mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-24 02:21:51 +01:00
Removed logic and option for the side drawer
👋
This commit is contained in:
parent
31670b8113
commit
4d1623a812
@ -137,8 +137,6 @@ object PreferenceKeys {
|
||||
|
||||
const val refreshCoversToo = "refresh_covers_too"
|
||||
|
||||
const val useBottomNav = "use_bottom_nav"
|
||||
|
||||
@Deprecated("Use the preferences of the source")
|
||||
fun sourceUsername(sourceId: Long) = "pref_source_username_$sourceId"
|
||||
|
||||
|
@ -233,8 +233,6 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun extensionUpdatesCount() = rxPrefs.getInteger("ext_updates_count", 0)
|
||||
|
||||
fun useBottonNav() = rxPrefs.getBoolean(Keys.useBottomNav, true)
|
||||
|
||||
fun showRecentUpdates() = rxPrefs.getBoolean("show_recents", false)
|
||||
|
||||
fun lastExtCheck() = rxPrefs.getLong("last_ext_check", 0)
|
||||
|
@ -17,6 +17,7 @@ import com.f2prateek.rx.preferences.Preference
|
||||
import com.google.android.material.snackbar.BaseTransientBottomBar
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.jakewharton.rxbinding.support.v7.widget.queryTextChangeEvents
|
||||
import com.jakewharton.rxbinding.view.visible
|
||||
import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||
import eu.davidea.flexibleadapter.items.IFlexible
|
||||
import eu.kanade.tachiyomi.R
|
||||
@ -294,16 +295,7 @@ open class BrowseCatalogueController(bundle: Bundle) :
|
||||
)
|
||||
|
||||
// Setup filters button
|
||||
menu.findItem(R.id.action_set_filter).apply {
|
||||
icon.mutate()
|
||||
if (presenter.sourceFilters.isEmpty()) {
|
||||
isEnabled = false
|
||||
icon.alpha = 128
|
||||
} else {
|
||||
isEnabled = true
|
||||
icon.alpha = 255
|
||||
}
|
||||
}
|
||||
menu.findItem(R.id.action_set_filter).isVisible = presenter.sourceFilters.isNotEmpty()
|
||||
|
||||
// Show next display mode
|
||||
menu.findItem(R.id.action_display_mode).apply {
|
||||
|
@ -1,7 +1,6 @@
|
||||
package eu.kanade.tachiyomi.ui.catalogue.filter
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import com.google.android.material.R
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
@ -9,13 +8,15 @@ import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||
import eu.davidea.flexibleadapter.items.AbstractHeaderItem
|
||||
import eu.davidea.flexibleadapter.items.IFlexible
|
||||
import eu.davidea.viewholders.FlexibleViewHolder
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.source.model.Filter
|
||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||
|
||||
class HeaderItem(val filter: Filter.Header) : AbstractHeaderItem<HeaderItem.Holder>() {
|
||||
|
||||
@SuppressLint("PrivateResource")
|
||||
override fun getLayoutRes(): Int {
|
||||
return R.layout.design_navigation_item_subheader
|
||||
return com.google.android.material.R.layout.design_navigation_item_subheader
|
||||
}
|
||||
|
||||
override fun createViewHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>): Holder {
|
||||
@ -25,6 +26,7 @@ class HeaderItem(val filter: Filter.Header) : AbstractHeaderItem<HeaderItem.Hold
|
||||
override fun bindViewHolder(adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>, holder: Holder, position: Int, payloads: MutableList<Any?>?) {
|
||||
val view = holder.itemView as TextView
|
||||
view.text = filter.name
|
||||
view.setTextColor(view.context.getResourceColor(R.attr.actionBarTintColor))
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
|
@ -101,32 +101,16 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
|
||||
swipe_refresh.addView(recycler)
|
||||
adapter.fastScroller = fast_scroller
|
||||
|
||||
if (!MainActivity.bottomNav) {
|
||||
fast_scroller.addOnScrollStateChangeListener {
|
||||
controller.lockFilterBar(it)
|
||||
}
|
||||
}
|
||||
else {
|
||||
fast_scroller.setIgnoreTouchesOutsideHandle(false)
|
||||
}
|
||||
val config = resources?.configuration
|
||||
|
||||
val phoneLandscape = (config?.orientation == Configuration.ORIENTATION_LANDSCAPE &&
|
||||
(config.screenLayout.and(Configuration.SCREENLAYOUT_SIZE_MASK)) <
|
||||
Configuration.SCREENLAYOUT_SIZE_LARGE)
|
||||
if (MainActivity.bottomNav && !phoneLandscape) {
|
||||
// pad the recycler if the filter bottom sheet is visible
|
||||
if (!phoneLandscape) {
|
||||
val height = context.resources.getDimensionPixelSize(R.dimen.rounder_radius) + 5.dpToPx
|
||||
recycler.updatePaddingRelative(bottom = height)
|
||||
}
|
||||
else if (!MainActivity.bottomNav) {
|
||||
recycler.doOnApplyWindowInsets { v, insets, padding ->
|
||||
v.updatePaddingRelative(bottom = padding.bottom + insets.systemWindowInsetBottom)
|
||||
|
||||
fast_scroller?.updateLayoutParams<MarginLayoutParams> {
|
||||
bottomMargin = insets.systemWindowInsetBottom
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Double the distance required to trigger sync
|
||||
swipe_refresh.setDistanceToTriggerSync((2 * 64 * resources.displayMetrics.density).toInt())
|
||||
@ -191,14 +175,6 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
|
||||
adapter.notifyDataSetChanged()
|
||||
saveDragSort()
|
||||
}
|
||||
else {
|
||||
category.mangaSort = ('a' + (it.second - 1))
|
||||
if (category.id == 0)
|
||||
preferences.defaultMangaOrder().set(category.mangaSort.toString())
|
||||
else
|
||||
db.insertCategory(category).asRxObservable().subscribe()
|
||||
controller.enableReorderItems(category)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -363,9 +339,7 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
|
||||
preferences.defaultMangaOrder().set(mangaIds.joinToString("/"))
|
||||
else
|
||||
db.insertCategory(category).asRxObservable().subscribe()
|
||||
//justDraggedAndDropped = true
|
||||
controller.onCatSortChanged(category.id)
|
||||
controller.enableReorderItems(category)
|
||||
}
|
||||
override fun shouldMoveItem(fromPosition: Int, toPosition: Int): Boolean {
|
||||
if (adapter.selectedItemCount > 1)
|
||||
|
@ -75,7 +75,6 @@ class LibraryController(
|
||||
private val preferences: PreferencesHelper = Injekt.get()
|
||||
) : BaseController(bundle),
|
||||
TabbedController,
|
||||
SecondaryDrawerController,
|
||||
ActionMode.Callback,
|
||||
ChangeMangaCategoriesDialog.Listener,
|
||||
MigrationInterface,
|
||||
@ -144,11 +143,6 @@ class LibraryController(
|
||||
*/
|
||||
private var adapter: LibraryAdapter? = null
|
||||
|
||||
/**
|
||||
* Navigation view containing filter/sort/display items.
|
||||
*/
|
||||
private var navView: LibraryNavigationView? = null
|
||||
|
||||
/**
|
||||
* Drawer listener to allow swipe only for closing the drawer.
|
||||
*/
|
||||
@ -158,8 +152,6 @@ class LibraryController(
|
||||
|
||||
var snack: Snackbar? = null
|
||||
|
||||
private var reorderMenuItem:MenuItem? = null
|
||||
|
||||
private var presenter = LibraryPresenter(this)
|
||||
|
||||
init {
|
||||
@ -196,8 +188,8 @@ class LibraryController(
|
||||
|
||||
library_pager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
|
||||
override fun onPageSelected(position: Int) {
|
||||
enableReorderItems(position)
|
||||
bottom_sheet.lastCategory = adapter?.categories?.getOrNull(position)
|
||||
if (preferences.librarySortingMode().getOrDefault() == LibrarySort.DRAG_AND_DROP)
|
||||
bottom_sheet.updateTitle()
|
||||
}
|
||||
|
||||
@ -216,7 +208,6 @@ class LibraryController(
|
||||
createActionModeIfNeeded()
|
||||
}
|
||||
|
||||
if (MainActivity.bottomNav) {
|
||||
bottom_sheet.onCreate(pager_layout)
|
||||
|
||||
bottom_sheet.onGroupClicked = {
|
||||
@ -225,8 +216,7 @@ class LibraryController(
|
||||
SortFilterBottomSheet.ACTION_FILTER -> onFilterChanged()
|
||||
SortFilterBottomSheet.ACTION_SORT -> onSortChanged()
|
||||
SortFilterBottomSheet.ACTION_DISPLAY -> reattachAdapter()
|
||||
SortFilterBottomSheet.ACTION_DOWNLOAD_BADGE ->
|
||||
presenter.requestDownloadBadgesUpdate()
|
||||
SortFilterBottomSheet.ACTION_DOWNLOAD_BADGE -> presenter.requestDownloadBadgesUpdate()
|
||||
SortFilterBottomSheet.ACTION_UNREAD_BADGE -> presenter.requestUnreadBadgesUpdate()
|
||||
SortFilterBottomSheet.ACTION_CAT_SORT -> onCatSortChanged()
|
||||
}
|
||||
@ -236,40 +226,6 @@ class LibraryController(
|
||||
router.pushController(DownloadController().withFadeTransaction())
|
||||
}
|
||||
}
|
||||
else {
|
||||
bottom_sheet.gone()
|
||||
shadow.gone()
|
||||
shadow2.gone()
|
||||
}
|
||||
}
|
||||
|
||||
fun enableReorderItems(category: Category) {
|
||||
if (MainActivity.bottomNav) return
|
||||
adapter?.categories?.getOrNull(library_pager.currentItem)?.mangaSort = category.mangaSort
|
||||
enableReorderItems(sortType = category.mangaSort)
|
||||
}
|
||||
|
||||
private fun enableReorderItems(position: Int? = null, sortType: Char? = null) {
|
||||
if (MainActivity.bottomNav) return
|
||||
val pos = position ?: library_pager.currentItem
|
||||
val orderOfCat = sortType ?: adapter?.categories?.getOrNull(pos)?.mangaSort
|
||||
if (reorderMenuItem?.isVisible != true) return
|
||||
val subMenu = reorderMenuItem?.subMenu ?: return
|
||||
if (orderOfCat != null) {
|
||||
subMenu.setGroupCheckable(R.id.reorder_group, true, true)
|
||||
when (orderOfCat) {
|
||||
'a', 'b' -> subMenu.findItem(R.id.action_alpha_asc)?.isChecked = true
|
||||
'c', 'd' -> subMenu.findItem(R.id.action_update_asc)?.isChecked = true
|
||||
'e', 'f' -> subMenu.findItem(R.id.action_unread)?.isChecked = true
|
||||
'g', 'h' -> subMenu.findItem(R.id.action_last_read)?.isChecked = true
|
||||
}
|
||||
subMenu.findItem(R.id.action_reverse)?.isVisible = true
|
||||
}
|
||||
else {
|
||||
subMenu.findItem(R.id.action_reverse)?.isVisible = false
|
||||
subMenu.setGroupCheckable(R.id.reorder_group, false, false)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) {
|
||||
super.onChangeStarted(handler, type)
|
||||
@ -314,40 +270,6 @@ class LibraryController(
|
||||
super.onDetach(view)
|
||||
}
|
||||
|
||||
override fun createSecondaryDrawer(drawer: DrawerLayout): ViewGroup? {
|
||||
if (MainActivity.bottomNav) return null
|
||||
val view = drawer.inflate(R.layout.library_drawer) as LibraryNavigationView
|
||||
navView = view
|
||||
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, GravityCompat.END)
|
||||
|
||||
navView?.onGroupClicked = { group, item ->
|
||||
when (group) {
|
||||
is LibraryNavigationView.FilterGroup -> onFilterChanged(item)
|
||||
is LibraryNavigationView.SortGroup -> onSortChanged()
|
||||
is LibraryNavigationView.DisplayGroup -> reattachAdapter()
|
||||
is LibraryNavigationView.BadgeGroup -> onDownloadBadgeChanged()
|
||||
}
|
||||
}
|
||||
|
||||
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 = view.findViewById(R.id.status_bar_scrim) as View
|
||||
statusScrim.setOnApplyWindowInsetsListener(HeightTopWindowInsetsListener)
|
||||
view.setOnApplyWindowInsetsListener { _, insets ->
|
||||
view.recycler.updatePaddingRelative(
|
||||
bottom = view.recycler.marginBottom + insets.systemWindowInsetBottom,
|
||||
top = view.recycler.marginTop + insets.systemWindowInsetTop
|
||||
)
|
||||
insets
|
||||
}
|
||||
return view
|
||||
}
|
||||
|
||||
override fun cleanupSecondaryDrawer(drawer: DrawerLayout) {
|
||||
navView = null
|
||||
}
|
||||
|
||||
override fun configureTabs(tabs: TabLayout) {
|
||||
with(tabs) {
|
||||
tabGravity = TabLayout.GRAVITY_CENTER
|
||||
@ -423,35 +345,25 @@ class LibraryController(
|
||||
preferences.landscapeColumns()
|
||||
}
|
||||
|
||||
private fun onRefresh() {
|
||||
if (!MainActivity.bottomNav) activity?.invalidateOptionsMenu()
|
||||
presenter.requestFullUpdate()
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a filter is changed.
|
||||
*/
|
||||
private fun onFilterChanged(item: ExtendedNavigationView.Item? = null) {
|
||||
if (item is ExtendedNavigationView.Item.MultiStateGroup && item.resTitle == R.string.categories) {
|
||||
if (!MainActivity.bottomNav) activity?.invalidateOptionsMenu()
|
||||
presenter.requestFullUpdate()
|
||||
return
|
||||
}
|
||||
private fun onFilterChanged() {
|
||||
presenter.requestFilterUpdate()
|
||||
destroyActionModeIfNeeded()
|
||||
if (!MainActivity.bottomNav) activity?.invalidateOptionsMenu()
|
||||
}
|
||||
|
||||
private fun onDownloadBadgeChanged() {
|
||||
presenter.requestDownloadBadgesUpdate()
|
||||
private fun onRefresh() {
|
||||
presenter.getLibrary()
|
||||
destroyActionModeIfNeeded()
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the sorting mode is changed.
|
||||
*/
|
||||
private fun onSortChanged() {
|
||||
if (!MainActivity.bottomNav) activity?.invalidateOptionsMenu()
|
||||
presenter.requestSortUpdate()
|
||||
destroyActionModeIfNeeded()
|
||||
}
|
||||
|
||||
fun onCatSortChanged(id: Int? = null) {
|
||||
@ -489,27 +401,19 @@ class LibraryController(
|
||||
/**
|
||||
* Destroys the action mode.
|
||||
*/
|
||||
fun destroyActionModeIfNeeded() {
|
||||
private fun destroyActionModeIfNeeded() {
|
||||
actionMode?.finish()
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||
inflater.inflate(R.menu.library, menu)
|
||||
|
||||
val reorganizeItem = menu.findItem(R.id.action_reorganize)
|
||||
reorganizeItem.isVisible =
|
||||
!MainActivity.bottomNav
|
||||
preferences.librarySortingMode().getOrDefault() == LibrarySort.DRAG_AND_DROP &&
|
||||
!preferences.hideCategories().getOrDefault()
|
||||
|
||||
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()
|
||||
menu.findItem(R.id.action_library_filter).isVisible = phoneLandscape
|
||||
|
||||
val searchItem = menu.findItem(R.id.action_search)
|
||||
val searchView = searchItem.actionView as SearchView
|
||||
@ -555,7 +459,7 @@ class LibraryController(
|
||||
}
|
||||
|
||||
override fun onPrepareOptionsMenu(menu: Menu) {
|
||||
val navView = navView ?: return
|
||||
val navView = bottom_sheet ?: return
|
||||
|
||||
val filterItem = menu.findItem(R.id.action_library_filter)
|
||||
|
||||
@ -569,15 +473,9 @@ class LibraryController(
|
||||
when (item.itemId) {
|
||||
R.id.action_search -> expandActionViewFromInteraction = true
|
||||
R.id.action_library_filter -> {
|
||||
if (MainActivity.bottomNav) {
|
||||
if (bottom_sheet.sheetBehavior?.state != BottomSheetBehavior.STATE_COLLAPSED)
|
||||
bottom_sheet.sheetBehavior?.state =
|
||||
BottomSheetBehavior.STATE_COLLAPSED
|
||||
else
|
||||
bottom_sheet.sheetBehavior?.state =
|
||||
BottomSheetBehavior.STATE_EXPANDED
|
||||
}
|
||||
else navView?.let { activity?.drawer?.openDrawer(GravityCompat.END) }
|
||||
bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED
|
||||
else bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_EXPANDED
|
||||
}
|
||||
R.id.action_edit_categories -> {
|
||||
router.pushController(CategoryController().withFadeTransaction())
|
||||
@ -585,31 +483,12 @@ class LibraryController(
|
||||
R.id.action_source_migration -> {
|
||||
router.pushController(MigrationController().withFadeTransaction())
|
||||
}
|
||||
R.id.action_alpha_asc -> reOrder(0)
|
||||
R.id.action_update_asc -> reOrder(1)
|
||||
R.id.action_unread -> reOrder(2)
|
||||
R.id.action_last_read -> reOrder(3)
|
||||
R.id.action_reverse -> reOrder(-1)
|
||||
else -> return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
private fun reOrder(type: Int) {
|
||||
val modType = if (type == -1) {
|
||||
val t = (adapter?.categories?.getOrNull(library_pager.currentItem)?.mangaSort
|
||||
?.minus('a') ?: 0) + 1
|
||||
if (t % 2 != 0) t + 1
|
||||
else t - 1
|
||||
}
|
||||
else 2 * type + 1
|
||||
adapter?.categories?.getOrNull(library_pager.currentItem)?.id?.let {
|
||||
reorganizeRelay.call(it to modType)
|
||||
onSortChanged()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidates the action mode, forcing it to refresh its content.
|
||||
*/
|
||||
@ -753,17 +632,6 @@ class LibraryController(
|
||||
.showDialog(router)
|
||||
}
|
||||
|
||||
fun lockFilterBar(lock: Boolean) {
|
||||
val drawer = (navView?.parent as? DrawerLayout) ?: return
|
||||
if (lock) {
|
||||
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED)
|
||||
drawer.closeDrawers()
|
||||
} else {
|
||||
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED)
|
||||
drawer.visible()
|
||||
}
|
||||
}
|
||||
|
||||
private fun deleteMangasFromLibrary() {
|
||||
val mangas = selectedMangas.toList()
|
||||
presenter.removeMangaFromLibrary(mangas)
|
||||
|
@ -115,27 +115,20 @@ class LibraryPresenter(
|
||||
|
||||
val filterFn: (LibraryItem) -> Boolean = f@ { item ->
|
||||
// Filter when there isn't unread chapters.
|
||||
if (MainActivity.bottomNav) {
|
||||
if (filterUnread == STATE_INCLUDE &&
|
||||
(item.manga.unread == 0 || db.getChapters(item.manga).executeAsBlocking()
|
||||
.size != item.manga.unread)) return@f false
|
||||
if (filterUnread == STATE_EXCLUDE &&
|
||||
(item.manga.unread == 0 || db.getChapters(item.manga).executeAsBlocking().size == item.manga.unread)) return@f false
|
||||
(item.manga.unread == 0 ||
|
||||
db.getChapters(item.manga).executeAsBlocking().size == item.manga.unread))
|
||||
return@f false
|
||||
if (filterUnread == STATE_REALLY_EXCLUDE && item.manga.unread > 0) return@f false
|
||||
}
|
||||
else {
|
||||
if (filterUnread == STATE_INCLUDE && item.manga.unread == 0) return@f false
|
||||
if ((filterUnread == STATE_EXCLUDE || filterUnread == STATE_REALLY_EXCLUDE) && item
|
||||
.manga.unread > 0) return@f false
|
||||
}
|
||||
|
||||
if (MainActivity.bottomNav) {
|
||||
if (filterMangaType == LibraryManga.MANGA &&
|
||||
item.manga.mangaType() == LibraryManga.MANWHA)
|
||||
return@f false
|
||||
if ((filterMangaType == LibraryManga.MANWHA) &&
|
||||
item.manga.mangaType() == LibraryManga.MANGA) return@f false
|
||||
}
|
||||
|
||||
|
||||
if (filterCompleted == STATE_INCLUDE && item.manga.status != SManga.COMPLETED)
|
||||
@ -479,10 +472,6 @@ class LibraryPresenter(
|
||||
}
|
||||
}
|
||||
|
||||
fun requestFullUpdate() {
|
||||
getLibrary()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the common categories for the given list of manga.
|
||||
*
|
||||
|
@ -260,6 +260,8 @@ class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: A
|
||||
}
|
||||
}
|
||||
|
||||
fun hasActiveFilters() = filterItems.any { it.isActivated }
|
||||
|
||||
private fun getFilters(): List<Int> {
|
||||
val filters = mutableListOf<Int>()
|
||||
val categoriesOn = !preferences.hideCategories().getOrDefault()
|
||||
@ -434,8 +436,8 @@ class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: A
|
||||
popup.show()
|
||||
}
|
||||
|
||||
private fun onMainSortClicked(menuId: Int) {
|
||||
if (menuId == R.id.action_reverse) {
|
||||
private fun onMainSortClicked(menuId: Int?) {
|
||||
if (menuId == null) {
|
||||
preferences.librarySortingAscending().set(
|
||||
!preferences.librarySortingAscending().getOrDefault())
|
||||
}
|
||||
@ -450,7 +452,7 @@ class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: A
|
||||
}
|
||||
if (sort == preferences.librarySortingMode().getOrDefault()) {
|
||||
if (sort != LibrarySort.DRAG_AND_DROP)
|
||||
onMainSortClicked(R.id.action_reverse)
|
||||
onMainSortClicked(null)
|
||||
return
|
||||
}
|
||||
preferences.librarySortingMode().set(sort)
|
||||
@ -460,9 +462,9 @@ class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: A
|
||||
onGroupClicked(ACTION_SORT)
|
||||
}
|
||||
|
||||
private fun onCatSortClicked(menuId: Int) {
|
||||
private fun onCatSortClicked(menuId: Int?) {
|
||||
val category = lastCategory ?: return
|
||||
val modType = if (menuId == R.id.action_reverse) {
|
||||
val modType = if (menuId == null) {
|
||||
val t = (category.mangaSort?.minus('a') ?: 0) + 1
|
||||
if (t % 2 != 0) t + 1
|
||||
else t - 1
|
||||
@ -475,7 +477,7 @@ class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: A
|
||||
else -> 0
|
||||
}
|
||||
if (order == category.catSortingMode()) {
|
||||
onCatSortClicked(R.id.action_reverse)
|
||||
onCatSortClicked(null)
|
||||
return
|
||||
}
|
||||
(2 * order + 1)
|
||||
@ -607,10 +609,10 @@ class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: A
|
||||
}
|
||||
updateTitle()
|
||||
}
|
||||
val filters = getFilters().size
|
||||
if (filters > 0 && clearButton.parent == null)
|
||||
val hasFilters = hasActiveFilters()
|
||||
if (hasFilters && clearButton.parent == null)
|
||||
filter_layout.addView(clearButton, 0)
|
||||
else if (filters == 0 && clearButton.parent != null)
|
||||
else if (!hasFilters && clearButton.parent != null)
|
||||
filter_layout.removeView(clearButton)
|
||||
}
|
||||
|
||||
|
@ -14,11 +14,9 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.webkit.WebView
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import androidx.appcompat.graphics.drawable.DrawerArrowDrawable
|
||||
import androidx.biometric.BiometricManager
|
||||
import androidx.core.graphics.ColorUtils
|
||||
import androidx.core.view.GravityCompat
|
||||
import com.bluelinelabs.conductor.Conductor
|
||||
import com.bluelinelabs.conductor.Controller
|
||||
@ -54,14 +52,8 @@ import eu.kanade.tachiyomi.ui.recently_read.RecentlyReadController
|
||||
import eu.kanade.tachiyomi.ui.setting.SettingsMainController
|
||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||
import eu.kanade.tachiyomi.util.system.launchUI
|
||||
import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets
|
||||
import eu.kanade.tachiyomi.util.view.gone
|
||||
import eu.kanade.tachiyomi.util.view.marginBottom
|
||||
import eu.kanade.tachiyomi.util.view.marginTop
|
||||
import eu.kanade.tachiyomi.util.view.updateLayoutParams
|
||||
import eu.kanade.tachiyomi.util.view.updatePadding
|
||||
import eu.kanade.tachiyomi.util.view.updatePaddingRelative
|
||||
import eu.kanade.tachiyomi.util.view.visible
|
||||
import kotlinx.android.synthetic.main.main_activity.*
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
@ -138,27 +130,6 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
|
||||
|
||||
tabAnimator = TabsAnimator(tabs)
|
||||
|
||||
// Set behavior of Navigation drawer
|
||||
nav_view.setNavigationItemSelectedListener { item ->
|
||||
val id = item.itemId
|
||||
|
||||
val currentRoot = router.backstack.firstOrNull()
|
||||
if (currentRoot?.tag()?.toIntOrNull() != id) {
|
||||
when (id) {
|
||||
R.id.nav_drawer_library -> setRoot(LibraryController(), id)
|
||||
R.id.nav_drawer_recent_updates -> setRoot(RecentChaptersController(), id)
|
||||
R.id.nav_drawer_recently_read -> setRoot(RecentlyReadController(), id)
|
||||
R.id.nav_drawer_catalogues -> setRoot(CatalogueController(), id)
|
||||
R.id.nav_drawer_extensions -> setRoot(ExtensionController(), id)
|
||||
R.id.nav_drawer_downloads -> setRoot(DownloadController(), id)
|
||||
R.id.nav_drawer_settings -> setRoot(SettingsMainController(), id)
|
||||
}
|
||||
//navigationView.selectedItemId = id
|
||||
}
|
||||
drawer.closeDrawer(GravityCompat.START)
|
||||
true
|
||||
}
|
||||
|
||||
navigationView.setOnNavigationItemSelectedListener { item ->
|
||||
val id = item.itemId
|
||||
|
||||
@ -175,7 +146,6 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
|
||||
R.id.nav_drawer_catalogues -> setRoot(CatalogueController(), id)
|
||||
R.id.nav_drawer_settings -> setRoot(SettingsMainController(), id)
|
||||
}
|
||||
nav_view.setCheckedItem(id)
|
||||
}
|
||||
else if (currentRoot.tag()?.toIntOrNull() == id) {
|
||||
when (id) {
|
||||
@ -198,27 +168,15 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
|
||||
val container: ViewGroup = findViewById(R.id.controller_container)
|
||||
|
||||
val content: ViewGroup = findViewById(R.id.main_content)
|
||||
bottomNav = preferences.useBottonNav().getOrDefault()
|
||||
DownloadService.addListener(this)
|
||||
content.fitsSystemWindows = !bottomNav
|
||||
if (!bottomNav) {
|
||||
container.systemUiVisibility =
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
}
|
||||
content.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
nav_view.doOnApplyWindowInsets { v, _, _ ->
|
||||
v.updatePaddingRelative(
|
||||
bottom = v.marginBottom,
|
||||
top = v.marginTop
|
||||
)
|
||||
}
|
||||
navigationView.visibility = if (bottomNav) View.VISIBLE else View.GONE
|
||||
updateRecentsIcon()
|
||||
content.setOnApplyWindowInsetsListener { v, insets ->
|
||||
window.navigationBarColor =
|
||||
// if device doesn't support light nav bar
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
// basically if in landscape on a phone
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
|
||||
(v.rootWindowInsets.systemWindowInsetLeft > 0 ||
|
||||
v.rootWindowInsets.systemWindowInsetRight > 0))
|
||||
@ -226,7 +184,11 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
|
||||
Color.BLACK
|
||||
else Color.argb(179, 0, 0, 0)
|
||||
}
|
||||
// if the android q+ device has gesture nav, transparent nav bar
|
||||
else {
|
||||
getColor(android.R.color.transparent)
|
||||
}
|
||||
/* // if the android q+ device has gesture nav, transparent nav bar
|
||||
// this is here incase some crazy with a notch uses landscape
|
||||
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q
|
||||
&& (v.rootWindowInsets.systemWindowInsetBottom != v.rootWindowInsets
|
||||
.tappableElementInsets.bottom)) {
|
||||
@ -235,19 +197,8 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
|
||||
// if in landscape with 2/3 button mode, fully opaque nav bar
|
||||
else if (v.rootWindowInsets.systemWindowInsetLeft > 0
|
||||
|| v.rootWindowInsets.systemWindowInsetRight > 0) {
|
||||
getResourceColor(
|
||||
if (bottomNav) android.R.attr.colorPrimary
|
||||
else android.R.attr.colorBackground
|
||||
)
|
||||
}
|
||||
// if in portrait with 2/3 button mode, translucent nav bar
|
||||
else {
|
||||
ColorUtils.setAlphaComponent(
|
||||
getResourceColor(
|
||||
if (bottomNav) android.R.attr.colorPrimary
|
||||
else android.R.attr.colorBackground
|
||||
), 179)
|
||||
}
|
||||
getResourceColor( android.R.attr.colorPrimary )
|
||||
}*/
|
||||
v.setPadding(insets.systemWindowInsetLeft, insets.systemWindowInsetTop,
|
||||
insets.systemWindowInsetRight, 0)
|
||||
insets
|
||||
@ -277,7 +228,7 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
|
||||
right = insets.systemWindowInsetRight
|
||||
)
|
||||
nav_bar_scrim.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
height = if (bottomNav) insets.systemWindowInsetBottom else 0
|
||||
height = insets.systemWindowInsetBottom
|
||||
}
|
||||
insets.replaceSystemWindowInsets(
|
||||
0, insets.systemWindowInsetTop,
|
||||
@ -330,7 +281,7 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
|
||||
}
|
||||
|
||||
fun updateRecentsIcon() {
|
||||
if (bottomNav) navigationView.menu.findItem(R.id.nav_drawer_recents).icon =
|
||||
navigationView.menu.findItem(R.id.nav_drawer_recents).icon =
|
||||
AppCompatResources.getDrawable(this,
|
||||
if (preferences.showRecentUpdates().getOrDefault()) R.drawable.ic_update_black_24dp
|
||||
else R.drawable.ic_history_black_24dp)
|
||||
@ -356,30 +307,22 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
|
||||
}
|
||||
|
||||
private fun setExtensionsBadge() {
|
||||
|
||||
val extUpdateText: TextView = nav_view.menu.findItem(
|
||||
R.id.nav_drawer_extensions
|
||||
)?.actionView as? TextView ?: return
|
||||
|
||||
val updates = preferences.extensionUpdatesCount().getOrDefault()
|
||||
if (updates > 0) {
|
||||
extUpdateText.text = updates.toString()
|
||||
extUpdateText.visible()
|
||||
val badge = navigationView.getOrCreateBadge(R.id.nav_drawer_settings)
|
||||
badge.number = updates
|
||||
badge.backgroundColor = getResourceColor(R.attr.badgeColor)
|
||||
badge.badgeTextColor = Color.WHITE
|
||||
}
|
||||
else {
|
||||
extUpdateText.text = null
|
||||
extUpdateText.gone()
|
||||
navigationView.removeBadge(R.id.nav_drawer_settings)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
bottomNav = preferences.useBottonNav().getOrDefault()
|
||||
// setting in case someone comes from the search activity
|
||||
usingBottomNav = true
|
||||
getExtensionUpdates()
|
||||
DownloadService.callListeners()
|
||||
val useBiometrics = preferences.useBiometrics().getOrDefault()
|
||||
@ -467,7 +410,6 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
DownloadService.removeListener(this)
|
||||
nav_view?.setNavigationItemSelectedListener(null)
|
||||
toolbar?.setNavigationOnClickListener(null)
|
||||
}
|
||||
|
||||
@ -476,12 +418,8 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
|
||||
super.onBackPressed()
|
||||
return
|
||||
}
|
||||
val backstackSize = router.backstackSize
|
||||
if (drawer.isDrawerOpen(GravityCompat.START) || drawer.isDrawerOpen(GravityCompat.END)) {
|
||||
drawer.closeDrawers()
|
||||
} else if (!bottomNav && backstackSize == 1 && router.getControllerWithTag
|
||||
("$startScreenId") == null) {
|
||||
setSelectedDrawerItem(startScreenId)
|
||||
} else if (!router.handleBack()) {
|
||||
unlocked = false
|
||||
super.onBackPressed()
|
||||
@ -490,38 +428,26 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
|
||||
|
||||
private fun setSelectedDrawerItem(itemId: Int) {
|
||||
if (!isFinishing) {
|
||||
if (bottomNav) {
|
||||
if (itemId == R.id.nav_drawer_library || itemId == R.id.nav_drawer_settings)
|
||||
if (itemId == R.id.nav_drawer_library ||
|
||||
itemId == R.id.nav_drawer_settings ||
|
||||
itemId == R.id.nav_drawer_catalogues)
|
||||
navigationView.selectedItemId = itemId
|
||||
}
|
||||
else nav_view.setCheckedItem(itemId)
|
||||
jumpToController(itemId)
|
||||
}
|
||||
}
|
||||
|
||||
private fun jumpToController(id: Int) {
|
||||
|
||||
val currentRoot = router.backstack.firstOrNull()
|
||||
if (currentRoot?.tag()?.toIntOrNull() != id) {
|
||||
when (id) {
|
||||
R.id.nav_drawer_library -> if (!bottomNav) setRoot(LibraryController(), id)
|
||||
R.id.nav_drawer_recent_updates -> {
|
||||
preferences.showRecentUpdates().set(true)
|
||||
if (bottomNav) navigationView.selectedItemId = R.id.nav_drawer_recents
|
||||
else setRoot(RecentChaptersController(), id)
|
||||
R.id.nav_drawer_recent_updates, R.id.nav_drawer_recently_read -> {
|
||||
preferences.showRecentUpdates().set(id == R.id.nav_drawer_recent_updates)
|
||||
navigationView.selectedItemId = R.id.nav_drawer_recents
|
||||
updateRecentsIcon()
|
||||
}
|
||||
R.id.nav_drawer_recently_read -> {
|
||||
preferences.showRecentUpdates().set(false)
|
||||
if (bottomNav) navigationView.selectedItemId = R.id.nav_drawer_recents
|
||||
else setRoot(RecentlyReadController(), id)
|
||||
updateRecentsIcon()
|
||||
}
|
||||
R.id.nav_drawer_catalogues -> setRoot(CatalogueController(), id)
|
||||
R.id.nav_drawer_extensions -> {
|
||||
if (router.backstack.isEmpty()) {
|
||||
navigationView.selectedItemId = R.id.nav_drawer_settings
|
||||
setRoot(SettingsMainController(), R.id.nav_drawer_settings)
|
||||
router.pushController(RouterTransaction.with(ExtensionController())
|
||||
.pushChangeHandler(SimpleSwapChangeHandler())
|
||||
.popChangeHandler(FadeChangeHandler()))
|
||||
@ -534,24 +460,15 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
|
||||
if (router.backstackSize > 1) {
|
||||
router.popToRoot()
|
||||
}
|
||||
|
||||
if (bottomNav) {
|
||||
if (router.backstack.isEmpty()) {
|
||||
navigationView.selectedItemId = R.id.nav_drawer_library
|
||||
if (router.backstack.firstOrNull()?.controller() is LibraryController)
|
||||
router.popToRoot()
|
||||
else
|
||||
setRoot(LibraryController(), R.id.nav_drawer_library)
|
||||
router.pushController(DownloadController().withFadeTransaction())
|
||||
router.pushController(RouterTransaction.with(DownloadController())
|
||||
.pushChangeHandler(SimpleSwapChangeHandler())
|
||||
.popChangeHandler(FadeChangeHandler()))
|
||||
}
|
||||
else {
|
||||
nav_view.setCheckedItem(R.id.nav_drawer_settings)
|
||||
setRoot(DownloadController(), id)
|
||||
router.pushController(DownloadController().withFadeTransaction())
|
||||
}
|
||||
|
||||
}
|
||||
R.id.nav_drawer_settings -> {
|
||||
if (!bottomNav)
|
||||
setRoot(SettingsMainController(), id)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -591,19 +508,15 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
|
||||
if (from is DialogController || to is DialogController) {
|
||||
return
|
||||
}
|
||||
val showHamburger = router.backstackSize == 1
|
||||
drawer.setDrawerLockMode(androidx.drawerlayout.widget.DrawerLayout.LOCK_MODE_LOCKED_CLOSED)
|
||||
if (showHamburger) {
|
||||
if (bottomNav) toolbar.navigationIcon = null
|
||||
else drawer.setDrawerLockMode(androidx.drawerlayout.widget.DrawerLayout.LOCK_MODE_UNLOCKED)
|
||||
val onRoot = router.backstackSize == 1
|
||||
//drawer.setDrawerLockMode(androidx.drawerlayout.widget.DrawerLayout
|
||||
// .LOCK_MODE_LOCKED_CLOSED)
|
||||
if (onRoot) {
|
||||
toolbar.navigationIcon = null
|
||||
} else {
|
||||
if (bottomNav) toolbar.navigationIcon = drawerArrow
|
||||
else drawer.setDrawerLockMode(
|
||||
androidx.drawerlayout.widget.DrawerLayout.LOCK_MODE_LOCKED_CLOSED
|
||||
)
|
||||
toolbar.navigationIcon = drawerArrow
|
||||
}
|
||||
if (bottomNav) drawerArrow?.progress = 1f
|
||||
else ObjectAnimator.ofFloat(drawerArrow, "progress", if (showHamburger) 0f else 1f).start()
|
||||
drawerArrow?.progress = 1f
|
||||
|
||||
if (from is TabbedController) {
|
||||
from.cleanupTabs(tabs)
|
||||
@ -639,7 +552,6 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
|
||||
}
|
||||
|
||||
override fun downloadStatusChanged(downloading: Boolean) {
|
||||
if (!bottomNav) return
|
||||
val downloadManager = Injekt.get<DownloadManager>()
|
||||
val hasQueue = downloading || downloadManager.hasQueue()
|
||||
launchUI {
|
||||
@ -671,8 +583,7 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
|
||||
|
||||
var unlocked = false
|
||||
|
||||
var bottomNav = false
|
||||
var usingBottomNav = true
|
||||
internal set
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class SearchActivity: MainActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
bottomNav = false
|
||||
usingBottomNav = false
|
||||
setContentView(R.layout.search_activity)
|
||||
|
||||
setSupportActionBar(sToolbar)
|
||||
@ -189,7 +189,7 @@ class SearchActivity: MainActivity() {
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
bottomNav = false
|
||||
usingBottomNav = false
|
||||
}
|
||||
|
||||
override fun handleIntentAction(intent: Intent): Boolean {
|
||||
|
@ -103,9 +103,7 @@ class ChaptersController() : NucleusController<ChaptersPresenter>(),
|
||||
adapter?.fastScroller = fast_scroller
|
||||
|
||||
val fabBaseMarginBottom = fab?.marginBottom ?: 0
|
||||
recycler.setOnApplyWindowInsetsListener { v, insets ->
|
||||
if (MainActivity.bottomNav)
|
||||
return@setOnApplyWindowInsetsListener insets
|
||||
recycler.doOnApplyWindowInsets { v, insets, _ ->
|
||||
fab?.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
bottomMargin = fabBaseMarginBottom + insets.systemWindowInsetBottom
|
||||
}
|
||||
@ -115,7 +113,6 @@ class ChaptersController() : NucleusController<ChaptersPresenter>(),
|
||||
// offset the recycler by the fab's inset + some inset on top
|
||||
v.updatePaddingRelative(bottom = insets.systemWindowInsetBottom +
|
||||
v.context.resources.getDimensionPixelSize(R.dimen.fab_list_padding))
|
||||
insets
|
||||
}
|
||||
swipe_refresh.refreshes().subscribeUntilDestroy { fetchChaptersFromSource() }
|
||||
|
||||
|
@ -205,7 +205,7 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
||||
setFullCoverToThumb()
|
||||
}
|
||||
container?.setOnApplyWindowInsetsListener { _, insets ->
|
||||
if (MainActivity.bottomNav)
|
||||
if (MainActivity.usingBottomNav)
|
||||
return@setOnApplyWindowInsetsListener insets
|
||||
if (resources?.configuration?.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
fab_favorite?.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
|
@ -338,7 +338,6 @@ class RecentChaptersController : NucleusController<RecentChaptersPresenter>(),
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||
inflater.inflate(R.menu.recent_updates, menu)
|
||||
menu.findItem(R.id.action_recents).isVisible = MainActivity.bottomNav
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
|
@ -192,7 +192,6 @@ class RecentlyReadController(bundle: Bundle? = null) : BaseController(bundle),
|
||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||
inflater.inflate(R.menu.recently_read, menu)
|
||||
val searchItem = menu.findItem(R.id.action_search)
|
||||
menu.findItem(R.id.action_recents).isVisible = MainActivity.bottomNav
|
||||
val searchView = searchItem.actionView as SearchView
|
||||
if (query.isNotEmpty()) {
|
||||
searchItem.expandActionView()
|
||||
|
@ -135,35 +135,5 @@ class SettingsGeneralController : SettingsController() {
|
||||
defaultValue = 0
|
||||
}
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
key = Keys.useBottomNav
|
||||
titleRes = R.string.use_bottom_nav
|
||||
defaultValue = true
|
||||
onChange { bottomNav ->
|
||||
bottomNav as Boolean
|
||||
if (!bottomNav) {
|
||||
MaterialDialog(activity!!).title(R.string.switch_to_sidebar)
|
||||
.message(R.string.switch_to_sidebar_summary)
|
||||
.positiveButton(R.string.action_switch) {
|
||||
preferences.useBottonNav().set(bottomNav)
|
||||
switchNavType(bottomNav)
|
||||
}.negativeButton(android.R.string.no).show()
|
||||
false
|
||||
}
|
||||
else {
|
||||
switchNavType(bottomNav)
|
||||
true
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun switchNavType(bottomNav: Boolean) {
|
||||
activity?.recreate()
|
||||
if (bottomNav) {
|
||||
(activity as MainActivity).navigationView.selectedItemId = R.id.nav_drawer_settings
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ class SettingsMainController : SettingsController() {
|
||||
iconRes = R.drawable.ic_extension_black_24dp
|
||||
iconTint = tintColor
|
||||
titleRes = R.string.label_extensions
|
||||
isVisible = MainActivity.bottomNav
|
||||
onClick { navigateTo(ExtensionController()) }
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ inline val View.marginLeft: Int
|
||||
|
||||
object RecyclerWindowInsetsListener : View.OnApplyWindowInsetsListener {
|
||||
override fun onApplyWindowInsets(v: View, insets: WindowInsets): WindowInsets {
|
||||
if (MainActivity.bottomNav) return insets
|
||||
if (MainActivity.usingBottomNav) return insets
|
||||
v.setPadding(0,0,0,insets.systemWindowInsetBottom)
|
||||
//v.updatePaddingRelative(bottom = v.paddingBottom + insets.systemWindowInsetBottom)
|
||||
return insets
|
||||
@ -163,7 +163,7 @@ object RecyclerWindowInsetsListener : View.OnApplyWindowInsetsListener {
|
||||
|
||||
fun View.doOnApplyWindowInsets(f: (View, WindowInsets, ViewPaddingState) -> Unit) {
|
||||
// Create a snapshot of the view's padding state
|
||||
if (MainActivity.bottomNav) return
|
||||
if (MainActivity.usingBottomNav) return
|
||||
val paddingState = createStateForView(this)
|
||||
setOnApplyWindowInsetsListener { v, insets ->
|
||||
f(v, insets, paddingState)
|
||||
|
@ -2,7 +2,8 @@
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
android:viewportHeight="24.0"
|
||||
android:tint="?attr/actionBarTintColor">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M4,14h4v-4L4,10v4zM4,19h4v-4L4,15v4zM4,9h4L8,5L4,5v4zM9,14h12v-4L9,10v4zM9,19h12v-4L9,15v4zM9,5v4h12L21,5L9,5z"/>
|
||||
|
@ -2,7 +2,8 @@
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
android:viewportHeight="24.0"
|
||||
android:tint="?attr/actionBarTintColor">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M4,11h5L9,5L4,5v6zM4,18h5v-6L4,12v6zM10,18h5v-6h-5v6zM16,18h5v-6h-5v6zM10,11h5L15,5h-5v6zM16,5v6h5L21,5h-5z"/>
|
||||
|
@ -20,6 +20,5 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end"
|
||||
app:fastScrollerBubbleEnabled="true"
|
||||
app:fastScrollerIgnoreTouchesOutsideHandle="true"
|
||||
tools:visibility="visible" />
|
||||
</eu.kanade.tachiyomi.ui.library.LibraryCategoryView>
|
||||
|
@ -87,15 +87,5 @@
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<com.google.android.material.navigation.NavigationView
|
||||
android:id="@+id/nav_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:fitsSystemWindows="true"
|
||||
android:theme="?attr/navigation_view_theme"
|
||||
app:headerLayout="@layout/navigation_header"
|
||||
app:menu="@menu/menu_navigation"/>
|
||||
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
||||
</FrameLayout>
|
||||
|
@ -29,33 +29,4 @@
|
||||
android:title="@string/label_migration"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_reorganize"
|
||||
android:icon="@drawable/ic_swap_vert_white_24dp"
|
||||
android:title="@string/action_sort_by"
|
||||
app:showAsAction="ifRoom">
|
||||
<menu>
|
||||
<group android:id="@+id/reorder_group"
|
||||
android:checkableBehavior="single">
|
||||
<item
|
||||
android:id="@+id/action_alpha_asc"
|
||||
android:title="@string/title"/>
|
||||
<item
|
||||
android:id="@+id/action_update_asc"
|
||||
android:title="@string/action_sort_last_updated"/>
|
||||
<item
|
||||
android:id="@+id/action_unread"
|
||||
android:title="@string/action_filter_unread"/>
|
||||
<item
|
||||
android:id="@+id/action_last_read"
|
||||
android:title="@string/action_sort_last_read"/>
|
||||
|
||||
</group>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_reverse"
|
||||
android:title="@string/action_reverse_order"/>
|
||||
</menu>
|
||||
</item>
|
||||
|
||||
</menu>
|
||||
|
@ -167,12 +167,6 @@
|
||||
<string name="pref_date_format">Date format</string>
|
||||
<string name="pref_enable_automatic_updates">Check for updates</string>
|
||||
<string name="pref_enable_automatic_updates_summary">Automatically check for new app versions</string>
|
||||
<string name="use_bottom_nav">Use bottom navigation</string>
|
||||
<string name="switch_to_sidebar">Switch to navigation drawer?</string>
|
||||
<string name="switch_to_sidebar_summary">Navigation drawer is no longer supported by this
|
||||
version of Tachiyomi and will later be removed. Non-critical bugs and features
|
||||
relating to it will be ignored.</string>
|
||||
<string name="action_switch">Switch</string>
|
||||
|
||||
<!-- Library section -->
|
||||
<string name="pref_category_library_display">Display</string>
|
||||
|
Loading…
Reference in New Issue
Block a user