Skip to content

Commit

Permalink
MaterialMenu.java, MaterialMenuBase.java: Renamed setIconVisible func…
Browse files Browse the repository at this point in the history
…tion to setVisible.

MaterialMenuDrawable.java, MaterialMenuView.java: Renamed iconVisible var to visible.
  • Loading branch information
mschez committed May 8, 2015
1 parent 22c146c commit b5ddfc1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public interface MaterialMenu {
*
* @param visible new value for visibility
*/
public void setIconVisible(boolean visible);
public void setVisible(boolean visible);

/**
* Set duration of transformation animations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import com.nineoldandroids.animation.Animator;

import static com.balysv.materialmenu.MaterialMenuDrawable.DEFAULT_ICON_VISIBLE;
import static com.balysv.materialmenu.MaterialMenuDrawable.DEFAULT_VISIBLE;
import static com.balysv.materialmenu.MaterialMenuDrawable.DEFAULT_PRESSED_DURATION;
import static com.balysv.materialmenu.MaterialMenuDrawable.DEFAULT_SCALE;
import static com.balysv.materialmenu.MaterialMenuDrawable.DEFAULT_TRANSFORM_DURATION;
Expand All @@ -50,7 +50,7 @@ public MaterialMenuBase(Activity activity, int color, MaterialMenuDrawable.Strok
}

public MaterialMenuBase(Activity activity, int color, MaterialMenuDrawable.Stroke stroke, int transformDuration, int pressedDuration) {
this(activity, color, stroke, DEFAULT_ICON_VISIBLE, transformDuration, pressedDuration);
this(activity, color, stroke, DEFAULT_VISIBLE, transformDuration, pressedDuration);
}

public MaterialMenuBase(Activity activity, int color, MaterialMenuDrawable.Stroke stroke, boolean iconVisible, int transformDuration, int pressedDuration) {
Expand Down Expand Up @@ -120,8 +120,8 @@ public final void setColor(int color) {
}

@Override
public final void setIconVisible(boolean visible) {
getDrawable().setIconVisible(visible);
public final void setVisible(boolean visible) {
getDrawable().setVisible(visible);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ protected static Stroke valueOf(int strokeWidth) {
public static final int DEFAULT_TRANSFORM_DURATION = 800;
public static final int DEFAULT_PRESSED_DURATION = 400;

public static final boolean DEFAULT_ICON_VISIBLE = true;
public static final boolean DEFAULT_VISIBLE = true;

private static final int BASE_DRAWABLE_WIDTH = 40;
private static final int BASE_DRAWABLE_HEIGHT = 40;
Expand Down Expand Up @@ -181,7 +181,7 @@ protected static Stroke valueOf(int strokeWidth) {
private IconState animatingIconState;
private boolean drawTouchCircle;
private boolean neverDrawTouch;
private boolean iconVisible;
private boolean visible;
private boolean rtlEnabled;

private ObjectAnimator transformation;
Expand All @@ -190,19 +190,19 @@ protected static Stroke valueOf(int strokeWidth) {

private MaterialMenuState materialMenuState;

public MaterialMenuDrawable(Context context, int color, Stroke stroke, boolean iconVisible) {
this(context, color, stroke, iconVisible, DEFAULT_SCALE, DEFAULT_TRANSFORM_DURATION, DEFAULT_PRESSED_DURATION);
public MaterialMenuDrawable(Context context, int color, Stroke stroke, boolean visible) {
this(context, color, stroke, visible, DEFAULT_SCALE, DEFAULT_TRANSFORM_DURATION, DEFAULT_PRESSED_DURATION);
}

public MaterialMenuDrawable(Context context, int color, Stroke stroke) {
this(context, color, stroke, DEFAULT_ICON_VISIBLE, DEFAULT_SCALE, DEFAULT_TRANSFORM_DURATION, DEFAULT_PRESSED_DURATION);
this(context, color, stroke, DEFAULT_VISIBLE, DEFAULT_SCALE, DEFAULT_TRANSFORM_DURATION, DEFAULT_PRESSED_DURATION);
}

public MaterialMenuDrawable(Context context, int color, Stroke stroke, int transformDuration, int pressedDuration) {
this(context, color, stroke, DEFAULT_ICON_VISIBLE, DEFAULT_SCALE, transformDuration, pressedDuration);
this(context, color, stroke, DEFAULT_VISIBLE, DEFAULT_SCALE, transformDuration, pressedDuration);
}

public MaterialMenuDrawable(Context context, int color, Stroke stroke, boolean iconVisible, int scale, int transformDuration, int pressedDuration) {
public MaterialMenuDrawable(Context context, int color, Stroke stroke, boolean visible, int scale, int transformDuration, int pressedDuration) {
Resources resources = context.getResources();
// convert each separately due to various densities
this.dip1 = dpToPx(resources, 1) * scale;
Expand All @@ -214,7 +214,7 @@ public MaterialMenuDrawable(Context context, int color, Stroke stroke, boolean i
this.diph = dip1 / 2;

this.stroke = stroke;
this.iconVisible = iconVisible;
this.visible = visible;
this.width = (int) (dpToPx(resources, BASE_DRAWABLE_WIDTH) * scale);
this.height = (int) (dpToPx(resources, BASE_DRAWABLE_HEIGHT) * scale);
this.iconWidth = dpToPx(resources, BASE_ICON_WIDTH) * scale;
Expand Down Expand Up @@ -274,7 +274,7 @@ private void initPaint(int color) {
*/

@Override public void draw(Canvas canvas) {
if(!iconVisible) return;
if(!visible) return;

final float ratio = transformationValue <= 1 ? transformationValue : 2 - transformationValue;

Expand Down Expand Up @@ -711,8 +711,8 @@ public IconState setTransformationOffset(AnimationState animationState, float of
return currentIconState;
}

public void setIconVisible(boolean visible) {
this.iconVisible = visible;
public void setVisible(boolean visible) {
this.visible = visible;
invalidateSelf();
}

Expand Down Expand Up @@ -918,7 +918,7 @@ public Drawable newDrawable() {
pressedCircle.getDuration(), width, height, iconWidth, circleRadius, strokeWidth, dip1
);
drawable.setIconState(animatingIconState != null ? animatingIconState : currentIconState);
drawable.setIconVisible(iconVisible);
drawable.setVisible(visible);
drawable.setRTLEnabled(rtlEnabled);
return drawable;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import com.nineoldandroids.animation.Animator;

import static com.balysv.materialmenu.MaterialMenuDrawable.DEFAULT_COLOR;
import static com.balysv.materialmenu.MaterialMenuDrawable.DEFAULT_ICON_VISIBLE;
import static com.balysv.materialmenu.MaterialMenuDrawable.DEFAULT_VISIBLE;
import static com.balysv.materialmenu.MaterialMenuDrawable.DEFAULT_PRESSED_DURATION;
import static com.balysv.materialmenu.MaterialMenuDrawable.DEFAULT_SCALE;
import static com.balysv.materialmenu.MaterialMenuDrawable.DEFAULT_TRANSFORM_DURATION;
Expand Down Expand Up @@ -65,7 +65,7 @@ private void init(Context context, AttributeSet attributeSet) {

try {
int color = attr.getColor(R.styleable.MaterialMenuView_mm_color, DEFAULT_COLOR);
boolean visible = attr.getBoolean(R.styleable.MaterialMenuView_mm_visible, true);
boolean visible = attr.getBoolean(R.styleable.MaterialMenuView_mm_visible, DEFAULT_VISIBLE);
int scale = attr.getInteger(R.styleable.MaterialMenuView_mm_scale, DEFAULT_SCALE);
int transformDuration = attr.getInteger(R.styleable.MaterialMenuView_mm_transformDuration, DEFAULT_TRANSFORM_DURATION);
int pressedDuration = attr.getInteger(R.styleable.MaterialMenuView_mm_pressedDuration, DEFAULT_PRESSED_DURATION);
Expand Down Expand Up @@ -136,8 +136,8 @@ public void setColor(int color) {
}

@Override
public void setIconVisible(boolean visible) {
drawable.setIconVisible(visible);
public void setVisible(boolean visible) {
drawable.setVisible(visible);
}

@Override
Expand Down

0 comments on commit b5ddfc1

Please sign in to comment.