From db3fdf50cf6c7d68db970eee8364ccf863a9062f Mon Sep 17 00:00:00 2001 From: WhiredPlanck Date: Sat, 9 Nov 2024 15:13:25 +0800 Subject: [PATCH] refactor: rename KeyEventType to KeyBehavior --- .../java/com/osfans/trime/ime/keyboard/Key.kt | 134 +++++++++--------- .../KeyBehavior.kt} | 6 +- .../osfans/trime/ime/keyboard/KeyboardView.kt | 81 ++++++----- 3 files changed, 108 insertions(+), 113 deletions(-) rename app/src/main/java/com/osfans/trime/ime/{enums/KeyEventType.kt => keyboard/KeyBehavior.kt} (81%) diff --git a/app/src/main/java/com/osfans/trime/ime/keyboard/Key.kt b/app/src/main/java/com/osfans/trime/ime/keyboard/Key.kt index f862f9eb54..28a19ae1ac 100644 --- a/app/src/main/java/com/osfans/trime/ime/keyboard/Key.kt +++ b/app/src/main/java/com/osfans/trime/ime/keyboard/Key.kt @@ -14,7 +14,6 @@ import com.osfans.trime.core.Rime.Companion.isComposing import com.osfans.trime.core.Rime.Companion.showAsciiPunch import com.osfans.trime.data.theme.ColorManager import com.osfans.trime.data.theme.KeyActionManager -import com.osfans.trime.ime.enums.KeyEventType import com.osfans.trime.util.CollectionUtils.obtainBoolean import com.osfans.trime.util.CollectionUtils.obtainFloat import com.osfans.trime.util.CollectionUtils.obtainString @@ -47,14 +46,14 @@ class Key( private var label: String? = null var hint: String? = null private set - private lateinit var keyConfig: Map - private val keyBackColor get() = ColorManager.getDrawable(keyConfig, "key_back_color") - private val hilitedKeyBackColor get() = ColorManager.getDrawable(keyConfig, "hilited_key_back_color") + private lateinit var keyMap: Map + private val keyBackColor get() = ColorManager.getDrawable(keyMap, "key_back_color") + private val hilitedKeyBackColor get() = ColorManager.getDrawable(keyMap, "hilited_key_back_color") - private val keyTextColor get() = ColorManager.getColor(keyConfig, "key_text_color") - private val keySymbolColor get() = ColorManager.getColor(keyConfig, "key_symbol_color") - private val hilitedKeyTextColor get() = ColorManager.getColor(keyConfig, "hilited_key_text_color") - private val hilitedKeySymbolColor get() = ColorManager.getColor(keyConfig, "hilited_key_symbol_color") + private val keyTextColor get() = ColorManager.getColor(keyMap, "key_text_color") + private val keySymbolColor get() = ColorManager.getColor(keyMap, "key_symbol_color") + private val hilitedKeyTextColor get() = ColorManager.getColor(keyMap, "hilited_key_text_color") + private val hilitedKeySymbolColor get() = ColorManager.getColor(keyMap, "hilited_key_symbol_color") var keyTextSize: Int? = null private set @@ -98,37 +97,34 @@ class Key( * Create an empty key with no attributes. * * @param parent 按鍵所在的[鍵盤][Keyboard] - * @param keyDefs 從YAML中解析得到的按键定义 + * @param externalKeyMap 從YAML中解析得到的按键定义 */ - constructor(parent: Keyboard, keyDefs: Map) : this(parent) { - var s: String - run { - keyConfig = keyDefs - var hasComposingKey = false - for (type in KeyEventType.entries) { - val typeStr = type.toString().lowercase() - s = obtainString(keyDefs, typeStr) - if (s.isNotEmpty()) { - keyActions[type.ordinal] = KeyActionManager.getAction(s) - if (type.ordinal < KeyEventType.COMBO.ordinal) hasComposingKey = true - } else if (type == KeyEventType.CLICK) { - keyActions[type.ordinal] = KeyActionManager.getAction("") - } - } - if (hasComposingKey) mKeyboard.composingKeys.add(this) - label = obtainString(keyDefs, "label", "") - labelSymbol = obtainString(keyDefs, "label_symbol", "") - hint = obtainString(keyDefs, "hint", "") - if (keyDefs.containsKey("send_bindings")) { - sendBindings = obtainBoolean(keyDefs, "send_bindings", true) - } else if (!hasComposingKey) { - sendBindings = false + constructor(parent: Keyboard, externalKeyMap: Map) : this(parent) { + keyMap = externalKeyMap + var hasComposingKey = false + for (behavior in KeyBehavior.entries) { + val behaviorName = behavior.name.lowercase() + val what = obtainString(externalKeyMap, behaviorName) + if (what.isNotEmpty()) { + keyActions[behavior.ordinal] = KeyActionManager.getAction(what) + if (behavior.ordinal < KeyBehavior.COMBO.ordinal) hasComposingKey = true + } else if (behavior == KeyBehavior.CLICK) { + keyActions[behavior.ordinal] = KeyActionManager.getAction("") } } + if (hasComposingKey) mKeyboard.composingKeys.add(this) + label = obtainString(externalKeyMap, "label", "") + labelSymbol = obtainString(externalKeyMap, "label_symbol", "") + hint = obtainString(externalKeyMap, "hint", "") + if (externalKeyMap.containsKey("send_bindings")) { + sendBindings = obtainBoolean(externalKeyMap, "send_bindings", true) + } else if (!hasComposingKey) { + sendBindings = false + } mKeyboard.setModiferKey(this.code, this) - keyTextSize = appContext.sp(obtainFloat(keyDefs, "key_text_size")).toInt() - symbolTextSize = appContext.sp(obtainFloat(keyDefs, "symbol_text_size")).toInt() - roundCorner = obtainFloat(keyDefs, "round_corner") + keyTextSize = appContext.sp(obtainFloat(externalKeyMap, "key_text_size")).toInt() + symbolTextSize = appContext.sp(obtainFloat(externalKeyMap, "symbol_text_size")).toInt() + roundCorner = obtainFloat(externalKeyMap, "round_corner") } fun setOn(on: Boolean): Boolean { @@ -324,62 +320,62 @@ class Key( } /** - * @param type 同文按键模式(点击/长按/滑动) + * @param behavior 同文按键模式(点击/长按/滑动) * @return */ - fun sendBindings(type: Int): Boolean { + fun sendBindings(behavior: KeyBehavior): Boolean { var e: KeyAction? = null - if (type != KeyEventType.CLICK.ordinal && type >= 0 && type <= EVENT_NUM) e = keyActions[type] + if (behavior != KeyBehavior.CLICK) e = keyActions[behavior.ordinal] if (e != null) return true - if (keyActions[KeyEventType.ASCII.ordinal] != null && isAsciiMode) return false + if (keyActions[KeyBehavior.ASCII.ordinal] != null && isAsciiMode) return false if (sendBindings) { - if (keyActions[KeyEventType.PAGING.ordinal] != null && hasLeft()) return true - if (keyActions[KeyEventType.HAS_MENU.ordinal] != null && hasMenu()) return true - if (keyActions[KeyEventType.COMPOSING.ordinal] != null && isComposing) return true + if (keyActions[KeyBehavior.PAGING.ordinal] != null && hasLeft()) return true + if (keyActions[KeyBehavior.HAS_MENU.ordinal] != null && hasMenu()) return true + if (keyActions[KeyBehavior.COMPOSING.ordinal] != null && isComposing) return true } return false } private val keyAction: KeyAction? get() { - if (keyActions[KeyEventType.ASCII.ordinal] != null && isAsciiMode) { - return keyActions[KeyEventType.ASCII.ordinal] + if (keyActions[KeyBehavior.ASCII.ordinal] != null && isAsciiMode) { + return keyActions[KeyBehavior.ASCII.ordinal] } - if (keyActions[KeyEventType.PAGING.ordinal] != null && hasLeft()) { - return keyActions[KeyEventType.PAGING.ordinal] + if (keyActions[KeyBehavior.PAGING.ordinal] != null && hasLeft()) { + return keyActions[KeyBehavior.PAGING.ordinal] } - if (keyActions[KeyEventType.HAS_MENU.ordinal] != null && hasMenu()) { - return keyActions[KeyEventType.HAS_MENU.ordinal] + if (keyActions[KeyBehavior.HAS_MENU.ordinal] != null && hasMenu()) { + return keyActions[KeyBehavior.HAS_MENU.ordinal] } - return if (keyActions[KeyEventType.COMPOSING.ordinal] != null && isComposing) { - keyActions[KeyEventType.COMPOSING.ordinal] + return if (keyActions[KeyBehavior.COMPOSING.ordinal] != null && isComposing) { + keyActions[KeyBehavior.COMPOSING.ordinal] } else { click } } val click: KeyAction? - get() = keyActions[KeyEventType.CLICK.ordinal] + get() = keyActions[KeyBehavior.CLICK.ordinal] val longClick: KeyAction? - get() = keyActions[KeyEventType.LONG_CLICK.ordinal] + get() = keyActions[KeyBehavior.LONG_CLICK.ordinal] - fun hasEvent(i: Int): Boolean = keyActions[i] != null + fun hasAction(behavior: KeyBehavior): Boolean = keyActions[behavior.ordinal] != null - fun getAction(i: Int): KeyAction? { + fun getAction(behavior: KeyBehavior): KeyAction? { var e: KeyAction? = null - if (i != KeyEventType.CLICK.ordinal && i >= 0 && i <= EVENT_NUM) e = keyActions[i] + if (behavior != KeyBehavior.CLICK) e = keyActions[behavior.ordinal] if (e != null) return e - if (keyActions[KeyEventType.ASCII.ordinal] != null && isAsciiMode) { - return keyActions[KeyEventType.ASCII.ordinal] + if (keyActions[KeyBehavior.ASCII.ordinal] != null && isAsciiMode) { + return keyActions[KeyBehavior.ASCII.ordinal] } if (sendBindings) { - if (keyActions[KeyEventType.PAGING.ordinal] != null && hasLeft()) { - return keyActions[KeyEventType.PAGING.ordinal] + if (keyActions[KeyBehavior.PAGING.ordinal] != null && hasLeft()) { + return keyActions[KeyBehavior.PAGING.ordinal] } - if (keyActions[KeyEventType.HAS_MENU.ordinal] != null && hasMenu()) { - return keyActions[KeyEventType.HAS_MENU.ordinal] + if (keyActions[KeyBehavior.HAS_MENU.ordinal] != null && hasMenu()) { + return keyActions[KeyBehavior.HAS_MENU.ordinal] } - if (keyActions[KeyEventType.COMPOSING.ordinal] != null && isComposing) { - return keyActions[KeyEventType.COMPOSING.ordinal] + if (keyActions[KeyBehavior.COMPOSING.ordinal] != null && isComposing) { + return keyActions[KeyBehavior.COMPOSING.ordinal] } } return click @@ -388,13 +384,13 @@ class Key( val code: Int get() = click!!.code - fun getCode(type: Int): Int = getAction(type)!!.code + fun getCode(behavior: KeyBehavior): Int = getAction(behavior)!!.code fun getLabel(): String? { val event = keyAction return if (!TextUtils.isEmpty(label) && event === click && - keyActions[KeyEventType.ASCII.ordinal] == null && + keyActions[KeyBehavior.ASCII.ordinal] == null && !showAsciiPunch() ) { label @@ -403,11 +399,11 @@ class Key( } } - fun getPreviewText(type: Int): String = - if (type == KeyEventType.CLICK.ordinal) { + fun getPreviewText(behavior: KeyBehavior): String = + if (behavior == KeyBehavior.CLICK) { keyAction!!.getPreview(mKeyboard) } else { - getAction(type)!!.getPreview(mKeyboard) + getAction(behavior)!!.getPreview(mKeyboard) } val symbolLabel: String? @@ -455,7 +451,7 @@ class Key( KEY_STATE_NORMAL, // 5 "key_back_color" 按键背景 ) - private val EVENT_NUM = KeyEventType.entries.size + private val EVENT_NUM = KeyBehavior.entries.size @JvmStatic fun isTrimeModifierKey(keycode: Int): Boolean = if (keycode == KeyEvent.KEYCODE_FUNCTION) false else KeyEvent.isModifierKey(keycode) diff --git a/app/src/main/java/com/osfans/trime/ime/enums/KeyEventType.kt b/app/src/main/java/com/osfans/trime/ime/keyboard/KeyBehavior.kt similarity index 81% rename from app/src/main/java/com/osfans/trime/ime/enums/KeyEventType.kt rename to app/src/main/java/com/osfans/trime/ime/keyboard/KeyBehavior.kt index 38431aeaa9..d0d910d690 100644 --- a/app/src/main/java/com/osfans/trime/ime/enums/KeyEventType.kt +++ b/app/src/main/java/com/osfans/trime/ime/keyboard/KeyBehavior.kt @@ -2,10 +2,10 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -package com.osfans.trime.ime.enums +package com.osfans.trime.ime.keyboard -/** 按键事件枚举 */ -enum class KeyEventType { +/** 按键行为枚举 */ +enum class KeyBehavior { // 长按按键展开列表时,正上方为长按对应按键,排序如上,不展示combo及之前的按键,展示extra COMPOSING, HAS_MENU, diff --git a/app/src/main/java/com/osfans/trime/ime/keyboard/KeyboardView.kt b/app/src/main/java/com/osfans/trime/ime/keyboard/KeyboardView.kt index 7b37bb0b8d..ce9450cfde 100644 --- a/app/src/main/java/com/osfans/trime/ime/keyboard/KeyboardView.kt +++ b/app/src/main/java/com/osfans/trime/ime/keyboard/KeyboardView.kt @@ -29,7 +29,6 @@ import com.osfans.trime.data.prefs.AppPrefs import com.osfans.trime.data.theme.ColorManager import com.osfans.trime.data.theme.FontManager import com.osfans.trime.data.theme.Theme -import com.osfans.trime.ime.enums.KeyEventType import com.osfans.trime.util.LeakGuardHandlerWrapper import com.osfans.trime.util.indexOfStateSet import com.osfans.trime.util.sp @@ -238,7 +237,7 @@ class KeyboardView( override fun handleMessage(msg: Message) { val mKeyboardView = getOwnerInstanceOrNull() ?: return when (msg.what) { - MSG_SHOW_PREVIEW -> mKeyboardView.showKey(msg.arg1, msg.arg2) + MSG_SHOW_PREVIEW -> mKeyboardView.showKey(msg.arg1, KeyBehavior.entries[msg.arg2]) MSG_REMOVE_PREVIEW -> mKeyboardView.mPreviewPopup.dismiss() MSG_REPEAT -> if (mKeyboardView.repeatKey()) { @@ -289,7 +288,7 @@ class KeyboardView( val endingVelocityX: Float = mSwipeTracker.xVelocity val endingVelocityY: Float = mSwipeTracker.yVelocity var sendDownKey = false - var type = KeyEventType.CLICK + var behavior = KeyBehavior.CLICK // In my tests velocity always smaller than 400 // so I don't really why we need to compare velocity here, // as default value of getSwipeVelocity() is 800 @@ -300,14 +299,14 @@ class KeyboardView( absY < absX || ( deltaY > 0 && - mKeys!![mDownKey].keyActions[KeyEventType.SWIPE_UP.ordinal] == null + mKeys!![mDownKey].keyActions[KeyBehavior.SWIPE_UP.ordinal] == null ) || ( deltaY < 0 && - mKeys!![mDownKey].keyActions[KeyEventType.SWIPE_DOWN.ordinal] == null + mKeys!![mDownKey].keyActions[KeyBehavior.SWIPE_DOWN.ordinal] == null ) ) && - mKeys!![mDownKey].keyActions[KeyEventType.SWIPE_RIGHT.ordinal] != null + mKeys!![mDownKey].keyActions[KeyBehavior.SWIPE_RIGHT.ordinal] != null ) { // I should have implement mDisambiguateSwipe as a config option, but the logic // here is really weird, and I don't really know @@ -318,67 +317,67 @@ class KeyboardView( return true } else { sendDownKey = true - type = KeyEventType.SWIPE_RIGHT + behavior = KeyBehavior.SWIPE_RIGHT } } else if ((deltaX < -travel || velocityX < -velocity) && ( absY < absX || ( deltaY > 0 && - mKeys!![mDownKey].keyActions[KeyEventType.SWIPE_UP.ordinal] == null + mKeys!![mDownKey].keyActions[KeyBehavior.SWIPE_UP.ordinal] == null ) || ( deltaY < 0 && - mKeys!![mDownKey].keyActions[KeyEventType.SWIPE_DOWN.ordinal] == null + mKeys!![mDownKey].keyActions[KeyBehavior.SWIPE_DOWN.ordinal] == null ) ) && - mKeys!![mDownKey].keyActions[KeyEventType.SWIPE_LEFT.ordinal] != null + mKeys!![mDownKey].keyActions[KeyBehavior.SWIPE_LEFT.ordinal] != null ) { if (mDisambiguateSwipe && endingVelocityX < velocityX / 4) { return true } else { sendDownKey = true - type = KeyEventType.SWIPE_LEFT + behavior = KeyBehavior.SWIPE_LEFT } } else if ((deltaY < -travel || velocityY < -velocity) && ( absX < absY || ( deltaX > 0 && - mKeys!![mDownKey].keyActions[KeyEventType.SWIPE_RIGHT.ordinal] == null + mKeys!![mDownKey].keyActions[KeyBehavior.SWIPE_RIGHT.ordinal] == null ) || ( deltaX < 0 && - mKeys!![mDownKey].keyActions[KeyEventType.SWIPE_LEFT.ordinal] == null + mKeys!![mDownKey].keyActions[KeyBehavior.SWIPE_LEFT.ordinal] == null ) ) && - mKeys!![mDownKey].keyActions[KeyEventType.SWIPE_UP.ordinal] != null + mKeys!![mDownKey].keyActions[KeyBehavior.SWIPE_UP.ordinal] != null ) { if (mDisambiguateSwipe && endingVelocityY < velocityY / 4) { return true } else { sendDownKey = true - type = KeyEventType.SWIPE_UP + behavior = KeyBehavior.SWIPE_UP } } else if ((deltaY > travel || velocityY > velocity) && ( absX < absY || ( deltaX > 0 && - mKeys!![mDownKey].keyActions[KeyEventType.SWIPE_RIGHT.ordinal] == null + mKeys!![mDownKey].keyActions[KeyBehavior.SWIPE_RIGHT.ordinal] == null ) || ( deltaX < 0 && - mKeys!![mDownKey].keyActions[KeyEventType.SWIPE_LEFT.ordinal] == null + mKeys!![mDownKey].keyActions[KeyBehavior.SWIPE_LEFT.ordinal] == null ) ) && - mKeys!![mDownKey].keyActions[KeyEventType.SWIPE_DOWN.ordinal] != null + mKeys!![mDownKey].keyActions[KeyBehavior.SWIPE_DOWN.ordinal] != null ) { if (mDisambiguateSwipe && endingVelocityY > velocityY / 4) { return true } else { sendDownKey = true - type = KeyEventType.SWIPE_DOWN + behavior = KeyBehavior.SWIPE_DOWN } } else { Timber.d("swipeDebug.onFling fail , dY=$deltaY, vY=$velocityY, eVY=$endingVelocityY, travel=$travel") @@ -386,8 +385,8 @@ class KeyboardView( if (sendDownKey) { Timber.d("initGestureDetector: sendDownKey") showPreview(NOT_A_KEY) - showPreview(mDownKey, type.ordinal) - detectAndSendKey(mDownKey, mStartX, mStartY, me1.eventTime, type) + showPreview(mDownKey, behavior) + detectAndSendKey(mDownKey, mStartX, mStartY, me1.eventTime, behavior) return true } return false @@ -830,27 +829,27 @@ class KeyboardView( x: Int, y: Int, eventTime: Long, - type: KeyEventType = KeyEventType.CLICK, + behavior: KeyBehavior = KeyBehavior.CLICK, ) { - Timber.d("detectAndSendKey: index=$index, x=$x, y=$y, type=$type, mKeys.size=${mKeys!!.size}") + Timber.d("detectAndSendKey: index=$index, x=$x, y=$y, type=$behavior, mKeys.size=${mKeys!!.size}") if (index != NOT_A_KEY && index < mKeys!!.size) { val key = mKeys!![index] - if (Key.isTrimeModifierKey(key.code) && !key.sendBindings(type.ordinal)) { + if (Key.isTrimeModifierKey(key.code) && !key.sendBindings(behavior)) { Timber.d("detectAndSendKey: ModifierKey, key.getEvent, keyLabel=${key.getLabel()}") setModifier(key) } else { if (key.click!!.isRepeatable) { - if (type.ordinal > KeyEventType.CLICK.ordinal) mAbortKey = true - if (!key.hasEvent(type.ordinal)) return + if (behavior > KeyBehavior.CLICK) mAbortKey = true + if (!key.hasAction(behavior)) return } - val code = key.getCode(type.ordinal) + val code = key.getCode(behavior) // TextEntryState.keyPressedAt(key, x, y); val codes = IntArray(MAX_NEARBY_KEYS) Arrays.fill(codes, NOT_A_KEY) // getKeyIndices(x, y, codes); // 这里实际上并没有生效 Timber.d("detectAndSendKey: onEvent, code=$code, key.getEvent") // 可以在这里把 mKeyboard.getModifer() 获取的修饰键状态写入event里 - key.getAction(type.ordinal)?.let { keyboardActionListener?.onAction(it) } + key.getAction(behavior)?.let { keyboardActionListener?.onAction(it) } releaseKey(code) Timber.d("detectAndSendKey: refreshModifier") refreshModifier() @@ -862,7 +861,7 @@ class KeyboardView( private fun showPreview( keyIndex: Int, - type: Int = 0, + behavior: KeyBehavior = KeyBehavior.COMPOSING, ) { val oldKeyIndex = mCurrentKeyIndex val previewPopup = mPreviewPopup @@ -895,10 +894,10 @@ class KeyboardView( if (keyIndex != NOT_A_KEY) { if (previewPopup.isShowing && mPreviewText.visibility == VISIBLE) { // Show right away, if it's already visible and finger is moving around - showKey(keyIndex, type) + showKey(keyIndex, behavior) } else { mHandler.sendMessageDelayed( - mHandler.obtainMessage(MSG_SHOW_PREVIEW, keyIndex, type), + mHandler.obtainMessage(MSG_SHOW_PREVIEW, keyIndex, behavior.ordinal), DELAY_BEFORE_PREVIEW.toLong(), ) } @@ -908,13 +907,13 @@ class KeyboardView( private fun showKey( keyIndex: Int, - type: Int, + behavior: KeyBehavior, ) { val previewPopup = mPreviewPopup if (keyIndex !in mKeys!!.indices) return val key = mKeys!![keyIndex] mPreviewText.setCompoundDrawables(null, null, null, null) - mPreviewText.text = key.getPreviewText(type) + mPreviewText.text = key.getPreviewText(behavior) mPreviewText.measure( MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), @@ -1045,7 +1044,7 @@ class KeyboardView( return false } showPreview(NOT_A_KEY) - showPreview(mCurrentKey, KeyEventType.LONG_CLICK.ordinal) + showPreview(mCurrentKey, KeyBehavior.LONG_CLICK) val popupKey = mKeys!![mCurrentKey] val result = onLongPress(popupKey) if (result) { @@ -1075,7 +1074,7 @@ class KeyboardView( return true } Timber.w("only set isShifted, no others modifierkey") - if (popupKey.isShift && !popupKey.sendBindings(KeyEventType.LONG_CLICK.ordinal)) { + if (popupKey.isShift && !popupKey.sendBindings(KeyBehavior.LONG_CLICK)) { // todo 其他修饰键 setShifted(!popupKey.isOn, !popupKey.isOn) return true @@ -1315,7 +1314,7 @@ class KeyboardView( val msg = mHandler.obtainMessage(MSG_LONGPRESS, me) mHandler.sendMessageDelayed(msg, prefs.keyboard.longPressTimeout.toLong()) } - showPreview(keyIndex, 0) + showPreview(keyIndex, KeyBehavior.COMPOSING) } /** @@ -1341,18 +1340,18 @@ class KeyboardView( val travel = prefs.keyboard.swipeTravel if (max(absY, absX) > travel && touchOnePoint) { Timber.d("\t\tonModifiedTouchEvent()\ttouch") - val keyEventType = + val keyBehavior = if (absX < absY) { Timber.d("swipeDebug.ext y, dX=$dx, dY=$dy") - if (dy > travel) KeyEventType.SWIPE_DOWN else KeyEventType.SWIPE_UP + if (dy > travel) KeyBehavior.SWIPE_DOWN else KeyBehavior.SWIPE_UP } else { Timber.d("swipeDebug.ext x, dX=$dx, dY=$dy") - if (dx > travel) KeyEventType.SWIPE_RIGHT else KeyEventType.SWIPE_LEFT + if (dx > travel) KeyBehavior.SWIPE_RIGHT else KeyBehavior.SWIPE_LEFT } showPreview(NOT_A_KEY) mHandler.removeMessages(MSG_REPEAT) mHandler.removeMessages(MSG_LONGPRESS) - detectAndSendKey(mDownKey, mStartX, mStartY, me.eventTime, keyEventType) + detectAndSendKey(mDownKey, mStartX, mStartY, me.eventTime, keyBehavior) return true } else { Timber.d("swipeDebug.ext fail, dX=$dx, dY=$dy") @@ -1373,7 +1372,7 @@ class KeyboardView( touchX, touchY, eventTime, - if (mOldPointerCount > 1 || mComboMode) KeyEventType.COMBO else KeyEventType.CLICK, + if (mOldPointerCount > 1 || mComboMode) KeyBehavior.COMBO else KeyBehavior.CLICK, ) } invalidateAllKeys()