feat: implemented logic to hide and show number keys row.

This commit is contained in:
ismailnurudeen
2023-04-18 16:15:25 +01:00
parent 14e94ea8cd
commit 5363970799
2 changed files with 21 additions and 2 deletions

View File

@ -97,6 +97,8 @@ class MyKeyboard {
var parent: MyKeyboard
var isNumRow: Boolean = false
constructor(parent: MyKeyboard) {
this.parent = parent
}
@ -107,6 +109,7 @@ class MyKeyboard {
defaultWidth = getDimensionOrFraction(a, R.styleable.MyKeyboard_keyWidth, parent.mDisplayWidth, parent.mDefaultWidth)
defaultHeight = (res.getDimension(R.dimen.key_height) * this.parent.mKeyboardHeightMultiplier).roundToInt()
defaultHorizontalGap = getDimensionOrFraction(a, R.styleable.MyKeyboard_horizontalGap, parent.mDisplayWidth, parent.mDefaultHorizontalGap)
isNumRow = a.getBoolean(R.styleable.MyKeyboard_isNumRow, false)
a.recycle()
}
}
@ -342,12 +345,19 @@ class MyKeyboard {
if (event == XmlResourceParser.START_TAG) {
when (parser.name) {
TAG_ROW -> {
currentRow = createRowFromXml(res, parser)
if (currentRow.isNumRow && !context.config.showNumbersRow) {
continue
}
inRow = true
x = 0
currentRow = createRowFromXml(res, parser)
mRows.add(currentRow)
}
TAG_KEY -> {
if (currentRow?.isNumRow == true && !context.config.showNumbersRow) {
continue
}
inKey = true
key = createKeyFromXml(res, currentRow!!, x, y, parser)
mKeys!!.add(key)
@ -362,6 +372,7 @@ class MyKeyboard {
}
currentRow.mKeys.add(key)
}
TAG_KEYBOARD -> {
parseKeyboardAttributes(res, parser)
}