Move help into settings menu
This commit is contained in:
parent
59b925a028
commit
b9420040f5
15 changed files with 69 additions and 29 deletions
|
@ -23,7 +23,6 @@ import eu.kanade.tachiyomi.ui.manga.MangaController
|
|||
import eu.kanade.tachiyomi.ui.recent_updates.RecentChaptersController
|
||||
import eu.kanade.tachiyomi.ui.recently_read.RecentlyReadController
|
||||
import eu.kanade.tachiyomi.ui.setting.SettingsMainController
|
||||
import eu.kanade.tachiyomi.util.system.openInBrowser
|
||||
import kotlinx.android.synthetic.main.main_activity.*
|
||||
|
||||
|
||||
|
@ -82,9 +81,6 @@ class MainActivity : BaseActivity() {
|
|||
R.id.nav_drawer_settings -> {
|
||||
router.pushController(SettingsMainController().withFadeTransaction())
|
||||
}
|
||||
R.id.nav_drawer_help -> {
|
||||
openInBrowser(URL_HELP)
|
||||
}
|
||||
}
|
||||
}
|
||||
drawer.closeDrawer(GravityCompat.START)
|
||||
|
@ -265,8 +261,6 @@ class MainActivity : BaseActivity() {
|
|||
const val INTENT_SEARCH = "eu.kanade.tachiyomi.SEARCH"
|
||||
const val INTENT_SEARCH_QUERY = "query"
|
||||
const val INTENT_SEARCH_FILTER = "filter"
|
||||
|
||||
private const val URL_HELP = "https://tachiyomi.org/help/"
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package eu.kanade.tachiyomi.ui.setting
|
||||
|
||||
import android.view.Menu
|
||||
import android.view.MenuInflater
|
||||
import android.view.MenuItem
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.util.system.openInBrowser
|
||||
|
||||
abstract class BaseSettingsController : 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)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val URL_HELP = "https://tachiyomi.org/help/"
|
||||
}
|
||||
}
|
|
@ -31,7 +31,7 @@ import java.util.Locale
|
|||
import java.util.TimeZone
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
||||
|
||||
class SettingsAboutController : SettingsController() {
|
||||
class SettingsAboutController : BaseSettingsController() {
|
||||
|
||||
/**
|
||||
* Checks for new releases
|
||||
|
|
|
@ -21,7 +21,7 @@ import rx.android.schedulers.AndroidSchedulers
|
|||
import rx.schedulers.Schedulers
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
class SettingsAdvancedController : SettingsController() {
|
||||
class SettingsAdvancedController : BaseSettingsController() {
|
||||
|
||||
private val network: NetworkHelper by injectLazy()
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ import java.io.File
|
|||
import java.util.concurrent.TimeUnit
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
||||
|
||||
class SettingsBackupController : SettingsController() {
|
||||
class SettingsBackupController : BaseSettingsController() {
|
||||
|
||||
/**
|
||||
* Flags containing information of what to backup.
|
||||
|
|
|
@ -23,7 +23,7 @@ import uy.kohesive.injekt.injectLazy
|
|||
import java.io.File
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
||||
|
||||
class SettingsDownloadController : SettingsController() {
|
||||
class SettingsDownloadController : BaseSettingsController() {
|
||||
|
||||
private val db: DatabaseHelper by injectLazy()
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import eu.kanade.tachiyomi.R
|
|||
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
||||
|
||||
class SettingsGeneralController : SettingsController() {
|
||||
class SettingsGeneralController : BaseSettingsController() {
|
||||
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) {
|
||||
titleRes = R.string.pref_category_general
|
||||
|
|
|
@ -22,7 +22,7 @@ import uy.kohesive.injekt.Injekt
|
|||
import uy.kohesive.injekt.api.get
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
||||
|
||||
class SettingsLibraryController : SettingsController() {
|
||||
class SettingsLibraryController : BaseSettingsController() {
|
||||
|
||||
private val db: DatabaseHelper = Injekt.get()
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package eu.kanade.tachiyomi.ui.setting
|
||||
|
||||
import androidx.preference.PreferenceScreen
|
||||
import com.bluelinelabs.conductor.RouterTransaction
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||
|
||||
class SettingsMainController : SettingsController() {
|
||||
class SettingsMainController : BaseSettingsController() {
|
||||
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) {
|
||||
titleRes = R.string.label_settings
|
||||
|
||||
|
@ -54,7 +55,7 @@ class SettingsMainController : SettingsController() {
|
|||
onClick { navigateTo(SettingsAdvancedController()) }
|
||||
}
|
||||
preference {
|
||||
iconRes = R.drawable.ic_help_black_24dp
|
||||
iconRes = R.drawable.ic_info_black_24dp
|
||||
iconTint = tintColor
|
||||
titleRes = R.string.pref_category_about
|
||||
onClick { navigateTo(SettingsAboutController()) }
|
||||
|
@ -62,6 +63,6 @@ class SettingsMainController : SettingsController() {
|
|||
}
|
||||
|
||||
private fun navigateTo(controller: SettingsController) {
|
||||
router.pushController(controller.withFadeTransaction())
|
||||
router.pushController(RouterTransaction.with(controller))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import androidx.preference.PreferenceScreen
|
|||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
||||
|
||||
class SettingsReaderController : SettingsController() {
|
||||
class SettingsReaderController : BaseSettingsController() {
|
||||
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) {
|
||||
titleRes = R.string.pref_category_reader
|
||||
|
|
|
@ -17,7 +17,7 @@ import eu.kanade.tachiyomi.widget.preference.TrackLogoutDialog
|
|||
import uy.kohesive.injekt.injectLazy
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
||||
|
||||
class SettingsTrackingController : SettingsController(),
|
||||
class SettingsTrackingController : BaseSettingsController(),
|
||||
TrackLoginDialog.Listener,
|
||||
TrackLogoutDialog.Listener {
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,19h-2v-2h2v2zM15.07,11.25l-0.9,0.92C13.45,12.9 13,13.5 13,15h-2v-0.5c0,-1.1 0.45,-2.1 1.17,-2.83l1.24,-1.26c0.37,-0.36 0.59,-0.86 0.59,-1.41 0,-1.1 -0.9,-2 -2,-2s-2,0.9 -2,2L8,9c0,-2.21 1.79,-4 4,-4s4,1.79 4,4c0,0.88 -0.36,1.68 -0.93,2.25z"/>
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,19h-2v-2h2v2zM15.07,11.25l-0.9,0.92C13.45,12.9 13,13.5 13,15h-2v-0.5c0,-1.1 0.45,-2.1 1.17,-2.83l1.24,-1.26c0.37,-0.36 0.59,-0.86 0.59,-1.41 0,-1.1 -0.9,-2 -2,-2s-2,0.9 -2,2L8,9c0,-2.21 1.79,-4 4,-4s4,1.79 4,4c0,0.88 -0.36,1.68 -0.93,2.25z" />
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_info_black_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_info_black_24dp.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z" />
|
||||
</vector>
|
|
@ -38,10 +38,5 @@
|
|||
android:checkable="false"
|
||||
android:icon="@drawable/ic_settings_black_24dp"
|
||||
android:title="@string/label_settings" />
|
||||
<item
|
||||
android:id="@+id/nav_drawer_help"
|
||||
android:checkable="false"
|
||||
android:icon="@drawable/ic_help_black_24dp"
|
||||
android:title="@string/label_help" />
|
||||
</group>
|
||||
</menu>
|
||||
|
|
11
app/src/main/res/menu/settings.xml
Normal file
11
app/src/main/res/menu/settings.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/action_help"
|
||||
android:icon="@drawable/ic_help_white_24dp"
|
||||
android:title="@string/label_help"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
</menu>
|
Reference in a new issue