diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/ChaptersPagesSheet.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/ChaptersPagesSheet.kt index 98be2923a..8e86ff6a6 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/ChaptersPagesSheet.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/ChaptersPagesSheet.kt @@ -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(), 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(), 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 } } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/main/ui/MainActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/main/ui/MainActivity.kt index 394f1acae..480aaff69 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/main/ui/MainActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/main/ui/MainActivity.kt @@ -420,8 +420,8 @@ class MainActivity : BaseActivity(), AppBarOwner, BottomNav } viewBinding.container.updateLayoutParams { bottomMargin = if (isPinned) { - (bottomNavBar?.measureHeight() ?: 0) - .coerceAtLeast(resources.getDimensionPixelSize(materialR.dimen.m3_bottom_nav_min_height)) + (bottomNavBar?.measureHeight() + ?.coerceAtLeast(resources.getDimensionPixelSize(materialR.dimen.m3_bottom_nav_min_height)) ?: 0) } else { 0 } diff --git a/app/src/main/res/layout-w600dp-land/activity_details.xml b/app/src/main/res/layout-w600dp-land/activity_details.xml index b23fdc17d..70dae8b17 100644 --- a/app/src/main/res/layout-w600dp-land/activity_details.xml +++ b/app/src/main/res/layout-w600dp-land/activity_details.xml @@ -3,10 +3,10 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/layout_root" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".details.ui.DetailsActivity" + tools:ignore="ViewBindingType" tools:viewBindingType="android.view.ViewGroup">