Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4290)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/autofill/CardUnmaskPrompt.java

Issue 1015013002: [android] Accessibility for card unmask dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simpler logic. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/autofill/CardUnmaskPrompt.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/CardUnmaskPrompt.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/CardUnmaskPrompt.java
index b115b85eaa608c9dac00a7d048bfc41a97a79314..7a4995a3d7e1e064183b9006089740eee308911e 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/CardUnmaskPrompt.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/CardUnmaskPrompt.java
@@ -23,6 +23,7 @@ import android.view.View;
import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
+import android.view.accessibility.AccessibilityEvent;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.CheckBox;
@@ -33,6 +34,7 @@ import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
+import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.chrome.R;
import java.util.Calendar;
@@ -168,8 +170,9 @@ public class CardUnmaskPrompt
setInputsEnabled(false);
setOverlayVisibility(View.VISIBLE);
mVerificationProgressBar.setVisibility(View.VISIBLE);
- mVerificationView.setText(
- R.string.autofill_card_unmask_verification_in_progress);
+ mVerificationView.setText(R.string.autofill_card_unmask_verification_in_progress);
+ ApiCompatibilityUtils.announceForAccessibility(
+ mVerificationView, mVerificationView.getText());
setInputError(null);
}
@@ -253,8 +256,9 @@ public class CardUnmaskPrompt
private void setInitialFocus() {
InputMethodManager imm = (InputMethodManager) mDialog.getContext().getSystemService(
Context.INPUT_METHOD_SERVICE);
- imm.showSoftInput(mShouldRequestExpirationDate ? mMonthInput : mCardUnmaskInput,
- InputMethodManager.SHOW_IMPLICIT);
+ View view = mShouldRequestExpirationDate ? mMonthInput : mCardUnmaskInput;
+ imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
+ view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
}
private boolean areInputsValid() {
@@ -309,6 +313,12 @@ public class CardUnmaskPrompt
mErrorMessage.setText(message);
mErrorMessage.setVisibility(message == null ? View.GONE : View.VISIBLE);
+ // A null message is passed in during card verification, which also makes an announcement.
+ // Announcing twice in a row may cancel the first announcement.
+ if (message != null) {
+ ApiCompatibilityUtils.announceForAccessibility(mErrorMessage, message);
+ }
+
// The rest of this code makes L-specific assumptions about the background being used to
// draw the TextInput.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return;
@@ -332,6 +342,7 @@ public class CardUnmaskPrompt
private void setNoRetryError(String message) {
mNoRetryErrorMessage.setText(message);
mNoRetryErrorMessage.setVisibility(View.VISIBLE);
+ ApiCompatibilityUtils.announceForAccessibility(mNoRetryErrorMessage, message);
}
/**
« no previous file with comments | « base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698