Example usage for android.app ActionBar setNavigationMode

List of usage examples for android.app ActionBar setNavigationMode

Introduction

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

Prototype

@Deprecated
public abstract void setNavigationMode(@NavigationMode int mode);

Source Link

Document

Set the current navigation mode.

Usage

From source file:com.javierd.about.AboutActivity.java

/** Called when the activity is first created. */
@Override//from w  w w  . jav  a2  s  .  c om
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mViewPager = new ViewPager(this);
    mViewPager.setId(R.id.pager);

    setContentView(mViewPager);
    appContext = getApplicationContext();

    ActionBar actionbar = getActionBar();
    actionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionbar.setDisplayShowHomeEnabled(false);
    mTabsAdapter = new TabsAdapter(this, mViewPager);
    mTabsAdapter.addTab(actionbar.newTab().setText(R.string.about_tab_title), AboutFragment.class, null);
    mTabsAdapter.addTab(actionbar.newTab().setText(R.string.features_tab_title), FeaturesFragment.class, null);
    mTabsAdapter.addTab(actionbar.newTab().setText(R.string.dirt_tab_title), DirtFragment.class, null);
    mTabsAdapter.addTab(actionbar.newTab().setText(R.string.contributors_tab_title), ContributorsFragment.class,
            null);
    mTabsAdapter.addTab(actionbar.newTab().setText(R.string.social_tab_title), SocialFragment.class, null);

}

From source file:net.forkk.autocron.EditAutomationActivity.java

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

    Intent intent = getIntent();//from w w w.j a  va  2s  .  co m
    assert intent != null;
    mAutomationPointer = (ComponentPointer) intent.getSerializableExtra(EXTRA_AUTOMATION_POINTER);

    mShowTriggerList = mAutomationPointer instanceof Event.Pointer;

    setContentView(R.layout.activity_edit_automation);

    // Set up the action bar.
    final ActionBar actionBar = getActionBar();
    assert actionBar != null;
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // Create the adapter that will return a fragment for each of the three
    // primary sections of the app.
    mPagerAdapter = new SectionsPagerAdapter(getFragmentManager());

    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mPagerAdapter);

    // When swiping between different sections, select the corresponding
    // tab. We can also use ActionBar.Tab#select() to do this if we have
    // a reference to the Tab.
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            actionBar.setSelectedNavigationItem(position);
        }
    });

    // For each of the sections in the app, add a tab to the action bar.
    for (int i = 0; i < mPagerAdapter.getCount(); i++) {
        // Create a tab with text corresponding to the page title defined by
        // the adapter. Also specify this Activity object, which implements
        // the TabListener interface, as the callback (listener) for when
        // this tab is selected.
        actionBar.addTab(actionBar.newTab().setText(mPagerAdapter.getPageTitle(i)).setTabListener(this));
    }
}

From source file:com.example.ll.llsdktest.MainActivity.java

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

    //configuring SDK
    Setting.configureLimelightSettings("https://staging-api.lvp.llnw.net/rest",
            "https://staging-wlp.lvp.llnw.net/license", "limelight");
    LoggerUtil.setLogLevelByString("Debug", this);
    Setting.SetAnalyticsEndPoint(/*from ww w.  ja  va  2s  . c  o m*/
            "https://staging-mcs.lvp.llnw.net/r/MetricsCollectionService/recordMetricsEvent");

    setContentView(R.layout.activity_main);

    // Set up the action bar.
    final ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // Create the adapter that will return a fragment for each of the three
    // primary sections of the activity.
    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());

    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setOnPageChangeListener(this);
    mViewPager.setAdapter(mSectionsPagerAdapter);
    mViewPager.setOffscreenPageLimit(2);
    actionBar.addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(0)).setTabListener(this));
    actionBar.addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(1)).setTabListener(this));
}

From source file:com.plnyyanks.frcnotebook.activities.ViewEvent.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(PreferenceHandler.getTheme());
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_event);

    activity = this;

    if (event == null) {
        Intent intent = new Intent(this, StartActivity.class);
        startActivity(intent);/*from  ww  w  .  j a  v a2 s .co  m*/
        return;
    }

    ActionBar bar = getActionBar();
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    bar.setTitle(event.getEventName());
    bar.setSubtitle("#" + key);
    bar.setDisplayHomeAsUpEnabled(true);

    //tab for team list
    ActionBar.Tab teamListTab = bar.newTab();
    teamListTab.setText("Teams Attending");
    teamListTab.setTabListener(this);
    bar.addTab(teamListTab);

    //tab for match schedule
    ActionBar.Tab scheduleTab = bar.newTab();
    scheduleTab.setText("Match Schedule");
    scheduleTab.setTabListener(this);
    bar.addTab(scheduleTab);

    if (savedInstanceState != null) {
        bar.setSelectedNavigationItem(savedInstanceState.getInt(STATE_SELECTED_NAVIGATION_ITEM, 0));
    } else {
        bar.setSelectedNavigationItem(0);
    }
}

