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
android:id="@+id/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>

View File

@ -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;
}

View File

@ -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();
}

View File

@ -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)
}
}
}