diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/FilterBottomSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/FilterBottomSheet.kt index 51d5fd9a51..cd07fcdfe6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/FilterBottomSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/FilterBottomSheet.kt @@ -83,11 +83,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri updateTitle() sheetBehavior.setBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() { override fun onSlide(bottomSheet: View, progress: Float) { - val minHeight = sheetBehavior.peekHeight - val maxHeight = bottomSheet.height - val percent = (progress * 100).roundToInt() - val value = (percent * (maxHeight - minHeight) / 100) + minHeight - pager?.setPadding(0, 0, 0, value) + updateRootPadding() sortText.alpha = 1 - progress title.alpha = progress //line.alpha = 1 - progress @@ -102,6 +98,9 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri if (sheetBehavior.state == BottomSheetBehavior.STATE_COLLAPSED) { pager?.setPadding(0, 0, 0, topbar.height) } + else { + updateRootPadding() + } } createTags() } @@ -135,6 +134,16 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri } } + fun updateRootPadding() { + val sheetBehavior = BottomSheetBehavior.from(this) + val minHeight = sheetBehavior.peekHeight + val maxHeight = height + val percent = ((if (sheetBehavior.state == BottomSheetBehavior.STATE_EXPANDED) 1f else 0f) + * 100).roundToInt() + val value = (percent * (maxHeight - minHeight) / 100) + minHeight + pager?.setPadding(0, 0, 0, value) + } + fun sorting(): Int { return if (lastCategory != null && preferences.showCategories().getOrDefault()) { when (lastCategory?.mangaSort) { 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 ba5736e2be..b4e03ab38f 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 @@ -43,6 +43,7 @@ import eu.kanade.tachiyomi.ui.base.controller.SecondaryDrawerController import eu.kanade.tachiyomi.ui.base.controller.TabbedController import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.category.CategoryController +import eu.kanade.tachiyomi.ui.download.DownloadController import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.ui.manga.MangaController import eu.kanade.tachiyomi.ui.migration.MigrationController @@ -221,6 +222,10 @@ class LibraryController( FilterBottomSheet.ACTION_BADGE -> onDownloadBadgeChanged() } } + + fab.setOnClickListener { + router.pushController(DownloadController().withFadeTransaction()) + } } fun enableReorderItems(category: Category) { 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 cd08a95505..a2345212be 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 @@ -667,26 +667,17 @@ open class MainActivity : BaseActivity() { fun setDownloadBadge(downloading: Boolean) { if (!bottomNav) return - val badge = bottomNavView?.getOrCreateBadge(R.id.nav_drawer_settings) ?: return val downloadManager = Injekt.get() val hasQueue = downloading || downloadManager.hasQueue() if (hasQueue) { + val badge = bottomNavView?.getOrCreateBadge(R.id.nav_drawer_library) + ?: return badge.clearNumber() badge.backgroundColor = bottomNavView?.context?.getResourceColor(R.attr .badgeColor) ?: Color.BLACK } - else - { - val updates = Injekt.get().extensionUpdatesCount().getOrDefault() - if (updates > 0) { - badge.number = updates - badge.backgroundColor = bottomNavView?.context?.getResourceColor(R.attr - .badgeColor) ?: Color.BLACK - badge.badgeTextColor = Color.WHITE - } - else { - bottomNavView?.removeBadge(R.id.nav_drawer_settings) - } + else { + bottomNavView?.removeBadge(R.id.nav_drawer_library) } } } diff --git a/app/src/main/res/layout/library_controller.xml b/app/src/main/res/layout/library_controller.xml index 091ddff9f0..d273e627d5 100644 --- a/app/src/main/res/layout/library_controller.xml +++ b/app/src/main/res/layout/library_controller.xml @@ -26,6 +26,18 @@ + +