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
db96e964
Commit
db96e964
authored
Jan 28, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
restoreObservable should be on detachView neither than on attachView method
parent
e1987e37
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
77 additions
and
42 deletions
+77
-42
RoomParkMainActivity.kt
.../com/biganto/visual/roompark/base/RoomParkMainActivity.kt
+3
-0
article.kt
.../com/biganto/visual/roompark/domain/interactor/article.kt
+1
-0
articles.kt
...com/biganto/visual/roompark/domain/interactor/articles.kt
+4
-10
ScreenController.kt
...ual/roompark/presentation/screen/deal/ScreenController.kt
+0
-9
ScreenController.kt
...oompark/presentation/screen/feed_list/ScreenController.kt
+30
-3
ScreenPresenter.kt
...roompark/presentation/screen/feed_list/ScreenPresenter.kt
+3
-1
ScreenController.kt
...al/roompark/presentation/screen/feeds/ScreenController.kt
+6
-8
ScreenPresenter.kt
...ual/roompark/presentation/screen/feeds/ScreenPresenter.kt
+13
-7
ic_chevron_left.xml
app/src/main/res/drawable/ic_chevron_left.xml
+1
-1
feed_direct_screen.xml
app/src/main/res/layout/feed_direct_screen.xml
+16
-0
feed_direct_viewholder.xml
app/src/main/res/layout/feed_direct_viewholder.xml
+0
-1
switch_toolbar.xml
app/src/main/res/layout/switch_toolbar.xml
+0
-2
No files found.
app/src/main/java/com/biganto/visual/roompark/base/RoomParkMainActivity.kt
View file @
db96e964
...
...
@@ -66,6 +66,8 @@ class RoomParkMainActivity(
router
=
Conductor
.
attachRouter
(
this
,
conductorContainer
,
savedInstanceState
)
router
.
setRoot
(
RouterTransaction
.
with
(
SplashScreenController
()))
headerToolbarBack
.
setOnClickListener
{
onBackPressed
()}
}
override
fun
displayBackButton
(
show
:
Boolean
)
{
...
...
@@ -89,6 +91,7 @@ class RoomParkMainActivity(
override
val
headerToolbarBack
get
()
=
headerToolbar
.
findViewById
<
MaterialTextView
>(
R
.
id
.
back_button_chevron
)
override
fun
setToolbar
(
header
:
HeaderToolbarModel
?,
status
:
StatusToolbarModel
?){
appBar
.
setExpanded
(
false
,
false
)
if
(
header
==
null
&&
status
==
null
){
...
...
app/src/main/java/com/biganto/visual/roompark/domain/interactor/article.kt
View file @
db96e964
...
...
@@ -16,6 +16,7 @@ class ArticleInteractor @Inject constructor(
fun
fetchArticle
(
articleId
:
Int
):
Observable
<
ArticleModel
>
=
uc
.
getArticle
(
articleId
)
// Single.just(
// when (articleId) {
// 2 -> article2
...
...
app/src/main/java/com/biganto/visual/roompark/domain/interactor/articles.kt
View file @
db96e964
package
com.biganto.visual.roompark.domain.interactor
import
com.biganto.visual.roompark.domain.model.ArticlesPreviewModel
import
io.reactivex.Single
import
com.biganto.visual.roompark.domain.use_case.FeedUseCase
import
javax.inject.Inject
/**
...
...
@@ -9,16 +8,11 @@ import javax.inject.Inject
*/
class
ArticlesInteractor
@Inject
constructor
(
private
val
uc
:
FeedUseCase
)
{
fun
fetchArticles
(
feedAlias
:
String
):
Single
<
ArticlesPreviewModel
>
=
Single
.
just
(
when
(
feedAlias
)
{
"news"
->
FeedsInteractor
.
testNewsArticles
"blog"
->
FeedsInteractor
.
testBlogsArticles
"constructors_blog"
->
FeedsInteractor
.
testDevArticles
else
->
error
(
"unknown feedId"
)
}
)
fun
fetchArticles
(
feed
:
String
)
=
uc
.
getArticles
(
feed
)
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/deal/ScreenController.kt
View file @
db96e964
...
...
@@ -132,15 +132,6 @@ class DealScreenController :
)
}
)
toolBar
.
headerToolbarBack
?.
let
{
detachDisposable
.
add
(
it
.
clicks
()
.
doOnNext
{
Timber
.
d
(
"clicked: 1"
)
}
.
subscribeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
{
handleBack
()
}
)
}
}
private
fun
setToolbar
(){
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feed_list/ScreenController.kt
View file @
db96e964
package
com.biganto.visual.roompark.presentation.screen.feed_list
import
android.view.View
import
android.widget.ProgressBar
import
androidx.core.os.bundleOf
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
...
...
@@ -12,8 +13,10 @@ import com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.conductor.BigantoBaseController
import
com.biganto.visual.roompark.presentation.screen.article.ArticleScreenController
import
com.biganto.visual.roompark.presentation.screen.feed_list.util.ArticlesAdapter
import
com.biganto.visual.roompark.util.extensions.setGone
import
com.biganto.visual.roompark.util.view_utils.grid.CeilsDecoration
import
com.bluelinelabs.conductor.RouterTransaction
import
com.google.android.material.textview.MaterialTextView
import
timber.log.Timber
import
javax.inject.Inject
...
...
@@ -44,6 +47,12 @@ class ArticlesScreenController :
@BindView
(
R
.
id
.
articles_recycler_view
)
lateinit
var
articlesRecyclerView
:
RecyclerView
@BindView
(
R
.
id
.
progress_bar_view
)
lateinit
var
progressBar
:
ProgressBar
@BindView
(
R
.
id
.
empty_list_text_view
)
lateinit
var
emptyListNotice
:
MaterialTextView
private
fun
setToolbar
()
{
articlesRecyclerView
.
isNestedScrollingEnabled
=
false
...
...
@@ -102,14 +111,32 @@ class ArticlesScreenController :
}
private
fun
render
(
viewState
:
ArticlesScreenViewState
.
Idle
){
progressBar
.
setGone
(
false
)
emptyListNotice
.
setGone
(
true
)
articlesRecyclerView
.
setGone
(
true
)
}
private
fun
render
(
viewState
:
ArticlesScreenViewState
.
SomeError
)
=
private
fun
render
(
viewState
:
ArticlesScreenViewState
.
SomeError
)
{
showError
(
viewState
.
exception
)
progressBar
.
setGone
(
true
)
}
private
fun
render
(
viewState
:
ArticlesScreenViewState
.
ArticlesLoaded
)
{
(
articlesRecyclerView
.
adapter
as
ArticlesAdapter
).
setItems
(
viewState
.
items
)
progressBar
.
setGone
(
true
)
emptyListNotice
.
setGone
(
true
)
articlesRecyclerView
.
setGone
(
true
)
if
(
viewState
.
items
.
isNullOrEmpty
())
{
emptyListNotice
.
setGone
(
false
)
articlesRecyclerView
.
setGone
(
true
)
}
else
{
emptyListNotice
.
setGone
(
true
)
articlesRecyclerView
.
setGone
(
false
)
(
articlesRecyclerView
.
adapter
as
ArticlesAdapter
).
setItems
(
viewState
.
items
)
}
}
private
fun
getComponent
()
=
DaggerArticlesScreenComponent
.
factory
()
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feed_list/ScreenPresenter.kt
View file @
db96e964
...
...
@@ -3,6 +3,7 @@ package com.biganto.visual.roompark.presentation.screen.feed_list
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.domain.interactor.ArticlesInteractor
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
timber.log.Timber
...
...
@@ -27,7 +28,8 @@ class ArticlesScreenPresenter @Inject constructor(
Timber
.
d
(
"feedId : $feedId"
)
val
prefetchCards
=
interactor
.
fetchArticles
(
feedId
)
.
map
{
ArticlesScreenViewState
.
ArticlesLoaded
(
it
.
articles
)
}
.
map
<
ArticlesScreenViewState
>{
ArticlesScreenViewState
.
ArticlesLoaded
(
it
.
articles
)
}
.
startWith
(
Observable
.
just
<
ArticlesScreenViewState
>(
ArticlesScreenViewState
.
Idle
()))
val
state
=
restoreStateObservable
.
mergeWith
(
prefetchCards
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenController.kt
View file @
db96e964
...
...
@@ -47,24 +47,22 @@ class FeedsScreenController :
override
fun
onCameraSelected
():
Observable
<
WebCamModel
>
=
(
camsRecyclerView
.
adapter
as
CamsListAdapter
).
onItemClicked
.
debounce
(
120L
,
TimeUnit
.
MILLISECONDS
)
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
debounce
(
1220L
,
TimeUnit
.
MILLISECONDS
)
override
fun
onArticleSelected
():
Observable
<
ArticlePreviewModel
>
=
(
feedsRecyclerView
.
adapter
as
ArticlesPreviewAdapter
).
onItemClicked
.
debounce
(
120L
,
TimeUnit
.
MILLISECONDS
)
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
debounce
(
1220L
,
TimeUnit
.
MILLISECONDS
)
override
fun
onAlbumSelected
():
Observable
<
AlbumPreviewModel
>
=
(
devProgressRecyclerView
.
adapter
as
AlbumsPreviewAdapter
).
onItemClicked
.
debounce
(
120L
,
TimeUnit
.
MILLISECONDS
)
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
debounce
(
1220L
,
TimeUnit
.
MILLISECONDS
)
override
fun
feedsTabSelected
():
Observable
<
String
>
=
feedsTabs
.
selections
()
.
filter
{
it
.
position
>=
0
&&
it
.
position
<
storedFeedsList
.
size
}
.
debounce
(
200L
,
TimeUnit
.
MILLISECONDS
)
.
doOnNext
{
Timber
.
d
(
"it.position ${it.position}"
)
}
.
map
{
it
.
position
}
.
map
{
storedFeedsList
[
it
].
alias
}
.
observeOn
(
AndroidSchedulers
.
mainThread
())
...
...
@@ -146,7 +144,7 @@ class FeedsScreenController :
}
override
fun
render
(
viewState
:
FeedsScreenViewState
)
{
super
.
render
(
viewState
)
//
super.render(viewState)
Timber
.
d
(
"Render state $viewState"
)
when
(
viewState
){
is
FeedsScreenViewState
.
Idle
->
render
(
viewState
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenPresenter.kt
View file @
db96e964
...
...
@@ -3,6 +3,7 @@ package com.biganto.visual.roompark.presentation.screen.feeds
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.domain.interactor.FeedsInteractor
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
timber.log.Timber
...
...
@@ -32,10 +33,15 @@ class FeedsScreenPresenter @Inject constructor(
override
fun
attachView
(
view
:
FeedsScreen
)
{
Timber
.
d
(
"AttachView "
)
restoreStateObservable
.
accept
(
FeedsScreenViewState
.
RestoreView
(
restoreModel
))
super
.
attachView
(
view
)
}
override
fun
detachView
()
{
super
.
detachView
()
restoreStateObservable
.
accept
(
FeedsScreenViewState
.
RestoreView
(
restoreModel
))
}
override
fun
bindIntents
()
{
val
fetchCams
=
interactor
.
fetchCams
()
...
...
@@ -69,10 +75,8 @@ class FeedsScreenPresenter @Inject constructor(
.
onErrorReturn
(
::
parseError
)
val
switchToAllArtiles
=
intent
(
FeedsScreen
::
onAllFeedArticles
)
.
map
<
FeedsScreenViewState
>
{
FeedsScreenViewState
.
ToArticlesScreen
(
it
.
alias
)
}
.
onErrorReturn
(
::
parseError
)
.
flatMap
{
Observable
.
defer
{
Observable
.
just
<
FeedsScreenViewState
>(
FeedsScreenViewState
.
ToArticlesScreen
(
it
.
alias
))
}}
val
selectCamera
=
intent
(
FeedsScreen
::
onCameraSelected
)
.
map
<
FeedsScreenViewState
>
{
...
...
@@ -99,8 +103,9 @@ class FeedsScreenPresenter @Inject constructor(
}
.
onErrorReturn
(
::
parseError
)
val
state
=
restoreStateObservable
.
mergeWith
(
fetchFeeds
)
val
state
=
fetchFeeds
.
mergeWith
(
getFeedArticlesPreview
)
.
mergeWith
(
fetchAlbums
)
.
mergeWith
(
fetchCams
)
...
...
@@ -109,6 +114,7 @@ class FeedsScreenPresenter @Inject constructor(
.
mergeWith
(
selectCamera
)
.
mergeWith
(
selectAlbum
)
.
mergeWith
(
selectArticle
)
.
mergeWith
(
restoreStateObservable
)
.
doOnError
{
Timber
.
e
(
it
)}
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
...
...
app/src/main/res/drawable/ic_chevron_left.xml
View file @
db96e964
...
...
@@ -4,6 +4,6 @@
android:viewportWidth=
"24"
android:viewportHeight=
"24"
>
<path
android:fillColor=
"
#FF000000
"
android:fillColor=
"
@color/colorAccent
"
android:pathData=
"M15.41,7.41L14,6l-6,6 6,6 1.41,-1.41L10.83,12z"
/>
</vector>
app/src/main/res/layout/feed_direct_screen.xml
View file @
db96e964
...
...
@@ -6,6 +6,22 @@
android:background=
"@color/colorNoticeBackground"
android:orientation=
"vertical"
>
<ProgressBar
android:id=
"@+id/progress_bar_view"
style=
"?android:attr/progressBarStyle"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
/>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/empty_list_text_view"
style=
"@style/Common_Text.Notice"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
android:text=
"Нет элементов"
android:textAlignment=
"center"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/articles_recycler_view"
android:layout_width=
"match_parent"
...
...
app/src/main/res/layout/feed_direct_viewholder.xml
View file @
db96e964
...
...
@@ -14,7 +14,6 @@
android:layout_marginTop=
"16dp"
android:layout_marginEnd=
"16dp"
android:layout_marginBottom=
"16dp"
android:background=
"@color/colorAccentSecondary"
app:image_corner_radius=
"4dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@+id/feed_title_info_text_view"
...
...
app/src/main/res/layout/switch_toolbar.xml
View file @
db96e964
...
...
@@ -18,7 +18,6 @@
android:gravity=
"start|center_vertical"
android:text=
"МОИ \nСДЕЛКИ"
android:textAlignment=
"gravity"
app:drawableTint=
"@color/colorAccent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
...
...
@@ -34,7 +33,6 @@
android:fitsSystemWindows=
"true"
android:gravity=
"start|center_vertical"
android:includeFontPadding=
"true"
android:text=
"Ffff"
android:textAlignment=
"gravity"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@+id/include13"
...
...
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