menu updates

This commit is contained in:
Andrew Dolgov 2011-11-24 09:06:47 +03:00
parent d5f17058c4
commit d7dfd661ce
4 changed files with 18 additions and 6 deletions

View File

@ -2,7 +2,12 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/show_feeds" <item android:id="@+id/show_feeds"
android:icon="@android:drawable/ic_menu_rotate" android:icon="@android:drawable/ic_menu_rotate"
android:title="@string/menu_unread_feeds" android:title="@string/menu_all_feeds"
android:showAsAction=""/>
<item android:id="@+id/update"
android:icon="@android:drawable/ic_menu_rotate"
android:title="@string/update"
android:showAsAction="ifRoom|withText"/> android:showAsAction="ifRoom|withText"/>
<item android:id="@+id/preferences" <item android:id="@+id/preferences"

View File

@ -26,7 +26,8 @@
<string name="no_unread_feeds">No unread feeds.</string> <string name="no_unread_feeds">No unread feeds.</string>
<string name="no_unread_headlines">No unread headlines.</string> <string name="no_unread_headlines">No unread headlines.</string>
<string name="loading_message">Loading, please wait...</string> <string name="loading_message">Loading, please wait...</string>
<string name="menu_unread_feeds">Unread feeds</string> <string name="menu_unread_feeds">Show unread feeds</string>
<string name="menu_all_feeds">All feeds</string> <string name="menu_all_feeds">Show all feeds</string>
<string name="update">Update</string>
</resources> </resources>

View File

@ -61,7 +61,10 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
list.setAdapter(m_adapter); list.setAdapter(m_adapter);
list.setOnItemClickListener(this); list.setOnItemClickListener(this);
if (m_feed != null) refresh(); if (m_feed != null)
refresh();
else
view.findViewById(R.id.loading_container).setVisibility(View.GONE);
return view; return view;
} }

View File

@ -199,11 +199,14 @@ public class MainActivity extends Activity implements FeedsFragment.OnFeedSelect
Intent intent = new Intent(this, PreferencesActivity.class); Intent intent = new Intent(this, PreferencesActivity.class);
startActivityForResult(intent, 0); startActivityForResult(intent, 0);
return true; return true;
case R.id.update:
refreshFeeds();
return true;
case R.id.show_feeds: case R.id.show_feeds:
if (getUnreadOnly()) { if (getUnreadOnly()) {
item.setTitle(R.string.menu_all_feeds);
} else {
item.setTitle(R.string.menu_unread_feeds); item.setTitle(R.string.menu_unread_feeds);
} else {
item.setTitle(R.string.menu_all_feeds);
} }
setUnreadOnly(!getUnreadOnly()); setUnreadOnly(!getUnreadOnly());