mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-10 01:35:09 +01:00
Collasing bottom sheet's peak on small phones in landscape
This commit is contained in:
parent
033e4f205d
commit
596597c910
@ -425,23 +425,22 @@ class LibraryController(
|
||||
}
|
||||
|
||||
private fun onRefresh() {
|
||||
activity?.invalidateOptionsMenu()
|
||||
if (!MainActivity.bottomNav) activity?.invalidateOptionsMenu()
|
||||
presenter.requestFullUpdate()
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a filter is changed.
|
||||
*/
|
||||
private fun onFilterChanged(item: ExtendedNavigationView.Item) {
|
||||
if (item is ExtendedNavigationView.Item.MultiStateGroup &&
|
||||
item.resTitle == R.string.action_hide_categories) {
|
||||
activity?.invalidateOptionsMenu()
|
||||
private fun onFilterChanged(item: ExtendedNavigationView.Item?) {
|
||||
if (item is ExtendedNavigationView.Item.MultiStateGroup && item.resTitle == R.string.categories) {
|
||||
if (!MainActivity.bottomNav) activity?.invalidateOptionsMenu()
|
||||
presenter.requestFullUpdate()
|
||||
return
|
||||
}
|
||||
presenter.requestFilterUpdate()
|
||||
destroyActionModeIfNeeded()
|
||||
activity?.invalidateOptionsMenu()
|
||||
if (!MainActivity.bottomNav) activity?.invalidateOptionsMenu()
|
||||
}
|
||||
|
||||
private fun onDownloadBadgeChanged() {
|
||||
@ -452,7 +451,7 @@ class LibraryController(
|
||||
* Called when the sorting mode is changed.
|
||||
*/
|
||||
private fun onSortChanged() {
|
||||
activity?.invalidateOptionsMenu()
|
||||
if (!MainActivity.bottomNav) activity?.invalidateOptionsMenu()
|
||||
presenter.requestSortUpdate()
|
||||
}
|
||||
|
||||
@ -503,7 +502,13 @@ class LibraryController(
|
||||
!MainActivity.bottomNav
|
||||
preferences.librarySortingMode().getOrDefault() == LibrarySort.DRAG_AND_DROP &&
|
||||
!preferences.hideCategories().getOrDefault()
|
||||
menu.findItem(R.id.action_filter).isVisible = !MainActivity.bottomNav
|
||||
|
||||
val config = resources?.configuration
|
||||
|
||||
val phoneLandscape = (config?.orientation == Configuration.ORIENTATION_LANDSCAPE &&
|
||||
(config.screenLayout.and(Configuration.SCREENLAYOUT_SIZE_MASK)) <
|
||||
Configuration.SCREENLAYOUT_SIZE_LARGE)
|
||||
menu.findItem(R.id.action_library_filter).isVisible = !MainActivity.bottomNav || phoneLandscape
|
||||
reorderMenuItem = reorganizeItem
|
||||
enableReorderItems()
|
||||
|
||||
@ -519,7 +524,7 @@ class LibraryController(
|
||||
}
|
||||
|
||||
// Mutate the filter icon because it needs to be tinted and the resource is shared.
|
||||
menu.findItem(R.id.action_filter).icon.mutate()
|
||||
menu.findItem(R.id.action_library_filter).icon.mutate()
|
||||
|
||||
searchViewSubscription?.unsubscribe()
|
||||
searchViewSubscription = searchView.queryTextChanges()
|
||||
@ -549,7 +554,7 @@ class LibraryController(
|
||||
override fun onPrepareOptionsMenu(menu: Menu) {
|
||||
val navView = navView ?: return
|
||||
|
||||
val filterItem = menu.findItem(R.id.action_filter)
|
||||
val filterItem = menu.findItem(R.id.action_library_filter)
|
||||
|
||||
// Tint icon if there's a filter active
|
||||
val filterColor = if (navView.hasActiveFilters()) Color.rgb(255, 238, 7)
|
||||
@ -560,8 +565,10 @@ class LibraryController(
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
R.id.action_search -> expandActionViewFromInteraction = true
|
||||
R.id.action_filter -> {
|
||||
navView?.let { activity?.drawer?.openDrawer(GravityCompat.END) }
|
||||
R.id.action_library_filter -> {
|
||||
if (MainActivity.bottomNav) bottom_sheet.sheetBehavior?.state =
|
||||
BottomSheetBehavior.STATE_EXPANDED
|
||||
else navView?.let { activity?.drawer?.openDrawer(GravityCompat.END) }
|
||||
}
|
||||
R.id.action_edit_categories -> {
|
||||
router.pushController(CategoryController().withFadeTransaction())
|
||||
|
@ -3,10 +3,9 @@ package eu.kanade.tachiyomi.widget
|
||||
import android.animation.ObjectAnimator
|
||||
import android.animation.StateListAnimator
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.util.AttributeSet
|
||||
import com.google.android.material.R
|
||||
import com.google.android.material.appbar.AppBarLayout
|
||||
import android.util.AttributeSet
|
||||
|
||||
class ElevationAppBarLayout @JvmOverloads constructor(
|
||||
context: Context,
|
||||
|
@ -16,15 +16,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/scrollView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@ -182,7 +173,6 @@
|
||||
</LinearLayout>
|
||||
</HorizontalScrollView>
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/topbar"
|
||||
|
@ -12,7 +12,7 @@
|
||||
app:showAsAction="collapseActionView|ifRoom"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_filter"
|
||||
android:id="@+id/action_library_filter"
|
||||
android:icon="@drawable/ic_filter_list_white_24dp"
|
||||
android:title="@string/action_filter"
|
||||
app:showAsAction="ifRoom"/>
|
||||
|
Loading…
Reference in New Issue
Block a user