Skip to content

Commit

Permalink
Now possible to answer or decline a call with TalkBack
Browse files Browse the repository at this point in the history
  • Loading branch information
Yashar committed Feb 5, 2021
1 parent 52ffc38 commit 5fe4a59
Showing 1 changed file with 6 additions and 2 deletions.
Expand Up @@ -212,7 +212,7 @@ public boolean onTouchEvent(MotionEvent event) {
animator.start();
leftAnimator = animator;
if (listener != null) {
if ((!startDrag && Math.abs(dy) < touchSlop && !screenWasWakeup) || leftOffsetX > maxOffset * 0.8f) {
if ((!startDrag && Math.abs(dy) < touchSlop && (!screenWasWakeup || isTouchExplorationEnabled())) || leftOffsetX > maxOffset * 0.8f) {
listener.onDicline();
}
}
Expand All @@ -226,7 +226,7 @@ public boolean onTouchEvent(MotionEvent event) {
animator.start();
rightAnimator = animator;
if (listener != null) {
if ((!startDrag && Math.abs(dy) < touchSlop && !screenWasWakeup) || -rigthOffsetX > maxOffset * 0.8f) {
if ((!startDrag && Math.abs(dy) < touchSlop && (!screenWasWakeup || isTouchExplorationEnabled())) || -rigthOffsetX > maxOffset * 0.8f) {
listener.onAccept();
}
}
Expand Down Expand Up @@ -483,6 +483,10 @@ public void setScreenWasWakeup(boolean screenWasWakeup) {
this.screenWasWakeup = screenWasWakeup;
}

private boolean isTouchExplorationEnabled() {
return ((AcceptDeclineAccessibilityNodeProvider) getAccessibilityNodeProvider()).accessibilityManager.isTouchExplorationEnabled();
}

private static abstract class AcceptDeclineAccessibilityNodeProvider extends AccessibilityNodeProvider {

private final View hostView;
Expand Down

0 comments on commit 5fe4a59

Please sign in to comment.