diff options
author | Santos Cordon <santoscordon@google.com> | 2014-08-06 19:59:44 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-08-05 00:29:22 +0000 |
commit | 4d6896f4d422d39f8cd0b3cc0c7992fbb71696ad (patch) | |
tree | cb66784f5de18712d569c53f71a6df56ce53636b | |
parent | 916052eb37635b123f84294aa3c7f3bc9c4040b1 (diff) | |
parent | 72dd0d42c60418da0e006ea9ea39fb2da2898a05 (diff) |
Merge "Send a stopDtmf() on click for talkback." into lmp-dev
-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()); |