diff options
author | ByteHamster <info@bytehamster.com> | 2022-05-06 23:14:47 +0200 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2022-05-06 23:14:47 +0200 |
commit | 5ae471ad0a89f0b542e99e8b841763ad75371f44 (patch) | |
tree | d5ddd4c11203322dfc647b3a9b18ad95c8ce9c6a /app | |
parent | 01bddcc0a9c214d6432493f4a881370c9328cf11 (diff) | |
download | AntennaPod-5ae471ad0a89f0b542e99e8b841763ad75371f44.zip |
Invert behavior of playback state swipe action to first remove from inbox
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/dialog/SwipeActionsDialog.java | 1 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/fragment/swipeactions/SwipeAction.java | 2 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/fragment/swipeactions/SwipeActions.java | 2 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/fragment/swipeactions/TogglePlaybackStateSwipeAction.java (renamed from app/src/main/java/de/danoeh/antennapod/fragment/swipeactions/MarkPlayedSwipeAction.java) | 14 |
4 files changed, 9 insertions, 10 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/SwipeActionsDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/SwipeActionsDialog.java index 31034d5d0..674b198d5 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/SwipeActionsDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/SwipeActionsDialog.java @@ -59,6 +59,7 @@ public class SwipeActionsDialog { switch (tag) { case InboxFragment.TAG: forFragment = context.getString(R.string.inbox_label); + keys = Stream.of(keys).filter(a -> !a.getId().equals(SwipeAction.TOGGLE_PLAYED)).toList(); break; case EpisodesFragment.TAG: forFragment = context.getString(R.string.episodes_label); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/swipeactions/SwipeAction.java b/app/src/main/java/de/danoeh/antennapod/fragment/swipeactions/SwipeAction.java index e6d002b2b..58e8af82b 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/swipeactions/SwipeAction.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/swipeactions/SwipeAction.java @@ -15,7 +15,7 @@ public interface SwipeAction { String REMOVE_FROM_INBOX = "REMOVE_FROM_INBOX"; String START_DOWNLOAD = "START_DOWNLOAD"; String MARK_FAV = "MARK_FAV"; - String MARK_PLAYED = "MARK_PLAYED"; + String TOGGLE_PLAYED = "MARK_PLAYED"; String REMOVE_FROM_QUEUE = "REMOVE_FROM_QUEUE"; String getId(); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/swipeactions/SwipeActions.java b/app/src/main/java/de/danoeh/antennapod/fragment/swipeactions/SwipeActions.java index 5262592aa..d9779baf9 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/swipeactions/SwipeActions.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/swipeactions/SwipeActions.java @@ -38,7 +38,7 @@ public class SwipeActions extends ItemTouchHelper.SimpleCallback implements Life public static final List<SwipeAction> swipeActions = Collections.unmodifiableList( Arrays.asList(new AddToQueueSwipeAction(), new RemoveFromInboxSwipeAction(), new StartDownloadSwipeAction(), new MarkFavoriteSwipeAction(), - new MarkPlayedSwipeAction(), new RemoveFromQueueSwipeAction()) + new TogglePlaybackStateSwipeAction(), new RemoveFromQueueSwipeAction()) ); private final Fragment fragment; diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/swipeactions/MarkPlayedSwipeAction.java b/app/src/main/java/de/danoeh/antennapod/fragment/swipeactions/TogglePlaybackStateSwipeAction.java index b820d8a65..4ff07d13c 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/swipeactions/MarkPlayedSwipeAction.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/swipeactions/TogglePlaybackStateSwipeAction.java @@ -9,11 +9,11 @@ import de.danoeh.antennapod.menuhandler.FeedItemMenuHandler; import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItemFilter; -public class MarkPlayedSwipeAction implements SwipeAction { +public class TogglePlaybackStateSwipeAction implements SwipeAction { @Override public String getId() { - return MARK_PLAYED; + return TOGGLE_PLAYED; } @Override @@ -28,19 +28,17 @@ public class MarkPlayedSwipeAction implements SwipeAction { @Override public String getTitle(Context context) { - return context.getString(R.string.mark_read_label); + return context.getString(R.string.toggle_played_label); } @Override public void performAction(FeedItem item, Fragment fragment, FeedItemFilter filter) { - int togglePlayState = - item.getPlayState() != FeedItem.PLAYED ? FeedItem.PLAYED : FeedItem.UNPLAYED; - FeedItemMenuHandler.markReadWithUndo(fragment, - item, togglePlayState, willRemove(filter)); + int newState = item.getPlayState() == FeedItem.UNPLAYED ? FeedItem.PLAYED : FeedItem.UNPLAYED; + FeedItemMenuHandler.markReadWithUndo(fragment, item, newState, willRemove(filter)); } @Override public boolean willRemove(FeedItemFilter filter) { - return filter.showUnplayed || filter.showPlayed; + return filter.showUnplayed || filter.showPlayed || filter.showNew; } } |