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