[Android] PreferencesFragment: no need to restart if hwaccel change

Thomas Guillem git at videolan.org
Thu Dec 22 20:50:22 CET 2016


vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Dec 22 20:44:30 2016 +0100| [654e1d623474aa6d3093f3bc1357c7ba511d3542] | committer: Thomas Guillem

PreferencesFragment: no need to restart if hwaccel change

> https://code.videolan.org/videolan/vlc-android/commit/654e1d623474aa6d3093f3bc1357c7ba511d3542
---

 .../videolan/vlc/gui/preferences/PreferencesFragment.java   | 13 +------------
 .../vlc/gui/tv/preferences/PreferencesFragment.java         | 13 +------------
 2 files changed, 2 insertions(+), 24 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesFragment.java b/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesFragment.java
index ab077b8..d79220f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesFragment.java
@@ -24,16 +24,14 @@
 package org.videolan.vlc.gui.preferences;
 
 import android.content.Intent;
-import android.content.SharedPreferences;
 import android.os.Bundle;
 import android.support.v7.preference.Preference;
 
 import org.videolan.vlc.R;
 import org.videolan.vlc.VLCApplication;
 import org.videolan.vlc.gui.SecondaryActivity;
-import org.videolan.vlc.util.VLCInstance;
 
-public class PreferencesFragment extends BasePreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
+public class PreferencesFragment extends BasePreferenceFragment {
 
     public final static String TAG = "VLC/PreferencesFragment";
 
@@ -52,7 +50,6 @@ public class PreferencesFragment extends BasePreferenceFragment implements Share
     @Override
     public void onStart() {
         super.onStart();
-        getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
     }
 
     @Override
@@ -61,14 +58,6 @@ public class PreferencesFragment extends BasePreferenceFragment implements Share
     }
 
     @Override
-    public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
-        if(key.equalsIgnoreCase("hardware_acceleration")) {
-            if (getActivity() != null )
-                ((PreferencesActivity)getActivity()).restartMediaPlayer();
-        }
-    }
-
-    @Override
     public boolean onPreferenceTreeClick(Preference preference) {
         switch (preference.getKey()){
             case "directories":
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesFragment.java b/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesFragment.java
index 97a50e6..77e0f96 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesFragment.java
@@ -25,7 +25,6 @@ package org.videolan.vlc.gui.tv.preferences;
 
 import android.annotation.TargetApi;
 import android.content.Intent;
-import android.content.SharedPreferences;
 import android.os.Build;
 import android.os.Bundle;
 import android.support.v7.preference.Preference;
@@ -33,10 +32,9 @@ import android.support.v7.preference.Preference;
 import org.videolan.vlc.R;
 import org.videolan.vlc.VLCApplication;
 import org.videolan.vlc.gui.SecondaryActivity;
-import org.videolan.vlc.util.VLCInstance;
 
 @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
-public class PreferencesFragment extends BasePreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
+public class PreferencesFragment extends BasePreferenceFragment {
 
     public final static String TAG = "VLC/PreferencesFragment";
 
@@ -55,7 +53,6 @@ public class PreferencesFragment extends BasePreferenceFragment implements Share
     @Override
     public void onStart() {
         super.onStart();
-        getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
     }
 
     @Override
@@ -65,14 +62,6 @@ public class PreferencesFragment extends BasePreferenceFragment implements Share
     }
 
     @Override
-    public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
-        if(key.equalsIgnoreCase("hardware_acceleration")) {
-            VLCInstance.restart();
-            if (getActivity() != null )
-                ((PreferencesActivity)getActivity()).restartMediaPlayer();
-        }
-    }
-    @Override
     public boolean onPreferenceTreeClick(Preference preference) {
         switch (preference.getKey()){
             case "directories":



More information about the Android mailing list