use actionbar better in online mode, menu cleanup
This commit is contained in:
parent
8fa8debdca
commit
160115b84c
@ -40,7 +40,7 @@
|
||||
<item
|
||||
android:id="@+id/go_offline"
|
||||
android:icon="@drawable/ic_menu_cloud"
|
||||
android:showAsAction="ifRoom|withText"
|
||||
|
||||
android:title="@string/go_offline"/>
|
||||
|
||||
<item
|
||||
@ -52,6 +52,7 @@
|
||||
<item
|
||||
android:id="@+id/headlines_select"
|
||||
android:icon="@drawable/ic_menu_database"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/headlines_select"/>
|
||||
</group>
|
||||
|
||||
@ -59,20 +60,20 @@
|
||||
|
||||
<item
|
||||
android:id="@+id/selection_toggle_unread"
|
||||
android:icon="@android:drawable/ic_menu_rotate"
|
||||
android:icon="@android:drawable/ic_menu_recent_history"
|
||||
android:showAsAction=""
|
||||
android:title="@string/selection_toggle_unread"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/selection_toggle_marked"
|
||||
android:icon="@drawable/ic_menu_marked"
|
||||
android:showAsAction=""
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/selection_toggle_marked"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/selection_toggle_published"
|
||||
android:icon="@drawable/ic_menu_rss"
|
||||
android:showAsAction=""
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/selection_toggle_published"/>
|
||||
|
||||
<item
|
||||
@ -93,13 +94,13 @@
|
||||
<item
|
||||
android:id="@+id/toggle_marked"
|
||||
android:icon="@drawable/ic_menu_marked"
|
||||
android:showAsAction=""
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/article_toggle_marked"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/toggle_published"
|
||||
android:icon="@drawable/ic_menu_rss"
|
||||
android:showAsAction=""
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/article_toggle_published"/>
|
||||
|
||||
<item
|
||||
|
@ -824,6 +824,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
||||
ArticleList selected = hf.getSelectedArticles();
|
||||
if (selected.size() > 0) {
|
||||
selected.clear();
|
||||
initMainMenu();
|
||||
hf.notifyUpdated();
|
||||
}
|
||||
}
|
||||
@ -970,62 +971,55 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
||||
public void initMainMenu() {
|
||||
if (m_menu != null) {
|
||||
if (m_sessionId != null) {
|
||||
|
||||
HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentById(R.id.headlines_fragment);
|
||||
int numSelected = 0;
|
||||
|
||||
if (hf != null)
|
||||
numSelected = hf.getSelectedArticles().size();
|
||||
|
||||
m_menu.setGroupVisible(R.id.menu_group_logged_in, true);
|
||||
m_menu.setGroupVisible(R.id.menu_group_logged_out, false);
|
||||
|
||||
if (m_activeFeed != null) {
|
||||
//m_menu.findItem(R.id.load_more_articles).setVisible(m_canLoadMore);
|
||||
//m_menu.findItem(R.id.show_all_articles).setVisible(true);
|
||||
} else {
|
||||
if (m_activeFeed == null) {
|
||||
m_menu.setGroupVisible(R.id.menu_group_headlines, false);
|
||||
m_menu.setGroupVisible(R.id.menu_group_headlines_selection, false);
|
||||
}
|
||||
|
||||
if (m_selectedArticle != null) {
|
||||
if (m_selectedArticle != null && numSelected == 0) {
|
||||
m_menu.setGroupVisible(R.id.menu_group_article, true);
|
||||
|
||||
m_menu.setGroupVisible(R.id.menu_group_feeds, false);
|
||||
|
||||
if (m_smallScreenMode) {
|
||||
//if (m_smallScreenMode) {
|
||||
m_menu.setGroupVisible(R.id.menu_group_headlines, false);
|
||||
m_menu.setGroupVisible(R.id.menu_group_headlines_selection, false);
|
||||
} else {
|
||||
m_menu.setGroupVisible(R.id.menu_group_headlines, true);
|
||||
}
|
||||
//} else {
|
||||
// m_menu.setGroupVisible(R.id.menu_group_headlines, true);
|
||||
//}
|
||||
|
||||
} else {
|
||||
m_menu.setGroupVisible(R.id.menu_group_article, false);
|
||||
|
||||
if (m_activeFeed != null) {
|
||||
|
||||
HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentById(R.id.headlines_fragment);
|
||||
|
||||
if (hf != null) {
|
||||
int numSelected = hf.getSelectedArticles().size();
|
||||
|
||||
if (numSelected != 0) {
|
||||
m_menu.setGroupVisible(R.id.menu_group_headlines, false);
|
||||
m_menu.setGroupVisible(R.id.menu_group_headlines_selection, true);
|
||||
} else {
|
||||
m_menu.setGroupVisible(R.id.menu_group_headlines, true);
|
||||
m_menu.setGroupVisible(R.id.menu_group_headlines_selection, false);
|
||||
}
|
||||
|
||||
if (numSelected != 0) {
|
||||
m_menu.setGroupVisible(R.id.menu_group_headlines, false);
|
||||
m_menu.setGroupVisible(R.id.menu_group_headlines_selection, true);
|
||||
} else {
|
||||
m_menu.setGroupVisible(R.id.menu_group_headlines, true);
|
||||
m_menu.setGroupVisible(R.id.menu_group_headlines_selection, false);
|
||||
}
|
||||
|
||||
|
||||
m_menu.setGroupVisible(R.id.menu_group_feeds, false);
|
||||
} else {
|
||||
m_menu.setGroupVisible(R.id.menu_group_feeds, true);
|
||||
}
|
||||
|
||||
if (!m_smallScreenMode || m_activeFeed == null) {
|
||||
/* if (!m_smallScreenMode || m_activeFeed == null) {
|
||||
m_menu.findItem(R.id.show_feeds).setVisible(true);
|
||||
m_menu.findItem(R.id.update_feeds).setVisible(true);
|
||||
}
|
||||
} */
|
||||
|
||||
m_menu.findItem(R.id.back_to_categories).setVisible(m_activeCategory != null);
|
||||
}
|
||||
@ -1804,8 +1798,8 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
||||
@Override
|
||||
public void onTabReselected(Tab tab,
|
||||
android.app.FragmentTransaction _ft) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
closeArticle();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1829,7 +1823,9 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
||||
@Override
|
||||
public void onTabUnselected(Tab tab,
|
||||
android.app.FragmentTransaction _ft) {
|
||||
|
||||
|
||||
closeArticle();
|
||||
|
||||
findViewById(R.id.feeds_fragment).setVisibility(View.GONE);
|
||||
findViewById(R.id.cats_fragment).setVisibility(View.VISIBLE);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user