Example usage for android.app ActionBar setListNavigationCallbacks

List of usage examples for android.app ActionBar setListNavigationCallbacks

Introduction

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

Prototype

@Deprecated
public abstract void setListNavigationCallbacks(SpinnerAdapter adapter, OnNavigationListener callback);

Source Link

Document

Set the adapter and navigation callback for list navigation mode.

Usage

From source file:Main.java

public static boolean setListNavigationCallbacks(ActionBar actionBar, ArrayAdapter<CharSequence> adapter,
        ActionBar.OnNavigationListener navigationListener) {

    if (actionBar != null) {
        actionBar.setListNavigationCallbacks(adapter, navigationListener);
        return true;
    } else {//from  w w  w  . j a va2s.c  o  m
        return false;
    }
}

From source file:com.eftimoff.viewpagertransformers.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    int selectedPage = 0;
    if (savedInstanceState != null) {
        mSelectedItem = savedInstanceState.getInt(KEY_SELECTED_CLASS);
        selectedPage = savedInstanceState.getInt(KEY_SELECTED_PAGE);
    }/*from www . j a  va  2 s  .com*/

    final ArrayAdapter<TransformerItem> actionBarAdapter = new ArrayAdapter<TransformerItem>(
            getApplicationContext(), android.R.layout.simple_list_item_1, android.R.id.text1,
            TRANSFORM_CLASSES);

    final ActionBar actionBar = getActionBar();
    actionBar.setListNavigationCallbacks(actionBarAdapter, this);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE);

    setContentView(R.layout.activity_main);

    mAdapter = new PageAdapter(getSupportFragmentManager());

    mPager = (ViewPager) findViewById(R.id.container);
    mPager.setAdapter(mAdapter);
    mPager.setCurrentItem(selectedPage);

    actionBar.setSelectedNavigationItem(mSelectedItem);
}

From source file:com.klowerbase.test.ViewpagerAnimationActivity.java

@SuppressWarnings("deprecation")
@Override/*from   www.ja v  a  2  s . c om*/
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    int selectedPage = 0;
    if (savedInstanceState != null) {
        mSelectedItem = savedInstanceState.getInt(KEY_SELECTED_CLASS);
        selectedPage = savedInstanceState.getInt(KEY_SELECTED_PAGE);
    }

    final ArrayAdapter<TransformerItem> actionBarAdapter = new ArrayAdapter<TransformerItem>(
            getApplicationContext(), android.R.layout.simple_expandable_list_item_1, android.R.id.text1,
            TRANSFORM_CLASSES);

    setContentView(R.layout.viewpageranimation);

    mAdapter = new PageAdapter(getSupportFragmentManager());

    mPager = (ViewPager) findViewById(R.id.container);
    mPager.setAdapter(mAdapter);
    mPager.setCurrentItem(selectedPage);

    final ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setListNavigationCallbacks(actionBarAdapter, this);
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
        //noinspection ResourceType
        actionBar.setDisplayOptions(actionBar.getDisplayOptions() ^ ActionBar.DISPLAY_SHOW_TITLE);

        actionBar.setSelectedNavigationItem(mSelectedItem);
    }

}

From source file:com.ToxicBakery.viewpager.transforms.example.MainActivity.java

@SuppressWarnings("deprecation")
@Override/*from   w w  w.  j  a  v  a 2s .c  o  m*/
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    int selectedPage = 0;
    if (savedInstanceState != null) {
        mSelectedItem = savedInstanceState.getInt(KEY_SELECTED_CLASS);
        selectedPage = savedInstanceState.getInt(KEY_SELECTED_PAGE);
    }

    final ArrayAdapter<TransformerItem> actionBarAdapter = new ArrayAdapter<TransformerItem>(
            getApplicationContext(), android.R.layout.simple_list_item_1, android.R.id.text1,
            TRANSFORM_CLASSES);

    setContentView(R.layout.activity_main);

    mAdapter = new PageAdapter(getFragmentManager());

    mPager = (ViewPager) findViewById(R.id.container);
    mPager.setAdapter(mAdapter);
    mPager.setCurrentItem(selectedPage);

    final ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setListNavigationCallbacks(actionBarAdapter, this);
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

        //noinspection ResourceType
        actionBar.setDisplayOptions(actionBar.getDisplayOptions() ^ ActionBar.DISPLAY_SHOW_TITLE);

        actionBar.setSelectedNavigationItem(mSelectedItem);
    }

}

From source file:com.veggies.android.todoList.MainActivity.java

private void setActionMenu() {
    isDisplayAllList = false;/*ww w.  j  a  v a 2  s .c o  m*/
    ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    actionBar.setListNavigationCallbacks(spinnerAdapter, new DropDownListenser());
}

