Skip to content
Snippets Groups Projects
Commit ae42cd7e authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka
Browse files

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
parent f49e9757
No related branches found
No related tags found
No related merge requests found
...@@ -44,6 +44,7 @@ import android.view.ViewGroup; ...@@ -44,6 +44,7 @@ import android.view.ViewGroup;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import com.android.inputmethod.accessibility.AccessibilityUtils;
import com.android.inputmethod.latin.LatinImeLogger; import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.PunctuationSuggestions; import com.android.inputmethod.latin.PunctuationSuggestions;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
...@@ -386,6 +387,12 @@ final class SuggestionStripLayoutHelper { ...@@ -386,6 +387,12 @@ final class SuggestionStripLayoutHelper {
final float scaleX = getTextScaleX(word, width, wordView.getPaint()); final float scaleX = getTextScaleX(word, width, wordView.getPaint());
wordView.setText(text); // TextView.setText() resets text scale x to 1.0. wordView.setText(text); // TextView.setText() resets text scale x to 1.0.
wordView.setTextScaleX(Math.max(scaleX, MIN_TEXT_XSCALE)); 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; return wordView;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment