sets for defualt theme + localization

This commit is contained in:
Jay 2019-10-27 01:10:13 -07:00
parent 824921660f
commit 40a0584498
6 changed files with 8 additions and 22 deletions

View File

@ -60,6 +60,9 @@ android {
versionNameSuffix "-${getCommitCount()}" versionNameSuffix "-${getCommitCount()}"
applicationIdSuffix ".debug" applicationIdSuffix ".debug"
} }
release {
applicationIdSuffix = '.j2k'
}
} }
flavorDimensions "default" flavorDimensions "default"

View File

@ -33,7 +33,7 @@ class PreferencesHelper(val context: Context) {
fun clear() = prefs.edit().clear().apply() fun clear() = prefs.edit().clear().apply()
fun theme() = prefs.getInt(Keys.theme, 1) fun theme() = prefs.getInt(Keys.theme, 5)
fun rotation() = rxPrefs.getInteger(Keys.rotation, 1) fun rotation() = rxPrefs.getInteger(Keys.rotation, 1)
@ -65,7 +65,7 @@ class PreferencesHelper(val context: Context) {
fun zoomStart() = rxPrefs.getInteger(Keys.zoomStart, 1) fun zoomStart() = rxPrefs.getInteger(Keys.zoomStart, 1)
fun readerTheme() = rxPrefs.getInteger(Keys.readerTheme, 0) fun readerTheme() = rxPrefs.getInteger(Keys.readerTheme, 2)
fun cropBorders() = rxPrefs.getBoolean(Keys.cropBorders, false) fun cropBorders() = rxPrefs.getBoolean(Keys.cropBorders, false)

View File

@ -65,11 +65,6 @@ class MainActivity : BaseActivity() {
lateinit var tabAnimator: TabsAnimator lateinit var tabAnimator: TabsAnimator
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
/*delegate.setLocalNightMode(when (preferences.theme()) {
1 -> MODE_NIGHT_NO
2, 3, 4 -> MODE_NIGHT_YES
else -> MODE_NIGHT_FOLLOW_SYSTEM
})*/
setDefaultNightMode(when (preferences.theme()) { setDefaultNightMode(when (preferences.theme()) {
1 -> MODE_NIGHT_NO 1 -> MODE_NIGHT_NO
2, 3, 4 -> MODE_NIGHT_YES 2, 3, 4 -> MODE_NIGHT_YES

View File

@ -56,23 +56,12 @@ class SettingsGeneralController : SettingsController() {
titleRes = R.string.pref_theme titleRes = R.string.pref_theme
entriesRes = arrayOf(R.string.light_theme, R.string.dark_theme, entriesRes = arrayOf(R.string.light_theme, R.string.dark_theme,
R.string.amoled_theme, R.string.darkblue_theme, R.string.amoled_theme, R.string.darkblue_theme,
R.string.system_theme, R.string.system_amoled_theme, R.string.system_darkblue_theme) R.string.system_default, R.string.system_amoled_theme, R.string.system_darkblue_theme)
entryValues = arrayOf("1", "2", "3", "4", "5", "6", "7") entryValues = arrayOf("1", "2", "3", "4", "5", "6", "7")
defaultValue = "5" defaultValue = "5"
summary = "%s" summary = "%s"
onChange {newValue -> onChange { newValue ->
val activity = activity ?: return@onChange false
val app = activity.application
AppCompatDelegate.setDefaultNightMode(when (newValue) {
"1" -> AppCompatDelegate.MODE_NIGHT_NO
"2", "3", "4" -> AppCompatDelegate.MODE_NIGHT_YES
else -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
})
//LocaleHelper.changeLocale(newValue.toString())
//LocaleHelper.updateConfiguration(app, app.resources.configuration)
//activity?.recreate()
activity?.recreate() activity?.recreate()
true true
} }

View File

@ -50,7 +50,7 @@ class SettingsReaderController : SettingsController() {
intListPreference { intListPreference {
key = Keys.readerTheme key = Keys.readerTheme
titleRes = R.string.pref_reader_theme titleRes = R.string.pref_reader_theme
entriesRes = arrayOf(R.string.white_background, R.string.black_background, R.string.auto_background) entriesRes = arrayOf(R.string.white_background, R.string.black_background, R.string.zoom_start_automatic)
entryValues = arrayOf("0", "1", "2") entryValues = arrayOf("0", "1", "2")
defaultValue = "0" defaultValue = "0"
summary = "%s" summary = "%s"

View File

@ -143,7 +143,6 @@
<string name="dark_theme">Dark theme</string> <string name="dark_theme">Dark theme</string>
<string name="amoled_theme">AMOLED theme</string> <string name="amoled_theme">AMOLED theme</string>
<string name="darkblue_theme">Dark blue</string> <string name="darkblue_theme">Dark blue</string>
<string name="system_theme">System default</string>
<string name="system_amoled_theme">System default (AMOLED)</string> <string name="system_amoled_theme">System default (AMOLED)</string>
<string name="system_darkblue_theme">System default (Dark blue)</string> <string name="system_darkblue_theme">System default (Dark blue)</string>
<string name="pref_start_screen">Start screen</string> <string name="pref_start_screen">Start screen</string>