From 271db63db847c5bf8fec7bbbefd8d95944171a48 Mon Sep 17 00:00:00 2001 From: Jay Date: Wed, 20 May 2020 20:58:02 -0400 Subject: [PATCH] Cleaning up the library xml --- .../tachiyomi/ui/library/LibraryController.kt | 7 ++-- .../library/category/CategoryRecyclerView.kt | 5 +-- .../res/layout/library_list_controller.xml | 40 +++++-------------- 3 files changed, 15 insertions(+), 37 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt index 2064d3d90b..747f7f9a9e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt @@ -358,7 +358,7 @@ class LibraryController( elevateAppBar = scrollViewWith(recycler, swipeRefreshLayout = swipe_refresh, afterInsets = { insets -> - category_layout?.updateLayoutParams { + category_recycler?.updateLayoutParams { topMargin = recycler?.paddingTop ?: 0 } fast_scroller?.updateLayoutParams { @@ -802,15 +802,16 @@ class LibraryController( private fun showCategories(show: Boolean) { recycler_cover.isClickable = show recycler_cover.isFocusable = show - val full = category_layout.height.toFloat() + recycler.paddingTop + val full = category_recycler.height.toFloat() + recycler.paddingTop val translateY = if (show) full else 0f recycler.animate().translationY(translateY).start() category_hopper_frame.animate().translationY(translateY).start() - recycler_shadow.animate().translationY(translateY + 12.dpToPx).start() + recycler_shadow.animate().translationY(translateY - 8.dpToPx).start() recycler_cover.animate().translationY(translateY).start() recycler_cover.animate().alpha(if (show) 0.75f else 0f).start() recycler.suppressLayout(show) activity?.toolbar?.showDropdown(!show) + swipe_refresh.isEnabled = !show setTitle() if (show) { category_recycler.scrollToCategory(activeCategory) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/category/CategoryRecyclerView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/category/CategoryRecyclerView.kt index 96b6b00938..d396dd584e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/category/CategoryRecyclerView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/category/CategoryRecyclerView.kt @@ -70,9 +70,8 @@ class CategoryRecyclerView @JvmOverloads constructor( } override fun onMeasure(widthSpec: Int, heightSpec: Int) { - val recyclerView = (parent as ViewGroup) - val mainView = (parent.parent.parent.parent as ViewGroup) - val top = recyclerView.marginTop + val mainView = (parent.parent.parent as ViewGroup) + val top = marginTop val parent = mainView.measuredHeight - top - 100.dpToPx val heightS = if (parent > 0) { MeasureSpec.makeMeasureSpec(parent, MeasureSpec.AT_MOST) diff --git a/app/src/main/res/layout/library_list_controller.xml b/app/src/main/res/layout/library_list_controller.xml index b32cd75ac0..2b4a77d44b 100644 --- a/app/src/main/res/layout/library_list_controller.xml +++ b/app/src/main/res/layout/library_list_controller.xml @@ -17,32 +17,19 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - - - - - + android:clipToPadding="false" + android:paddingBottom="4dp" + android:scrollbars="vertical" /> - + - + android:backgroundTint="?android:textColorPrimaryInverse" /> +