/** * Retrieves the String resource ID of the currently selected navigation tab. * * @return the String resource ID of the selected {@link ActionBar.Tab}, else {@code 0} if no * navigation tabs are available * @since 1.1.0 */ protected int getSelectedTab() { ActionBar actionBar = getActionBar(); return (actionBar != null && actionBar.getNavigationItemCount() > 0) ? navigationResourceIds[(Integer) actionBar.getSelectedNavigationIndex()] : 0; }
public void saveNavigationPositionToDB() { int navPosition = getMenuFragment().getCurrentIndex() * 10; ActionBar actionBar = getActionBar(); int second = 0; if (actionBar.getNavigationMode() != ActionBar.NAVIGATION_MODE_STANDARD) { second = actionBar.getSelectedNavigationIndex(); } int result = navPosition + second; GlobalContext.getInstance().getAccountBean().setNavigationPosition(result); AccountDBTask.updateNavigationPosition(GlobalContext.getInstance().getAccountBean(), result); }
/** * This is meant to be called from the intent handling. It handles the two possible cases that * this app was already running when it received the intent or it was started fresh with the * intent meaning we have to handle the opening asynchronously. * * @param listId */ private void openListFromIntent(long listId) { if (beforeBoot) { // Set the variable to be selected after the loader has // finished its query listIdToSelect = listId; Log.d(TAG, "beforeBoot setting future id"); } else { // Select the list directly since the loader is done int pos = getPosOfId(listId); Log.d("FragmentLayout", "pos: " + pos); if (pos > -1) { // select it ActionBar ab = getActionBar(); if (ab != null && ab.getSelectedNavigationIndex() != pos) { ab.setSelectedNavigationItem(pos); } } } }
@Override public int getSelectedNavigationIndex() { return mActionBar.getSelectedNavigationIndex(); }
public int getListNavSelectIndex() { ActionBar actionBar = getActionBar(); return actionBar.getSelectedNavigationIndex(); }