Example usage for android.support.v4.app ActionBar NAVIGATION_MODE_LIST

List of usage examples for android.support.v4.app ActionBar NAVIGATION_MODE_LIST

Introduction

In this page you can find the example usage for android.support.v4.app ActionBar NAVIGATION_MODE_LIST.

Prototype

int NAVIGATION_MODE_LIST

To view the source code for android.support.v4.app ActionBar NAVIGATION_MODE_LIST.

Click Source Link

Document

List navigation mode.

Usage

From source file:org.androidui.app.ActionBarImpl.java

@Override
public int getNavigationItemCount() {
    switch (mActionView.getNavigationMode()) {
    default:/*ww  w. ja v a  2s  .c om*/
    case ActionBar.NAVIGATION_MODE_STANDARD:
        return 0;

    case ActionBar.NAVIGATION_MODE_LIST:
        SpinnerAdapter dropdownAdapter = mActionView.getDropdownAdapter();
        return (dropdownAdapter != null) ? dropdownAdapter.getCount() : 0;

    case ActionBar.NAVIGATION_MODE_TABS:
        if (mActionView.getSelectedTab() == null) {
            return -1;
        }
        return mActionView.getTabCount();
    }
}

From source file:org.androidui.app.ActionBarImpl.java

@Override
public int getSelectedNavigationIndex() {
    switch (mActionView.getNavigationMode()) {
    default:/*from   w w w  .  jav  a 2  s.  co  m*/
    case ActionBar.NAVIGATION_MODE_STANDARD:
        return -1;

    case ActionBar.NAVIGATION_MODE_LIST:
        return mActionView.getDropdownSelectedPosition();

    case ActionBar.NAVIGATION_MODE_TABS:
        return mActionView.getSelectedTab().getPosition();
    }
}

From source file:com.actionbarsherlock.sample.styledactionbar.MainActivity.java

private void showDropDownNav() {
    ActionBar ab = getSupportActionBar();
    if (ab.getNavigationMode() != ActionBar.NAVIGATION_MODE_LIST) {
        ab.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    }/* ww w . java 2s . co  m*/
}

From source file:org.androidui.app.ActionBarImpl.java

@Override
public void setSelectedNavigationItem(int position) {
    switch (mActionView.getNavigationMode()) {
    default:// www  . j a  v a 2 s  .  c  o  m
    case ActionBar.NAVIGATION_MODE_STANDARD:
        throw new IllegalStateException();

    case ActionBar.NAVIGATION_MODE_TABS:
        mActionView.getTabAt(position).select();
        break;

    case ActionBar.NAVIGATION_MODE_LIST:
        mActionView.setDropdownSelectedPosition(position);
        break;
    }
}