@@ -64,6 +64,7 @@ public class AxmolGLSurfaceView extends GLSurfaceView {
64
64
65
65
private boolean mSoftKeyboardShown = false ;
66
66
private boolean mMultipleTouchEnabled = true ;
67
+ private boolean mInteractive = true ;
67
68
68
69
private CountDownLatch mNativePauseComplete ;
69
70
@@ -83,6 +84,14 @@ public void setMultipleTouchEnabled(boolean multipleTouchEnabled) {
83
84
this .mMultipleTouchEnabled = multipleTouchEnabled ;
84
85
}
85
86
87
+ public boolean isInteractive () {
88
+ return mInteractive ;
89
+ }
90
+
91
+ public void setInteractive (boolean interactive ) {
92
+ this .mInteractive = interactive ;
93
+ }
94
+
86
95
// ===========================================================
87
96
// Constructors
88
97
// ===========================================================
@@ -214,6 +223,10 @@ public boolean onTouchEvent(final MotionEvent pMotionEvent) {
214
223
215
224
switch (pMotionEvent .getAction () & MotionEvent .ACTION_MASK ) {
216
225
case MotionEvent .ACTION_POINTER_DOWN :
226
+ if (!mInteractive ) {
227
+ break ;
228
+ }
229
+
217
230
final int indexPointerDown = pMotionEvent .getAction () >> MotionEvent .ACTION_POINTER_INDEX_SHIFT ;
218
231
if (!mMultipleTouchEnabled && indexPointerDown != 0 ) {
219
232
break ;
@@ -231,6 +244,10 @@ public void run() {
231
244
break ;
232
245
233
246
case MotionEvent .ACTION_DOWN :
247
+ if (!mInteractive ) {
248
+ break ;
249
+ }
250
+
234
251
// there are only one finger on the screen
235
252
final int idDown = pMotionEvent .getPointerId (0 );
236
253
final float xDown = xs [0 ];
@@ -351,6 +368,10 @@ protected void onSizeChanged(final int pNewSurfaceWidth, final int pNewSurfaceHe
351
368
352
369
@ Override
353
370
public boolean onKeyDown (final int pKeyCode , final KeyEvent pKeyEvent ) {
371
+ if (!mInteractive ) {
372
+ return false ;
373
+ }
374
+
354
375
switch (pKeyCode ) {
355
376
case KeyEvent .KEYCODE_BACK :
356
377
case KeyEvent .KEYCODE_MENU :
@@ -375,6 +396,10 @@ public void run() {
375
396
376
397
@ Override
377
398
public boolean onKeyUp (final int keyCode , KeyEvent event ) {
399
+ if (!mInteractive ) {
400
+ return false ;
401
+ }
402
+
378
403
switch (keyCode ) {
379
404
case KeyEvent .KEYCODE_BACK :
380
405
case KeyEvent .KEYCODE_MENU :
0 commit comments