Refactoring Library and Filter Bottom Sheet

Library controller is no longer rx
Library presenter is no longer rx
This commit is contained in:
Jay 2020-02-08 18:59:51 -08:00
parent 05cb2c0b6b
commit d4153a9f41
11 changed files with 166 additions and 411 deletions

View File

@ -27,8 +27,6 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior
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.google.android.material.tabs.TabLayout import com.google.android.material.tabs.TabLayout
import com.jakewharton.rxbinding.support.v4.view.pageSelections
import com.jakewharton.rxbinding.support.v7.widget.queryTextChanges
import com.jakewharton.rxrelay.BehaviorRelay import com.jakewharton.rxrelay.BehaviorRelay
import com.jakewharton.rxrelay.PublishRelay import com.jakewharton.rxrelay.PublishRelay
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
@ -41,13 +39,13 @@ import eu.kanade.tachiyomi.data.library.LibraryServiceListener
import eu.kanade.tachiyomi.data.library.LibraryUpdateService import eu.kanade.tachiyomi.data.library.LibraryUpdateService
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.ui.base.controller.NucleusController import eu.kanade.tachiyomi.ui.base.controller.BaseController
import eu.kanade.tachiyomi.ui.base.controller.SecondaryDrawerController import eu.kanade.tachiyomi.ui.base.controller.SecondaryDrawerController
import eu.kanade.tachiyomi.ui.base.controller.TabbedController import eu.kanade.tachiyomi.ui.base.controller.TabbedController
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
import eu.kanade.tachiyomi.ui.category.CategoryController import eu.kanade.tachiyomi.ui.category.CategoryController
import eu.kanade.tachiyomi.ui.download.DownloadController import eu.kanade.tachiyomi.ui.download.DownloadController
import eu.kanade.tachiyomi.ui.library.filter.FilterBottomSheet import eu.kanade.tachiyomi.ui.library.filter.SortFilterBottomSheet
import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.ui.main.MainActivity
import eu.kanade.tachiyomi.ui.manga.MangaController import eu.kanade.tachiyomi.ui.manga.MangaController
import eu.kanade.tachiyomi.ui.migration.MigrationController import eu.kanade.tachiyomi.ui.migration.MigrationController
@ -75,7 +73,7 @@ import uy.kohesive.injekt.api.get
class LibraryController( class LibraryController(
bundle: Bundle? = null, bundle: Bundle? = null,
private val preferences: PreferencesHelper = Injekt.get() private val preferences: PreferencesHelper = Injekt.get()
) : NucleusController<LibraryPresenter>(bundle), ) : BaseController(bundle),
TabbedController, TabbedController,
SecondaryDrawerController, SecondaryDrawerController,
ActionMode.Callback, ActionMode.Callback,
@ -154,18 +152,16 @@ class LibraryController(
/** /**
* Drawer listener to allow swipe only for closing the drawer. * Drawer listener to allow swipe only for closing the drawer.
*/ */
private var drawerListener: DrawerLayout.DrawerListener? = null
private var tabsVisibilityRelay: BehaviorRelay<Boolean> = BehaviorRelay.create(false) private var tabsVisibilityRelay: BehaviorRelay<Boolean> = BehaviorRelay.create(false)
private var tabsVisibilitySubscription: Subscription? = null private var tabsVisibilitySubscription: Subscription? = null
private var searchViewSubscription: Subscription? = null
var snack: Snackbar? = null var snack: Snackbar? = null
private var reorderMenuItem:MenuItem? = null private var reorderMenuItem:MenuItem? = null
private var presenter = LibraryPresenter(this)
init { init {
setHasOptionsMenu(true) setHasOptionsMenu(true)
retainViewMode = RetainViewMode.RETAIN_DETACH retainViewMode = RetainViewMode.RETAIN_DETACH
@ -174,11 +170,6 @@ class LibraryController(
override fun getTitle(): String? { override fun getTitle(): String? {
return resources?.getString(R.string.label_library) return resources?.getString(R.string.label_library)
} }
override fun createPresenter(): LibraryPresenter {
return LibraryPresenter()
}
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View { override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
return inflater.inflate(R.layout.library_controller, container, false) return inflater.inflate(R.layout.library_controller, container, false)
} }
@ -188,11 +179,21 @@ class LibraryController(
adapter = LibraryAdapter(this) adapter = LibraryAdapter(this)
library_pager.adapter = adapter library_pager.adapter = adapter
library_pager.pageSelections().skip(1).subscribeUntilDestroy { library_pager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
preferences.lastUsedCategory().set(it) override fun onPageSelected(position: Int) {
activeCategory = it preferences.lastUsedCategory().set(position)
activeCategory = position
} }
override fun onPageScrollStateChanged(state: Int) { }
override fun onPageScrolled(
position: Int,
positionOffset: Float,
positionOffsetPixels: Int
) { }
})
library_pager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener { library_pager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
override fun onPageSelected(position: Int) { override fun onPageSelected(position: Int) {
enableReorderItems(position) enableReorderItems(position)
@ -209,11 +210,7 @@ class LibraryController(
override fun onPageScrollStateChanged(state: Int) { } override fun onPageScrollStateChanged(state: Int) { }
}) })
getColumnsPreferenceForCurrentOrientation().asObservable() mangaPerRow = getColumnsPreferenceForCurrentOrientation().getOrDefault()
.doOnNext { mangaPerRow = it }
.skip(1)
// Set again the adapter to recalculate the covers height
.subscribeUntilDestroy { reattachAdapter() }
if (selectedMangas.isNotEmpty()) { if (selectedMangas.isNotEmpty()) {
createActionModeIfNeeded() createActionModeIfNeeded()
@ -224,14 +221,14 @@ class LibraryController(
bottom_sheet.onGroupClicked = { bottom_sheet.onGroupClicked = {
when (it) { when (it) {
FilterBottomSheet.ACTION_REFRESH -> onRefresh() SortFilterBottomSheet.ACTION_REFRESH -> onRefresh()
FilterBottomSheet.ACTION_FILTER -> onFilterChanged() SortFilterBottomSheet.ACTION_FILTER -> onFilterChanged()
FilterBottomSheet.ACTION_SORT -> onSortChanged() SortFilterBottomSheet.ACTION_SORT -> onSortChanged()
FilterBottomSheet.ACTION_DISPLAY -> reattachAdapter() SortFilterBottomSheet.ACTION_DISPLAY -> reattachAdapter()
FilterBottomSheet.ACTION_DOWNLOAD_BADGE -> SortFilterBottomSheet.ACTION_DOWNLOAD_BADGE ->
presenter.requestDownloadBadgesUpdate() presenter.requestDownloadBadgesUpdate()
FilterBottomSheet.ACTION_UNREAD_BADGE -> presenter.requestUnreadBadgesUpdate() SortFilterBottomSheet.ACTION_UNREAD_BADGE -> presenter.requestUnreadBadgesUpdate()
FilterBottomSheet.ACTION_CAT_SORT -> onCatSortChanged() SortFilterBottomSheet.ACTION_CAT_SORT -> onCatSortChanged()
} }
} }
@ -528,15 +525,19 @@ class LibraryController(
// Mutate the filter icon because it needs to be tinted and the resource is shared. // Mutate the filter icon because it needs to be tinted and the resource is shared.
menu.findItem(R.id.action_library_filter).icon.mutate() menu.findItem(R.id.action_library_filter).icon.mutate()
searchViewSubscription?.unsubscribe() searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
searchViewSubscription = searchView.queryTextChanges() override fun onQueryTextChange(newText: String?): Boolean {
// Ignore events if this controller isn't at the top if (router.backstack.lastOrNull()?.controller() == this@LibraryController) {
.filter { router.backstack.lastOrNull()?.controller() == this } query = newText ?: ""
.subscribeUntilDestroy {
query = it.toString()
searchRelay.call(query) searchRelay.call(query)
} }
return true
}
override fun onQueryTextSubmit(query: String?): Boolean {
return true
}
})
searchItem.fixExpand(onExpand = { invalidateMenuOnExpand() }) searchItem.fixExpand(onExpand = { invalidateMenuOnExpand() })
} }
@ -712,9 +713,6 @@ class LibraryController(
} }
fun openManga(manga: Manga, startY: Float?) { fun openManga(manga: Manga, startY: Float?) {
// Notify the presenter a manga is being opened.
presenter.onOpenManga()
router.pushController(MangaController(manga, startY).withFadeTransaction()) router.pushController(MangaController(manga, startY).withFadeTransaction())
} }

