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
c8a42b8d
Commit
c8a42b8d
authored
Mar 23, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
photo dialog on screen
feed screen scroller improve scroll reachability
parent
f387e3f6
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
69 additions
and
3 deletions
+69
-3
articles.kt
...com/biganto/visual/roompark/domain/interactor/articles.kt
+4
-0
ScreenContract.kt
...al/roompark/presentation/screen/article/ScreenContract.kt
+2
-0
ScreenController.kt
.../roompark/presentation/screen/article/ScreenController.kt
+19
-0
ScreenPresenter.kt
...l/roompark/presentation/screen/article/ScreenPresenter.kt
+3
-0
ScreenContract.kt
.../roompark/presentation/screen/feed_list/ScreenContract.kt
+2
-0
ScreenController.kt
...oompark/presentation/screen/feed_list/ScreenController.kt
+24
-0
ScreenPresenter.kt
...roompark/presentation/screen/feed_list/ScreenPresenter.kt
+12
-0
ScreenViewState.kt
...roompark/presentation/screen/feed_list/ScreenViewState.kt
+1
-0
ScreenController.kt
...al/roompark/presentation/screen/feeds/ScreenController.kt
+1
-2
ScreenPresenter.kt
...ual/roompark/presentation/screen/feeds/ScreenPresenter.kt
+1
-1
No files found.
app/src/main/java/com/biganto/visual/roompark/domain/interactor/articles.kt
View file @
c8a42b8d
...
@@ -13,6 +13,10 @@ class ArticlesInteractor @Inject constructor(
...
@@ -13,6 +13,10 @@ class ArticlesInteractor @Inject constructor(
fun
fetchArticles
(
feed
:
String
)
=
fun
fetchArticles
(
feed
:
String
)
=
uc
.
getArticles
(
feed
)
uc
.
getArticles
(
feed
)
fun
fetchArticlesPage
(
feed
:
String
,
pageSize
:
Int
,
current
:
Int
)
=
uc
.
fetchArticlesPage
(
feed
,
pageSize
,
current
)
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/article/ScreenContract.kt
View file @
c8a42b8d
package
com.biganto.visual.roompark.presentation.screen.article
package
com.biganto.visual.roompark.presentation.screen.article
import
com.biganto.visual.roompark.conductor.BigantoBaseContract
import
com.biganto.visual.roompark.conductor.BigantoBaseContract
import
com.biganto.visual.roompark.domain.model.FeedModel
import
io.reactivex.Observable
/**
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
* Created by Vladislav Bogdashkin on 30.09.2019.
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/article/ScreenController.kt
View file @
c8a42b8d
...
@@ -13,15 +13,23 @@ import com.biganto.visual.roompark.R
...
@@ -13,15 +13,23 @@ 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.conductor.dialogs.PhotoDialogController
import
com.biganto.visual.roompark.conductor.dialogs.change_handler.DialogChangeHandler
import
com.biganto.visual.roompark.domain.model.FeedModel
import
com.biganto.visual.roompark.presentation.screen.article.util.ArticleBottomPhotoAdapter
import
com.biganto.visual.roompark.presentation.screen.article.util.ArticleBottomPhotoAdapter
import
com.biganto.visual.roompark.presentation.screen.article.util.HtmlPageAdapter
import
com.biganto.visual.roompark.presentation.screen.article.util.HtmlPageAdapter
import
com.biganto.visual.roompark.presentation.screen.article.util.HtmlTag
import
com.biganto.visual.roompark.presentation.screen.article.util.HtmlTag
import
com.biganto.visual.roompark.util.extensions.formatToSimple
import
com.biganto.visual.roompark.util.extensions.formatToSimple
import
com.bluelinelabs.conductor.RouterTransaction
import
com.bumptech.glide.Glide
import
com.bumptech.glide.Glide
import
com.bumptech.glide.load.engine.DiskCacheStrategy
import
com.bumptech.glide.load.engine.DiskCacheStrategy
import
com.google.android.material.textview.MaterialTextView
import
com.google.android.material.textview.MaterialTextView
import
com.jakewharton.rxbinding3.recyclerview.scrollStateChanges
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
import
jp.wasabeef.glide.transformations.BlurTransformation
import
jp.wasabeef.glide.transformations.BlurTransformation
import
timber.log.Timber
import
timber.log.Timber
import
java.util.concurrent.TimeUnit
import
javax.inject.Inject
import
javax.inject.Inject
...
@@ -45,6 +53,7 @@ class ArticleScreenController :
...
@@ -45,6 +53,7 @@ class ArticleScreenController :
getComponent
()
getComponent
()
}
}
@Inject
@Inject
override
lateinit
var
injectedPresenter
:
ArticleScreenPresenter
override
lateinit
var
injectedPresenter
:
ArticleScreenPresenter
...
@@ -95,6 +104,16 @@ class ArticleScreenController :
...
@@ -95,6 +104,16 @@ class ArticleScreenController :
toolBar
.
setToolbar
()
toolBar
.
setToolbar
()
bottomNavigationController
.
hide
()
bottomNavigationController
.
hide
()
bindRecycler
()
bindRecycler
()
detachDisposable
.
add
(
(
bottomPhotosRecyclerView
.
adapter
as
ArticleBottomPhotoAdapter
)
.
onItemClicked
.
subscribe
{
router
.
pushController
(
RouterTransaction
.
with
(
PhotoDialogController
(
it
.
url
))
.
pushChangeHandler
(
DialogChangeHandler
())
.
popChangeHandler
(
DialogChangeHandler
())
)
}
)
}
}
override
fun
render
(
viewState
:
ArticleScreenViewState
)
{
override
fun
render
(
viewState
:
ArticleScreenViewState
)
{
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/article/ScreenPresenter.kt
View file @
c8a42b8d
...
@@ -2,6 +2,9 @@ package com.biganto.visual.roompark.presentation.screen.article
...
@@ -2,6 +2,9 @@ package com.biganto.visual.roompark.presentation.screen.article
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.domain.interactor.ArticleInteractor
import
com.biganto.visual.roompark.domain.interactor.ArticleInteractor
import
com.biganto.visual.roompark.presentation.screen.feeds.FEED_PREVIEW_PAGE_SIZE
import
com.biganto.visual.roompark.presentation.screen.feeds.FeedsScreen
import
com.biganto.visual.roompark.presentation.screen.feeds.FeedsScreenViewState
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
io.reactivex.Observable
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.android.schedulers.AndroidSchedulers
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feed_list/ScreenContract.kt
View file @
c8a42b8d
package
com.biganto.visual.roompark.presentation.screen.feed_list
package
com.biganto.visual.roompark.presentation.screen.feed_list
import
com.biganto.visual.roompark.conductor.BigantoBaseContract
import
com.biganto.visual.roompark.conductor.BigantoBaseContract
import
io.reactivex.Observable
/**
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
*/
interface
ArticlesScreen
:
BigantoBaseContract
<
ArticlesScreenViewState
>
{
interface
ArticlesScreen
:
BigantoBaseContract
<
ArticlesScreenViewState
>
{
fun
requsetsNewArticles
():
Observable
<
Int
>
}
}
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feed_list/ScreenController.kt
View file @
c8a42b8d
...
@@ -3,6 +3,7 @@ package com.biganto.visual.roompark.presentation.screen.feed_list
...
@@ -3,6 +3,7 @@ package com.biganto.visual.roompark.presentation.screen.feed_list
import
android.view.View
import
android.view.View
import
android.widget.ProgressBar
import
android.widget.ProgressBar
import
androidx.core.os.bundleOf
import
androidx.core.os.bundleOf
import
androidx.core.view.isNotEmpty
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
androidx.recyclerview.widget.RecyclerView
import
butterknife.BindView
import
butterknife.BindView
...
@@ -17,7 +18,11 @@ import com.biganto.visual.roompark.util.extensions.setGone
...
@@ -17,7 +18,11 @@ import com.biganto.visual.roompark.util.extensions.setGone
import
com.biganto.visual.roompark.util.view_utils.grid.CeilsDecoration
import
com.biganto.visual.roompark.util.view_utils.grid.CeilsDecoration
import
com.bluelinelabs.conductor.RouterTransaction
import
com.bluelinelabs.conductor.RouterTransaction
import
com.google.android.material.textview.MaterialTextView
import
com.google.android.material.textview.MaterialTextView
import
com.jakewharton.rxbinding3.recyclerview.scrollStateChanges
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
import
timber.log.Timber
import
timber.log.Timber
import
java.util.concurrent.TimeUnit
import
javax.inject.Inject
import
javax.inject.Inject
/**
/**
...
@@ -37,6 +42,17 @@ class ArticlesScreenController :
...
@@ -37,6 +42,17 @@ class ArticlesScreenController :
constructor
(
feedAlias
:
String
):
super
(
bundleOf
(
FEED_ALIAS
to
feedAlias
))
constructor
(
feedAlias
:
String
):
super
(
bundleOf
(
FEED_ALIAS
to
feedAlias
))
override
fun
requsetsNewArticles
():
Observable
<
Int
>
=
articlesRecyclerView
.
scrollStateChanges
()
.
filter
{
it
==
RecyclerView
.
SCROLL_STATE_IDLE
}
.
map
{
articlesRecyclerView
.
layoutManager
as
LinearLayoutManager
}
.
map
{
it
.
findLastCompletelyVisibleItemPosition
()
}
.
filter
{
articlesRecyclerView
.
isNotEmpty
()
}
.
filter
{
it
>(
articlesRecyclerView
.
adapter
?.
itemCount
?:
0
)-
4
}
.
map
{
articlesRecyclerView
.
adapter
?.
itemCount
?:
0
}
.
debounce
(
120L
,
TimeUnit
.
MILLISECONDS
)
.
observeOn
(
AndroidSchedulers
.
mainThread
())
override
fun
injectDependencies
()
{
override
fun
injectDependencies
()
{
getComponent
()
getComponent
()
}
}
...
@@ -106,6 +122,7 @@ class ArticlesScreenController :
...
@@ -106,6 +122,7 @@ class ArticlesScreenController :
when
(
viewState
){
when
(
viewState
){
is
ArticlesScreenViewState
.
Idle
->
render
(
viewState
)
is
ArticlesScreenViewState
.
Idle
->
render
(
viewState
)
is
ArticlesScreenViewState
.
ArticlesLoaded
->
render
(
viewState
)
is
ArticlesScreenViewState
.
ArticlesLoaded
->
render
(
viewState
)
is
ArticlesScreenViewState
.
ArticlesScrollPage
->
render
(
viewState
)
is
ArticlesScreenViewState
.
SomeError
->
render
(
viewState
)
is
ArticlesScreenViewState
.
SomeError
->
render
(
viewState
)
}
}
}
}
...
@@ -122,6 +139,13 @@ class ArticlesScreenController :
...
@@ -122,6 +139,13 @@ class ArticlesScreenController :
}
}
private
fun
render
(
viewState
:
ArticlesScreenViewState
.
ArticlesScrollPage
){
Timber
.
d
(
"got items: ${viewState.items.size}"
)
(
articlesRecyclerView
.
adapter
as
ArticlesAdapter
).
addItems
(
viewState
.
items
)
}
private
fun
render
(
viewState
:
ArticlesScreenViewState
.
ArticlesLoaded
)
{
private
fun
render
(
viewState
:
ArticlesScreenViewState
.
ArticlesLoaded
)
{
progressBar
.
setGone
(
true
)
progressBar
.
setGone
(
true
)
emptyListNotice
.
setGone
(
true
)
emptyListNotice
.
setGone
(
true
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feed_list/ScreenPresenter.kt
View file @
c8a42b8d
...
@@ -14,6 +14,8 @@ import javax.inject.Named
...
@@ -14,6 +14,8 @@ import javax.inject.Named
* Created by Vladislav Bogdashkin on 30.09.2019.
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
*/
private
const
val
FEED_PAGE_SIZE
=
10
class
ArticlesScreenPresenter
@Inject
constructor
(
class
ArticlesScreenPresenter
@Inject
constructor
(
@Named
(
FEED_ALIAS
)
private
val
feedId
:
String
,
@Named
(
FEED_ALIAS
)
private
val
feedId
:
String
,
...
@@ -31,8 +33,18 @@ class ArticlesScreenPresenter @Inject constructor(
...
@@ -31,8 +33,18 @@ class ArticlesScreenPresenter @Inject constructor(
.
map
<
ArticlesScreenViewState
>{
ArticlesScreenViewState
.
ArticlesLoaded
(
it
.
articles
)
}
.
map
<
ArticlesScreenViewState
>{
ArticlesScreenViewState
.
ArticlesLoaded
(
it
.
articles
)
}
.
startWith
(
Observable
.
just
<
ArticlesScreenViewState
>(
ArticlesScreenViewState
.
Idle
()))
.
startWith
(
Observable
.
just
<
ArticlesScreenViewState
>(
ArticlesScreenViewState
.
Idle
()))
val
getNewArticlesPage
=
intent
(
ArticlesScreen
::
requsetsNewArticles
)
.
flatMap
{
interactor
.
fetchArticlesPage
(
feedId
,
FEED_PAGE_SIZE
,
it
)
}
.
map
<
ArticlesScreenViewState
>
{
// restoreModel.articles = it.articles
Timber
.
d
(
"arrived list: ${it.articles.size}"
)
ArticlesScreenViewState
.
ArticlesScrollPage
(
it
.
articles
.
toList
())
}
.
onErrorReturn
(
::
parseError
)
val
state
=
restoreStateObservable
val
state
=
restoreStateObservable
.
mergeWith
(
prefetchCards
)
.
mergeWith
(
prefetchCards
)
.
mergeWith
(
getNewArticlesPage
)
.
doOnError
{
Timber
.
e
(
it
)}
.
doOnError
{
Timber
.
e
(
it
)}
.
onErrorReturn
(
::
parseError
)
.
onErrorReturn
(
::
parseError
)
.
subscribeOn
(
Schedulers
.
io
())
.
subscribeOn
(
Schedulers
.
io
())
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feed_list/ScreenViewState.kt
View file @
c8a42b8d
...
@@ -13,4 +13,5 @@ sealed class ArticlesScreenViewState : BigantoBaseViewState() {
...
@@ -13,4 +13,5 @@ sealed class ArticlesScreenViewState : BigantoBaseViewState() {
class
Idle
:
ArticlesScreenViewState
()
class
Idle
:
ArticlesScreenViewState
()
class
ArticlesLoaded
(
val
items
:
List
<
ArticlePreviewModel
>)
:
ArticlesScreenViewState
()
class
ArticlesLoaded
(
val
items
:
List
<
ArticlePreviewModel
>)
:
ArticlesScreenViewState
()
class
SomeError
(
val
exception
:
ExceptionString
)
:
ArticlesScreenViewState
()
class
SomeError
(
val
exception
:
ExceptionString
)
:
ArticlesScreenViewState
()
class
ArticlesScrollPage
(
val
items
:
List
<
ArticlePreviewModel
>)
:
ArticlesScreenViewState
()
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenController.kt
View file @
c8a42b8d
...
@@ -96,9 +96,8 @@ class FeedsScreenController :
...
@@ -96,9 +96,8 @@ class FeedsScreenController :
.
filter
{
it
==
RecyclerView
.
SCROLL_STATE_IDLE
}
.
filter
{
it
==
RecyclerView
.
SCROLL_STATE_IDLE
}
.
map
{
feedsRecyclerView
.
layoutManager
as
LinearLayoutManager
}
.
map
{
feedsRecyclerView
.
layoutManager
as
LinearLayoutManager
}
.
map
{
it
.
findLastCompletelyVisibleItemPosition
()
}
.
map
{
it
.
findLastCompletelyVisibleItemPosition
()
}
.
doOnNext
{
Timber
.
d
(
"Visible items $it of ${(feedsRecyclerView.adapter?.itemCount?:0) - 3}"
)
}
.
filter
{
storedFeedsList
.
isNotEmpty
()
}
.
filter
{
storedFeedsList
.
isNotEmpty
()
}
.
filter
{
it
>(
feedsRecyclerView
.
adapter
?.
itemCount
?:
0
)-
2
}
.
filter
{
it
>(
feedsRecyclerView
.
adapter
?.
itemCount
?:
0
)-
4
}
.
map
{
feedsRecyclerView
.
adapter
?.
itemCount
?:
0
}
.
map
{
feedsRecyclerView
.
adapter
?.
itemCount
?:
0
}
.
map
{
Pair
(
storedFeedsList
[
feedsTabs
.
selectedTabPosition
],
it
)}
.
map
{
Pair
(
storedFeedsList
[
feedsTabs
.
selectedTabPosition
],
it
)}
.
debounce
(
120L
,
TimeUnit
.
MILLISECONDS
)
.
debounce
(
120L
,
TimeUnit
.
MILLISECONDS
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenPresenter.kt
View file @
c8a42b8d
...
@@ -13,7 +13,7 @@ import javax.inject.Inject
...
@@ -13,7 +13,7 @@ import javax.inject.Inject
* Created by Vladislav Bogdashkin on 30.09.2019.
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
*/
const
val
FEED_PREVIEW_PAGE_SIZE
=
10
private
const
val
FEED_PREVIEW_PAGE_SIZE
=
10
class
FeedsScreenPresenter
@Inject
constructor
(
class
FeedsScreenPresenter
@Inject
constructor
(
private
val
interactor
:
FeedsInteractor
private
val
interactor
:
FeedsInteractor
...
...
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