diff --git a/res/layout/draggable_row.xml b/res/layout/draggable_row.xml
index 7a615013..6ae7fb56 100644
--- a/res/layout/draggable_row.xml
+++ b/res/layout/draggable_row.xml
@@ -29,9 +29,10 @@ along with this program. If not, see .
android:orientation="horizontal">
.
android:layout_height="match_parent"
android:layout_width="0px"
android:layout_weight="1"/>
-
+ android:layout_width="44dip"/>
+
.
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dslv="http://schemas.android.com/apk/res-auto"
android:id="@+id/list"
- android:fastScrollEnabled="true"
android:divider="@null"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
+ android:scrollbarStyle="outsideInset"
dslv:drag_enabled="false"
dslv:drag_start_mode="onMove"
dslv:drag_handle_id="@+id/dragger"/>
diff --git a/res/layout/tab_order.xml b/res/layout/tab_order.xml
index 53ef0498..5448660b 100644
--- a/res/layout/tab_order.xml
+++ b/res/layout/tab_order.xml
@@ -36,7 +36,8 @@ THE SOFTWARE.
android:layout_weight="1"
android:choiceMode="multipleChoice"
dslv:drag_enabled="true"
- dslv:drag_start_mode="onMove" />
+ dslv:drag_start_mode="onMove"
+ dslv:drag_handle_id="@+id/dragger" />
0)
+ mTextView.setWidth(pixelFree);
+ if (redraw == true)
+ this.invalidate();
}
@Override
@@ -56,16 +101,39 @@ public class DraggableRow extends LinearLayout implements Checkable {
setChecked(!mChecked);
}
+ /**
+ * Marks a row as highlighted
+ * @param state Enable or disable highlighting
+ */
+ public void highlightRow(boolean state) {
+ mPmark.setVisibility( state ? View.VISIBLE : View.INVISIBLE );
+ }
/**
* Changes the visibility of the checkbox
- * @param state controlls if the checkbox is shown or hidden
+ * @param state show or destroy the checkbox
*/
public void showCheckBox(boolean state) {
if (mShowCheckBox != state) {
mCheckBox.setVisibility( state ? View.VISIBLE : View.GONE);
mShowCheckBox = state;
+ setupTextView(true);
}
}
+ /**
+ * Change visibility of dragger element
+ * @param state shows or hides the dragger
+ */
+ public void showDragger(boolean state) {
+ mDragger.setVisibility( state ? View.VISIBLE : View.INVISIBLE );
+ }
+
+ /**
+ * Returns an instance of our textview
+ */
+ public TextView getTextView() {
+ return mTextView;
+ }
+
}
diff --git a/src/ch/blinkenlights/android/vanilla/PlaylistAdapter.java b/src/ch/blinkenlights/android/vanilla/PlaylistAdapter.java
index 81f81bed..c23a4673 100644
--- a/src/ch/blinkenlights/android/vanilla/PlaylistAdapter.java
+++ b/src/ch/blinkenlights/android/vanilla/PlaylistAdapter.java
@@ -105,9 +105,9 @@ public class PlaylistAdapter extends CursorAdapter implements Handler.Callback {
@Override
public void bindView(View view, Context context, Cursor cursor)
{
- View dragger = ((View)view.findViewById(R.id.dragger));
- dragger.setVisibility( mEditable ? View.VISIBLE : View.INVISIBLE );
- TextView textView = ((TextView)view.findViewById(R.id.text));
+ DraggableRow dview = (DraggableRow)view;
+ dview.showDragger(mEditable);
+ TextView textView = dview.getTextView();
textView.setText(cursor.getString(1));
textView.setTag(cursor.getLong(3));
}
diff --git a/src/ch/blinkenlights/android/vanilla/ShowQueueAdapter.java b/src/ch/blinkenlights/android/vanilla/ShowQueueAdapter.java
index d3e8660d..6e93fa0e 100644
--- a/src/ch/blinkenlights/android/vanilla/ShowQueueAdapter.java
+++ b/src/ch/blinkenlights/android/vanilla/ShowQueueAdapter.java
@@ -26,7 +26,6 @@ import android.view.LayoutInflater;
import android.widget.TextView;
import android.graphics.Color;
-import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.text.Spannable;
@@ -59,20 +58,18 @@ public class ShowQueueAdapter
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = ((Activity)mContext).getLayoutInflater();
- View row = inflater.inflate(mResource, parent, false);
+ DraggableRow row = (DraggableRow)inflater.inflate(mResource, parent, false);
Song song = getItem(position);
if (song != null) { // unlikely to fail but seems to happen in the wild.
- TextView target = ((TextView)row.findViewById(R.id.text));
SpannableStringBuilder sb = new SpannableStringBuilder(song.title);
sb.append('\n');
sb.append(song.album+", "+song.artist);
sb.setSpan(new ForegroundColorSpan(Color.GRAY), song.title.length() + 1, sb.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
- target.setText(sb);
+ row.getTextView().setText(sb);
}
- View dragger = ((View)row.findViewById(R.id.dragger));
- dragger.setVisibility( ( position == mHighlightRow ? View.VISIBLE : View.INVISIBLE ));
+ row.highlightRow(position == mHighlightRow);
return row;
}
diff --git a/src/ch/blinkenlights/android/vanilla/TabOrderAdapter.java b/src/ch/blinkenlights/android/vanilla/TabOrderAdapter.java
index 7f329c3f..9581dd94 100644
--- a/src/ch/blinkenlights/android/vanilla/TabOrderAdapter.java
+++ b/src/ch/blinkenlights/android/vanilla/TabOrderAdapter.java
@@ -93,7 +93,7 @@ public class TabOrderAdapter extends BaseAdapter {
} else {
view = (DraggableRow)convert;
}
- ((TextView)view.findViewById(R.id.text)).setText(LibraryPagerAdapter.TITLES[mTabIds[position]]);
+ view.getTextView().setText(LibraryPagerAdapter.TITLES[mTabIds[position]]);
view.showCheckBox(true);
return view;
}