mirror of
https://github.com/geode-sdk/android-launcher.git
synced 2026-10-21 16:32:39 +00:00
cleanup edittext
This commit is contained in:
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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user