/** * helper method to decide for the correct color * * @param ctx * @return */ public int getIconColor(Context ctx) { int iconColor; if (this.isEnabled()) { iconColor = ColorHolder.color(getIconColor(), ctx, R.attr.material_drawer_primary_icon, R.color.material_drawer_primary_icon); } else { iconColor = ColorHolder.color(getDisabledIconColor(), ctx, R.attr.material_drawer_hint_icon, R.color.material_drawer_hint_icon); } return iconColor; }
/** * helper method to decide for the correct color * * @param ctx * @return */ protected int getColor(Context ctx) { int color; if (this.isEnabled()) { color = ColorHolder.color(getTextColor(), ctx, R.attr.material_drawer_primary_text, R.color.material_drawer_primary_text); } else { color = ColorHolder.color(getDisabledTextColor(), ctx, R.attr.material_drawer_hint_text, R.color.material_drawer_hint_text); } return color; }
/** * helper method to decide for the correct color * * @param ctx * @return */ protected int getSelectedColor(Context ctx) { if (getBooleanStyleable(ctx, R.styleable.MaterialDrawer_material_drawer_legacy_style, false)) { return ColorHolder.color(getSelectedColor(), ctx, R.attr.material_drawer_selected_legacy, R.color.material_drawer_selected_legacy); } else { return ColorHolder.color(getSelectedColor(), ctx, R.attr.material_drawer_selected, R.color.material_drawer_selected); } }
/** * for backwards compatibility - withIconTinted.. * * @param iconTinted * @return */ @Deprecated public T withTintSelectedIcon(boolean iconTinted) { return withIconTintingEnabled(iconTinted); }
/** * helper method to decide for the correct color * * @param ctx * @return */ protected int getSelectedIconColor(Context ctx) { return ColorHolder.color(getSelectedIconColor(), ctx, R.attr.material_drawer_selected_text, R.color.material_drawer_selected_text); }
/** * helper method to decide for the correct color * * @param ctx * @return */ protected int getSelectedTextColor(Context ctx) { return ColorHolder.color(getSelectedTextColor(), ctx, R.attr.material_drawer_selected_text, R.color.material_drawer_selected_text); }
@Override public void bindView(ViewHolder viewHolder, List payloads) { super.bindView(viewHolder, payloads);
public T withIcon(IIcon iicon) { this.icon = new ImageHolder(iicon); //if we are on api 21 or higher we use the IconicsDrawable for selection too and color it with the correct color //else we use just the one drawable and enable tinting on press if (Build.VERSION.SDK_INT >= 21) { this.selectedIcon = new ImageHolder(iicon); } else { this.withIconTintingEnabled(true); } return (T) this; }
/** * helper method to decide for the correct color * * @param ctx * @return */ protected int getSelectedIconColor(Context ctx) { return ColorHolder.color(getSelectedIconColor(), ctx, R.attr.material_drawer_selected_text, R.color.material_drawer_selected_text); }
/** * helper method to decide for the correct color * * @param ctx * @return */ protected int getSelectedTextColor(Context ctx) { return ColorHolder.color(getSelectedTextColor(), ctx, R.attr.material_drawer_selected_text, R.color.material_drawer_selected_text); }
/** * helper method to decide for the correct color * * @param ctx * @return */ protected int getColor(Context ctx) { int color; if (this.isEnabled()) { color = ColorHolder.color(getTextColor(), ctx, R.attr.material_drawer_primary_text, R.color.material_drawer_primary_text); } else { color = ColorHolder.color(getDisabledTextColor(), ctx, R.attr.material_drawer_hint_text, R.color.material_drawer_hint_text); } return color; }
/** * helper method to decide for the correct color * * @param ctx * @return */ public int getIconColor(Context ctx) { int iconColor; if (this.isEnabled()) { iconColor = ColorHolder.color(getIconColor(), ctx, R.attr.material_drawer_primary_icon, R.color.material_drawer_primary_icon); } else { iconColor = ColorHolder.color(getDisabledIconColor(), ctx, R.attr.material_drawer_hint_icon, R.color.material_drawer_hint_icon); } return iconColor; }
/** * for backwards compatibility - withIconTinted.. * * @param iconTinted * @return */ @Deprecated public T withTintSelectedIcon(boolean iconTinted) { return withIconTintingEnabled(iconTinted); }
/** * helper method to decide for the correct color * * @param ctx * @return */ protected int getSelectedColor(Context ctx) { return ColorHolder.color(getSelectedColor(), ctx, R.attr.material_drawer_selected, R.color.material_drawer_selected); }
public T withIcon(IIcon iicon) { this.icon = new ImageHolder(iicon); //if we are on api 21 or higher we use the IconicsDrawable for selection too and color it with the correct color //else we use just the one drawable and enable tinting on press if (Build.VERSION.SDK_INT >= 21) { this.selectedIcon = new ImageHolder(iicon); } else { this.withIconTintingEnabled(true); } return (T) this; }