Java Code Examples for android.support.v7.app.ActionBar#getNavigationMode()

The following examples show how to use android.support.v7.app.ActionBar#getNavigationMode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java    From ui with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected( MenuItem item )
{
	boolean ret;
	if (item.getItemId() == R.id.menu_settings)
	{
		// Handle Settings
		ret = true;
	} else if (item.getItemId() == R.id.menu_toggle)
	{
		ActionBar ab = getSupportActionBar();
		if (ab.getNavigationMode() == ActionBar.NAVIGATION_MODE_TABS)
		{
			setListNavigation( ab );
			mSearchItem.setVisible( false );
		} else
		{
			setTabNavigation( ab );
			mSearchItem.setVisible( true );
		}
		ret = true;
	} else if( item.getItemId() == R.id.menu_actionmode)
	{
		startSupportActionMode(mCallback);
		ret = true;
	} else
	{
		ret = super.onOptionsItemSelected( item );
	}
	return ret;
}
 
Example 2
Source File: ActionBarTabs.java    From V.FlyoutTest with MIT License 5 votes vote down vote up
public void onToggleTabs(View v) {
    final ActionBar bar = getSupportActionBar();

    if (bar.getNavigationMode() == ActionBar.NAVIGATION_MODE_TABS) {
        bar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
        bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE);
    } else {
        bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
        bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
    }
}