[Android] Audio player: create a specific layout for the playlist item drag shadow

Adrien Maglo git at videolan.org
Fri Jan 24 17:31:01 CET 2014


vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Fri Jan 24 17:12:16 2014 +0100| [4d5e69034b9d2f848f86e1977e32f1a9c4a9b114] | committer: Adrien Maglo

Audio player: create a specific layout for the playlist item drag shadow

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=4d5e69034b9d2f848f86e1977e32f1a9c4a9b114
---

 .../res/layout/audio_playlist_item_drag_shadow.xml |   62 ++++++++++++++++++++
 .../videolan/vlc/gui/audio/AudioPlaylistView.java  |    4 +-
 2 files changed, 63 insertions(+), 3 deletions(-)

diff --git a/vlc-android/res/layout/audio_playlist_item_drag_shadow.xml b/vlc-android/res/layout/audio_playlist_item_drag_shadow.xml
new file mode 100644
index 0000000..14a06c7
--- /dev/null
+++ b/vlc-android/res/layout/audio_playlist_item_drag_shadow.xml
@@ -0,0 +1,62 @@
+<?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:layout_weight="1"
+    android:orientation="horizontal"
+    android:paddingLeft="10dp"
+    android:background="@color/darkerorange" >
+
+    <LinearLayout
+        android:layout_width="0dip"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:gravity="center_vertical"
+        android:orientation="vertical" >
+
+        <TextView
+            android:id="@+id/title"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="5dip"
+            android:layout_marginRight="5dip"
+            android:layout_marginTop="5dip"
+            android:singleLine="true"
+            android:text="@string/title"
+            android:textColor="@color/list_title"
+            android:textSize="16sp" />
+
+        <TextView
+            android:id="@+id/artist"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginBottom="5dip"
+            android:layout_marginLeft="5dip"
+            android:layout_marginRight="5dip"
+            android:singleLine="true"
+            android:text="@string/artist"
+            android:textColor="@color/list_subtitle"
+            android:textSize="11sp" />
+    </LinearLayout>
+
+    <View
+        android:layout_width="1dp"
+        android:layout_height="match_parent"
+        android:layout_gravity="center"
+        android:layout_marginBottom="8dp"
+        android:layout_marginTop="8dp"
+        android:background="?attr/playlist_item_footer" />
+
+    <ImageButton
+        android:id="@+id/move"
+        android:layout_width="30dp"
+        android:layout_height="30dp"
+        android:layout_gravity="center"
+        android:layout_marginLeft="5dp"
+        android:layout_marginRight="5dp"
+        android:background="#00000000"
+        android:scaleType="fitXY"
+        android:src="@drawable/ic_move_media" />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlaylistView.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlaylistView.java
index 5b341ee..2069723 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlaylistView.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlaylistView.java
@@ -49,7 +49,7 @@ public class AudioPlaylistView extends ListView {
         mIsDragging = false;
 
         LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-        mDragShadow = inflater.inflate(R.layout.audio_playlist_item, this, false);
+        mDragShadow = inflater.inflate(R.layout.audio_playlist_item_drag_shadow, this, false);
     }
 
     @Override
@@ -136,10 +136,8 @@ public class AudioPlaylistView extends ListView {
         if (mDragShadow != null) {
             TextView titleView = (TextView)mDragShadow.findViewById(R.id.title);
             TextView artistView = (TextView)mDragShadow.findViewById(R.id.artist);
-            LinearLayout layout = (LinearLayout)mDragShadow.findViewById(R.id.layout_item);
             titleView.setText(title);
             artistView.setText(artist);
-            layout.setBackgroundResource(R.color.darkorange);
             mIsDragging = true;
         }
     }



More information about the Android mailing list