diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCatalogueController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCatalogueController.kt index 91be18e4c9..4934ffee4f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCatalogueController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCatalogueController.kt @@ -9,7 +9,6 @@ import android.view.MenuItem import android.view.View import android.view.ViewGroup import androidx.appcompat.widget.SearchView -import androidx.core.view.GravityCompat import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView @@ -24,10 +23,10 @@ import eu.kanade.tachiyomi.data.database.models.Category import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.source.CatalogueSource +import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.ui.base.controller.NucleusController -import eu.kanade.tachiyomi.ui.base.controller.SecondaryDrawerController import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.catalogue.CatalogueController import eu.kanade.tachiyomi.ui.library.ChangeMangaCategoriesDialog @@ -35,32 +34,28 @@ import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.ui.manga.MangaDetailsController import eu.kanade.tachiyomi.ui.webview.WebViewActivity import eu.kanade.tachiyomi.util.system.connectivityManager -import eu.kanade.tachiyomi.util.view.HeightTopWindowInsetsListener -import eu.kanade.tachiyomi.util.view.RecyclerWindowInsetsListener +import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.view.gone import eu.kanade.tachiyomi.util.view.inflate -import eu.kanade.tachiyomi.util.view.marginBottom -import eu.kanade.tachiyomi.util.view.marginTop import eu.kanade.tachiyomi.util.view.scrollViewWith import eu.kanade.tachiyomi.util.view.snack import eu.kanade.tachiyomi.util.view.updateLayoutParams -import eu.kanade.tachiyomi.util.view.updatePaddingRelative import eu.kanade.tachiyomi.util.view.visible +import eu.kanade.tachiyomi.util.view.visibleIf import eu.kanade.tachiyomi.widget.AutofitRecyclerView -import java.util.concurrent.TimeUnit import kotlinx.android.synthetic.main.catalogue_controller.* import rx.Observable import rx.Subscription import rx.android.schedulers.AndroidSchedulers import timber.log.Timber import uy.kohesive.injekt.injectLazy +import java.util.concurrent.TimeUnit /** * Controller to manage the catalogues available in the app. */ open class BrowseCatalogueController(bundle: Bundle) : NucleusController(bundle), - SecondaryDrawerController, FlexibleAdapter.OnItemClickListener, FlexibleAdapter.OnItemLongClickListener, FlexibleAdapter.EndlessScrollListener, @@ -148,8 +143,9 @@ open class BrowseCatalogueController(bundle: Bundle) : setupRecycler(view) navView?.setFilters(presenter.filterItems) - scrollViewWith(recycler!!, true) + fab.visibleIf(presenter.sourceFilters.isNotEmpty()) + fab.setOnClickListener { showFilters() } progress?.visible() } @@ -164,53 +160,6 @@ open class BrowseCatalogueController(bundle: Bundle) : super.onDestroyView(view) } - override fun createSecondaryDrawer(drawer: androidx.drawerlayout.widget.DrawerLayout): ViewGroup? { - // Inflate and prepare drawer - val navView = drawer.inflate(R.layout.catalogue_drawer) as CatalogueNavigationView - this.navView = navView - navView.setFilters(presenter.filterItems) - - drawer.setDrawerLockMode(androidx.drawerlayout.widget.DrawerLayout.LOCK_MODE_UNLOCKED, GravityCompat.END) - - navView.onSearchClicked = { - val allDefault = presenter.sourceFilters == presenter.source.getFilterList() - showProgressBar() - adapter?.clear() - drawer.closeDrawer(GravityCompat.END) - presenter.setSourceFilter(if (allDefault) FilterList() else presenter.sourceFilters) - } - - navView.onResetClicked = { - presenter.appliedFilters = FilterList() - val newFilters = presenter.source.getFilterList() - presenter.sourceFilters = newFilters - navView.setFilters(presenter.filterItems) - } - drawer.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or - View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or - View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION - - val statusScrim = navView.findViewById(R.id.status_bar_scrim) as View - statusScrim.setOnApplyWindowInsetsListener(HeightTopWindowInsetsListener) - val titleView = navView.findViewById(R.id.title_background) as View - val titleMarginTop = titleView.marginTop - navView.setOnApplyWindowInsetsListener { v, insets -> - navView.recycler.updatePaddingRelative( - bottom = navView.recycler.marginBottom + insets.systemWindowInsetBottom, - top = navView.recycler.marginTop + insets.systemWindowInsetTop - ) - titleView.updateLayoutParams { - topMargin = titleMarginTop + insets.systemWindowInsetTop - } - insets - } - return navView - } - - override fun cleanupSecondaryDrawer(drawer: androidx.drawerlayout.widget.DrawerLayout) { - navView = null - } - private fun setupRecycler(view: View) { numColumnsSubscription?.unsubscribe() @@ -252,8 +201,22 @@ open class BrowseCatalogueController(bundle: Bundle) : recycler.setHasFixedSize(true) recycler.adapter = adapter + scrollViewWith(recycler, true) { insets -> + fab.updateLayoutParams { + bottomMargin = insets.systemWindowInsetBottom + 16.dpToPx + } + } + + recycler.addOnScrollListener(object : RecyclerView.OnScrollListener() { + override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { + if (dy <= 0) + fab.extend() + else + fab.shrink() + } + }) + catalogue_view.addView(recycler, 1) - recycler.setOnApplyWindowInsetsListener(RecyclerWindowInsetsListener) if (oldPosition != RecyclerView.NO_POSITION) { recycler.layoutManager?.scrollToPosition(oldPosition) } @@ -297,9 +260,6 @@ open class BrowseCatalogueController(bundle: Bundle) : } ) - // Setup filters button - menu.findItem(R.id.action_set_filter).isVisible = presenter.sourceFilters.isNotEmpty() - // Show next display mode menu.findItem(R.id.action_display_mode).apply { val icon = if (presenter.isListMode) @@ -321,13 +281,63 @@ open class BrowseCatalogueController(bundle: Bundle) : when (item.itemId) { R.id.action_search -> expandActionViewFromInteraction = true R.id.action_display_mode -> swapDisplayMode() -// R.id.action_set_filter -> navView?.let { activity?.drawer?.openDrawer(GravityCompat.END) } R.id.action_open_in_web_view -> openInWebView() else -> return super.onOptionsItemSelected(item) } return true } + private fun showFilters() { + val sheet = CatalogueSearchSheet(activity!!) + sheet.setFilters(presenter.filterItems) + presenter.filtersChanged = false + val oldFilters = mutableListOf() + for (i in presenter.sourceFilters) { + if (i is Filter.Group<*>) { + val subFilters = mutableListOf() + for (j in i.state) { + subFilters.add((j as Filter<*>).state) + } + oldFilters.add(subFilters) + } else { + oldFilters.add(i.state) + } + } + sheet.onSearchClicked = { + var matches = true + for (i in presenter.sourceFilters.indices) { + val filter = oldFilters[i] + if (filter is List<*>) { + for (j in filter.indices) { + if (filter[j] != + ((presenter.sourceFilters[i] as Filter.Group<*>).state[j] as + Filter<*>).state) { + matches = false + break + } + } + } else if (oldFilters[i] != presenter.sourceFilters[i].state) { + matches = false + break + } + } + if (!matches) { + val allDefault = presenter.sourceFilters == presenter.source.getFilterList() + showProgressBar() + adapter?.clear() + presenter.setSourceFilter(if (allDefault) FilterList() else presenter.sourceFilters) + } + } + + sheet.onResetClicked = { + presenter.appliedFilters = FilterList() + val newFilters = presenter.source.getFilterList() + presenter.sourceFilters = newFilters + sheet.setFilters(presenter.filterItems) + } + sheet.show() + } + private fun openInWebView() { val source = presenter.source as? HttpSource ?: return val activity = activity ?: return diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCataloguePresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCataloguePresenter.kt index aeabe520fc..47b2eec0a9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCataloguePresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCataloguePresenter.kt @@ -60,12 +60,15 @@ open class BrowseCataloguePresenter( var query = "" private set + var filtersChanged = false + /** * Modifiable list of filters. */ var sourceFilters = FilterList() set(value) { field = value + filtersChanged = true filterItems = value.toItems() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueNavigationView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueNavigationView.kt index eab963bb4b..5e34ba35c7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueNavigationView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueNavigationView.kt @@ -7,9 +7,7 @@ import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.items.IFlexible import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.util.view.inflate -import eu.kanade.tachiyomi.util.view.updatePaddingRelative import eu.kanade.tachiyomi.widget.SimpleNavigationView -import kotlinx.android.synthetic.main.catalogue_drawer_content.view.* class CatalogueNavigationView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : SimpleNavigationView(context, attrs) { @@ -28,13 +26,13 @@ class CatalogueNavigationView @JvmOverloads constructor(context: Context, attrs: val view = inflate(R.layout.catalogue_drawer_content) ((view as ViewGroup).getChildAt(1) as ViewGroup).addView(recycler) addView(view) - title.text = context.getString(R.string.source_search_options) - search_btn.setOnClickListener { onSearchClicked() } + // title.text = context.getString(R.string.source_search_options) + /*search_btn.setOnClickListener { onSearchClicked() } reset_btn.setOnClickListener { onResetClicked() } view.search_layout.setOnApplyWindowInsetsListener { v, insets -> view.updatePaddingRelative(bottom = insets.systemWindowInsetBottom) insets - } + }*/ } fun setFilters(items: List>) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueSearchSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueSearchSheet.kt new file mode 100644 index 0000000000..dc02db21e1 --- /dev/null +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueSearchSheet.kt @@ -0,0 +1,119 @@ +package eu.kanade.tachiyomi.ui.catalogue.browse + +import android.animation.ObjectAnimator +import android.animation.ValueAnimator +import android.app.Activity +import android.os.Build +import android.view.View +import android.view.ViewGroup +import androidx.recyclerview.widget.RecyclerView +import com.google.android.material.bottomsheet.BottomSheetBehavior +import com.google.android.material.bottomsheet.BottomSheetDialog +import eu.davidea.flexibleadapter.FlexibleAdapter +import eu.davidea.flexibleadapter.items.IFlexible +import eu.kanade.tachiyomi.R +import eu.kanade.tachiyomi.data.preference.PreferencesHelper +import eu.kanade.tachiyomi.data.preference.getOrDefault +import eu.kanade.tachiyomi.util.system.dpToPx +import eu.kanade.tachiyomi.util.view.setEdgeToEdge +import kotlinx.android.synthetic.main.catalogue_drawer_content.* +import uy.kohesive.injekt.injectLazy + +class CatalogueSearchSheet(private val activity: Activity) : + BottomSheetDialog(activity, R.style.BottomSheetDialogThemeCovered) { + + /** + * Preferences helper. + */ + private val preferences by injectLazy() + + private var sheetBehavior: BottomSheetBehavior<*> + + private var elevationAnimator: ValueAnimator? = null + + var filterChanged = true + + var isNotElevated = false + + val adapter: FlexibleAdapter> = FlexibleAdapter>(null) + .setDisplayHeadersAtStartUp(true) + + var onSearchClicked = {} + + var onResetClicked = {} + + init { + val view = activity.layoutInflater.inflate(R.layout.catalogue_drawer_content, null) + setContentView(view) + toolbar_title.text = context.getString(R.string.source_search_options) + dismiss_button.setOnClickListener { dismiss() } + reset_btn.setOnClickListener { onResetClicked() } + /*view.search_layout.setOnApplyWindowInsetsListener { v, insets -> + view.updatePaddingRelative(bottom = insets.systemWindowInsetBottom) + insets + }*/ + + recycler.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(context) + recycler.clipToPadding = false + recycler.adapter = adapter + recycler.setHasFixedSize(true) + sheetBehavior = BottomSheetBehavior.from(view.parent as ViewGroup) + sheetBehavior.skipCollapsed = true + sheetBehavior.state = BottomSheetBehavior.STATE_EXPANDED + setEdgeToEdge( + activity, recycler, view, 50.dpToPx + ) + // window?.findViewById(com.google.android.material.R.id.container)?.fitsSystemWindows = + // false + window?.navigationBarColor = activity.window.navigationBarColor + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && preferences.readerTheme() + .getOrDefault() == 0 && activity.window.decorView.rootWindowInsets.systemWindowInsetRight == 0 && activity.window.decorView.rootWindowInsets.systemWindowInsetLeft == 0 + ) window?.decorView?.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR + val height = activity.window.decorView.rootWindowInsets.systemWindowInsetBottom + + sheetBehavior.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() { + override fun onSlide(bottomSheet: View, progress: Float) {} + + override fun onStateChanged(p0: View, state: Int) { + if (state == BottomSheetBehavior.STATE_EXPANDED) { + sheetBehavior.skipCollapsed = true + } + } + }) + + recycler.addOnScrollListener(object : RecyclerView.OnScrollListener() { + override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { + super.onScrolled(recyclerView, dx, dy) + val atTop = !recycler.canScrollVertically(-1) + if (atTop != isNotElevated) { + elevationAnimator?.cancel() + isNotElevated = atTop + elevationAnimator?.cancel() + elevationAnimator = ObjectAnimator.ofFloat( + title_layout, + "elevation", + title_layout.elevation, + if (atTop) 0f else 10f.dpToPx + ) + elevationAnimator?.duration = 100 + elevationAnimator?.start() + } + } + }) + } + + override fun onStart() { + super.onStart() + sheetBehavior.state = BottomSheetBehavior.STATE_EXPANDED + } + + override fun dismiss() { + super.dismiss() + if (filterChanged) + onSearchClicked() + } + + fun setFilters(items: List>) { + adapter.updateDataSet(items) + } +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/latest/LatestUpdatesController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/latest/LatestUpdatesController.kt index 8eb53859f6..f3e198f65e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/latest/LatestUpdatesController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/latest/LatestUpdatesController.kt @@ -2,8 +2,6 @@ package eu.kanade.tachiyomi.ui.catalogue.latest import android.os.Bundle import android.view.Menu -import android.view.ViewGroup -import androidx.drawerlayout.widget.DrawerLayout import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.ui.catalogue.browse.BrowseCatalogueController @@ -25,13 +23,5 @@ class LatestUpdatesController(bundle: Bundle) : BrowseCatalogueController(bundle override fun onPrepareOptionsMenu(menu: Menu) { super.onPrepareOptionsMenu(menu) menu.findItem(R.id.action_search).isVisible = false - menu.findItem(R.id.action_set_filter).isVisible = false - } - - override fun createSecondaryDrawer(drawer: androidx.drawerlayout.widget.DrawerLayout): ViewGroup? { - return null - } - - override fun cleanupSecondaryDrawer(drawer: androidx.drawerlayout.widget.DrawerLayout) { } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/DisplayBottomSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/DisplayBottomSheet.kt index be3ec89045..fd8b923bb1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/DisplayBottomSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/DisplayBottomSheet.kt @@ -20,7 +20,7 @@ import kotlinx.android.synthetic.main.display_bottom_sheet.* import uy.kohesive.injekt.injectLazy class DisplayBottomSheet(private val controller: LibraryController) : BottomSheetDialog - (controller.activity!!, R.style.BottomSheetDialogTheme) { + (controller.activity!!, R.style.BottomSheetDialogThemeCovered) { val activity = controller.activity!! @@ -37,9 +37,10 @@ class DisplayBottomSheet(private val controller: LibraryController) : BottomShee setContentView(view) sheetBehavior = BottomSheetBehavior.from(view.parent as ViewGroup) - setEdgeToEdge(activity, bottom_sheet, view, false) + setEdgeToEdge(activity, bottom_sheet, view) val height = activity.window.decorView.rootWindowInsets.systemWindowInsetBottom sheetBehavior.peekHeight = 220.dpToPx + height + window?.navigationBarColor = activity.window.navigationBarColor sheetBehavior.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() { override fun onSlide(bottomSheet: View, progress: Float) { } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersSortBottomSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersSortBottomSheet.kt index 056b3f3fd1..517a06a19d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersSortBottomSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersSortBottomSheet.kt @@ -16,7 +16,7 @@ import eu.kanade.tachiyomi.util.view.visibleIf import kotlinx.android.synthetic.main.chapter_sort_bottom_sheet.* class ChaptersSortBottomSheet(controller: MangaDetailsController) : BottomSheetDialog - (controller.activity!!, R.style.BottomSheetDialogTheme) { + (controller.activity!!, R.style.BottomSheetDialogThemeCovered) { val activity = controller.activity!! @@ -30,9 +30,10 @@ class ChaptersSortBottomSheet(controller: MangaDetailsController) : BottomSheetD setContentView(view) sheetBehavior = BottomSheetBehavior.from(view.parent as ViewGroup) - setEdgeToEdge(activity, bottom_sheet, view, false) + setEdgeToEdge(activity, bottom_sheet, view) val height = activity.window.decorView.rootWindowInsets.systemWindowInsetBottom sheetBehavior.peekHeight = 380.dpToPx + height + window?.navigationBarColor = activity.window.navigationBarColor sheetBehavior.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() { override fun onSlide(bottomSheet: View, progress: Float) { } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackingBottomSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackingBottomSheet.kt index 04c1de1dfd..cec3cb9cb4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackingBottomSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackingBottomSheet.kt @@ -40,7 +40,7 @@ class TrackingBottomSheet(private val controller: MangaDetailsController) : Bott setContentView(view) sheetBehavior = BottomSheetBehavior.from(view.parent as ViewGroup) - setEdgeToEdge(activity, display_bottom_sheet, view, false) + setEdgeToEdge(activity, display_bottom_sheet, view) val height = activity.window.decorView.rootWindowInsets.systemWindowInsetBottom sheetBehavior.peekHeight = 380.dpToPx + height diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/design/MigrationBottomSheetDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/design/MigrationBottomSheetDialog.kt index 0c4b52a9ba..7b06675699 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/design/MigrationBottomSheetDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/design/MigrationBottomSheetDialog.kt @@ -62,7 +62,7 @@ class MigrationBottomSheetDialog( params3.endToEnd = -1 extra_search_param.layoutParams = params3 } - setEdgeToEdge(activity, constraint_layout, view, false) + setEdgeToEdge(activity, constraint_layout, view) setBottomEdge( if (activity.resources.configuration?.orientation == Configuration.ORIENTATION_LANDSCAPE) extra_search_param_text else skip_step, activity diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderColorFilterSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderColorFilterSheet.kt index 0ee65dfc46..a4fb3a4f89 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderColorFilterSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderColorFilterSheet.kt @@ -54,7 +54,7 @@ class ReaderColorFilterSheet(activity: ReaderActivity) : BottomSheetDialog val view = activity.layoutInflater.inflate(R.layout.reader_color_filter_sheet, null) setContentView(view) - setEdgeToEdge(activity, constraint_layout, view, true) + setEdgeToEdge(activity, constraint_layout, view, 0) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && preferences.readerTheme().getOrDefault() == 0 && activity.window.decorView.rootWindowInsets.systemWindowInsetRight == 0 && diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPageSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPageSheet.kt index 8f1ea6bfce..4291657eec 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPageSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPageSheet.kt @@ -32,7 +32,7 @@ class ReaderPageSheet( init { setContentView(view) - setEdgeToEdge(activity, view, view, false) + setEdgeToEdge(activity, view, view) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && Injekt.get().readerTheme().getOrDefault() == 0 && activity.window.decorView.rootWindowInsets.systemWindowInsetRight == 0 && diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSettingsSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSettingsSheet.kt index 7a76cb6cbb..03b55d5a07 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSettingsSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSettingsSheet.kt @@ -52,7 +52,8 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : activity, constraint_layout, scroll, - context.resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE + if (context.resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) + 0 else -1 ) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && preferences.readerTheme() .getOrDefault() == 0 && activity.window.decorView.rootWindowInsets.systemWindowInsetRight == 0 && activity.window.decorView.rootWindowInsets.systemWindowInsetLeft == 0 diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt index 3126e82bbb..0ba5cbf07d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt @@ -398,7 +398,7 @@ fun BottomSheetDialog.setEdgeToEdge( activity: Activity, layout: View, contentView: View, - setTopMargin: Boolean + setTopMargin: Int = -1 ) { window?.setBackgroundDrawable(null) val currentNightMode = @@ -425,12 +425,22 @@ fun BottomSheetDialog.setEdgeToEdge( } window?.findViewById(com.google.android.material.R.id.container)?.fitsSystemWindows = false - contentView.updateLayoutParams { - if (setTopMargin) topMargin = - activity.window.decorView.rootWindowInsets.systemWindowInsetTop - leftMargin = activity.window.decorView.rootWindowInsets.systemWindowInsetLeft - rightMargin = activity.window.decorView.rootWindowInsets.systemWindowInsetRight + contentView.systemUiVisibility = + View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION + /*contentView.updateLayoutParams { + if (setTopMargin > -1) topMargin = + activity.window.decorView.rootWindowInsets.systemWindowInsetTop + setTopMargin + }*/ + + if (setTopMargin > 0) (contentView.parent as View).updateLayoutParams { + height = + activity.window.decorView.height - activity.window.decorView.rootWindowInsets.systemWindowInsetTop - setTopMargin + // activity.window.decorView.rootWindowInsets.systemWindowInsetTop // + setTopMargin } + else if (setTopMargin == 0) contentView.updateLayoutParams { + topMargin = activity.window.decorView.rootWindowInsets.systemWindowInsetTop + } + contentView.requestLayout() } fun setBottomEdge(view: View, activity: Activity) { diff --git a/app/src/main/res/drawable/bg_bottom_sheet_secondary.xml b/app/src/main/res/drawable/bg_bottom_sheet_secondary.xml new file mode 100644 index 0000000000..b678bb55ef --- /dev/null +++ b/app/src/main/res/drawable/bg_bottom_sheet_secondary.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/catalogue_controller.xml b/app/src/main/res/layout/catalogue_controller.xml index e2a0cdb348..5b2071c959 100644 --- a/app/src/main/res/layout/catalogue_controller.xml +++ b/app/src/main/res/layout/catalogue_controller.xml @@ -2,6 +2,7 @@ @@ -22,5 +23,19 @@ android:visibility="gone"/> + + diff --git a/app/src/main/res/layout/catalogue_drawer_content.xml b/app/src/main/res/layout/catalogue_drawer_content.xml index 9c1b558f55..0d1055c8ae 100644 --- a/app/src/main/res/layout/catalogue_drawer_content.xml +++ b/app/src/main/res/layout/catalogue_drawer_content.xml @@ -1,75 +1,68 @@ - - + android:layout_height="match_parent" + android:layout_marginTop="?attr/actionBarSize" + android:clipToPadding="false" + android:fitsSystemWindows="true" /> - + + + + + android:textColor="?actionBarTintColor" + android:textSize="20sp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:text="Title Text" /> - - - - - - - - -