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

The following examples show how to use android.support.v7.app.ActionBar#setNavigationMode() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: sms-ticket   File: MainActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // setup actionbar tabs
    ActionBar bar = getSupportActionBar();
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    bar.addTab(bar.newTab().setText(getString(R.string.tab_tickets)).setTabListener(mTabListener));
    bar.addTab(bar.newTab().setText(getString(R.string.tab_statistics)).setTabListener(mTabListener));
    if (savedInstanceState != null) {
        mSelectedTab = savedInstanceState.getInt("selectedTab", TAB_TICKETS);
    }
    bar.setSelectedNavigationItem(mSelectedTab);
    handleIntent(getIntent());
    UpdateService.call(this, false);
    checkForHigherPriorityReceivers();
    checkForSim();
    checkForEula();
}
 
Example 2
Source Project: easy-adapter   File: MainActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(new MyPageAdapter(getSupportFragmentManager()));
    mViewPager.setOnPageChangeListener(mPageChangeListener);
    final ActionBar actionBar = getSupportActionBar();
    if (actionBar!= null) {
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
        actionBar.addTab(actionBar
                .newTab()
                .setText(getString(R.string.tab_1_name))
                .setTabListener(mTabListener));
        actionBar.addTab(actionBar
                .newTab()
                .setText(getString(R.string.tab_2_name))
                .setTabListener(mTabListener));
    }
}
 
Example 3
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.about_main);

    // Set up the action bar.
    final ActionBar actionBar = getSupportActionBar();
    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.setAdapter(mSectionsPagerAdapter);

    // 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 < mSectionsPagerAdapter.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(mSectionsPagerAdapter.getPageTitle(i))
                        .setTabListener(this));
    }
}
 
Example 4
/**
     * Per the navigation drawer design guidelines, updates the action bar to show the global app
     * 'context', rather than just what's in the current screen.
     */
    private void showGlobalContextActionBar() {
        ActionBar actionBar = getActionBar();
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
//        actionBar.setTitle(R.string.app_name);
    }
 
Example 5
@Override
protected void onCreate(Bundle savedInstanceState) {
    Log_OC.d(TAG, "onCreate() start");

    super.onCreate(savedInstanceState);

    setContentView(R.layout.files_folder_picker);

    if (savedInstanceState == null) {
        createFragments();
    }


    fpToolbar = (Toolbar) findViewById(R.id.toolbar);
    if (fpToolbar != null)
    {
        setSupportActionBar(fpToolbar);
    }
    // sets callback listeners for UI elements
    initControls();

    // Action bar setup
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);

    mProgressBar = (ProgressBar) findViewById(R.id.progressBar);
    mProgressBar.setIndeterminateDrawable(
            getResources().getDrawable(
                    R.drawable.actionbar_progress_indeterminate_horizontal));
    mProgressBar.setIndeterminate(mSyncInProgress);
    // always AFTER setContentView(...) ; to work around bug in its implementation

    // sets message for empty list of folders
    setBackgroundText();

    Log_OC.d(TAG, "onCreate() end");
}
 
Example 6
/**
 * Per the navigation drawer design guidelines, updates the action bar to show the global app
 * 'context', rather than just what's in the current screen.
 */
private void showGlobalContextActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setTitle(R.string.app_name);
}
 
Example 7
Source Project: support   File: MarkdownDemo.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_markdown_demo);

    // Set up the action bar.
    final ActionBar actionBar = getSupportActionBar();
    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.setAdapter(mSectionsPagerAdapter);

    // 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 < mSectionsPagerAdapter.getCount(); i++) {
        actionBar.addTab(
                actionBar.newTab()
                        .setText(mSectionsPagerAdapter.getPageTitle(i))
                        .setTabListener(this));
    }
}
 
Example 8
/**
 * Per the navigation drawer design guidelines, updates the action bar to show the global app
 * 'context', rather than just what's in the current screen.
 */
private void showGlobalContextActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setTitle(R.string.app_name);
}
 
Example 9
/**
 * Per the navigation drawer design guidelines, updates the action bar to show the global app
 * 'context', rather than just what's in the current screen.
 */
private void showGlobalContextActionBar() {
  ActionBar actionBar = getActionBar();
  actionBar.setDisplayShowTitleEnabled(true);
  actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
  actionBar.setTitle(R.string.app_name);
}
 
Example 10
Source Project: QuickReturn   File: MainActivity.java    License: MIT License 5 votes vote down vote up
@Override protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  ActionBar actionBar = getSupportActionBar();
  actionBar.setTitle("");
  actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
  String[] actionBarItems = { "ListView", "GridView", "ScrollView" };
  SpinnerAdapter spinnerAdapter = new ArrayAdapter<>(this, R.layout.action_bar_spinner_text,
      actionBarItems);

  actionBar.setListNavigationCallbacks(spinnerAdapter, this);

  initialize(R.layout.activity_main);
}
 
Example 11
/**
 * Per the navigation drawer design guidelines, updates the action bar to
 * show the global app 'context', rather than just what's in the current
 * screen.
 */
private void showGlobalContextActionBar() {
	ActionBar actionBar = getActionBar();
	actionBar.setDisplayShowTitleEnabled(true);
	actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
	actionBar.setTitle(R.string.app_name);
}
 
Example 12
Source Project: EazeGraph   File: ChartActivity.java    License: Apache License 2.0 4 votes vote down vote up
public void restoreActionBar() {
    ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(mTitle);
}
 
Example 13
Source Project: jus   File: MainActivity.java    License: Apache License 2.0 4 votes vote down vote up
public void restoreActionBar() {
    ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(mTitle);
}
 
Example 14
public void restoreActionBar() {
    ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    //  actionBar.setTitle(mTitle);
}
 
Example 15
public void restoreActionBar() {
    ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(mTitle);
}
 
Example 16
public void restoreActionBar() {
    ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(mTitle);
}
 
Example 17
Source Project: actionbarextras   File: DropdownProxy.java    License: MIT License 4 votes vote down vote up
private void handleAdd(boolean keepTitle){
	ActionBar actionBar = ((AppCompatActivity)getActivity()).getSupportActionBar();
	actionBar.setDisplayShowTitleEnabled(keepTitle);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
}
 
Example 18
@Override
protected void onCreate(Bundle savedInstanceState) {
    // createFontAwesomeEngine();
    IconicFontEngine.addDefaultEngine(
            new FontAwesomeEngine(Typeface.createFromAsset(getAssets(), "fonts/fontawesome-webfont.ttf")));
    IconicFontEngine.addDefaultEngine(
            new TypiconsEngine(Typeface.createFromAsset(getAssets(), "fonts/typicons.ttf")));

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Set up the action bar.
    final ActionBar actionBar = getSupportActionBar();
    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.setAdapter(mSectionsPagerAdapter);

    // 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 < mSectionsPagerAdapter.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(mSectionsPagerAdapter.getPageTitle(i))
                        .setTabListener(this));
    }
}
 
Example 19
public void restoreActionBar() {
    ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(mTitle);
}
 
Example 20
public void restoreActionBar() {
	ActionBar actionBar = getSupportActionBar();
	actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
	actionBar.setDisplayShowTitleEnabled(true);
	actionBar.setTitle(mTitle);
}