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 1e3f64a1b..2e6204043 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
@@ -33,7 +33,6 @@ import eu.kanade.tachiyomi.ui.base.controller.TabbedController
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.migration.MigrationController
import eu.kanade.tachiyomi.util.system.toast
import eu.kanade.tachiyomi.util.view.inflate
import kotlinx.android.synthetic.main.library_controller.empty_view
@@ -396,10 +395,6 @@ class LibraryController(
preferences.downloadBadge().set(item.isChecked)
onDownloadBadgeChanged()
}
-
- R.id.action_source_migration -> {
- router.pushController(MigrationController().withFadeTransaction())
- }
}
return super.onOptionsItemSelected(item)
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 bd90d0689..986f64196 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
@@ -1,14 +1,10 @@
package eu.kanade.tachiyomi.ui.main
-import android.animation.ObjectAnimator
import android.app.SearchManager
import android.content.Intent
-import android.graphics.Color
import android.os.Bundle
import android.view.ViewGroup
-import androidx.appcompat.graphics.drawable.DrawerArrowDrawable
import androidx.core.view.GravityCompat
-import androidx.drawerlayout.widget.DrawerLayout
import com.bluelinelabs.conductor.*
import eu.kanade.tachiyomi.Migrations
import eu.kanade.tachiyomi.R
@@ -18,12 +14,11 @@ import eu.kanade.tachiyomi.ui.base.controller.*
import eu.kanade.tachiyomi.ui.catalogue.CatalogueController
import eu.kanade.tachiyomi.ui.catalogue.global_search.CatalogueSearchController
import eu.kanade.tachiyomi.ui.download.DownloadController
-import eu.kanade.tachiyomi.ui.extension.ExtensionController
import eu.kanade.tachiyomi.ui.library.LibraryController
import eu.kanade.tachiyomi.ui.manga.MangaController
+import eu.kanade.tachiyomi.ui.more.MoreController
import eu.kanade.tachiyomi.ui.recent_updates.RecentChaptersController
import eu.kanade.tachiyomi.ui.recently_read.RecentlyReadController
-import eu.kanade.tachiyomi.ui.setting.SettingsMainController
import kotlinx.android.synthetic.main.main_activity.*
@@ -31,15 +26,13 @@ class MainActivity : BaseActivity() {
private lateinit var router: Router
- private var drawerArrow: DrawerArrowDrawable? = null
-
private var secondaryDrawer: ViewGroup? = null
private val startScreenId by lazy {
when (preferences.startScreen()) {
- 2 -> R.id.nav_drawer_recently_read
- 3 -> R.id.nav_drawer_recent_updates
- else -> R.id.nav_drawer_library
+ 2 -> R.id.nav_history
+ 3 -> R.id.nav_updates
+ else -> R.id.nav_library
}
}
@@ -58,33 +51,25 @@ class MainActivity : BaseActivity() {
setSupportActionBar(toolbar)
- drawerArrow = DrawerArrowDrawable(this)
- drawerArrow?.color = Color.WHITE
- toolbar.navigationIcon = drawerArrow
-
tabAnimator = TabsAnimator(tabs)
- // Set behavior of Navigation drawer
- nav_view.setNavigationItemSelectedListener { item ->
+ // Set behavior of bottom nav
+ bottom_nav.setOnNavigationItemSelectedListener { item ->
val id = item.itemId
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_catalogues -> setRoot(CatalogueController(), id)
- R.id.nav_drawer_extensions -> setRoot(ExtensionController(), id)
- R.id.nav_drawer_downloads -> {
- router.pushController(DownloadController().withFadeTransaction())
- }
- R.id.nav_drawer_settings -> {
- router.pushController(SettingsMainController().withFadeTransaction())
- }
+ R.id.nav_library -> setRoot(LibraryController(), id)
+ R.id.nav_updates -> setRoot(RecentChaptersController(), id)
+ R.id.nav_history -> setRoot(RecentlyReadController(), id)
+ R.id.nav_catalogues -> setRoot(CatalogueController(), id)
+ R.id.nav_more -> setRoot(MoreController(), id)
}
+ } else {
+ router.popToRoot()
}
- drawer.closeDrawer(GravityCompat.START)
+
true
}
@@ -143,18 +128,18 @@ class MainActivity : BaseActivity() {
}
when (intent.action) {
- SHORTCUT_LIBRARY -> setSelectedDrawerItem(R.id.nav_drawer_library)
- SHORTCUT_RECENTLY_UPDATED -> setSelectedDrawerItem(R.id.nav_drawer_recent_updates)
- SHORTCUT_RECENTLY_READ -> setSelectedDrawerItem(R.id.nav_drawer_recently_read)
- SHORTCUT_CATALOGUES -> setSelectedDrawerItem(R.id.nav_drawer_catalogues)
+ SHORTCUT_LIBRARY -> setSelectedDrawerItem(R.id.nav_library)
+ SHORTCUT_RECENTLY_UPDATED -> setSelectedDrawerItem(R.id.nav_updates)
+ SHORTCUT_RECENTLY_READ -> setSelectedDrawerItem(R.id.nav_history)
+ SHORTCUT_CATALOGUES -> setSelectedDrawerItem(R.id.nav_catalogues)
SHORTCUT_MANGA -> {
val extras = intent.extras ?: return false
- router.setRoot(RouterTransaction.with(MangaController(extras)))
+ setSelectedDrawerItem(R.id.nav_library)
+ router.pushController(RouterTransaction.with(MangaController(extras)))
}
SHORTCUT_DOWNLOADS -> {
- if (router.backstack.none { it.controller() is DownloadController }) {
- setSelectedDrawerItem(R.id.nav_drawer_downloads)
- }
+ setSelectedDrawerItem(R.id.nav_more)
+ router.pushController(RouterTransaction.with(DownloadController()))
}
Intent.ACTION_SEARCH, "com.google.android.gms.actions.SEARCH_ACTION" -> {
//If the intent match the "standard" Android search intent
@@ -186,7 +171,7 @@ class MainActivity : BaseActivity() {
override fun onDestroy() {
super.onDestroy()
- nav_view?.setNavigationItemSelectedListener(null)
+ bottom_nav?.setOnNavigationItemSelectedListener(null)
toolbar?.setNavigationOnClickListener(null)
}
@@ -203,8 +188,7 @@ class MainActivity : BaseActivity() {
private fun setSelectedDrawerItem(itemId: Int) {
if (!isFinishing) {
- nav_view.setCheckedItem(itemId)
- nav_view.menu.performIdentifierAction(itemId, 0)
+ bottom_nav.selectedItemId = itemId
}
}
@@ -217,14 +201,7 @@ class MainActivity : BaseActivity() {
return
}
- val showHamburger = router.backstackSize == 1
- if (showHamburger) {
- drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED)
- } else {
- drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED)
- }
-
- ObjectAnimator.ofFloat(drawerArrow, "progress", if (showHamburger) 0f else 1f).start()
+ supportActionBar?.setDisplayHomeAsUpEnabled(router.backstackSize != 1)
if (from is TabbedController) {
from.cleanupTabs(tabs)
diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAboutController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt
similarity index 97%
rename from app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAboutController.kt
rename to app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt
index 13c0e35d1..c7ca1ed00 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAboutController.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt
@@ -1,4 +1,4 @@
-package eu.kanade.tachiyomi.ui.setting
+package eu.kanade.tachiyomi.ui.more
import android.app.Dialog
import android.content.Intent
@@ -16,6 +16,7 @@ import eu.kanade.tachiyomi.data.updater.UpdaterJob
import eu.kanade.tachiyomi.data.updater.UpdaterService
import eu.kanade.tachiyomi.ui.base.controller.DialogController
import eu.kanade.tachiyomi.ui.main.ChangelogDialogController
+import eu.kanade.tachiyomi.ui.setting.SettingsController
import eu.kanade.tachiyomi.util.lang.launchNow
import eu.kanade.tachiyomi.util.lang.toTimestampString
import eu.kanade.tachiyomi.util.preference.*
@@ -29,7 +30,7 @@ import java.util.Locale
import java.util.TimeZone
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
-class SettingsAboutController : SettingsController() {
+class AboutController : SettingsController() {
/**
* Checks for new releases
diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/more/MoreController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/more/MoreController.kt
new file mode 100644
index 000000000..f6cd6d422
--- /dev/null
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/more/MoreController.kt
@@ -0,0 +1,81 @@
+package eu.kanade.tachiyomi.ui.more
+
+import androidx.preference.PreferenceScreen
+import eu.kanade.tachiyomi.R
+import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
+import eu.kanade.tachiyomi.ui.download.DownloadController
+import eu.kanade.tachiyomi.ui.extension.ExtensionController
+import eu.kanade.tachiyomi.ui.migration.MigrationController
+import eu.kanade.tachiyomi.ui.setting.SettingsController
+import eu.kanade.tachiyomi.ui.setting.SettingsMainController
+import eu.kanade.tachiyomi.util.preference.*
+import eu.kanade.tachiyomi.util.system.getResourceColor
+import eu.kanade.tachiyomi.util.system.openInBrowser
+
+class MoreController : SettingsController() {
+
+ override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) {
+ titleRes = R.string.label_more
+
+ val tintColor = context.getResourceColor(R.attr.colorAccent)
+
+ preferenceCategory {
+ preference {
+ titleRes = R.string.label_extensions
+ iconRes = R.drawable.ic_extension_black_24dp
+ iconTint = tintColor
+ onClick {
+ router.pushController(ExtensionController().withFadeTransaction())
+ }
+ }
+ preference {
+ titleRes = R.string.label_download_queue
+ iconRes = R.drawable.ic_file_download_black_24dp
+ iconTint = tintColor
+ onClick {
+ router.pushController(DownloadController().withFadeTransaction())
+ }
+ }
+ preference {
+ titleRes = R.string.label_migration
+ iconRes = R.drawable.ic_compare_arrows_black_24dp
+ iconTint = tintColor
+ onClick {
+ router.pushController(MigrationController().withFadeTransaction())
+ }
+ }
+ }
+
+ preferenceCategory {
+ preference {
+ titleRes = R.string.label_settings
+ iconRes = R.drawable.ic_settings_black_24dp
+ iconTint = tintColor
+ onClick {
+ router.pushController(SettingsMainController().withFadeTransaction())
+ }
+ }
+ preference {
+ iconRes = R.drawable.ic_info_black_24dp
+ iconTint = tintColor
+ titleRes = R.string.pref_category_about
+ onClick {
+ router.pushController(AboutController().withFadeTransaction())
+ }
+ }
+ preference {
+ titleRes = R.string.label_help
+ iconRes = R.drawable.ic_help_black_24dp
+ iconTint = tintColor
+ onClick {
+ activity?.openInBrowser(URL_HELP)
+ }
+ }
+ }
+ }
+
+ companion object {
+ private const val URL_HELP = "https://tachiyomi.org/help/"
+ }
+
+}
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 e4910528e..cd7056a62 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
@@ -1,33 +1,13 @@
package eu.kanade.tachiyomi.ui.setting
-import android.view.Menu
-import android.view.MenuInflater
-import android.view.MenuItem
import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
import eu.kanade.tachiyomi.util.preference.*
import eu.kanade.tachiyomi.util.system.getResourceColor
-import eu.kanade.tachiyomi.util.system.openInBrowser
class SettingsMainController : SettingsController() {
- init {
- setHasOptionsMenu(true)
- }
-
- override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
- inflater.inflate(R.menu.settings, menu)
- }
-
- override fun onOptionsItemSelected(item: MenuItem): Boolean {
- when (item.itemId) {
- R.id.action_help -> activity?.openInBrowser(URL_HELP)
- }
-
- return super.onOptionsItemSelected(item)
- }
-
override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) {
titleRes = R.string.label_settings
@@ -75,19 +55,9 @@ class SettingsMainController : SettingsController() {
titleRes = R.string.pref_category_advanced
onClick { navigateTo(SettingsAdvancedController()) }
}
- preference {
- iconRes = R.drawable.ic_info_black_24dp
- iconTint = tintColor
- titleRes = R.string.pref_category_about
- onClick { navigateTo(SettingsAboutController()) }
- }
}
private fun navigateTo(controller: SettingsController) {
router.pushController(controller.withFadeTransaction())
}
-
- companion object {
- private const val URL_HELP = "https://tachiyomi.org/help/"
- }
}
diff --git a/app/src/main/res/drawable/bottom_nav_item_selector.xml b/app/src/main/res/drawable/bottom_nav_item_selector.xml
new file mode 100644
index 000000000..a4b1bce02
--- /dev/null
+++ b/app/src/main/res/drawable/bottom_nav_item_selector.xml
@@ -0,0 +1,8 @@
+
+