#2929 add Open Podcast to player screen

This commit is contained in:
orionlee 2019-09-21 13:52:04 -07:00
parent 3491377120
commit fcb1a180ad
2 changed files with 21 additions and 0 deletions

View File

@ -322,6 +322,8 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
Playable media = controller.getMedia();
boolean isFeedMedia = media != null && (media instanceof FeedMedia);
menu.findItem(R.id.open_feed_item).setVisible(isFeedMedia); // FeedMedia implies it belongs to a Feed
boolean hasWebsiteLink = ( getWebsiteLinkWithFallback(media) != null );
menu.findItem(R.id.visit_website_item).setVisible(hasWebsiteLink);
@ -448,6 +450,17 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
PlaybackControlsDialog dialog = PlaybackControlsDialog.newInstance(isPlayingVideo);
dialog.show(getSupportFragmentManager(), "playback_controls");
break;
case R.id.open_feed_item:
if(media instanceof FeedMedia) {
FeedItem feedItem = ((FeedMedia)media).getItem();
if (feedItem != null) {
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
intent.putExtra(MainActivity.EXTRA_FEED_ID, feedItem.getFeedId());
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
}
break;
case R.id.visit_website_item:
Uri uri = Uri.parse(getWebsiteLinkWithFallback(media));
startActivity(new Intent(Intent.ACTION_VIEW, uri));

View File

@ -34,6 +34,14 @@
custom:showAsAction="always">
</item>
<item
android:id="@+id/open_feed_item"
android:icon="?attr/feed"
custom:showAsAction="collapseActionView"
android:title="@string/open_podcast"
android:visible="false">
</item>
<item
android:id="@+id/visit_website_item"
android:icon="?attr/location_web_site"