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

View File

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