mirror of
https://github.com/mihonapp/mihon.git
synced 2025-06-25 10:37:51 +02: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:
@ -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)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user