menu cleanup, use popup dialog for selecting articles
This commit is contained in:
parent
efa540bd9e
commit
adfa14f606
@ -49,51 +49,42 @@
|
||||
android:showAsAction=""
|
||||
android:title="@string/show_all_articles"/>
|
||||
|
||||
|
||||
<item
|
||||
android:id="@+id/headlines_select_all"
|
||||
android:title="@string/headlines_select_all"/>
|
||||
|
||||
<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"/>
|
||||
android:id="@+id/headlines_select"
|
||||
android:title="@string/headlines_select"/>
|
||||
</group>
|
||||
|
||||
<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
|
||||
android:id="@+id/share_article"
|
||||
android:icon="@android:drawable/ic_menu_share"
|
||||
android:showAsAction="ifRoom"
|
||||
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
|
||||
android:id="@+id/toggle_published"
|
||||
android:icon="@drawable/ic_menu_rss"
|
||||
android:showAsAction=""
|
||||
android:title="@string/toggle_published"/>
|
||||
android:title="@string/article_toggle_published"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/set_unread"
|
||||
android:icon="@android:drawable/ic_menu_recent_history"
|
||||
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>
|
||||
|
||||
<item
|
||||
|
@ -44,15 +44,17 @@
|
||||
<string name="category_browse_articles">Browse articles</string>
|
||||
<string name="blank"></string>
|
||||
<string name="transport_debugging">Log sent and received data</string>
|
||||
<string name="toggle_marked">Toggle starred</string>
|
||||
<string name="toggle_published">Toggle published</string>
|
||||
<string name="headlines_select_all">Select all</string>
|
||||
<string name="headlines_select_none">Select none</string>
|
||||
<string name="headlines_select_unread">Unread</string>
|
||||
<string name="article_toggle_marked">Toggle starred</string>
|
||||
<string name="article_toggle_published">Toggle published</string>
|
||||
<string name="headlines_select">Select articles</string>
|
||||
<string name="headlines_select_dialog">Select articles</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_published">Published</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="login_summary">Your tt-rss login. Not needed for single user mode</string>
|
||||
<string name="enable_ads">Enable ads</string>
|
||||
|
@ -5,7 +5,10 @@ import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import android.animation.LayoutTransition;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.ConnectivityManager;
|
||||
@ -23,7 +26,9 @@ import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.AdapterView.AdapterContextMenuInfo;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
@ -528,7 +533,7 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
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()) {
|
||||
case R.id.preferences:
|
||||
@ -553,14 +558,35 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
||||
case R.id.back_to_categories:
|
||||
closeCategory();
|
||||
return true;
|
||||
case R.id.headlines_select_all:
|
||||
if (hf != null) hf.setSelection(HeadlinesFragment.ArticlesSelection.ALL);
|
||||
return true;
|
||||
case R.id.headlines_select_none:
|
||||
if (hf != null) hf.setSelection(HeadlinesFragment.ArticlesSelection.NONE);
|
||||
return true;
|
||||
case R.id.headlines_select_unread:
|
||||
if (hf != null) hf.setSelection(HeadlinesFragment.ArticlesSelection.UNREAD);
|
||||
case R.id.headlines_select:
|
||||
if (hf != null) {
|
||||
Dialog dialog = new Dialog(this);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(R.string.headlines_select_dialog);
|
||||
|
||||
builder.setSingleChoiceItems(new String[] { getString(R.string.headlines_select_all),
|
||||
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;
|
||||
case R.id.catchup_and_load:
|
||||
if (hf != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user