diff options
author | 2014-01-30 01:36:41 -0800 | |
---|---|---|
committer | 2014-01-30 01:36:41 -0800 | |
commit | 0f218b066d3980ab0c2cdc157039eb15e6bc9e65 (patch) | |
tree | b98de80e5c3dccb2663f9684aa4f34a506568b15 /java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java | |
parent | 81fa5dbd09cf367209f31e90477eb1355c93e212 (diff) | |
parent | 776d46a771089482c68be56e81219bbd7bb559e4 (diff) | |
download | latinime-0f218b066d3980ab0c2cdc157039eb15e6bc9e65.tar.gz latinime-0f218b066d3980ab0c2cdc157039eb15e6bc9e65.tar.xz latinime-0f218b066d3980ab0c2cdc157039eb15e6bc9e65.zip |
am 776d46a7: Merge "Show "Touch again to save" in system locale"
* commit '776d46a771089482c68be56e81219bbd7bb559e4':
Show "Touch again to save" in system locale
Diffstat (limited to 'java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java index 3cd9d9555..5ed42ab00 100644 --- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java +++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java @@ -50,6 +50,7 @@ import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.SuggestedWords; import com.android.inputmethod.latin.utils.AutoCorrectionUtils; import com.android.inputmethod.latin.utils.ResourceUtils; +import com.android.inputmethod.latin.utils.SubtypeLocaleUtils; import com.android.inputmethod.latin.utils.ViewLayoutUtils; import java.util.ArrayList; @@ -459,7 +460,7 @@ final class SuggestionStripLayoutHelper { } public void layoutAddToDictionaryHint(final String word, final ViewGroup addToDictionaryStrip, - final int stripWidth, final CharSequence hintText) { + final int stripWidth) { final int width = stripWidth - mDividerWidth - mPadding * 2; final TextView wordView = (TextView)addToDictionaryStrip.findViewById(R.id.word_to_save); @@ -473,13 +474,17 @@ final class SuggestionStripLayoutHelper { final TextView hintView = (TextView)addToDictionaryStrip.findViewById( R.id.hint_add_to_dictionary); - hintView.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL | GravityCompat.START); hintView.setTextColor(mColorAutoCorrect); final boolean isRtlLanguage = (ViewCompat.getLayoutDirection(addToDictionaryStrip) == ViewCompat.LAYOUT_DIRECTION_RTL); - final String hintWithArrow = (isRtlLanguage ? RIGHTWARDS_ARROW : LEFTWARDS_ARROW) - + hintText; + final String arrow = isRtlLanguage ? RIGHTWARDS_ARROW : LEFTWARDS_ARROW; + final Resources res = addToDictionaryStrip.getResources(); + final boolean isRtlSystem = SubtypeLocaleUtils.isRtlLanguage(res.getConfiguration().locale); + final CharSequence hintText = res.getText(R.string.hint_add_to_dictionary); + final String hintWithArrow = (isRtlLanguage == isRtlSystem) + ? (arrow + hintText) : (hintText + arrow); final int hintWidth = width - wordWidth; + hintView.setTextScaleX(1.0f); // Reset textScaleX. final float hintScaleX = getTextScaleX(hintWithArrow, hintWidth, hintView.getPaint()); hintView.setText(hintWithArrow); hintView.setTextScaleX(hintScaleX); |