View File

@ -55,12 +55,13 @@ private typealias LibraryMap = Map<Int, List<LibraryItem>>
* Presenter of [LibraryController]. * Presenter of [LibraryController].
*/ */
class LibraryPresenter( class LibraryPresenter(
private val view: LibraryController,
private val db: DatabaseHelper = Injekt.get(), private val db: DatabaseHelper = Injekt.get(),
private val preferences: PreferencesHelper = Injekt.get(), private val preferences: PreferencesHelper = Injekt.get(),
private val coverCache: CoverCache = Injekt.get(), private val coverCache: CoverCache = Injekt.get(),
private val sourceManager: SourceManager = Injekt.get(), private val sourceManager: SourceManager = Injekt.get(),
private val downloadManager: DownloadManager = Injekt.get() private val downloadManager: DownloadManager = Injekt.get()
) : BasePresenter<LibraryController>() { ) {
private val context = preferences.context private val context = preferences.context
@ -80,33 +81,6 @@ class LibraryPresenter(
private var currentMangaMap:LibraryMap? = null private var currentMangaMap:LibraryMap? = null
override fun onCreate(savedState: Bundle?) {
super.onCreate(savedState)
getLibrary()
}
/**
* Subscribes to library if needed.
*/
/* fun subscribeLibrary() {
if (librarySubscription.isNullOrUnsubscribed()) {
librarySubscription = getLibraryObservable()
.combineLatest(downloadTriggerRelay.observeOn(Schedulers.io())) {
lib, _ -> lib.apply { setDownloadCount(mangaMap) }
}
.combineLatest(filterTriggerRelay.observeOn(Schedulers.io())) {
lib, _ -> lib.copy(mangaMap = applyFilters(lib.mangaMap))
}
.combineLatest(sortTriggerRelay.observeOn(Schedulers.io())) {
lib, _ -> lib.copy(mangaMap = applySort(lib.mangaMap))
}
.observeOn(AndroidSchedulers.mainThread())
.subscribeLatestCache({ view, (categories, mangaMap) ->
view.onNextLibraryUpdate(categories, mangaMap)
})
}
}*/
fun getLibrary() { fun getLibrary() {
launchUI { launchUI {
val mangaMap = withContext(Dispatchers.IO) { val mangaMap = withContext(Dispatchers.IO) {
@ -119,7 +93,7 @@ class LibraryPresenter(
mangaMap mangaMap
} }
currentMangaMap = mangaMap currentMangaMap = mangaMap
view?.onNextLibraryUpdate(categories, mangaMap) view.onNextLibraryUpdate(categories, mangaMap)
} }
} }
@ -428,25 +402,6 @@ class LibraryPresenter(
return Library(this.categories, libraryMap) return Library(this.categories, libraryMap)
} }
/**
* Get the categories and all its manga from the database.
*
* @return an observable of the categories and its manga.
*/
/*private fun getLibraryObservable(): Observable<Library> {
return Observable.combineLatest(getCategoriesObservable(), getLibraryMangasObservable()) { dbCategories, libraryManga ->
val categories = if (libraryManga.containsKey(0))
arrayListOf(createDefaultCategory()) + dbCategories
else dbCategories
this.allCategories = categories
this.categories = if (preferences.hideCategories().getOrDefault())
arrayListOf(createDefaultCategory())
else categories
Library(this.categories, libraryManga)
}
}*/
private fun createDefaultCategory(): Category { private fun createDefaultCategory(): Category {
val default = Category.createDefault(context) val default = Category.createDefault(context)
val defOrder = preferences.defaultMangaOrder().getOrDefault() val defOrder = preferences.defaultMangaOrder().getOrDefault()
@ -454,36 +409,7 @@ class LibraryPresenter(
else default.mangaOrder = defOrder.split("/").mapNotNull { it.toLongOrNull() } else default.mangaOrder = defOrder.split("/").mapNotNull { it.toLongOrNull() }
return default return default
} }
/*
/**
* Get the categories from the database.
*
* @return an observable of the categories.
*/
private fun getCategoriesObservable(): Observable<List<Category>> {
return db.getCategories().asRxObservable()
}
/**
* Get the manga grouped by categories.
*
* @return an observable containing a map with the category id as key and a list of manga as the
* value.
*/
private fun getLibraryMangasObservable(): Observable<LibraryMap> {
val libraryAsList = preferences.libraryAsList()
return db.getLibraryMangas().asRxObservable()
.map { list ->
if (!preferences.hideCategories().getOrDefault()) {
list.map { LibraryItem(it, libraryAsList) }.groupBy { it.manga.category }
}
else {
list.distinctBy { it.id }.map { LibraryItem(it, libraryAsList)}.groupBy {
0 }
}
}
}
*/
/** /**
* Requests the library to be filtered. * Requests the library to be filtered.
*/ */
@ -493,7 +419,7 @@ class LibraryPresenter(
mangaMap = withContext(Dispatchers.IO) { applyFilters(mangaMap) } mangaMap = withContext(Dispatchers.IO) { applyFilters(mangaMap) }
mangaMap = withContext(Dispatchers.IO) { applySort(mangaMap) } mangaMap = withContext(Dispatchers.IO) { applySort(mangaMap) }
currentMangaMap = mangaMap currentMangaMap = mangaMap
view?.onNextLibraryUpdate(categories, mangaMap) view.onNextLibraryUpdate(categories, mangaMap)
} }
} }
@ -501,7 +427,6 @@ class LibraryPresenter(
* Requests the library to have download badges added/removed. * Requests the library to have download badges added/removed.
*/ */
fun requestDownloadBadgesUpdate() { fun requestDownloadBadgesUpdate() {
//getLibrary()
launchUI { launchUI {
val mangaMap = rawMangaMap ?: return@launchUI val mangaMap = rawMangaMap ?: return@launchUI
withContext(Dispatchers.IO) { setDownloadCount(mangaMap) } withContext(Dispatchers.IO) { setDownloadCount(mangaMap) }
@ -509,7 +434,7 @@ class LibraryPresenter(
val current = currentMangaMap ?: return@launchUI val current = currentMangaMap ?: return@launchUI
withContext(Dispatchers.IO) { setDownloadCount(current) } withContext(Dispatchers.IO) { setDownloadCount(current) }
currentMangaMap = current currentMangaMap = current
view?.onNextLibraryUpdate(categories, current) view.onNextLibraryUpdate(categories, current)
} }
} }
@ -525,7 +450,7 @@ class LibraryPresenter(
val current = currentMangaMap ?: return@launchUI val current = currentMangaMap ?: return@launchUI
withContext(Dispatchers.IO) { setUnreadBadge(current) } withContext(Dispatchers.IO) { setUnreadBadge(current) }
currentMangaMap = current currentMangaMap = current
view?.onNextLibraryUpdate(categories, current) view.onNextLibraryUpdate(categories, current)
} }
} }
@ -537,7 +462,7 @@ class LibraryPresenter(
var mangaMap = currentMangaMap ?: return@launchUI var mangaMap = currentMangaMap ?: return@launchUI
mangaMap = withContext(Dispatchers.IO) { applySort(mangaMap) } mangaMap = withContext(Dispatchers.IO) { applySort(mangaMap) }
currentMangaMap = mangaMap currentMangaMap = mangaMap
view?.onNextLibraryUpdate(categories, mangaMap) view.onNextLibraryUpdate(categories, mangaMap)
} }
} }
@ -546,23 +471,14 @@ class LibraryPresenter(
var mangaMap = currentMangaMap ?: return@launchUI var mangaMap = currentMangaMap ?: return@launchUI
mangaMap = withContext(Dispatchers.IO) { applyCatSort(mangaMap, catId) } mangaMap = withContext(Dispatchers.IO) { applyCatSort(mangaMap, catId) }
currentMangaMap = mangaMap currentMangaMap = mangaMap
view?.onNextLibraryUpdate(categories, mangaMap) view.onNextLibraryUpdate(categories, mangaMap)
} }
} }
fun requestFullUpdate() { fun requestFullUpdate() {
//librarySubscription?.unsubscribe()
getLibrary() getLibrary()
} }
/**
* Called when a manga is opened.
*/
fun onOpenManga() {
// Avoid further db updates for the library when it's not needed
//librarySubscription?.let { remove(it) }
}
/** /**
* Returns the common categories for the given list of manga. * Returns the common categories for the given list of manga.
* *

View File

@ -1,168 +0,0 @@
package eu.kanade.tachiyomi.ui.library.filter
import android.app.Activity
import android.content.res.Configuration
import android.graphics.Color
import android.graphics.drawable.GradientDrawable
import android.os.Build
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import android.widget.CompoundButton
import android.widget.LinearLayout
import android.widget.RadioButton
import android.widget.RadioGroup
import android.widget.Toast
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.graphics.ColorUtils
import com.bluelinelabs.conductor.Controller
import com.f2prateek.rx.preferences.Preference
import com.google.android.material.bottomsheet.BottomSheetDialog
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.ui.migration.MigrationFlags
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.system.toast
import eu.kanade.tachiyomi.util.view.marginBottom
import eu.kanade.tachiyomi.util.view.updateLayoutParams
import eu.kanade.tachiyomi.util.view.visible
import kotlinx.android.synthetic.main.migration_bottom_sheet.*
import kotlinx.android.synthetic.main.migration_bottom_sheet.extra_search_param
import kotlinx.android.synthetic.main.migration_bottom_sheet.extra_search_param_text
import kotlinx.android.synthetic.main.migration_bottom_sheet.mig_categories
import kotlinx.android.synthetic.main.migration_bottom_sheet.mig_chapters
import kotlinx.android.synthetic.main.migration_bottom_sheet.mig_tracking
import uy.kohesive.injekt.injectLazy
class SortBottomSheet(private val activity: Activity, theme: Int, private val listener:
SortBottomSheetListener) :
BottomSheetDialog(activity,
theme) {
/**
* Preferences helper.
*/
private val preferences by injectLazy<PreferencesHelper>()
init {
// Use activity theme for this layout
val view = activity.layoutInflater.inflate(R.layout.migration_bottom_sheet, null)
//val scroll = NestedScrollView(context)
// scroll.addView(view)
setContentView(view)
if (activity.resources.configuration?.orientation == Configuration.ORIENTATION_LANDSCAPE)
sourceGroup.orientation = LinearLayout.HORIZONTAL
window?.setBackgroundDrawable(null)
val currentNightMode = activity.resources.configuration.uiMode and Configuration
.UI_MODE_NIGHT_MASK
if (currentNightMode == Configuration.UI_MODE_NIGHT_NO)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
window?.decorView?.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
val nView = View(context)
val height = activity.window.decorView.rootWindowInsets.systemWindowInsetBottom
val params = ConstraintLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, height
)
params.bottomToBottom = constraintLayout.id
params.startToStart = constraintLayout.id
params.endToEnd = constraintLayout.id
nView.layoutParams = params
nView.background = GradientDrawable(
GradientDrawable.Orientation.BOTTOM_TOP, intArrayOf(
ColorUtils.setAlphaComponent(Color.BLACK, 179), Color.TRANSPARENT
)
)
constraintLayout.addView(nView)
}
}
/**
* Called when the sheet is created. It initializes the listeners and values of the preferences.
*/
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
initPreferences()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
window?.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS)
val marginB = skip_step.marginBottom
skip_step.updateLayoutParams<ViewGroup.MarginLayoutParams> {
bottomMargin = marginB +
activity.window.decorView.rootWindowInsets.systemWindowInsetBottom
}
}
}
/**
* Init general reader preferences.
*/
private fun initPreferences() {
val flags = preferences.migrateFlags().getOrDefault()
mig_chapters.isChecked = MigrationFlags.hasChapters(flags)
mig_categories.isChecked = MigrationFlags.hasCategories(flags)
mig_tracking.isChecked = MigrationFlags.hasTracks(flags)
mig_chapters.setOnCheckedChangeListener { _, _ -> setFlags() }
mig_categories.setOnCheckedChangeListener { _, _ -> setFlags() }
mig_tracking.setOnCheckedChangeListener { _, _ -> setFlags() }
extra_search_param_text.gone()
extra_search_param.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
extra_search_param_text.visible()
} else {
extra_search_param_text.gone()
}
}
sourceGroup.bindToPreference(preferences.useSourceWithMost())
skip_step.isChecked = preferences.skipPreMigration().getOrDefault()
skip_step.setOnCheckedChangeListener { _, isChecked ->
if (isChecked)
(listener as? Controller)?.activity?.toast(R.string.pre_migration_skip_toast,
Toast.LENGTH_LONG)
}
}
private fun setFlags() {
var flags = 0
if(mig_chapters.isChecked) flags = flags or MigrationFlags.CHAPTERS
if(mig_categories.isChecked) flags = flags or MigrationFlags.CATEGORIES
if(mig_tracking.isChecked) flags = flags or MigrationFlags.TRACK
preferences.migrateFlags().set(flags)
}
/**
* Binds a checkbox or switch view with a boolean preference.
*/
private fun CompoundButton.bindToPreference(pref: Preference<Boolean>) {
isChecked = pref.getOrDefault()
setOnCheckedChangeListener { _, isChecked -> pref.set(isChecked) }
}
/**
* Binds a radio group with a boolean preference.
*/
private fun RadioGroup.bindToPreference(pref: Preference<Boolean>) {
(getChildAt(pref.getOrDefault().toInt()) as RadioButton).isChecked = true
setOnCheckedChangeListener { _, value ->
val index = indexOfChild(findViewById(value))
pref.set(index == 1)
}
}
private fun Boolean.toInt() = if (this) 1 else 0
}
interface SortBottomSheetListener {
fun onApplySort()
}

