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