aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r--src/com/android/inputmethod/latin/LatinIME.java26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/com/android/inputmethod/latin/LatinIME.java b/src/com/android/inputmethod/latin/LatinIME.java
index ee525b495..992456183 100644
--- a/src/com/android/inputmethod/latin/LatinIME.java
+++ b/src/com/android/inputmethod/latin/LatinIME.java
@@ -215,6 +215,7 @@ public class LatinIME extends InputMethodService
private boolean mEnableVoice = true;
private boolean mVoiceOnPrimary;
private int mOrientation;
+ private List<CharSequence> mSuggestPuncList;
// Indicates whether the suggestion strip is to be on in landscape
private boolean mJustAccepted;
@@ -296,6 +297,7 @@ public class LatinIME extends InputMethodService
}
initSuggest(inputLanguage);
mOrientation = conf.orientation;
+ initSuggestPuncList();
mVibrateDuration = mResources.getInteger(R.integer.vibrate_duration_ms);
@@ -1337,7 +1339,7 @@ public class LatinIME extends InputMethodService
}
if (!mPredicting) {
- setSuggestions(null, false, false, false);
+ setNextSuggestions();
return;
}
@@ -1397,6 +1399,12 @@ public class LatinIME extends InputMethodService
updateShiftKeyState(getCurrentInputEditorInfo());
return;
}
+
+ // If this is a punctuation, apply it through the normal key press
+ if (suggestion.length() == 1 && isWordSeparator(suggestion.charAt(0))) {
+ onKey(suggestion.charAt(0), null);
+ return;
+ }
pickSuggestion(suggestion);
TextEntryState.acceptedSuggestion(mComposing.toString(), suggestion);
// Follow it with a space
@@ -1430,10 +1438,14 @@ public class LatinIME extends InputMethodService
}
mPredicting = false;
mCommittedLength = suggestion.length();
- setSuggestions(null, false, false, false);
+ setNextSuggestions();
updateShiftKeyState(getCurrentInputEditorInfo());
}
+ private void setNextSuggestions() {
+ setSuggestions(mSuggestPuncList, false, false, false);
+ }
+
private boolean isCursorTouchingWord() {
InputConnection ic = getCurrentInputConnection();
if (ic == null) return false;
@@ -1767,6 +1779,16 @@ public class LatinIME extends InputMethodService
return sp.getString(PREF_SELECTED_LANGUAGES, null);
}
+ private void initSuggestPuncList() {
+ mSuggestPuncList = new ArrayList<CharSequence>();
+ String suggestPuncs = mResources.getString(R.string.suggested_punctuations);
+ if (suggestPuncs != null) {
+ for (int i = 0; i < suggestPuncs.length(); i++) {
+ mSuggestPuncList.add(suggestPuncs.subSequence(i, i + 1));
+ }
+ }
+ }
+
private void showOptionsMenu() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(true);