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
5d14095e
Commit
5d14095e
authored
Dec 01, 2019
by
Vladislav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added item selected impls
parent
6f081dd0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
3 deletions
+76
-3
ScreenContract.kt
...sual/roompark/presentation/screen/feeds/ScreenContract.kt
+6
-0
ScreenController.kt
...al/roompark/presentation/screen/feeds/ScreenController.kt
+45
-3
ScreenPresenter.kt
...ual/roompark/presentation/screen/feeds/ScreenPresenter.kt
+19
-0
ScreenViewState.kt
...ual/roompark/presentation/screen/feeds/ScreenViewState.kt
+6
-0
No files found.
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenContract.kt
View file @
5d14095e
package
com.biganto.visual.roompark.presentation.screen.feeds
package
com.biganto.visual.roompark.presentation.screen.feeds
import
com.biganto.visual.roompark.conductor.BigantoBaseContract
import
com.biganto.visual.roompark.conductor.BigantoBaseContract
import
com.biganto.visual.roompark.domain.model.AlbumPreviewModel
import
com.biganto.visual.roompark.domain.model.ArticlePreviewModel
import
com.biganto.visual.roompark.domain.model.FeedModel
import
com.biganto.visual.roompark.domain.model.FeedModel
import
com.biganto.visual.roompark.domain.model.WebCamModel
import
io.reactivex.Observable
import
io.reactivex.Observable
/**
/**
...
@@ -12,6 +15,9 @@ interface FeedsScreen : BigantoBaseContract<FeedsScreenViewState> {
...
@@ -12,6 +15,9 @@ interface FeedsScreen : BigantoBaseContract<FeedsScreenViewState> {
fun
feedsTabSelected
():
Observable
<
Int
>
fun
feedsTabSelected
():
Observable
<
Int
>
fun
requsetsNewArticles
():
Observable
<
Pair
<
FeedModel
,
Int
>>
fun
requsetsNewArticles
():
Observable
<
Pair
<
FeedModel
,
Int
>>
fun
onAllFeedArticles
():
Observable
<
FeedModel
>
fun
onAllFeedArticles
():
Observable
<
FeedModel
>
fun
onCameraSelected
():
Observable
<
WebCamModel
>
fun
onArticleSelected
():
Observable
<
ArticlePreviewModel
>
fun
onAlbumSelected
():
Observable
<
AlbumPreviewModel
>
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenController.kt
View file @
5d14095e
...
@@ -10,7 +10,10 @@ import com.biganto.visual.roompark.R
...
@@ -10,7 +10,10 @@ import com.biganto.visual.roompark.R
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.domain.model.AlbumPreviewModel
import
com.biganto.visual.roompark.domain.model.ArticlePreviewModel
import
com.biganto.visual.roompark.domain.model.FeedModel
import
com.biganto.visual.roompark.domain.model.FeedModel
import
com.biganto.visual.roompark.domain.model.WebCamModel
import
com.biganto.visual.roompark.presentation.screen.feed_list.ArticlesScreenController
import
com.biganto.visual.roompark.presentation.screen.feed_list.ArticlesScreenController
import
com.biganto.visual.roompark.presentation.screen.feeds.utils.AlbumsPreviewAdapter
import
com.biganto.visual.roompark.presentation.screen.feeds.utils.AlbumsPreviewAdapter
import
com.biganto.visual.roompark.presentation.screen.feeds.utils.ArticlesPreviewAdapter
import
com.biganto.visual.roompark.presentation.screen.feeds.utils.ArticlesPreviewAdapter
...
@@ -38,6 +41,24 @@ class FeedsScreenController :
...
@@ -38,6 +41,24 @@ class FeedsScreenController :
,
FeedsScreenPresenter
>()
,
FeedsScreenPresenter
>()
,
FeedsScreen
{
,
FeedsScreen
{
override
fun
onCameraSelected
():
Observable
<
WebCamModel
>
=
(
camsRecyclerView
.
adapter
as
CamsListAdapter
).
onItemClicked
.
debounce
(
120L
,
TimeUnit
.
MILLISECONDS
)
.
observeOn
(
AndroidSchedulers
.
mainThread
())
override
fun
onArticleSelected
():
Observable
<
ArticlePreviewModel
>
=
(
feedsRecyclerView
.
adapter
as
ArticlesPreviewAdapter
).
onItemClicked
.
debounce
(
120L
,
TimeUnit
.
MILLISECONDS
)
.
observeOn
(
AndroidSchedulers
.
mainThread
())
override
fun
onAlbumSelected
():
Observable
<
AlbumPreviewModel
>
=
(
devProgressRecyclerView
.
adapter
as
AlbumsPreviewAdapter
).
onItemClicked
.
debounce
(
120L
,
TimeUnit
.
MILLISECONDS
)
.
observeOn
(
AndroidSchedulers
.
mainThread
())
override
fun
feedsTabSelected
():
Observable
<
Int
>
override
fun
feedsTabSelected
():
Observable
<
Int
>
=
feedsTabs
.
selections
()
=
feedsTabs
.
selections
()
.
debounce
(
200L
,
TimeUnit
.
MILLISECONDS
)
.
debounce
(
200L
,
TimeUnit
.
MILLISECONDS
)
...
@@ -114,8 +135,8 @@ class FeedsScreenController :
...
@@ -114,8 +135,8 @@ class FeedsScreenController :
override
fun
onAllFeedArticles
():
Observable
<
FeedModel
>
=
override
fun
onAllFeedArticles
():
Observable
<
FeedModel
>
=
allFeedArticles
.
clicks
()
allFeedArticles
.
clicks
()
.
map
{
feedsTabs
.
getTabAt
(
feedsTabs
.
selectedTabPosition
)}
.
map
{
feedsTabs
.
getTabAt
(
feedsTabs
.
selectedTabPosition
)}
.
map
{
storedFeedsList
[
it
.
position
]
}
.
map
{
storedFeedsList
[
it
.
position
]
}
override
fun
onViewBound
(
v
:
View
)
{
override
fun
onViewBound
(
v
:
View
)
{
toolBar
.
hideAll
()
toolBar
.
hideAll
()
...
@@ -135,6 +156,9 @@ class FeedsScreenController :
...
@@ -135,6 +156,9 @@ class FeedsScreenController :
is
FeedsScreenViewState
.
GetFeedArticlesPreview
->
render
(
viewState
)
is
FeedsScreenViewState
.
GetFeedArticlesPreview
->
render
(
viewState
)
is
FeedsScreenViewState
.
RestoreView
->
render
(
viewState
)
is
FeedsScreenViewState
.
RestoreView
->
render
(
viewState
)
is
FeedsScreenViewState
.
ToArticlesScreen
->
render
(
viewState
)
is
FeedsScreenViewState
.
ToArticlesScreen
->
render
(
viewState
)
is
FeedsScreenViewState
.
ToWebCam
->
render
(
viewState
)
is
FeedsScreenViewState
.
ToArticle
->
render
(
viewState
)
is
FeedsScreenViewState
.
ToAlbum
->
render
(
viewState
)
is
FeedsScreenViewState
.
SomeError
->
render
(
viewState
)
is
FeedsScreenViewState
.
SomeError
->
render
(
viewState
)
}
}
}
}
...
@@ -151,7 +175,25 @@ class FeedsScreenController :
...
@@ -151,7 +175,25 @@ class FeedsScreenController :
)
)
}
}
private
fun
render
(
viewState
:
FeedsScreenViewState
.
SomeError
)
=
private
fun
render
(
viewState
:
FeedsScreenViewState
.
ToWebCam
)
{
TODO
(
"to webcam screen"
)
// router.pushController(
// RouterTransaction.with(ArticlesScreenController(viewState.feedId))
// .popChangeHandler(FadeChangeHandler())
// .pushChangeHandler(FadeChangeHandler())
// )
}
private
fun
render
(
viewState
:
FeedsScreenViewState
.
ToArticle
)
{
TODO
(
"to article screen"
)
}
private
fun
render
(
viewState
:
FeedsScreenViewState
.
ToAlbum
)
{
TODO
(
"to album screen"
)
}
private
fun
render
(
viewState
:
FeedsScreenViewState
.
SomeError
)
=
showError
(
viewState
.
exception
)
showError
(
viewState
.
exception
)
private
fun
allFeedName
(
feedId
:
Int
)
=
if
(
feedId
==
1
)
"НОВОСТИ"
else
"БЛОГИ"
private
fun
allFeedName
(
feedId
:
Int
)
=
if
(
feedId
==
1
)
"НОВОСТИ"
else
"БЛОГИ"
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenPresenter.kt
View file @
5d14095e
...
@@ -73,6 +73,22 @@ class FeedsScreenPresenter @Inject constructor(
...
@@ -73,6 +73,22 @@ class FeedsScreenPresenter @Inject constructor(
}
}
.
onErrorReturn
(
::
parseError
)
.
onErrorReturn
(
::
parseError
)
val
selectCamera
=
intent
(
FeedsScreen
::
onCameraSelected
)
.
map
<
FeedsScreenViewState
>
{
FeedsScreenViewState
.
ToWebCam
(
it
.
index
,
it
.
streamUrl
)
}
val
selectArticle
=
intent
(
FeedsScreen
::
onArticleSelected
)
.
map
<
FeedsScreenViewState
>
{
FeedsScreenViewState
.
ToArticle
(
it
.
articleId
)
}
val
selectAlbum
=
intent
(
FeedsScreen
::
onAlbumSelected
)
.
map
<
FeedsScreenViewState
>
{
FeedsScreenViewState
.
ToAlbum
(
it
.
albumId
)
}
val
getNewArticlesPage
=
intent
(
FeedsScreen
::
requsetsNewArticles
)
val
getNewArticlesPage
=
intent
(
FeedsScreen
::
requsetsNewArticles
)
.
flatMap
{
interactor
.
fetchArticles
(
it
.
first
.
feedId
,
FEED_PREVIEW_PAGE_SIZE
,
it
.
second
)
}
.
flatMap
{
interactor
.
fetchArticles
(
it
.
first
.
feedId
,
FEED_PREVIEW_PAGE_SIZE
,
it
.
second
)
}
.
map
<
FeedsScreenViewState
>
{
.
map
<
FeedsScreenViewState
>
{
...
@@ -89,6 +105,9 @@ class FeedsScreenPresenter @Inject constructor(
...
@@ -89,6 +105,9 @@ class FeedsScreenPresenter @Inject constructor(
.
mergeWith
(
fetchCams
)
.
mergeWith
(
fetchCams
)
.
mergeWith
(
getNewArticlesPage
)
.
mergeWith
(
getNewArticlesPage
)
.
mergeWith
(
switchToAllArtiles
)
.
mergeWith
(
switchToAllArtiles
)
.
mergeWith
(
selectCamera
)
.
mergeWith
(
selectAlbum
)
.
mergeWith
(
selectArticle
)
.
doOnError
{
Timber
.
e
(
it
)}
.
doOnError
{
Timber
.
e
(
it
)}
.
subscribeOn
(
Schedulers
.
io
())
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenViewState.kt
View file @
5d14095e
...
@@ -26,6 +26,12 @@ sealed class FeedsScreenViewState : BigantoBaseViewState() {
...
@@ -26,6 +26,12 @@ sealed class FeedsScreenViewState : BigantoBaseViewState() {
class
SomeError
(
val
exception
:
ExceptionString
)
:
FeedsScreenViewState
()
class
SomeError
(
val
exception
:
ExceptionString
)
:
FeedsScreenViewState
()
class
ToArticlesScreen
(
val
feedId
:
Int
)
:
FeedsScreenViewState
()
class
ToArticlesScreen
(
val
feedId
:
Int
)
:
FeedsScreenViewState
()
class
ToArticle
(
val
articleId
:
Int
)
:
FeedsScreenViewState
()
class
ToAlbum
(
val
albumId
:
Int
)
:
FeedsScreenViewState
()
class
ToWebCam
(
val
camId
:
Int
,
val
camUrl
:
String
)
:
FeedsScreenViewState
()
}
}
data class
RestoreModel
(
data class
RestoreModel
(
...
...
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