Episode view: Open podcast menu or click on cover or podcast title

This commit is contained in:
Martin Fietz 2016-03-27 16:02:41 +02:00
parent bbf1c43294
commit 82f73a0af8
2 changed files with 25 additions and 7 deletions

View File

@ -137,6 +137,7 @@ public class ItemFragment extends Fragment {
root = (ViewGroup) layout.findViewById(R.id.content_root);
txtvPodcast = (TextView) layout.findViewById(R.id.txtvPodcast);
txtvPodcast.setOnClickListener(v -> openPodcast());
txtvTitle = (TextView) layout.findViewById(R.id.txtvTitle);
txtvDuration = (TextView) layout.findViewById(R.id.txtvDuration);
txtvPublished = (TextView) layout.findViewById(R.id.txtvPublished);
@ -169,6 +170,7 @@ public class ItemFragment extends Fragment {
registerForContextMenu(webvDescription);
imgvCover = (ImageView) layout.findViewById(R.id.imgvCover);
imgvCover.setOnClickListener(v -> openPodcast());
progbarDownload = (ProgressBar) layout.findViewById(R.id.progbarDownload);
progbarLoading = (ProgressBar) layout.findViewById(R.id.progbarLoading);
butAction1 = (IconButton) layout.findViewById(R.id.butAction1);
@ -263,6 +265,11 @@ public class ItemFragment extends Fragment {
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
switch(menuItem.getItemId()) {
case R.id.open_podcast:
openPodcast();
return true;
default:
try {
return FeedItemMenuHandler.onMenuItemClicked(getActivity(), menuItem.getItemId(), item);
} catch (DownloadRequestException e) {
@ -271,6 +278,7 @@ public class ItemFragment extends Fragment {
return true;
}
}
}
private final FeedItemMenuHandler.MenuInterface popupMenuInterface = new FeedItemMenuHandler.MenuInterface() {
@Override
@ -456,6 +464,10 @@ public class ItemFragment extends Fragment {
}
}
private void openPodcast() {
((MainActivity)getActivity()).loadFeedFragmentById(item.getFeedId(), null);
}
public void onEventMainThread(QueueEvent event) {
if(event.contains(itemID)) {
load();

View File

@ -93,4 +93,10 @@
android:title="@string/support_label">
</item>
<item
android:id="@+id/open_podcast"
custom:showAsAction="collapseActionView"
android:title="@string/open_podcast">
</item>
</menu>