aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2014-06-19 11:50:37 -0700
committerTadashi G. Takaoka <takaoka@google.com>2014-06-19 19:22:02 -0700
commitae42cd7e43488aead5310c5fcb7467b8ce9c2dd6 (patch)
tree0a5d81a921cee1376984dbfe83dca9385dde7e17 /java/src
parentf49e9757404a84620f56e4210159c55193587187 (diff)
downloadlatinime-ae42cd7e43488aead5310c5fcb7467b8ce9c2dd6.tar.gz
latinime-ae42cd7e43488aead5310c5fcb7467b8ce9c2dd6.tar.xz
latinime-ae42cd7e43488aead5310c5fcb7467b8ce9c2dd6.zip
Disable empty suggestion word on the suggestions strip
It should be disabled when it is empty. But should be enabled even when it is empty with accessibility exploration on to avoid announcing "disabled". Note that this CL may not be able to handle "suspending talk back" state correctly. It should be handled by registering TouchExplorationStateChangeListener that is available from API 19. Bug: 15738513 Bug: 14849593 Change-Id: Id9ad89f770840f74a106f53833060407b20c1e24
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java
index 19b48f081..46f5cdee0 100644
--- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java
+++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java
@@ -44,6 +44,7 @@ import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
+import com.android.inputmethod.accessibility.AccessibilityUtils;
import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.PunctuationSuggestions;
import com.android.inputmethod.latin.R;
@@ -386,6 +387,12 @@ final class SuggestionStripLayoutHelper {
final float scaleX = getTextScaleX(word, width, wordView.getPaint());
wordView.setText(text); // TextView.setText() resets text scale x to 1.0.
wordView.setTextScaleX(Math.max(scaleX, MIN_TEXT_XSCALE));
+ // A <code>wordView</code> should be disabled when <code>word</code> is empty in order to
+ // make it unclickable.
+ // With accessibility touch exploration on, <code>wordView</code> should be enabled even
+ // when it is empty to avoid announcing as "disabled".
+ wordView.setEnabled(!TextUtils.isEmpty(word)
+ || AccessibilityUtils.getInstance().isTouchExplorationEnabled());
return wordView;
}