diff options
author | Tom Hennen <TomHennen@users.noreply.github.com> | 2015-04-03 12:24:04 -0400 |
---|---|---|
committer | Tom Hennen <TomHennen@users.noreply.github.com> | 2015-04-03 12:24:04 -0400 |
commit | 13012a2c41214fd4f3ded3306f224a01e673f956 (patch) | |
tree | 5bd6d2dd4a263aeccb243c50ba2c9cd52a2638e5 /app | |
parent | ec3ea8406469c78e133d9703d5877ba43582364b (diff) | |
parent | 42e118626edb2c882e62651d9c469316f7ddfb42 (diff) | |
download | AntennaPod-13012a2c41214fd4f3ded3306f224a01e673f956.zip |
Merge pull request #693 from volhol/develop
Addresses #669 and #664: play buttons in the lists
Diffstat (limited to 'app')
9 files changed, 24 insertions, 6 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/ActionButtonUtils.java b/app/src/main/java/de/danoeh/antennapod/adapter/ActionButtonUtils.java index c35bb9694..8d3e73429 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/ActionButtonUtils.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/ActionButtonUtils.java @@ -57,7 +57,7 @@ public class ActionButtonUtils { } else { // item is not being downloaded butSecondary.setVisibility(View.VISIBLE); - if (media.isPlaying()) { + if (media.isCurrentlyPlaying()) { butSecondary.setImageDrawable(drawables.getDrawable(3)); } else { butSecondary diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java b/app/src/main/java/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java index 800462023..14644dd68 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java @@ -1,6 +1,7 @@ package de.danoeh.antennapod.adapter; import android.content.Context; +import android.content.Intent; import android.widget.Toast; import org.apache.commons.lang3.Validate; @@ -9,6 +10,7 @@ import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.dialog.DownloadRequestErrorDialogCreator; import de.danoeh.antennapod.core.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.core.service.playback.PlaybackService; import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.storage.DownloadRequestException; @@ -46,7 +48,15 @@ public class DefaultActionButtonCallback implements ActionButtonCallback { DownloadRequester.getInstance().cancelDownload(context, media); Toast.makeText(context, R.string.download_cancelled_msg, Toast.LENGTH_SHORT).show(); } else { // media is downloaded - DBTasks.playMedia(context, media, true, true, false); + if (item.hasMedia() && item.getMedia().isCurrentlyPlaying()) { + context.sendBroadcast(new Intent(PlaybackService.ACTION_PAUSE_PLAY_CURRENT_EPISODE)); + } + else if (item.hasMedia() && item.getMedia().isCurrentlyPaused()) { + context.sendBroadcast(new Intent(PlaybackService.ACTION_RESUME_PLAY_CURRENT_EPISODE)); + } + else { + DBTasks.playMedia(context, media, false, true, false); + } } } else { if (!item.isRead()) { diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistAdapter.java index 8f1a838f9..d56bfc587 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistAdapter.java @@ -9,6 +9,7 @@ import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.*; import de.danoeh.antennapod.R; +import de.danoeh.antennapod.core.feed.EventDistributor; import de.danoeh.antennapod.core.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedMedia; import de.danoeh.antennapod.core.feed.MediaType; diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/NewEpisodesListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/NewEpisodesListAdapter.java index 1f98ec158..7a05b9370 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/NewEpisodesListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/NewEpisodesListAdapter.java @@ -14,6 +14,7 @@ import android.widget.TextView; import com.squareup.picasso.Picasso; import de.danoeh.antennapod.R; +import de.danoeh.antennapod.core.feed.EventDistributor; import de.danoeh.antennapod.core.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedMedia; import de.danoeh.antennapod.core.storage.DownloadRequester; diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/QueueListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/QueueListAdapter.java index 77b2b4d49..a256dc129 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/QueueListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/QueueListAdapter.java @@ -14,6 +14,7 @@ import android.widget.TextView; import com.squareup.picasso.Picasso; import de.danoeh.antennapod.R; +import de.danoeh.antennapod.core.feed.EventDistributor; import de.danoeh.antennapod.core.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedMedia; import de.danoeh.antennapod.core.storage.DownloadRequester; diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemlistFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemlistFragment.java index 5312beeeb..acb07626c 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemlistFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemlistFragment.java @@ -66,7 +66,8 @@ public class ItemlistFragment extends ListFragment { private static final int EVENTS = EventDistributor.DOWNLOAD_HANDLED | EventDistributor.DOWNLOAD_QUEUED | EventDistributor.QUEUE_UPDATE - | EventDistributor.UNREAD_ITEMS_UPDATE; + | EventDistributor.UNREAD_ITEMS_UPDATE + | EventDistributor.PLAYER_STATUS_UPDATE; public static final String EXTRA_SELECTED_FEEDITEM = "extra.de.danoeh.antennapod.activity.selected_feeditem"; public static final String ARGUMENT_FEED_ID = "argument.de.danoeh.antennapod.feed_id"; diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/NewEpisodesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/NewEpisodesFragment.java index 24991144e..5cafd370e 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/NewEpisodesFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/NewEpisodesFragment.java @@ -54,7 +54,8 @@ public class NewEpisodesFragment extends Fragment { private static final int EVENTS = EventDistributor.DOWNLOAD_HANDLED | EventDistributor.DOWNLOAD_QUEUED | EventDistributor.QUEUE_UPDATE | - EventDistributor.UNREAD_ITEMS_UPDATE; + EventDistributor.UNREAD_ITEMS_UPDATE | + EventDistributor.PLAYER_STATUS_UPDATE; private static final int RECENT_EPISODES_LIMIT = 150; private static final String PREF_NAME = "PrefNewEpisodesFragment"; diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java index f6d2d5d07..ab38af106 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java @@ -34,6 +34,8 @@ import de.danoeh.antennapod.menuhandler.NavDrawerActivity; public class PlaybackHistoryFragment extends ListFragment { private static final String TAG = "PlaybackHistoryFragment"; + private static final int EVENTS = EventDistributor.PLAYBACK_HISTORY_UPDATE | + EventDistributor.PLAYER_STATUS_UPDATE; private List<FeedItem> playbackHistory; private QueueAccess queue; @@ -167,7 +169,7 @@ public class PlaybackHistoryFragment extends ListFragment { @Override public void update(EventDistributor eventDistributor, Integer arg) { - if ((arg & EventDistributor.PLAYBACK_HISTORY_UPDATE) != 0) { + if ((arg & EVENTS) != 0) { startItemLoader(); getActivity().supportInvalidateOptionsMenu(); } diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java index da33c6ea3..70a231cad 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java @@ -56,7 +56,8 @@ public class QueueFragment extends Fragment { private static final String TAG = "QueueFragment"; private static final int EVENTS = EventDistributor.DOWNLOAD_HANDLED | EventDistributor.DOWNLOAD_QUEUED | - EventDistributor.QUEUE_UPDATE; + EventDistributor.QUEUE_UPDATE | + EventDistributor.PLAYER_STATUS_UPDATE; private DragSortListView listView; private QueueListAdapter listAdapter; |