cleanup code

- remove duplicate blank lines
- move emoji key code check to the onLongPress method
This commit is contained in:
darthpaul
2022-11-05 21:49:58 +00:00
parent 210da88052
commit bcbd67aaac
2 changed files with 105 additions and 109 deletions

View File

@ -52,7 +52,6 @@ fun Context.getKeyboardDialogBuilder() = if (baseConfig.isUsingSystemTheme) {
AlertDialog.Builder(this, R.style.MyKeyboard_Alert)
}
fun Context.setupKeyboardDialogStuff(
windowToken: IBinder,
view: View,
@ -62,8 +61,6 @@ fun Context.setupKeyboardDialogStuff(
cancelOnTouchOutside: Boolean = true,
callback: ((alertDialog: AlertDialog) -> Unit)? = null
) {
val textColor = getProperTextColor()
val backgroundColor = getProperBackgroundColor()
val primaryColor = getProperPrimaryColor()

View File

@ -938,15 +938,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
}
val popupKey = mKeys[mCurrentKey]
val result = if (popupKey.code == KEYCODE_EMOJI) {
ChangeLanguagePopup(this, onSelect = {
mOnKeyboardActionListener?.reloadKeyboard()
})
true
} else {
onLongPress(popupKey, me)
}
val result = onLongPress(popupKey, me)
if (result) {
mAbortKey = true
showPreview(NOT_A_KEY)
@ -963,6 +955,12 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
* handle the call.
*/
private fun onLongPress(popupKey: MyKeyboard.Key, me: MotionEvent): Boolean {
if (popupKey.code == KEYCODE_EMOJI) {
ChangeLanguagePopup(this, onSelect = {
mOnKeyboardActionListener?.reloadKeyboard()
})
return true
} else {
val popupKeyboardId = popupKey.popupResId
if (popupKeyboardId != 0) {
mMiniKeyboardContainer = mMiniKeyboardCache[popupKey]
@ -1062,6 +1060,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
invalidateAllKeys()
return true
}
}
return false
}