diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/widgets/TouchBlockLayout.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/widgets/TouchBlockLayout.kt new file mode 100644 index 000000000..97570db19 --- /dev/null +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/widgets/TouchBlockLayout.kt @@ -0,0 +1,22 @@ +package org.koitharu.kotatsu.core.ui.widgets + +import android.content.Context +import android.util.AttributeSet +import android.view.MotionEvent +import android.widget.FrameLayout + +class TouchBlockLayout @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null +) : FrameLayout(context, attrs) { + + var isTouchEventsAllowed = true + + override fun onInterceptTouchEvent( + ev: MotionEvent? + ): Boolean = if (isTouchEventsAllowed) { + super.onInterceptTouchEvent(ev) + } else { + true + } +} 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 f76f0bd01..5c7655344 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 @@ -99,10 +99,11 @@ class ChaptersPagesSheet : BaseAdaptiveSheet(), override fun onApplyWindowInsets(v: View, insets: WindowInsetsCompat): WindowInsetsCompat = insets override fun onStateChanged(sheet: View, newState: Int) { - if (newState == STATE_DRAGGING || newState == STATE_SETTLING) { - return - } - val binding = viewBinding ?: return + val binding = viewBinding ?: return + binding.layoutTouchBlock.isTouchEventsAllowed = newState != STATE_COLLAPSED + if (newState == STATE_DRAGGING || newState == STATE_SETTLING) { + return + } val isActionModeStarted = actionModeDelegate?.isActionModeStarted == true binding.toolbar.menuView?.isVisible = newState == STATE_EXPANDED && !isActionModeStarted binding.splitButtonRead.isVisible = newState != STATE_EXPANDED && !isActionModeStarted diff --git a/app/src/main/res/layout/sheet_chapters_pages.xml b/app/src/main/res/layout/sheet_chapters_pages.xml index adfb49d32..1aa16f996 100644 --- a/app/src/main/res/layout/sheet_chapters_pages.xml +++ b/app/src/main/res/layout/sheet_chapters_pages.xml @@ -1,82 +1,88 @@ + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> - + - + - + - + - + -