diff --git a/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java b/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java index 6cc457ac5..dcbc1d61b 100644 --- a/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java @@ -341,7 +341,8 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener private void createMainMenuPopover() { int layout; - if (AndroidUtilities.isTabletSized(this)) + boolean isTablet = AndroidUtilities.isTabletSized(this); + if (isTablet) layout = R.layout.main_menu_popover_tablet; else layout = R.layout.main_menu_popover; @@ -353,6 +354,9 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener mainMenu.setSelected(false); } }); + + if (isTablet) + setupMainMenuForPeopleViewState(getIntent().getBooleanExtra(PEOPLE_VIEW, false)); } private void setupPopoverWithFragment(FragmentPopover popover, Fragment frag, LayoutParams params) { @@ -675,7 +679,10 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener TaskListFragment tlf = getTaskListFragment(); switch (item) { case MainMenuPopover.MAIN_MENU_ITEM_LISTS: - listsNav.performClick(); + if (fragmentLayout == LAYOUT_SINGLE) + listsNav.performClick(); + else + togglePeopleView(); return; case MainMenuPopover.MAIN_MENU_ITEM_SEARCH: onSearchRequested(); @@ -708,9 +715,16 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener else setupFragment(FilterListFragment.TAG_FILTERLIST_FRAGMENT, R.id.filterlist_fragment_container, FilterListFragment.class, false, true); + + setupMainMenuForPeopleViewState(peopleMode); getIntent().putExtra(PEOPLE_VIEW, peopleMode); } + private void setupMainMenuForPeopleViewState(boolean inPeopleMode) { + mainMenuPopover.setFixedItemVisibility(0, inPeopleMode ? View.VISIBLE : View.GONE, true); + mainMenuPopover.setFixedItemVisibility(1, inPeopleMode ? View.GONE : View.VISIBLE, true); + } + public MainMenuPopover getMainMenuPopover() { return mainMenuPopover; } diff --git a/astrid/src/com/todoroo/astrid/ui/MainMenuPopover.java b/astrid/src/com/todoroo/astrid/ui/MainMenuPopover.java index 6aa22d885..7553a1c8f 100644 --- a/astrid/src/com/todoroo/astrid/ui/MainMenuPopover.java +++ b/astrid/src/com/todoroo/astrid/ui/MainMenuPopover.java @@ -97,21 +97,28 @@ public class MainMenuPopover extends FragmentPopover implements InterceptTouchLi private void addFixedItems(boolean isTablet) { int themeFlags = isTablet ? ThemeService.FLAG_FORCE_DARK : 0; - if (!isTablet) - addMenuItem(R.string.TLA_menu_lists, - ThemeService.getDrawable(R.drawable.icn_menu_lists, themeFlags), - MAIN_MENU_ITEM_LISTS, null, topFixed); // Lists item - addMenuItem(R.string.TLA_menu_search, - ThemeService.getDrawable(R.drawable.icn_menu_search, themeFlags), - MAIN_MENU_ITEM_SEARCH, null, topFixed); + addMenuItem(R.string.TLA_menu_lists, + ThemeService.getDrawable(R.drawable.icn_menu_lists, themeFlags), + MAIN_MENU_ITEM_LISTS, null, topFixed); // Lists item addMenuItem(R.string.TLA_menu_friends, R.drawable.icn_anyone, MAIN_MENU_ITEM_FRIENDS, null, topFixed); + addMenuItem(R.string.TLA_menu_search, + ThemeService.getDrawable(R.drawable.icn_menu_search, themeFlags), + MAIN_MENU_ITEM_SEARCH, null, topFixed); addMenuItem(R.string.TLA_menu_settings, ThemeService.getDrawable(R.drawable.icn_menu_settings, themeFlags), MAIN_MENU_ITEM_SETTINGS, null, bottomFixed); // Settings item } + public void setFixedItemVisibility(int index, int visibility, boolean top) { + LinearLayout container = top ? topFixed : bottomFixed; + if (index < 0 || index >= container.getChildCount()) + return; + + container.getChildAt(index).setVisibility(visibility); + } + @Override protected int getArrowLeftMargin(View arrow) { return mRect.centerX() - arrow.getMeasuredWidth() / 2 - (int) (12 * metrics.density);