blob: bf258078d52422f1e740d41c5ce21a808659a26f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
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;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import de.podfetcher.R;
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);
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) {
FeedManager manager = FeedManager.getInstance();
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;
}
return true;
}
}
|