mirror of
https://github.com/SimpleMobileTools/Simple-Keyboard.git
synced 2025-06-05 21:49:26 +02:00
removing some unused keyboard key attributes
This commit is contained in:
@ -129,8 +129,6 @@ class MyKeyboard {
|
|||||||
|
|
||||||
var mKeys = ArrayList<Key>()
|
var mKeys = ArrayList<Key>()
|
||||||
|
|
||||||
/** The keyboard mode for this row */
|
|
||||||
var mode = 0
|
|
||||||
var parent: MyKeyboard
|
var parent: MyKeyboard
|
||||||
|
|
||||||
constructor(parent: MyKeyboard) {
|
constructor(parent: MyKeyboard) {
|
||||||
@ -157,12 +155,9 @@ class MyKeyboard {
|
|||||||
* @attr ref android.R.styleable#Keyboard_Key_keyIcon
|
* @attr ref android.R.styleable#Keyboard_Key_keyIcon
|
||||||
* @attr ref android.R.styleable#Keyboard_Key_keyLabel
|
* @attr ref android.R.styleable#Keyboard_Key_keyLabel
|
||||||
* @attr ref android.R.styleable#Keyboard_Key_iconPreview
|
* @attr ref android.R.styleable#Keyboard_Key_iconPreview
|
||||||
* @attr ref android.R.styleable#Keyboard_Key_isSticky
|
|
||||||
* @attr ref android.R.styleable#Keyboard_Key_isRepeatable
|
* @attr ref android.R.styleable#Keyboard_Key_isRepeatable
|
||||||
* @attr ref android.R.styleable#Keyboard_Key_isModifier
|
|
||||||
* @attr ref android.R.styleable#Keyboard_Key_popupKeyboard
|
* @attr ref android.R.styleable#Keyboard_Key_popupKeyboard
|
||||||
* @attr ref android.R.styleable#Keyboard_Key_popupCharacters
|
* @attr ref android.R.styleable#Keyboard_Key_popupCharacters
|
||||||
* @attr ref android.R.styleable#Keyboard_Key_keyOutputText
|
|
||||||
* @attr ref android.R.styleable#Keyboard_Key_keyEdgeFlags
|
* @attr ref android.R.styleable#Keyboard_Key_keyEdgeFlags
|
||||||
*/
|
*/
|
||||||
class Key(parent: Row) {
|
class Key(parent: Row) {
|
||||||
@ -190,9 +185,6 @@ class MyKeyboard {
|
|||||||
/** The horizontal gap before this key */
|
/** The horizontal gap before this key */
|
||||||
var gap: Int
|
var gap: Int
|
||||||
|
|
||||||
/** Whether this key is sticky, i.e., a toggle key */
|
|
||||||
var sticky = false
|
|
||||||
|
|
||||||
/** X coordinate of the key in the keyboard layout */
|
/** X coordinate of the key in the keyboard layout */
|
||||||
var x = 0
|
var x = 0
|
||||||
|
|
||||||
@ -205,9 +197,6 @@ class MyKeyboard {
|
|||||||
/** Focused state, used after long pressing a key and swiping to alternative keys */
|
/** Focused state, used after long pressing a key and swiping to alternative keys */
|
||||||
var focused = false
|
var focused = false
|
||||||
|
|
||||||
/** Text to output when pressed. This can be multiple characters, like ".com" */
|
|
||||||
var text: CharSequence? = null
|
|
||||||
|
|
||||||
/** Popup characters */
|
/** Popup characters */
|
||||||
var popupCharacters: CharSequence? = null
|
var popupCharacters: CharSequence? = null
|
||||||
|
|
||||||
@ -218,9 +207,6 @@ class MyKeyboard {
|
|||||||
*/
|
*/
|
||||||
var edgeFlags = 0
|
var edgeFlags = 0
|
||||||
|
|
||||||
/** Whether this is a modifier key, such as Shift or Alt */
|
|
||||||
var modifier = false
|
|
||||||
|
|
||||||
/** The keyboard that this key belongs to */
|
/** The keyboard that this key belongs to */
|
||||||
private val keyboard: MyKeyboard = parent.parent
|
private val keyboard: MyKeyboard = parent.parent
|
||||||
|
|
||||||
@ -264,14 +250,11 @@ class MyKeyboard {
|
|||||||
popupCharacters = a.getText(R.styleable.MyKeyboard_Key_popupCharacters)
|
popupCharacters = a.getText(R.styleable.MyKeyboard_Key_popupCharacters)
|
||||||
popupResId = a.getResourceId(R.styleable.MyKeyboard_Key_popupKeyboard, 0)
|
popupResId = a.getResourceId(R.styleable.MyKeyboard_Key_popupKeyboard, 0)
|
||||||
repeatable = a.getBoolean(R.styleable.MyKeyboard_Key_isRepeatable, false)
|
repeatable = a.getBoolean(R.styleable.MyKeyboard_Key_isRepeatable, false)
|
||||||
modifier = a.getBoolean(R.styleable.MyKeyboard_Key_isModifier, false)
|
|
||||||
sticky = a.getBoolean(R.styleable.MyKeyboard_Key_isSticky, false)
|
|
||||||
edgeFlags = a.getInt(R.styleable.MyKeyboard_Key_keyEdgeFlags, 0)
|
edgeFlags = a.getInt(R.styleable.MyKeyboard_Key_keyEdgeFlags, 0)
|
||||||
icon = a.getDrawable(R.styleable.MyKeyboard_Key_keyIcon)
|
icon = a.getDrawable(R.styleable.MyKeyboard_Key_keyIcon)
|
||||||
icon?.setBounds(0, 0, icon!!.intrinsicWidth, icon!!.intrinsicHeight)
|
icon?.setBounds(0, 0, icon!!.intrinsicWidth, icon!!.intrinsicHeight)
|
||||||
|
|
||||||
label = a.getText(R.styleable.MyKeyboard_Key_keyLabel) ?: ""
|
label = a.getText(R.styleable.MyKeyboard_Key_keyLabel) ?: ""
|
||||||
text = a.getText(R.styleable.MyKeyboard_Key_keyOutputText)
|
|
||||||
topSmallNumber = a.getString(R.styleable.MyKeyboard_Key_topSmallNumber) ?: ""
|
topSmallNumber = a.getString(R.styleable.MyKeyboard_Key_topSmallNumber) ?: ""
|
||||||
|
|
||||||
if (label.isNotEmpty() && codes.firstOrNull() != KEYCODE_MODE_CHANGE && codes.firstOrNull() != KEYCODE_SHIFT) {
|
if (label.isNotEmpty() && codes.firstOrNull() != KEYCODE_MODE_CHANGE && codes.firstOrNull() != KEYCODE_SHIFT) {
|
||||||
|
@ -323,7 +323,6 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
public override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
||||||
// Round up a little
|
|
||||||
if (mKeyboard == null) {
|
if (mKeyboard == null) {
|
||||||
setMeasuredDimension(0, 0)
|
setMeasuredDimension(0, 0)
|
||||||
} else {
|
} else {
|
||||||
@ -564,7 +563,6 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
|||||||
private fun detectAndSendKey(index: Int, x: Int, y: Int, eventTime: Long) {
|
private fun detectAndSendKey(index: Int, x: Int, y: Int, eventTime: Long) {
|
||||||
if (index != NOT_A_KEY && index < mKeys.size) {
|
if (index != NOT_A_KEY && index < mKeys.size) {
|
||||||
val key = mKeys[index]
|
val key = mKeys[index]
|
||||||
if (key.text == null) {
|
|
||||||
var code = key.codes[0]
|
var code = key.codes[0]
|
||||||
val codes = IntArray(MAX_NEARBY_KEYS)
|
val codes = IntArray(MAX_NEARBY_KEYS)
|
||||||
Arrays.fill(codes, NOT_A_KEY)
|
Arrays.fill(codes, NOT_A_KEY)
|
||||||
@ -579,7 +577,6 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
|||||||
code = key.codes[mTapCount]
|
code = key.codes[mTapCount]
|
||||||
}
|
}
|
||||||
onKeyboardActionListener!!.onKey(code, codes)
|
onKeyboardActionListener!!.onKey(code, codes)
|
||||||
}
|
|
||||||
mLastSentIndex = index
|
mLastSentIndex = index
|
||||||
mLastTapTime = eventTime
|
mLastTapTime = eventTime
|
||||||
}
|
}
|
||||||
|
@ -27,16 +27,10 @@
|
|||||||
<!-- Key is anchored to the right of the keyboard. -->
|
<!-- Key is anchored to the right of the keyboard. -->
|
||||||
<flag name="right" value="2" />
|
<flag name="right" value="2" />
|
||||||
</attr>
|
</attr>
|
||||||
<!-- Whether this is a modifier key such as Alt or Shift. -->
|
|
||||||
<attr name="isModifier" format="boolean" />
|
|
||||||
<!-- Whether this is a toggle key. -->
|
|
||||||
<attr name="isSticky" format="boolean" />
|
|
||||||
<!-- Whether long-pressing on this key will make it repeat. -->
|
<!-- Whether long-pressing on this key will make it repeat. -->
|
||||||
<attr name="isRepeatable" format="boolean" />
|
<attr name="isRepeatable" format="boolean" />
|
||||||
<!-- The icon to show in the popup preview. -->
|
<!-- The icon to show in the popup preview. -->
|
||||||
<attr name="iconPreview" format="reference" />
|
<attr name="iconPreview" format="reference" />
|
||||||
<!-- The string of characters to output when this key is pressed. -->
|
|
||||||
<attr name="keyOutputText" format="string" />
|
|
||||||
<!-- The label to display on the key. -->
|
<!-- The label to display on the key. -->
|
||||||
<attr name="keyLabel" format="string" />
|
<attr name="keyLabel" format="string" />
|
||||||
<!-- The icon to display on the key instead of the label. -->
|
<!-- The icon to display on the key instead of the label. -->
|
||||||
|
Reference in New Issue
Block a user