From 2d66185a02d22d0033bd6537d6cb4f31dc24829b Mon Sep 17 00:00:00 2001 From: Jay Date: Sat, 29 Feb 2020 18:58:55 -0800 Subject: [PATCH] Hide the title for single categories Updates to swiping to to otehr categories Started framework of merging manga info/chapters --- .../tachiyomi/ui/library/LibraryHeaderItem.kt | 3 +- .../ui/library/LibraryListController.kt | 12 +- .../kanade/tachiyomi/ui/main/MainActivity.kt | 3 +- app/src/main/res/drawable/full_gradient.xml | 12 + .../main/res/layout/big_manga_controller.xml | 342 ++++++++++++++++++ 5 files changed, 366 insertions(+), 6 deletions(-) create mode 100644 app/src/main/res/drawable/full_gradient.xml create mode 100644 app/src/main/res/layout/big_manga_controller.xml diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderItem.kt index f6337545f2..8924e993cf 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderItem.kt @@ -95,7 +95,8 @@ class LibraryHeaderItem(private val categoryF: (Int) -> Category, val catId: Int topMargin = (if (category.isFirst == true) 2 else 32).dpToPx } - sectionText.text = category.name + if (category.isFirst == true && category.isLast == true) sectionText.text = "" + else sectionText.text = category.name sortText.text = itemView.context.getString(R.string.sort_by_, itemView.context.getString( when (category.sortingMode()) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt index 1a8a4caeb9..79c7d31410 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt @@ -68,7 +68,8 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle), private var lastItem:IFlexible<*>? = null private lateinit var customTitleSpinner: LinearLayout private lateinit var titlePopupMenu:PopupMenu - var switchingCategories = false + + private var switchingCategories = false /** * Recycler view of the list of manga. @@ -589,10 +590,13 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle), override fun onSwipeRight(x: Float, y: Float) = goToNextCategory(x, y,1) private fun goToNextCategory(x: Float, y: Float, offset: Int) { - val editTextRect = Rect() - bottom_sheet.getGlobalVisibleRect(editTextRect) + val sheetRect = Rect() + val recyclerRect = Rect() + bottom_sheet.getGlobalVisibleRect(sheetRect) + recycler.getGlobalVisibleRect(recyclerRect) - if (editTextRect.contains(x.toInt(), y.toInt())) { + if (sheetRect.contains(x.toInt(), y.toInt()) || + !recyclerRect.contains(x.toInt(), y.toInt())) { return } val position = diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index 521f3111c9..95e40491bf 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -589,6 +589,7 @@ open class MainActivity : BaseActivity(), DownloadServiceListener { override fun onFling( e1: MotionEvent, e2: MotionEvent, velocityX: Float, velocityY: Float ): Boolean { + if (currentGestureDelegate == null) return false var result = false try { val diffY = e2.y - e1.y @@ -596,7 +597,7 @@ open class MainActivity : BaseActivity(), DownloadServiceListener { if (abs(diffX) > abs(diffY)) { if (abs(diffX) > Companion.SWIPE_THRESHOLD && abs(velocityX) > Companion.SWIPE_VELOCITY_THRESHOLD - && abs(diffY) <= Companion.SWIPE_THRESHOLD / 2 + && abs(diffY) <= Companion.SWIPE_THRESHOLD * 0.75f ) { if (diffX > 0) { currentGestureDelegate?.onSwipeRight(e1.x, e1.y) diff --git a/app/src/main/res/drawable/full_gradient.xml b/app/src/main/res/drawable/full_gradient.xml new file mode 100644 index 0000000000..f976e3b614 --- /dev/null +++ b/app/src/main/res/drawable/full_gradient.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/big_manga_controller.xml b/app/src/main/res/layout/big_manga_controller.xml new file mode 100644 index 0000000000..3ff9738d63 --- /dev/null +++ b/app/src/main/res/layout/big_manga_controller.xml @@ -0,0 +1,342 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +