Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Room Park Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladislav Bogdashkin
Room Park Android
Commits
94e478fa
Commit
94e478fa
authored
Dec 09, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
view patterns added
parent
52e38547
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
334 additions
and
1 deletion
+334
-1
albums.kt
...a/com/biganto/visual/roompark/domain/interactor/albums.kt
+25
-0
ScreenContract.kt
...ual/roompark/presentation/screen/albums/ScreenContract.kt
+11
-0
ScreenController.kt
...l/roompark/presentation/screen/albums/ScreenController.kt
+100
-0
ScreenDI.kt
...to/visual/roompark/presentation/screen/albums/ScreenDI.kt
+50
-0
ScreenPresenter.kt
...al/roompark/presentation/screen/albums/ScreenPresenter.kt
+37
-0
ScreenViewState.kt
...al/roompark/presentation/screen/albums/ScreenViewState.kt
+19
-0
album_preview_card_viewholder.xml
app/src/main/res/layout/album_preview_card_viewholder.xml
+2
-1
albums_screen.xml
app/src/main/res/layout/albums_screen.xml
+70
-0
date_album_viewholder.xml
app/src/main/res/layout/date_album_viewholder.xml
+20
-0
No files found.
app/src/main/java/com/biganto/visual/roompark/domain/interactor/albums.kt
0 → 100644
View file @
94e478fa
package
com.biganto.visual.roompark.domain.interactor
import
com.biganto.visual.roompark.domain.model.AlbumsListModel
import
com.biganto.visual.roompark.domain.use_case.AlbumsUseCase
import
com.biganto.visual.roompark.domain.use_case.CamsUseCase
import
io.reactivex.Observable
import
javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 09.10.2019.
*/
class
AlbumssInteractor
@Inject
constructor
(
private
val
useCase
:
AlbumsUseCase
)
{
fun
fetchHeaderAlbums
()
=
useCase
.
getProgressAlbums
()
fun
fetchAlbumPhotos
(
parentId
:
Int
)
=
useCase
.
getChildAlbum
(
parentId
)
}
app/src/main/java/com/biganto/visual/roompark/presentation/screen/albums/ScreenContract.kt
0 → 100644
View file @
94e478fa
package
com.biganto.visual.roompark.presentation.screen.albums
import
com.biganto.visual.roompark.conductor.BigantoBaseContract
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
interface
AlbumsScreen
:
BigantoBaseContract
<
AlbumsScreenViewState
>
{
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/albums/ScreenController.kt
0 → 100644
View file @
94e478fa
package
com.biganto.visual.roompark.presentation.screen.web_cam
import
android.os.Bundle
import
android.view.View
import
androidx.core.os.bundleOf
import
butterknife.BindView
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.base.IBottomNavigation
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.conductor.BigantoBaseController
import
com.biganto.visual.roompark.presentation.screen.albums.AlbumsScreen
import
com.biganto.visual.roompark.presentation.screen.albums.AlbumsScreenPresenter
import
com.biganto.visual.roompark.presentation.screen.albums.AlbumsScreenViewState
import
com.google.android.exoplayer2.SimpleExoPlayer
import
com.google.android.exoplayer2.ui.PlayerView
import
javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
const
val
SELECTED_ALBUM_INDEX_KEY
=
"SELECTED_ALBUM_INDEX"
class
AlbumsScreenController
:
BigantoBaseController
<
AlbumsScreenViewState
,
AlbumsScreen
,
AlbumsScreenPresenter
>
,
AlbumsScreen
{
constructor
(
args
:
Bundle
):
super
(
args
)
constructor
(
id
:
Int
)
:
super
(
bundleOf
(
SELECTED_CAM_INDEX_KEY
to
id
))
@BindView
(
R
.
id
.
webCamPlayerView
)
lateinit
var
playerView
:
PlayerView
lateinit
var
player
:
SimpleExoPlayer
override
fun
onViewBound
(
v
:
View
)
{
toolBar
.
hideAll
()
bottomNavigation
.
hide
()
}
override
fun
injectDependencies
()
{
getComponent
()
}
@Inject
override
lateinit
var
injectedPresenter
:
AlbumsScreenPresenter
// @Inject
// lateinit var snacky:ISnackBarProvider
lateinit
var
rpActivity
:
RoomParkMainActivity
fun
getComponent
()
=
DaggerAlbumsScreenComponent
.
factory
()
.
create
(
RoomParkApplication
.
component
,
activity
as
RoomParkMainActivity
,
args
.
getInt
(
SELECTED_CAM_INDEX_KEY
))
.
inject
(
this
)
// @Inject
// lateinit var ac: RoomParkMainActivity
@Inject
lateinit
var
bottomNavigation
:
IBottomNavigation
override
fun
render
(
viewState
:
AlbumsScreenViewState
)
{
when
(
viewState
){
is
AlbumsScreenViewState
.
Idle
->
render
(
viewState
)
is
AlbumsScreenViewState
.
AlbumsSelected
->
render
(
viewState
)
is
AlbumsScreenViewState
.
AlbumsListLoaded
->
render
(
viewState
)
is
AlbumsScreenViewState
.
SomeError
->
render
(
viewState
)
}
}
private
fun
render
(
viewState
:
AlbumsScreenViewState
.
Idle
){
}
private
fun
render
(
viewState
:
AlbumsScreenViewState
.
SomeError
)
=
showError
(
viewState
.
exception
)
private
fun
render
(
viewState
:
AlbumsScreenViewState
.
AlbumsListLoaded
){
}
private
fun
render
(
viewState
:
AlbumsScreenViewState
.
AlbumsSelected
){
}
override
fun
getLayoutId
():
Int
=
R
.
layout
.
prog
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/albums/ScreenDI.kt
0 → 100644
View file @
94e478fa
package
com.biganto.visual.roompark.presentation.screen.albums
import
android.content.Context
import
com.biganto.visual.roompark.base.IBottomNavigation
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.di.dagger.AppComponent
import
com.biganto.visual.roompark.di.dagger.PerScreen
import
com.biganto.visual.roompark.presentation.screen.web_cam.AlbumsScreenController
import
com.biganto.visual.roompark.presentation.screen.web_cam.SELECTED_ALBUM_INDEX_KEY
import
dagger.Binds
import
dagger.BindsInstance
import
dagger.Component
import
dagger.Module
import
javax.inject.Named
///**
// * Created by Vladislav Bogdashkin on 30.09.2019.
// */
@PerScreen
@Component
(
modules
=
[
AlbumsScreenModule
::
class
]
,
dependencies
=
[
AppComponent
::
class
]
)
interface
AlbumsScreenComponent
{
@Component
.
Factory
interface
Factory
{
fun
create
(
appComponent
:
AppComponent
,
@BindsInstance
activity
:
RoomParkMainActivity
,
@BindsInstance
@Named
(
SELECTED_ALBUM_INDEX_KEY
)
camIndex
:
Int
):
AlbumsScreenComponent
}
fun
inject
(
controller
:
AlbumsScreenController
)
}
@Module
abstract
class
AlbumsScreenModule
{
@PerScreen
@Binds
abstract
fun
provideContext
(
activity
:
RoomParkMainActivity
):
Context
@PerScreen
@Binds
abstract
fun
provideBottomNavigation
(
activitiy
:
RoomParkMainActivity
):
IBottomNavigation
}
app/src/main/java/com/biganto/visual/roompark/presentation/screen/albums/ScreenPresenter.kt
0 → 100644
View file @
94e478fa
package
com.biganto.visual.roompark.presentation.screen.albums
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.domain.interactor.AlbumssInteractor
import
com.biganto.visual.roompark.presentation.screen.web_cam.SELECTED_CAM_INDEX_KEY
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
javax.inject.Inject
import
javax.inject.Named
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
class
AlbumsScreenPresenter
@Inject
constructor
(
private
val
interactor
:
AlbumssInteractor
,
@Named
(
SELECTED_CAM_INDEX_KEY
)
private
var
selectedCamIndex
:
Int
)
:
BigantoBasePresenter
<
AlbumsScreen
,
AlbumsScreenViewState
>()
{
override
fun
defaultErrorViewStateHandler
()
=
{
e
:
ExceptionString
->
AlbumsScreenViewState
.
SomeError
(
e
)
}
override
fun
bindIntents
()
{
val
state
=
restoreStateObservable
.
mergeWith
(
interactor
.
fetchCams
()
.
map
{
AlbumsScreenViewState
.
AlbumsListLoaded
(
it
.
items
.
toList
(),
selectedCamIndex
)}
)
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
subscribeViewState
(
state
.
cast
(
AlbumsScreenViewState
::
class
.
java
),
AlbumsScreen
::
render
)
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/albums/ScreenViewState.kt
0 → 100644
View file @
94e478fa
package
com.biganto.visual.roompark.presentation.screen.albums
import
com.biganto.visual.roompark.conductor.BigantoBaseViewState
import
com.biganto.visual.roompark.domain.model.AlbumPhotoPreviewModel
import
com.biganto.visual.roompark.domain.model.AlbumPreviewModel
import
com.biganto.visual.roompark.util.monades.ExceptionString
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
sealed
class
AlbumsScreenViewState
:
BigantoBaseViewState
()
{
class
Idle
:
AlbumsScreenViewState
()
class
AlbumsListLoaded
(
val
list
:
List
<
AlbumPreviewModel
>,
val
selectedCamIndex
:
Int
)
:
AlbumsScreenViewState
()
class
AlbumsSelected
(
val
list
:
List
<
AlbumPhotoPreviewModel
>)
:
AlbumsScreenViewState
()
class
PhotoSelected
(
val
photoId
:
Int
)
:
AlbumsScreenViewState
()
class
SomeError
(
val
exception
:
ExceptionString
)
:
AlbumsScreenViewState
()
}
\ No newline at end of file
app/src/main/res/layout/album_preview_card_viewholder.xml
View file @
94e478fa
...
@@ -4,7 +4,8 @@
...
@@ -4,7 +4,8 @@
android:layout_width=
"142dp"
android:layout_width=
"142dp"
android:layout_height=
"94dp"
android:layout_height=
"94dp"
android:layout_margin=
"16dp"
android:layout_margin=
"16dp"
app:cardElevation=
"2dp"
app:cardElevation=
"4dp"
app:cardMaxElevation=
"6dp"
app:cardForegroundColor=
"#00000000"
app:cardForegroundColor=
"#00000000"
app:cardPreventCornerOverlap=
"false"
app:cardPreventCornerOverlap=
"false"
app:cardUseCompatPadding=
"false"
>
app:cardUseCompatPadding=
"false"
>
...
...
app/src/main/res/layout/albums_screen.xml
0 → 100644
View file @
94e478fa
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/container"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/colorOpacityBackground"
android:orientation=
"vertical"
>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/recyclerView2"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_marginStart=
"16dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/include12"
tools:itemCount=
"3"
tools:listitem=
"@layout/date_album_viewholder"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/headers_recycler_view"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@color/colorPrimary"
android:orientation=
"horizontal"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:itemCount=
"1"
tools:listitem=
"@layout/estate_card_viewholder"
/>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/header_album_title"
style=
"@style/Header_TextView.Inverted_Header"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"16dp"
android:layout_marginTop=
"32dp"
android:gravity=
"center_vertical"
android:text=
"Дом №1"
android:textAlignment=
"viewStart"
app:layout_constraintEnd_toStartOf=
"@+id/include"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/headers_recycler_view"
/>
<include
android:id=
"@+id/include"
layout=
"@layout/bell_switch_view"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"32dp"
android:layout_marginEnd=
"16dp"
app:layout_constraintBottom_toBottomOf=
"@+id/header_album_title"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/headers_recycler_view"
/>
<include
android:id=
"@+id/include12"
layout=
"@layout/horizontal_divider"
android:layout_width=
"0dp"
android:layout_height=
"1dp"
android:layout_marginTop=
"16dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/header_album_title"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/date_album_viewholder.xml
0 → 100644
View file @
94e478fa
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<com.google.android.material.textview.MaterialTextView
style=
"@style/Common_Text.Inverted"
android:id=
"@+id/date_title_textview"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"TextView"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/photos_recycler_iew"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:layout_marginBottom=
"16dp"
android:orientation=
"vertical"
/>
</LinearLayout>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment