Direct play from the the lists

position in media item is now updated
This commit is contained in:
volhol 2015-04-01 12:47:35 +02:00
parent 71db0368c4
commit 247ef778aa
5 changed files with 13 additions and 16 deletions

View File

@ -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";
@ -296,9 +297,6 @@ public class ItemlistFragment extends ListFragment {
updateProgressBarVisibility();
}
}
if ((arg & EventDistributor.PLAYER_STATUS_UPDATE) != 0) {
adapter.notifyDataSetChanged();
}
}
};

View File

@ -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";
@ -340,9 +341,6 @@ public class NewEpisodesFragment extends Fragment {
getActivity().supportInvalidateOptionsMenu();
}
}
if ((arg & EventDistributor.PLAYER_STATUS_UPDATE) != 0) {
listAdapter.notifyDataSetChanged();
}
}
};

View File

@ -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,13 +169,10 @@ 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();
}
if ((arg & EventDistributor.PLAYER_STATUS_UPDATE) != 0) {
adapter.notifyDataSetChanged();
}
}
};

View File

@ -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;
@ -477,9 +478,6 @@ public class QueueFragment extends Fragment {
getActivity().supportInvalidateOptionsMenu();
}
}
if ((arg & EventDistributor.PLAYER_STATUS_UPDATE) != 0) {
listAdapter.notifyDataSetChanged();
}
}
};

View File

@ -179,6 +179,10 @@ public class PlaybackServiceMediaPlayer {
if (playerStatus == PlayerStatus.PAUSED || playerStatus == PlayerStatus.PLAYING || playerStatus == PlayerStatus.PREPARED) {
mediaPlayer.stop();
}
// set temporarily to pause in order to update list with current position
if (playerStatus == PlayerStatus.PLAYING) {
setPlayerStatus(PlayerStatus.PAUSED, media);
}
setPlayerStatus(PlayerStatus.INDETERMINATE, null);
}
}