View File

@ -44,7 +44,7 @@ import uy.kohesive.injekt.injectLazy
import kotlin.math.min import kotlin.math.min
import kotlin.math.roundToInt import kotlin.math.roundToInt
class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null)
: LinearLayout(context, attrs), : LinearLayout(context, attrs),
FilterTagGroupListener { FilterTagGroupListener {
@ -88,8 +88,8 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
fun onCreate(pagerView:View) { fun onCreate(pagerView:View) {
if (isLandscape() || isTablet()) { if (isLandscape() || isTablet()) {
sideLayout.orientation = HORIZONTAL side_layout.orientation = HORIZONTAL
sortingLayout.updateLayoutParams<MarginLayoutParams> { sorting_layout.updateLayoutParams<MarginLayoutParams> {
bottomMargin = 0 bottomMargin = 0
topMargin = 0 topMargin = 0
} }
@ -98,10 +98,10 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
top = 0 top = 0
) )
} }
clearButton = pendingClearButton clearButton = clear_button
filterLayout.removeView(clearButton) filter_layout.removeView(clearButton)
sheetBehavior = BottomSheetBehavior.from(this) sheetBehavior = BottomSheetBehavior.from(this)
topbar.setOnClickListener { top_bar.setOnClickListener {
if (sheetBehavior?.state != BottomSheetBehavior.STATE_EXPANDED) { if (sheetBehavior?.state != BottomSheetBehavior.STATE_EXPANDED) {
sheetBehavior?.state = BottomSheetBehavior.STATE_EXPANDED sheetBehavior?.state = BottomSheetBehavior.STATE_EXPANDED
//topbar.animate().alpha(0f).setDuration(100).start() //topbar.animate().alpha(0f).setDuration(100).start()
@ -117,7 +117,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
val coordLayout:View = (pagerView.parent as ViewGroup).findViewById(R.id.snackbar_layout) val coordLayout:View = (pagerView.parent as ViewGroup).findViewById(R.id.snackbar_layout)
sheetBehavior?.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() { sheetBehavior?.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() {
override fun onSlide(bottomSheet: View, progress: Float) { override fun onSlide(bottomSheet: View, progress: Float) {
topbar.alpha = 1 - progress top_bar.alpha = 1 - progress
shadow2.alpha = (1 - progress) * 0.25f shadow2.alpha = (1 - progress) * 0.25f
updateRootPadding(progress) updateRootPadding(progress)
} }
@ -126,12 +126,12 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
if (state == BottomSheetBehavior.STATE_COLLAPSED) reSortViews() if (state == BottomSheetBehavior.STATE_COLLAPSED) reSortViews()
else setMainSortText() else setMainSortText()
if (state == BottomSheetBehavior.STATE_EXPANDED) if (state == BottomSheetBehavior.STATE_EXPANDED)
topbar.alpha = 0f top_bar.alpha = 0f
topbar.isClickable = state == BottomSheetBehavior.STATE_COLLAPSED top_bar.isClickable = state == BottomSheetBehavior.STATE_COLLAPSED
topbar.isFocusable = state == BottomSheetBehavior.STATE_COLLAPSED top_bar.isFocusable = state == BottomSheetBehavior.STATE_COLLAPSED
} }
}) })
topbar.viewTreeObserver.addOnGlobalLayoutListener { top_bar.viewTreeObserver.addOnGlobalLayoutListener {
val phoneLandscape = (isLandscape() && !isTablet()) val phoneLandscape = (isLandscape() && !isTablet())
sheetBehavior?.peekHeight = if (phoneLandscape) { sheetBehavior?.peekHeight = if (phoneLandscape) {
if (shadow2.visibility != View.GONE) { if (shadow2.visibility != View.GONE) {
@ -140,15 +140,15 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
} }
0 0
} }
else if (!sortText.text.isNullOrBlank()) { else if (!title.text.isNullOrBlank()) {
topbar.height top_bar.height
} }
else 0 else 0
if (sheetBehavior?.state == BottomSheetBehavior.STATE_COLLAPSED) { if (sheetBehavior?.state == BottomSheetBehavior.STATE_COLLAPSED) {
val height = context.resources.getDimensionPixelSize(R.dimen.rounder_radius) val height = context.resources.getDimensionPixelSize(R.dimen.rounder_radius)
pager?.setPadding(0, 0, 0, if (phoneLandscape) 0 else pager?.setPadding(0, 0, 0, if (phoneLandscape) 0 else
(topbar.height - height)) (top_bar.height - height))
coordLayout.setPadding(0, 0, 0, topbar.height) coordLayout.setPadding(0, 0, 0, top_bar.height)
} }
else { else {
updateRootPadding() updateRootPadding()
@ -156,11 +156,11 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
} }
createTags() createTags()
mainSortTextView.setOnClickListener { showMainSortOptions() } library_sort_text.setOnClickListener { showMainSortOptions() }
catSortTextView.setOnClickListener { showCatSortOptions() } category_sort_text.setOnClickListener { showCatSortOptions() }
clearButton.setOnClickListener { clearFilters() } clearButton.setOnClickListener { clearFilters() }
downloadCheckbox.isChecked = preferences.downloadBadge().getOrDefault() download_checkbox.isChecked = preferences.downloadBadge().getOrDefault()
downloadCheckbox.setOnCheckedChangeListener { _, isChecked -> download_checkbox.setOnCheckedChangeListener { _, isChecked ->
preferences.downloadBadge().set(isChecked) preferences.downloadBadge().set(isChecked)
onGroupClicked(ACTION_DOWNLOAD_BADGE) onGroupClicked(ACTION_DOWNLOAD_BADGE)
} }
@ -169,7 +169,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
showUnreadMenu() showUnreadMenu()
} }
displayGroup.bindToPreference(preferences.libraryAsList()) display_group.bindToPreference(preferences.libraryAsList())
} }
private fun isLandscape(): Boolean { private fun isLandscape(): Boolean {
@ -212,17 +212,17 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
filters.joinToString(", ") { context.getString(it) } filters.joinToString(", ") { context.getString(it) }
} }
} }
sortText.text = text title.text = text
setMainSortText() setMainSortText()
} }
} }
fun adjustTitleMargin(downloading: Boolean) { fun adjustTitleMargin(downloading: Boolean) {
val params = sortText.layoutParams as? MarginLayoutParams ?: return val params = title.layoutParams as? MarginLayoutParams ?: return
params.rightMargin = (if (downloading) 80 else 8).dpToPx params.rightMargin = (if (downloading) 80 else 8).dpToPx
sortText.layoutParams = params title.layoutParams = params
filterScrollView.updatePaddingRelative(end = (if (downloading) 80 else 20).dpToPx) filter_scroll.updatePaddingRelative(end = (if (downloading) 80 else 20).dpToPx)
} }
fun updateRootPadding(progress: Float? = null) { fun updateRootPadding(progress: Float? = null) {
@ -309,7 +309,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
tracked.setup(this, R.string.action_filter_tracked, R.string.action_filter_not_tracked) tracked.setup(this, R.string.action_filter_tracked, R.string.action_filter_not_tracked)
filterItems.forEach { filterItems.forEach {
filterLayout.addView(it) filter_layout.addView(it)
} }
checkForManwha() checkForManwha()
@ -323,12 +323,12 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
launchUI { launchUI {
val mangaType = inflate(R.layout.filter_buttons) as FilterTagGroup val mangaType = inflate(R.layout.filter_buttons) as FilterTagGroup
mangaType.setup( mangaType.setup(
this@FilterBottomSheet, this@SortFilterBottomSheet,
R.string.manga, R.string.manga,
R.string.manwha R.string.manwha
) )
this@FilterBottomSheet.mangaType = mangaType this@SortFilterBottomSheet.mangaType = mangaType
filterLayout.addView(mangaType) filter_layout.addView(mangaType)
filterItems.add(mangaType) filterItems.add(mangaType)
} }
} }
@ -347,7 +347,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
private fun showMainSortOptions() { private fun showMainSortOptions() {
// Create a PopupMenu, giving it the clicked view for an anchor // Create a PopupMenu, giving it the clicked view for an anchor
val popup = PopupMenu(context, mainSortTextView) val popup = PopupMenu(context, library_sort_text)
// Inflate our menu resource into the PopupMenu's Menu // Inflate our menu resource into the PopupMenu's Menu
popup.menuInflater.inflate(R.menu.main_sort, popup.menu) popup.menuInflater.inflate(R.menu.main_sort, popup.menu)
@ -390,7 +390,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
private fun showCatSortOptions() { private fun showCatSortOptions() {
val category = lastCategory ?: return val category = lastCategory ?: return
// Create a PopupMenu, giving it the clicked view for an anchor // Create a PopupMenu, giving it the clicked view for an anchor
val popup = PopupMenu(context, catSortTextView) val popup = PopupMenu(context, category_sort_text)
// Inflate our menu resource into the PopupMenu's Menu // Inflate our menu resource into the PopupMenu's Menu
popup.menuInflater.inflate(R.menu.cat_sort, popup.menu) popup.menuInflater.inflate(R.menu.cat_sort, popup.menu)
@ -504,7 +504,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
} }
) )
} }
mainSortTextView.text = withContext(Dispatchers.IO) { library_sort_text.text = withContext(Dispatchers.IO) {
context.getString( context.getString(
if (sortId == LibrarySort.DRAG_AND_DROP) R.string.sort_library_by_ if (sortId == LibrarySort.DRAG_AND_DROP) R.string.sort_library_by_
else R.string.sort_by_, context.getString( else R.string.sort_by_, context.getString(
@ -519,7 +519,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
) )
) )
} }
mainSortTextView.setCompoundDrawablesRelativeWithIntrinsicBounds( library_sort_text.setCompoundDrawablesRelativeWithIntrinsicBounds(
drawableL, null, null, null drawableL, null, null, null
) )
setCatSortText() setCatSortText()
@ -540,7 +540,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
} }
) )
} }
catSortTextView.text = withContext(Dispatchers.IO) { category_sort_text.text = withContext(Dispatchers.IO) {
context.getString( context.getString(
R.string.sort_category_by_, context.getString( R.string.sort_category_by_, context.getString(
when (sortId) { when (sortId) {
@ -554,11 +554,11 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
) )
) )
} }
catSortTextView.setCompoundDrawablesRelativeWithIntrinsicBounds( category_sort_text.setCompoundDrawablesRelativeWithIntrinsicBounds(
drawableL, null, null, null drawableL, null, null, null
) )
if (catSortTextView.visibility != View.VISIBLE) catSortTextView.visible() if (category_sort_text.visibility != View.VISIBLE) category_sort_text.visible()
} else if (catSortTextView.visibility == View.VISIBLE) catSortTextView.gone() } else if (category_sort_text.visibility == View.VISIBLE) category_sort_text.gone()
} }
} }
@ -603,9 +603,9 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
} }
val filters = getFilters().size val filters = getFilters().size
if (filters > 0 && clearButton.parent == null) if (filters > 0 && clearButton.parent == null)
filterLayout.addView(clearButton, 0) filter_layout.addView(clearButton, 0)
else if (filters == 0 && clearButton.parent != null) else if (filters == 0 && clearButton.parent != null)
filterLayout.removeView(clearButton) filter_layout.removeView(clearButton)
} }
private fun clearFilters() { private fun clearFilters() {
@ -621,7 +621,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
val transition = androidx.transition.AutoTransition() val transition = androidx.transition.AutoTransition()
transition.duration = 150 transition.duration = 150
androidx.transition.TransitionManager.beginDelayedTransition(filterLayout, transition) androidx.transition.TransitionManager.beginDelayedTransition(filter_layout, transition)
filterItems.forEach { filterItems.forEach {
it.reset() it.reset()
} }
@ -630,16 +630,16 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
} }
fun reSortViews() { fun reSortViews() {
filterLayout.removeAllViews() filter_layout.removeAllViews()
if (filterItems.any { it.isActivated }) if (filterItems.any { it.isActivated })
filterLayout.addView(clearButton) filter_layout.addView(clearButton)
filterItems.filter { it.isActivated }.forEach { filterItems.filter { it.isActivated }.forEach {
filterLayout.addView(it) filter_layout.addView(it)
} }
filterItems.filterNot { it.isActivated }.forEach { filterItems.filterNot { it.isActivated }.forEach {
filterLayout.addView(it) filter_layout.addView(it)
} }
filterScrollView.scrollTo(0, 0) filter_scroll.scrollTo(0, 0)
} }
private fun showUnreadMenu() { private fun showUnreadMenu() {

View File

@ -111,13 +111,15 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
lateinit var tabAnimator: TabsAnimator lateinit var tabAnimator: TabsAnimator
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) // Create a webview before extensions do or else they will break night mode theme
// https://stackoverflow.com/questions/54191883
Timber.d("Manually instantiating WebView to avoid night mode issue.") Timber.d("Manually instantiating WebView to avoid night mode issue.")
try { try {
WebView(applicationContext) WebView(applicationContext)
} catch (e: Exception) { } catch (e: Exception) {
Timber.e(e, "Exception when creating webview at start") Timber.e(e, "Exception when creating webview at start")
} }
super.onCreate(savedInstanceState)
if (trulyGoBack) return if (trulyGoBack) return
// Do not let the launcher create a new activity http://stackoverflow.com/questions/16283079 // Do not let the launcher create a new activity http://stackoverflow.com/questions/16283079
@ -488,7 +490,10 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
private fun setSelectedDrawerItem(itemId: Int) { private fun setSelectedDrawerItem(itemId: Int) {
if (!isFinishing) { if (!isFinishing) {
if (bottomNav) navigationView.selectedItemId = itemId if (bottomNav) {
if (itemId == R.id.nav_drawer_library || itemId == R.id.nav_drawer_settings)
navigationView.selectedItemId = itemId
}
else nav_view.setCheckedItem(itemId) else nav_view.setCheckedItem(itemId)
jumpToController(itemId) jumpToController(itemId)
} }
@ -499,21 +504,17 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
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 -> setRoot(LibraryController(), id) R.id.nav_drawer_library -> if (!bottomNav) setRoot(LibraryController(), id)
R.id.nav_drawer_recent_updates -> { R.id.nav_drawer_recent_updates -> {
if (bottomNav)
navigationView.selectedItemId = R.id.nav_drawer_recents
setRoot(RecentChaptersController(), if (bottomNav) R.id.nav_drawer_recents
else id)
preferences.showRecentUpdates().set(true) preferences.showRecentUpdates().set(true)
if (bottomNav) navigationView.selectedItemId = R.id.nav_drawer_recents
else setRoot(RecentChaptersController(), id)
updateRecentsIcon() updateRecentsIcon()
} }
R.id.nav_drawer_recently_read -> { R.id.nav_drawer_recently_read -> {
if (bottomNav)
navigationView.selectedItemId = R.id.nav_drawer_recents
setRoot(RecentlyReadController(), if (bottomNav) R.id.nav_drawer_recents
else id)
preferences.showRecentUpdates().set(false) preferences.showRecentUpdates().set(false)
if (bottomNav) navigationView.selectedItemId = R.id.nav_drawer_recents
else setRoot(RecentlyReadController(), id)
updateRecentsIcon() updateRecentsIcon()
} }
R.id.nav_drawer_catalogues -> setRoot(CatalogueController(), id) R.id.nav_drawer_catalogues -> setRoot(CatalogueController(), id)
@ -549,6 +550,7 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
} }
R.id.nav_drawer_settings -> { R.id.nav_drawer_settings -> {
if (!bottomNav)
setRoot(SettingsMainController(), id) setRoot(SettingsMainController(), id)
} }
} }

