menu-related tweaks, drop duplicate set unread from headline context

menu
This commit is contained in:
Andrew Dolgov 2011-11-30 22:06:11 +03:00
parent ec7f489c6d
commit 95f6ef2fa2
3 changed files with 23 additions and 13 deletions

View File

@ -23,9 +23,9 @@
android:title="@string/share_article"/> android:title="@string/share_article"/>
<item <item
android:id="@+id/set_unread" android:id="@+id/catchup_above"
android:showAsAction="" android:showAsAction=""
android:title="@string/article_set_unread"/> android:title="@string/article_mark_read_above"/>
</group> </group>

View File

@ -58,6 +58,7 @@
<string name="context_selection_toggle_published">(Un)Publish</string> <string name="context_selection_toggle_published">(Un)Publish</string>
<string name="context_selection_toggle_unread">(Un)Read</string> <string name="context_selection_toggle_unread">(Un)Read</string>
<string name="article_set_unread">Set unread</string> <string name="article_set_unread">Set unread</string>
<string name="article_mark_read_above">Mark above read</string>
<string name="http_login_summary">Optional. Fill this if your tt-rss installation is protected by HTTP Basic authentication</string> <string name="http_login_summary">Optional. Fill this if your tt-rss installation is protected by HTTP Basic authentication</string>
<string name="login_summary">Your tt-rss login. Not needed for single user mode</string> <string name="login_summary">Your tt-rss login. Not needed for single user mode</string>
<string name="enable_ads">Enable ads</string> <string name="enable_ads">Enable ads</string>

View File

@ -693,6 +693,7 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
return true; */ return true; */
default: default:
Log.d(TAG, "onOptionsItemSelected, unhandled id=" + item.getItemId());
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
} }
@ -1138,8 +1139,6 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
public boolean onContextItemSelected(MenuItem item) { public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
Log.d(TAG, "onContextItemSelected=" + item.getItemId());
HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentById(R.id.headlines_fragment); HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentById(R.id.headlines_fragment);
FeedsFragment ff = (FeedsFragment)getSupportFragmentManager().findFragmentById(R.id.feeds_fragment); FeedsFragment ff = (FeedsFragment)getSupportFragmentManager().findFragmentById(R.id.feeds_fragment);
FeedCategoriesFragment cf = (FeedCategoriesFragment)getSupportFragmentManager().findFragmentById(R.id.cats_fragment); FeedCategoriesFragment cf = (FeedCategoriesFragment)getSupportFragmentManager().findFragmentById(R.id.cats_fragment);
@ -1153,7 +1152,7 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
cf.setSelectedCategory(cat); cf.setSelectedCategory(cat);
} }
} }
break; return true;
case R.id.browse_feeds: case R.id.browse_feeds:
if (cf != null) { if (cf != null) {
FeedCategory cat = cf.getCategoryAtPosition(info.position); FeedCategory cat = cf.getCategoryAtPosition(info.position);
@ -1162,7 +1161,7 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
cf.setSelectedCategory(cat); cf.setSelectedCategory(cat);
} }
} }
break; return true;
case R.id.catchup_category: case R.id.catchup_category:
if (cf != null) { if (cf != null) {
FeedCategory cat = cf.getCategoryAtPosition(info.position); FeedCategory cat = cf.getCategoryAtPosition(info.position);
@ -1170,7 +1169,7 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
catchupFeed(new Feed(cat.id, cat.title, true)); catchupFeed(new Feed(cat.id, cat.title, true));
} }
} }
break; return true;
case R.id.catchup_feed: case R.id.catchup_feed:
if (ff != null) { if (ff != null) {
Feed feed = ff.getFeedAtPosition(info.position); Feed feed = ff.getFeedAtPosition(info.position);
@ -1178,7 +1177,7 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
catchupFeed(feed); catchupFeed(feed);
} }
} }
break; return true;
case R.id.selection_toggle_marked: case R.id.selection_toggle_marked:
if (hf != null) { if (hf != null) {
ArticleList selected = hf.getSelectedArticles(); ArticleList selected = hf.getSelectedArticles();
@ -1245,8 +1244,17 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
if (article != null) if (article != null)
shareArticle(article); shareArticle(article);
} }
break; return true;
case R.id.set_unread: case R.id.catchup_above:
if (hf != null) {
Article article = hf.getArticleAtPosition(info.position);
if (article != null) {
// TODO implement
}
}
return true;
/* case R.id.set_unread:
if (hf != null) { if (hf != null) {
Article article = hf.getArticleAtPosition(info.position); Article article = hf.getArticleAtPosition(info.position);
if (article != null) { if (article != null) {
@ -1254,10 +1262,11 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
saveArticleUnread(article); saveArticleUnread(article);
} }
} }
break; break; */
default:
Log.d(TAG, "onContextItemSelected, unhandled id=" + item.getItemId());
return super.onContextItemSelected(item);
} }
return true;
} }