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
463ed781
Commit
463ed781
authored
Apr 22, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cache update info etc
parent
d9a1127f
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
23 deletions
+58
-23
StartToursDownloadingDialogController.kt
...ogs/tour_chooser/StartToursDownloadingDialogController.kt
+16
-5
settings.kt
...com/biganto/visual/roompark/domain/interactor/settings.kt
+7
-2
ScreenController.kt
...roompark/presentation/screen/settings/ScreenController.kt
+3
-3
ScreenPresenter.kt
.../roompark/presentation/screen/settings/ScreenPresenter.kt
+30
-9
tours_download_dialog_screen.xml
app/src/main/res/layout/tours_download_dialog_screen.xml
+2
-4
No files found.
app/src/main/java/com/biganto/visual/roompark/conductor/dialogs/tour_chooser/StartToursDownloadingDialogController.kt
View file @
463ed781
...
...
@@ -28,6 +28,7 @@ import dagger.Component
import
dagger.Module
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.disposables.CompositeDisposable
import
io.reactivex.schedulers.Schedulers
import
timber.log.Timber
import
java.util.concurrent.TimeUnit
import
javax.inject.Inject
...
...
@@ -43,7 +44,7 @@ class StartToursDownloadingDialogController : Controller {
constructor
(
args
:
Bundle
)
:
super
(
args
)
constructor
(
size
:
Long
)
:
super
(
Bundle
().
apply
{
putLong
(
TOTAL_SIZE_DOWNLOAD_KEY
,
size
)
}
)
constructor
(
size
:
Long
)
:
super
(
Bundle
().
apply
{
putLong
(
TOTAL_SIZE_DOWNLOAD_KEY
,
size
)
}
)
private
val
detachDisposable
=
CompositeDisposable
()
...
...
@@ -98,10 +99,20 @@ class StartToursDownloadingDialogController : Controller {
detachDisposable
.
add
(
view
.
findViewById
<
Button
>(
R
.
id
.
alert_ok_button
)
.
clicks
()
.
debounce
(
200
,
TimeUnit
.
MILLISECONDS
)
.
debounce
(
200
,
TimeUnit
.
MILLISECONDS
)
.
observeOn
(
Schedulers
.
io
())
.
flatMap
{
downloader
.
startToursDownloading
()
// .subscribeOn(Schedulers.computation())
.
doOnComplete
{
Timber
.
d
(
" C "
)
}
}
.
doOnComplete
{
Timber
.
d
(
" X "
)
}
// .subscribeOn(AndroidSchedulers.mainThread())
.
doOnComplete
{
Timber
.
d
(
" Xss "
)
}
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
flatMapCompletable
{
downloader
.
startToursDownloading
()
}
.
subscribe
({
Timber
.
d
(
" SUBSCRIBER "
)
snackbar
.
showSnackBar
(
R
.
string
.
download_all_tours_start_snackbar_message
)
handleBack
()
},{
...
...
@@ -112,8 +123,8 @@ class StartToursDownloadingDialogController : Controller {
)
)
//
view.findViewById<View>(R.id.close_current_button).setOnClickListener { handleBack() }
view
.
setOnClickListener
{
handleBack
()
}
view
.
findViewById
<
View
>(
R
.
id
.
close_current_button
).
setOnClickListener
{
handleBack
()
}
//
view.setOnClickListener { handleBack() }
return
view
}
...
...
app/src/main/java/com/biganto/visual/roompark/domain/interactor/settings.kt
View file @
463ed781
...
...
@@ -67,14 +67,19 @@ class SettingsInteractor @Inject constructor(
}
}
fun
startToursDownloading
()
:
Completable
=
fun
startToursDownloading
()
=
toursUc
.
downloadAllDeelsAndEstates
()
.
doOnNext
{
Timber
.
d
(
" gonna startService"
)
}
.
doOnNext
{
this
.
startDownloadService
()
}
.
delay
(
100
,
TimeUnit
.
MILLISECONDS
)
.
doOnNext
{
Timber
.
d
(
" gonna startServic222e"
)
}
.
doOnNext
{
tours
->
startDownloadService
(
tours
.
map
{
tour
->
tour
.
id
})
}.
ignoreElements
()
}
.
doOnNext
{
Timber
.
d
(
" gonna startServsdfsfdsice"
)
}
// .doOnComplete { Timber.w(" azzaza complete") }
fun
getSubscriptions
()
=
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/settings/ScreenController.kt
View file @
463ed781
...
...
@@ -132,9 +132,9 @@ class SettingsScreenController :
@OnClick
(
R
.
id
.
downloadToursIcon
)
fun
startDownloadingDialog
(){
router
.
setRoot
(
RouterTransaction
.
with
(
StartToursDownloadingDialogController
(
tempToursSize
))
.
pushChangeHandler
(
Fade
ChangeHandler
())
.
popChangeHandler
(
Fade
ChangeHandler
())
router
.
pushController
(
RouterTransaction
.
with
(
StartToursDownloadingDialogController
(
tempToursSize
))
.
pushChangeHandler
(
Dialog
ChangeHandler
())
.
popChangeHandler
(
Dialog
ChangeHandler
())
)
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/settings/ScreenPresenter.kt
View file @
463ed781
...
...
@@ -7,6 +7,7 @@ import com.biganto.visual.roompark.domain.model.CachedDataModel
import
com.biganto.visual.roompark.domain.model.SubscriptionModel
import
com.biganto.visual.roompark.domain.model.TitledSubscriptionModel
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
com.jakewharton.rxrelay2.PublishRelay
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
...
...
@@ -37,15 +38,27 @@ class SettingsScreenPresenter @Inject constructor(
override
fun
defaultErrorViewStateHandler
()
=
{
e
:
ExceptionString
->
SettingsScreenViewState
.
SomeError
(
e
)
}
override
fun
bindIntents
()
{
private
val
cacheSizeRefresher
=
PublishRelay
.
create
<
Int
>()
val
fetchToursSize
=
interactor
.
fetchToursSizes
()
private
val
cahcObs
=
cacheSizeRefresher
.
flatMap
{
Observable
.
merge
(
arrayListOf
(
fetchToursSize
,
fetchPlansSize
)
)
}
private
val
fetchToursSize
:
Observable
<
SettingsScreenViewState
>
=
interactor
.
fetchToursSizes
()
.
map
{
SettingsScreenViewState
.
OnSizePrefetch
(
it
)
}
val
fetchPlansSize
=
interactor
.
fetchPlanTypesSizes
()
private
val
fetchPlansSize
:
Observable
<
SettingsScreenViewState
>
=
interactor
.
fetchPlanTypesSizes
()
.
map
{
it
*
TYPICAL_PLAN_SIZE
}
.
map
{
SettingsScreenViewState
.
OnPlanTypesPrefetch
(
it
)
}
override
fun
bindIntents
()
{
// val onDownloadTours = intent(SettingsScreen::downloadAllTours)
// .flatMap { interactor.startToursDownloading()
// .andThen(Observable.just(SettingsScreenViewState.Idle()))
...
...
@@ -88,6 +101,7 @@ class SettingsScreenPresenter @Inject constructor(
.
doOnNext
{
cached
->
cached
.
sortBy
{
it
.
id
}
}
.
doOnNext
{
restoreModel
.
cacheInfo
=
it
}
.
map
{
SettingsScreenViewState
.
LoadCachInfo
(
it
)
}
.
doOnNext
{
cacheSizeRefresher
.
accept
(
1
)
}
val
fetchSubscriptions
=
interactor
.
getSubscriptions
()
.
doOnNext
{
restoreModel
.
subs
=
it
.
toMutableList
()
}
...
...
@@ -109,28 +123,35 @@ class SettingsScreenPresenter @Inject constructor(
interactor
.
deleteCacheFiles
()
.
map
<
SettingsScreenViewState
>
{
Timber
.
d
(
" got progress: ${it.first} / ${it.second.toFloat()}"
)
if
(
it
.
first
==
it
.
second
)
cacheSizeRefresher
.
accept
(
1
)
SettingsScreenViewState
.
OnCacheDeleting
(
it
.
first
/
it
.
second
.
toFloat
()
)
}
.
delay
(
600
,
TimeUnit
.
MILLISECONDS
)
.
startWith
(
SettingsScreenViewState
.
OnCacheDeleting
(
0f
))
.
doOnError
{
Timber
.
e
(
it
)
}
.
subscribeOn
(
Schedulers
.
io
())
}
val
state
=
Observable
.
mergeDelayError
(
arrayListOf
(
restoreStateObservable
,
fetchPlansSize
,
cahcObs
,
// fetchPlansSize,
fetchSettings
,
onSignOut
,
onClearCache
,
refreshInfo
,
fetchSubscriptions
,
fetchCache
,
onSubChecked
,
onSubChecked
// onDownloadTours,
fetchToursSize
//
fetchToursSize
)
)
.
doOnError
{
Timber
.
e
(
it
)
}
...
...
app/src/main/res/layout/tours_download_dialog_screen.xml
View file @
463ed781
...
...
@@ -24,6 +24,8 @@
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"16dp"
android:layout_marginEnd=
"8dp"
android:orientation=
"vertical"
>
<com.google.android.material.textview.MaterialTextView
...
...
@@ -40,8 +42,6 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_margin=
"2dp"
android:layout_marginStart=
"8dp"
android:layout_marginEnd=
"8dp"
android:text=
"@string/download_all_tours_size_title"
/>
...
...
@@ -51,8 +51,6 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_margin=
"2dp"
android:layout_marginStart=
"8dp"
android:layout_marginEnd=
"8dp"
android:text=
"@string/download_all_tours_disk_size_title"
/>
<LinearLayout
...
...
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