menu cleanup, use popup dialog for selecting articles
This commit is contained in:
parent
efa540bd9e
commit
adfa14f606
@ -49,51 +49,42 @@
|
|||||||
android:showAsAction=""
|
android:showAsAction=""
|
||||||
android:title="@string/show_all_articles"/>
|
android:title="@string/show_all_articles"/>
|
||||||
|
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/headlines_select_all"
|
android:id="@+id/headlines_select"
|
||||||
android:title="@string/headlines_select_all"/>
|
android:title="@string/headlines_select"/>
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/headlines_select_unread"
|
|
||||||
android:title="@string/headlines_select_unread"/>
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/headlines_select_none"
|
|
||||||
android:title="@string/headlines_select_none"/>
|
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
<group android:id="@+id/menu_group_article" >
|
<group android:id="@+id/menu_group_article" >
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/close_article"
|
|
||||||
android:icon="@android:drawable/ic_menu_close_clear_cancel"
|
|
||||||
android:showAsAction="ifRoom|withText"
|
|
||||||
android:title="@string/close_article"/>
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/toggle_marked"
|
|
||||||
android:icon="@android:drawable/star_off"
|
|
||||||
android:showAsAction=""
|
|
||||||
android:title="@string/toggle_marked"/>
|
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/share_article"
|
android:id="@+id/share_article"
|
||||||
android:icon="@android:drawable/ic_menu_share"
|
android:icon="@android:drawable/ic_menu_share"
|
||||||
android:showAsAction="ifRoom"
|
android:showAsAction="ifRoom"
|
||||||
android:title="@string/share_article"/>
|
android:title="@string/share_article"/>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/toggle_marked"
|
||||||
|
android:icon="@android:drawable/star_off"
|
||||||
|
android:showAsAction=""
|
||||||
|
android:title="@string/article_toggle_marked"/>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/toggle_published"
|
android:id="@+id/toggle_published"
|
||||||
android:icon="@drawable/ic_menu_rss"
|
android:icon="@drawable/ic_menu_rss"
|
||||||
android:showAsAction=""
|
android:showAsAction=""
|
||||||
android:title="@string/toggle_published"/>
|
android:title="@string/article_toggle_published"/>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/set_unread"
|
android:id="@+id/set_unread"
|
||||||
android:icon="@android:drawable/ic_menu_recent_history"
|
android:icon="@android:drawable/ic_menu_recent_history"
|
||||||
android:showAsAction=""
|
android:showAsAction=""
|
||||||
android:title="@string/set_unread"/>
|
android:title="@string/article_set_unread"/>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/close_article"
|
||||||
|
android:icon="@android:drawable/ic_menu_close_clear_cancel"
|
||||||
|
android:showAsAction="ifRoom|withText"
|
||||||
|
android:title="@string/close_article"/>
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
|
@ -44,15 +44,17 @@
|
|||||||
<string name="category_browse_articles">Browse articles</string>
|
<string name="category_browse_articles">Browse articles</string>
|
||||||
<string name="blank"></string>
|
<string name="blank"></string>
|
||||||
<string name="transport_debugging">Log sent and received data</string>
|
<string name="transport_debugging">Log sent and received data</string>
|
||||||
<string name="toggle_marked">Toggle starred</string>
|
<string name="article_toggle_marked">Toggle starred</string>
|
||||||
<string name="toggle_published">Toggle published</string>
|
<string name="article_toggle_published">Toggle published</string>
|
||||||
<string name="headlines_select_all">Select all</string>
|
<string name="headlines_select">Select articles</string>
|
||||||
<string name="headlines_select_none">Select none</string>
|
<string name="headlines_select_dialog">Select articles</string>
|
||||||
<string name="headlines_select_unread">Unread</string>
|
<string name="headlines_select_all">All articles</string>
|
||||||
|
<string name="headlines_select_unread">Unread articles</string>
|
||||||
|
<string name="headlines_select_none">None</string>
|
||||||
<string name="selection_toggle_marked">Starred</string>
|
<string name="selection_toggle_marked">Starred</string>
|
||||||
<string name="selection_toggle_published">Published</string>
|
<string name="selection_toggle_published">Published</string>
|
||||||
<string name="selection_toggle_unread">Unread</string>
|
<string name="selection_toggle_unread">Unread</string>
|
||||||
<string name="set_unread">Mark unread</string>
|
<string name="article_set_unread">Mark unread</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>
|
||||||
|
@ -5,7 +5,10 @@ import java.util.Timer;
|
|||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
|
||||||
import android.animation.LayoutTransition;
|
import android.animation.LayoutTransition;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
@ -23,7 +26,9 @@ import android.view.MenuItem;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.animation.AnimationUtils;
|
import android.view.animation.AnimationUtils;
|
||||||
import android.widget.AdapterView.AdapterContextMenuInfo;
|
import android.widget.AdapterView.AdapterContextMenuInfo;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
@ -528,7 +533,7 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentById(R.id.headlines_fragment);
|
final HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentById(R.id.headlines_fragment);
|
||||||
|
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.preferences:
|
case R.id.preferences:
|
||||||
@ -553,14 +558,35 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
|||||||
case R.id.back_to_categories:
|
case R.id.back_to_categories:
|
||||||
closeCategory();
|
closeCategory();
|
||||||
return true;
|
return true;
|
||||||
case R.id.headlines_select_all:
|
case R.id.headlines_select:
|
||||||
if (hf != null) hf.setSelection(HeadlinesFragment.ArticlesSelection.ALL);
|
if (hf != null) {
|
||||||
return true;
|
Dialog dialog = new Dialog(this);
|
||||||
case R.id.headlines_select_none:
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
if (hf != null) hf.setSelection(HeadlinesFragment.ArticlesSelection.NONE);
|
builder.setTitle(R.string.headlines_select_dialog);
|
||||||
return true;
|
|
||||||
case R.id.headlines_select_unread:
|
builder.setSingleChoiceItems(new String[] { getString(R.string.headlines_select_all),
|
||||||
if (hf != null) hf.setSelection(HeadlinesFragment.ArticlesSelection.UNREAD);
|
getString(R.string.headlines_select_unread), getString(R.string.headlines_select_none) }, 0, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
switch (which) {
|
||||||
|
case 0:
|
||||||
|
hf.setSelection(HeadlinesFragment.ArticlesSelection.ALL);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
hf.setSelection(HeadlinesFragment.ArticlesSelection.UNREAD);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
hf.setSelection(HeadlinesFragment.ArticlesSelection.NONE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
dialog.cancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
dialog = builder.create();
|
||||||
|
dialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
case R.id.catchup_and_load:
|
case R.id.catchup_and_load:
|
||||||
if (hf != null) {
|
if (hf != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user