diff options
author | Yorke Lee <yorkelee@google.com> | 2013-09-06 17:15:48 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-09-06 17:15:48 +0000 |
commit | 5c3ba14b5111592192651f66b86df616c789429a (patch) | |
tree | 2b1bba94861cc8a1d74bbf60cc28baa7479e22a9 | |
parent | ad398f2ad398b78376b48cb422fb6afc5306d9b6 (diff) | |
parent | c45baecabd157ee8e9ce75791e1afe4c702c25a8 (diff) |
Merge "Fix accessibility issues with dialpad" into klp-dev
-rw-r--r-- | res/layout/dialpad_fragment.xml | 4 | ||||
-rw-r--r-- | src/com/android/dialer/dialpad/DialpadFragment.java | 29 |
2 files changed, 30 insertions, 3 deletions
diff --git a/res/layout/dialpad_fragment.xml b/res/layout/dialpad_fragment.xml index a248549c9..4007e3678 100644 --- a/res/layout/dialpad_fragment.xml +++ b/res/layout/dialpad_fragment.xml @@ -23,7 +23,7 @@ android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" /> - <LinearLayout + <view class="com.android.dialer.dialpad.DialpadFragment$HoverIgnoringLinearLayout" android:id="@+id/top" android:layout_width="match_parent" android:layout_height="0dp" @@ -122,5 +122,5 @@ android:layout_weight="1" /> - </LinearLayout> + </view> </view> diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index 79e830730..361f60d75 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -57,6 +57,7 @@ import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; +import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; import android.view.ViewGroup; @@ -136,6 +137,30 @@ public class DialpadFragment extends Fragment } } + /** + * LinearLayout that always returns true for onHoverEvent callbacks, to fix + * problems with accessibility due to the dialpad overlaying other fragments. + */ + public static class HoverIgnoringLinearLayout extends LinearLayout { + + public HoverIgnoringLinearLayout(Context context) { + super(context); + } + + public HoverIgnoringLinearLayout(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public HoverIgnoringLinearLayout(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + } + + @Override + public boolean onHoverEvent(MotionEvent event) { + return true; + } + } + public interface OnDialpadQueryChangedListener { void onDialpadQueryChanged(String query); } @@ -611,7 +636,9 @@ public class DialpadFragment extends Fragment dialpadKey.setOnPressedListener(this); numberView = (TextView) dialpadKey.findViewById(R.id.dialpad_key_number); lettersView = (TextView) dialpadKey.findViewById(R.id.dialpad_key_letters); - numberView.setText(resources.getString(numberIds[i])); + final String numberString = resources.getString(numberIds[i]); + numberView.setText(numberString); + dialpadKey.setContentDescription(numberString); if (lettersView != null) { lettersView.setText(resources.getString(letterIds[i])); } |