From 5d31737c6803c971dff8157c323a5a7fac5deaf5 Mon Sep 17 00:00:00 2001 From: Jay Date: Sat, 8 Feb 2020 04:40:41 -0800 Subject: [PATCH] Library presenter no longer using oberserables This lagged sorting for D&D so time to get rid of it --- .../data/database/models/LibraryManga.kt | 5 +- .../data/library/LibraryUpdateService.kt | 21 +- .../tachiyomi/ui/extension/ExtensionHolder.kt | 2 +- .../ui/library/LibraryCategoryView.kt | 3 +- .../tachiyomi/ui/library/LibraryController.kt | 20 +- .../tachiyomi/ui/library/LibraryPresenter.kt | 184 +++++++++++++----- .../ui/library/filter/FilterBottomSheet.kt | 36 ++-- .../kanade/tachiyomi/ui/main/MainActivity.kt | 2 +- app/src/main/res/drawable/square_ripple.xml | 9 + .../main/res/layout/filter_bottom_sheet.xml | 17 +- .../main/res/layout/library_controller.xml | 5 + 11 files changed, 224 insertions(+), 80 deletions(-) create mode 100644 app/src/main/res/drawable/square_ripple.xml diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/LibraryManga.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/LibraryManga.kt index 66eddd2b75..0eb74c4a83 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/LibraryManga.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/LibraryManga.kt @@ -13,7 +13,10 @@ class LibraryManga : MangaImpl() { fun mangaType(): Int { val sourceManager:SourceManager by injectLazy() return if (currentGenres()?.split(",")?.any - { tag -> tag.trim().toLowerCase(Locale.getDefault()) == "long strip" } == true || + { tag -> + val trimmedTag = tag.trim().toLowerCase(Locale.getDefault()) + trimmedTag == "long strip" || trimmedTag == "manwha" + } == true || sourceManager.getOrStub(source).name.contains("webtoon", true)) MANWHA else MANGA diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt index 37adc99fa4..439c1ebebe 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt @@ -22,6 +22,7 @@ import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.MangaImpl import eu.kanade.tachiyomi.data.download.DownloadManager import eu.kanade.tachiyomi.data.download.DownloadService +import eu.kanade.tachiyomi.data.download.DownloadServiceListener import eu.kanade.tachiyomi.data.glide.GlideApp import eu.kanade.tachiyomi.data.library.LibraryUpdateRanker.rankingScheme import eu.kanade.tachiyomi.data.library.LibraryUpdateService.Companion.start @@ -52,6 +53,7 @@ import rx.schedulers.Schedulers import timber.log.Timber import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get +import uy.kohesive.injekt.injectLazy import java.util.ArrayList import java.util.Date import java.util.concurrent.TimeUnit @@ -233,6 +235,16 @@ class LibraryUpdateService( val categoryId = intent.getIntExtra(KEY_CATEGORY, -1) return getMangaToUpdate(categoryId, target) } + + private var listener:LibraryServiceListener? = null + + fun setListener(listener: LibraryServiceListener) { + this.listener = listener + } + + fun removeListener() { + listener = null + } } /** @@ -353,9 +365,11 @@ class LibraryUpdateService( val fetchedChapters = try { source.fetchChapterList(manga).toBlocking().single() } catch(e: java.lang.Exception) { failedUpdates.add(manga) - emptyList() } + emptyList() + } if (fetchedChapters.isNotEmpty()) { val newChapters = syncChaptersWithSource(db, fetchedChapters, manga, source).first + listener?.updatedManga(manga) if (newChapters.isNotEmpty()) { if (downloadNew && (categoriesToDownload.isEmpty() || manga.category in categoriesToDownload)) { downloadChapters(manga, newChapters.sortedBy { it.chapter_number }) @@ -592,5 +606,8 @@ class LibraryUpdateService( intent.action = MainActivity.SHORTCUT_RECENTLY_UPDATED return PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT) } - +} + +interface LibraryServiceListener { + fun updatedManga(manga: LibraryManga) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionHolder.kt index fb9766e258..99ad2f5794 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionHolder.kt @@ -63,7 +63,7 @@ class ExtensionHolder(view: View, override val adapter: ExtensionAdapter) : //background = VectorDrawableCompat.create(resources!!, R.drawable.button_bg_transparent, null) setTextColor(ContextCompat.getColorStateList(context, R.drawable.button_text_state)) - backgroundTintList = ContextCompat.getColorStateList(context, R.drawable.button_bg_transparent) + backgroundTintList = ContextCompat.getColorStateList(context, R.color.button_bg) val extension = item.extension diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryView.kt index 08f468485f..bc33696a6a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryView.kt @@ -28,6 +28,7 @@ import eu.kanade.tachiyomi.util.view.updateLayoutParams import eu.kanade.tachiyomi.util.view.updatePaddingRelative import eu.kanade.tachiyomi.widget.AutofitRecyclerView import kotlinx.android.synthetic.main.library_category.view.* +import kotlinx.android.synthetic.main.library_controller.* import kotlinx.coroutines.delay import rx.subscriptions.CompositeSubscription import uy.kohesive.injekt.injectLazy @@ -128,7 +129,7 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att swipe_refresh.setOnRefreshListener { val inQueue = LibraryUpdateService.categoryInQueue(category.id) controller.snack?.dismiss() - controller.snack = snack( + controller.snack = controller.snackbar_layout.snack( resources.getString( when { inQueue -> R.string.category_already_in_queue diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt index 667c1e25aa..b5c71b6083 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt @@ -37,6 +37,8 @@ import eu.kanade.tachiyomi.data.database.models.LibraryManga import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.download.DownloadService import eu.kanade.tachiyomi.data.download.DownloadServiceListener +import eu.kanade.tachiyomi.data.library.LibraryServiceListener +import eu.kanade.tachiyomi.data.library.LibraryUpdateService import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.ui.base.controller.NucleusController @@ -79,7 +81,8 @@ class LibraryController( ActionMode.Callback, ChangeMangaCategoriesDialog.Listener, MigrationInterface, - DownloadServiceListener { + DownloadServiceListener, + LibraryServiceListener { /** * Position of the active category. @@ -273,15 +276,17 @@ class LibraryController( super.onChangeStarted(handler, type) if (type.isEnter) { activity?.tabs?.setupWithViewPager(library_pager) - presenter.subscribeLibrary() + presenter.getLibrary() DownloadService.addListener(this) DownloadService.callListeners() + LibraryUpdateService.setListener(this) } } override fun onDestroyView(view: View) { adapter?.onDestroy() DownloadService.removeListener(this) + LibraryUpdateService.removeListener() adapter = null actionMode = null tabsVisibilitySubscription?.unsubscribe() @@ -298,6 +303,11 @@ class LibraryController( bottom_sheet.adjustTitleMargin(downloading) } } + + override fun updatedManga(manga: LibraryManga) { + presenter.updateManga(manga) + } + override fun onDetach(view: View) { destroyActionModeIfNeeded() snack?.dismiss() @@ -347,9 +357,9 @@ class LibraryController( tabsVisibilitySubscription?.unsubscribe() tabsVisibilitySubscription = tabsVisibilityRelay.subscribe { visible -> val tabAnimator = (activity as? MainActivity)?.tabAnimator ?: return@subscribe - if (visible && tabAnimator.getHeight() == 0) { + if (visible) { tabAnimator.expand() - } else if (!visible && tabAnimator.getHeight() != 0) { + } else if (!visible) { tabAnimator.collapse() } } @@ -746,7 +756,7 @@ class LibraryController( presenter.removeMangaFromLibrary(mangas) destroyActionModeIfNeeded() snack?.dismiss() - snack = pager_layout?.snack(activity?.getString(R.string.manga_removed_library) ?: "", Snackbar + snack = snackbar_layout?.snack(activity?.getString(R.string.manga_removed_library) ?: "", Snackbar .LENGTH_INDEFINITE) { var undoing = false setAction(R.string.action_undo) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt index 0bc3850277..8a096ff91a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt @@ -33,10 +33,16 @@ import eu.kanade.tachiyomi.util.chapter.syncChaptersWithSource import eu.kanade.tachiyomi.util.lang.combineLatest import eu.kanade.tachiyomi.util.lang.isNullOrUnsubscribed import eu.kanade.tachiyomi.util.lang.removeArticles +import eu.kanade.tachiyomi.util.system.launchUI import eu.kanade.tachiyomi.widget.ExtendedNavigationView.Item.TriStateGroup.Companion.STATE_EXCLUDE import eu.kanade.tachiyomi.widget.ExtendedNavigationView.Item.TriStateGroup.Companion.STATE_IGNORE import eu.kanade.tachiyomi.widget.ExtendedNavigationView.Item.TriStateGroup.Companion.STATE_INCLUDE import eu.kanade.tachiyomi.widget.ExtendedNavigationView.Item.TriStateGroup.Companion.STATE_REALLY_EXCLUDE +import kotlinx.coroutines.CoroutineStart +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.GlobalScope +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext import rx.Observable import rx.Subscription import rx.android.schedulers.AndroidSchedulers @@ -80,36 +86,21 @@ class LibraryPresenter( var allCategories: List = emptyList() private set /** - * Relay used to apply the UI filters to the last emission of the library. + * List of all manga to update the */ - private val filterTriggerRelay = BehaviorRelay.create(Unit) + private var rawMangaMap:LibraryMap? = null - /** - * Relay used to apply the UI update to the last emission of the library. - */ - private val downloadTriggerRelay = BehaviorRelay.create(Unit) - - /** - * Relay used to apply the selected sorting method to the last emission of the library. - */ - private val sortTriggerRelay = BehaviorRelay.create(Unit) - - /** - * Library subscription. - */ - private var librarySubscription: Subscription? = null - - private var lastCategoryId:Int? = null + private var currentMangaMap:LibraryMap? = null override fun onCreate(savedState: Bundle?) { super.onCreate(savedState) - subscribeLibrary() + getLibrary() } /** * Subscribes to library if needed. */ - fun subscribeLibrary() { + /* fun subscribeLibrary() { if (librarySubscription.isNullOrUnsubscribed()) { librarySubscription = getLibraryObservable() .combineLatest(downloadTriggerRelay.observeOn(Schedulers.io())) { @@ -126,6 +117,22 @@ class LibraryPresenter( view.onNextLibraryUpdate(categories, mangaMap) }) } + }*/ + + fun getLibrary() { + launchUI { + val mangaMap = withContext(Dispatchers.IO) { + val library = getLibraryFromDB() + library.apply { setDownloadCount(library.mangaMap) } + rawMangaMap = library.mangaMap + var mangaMap = library.mangaMap + mangaMap = applyFilters(mangaMap) + mangaMap = applySort(mangaMap) + mangaMap + } + currentMangaMap = mangaMap + view?.onNextLibraryUpdate(categories, mangaMap) + } } /** @@ -228,7 +235,6 @@ class LibraryPresenter( val catSorted = applySort(mapOf(catId to categoryManga), catId) val mutableMap = map.toMutableMap() mutableMap[catId] = catSorted.values.first() - lastCategoryId = null return mutableMap } @@ -289,8 +295,6 @@ class LibraryPresenter( * @param map the map to sort. */ private fun applySort(map: LibraryMap): LibraryMap { - if (lastCategoryId != null) return applyCatSort(map, lastCategoryId) - val sortingMode = preferences.librarySortingMode().getOrDefault() val lastReadManga by lazy { @@ -408,7 +412,34 @@ class LibraryPresenter( * * @return an observable of the categories and its manga. */ - private fun getLibraryObservable(): Observable { + private fun getLibraryFromDB(): Library { + val categories = db.getCategories().executeAsBlocking().toMutableList() + val libraryAsList = preferences.libraryAsList() + val showCategories = preferences.showCategories().getOrDefault() + var libraryManga = db.getLibraryMangas().executeAsBlocking() + if (!showCategories) + libraryManga = libraryManga.distinctBy { it.id } + val libraryMap = libraryManga.map { manga -> + LibraryItem(manga, libraryAsList) + }.groupBy { + if (showCategories) it.manga.category else 0 + } + if (libraryMap.containsKey(0)) + categories.add(0, createDefaultCategory()) + + this.allCategories = categories + this.categories = if (!preferences.showCategories().getOrDefault()) + arrayListOf(createDefaultCategory()) + else categories + 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 { return Observable.combineLatest(getCategoriesObservable(), getLibraryMangasObservable()) { dbCategories, libraryManga -> val categories = if (libraryManga.containsKey(0)) arrayListOf(createDefaultCategory()) + dbCategories @@ -420,7 +451,7 @@ class LibraryPresenter( else categories Library(this.categories, libraryManga) } - } + }*/ private fun createDefaultCategory(): Category { val default = Category.createDefault(context) @@ -429,7 +460,7 @@ class LibraryPresenter( else default.mangaOrder = defOrder.split("/").mapNotNull { it.toLongOrNull() } return default } - +/* /** * Get the categories from the database. * @@ -458,36 +489,60 @@ class LibraryPresenter( } } } - +*/ /** * Requests the library to be filtered. */ fun requestFilterUpdate() { - filterTriggerRelay.call(Unit) + launchUI { + var mangaMap = rawMangaMap ?: return@launchUI + mangaMap = withContext(Dispatchers.IO) { applyFilters(mangaMap) } + mangaMap = withContext(Dispatchers.IO) { applySort(mangaMap) } + currentMangaMap = mangaMap + view?.onNextLibraryUpdate(categories, mangaMap) + } } /** * Requests the library to have download badges added. */ fun requestDownloadBadgesUpdate() { - downloadTriggerRelay.call(Unit) + //getLibrary() + launchUI { + val mangaMap = rawMangaMap ?: return@launchUI + withContext(Dispatchers.IO) { setDownloadCount(mangaMap) } + rawMangaMap = mangaMap + val current = currentMangaMap ?: return@launchUI + withContext(Dispatchers.IO) { setDownloadCount(current) } + currentMangaMap = current + view?.onNextLibraryUpdate(categories, current) + } } /** * Requests the library to be sorted. */ fun requestSortUpdate() { - sortTriggerRelay.call(Unit) + launchUI { + var mangaMap = currentMangaMap ?: return@launchUI + mangaMap = withContext(Dispatchers.IO) { applySort(mangaMap) } + currentMangaMap = mangaMap + view?.onNextLibraryUpdate(categories, mangaMap) + } } fun requestCatSortUpdate(catId: Int) { - lastCategoryId = catId - sortTriggerRelay.call(Unit) + launchUI { + var mangaMap = currentMangaMap ?: return@launchUI + mangaMap = withContext(Dispatchers.IO) { applyCatSort(mangaMap, catId) } + currentMangaMap = mangaMap + view?.onNextLibraryUpdate(categories, mangaMap) + } } fun requestFullUpdate() { - librarySubscription?.unsubscribe() - subscribeLibrary() + //librarySubscription?.unsubscribe() + getLibrary() } /** @@ -495,7 +550,7 @@ class LibraryPresenter( */ fun onOpenManga() { // Avoid further db updates for the library when it's not needed - librarySubscription?.let { remove(it) } + //librarySubscription?.let { remove(it) } } /** @@ -517,18 +572,19 @@ class LibraryPresenter( * @param deleteChapters whether to also delete downloaded chapters. */ fun removeMangaFromLibrary(mangas: List) { - // Create a set of the list - val mangaToDelete = mangas.distinctBy { it.id } - mangaToDelete.forEach { it.favorite = false } - Observable.fromCallable { db.insertMangas(mangaToDelete).executeAsBlocking() } - .onErrorResumeNext { Observable.empty() } - .subscribeOn(Schedulers.io()) - .subscribe() + GlobalScope.launch(Dispatchers.IO, CoroutineStart.DEFAULT) { + // Create a set of the list + val mangaToDelete = mangas.distinctBy { it.id } + mangaToDelete.forEach { it.favorite = false } + + db.insertMangas(mangaToDelete).executeAsBlocking() + getLibrary() + } } fun confirmDeletion(mangas: List) { - Observable.fromCallable { + GlobalScope.launch(Dispatchers.IO, CoroutineStart.DEFAULT) { val mangaToDelete = mangas.distinctBy { it.id } mangaToDelete.forEach { manga -> db.resetMangaInfo(manga).executeAsBlocking() @@ -537,18 +593,44 @@ class LibraryPresenter( if (source != null) downloadManager.deleteManga(manga, source) } - }.subscribeOn(Schedulers.io()).subscribe() + } + } + + fun updateManga(manga: LibraryManga) { + GlobalScope.launch(Dispatchers.IO, CoroutineStart.DEFAULT) { + val rawMap = rawMangaMap ?: return@launch + val currentMap = currentMangaMap ?: return@launch + rawMap.apply { + forEach { + it.value.forEach { item -> + if (item.manga.id == manga.id) + item.manga.unread = manga.unread + } + } + } + currentMap.apply { + forEach { + it.value.forEach { item -> + if (item.manga.id == manga.id) + item.manga.unread = manga.unread + } + } + } + rawMangaMap = rawMap + currentMangaMap = currentMap + requestSortUpdate() + } } fun addMangas(mangas: List) { - val mangaToAdd = mangas.distinctBy { it.id } - mangaToAdd.forEach { it.favorite = true } - Observable.fromCallable { db.insertMangas(mangaToAdd).executeAsBlocking() } - .onErrorResumeNext { Observable.empty() } - .subscribeOn(Schedulers.io()) - .subscribe() - mangaToAdd.forEach { db.insertManga(it).executeAsBlocking() } + GlobalScope.launch(Dispatchers.IO, CoroutineStart.DEFAULT) { + val mangaToAdd = mangas.distinctBy { it.id } + mangaToAdd.forEach { it.favorite = true } + db.insertMangas(mangaToAdd).executeAsBlocking() + getLibrary() + mangaToAdd.forEach { db.insertManga(it).executeAsBlocking() } + } } /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/FilterBottomSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/FilterBottomSheet.kt index e4eced9a58..e3febf841f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/FilterBottomSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/FilterBottomSheet.kt @@ -28,8 +28,6 @@ import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.launchUI import eu.kanade.tachiyomi.util.view.gone import eu.kanade.tachiyomi.util.view.inflate -import eu.kanade.tachiyomi.util.view.marginBottom -import eu.kanade.tachiyomi.util.view.marginTop import eu.kanade.tachiyomi.util.view.updateLayoutParams import eu.kanade.tachiyomi.util.view.updatePadding import eu.kanade.tachiyomi.util.view.updatePaddingRelative @@ -85,21 +83,18 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri } var onGroupClicked: (Int) -> Unit = { _ -> } - val recycler = androidx.recyclerview.widget.RecyclerView(context) var pager:View? = null fun onCreate(pagerView:View) { - if (context.resources.configuration?.orientation == Configuration.ORIENTATION_LANDSCAPE) { + if (context.resources.configuration?.orientation == Configuration.ORIENTATION_LANDSCAPE + || isTablet()) { sideLayout.orientation = HORIZONTAL - val marginValue = 10.dpToPx - arrayListOf(sortingLayout).forEach { - it.updateLayoutParams { - bottomMargin = 0 - topMargin = 0 - } + sortingLayout.updateLayoutParams { + bottomMargin = 0 + topMargin = 0 } sortScrollView.updatePadding( - bottom = marginValue, + bottom = 10.dpToPx, top = 0 ) } @@ -116,12 +111,14 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri } pager = pagerView - pager?.setPadding(0, 0, 0, topbar.height) updateTitle() + val shadow:View = (pagerView.parent as ViewGroup).findViewById(R.id.shadow2) + val coordLayout:View = (pagerView.parent as ViewGroup).findViewById(R.id.snackbar_layout) sheetBehavior?.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() { override fun onSlide(bottomSheet: View, progress: Float) { updateRootPadding(progress) topbar.alpha = 1 - progress + shadow.alpha = (1 - progress) * 0.25f } override fun onStateChanged(p0: View, state: Int) { @@ -136,6 +133,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri if (sheetBehavior?.state == BottomSheetBehavior.STATE_COLLAPSED) { val height = context.resources.getDimensionPixelSize(R.dimen.rounder_radius) pager?.setPadding(0, 0, 0, topbar.height - height) + coordLayout.setPadding(0, 0, 0, topbar.height) } else { updateRootPadding() @@ -146,10 +144,20 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri mainSortTextView.setOnClickListener { showMainSortOptions() } catSortTextView.setOnClickListener { showCatSortOptions() } clearButton.setOnClickListener { clearFilters() } + downloadCheckbox.isChecked = preferences.downloadBadge().getOrDefault() + downloadCheckbox.setOnCheckedChangeListener { _, isChecked -> + preferences.downloadBadge().set(isChecked) + onGroupClicked(ACTION_BADGE) + } displayGroup.bindToPreference(preferences.libraryAsList()) } + private fun isTablet(): Boolean { + return (context.resources.configuration.screenLayout and Configuration + .SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE + } + fun updateTitle() { launchUI { val text = withContext(Dispatchers.IO) { @@ -422,7 +430,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri ) } mainSortTextView.setCompoundDrawablesRelativeWithIntrinsicBounds( - drawable, null, null, null + null, null, drawable, null ) mainSortTextView.text = withContext(Dispatchers.IO) { if (sortId == LibrarySort.DRAG_AND_DROP) @@ -471,7 +479,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri ) } catSortTextView.setCompoundDrawablesRelativeWithIntrinsicBounds( - drawable, null, null, null + null, null, drawable, null ) catSortTextView.text = withContext(Dispatchers.IO) { context.getString( diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index d243950ffd..0bce943dab 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -178,7 +178,7 @@ open class MainActivity : BaseActivity(), DownloadServiceListener { } nav_view.setCheckedItem(id) } - else if (currentRoot?.tag()?.toIntOrNull() == id) { + else if (currentRoot.tag()?.toIntOrNull() == id) { when (id) { R.id.nav_drawer_recents -> { if (router.backstack.size > 1) router.popToRoot() diff --git a/app/src/main/res/drawable/square_ripple.xml b/app/src/main/res/drawable/square_ripple.xml new file mode 100644 index 0000000000..febfe6d0ee --- /dev/null +++ b/app/src/main/res/drawable/square_ripple.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/filter_bottom_sheet.xml b/app/src/main/res/layout/filter_bottom_sheet.xml index 191aa70aa5..201338b95d 100644 --- a/app/src/main/res/layout/filter_bottom_sheet.xml +++ b/app/src/main/res/layout/filter_bottom_sheet.xml @@ -39,7 +39,6 @@ android:paddingStart="20dp" android:paddingTop="10dp" android:paddingEnd="20dp" - android:paddingBottom="10dp" android:scrollbars="none"> @@ -169,6 +172,12 @@ android:text="@string/action_display_list" /> + + diff --git a/app/src/main/res/layout/library_controller.xml b/app/src/main/res/layout/library_controller.xml index 39ca4ee6b8..54ec27a15e 100644 --- a/app/src/main/res/layout/library_controller.xml +++ b/app/src/main/res/layout/library_controller.xml @@ -15,6 +15,11 @@ android:layout_height="match_parent" /> + +