From source file:com.commonsware.android.feedfrags.FeedsNavActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_nav);/*from ww w.ja  va 2 s.c  o  m*/

    ActionBar bar = getActionBar();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        adapter = new ArrayAdapter<Feed>(bar.getThemedContext(), R.layout.row, Feed.getFeeds());
    } else {
        adapter = new ArrayAdapter<Feed>(this, R.layout.row, Feed.getFeeds());
    }

    bar.setListNavigationCallbacks(adapter, new NavListener());
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE);
    bar.setDisplayHomeAsUpEnabled(true);
}

From source file:com.github.riotopsys.malforandroid2.activity.HubActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.i(TAG, "onCreate");
    setContentView(R.layout.main);// ww  w  .  ja  v a2s .  co m

    ActionBar actionBar = getActionBar();

    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    actionBar
            .setListNavigationCallbacks(
                    new ArrayAdapter<String>(actionBar.getThemedContext(), android.R.layout.simple_list_item_1,
                            android.R.id.text1, getResources().getStringArray(R.array.drop_down_nav_options)),
                    this);

    setupAnimeAdapter();
    setupMangaAdapter();

    if (!state.isSyncScheduled()) {
        //somehow we hit this point with out starting the sync, so we'll do it now
        BootReciever.scheduleSync(state, this);
    }

    if (detailFrame != null) {
        transitionDetail(false);
    }

    if (savedInstanceState != null) {
        actionBar.setSelectedNavigationItem(savedInstanceState.getInt("MODE"));
    }

    apprater.onAppOpened(this);
}

From source file:com.herasymc.cmput301counter.CounterSummaryActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_counter_summary);

    list = CounterList.getInstance(getApplicationContext());
    id = (int) getIntent().getLongExtra("id", -1); // if id is -1, summarize all counters

    // Set up the action bar to show a dropdown list.
    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    // Show the Up button in the action bar.
    actionBar.setDisplayHomeAsUpEnabled(true);

    // Set up the dropdown list navigation in the action bar.
    actionBar.setListNavigationCallbacks(
            // Specify a SpinnerAdapter to populate the dropdown list.
            new ArrayAdapter<String>(actionBar.getThemedContext(), android.R.layout.simple_list_item_1,
                    android.R.id.text1,//from  w w  w  . j a v a 2 s.  com
                    new String[] { getString(R.string.title_summary_minute),
                            getString(R.string.title_summary_hour), getString(R.string.title_summary_day),
                            getString(R.string.title_summary_week), getString(R.string.title_summary_month) }),
            this);
}

From source file:org.floens.chan.ui.activity.BoardActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    boardFragment = ThreadFragment.newInstance(this);
    threadFragment = ThreadFragment.newInstance(this);

    FragmentTransaction ft = getFragmentManager().beginTransaction();
    ft.replace(R.id.left_pane, boardFragment);
    ft.replace(R.id.right_pane, threadFragment);
    ft.commitAllowingStateLoss();//from   ww w  .  ja va  2s . co  m

    final ActionBar actionBar = getActionBar();
    actionBar.setListNavigationCallbacks(
            new ArrayAdapter<String>(actionBar.getThemedContext(), R.layout.board_select_spinner,
                    android.R.id.text1, ChanApplication.getBoardManager().getSavedKeys()),
            this);

    updatePaneState();
    updateActionBarState();

    Intent startIntent = getIntent();
    Uri startUri = startIntent.getData();

    if (savedInstanceState != null) {
        threadLoadable.readFromBundle(this, "thread", savedInstanceState);
        startLoadingThread(threadLoadable);

        // Reset page etc.
        Loadable tmp = new Loadable();
        tmp.readFromBundle(this, "board", savedInstanceState);
        loadBoard(tmp.board);
    } else {
        if (startUri != null) {
            handleIntentURI(startUri);
        }

        if (boardLoadable.mode == Loadable.Mode.INVALID) {
            List<String> savedValues = ChanApplication.getBoardManager().getSavedValues();
            if (savedValues.size() > 0) {
                loadBoard(savedValues.get(0));
            }
        }
    }
}

From source file:com.google.adsensequickstart.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(R.layout.activity_main);

    apiController = ApiController.getApiController(this);

    // Set up the action bar to show a dropdown list.
    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    // Set up the dropdown list navigation in the action bar.
    actionBar.setListNavigationCallbacks(
            // Specify a SpinnerAdapter to populate the dropdown list.
            new ArrayAdapter<String>(actionBar.getThemedContext(), android.R.layout.simple_list_item_1,
                    android.R.id.text1, new String[] { getString(R.string.title_section1),
                            getString(R.string.title_section2), getString(R.string.title_section3) }),
            this);
}