[Android] [PATCH 3/4] Cardview for audio browsing
Geoffrey Métais
geoffrey.metais at gmail.com
Mon Nov 3 16:21:47 CET 2014
---
vlc-android/res/layout/audio_browser_card.xml | 70 ++++++++++++++++++++++
vlc-android/res/layout/audio_browser_item.xml | 66 --------------------
.../vlc/gui/audio/AudioBrowserListAdapter.java | 2 +-
3 files changed, 71 insertions(+), 67 deletions(-)
create mode 100644 vlc-android/res/layout/audio_browser_card.xml
delete mode 100644 vlc-android/res/layout/audio_browser_item.xml
diff --git a/vlc-android/res/layout/audio_browser_card.xml b/vlc-android/res/layout/audio_browser_card.xml
new file mode 100644
index 0000000..8393b97
--- /dev/null
+++ b/vlc-android/res/layout/audio_browser_card.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:card_view="http://schemas.android.com/apk/res-auto"
+ android:id="@+id/layout_item"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ card_view:cardUseCompatPadding="true"
+ card_view:cardElevation="1sp">
+
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/audio_browser_item_size" >
+
+ <ImageView
+ android:id="@+id/cover"
+ android:layout_width="@dimen/audio_browser_item_size"
+ android:layout_height="@dimen/audio_browser_item_size"
+ android:layout_gravity="center" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_toRightOf="@+id/cover"
+ android:layout_toLeftOf="@+id/item_more"
+ android:paddingLeft="10dp"
+ android:gravity="center_vertical"
+ android:orientation="vertical" >
+
+ <TextView
+ android:id="@+id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:singleLine="true"
+ android:ellipsize="middle"
+ android:maxLines="1"
+ android:text="@string/title"
+ android:textColor="?attr/list_title"
+ android:textSize="20sp" />
+
+ <TextView
+ android:id="@+id/subtitle"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:ellipsize="middle"
+ android:maxLines="1"
+ android:text="@string/artist"
+ android:textColor="?attr/list_subtitle"
+ android:textSize="14sp" />
+ </LinearLayout>
+
+ <ImageView
+ android:id="@+id/item_more"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerVertical="true"
+ android:layout_alignParentRight="true"
+ android:background="@drawable/ic_more_vert_grey600_24dp"
+ android:clickable="true" />
+ </RelativeLayout>
+
+ <View
+ android:id="@+id/footer"
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:background="?attr/item_footer" />
+
+</android.support.v7.widget.CardView>
\ No newline at end of file
diff --git a/vlc-android/res/layout/audio_browser_item.xml b/vlc-android/res/layout/audio_browser_item.xml
deleted file mode 100644
index 189d27c..0000000
--- a/vlc-android/res/layout/audio_browser_item.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<?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="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical" >
-
- <RelativeLayout
- android:layout_width="match_parent"
- android:layout_height="@dimen/audio_browser_item_size" >
-
- <ImageView
- android:id="@+id/cover"
- android:layout_width="@dimen/audio_browser_item_size"
- android:layout_height="@dimen/audio_browser_item_size"
- android:layout_gravity="center" />
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_toRightOf="@+id/cover"
- android:paddingLeft="10dp"
- android:gravity="center_vertical"
- android:orientation="vertical" >
-
- <TextView
- android:id="@+id/title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:singleLine="true"
- android:ellipsize="middle"
- android:maxLines="1"
- android:text="@string/title"
- android:textColor="?attr/list_title"
- android:textSize="20sp" />
-
- <TextView
- android:id="@+id/subtitle"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:singleLine="true"
- android:ellipsize="middle"
- android:maxLines="1"
- android:text="@string/artist"
- android:textColor="?attr/list_subtitle"
- android:textSize="14sp" />
- </LinearLayout>
-
- <ImageView
- android:id="@+id/item_more"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
- android:layout_alignParentRight="true"
- android:background="@drawable/ic_more"
- android:clickable="true" />
- </RelativeLayout>
-
- <View
- android:id="@+id/footer"
- android:layout_width="match_parent"
- android:layout_height="1dp"
- android:background="?attr/item_footer" />
-
-</LinearLayout>
\ No newline at end of file
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java
index 4e1056c..1312d84 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java
@@ -236,7 +236,7 @@ public class AudioBrowserListAdapter extends BaseAdapter implements SectionIndex
if (b_createView) {
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- v = inflater.inflate(R.layout.audio_browser_item, parent, false);
+ v = inflater.inflate(R.layout.audio_browser_card, parent, false);
holder = new ViewHolder();
holder.layout = v.findViewById(R.id.layout_item);
holder.title = (TextView) v.findViewById(R.id.title);
--
1.9.1
More information about the Android
mailing list