mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
Merge pull request #334 from Bnyro/master
player stops in settings fixed
This commit is contained in:
commit
15de27676a
@ -37,6 +37,7 @@ import org.json.JSONTokener
|
|||||||
import retrofit2.HttpException
|
import retrofit2.HttpException
|
||||||
|
|
||||||
private var isCurrentViewMainSettings = true
|
private var isCurrentViewMainSettings = true
|
||||||
|
private var requireMainActivityRestart = false
|
||||||
|
|
||||||
class SettingsActivity :
|
class SettingsActivity :
|
||||||
AppCompatActivity(),
|
AppCompatActivity(),
|
||||||
@ -243,11 +244,13 @@ class SettingsActivity :
|
|||||||
themeToggle?.setOnPreferenceChangeListener { _, _ ->
|
themeToggle?.setOnPreferenceChangeListener { _, _ ->
|
||||||
val refresh = Intent(context, SettingsActivity::class.java)
|
val refresh = Intent(context, SettingsActivity::class.java)
|
||||||
startActivity(refresh)
|
startActivity(refresh)
|
||||||
|
requireMainActivityRestart = true
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
val accentColor = findPreference<Preference>("accent_color")
|
val accentColor = findPreference<Preference>("accent_color")
|
||||||
accentColor?.setOnPreferenceChangeListener { _, _ ->
|
accentColor?.setOnPreferenceChangeListener { _, _ ->
|
||||||
|
requireMainActivityRestart = true
|
||||||
val refresh = Intent(context, SettingsActivity::class.java)
|
val refresh = Intent(context, SettingsActivity::class.java)
|
||||||
startActivity(refresh)
|
startActivity(refresh)
|
||||||
true
|
true
|
||||||
@ -259,9 +262,9 @@ class SettingsActivity :
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
val changeLanguage = findPreference<ListPreference>("language")
|
val gridColumns = findPreference<ListPreference>("grid")
|
||||||
changeLanguage?.setOnPreferenceChangeListener { _, _ ->
|
gridColumns?.setOnPreferenceChangeListener { _, _ ->
|
||||||
restartMainActivity(requireContext())
|
requireMainActivityRestart = true
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,7 +387,13 @@ class SettingsActivity :
|
|||||||
if (isCurrentViewMainSettings) {
|
if (isCurrentViewMainSettings) {
|
||||||
PreferenceManager.getDefaultSharedPreferences(this)
|
PreferenceManager.getDefaultSharedPreferences(this)
|
||||||
.unregisterOnSharedPreferenceChangeListener(this)
|
.unregisterOnSharedPreferenceChangeListener(this)
|
||||||
|
if (requireMainActivityRestart) {
|
||||||
restartMainActivity(this)
|
restartMainActivity(this)
|
||||||
|
finishAffinity()
|
||||||
|
} else {
|
||||||
|
super.onBackPressed()
|
||||||
|
}
|
||||||
|
finishAndRemoveTask()
|
||||||
} else {
|
} else {
|
||||||
isCurrentViewMainSettings = true
|
isCurrentViewMainSettings = true
|
||||||
supportFragmentManager
|
supportFragmentManager
|
||||||
|
Loading…
Reference in New Issue
Block a user