Using appbar for reader, removing tablayout in main activity xml

and a pill in the reader chapters sheet
This commit is contained in:
Jay 2020-04-19 17:57:35 -04:00
parent 732b7c3414
commit b38b74d95d
5 changed files with 75 additions and 56 deletions

View File

@ -314,8 +314,8 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
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<ReaderPresenter>(),
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<ReaderPresenter>(),
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<ReaderPresenter>(),
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
}
})
toolbar.startAnimation(toolbarAnimation)
appbar.startAnimation(toolbarAnimation)
}
} else {
if (menuStickyVisible && !menuVisible) {

View File

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

View File

@ -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" />
</LinearLayout>
</eu.kanade.tachiyomi.ui.base.CenteredToolbar>
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabs"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorPrimary"
android:theme="@style/Theme.ActionBar.Tab"
app:tabGravity="center"
app:tabIndicatorColor="?attr/actionBarTintColor"
app:tabInlineLabel="true"
app:tabMinWidth="75dp"
app:tabMode="auto"
app:tabRippleColor="@color/rippleColor"
app:tabTextColor="?attr/actionBarTintColor" />
</com.google.android.material.appbar.AppBarLayout>
<com.google.android.material.bottomnavigation.BottomNavigationView

View File

@ -41,12 +41,24 @@
android:background="@android:color/transparent"
android:visibility="invisible"
tools:visibility="visible">
<com.google.android.material.appbar.AppBarLayout
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"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?colorSecondary" />
android:background="@android:color/transparent" />
</com.google.android.material.appbar.AppBarLayout>
<include layout="@layout/reader_chapters_sheet"/>

View File

@ -11,51 +11,73 @@
app:behavior_peekHeight="?attr/actionBarSize"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
<LinearLayout
android:id="@+id/title_layout"
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/topbar_layout"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="top"
android:orientation="horizontal">
android:layout_height="wrap_content">
<ImageButton
android:id="@+id/chapters_button"
<ImageView
android:id="@+id/pill"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:alpha="0.25"
android:contentDescription="@string/drag_handle"
android:src="@drawable/draggable_pill"
android:tint="?actionBarTintColor"
android:tooltipText="@string/view_chapters"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/next"
android:padding="@dimen/material_layout_keylines_screen_edge_margin"
app:srcCompat="@drawable/ic_format_list_numbered_24dp" />
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--
Wonky way of setting height due to issues with horizontally centering the thumb in Android 5.
See https://stackoverflow.com/questions/15701767/android-thumb-is-not-centered-in-seekbar
-->
<eu.kanade.tachiyomi.ui.reader.ReaderSeekBar
android:id="@+id/page_seekbar"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
/>
<LinearLayout
android:id="@+id/seekbar_layout"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="top"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/page_text"
android:layout_width="100dp"
android:layout_height="match_parent"
android:tint="?actionBarTintColor"
android:gravity="center"
android:textSize="15sp"
tools:text="100 / 105" />
</LinearLayout>
<ImageButton
android:id="@+id/chapters_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/next"
android:padding="@dimen/material_layout_keylines_screen_edge_margin"
android:tint="?actionBarTintColor"
android:tooltipText="@string/view_chapters"
app:srcCompat="@drawable/ic_format_list_numbered_24dp" />
<!--
Wonky way of setting height due to issues with horizontally centering the thumb in Android 5.
See https://stackoverflow.com/questions/15701767/android-thumb-is-not-centered-in-seekbar
-->
<eu.kanade.tachiyomi.ui.reader.ReaderSeekBar
android:id="@+id/page_seekbar"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<TextView
android:id="@+id/page_text"
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="15sp"
android:textColor="?actionBarTintColor"
tools:text="100 / 105" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/chapter_recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:attr/colorBackground"
android:alpha="0"
android:background="?android:attr/colorBackground"
android:clipToPadding="false"
tools:listitem="@layout/reader_chapter_item"/>
tools:listitem="@layout/reader_chapter_item" />
</eu.kanade.tachiyomi.ui.reader.ReaderChapterSheet>