Skip to content

Commit

Permalink
added method to enable/disable long hold
Browse files Browse the repository at this point in the history
  • Loading branch information
abdularis committed Sep 2, 2019
1 parent 8eb3be1 commit 475d2b9
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class TapHoldUpButton extends View {
private int mCircleColor;
private int mCircleColorOnHold;

private boolean longHoldEnabled = true;
private float mScalePercentage = 1f;
private boolean longHold = false;
private int touchState;
Expand Down Expand Up @@ -64,6 +65,10 @@ public void setOnButtonClickListener(OnButtonClickListener listener) {
mClickListener = listener;
}

public void enableLongHold(boolean enable) {
longHoldEnabled = enable;
}

public void resetLongHold() {
if (!longHold)
return;
Expand Down Expand Up @@ -100,6 +105,8 @@ public boolean onTouchEvent(MotionEvent event) {
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
if (!longHoldEnabled)
return;
if (touchState == MotionEvent.ACTION_DOWN) {
longHold = true;
startColorChangeAnimation(mCircleColor, mCircleColorOnHold);
Expand Down

0 comments on commit 475d2b9

Please sign in to comment.