From ff903bd4a4d58693db9b8f437cf1677f82e3e873 Mon Sep 17 00:00:00 2001 From: Aleksandras Kostarevas Date: Tue, 16 Jan 2024 17:56:45 +0200 Subject: [PATCH] Change emoji key to go to new emoji menu --- java/res/layout/input_view.xml | 3 --- .../keyboard/KeyboardSwitcher.java | 23 ++++--------------- .../keyboard/internal/KeyboardState.java | 9 -------- .../futo/inputmethod/latin/uix/UixManager.kt | 7 ++++++ 4 files changed, 11 insertions(+), 31 deletions(-) diff --git a/java/res/layout/input_view.xml b/java/res/layout/input_view.xml index d11991372..5dd7716df 100644 --- a/java/res/layout/input_view.xml +++ b/java/res/layout/input_view.xml @@ -26,7 +26,4 @@ - diff --git a/java/src/org/futo/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/org/futo/inputmethod/keyboard/KeyboardSwitcher.java index f09c0e10d..27ff23daf 100644 --- a/java/src/org/futo/inputmethod/keyboard/KeyboardSwitcher.java +++ b/java/src/org/futo/inputmethod/keyboard/KeyboardSwitcher.java @@ -54,7 +54,6 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { private InputView mCurrentInputView; private View mMainKeyboardFrame; private MainKeyboardView mKeyboardView; - private EmojiPalettesView mEmojiPalettesView; private LatinIMELegacy mLatinIMELegacy; private RichInputMethodManager mRichImm; private boolean mIsHardwareAcceleratedDrawingEnabled; @@ -292,13 +291,13 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { // @see #getVisibleKeyboardView() and // @see LatinIME#onComputeInset(android.inputmethodservice.InputMethodService.Insets) mMainKeyboardFrame.setVisibility(visibility); - mEmojiPalettesView.setVisibility(View.GONE); - mEmojiPalettesView.stopEmojiPalettes(); } // Implements {@link KeyboardState.SwitchActions}. @Override public void setEmojiKeyboard() { + ((LatinIME)mLatinIMELegacy.getInputMethodService()).getUixManager().openEmojiKeyboard(); + /* if (DEBUG_ACTION) { Log.d(TAG, "setEmojiKeyboard"); } @@ -312,6 +311,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { mKeyboardTextsSet.getText(KeyboardTextsSet.SWITCH_TO_ALPHA_KEY_LABEL), mKeyboardView.getKeyVisualAttribute(), keyboard.mIconsSet); mEmojiPalettesView.setVisibility(View.VISIBLE); + */ } public enum KeyboardSwitchState { @@ -355,9 +355,6 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { if (toggleState == KeyboardSwitchState.EMOJI) { setEmojiKeyboard(); } else { - mEmojiPalettesView.stopEmojiPalettes(); - mEmojiPalettesView.setVisibility(View.GONE); - mMainKeyboardFrame.setVisibility(View.VISIBLE); mKeyboardView.setVisibility(View.VISIBLE); setKeyboard(toggleState.mKeyboardId, toggleState); @@ -432,7 +429,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { } public boolean isShowingEmojiPalettes() { - return mEmojiPalettesView != null && mEmojiPalettesView.isShown(); + return false; } public boolean isShowingMoreKeysPanel() { @@ -443,9 +440,6 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { } public View getVisibleKeyboardView() { - if (isShowingEmojiPalettes()) { - return mEmojiPalettesView; - } return mKeyboardView; } @@ -458,9 +452,6 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { mKeyboardView.cancelAllOngoingEvents(); mKeyboardView.deallocateMemory(); } - if (mEmojiPalettesView != null) { - mEmojiPalettesView.stopEmojiPalettes(); - } } public View onCreateInputView(@NonNull Context displayContext, @@ -474,15 +465,9 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { mCurrentInputView = (InputView)LayoutInflater.from(mThemeContext).inflate( R.layout.input_view, null); mMainKeyboardFrame = mCurrentInputView.findViewById(R.id.main_keyboard_frame); - mEmojiPalettesView = (EmojiPalettesView)mCurrentInputView.findViewById( - R.id.emoji_palettes_view); - mKeyboardView = (MainKeyboardView) mCurrentInputView.findViewById(R.id.keyboard_view); mKeyboardView.setHardwareAcceleratedDrawingEnabled(isHardwareAcceleratedDrawingEnabled); mKeyboardView.setKeyboardActionListener(mLatinIMELegacy); - mEmojiPalettesView.setHardwareAcceleratedDrawingEnabled( - isHardwareAcceleratedDrawingEnabled); - mEmojiPalettesView.setKeyboardActionListener(mLatinIMELegacy); return mCurrentInputView; } diff --git a/java/src/org/futo/inputmethod/keyboard/internal/KeyboardState.java b/java/src/org/futo/inputmethod/keyboard/internal/KeyboardState.java index 1d0c6c85e..8b76758a4 100644 --- a/java/src/org/futo/inputmethod/keyboard/internal/KeyboardState.java +++ b/java/src/org/futo/inputmethod/keyboard/internal/KeyboardState.java @@ -338,15 +338,6 @@ public final class KeyboardState { } private void setEmojiKeyboard() { - if (DEBUG_INTERNAL_ACTION) { - Log.d(TAG, "setEmojiKeyboard"); - } - mIsAlphabetMode = false; - mIsEmojiMode = true; - mRecapitalizeMode = RecapitalizeStatus.NOT_A_RECAPITALIZE_MODE; - // Remember caps lock mode and reset alphabet shift state. - mPrevMainKeyboardWasShiftLocked = mAlphabetShiftState.isShiftLocked(); - mAlphabetShiftState.setShiftLocked(false); mSwitchActions.setEmojiKeyboard(); } diff --git a/java/src/org/futo/inputmethod/latin/uix/UixManager.kt b/java/src/org/futo/inputmethod/latin/uix/UixManager.kt index 455b81be5..96e9a63a6 100644 --- a/java/src/org/futo/inputmethod/latin/uix/UixManager.kt +++ b/java/src/org/futo/inputmethod/latin/uix/UixManager.kt @@ -26,6 +26,7 @@ import org.futo.inputmethod.latin.SuggestedWords import org.futo.inputmethod.latin.common.Constants import org.futo.inputmethod.latin.inputlogic.InputLogic import org.futo.inputmethod.latin.suggestions.SuggestionStripView +import org.futo.inputmethod.latin.uix.actions.EmojiAction import org.futo.inputmethod.latin.uix.theme.ThemeOption import org.futo.inputmethod.latin.uix.theme.UixThemeWrapper @@ -349,4 +350,10 @@ class UixManager(private val latinIME: LatinIME) { return true } + + fun openEmojiKeyboard() { + if(currWindowAction == null) { + onActionActivated(EmojiAction) + } + } } \ No newline at end of file