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
89fe6434
Commit
89fe6434
authored
Mar 20, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix cache directory path to delete
parent
d01c7933
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
8 deletions
+37
-8
FileModule.kt
...iganto/visual/roompark/data/repository/file/FileModule.kt
+9
-8
ScreenController.kt
...roompark/presentation/screen/settings/ScreenController.kt
+9
-0
settings_screen.xml
app/src/main/res/layout/settings_screen.xml
+19
-0
No files found.
app/src/main/java/com/biganto/visual/roompark/data/repository/file/FileModule.kt
View file @
89fe6434
...
...
@@ -7,6 +7,7 @@ import com.biganto.visual.roompark.util.extensions.asInt
import
com.google.gson.JsonElement
import
dagger.Module
import
io.reactivex.Observable
import
kotlinx.io.IOException
import
timber.log.Timber
import
java.io.File
import
javax.inject.Inject
...
...
@@ -65,15 +66,15 @@ class FileModule @Inject constructor(val context: Application) {
fun
deleteAllCacheObservable
()
=
Observable
.
create
<
Pair
<
Int
,
Int
>>
{
emitter
->
val
foldersToDelete
=
listOf
(
FileDirectory
.
Albums
()
.
dir
,
FileDirectory
.
FeedsDir
()
.
dir
,
FileDirectory
.
PlanTypeDir
()
.
dir
,
FileDirectory
.
ToursDir
()
.
dir
FileDirectory
.
Albums
(),
FileDirectory
.
FeedsDir
(),
FileDirectory
.
PlanTypeDir
(),
FileDirectory
.
ToursDir
()
)
foldersToDelete
.
forEachIndexed
{
index
,
dir
->
if
(
File
(
dir
).
deleteRecursively
())
emitter
.
onNext
(
Pair
(
index
,
foldersToDelete
.
size
))
else
emitter
.
onError
(
error
(
"Error occurred on files deleting!"
))
foldersToDelete
.
forEachIndexed
{
index
,
dir
->
if
(
getDirectory
(
context
,
dir
).
deleteRecursively
())
emitter
.
onNext
(
Pair
(
index
,
foldersToDelete
.
size
-
1
))
else
emitter
.
onError
(
IOException
(
"Error occurred on files deleting!"
))
}
emitter
.
onComplete
()
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/settings/ScreenController.kt
View file @
89fe6434
...
...
@@ -16,6 +16,7 @@ import com.biganto.visual.roompark.presentation.screen.settings.util.CahcedListA
import
com.biganto.visual.roompark.presentation.screen.settings.util.PushListAdapter
import
com.biganto.visual.roompark.presentation.screen.splash.SplashScreenController
import
com.biganto.visual.roompark.util.extensions.bytesToSize
import
com.biganto.visual.roompark.util.extensions.setGone
import
com.bluelinelabs.conductor.RouterTransaction
import
com.bluelinelabs.conductor.changehandler.FadeChangeHandler
import
com.google.android.material.textview.MaterialTextView
...
...
@@ -83,6 +84,8 @@ class SettingsScreenController :
@BindView
(
R
.
id
.
clear_cache_button
)
lateinit
var
clearCacheButton
:
MaterialTextView
@BindView
(
R
.
id
.
progress_lock_background
)
lateinit
var
progressShame
:
View
private
fun
setToolbar
(){
toolBar
.
appBar
.
liftOnScrollTargetViewId
=
R
.
id
.
nestedScrollContainer
...
...
@@ -124,6 +127,7 @@ class SettingsScreenController :
is
SettingsScreenViewState
.
LoadSettingsList
->
render
(
viewState
)
is
SettingsScreenViewState
.
SomeError
->
render
(
viewState
)
is
SettingsScreenViewState
.
SignOut
->
render
(
viewState
)
is
SettingsScreenViewState
.
OnCacheDeleting
->
render
(
viewState
)
}
}
...
...
@@ -131,7 +135,12 @@ class SettingsScreenController :
showError
(
viewState
.
exception
)
private
fun
render
(
viewState
:
SettingsScreenViewState
.
Idle
){
progressShame
.
setGone
(
true
)
}
private
fun
render
(
viewState
:
SettingsScreenViewState
.
OnCacheDeleting
){
progressShame
.
setGone
(
viewState
.
progress
>=
1f
)
}
private
fun
render
(
viewState
:
SettingsScreenViewState
.
SignOut
){
...
...
app/src/main/res/layout/settings_screen.xml
View file @
89fe6434
...
...
@@ -147,5 +147,24 @@
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