Java Code Examples for androidx.appcompat.widget.Toolbar#setOverflowIcon()

The following examples show how to use androidx.appcompat.widget.Toolbar#setOverflowIcon() . 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: SettingsActivity.java    From matlog with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);

    Toolbar toolbar = findViewById(R.id.toolbar_actionbar);
    toolbar.setOverflowIcon(AppCompatResources.getDrawable(this, R.drawable.ic_more_vert_24dp));
    setSupportActionBar(toolbar);

    FragmentManager fm = getFragmentManager();
    Fragment f = fm.findFragmentById(R.id.content);
    if (f == null) {
        fm.beginTransaction()
                .replace(R.id.content,
                        new SettingsFragment())
                .commit();
    }
    //noinspection ConstantConditions
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    setTitle(R.string.settings);
}
 
Example 2
Source File: BrandedActivity.java    From nextcloud-notes with GNU General Public License v3.0 6 votes vote down vote up
public void applyBrandToPrimaryToolbar(@NonNull AppBarLayout appBarLayout, @NonNull Toolbar toolbar) {
    // FIXME Workaround for https://github.com/stefan-niedermann/nextcloud-notes/issues/889
    appBarLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.primary));

    final Drawable overflowDrawable = toolbar.getOverflowIcon();
    if (overflowDrawable != null) {
        overflowDrawable.setColorFilter(colorAccent, PorterDuff.Mode.SRC_ATOP);
        toolbar.setOverflowIcon(overflowDrawable);
    }

    final Drawable navigationDrawable = toolbar.getNavigationIcon();
    if (navigationDrawable != null) {
        navigationDrawable.setColorFilter(colorAccent, PorterDuff.Mode.SRC_ATOP);
        toolbar.setNavigationIcon(navigationDrawable);
    }
}
 
Example 3
Source File: BaseActivity.java    From Android-skin-support with MIT License 5 votes vote down vote up
protected void initToolbar() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    toolbar.setTitle("Title");
    toolbar.setSubtitle("Subtitle");
    toolbar.setNavigationIcon(R.drawable.ic_settings_black_24dp);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startActivity(new Intent(BaseActivity.this, SettingsActivity.class));
        }
    });
    toolbar.setOverflowIcon(getResources().getDrawable(R.drawable.ic_camera_24dp));
}
 
Example 4
Source File: LogcatActivity.java    From matlog with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_logcat);

    LogLine.isScrubberEnabled = PreferenceHelper.isScrubberEnabled(this);

    handleShortcuts(getIntent().getStringExtra("shortcut_action"));

    mHandler = new Handler(Looper.getMainLooper());

    findViewById(R.id.fab).setOnClickListener(v -> DialogHelper.stopRecordingLog(LogcatActivity.this));

    ((RecyclerView) findViewById(R.id.list)).setLayoutManager(new LinearLayoutManager(this));

    ((RecyclerView) findViewById(R.id.list)).setItemAnimator(null);

    Toolbar toolbar = findViewById(R.id.toolbar_actionbar);
    toolbar.setOverflowIcon(AppCompatResources.getDrawable(this, R.drawable.ic_more_vert_24dp));
    setSupportActionBar(toolbar);

    mCollapsedMode = !PreferenceHelper.getExpandedByDefaultPreference(this);

    mFilterPattern = PreferenceHelper.getFilterPatternPreference(this);

    log.d("initial collapsed mode is %s", mCollapsedMode);

    mSearchSuggestionsAdapter = new SimpleCursorAdapter(this,
            R.layout.list_item_dropdown,
            null,
            new String[]{"suggestion"},
            new int[]{android.R.id.text1},
            CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);

    setUpAdapter();
    updateBackgroundColor();
    runUpdatesIfNecessaryAndShowWelcomeMessage();
}
 
Example 5
Source File: MainActivity.java    From arcgis-runtime-samples-android with Apache License 2.0 4 votes vote down vote up
private void setupToolbar() {
  Toolbar toolbar = findViewById(R.id.toolbar);
  setSupportActionBar(toolbar);
  toolbar.setOverflowIcon(ContextCompat.getDrawable(this, R.drawable.ic_photo_camera));
}