From 4d38769cce0a01fcbf2e4020a4d717287b6120aa Mon Sep 17 00:00:00 2001 From: calderwoodra Date: Wed, 4 Apr 2018 17:11:56 -0700 Subject: Voicemail and Call log notifications now open GoogleMainActivity. Bug: 75972847,77595270 Test: manual PiperOrigin-RevId: 191672019 Change-Id: I9ea7fb67b4dffeb6acb30840eaf093e4d00a3bcf --- java/com/android/dialer/app/MainComponent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/com/android/dialer/app/MainComponent.java b/java/com/android/dialer/app/MainComponent.java index c223723c6..ec3fc3fa6 100644 --- a/java/com/android/dialer/app/MainComponent.java +++ b/java/com/android/dialer/app/MainComponent.java @@ -56,6 +56,6 @@ public class MainComponent { } private static String getComponentName() { - return "com.android.dialer.main.impl.MainActivity"; + return "com.android.dialer.app.DialtactsActivity"; } } -- cgit v1.2.3 From da7771683a334db63b4503a291d3c67e7b4ca22e Mon Sep 17 00:00:00 2001 From: calderwoodra Date: Wed, 4 Apr 2018 17:24:11 -0700 Subject: Fixed some issues in dialer's dialpad for talkback users. - Content description for voicemail button is now "1... double tap and hold to call vociemail" - Content description for 0 button is now "0... double tap and hold for plus symbol" Bug: 19621015,62712616 Test: manual + a11y office hours PiperOrigin-RevId: 191673375 Change-Id: I9b5d8d875f1bf218be6fcc33dff4ac9e479e4f43 --- .../dialer/dialpadview/DialpadFragment.java | 9 ++- .../dialer/dialpadview/DialpadKeyButton.java | 76 ++++------------------ .../android/dialer/dialpadview/DialpadView.java | 3 + .../dialer/dialpadview/res/values/strings.xml | 4 +- 4 files changed, 27 insertions(+), 65 deletions(-) diff --git a/java/com/android/dialer/dialpadview/DialpadFragment.java b/java/com/android/dialer/dialpadview/DialpadFragment.java index 6f8d677e8..9d88d8e0f 100644 --- a/java/com/android/dialer/dialpadview/DialpadFragment.java +++ b/java/com/android/dialer/dialpadview/DialpadFragment.java @@ -1050,9 +1050,15 @@ public class DialpadFragment extends Fragment digits.clear(); return true; } else if (id == R.id.one) { - if (isDigitsEmpty() || TextUtils.equals(this.digits.getText(), "1")) { + // For non-talkback users: check for empty + // For linear navigation users: check for "1" + // For explore by touch users: check for "11" + if (isDigitsEmpty() + || TextUtils.equals(this.digits.getText(), "1") + || TextUtils.equals(this.digits.getText(), "11")) { // We'll try to initiate voicemail and thus we want to remove irrelevant string. removePreviousDigitIfPossible('1'); + removePreviousDigitIfPossible('1'); List subscriptionAccountHandles = TelecomUtil.getSubscriptionPhoneAccounts(getActivity()); @@ -1094,6 +1100,7 @@ public class DialpadFragment extends Fragment // (and not via other means like certain accessibility input methods). // Remove the '0' that was input when the key was first pressed. removePreviousDigitIfPossible('0'); + removePreviousDigitIfPossible('0'); } keyPressed(KeyEvent.KEYCODE_PLUS); stopTone(); diff --git a/java/com/android/dialer/dialpadview/DialpadKeyButton.java b/java/com/android/dialer/dialpadview/DialpadKeyButton.java index 84aca14f2..47553b6f9 100644 --- a/java/com/android/dialer/dialpadview/DialpadKeyButton.java +++ b/java/com/android/dialer/dialpadview/DialpadKeyButton.java @@ -19,13 +19,14 @@ package com.android.dialer.dialpadview; import android.content.Context; import android.graphics.RectF; import android.os.Bundle; +import android.text.TextUtils; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; -import android.view.ViewConfiguration; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityNodeInfo; +import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; import android.widget.FrameLayout; /** @@ -45,33 +46,21 @@ import android.widget.FrameLayout; */ public class DialpadKeyButton extends FrameLayout { - /** Timeout before switching to long-click accessibility mode. */ - private static final int LONG_HOVER_TIMEOUT = ViewConfiguration.getLongPressTimeout() * 2; - /** Accessibility manager instance used to check touch exploration state. */ private AccessibilityManager accessibilityManager; /** Bounds used to filter HOVER_EXIT events. */ private RectF hoverBounds = new RectF(); - /** Whether this view is currently in the long-hover state. */ - private boolean longHovered; - /** Alternate content description for long-hover state. */ private CharSequence longHoverContentDesc; - /** Backup of standard content description. Used for accessibility. */ - private CharSequence backupContentDesc; - /** Backup of clickable property. Used for accessibility. */ private boolean wasClickable; /** Backup of long-clickable property. Used for accessibility. */ private boolean wasLongClickable; - /** Runnable used to trigger long-click mode for accessibility. */ - private Runnable longHoverRunnable; - private OnPressedListener onPressedListener; public DialpadKeyButton(Context context, AttributeSet attrs) { @@ -95,19 +84,6 @@ public class DialpadKeyButton extends FrameLayout { public void setLongHoverContentDescription(CharSequence contentDescription) { longHoverContentDesc = contentDescription; - - if (longHovered) { - super.setContentDescription(longHoverContentDesc); - } - } - - @Override - public void setContentDescription(CharSequence contentDescription) { - if (longHovered) { - backupContentDesc = contentDescription; - } else { - super.setContentDescription(contentDescription); - } } @Override @@ -138,6 +114,18 @@ public class DialpadKeyButton extends FrameLayout { return super.performAccessibilityAction(action, arguments); } + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + // If the button has a long hover description, ask talkback to announce the action follow by + // the description (for example "double tap and hold to call voicemail"). + if (!TextUtils.isEmpty(longHoverContentDesc)) { + AccessibilityAction longClickAction = + new AccessibilityAction(AccessibilityNodeInfo.ACTION_LONG_CLICK, longHoverContentDesc); + info.addAction(longClickAction); + } + } + @Override public boolean onHoverEvent(MotionEvent event) { // When touch exploration is turned on, lifting a finger while inside @@ -148,20 +136,6 @@ public class DialpadKeyButton extends FrameLayout { // Lift-to-type temporarily disables double-tap activation. wasClickable = isClickable(); wasLongClickable = isLongClickable(); - if (wasLongClickable && longHoverContentDesc != null) { - if (longHoverRunnable == null) { - longHoverRunnable = - new Runnable() { - @Override - public void run() { - setLongHovered(true); - announceForAccessibility(longHoverContentDesc); - } - }; - } - postDelayed(longHoverRunnable, LONG_HOVER_TIMEOUT); - } - setClickable(false); setLongClickable(false); break; @@ -170,7 +144,6 @@ public class DialpadKeyButton extends FrameLayout { simulateClickForAccessibility(); } - cancelLongHover(); setClickable(wasClickable); setLongClickable(wasLongClickable); break; @@ -201,27 +174,6 @@ public class DialpadKeyButton extends FrameLayout { setPressed(false); } - private void setLongHovered(boolean enabled) { - if (longHovered != enabled) { - longHovered = enabled; - - // Switch between normal and alternate description, if available. - if (enabled) { - backupContentDesc = getContentDescription(); - super.setContentDescription(longHoverContentDesc); - } else { - super.setContentDescription(backupContentDesc); - } - } - } - - private void cancelLongHover() { - if (longHoverRunnable != null) { - removeCallbacks(longHoverRunnable); - } - setLongHovered(false); - } - public interface OnPressedListener { void onPressed(View view, boolean pressed); diff --git a/java/com/android/dialer/dialpadview/DialpadView.java b/java/com/android/dialer/dialpadview/DialpadView.java index 0369b40ca..6d538f3d2 100644 --- a/java/com/android/dialer/dialpadview/DialpadView.java +++ b/java/com/android/dialer/dialpadview/DialpadView.java @@ -171,6 +171,9 @@ public class DialpadView extends LinearLayout { } else if (BUTTON_IDS[i] == R.id.star) { numberString = resources.getString(R.string.dialpad_star_number); numberContentDescription = numberString; + } else if (BUTTON_IDS[i] == R.id.zero) { + numberString = numberFormat.format(i); + numberContentDescription = numberString; } else { numberString = numberFormat.format(i); // The content description is used for Talkback key presses. The number is diff --git a/java/com/android/dialer/dialpadview/res/values/strings.xml b/java/com/android/dialer/dialpadview/res/values/strings.xml index 5d8d8e6a5..eb5c04f9c 100644 --- a/java/com/android/dialer/dialpadview/res/values/strings.xml +++ b/java/com/android/dialer/dialpadview/res/values/strings.xml @@ -30,12 +30,12 @@ backspace - plus + dial plus - voicemail + call voicemail - + + + + + - - + + android:layout_margin="@dimen/search_bar_margin" + android:layout_gravity="center_vertical" + android:contentDescription="@string/main_remove_contact" + android:importantForAccessibility="no"> - + + - - - + + + + + + -- cgit v1.2.3