Merge "Display "Touch again to save" in the keyboard locale"

main
Ken Wakasa 2011-10-27 09:58:08 -07:00 committed by Android (Google) Code Review
commit 24ddc12eb7
3 changed files with 10 additions and 9 deletions

View File

@ -1943,7 +1943,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
} }
if (showingAddToDictionaryHint) { if (showingAddToDictionaryHint) {
if (mIsUserDictionaryAvaliable) { if (mIsUserDictionaryAvaliable) {
mSuggestionsView.showAddToDictionaryHint(suggestion); mSuggestionsView.showAddToDictionaryHint(
suggestion, mSettingsValues.mHintToSaveText);
} else { } else {
mHandler.postUpdateSuggestions(); mHandler.postUpdateSuggestions();
} }

View File

@ -115,6 +115,7 @@ public class Settings extends InputMethodSettingsActivity
public final String mSuggestPuncs; public final String mSuggestPuncs;
public final SuggestedWords mSuggestPuncList; public final SuggestedWords mSuggestPuncList;
private final String mSymbolsExcludedFromWordSeparators; private final String mSymbolsExcludedFromWordSeparators;
public final CharSequence mHintToSaveText;
// From preferences: // From preferences:
public final boolean mSoundOn; // Sound setting private to Latin IME (see mSilentModeOn) public final boolean mSoundOn; // Sound setting private to Latin IME (see mSilentModeOn)
@ -176,6 +177,7 @@ public class Settings extends InputMethodSettingsActivity
mSuggestPuncs = res.getString(R.string.suggested_punctuations); mSuggestPuncs = res.getString(R.string.suggested_punctuations);
// TODO: it would be nice not to recreate this each time we change the configuration // TODO: it would be nice not to recreate this each time we change the configuration
mSuggestPuncList = createSuggestPuncList(mSuggestPuncs); mSuggestPuncList = createSuggestPuncList(mSuggestPuncs);
mHintToSaveText = context.getText(R.string.hint_add_to_dictionary);
// Get the settings preferences // Get the settings preferences
final boolean hasVibrator = VibratorCompatWrapper.getInstance(context).hasVibrator(); final boolean hasVibrator = VibratorCompatWrapper.getInstance(context).hasVibrator();

View File

@ -171,7 +171,6 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
public final TextView mWordToSaveView; public final TextView mWordToSaveView;
private final TextView mHintToSaveView; private final TextView mHintToSaveView;
private final CharSequence mHintToSaveText;
public SuggestionsViewParams(Context context, AttributeSet attrs, int defStyle, public SuggestionsViewParams(Context context, AttributeSet attrs, int defStyle,
List<TextView> words, List<View> dividers, List<TextView> infos) { List<TextView> words, List<View> dividers, List<TextView> infos) {
@ -227,7 +226,6 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
final LayoutInflater inflater = LayoutInflater.from(context); final LayoutInflater inflater = LayoutInflater.from(context);
mWordToSaveView = (TextView)inflater.inflate(R.layout.suggestion_word, null); mWordToSaveView = (TextView)inflater.inflate(R.layout.suggestion_word, null);
mHintToSaveView = (TextView)inflater.inflate(R.layout.suggestion_word, null); mHintToSaveView = (TextView)inflater.inflate(R.layout.suggestion_word, null);
mHintToSaveText = context.getText(R.string.hint_add_to_dictionary);
} }
private static Drawable getMoreSuggestionsHint(Resources res, float textSize, int color) { private static Drawable getMoreSuggestionsHint(Resources res, float textSize, int color) {
@ -444,7 +442,7 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
} }
public void layoutAddToDictionaryHint(CharSequence word, ViewGroup stripView, public void layoutAddToDictionaryHint(CharSequence word, ViewGroup stripView,
int stripWidth) { int stripWidth, CharSequence hintText) {
final int width = stripWidth - mDividerWidth - mPadding * 2; final int width = stripWidth - mDividerWidth - mPadding * 2;
final TextView wordView = mWordToSaveView; final TextView wordView = mWordToSaveView;
@ -463,8 +461,8 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
final TextView hintView = mHintToSaveView; final TextView hintView = mHintToSaveView;
hintView.setTextColor(mColorAutoCorrect); hintView.setTextColor(mColorAutoCorrect);
final int hintWidth = width - wordWidth; final int hintWidth = width - wordWidth;
final float hintScaleX = getTextScaleX(mHintToSaveText, hintWidth, hintView.getPaint()); final float hintScaleX = getTextScaleX(hintText, hintWidth, hintView.getPaint());
hintView.setText(mHintToSaveText); hintView.setText(hintText);
hintView.setTextScaleX(hintScaleX); hintView.setTextScaleX(hintScaleX);
stripView.addView(hintView); stripView.addView(hintView);
setLayoutWeight( setLayoutWeight(
@ -646,9 +644,9 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
&& mSuggestionsStrip.getChildAt(0) == mParams.mWordToSaveView; && mSuggestionsStrip.getChildAt(0) == mParams.mWordToSaveView;
} }
public void showAddToDictionaryHint(CharSequence word) { public void showAddToDictionaryHint(CharSequence word, CharSequence hintText) {
clear(); clear();
mParams.layoutAddToDictionaryHint(word, mSuggestionsStrip, getWidth()); mParams.layoutAddToDictionaryHint(word, mSuggestionsStrip, getWidth(), hintText);
} }
public boolean dismissAddToDictionaryHint() { public boolean dismissAddToDictionaryHint() {