mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-14 22:12:46 +00:00
fix clipboard suggestion being shown for a split second when starting gesture typing
This commit is contained in:
parent
105d044aa8
commit
a3bc3b56ff
3 changed files with 18 additions and 6 deletions
|
@ -1630,7 +1630,11 @@ public class LatinIME extends InputMethodService implements
|
||||||
@Override
|
@Override
|
||||||
public void showSuggestionStrip(final SuggestedWords suggestedWords) {
|
public void showSuggestionStrip(final SuggestedWords suggestedWords) {
|
||||||
if (suggestedWords.isEmpty()) {
|
if (suggestedWords.isEmpty()) {
|
||||||
setNeutralSuggestionStrip();
|
// avoids showing clipboard suggestion when starting gesture typing
|
||||||
|
// should be fine, as there will be another suggestion in a few ms
|
||||||
|
// (but not a great style to avoid this visual glitch, maybe revert this commit and replace with sth better)
|
||||||
|
if (suggestedWords.mInputStyle != SuggestedWords.INPUT_STYLE_UPDATE_BATCH)
|
||||||
|
setNeutralSuggestionStrip();
|
||||||
} else {
|
} else {
|
||||||
setSuggestedWords(suggestedWords);
|
setSuggestedWords(suggestedWords);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,9 +39,13 @@ public class SuggestedWords {
|
||||||
private static final ArrayList<SuggestedWordInfo> EMPTY_WORD_INFO_LIST = new ArrayList<>(0);
|
private static final ArrayList<SuggestedWordInfo> EMPTY_WORD_INFO_LIST = new ArrayList<>(0);
|
||||||
@NonNull
|
@NonNull
|
||||||
private static final SuggestedWords EMPTY = new SuggestedWords(
|
private static final SuggestedWords EMPTY = new SuggestedWords(
|
||||||
EMPTY_WORD_INFO_LIST, null /* rawSuggestions */, null /* typedWord */,
|
EMPTY_WORD_INFO_LIST, null, null, false,
|
||||||
false /* typedWordValid */, false /* willAutoCorrect */,
|
false, false, INPUT_STYLE_NONE, NOT_A_SEQUENCE_NUMBER);
|
||||||
false /* isObsoleteSuggestions */, INPUT_STYLE_NONE, NOT_A_SEQUENCE_NUMBER);
|
|
||||||
|
@NonNull
|
||||||
|
private static final SuggestedWords EMPTY_BATCH = new SuggestedWords(
|
||||||
|
EMPTY_WORD_INFO_LIST, null, null, false,
|
||||||
|
false, false, INPUT_STYLE_UPDATE_BATCH, NOT_A_SEQUENCE_NUMBER);
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public final SuggestedWordInfo mTypedWordInfo;
|
public final SuggestedWordInfo mTypedWordInfo;
|
||||||
|
@ -195,6 +199,11 @@ public class SuggestedWords {
|
||||||
return SuggestedWords.EMPTY;
|
return SuggestedWords.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public static SuggestedWords getEmptyBatchInstance() {
|
||||||
|
return SuggestedWords.EMPTY_BATCH;
|
||||||
|
}
|
||||||
|
|
||||||
// Should get rid of the first one (what the user typed previously) from suggestions
|
// Should get rid of the first one (what the user typed previously) from suggestions
|
||||||
// and replace it with what the user currently typed.
|
// and replace it with what the user currently typed.
|
||||||
public static ArrayList<SuggestedWordInfo> getTypedWordAndPreviousSuggestions(
|
public static ArrayList<SuggestedWordInfo> getTypedWordAndPreviousSuggestions(
|
||||||
|
|
|
@ -511,8 +511,7 @@ public final class InputLogic {
|
||||||
final KeyboardSwitcher keyboardSwitcher, final LatinIME.UIHandler handler) {
|
final KeyboardSwitcher keyboardSwitcher, final LatinIME.UIHandler handler) {
|
||||||
mWordBeingCorrectedByCursor = null;
|
mWordBeingCorrectedByCursor = null;
|
||||||
mInputLogicHandler.onStartBatchInput();
|
mInputLogicHandler.onStartBatchInput();
|
||||||
handler.showGesturePreviewAndSuggestionStrip(
|
handler.showGesturePreviewAndSuggestionStrip(SuggestedWords.getEmptyBatchInstance(), false);
|
||||||
SuggestedWords.getEmptyInstance(), false /* dismissGestureFloatingPreviewText */);
|
|
||||||
handler.cancelUpdateSuggestionStrip();
|
handler.cancelUpdateSuggestionStrip();
|
||||||
++mAutoCommitSequenceNumber;
|
++mAutoCommitSequenceNumber;
|
||||||
mConnection.beginBatchEdit();
|
mConnection.beginBatchEdit();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue