Show single word in actionbar during update batch

This commit is contained in:
Aleksandras Kostarevas 2024-04-22 10:40:32 -04:00
parent a0cb585ef6
commit ea166f2750
2 changed files with 16 additions and 0 deletions

View File

@ -17,6 +17,7 @@
package org.futo.inputmethod.latin;
import android.text.TextUtils;
import android.util.Log;
import static org.futo.inputmethod.latin.define.DecoderSpecificConstants.SHOULD_AUTO_CORRECT_USING_NON_WHITE_LISTED_SUGGESTION;
import static org.futo.inputmethod.latin.define.DecoderSpecificConstants.SHOULD_REMOVE_PREVIOUSLY_REJECTED_SUGGESTION;
@ -333,6 +334,7 @@ public final class Suggest {
&& TextUtils.equals(suggestionsContainer.get(0).mWord,
wordComposer.getRejectedBatchModeSuggestion())) {
final SuggestedWordInfo rejected = suggestionsContainer.remove(0);
Log.i(TAG, "Swipe: Swapping top candidate [ " + rejected.mWord + " ] as it was previously rejected by user");
suggestionsContainer.add(1, rejected);
}
SuggestedWordInfo.removeDups(null /* typedWord */, suggestionsContainer);

View File

@ -288,6 +288,20 @@ fun RowScope.SuggestionItems(words: SuggestedWords, onClick: (i: Int) -> Unit, o
return
}
if(maxSuggestions == 1 || words.mInputStyle == SuggestedWords.INPUT_STYLE_UPDATE_BATCH) {
SuggestionItem(
words,
0,
isPrimary = true,
onClick = { onClick(0) },
onLongClick = { onLongClick(0) }
)
return
} else if(words.mInputStyle == SuggestedWords.INPUT_STYLE_TAIL_BATCH && maxSuggestions > 1) {
words.mSuggestedWordInfoList.removeAt(0);
}
var offset = 0