Removed logic and option for the side drawer

👋
This commit is contained in:
Jay 2020-02-09 15:25:15 -08:00
parent 31670b8113
commit 4d1623a812
23 changed files with 99 additions and 445 deletions

View File

@ -137,8 +137,6 @@ object PreferenceKeys {
const val refreshCoversToo = "refresh_covers_too" const val refreshCoversToo = "refresh_covers_too"
const val useBottomNav = "use_bottom_nav"
@Deprecated("Use the preferences of the source") @Deprecated("Use the preferences of the source")
fun sourceUsername(sourceId: Long) = "pref_source_username_$sourceId" fun sourceUsername(sourceId: Long) = "pref_source_username_$sourceId"

View File

@ -233,8 +233,6 @@ class PreferencesHelper(val context: Context) {
fun extensionUpdatesCount() = rxPrefs.getInteger("ext_updates_count", 0) fun extensionUpdatesCount() = rxPrefs.getInteger("ext_updates_count", 0)
fun useBottonNav() = rxPrefs.getBoolean(Keys.useBottomNav, true)
fun showRecentUpdates() = rxPrefs.getBoolean("show_recents", false) fun showRecentUpdates() = rxPrefs.getBoolean("show_recents", false)
fun lastExtCheck() = rxPrefs.getLong("last_ext_check", 0) fun lastExtCheck() = rxPrefs.getLong("last_ext_check", 0)

View File

@ -17,6 +17,7 @@ import com.f2prateek.rx.preferences.Preference
import com.google.android.material.snackbar.BaseTransientBottomBar import com.google.android.material.snackbar.BaseTransientBottomBar
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import com.jakewharton.rxbinding.support.v7.widget.queryTextChangeEvents import com.jakewharton.rxbinding.support.v7.widget.queryTextChangeEvents
import com.jakewharton.rxbinding.view.visible
import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.IFlexible import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
@ -294,16 +295,7 @@ open class BrowseCatalogueController(bundle: Bundle) :
) )
// Setup filters button // Setup filters button
menu.findItem(R.id.action_set_filter).apply { menu.findItem(R.id.action_set_filter).isVisible = presenter.sourceFilters.isNotEmpty()
icon.mutate()
if (presenter.sourceFilters.isEmpty()) {
isEnabled = false
icon.alpha = 128
} else {
isEnabled = true
icon.alpha = 255
}
}
// Show next display mode // Show next display mode
menu.findItem(R.id.action_display_mode).apply { menu.findItem(R.id.action_display_mode).apply {

View File

@ -1,7 +1,6 @@
package eu.kanade.tachiyomi.ui.catalogue.filter package eu.kanade.tachiyomi.ui.catalogue.filter
import android.annotation.SuppressLint import android.annotation.SuppressLint
import com.google.android.material.R
import android.view.View import android.view.View
import android.widget.TextView import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView 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.AbstractHeaderItem
import eu.davidea.flexibleadapter.items.IFlexible import eu.davidea.flexibleadapter.items.IFlexible
import eu.davidea.viewholders.FlexibleViewHolder import eu.davidea.viewholders.FlexibleViewHolder
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.Filter
import eu.kanade.tachiyomi.util.system.getResourceColor
class HeaderItem(val filter: Filter.Header) : AbstractHeaderItem<HeaderItem.Holder>() { class HeaderItem(val filter: Filter.Header) : AbstractHeaderItem<HeaderItem.Holder>() {
@SuppressLint("PrivateResource") @SuppressLint("PrivateResource")
override fun getLayoutRes(): Int { 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 { 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?>?) { override fun bindViewHolder(adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>, holder: Holder, position: Int, payloads: MutableList<Any?>?) {
val view = holder.itemView as TextView val view = holder.itemView as TextView
view.text = filter.name view.text = filter.name
view.setTextColor(view.context.getResourceColor(R.attr.actionBarTintColor))
} }
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean {

View File

@ -101,32 +101,16 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
swipe_refresh.addView(recycler) swipe_refresh.addView(recycler)
adapter.fastScroller = fast_scroller adapter.fastScroller = fast_scroller
if (!MainActivity.bottomNav) {
fast_scroller.addOnScrollStateChangeListener {
controller.lockFilterBar(it)
}
}
else {
fast_scroller.setIgnoreTouchesOutsideHandle(false)
}
val config = resources?.configuration val config = resources?.configuration
val phoneLandscape = (config?.orientation == Configuration.ORIENTATION_LANDSCAPE && val phoneLandscape = (config?.orientation == Configuration.ORIENTATION_LANDSCAPE &&
(config.screenLayout.and(Configuration.SCREENLAYOUT_SIZE_MASK)) < (config.screenLayout.and(Configuration.SCREENLAYOUT_SIZE_MASK)) <
Configuration.SCREENLAYOUT_SIZE_LARGE) 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 val height = context.resources.getDimensionPixelSize(R.dimen.rounder_radius) + 5.dpToPx
recycler.updatePaddingRelative(bottom = height) 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 // Double the distance required to trigger sync
swipe_refresh.setDistanceToTriggerSync((2 * 64 * resources.displayMetrics.density).toInt()) swipe_refresh.setDistanceToTriggerSync((2 * 64 * resources.displayMetrics.density).toInt())
@ -191,14 +175,6 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
adapter.notifyDataSetChanged() adapter.notifyDataSetChanged()
saveDragSort() 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("/")) preferences.defaultMangaOrder().set(mangaIds.joinToString("/"))
else else
db.insertCategory(category).asRxObservable().subscribe() db.insertCategory(category).asRxObservable().subscribe()
//justDraggedAndDropped = true
controller.onCatSortChanged(category.id) controller.onCatSortChanged(category.id)
controller.enableReorderItems(category)
} }
override fun shouldMoveItem(fromPosition: Int, toPosition: Int): Boolean { override fun shouldMoveItem(fromPosition: Int, toPosition: Int): Boolean {
if (adapter.selectedItemCount > 1) if (adapter.selectedItemCount > 1)

View File

@ -75,7 +75,6 @@ class LibraryController(
private val preferences: PreferencesHelper = Injekt.get() private val preferences: PreferencesHelper = Injekt.get()
) : BaseController(bundle), ) : BaseController(bundle),
TabbedController, TabbedController,
SecondaryDrawerController,
ActionMode.Callback, ActionMode.Callback,
ChangeMangaCategoriesDialog.Listener, ChangeMangaCategoriesDialog.Listener,
MigrationInterface, MigrationInterface,
@ -144,11 +143,6 @@ class LibraryController(
*/ */
private var adapter: LibraryAdapter? = null 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. * Drawer listener to allow swipe only for closing the drawer.
*/ */
@ -158,8 +152,6 @@ class LibraryController(
var snack: Snackbar? = null var snack: Snackbar? = null
private var reorderMenuItem:MenuItem? = null
private var presenter = LibraryPresenter(this) private var presenter = LibraryPresenter(this)
init { init {
@ -196,8 +188,8 @@ class LibraryController(
library_pager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener { library_pager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
override fun onPageSelected(position: Int) { override fun onPageSelected(position: Int) {
enableReorderItems(position)
bottom_sheet.lastCategory = adapter?.categories?.getOrNull(position) bottom_sheet.lastCategory = adapter?.categories?.getOrNull(position)
if (preferences.librarySortingMode().getOrDefault() == LibrarySort.DRAG_AND_DROP)
bottom_sheet.updateTitle() bottom_sheet.updateTitle()
} }
@ -216,7 +208,6 @@ class LibraryController(
createActionModeIfNeeded() createActionModeIfNeeded()
} }
if (MainActivity.bottomNav) {
bottom_sheet.onCreate(pager_layout) bottom_sheet.onCreate(pager_layout)
bottom_sheet.onGroupClicked = { bottom_sheet.onGroupClicked = {
@ -225,8 +216,7 @@ class LibraryController(
SortFilterBottomSheet.ACTION_FILTER -> onFilterChanged() SortFilterBottomSheet.ACTION_FILTER -> onFilterChanged()
SortFilterBottomSheet.ACTION_SORT -> onSortChanged() SortFilterBottomSheet.ACTION_SORT -> onSortChanged()
SortFilterBottomSheet.ACTION_DISPLAY -> reattachAdapter() SortFilterBottomSheet.ACTION_DISPLAY -> reattachAdapter()
SortFilterBottomSheet.ACTION_DOWNLOAD_BADGE -> SortFilterBottomSheet.ACTION_DOWNLOAD_BADGE -> presenter.requestDownloadBadgesUpdate()
presenter.requestDownloadBadgesUpdate()
SortFilterBottomSheet.ACTION_UNREAD_BADGE -> presenter.requestUnreadBadgesUpdate() SortFilterBottomSheet.ACTION_UNREAD_BADGE -> presenter.requestUnreadBadgesUpdate()
SortFilterBottomSheet.ACTION_CAT_SORT -> onCatSortChanged() SortFilterBottomSheet.ACTION_CAT_SORT -> onCatSortChanged()
} }
@ -236,40 +226,6 @@ class LibraryController(
router.pushController(DownloadController().withFadeTransaction()) 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) { override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) {
super.onChangeStarted(handler, type) super.onChangeStarted(handler, type)
@ -314,40 +270,6 @@ class LibraryController(
super.onDetach(view) 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) { override fun configureTabs(tabs: TabLayout) {
with(tabs) { with(tabs) {
tabGravity = TabLayout.GRAVITY_CENTER tabGravity = TabLayout.GRAVITY_CENTER
@ -423,35 +345,25 @@ class LibraryController(
preferences.landscapeColumns() preferences.landscapeColumns()
} }
private fun onRefresh() {
if (!MainActivity.bottomNav) activity?.invalidateOptionsMenu()
presenter.requestFullUpdate()
}
/** /**
* Called when a filter is changed. * Called when a filter is changed.
*/ */
private fun onFilterChanged(item: ExtendedNavigationView.Item? = null) { private fun onFilterChanged() {
if (item is ExtendedNavigationView.Item.MultiStateGroup && item.resTitle == R.string.categories) {
if (!MainActivity.bottomNav) activity?.invalidateOptionsMenu()
presenter.requestFullUpdate()
return
}
presenter.requestFilterUpdate() presenter.requestFilterUpdate()
destroyActionModeIfNeeded() destroyActionModeIfNeeded()
if (!MainActivity.bottomNav) activity?.invalidateOptionsMenu()
} }
private fun onDownloadBadgeChanged() { private fun onRefresh() {
presenter.requestDownloadBadgesUpdate() presenter.getLibrary()
destroyActionModeIfNeeded()
} }
/** /**
* Called when the sorting mode is changed. * Called when the sorting mode is changed.
*/ */
private fun onSortChanged() { private fun onSortChanged() {
if (!MainActivity.bottomNav) activity?.invalidateOptionsMenu()
presenter.requestSortUpdate() presenter.requestSortUpdate()
destroyActionModeIfNeeded()
} }
fun onCatSortChanged(id: Int? = null) { fun onCatSortChanged(id: Int? = null) {
@ -489,27 +401,19 @@ class LibraryController(
/** /**
* Destroys the action mode. * Destroys the action mode.
*/ */
fun destroyActionModeIfNeeded() { private fun destroyActionModeIfNeeded() {
actionMode?.finish() actionMode?.finish()
} }
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater.inflate(R.menu.library, menu) 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 config = resources?.configuration
val phoneLandscape = (config?.orientation == Configuration.ORIENTATION_LANDSCAPE && val phoneLandscape = (config?.orientation == Configuration.ORIENTATION_LANDSCAPE &&
(config.screenLayout.and(Configuration.SCREENLAYOUT_SIZE_MASK)) < (config.screenLayout.and(Configuration.SCREENLAYOUT_SIZE_MASK)) <
Configuration.SCREENLAYOUT_SIZE_LARGE) Configuration.SCREENLAYOUT_SIZE_LARGE)
menu.findItem(R.id.action_library_filter).isVisible = !MainActivity.bottomNav || phoneLandscape menu.findItem(R.id.action_library_filter).isVisible = phoneLandscape
reorderMenuItem = reorganizeItem
enableReorderItems()
val searchItem = menu.findItem(R.id.action_search) val searchItem = menu.findItem(R.id.action_search)
val searchView = searchItem.actionView as SearchView val searchView = searchItem.actionView as SearchView
@ -555,7 +459,7 @@ class LibraryController(
} }
override fun onPrepareOptionsMenu(menu: Menu) { override fun onPrepareOptionsMenu(menu: Menu) {
val navView = navView ?: return val navView = bottom_sheet ?: return
val filterItem = menu.findItem(R.id.action_library_filter) val filterItem = menu.findItem(R.id.action_library_filter)
@ -569,15 +473,9 @@ class LibraryController(
when (item.itemId) { when (item.itemId) {
R.id.action_search -> expandActionViewFromInteraction = true R.id.action_search -> expandActionViewFromInteraction = true
R.id.action_library_filter -> { R.id.action_library_filter -> {
if (MainActivity.bottomNav) {
if (bottom_sheet.sheetBehavior?.state != BottomSheetBehavior.STATE_COLLAPSED) if (bottom_sheet.sheetBehavior?.state != BottomSheetBehavior.STATE_COLLAPSED)
bottom_sheet.sheetBehavior?.state = bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED
BottomSheetBehavior.STATE_COLLAPSED else bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_EXPANDED
else
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())
@ -585,31 +483,12 @@ class LibraryController(
R.id.action_source_migration -> { R.id.action_source_migration -> {
router.pushController(MigrationController().withFadeTransaction()) 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) else -> return super.onOptionsItemSelected(item)
} }
return true 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. * Invalidates the action mode, forcing it to refresh its content.
*/ */
@ -753,17 +632,6 @@ class LibraryController(
.showDialog(router) .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() { private fun deleteMangasFromLibrary() {
val mangas = selectedMangas.toList() val mangas = selectedMangas.toList()
presenter.removeMangaFromLibrary(mangas) presenter.removeMangaFromLibrary(mangas)

View File

@ -115,27 +115,20 @@ class LibraryPresenter(
val filterFn: (LibraryItem) -> Boolean = f@ { item -> val filterFn: (LibraryItem) -> Boolean = f@ { item ->
// Filter when there isn't unread chapters. // Filter when there isn't unread chapters.
if (MainActivity.bottomNav) {
if (filterUnread == STATE_INCLUDE && if (filterUnread == STATE_INCLUDE &&
(item.manga.unread == 0 || db.getChapters(item.manga).executeAsBlocking() (item.manga.unread == 0 || db.getChapters(item.manga).executeAsBlocking()
.size != item.manga.unread)) return@f false .size != item.manga.unread)) return@f false
if (filterUnread == STATE_EXCLUDE && 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 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 && if (filterMangaType == LibraryManga.MANGA &&
item.manga.mangaType() == LibraryManga.MANWHA) item.manga.mangaType() == LibraryManga.MANWHA)
return@f false return@f false
if ((filterMangaType == LibraryManga.MANWHA) && if ((filterMangaType == LibraryManga.MANWHA) &&
item.manga.mangaType() == LibraryManga.MANGA) return@f false item.manga.mangaType() == LibraryManga.MANGA) return@f false
}
if (filterCompleted == STATE_INCLUDE && item.manga.status != SManga.COMPLETED) 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. * Returns the common categories for the given list of manga.
* *

View File

@ -260,6 +260,8 @@ class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: A
} }
} }
fun hasActiveFilters() = filterItems.any { it.isActivated }
private fun getFilters(): List<Int> { private fun getFilters(): List<Int> {
val filters = mutableListOf<Int>() val filters = mutableListOf<Int>()
val categoriesOn = !preferences.hideCategories().getOrDefault() val categoriesOn = !preferences.hideCategories().getOrDefault()
@ -434,8 +436,8 @@ class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: A
popup.show() popup.show()
} }
private fun onMainSortClicked(menuId: Int) { private fun onMainSortClicked(menuId: Int?) {
if (menuId == R.id.action_reverse) { if (menuId == null) {
preferences.librarySortingAscending().set( preferences.librarySortingAscending().set(
!preferences.librarySortingAscending().getOrDefault()) !preferences.librarySortingAscending().getOrDefault())
} }
@ -450,7 +452,7 @@ class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: A
} }
if (sort == preferences.librarySortingMode().getOrDefault()) { if (sort == preferences.librarySortingMode().getOrDefault()) {
if (sort != LibrarySort.DRAG_AND_DROP) if (sort != LibrarySort.DRAG_AND_DROP)
onMainSortClicked(R.id.action_reverse) onMainSortClicked(null)
return return
} }
preferences.librarySortingMode().set(sort) preferences.librarySortingMode().set(sort)
@ -460,9 +462,9 @@ class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: A
onGroupClicked(ACTION_SORT) onGroupClicked(ACTION_SORT)
} }
private fun onCatSortClicked(menuId: Int) { private fun onCatSortClicked(menuId: Int?) {
val category = lastCategory ?: return 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 val t = (category.mangaSort?.minus('a') ?: 0) + 1
if (t % 2 != 0) t + 1 if (t % 2 != 0) t + 1
else t - 1 else t - 1
@ -475,7 +477,7 @@ class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: A
else -> 0 else -> 0
} }
if (order == category.catSortingMode()) { if (order == category.catSortingMode()) {
onCatSortClicked(R.id.action_reverse) onCatSortClicked(null)
return return
} }
(2 * order + 1) (2 * order + 1)
@ -607,10 +609,10 @@ class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: A
} }
updateTitle() updateTitle()
} }
val filters = getFilters().size val hasFilters = hasActiveFilters()
if (filters > 0 && clearButton.parent == null) if (hasFilters && clearButton.parent == null)
filter_layout.addView(clearButton, 0) filter_layout.addView(clearButton, 0)
else if (filters == 0 && clearButton.parent != null) else if (!hasFilters && clearButton.parent != null)
filter_layout.removeView(clearButton) filter_layout.removeView(clearButton)
} }

View File

@ -14,11 +14,9 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.webkit.WebView import android.webkit.WebView
import android.widget.FrameLayout import android.widget.FrameLayout
import android.widget.TextView
import androidx.appcompat.content.res.AppCompatResources import androidx.appcompat.content.res.AppCompatResources
import androidx.appcompat.graphics.drawable.DrawerArrowDrawable import androidx.appcompat.graphics.drawable.DrawerArrowDrawable
import androidx.biometric.BiometricManager import androidx.biometric.BiometricManager
import androidx.core.graphics.ColorUtils
import androidx.core.view.GravityCompat import androidx.core.view.GravityCompat
import com.bluelinelabs.conductor.Conductor import com.bluelinelabs.conductor.Conductor
import com.bluelinelabs.conductor.Controller 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.ui.setting.SettingsMainController
import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.system.launchUI 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.updateLayoutParams
import eu.kanade.tachiyomi.util.view.updatePadding 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.android.synthetic.main.main_activity.*
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
@ -138,27 +130,6 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
tabAnimator = TabsAnimator(tabs) 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 -> navigationView.setOnNavigationItemSelectedListener { item ->
val id = item.itemId 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_catalogues -> setRoot(CatalogueController(), id)
R.id.nav_drawer_settings -> setRoot(SettingsMainController(), id) R.id.nav_drawer_settings -> setRoot(SettingsMainController(), id)
} }
nav_view.setCheckedItem(id)
} }
else if (currentRoot.tag()?.toIntOrNull() == id) { else if (currentRoot.tag()?.toIntOrNull() == id) {
when (id) { when (id) {
@ -198,27 +168,15 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
val container: ViewGroup = findViewById(R.id.controller_container) val container: ViewGroup = findViewById(R.id.controller_container)
val content: ViewGroup = findViewById(R.id.main_content) val content: ViewGroup = findViewById(R.id.main_content)
bottomNav = preferences.useBottonNav().getOrDefault()
DownloadService.addListener(this) 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 content.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION 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() updateRecentsIcon()
content.setOnApplyWindowInsetsListener { v, insets -> content.setOnApplyWindowInsetsListener { v, insets ->
window.navigationBarColor = // if device doesn't support light nav bar
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { 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 && if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
(v.rootWindowInsets.systemWindowInsetLeft > 0 || (v.rootWindowInsets.systemWindowInsetLeft > 0 ||
v.rootWindowInsets.systemWindowInsetRight > 0)) v.rootWindowInsets.systemWindowInsetRight > 0))
@ -226,7 +184,11 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
Color.BLACK Color.BLACK
else Color.argb(179, 0, 0, 0) 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 else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q
&& (v.rootWindowInsets.systemWindowInsetBottom != v.rootWindowInsets && (v.rootWindowInsets.systemWindowInsetBottom != v.rootWindowInsets
.tappableElementInsets.bottom)) { .tappableElementInsets.bottom)) {
@ -235,19 +197,8 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
// if in landscape with 2/3 button mode, fully opaque nav bar // if in landscape with 2/3 button mode, fully opaque nav bar
else if (v.rootWindowInsets.systemWindowInsetLeft > 0 else if (v.rootWindowInsets.systemWindowInsetLeft > 0
|| v.rootWindowInsets.systemWindowInsetRight > 0) { || v.rootWindowInsets.systemWindowInsetRight > 0) {
getResourceColor( getResourceColor( android.R.attr.colorPrimary )
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)
}
v.setPadding(insets.systemWindowInsetLeft, insets.systemWindowInsetTop, v.setPadding(insets.systemWindowInsetLeft, insets.systemWindowInsetTop,
insets.systemWindowInsetRight, 0) insets.systemWindowInsetRight, 0)
insets insets
@ -277,7 +228,7 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
right = insets.systemWindowInsetRight right = insets.systemWindowInsetRight
) )
nav_bar_scrim.updateLayoutParams<ViewGroup.MarginLayoutParams> { nav_bar_scrim.updateLayoutParams<ViewGroup.MarginLayoutParams> {
height = if (bottomNav) insets.systemWindowInsetBottom else 0 height = insets.systemWindowInsetBottom
} }
insets.replaceSystemWindowInsets( insets.replaceSystemWindowInsets(
0, insets.systemWindowInsetTop, 0, insets.systemWindowInsetTop,
@ -330,7 +281,7 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
} }
fun updateRecentsIcon() { 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, AppCompatResources.getDrawable(this,
if (preferences.showRecentUpdates().getOrDefault()) R.drawable.ic_update_black_24dp if (preferences.showRecentUpdates().getOrDefault()) R.drawable.ic_update_black_24dp
else R.drawable.ic_history_black_24dp) else R.drawable.ic_history_black_24dp)
@ -356,30 +307,22 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
} }
private fun setExtensionsBadge() { private fun setExtensionsBadge() {
val extUpdateText: TextView = nav_view.menu.findItem(
R.id.nav_drawer_extensions
)?.actionView as? TextView ?: return
val updates = preferences.extensionUpdatesCount().getOrDefault() val updates = preferences.extensionUpdatesCount().getOrDefault()
if (updates > 0) { if (updates > 0) {
extUpdateText.text = updates.toString()
extUpdateText.visible()
val badge = navigationView.getOrCreateBadge(R.id.nav_drawer_settings) val badge = navigationView.getOrCreateBadge(R.id.nav_drawer_settings)
badge.number = updates badge.number = updates
badge.backgroundColor = getResourceColor(R.attr.badgeColor) badge.backgroundColor = getResourceColor(R.attr.badgeColor)
badge.badgeTextColor = Color.WHITE badge.badgeTextColor = Color.WHITE
} }
else { else {
extUpdateText.text = null
extUpdateText.gone()
navigationView.removeBadge(R.id.nav_drawer_settings) navigationView.removeBadge(R.id.nav_drawer_settings)
} }
} }
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
bottomNav = preferences.useBottonNav().getOrDefault() // setting in case someone comes from the search activity
usingBottomNav = true
getExtensionUpdates() getExtensionUpdates()
DownloadService.callListeners() DownloadService.callListeners()
val useBiometrics = preferences.useBiometrics().getOrDefault() val useBiometrics = preferences.useBiometrics().getOrDefault()
@ -467,7 +410,6 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
DownloadService.removeListener(this) DownloadService.removeListener(this)
nav_view?.setNavigationItemSelectedListener(null)
toolbar?.setNavigationOnClickListener(null) toolbar?.setNavigationOnClickListener(null)
} }
@ -476,12 +418,8 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
super.onBackPressed() super.onBackPressed()
return return
} }
val backstackSize = router.backstackSize
if (drawer.isDrawerOpen(GravityCompat.START) || drawer.isDrawerOpen(GravityCompat.END)) { if (drawer.isDrawerOpen(GravityCompat.START) || drawer.isDrawerOpen(GravityCompat.END)) {
drawer.closeDrawers() drawer.closeDrawers()
} else if (!bottomNav && backstackSize == 1 && router.getControllerWithTag
("$startScreenId") == null) {
setSelectedDrawerItem(startScreenId)
} else if (!router.handleBack()) { } else if (!router.handleBack()) {
unlocked = false unlocked = false
super.onBackPressed() super.onBackPressed()
@ -490,38 +428,26 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
private fun setSelectedDrawerItem(itemId: Int) { private fun setSelectedDrawerItem(itemId: Int) {
if (!isFinishing) { if (!isFinishing) {
if (bottomNav) { if (itemId == R.id.nav_drawer_library ||
if (itemId == R.id.nav_drawer_library || itemId == R.id.nav_drawer_settings) itemId == R.id.nav_drawer_settings ||
itemId == R.id.nav_drawer_catalogues)
navigationView.selectedItemId = itemId navigationView.selectedItemId = itemId
}
else nav_view.setCheckedItem(itemId)
jumpToController(itemId) jumpToController(itemId)
} }
} }
private fun jumpToController(id: Int) { private fun jumpToController(id: Int) {
val currentRoot = router.backstack.firstOrNull() val currentRoot = router.backstack.firstOrNull()
if (currentRoot?.tag()?.toIntOrNull() != id) { if (currentRoot?.tag()?.toIntOrNull() != id) {
when (id) { when (id) {
R.id.nav_drawer_library -> if (!bottomNav) setRoot(LibraryController(), id) R.id.nav_drawer_recent_updates, R.id.nav_drawer_recently_read -> {
R.id.nav_drawer_recent_updates -> { preferences.showRecentUpdates().set(id == R.id.nav_drawer_recent_updates)
preferences.showRecentUpdates().set(true) navigationView.selectedItemId = R.id.nav_drawer_recents
if (bottomNav) navigationView.selectedItemId = R.id.nav_drawer_recents
else setRoot(RecentChaptersController(), id)
updateRecentsIcon() 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 -> { R.id.nav_drawer_extensions -> {
if (router.backstack.isEmpty()) { if (router.backstack.isEmpty()) {
navigationView.selectedItemId = R.id.nav_drawer_settings navigationView.selectedItemId = R.id.nav_drawer_settings
setRoot(SettingsMainController(), R.id.nav_drawer_settings)
router.pushController(RouterTransaction.with(ExtensionController()) router.pushController(RouterTransaction.with(ExtensionController())
.pushChangeHandler(SimpleSwapChangeHandler()) .pushChangeHandler(SimpleSwapChangeHandler())
.popChangeHandler(FadeChangeHandler())) .popChangeHandler(FadeChangeHandler()))
@ -534,24 +460,15 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
if (router.backstackSize > 1) { if (router.backstackSize > 1) {
router.popToRoot() router.popToRoot()
} }
if (router.backstack.isEmpty()) {
if (bottomNav) {
navigationView.selectedItemId = R.id.nav_drawer_library navigationView.selectedItemId = R.id.nav_drawer_library
if (router.backstack.firstOrNull()?.controller() is LibraryController) router.pushController(RouterTransaction.with(DownloadController())
router.popToRoot() .pushChangeHandler(SimpleSwapChangeHandler())
else .popChangeHandler(FadeChangeHandler()))
setRoot(LibraryController(), R.id.nav_drawer_library)
router.pushController(DownloadController().withFadeTransaction())
} }
else { else {
nav_view.setCheckedItem(R.id.nav_drawer_settings) router.pushController(DownloadController().withFadeTransaction())
setRoot(DownloadController(), id)
} }
}
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) { if (from is DialogController || to is DialogController) {
return return
} }
val showHamburger = router.backstackSize == 1 val onRoot = router.backstackSize == 1
drawer.setDrawerLockMode(androidx.drawerlayout.widget.DrawerLayout.LOCK_MODE_LOCKED_CLOSED) //drawer.setDrawerLockMode(androidx.drawerlayout.widget.DrawerLayout
if (showHamburger) { // .LOCK_MODE_LOCKED_CLOSED)
if (bottomNav) toolbar.navigationIcon = null if (onRoot) {
else drawer.setDrawerLockMode(androidx.drawerlayout.widget.DrawerLayout.LOCK_MODE_UNLOCKED) toolbar.navigationIcon = null
} else { } else {
if (bottomNav) toolbar.navigationIcon = drawerArrow toolbar.navigationIcon = drawerArrow
else drawer.setDrawerLockMode(
androidx.drawerlayout.widget.DrawerLayout.LOCK_MODE_LOCKED_CLOSED
)
} }
if (bottomNav) drawerArrow?.progress = 1f drawerArrow?.progress = 1f
else ObjectAnimator.ofFloat(drawerArrow, "progress", if (showHamburger) 0f else 1f).start()
if (from is TabbedController) { if (from is TabbedController) {
from.cleanupTabs(tabs) from.cleanupTabs(tabs)
@ -639,7 +552,6 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
} }
override fun downloadStatusChanged(downloading: Boolean) { override fun downloadStatusChanged(downloading: Boolean) {
if (!bottomNav) return
val downloadManager = Injekt.get<DownloadManager>() val downloadManager = Injekt.get<DownloadManager>()
val hasQueue = downloading || downloadManager.hasQueue() val hasQueue = downloading || downloadManager.hasQueue()
launchUI { launchUI {
@ -671,8 +583,7 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
var unlocked = false var unlocked = false
var bottomNav = false var usingBottomNav = true
internal set internal set
} }
} }

View File

@ -33,7 +33,7 @@ class SearchActivity: MainActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
bottomNav = false usingBottomNav = false
setContentView(R.layout.search_activity) setContentView(R.layout.search_activity)
setSupportActionBar(sToolbar) setSupportActionBar(sToolbar)
@ -189,7 +189,7 @@ class SearchActivity: MainActivity() {
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
bottomNav = false usingBottomNav = false
} }
override fun handleIntentAction(intent: Intent): Boolean { override fun handleIntentAction(intent: Intent): Boolean {

View File

@ -103,9 +103,7 @@ class ChaptersController() : NucleusController<ChaptersPresenter>(),
adapter?.fastScroller = fast_scroller adapter?.fastScroller = fast_scroller
val fabBaseMarginBottom = fab?.marginBottom ?: 0 val fabBaseMarginBottom = fab?.marginBottom ?: 0
recycler.setOnApplyWindowInsetsListener { v, insets -> recycler.doOnApplyWindowInsets { v, insets, _ ->
if (MainActivity.bottomNav)
return@setOnApplyWindowInsetsListener insets
fab?.updateLayoutParams<ViewGroup.MarginLayoutParams> { fab?.updateLayoutParams<ViewGroup.MarginLayoutParams> {
bottomMargin = fabBaseMarginBottom + insets.systemWindowInsetBottom bottomMargin = fabBaseMarginBottom + insets.systemWindowInsetBottom
} }
@ -115,7 +113,6 @@ class ChaptersController() : NucleusController<ChaptersPresenter>(),
// offset the recycler by the fab's inset + some inset on top // offset the recycler by the fab's inset + some inset on top
v.updatePaddingRelative(bottom = insets.systemWindowInsetBottom + v.updatePaddingRelative(bottom = insets.systemWindowInsetBottom +
v.context.resources.getDimensionPixelSize(R.dimen.fab_list_padding)) v.context.resources.getDimensionPixelSize(R.dimen.fab_list_padding))
insets
} }
swipe_refresh.refreshes().subscribeUntilDestroy { fetchChaptersFromSource() } swipe_refresh.refreshes().subscribeUntilDestroy { fetchChaptersFromSource() }

View File

@ -205,7 +205,7 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
setFullCoverToThumb() setFullCoverToThumb()
} }
container?.setOnApplyWindowInsetsListener { _, insets -> container?.setOnApplyWindowInsetsListener { _, insets ->
if (MainActivity.bottomNav) if (MainActivity.usingBottomNav)
return@setOnApplyWindowInsetsListener insets return@setOnApplyWindowInsetsListener insets
if (resources?.configuration?.orientation == Configuration.ORIENTATION_LANDSCAPE) { if (resources?.configuration?.orientation == Configuration.ORIENTATION_LANDSCAPE) {
fab_favorite?.updateLayoutParams<ViewGroup.MarginLayoutParams> { fab_favorite?.updateLayoutParams<ViewGroup.MarginLayoutParams> {

View File

@ -338,7 +338,6 @@ class RecentChaptersController : NucleusController<RecentChaptersPresenter>(),
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater.inflate(R.menu.recent_updates, menu) inflater.inflate(R.menu.recent_updates, menu)
menu.findItem(R.id.action_recents).isVisible = MainActivity.bottomNav
} }
override fun onOptionsItemSelected(item: MenuItem): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {

View File

@ -192,7 +192,6 @@ class RecentlyReadController(bundle: Bundle? = null) : BaseController(bundle),
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater.inflate(R.menu.recently_read, menu) inflater.inflate(R.menu.recently_read, menu)
val searchItem = menu.findItem(R.id.action_search) val searchItem = menu.findItem(R.id.action_search)
menu.findItem(R.id.action_recents).isVisible = MainActivity.bottomNav
val searchView = searchItem.actionView as SearchView val searchView = searchItem.actionView as SearchView
if (query.isNotEmpty()) { if (query.isNotEmpty()) {
searchItem.expandActionView() searchItem.expandActionView()

View File

@ -135,35 +135,5 @@ class SettingsGeneralController : SettingsController() {
defaultValue = 0 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
}
} }
} }

View File

@ -27,7 +27,6 @@ class SettingsMainController : SettingsController() {
iconRes = R.drawable.ic_extension_black_24dp iconRes = R.drawable.ic_extension_black_24dp
iconTint = tintColor iconTint = tintColor
titleRes = R.string.label_extensions titleRes = R.string.label_extensions
isVisible = MainActivity.bottomNav
onClick { navigateTo(ExtensionController()) } onClick { navigateTo(ExtensionController()) }
} }

View File

@ -154,7 +154,7 @@ inline val View.marginLeft: Int
object RecyclerWindowInsetsListener : View.OnApplyWindowInsetsListener { object RecyclerWindowInsetsListener : View.OnApplyWindowInsetsListener {
override fun onApplyWindowInsets(v: View, insets: WindowInsets): WindowInsets { 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.setPadding(0,0,0,insets.systemWindowInsetBottom)
//v.updatePaddingRelative(bottom = v.paddingBottom + insets.systemWindowInsetBottom) //v.updatePaddingRelative(bottom = v.paddingBottom + insets.systemWindowInsetBottom)
return insets return insets
@ -163,7 +163,7 @@ object RecyclerWindowInsetsListener : View.OnApplyWindowInsetsListener {
fun View.doOnApplyWindowInsets(f: (View, WindowInsets, ViewPaddingState) -> Unit) { fun View.doOnApplyWindowInsets(f: (View, WindowInsets, ViewPaddingState) -> Unit) {
// Create a snapshot of the view's padding state // Create a snapshot of the view's padding state
if (MainActivity.bottomNav) return if (MainActivity.usingBottomNav) return
val paddingState = createStateForView(this) val paddingState = createStateForView(this)
setOnApplyWindowInsetsListener { v, insets -> setOnApplyWindowInsetsListener { v, insets ->
f(v, insets, paddingState) f(v, insets, paddingState)

View File

@ -2,7 +2,8 @@
android:width="24dp" android:width="24dp"
android:height="24dp" android:height="24dp"
android:viewportWidth="24.0" android:viewportWidth="24.0"
android:viewportHeight="24.0"> android:viewportHeight="24.0"
android:tint="?attr/actionBarTintColor">
<path <path
android:fillColor="#FFFFFFFF" android:fillColor="#FFFFFFFF"
android:pathData="M4,14h4v-4L4,10v4zM4,19h4v-4L4,15v4zM4,9h4L8,5L4,5v4zM9,14h12v-4L9,10v4zM9,19h12v-4L9,15v4zM9,5v4h12L21,5L9,5z"/> android:pathData="M4,14h4v-4L4,10v4zM4,19h4v-4L4,15v4zM4,9h4L8,5L4,5v4zM9,14h12v-4L9,10v4zM9,19h12v-4L9,15v4zM9,5v4h12L21,5L9,5z"/>

View File

@ -2,7 +2,8 @@
android:width="24dp" android:width="24dp"
android:height="24dp" android:height="24dp"
android:viewportWidth="24.0" android:viewportWidth="24.0"
android:viewportHeight="24.0"> android:viewportHeight="24.0"
android:tint="?attr/actionBarTintColor">
<path <path
android:fillColor="#FFFFFFFF" android:fillColor="#FFFFFFFF"
android:pathData="M4,11h5L9,5L4,5v6zM4,18h5v-6L4,12v6zM10,18h5v-6h-5v6zM16,18h5v-6h-5v6zM10,11h5L15,5h-5v6zM16,5v6h5L21,5h-5z"/> android:pathData="M4,11h5L9,5L4,5v6zM4,18h5v-6L4,12v6zM10,18h5v-6h-5v6zM16,18h5v-6h-5v6zM10,11h5L15,5h-5v6zM16,5v6h5L21,5h-5z"/>

View File

@ -20,6 +20,5 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="end" android:layout_gravity="end"
app:fastScrollerBubbleEnabled="true" app:fastScrollerBubbleEnabled="true"
app:fastScrollerIgnoreTouchesOutsideHandle="true"
tools:visibility="visible" /> tools:visibility="visible" />
</eu.kanade.tachiyomi.ui.library.LibraryCategoryView> </eu.kanade.tachiyomi.ui.library.LibraryCategoryView>

View File

@ -87,15 +87,5 @@
</androidx.constraintlayout.widget.ConstraintLayout> </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> </androidx.drawerlayout.widget.DrawerLayout>
</FrameLayout> </FrameLayout>

View File

@ -29,33 +29,4 @@
android:title="@string/label_migration" android:title="@string/label_migration"
app:showAsAction="never"/> 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> </menu>

View File

@ -167,12 +167,6 @@
<string name="pref_date_format">Date format</string> <string name="pref_date_format">Date format</string>
<string name="pref_enable_automatic_updates">Check for updates</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="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 --> <!-- Library section -->
<string name="pref_category_library_display">Display</string> <string name="pref_category_library_display">Display</string>