[Android] Preferences: workaround to the old android version bug of the wrong background color of the child preference screen

Adrien Maglo git at videolan.org
Mon Jan 27 20:59:05 CET 2014


vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Mon Jan 27 20:58:55 2014 +0100| [4798567f1c1c726d495b4dc885e72474857a1b19] | committer: Adrien Maglo

Preferences: workaround to the old android version bug of the wrong background color of the child preference screen

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=4798567f1c1c726d495b4dc885e72474857a1b19
---

 .../src/org/videolan/vlc/gui/PreferencesActivity.java    |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java b/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
index 5522594..47d35ff 100644
--- a/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
@@ -44,6 +44,7 @@ import android.preference.Preference.OnPreferenceChangeListener;
 import android.preference.Preference.OnPreferenceClickListener;
 import android.preference.PreferenceActivity;
 import android.preference.PreferenceManager;
+import android.preference.PreferenceScreen;
 import android.widget.Toast;
 
 @SuppressWarnings("deprecation")
@@ -243,6 +244,19 @@ public class PreferencesActivity extends PreferenceActivity implements OnSharedP
     }
 
     @Override
+    public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference)
+    {
+        super.onPreferenceTreeClick(preferenceScreen, preference);
+        if (preference!=null)
+            if (preference instanceof PreferenceScreen)
+                if (((PreferenceScreen)preference).getDialog()!=null)
+                    ((PreferenceScreen)preference).getDialog().getWindow().getDecorView()
+                    .setBackgroundDrawable(this.getWindow().getDecorView().getBackground()
+                            .getConstantState().newDrawable());
+        return false;
+    }
+
+    @Override
     protected void onResume() {
         super.onResume();
         AudioServiceController.getInstance().bindAudioService(this);



More information about the Android mailing list