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

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

Introduction

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

Prototype

public abstract void setNavigationMode(int mode);

Source Link

Document

Set the current navigation mode.

Usage

From source file:com.abcvoipsip.ui.prefs.Codecs.java

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

    setContentView(R.layout.codecs_pager);

    final ActionBar ab = getSupportActionBar();
    ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    ab.setDisplayShowHomeEnabled(true);//from w  w w .  j ava 2 s.  co m
    ab.setDisplayShowTitleEnabled(true);

    mViewPager = (ViewPager) findViewById(R.id.pager);
    TabsAdapter tabAdapter = new TabsAdapter(this, ab, mViewPager);

    Tab audioNb = ab.newTab().setText(R.string.narrow_band).setIcon(R.drawable.ic_prefs_media);
    Tab audioWb = ab.newTab().setText(R.string.wide_band).setIcon(R.drawable.ic_prefs_media);
    Tab videoNb = ab.newTab().setText(R.string.narrow_band).setIcon(R.drawable.ic_prefs_media_video);
    Tab videoWb = ab.newTab().setText(R.string.wide_band).setIcon(R.drawable.ic_prefs_media_video);

    tabAdapter.addTab(audioWb, CodecsFragment.class);
    tabAdapter.addTab(audioNb, CodecsFragment.class);
    tabAdapter.addTab(videoWb, CodecsFragment.class);
    tabAdapter.addTab(videoNb, CodecsFragment.class);
}

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);
    }/*from w  ww .  ja  va2 s.  co m*/
}

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

private void showTabsNav() {
    ActionBar ab = getSupportActionBar();
    if (ab.getNavigationMode() != ActionBar.NAVIGATION_MODE_TABS) {
        ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    }//www  . j  a  v a2 s  .com
}

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

private void showStandardNav() {
    ActionBar ab = getSupportActionBar();
    if (ab.getNavigationMode() != ActionBar.NAVIGATION_MODE_STANDARD) {
        ab.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    }/*w ww . j a va 2s.com*/
}

From source file:com.abcvoipsip.ui.SipHome.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    //prefWrapper = new PreferencesWrapper(this);
    prefProviderWrapper = new PreferencesProviderWrapper(this);

    /*/*  w w  w . j a  v a 2  s  .com*/
     * Resources r; try { r =
     * getPackageManager().getResourcesForApplication("com.etatgere"); int
     * rThemeId = r.getIdentifier("com.etatgere:style/LightTheme", null,
     * null); Log.e(THIS_FILE, "Remote theme " + rThemeId); Theme t =
     * r.newTheme(); t.applyStyle(rThemeId, false); //getTheme().setTo(t); }
     * catch (NameNotFoundException e) { Log.e(THIS_FILE,
     * "Not found app etatgere"); }
     */
    if (USE_LIGHT_THEME) {
        setTheme(R.style.LightTheme_noTopActionBar);
    }

    super.onCreate(savedInstanceState);

    setContentView(R.layout.sip_home);

    final ActionBar ab = getSupportActionBar();
    ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    // ab.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    // showAbTitle = Compatibility.hasPermanentMenuKey

    ab.setDisplayShowHomeEnabled(false);
    ab.setDisplayShowTitleEnabled(false);

    Tab dialerTab = ab.newTab()
            // .setText(R.string.dial_tab_name_text)
            .setIcon(R.drawable.ic_ab_dialer_holo_dark);
    Tab callLogTab = ab.newTab()
            // .setText(R.string.calllog_tab_name_text)
            .setIcon(R.drawable.ic_ab_history_holo_dark);

    Tab favoritesTab = ab.newTab()
            // .setText(R.string.messages_tab_name_text)
            .setIcon(R.drawable.ic_ab_favourites_holo_dark);

    Tab messagingTab = null;
    if (CustomDistribution.supportMessaging()) {
        messagingTab = ab.newTab()
                // .setText(R.string.messages_tab_name_text)
                .setIcon(R.drawable.ic_ab_text_holo_dark);
    }

    mDualPane = getResources().getBoolean(R.bool.use_dual_panes);

    mViewPager = (ViewPager) findViewById(R.id.pager);
    mTabsAdapter = new TabsAdapter(this, getSupportActionBar(), mViewPager);
    mTabsAdapter.addTab(dialerTab, DialerFragment.class);
    mTabsAdapter.addTab(callLogTab, CallLogListFragment.class);
    mTabsAdapter.addTab(favoritesTab, FavListFragment.class);
    if (messagingTab != null) {
        mTabsAdapter.addTab(messagingTab, ConversationsListFragment.class);
    }

    hasTriedOnceActivateAcc = false;

    if (!prefProviderWrapper.getPreferenceBooleanValue(SipConfigManager.PREVENT_SCREEN_ROTATION)) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
    }

    selectTabWithAction(getIntent());
    Log.setLogLevel(prefProviderWrapper.getLogLevel());

    // Async check
    asyncSanityCheker = new Thread() {
        public void run() {
            asyncSanityCheck();
        };
    };
    asyncSanityCheker.start();
}

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

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

    if (savedInstanceState != null && savedInstanceState.getInt("theme", -1) != -1) {
        mThemeId = savedInstanceState.getInt("theme");
        this.setTheme(mThemeId);
    }/*from w w  w .  j a va  2  s .  c o m*/

    setContentView(R.layout.main);

    Directory.initializeDirectory();

    ActionBar bar = getSupportActionBar();

    int i;
    for (i = 0; i < Directory.getCategoryCount(); i++) {
        bar.addTab(bar.newTab().setText(Directory.getCategory(i).getName()).setTabListener(this));
    }

    mActionBarView = getLayoutInflater().inflate(R.layout.action_bar_custom, null);

    bar.setCustomView(mActionBarView);
    bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_USE_LOGO);
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    bar.setDisplayShowHomeEnabled(true);

    // If category is not saved to the savedInstanceState,
    // 0 is returned by default.
    if (savedInstanceState != null) {
        int category = savedInstanceState.getInt("category");
        bar.selectTab(bar.getTabAt(category));
    }
}