diff --git a/res/layout/draggable_row.xml b/res/layout/draggable_row.xml
index 24f1bd88..7a615013 100644
--- a/res/layout/draggable_row.xml
+++ b/res/layout/draggable_row.xml
@@ -15,7 +15,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
-->
-.
android:layout_height="1px"
android:background="@color/divider_color"/>
-
+
diff --git a/src/ch/blinkenlights/android/vanilla/DraggableRow.java b/src/ch/blinkenlights/android/vanilla/DraggableRow.java
new file mode 100644
index 00000000..a31845dc
--- /dev/null
+++ b/src/ch/blinkenlights/android/vanilla/DraggableRow.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2014 Adrian Ulrich
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package ch.blinkenlights.android.vanilla;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.LinearLayout;
+import android.widget.CheckedTextView;
+import android.widget.Checkable;
+import android.util.Log;
+
+public class DraggableRow extends LinearLayout implements Checkable {
+ private boolean mShowCheckBox;
+ private boolean mChecked;
+ private CheckedTextView mCheckBox;
+
+ public DraggableRow(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+
+ @Override
+ public void onFinishInflate() {
+ mCheckBox = (CheckedTextView)this.findViewById(R.id.checkbox);
+ }
+
+ @Override
+ public boolean isChecked() {
+ return mChecked;
+ }
+
+ @Override
+ public void setChecked(boolean checked) {
+ mChecked = checked;
+ mCheckBox.setChecked(mChecked);
+ }
+
+ @Override
+ public void toggle() {
+ setChecked(!mChecked);
+ }
+
+
+ /**
+ * Changes the visibility of the checkbox
+ * @param state controlls if the checkbox is shown or hidden
+ */
+ public void showCheckBox(boolean state) {
+ if (mShowCheckBox != state) {
+ mCheckBox.setVisibility( state ? View.VISIBLE : View.GONE);
+ mShowCheckBox = state;
+ }
+ }
+
+}
diff --git a/src/ch/blinkenlights/android/vanilla/TabOrderAdapter.java b/src/ch/blinkenlights/android/vanilla/TabOrderAdapter.java
index 6f8f15f1..7f329c3f 100644
--- a/src/ch/blinkenlights/android/vanilla/TabOrderAdapter.java
+++ b/src/ch/blinkenlights/android/vanilla/TabOrderAdapter.java
@@ -87,13 +87,14 @@ public class TabOrderAdapter extends BaseAdapter {
@Override
public View getView(int position, View convert, ViewGroup parent)
{
- View view;
+ DraggableRow view;
if (convert == null) {
- view = mInflater.inflate(R.layout.draggable_row, null);
+ view = (DraggableRow)mInflater.inflate(R.layout.draggable_row, null);
} else {
- view = convert;
+ view = (DraggableRow)convert;
}
((TextView)view.findViewById(R.id.text)).setText(LibraryPagerAdapter.TITLES[mTabIds[position]]);
+ view.showCheckBox(true);
return view;
}