diff options
author | Santos Cordon <santoscordon@google.com> | 2014-08-06 03:59:12 -0700 |
---|---|---|
committer | Santos Cordon <santoscordon@google.com> | 2014-08-06 12:57:50 -0700 |
commit | 72dd0d42c60418da0e006ea9ea39fb2da2898a05 (patch) | |
tree | e660c8c5b1cec3c89c461af58dbfc0c87194bcb2 | |
parent | 164075975ba3ccabb9fcc3d78c6c5f5c1d281e10 (diff) |
Send a stopDtmf() on click for talkback.
Bug: 15921080
Change-Id: I89f5c9da7dec1fe9af4cd85cb541020741eb1354
-rw-r--r-- | InCallUI/src/com/android/incallui/DialpadFragment.java | 21 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/DialpadPresenter.java | 2 |
2 files changed, 18 insertions, 5 deletions
diff --git a/InCallUI/src/com/android/incallui/DialpadFragment.java b/InCallUI/src/com/android/incallui/DialpadFragment.java index b22141b95..e15f1bccb 100644 --- a/InCallUI/src/com/android/incallui/DialpadFragment.java +++ b/InCallUI/src/com/android/incallui/DialpadFragment.java @@ -18,6 +18,8 @@ package com.android.incallui; import android.content.Context; import android.os.Bundle; +import android.os.Handler; +import android.os.Looper; import android.text.Editable; import android.text.method.DialerKeyListener; import android.util.AttributeSet; @@ -46,6 +48,8 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadPrese private static final float DIALPAD_SLIDE_FRACTION = 1.0f; + private static final int ACCESSIBILITY_DTMF_STOP_DELAY_MILLIS = 50; + /** * LinearLayout with getter and setter methods for the translationY property using floats, * for animation purposes. @@ -105,6 +109,9 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadPrese private static final HashMap<Integer, Character> mDisplayMap = new HashMap<Integer, Character>(); + private static final Handler sHandler = new Handler(Looper.getMainLooper()); + + /** Set up the static maps*/ static { // Map the buttons to the display characters @@ -222,7 +229,7 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadPrese if (keyOK) { Log.d(this, "Stopping the tone for '" + c + "'"); - getPresenter().stopTone(); + getPresenter().stopDtmf(); return true; } @@ -274,7 +281,7 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadPrese // consider checking for this ourselves. if (ok(getAcceptedChars(), c)) { Log.d(this, "Stopping the tone for '" + c + "'"); - getPresenter().stopTone(); + getPresenter().stopDtmf(); return true; } @@ -327,6 +334,12 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadPrese // Checking the press state prevents double activation. if (!v.isPressed() && mDisplayMap.containsKey(id)) { getPresenter().processDtmf(mDisplayMap.get(id)); + sHandler.postDelayed(new Runnable() { + @Override + public void run() { + getPresenter().stopDtmf(); + } + }, ACCESSIBILITY_DTMF_STOP_DELAY_MILLIS); } } } @@ -378,7 +391,7 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadPrese } break; case KeyEvent.ACTION_UP: - getPresenter().stopTone(); + getPresenter().stopDtmf(); break; } // do not return true [handled] here, since we want the @@ -404,7 +417,7 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadPrese case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: // stop the tone on ANY other event, except for MOVE. - getPresenter().stopTone(); + getPresenter().stopDtmf(); break; } // do not return true [handled] here, since we want the diff --git a/InCallUI/src/com/android/incallui/DialpadPresenter.java b/InCallUI/src/com/android/incallui/DialpadPresenter.java index 0778b1e9b..79fe3d6df 100644 --- a/InCallUI/src/com/android/incallui/DialpadPresenter.java +++ b/InCallUI/src/com/android/incallui/DialpadPresenter.java @@ -68,7 +68,7 @@ public class DialpadPresenter extends Presenter<DialpadPresenter.DialpadUi> /** * Stops the local tone based on the phone type. */ - public void stopTone() { + public void stopDtmf() { if (mCall != null) { Log.d(this, "stopping remote tone"); TelecommAdapter.getInstance().stopDtmfTone(mCall.getId()); |