Change emoji key to go to new emoji menu

This commit is contained in:
Aleksandras Kostarevas 2024-01-16 17:56:45 +02:00
parent 85010f6d95
commit ff903bd4a4
4 changed files with 11 additions and 31 deletions

View File

@ -26,7 +26,4 @@
<include <include
android:id="@+id/main_keyboard_frame" android:id="@+id/main_keyboard_frame"
layout="@layout/main_keyboard_frame" /> layout="@layout/main_keyboard_frame" />
<include
android:id="@+id/emoji_palettes_view"
layout="@layout/emoji_palettes_view" />
</org.futo.inputmethod.latin.InputView> </org.futo.inputmethod.latin.InputView>

View File

@ -54,7 +54,6 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
private InputView mCurrentInputView; private InputView mCurrentInputView;
private View mMainKeyboardFrame; private View mMainKeyboardFrame;
private MainKeyboardView mKeyboardView; private MainKeyboardView mKeyboardView;
private EmojiPalettesView mEmojiPalettesView;
private LatinIMELegacy mLatinIMELegacy; private LatinIMELegacy mLatinIMELegacy;
private RichInputMethodManager mRichImm; private RichInputMethodManager mRichImm;
private boolean mIsHardwareAcceleratedDrawingEnabled; private boolean mIsHardwareAcceleratedDrawingEnabled;
@ -292,13 +291,13 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
// @see #getVisibleKeyboardView() and // @see #getVisibleKeyboardView() and
// @see LatinIME#onComputeInset(android.inputmethodservice.InputMethodService.Insets) // @see LatinIME#onComputeInset(android.inputmethodservice.InputMethodService.Insets)
mMainKeyboardFrame.setVisibility(visibility); mMainKeyboardFrame.setVisibility(visibility);
mEmojiPalettesView.setVisibility(View.GONE);
mEmojiPalettesView.stopEmojiPalettes();
} }
// Implements {@link KeyboardState.SwitchActions}. // Implements {@link KeyboardState.SwitchActions}.
@Override @Override
public void setEmojiKeyboard() { public void setEmojiKeyboard() {
((LatinIME)mLatinIMELegacy.getInputMethodService()).getUixManager().openEmojiKeyboard();
/*
if (DEBUG_ACTION) { if (DEBUG_ACTION) {
Log.d(TAG, "setEmojiKeyboard"); Log.d(TAG, "setEmojiKeyboard");
} }
@ -312,6 +311,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
mKeyboardTextsSet.getText(KeyboardTextsSet.SWITCH_TO_ALPHA_KEY_LABEL), mKeyboardTextsSet.getText(KeyboardTextsSet.SWITCH_TO_ALPHA_KEY_LABEL),
mKeyboardView.getKeyVisualAttribute(), keyboard.mIconsSet); mKeyboardView.getKeyVisualAttribute(), keyboard.mIconsSet);
mEmojiPalettesView.setVisibility(View.VISIBLE); mEmojiPalettesView.setVisibility(View.VISIBLE);
*/
} }
public enum KeyboardSwitchState { public enum KeyboardSwitchState {
@ -355,9 +355,6 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
if (toggleState == KeyboardSwitchState.EMOJI) { if (toggleState == KeyboardSwitchState.EMOJI) {
setEmojiKeyboard(); setEmojiKeyboard();
} else { } else {
mEmojiPalettesView.stopEmojiPalettes();
mEmojiPalettesView.setVisibility(View.GONE);
mMainKeyboardFrame.setVisibility(View.VISIBLE); mMainKeyboardFrame.setVisibility(View.VISIBLE);
mKeyboardView.setVisibility(View.VISIBLE); mKeyboardView.setVisibility(View.VISIBLE);
setKeyboard(toggleState.mKeyboardId, toggleState); setKeyboard(toggleState.mKeyboardId, toggleState);
@ -432,7 +429,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
} }
public boolean isShowingEmojiPalettes() { public boolean isShowingEmojiPalettes() {
return mEmojiPalettesView != null && mEmojiPalettesView.isShown(); return false;
} }
public boolean isShowingMoreKeysPanel() { public boolean isShowingMoreKeysPanel() {
@ -443,9 +440,6 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
} }
public View getVisibleKeyboardView() { public View getVisibleKeyboardView() {
if (isShowingEmojiPalettes()) {
return mEmojiPalettesView;
}
return mKeyboardView; return mKeyboardView;
} }
@ -458,9 +452,6 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
mKeyboardView.cancelAllOngoingEvents(); mKeyboardView.cancelAllOngoingEvents();
mKeyboardView.deallocateMemory(); mKeyboardView.deallocateMemory();
} }
if (mEmojiPalettesView != null) {
mEmojiPalettesView.stopEmojiPalettes();
}
} }
public View onCreateInputView(@NonNull Context displayContext, public View onCreateInputView(@NonNull Context displayContext,
@ -474,15 +465,9 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
mCurrentInputView = (InputView)LayoutInflater.from(mThemeContext).inflate( mCurrentInputView = (InputView)LayoutInflater.from(mThemeContext).inflate(
R.layout.input_view, null); R.layout.input_view, null);
mMainKeyboardFrame = mCurrentInputView.findViewById(R.id.main_keyboard_frame); 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 = (MainKeyboardView) mCurrentInputView.findViewById(R.id.keyboard_view);
mKeyboardView.setHardwareAcceleratedDrawingEnabled(isHardwareAcceleratedDrawingEnabled); mKeyboardView.setHardwareAcceleratedDrawingEnabled(isHardwareAcceleratedDrawingEnabled);
mKeyboardView.setKeyboardActionListener(mLatinIMELegacy); mKeyboardView.setKeyboardActionListener(mLatinIMELegacy);
mEmojiPalettesView.setHardwareAcceleratedDrawingEnabled(
isHardwareAcceleratedDrawingEnabled);
mEmojiPalettesView.setKeyboardActionListener(mLatinIMELegacy);
return mCurrentInputView; return mCurrentInputView;
} }

View File

@ -338,15 +338,6 @@ public final class KeyboardState {
} }
private void setEmojiKeyboard() { 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(); mSwitchActions.setEmojiKeyboard();
} }

View File

@ -26,6 +26,7 @@ import org.futo.inputmethod.latin.SuggestedWords
import org.futo.inputmethod.latin.common.Constants import org.futo.inputmethod.latin.common.Constants
import org.futo.inputmethod.latin.inputlogic.InputLogic import org.futo.inputmethod.latin.inputlogic.InputLogic
import org.futo.inputmethod.latin.suggestions.SuggestionStripView 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.ThemeOption
import org.futo.inputmethod.latin.uix.theme.UixThemeWrapper import org.futo.inputmethod.latin.uix.theme.UixThemeWrapper
@ -349,4 +350,10 @@ class UixManager(private val latinIME: LatinIME) {
return true return true
} }
fun openEmojiKeyboard() {
if(currWindowAction == null) {
onActionActivated(EmojiAction)
}
}
} }