[Android] Fix IllegalStateException
Nicolas Pomepuy
git at videolan.org
Thu Oct 17 13:38:14 UTC 2024
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Oct 17 10:00:29 2024 +0200| [3daead8e571c0e7c861172024cb2d17f011f6ca8] | committer: Duncan McNamara
Fix IllegalStateException
> https://code.videolan.org/videolan/vlc-android/commit/3daead8e571c0e7c861172024cb2d17f011f6ca8
---
.../television/ui/preferences/PreferencesRemoteAccess.kt | 11 ++++++++++-
.../videolan/vlc/gui/preferences/PreferencesRemoteAccess.kt | 11 ++++++++++-
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesRemoteAccess.kt b/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesRemoteAccess.kt
index aafcef6e3c..51aa570e59 100644
--- a/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesRemoteAccess.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesRemoteAccess.kt
@@ -56,13 +56,22 @@ class PreferencesRemoteAccess : BasePreferenceFragment(), SharedPreferences.OnSh
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- preferenceScreen.sharedPreferences!!.registerOnSharedPreferenceChangeListener(this)
if(!settings.getBoolean(REMOTE_ACCESS_ONBOARDING, false)) {
settings.putSingle(REMOTE_ACCESS_ONBOARDING, true)
startActivity(Intent(Intent.ACTION_VIEW).apply { setClassName(activity, REMOTE_ACCESS_ONBOARDING) })
}
}
+ override fun onStart() {
+ super.onStart()
+ preferenceScreen.sharedPreferences!!.registerOnSharedPreferenceChangeListener(this)
+ }
+
+ override fun onStop() {
+ super.onStop()
+ preferenceScreen.sharedPreferences!!.unregisterOnSharedPreferenceChangeListener(this)
+ }
+
override fun onCreatePreferences(bundle: Bundle?, s: String?) {
super.onCreatePreferences(bundle, s)
settings = Settings.getInstance(activity)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesRemoteAccess.kt b/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesRemoteAccess.kt
index bc756cce59..967f784579 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesRemoteAccess.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesRemoteAccess.kt
@@ -56,13 +56,22 @@ class PreferencesRemoteAccess : BasePreferenceFragment(), SharedPreferences.OnSh
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setHasOptionsMenu(true)
- preferenceScreen.sharedPreferences!!.registerOnSharedPreferenceChangeListener(this)
if(!settings.getBoolean(REMOTE_ACCESS_ONBOARDING, false)) {
settings.putSingle(REMOTE_ACCESS_ONBOARDING, true)
startActivity(Intent(Intent.ACTION_VIEW).apply { setClassName(requireActivity(), REMOTE_ACCESS_ONBOARDING) })
}
}
+ override fun onStart() {
+ super.onStart()
+ preferenceScreen.sharedPreferences!!.registerOnSharedPreferenceChangeListener(this)
+ }
+
+ override fun onStop() {
+ super.onStop()
+ preferenceScreen.sharedPreferences!!.unregisterOnSharedPreferenceChangeListener(this)
+ }
+
override fun onCreatePreferences(bundle: Bundle?, s: String?) {
super.onCreatePreferences(bundle, s)
settings = Settings.getInstance(requireActivity())
More information about the Android
mailing list