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
ffdb56e4
Commit
ffdb56e4
authored
Mar 23, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/article_photos' into develop
parents
76e62401
ddbb760d
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
197 additions
and
23 deletions
+197
-23
Project.xml
.idea/codeStyles/Project.xml
+3
-0
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
+30
-0
articleBottomPhotoAdapter.kt
...entation/screen/article/util/articleBottomPhotoAdapter.kt
+39
-0
ScreenContract.kt
.../roompark/presentation/screen/feed_list/ScreenContract.kt
+2
-0
ScreenController.kt
...oompark/presentation/screen/feed_list/ScreenController.kt
+41
-0
ScreenPresenter.kt
...roompark/presentation/screen/feed_list/ScreenPresenter.kt
+23
-0
ScreenViewState.kt
...roompark/presentation/screen/feed_list/ScreenViewState.kt
+8
-1
ScreenController.kt
...al/roompark/presentation/screen/feeds/ScreenController.kt
+1
-2
ScreenPresenter.kt
...ual/roompark/presentation/screen/feeds/ScreenPresenter.kt
+18
-9
ScreenViewState.kt
...ual/roompark/presentation/screen/feeds/ScreenViewState.kt
+1
-1
feed_read_header.xml
app/src/main/res/layout/feed_read_header.xml
+3
-6
feed_read_screen.xml
app/src/main/res/layout/feed_read_screen.xml
+14
-4
photo_article_slider_viewholder.xml
app/src/main/res/layout/photo_article_slider_viewholder.xml
+8
-0
No files found.
.idea/codeStyles/Project.xml
View file @
ffdb56e4
<component
name=
"ProjectCodeStyleConfiguration"
>
<component
name=
"ProjectCodeStyleConfiguration"
>
<code_scheme
name=
"Project"
version=
"173"
>
<code_scheme
name=
"Project"
version=
"173"
>
<AndroidXmlCodeStyleSettings>
<option
name=
"ARRANGEMENT_SETTINGS_MIGRATED_TO_191"
value=
"true"
/>
</AndroidXmlCodeStyleSettings>
<JetCodeStyleSettings>
<JetCodeStyleSettings>
<option
name=
"CODE_STYLE_DEFAULTS"
value=
"KOTLIN_OFFICIAL"
/>
<option
name=
"CODE_STYLE_DEFAULTS"
value=
"KOTLIN_OFFICIAL"
/>
</JetCodeStyleSettings>
</JetCodeStyleSettings>
...
...
app/src/main/java/com/biganto/visual/roompark/domain/interactor/articles.kt
View file @
ffdb56e4
...
@@ -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 @
ffdb56e4
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 @
ffdb56e4
...
@@ -13,9 +13,14 @@ import com.biganto.visual.roompark.R
...
@@ -13,9 +13,14 @@ 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.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.biganto.visual.roompark.util.extensions.setGone
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
...
@@ -44,6 +49,7 @@ class ArticleScreenController :
...
@@ -44,6 +49,7 @@ class ArticleScreenController :
getComponent
()
getComponent
()
}
}
@Inject
@Inject
override
lateinit
var
injectedPresenter
:
ArticleScreenPresenter
override
lateinit
var
injectedPresenter
:
ArticleScreenPresenter
...
@@ -56,6 +62,9 @@ class ArticleScreenController :
...
@@ -56,6 +62,9 @@ class ArticleScreenController :
@BindView
(
R
.
id
.
articleBodyRecyclerView
)
@BindView
(
R
.
id
.
articleBodyRecyclerView
)
lateinit
var
articleRecyclerView
:
RecyclerView
lateinit
var
articleRecyclerView
:
RecyclerView
@BindView
(
R
.
id
.
article_photos_recylcerView
)
lateinit
var
bottomPhotosRecyclerView
:
RecyclerView
private
val
blurPreview
:
ImageView
by
lazy
{
private
val
blurPreview
:
ImageView
by
lazy
{
headerBlock
.
findViewById
<
ImageView
>(
R
.
id
.
articlePreviewBlurred
)
headerBlock
.
findViewById
<
ImageView
>(
R
.
id
.
articlePreviewBlurred
)
}
}
...
@@ -79,12 +88,28 @@ class ArticleScreenController :
...
@@ -79,12 +88,28 @@ class ArticleScreenController :
LinearLayoutManager
(
activity
,
RecyclerView
.
VERTICAL
,
false
)
LinearLayoutManager
(
activity
,
RecyclerView
.
VERTICAL
,
false
)
articleRecyclerView
.
adapter
=
HtmlPageAdapter
()
articleRecyclerView
.
adapter
=
HtmlPageAdapter
()
articleRecyclerView
.
itemAnimator
=
null
articleRecyclerView
.
itemAnimator
=
null
bottomPhotosRecyclerView
.
layoutManager
=
LinearLayoutManager
(
activity
,
RecyclerView
.
HORIZONTAL
,
false
)
bottomPhotosRecyclerView
.
adapter
=
ArticleBottomPhotoAdapter
()
bottomPhotosRecyclerView
.
itemAnimator
=
null
}
}
override
fun
onViewBound
(
v
:
View
)
{
override
fun
onViewBound
(
v
:
View
)
{
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
)
{
...
@@ -121,6 +146,11 @@ class ArticleScreenController :
...
@@ -121,6 +146,11 @@ class ArticleScreenController :
articleDate
.
text
=
viewState
.
item
.
published
.
formatToSimple
articleDate
.
text
=
viewState
.
item
.
published
.
formatToSimple
bottomPhotosRecyclerView
.
setGone
(
viewState
.
item
.
bottomPhotoList
.
isNullOrEmpty
())
viewState
.
item
.
bottomPhotoList
?.
let
{
(
bottomPhotosRecyclerView
.
adapter
as
ArticleBottomPhotoAdapter
).
setItems
(
it
)
}
Glide
.
with
(
blurPreview
)
Glide
.
with
(
blurPreview
)
.
load
(
viewState
.
item
.
previewUrl
)
.
load
(
viewState
.
item
.
previewUrl
)
.
transform
(
BlurTransformation
(
40
,
4
))
.
transform
(
BlurTransformation
(
40
,
4
))
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/article/util/articleBottomPhotoAdapter.kt
0 → 100644
View file @
ffdb56e4
package
com.biganto.visual.roompark.presentation.screen.article.util
import
android.view.View
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.data.repository.db.requrey.TitledPhoto
import
com.biganto.visual.roompark.presentation.screen.settings.util.CommonRecyclerAdapter
import
com.biganto.visual.roompark.presentation.screen.settings.util.CommonViewHolder
import
com.biganto.visual.roompark.util.view_utils.image_view.RoundedImageView
import
com.bumptech.glide.Glide
import
com.bumptech.glide.load.engine.DiskCacheStrategy
import
kotlin.reflect.KClass
/**
* Created by Vladislav Bogdashkin on 29.01.2020.
*/
class
ArticleBottomPhotoAdapter
:
CommonRecyclerAdapter
<
ArticleBottomPhotoViewHolder
,
TitledPhoto
>()
{
override
val
vhKlazz
:
KClass
<
ArticleBottomPhotoViewHolder
>
get
()
=
ArticleBottomPhotoViewHolder
::
class
override
fun
getVhLayout
():
Int
=
R
.
layout
.
photo_article_slider_viewholder
}
class
ArticleBottomPhotoViewHolder
(
itemView
:
View
)
:
CommonViewHolder
<
TitledPhoto
>(
itemView
){
override
fun
onViewBound
(
model
:
TitledPhoto
)
{
// articleTitle.text = model.title
Glide
.
with
(
itemView
)
.
load
(
model
.
url
)
.
centerCrop
()
.
fitCenter
()
.
diskCacheStrategy
(
DiskCacheStrategy
.
ALL
)
.
into
((
itemView
as
RoundedImageView
))
}
}
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feed_list/ScreenContract.kt
View file @
ffdb56e4
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 @
ffdb56e4
...
@@ -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,8 @@ class ArticlesScreenController :
...
@@ -106,6 +122,8 @@ 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
.
RestoreView
->
render
(
viewState
)
is
ArticlesScreenViewState
.
SomeError
->
render
(
viewState
)
is
ArticlesScreenViewState
.
SomeError
->
render
(
viewState
)
}
}
}
}
...
@@ -122,6 +140,29 @@ class ArticlesScreenController :
...
@@ -122,6 +140,29 @@ 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
.
RestoreView
){
progressBar
.
setGone
(
true
)
emptyListNotice
.
setGone
(
true
)
articlesRecyclerView
.
setGone
(
true
)
if
(
viewState
.
restore
.
articles
.
isNullOrEmpty
())
{
emptyListNotice
.
setGone
(
false
)
articlesRecyclerView
.
setGone
(
true
)
}
else
{
emptyListNotice
.
setGone
(
true
)
articlesRecyclerView
.
setGone
(
false
)
(
articlesRecyclerView
.
adapter
as
ArticlesAdapter
).
setItems
(
viewState
.
restore
.
articles
)
}
}
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 @
ffdb56e4
...
@@ -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
,
...
@@ -21,6 +23,14 @@ class ArticlesScreenPresenter @Inject constructor(
...
@@ -21,6 +23,14 @@ class ArticlesScreenPresenter @Inject constructor(
)
)
:
BigantoBasePresenter
<
ArticlesScreen
,
ArticlesScreenViewState
>()
{
:
BigantoBasePresenter
<
ArticlesScreen
,
ArticlesScreenViewState
>()
{
private
val
restoreModel
=
RestoreModel
(
mutableListOf
())
override
fun
detachView
()
{
super
.
detachView
()
restoreStateObservable
.
accept
(
ArticlesScreenViewState
.
RestoreView
(
restoreModel
))
}
override
fun
defaultErrorViewStateHandler
()
=
override
fun
defaultErrorViewStateHandler
()
=
{
e
:
ExceptionString
->
ArticlesScreenViewState
.
SomeError
(
e
)}
{
e
:
ExceptionString
->
ArticlesScreenViewState
.
SomeError
(
e
)}
...
@@ -31,8 +41,21 @@ class ArticlesScreenPresenter @Inject constructor(
...
@@ -31,8 +41,21 @@ 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
>
{
articlePage
->
articlePage
.
articles
.
asSequence
()
.
filter
{
!
restoreModel
.
articles
.
contains
(
it
)
}
.
toList
()
.
let
{
uniqueItems
->
restoreModel
.
articles
.
addAll
(
uniqueItems
)}
ArticlesScreenViewState
.
ArticlesScrollPage
(
articlePage
.
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 @
ffdb56e4
...
@@ -13,4 +13,11 @@ sealed class ArticlesScreenViewState : BigantoBaseViewState() {
...
@@ -13,4 +13,11 @@ 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
class
RestoreView
(
val
restore
:
RestoreModel
)
:
ArticlesScreenViewState
()
}
data class
RestoreModel
(
var
articles
:
MutableList
<
ArticlePreviewModel
>
)
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenController.kt
View file @
ffdb56e4
...
@@ -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 @
ffdb56e4
...
@@ -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
...
@@ -28,7 +28,8 @@ class FeedsScreenPresenter @Inject constructor(
...
@@ -28,7 +28,8 @@ class FeedsScreenPresenter @Inject constructor(
arrayListOf
(),
arrayListOf
(),
arrayListOf
(),
arrayListOf
(),
arrayListOf
(),
arrayListOf
(),
arrayListOf
())
mutableListOf
()
)
override
fun
attachView
(
view
:
FeedsScreen
)
{
override
fun
attachView
(
view
:
FeedsScreen
)
{
...
@@ -67,9 +68,13 @@ class FeedsScreenPresenter @Inject constructor(
...
@@ -67,9 +68,13 @@ class FeedsScreenPresenter @Inject constructor(
val
getFeedArticlesPreview
=
intent
(
FeedsScreen
::
feedsTabSelected
)
val
getFeedArticlesPreview
=
intent
(
FeedsScreen
::
feedsTabSelected
)
.
flatMap
{
interactor
.
fetchArticles
(
it
)
}
.
flatMap
{
interactor
.
fetchArticles
(
it
)
}
.
map
<
FeedsScreenViewState
>
{
.
map
<
FeedsScreenViewState
>
{
articlePage
->
restoreModel
.
articles
=
it
.
articles
articlePage
.
articles
FeedsScreenViewState
.
GetFeedArticlesPreview
(
it
.
articles
.
toList
())
.
asSequence
()
.
filter
{
!
restoreModel
.
articles
.
contains
(
it
)
}
.
toList
()
.
let
{
uniqueItems
->
restoreModel
.
articles
.
addAll
(
uniqueItems
)}
FeedsScreenViewState
.
GetFeedArticlesPreview
(
articlePage
.
articles
.
toList
())
}
}
.
onErrorReturn
(
::
parseError
)
.
onErrorReturn
(
::
parseError
)
...
@@ -95,10 +100,14 @@ class FeedsScreenPresenter @Inject constructor(
...
@@ -95,10 +100,14 @@ class FeedsScreenPresenter @Inject constructor(
val
getNewArticlesPage
=
intent
(
FeedsScreen
::
requsetsNewArticles
)
val
getNewArticlesPage
=
intent
(
FeedsScreen
::
requsetsNewArticles
)
.
flatMap
{
interactor
.
fetchArticles
(
it
.
first
.
alias
,
FEED_PREVIEW_PAGE_SIZE
,
it
.
second
)
}
.
flatMap
{
interactor
.
fetchArticles
(
it
.
first
.
alias
,
FEED_PREVIEW_PAGE_SIZE
,
it
.
second
)
}
.
map
<
FeedsScreenViewState
>
{
.
map
<
FeedsScreenViewState
>
{
articlePage
->
restoreModel
.
articles
=
it
.
articles
articlePage
.
articles
Timber
.
d
(
"arrived list: ${it.articles.size}"
)
.
asSequence
()
FeedsScreenViewState
.
ArticlesScrollPage
(
it
.
articles
.
toList
())
.
filter
{
!
restoreModel
.
articles
.
contains
(
it
)
}
.
toList
()
.
let
{
uniqueItems
->
restoreModel
.
articles
.
addAll
(
uniqueItems
)}
FeedsScreenViewState
.
ArticlesScrollPage
(
articlePage
.
articles
.
toList
())
}
}
.
onErrorReturn
(
::
parseError
)
.
onErrorReturn
(
::
parseError
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenViewState.kt
View file @
ffdb56e4
...
@@ -38,5 +38,5 @@ data class RestoreModel(
...
@@ -38,5 +38,5 @@ data class RestoreModel(
var
feeds
:
List
<
FeedModel
>,
var
feeds
:
List
<
FeedModel
>,
var
albums
:
List
<
AlbumPreviewModel
>,
var
albums
:
List
<
AlbumPreviewModel
>,
var
cams
:
List
<
WebCamModel
>,
var
cams
:
List
<
WebCamModel
>,
var
articles
:
List
<
ArticlePreviewModel
>
var
articles
:
MutableList
<
ArticlePreviewModel
>
)
)
\ No newline at end of file
app/src/main/res/layout/feed_read_header.xml
View file @
ffdb56e4
...
@@ -16,19 +16,17 @@
...
@@ -16,19 +16,17 @@
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
app:srcCompat=
"@drawable/default_image_placeholder"
/>
<com.biganto.visual.roompark.util.view_utils.image_view.RoundedImageView
<com.biganto.visual.roompark.util.view_utils.image_view.RoundedImageView
android:id=
"@+id/articlePreview"
android:id=
"@+id/articlePreview"
app:image_corner_radius=
"4dp"
android:layout_width=
"125dp"
android:layout_width=
"125dp"
android:layout_height=
"125dp"
android:layout_height=
"125dp"
android:layout_marginStart=
"16dp"
android:layout_marginStart=
"16dp"
android:layout_marginTop=
"44dp"
android:layout_marginTop=
"44dp"
app:image_corner_radius=
"4dp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
app:srcCompat=
"@drawable/ic_favorites"
/>
<com.google.android.material.textview.MaterialTextView
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/articleDate"
android:id=
"@+id/articleDate"
...
@@ -37,7 +35,6 @@
...
@@ -37,7 +35,6 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"24dp"
android:layout_marginStart=
"24dp"
android:includeFontPadding=
"false"
android:includeFontPadding=
"false"
android:text=
"22 / 02 / 2019"
android:visibility=
"visible"
android:visibility=
"visible"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
...
...
app/src/main/res/layout/feed_read_screen.xml
View file @
ffdb56e4
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_height=
"match_parent"
xmlns:tools=
"http://schemas.android.com/tools"
>
<androidx.core.widget.NestedScrollView
<androidx.core.widget.NestedScrollView
...
@@ -35,8 +35,18 @@
...
@@ -35,8 +35,18 @@
<androidx.recyclerview.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/articleBodyRecyclerView"
android:id=
"@+id/articleBodyRecyclerView"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
android:layout_height=
"wrap_content"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/article_photos_recylcerView"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"32dp"
android:background=
"@color/colorOpacityBackground"
android:orientation=
"horizontal"
android:paddingBottom=
"16dp"
tools:listitem=
"@layout/photo_viewholder"
/>
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.core.widget.NestedScrollView>
...
...
app/src/main/res/layout/photo_article_slider_viewholder.xml
0 → 100644
View file @
ffdb56e4
<?xml version="1.0" encoding="utf-8"?>
<com.biganto.visual.roompark.util.view_utils.image_view.RoundedImageView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"256dp"
android:layout_height=
"228dp"
android:layout_margin=
"16dp"
android:scaleType=
"centerCrop"
app:image_corner_radius=
"4dp"
/>
\ 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