diff --git a/.gitmodules b/.gitmodules
index 68b49e09..e1e7512a 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -5,3 +5,6 @@
[submodule "pulltorefresh"]
path = pulltorefresh
url = git://github.com/chrisbanes/Android-PullToRefresh.git
+[submodule "drag-sort-listview"]
+ path = drag-sort-listview
+ url = https://github.com/bauerca/drag-sort-listview
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
index 5cc19196..ead65380 100644
--- a/.idea/encodings.xml
+++ b/.idea/encodings.xml
@@ -2,8 +2,6 @@
-
-
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 97015b21..0c812c3e 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -3,6 +3,7 @@
+
diff --git a/Subsonic-Android.iml b/Subsonic-Android.iml
index f5676017..12768e7b 100644
--- a/Subsonic-Android.iml
+++ b/Subsonic-Android.iml
@@ -23,6 +23,7 @@
+
diff --git a/drag-sort-listview b/drag-sort-listview
new file mode 160000
index 00000000..c3cfccee
--- /dev/null
+++ b/drag-sort-listview
@@ -0,0 +1 @@
+Subproject commit c3cfccee21676149dfdf8e803c0ec2eaebc6b841
diff --git a/drag-sort-listview.iml b/drag-sort-listview.iml
new file mode 100644
index 00000000..a06ae8f0
--- /dev/null
+++ b/drag-sort-listview.iml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/menudrawer.iml b/menudrawer.iml
index 23044962..8937b1bb 100644
--- a/menudrawer.iml
+++ b/menudrawer.iml
@@ -3,10 +3,10 @@
-
-
-
-
+
+
+
+
file://D:/Data/Android/adt-bundle-windows/sdk/tools/proguard/proguard-android.txt
@@ -16,9 +16,9 @@
-
-
-
+
+
+
diff --git a/project.properties b/project.properties
index 2c8cde28..926cf3ea 100644
--- a/project.properties
+++ b/project.properties
@@ -10,7 +10,8 @@
# Project target.
target=android-19
android.library=false
-android.library.reference.1=menudrawer
+android.library.reference.1=menudrawer/menudrawer
android.library.reference.2=pulltorefresh
+android.library.reference.3=drag-sort-listview/library
diff --git a/res/drawable-xxhdpi/ic_action_import_export_dark.png b/res/drawable-xxhdpi/ic_action_import_export_dark.png
new file mode 100644
index 00000000..2dccb243
Binary files /dev/null and b/res/drawable-xxhdpi/ic_action_import_export_dark.png differ
diff --git a/res/drawable-xxhdpi/ic_action_import_export_light.png b/res/drawable-xxhdpi/ic_action_import_export_light.png
new file mode 100644
index 00000000..f054a68e
Binary files /dev/null and b/res/drawable-xxhdpi/ic_action_import_export_light.png differ
diff --git a/res/layout/download_playlist.xml b/res/layout/download_playlist.xml
index bad95d2e..72e32883 100644
--- a/res/layout/download_playlist.xml
+++ b/res/layout/download_playlist.xml
@@ -14,12 +14,21 @@
a:layout_height="wrap_content"
a:padding="10dip"/>
-
+ a:textFilterEnabled="true"
+ dslv:drag_handle_id="@+id/song_drag"
+ dslv:remove_enabled="true"
+ dslv:remove_mode="flingRemove"
+ dslv:fling_handle_id="@+id/song_drag"
+ dslv:drag_start_mode="onMove"
+ dslv:float_background_color="?attr/color_background"
+ dslv:float_alpha="0.7" />
+
\ No newline at end of file
diff --git a/res/layout/song_list_item.xml b/res/layout/song_list_item.xml
index a43f13ff..9cfc7572 100644
--- a/res/layout/song_list_item.xml
+++ b/res/layout/song_list_item.xml
@@ -11,7 +11,7 @@
a:layout_height="fill_parent"
a:checkMark="?attr/button_check_custom"
a:gravity="center_vertical"
- a:paddingLeft="1dip" />
+ a:paddingLeft="3dip" />
@@ -25,4 +25,14 @@
a:paddingRight="3dip"
a:src="?attr/star_hollow" />
+
+
\ No newline at end of file
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 6a1038ff..74af4813 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -18,4 +18,6 @@
#B0000000
#80000000
#FF555555
+ #ff000000
+ #fff3f3f3
\ No newline at end of file
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 3466d4a5..a6cb48b9 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -88,6 +88,8 @@
+
+
diff --git a/res/values/themes.xml b/res/values/themes.xml
index c8e5a79e..ce7a2c05 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -2,6 +2,7 @@
\ No newline at end of file
diff --git a/src/com/thejoshwa/ultrasonic/androidapp/activity/DownloadActivity.java b/src/com/thejoshwa/ultrasonic/androidapp/activity/DownloadActivity.java
index 8cc49c0c..c06bb26f 100644
--- a/src/com/thejoshwa/ultrasonic/androidapp/activity/DownloadActivity.java
+++ b/src/com/thejoshwa/ultrasonic/androidapp/activity/DownloadActivity.java
@@ -46,11 +46,11 @@ import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
-import android.widget.ListView;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.ViewFlipper;
+import com.mobeta.android.dslv.DragSortListView;
import com.thejoshwa.ultrasonic.androidapp.R;
import com.thejoshwa.ultrasonic.androidapp.domain.MusicDirectory;
import com.thejoshwa.ultrasonic.androidapp.domain.MusicDirectory.Entry;
@@ -95,7 +95,7 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
private TextView albumTextView;
private TextView artistTextView;
private ImageView albumArtImageView;
- private ListView playlistView;
+ private DragSortListView playlistView;
private TextView positionTextView;
private TextView downloadTrackTextView;
private TextView downloadTotalDurationTextView;
@@ -153,7 +153,7 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
downloadTotalDurationTextView = (TextView) findViewById(R.id.download_total_duration);
durationTextView = (TextView) findViewById(R.id.download_duration);
progressBar = (SeekBar) findViewById(R.id.download_progress_bar);
- playlistView = (ListView) findViewById(R.id.download_list);
+ playlistView = (DragSortListView) findViewById(R.id.download_list);
final AutoRepeatButton previousButton = (AutoRepeatButton) findViewById(R.id.download_previous);
final AutoRepeatButton nextButton = (AutoRepeatButton) findViewById(R.id.download_next);
pauseButton = findViewById(R.id.download_pause);
@@ -974,7 +974,7 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
if (song != null)
{
- entry = song.getSong();
+ entry = song.getSong();
}
switch (menuItemId)
@@ -1174,7 +1174,48 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
final List list = downloadService.getSongs();
emptyTextView.setText(R.string.download_empty);
- playlistView.setAdapter(new SongListAdapter(this, list));
+ final SongListAdapter adapter = new SongListAdapter(this, list);
+ playlistView.setAdapter(adapter);
+
+ playlistView.setDragSortListener(new DragSortListView.DragSortListener()
+ {
+ @Override
+ public void drop(int from, int to)
+ {
+ if (from != to)
+ {
+ DownloadFile item = adapter.getItem(from);
+ adapter.remove(item);
+ adapter.insert(item, to);
+ onDownloadListChanged();
+ onCurrentChanged();
+ }
+ }
+
+ @Override
+ public void drag(int from, int to)
+ {
+
+ }
+
+
+ @Override
+ public void remove(int which)
+ {
+ DownloadFile item = adapter.getItem(which);
+ DownloadFile currentPlaying = getDownloadService().getCurrentPlaying();
+
+ if (currentPlaying == item)
+ {
+ getDownloadService().next();
+ }
+
+ adapter.remove(item);
+ onDownloadListChanged();
+ onCurrentChanged();
+ }
+ });
+
emptyTextView.setVisibility(list.isEmpty() ? View.VISIBLE : View.GONE);
currentRevision = downloadService.getDownloadListUpdateRevision();
diff --git a/src/com/thejoshwa/ultrasonic/androidapp/view/EntryAdapter.java b/src/com/thejoshwa/ultrasonic/androidapp/view/EntryAdapter.java
index 8bdbc243..65ea5d36 100644
--- a/src/com/thejoshwa/ultrasonic/androidapp/view/EntryAdapter.java
+++ b/src/com/thejoshwa/ultrasonic/androidapp/view/EntryAdapter.java
@@ -98,7 +98,7 @@ public class EntryAdapter extends ArrayAdapter
view = new SongView(activity);
}
- view.setSong(entry, checkable);
+ view.setSong(entry, checkable, false);
return view;
}
}
diff --git a/src/com/thejoshwa/ultrasonic/androidapp/view/SongListAdapter.java b/src/com/thejoshwa/ultrasonic/androidapp/view/SongListAdapter.java
index a8d9dcb5..80ef62bc 100644
--- a/src/com/thejoshwa/ultrasonic/androidapp/view/SongListAdapter.java
+++ b/src/com/thejoshwa/ultrasonic/androidapp/view/SongListAdapter.java
@@ -46,7 +46,7 @@ public class SongListAdapter extends ArrayAdapter
view = new SongView(this.context);
}
- view.setSong(entry, false);
+ view.setSong(entry, false, true);
return view;
}
}
diff --git a/src/com/thejoshwa/ultrasonic/androidapp/view/SongView.java b/src/com/thejoshwa/ultrasonic/androidapp/view/SongView.java
index d721d30c..9337dc86 100644
--- a/src/com/thejoshwa/ultrasonic/androidapp/view/SongView.java
+++ b/src/com/thejoshwa/ultrasonic/androidapp/view/SongView.java
@@ -61,6 +61,7 @@ public class SongView extends UpdateView implements Checkable
private CheckedTextView checkedTextView;
private ImageView starImageView;
+ private ImageView songDragImageView;
private TextView titleTextView;
private TextView statusTextView;
private Entry song;
@@ -125,7 +126,7 @@ public class SongView extends UpdateView implements Checkable
return this.song;
}
- protected void setSong(final Entry song, boolean checkable)
+ protected void setSong(final Entry song, boolean checkable, boolean dragable)
{
updateBackground();
@@ -140,6 +141,7 @@ public class SongView extends UpdateView implements Checkable
checkedTextView = (CheckedTextView) findViewById(R.id.song_check);
starImageView = (ImageView) findViewById(R.id.song_star);
+ songDragImageView = (ImageView) findViewById(R.id.song_drag);
TextView trackTextView = (TextView) findViewById(R.id.song_track);
titleTextView = (TextView) findViewById(R.id.song_title);
TextView artistTextView = (TextView) findViewById(R.id.song_artist);
@@ -204,6 +206,7 @@ public class SongView extends UpdateView implements Checkable
}
checkedTextView.setVisibility(checkable && !song.isVideo() ? View.VISIBLE : View.GONE);
+ songDragImageView.setVisibility(dragable ? View.VISIBLE : View.GONE);
if (Util.isOffline(this.context))
{