Commit f1d6ae33 authored by Adrien Maglo's avatar Adrien Maglo

GUI: define style attributes for the shadows.

Do not display shadows for the black theme.
parent 1f227566
......@@ -28,6 +28,9 @@
<attr name="ic_down_style" format="reference" />
<attr name="ic_up_style" format="reference" />
<attr name="mini_player_top_shadow" format="reference" />
<attr name="audio_playlist_shadow" format="reference" />
<declare-styleable name="SlidingPaneLayout">
<attr name="overhangSize" format="dimension" />
</declare-styleable>
......
......@@ -37,6 +37,9 @@
<item name="list_title_last">@color/list_title_last</item>
<item name="list_title">@color/list_title</item>
<item name="android:windowBackground">@color/background_common</item>
<item name="mini_player_top_shadow">@drawable/mini_player_top_shadow</item>
<item name="audio_playlist_shadow">@drawable/audio_playlist_shadow</item>
</style>
<style name="Theme.VLC.Black" parent="Theme.VLC">
......@@ -47,6 +50,9 @@
<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>
<item name="mini_player_top_shadow">@null</item>
<item name="audio_playlist_shadow">@null</item>
</style>
<style name="Theme.VLC.List">
......
......@@ -890,7 +890,9 @@ public class MainActivity extends SherlockFragmentActivity {
@Override
public void onPanelOpened() {
mSlidingPane.setShadowResource(R.drawable.mini_player_top_shadow);
int resId = Util.getResourceFromAttribute(MainActivity.this, R.attr.mini_player_top_shadow);
if (resId != 0)
mSlidingPane.setShadowResource(resId);
mAudioPlayer.setHeaderVisibilities(false, false, true, true, true);
mMenu.setSlidingEnabled(true);
}
......
......@@ -21,6 +21,7 @@
package org.videolan.vlc.gui.audio;
import org.videolan.vlc.R;
import org.videolan.vlc.Util;
import android.content.Context;
import android.graphics.Canvas;
......@@ -46,6 +47,8 @@ public class AudioPlaylistView extends ListView {
private OnItemRemovedListener mOnItemRemovedListener;
private OnItemLongClickListener mOnItemLongClickListener;
Drawable mShadowDrawable;
public AudioPlaylistView(Context context, AttributeSet attrs) {
super(context, attrs);
......@@ -53,6 +56,9 @@ public class AudioPlaylistView extends ListView {
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mDragShadow = inflater.inflate(R.layout.audio_playlist_item_drag_shadow, this, false);
int resId = Util.getResourceFromAttribute(context, R.attr.audio_playlist_shadow);
mShadowDrawable = resId != 0 ? getResources().getDrawable(resId) : null;
}
@Override
......@@ -139,9 +145,10 @@ public class AudioPlaylistView extends ListView {
public void draw(Canvas c) {
super.draw(c);
// Draw the top and bottom list shadows.
Drawable mShadowDrawable = getResources().getDrawable(R.drawable.audio_playlist_shadow);
if (mShadowDrawable == null)
return;
// Draw the top and bottom list shadows.
final int shadowHeight = mShadowDrawable.getIntrinsicHeight();
final int right = getRight();
final int left = getLeft();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment