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
|
// pref = visual path
|
||||||
settingsManager.edit().putString(getString(R.string.download_path_key), dirs[it]).apply()
|
settingsManager.edit().putString(getString(R.string.download_path_key), dirs[it]).apply()
|
||||||
settingsManager.edit().putString(getString(R.string.download_path_pref), dirs[it]).apply()
|
settingsManager.edit().putString(getString(R.string.download_path_pref), dirs[it]).apply()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (preferedMediaTypePreference != null) {
|
if (preferedMediaTypePreference != null) {
|
||||||
preferedMediaTypePreference.setOnPreferenceClickListener {
|
preferedMediaTypePreference.setOnPreferenceClickListener {
|
||||||
|
@ -279,7 +281,8 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
||||||
true,
|
true,
|
||||||
{}) {
|
{}) {
|
||||||
try {
|
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()
|
activity?.recreate()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
logError(e)
|
logError(e)
|
||||||
|
@ -293,7 +296,8 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
||||||
val prefValues = resources.getStringArray(R.array.themes_overlay_names_values)
|
val prefValues = resources.getStringArray(R.array.themes_overlay_names_values)
|
||||||
val settingsManager = PreferenceManager.getDefaultSharedPreferences(context)
|
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(
|
context?.showBottomDialog(
|
||||||
prefNames.toList(),
|
prefNames.toList(),
|
||||||
prefValues.indexOf(currentLayout),
|
prefValues.indexOf(currentLayout),
|
||||||
|
@ -301,7 +305,8 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
||||||
true,
|
true,
|
||||||
{}) {
|
{}) {
|
||||||
try {
|
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()
|
activity?.recreate()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
logError(e)
|
logError(e)
|
||||||
|
@ -315,7 +320,8 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
||||||
val prefValues = resources.getStringArray(R.array.themes_names_values)
|
val prefValues = resources.getStringArray(R.array.themes_names_values)
|
||||||
val settingsManager = PreferenceManager.getDefaultSharedPreferences(context)
|
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(
|
context?.showBottomDialog(
|
||||||
prefNames.toList(),
|
prefNames.toList(),
|
||||||
prefValues.indexOf(currentLayout),
|
prefValues.indexOf(currentLayout),
|
||||||
|
@ -323,7 +329,8 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
||||||
true,
|
true,
|
||||||
{}) {
|
{}) {
|
||||||
try {
|
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()
|
activity?.recreate()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
logError(e)
|
logError(e)
|
||||||
|
@ -338,14 +345,18 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
||||||
val settingsManager = PreferenceManager.getDefaultSharedPreferences(context)
|
val settingsManager = PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
|
|
||||||
val currentQuality =
|
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(
|
context?.showBottomDialog(
|
||||||
prefNames.toList(),
|
prefNames.toList(),
|
||||||
prefValues.indexOf(currentQuality),
|
prefValues.indexOf(currentQuality),
|
||||||
getString(R.string.watch_quality_pref),
|
getString(R.string.watch_quality_pref),
|
||||||
true,
|
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
|
return@setOnPreferenceClickListener true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue