Java Code Examples for androidx.appcompat.app.ActionBar#setNavigationMode()

The following examples show how to use androidx.appcompat.app.ActionBar#setNavigationMode() . 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: TableFragment.java    From android_dbinspector with Apache License 2.0 6 votes vote down vote up
private void setUpActionBar() {
    final ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();

    actionBar.setTitle(tableName);
    actionBar.setDisplayHomeAsUpEnabled(true);

    // Set up the action bar to show a dropdown list.
    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<>(actionBar.getThemedContext(), android.R.layout.simple_list_item_1,
                    android.R.id.text1, new String[]{getString(R.string.dbinspector_content),
                    getString(R.string.dbinspector_structure), getString(R.string.dbinspector_foreign_keys),
                    getString(R.string.dbinspector_indexes)}),
            this);
}
 
Example 2
Source File: BaseActivity.java    From braintree-android-drop-in with MIT License 5 votes vote down vote up
@SuppressWarnings("ConstantConditions")
private void setupActionBar() {
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
            R.array.environments, android.R.layout.simple_spinner_dropdown_item);
    actionBar.setListNavigationCallbacks(adapter, this);
    actionBar.setSelectedNavigationItem(Settings.getEnvironment(this));
}
 
Example 3
Source File: NavigationDrawerFragment.java    From Applozic-Android-SDK with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * 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 4
Source File: NavigationDrawerFragment.java    From android-ads with Apache License 2.0 5 votes vote down vote up
/**
 * 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
Source File: NavigationDrawerFragment.java    From fragment-navigation with Apache License 2.0 5 votes vote down vote up
/**
 * 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 6
Source File: BaseActivity.java    From braintree_android with MIT License 5 votes vote down vote up
@SuppressWarnings("ConstantConditions")
private void setupActionBar() {
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.environments,
            android.R.layout.simple_spinner_dropdown_item);
    actionBar.setListNavigationCallbacks(adapter, this);

    List<String> envs = Arrays.asList(getResources().getStringArray(R.array.environments));
    actionBar.setSelectedNavigationItem(envs.indexOf(Settings.getEnvironment(this)));
}
 
Example 7
Source File: NavigationDrawerFragment.java    From googleads-mobile-android-examples with Apache License 2.0 5 votes vote down vote up
/**
 * 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 8
Source File: MainActivity.java    From Applozic-Android-SDK with BSD 3-Clause "New" or "Revised" License 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 9
Source File: MainActivity.java    From android-ads with 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(title);
}
 
Example 10
Source File: MainActivity.java    From fragment-navigation with 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);
}
 
Example 11
Source File: MainActivity.java    From googleads-mobile-android-examples with 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(title);
}