From b38b74d95dfecc3bd788bb4e77e11dc16e48502a Mon Sep 17 00:00:00 2001 From: Jay Date: Sun, 19 Apr 2020 17:57:35 -0400 Subject: [PATCH] Using appbar for reader, removing tablayout in main activity xml and a pill in the reader chapters sheet --- .../tachiyomi/ui/reader/ReaderActivity.kt | 10 +-- .../tachiyomi/ui/reader/ReaderChapterSheet.kt | 1 + app/src/main/res/layout/main_activity.xml | 18 +--- app/src/main/res/layout/reader_activity.xml | 14 ++- .../main/res/layout/reader_chapters_sheet.xml | 88 ++++++++++++------- 5 files changed, 75 insertions(+), 56 deletions(-) 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 aa3430a679..84691e0199 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 @@ -314,8 +314,8 @@ class ReaderActivity : BaseRxActivity(), setSupportActionBar(toolbar) val primaryColor = ColorUtils.setAlphaComponent(getResourceColor(R.attr.colorSecondary), 200) - toolbar.setBackgroundColor(primaryColor) - window.statusBarColor = primaryColor + appbar.setBackgroundColor(primaryColor) + window.statusBarColor = Color.TRANSPARENT supportActionBar?.setDisplayHomeAsUpEnabled(true) toolbar.setNavigationOnClickListener { onBackPressed() @@ -384,7 +384,7 @@ class ReaderActivity : BaseRxActivity(), window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) } }) - toolbar.startAnimation(toolbarAnimation) + appbar.startAnimation(toolbarAnimation) } BottomSheetBehavior.from(chapters_bottom_sheet).state = BottomSheetBehavior.STATE_COLLAPSED } @@ -398,7 +398,7 @@ class ReaderActivity : BaseRxActivity(), reader_menu.visibility = View.GONE } }) - toolbar.startAnimation(toolbarAnimation) + appbar.startAnimation(toolbarAnimation) BottomSheetBehavior.from(chapters_bottom_sheet).isHideable = true BottomSheetBehavior.from(chapters_bottom_sheet).state = BottomSheetBehavior.STATE_HIDDEN } else @@ -658,7 +658,7 @@ class ReaderActivity : BaseRxActivity(), window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) } }) - toolbar.startAnimation(toolbarAnimation) + appbar.startAnimation(toolbarAnimation) } } else { if (menuStickyVisible && !menuVisible) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderChapterSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderChapterSheet.kt index 3746b5df0f..f3f5e60fd9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderChapterSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderChapterSheet.kt @@ -67,6 +67,7 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr } sheetBehavior?.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() { override fun onSlide(bottomSheet: View, progress: Float) { + pill.alpha = (1 - max(0f, progress)) * 0.25f val trueProgress = max(progress, 0f) backgroundTintList = ColorStateList.valueOf(lerpColor(primary, fullPrimary, trueProgress)) diff --git a/app/src/main/res/layout/main_activity.xml b/app/src/main/res/layout/main_activity.xml index e98ad8fd8d..c7b8866566 100644 --- a/app/src/main/res/layout/main_activity.xml +++ b/app/src/main/res/layout/main_activity.xml @@ -24,9 +24,9 @@ android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" - android:theme="?attr/actionBarTheme" android:background="?attr/colorSecondary" android:stateListAnimator="@null" + android:theme="?attr/actionBarTheme" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent"> @@ -59,22 +59,6 @@ tools:text="Title Text" /> - - - + + android:background="@android:color/transparent" /> + + diff --git a/app/src/main/res/layout/reader_chapters_sheet.xml b/app/src/main/res/layout/reader_chapters_sheet.xml index 85ef1aedb7..128e90ecd1 100644 --- a/app/src/main/res/layout/reader_chapters_sheet.xml +++ b/app/src/main/res/layout/reader_chapters_sheet.xml @@ -11,51 +11,73 @@ app:behavior_peekHeight="?attr/actionBarSize" app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"> - + android:layout_height="wrap_content"> - + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - - + - - + + + + + + + + + tools:listitem="@layout/reader_chapter_item" /> \ No newline at end of file