|
|
|
|
@ -8,7 +8,6 @@ import androidx.appcompat.view.ActionMode
|
|
|
|
|
import androidx.core.view.isVisible
|
|
|
|
|
import androidx.fragment.app.FragmentManager
|
|
|
|
|
import androidx.fragment.app.activityViewModels
|
|
|
|
|
import androidx.lifecycle.Lifecycle
|
|
|
|
|
import com.google.android.material.tabs.TabLayoutMediator
|
|
|
|
|
import dagger.hilt.android.AndroidEntryPoint
|
|
|
|
|
import org.koitharu.kotatsu.core.exceptions.resolve.SnackbarErrorObserver
|
|
|
|
|
@ -74,10 +73,12 @@ class ChaptersPagesSheet : BaseAdaptiveSheet<SheetChaptersPagesBinding>(), Actio
|
|
|
|
|
actionModeDelegate?.addListener(this, viewLifecycleOwner)
|
|
|
|
|
addSheetCallback(this, viewLifecycleOwner)
|
|
|
|
|
|
|
|
|
|
viewModel.onError.observeEvent(viewLifecycleOwner, SnackbarErrorObserver(binding.pager, this))
|
|
|
|
|
viewModel.onActionDone.observeEvent(viewLifecycleOwner, ReversibleActionObserver(binding.pager, null))
|
|
|
|
|
viewModel.onDownloadStarted.observeEvent(viewLifecycleOwner, DownloadStartedObserver(binding.pager))
|
|
|
|
|
viewModel.newChaptersCount.observe(viewLifecycleOwner, ::onNewChaptersChanged)
|
|
|
|
|
if (dialog != null) {
|
|
|
|
|
viewModel.onError.observeEvent(viewLifecycleOwner, SnackbarErrorObserver(binding.pager, this))
|
|
|
|
|
viewModel.onActionDone.observeEvent(viewLifecycleOwner, ReversibleActionObserver(binding.pager, null))
|
|
|
|
|
viewModel.onDownloadStarted.observeEvent(viewLifecycleOwner, DownloadStartedObserver(binding.pager))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun onStateChanged(sheet: View, newState: Int) {
|
|
|
|
|
@ -151,7 +152,7 @@ class ChaptersPagesSheet : BaseAdaptiveSheet<SheetChaptersPagesBinding>(), Actio
|
|
|
|
|
|
|
|
|
|
fun isShown(fm: FragmentManager): Boolean {
|
|
|
|
|
val sheet = fm.findFragmentByTag(TAG) as? ChaptersPagesSheet
|
|
|
|
|
return sheet != null && sheet.lifecycle.currentState.isAtLeast(Lifecycle.State.STARTED)
|
|
|
|
|
return sheet?.dialog?.isShowing == true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|