Java Code Examples for android.support.v7.widget.Toolbar#getOverflowIcon()

The following examples show how to use android.support.v7.widget.Toolbar#getOverflowIcon() . 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: Util.java    From RetroMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
public static void setOverflowButtonColor(final Toolbar toolbar, final int color) {
    Drawable drawable = toolbar.getOverflowIcon();
    if (drawable != null) {
        drawable = DrawableCompat.wrap(drawable);
        DrawableCompat.setTint(drawable.mutate(), color);
        toolbar.setOverflowIcon(drawable);
    }
}
 
Example 2
Source File: NestedRecyclerViewAlbumHolder.java    From Camera-Roll-Android-App with Apache License 2.0 5 votes vote down vote up
static Toolbar getSelectorModeToolbar(Context context,
                                      View.OnClickListener onClickListener,
                                      Toolbar.OnMenuItemClickListener onItemClickListener) {
    final Toolbar toolbar = new Toolbar(context);
    toolbar.setTag(SELECTOR_TOOLBAR_TAG);

    Theme theme = Settings.getInstance(context).getThemeInstance(context);
    int accentColor = theme.getAccentColor(context);
    int accentTextColor = theme.getAccentTextColor(context);

    toolbar.setBackgroundColor(accentColor);

    toolbar.setTitleTextColor(accentTextColor);

    toolbar.inflateMenu(R.menu.selector_mode);
    toolbar.setOnMenuItemClickListener(onItemClickListener);

    Drawable menuIcon = toolbar.getOverflowIcon();
    if (menuIcon != null) {
        DrawableCompat.wrap(menuIcon);
        DrawableCompat.setTint(menuIcon.mutate(), accentTextColor);
    }

    Drawable navIcon = ContextCompat.getDrawable(context,
            R.drawable.ic_clear_white);
    if (navIcon != null) {
        DrawableCompat.wrap(navIcon);
        DrawableCompat.setTint(navIcon.mutate(), accentTextColor);
        toolbar.setNavigationIcon(navIcon);
    }

    toolbar.setNavigationOnClickListener(onClickListener);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        toolbar.setElevation(context.getResources()
                .getDimension(R.dimen.toolbar_elevation));
    }
    return toolbar;
}
 
Example 3
Source File: Util.java    From Camera-Roll-Android-App with Apache License 2.0 5 votes vote down vote up
public static void colorToolbarOverflowMenuIcon(Toolbar toolbar, int color) {
    //set Toolbar overflow icon color
    Drawable drawable = toolbar.getOverflowIcon();
    if (drawable != null) {
        drawable = DrawableCompat.wrap(drawable);
        DrawableCompat.setTint(drawable.mutate(), color);
        toolbar.setOverflowIcon(drawable);
    }
}