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
ab7bae22
Commit
ab7bae22
authored
Mar 20, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add refresh call on clear cache
parent
89fe6434
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
21 deletions
+39
-21
ScreenContract.kt
...l/roompark/presentation/screen/settings/ScreenContract.kt
+1
-0
ScreenController.kt
...roompark/presentation/screen/settings/ScreenController.kt
+8
-1
ScreenPresenter.kt
.../roompark/presentation/screen/settings/ScreenPresenter.kt
+6
-0
settings_screen.xml
app/src/main/res/layout/settings_screen.xml
+24
-20
No files found.
app/src/main/java/com/biganto/visual/roompark/presentation/screen/settings/ScreenContract.kt
View file @
ab7bae22
...
...
@@ -10,5 +10,6 @@ import io.reactivex.Observable
interface
SettingsScreen
:
BigantoBaseContract
<
SettingsScreenViewState
>
{
fun
signOut
():
Observable
<
Int
>
fun
clearCache
():
Observable
<
Int
>
fun
refreshCacheInfo
():
Observable
<
Int
>
}
app/src/main/java/com/biganto/visual/roompark/presentation/screen/settings/ScreenController.kt
View file @
ab7bae22
...
...
@@ -21,6 +21,7 @@ import com.bluelinelabs.conductor.RouterTransaction
import
com.bluelinelabs.conductor.changehandler.FadeChangeHandler
import
com.google.android.material.textview.MaterialTextView
import
com.jakewharton.rxbinding3.view.clicks
import
com.jakewharton.rxrelay2.BehaviorRelay
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
import
timber.log.Timber
...
...
@@ -48,6 +49,8 @@ class SettingsScreenController :
.
map
{
Timber
.
d
(
"Clicked clear cache button"
);
1
}
.
observeOn
(
AndroidSchedulers
.
mainThread
())
private
val
refreshEmitter
=
BehaviorRelay
.
create
<
Int
>()
override
fun
refreshCacheInfo
():
Observable
<
Int
>
=
refreshEmitter
override
fun
injectDependencies
()
{
getComponent
()
...
...
@@ -136,11 +139,15 @@ class SettingsScreenController :
private
fun
render
(
viewState
:
SettingsScreenViewState
.
Idle
){
progressShame
.
setGone
(
true
)
clearCacheButton
.
setGone
(
false
)
}
private
fun
render
(
viewState
:
SettingsScreenViewState
.
OnCacheDeleting
){
progressShame
.
setGone
(
viewState
.
progress
>=
1f
)
val
isProgressed
=
viewState
.
progress
>=
1f
progressShame
.
setGone
(
isProgressed
)
clearCacheButton
.
setGone
(!
isProgressed
)
refreshEmitter
.
accept
(
1
)
}
private
fun
render
(
viewState
:
SettingsScreenViewState
.
SignOut
){
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/settings/ScreenPresenter.kt
View file @
ab7bae22
...
...
@@ -42,6 +42,10 @@ class SettingsScreenPresenter @Inject constructor(
.
onErrorReturn
(
::
parseError
)
}
val
refreshInfo
=
intent
(
SettingsScreen
::
refreshCacheInfo
)
.
flatMap
{
fetchSettings
}
val
onClearCache
=
intent
(
SettingsScreen
::
clearCache
)
.
flatMap
{
interactor
.
deleteCacheFiles
()
...
...
@@ -52,6 +56,7 @@ class SettingsScreenPresenter @Inject constructor(
}
.
startWith
(
SettingsScreenViewState
.
OnCacheDeleting
(
0f
))
.
onErrorReturn
(
::
parseError
)
}
...
...
@@ -59,6 +64,7 @@ class SettingsScreenPresenter @Inject constructor(
.
mergeWith
(
fetchSettings
)
.
mergeWith
(
onSignOut
)
.
mergeWith
(
onClearCache
)
.
mergeWith
(
refreshInfo
)
.
doOnError
{
Timber
.
e
(
it
)}
.
subscribeOn
(
Schedulers
.
io
())
.
onErrorReturn
(
::
parseError
)
...
...
app/src/main/res/layout/settings_screen.xml
View file @
ab7bae22
...
...
@@ -126,8 +126,30 @@
android:id=
"@+id/clear_cache_button"
style=
"@style/Default_TextView.Clear_Cache_Text"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_margin=
"32dp"
/>
android:layout_height=
"48dp"
android:layout_margin=
"16dp"
android:textAlignment=
"center"
/>
<FrameLayout
android:id=
"@+id/progress_lock_background"
android:background=
"@color/colorOpacityBackgroundInv"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:layout_margin=
"16dp"
android:backgroundTint=
"@color/colorPrimary"
android:visibility=
"gone"
>
<ProgressBar
android:id=
"@+id/settings_progress_bar"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:indeterminate=
"true"
android:layout_gravity=
"center"
/>
</FrameLayout>
<com.google.android.material.textview.MaterialTextView
...
...
@@ -147,24 +169,6 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_margin=
"32dp"
/>
<FrameLayout
android:id=
"@+id/progress_lock_background"
android:background=
"@color/colorOpacityBackgroundInv"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:visibility=
"invisible"
>
<ProgressBar
android:id=
"@+id/settings_progress_bar"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:indeterminate=
"true"
android:layout_gravity=
"center"
/>
</FrameLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
\ 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