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)
|
AlertDialog.Builder(this, R.style.MyKeyboard_Alert)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun Context.setupKeyboardDialogStuff(
|
fun Context.setupKeyboardDialogStuff(
|
||||||
windowToken: IBinder,
|
windowToken: IBinder,
|
||||||
view: View,
|
view: View,
|
||||||
@ -62,8 +61,6 @@ fun Context.setupKeyboardDialogStuff(
|
|||||||
cancelOnTouchOutside: Boolean = true,
|
cancelOnTouchOutside: Boolean = true,
|
||||||
callback: ((alertDialog: AlertDialog) -> Unit)? = null
|
callback: ((alertDialog: AlertDialog) -> Unit)? = null
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
|
||||||
val textColor = getProperTextColor()
|
val textColor = getProperTextColor()
|
||||||
val backgroundColor = getProperBackgroundColor()
|
val backgroundColor = getProperBackgroundColor()
|
||||||
val primaryColor = getProperPrimaryColor()
|
val primaryColor = getProperPrimaryColor()
|
||||||
|
@ -938,15 +938,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
|||||||
}
|
}
|
||||||
|
|
||||||
val popupKey = mKeys[mCurrentKey]
|
val popupKey = mKeys[mCurrentKey]
|
||||||
val result = if (popupKey.code == KEYCODE_EMOJI) {
|
val result = onLongPress(popupKey, me)
|
||||||
ChangeLanguagePopup(this, onSelect = {
|
|
||||||
mOnKeyboardActionListener?.reloadKeyboard()
|
|
||||||
})
|
|
||||||
true
|
|
||||||
} else {
|
|
||||||
onLongPress(popupKey, me)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
mAbortKey = true
|
mAbortKey = true
|
||||||
showPreview(NOT_A_KEY)
|
showPreview(NOT_A_KEY)
|
||||||
@ -963,6 +955,12 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
|||||||
* handle the call.
|
* handle the call.
|
||||||
*/
|
*/
|
||||||
private fun onLongPress(popupKey: MyKeyboard.Key, me: MotionEvent): Boolean {
|
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
|
val popupKeyboardId = popupKey.popupResId
|
||||||
if (popupKeyboardId != 0) {
|
if (popupKeyboardId != 0) {
|
||||||
mMiniKeyboardContainer = mMiniKeyboardCache[popupKey]
|
mMiniKeyboardContainer = mMiniKeyboardCache[popupKey]
|
||||||
@ -1062,6 +1060,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
|||||||
invalidateAllKeys()
|
invalidateAllKeys()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user