Example usage for android.app ActionBar NAVIGATION_MODE_STANDARD

List of usage examples for android.app ActionBar NAVIGATION_MODE_STANDARD

Introduction

In this page you can find the example usage for android.app ActionBar NAVIGATION_MODE_STANDARD.

Prototype

int NAVIGATION_MODE_STANDARD

To view the source code for android.app ActionBar NAVIGATION_MODE_STANDARD.

Click Source Link

Document

Standard navigation mode.

Usage

From source file:com.google.samples.apps.iosched.ui.SessionLivestreamActivity.java

/**
 * Load the list of currently live sessions or upcoming live sessions. This
 * populates the Action Bar (either the title or as list navigation.
 *//*from w  w  w .  j  av a2 s .  c om*/
private void loadSessionsList(Cursor data) {
    mLivestreamAdapter.swapCursor(data);
    if (data != null && data.getCount() > 0) {
        mSessionsFound = true;
        final ActionBar actionBar = getActionBar();
        if (data.getCount() == 1) {
            // Just one session on, display title in Action Bar
            if (data.moveToFirst()) {
                actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
                actionBar.setDisplayShowTitleEnabled(true);
                actionBar.setTitle(data.getString(SessionsQuery.TITLE));
            }
        } else if (data.getCount() > 1) {
            // 2+ sessions found, set Action Bar to list navigation (spinner)
            actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
            actionBar.setListNavigationCallbacks(mLivestreamAdapter, this);
            actionBar.setDisplayShowTitleEnabled(false);
            getActionBar().setSelectedNavigationItem(locateSelectedItem(data));
        }
    } else if (mSessionsFound) {
        // Sessions were previously found but no sessions are currently live,
        // adjust query to see if there are any future sessions at all
        mSessionsFound = false;
        final Bundle bundle = new Bundle();
        bundle.putBoolean(LOADER_SESSIONS_ARG, true);
        getLoaderManager().restartLoader(SessionsQuery._TOKEN, bundle, this);
    } else {
        // No sessions live right now and no sessions coming up, get out
        finish();
    }
}

From source file:dev.dworks.apps.anexplorer.DocumentsActivity.java

public void updateActionBar() {
    final ActionBar actionBar = getActionBar();

    actionBar.setDisplayShowHomeEnabled(true);

    final boolean showIndicator = !mShowAsDialog && (mState.action != ACTION_MANAGE);
    actionBar.setDisplayHomeAsUpEnabled(showIndicator);
    if (mDrawerToggle != null) {
        mDrawerToggle.setDrawerIndicatorEnabled(showIndicator);
    }//from  w w w  . ja  v  a  2  s. co  m

    if (isRootsDrawerOpen()) {
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
        actionBar.setIcon(new ColorDrawable());

        if (mState.action == ACTION_OPEN || mState.action == ACTION_GET_CONTENT
                || mState.action == ACTION_BROWSE) {
            actionBar.setTitle(R.string.app_name);
            actionBar.setIcon(R.drawable.ic_launcher);
        } else if (mState.action == ACTION_CREATE) {
            actionBar.setTitle(R.string.title_save);
        }
    } else {
        final RootInfo root = getCurrentRoot();
        //actionBar.setIcon(root != null ? root.loadIcon(this) : null);

        if (mState.stack.size() <= 1) {
            actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
            actionBar.setTitle(root.title);
        } else {
            mIgnoreNextNavigation = true;
            actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
            actionBar.setTitle(null);
            actionBar.setListNavigationCallbacks(mStackAdapter, mStackListener);
            actionBar.setSelectedNavigationItem(mStackAdapter.getCount() - 1);
        }
    }
}

From source file:de.anderdonau.spacetrader.Main.java

public void restoreActionBar() {
    ActionBar actionBar = getActionBar();
    assert actionBar != null;
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setTitle(getString(R.string.app_name));
}

From source file:com.cairoconfessions.MainActivity.java

public void restoreActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    if (mTitle != "Cairo Confessions")
        actionBar.setTitle(mTitle);//w w w  .  j a  va 2s . co m
}

From source file:com.android.contacts.activities.DialtactsActivity.java

/**
 * Hides every tab and shows search UI for phone lookup.
 *///from  w w w  .  j a v  a2 s .  c  om
private void enterSearchUi() {
    if (mSearchFragment == null) {
        // We add the search fragment dynamically in the first onLayoutChange() and
        // mSearchFragment is set sometime later when the fragment transaction is actually
        // executed, which means there's a window when users are able to hit the (physical)
        // search key but mSearchFragment is still null.
        // It's quite hard to handle this case right, so let's just ignore the search key
        // in this case.  Users can just hit it again and it will work this time.
        return;
    }
    if (mSearchView == null) {
        prepareSearchView();
    }

    final ActionBar actionBar = getActionBar();

    final Tab tab = actionBar.getSelectedTab();

    // User can search during the call, but we don't want to remember the status.
    if (tab != null && !DialpadFragment.phoneIsInUse()) {
        mLastManuallySelectedFragment = tab.getPosition();
    }

    mSearchView.setQuery(null, true);

    actionBar.setDisplayShowCustomEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);

    updateFakeMenuButtonsVisibility(false);

    for (int i = 0; i < TAB_INDEX_COUNT; i++) {
        sendFragmentVisibilityChange(i, false /* not visible */ );
    }

    // Show the search fragment and hide everything else.
    mSearchFragment.setUserVisibleHint(true);
    final FragmentTransaction transaction = getFragmentManager().beginTransaction();
    transaction.show(mSearchFragment);
    transaction.commitAllowingStateLoss();
    mViewPager.setVisibility(View.GONE);

    // We need to call this and onActionViewCollapsed() manually, since we are using a custom
    // layout instead of asking the search menu item to take care of SearchView.
    mSearchView.onActionViewExpanded();
    mInSearchUi = true;
}