mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-14 07:48:58 +00:00
ANDROID: Add comments and code to reinforce hiding of system cursor
For the case when an external mouse is connected to the device The code still only fixes the issue for devices runnng Android 7.0 or newer
This commit is contained in:
parent
8f2ecc34ee
commit
f6d1ab66b7
@ -3,24 +3,32 @@ package org.scummvm.scummvm;
|
||||
import android.content.Context;
|
||||
import android.text.InputType;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.PointerIcon;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.inputmethod.BaseInputConnection;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.annotation.TargetApi;
|
||||
|
||||
public class EditableSurfaceView extends SurfaceView {
|
||||
Context _context;
|
||||
public EditableSurfaceView(Context context) {
|
||||
|
||||
super(context);
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public EditableSurfaceView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public EditableSurfaceView(Context context, AttributeSet attrs,
|
||||
int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
_context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -58,4 +66,18 @@ public class EditableSurfaceView extends SurfaceView {
|
||||
|
||||
return new MyInputConnection();
|
||||
}
|
||||
|
||||
// This re-inforces the code for hiding the system mouse.
|
||||
// We already had code for this in ScummVMActivity (see showMouseCursor())
|
||||
// so this might be redundant
|
||||
//
|
||||
// It applies on devices running Android 7 and above
|
||||
// https://stackoverflow.com/a/55482761
|
||||
// https://developer.android.com/reference/android/view/PointerIcon.html
|
||||
//
|
||||
@TargetApi(24)
|
||||
@Override
|
||||
public PointerIcon onResolvePointerIcon(MotionEvent me, int pointerIndex) {
|
||||
return PointerIcon.getSystemIcon(_context, PointerIcon.TYPE_NULL);
|
||||
}
|
||||
}
|
||||
|
@ -484,8 +484,10 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
|
||||
|
||||
private void showMouseCursor(boolean show) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
// Android N (Nougat) is Android 7.0
|
||||
SurfaceView main_surface = findViewById(R.id.main_surface);
|
||||
int type = show ? PointerIcon.TYPE_DEFAULT : PointerIcon.TYPE_NULL;
|
||||
// https://stackoverflow.com/a/55482761
|
||||
main_surface.setPointerIcon(PointerIcon.getSystemIcon(this, type));
|
||||
} else {
|
||||
/* Currently hiding the system mouse cursor is only
|
||||
|
Loading…
x
Reference in New Issue
Block a user