From 98972e76c9bd2f03925d172417a7f1deeea3296c Mon Sep 17 00:00:00 2001 From: Jay Date: Tue, 4 Feb 2020 23:21:12 -0800 Subject: [PATCH] Fixing imports --- .../tachiyomi/data/download/DownloadManager.kt | 1 + .../tachiyomi/ui/library/LibraryController.kt | 11 +++++------ .../kanade/tachiyomi/ui/library/LibraryPresenter.kt | 2 ++ .../eu/kanade/tachiyomi/ui/main/MainActivity.kt | 7 +------ .../widget/preference/ExtensionPreference.kt | 4 ++-- app/src/main/res/menu/library.xml | 2 +- app/src/main/res/menu/menu_navigation.xml | 13 ++----------- 7 files changed, 14 insertions(+), 26 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt index 5c89f19f5a..aafbfa65e3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt @@ -120,6 +120,7 @@ class DownloadManager(val context: Context) { fun isPaused() = downloader.isPaused() + fun hasQueue() = downloader.queue.isNotEmpty() /** * Tells the downloader to enqueue the given list of chapters. 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 a243d8d28f..f418cd5689 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 @@ -1,9 +1,9 @@ package eu.kanade.tachiyomi.ui.library +import android.app.DownloadManager import android.content.Context import android.content.res.Configuration import android.graphics.Color -import android.os.Build import android.os.Bundle import android.view.LayoutInflater import android.view.Menu @@ -12,7 +12,6 @@ import android.view.MenuItem import android.view.View import android.view.ViewGroup import android.view.WindowInsets -import android.view.WindowManager import android.view.inputmethod.InputMethodManager import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.view.ActionMode @@ -51,8 +50,7 @@ import eu.kanade.tachiyomi.ui.migration.MigrationInterface import eu.kanade.tachiyomi.ui.migration.manga.design.PreMigrationController import eu.kanade.tachiyomi.ui.migration.manga.process.MigrationListController import eu.kanade.tachiyomi.ui.migration.manga.process.MigrationProcedureConfig -import eu.kanade.tachiyomi.ui.setting.SettingsAdvancedController -import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets +import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.view.inflate import eu.kanade.tachiyomi.util.view.marginBottom import eu.kanade.tachiyomi.util.view.marginTop @@ -440,9 +438,10 @@ class LibraryController( val searchView = searchItem.actionView as SearchView searchView.queryHint = resources?.getString(R.string.search_hint) - menu.findItem(R.id.action_downloads).isVisible = MainActivity.bottomNav + menu.findItem(R.id.action_downloads).isVisible = MainActivity.bottomNav && + presenter.hasPendingDownloads() searchItem.collapseActionView() - if (!query.isEmpty()) { + if (query.isNotEmpty()) { searchItem.expandActionView() searchView.setQuery(query, true) searchView.clearFocus() 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 f70dad6f4a..40c24f1059 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 @@ -101,6 +101,8 @@ class LibraryPresenter( subscribeLibrary() } + fun hasPendingDownloads() = downloadManager.hasQueue() + /** * Subscribes to library if needed. */ 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 1494803d1c..a9bfa71e1f 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 @@ -149,12 +149,7 @@ open class MainActivity : BaseActivity() { R.id.nav_drawer_downloads -> { router.pushController(DownloadController().withFadeTransaction()) } - R.id.nav_drawer_settings -> { - router.pushController(SettingsMainController().withFadeTransaction()) - } - R.id.nav_drawer_help -> { - openInBrowser(URL_HELP) - } + R.id.nav_drawer_settings -> setRoot(SettingsMainController(), id) } //navigationView.selectedItemId = id } diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/ExtensionPreference.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/ExtensionPreference.kt index 00d16a3a22..3e64e84269 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/ExtensionPreference.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/ExtensionPreference.kt @@ -7,8 +7,8 @@ import android.util.AttributeSet import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.getOrDefault -import eu.kanade.tachiyomi.util.gone -import eu.kanade.tachiyomi.util.visible +import eu.kanade.tachiyomi.util.view.gone +import eu.kanade.tachiyomi.util.view.visible import kotlinx.android.synthetic.main.preference_update_text.view.* import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/res/menu/library.xml b/app/src/main/res/menu/library.xml index 62e6974114..b0a884cf71 100644 --- a/app/src/main/res/menu/library.xml +++ b/app/src/main/res/menu/library.xml @@ -20,7 +20,7 @@ - - + android:title="@string/label_download_queue" /> - + android:title="@string/label_settings" />