Skip to content
Merged
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: 9 additions & 1 deletion app/src/main/java/io/github/sspanak/tt9/hacks/AppHacks.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ public void setComposingText(@NonNull String word) {
}



public void setComposingTextWithHighlightedStem(@NonNull String word, @Nullable String stem, boolean isStemFilterFuzzy) {
final HighlightedText highText =
new HighlightedText(word, true, false)
Expand Down Expand Up @@ -272,6 +271,15 @@ public int getEditorAction(@NonNull SettingsStore settings) {
}


/**
* Determines whether the composing text in the connected app should be forced to our state,
* before committing or calling finishComposingText().
*/
public boolean shouldRefreshComposingTextBeforeCommit(@NonNull String currentSuggestion) {
return inputType != null && inputType.isWhatsApp() && Text.isGraphic(currentSuggestion);
}


/**
* For Deezer, eBay and other apps' search fields, where the input connection gets restarted on
* every key press. The restart causes initialization of a new TextField object, losing the previous
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ public void commitCurrent(boolean entireSuggestion, boolean clearList) {
// getCurrent() is somewhat resource-intensive, so we want to minimize the calls to it.
// Hence, the more complicated if-else structure
final String current = getCurrent();

if (appHacks != null && appHacks.shouldRefreshComposingTextBeforeCommit(current)) {
textField.replaceComposingText(current);
}

if (textField.getComposingText().equals(current)) {
textField.finishComposingText();
} else {
Expand Down
Loading