mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2025-12-01 12:31:45 +00:00
Added menuitem to visit the website of a feed or feeditem
This commit is contained in:
BIN
res/drawable-hdpi/location_web_site.png
Normal file
BIN
res/drawable-hdpi/location_web_site.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
@ -9,6 +9,7 @@
|
||||
<item android:id="@+id/add_to_queue_item" android:title="@string/add_to_queue_label" android:visible="false" android:showAsAction="collapseActionView"></item>
|
||||
<item android:id="@+id/remove_from_queue_item" android:title="@string/remove_from_queue_label" android:visible="false" android:showAsAction="collapseActionView"></item>
|
||||
<item android:id="@+id/stream_item" android:title="@string/stream_label" android:visible="false" android:showAsAction="collapseActionView"></item>
|
||||
<item android:id="@+id/visit_website_item" android:icon="@drawable/location_web_site" android:title="@string/visit_website_label" android:showAsAction="ifRoom|collapseActionView" android:visible="false"></item>
|
||||
|
||||
|
||||
</menu>
|
||||
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:id="@+id/mark_all_read_item" android:title="@string/mark_all_read_label" android:showAsAction="ifRoom|withText"></item><item android:id="@+id/show_info_item" android:icon="@drawable/action_about" android:title="@string/show_info_label" android:showAsAction="always"></item><item android:id="@+id/remove_item" android:title="@string/remove_feed_label" android:icon="@drawable/content_discard" android:visible="true" android:showAsAction="collapseActionView"></item>
|
||||
<item android:id="@+id/visit_website_item" android:showAsAction="ifRoom|collapseActionView" android:icon="@drawable/location_web_site" android:title="@string/visit_website_label" android:visible="true"></item>
|
||||
|
||||
|
||||
|
||||
|
||||
@ -60,4 +60,5 @@
|
||||
<string name="remove_feed_label">Remove Feed</string>
|
||||
<string name="position_default_label">00:00:00</string>
|
||||
<string name="queue_label">Queue</string>
|
||||
<string name="visit_website_label">Visit Website</string>
|
||||
</resources>
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package de.podfetcher.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuInflater;
|
||||
@ -44,6 +46,10 @@ public class FeedItemMenuHandler {
|
||||
menu.findItem(R.id.mark_read_item).setVisible(true);
|
||||
}
|
||||
|
||||
if (selectedItem.getLink() != null) {
|
||||
menu.findItem(R.id.visit_website_item).setVisible(true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -82,6 +88,10 @@ public class FeedItemMenuHandler {
|
||||
manager.playMedia(context, selectedItem.getMedia(), true, true,
|
||||
true);
|
||||
break;
|
||||
case R.id.visit_website_item:
|
||||
Uri uri = Uri.parse(selectedItem.getLink());
|
||||
context.startActivity(new Intent(Intent.ACTION_VIEW, uri));
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package de.podfetcher.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
|
||||
import com.actionbarsherlock.view.ActionMode;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
@ -12,27 +14,30 @@ import de.podfetcher.feed.Feed;
|
||||
import de.podfetcher.feed.FeedItem;
|
||||
import de.podfetcher.feed.FeedManager;
|
||||
|
||||
|
||||
/** Handles interactions with the FeedItemMenu. */
|
||||
public class FeedMenuHandler {
|
||||
|
||||
public static boolean onCreateOptionsMenu(MenuInflater inflater, Menu menu) {
|
||||
inflater.inflate(R.menu.feedlist, menu);
|
||||
|
||||
public static boolean onCreateOptionsMenu(MenuInflater inflater, Menu menu) {
|
||||
inflater.inflate(R.menu.feedlist, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static boolean onPrepareOptionsMenu(Menu menu) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** NOTE: This method does not handle clicks on the 'remove feed' - item. */
|
||||
public static boolean onOptionsItemClicked(Context context, MenuItem item, Feed selectedFeed) {
|
||||
public static boolean onOptionsItemClicked(Context context, MenuItem item,
|
||||
Feed selectedFeed) {
|
||||
FeedManager manager = FeedManager.getInstance();
|
||||
switch (item.getItemId()) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.mark_all_read_item:
|
||||
manager.markFeedRead(context, selectedFeed);
|
||||
break;
|
||||
case R.id.visit_website_item:
|
||||
Uri uri = Uri.parse(selectedFeed.getLink());
|
||||
context.startActivity(new Intent(Intent.ACTION_VIEW, uri));
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user