Cleaning up the library xml

This commit is contained in:
Jay 2020-05-20 20:58:02 -04:00
parent f78daf7156
commit 271db63db8
3 changed files with 15 additions and 37 deletions

View File

@ -358,7 +358,7 @@ class LibraryController(
elevateAppBar =
scrollViewWith(recycler, swipeRefreshLayout = swipe_refresh, afterInsets = { insets ->
category_layout?.updateLayoutParams<ViewGroup.MarginLayoutParams> {
category_recycler?.updateLayoutParams<ViewGroup.MarginLayoutParams> {
topMargin = recycler?.paddingTop ?: 0
}
fast_scroller?.updateLayoutParams<ViewGroup.MarginLayoutParams> {
@ -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)

View File

@ -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)

View File

@ -17,32 +17,19 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
<FrameLayout
android:id="@+id/recycler_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/category_layout"
<eu.kanade.tachiyomi.ui.library.category.CategoryRecyclerView
android:id="@+id/category_recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="?actionBarSize"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<eu.kanade.tachiyomi.ui.library.category.CategoryRecyclerView
android:id="@+id/category_recycler"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:paddingBottom="4dp"
android:scrollbars="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
android:scrollbars="vertical" />
<View
android:id="@+id/recycler_shadow"
@ -55,12 +42,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<include
layout="@layout/library_grid_recycler"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<include layout="@layout/library_grid_recycler" />
<View
android:id="@+id/recycler_cover"
@ -68,12 +50,8 @@
android:layout_height="match_parent"
android:alpha="0"
android:background="@drawable/bottom_sheet_rounded_background"
android:backgroundTint="?android:textColorPrimaryInverse"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
android:backgroundTint="?android:textColorPrimaryInverse" />
</FrameLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>