make sure the popup width is the same as the key width itself

This commit is contained in:
tibbi 2022-02-02 19:12:55 +01:00
parent e690b29f49
commit 0c6259343e
2 changed files with 4 additions and 3 deletions

View File

@ -284,8 +284,9 @@ class MyKeyboard {
* @param context the application or service context
* @param layoutTemplateResId the layout template file, containing no keys.
* @param characters the list of characters to display on the keyboard. One key will be created for each character.
* @param keyWidth the width of the popup key, make sure it is the same as the key itself
*/
constructor(context: Context, layoutTemplateResId: Int, characters: CharSequence) :
constructor(context: Context, layoutTemplateResId: Int, characters: CharSequence, keyWidth: Int) :
this(context, layoutTemplateResId, 0) {
var x = 0
var y = 0
@ -293,7 +294,7 @@ class MyKeyboard {
mMinWidth = 0
val row = Row(this)
row.defaultHeight = mDefaultHeight
row.defaultWidth = mDefaultWidth
row.defaultWidth = keyWidth
row.defaultHorizontalGap = mDefaultHorizontalGap
characters.forEachIndexed { index, character ->

View File

@ -963,7 +963,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
}
val keyboard = if (popupKey.popupCharacters != null) {
MyKeyboard(context, popupKeyboardId, popupKey.popupCharacters!!)
MyKeyboard(context, popupKeyboardId, popupKey.popupCharacters!!, popupKey.width)
} else {
MyKeyboard(context, popupKeyboardId, 0)
}