Skip to content

Commit

Permalink
Basic color and type shouldn't be applied if custom resource is provi…
Browse files Browse the repository at this point in the history
…ded. Fixes IvBaranov#6.
  • Loading branch information
IvBaranov committed Nov 20, 2015
1 parent 0000963 commit 9075019
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ public static final class Builder {
private int mBounceDuration = DEFAULT_BOUNCE_DURATION;
private int mColor = STYLE_WHITE;
private int mType = STYLE_BLACK;
private boolean mCustomRecources = false;

public Builder(Context context) {
this.context = context;
Expand Down Expand Up @@ -428,11 +429,13 @@ public Builder animateUnfavorite(boolean animation) {

public Builder favoriteResource(int resource) {
this.mFavoriteResource = resource;
mCustomRecources = true;
return this;
}

public Builder notFavoriteResource(int recsource) {
this.mNotFavoriteResource = recsource;
mCustomRecources = true;
return this;
}

Expand All @@ -453,11 +456,13 @@ public Builder bounceDuration(int bounceDuration) {

public Builder color(int color) {
this.mColor = color;
mCustomRecources = false;
return this;
}

public Builder type(int type) {
this.mType = type;
mCustomRecources = false;
return this;
}

Expand All @@ -472,8 +477,10 @@ public MaterialFavoriteButton create() {
materialFavoriteButton.setRotationDuration(mRotationDuration);
materialFavoriteButton.setRotationAngle(mRotationAngle);
materialFavoriteButton.setBounceDuration(mBounceDuration);
materialFavoriteButton.setColor(mColor);
materialFavoriteButton.setType(mType);
if (!mCustomRecources) {
materialFavoriteButton.setColor(mColor);
materialFavoriteButton.setType(mType);
}
materialFavoriteButton.setResources();

return materialFavoriteButton;
Expand Down

0 comments on commit 9075019

Please sign in to comment.