From c4f1183dc411612d42089c4166083694bbc5a528 Mon Sep 17 00:00:00 2001 From: Jay Date: Sat, 23 May 2020 15:52:36 -0400 Subject: [PATCH] Moving new material views to base class --- .../tachiyomi/ui/{library => base}/MaterialFastScroll.kt | 2 +- .../tachiyomi/ui/{library => base}/MaterialMenuSheet.kt | 2 +- .../eu/kanade/tachiyomi/ui/library/LibraryController.kt | 1 + .../kanade/tachiyomi/ui/library/LibraryHeaderHolder.kt | 9 +++------ .../java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt | 2 +- app/src/main/res/layout/download_bottom_sheet.xml | 2 +- app/src/main/res/layout/extensions_bottom_sheet.xml | 2 +- app/src/main/res/layout/library_list_controller.xml | 2 +- app/src/main/res/layout/manga_details_controller.xml | 2 +- 9 files changed, 11 insertions(+), 13 deletions(-) rename app/src/main/java/eu/kanade/tachiyomi/ui/{library => base}/MaterialFastScroll.kt (99%) rename app/src/main/java/eu/kanade/tachiyomi/ui/{library => base}/MaterialMenuSheet.kt (99%) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/MaterialFastScroll.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/MaterialFastScroll.kt similarity index 99% rename from app/src/main/java/eu/kanade/tachiyomi/ui/library/MaterialFastScroll.kt rename to app/src/main/java/eu/kanade/tachiyomi/ui/base/MaterialFastScroll.kt index 573fbbec41..69581b342e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/MaterialFastScroll.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/MaterialFastScroll.kt @@ -1,4 +1,4 @@ -package eu.kanade.tachiyomi.ui.library +package eu.kanade.tachiyomi.ui.base import android.content.Context import android.util.AttributeSet diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/MaterialMenuSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/MaterialMenuSheet.kt similarity index 99% rename from app/src/main/java/eu/kanade/tachiyomi/ui/library/MaterialMenuSheet.kt rename to app/src/main/java/eu/kanade/tachiyomi/ui/base/MaterialMenuSheet.kt index 59a8c5ebc4..6bba736153 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/MaterialMenuSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/MaterialMenuSheet.kt @@ -1,4 +1,4 @@ -package eu.kanade.tachiyomi.ui.library +package eu.kanade.tachiyomi.ui.base import android.animation.ObjectAnimator import android.animation.ValueAnimator 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 192500fb1b..ce8f71f797 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 @@ -49,6 +49,7 @@ import eu.kanade.tachiyomi.data.notification.NotificationReceiver import eu.kanade.tachiyomi.data.notification.Notifications import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.getOrDefault +import eu.kanade.tachiyomi.ui.base.MaterialMenuSheet import eu.kanade.tachiyomi.ui.base.controller.BaseController import eu.kanade.tachiyomi.ui.category.ManageCategoryDialog import eu.kanade.tachiyomi.ui.library.LibraryGroup.BY_DEFAULT diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderHolder.kt index 4a747c8130..3336a902e6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderHolder.kt @@ -16,6 +16,7 @@ import eu.kanade.tachiyomi.data.database.models.Category import eu.kanade.tachiyomi.data.library.LibraryUpdateService import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.source.icon +import eu.kanade.tachiyomi.ui.base.MaterialMenuSheet import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.system.getResourceColor @@ -182,14 +183,10 @@ class LibraryHeaderHolder(val view: View, private val adapter: LibraryCategoryAd } val sortingMode = category.sortingMode() val sheet = MaterialMenuSheet( - activity, - items, - activity.getString(R.string.sort_by), - sortingMode + activity, items, activity.getString(R.string.sort_by), sortingMode ) { sheet, item -> onCatSortClicked(category, item) - val nCategory = - (adapter.getItem(adapterPosition) as? LibraryHeaderItem)?.category + val nCategory = (adapter.getItem(adapterPosition) as? LibraryHeaderItem)?.category val isAscending = nCategory?.isAscending() ?: false val drawableRes = getSortRes(item, isAscending) sheet.setDrawable(item, drawableRes) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index d7472371ec..40f7a11f82 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -36,7 +36,7 @@ import eu.kanade.tachiyomi.data.notification.Notifications import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.ui.base.activity.BaseRxActivity -import eu.kanade.tachiyomi.ui.library.MaterialMenuSheet +import eu.kanade.tachiyomi.ui.base.MaterialMenuSheet import eu.kanade.tachiyomi.ui.reader.ReaderPresenter.SetAsCoverResult.AddToLibraryFirst import eu.kanade.tachiyomi.ui.reader.ReaderPresenter.SetAsCoverResult.Error import eu.kanade.tachiyomi.ui.reader.ReaderPresenter.SetAsCoverResult.Success diff --git a/app/src/main/res/layout/download_bottom_sheet.xml b/app/src/main/res/layout/download_bottom_sheet.xml index a2b57f02ce..ef719aba8c 100644 --- a/app/src/main/res/layout/download_bottom_sheet.xml +++ b/app/src/main/res/layout/download_bottom_sheet.xml @@ -76,7 +76,7 @@ android:layout_gravity="center" android:visibility="gone" /> - - - -