mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 22:00: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
|
||||
|
||||
private var isCurrentViewMainSettings = true
|
||||
private var requireMainActivityRestart = false
|
||||
|
||||
class SettingsActivity :
|
||||
AppCompatActivity(),
|
||||
@ -243,11 +244,13 @@ class SettingsActivity :
|
||||
themeToggle?.setOnPreferenceChangeListener { _, _ ->
|
||||
val refresh = Intent(context, SettingsActivity::class.java)
|
||||
startActivity(refresh)
|
||||
requireMainActivityRestart = true
|
||||
true
|
||||
}
|
||||
|
||||
val accentColor = findPreference<Preference>("accent_color")
|
||||
accentColor?.setOnPreferenceChangeListener { _, _ ->
|
||||
requireMainActivityRestart = true
|
||||
val refresh = Intent(context, SettingsActivity::class.java)
|
||||
startActivity(refresh)
|
||||
true
|
||||
@ -259,9 +262,9 @@ class SettingsActivity :
|
||||
true
|
||||
}
|
||||
|
||||
val changeLanguage = findPreference<ListPreference>("language")
|
||||
changeLanguage?.setOnPreferenceChangeListener { _, _ ->
|
||||
restartMainActivity(requireContext())
|
||||
val gridColumns = findPreference<ListPreference>("grid")
|
||||
gridColumns?.setOnPreferenceChangeListener { _, _ ->
|
||||
requireMainActivityRestart = true
|
||||
true
|
||||
}
|
||||
|
||||
@ -384,7 +387,13 @@ class SettingsActivity :
|
||||
if (isCurrentViewMainSettings) {
|
||||
PreferenceManager.getDefaultSharedPreferences(this)
|
||||
.unregisterOnSharedPreferenceChangeListener(this)
|
||||
restartMainActivity(this)
|
||||
if (requireMainActivityRestart) {
|
||||
restartMainActivity(this)
|
||||
finishAffinity()
|
||||
} else {
|
||||
super.onBackPressed()
|
||||
}
|
||||
finishAndRemoveTask()
|
||||
} else {
|
||||
isCurrentViewMainSettings = true
|
||||
supportFragmentManager
|
||||
|
Loading…
Reference in New Issue
Block a user