mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-28 19:59:55 +00:00
Only do emoji search and show setting if toolbar is in compatible mode.
Auto-show emoji suggestions.
This commit is contained in:
parent
43c39371e6
commit
2b072216af
4 changed files with 22 additions and 9 deletions
|
@ -77,7 +77,6 @@ import helium314.keyboard.latin.suggestions.SuggestionStripView;
|
|||
import helium314.keyboard.latin.suggestions.SuggestionStripViewAccessor;
|
||||
import helium314.keyboard.latin.touchinputconsumer.GestureConsumer;
|
||||
import helium314.keyboard.latin.utils.ColorUtilKt;
|
||||
import helium314.keyboard.latin.utils.DictionaryInfoUtils;
|
||||
import helium314.keyboard.latin.utils.InlineAutofillUtils;
|
||||
import helium314.keyboard.latin.utils.InputMethodPickerKt;
|
||||
import helium314.keyboard.latin.utils.JniUtils;
|
||||
|
@ -249,7 +248,7 @@ public class LatinIME extends InputMethodService implements
|
|||
case MSG_SHOW_GESTURE_PREVIEW_AND_SUGGESTION_STRIP:
|
||||
if (msg.arg1 == ARG1_NOT_GESTURE_INPUT) {
|
||||
final SuggestedWords suggestedWords = (SuggestedWords) msg.obj;
|
||||
latinIme.showSuggestionStrip(suggestedWords);
|
||||
latinIme.setSuggestions(suggestedWords);
|
||||
} else {
|
||||
latinIme.showGesturePreviewAndSuggestionStrip((SuggestedWords) msg.obj,
|
||||
msg.arg1 == ARG1_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT);
|
||||
|
@ -1635,7 +1634,7 @@ public class LatinIME extends InputMethodService implements
|
|||
// This method must run on the UI Thread.
|
||||
void showGesturePreviewAndSuggestionStrip(@NonNull final SuggestedWords suggestedWords,
|
||||
final boolean dismissGestureFloatingPreviewText) {
|
||||
showSuggestionStrip(suggestedWords);
|
||||
setSuggestions(suggestedWords);
|
||||
final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
|
||||
mainKeyboardView.showGestureFloatingPreviewText(suggestedWords,
|
||||
dismissGestureFloatingPreviewText /* dismissDelayed */);
|
||||
|
@ -1677,7 +1676,7 @@ public class LatinIME extends InputMethodService implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void showSuggestionStrip(final SuggestedWords suggestedWords) {
|
||||
public void setSuggestions(final SuggestedWords suggestedWords) {
|
||||
if (suggestedWords.isEmpty()) {
|
||||
// avoids showing clipboard suggestion when starting gesture typing
|
||||
// should be fine, as there will be another suggestion in a few ms
|
||||
|
@ -1692,6 +1691,11 @@ public class LatinIME extends InputMethodService implements
|
|||
AccessibilityUtils.Companion.getInstance().setAutoCorrection(suggestedWords);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showSuggestionStrip() {
|
||||
mSuggestionStripView.setToolbarVisibility(false);
|
||||
}
|
||||
|
||||
// Called from {@link SuggestionStripView} through the {@link SuggestionStripView#Listener}
|
||||
// interface
|
||||
@Override
|
||||
|
|
|
@ -59,10 +59,12 @@ import helium314.keyboard.latin.utils.ScriptUtils;
|
|||
import helium314.keyboard.latin.utils.StatsUtils;
|
||||
import helium314.keyboard.latin.utils.TextRange;
|
||||
import helium314.keyboard.latin.utils.TimestampKt;
|
||||
import helium314.keyboard.latin.utils.ToolbarMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -1656,7 +1658,7 @@ public final class InputLogic {
|
|||
+ "requested!");
|
||||
}
|
||||
// Clear the suggestions strip.
|
||||
mSuggestionStripViewAccessor.showSuggestionStrip(SuggestedWords.getEmptyInstance());
|
||||
mSuggestionStripViewAccessor.setSuggestions(SuggestedWords.getEmptyInstance());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1691,7 +1693,10 @@ public final class InputLogic {
|
|||
// Prefer clipboard suggestions (if available and setting is enabled) over beginning of sentence predictions.
|
||||
if (!(suggestedWords.mInputStyle == SuggestedWords.INPUT_STYLE_BEGINNING_OF_SENTENCE_PREDICTION
|
||||
&& mLatinIME.tryShowClipboardSuggestion())) {
|
||||
mSuggestionStripViewAccessor.showSuggestionStrip(suggestedWords);
|
||||
mSuggestionStripViewAccessor.setSuggestions(suggestedWords);
|
||||
}
|
||||
if (isEmojiSearch(0)) {
|
||||
mSuggestionStripViewAccessor.showSuggestionStrip();
|
||||
}
|
||||
}
|
||||
if (DebugFlags.DEBUG_ENABLED) {
|
||||
|
@ -2594,7 +2599,8 @@ public final class InputLogic {
|
|||
}
|
||||
|
||||
private void updateEmojiDictionary(Locale locale) {
|
||||
if (Settings.getValues().mInlineEmojiSearch) {
|
||||
if (Settings.getValues().mInlineEmojiSearch
|
||||
&& Set.of(ToolbarMode.SUGGESTION_STRIP, ToolbarMode.EXPANDABLE).contains(Settings.getValues().mToolbarMode)) {
|
||||
if (mEmojiDictionaryFacilitator == null || ! mEmojiDictionaryFacilitator.isForLocale(locale)) {
|
||||
closeEmojiDictionary();
|
||||
var dictFile = DictionaryInfoUtils.getCachedDictForLocaleAndType(locale, "emoji", mLatinIME);
|
||||
|
|
|
@ -13,5 +13,6 @@ import helium314.keyboard.latin.SuggestedWords;
|
|||
*/
|
||||
public interface SuggestionStripViewAccessor {
|
||||
void setNeutralSuggestionStrip();
|
||||
void showSuggestionStrip(final SuggestedWords suggestedWords);
|
||||
void setSuggestions(final SuggestedWords suggestedWords);
|
||||
void showSuggestionStrip();
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import helium314.keyboard.latin.settings.Defaults
|
|||
import helium314.keyboard.latin.settings.Settings
|
||||
import helium314.keyboard.latin.utils.Log
|
||||
import helium314.keyboard.latin.utils.SubtypeSettings
|
||||
import helium314.keyboard.latin.utils.ToolbarMode
|
||||
import helium314.keyboard.latin.utils.getActivity
|
||||
import helium314.keyboard.latin.utils.locale
|
||||
import helium314.keyboard.latin.utils.prefs
|
||||
|
@ -57,7 +58,8 @@ fun PreferencesScreen(
|
|||
Settings.PREF_SOUND_ON,
|
||||
if (prefs.getBoolean(Settings.PREF_SOUND_ON, Defaults.PREF_SOUND_ON))
|
||||
Settings.PREF_KEYPRESS_SOUND_VOLUME else null,
|
||||
Settings.PREF_INLINE_EMOJI_SEARCH,
|
||||
if (Settings.readToolbarMode(prefs) in setOf(ToolbarMode.SUGGESTION_STRIP, ToolbarMode.EXPANDABLE))
|
||||
Settings.PREF_INLINE_EMOJI_SEARCH else null,
|
||||
R.string.settings_category_additional_keys,
|
||||
Settings.PREF_SHOW_NUMBER_ROW,
|
||||
if (SubtypeSettings.getEnabledSubtypes(true).any { it.locale().language in localesWithLocalizedNumberRow })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue