summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaniel oeh <daniel.oeh@gmail.com>2014-07-13 10:48:04 +0200
committerdaniel oeh <daniel.oeh@gmail.com>2014-07-13 10:48:04 +0200
commit1b0ee017ce9d4c5f400efc5410d07f27379c1173 (patch)
tree5fc53a51d14775f294d3f9bd9101973e69720587
parentb87db6841955995d7963ae4899e7d404ab06da2e (diff)
downloadAntennaPod-1b0ee017ce9d4c5f400efc5410d07f27379c1173.zip
Removed "swipe to remove" from queue, replaced with context menu item.
closes #462
-rw-r--r--res/layout/queue_fragment.xml16
-rw-r--r--res/menu/queue_context.xml9
-rw-r--r--res/values/ids.xml3
-rw-r--r--src/de/danoeh/antennapod/fragment/QueueFragment.java44
4 files changed, 25 insertions, 47 deletions
diff --git a/res/layout/queue_fragment.xml b/res/layout/queue_fragment.xml
index 373975c1c..742411761 100644
--- a/res/layout/queue_fragment.xml
+++ b/res/layout/queue_fragment.xml
@@ -16,8 +16,7 @@
dslv:drag_scroll_start="0.33"
dslv:float_alpha="0.6"
dslv:max_drag_scroll_speed="0.5"
- dslv:remove_enabled="true"
- dslv:remove_mode="flingRemove"
+ dslv:remove_enabled="false"
dslv:slide_shuffle_speed="0.3"
dslv:sort_enabled="true"
dslv:track_drag_sort="true"
@@ -40,17 +39,4 @@
android:indeterminateOnly="true"
android:visibility="gone"/>
- <LinearLayout
- android:id="@+id/undobar"
- style="@style/UndoBar">
-
- <TextView
- android:id="@+id/undobar_message"
- style="@style/UndoBarMessage"/>
-
- <Button
- android:id="@+id/undobar_button"
- style="@style/UndoBarButton"/>
- </LinearLayout>
-
</FrameLayout> \ No newline at end of file
diff --git a/res/menu/queue_context.xml b/res/menu/queue_context.xml
index e24f35298..327600038 100644
--- a/res/menu/queue_context.xml
+++ b/res/menu/queue_context.xml
@@ -5,11 +5,16 @@
<item
android:id="@+id/move_to_top_item"
android:menuCategory="container"
- android:title="@string/move_to_top_label"/>
+ android:title="@string/move_to_top_label" />
+
+ <item
+ android:id="@+id/remove_from_queue_item"
+ android:menuCategory="container"
+ android:title="@string/remove_from_queue_label" />
<item
android:id="@+id/move_to_bottom_item"
android:menuCategory="container"
- android:title="@string/move_to_bottom_label"/>
+ android:title="@string/move_to_bottom_label" />
</menu> \ No newline at end of file
diff --git a/res/values/ids.xml b/res/values/ids.xml
index d7a4e2afc..90e405fde 100644
--- a/res/values/ids.xml
+++ b/res/values/ids.xml
@@ -22,5 +22,6 @@
<item name="imageloader_key" type="id"/>
<item name="notification_gpodnet_sync_error" type="id"/>
<item name="notification_gpodnet_sync_autherror" type="id"/>
-
+ <item name="undobar_button" type="id"/>
+ <item name="undobar_message" type="id"/>
</resources> \ No newline at end of file
diff --git a/src/de/danoeh/antennapod/fragment/QueueFragment.java b/src/de/danoeh/antennapod/fragment/QueueFragment.java
index e3f0bb19d..6117ce3a9 100644
--- a/src/de/danoeh/antennapod/fragment/QueueFragment.java
+++ b/src/de/danoeh/antennapod/fragment/QueueFragment.java
@@ -5,15 +5,25 @@ import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
-import android.os.Parcelable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.SearchView;
import android.util.Log;
-import android.view.*;
+import android.view.ContextMenu;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ProgressBar;
import android.widget.TextView;
+
import com.mobeta.android.dslv.DragSortListView;
+
+import java.util.List;
+import java.util.concurrent.atomic.AtomicReference;
+
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.adapter.DefaultActionButtonCallback;
@@ -27,13 +37,8 @@ import de.danoeh.antennapod.service.download.Downloader;
import de.danoeh.antennapod.storage.DBReader;
import de.danoeh.antennapod.storage.DBWriter;
import de.danoeh.antennapod.util.QueueAccess;
-import de.danoeh.antennapod.util.UndoBarController;
-import de.danoeh.antennapod.util.gui.FeedItemUndoToken;
import de.danoeh.antennapod.util.menuhandler.MenuItemUtils;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicReference;
-
/**
* Shows all items in the queue
*/
@@ -47,7 +52,6 @@ public class QueueFragment extends Fragment {
private QueueListAdapter listAdapter;
private TextView txtvEmpty;
private ProgressBar progLoading;
- private UndoBarController undoBarController;
private List<FeedItem> queue;
private List<Downloader> downloaderList;
@@ -111,7 +115,6 @@ public class QueueFragment extends Fragment {
private void resetViewState() {
unregisterForContextMenu(listView);
listAdapter = null;
- undoBarController = null;
activity.set(null);
viewsCreated = false;
blockDownloadObserverUpdate = false;
@@ -185,6 +188,9 @@ public class QueueFragment extends Fragment {
case R.id.move_to_bottom_item:
DBWriter.moveQueueItemToBottom(getActivity(), selectedItem.getId(), true);
return true;
+ case R.id.remove_from_queue_item:
+ DBWriter.removeQueueItem(getActivity(), selectedItem.getId(), false);
+ return true;
default:
return super.onContextItemSelected(item);
}
@@ -212,19 +218,6 @@ public class QueueFragment extends Fragment {
}
});
- undoBarController = new UndoBarController(root.findViewById(R.id.undobar), new UndoBarController.UndoListener() {
- @Override
- public void onUndo(Parcelable token) {
- // Perform the undo
- FeedItemUndoToken undoToken = (FeedItemUndoToken) token;
- if (token != null) {
- long itemId = undoToken.getFeedItemId();
- int position = undoToken.getPosition();
- DBWriter.addQueueItemAt(getActivity(), itemId, position, false);
- }
- }
- });
-
listView.setDragSortListener(new DragSortListView.DragSortListener() {
@Override
public void drag(int from, int to) {
@@ -245,13 +238,6 @@ public class QueueFragment extends Fragment {
@Override
public void remove(int which) {
- stopItemLoader();
- FeedItem item = (FeedItem) listView.getAdapter().getItem(which);
- DBWriter.removeQueueItem(getActivity(), item.getId(), true);
- undoBarController.showUndoBar(false,
- getString(R.string.removed_from_queue), new FeedItemUndoToken(item,
- which)
- );
}
});