diff --git a/res/layout/draggable_row.xml b/res/layout/draggable_row.xml
index 1d54c7a0..4432f4a4 100644
--- a/res/layout/draggable_row.xml
+++ b/res/layout/draggable_row.xml
@@ -34,6 +34,15 @@ along with this program. If not, see .
android:layout_height="44dip"
android:visibility="invisible"
android:background="@color/now_playing_marker" />
+
0)
mTextView.setWidth(pixelFree);
@@ -116,18 +120,33 @@ public class DraggableRow extends LinearLayout implements Checkable {
/**
* Changes the visibility of the checkbox
+ *
* @param state show or destroy the checkbox
*/
public void showCheckBox(boolean state) {
if (mShowCheckBox != state) {
- mCheckBox.setVisibility( state ? View.VISIBLE : View.GONE);
+ mCheckBox.setVisibility( state ? View.VISIBLE : View.GONE );
mShowCheckBox = state;
setupTextView(true);
}
}
+ /**
+ * Change the visibility of the cover view
+ *
+ * @param state show or hide the cover view
+ */
+ public void showCoverView(boolean state) {
+ if (mShowCover != state) {
+ mCoverView.setVisibility( state ? View.VISIBLE : View.GONE );
+ mShowCover = state;
+ setupTextView(true);
+ }
+ }
+
/**
* Change visibility of dragger element
+ *
* @param state shows or hides the dragger
*/
public void showDragger(boolean state) {
@@ -141,4 +160,11 @@ public class DraggableRow extends LinearLayout implements Checkable {
return mTextView;
}
+ /**
+ * Returns an instance of our coverview
+ */
+ public LazyCoverView getCoverView() {
+ return mCoverView;
+ }
+
}
diff --git a/src/ch/blinkenlights/android/vanilla/ShowQueueActivity.java b/src/ch/blinkenlights/android/vanilla/ShowQueueActivity.java
index be6315bd..d6cafbd6 100644
--- a/src/ch/blinkenlights/android/vanilla/ShowQueueActivity.java
+++ b/src/ch/blinkenlights/android/vanilla/ShowQueueActivity.java
@@ -48,7 +48,7 @@ public class ShowQueueActivity extends PlaybackActivity
mService = PlaybackService.get(this);
mListView = (DragSortListView) findViewById(R.id.list);
- listAdapter = new ShowQueueAdapter(this, R.layout.draggable_row);
+ listAdapter = new ShowQueueAdapter(this, R.layout.draggable_row, mHandler.getLooper());
mListView.setAdapter(listAdapter);
mListView.setDropListener(onDrop);
mListView.setRemoveListener(onRemove);
diff --git a/src/ch/blinkenlights/android/vanilla/ShowQueueAdapter.java b/src/ch/blinkenlights/android/vanilla/ShowQueueAdapter.java
index 9d75d28a..bb9d431f 100644
--- a/src/ch/blinkenlights/android/vanilla/ShowQueueAdapter.java
+++ b/src/ch/blinkenlights/android/vanilla/ShowQueueAdapter.java
@@ -19,6 +19,7 @@ package ch.blinkenlights.android.vanilla;
import android.content.Context;
import android.app.Activity;
+import android.os.Looper;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
@@ -35,14 +36,16 @@ public class ShowQueueAdapter
extends ArrayAdapter
{
- int mResource;
- int mHighlightRow;
- Context mContext;
+ private int mResource;
+ private int mHighlightRow;
+ private Context mContext;
+ private Looper mLooper;
- public ShowQueueAdapter(Context context, int resource) {
+ public ShowQueueAdapter(Context context, int resource, Looper looper) {
super(context, resource);
mResource = resource;
mContext = context;
+ mLooper = looper;
mHighlightRow = -1;
}
@@ -64,6 +67,8 @@ public class ShowQueueAdapter
} else {
LayoutInflater inflater = ((Activity)mContext).getLayoutInflater();
row = (DraggableRow)inflater.inflate(mResource, parent, false);
+ row.showCoverView(true);
+ row.getCoverView().setup(mLooper);
}
Song song = getItem(position);
@@ -74,6 +79,7 @@ public class ShowQueueAdapter
sb.append(song.album+", "+song.artist);
sb.setSpan(new ForegroundColorSpan(Color.GRAY), song.title.length() + 1, sb.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
row.getTextView().setText(sb);
+ row.getCoverView().setCover(MediaUtils.TYPE_ALBUM, song.albumId);
}
row.highlightRow(position == mHighlightRow);