use of de.danoeh.antennapod.dialog.PlaybackControlsDialog in project AntennaPod by AntennaPod.
the class AudioPlayerFragment method onMenuItemClick.
@Override
public boolean onMenuItemClick(MenuItem item) {
if (controller == null) {
return false;
}
Playable media = controller.getMedia();
if (media == null) {
return false;
}
@Nullable final FeedItem feedItem = (media instanceof FeedMedia) ? ((FeedMedia) media).getItem() : null;
if (feedItem != null && FeedItemMenuHandler.onMenuItemClicked(this, item.getItemId(), feedItem)) {
return true;
}
final int itemId = item.getItemId();
if (itemId == R.id.disable_sleeptimer_item || itemId == R.id.set_sleeptimer_item) {
new SleepTimerDialog().show(getChildFragmentManager(), "SleepTimerDialog");
return true;
} else if (itemId == R.id.audio_controls) {
PlaybackControlsDialog dialog = PlaybackControlsDialog.newInstance();
dialog.show(getChildFragmentManager(), "playback_controls");
return true;
} else if (itemId == R.id.open_feed_item) {
if (feedItem != null) {
Intent intent = MainActivity.getIntentToOpenFeed(getContext(), feedItem.getFeedId());
startActivity(intent);
}
return true;
}
return false;
}
use of de.danoeh.antennapod.dialog.PlaybackControlsDialog in project AntennaPod by AntennaPod.
the class VideoplayerActivity method onOptionsItemSelected.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.player_go_to_picture_in_picture) {
compatEnterPictureInPicture();
return true;
}
if (item.getItemId() == android.R.id.home) {
Intent intent = new Intent(VideoplayerActivity.this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
return true;
}
if (controller == null) {
return false;
}
Playable media = controller.getMedia();
if (media == null) {
return false;
}
// some options option requires FeedItem
@Nullable final FeedItem feedItem = getFeedItem(media);
if (item.getItemId() == R.id.add_to_favorites_item && feedItem != null) {
DBWriter.addFavoriteItem(feedItem);
isFavorite = true;
invalidateOptionsMenu();
} else if (item.getItemId() == R.id.remove_from_favorites_item && feedItem != null) {
DBWriter.removeFavoriteItem(feedItem);
isFavorite = false;
invalidateOptionsMenu();
} else if (item.getItemId() == R.id.disable_sleeptimer_item || item.getItemId() == R.id.set_sleeptimer_item) {
new SleepTimerDialog().show(getSupportFragmentManager(), "SleepTimerDialog");
} else if (item.getItemId() == R.id.audio_controls) {
PlaybackControlsDialog dialog = PlaybackControlsDialog.newInstance();
dialog.show(getSupportFragmentManager(), "playback_controls");
} else if (item.getItemId() == R.id.open_feed_item && feedItem != null) {
Intent intent = MainActivity.getIntentToOpenFeed(this, feedItem.getFeedId());
startActivity(intent);
} else if (item.getItemId() == R.id.visit_website_item) {
IntentUtils.openInBrowser(VideoplayerActivity.this, getWebsiteLinkWithFallback(media));
} else if (item.getItemId() == R.id.share_item && feedItem != null) {
ShareDialog shareDialog = ShareDialog.newInstance(feedItem);
shareDialog.show(getSupportFragmentManager(), "ShareEpisodeDialog");
} else {
return false;
}
return true;
}
Aggregations