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
0073535e
Commit
0073535e
authored
Dec 12, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
base recyclers adapters impl
parent
bf9e19df
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
80 additions
and
18 deletions
+80
-18
ScreenController.kt
...l/roompark/presentation/screen/albums/ScreenController.kt
+40
-10
ScreenDI.kt
...to/visual/roompark/presentation/screen/albums/ScreenDI.kt
+0
-2
ScreenPresenter.kt
...al/roompark/presentation/screen/albums/ScreenPresenter.kt
+0
-1
ScreenViewState.kt
...al/roompark/presentation/screen/albums/ScreenViewState.kt
+1
-1
AlbumListAdapter.kt
...mpark/presentation/screen/albums/util/AlbumListAdapter.kt
+34
-0
DevProgressPreviewAdapter.kt
...sentation/screen/feeds/utils/DevProgressPreviewAdapter.kt
+3
-1
Adapter.kt
...ual/roompark/presentation/screen/settings/util/Adapter.kt
+1
-1
ScreenController.kt
.../roompark/presentation/screen/web_cam/ScreenController.kt
+0
-1
albums_screen.xml
app/src/main/res/layout/albums_screen.xml
+1
-1
No files found.
app/src/main/java/com/biganto/visual/roompark/presentation/screen/albums/ScreenController.kt
View file @
0073535e
package
com.biganto.visual.roompark.presentation.screen.
web_cam
package
com.biganto.visual.roompark.presentation.screen.
albums
import
android.os.Bundle
import
android.os.Bundle
import
android.view.View
import
android.view.View
import
androidx.core.os.bundleOf
import
androidx.core.os.bundleOf
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
butterknife.BindView
import
butterknife.BindView
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.base.IBottomNavigation
import
com.biganto.visual.roompark.base.IBottomNavigation
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.conductor.BigantoBaseController
import
com.biganto.visual.roompark.conductor.BigantoBaseController
import
com.biganto.visual.roompark.presentation.screen.albums.AlbumsScreen
import
com.biganto.visual.roompark.presentation.screen.favorites.util.AlbumListAdapter
import
com.biganto.visual.roompark.presentation.screen.albums.AlbumsScreenPresenter
import
com.biganto.visual.roompark.presentation.screen.feeds.utils.AlbumsPreviewAdapter
import
com.biganto.visual.roompark.presentation.screen.albums.AlbumsScreenViewState
import
com.biganto.visual.roompark.util.view_utils.grid.CeilsDecoration
import
com.google.android.exoplayer2.SimpleExoPlayer
import
com.google.android.exoplayer2.ui.PlayerView
import
javax.inject.Inject
import
javax.inject.Inject
...
@@ -33,15 +33,39 @@ class AlbumsScreenController :
...
@@ -33,15 +33,39 @@ class AlbumsScreenController :
constructor
(
id
:
Int
)
:
super
(
bundleOf
(
SELECTED_ALBUM_INDEX_KEY
to
id
))
constructor
(
id
:
Int
)
:
super
(
bundleOf
(
SELECTED_ALBUM_INDEX_KEY
to
id
))
@BindView
(
R
.
id
.
webCamPlayerView
)
lateinit
var
playerView
:
PlayerView
lateinit
var
player
:
SimpleExoPlayer
@BindView
(
R
.
id
.
headers_recycler_view
)
lateinit
var
headersRecyclerView
:
RecyclerView
@BindView
(
R
.
id
.
albums_recycler_view
)
lateinit
var
albumsRecyclerView
:
RecyclerView
private
fun
bindRecycler
()
{
headersRecyclerView
.
isNestedScrollingEnabled
=
true
headersRecyclerView
.
layoutManager
=
LinearLayoutManager
(
activity
,
RecyclerView
.
HORIZONTAL
,
false
)
headersRecyclerView
.
adapter
=
AlbumsPreviewAdapter
()
headersRecyclerView
.
itemAnimator
=
null
if
(
headersRecyclerView
.
itemDecorationCount
==
0
)
headersRecyclerView
.
addItemDecoration
(
CeilsDecoration
(
1
,
resources
?.
getDimensionPixelSize
(
R
.
dimen
.
ceil_grid_padding
))
)
albumsRecyclerView
.
isNestedScrollingEnabled
=
true
albumsRecyclerView
.
layoutManager
=
LinearLayoutManager
(
activity
,
RecyclerView
.
VERTICAL
,
false
)
albumsRecyclerView
.
adapter
=
AlbumListAdapter
()
albumsRecyclerView
.
itemAnimator
=
null
}
override
fun
onViewBound
(
v
:
View
)
{
override
fun
onViewBound
(
v
:
View
)
{
toolBar
.
hideAll
()
toolBar
.
hideAll
()
bottomNavigation
.
hide
()
bottomNavigation
.
hide
()
bindRecycler
()
}
}
override
fun
injectDependencies
()
{
override
fun
injectDependencies
()
{
...
@@ -86,8 +110,14 @@ class AlbumsScreenController :
...
@@ -86,8 +110,14 @@ class AlbumsScreenController :
private
fun
render
(
viewState
:
AlbumsScreenViewState
.
SomeError
)
=
private
fun
render
(
viewState
:
AlbumsScreenViewState
.
SomeError
)
=
showError
(
viewState
.
exception
)
showError
(
viewState
.
exception
)
private
fun
render
(
viewState
:
AlbumsScreenViewState
.
AlbumsListLoaded
){
private
fun
render
(
viewState
:
AlbumsScreenViewState
.
AlbumsListLoaded
)
{
(
headersRecyclerView
.
adapter
as
AlbumsPreviewAdapter
).
setItems
(
viewState
.
list
)
headersRecyclerView
.
let
{
it
.
scrollToPosition
(
(
it
.
adapter
as
AlbumsPreviewAdapter
).
getItemPosition
(
viewState
.
selectedAlbumId
)
)
}
}
}
private
fun
render
(
viewState
:
AlbumsScreenViewState
.
AlbumsSelected
){
private
fun
render
(
viewState
:
AlbumsScreenViewState
.
AlbumsSelected
){
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/albums/ScreenDI.kt
View file @
0073535e
...
@@ -5,8 +5,6 @@ import com.biganto.visual.roompark.base.IBottomNavigation
...
@@ -5,8 +5,6 @@ import com.biganto.visual.roompark.base.IBottomNavigation
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.di.dagger.AppComponent
import
com.biganto.visual.roompark.di.dagger.AppComponent
import
com.biganto.visual.roompark.di.dagger.PerScreen
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.Binds
import
dagger.BindsInstance
import
dagger.BindsInstance
import
dagger.Component
import
dagger.Component
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/albums/ScreenPresenter.kt
View file @
0073535e
...
@@ -2,7 +2,6 @@ package com.biganto.visual.roompark.presentation.screen.albums
...
@@ -2,7 +2,6 @@ package com.biganto.visual.roompark.presentation.screen.albums
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.domain.interactor.AlbumssInteractor
import
com.biganto.visual.roompark.domain.interactor.AlbumssInteractor
import
com.biganto.visual.roompark.presentation.screen.web_cam.SELECTED_ALBUM_INDEX_KEY
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
io.reactivex.schedulers.Schedulers
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/albums/ScreenViewState.kt
View file @
0073535e
...
@@ -12,7 +12,7 @@ import com.biganto.visual.roompark.util.monades.ExceptionString
...
@@ -12,7 +12,7 @@ import com.biganto.visual.roompark.util.monades.ExceptionString
sealed
class
AlbumsScreenViewState
:
BigantoBaseViewState
()
{
sealed
class
AlbumsScreenViewState
:
BigantoBaseViewState
()
{
class
Idle
:
AlbumsScreenViewState
()
class
Idle
:
AlbumsScreenViewState
()
class
AlbumsListLoaded
(
val
list
:
List
<
AlbumPreviewModel
>,
val
selected
CamIndex
:
Int
)
:
AlbumsScreenViewState
()
class
AlbumsListLoaded
(
val
list
:
List
<
AlbumPreviewModel
>,
val
selected
AlbumId
:
Int
)
:
AlbumsScreenViewState
()
class
AlbumsSelected
(
val
list
:
List
<
AlbumSortedModel
>)
:
AlbumsScreenViewState
()
class
AlbumsSelected
(
val
list
:
List
<
AlbumSortedModel
>)
:
AlbumsScreenViewState
()
class
PhotoSelected
(
val
photoId
:
Int
)
:
AlbumsScreenViewState
()
class
PhotoSelected
(
val
photoId
:
Int
)
:
AlbumsScreenViewState
()
class
SomeError
(
val
exception
:
ExceptionString
)
:
AlbumsScreenViewState
()
class
SomeError
(
val
exception
:
ExceptionString
)
:
AlbumsScreenViewState
()
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/albums/util/AlbumListAdapter.kt
0 → 100644
View file @
0073535e
package
com.biganto.visual.roompark.presentation.screen.favorites.util
import
android.view.View
import
butterknife.BindView
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.domain.model.AlbumPhotoPreviewModel
import
com.biganto.visual.roompark.presentation.screen.settings.util.CommonRecyclerAdapter
import
com.biganto.visual.roompark.presentation.screen.settings.util.CommonViewHolder
import
com.google.android.material.textview.MaterialTextView
/**
* Created by Vladislav Bogdashkin on 16.10.2019.
*/
class
AlbumListAdapter
:
CommonRecyclerAdapter
<
AlbumViewHolder
,
AlbumPhotoPreviewModel
>()
{
override
val
vhKlazz
=
AlbumViewHolder
::
class
override
fun
getVhLayout
():
Int
=
R
.
layout
.
date_album_viewholder
}
class
AlbumViewHolder
(
itemView
:
View
)
:
CommonViewHolder
<
AlbumPhotoPreviewModel
>(
itemView
)
{
@BindView
(
R
.
id
.
date_title_textview
)
lateinit
var
albumTitle
:
MaterialTextView
// @BindView(R.id.camStatus) lateinit var camStatus: MaterialTextView
// @BindView(R.id.camStatusIcon) lateinit var camStatusIcon:ImageView
override
fun
onViewBound
(
model
:
AlbumPhotoPreviewModel
)
{
albumTitle
.
text
=
model
.
title
// camTitle.text = model.title
// camStatus.text = if (model.streams.isNullOrEmpty()) "ОФФЛАЙН" else "ОНЛАЙН"
// camStatusIcon.visibility = if (model.streams.isNullOrEmpty()) View.GONE else View.VISIBLE
}
}
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/utils/DevProgressPreviewAdapter.kt
View file @
0073535e
...
@@ -19,9 +19,11 @@ class AlbumsPreviewAdapter : CommonRecyclerAdapter<AlbumCardViewHolder,AlbumPrev
...
@@ -19,9 +19,11 @@ class AlbumsPreviewAdapter : CommonRecyclerAdapter<AlbumCardViewHolder,AlbumPrev
override
val
vhKlazz
=
AlbumCardViewHolder
::
class
override
val
vhKlazz
=
AlbumCardViewHolder
::
class
override
fun
getVhLayout
():
Int
=
R
.
layout
.
estate_card_viewholder
fun
getItemPosition
(
model
:
AlbumPreviewModel
)
=
getItemPosition
(
model
.
albumId
)
override
fun
getVhLayout
():
Int
=
R
.
layout
.
estate_card_viewholder
fun
getItemPosition
(
modelId
:
Int
)=
list
.
indexOfFirst
{
it
.
albumId
==
modelId
}
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/settings/util/Adapter.kt
View file @
0073535e
...
@@ -32,7 +32,7 @@ abstract class CommonRecyclerAdapter<VH:CommonViewHolder<M>,M:Any> : RecyclerVie
...
@@ -32,7 +32,7 @@ abstract class CommonRecyclerAdapter<VH:CommonViewHolder<M>,M:Any> : RecyclerVie
val
onItemClicked
:
Observable
<
M
>
val
onItemClicked
:
Observable
<
M
>
get
()
=
onModelClicked
get
()
=
onModelClicked
pr
ivate
var
list
:
MutableList
<
M
>
=
mutableListOf
()
pr
otected
var
list
:
MutableList
<
M
>
=
mutableListOf
()
fun
setItems
(
items
:
List
<
M
>){
fun
setItems
(
items
:
List
<
M
>){
this
.
list
.
clear
()
this
.
list
.
clear
()
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/web_cam/ScreenController.kt
View file @
0073535e
...
@@ -13,7 +13,6 @@ import com.biganto.visual.roompark.conductor.BigantoBaseController
...
@@ -13,7 +13,6 @@ import com.biganto.visual.roompark.conductor.BigantoBaseController
import
com.google.android.exoplayer2.ExoPlayerFactory
import
com.google.android.exoplayer2.ExoPlayerFactory
import
com.google.android.exoplayer2.SimpleExoPlayer
import
com.google.android.exoplayer2.SimpleExoPlayer
import
com.google.android.exoplayer2.ext.rtmp.RtmpDataSourceFactory
import
com.google.android.exoplayer2.ext.rtmp.RtmpDataSourceFactory
import
com.google.android.exoplayer2.extractor.DefaultExtractorsFactory
import
com.google.android.exoplayer2.extractor.ts.DefaultTsPayloadReaderFactory
import
com.google.android.exoplayer2.extractor.ts.DefaultTsPayloadReaderFactory
import
com.google.android.exoplayer2.source.MediaSource
import
com.google.android.exoplayer2.source.MediaSource
import
com.google.android.exoplayer2.source.ProgressiveMediaSource
import
com.google.android.exoplayer2.source.ProgressiveMediaSource
...
...
app/src/main/res/layout/albums_screen.xml
View file @
0073535e
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<androidx.recyclerview.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/
recyclerView2
"
android:id=
"@+id/
albums_recycler_view
"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_height=
"0dp"
android:layout_marginStart=
"16dp"
android:layout_marginStart=
"16dp"
...
...
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