mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 20:15:21 +00:00
parent
4de14a5dc1
commit
f22186e6f4
@ -52,6 +52,8 @@ public class WebRtcAnswerDeclineButton extends LinearLayout implements View.OnTo
|
|||||||
private float lastY;
|
private float lastY;
|
||||||
|
|
||||||
private boolean animating = false;
|
private boolean animating = false;
|
||||||
|
private boolean complete = false;
|
||||||
|
|
||||||
private AnimatorSet animatorSet;
|
private AnimatorSet animatorSet;
|
||||||
private AnswerDeclineListener listener;
|
private AnswerDeclineListener listener;
|
||||||
|
|
||||||
@ -162,8 +164,11 @@ public class WebRtcAnswerDeclineButton extends LinearLayout implements View.OnTo
|
|||||||
if (percentageToThreshold == 1 && listener != null) {
|
if (percentageToThreshold == 1 && listener != null) {
|
||||||
fab.setVisibility(View.INVISIBLE);
|
fab.setVisibility(View.INVISIBLE);
|
||||||
lastY = event.getRawY();
|
lastY = event.getRawY();
|
||||||
|
if (!complete) {
|
||||||
|
complete = true;
|
||||||
listener.onAnswered();
|
listener.onAnswered();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
differenceThreshold = ViewUtil.dpToPx(getContext(), DECLINE_THRESHOLD);
|
differenceThreshold = ViewUtil.dpToPx(getContext(), DECLINE_THRESHOLD);
|
||||||
percentageToThreshold = Math.min(1, difference / differenceThreshold);
|
percentageToThreshold = Math.min(1, difference / differenceThreshold);
|
||||||
@ -180,9 +185,13 @@ public class WebRtcAnswerDeclineButton extends LinearLayout implements View.OnTo
|
|||||||
if (percentageToThreshold == 1 && listener != null) {
|
if (percentageToThreshold == 1 && listener != null) {
|
||||||
fab.setVisibility(View.INVISIBLE);
|
fab.setVisibility(View.INVISIBLE);
|
||||||
lastY = event.getRawY();
|
lastY = event.getRawY();
|
||||||
|
|
||||||
|
if (!complete) {
|
||||||
|
complete = true;
|
||||||
listener.onDeclined();
|
listener.onDeclined();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
fab.getBackground().setTint(backgroundColor);
|
fab.getBackground().setTint(backgroundColor);
|
||||||
@ -287,6 +296,7 @@ public class WebRtcAnswerDeclineButton extends LinearLayout implements View.OnTo
|
|||||||
|
|
||||||
private void resetElements() {
|
private void resetElements() {
|
||||||
animating = false;
|
animating = false;
|
||||||
|
complete = false;
|
||||||
animatorSet.cancel();
|
animatorSet.cancel();
|
||||||
|
|
||||||
swipeUpText.setTranslationY(0);
|
swipeUpText.setTranslationY(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user