mirror of
https://github.com/SimpleMobileTools/Simple-Keyboard.git
synced 2025-06-05 21:49:26 +02:00
cleanup code
- remove duplicate blank lines - move emoji key code check to the onLongPress method
This commit is contained in:
@ -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()
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user