diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt index 6bc1c1b2fb..502e73c5b8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt @@ -233,6 +233,8 @@ class PreferencesHelper(val context: Context) { fun useBottonNav() = rxPrefs.getBoolean(Keys.useBottomNav, true) + fun showRecentUpdates() = rxPrefs.getBoolean("show_recents", false) + fun lastExtCheck() = rxPrefs.getLong("last_ext_check", 0) fun upgradeFilters() { 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 99ff6e1e41..a243d8d28f 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 @@ -440,7 +440,7 @@ class LibraryController( val searchView = searchItem.actionView as SearchView searchView.queryHint = resources?.getString(R.string.search_hint) - menu.findItem(R.id.action_downloads).isVisible = preferences.useBottonNav().getOrDefault() + menu.findItem(R.id.action_downloads).isVisible = MainActivity.bottomNav searchItem.collapseActionView() if (!query.isEmpty()) { searchItem.expandActionView() 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 564161b8fe..1494803d1c 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 @@ -19,6 +19,7 @@ import androidx.appcompat.graphics.drawable.DrawerArrowDrawable import androidx.biometric.BiometricManager import androidx.core.graphics.ColorUtils import androidx.core.view.GravityCompat +import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat import com.bluelinelabs.conductor.Conductor import com.bluelinelabs.conductor.Controller import com.bluelinelabs.conductor.ControllerChangeHandler @@ -168,33 +169,41 @@ open class MainActivity : BaseActivity() { if (currentRoot?.tag()?.toIntOrNull() != id) { when (id) { R.id.nav_drawer_library -> setRoot(LibraryController(), id) - R.id.nav_drawer_recent_updates -> setRoot(RecentChaptersController(), id) - R.id.nav_drawer_recently_read -> setRoot(RecentlyReadController(), id) + R.id.nav_drawer_recents -> { + if (preferences.showRecentUpdates().getOrDefault()) + setRoot(RecentChaptersController(), id) + else + setRoot(RecentlyReadController(), id) + } R.id.nav_drawer_catalogues -> setRoot(CatalogueController(), id) - R.id.nav_drawer_extensions -> setRoot(ExtensionController(), id) - R.id.nav_drawer_downloads -> { - if (router.backstack.isEmpty()) { - setRoot(LibraryController(), R.id.nav_drawer_library) - } - router.pushController(DownloadController().withFadeTransaction()) - } - R.id.nav_drawer_settings -> { - setRoot(SettingsMainController(), id) - } - R.id.nav_drawer_help -> { - openInBrowser(URL_HELP) - } + R.id.nav_drawer_settings -> setRoot(SettingsMainController(), id) } nav_view.setCheckedItem(id) } + else if (currentRoot?.tag()?.toIntOrNull() == id) { + when (id) { + R.id.nav_drawer_recents -> { + if (router.backstack.size > 1) router.popToRoot() + else { + val showRecents = preferences.showRecentUpdates().getOrDefault() + if (!showRecents) setRoot(RecentChaptersController(), id) + else setRoot(RecentlyReadController(), id) + preferences.showRecentUpdates().set(!showRecents) + updateRecentsIcon() + } + } + R.id.nav_drawer_library, R.id.nav_drawer_catalogues, + R.id.nav_drawer_settings -> router.popToRoot() + } + } true } val container: ViewGroup = findViewById(R.id.controller_container) val content: ViewGroup = findViewById(R.id.main_content) - val drawerEnabled = !preferences.useBottonNav().getOrDefault() - content.fitsSystemWindows = drawerEnabled - if (drawerEnabled) { + bottomNav = preferences.useBottonNav().getOrDefault() + content.fitsSystemWindows = !bottomNav + if (!bottomNav) { container.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION } @@ -207,7 +216,8 @@ open class MainActivity : BaseActivity() { top = v.marginTop ) } - navigationView.visibility = if (drawerEnabled) View.GONE else View.VISIBLE + navigationView.visibility = if (bottomNav) View.VISIBLE else View.GONE + updateRecentsIcon() content.setOnApplyWindowInsetsListener { v, insets -> window.navigationBarColor = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { @@ -228,14 +238,17 @@ open class MainActivity : BaseActivity() { else if (v.rootWindowInsets.systemWindowInsetLeft > 0 || v.rootWindowInsets.systemWindowInsetRight > 0) { getResourceColor( - if (drawerEnabled) android.R.attr.colorBackground - else android.R.attr.colorPrimary) + if (bottomNav) android.R.attr.colorPrimary + else android.R.attr.colorBackground + ) } // if in portrait with 2/3 button mode, translucent nav bar else { ColorUtils.setAlphaComponent( - getResourceColor(if (drawerEnabled) android.R.attr.colorBackground - else android.R.attr.colorPrimary), 179) + getResourceColor( + if (bottomNav) android.R.attr.colorPrimary + else android.R.attr.colorBackground + ), 179) } v.setPadding(insets.systemWindowInsetLeft, insets.systemWindowInsetTop, insets.systemWindowInsetRight, 0) @@ -252,7 +265,6 @@ open class MainActivity : BaseActivity() { content.systemUiVisibility = content.systemUiVisibility.or(View .SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) - val navBarScrim: View = findViewById(R.id.nav_bar_scrim) val drawerContainer: FrameLayout = findViewById(R.id.drawer_container) drawerContainer.setOnApplyWindowInsetsListener { v, insets -> val contextView = window?.decorView?.findViewById(R.id.action_mode_bar) @@ -267,7 +279,7 @@ open class MainActivity : BaseActivity() { right = insets.systemWindowInsetRight ) nav_bar_scrim.updateLayoutParams { - height = if (!drawerEnabled) insets.systemWindowInsetBottom else 0 + height = if (bottomNav) insets.systemWindowInsetBottom else 0 } insets.replaceSystemWindowInsets( 0, insets.systemWindowInsetTop, @@ -319,6 +331,16 @@ open class MainActivity : BaseActivity() { setExtensionsBadge() } + fun updateRecentsIcon() { + if (bottomNav) navigationView.menu.findItem(R.id.nav_drawer_recents).icon = + VectorDrawableCompat.create( + resources!!, + if (preferences.showRecentUpdates().getOrDefault()) R.drawable.ic_update_black_24dp + else R.drawable.ic_history_black_24dp, + null + ) + } + override fun startSupportActionMode(callback: androidx.appcompat.view.ActionMode.Callback): androidx.appcompat.view.ActionMode? { window?.statusBarColor = getResourceColor(R.attr.colorPrimary) return super.startSupportActionMode(callback) @@ -360,6 +382,7 @@ open class MainActivity : BaseActivity() { override fun onResume() { super.onResume() + bottomNav = preferences.useBottonNav().getOrDefault() getExtensionUpdates() val useBiometrics = preferences.useBiometrics().getOrDefault() if (useBiometrics && BiometricManager.from(this) @@ -458,8 +481,7 @@ open class MainActivity : BaseActivity() { val backstackSize = router.backstackSize if (drawer.isDrawerOpen(GravityCompat.START) || drawer.isDrawerOpen(GravityCompat.END)) { drawer.closeDrawers() - } else if (!preferences.useBottonNav().getOrDefault() - && backstackSize == 1 && router.getControllerWithTag + } else if (!bottomNav && backstackSize == 1 && router.getControllerWithTag ("$startScreenId") == null) { setSelectedDrawerItem(startScreenId) } else if (!router.handleBack()) { @@ -468,22 +490,36 @@ open class MainActivity : BaseActivity() { } } - fun setSelectedDrawerItem(itemId: Int) { + private fun setSelectedDrawerItem(itemId: Int) { if (!isFinishing) { - nav_view.setCheckedItem(itemId) - navigationView.selectedItemId = itemId + if (bottomNav) navigationView.selectedItemId = itemId + else nav_view.setCheckedItem(itemId) jumpToController(itemId) } } - fun jumpToController(id: Int) { + private fun jumpToController(id: Int) { val currentRoot = router.backstack.firstOrNull() if (currentRoot?.tag()?.toIntOrNull() != id) { when (id) { R.id.nav_drawer_library -> setRoot(LibraryController(), id) - R.id.nav_drawer_recent_updates -> setRoot(RecentChaptersController(), id) - R.id.nav_drawer_recently_read -> setRoot(RecentlyReadController(), id) + 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) + updateRecentsIcon() + } + 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) + updateRecentsIcon() + } R.id.nav_drawer_catalogues -> setRoot(CatalogueController(), id) R.id.nav_drawer_extensions -> { if (router.backstack.isEmpty()) { @@ -552,23 +588,19 @@ open class MainActivity : BaseActivity() { if (from is DialogController || to is DialogController) { return } - val drawerEnabled = !preferences.useBottonNav().getOrDefault() - val showHamburger = router.backstackSize == 1 drawer.setDrawerLockMode(androidx.drawerlayout.widget.DrawerLayout.LOCK_MODE_LOCKED_CLOSED) if (showHamburger) { - if (drawerEnabled) - drawer.setDrawerLockMode(androidx.drawerlayout.widget.DrawerLayout.LOCK_MODE_UNLOCKED) - else toolbar.navigationIcon = null + if (bottomNav) toolbar.navigationIcon = null + else drawer.setDrawerLockMode(androidx.drawerlayout.widget.DrawerLayout.LOCK_MODE_UNLOCKED) } else { - if (drawerEnabled) drawer.setDrawerLockMode( + if (bottomNav) toolbar.navigationIcon = drawerArrow + else drawer.setDrawerLockMode( androidx.drawerlayout.widget.DrawerLayout.LOCK_MODE_LOCKED_CLOSED ) - else toolbar.navigationIcon = drawerArrow } - if (drawerEnabled) - ObjectAnimator.ofFloat(drawerArrow, "progress", if (showHamburger) 0f else 1f).start() - else drawerArrow?.progress = 1f + if (bottomNav) drawerArrow?.progress = 1f + else ObjectAnimator.ofFloat(drawerArrow, "progress", if (showHamburger) 0f else 1f).start() if (from is TabbedController) { from.cleanupTabs(tabs) @@ -620,6 +652,9 @@ open class MainActivity : BaseActivity() { private const val URL_HELP = "https://tachiyomi.org/help/" var unlocked = false + + var bottomNav = false + internal set } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/SearchActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/SearchActivity.kt index 038ba7796e..969220aaf7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/SearchActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/SearchActivity.kt @@ -34,6 +34,7 @@ class SearchActivity: MainActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + bottomNav = false setContentView(R.layout.search_activity) setSupportActionBar(sToolbar) @@ -178,6 +179,11 @@ class SearchActivity: MainActivity() { } } + override fun onResume() { + super.onResume() + bottomNav = false + } + override fun handleIntentAction(intent: Intent): Boolean { val notificationId = intent.getIntExtra("notificationId", -1) if (notificationId > -1) NotificationReceiver.dismissNotification( diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersController.kt index 8155ec7a4e..620b46015c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersController.kt @@ -104,8 +104,7 @@ class ChaptersController() : NucleusController(), val fabBaseMarginBottom = fab?.marginBottom ?: 0 recycler.setOnApplyWindowInsetsListener { v, insets -> - if (activity !is SearchActivity && - presenter.preferences.useBottonNav().getOrDefault()) + if (MainActivity.bottomNav) return@setOnApplyWindowInsetsListener insets fab?.updateLayoutParams { bottomMargin = fabBaseMarginBottom + insets.systemWindowInsetBottom diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt index 7d283753f5..aae50011ac 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt @@ -198,9 +198,10 @@ class MangaInfoController : NucleusController(), val fabBaseMarginBottom = fab_favorite.marginBottom val mangaCoverMarginBottom = manga_cover.marginBottom val fullMarginBottom = manga_cover_full?.marginBottom ?: 0 + setFullCoverToThumb() container?.setOnApplyWindowInsetsListener { _, insets -> - if (activity !is SearchActivity && - Injekt.get().useBottonNav().getOrDefault()) + setFullCoverToThumb() + if (MainActivity.bottomNav) return@setOnApplyWindowInsetsListener insets if (resources?.configuration?.orientation == Configuration.ORIENTATION_LANDSCAPE) { fab_favorite?.updateLayoutParams { @@ -217,7 +218,6 @@ class MangaInfoController : NucleusController(), manga_cover_full?.updateLayoutParams { bottomMargin = fullMarginBottom + insets.systemWindowInsetBottom } - setFullCoverToThumb() insets } info_scrollview.doOnApplyWindowInsets { v, insets, padding -> @@ -759,7 +759,7 @@ class MangaInfoController : NucleusController(), layoutParams.width = thumbView.width expandedImageView.layoutParams = layoutParams expandedImageView.scaleType = ImageView.ScaleType.FIT_CENTER - setUpFullCover = thumbView.height > 0 + setUpFullCover = expandedImageView.height > 0 } override fun handleBack(): Boolean { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackController.kt index 126a042ec2..84cbc43192 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackController.kt @@ -8,18 +8,13 @@ import android.view.ViewGroup import androidx.recyclerview.widget.LinearLayoutManager import com.jakewharton.rxbinding.support.v4.widget.refreshes import eu.kanade.tachiyomi.R -import eu.kanade.tachiyomi.data.preference.PreferencesHelper -import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.data.track.model.TrackSearch import eu.kanade.tachiyomi.ui.base.controller.NucleusController -import eu.kanade.tachiyomi.ui.main.SearchActivity import eu.kanade.tachiyomi.ui.manga.MangaController import eu.kanade.tachiyomi.util.system.toast -import eu.kanade.tachiyomi.util.view.RecyclerWindowInsetsAlwaysListener +import eu.kanade.tachiyomi.util.view.RecyclerWindowInsetsListener import kotlinx.android.synthetic.main.track_controller.* import timber.log.Timber -import uy.kohesive.injekt.Injekt -import uy.kohesive.injekt.api.get class TrackController : NucleusController(), TrackAdapter.OnClickListener, @@ -50,9 +45,7 @@ class TrackController : NucleusController(), with(view) { track_recycler.layoutManager = LinearLayoutManager(context) track_recycler.adapter = adapter - if (activity is SearchActivity || - !Injekt.get().useBottonNav().getOrDefault()) - track_recycler.setOnApplyWindowInsetsListener(RecyclerWindowInsetsAlwaysListener) + track_recycler.setOnApplyWindowInsetsListener(RecyclerWindowInsetsListener) swipe_refresh.isEnabled = false swipe_refresh.refreshes().subscribeUntilDestroy { presenter.refresh() } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/RecentChaptersController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/RecentChaptersController.kt index 7cc7be9b4e..2ced759925 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/RecentChaptersController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/RecentChaptersController.kt @@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.recent_updates import android.view.LayoutInflater import android.view.Menu +import android.view.MenuInflater import android.view.MenuItem import android.view.View import android.view.ViewGroup @@ -18,16 +19,21 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.download.model.Download import eu.kanade.tachiyomi.data.library.LibraryUpdateService import eu.kanade.tachiyomi.data.notification.Notifications +import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.ui.base.controller.NoToolbarElevationController import eu.kanade.tachiyomi.ui.base.controller.NucleusController import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction +import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.ui.manga.MangaController import eu.kanade.tachiyomi.ui.reader.ReaderActivity import eu.kanade.tachiyomi.util.system.notificationManager import eu.kanade.tachiyomi.util.view.RecyclerWindowInsetsListener import eu.kanade.tachiyomi.util.view.snack +import eu.kanade.tachiyomi.ui.recently_read.RecentlyReadController import kotlinx.android.synthetic.main.recent_chapters_controller.* import timber.log.Timber +import uy.kohesive.injekt.Injekt +import uy.kohesive.injekt.api.get /** * Fragment that shows recent chapters. @@ -43,6 +49,9 @@ class RecentChaptersController : NucleusController(), ConfirmDeleteChaptersDialog.Listener, RecentChaptersAdapter.OnCoverClickListener { + init { + setHasOptionsMenu(true) + } /** * Action mode for multiple selection. */ @@ -326,4 +335,22 @@ class RecentChaptersController : NucleusController(), actionMode = null } + + override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { + inflater.inflate(R.menu.recent_updates, menu) + menu.findItem(R.id.action_recents).isVisible = MainActivity.bottomNav + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + when (item.itemId) { + R.id.action_recents -> { + router.setRoot( + RecentlyReadController().withFadeTransaction() + .tag(R.id.nav_drawer_recents.toString())) + Injekt.get().showRecentUpdates().set(false) + (activity as? MainActivity)?.updateRecentsIcon() + } + } + return super.onOptionsItemSelected(item) + } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadController.kt index cbea59b673..cdfd8e0bcb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadController.kt @@ -16,15 +16,21 @@ import eu.kanade.tachiyomi.data.backup.BackupRestoreService import eu.kanade.tachiyomi.data.database.models.History import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.ui.base.controller.BaseController +import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.catalogue.browse.ProgressItem +import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.ui.manga.MangaController import eu.kanade.tachiyomi.ui.reader.ReaderActivity import eu.kanade.tachiyomi.util.system.launchUI import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.view.RecyclerWindowInsetsListener import eu.kanade.tachiyomi.util.view.setOnQueryTextChangeListener -import kotlinx.android.synthetic.main.recently_read_controller.* +import kotlinx.android.synthetic.main.recently_read_controller.empty_view +import kotlinx.android.synthetic.main.recently_read_controller.recycler +import eu.kanade.tachiyomi.ui.recent_updates.RecentChaptersController +import uy.kohesive.injekt.Injekt +import uy.kohesive.injekt.api.get /** * Fragment that shows recently read manga. @@ -186,6 +192,7 @@ class RecentlyReadController(bundle: Bundle? = null) : BaseController(bundle), override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { inflater.inflate(R.menu.recently_read, menu) val searchItem = menu.findItem(R.id.action_search) + menu.findItem(R.id.action_recents).isVisible = MainActivity.bottomNav val searchView = searchItem.actionView as SearchView if (query.isNotEmpty()) { searchItem.expandActionView() @@ -207,15 +214,18 @@ class RecentlyReadController(bundle: Bundle? = null) : BaseController(bundle), } // Fixes problem with the overflow icon showing up in lieu of search - searchItem.setOnActionExpandListener(object : MenuItem.OnActionExpandListener { - override fun onMenuItemActionExpand(item: MenuItem): Boolean { - return true - } + searchItem.fixExpand(onExpand = { invalidateMenuOnExpand() }) + } - override fun onMenuItemActionCollapse(item: MenuItem): Boolean { - activity?.invalidateOptionsMenu() - return true + override fun onOptionsItemSelected(item: MenuItem): Boolean { + when (item.itemId) { + R.id.action_recents -> { + router.setRoot(RecentChaptersController().withFadeTransaction() + .tag(R.id.nav_drawer_recents.toString())) + Injekt.get().showRecentUpdates().set(true) + (activity as? MainActivity)?.updateRecentsIcon() } - }) + } + return super.onOptionsItemSelected(item) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsMainController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsMainController.kt index e534d38efb..0d983133ad 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsMainController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsMainController.kt @@ -6,13 +6,11 @@ import android.view.MenuItem import androidx.preference.PreferenceScreen import com.bluelinelabs.conductor.Controller import eu.kanade.tachiyomi.R -import eu.kanade.tachiyomi.data.preference.PreferencesHelper -import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.extension.ExtensionController +import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.openInBrowser -import uy.kohesive.injekt.injectLazy class SettingsMainController : SettingsController() { @@ -25,12 +23,11 @@ class SettingsMainController : SettingsController() { val tintColor = context.getResourceColor(R.attr.colorAccent) - val prefs:PreferencesHelper by injectLazy() extensionPreference { iconRes = R.drawable.ic_extension_black_24dp iconTint = tintColor titleRes = R.string.label_extensions - isVisible = prefs.useBottonNav().getOrDefault() + isVisible = MainActivity.bottomNav onClick { navigateTo(ExtensionController()) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt index b21cd9d161..7edb46bd3e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt @@ -23,6 +23,7 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.data.preference.getOrDefault +import eu.kanade.tachiyomi.ui.main.MainActivity import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import uy.kohesive.injekt.injectLazy @@ -149,16 +150,7 @@ inline val View.marginLeft: Int object RecyclerWindowInsetsListener : View.OnApplyWindowInsetsListener { override fun onApplyWindowInsets(v: View, insets: WindowInsets): WindowInsets { - val prefs:PreferencesHelper by injectLazy() - if (prefs.useBottonNav().getOrDefault()) return insets - v.setPadding(0,0,0,insets.systemWindowInsetBottom) - //v.updatePaddingRelative(bottom = v.paddingBottom + insets.systemWindowInsetBottom) - return insets - } -} - -object RecyclerWindowInsetsAlwaysListener : View.OnApplyWindowInsetsListener { - override fun onApplyWindowInsets(v: View, insets: WindowInsets): WindowInsets { + if (MainActivity.bottomNav) return insets v.setPadding(0,0,0,insets.systemWindowInsetBottom) //v.updatePaddingRelative(bottom = v.paddingBottom + insets.systemWindowInsetBottom) return insets @@ -167,8 +159,7 @@ object RecyclerWindowInsetsAlwaysListener : View.OnApplyWindowInsetsListener { fun View.doOnApplyWindowInsets(f: (View, WindowInsets, ViewPaddingState) -> Unit) { // Create a snapshot of the view's padding state - val prefs:PreferencesHelper by injectLazy() - if (prefs.useBottonNav().getOrDefault()) return + if (MainActivity.bottomNav) return val paddingState = createStateForView(this) setOnApplyWindowInsetsListener { v, insets -> f(v, insets, paddingState) diff --git a/app/src/main/res/drawable/ic_history_black_24dp.xml b/app/src/main/res/drawable/ic_history_black_24dp.xml new file mode 100644 index 0000000000..3344c4fcc4 --- /dev/null +++ b/app/src/main/res/drawable/ic_history_black_24dp.xml @@ -0,0 +1,6 @@ + + + diff --git a/app/src/main/res/drawable/ic_update_black_24dp.xml b/app/src/main/res/drawable/ic_update_black_24dp.xml index a1a7cbdfd3..5e6ebfe987 100644 --- a/app/src/main/res/drawable/ic_update_black_24dp.xml +++ b/app/src/main/res/drawable/ic_update_black_24dp.xml @@ -2,7 +2,8 @@ android:width="24dp" android:height="24dp" android:viewportWidth="24.0" - android:viewportHeight="24.0"> + android:viewportHeight="24.0" + android:tint="?attr/actionBarTintColor"> diff --git a/app/src/main/res/menu/bottom_navigation.xml b/app/src/main/res/menu/bottom_navigation.xml index 2e363f6566..333b91de63 100644 --- a/app/src/main/res/menu/bottom_navigation.xml +++ b/app/src/main/res/menu/bottom_navigation.xml @@ -8,13 +8,9 @@ android:icon="@drawable/ic_book_black_24dp" android:title="@string/pref_category_library" /> - + android:title="@string/short_recents" /> + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/recently_read.xml b/app/src/main/res/menu/recently_read.xml index d8c2330fd6..5e1cd0950e 100644 --- a/app/src/main/res/menu/recently_read.xml +++ b/app/src/main/res/menu/recently_read.xml @@ -7,4 +7,10 @@ app:actionViewClass="androidx.appcompat.widget.SearchView" app:showAsAction="ifRoom|collapseActionView" /> + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 35673574f6..2f1e810776 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -16,7 +16,7 @@ My library Recently read Catalogues - Library updates + Recently updated Selected: %1$d Source migration Extensions @@ -113,7 +113,7 @@ App not available Updates - Recents + Recents Browse