Skip to content

Commit

Permalink
make coloring icon optional
Browse files Browse the repository at this point in the history
  • Loading branch information
medyo committed May 9, 2016
1 parent 78b7be2 commit fc88f6c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
12 changes: 7 additions & 5 deletions library/src/main/java/mehdi/sakout/aboutpage/AboutPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,14 @@ public void onClick(View view) {

Drawable wrappedDrawable = DrawableCompat.wrap(iconView.getDrawable());
wrappedDrawable = wrappedDrawable.mutate();

if (element.getColor() != null) {
DrawableCompat.setTint(wrappedDrawable, element.getColor());
} else {
DrawableCompat.setTint(wrappedDrawable, ContextCompat.getColor(mContext, R.color.about_item_icon_color));
if (element.getAutoIconColor()){
if (element.getColor() != null) {
DrawableCompat.setTint(wrappedDrawable, element.getColor());
} else {
DrawableCompat.setTint(wrappedDrawable, ContextCompat.getColor(mContext, R.color.about_item_icon_color));
}
}

} else {
int iconPadding = mContext.getResources().getDimensionPixelSize(R.dimen.about_icon_padding);
textView.setPadding(iconPadding, iconPadding, iconPadding, iconPadding);
Expand Down
10 changes: 10 additions & 0 deletions library/src/main/java/mehdi/sakout/aboutpage/Element.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class Element {
private String value;
private Intent intent;
private Integer gravity;
private Boolean autoIconColor = true;

private View.OnClickListener onClickListener;

Expand Down Expand Up @@ -98,4 +99,13 @@ public Element setIntent(Intent intent) {
this.intent = intent;
return this;
}

public Boolean getAutoIconColor() {
return autoIconColor;
}

public Element setAutoIconColor(Boolean autoIconColor) {
this.autoIconColor = autoIconColor;
return this;
}
}

0 comments on commit fc88f6c

Please sign in to comment.