Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions app/src/main/java/helium314/keyboard/latin/LatinIME.java
Original file line number Diff line number Diff line change
Expand Up @@ -1035,11 +1035,17 @@ public void onUpdateSelection(final int oldSelStart, final int oldSelEnd,
+ ", cs=" + composingSpanStart + ", ce=" + composingSpanEnd);
}

final SettingsValues settingsValues = mSettings.getCurrent();
if (hasSuggestionStripView() && settingsValues.mAutoShowToolbar
&& composingSpanEnd != - 1 && newSelStart != oldSelStart + 1 && newSelStart != oldSelStart - 1 && newSelStart != composingSpanEnd) {
// Auto-show toolbar except while typing and picking suggestions
mSuggestionStripView.setToolbarVisibility(true);
}

// This call happens whether our view is displayed or not, but if it's not then we should
// not attempt recorrection. This is true even with a hardware keyboard connected: if the
// view is not displayed we have no means of showing suggestions anyway, and if it is then
// we want to show suggestions anyway.
final SettingsValues settingsValues = mSettings.getCurrent();
if (isInputViewShown()
&& mInputLogic.onUpdateSelection(oldSelStart, oldSelEnd, newSelStart, newSelEnd,
composingSpanStart, composingSpanEnd, settingsValues)) {
Expand Down Expand Up @@ -1459,7 +1465,7 @@ private void setSuggestedWords(final SuggestedWords suggestedWords) {
mSuggestionStripView.setSuggestions(suggestedWords,
mRichImm.getCurrentSubtype().isRtlSubtype());
// Auto hide the toolbar if dictionary suggestions are available
if (currentSettingsValues.mAutoHideToolbar && !noSuggestionsFromDictionaries) {
if (currentSettingsValues.mAutoHideToolbar && !noSuggestionsFromDictionaries && ! mInputLogic.isResumed()) {
mSuggestionStripView.setToolbarVisibility(false);
}
}
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/java/helium314/keyboard/latin/WordComposer.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public void reset() {
private void refreshTypedWordCache() {
mTypedWordCache = mCombinerChain.getComposingWordWithCombiningFeedback();
mCodePointSize = Character.codePointCount(mTypedWordCache, 0, mTypedWordCache.length());
mIsResumed = false;
}

/**
Expand Down Expand Up @@ -409,6 +410,10 @@ public SuggestedWordInfo getAutoCorrectionOrNull() {
return mAutoCorrection;
}

public void setResumed(boolean isResumed) {
mIsResumed = isResumed;
}

/**
* @return whether we started composing this word by resuming suggestion on an existing string
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1285,6 +1285,7 @@ private void handleBackspaceEvent(final Event event, final InputTransaction inpu
if (inputTransaction.getSettingsValues().needsToLookupSuggestions()
&& inputTransaction.getSettingsValues().mSpacingAndPunctuations.mCurrentLanguageHasSpaces) {
restartSuggestionsOnWordTouchedByCursor(inputTransaction.getSettingsValues(), currentKeyboardScript);
mWordComposer.setResumed(false);
}
return;
}
Expand Down Expand Up @@ -1420,6 +1421,7 @@ private void handleBackspaceEvent(final Event event, final InputTransaction inpu
} else if (inputTransaction.getSettingsValues().needsToLookupSuggestions()
&& inputTransaction.getSettingsValues().mSpacingAndPunctuations.mCurrentLanguageHasSpaces) {
restartSuggestionsOnWordTouchedByCursor(inputTransaction.getSettingsValues(), currentKeyboardScript);
mWordComposer.setResumed(false);
}
}
}
Expand Down Expand Up @@ -2764,4 +2766,8 @@ private void closeEmojiDictionary() {
mEmojiDictionaryFacilitator = null;
}
}

public boolean isResumed() {
return mWordComposer.isResumed();
}
}