renaming some variables, making some private

This commit is contained in:
tibbi 2022-01-20 09:49:52 +01:00
parent 9dfbfa7340
commit c474eba3e8
2 changed files with 18 additions and 22 deletions

View File

@ -57,7 +57,7 @@ class MyKeyboard {
private val mShiftKeys = arrayOf<Key?>(null, null) private val mShiftKeys = arrayOf<Key?>(null, null)
/** Key index for the shift key, if present */ /** Key index for the shift key, if present */
val shiftKeyIndices = intArrayOf(-1, -1) private val shiftKeyIndices = intArrayOf(-1, -1)
/** Total height of the keyboard, including the padding and keys */ /** Total height of the keyboard, including the padding and keys */
var height = 0 var height = 0
@ -78,7 +78,7 @@ class MyKeyboard {
private var mDisplayHeight = 0 private var mDisplayHeight = 0
/** What icon should we show at Enter key */ /** What icon should we show at Enter key */
var mEnterKeyType = IME_ACTION_NONE private var mEnterKeyType = IME_ACTION_NONE
/** Keyboard mode, or zero, if none. */ /** Keyboard mode, or zero, if none. */
private var mKeyboardMode = 0 private var mKeyboardMode = 0
@ -92,21 +92,20 @@ class MyKeyboard {
private const val TAG_KEYBOARD = "Keyboard" private const val TAG_KEYBOARD = "Keyboard"
private const val TAG_ROW = "Row" private const val TAG_ROW = "Row"
private const val TAG_KEY = "Key" private const val TAG_KEY = "Key"
const val EDGE_LEFT = 0x01 private const val EDGE_LEFT = 0x01
const val EDGE_RIGHT = 0x02 private const val EDGE_RIGHT = 0x02
const val EDGE_TOP = 0x04 private const val EDGE_TOP = 0x04
const val EDGE_BOTTOM = 0x08 private const val EDGE_BOTTOM = 0x08
const val KEYCODE_SHIFT = -1 const val KEYCODE_SHIFT = -1
const val KEYCODE_MODE_CHANGE = -2 const val KEYCODE_MODE_CHANGE = -2
const val KEYCODE_ENTER = -4 const val KEYCODE_ENTER = -4
const val KEYCODE_DELETE = -5 const val KEYCODE_DELETE = -5
const val KEYCODE_ALT = -6
const val KEYCODE_SPACE = 32 const val KEYCODE_SPACE = 32
// Variables for pre-computing nearest keys. // Variables for pre-computing nearest keys.
private const val GRID_WIDTH = 10 private const val GRID_WIDTH = 10
private const val GRID_HEIGHT = 5 private const val GRID_HEIGHT = 5
private val GRID_SIZE: Int = GRID_WIDTH * GRID_HEIGHT private const val GRID_SIZE = GRID_WIDTH * GRID_HEIGHT
/** Number of key widths from current touch point to search for nearest keys. */ /** Number of key widths from current touch point to search for nearest keys. */
private const val SEARCH_DISTANCE = 1.8f private const val SEARCH_DISTANCE = 1.8f
@ -602,8 +601,6 @@ class MyKeyboard {
} }
} }
mModifierKeys.add(key) mModifierKeys.add(key)
} else if (key.codes[0] == KEYCODE_ALT) {
mModifierKeys.add(key)
} else if (key.codes[0] == KEYCODE_ENTER) { } else if (key.codes[0] == KEYCODE_ENTER) {
val enterResourceId = when (mEnterKeyType) { val enterResourceId = when (mEnterKeyType) {
EditorInfo.IME_ACTION_SEARCH -> R.drawable.ic_search_vector EditorInfo.IME_ACTION_SEARCH -> R.drawable.ic_search_vector

View File

@ -18,7 +18,6 @@ import android.view.accessibility.AccessibilityManager
import android.widget.PopupWindow import android.widget.PopupWindow
import android.widget.TextView import android.widget.TextView
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.mydebug
import com.simplemobiletools.keyboard.R import com.simplemobiletools.keyboard.R
import com.simplemobiletools.keyboard.extensions.config import com.simplemobiletools.keyboard.extensions.config
import com.simplemobiletools.keyboard.helpers.* import com.simplemobiletools.keyboard.helpers.*
@ -167,7 +166,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
* @param previewEnabled whether or not to enable the key feedback popup * @param previewEnabled whether or not to enable the key feedback popup
* @see .isPreviewEnabled * @see .isPreviewEnabled
*/ */
var isPreviewEnabled = true private var isPreviewEnabled = true
private var mPopupPreviewX = 0 private var mPopupPreviewX = 0
private var mPopupPreviewY = 0 private var mPopupPreviewY = 0
private var mLastX = 0 private var mLastX = 0
@ -183,7 +182,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
* reported. * reported.
* @param enabled whether or not the proximity correction is enabled * @param enabled whether or not the proximity correction is enabled
*/ */
var isProximityCorrectionEnabled = false private var isProximityCorrectionEnabled = false
private val mPaint: Paint private val mPaint: Paint
private val mPadding: Rect private val mPadding: Rect
private var mDownTime: Long = 0 private var mDownTime: Long = 0
@ -211,9 +210,9 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
private var mIsLongPressingSpace = false private var mIsLongPressingSpace = false
private var mLastSpaceMoveX = 0 private var mLastSpaceMoveX = 0
private var mPopupMaxMoveDistance = 0f private var mPopupMaxMoveDistance = 0f
private var topSmallNumberSize = 0f private var mTopSmallNumberSize = 0f
private var topSmallNumberMarginWidth = 0f private var mTopSmallNumberMarginWidth = 0f
private var topSmallNumberMarginHeight = 0f private var mTopSmallNumberMarginHeight = 0f
private val mSpaceMoveThreshold: Int private val mSpaceMoveThreshold: Int
// Variables for dealing with multiple pointers // Variables for dealing with multiple pointers
@ -252,7 +251,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
/** The audio manager for accessibility support */ /** The audio manager for accessibility support */
private val mAudioManager: AudioManager private val mAudioManager: AudioManager
var mHandler: Handler? = null private var mHandler: Handler? = null
companion object { companion object {
private const val NOT_A_KEY = -1 private const val NOT_A_KEY = -1
@ -333,9 +332,9 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
mAccessibilityManager = (context.getSystemService(Context.ACCESSIBILITY_SERVICE) as AccessibilityManager) mAccessibilityManager = (context.getSystemService(Context.ACCESSIBILITY_SERVICE) as AccessibilityManager)
mAudioManager = context.getSystemService(Context.AUDIO_SERVICE) as AudioManager mAudioManager = context.getSystemService(Context.AUDIO_SERVICE) as AudioManager
mPopupMaxMoveDistance = resources.getDimension(R.dimen.popup_max_move_distance) mPopupMaxMoveDistance = resources.getDimension(R.dimen.popup_max_move_distance)
topSmallNumberSize = resources.getDimension(R.dimen.small_text_size) mTopSmallNumberSize = resources.getDimension(R.dimen.small_text_size)
topSmallNumberMarginWidth = resources.getDimension(R.dimen.top_small_number_margin_width) mTopSmallNumberMarginWidth = resources.getDimension(R.dimen.top_small_number_margin_width)
topSmallNumberMarginHeight = resources.getDimension(R.dimen.top_small_number_margin_height) mTopSmallNumberMarginHeight = resources.getDimension(R.dimen.top_small_number_margin_height)
resetMultiTap() resetMultiTap()
} }
@ -593,7 +592,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
smallLetterPaint.set(paint) smallLetterPaint.set(paint)
smallLetterPaint.apply { smallLetterPaint.apply {
color = paint.color.adjustAlpha(0.8f) color = paint.color.adjustAlpha(0.8f)
textSize = topSmallNumberSize textSize = mTopSmallNumberSize
typeface = Typeface.DEFAULT typeface = Typeface.DEFAULT
} }
@ -667,7 +666,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
) )
if (key.topSmallNumber.isNotEmpty()) { if (key.topSmallNumber.isNotEmpty()) {
canvas.drawText(key.topSmallNumber, key.width - topSmallNumberMarginWidth, topSmallNumberMarginHeight, smallLetterPaint) canvas.drawText(key.topSmallNumber, key.width - mTopSmallNumberMarginWidth, mTopSmallNumberMarginHeight, smallLetterPaint)
} }
// Turn off drop shadow // Turn off drop shadow