From source file:ru.lizaalert.hotline.ui.MainActivity.java

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

    // Set up the action bar.
    final ActionBar actionBar = getActionBar();
    assert actionBar != null;
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    mSectionsPagerAdapter = new SectionsPagerAdapter(this, getFragmentManager());

    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mSectionsPagerAdapter);

    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override//w  w  w .j  a  v  a 2s.c  o  m
        public void onPageSelected(int position) {
            actionBar.setSelectedNavigationItem(position);
            if (position == 1) {
                if (getCurrentFocus() != null) {
                    InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(
                            INPUT_METHOD_SERVICE);
                    inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
                }
            }

        }
    });

    for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {

        actionBar
                .addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
    }
}

From source file:org.kanbansalad.scanner.client.android.ScanActivity.java

private void addTabsToActionBar() {
    final ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    configureViewPager();/*from  ww w  .  j  a va  2s.  c  o m*/
    enableSwipeToMoveBetweenTabs(actionBar);

    addTabsTo(actionBar);
}

From source file:org.dmfs.webcal.fragments.GenericListFragment.java

@Override
public void setupActionBar() {
    if (getParentFragment() == null) // the topmost fragment owns the action bar
    {/*from  w w  w  .  j  av  a  2s .  c  om*/
        ActionBar ab = getActivity().getActionBar();
        ab.removeAllTabs();
        ab.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
        FragmentActivity activity = getActivity();
        activity.setTitle(mTitle);
        activity.getActionBar().setTitle(mTitle);
    }
}

From source file:activities.PaintingActivity.java

public void restoreActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setDisplayUseLogoEnabled(true);
    actionBar.setLogo(R.drawable.navbar_logo);
    actionBar.setIcon(R.drawable.ic_drawer);
}

From source file:com.bionx.res.about.InformationCenter.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.information_center);

    mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager());
    final ActionBar actionBar = getActionBar();
    actionBar.setHomeButtonEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mAppSectionsPagerAdapter);
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override/*from  w w  w . ja  v  a 2  s  . co  m*/
        public void onPageSelected(int position) {
            actionBar.setSelectedNavigationItem(position);
        }
    });
    for (int i = 0; i < mAppSectionsPagerAdapter.getCount(); i++) {
        actionBar.addTab(
                actionBar.newTab().setText(mAppSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
    }
}

From source file:org.birthdayadapter.ui.BaseActivity.java

/**
 * Called when the activity is first created.
 *///from  ww  w.j  a  v  a 2 s .  c o m
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mActivity = this;

    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        // Load Activity for Android < 4.0
        Intent oldActivity = new Intent(mActivity, BaseActivityV8.class);
        oldActivity.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        startActivity(oldActivity);
        finish();
    } else {
        // Load new design with tabs
        mViewPager = new ViewPager(this);
        mViewPager.setId(R.id.pager);

        setContentView(mViewPager);

        ActionBar actionBar = getActionBar();
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(false);

        mTabsAdapter = new TabsAdapter(this, mViewPager);

        mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.tab_main)), BaseFragment.class, null);

        mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.tab_preferences)),
                PreferencesFragment.class, null);

        mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.tab_accounts)),
                AccountListFragment.class, null);

        mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.tab_help)), HelpFragment.class, null);

        mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.tab_about)), AboutFragment.class,
                null);

        // default is disabled:
        mActivity.setProgressBarIndeterminateVisibility(Boolean.FALSE);

        mySharedPreferenceChangeListener = new MySharedPreferenceChangeListener(mActivity,
                mBackgroundStatusHandler);

        /*
         * Show workaround dialog for Android bug http://code.google.com/p/android/issues/detail?id=34880
         * Bug exists on Android 4.1 (SDK 16) and on some phones like Galaxy S4
         */
        if (BuildConfig.GOOGLE_PLAY_VERSION && PreferencesHelper.getShowWorkaroundDialog(mActivity)
                && !isPackageInstalled("org.birthdayadapter.jb.workaround")) {
            if ((Build.VERSION.SDK_INT == 16) || Build.DEVICE.toUpperCase().startsWith("GT-I9000")
                    || Build.DEVICE.toUpperCase().startsWith("GT-I9500")) {
                InstallWorkaroundDialogFragment dialog = InstallWorkaroundDialogFragment.newInstance();
                dialog.show(getFragmentManager(), "workaroundDialog");
            }
        }
    }
}