forked from recloudstream/cloudstream
Update SettingsFragment.kt
This commit is contained in:
parent
8e9c11db4b
commit
f0c34f2075
1 changed files with 192 additions and 181 deletions
|
@ -240,6 +240,8 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
// pref = visual path
|
||||
settingsManager.edit().putString(getString(R.string.download_path_key), dirs[it]).apply()
|
||||
settingsManager.edit().putString(getString(R.string.download_path_pref), dirs[it]).apply()
|
||||
}
|
||||
}
|
||||
|
||||
if (preferedMediaTypePreference != null) {
|
||||
preferedMediaTypePreference.setOnPreferenceClickListener {
|
||||
|
@ -279,9 +281,10 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
true,
|
||||
{}) {
|
||||
try {
|
||||
settingsManager.edit().putInt(getString(R.string.app_layout_key), prefValues[it]).apply()
|
||||
settingsManager.edit().putInt(getString(R.string.app_layout_key), prefValues[it])
|
||||
.apply()
|
||||
activity?.recreate()
|
||||
} catch (e : Exception) {
|
||||
} catch (e: Exception) {
|
||||
logError(e)
|
||||
}
|
||||
}
|
||||
|
@ -293,7 +296,8 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
val prefValues = resources.getStringArray(R.array.themes_overlay_names_values)
|
||||
val settingsManager = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
val currentLayout = settingsManager.getString( getString(R.string.primary_color_key),prefValues.first())
|
||||
val currentLayout =
|
||||
settingsManager.getString(getString(R.string.primary_color_key), prefValues.first())
|
||||
context?.showBottomDialog(
|
||||
prefNames.toList(),
|
||||
prefValues.indexOf(currentLayout),
|
||||
|
@ -301,9 +305,10 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
true,
|
||||
{}) {
|
||||
try {
|
||||
settingsManager.edit().putString(getString(R.string.primary_color_key), prefValues[it]).apply()
|
||||
settingsManager.edit().putString(getString(R.string.primary_color_key), prefValues[it])
|
||||
.apply()
|
||||
activity?.recreate()
|
||||
} catch (e : Exception) {
|
||||
} catch (e: Exception) {
|
||||
logError(e)
|
||||
}
|
||||
}
|
||||
|
@ -315,7 +320,8 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
val prefValues = resources.getStringArray(R.array.themes_names_values)
|
||||
val settingsManager = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
val currentLayout = settingsManager.getString( getString(R.string.app_theme_key),prefValues.first())
|
||||
val currentLayout =
|
||||
settingsManager.getString(getString(R.string.app_theme_key), prefValues.first())
|
||||
context?.showBottomDialog(
|
||||
prefNames.toList(),
|
||||
prefValues.indexOf(currentLayout),
|
||||
|
@ -323,9 +329,10 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
true,
|
||||
{}) {
|
||||
try {
|
||||
settingsManager.edit().putString(getString(R.string.app_theme_key), prefValues[it]).apply()
|
||||
settingsManager.edit().putString(getString(R.string.app_theme_key), prefValues[it])
|
||||
.apply()
|
||||
activity?.recreate()
|
||||
} catch (e : Exception) {
|
||||
} catch (e: Exception) {
|
||||
logError(e)
|
||||
}
|
||||
}
|
||||
|
@ -338,14 +345,18 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
val settingsManager = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
val currentQuality =
|
||||
settingsManager.getInt(getString(R.string.watch_quality_pref), Qualities.values().last().value)
|
||||
settingsManager.getInt(
|
||||
getString(R.string.watch_quality_pref),
|
||||
Qualities.values().last().value
|
||||
)
|
||||
context?.showBottomDialog(
|
||||
prefNames.toList(),
|
||||
prefValues.indexOf(currentQuality),
|
||||
getString(R.string.watch_quality_pref),
|
||||
true,
|
||||
{}) {
|
||||
settingsManager.edit().putInt(getString(R.string.watch_quality_pref), prefValues[it]).apply()
|
||||
settingsManager.edit().putInt(getString(R.string.watch_quality_pref), prefValues[it])
|
||||
.apply()
|
||||
}
|
||||
return@setOnPreferenceClickListener true
|
||||
}
|
||||
|
@ -446,4 +457,4 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
}
|
||||
return super.onPreferenceTreeClick(preference)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue