mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-08 23:07:26 -04:00
Use a publish processor for finishing action mode
Use a publish processor for finishing action mode
This commit is contained in:
parent
35d793756c
commit
78214dd255
@ -75,7 +75,7 @@ class ZimManageActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun updatePage(position: Int) {
|
private fun updatePage(position: Int) {
|
||||||
zimManageViewModel.currentTabIndex(position)
|
zimManageViewModel.currentPage.offer(position)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onNewIntent(intent: Intent?) {
|
override fun onNewIntent(intent: Intent?) {
|
||||||
|
@ -103,12 +103,12 @@ class ZimManageViewModel @Inject constructor(
|
|||||||
val deviceListIsRefreshing = MutableLiveData<Boolean>()
|
val deviceListIsRefreshing = MutableLiveData<Boolean>()
|
||||||
val libraryListIsRefreshing = MutableLiveData<Boolean>()
|
val libraryListIsRefreshing = MutableLiveData<Boolean>()
|
||||||
val networkStates = MutableLiveData<NetworkState>()
|
val networkStates = MutableLiveData<NetworkState>()
|
||||||
val currentPage = MutableLiveData<Int>()
|
|
||||||
|
|
||||||
val requestFileSystemCheck = PublishProcessor.create<Unit>()
|
val requestFileSystemCheck = PublishProcessor.create<Unit>()
|
||||||
val fileSelectActions = PublishProcessor.create<FileSelectActions>()
|
val fileSelectActions = PublishProcessor.create<FileSelectActions>()
|
||||||
val requestDownloadLibrary = BehaviorProcessor.createDefault<Unit>(Unit)
|
val requestDownloadLibrary = BehaviorProcessor.createDefault<Unit>(Unit)
|
||||||
val requestFiltering = BehaviorProcessor.createDefault<String>("")
|
val requestFiltering = BehaviorProcessor.createDefault<String>("")
|
||||||
|
val currentPage = PublishProcessor.create<Int>()
|
||||||
|
|
||||||
private val compositeDisposable = CompositeDisposable()
|
private val compositeDisposable = CompositeDisposable()
|
||||||
|
|
||||||
@ -158,10 +158,6 @@ class ZimManageViewModel @Inject constructor(
|
|||||||
)
|
)
|
||||||
}, Throwable::printStackTrace)
|
}, Throwable::printStackTrace)
|
||||||
|
|
||||||
fun currentTabIndex(position: Int) {
|
|
||||||
currentPage.value = position
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun startMultiSelectionAndSelectBook(
|
private fun startMultiSelectionAndSelectBook(
|
||||||
bookOnDisk: BookOnDisk
|
bookOnDisk: BookOnDisk
|
||||||
): StartMultiSelection {
|
): StartMultiSelection {
|
||||||
|
@ -112,11 +112,7 @@ class ZimFileSelectFragment : BaseFragment() {
|
|||||||
zimManageViewModel.fileSelectActions.offer(FileSelectActions.RestartActionMode)
|
zimManageViewModel.fileSelectActions.offer(FileSelectActions.RestartActionMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
zimManageViewModel.currentPage.observe(viewLifecycleOwner, Observer<Int> { currentPage ->
|
zimManageViewModel.currentPage.map { it == 1 }.subscribe { if (it) finishActionMode() }
|
||||||
if (currentPage == 1) {
|
|
||||||
finishActionMode()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun finishActionMode() {
|
private fun finishActionMode() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user