Skip to content

Commit ec7957a

Browse files
committed
refactor: remove deprecated popup keyboard stuffs in KeyboardView
1 parent b343450 commit ec7957a

File tree

1 file changed

+2
-34
lines changed

1 file changed

+2
-34
lines changed

app/src/main/java/com/osfans/trime/ime/keyboard/KeyboardView.kt

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ class KeyboardView(
5151
context: Context,
5252
private val theme: Theme,
5353
private val keyboard: Keyboard,
54-
) : View(context),
55-
View.OnClickListener {
54+
) : View(context) {
5655
private var mCurrentKeyIndex = NOT_A_KEY
5756
private val keyTextSize = theme.generalStyle.keyTextSize
5857
private val labelTextSize =
@@ -111,11 +110,7 @@ class KeyboardView(
111110

112111
// Working variable
113112
private val mCoordinates = IntArray(2)
114-
private val mPopupKeyboard = PopupWindow(context)
115-
private var mMiniKeyboardOnScreen = false
116113
private var mPopupParent: View = this
117-
private var mMiniKeyboardOffsetX = 0
118-
private var mMiniKeyboardOffsetY = 0
119114
private val mKeys get() = keyboard.keys
120115

121116
var keyboardActionListener: KeyboardActionListener? = null
@@ -418,15 +413,6 @@ class KeyboardView(
418413
val isCapsOn: Boolean
419414
get() = keyboard.mShiftKey?.isOn ?: false
420415

421-
/**
422-
* 關閉彈出鍵盤
423-
*
424-
* @param v 鍵盤視圖
425-
*/
426-
override fun onClick(v: View) {
427-
dismissPopupKeyboard()
428-
}
429-
430416
public override fun onMeasure(
431417
widthMeasureSpec: Int,
432418
heightMeasureSpec: Int,
@@ -802,8 +788,6 @@ class KeyboardView(
802788
}
803789
mHandler.removeMessages(MSG_REMOVE_PREVIEW)
804790
getLocationInWindow(mCoordinates)
805-
mCoordinates[0] += mMiniKeyboardOffsetX // Offset may be zero
806-
mCoordinates[1] += mMiniKeyboardOffsetY // Offset may be zero
807791

808792
// Set the preview background state
809793
mPreviewText.background.setState(EMPTY_STATE_SET)
@@ -1001,12 +985,6 @@ class KeyboardView(
1001985
}
1002986
}
1003987

1004-
// Needs to be called after the gesture detector gets a turn, as it may have
1005-
// displayed the mini keyboard
1006-
if (mMiniKeyboardOnScreen && action != MotionEvent.ACTION_CANCEL) {
1007-
return true
1008-
}
1009-
1010988
fun modifiedPointerDown() {
1011989
mAbortKey = false
1012990
mStartX = touchX
@@ -1089,7 +1067,7 @@ class KeyboardView(
10891067
showPreview(NOT_A_KEY)
10901068
Arrays.fill(mKeyIndices, NOT_A_KEY)
10911069
if (mRepeatKeyIndex != NOT_A_KEY && !mAbortKey) repeatKey()
1092-
if (mRepeatKeyIndex == NOT_A_KEY && !mMiniKeyboardOnScreen && !mAbortKey) {
1070+
if (mRepeatKeyIndex == NOT_A_KEY && !mAbortKey) {
10931071
Timber.d("onModifiedTouchEvent: detectAndSendKey")
10941072
detectAndSendKey(
10951073
mCurrentKey,
@@ -1159,7 +1137,6 @@ class KeyboardView(
11591137

11601138
MotionEvent.ACTION_CANCEL -> {
11611139
removeMessages()
1162-
dismissPopupKeyboard()
11631140
mAbortKey = true
11641141
showPreview(NOT_A_KEY)
11651142
invalidateKey(mKeys[mCurrentKey])
@@ -1188,7 +1165,6 @@ class KeyboardView(
11881165
mPreviewPopup.dismiss()
11891166
}
11901167
removeMessages()
1191-
dismissPopupKeyboard()
11921168
freeDrawingBuffer()
11931169
}
11941170

@@ -1197,14 +1173,6 @@ class KeyboardView(
11971173
freeDrawingBuffer()
11981174
}
11991175

1200-
private fun dismissPopupKeyboard() {
1201-
if (mPopupKeyboard.isShowing) {
1202-
mPopupKeyboard.dismiss()
1203-
mMiniKeyboardOnScreen = false
1204-
invalidateAllKeys()
1205-
}
1206-
}
1207-
12081176
private fun resetMultiTap() {
12091177
mLastSentIndex = -1
12101178
// final int mTapCount = 0;

0 commit comments

Comments
 (0)