Skip to content

Commit

Permalink
fixing issue that occurred when button was placed in sliding related …
Browse files Browse the repository at this point in the history
…view. Renamed attribute that was clashing with preferences compat lib
  • Loading branch information
jd-alexander committed Apr 11, 2016
1 parent 3ad9e8a commit f01ae10
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion likebutton/src/main/java/com/like/LikeButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ private void init(Context context, AttributeSet attrs, int defStyle) {
}
}

setEnabled(array.getBoolean(R.styleable.LikeButton_enabled,true));
setEnabled(array.getBoolean(R.styleable.LikeButton_is_enabled,true));
Boolean status = array.getBoolean(R.styleable.LikeButton_liked,false);
setAnimationScaleFactor(array.getFloat(R.styleable.LikeButton_anim_scale_factor,3));
setLiked(status);
Expand Down Expand Up @@ -245,7 +245,12 @@ public boolean onTouchEvent(MotionEvent event) {

switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
/*
Commented out this line and moved the animation effect to the action up event due to
conflicts that were occurring when library is used in sliding type views.
icon.animate().scaleX(0.7f).scaleY(0.7f).setDuration(150).setInterpolator(DECCELERATE_INTERPOLATOR);
*/
setPressed(true);
break;

Expand All @@ -259,6 +264,7 @@ public boolean onTouchEvent(MotionEvent event) {
break;

case MotionEvent.ACTION_UP:
icon.animate().scaleX(0.7f).scaleY(0.7f).setDuration(150).setInterpolator(DECCELERATE_INTERPOLATOR);
icon.animate().scaleX(1).scaleY(1).setInterpolator(DECCELERATE_INTERPOLATOR);
if (isPressed()) {
performClick();
Expand Down
2 changes: 1 addition & 1 deletion likebutton/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<attr name="circle_start_color" format="color|reference" />
<attr name="circle_end_color" format="color|reference" />
<attr name="liked" format="boolean"/>
<attr name="enabled" format="boolean"/>
<attr name="is_enabled" format="boolean"/>
<attr name="anim_scale_factor" format="float"/>
</declare-styleable>
</resources>

0 comments on commit f01ae10

Please sign in to comment.