Fix states for showing PunctuationList and correction
- Fixed the visibility of the suggestion strip Change-Id: I63ad561c71464657521661dbd25c72dd34841834main
parent
48bc6b158b
commit
ca26f20fa4
|
@ -667,7 +667,7 @@ public class LatinIME extends InputMethodService
|
||||||
mVoiceButtonOnPrimary);
|
mVoiceButtonOnPrimary);
|
||||||
updateShiftKeyState(attribute);
|
updateShiftKeyState(attribute);
|
||||||
|
|
||||||
setCandidatesViewShownInternal(isCandidateStripVisible() || mCompletionOn,
|
setCandidatesViewShownInternal(isCandidateStripVisible(),
|
||||||
false /* needsInputViewShown */ );
|
false /* needsInputViewShown */ );
|
||||||
updateSuggestions();
|
updateSuggestions();
|
||||||
|
|
||||||
|
@ -827,7 +827,7 @@ public class LatinIME extends InputMethodService
|
||||||
if (mCandidateView != null
|
if (mCandidateView != null
|
||||||
&& !mSuggestPuncList.equals(mCandidateView.getSuggestions())
|
&& !mSuggestPuncList.equals(mCandidateView.getSuggestions())
|
||||||
&& !mCandidateView.isShowingAddToDictionaryHint()) {
|
&& !mCandidateView.isShowingAddToDictionaryHint()) {
|
||||||
setNextSuggestions();
|
setPunctuationSuggestions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1408,6 +1408,8 @@ public class LatinIME extends InputMethodService
|
||||||
|
|
||||||
private void abortCorrection(boolean force) {
|
private void abortCorrection(boolean force) {
|
||||||
if (force || TextEntryState.isCorrecting()) {
|
if (force || TextEntryState.isCorrecting()) {
|
||||||
|
TextEntryState.onAbortCorrection();
|
||||||
|
setCandidatesViewShown(isCandidateStripVisible());
|
||||||
getCurrentInputConnection().finishComposingText();
|
getCurrentInputConnection().finishComposingText();
|
||||||
clearSuggestions();
|
clearSuggestions();
|
||||||
}
|
}
|
||||||
|
@ -1598,7 +1600,8 @@ public class LatinIME extends InputMethodService
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isCandidateStripVisible() {
|
private boolean isCandidateStripVisible() {
|
||||||
return isPredictionOn() && mShowSuggestions;
|
return (isPredictionOn() && mShowSuggestions) || mCompletionOn
|
||||||
|
|| mCandidateView.isShowingAddToDictionaryHint() || TextEntryState.isCorrecting();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCancelVoice() {
|
public void onCancelVoice() {
|
||||||
|
@ -1614,7 +1617,7 @@ public class LatinIME extends InputMethodService
|
||||||
if (mKeyboardSwitcher.getInputView() != null) {
|
if (mKeyboardSwitcher.getInputView() != null) {
|
||||||
setInputView(mKeyboardSwitcher.getInputView());
|
setInputView(mKeyboardSwitcher.getInputView());
|
||||||
}
|
}
|
||||||
setCandidatesViewShown(true);
|
setCandidatesViewShown(isCandidateStripVisible());
|
||||||
updateInputViewShown();
|
updateInputViewShown();
|
||||||
postUpdateSuggestions();
|
postUpdateSuggestions();
|
||||||
}});
|
}});
|
||||||
|
@ -1815,7 +1818,7 @@ public class LatinIME extends InputMethodService
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mPredicting) {
|
if (!mPredicting) {
|
||||||
setNextSuggestions();
|
setPunctuationSuggestions();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
showSuggestions(mWord);
|
showSuggestions(mWord);
|
||||||
|
@ -1883,7 +1886,7 @@ public class LatinIME extends InputMethodService
|
||||||
} else {
|
} else {
|
||||||
mBestWord = null;
|
mBestWord = null;
|
||||||
}
|
}
|
||||||
setCandidatesViewShown(isCandidateStripVisible() || mCompletionOn);
|
setCandidatesViewShown(isCandidateStripVisible());
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean pickDefaultSuggestion() {
|
private boolean pickDefaultSuggestion() {
|
||||||
|
@ -1977,7 +1980,7 @@ public class LatinIME extends InputMethodService
|
||||||
// we just did a correction, in which case we need to stay in
|
// we just did a correction, in which case we need to stay in
|
||||||
// TextEntryState.State.PICKED_SUGGESTION state.
|
// TextEntryState.State.PICKED_SUGGESTION state.
|
||||||
TextEntryState.typedCharacter((char) KEYCODE_SPACE, true);
|
TextEntryState.typedCharacter((char) KEYCODE_SPACE, true);
|
||||||
setNextSuggestions();
|
setPunctuationSuggestions();
|
||||||
} else if (!showingAddToDictionaryHint) {
|
} else if (!showingAddToDictionaryHint) {
|
||||||
// If we're not showing the "Touch again to save", then show corrections again.
|
// If we're not showing the "Touch again to save", then show corrections again.
|
||||||
// In case the cursor position doesn't change, make sure we show the suggestions again.
|
// In case the cursor position doesn't change, make sure we show the suggestions again.
|
||||||
|
@ -2039,7 +2042,7 @@ public class LatinIME extends InputMethodService
|
||||||
}
|
}
|
||||||
// If we just corrected a word, then don't show punctuations
|
// If we just corrected a word, then don't show punctuations
|
||||||
if (!correcting) {
|
if (!correcting) {
|
||||||
setNextSuggestions();
|
setPunctuationSuggestions();
|
||||||
}
|
}
|
||||||
updateShiftKeyState(getCurrentInputEditorInfo());
|
updateShiftKeyState(getCurrentInputEditorInfo());
|
||||||
}
|
}
|
||||||
|
@ -2148,14 +2151,16 @@ public class LatinIME extends InputMethodService
|
||||||
ic.endBatchEdit();
|
ic.endBatchEdit();
|
||||||
} else {
|
} else {
|
||||||
abortCorrection(true);
|
abortCorrection(true);
|
||||||
setNextSuggestions(); // Show the punctuation suggestions list
|
setPunctuationSuggestions(); // Show the punctuation suggestions list
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
abortCorrection(true);
|
abortCorrection(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setNextSuggestions() {
|
private void setPunctuationSuggestions() {
|
||||||
|
TextEntryState.onShowPunctuationsList();
|
||||||
|
setCandidatesViewShown(isCandidateStripVisible());
|
||||||
setSuggestions(mSuggestPuncList, false, false, false);
|
setSuggestions(mSuggestPuncList, false, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,8 @@ public class TextEntryState {
|
||||||
SPACE_AFTER_PICKED,
|
SPACE_AFTER_PICKED,
|
||||||
UNDO_COMMIT,
|
UNDO_COMMIT,
|
||||||
CORRECTING,
|
CORRECTING,
|
||||||
PICKED_CORRECTION;
|
PICKED_CORRECTION,
|
||||||
|
SHOWING_PUNCTUATIONS_LIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static State sState = State.UNKNOWN;
|
private static State sState = State.UNKNOWN;
|
||||||
|
@ -97,7 +98,7 @@ public class TextEntryState {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
sKeyLocationFile.close();
|
sKeyLocationFile.close();
|
||||||
// Write to log file
|
// Write to log file
|
||||||
// Write timestamp, settings,
|
// Write timestamp, settings,
|
||||||
String out = DateFormat.format("MM:dd hh:mm:ss", Calendar.getInstance().getTime())
|
String out = DateFormat.format("MM:dd hh:mm:ss", Calendar.getInstance().getTime())
|
||||||
.toString()
|
.toString()
|
||||||
|
@ -169,6 +170,18 @@ public class TextEntryState {
|
||||||
displayState();
|
displayState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void onAbortCorrection() {
|
||||||
|
if (isCorrecting()) {
|
||||||
|
sState = State.START;
|
||||||
|
}
|
||||||
|
displayState();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onShowPunctuationsList() {
|
||||||
|
sState = State.SHOWING_PUNCTUATIONS_LIST;
|
||||||
|
displayState();
|
||||||
|
}
|
||||||
|
|
||||||
public static void typedCharacter(char c, boolean isSeparator) {
|
public static void typedCharacter(char c, boolean isSeparator) {
|
||||||
boolean isSpace = c == ' ';
|
boolean isSpace = c == ' ';
|
||||||
switch (sState) {
|
switch (sState) {
|
||||||
|
|
Loading…
Reference in New Issue