mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 22:21:52 +01:00
Added a startup screen preference option (#395)
* Added a startup screen preference option * changed string and keys to be consistent
This commit is contained in:
parent
f7bb356abd
commit
33b04427d5
@ -82,6 +82,8 @@ class PreferenceKeys(context: Context) {
|
||||
|
||||
val automaticUpdateStatus = context.getString(R.string.pref_enable_automatic_updates_key)
|
||||
|
||||
val startScreen = context.getString(R.string.pref_start_screen_key)
|
||||
|
||||
fun sourceUsername(sourceId: Int) = "pref_source_username_$sourceId"
|
||||
|
||||
fun sourcePassword(sourceId: Int) = "pref_source_password_$sourceId"
|
||||
|
@ -32,6 +32,8 @@ class PreferencesHelper(context: Context) {
|
||||
}
|
||||
}
|
||||
|
||||
fun startScreen() = prefs.getInt(keys.startScreen, 1)
|
||||
|
||||
fun clear() = prefs.edit().clear().apply()
|
||||
|
||||
fun theme() = prefs.getInt(keys.theme, 1)
|
||||
|
@ -59,7 +59,14 @@ class MainActivity : BaseActivity() {
|
||||
}
|
||||
|
||||
if (savedState == null) {
|
||||
setFragment(LibraryFragment.newInstance())
|
||||
|
||||
when (preferences.startScreen()) {
|
||||
1 -> setFragment(LibraryFragment.newInstance())
|
||||
2 -> setFragment(RecentlyReadFragment.newInstance())
|
||||
3 -> setFragment(RecentChaptersFragment.newInstance())
|
||||
else -> setFragment(LibraryFragment.newInstance())
|
||||
}
|
||||
|
||||
ChangelogDialogFragment.show(preferences, supportFragmentManager)
|
||||
}
|
||||
}
|
||||
|
@ -144,4 +144,16 @@
|
||||
<item>remove</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="start_screen_selection">
|
||||
<item>@string/label_library</item>
|
||||
<item>@string/label_recent_manga</item>
|
||||
<item>@string/label_recent_updates</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="start_screen_selection_values">
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="pref_category_general_key">pref_category_general_key</string>
|
||||
<string name="pref_category_reader_key">pref_category_reader_key</string>
|
||||
<string name="pref_category_sync_key">pref_category_sync_key</string>
|
||||
@ -17,6 +18,7 @@
|
||||
<string name="pref_ask_update_manga_sync_key">pref_ask_update_manga_sync_key</string>
|
||||
<string name="pref_theme_key">pref_theme_key</string>
|
||||
<string name="pref_library_update_restriction_key">library_update_restriction</string>
|
||||
<string name="pref_start_screen_key">start_screen</string>
|
||||
|
||||
<string name="pref_default_viewer_key">pref_default_viewer_key</string>
|
||||
<string name="pref_image_scale_type_key">pref_image_scale_type_key</string>
|
||||
|
@ -93,6 +93,7 @@
|
||||
<string name="pref_theme">Application theme</string>
|
||||
<string name="light_theme">Main theme</string>
|
||||
<string name="dark_theme">Dark theme</string>
|
||||
<string name="pref_start_screen">Start screen</string>
|
||||
|
||||
<!-- Reader section -->
|
||||
<string name="pref_fullscreen">Fullscreen</string>
|
||||
|
@ -14,6 +14,14 @@
|
||||
android:summary="%s"
|
||||
android:title="@string/pref_theme"/>
|
||||
|
||||
<eu.kanade.tachiyomi.widget.preference.IntListPreference
|
||||
android:title="@string/pref_start_screen"
|
||||
android:key="@string/pref_start_screen_key"
|
||||
android:entries="@array/start_screen_selection"
|
||||
android:entryValues="@array/start_screen_selection_values"
|
||||
android:defaultValue="1"
|
||||
android:summary="%s"/>
|
||||
|
||||
<eu.kanade.tachiyomi.widget.preference.SimpleDialogPreference
|
||||
android:dialogLayout="@layout/pref_library_columns"
|
||||
android:key="@string/pref_library_columns_dialog_key"
|
||||
|
Loading…
Reference in New Issue
Block a user