View File

@ -131,7 +131,7 @@ class RecentlyReadController(bundle: Bundle? = null) : BaseController(bundle),
if (size > 0) { if (size > 0) {
empty_view?.hide() empty_view?.hide()
} else { } else {
empty_view.show(R.drawable.ic_glasses_black_128dp, R.string.information_no_recent_manga) empty_view.show(R.drawable.ic_history_white_128dp, R.string.information_no_recent_manga)
} }
} }

View File

@ -1,5 +1,6 @@
package eu.kanade.tachiyomi.ui.setting package eu.kanade.tachiyomi.ui.setting
import androidx.appcompat.app.AppCompatDelegate
import androidx.biometric.BiometricManager import androidx.biometric.BiometricManager
import androidx.preference.PreferenceScreen import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.BuildConfig import eu.kanade.tachiyomi.BuildConfig

View File

@ -0,0 +1,6 @@
<vector android:height="128dp"
android:tint="?attr/actionBarTintColor"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="128dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z"/>
</vector>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<eu.kanade.tachiyomi.ui.library.filter.FilterBottomSheet xmlns:android="http://schemas.android.com/apk/res/android" <eu.kanade.tachiyomi.ui.library.filter.SortFilterBottomSheet xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/bottom_sheet" android:id="@+id/bottom_sheet"
style="@style/BottomSheetDialogTheme" style="@style/BottomSheetDialogTheme"
@ -24,7 +24,7 @@
android:orientation="vertical"> android:orientation="vertical">
<HorizontalScrollView <HorizontalScrollView
android:id="@+id/filterScrollView" android:id="@+id/filter_scroll"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="6dp" android:layout_marginTop="6dp"
@ -35,14 +35,14 @@
android:scrollbars="none"> android:scrollbars="none">
<LinearLayout <LinearLayout
android:id="@+id/filterLayout" android:id="@+id/filter_layout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
android:id="@+id/pendingClearButton" android:id="@+id/clear_button"
android:layout_width="32dp" android:layout_width="32dp"
android:layout_height="32dp" android:layout_height="32dp"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
@ -69,7 +69,7 @@
android:scrollbars="none"> android:scrollbars="none">
<LinearLayout <LinearLayout
android:id="@+id/sideLayout" android:id="@+id/side_layout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:baselineAligned="true" android:baselineAligned="true"
@ -77,7 +77,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<LinearLayout <LinearLayout
android:id="@+id/sortingLayout" android:id="@+id/sorting_layout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
@ -87,7 +87,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/mainSortTextView" android:id="@+id/library_sort_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="20dp" android:layout_marginEnd="20dp"
@ -104,7 +104,7 @@
android:textStyle="normal" /> android:textStyle="normal" />
<TextView <TextView
android:id="@+id/catSortTextView" android:id="@+id/category_sort_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/square_ripple" android:background="@drawable/square_ripple"
@ -123,7 +123,7 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/displayLayout" android:id="@+id/display_layout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="7dp" android:layout_marginStart="7dp"
@ -146,7 +146,7 @@
<RadioGroup <RadioGroup
android:id="@+id/displayGroup" android:id="@+id/display_group"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal">
@ -175,7 +175,7 @@
> >
<CheckBox <CheckBox
android:id="@+id/downloadCheckbox" android:id="@+id/download_checkbox"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="20dp" android:layout_marginEnd="20dp"
@ -204,7 +204,7 @@
</LinearLayout> </LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/topbar" android:id="@+id/top_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/bg_bottom_sheet_primary" android:background="@drawable/bg_bottom_sheet_primary"
@ -214,17 +214,17 @@
<ImageView <ImageView
android:id="@+id/imageView2" android:id="@+id/title_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginStart="24dp" android:layout_marginStart="24dp"
android:src="@drawable/ic_sort_white_24dp" android:src="@drawable/ic_sort_white_24dp"
app:layout_constraintBottom_toBottomOf="@+id/sortText" app:layout_constraintBottom_toBottomOf="@+id/title"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/sortText" /> app:layout_constraintTop_toTopOf="@+id/title" />
<TextView <TextView
android:id="@+id/sortText" android:id="@+id/title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
@ -236,8 +236,8 @@
android:textColor="?attr/actionBarTintColor" android:textColor="?attr/actionBarTintColor"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView2" app:layout_constraintStart_toEndOf="@+id/title_icon"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</eu.kanade.tachiyomi.ui.library.filter.FilterBottomSheet> </eu.kanade.tachiyomi.ui.library.filter.SortFilterBottomSheet>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<eu.kanade.tachiyomi.ui.library.filter.FilterBottomSheet xmlns:android="http://schemas.android.com/apk/res/android" <eu.kanade.tachiyomi.ui.library.filter.SortFilterBottomSheet xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/bottom_sheet" android:id="@+id/bottom_sheet"
style="@style/BottomSheetDialogTheme" style="@style/BottomSheetDialogTheme"
@ -24,7 +24,7 @@
android:orientation="vertical"> android:orientation="vertical">
<HorizontalScrollView <HorizontalScrollView
android:id="@+id/filterScrollView" android:id="@+id/filter_scroll"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="6dp" android:layout_marginTop="6dp"
@ -35,14 +35,14 @@
android:scrollbars="none"> android:scrollbars="none">
<LinearLayout <LinearLayout
android:id="@+id/filterLayout" android:id="@+id/filter_layout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
android:id="@+id/pendingClearButton" android:id="@+id/clear_button"
android:layout_width="32dp" android:layout_width="32dp"
android:layout_height="32dp" android:layout_height="32dp"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
@ -69,7 +69,7 @@
android:scrollbars="none"> android:scrollbars="none">
<LinearLayout <LinearLayout
android:id="@+id/sideLayout" android:id="@+id/side_layout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:baselineAligned="true" android:baselineAligned="true"
@ -77,7 +77,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<LinearLayout <LinearLayout
android:id="@+id/sortingLayout" android:id="@+id/sorting_layout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
@ -87,7 +87,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/mainSortTextView" android:id="@+id/library_sort_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="20dp" android:layout_marginEnd="20dp"
@ -104,7 +104,7 @@
android:textStyle="normal" /> android:textStyle="normal" />
<TextView <TextView
android:id="@+id/catSortTextView" android:id="@+id/category_sort_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/square_ripple" android:background="@drawable/square_ripple"
@ -123,7 +123,7 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/displayLayout" android:id="@+id/display_layout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="7dp" android:layout_marginStart="7dp"
@ -146,7 +146,7 @@
<RadioGroup <RadioGroup
android:id="@+id/displayGroup" android:id="@+id/display_group"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal">
@ -175,7 +175,7 @@
> >
<CheckBox <CheckBox
android:id="@+id/downloadCheckbox" android:id="@+id/download_checkbox"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="20dp" android:layout_marginEnd="20dp"
@ -204,7 +204,7 @@
</LinearLayout> </LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/topbar" android:id="@+id/top_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/bg_bottom_sheet_primary" android:background="@drawable/bg_bottom_sheet_primary"
@ -214,17 +214,17 @@
<ImageView <ImageView
android:id="@+id/imageView2" android:id="@+id/title_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginStart="24dp" android:layout_marginStart="24dp"
android:src="@drawable/ic_sort_white_24dp" android:src="@drawable/ic_sort_white_24dp"
app:layout_constraintBottom_toBottomOf="@+id/sortText" app:layout_constraintBottom_toBottomOf="@+id/title"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/sortText" /> app:layout_constraintTop_toTopOf="@+id/title" />
<TextView <TextView
android:id="@+id/sortText" android:id="@+id/title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
@ -236,8 +236,8 @@
android:textColor="?attr/actionBarTintColor" android:textColor="?attr/actionBarTintColor"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView2" app:layout_constraintStart_toEndOf="@+id/title_icon"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</eu.kanade.tachiyomi.ui.library.filter.FilterBottomSheet> </eu.kanade.tachiyomi.ui.library.filter.SortFilterBottomSheet>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<eu.kanade.tachiyomi.ui.library.filter.FilterBottomSheet xmlns:android="http://schemas.android.com/apk/res/android" <eu.kanade.tachiyomi.ui.library.filter.SortFilterBottomSheet xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/bottom_sheet" android:id="@+id/bottom_sheet"
style="@style/BottomSheetDialogTheme" style="@style/BottomSheetDialogTheme"
@ -24,7 +24,7 @@
android:orientation="vertical"> android:orientation="vertical">
<HorizontalScrollView <HorizontalScrollView
android:id="@+id/filterScrollView" android:id="@+id/filter_scroll"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="6dp" android:layout_marginTop="6dp"
@ -35,14 +35,14 @@
android:scrollbars="none"> android:scrollbars="none">
<LinearLayout <LinearLayout
android:id="@+id/filterLayout" android:id="@+id/filter_layout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
android:id="@+id/pendingClearButton" android:id="@+id/clear_button"
android:layout_width="32dp" android:layout_width="32dp"
android:layout_height="32dp" android:layout_height="32dp"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
@ -59,7 +59,7 @@
</HorizontalScrollView> </HorizontalScrollView>
<LinearLayout <LinearLayout
android:id="@+id/sideLayout" android:id="@+id/side_layout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="6dp" android:layout_marginTop="6dp"
@ -70,7 +70,7 @@
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:id="@+id/sortingLayout" android:id="@+id/sorting_layout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
@ -80,7 +80,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/mainSortTextView" android:id="@+id/library_sort_text"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
@ -98,7 +98,7 @@
android:textStyle="normal" /> android:textStyle="normal" />
<TextView <TextView
android:id="@+id/catSortTextView" android:id="@+id/category_sort_text"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/square_ripple" android:background="@drawable/square_ripple"
@ -119,7 +119,7 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/displayLayout" android:id="@+id/display_layout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="7dp" android:layout_marginStart="7dp"
@ -142,7 +142,7 @@
<RadioGroup <RadioGroup
android:id="@+id/displayGroup" android:id="@+id/display_group"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal">
@ -171,7 +171,7 @@
> >
<CheckBox <CheckBox
android:id="@+id/downloadCheckbox" android:id="@+id/download_checkbox"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="20dp" android:layout_marginEnd="20dp"
@ -199,7 +199,7 @@
</LinearLayout> </LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/topbar" android:id="@+id/top_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/bg_bottom_sheet_primary" android:background="@drawable/bg_bottom_sheet_primary"
@ -209,17 +209,17 @@
<ImageView <ImageView
android:id="@+id/imageView2" android:id="@+id/title_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginStart="24dp" android:layout_marginStart="24dp"
android:src="@drawable/ic_sort_white_24dp" android:src="@drawable/ic_sort_white_24dp"
app:layout_constraintBottom_toBottomOf="@+id/sortText" app:layout_constraintBottom_toBottomOf="@+id/title"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/sortText" /> app:layout_constraintTop_toTopOf="@+id/title" />
<TextView <TextView
android:id="@+id/sortText" android:id="@+id/title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
@ -231,8 +231,8 @@
android:textColor="?attr/actionBarTintColor" android:textColor="?attr/actionBarTintColor"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView2" app:layout_constraintStart_toEndOf="@+id/title_icon"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</eu.kanade.tachiyomi.ui.library.filter.FilterBottomSheet> </eu.kanade.tachiyomi.ui.library.filter.SortFilterBottomSheet>