removing unused verticalGap key attribute

This commit is contained in:
tibbi 2022-01-21 17:24:47 +01:00
parent 37d0fc0e5c
commit 80963a35d2
3 changed files with 3 additions and 21 deletions

View File

@ -24,7 +24,6 @@ import java.util.*
* android:keyWidth="%10p" * android:keyWidth="%10p"
* android:keyHeight="50px" * android:keyHeight="50px"
* android:horizontalGap="2px" * android:horizontalGap="2px"
* android:verticalGap="2px" >
* <Row android:keyWidth="32px" > * <Row android:keyWidth="32px" >
* <Key android:keyLabel="A" /> * <Key android:keyLabel="A" />
* ... * ...
@ -35,7 +34,6 @@ import java.util.*
* @attr ref android.R.styleable#Keyboard_keyWidth * @attr ref android.R.styleable#Keyboard_keyWidth
* @attr ref android.R.styleable#Keyboard_keyHeight * @attr ref android.R.styleable#Keyboard_keyHeight
* @attr ref android.R.styleable#Keyboard_horizontalGap * @attr ref android.R.styleable#Keyboard_horizontalGap
* @attr ref android.R.styleable#Keyboard_verticalGap
*/ */
class MyKeyboard { class MyKeyboard {
/** Horizontal gap default for all rows */ /** Horizontal gap default for all rows */
@ -47,9 +45,6 @@ class MyKeyboard {
/** Default key height */ /** Default key height */
private var mDefaultHeight = 0 private var mDefaultHeight = 0
/** Default gap between rows */
private var mDefaultVerticalGap = 0
/** Is the keyboard in the shifted state */ /** Is the keyboard in the shifted state */
var shiftState = SHIFT_OFF var shiftState = SHIFT_OFF
@ -122,7 +117,6 @@ class MyKeyboard {
* @attr ref android.R.styleable#Keyboard_keyWidth * @attr ref android.R.styleable#Keyboard_keyWidth
* @attr ref android.R.styleable#Keyboard_keyHeight * @attr ref android.R.styleable#Keyboard_keyHeight
* @attr ref android.R.styleable#Keyboard_horizontalGap * @attr ref android.R.styleable#Keyboard_horizontalGap
* @attr ref android.R.styleable#Keyboard_verticalGap
* @attr ref android.R.styleable#Keyboard_Row_rowEdgeFlags * @attr ref android.R.styleable#Keyboard_Row_rowEdgeFlags
* @attr ref android.R.styleable#Keyboard_Row_keyboardMode * @attr ref android.R.styleable#Keyboard_Row_keyboardMode
*/ */
@ -136,9 +130,6 @@ class MyKeyboard {
/** Default horizontal gap between keys in this row. */ /** Default horizontal gap between keys in this row. */
var defaultHorizontalGap = 0 var defaultHorizontalGap = 0
/** Vertical gap following this row. */
var verticalGap = 0
var mKeys = ArrayList<Key>() var mKeys = ArrayList<Key>()
/** /**
@ -161,7 +152,6 @@ class MyKeyboard {
defaultWidth = getDimensionOrFraction(a, R.styleable.MyKeyboard_keyWidth, parent.mDisplayWidth, parent.mDefaultWidth) defaultWidth = getDimensionOrFraction(a, R.styleable.MyKeyboard_keyWidth, parent.mDisplayWidth, parent.mDefaultWidth)
defaultHeight = res.getDimension(R.dimen.key_height).toInt() defaultHeight = res.getDimension(R.dimen.key_height).toInt()
defaultHorizontalGap = getDimensionOrFraction(a, R.styleable.MyKeyboard_horizontalGap, parent.mDisplayWidth, parent.mDefaultHorizontalGap) defaultHorizontalGap = getDimensionOrFraction(a, R.styleable.MyKeyboard_horizontalGap, parent.mDisplayWidth, parent.mDefaultHorizontalGap)
verticalGap = getDimensionOrFraction(a, R.styleable.MyKeyboard_verticalGap, parent.mDisplayHeight, parent.mDefaultVerticalGap)
a.recycle() a.recycle()
a = res.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.MyKeyboard_Row) a = res.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.MyKeyboard_Row)
@ -393,7 +383,6 @@ class MyKeyboard {
mDisplayHeight = dm.heightPixels mDisplayHeight = dm.heightPixels
mDefaultHorizontalGap = 0 mDefaultHorizontalGap = 0
mDefaultWidth = mDisplayWidth / 10 mDefaultWidth = mDisplayWidth / 10
mDefaultVerticalGap = 0
mDefaultHeight = mDefaultWidth mDefaultHeight = mDefaultWidth
mKeys = ArrayList() mKeys = ArrayList()
mEnterKeyType = enterKeyType mEnterKeyType = enterKeyType
@ -424,7 +413,6 @@ class MyKeyboard {
row.defaultHeight = mDefaultHeight row.defaultHeight = mDefaultHeight
row.defaultWidth = mDefaultWidth row.defaultWidth = mDefaultWidth
row.defaultHorizontalGap = mDefaultHorizontalGap row.defaultHorizontalGap = mDefaultHorizontalGap
row.verticalGap = mDefaultVerticalGap
row.rowEdgeFlags = EDGE_TOP or EDGE_BOTTOM row.rowEdgeFlags = EDGE_TOP or EDGE_BOTTOM
characters.forEachIndexed { index, character -> characters.forEachIndexed { index, character ->
@ -615,15 +603,14 @@ class MyKeyboard {
} }
} else if (inRow) { } else if (inRow) {
inRow = false inRow = false
y += currentRow!!.verticalGap y += currentRow!!.defaultHeight
y += currentRow.defaultHeight
row++ row++
} }
} }
} }
} catch (e: Exception) { } catch (e: Exception) {
} }
height = y - mDefaultVerticalGap height = y
} }
private fun skipToEndOfRow(parser: XmlResourceParser) { private fun skipToEndOfRow(parser: XmlResourceParser) {
@ -640,7 +627,6 @@ class MyKeyboard {
mDefaultWidth = getDimensionOrFraction(a, R.styleable.MyKeyboard_keyWidth, mDisplayWidth, mDisplayWidth / 10) mDefaultWidth = getDimensionOrFraction(a, R.styleable.MyKeyboard_keyWidth, mDisplayWidth, mDisplayWidth / 10)
mDefaultHeight = res.getDimension(R.dimen.key_height).toInt() mDefaultHeight = res.getDimension(R.dimen.key_height).toInt()
mDefaultHorizontalGap = getDimensionOrFraction(a, R.styleable.MyKeyboard_horizontalGap, mDisplayWidth, 0) mDefaultHorizontalGap = getDimensionOrFraction(a, R.styleable.MyKeyboard_horizontalGap, mDisplayWidth, 0)
mDefaultVerticalGap = getDimensionOrFraction(a, R.styleable.MyKeyboard_verticalGap, mDisplayHeight, 0)
mProximityThreshold = (mDefaultWidth * SEARCH_DISTANCE).toInt() mProximityThreshold = (mDefaultWidth * SEARCH_DISTANCE).toInt()
mProximityThreshold *= mProximityThreshold // Square it for comparison mProximityThreshold *= mProximityThreshold // Square it for comparison
a.recycle() a.recycle()

View File

@ -39,8 +39,6 @@
<attr name="keyWidth" format="dimension|fraction" /> <attr name="keyWidth" format="dimension|fraction" />
<!-- Default horizontal gap between keys. --> <!-- Default horizontal gap between keys. -->
<attr name="horizontalGap" format="dimension|fraction" /> <attr name="horizontalGap" format="dimension|fraction" />
<!-- Default vertical gap between rows of keys. -->
<attr name="verticalGap" format="dimension|fraction" />
</declare-styleable> </declare-styleable>
<declare-styleable name="MyKeyboard_Row"> <declare-styleable name="MyKeyboard_Row">

View File

@ -1,4 +1,2 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:app="http://schemas.android.com/apk/res-auto" <Keyboard />
app:horizontalGap="0px"
app:verticalGap="0px" />