[Android] Advanced options: use the right styles for the black and light themes
Adrien Maglo
git at videolan.org
Mon Mar 10 12:19:51 CET 2014
vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Mon Mar 10 12:19:45 2014 +0100| [619562a34c1a1233fb730bfbb38748f0cae86194] | committer: Adrien Maglo
Advanced options: use the right styles for the black and light themes
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=619562a34c1a1233fb730bfbb38748f0cae86194
---
vlc-android/res/values/attrs.xml | 2 ++
vlc-android/res/values/styles.xml | 14 ++++++++++----
vlc-android/src/org/videolan/vlc/gui/CommonDialogs.java | 9 +++------
3 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/vlc-android/res/values/attrs.xml b/vlc-android/res/values/attrs.xml
index 2336233..b27afb5 100644
--- a/vlc-android/res/values/attrs.xml
+++ b/vlc-android/res/values/attrs.xml
@@ -46,6 +46,8 @@
<attr name="header_fadein_overlay" format="reference" />
<attr name="header_fadeout_overlay" format="reference" />
+ <attr name="advanced_options_style" format="reference" />
+
<declare-styleable name="SlidingPaneLayout">
<attr name="overhangSize" format="dimension" />
</declare-styleable>
diff --git a/vlc-android/res/values/styles.xml b/vlc-android/res/values/styles.xml
index e64ff25..fa1c631 100644
--- a/vlc-android/res/values/styles.xml
+++ b/vlc-android/res/values/styles.xml
@@ -57,6 +57,8 @@
<item name="ic_pause">@drawable/ic_pause</item>
<item name="ic_previous">@drawable/ic_previous</item>
<item name="ic_next">@drawable/ic_next</item>
+
+ <item name="advanced_options_style">@style/Theme.VLC.AdvancedOptionsLight</item>
</style>
<style name="Theme.VLC.Black" parent="Theme.Sherlock">
@@ -108,6 +110,8 @@
<item name="ic_pause">@drawable/ic_pause_w</item>
<item name="ic_previous">@drawable/ic_previous_w</item>
<item name="ic_next">@drawable/ic_next_w</item>
+
+ <item name="advanced_options_style">@style/Theme.VLC.AdvancedOptionsBlack</item>
</style>
<style name="Theme.VLC.List">
@@ -129,6 +133,8 @@
<style name="Theme.VLC.Fullscreen" parent="android:Theme.NoTitleBar.Fullscreen">
<item name="android:windowBackground">@color/black</item>
<item name="video_player_overlay">@color/transparent_gray</item>
+
+ <item name="advanced_options_style">@style/Theme.VLC.AdvancedOptionsBlack</item>
</style>
<style name="ActionBar" parent="Widget.Sherlock.Light.ActionBar">
@@ -155,8 +161,8 @@
<item name="android:windowNoTitle">true</item>
</style>
- <style name="Theme.VLC.AdvancedOptionsAudio" parent="Theme.VLC.AdvancedOptions">
- <item name="android:windowBackground">@drawable/advanced_options_audio_background</item>
+ <style name="Theme.VLC.AdvancedOptionsLight" parent="Theme.VLC.AdvancedOptions">
+ <item name="android:windowBackground">@drawable/abs__menu_dropdown_panel_holo_light</item>
<item name="android:textColor">@color/black</item>
<item name="advanced_options_divider">@color/darkgrey</item>
<item name="ic_speed_normal_style">@drawable/ic_speed_normal</item>
@@ -168,8 +174,8 @@
</style>
- <style name="Theme.VLC.AdvancedOptionsVideo" parent="Theme.VLC.AdvancedOptions">
- <item name="android:windowBackground">@drawable/advanced_options_video_background</item>
+ <style name="Theme.VLC.AdvancedOptionsBlack" parent="Theme.VLC.AdvancedOptions">
+ <item name="android:windowBackground">@drawable/abs__menu_dropdown_panel_holo_dark</item>
<item name="android:textColor">@color/white</item>
<item name="advanced_options_divider">@color/white</item>
<item name="ic_speed_normal_style">@drawable/ic_speed_normal_w</item>
diff --git a/vlc-android/src/org/videolan/vlc/gui/CommonDialogs.java b/vlc-android/src/org/videolan/vlc/gui/CommonDialogs.java
index 662fbd6..4ab42ae 100644
--- a/vlc-android/src/org/videolan/vlc/gui/CommonDialogs.java
+++ b/vlc-android/src/org/videolan/vlc/gui/CommonDialogs.java
@@ -25,6 +25,7 @@ import java.net.URI;
import java.net.URISyntaxException;
import org.videolan.vlc.R;
+import org.videolan.vlc.Util;
import org.videolan.vlc.VlcRunnable;
import org.videolan.vlc.interfaces.OnExpandableListener;
import org.videolan.vlc.widget.ExpandableLayout;
@@ -85,8 +86,7 @@ public class CommonDialogs {
public static void advancedOptions(final Context context, View v, MenuType t) {
- int style = t == MenuType.Video ?
- R.style.Theme_VLC_AdvancedOptionsVideo : R.style.Theme_VLC_AdvancedOptionsAudio;
+ int style = Util.getResourceFromAttribute(context, R.attr.advanced_options_style);
final Dialog dialog = new Dialog(context, style);
dialog.setContentView(R.layout.advanced_options);
@@ -162,12 +162,9 @@ public class CommonDialogs {
// show dialog
dialog.show();
- // force size
+ // force location
float density = context.getResources().getDisplayMetrics().density;
LayoutParams lp = dialog.getWindow().getAttributes();
- lp.width = (int) (density * 300 + 0.5f); // 300dp
-
- // force location
if (v != null) {
lp.gravity = Gravity.TOP | Gravity.LEFT;
int[] location = new int[2];
More information about the Android
mailing list