[Android] Workaround for statusbar color in dark theme

Geoffrey Métais git at videolan.org
Wed Nov 19 13:52:42 CET 2014


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Nov 19 13:21:15 2014 +0100| [ea33dcf6efbb5410bc7fa6f2fa1649ec580b8a6e] | committer: Geoffrey Métais

Workaround for statusbar color in dark theme

setTheme does not apply on statusbar color

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

 vlc-android/src/org/videolan/vlc/gui/MainActivity.java |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index d07db27..87d567b 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -60,6 +60,7 @@ import android.content.SharedPreferences.Editor;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager.NameNotFoundException;
 import android.content.res.Configuration;
+import android.graphics.Color;
 import android.os.Build;
 import android.os.Bundle;
 import android.os.Handler;
@@ -195,8 +196,13 @@ public class MainActivity extends ActionBarActivity {
 
         SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
         boolean enableBlackTheme = pref.getBoolean("enable_black_theme", false);
-        if (enableBlackTheme)
+        if (enableBlackTheme) {
             setTheme(R.style.Theme_VLC_Black);
+            //We need to manually change statusbar color, otherwise, it remains orange.
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+                getWindow().setStatusBarColor(Color.DKGRAY);
+            }
+        }
 
         View v_main = LayoutInflater.from(this).inflate(R.layout.main, null);
         setContentView(v_main);



More information about the Android mailing list