cleanup edittext

This commit is contained in:
qimiko committed 2022-05-27 02:30:37 -07:00
1 parent c7c402409a
commit 537175b60e
2 files changed
+5 -21

No files matched your search

@@ -1,34 +1,18 @@
package org.cocos2dx.lib
import android.content.Context
import android.util.AttributeSet
import android.view.KeyEvent
import androidx.appcompat.widget.AppCompatEditText
class Cocos2dxEditText : AppCompatEditText {
private var mCocos2dxGLSurfaceView: Cocos2dxGLSurfaceView? = null
constructor(context: Context) : super(context) {}
constructor(context: Context, attrs: AttributeSet) : super(
context, attrs
) {
}
constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(
context, attrs, defStyle
) {
}
fun setCocos2dxGLSurfaceView(pCocos2dxGLSurfaceView: Cocos2dxGLSurfaceView?) {
mCocos2dxGLSurfaceView = pCocos2dxGLSurfaceView
}
class Cocos2dxEditText(context: Context) : AppCompatEditText(context) {
var cocos2dxGLSurfaceView: Cocos2dxGLSurfaceView? = null
override fun onKeyDown(pKeyCode: Int, pKeyEvent: KeyEvent): Boolean {
super.onKeyDown(pKeyCode, pKeyEvent)
if (pKeyCode != 4) {
if (pKeyCode != KeyEvent.KEYCODE_BACK) {
return true
}
mCocos2dxGLSurfaceView!!.requestFocus()
cocos2dxGLSurfaceView?.requestFocus()
return true
}
}
@@ -222,7 +222,7 @@ class Cocos2dxGLSurfaceView(context: Context) : GLSurfaceView(context) {
mCocos2dxEditText = pCocos2dxEditText
if (sCocos2dxTextInputWrapper != null) {
mCocos2dxEditText?.setOnEditorActionListener(sCocos2dxTextInputWrapper)
mCocos2dxEditText?.setCocos2dxGLSurfaceView(this)
mCocos2dxEditText?.cocos2dxGLSurfaceView = this
requestFocus()
}
}