diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index 795deb5f66..07c53aeab6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -388,6 +388,14 @@ class ReaderActivity : } } + binding.touchView.setOnTouchListener { v, event -> + if (event.action == MotionEvent.ACTION_DOWN) { + if (binding.chaptersSheet.chaptersBottomSheet.sheetBehavior.isExpanded()) { + binding.chaptersSheet.chaptersBottomSheet.sheetBehavior?.collapse() + } + } + false + } val readerNavGestureDetector = ReaderNavGestureDetector(this) val gestureDetector = GestureDetectorCompat(this, readerNavGestureDetector) with(binding.readerNav) { @@ -680,7 +688,7 @@ class ReaderActivity : */ @SuppressLint("SetTextI18n") fun onPageSelected(page: ReaderPage) { - val newChapter = presenter.onPageSelected(page) + presenter.onPageSelected(page) val pages = page.chapter.pages ?: return val currentPage = page.number @@ -696,14 +704,9 @@ class ReaderActivity : binding.readerNav.leftPageText.text = currentPage.toString() binding.readerNav.rightPageText.text = totalPages.toString() } - if (!newChapter && binding.chaptersSheet.chaptersBottomSheet.shouldCollapse && binding.chaptersSheet.chaptersBottomSheet.sheetBehavior.isExpanded()) { - binding.chaptersSheet.chaptersBottomSheet.sheetBehavior?.collapse() - } if (binding.chaptersSheet.chaptersBottomSheet.selectedChapterId != page.chapter.chapter.id) { binding.chaptersSheet.chaptersBottomSheet.refreshList() } - binding.chaptersSheet.chaptersBottomSheet.shouldCollapse = true - // Set seekbar progress binding.readerNav.pageSeekbar.max = pages.lastIndex binding.readerNav.pageSeekbar.progress = page.index diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt index 9d9697d8dc..1fb872f15a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt @@ -458,8 +458,8 @@ class ReaderPresenter( * read, update tracking services, enqueue downloaded chapter deletion, and updating the active chapter if this * [page]'s chapter is different from the currently active. */ - fun onPageSelected(page: ReaderPage): Boolean { - val currentChapters = viewerChaptersRelay.value ?: return false + fun onPageSelected(page: ReaderPage) { + val currentChapters = viewerChaptersRelay.value ?: return val selectedChapter = page.chapter @@ -477,9 +477,7 @@ class ReaderPresenter( Timber.d("Setting ${selectedChapter.chapter.url} as active") onChapterChanged(currentChapters.currChapter) loadNewChapter(selectedChapter) - return true } - return false } /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/chapter/ReaderChapterSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/chapter/ReaderChapterSheet.kt index ec0f717d73..86e907a966 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/chapter/ReaderChapterSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/chapter/ReaderChapterSheet.kt @@ -41,7 +41,6 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr lateinit var presenter: ReaderPresenter var adapter: FastAdapter? = null private val itemAdapter = ItemAdapter() - var shouldCollapse = true var selectedChapterId = -1L var loadingPos = 0 @@ -98,7 +97,6 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr override fun onStateChanged(p0: View, state: Int) { if (state == BottomSheetBehavior.STATE_COLLAPSED) { - shouldCollapse = true sheetBehavior?.isHideable = false (binding.chapterRecycler.layoutManager as LinearLayoutManager).scrollToPositionWithOffset( adapter?.getPosition(presenter.getCurrentChapter()?.chapter?.id ?: 0L) ?: 0, @@ -136,7 +134,6 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr activity.binding.readerNav.leftChapter.invisible() activity.binding.readerNav.rightChapter.invisible() - shouldCollapse = false presenter.loadChapter(item.chapter) loadingPos = position val itemView = (binding.chapterRecycler.findViewHolderForAdapterPosition(position) as? ReaderChapterItem.ViewHolder)?.binding diff --git a/app/src/main/res/layout/reader_activity.xml b/app/src/main/res/layout/reader_activity.xml index 160665a12c..0c8840d3ac 100644 --- a/app/src/main/res/layout/reader_activity.xml +++ b/app/src/main/res/layout/reader_activity.xml @@ -63,6 +63,12 @@ + +