mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 18:56:44 -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) {
|
||||
zimManageViewModel.currentTabIndex(position)
|
||||
zimManageViewModel.currentPage.offer(position)
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent?) {
|
||||
|
@ -103,12 +103,12 @@ class ZimManageViewModel @Inject constructor(
|
||||
val deviceListIsRefreshing = MutableLiveData<Boolean>()
|
||||
val libraryListIsRefreshing = MutableLiveData<Boolean>()
|
||||
val networkStates = MutableLiveData<NetworkState>()
|
||||
val currentPage = MutableLiveData<Int>()
|
||||
|
||||
val requestFileSystemCheck = PublishProcessor.create<Unit>()
|
||||
val fileSelectActions = PublishProcessor.create<FileSelectActions>()
|
||||
val requestDownloadLibrary = BehaviorProcessor.createDefault<Unit>(Unit)
|
||||
val requestFiltering = BehaviorProcessor.createDefault<String>("")
|
||||
val currentPage = PublishProcessor.create<Int>()
|
||||
|
||||
private val compositeDisposable = CompositeDisposable()
|
||||
|
||||
@ -158,10 +158,6 @@ class ZimManageViewModel @Inject constructor(
|
||||
)
|
||||
}, Throwable::printStackTrace)
|
||||
|
||||
fun currentTabIndex(position: Int) {
|
||||
currentPage.value = position
|
||||
}
|
||||
|
||||
private fun startMultiSelectionAndSelectBook(
|
||||
bookOnDisk: BookOnDisk
|
||||
): StartMultiSelection {
|
||||
|
@ -112,11 +112,7 @@ class ZimFileSelectFragment : BaseFragment() {
|
||||
zimManageViewModel.fileSelectActions.offer(FileSelectActions.RestartActionMode)
|
||||
}
|
||||
|
||||
zimManageViewModel.currentPage.observe(viewLifecycleOwner, Observer<Int> { currentPage ->
|
||||
if (currentPage == 1) {
|
||||
finishActionMode()
|
||||
}
|
||||
})
|
||||
zimManageViewModel.currentPage.map { it == 1 }.subscribe { if (it) finishActionMode() }
|
||||
}
|
||||
|
||||
private fun finishActionMode() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user