Merge pull request #1827 from mfietz/issue/1239-open-podcast

Episode view: Open podcast
This commit is contained in:
Tom Hennen 2016-03-29 17:58:39 -04:00
commit b6ac166c4f
2 changed files with 26 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,12 +265,18 @@ public class ItemFragment extends Fragment {
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
try {
return FeedItemMenuHandler.onMenuItemClicked(getActivity(), menuItem.getItemId(), item);
} catch (DownloadRequestException e) {
e.printStackTrace();
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_LONG).show();
return true;
switch(menuItem.getItemId()) {
case R.id.open_podcast:
openPodcast();
return true;
default:
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,11 @@ public class ItemFragment extends Fragment {
}
}
private void openPodcast() {
Fragment fragment = ItemlistFragment.newInstance(item.getFeedId());
((MainActivity)getActivity()).loadChildFragment(fragment);
}
public void onEventMainThread(QueueEvent event) {
if(event.contains(itemID)) {
load();

View File

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