Commit f3ae5aff authored by Sébastien Toque's avatar Sébastien Toque

UI: Alternative gradients on items in media lists + some orange for subitems

parent 4a9d0d9a
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:angle="270"
android:centerColor="@color/item_1"
android:endColor="@color/item_common"
android:startColor="@color/item_common" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:angle="270"
android:centerColor="@color/item_2"
android:endColor="@color/item_common"
android:startColor="@color/item_common" />
</shape>
\ No newline at end of file
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical"> android:orientation="vertical"
android:background="@color/item_common">
<HorizontalScrollView <HorizontalScrollView
android:id="@+id/header" android:id="@+id/header"
android:scrollbars="none" android:scrollbars="none"
...@@ -62,23 +63,34 @@ ...@@ -62,23 +63,34 @@
android:id="@+id/songs_list" android:id="@+id/songs_list"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:divider="@color/item_common"
android:dividerHeight="1dp"
android:fastScrollEnabled="true" /> android:fastScrollEnabled="true" />
<ExpandableListView <ExpandableListView
android:id="@+id/artists_list" android:id="@+id/artists_list"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:divider="@color/item_common"
android:childDivider="@color/item_common"
android:dividerHeight="1dp"
android:groupIndicator="@null" android:groupIndicator="@null"
android:fastScrollEnabled="true" /> android:fastScrollEnabled="true" />
<ExpandableListView <ExpandableListView
android:id="@+id/albums_list" android:id="@+id/albums_list"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:divider="@color/item_common"
android:childDivider="@color/item_common"
android:dividerHeight="1dp"
android:groupIndicator="@null" android:groupIndicator="@null"
android:fastScrollEnabled="true" /> android:fastScrollEnabled="true" />
<ExpandableListView <ExpandableListView
android:id="@+id/genres_list" android:id="@+id/genres_list"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:divider="@color/item_common"
android:childDivider="@color/item_common"
android:dividerHeight="1dp"
android:groupIndicator="@null" android:groupIndicator="@null"
android:fastScrollEnabled="true" /> android:fastScrollEnabled="true" />
</org.videolan.vlc.widget.FlingViewGroup> </org.videolan.vlc.widget.FlingViewGroup>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_item"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_item"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" > android:orientation="horizontal" >
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_item"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:orientation="horizontal" >
android:orientation="vertical" >
<TextView <View
android:id="@+id/title" android:layout_width="5dip"
android:layout_width="wrap_content" android:layout_height="fill_parent"
android:layout_height="wrap_content" android:layout_marginLeft="5dip"
android:layout_marginLeft="25dip" android:background="@color/orange" />
android:layout_marginRight="5dip"
android:layout_marginTop="5dip"
android:text="@string/title"
android:textColor="#ffffff"
android:textSize="20dip" />
<TextView <LinearLayout
android:id="@+id/text" android:layout_width="0dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="25dip" android:layout_weight="1"
android:layout_marginRight="5dip" android:gravity="center_vertical"
android:layout_marginBottom="5dip" android:orientation="vertical" >
android:text="@string/songs"
android:textColor="#888888" <TextView
android:textSize="14dip" /> android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dip"
android:layout_marginRight="5dip"
android:layout_marginTop="5dip"
android:text="@string/title"
android:textColor="#ffffff"
android:textSize="20dip" />
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dip"
android:layout_marginLeft="15dip"
android:layout_marginRight="5dip"
android:text="@string/songs"
android:textColor="#888888"
android:textSize="14dip" />
</LinearLayout>
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:background="@color/item_common"
android:orientation="vertical" > android:orientation="vertical" >
<LinearLayout <LinearLayout
...@@ -36,6 +37,8 @@ ...@@ -36,6 +37,8 @@
android:id="@id/android:list" android:id="@id/android:list"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:divider="@color/item_common"
android:dividerHeight="1dp"
android:fastScrollEnabled="true" /> android:fastScrollEnabled="true" />
<TextView <TextView
......
...@@ -2,11 +2,14 @@ ...@@ -2,11 +2,14 @@
<LinearLayout <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent"> android:layout_height="fill_parent"
android:background="@color/item_common">
<ListView <ListView
android:id="@id/android:list" android:id="@id/android:list"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:divider="@color/item_common"
android:dividerHeight="1dp"
android:fastScrollEnabled="true" /> android:fastScrollEnabled="true" />
<FrameLayout <FrameLayout
android:id="@id/android:empty" android:id="@id/android:empty"
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_item"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="item_common">#F111</color>
<color name="item_1">#F222</color>
<color name="item_2">#F000</color>
<color name="orange">#FFF48B00</color>
</resources>
\ No newline at end of file
...@@ -27,6 +27,7 @@ import java.text.DecimalFormat; ...@@ -27,6 +27,7 @@ import java.text.DecimalFormat;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.net.Uri; import android.net.Uri;
import android.view.View;
import android.widget.Toast; import android.widget.Toast;
public class Util { public class Util {
...@@ -159,4 +160,10 @@ public class Util { ...@@ -159,4 +160,10 @@ public class Util {
{ {
return (string != null && string.length() > 0) ? string : context.getString(defaultId); return (string != null && string.length() > 0) ? string : context.getString(defaultId);
} }
public static void setItemBackground(View v, int position) {
v.setBackgroundResource(position % 2 == 0
? R.drawable.background_item1
: R.drawable.background_item2);
}
} }
...@@ -26,6 +26,7 @@ import java.util.List; ...@@ -26,6 +26,7 @@ import java.util.List;
import org.videolan.vlc.Media; import org.videolan.vlc.Media;
import org.videolan.vlc.R; import org.videolan.vlc.R;
import org.videolan.vlc.Util;
import android.content.Context; import android.content.Context;
import android.content.res.Resources; import android.content.res.Resources;
...@@ -150,6 +151,7 @@ public class AudioPlaylistAdapter extends BaseExpandableListAdapter { ...@@ -150,6 +151,7 @@ public class AudioPlaylistAdapter extends BaseExpandableListAdapter {
if (v == null) { if (v == null) {
v = mInflater.inflate(R.layout.audio_browser_playlist, parent, false); v = mInflater.inflate(R.layout.audio_browser_playlist, parent, false);
holder = new GroupViewHolder(); holder = new GroupViewHolder();
holder.layout = (View) v.findViewById(R.id.layout_item);
holder.title = (TextView) v.findViewById(R.id.title); holder.title = (TextView) v.findViewById(R.id.title);
holder.text = (TextView) v.findViewById(R.id.text); holder.text = (TextView) v.findViewById(R.id.text);
holder.more = (ImageView) v.findViewById(R.id.more); holder.more = (ImageView) v.findViewById(R.id.more);
...@@ -162,6 +164,7 @@ public class AudioPlaylistAdapter extends BaseExpandableListAdapter { ...@@ -162,6 +164,7 @@ public class AudioPlaylistAdapter extends BaseExpandableListAdapter {
int countMedia = mGroups.get(name).get(null).size(); int countMedia = mGroups.get(name).get(null).size();
Resources res = mContext.getResources(); Resources res = mContext.getResources();
Util.setItemBackground(holder.layout, groupPosition);
holder.title.setText(name); holder.title.setText(name);
if (count > 2) if (count > 2)
holder.text.setText(res.getQuantityString(mGroupTextId, count - 1, count - 1)); holder.text.setText(res.getQuantityString(mGroupTextId, count - 1, count - 1));
...@@ -185,6 +188,7 @@ public class AudioPlaylistAdapter extends BaseExpandableListAdapter { ...@@ -185,6 +188,7 @@ public class AudioPlaylistAdapter extends BaseExpandableListAdapter {
if (v == null) { if (v == null) {
v = mInflater.inflate(R.layout.audio_browser_playlist_child, parent, false); v = mInflater.inflate(R.layout.audio_browser_playlist_child, parent, false);
holder = new ChildViewHolder(); holder = new ChildViewHolder();
holder.layout = (View) v.findViewById(R.id.layout_item);
holder.title = (TextView) v.findViewById(R.id.title); holder.title = (TextView) v.findViewById(R.id.title);
holder.text = (TextView) v.findViewById(R.id.text); holder.text = (TextView) v.findViewById(R.id.text);
v.setTag(holder); v.setTag(holder);
...@@ -197,6 +201,7 @@ public class AudioPlaylistAdapter extends BaseExpandableListAdapter { ...@@ -197,6 +201,7 @@ public class AudioPlaylistAdapter extends BaseExpandableListAdapter {
int count = list.size(); int count = list.size();
Resources res = mContext.getResources(); Resources res = mContext.getResources();
Util.setItemBackground(holder.layout, childPosition);
if (name != null) if (name != null)
holder.title.setText(name); holder.title.setText(name);
else else
...@@ -207,12 +212,14 @@ public class AudioPlaylistAdapter extends BaseExpandableListAdapter { ...@@ -207,12 +212,14 @@ public class AudioPlaylistAdapter extends BaseExpandableListAdapter {
} }
static class GroupViewHolder { static class GroupViewHolder {
View layout;
TextView title; TextView title;
TextView text; TextView text;
ImageView more; ImageView more;
} }
static class ChildViewHolder { static class ChildViewHolder {
View layout;
TextView title; TextView title;
TextView text; TextView text;
} }
......
...@@ -25,6 +25,7 @@ import java.util.List; ...@@ -25,6 +25,7 @@ import java.util.List;
import org.videolan.vlc.Media; import org.videolan.vlc.Media;
import org.videolan.vlc.R; import org.videolan.vlc.R;
import org.videolan.vlc.Util;
import android.content.Context; import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
...@@ -69,6 +70,7 @@ public class AudioSongsListAdapter extends ArrayAdapter<Media> { ...@@ -69,6 +70,7 @@ public class AudioSongsListAdapter extends ArrayAdapter<Media> {
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = inflater.inflate(R.layout.audio_browser_item, parent, false); v = inflater.inflate(R.layout.audio_browser_item, parent, false);
holder = new ViewHolder(); holder = new ViewHolder();
holder.layout = (View) v.findViewById(R.id.layout_item);
holder.title = (TextView) v.findViewById(R.id.title); holder.title = (TextView) v.findViewById(R.id.title);
holder.artist = (TextView) v.findViewById(R.id.artist); holder.artist = (TextView) v.findViewById(R.id.artist);
v.setTag(holder); v.setTag(holder);
...@@ -76,6 +78,7 @@ public class AudioSongsListAdapter extends ArrayAdapter<Media> { ...@@ -76,6 +78,7 @@ public class AudioSongsListAdapter extends ArrayAdapter<Media> {
holder = (ViewHolder) v.getTag(); holder = (ViewHolder) v.getTag();
Media media = getItem(position); Media media = getItem(position);
Util.setItemBackground(holder.layout, position);
holder.title.setText(media.getTitle()); holder.title.setText(media.getTitle());
holder.title.setTextColor(mCurrentIndex == position ? 0xFFF48B00 /* ORANGE */ : Color.WHITE); holder.title.setTextColor(mCurrentIndex == position ? 0xFFF48B00 /* ORANGE */ : Color.WHITE);
holder.artist.setText(media.getArtist() + " - " + media.getAlbum()); holder.artist.setText(media.getArtist() + " - " + media.getAlbum());
...@@ -98,6 +101,7 @@ public class AudioSongsListAdapter extends ArrayAdapter<Media> { ...@@ -98,6 +101,7 @@ public class AudioSongsListAdapter extends ArrayAdapter<Media> {
} }
static class ViewHolder { static class ViewHolder {
View layout;
TextView title; TextView title;
TextView artist; TextView artist;
} }
......
...@@ -122,6 +122,7 @@ public class VideoListAdapter extends ArrayAdapter<Media> ...@@ -122,6 +122,7 @@ public class VideoListAdapter extends ArrayAdapter<Media>
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = inflater.inflate(R.layout.video_list_item, parent, false); v = inflater.inflate(R.layout.video_list_item, parent, false);
holder = new ViewHolder(); holder = new ViewHolder();
holder.layout = (View) v.findViewById(R.id.layout_item);
holder.thumbnail = (ImageView) v.findViewById(R.id.ml_item_thumbnail); holder.thumbnail = (ImageView) v.findViewById(R.id.ml_item_thumbnail);
holder.length = (TextView) v.findViewById(R.id.ml_item_length); holder.length = (TextView) v.findViewById(R.id.ml_item_length);
holder.title = (TextView) v.findViewById(R.id.ml_item_title); holder.title = (TextView) v.findViewById(R.id.ml_item_title);
...@@ -131,6 +132,7 @@ public class VideoListAdapter extends ArrayAdapter<Media> ...@@ -131,6 +132,7 @@ public class VideoListAdapter extends ArrayAdapter<Media>
holder = (ViewHolder) v.getTag(); holder = (ViewHolder) v.getTag();
Media media = getItem(position); Media media = getItem(position);
Util.setItemBackground(holder.layout, position);
holder.title.setText(media.getTitle()); holder.title.setText(media.getTitle());
holder.length.setText(" " + Util.millisToString(media.getLength()) + " "); holder.length.setText(" " + Util.millisToString(media.getLength()) + " ");
...@@ -163,6 +165,7 @@ public class VideoListAdapter extends ArrayAdapter<Media> ...@@ -163,6 +165,7 @@ public class VideoListAdapter extends ArrayAdapter<Media>
}; };
static class ViewHolder { static class ViewHolder {
View layout;
ImageView thumbnail; ImageView thumbnail;
TextView length; TextView length;
TextView title; TextView title;
......
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