[Android] Styles: add an ugly black theme.

Adrien Maglo git at videolan.org
Mon Feb 24 15:09:16 CET 2014


vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Mon Feb 24 15:08:49 2014 +0100| [940e7dae04479116bba6c3ae3fe3b593720975f6] | committer: Adrien Maglo

Styles: add an ugly black theme.

Please change the drawables and colors.

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

 vlc-android/res/values/strings.xml                         |    2 ++
 vlc-android/res/values/styles.xml                          |    8 ++++++++
 vlc-android/res/xml/preferences.xml                        |    5 +++++
 vlc-android/src/org/videolan/vlc/gui/MainActivity.java     |   10 ++++++++++
 .../src/org/videolan/vlc/gui/PreferencesActivity.java      |   12 ++++++++++++
 5 files changed, 37 insertions(+)

diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index 251ab97..00ad781 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -197,6 +197,8 @@
     <string name="enable_jump_buttons_summary">Show backward and forward buttons on the video interface</string>
     <string name="enable_steal_remote_control">Exclusive headset remote control</string>
     <string name="enable_steal_remote_control_summary">Avoid conflicts by stealing the remote control from other apps. This prevents dialing on double click on HTC phones.</string>
+    <string name="enable_black_theme">Enable the black theme</string>
+    <string name="enable_black_theme_summary">Change the interface colors for a better comfort in low light environments.</string>
     <string name="performance_prefs_category">Performance</string>
     <string name="chroma_format">Force video chroma</string>
     <string name="chroma_format_summary">RGB 32-bit: default chroma\nRGB 16-bit: better performance but lower quality\nYUV: best performance but does not work on all devices. Android 2.3 and later only.</string>
diff --git a/vlc-android/res/values/styles.xml b/vlc-android/res/values/styles.xml
index 537a2c9..e5a9464 100644
--- a/vlc-android/res/values/styles.xml
+++ b/vlc-android/res/values/styles.xml
@@ -39,6 +39,14 @@
         <item name="android:windowBackground">@color/background_common</item>
     </style>
 
+   <style name="Theme.VLC.Black" parent="Theme.VLC">
+        <item name="font_default">@color/white</item>
+        <item name="background_player">@color/font_default</item>
+        <item name="background_playlist">@color/font_default</item>
+        <item name="list_title">@color/bt_list_title</item>
+        <item name="android:windowBackground">@color/font_default</item>
+    </style>
+
     <style name="Theme.VLC.List">
         <item name="android:listSelector">@drawable/background_item</item>
     </style>
diff --git a/vlc-android/res/xml/preferences.xml b/vlc-android/res/xml/preferences.xml
index b3df7eb..03129b0 100644
--- a/vlc-android/res/xml/preferences.xml
+++ b/vlc-android/res/xml/preferences.xml
@@ -35,6 +35,11 @@
             android:key="enable_steal_remote_control"
             android:summary="@string/enable_steal_remote_control_summary"
             android:title="@string/enable_steal_remote_control" />
+        <CheckBoxPreference
+            android:defaultValue="false"
+            android:key="enable_black_theme"
+            android:summary="@string/enable_black_theme_summary"
+            android:title="@string/enable_black_theme" />
     </PreferenceCategory>
 
     <PreferenceCategory android:title="@string/performance_prefs_category" >
diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 2cbaefb..55488eb 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -186,6 +186,11 @@ public class MainActivity extends SherlockFragmentActivity {
         mMenu = (SlidingMenu) LayoutInflater.from(this).inflate(R.layout.sliding_menu, null);
         changeMenuOffset();
 
+        SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
+        boolean enableBlackTheme = pref.getBoolean("enable_black_theme", false);
+        if (enableBlackTheme)
+            setTheme(R.style.Theme_VLC_Black);
+
         View v_main = LayoutInflater.from(this).inflate(R.layout.main, null);
         setContentView(v_main);
 
@@ -660,6 +665,11 @@ public class MainActivity extends SherlockFragmentActivity {
         if (requestCode == ACTIVITY_RESULT_PREFERENCES) {
             if (resultCode == PreferencesActivity.RESULT_RESCAN)
                 MediaLibrary.getInstance(this).loadMediaItems(this, true);
+            else if (resultCode == PreferencesActivity.RESULT_RESTART) {
+                Intent intent = getIntent();
+                finish();
+                startActivity(intent);
+            }
         }
     }
 
diff --git a/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java b/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
index 95c5793..a3a4863 100644
--- a/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
@@ -60,6 +60,7 @@ public class PreferencesActivity extends PreferenceActivity implements OnSharedP
     public final static String VIDEO_RESUME_TIME = "VideoResumeTime";
     public final static String VIDEO_SUBTITLE_FILES = "VideoSubtitleFiles";
     public final static int RESULT_RESCAN = RESULT_FIRST_USER + 1;
+    public final static int RESULT_RESTART = RESULT_FIRST_USER + 2;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -116,6 +117,17 @@ public class PreferencesActivity extends PreferenceActivity implements OnSharedP
                     }
                 });
 
+        // Black theme
+        Preference checkboxBlackTheme = findPreference("enable_black_theme");
+        checkboxBlackTheme.setOnPreferenceClickListener(
+                new OnPreferenceClickListener() {
+                    @Override
+                    public boolean onPreferenceClick(Preference preference) {
+                        setResult(RESULT_RESTART);
+                        return true;
+                    }
+                });
+
         // Clear search history
         Preference clearHistoryPref = findPreference("clear_history");
         clearHistoryPref.setOnPreferenceClickListener(



More information about the Android mailing list