mirror of https://github.com/encounter/SDL.git
Android: remove old code after Android-16 has been set as minimum requirement
This commit is contained in:
parent
861a21f98b
commit
d86de288d4
|
@ -13,13 +13,13 @@ android {
|
||||||
if (buildAsApplication) {
|
if (buildAsApplication) {
|
||||||
applicationId "org.libsdl.app"
|
applicationId "org.libsdl.app"
|
||||||
}
|
}
|
||||||
minSdkVersion 14
|
minSdkVersion 16
|
||||||
targetSdkVersion 26
|
targetSdkVersion 26
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
ndkBuild {
|
ndkBuild {
|
||||||
arguments "APP_PLATFORM=android-14"
|
arguments "APP_PLATFORM=android-16"
|
||||||
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,12 +245,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||||
mSingleton = this;
|
mSingleton = this;
|
||||||
SDL.setContext(this);
|
SDL.setContext(this);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= 11) {
|
|
||||||
mClipboardHandler = new SDLClipboardHandler_API11();
|
mClipboardHandler = new SDLClipboardHandler_API11();
|
||||||
} else {
|
|
||||||
/* Before API 11, no clipboard notification (eg no SDL_CLIPBOARDUPDATE) */
|
|
||||||
mClipboardHandler = new SDLClipboardHandler_Old();
|
|
||||||
}
|
|
||||||
|
|
||||||
mHIDDeviceManager = HIDDeviceManager.acquire(this);
|
mHIDDeviceManager = HIDDeviceManager.acquire(this);
|
||||||
|
|
||||||
|
@ -1035,11 +1030,9 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||||
public static boolean isTextInputEvent(KeyEvent event) {
|
public static boolean isTextInputEvent(KeyEvent event) {
|
||||||
|
|
||||||
// Key pressed with Ctrl should be sent as SDL_KEYDOWN/SDL_KEYUP and not SDL_TEXTINPUT
|
// Key pressed with Ctrl should be sent as SDL_KEYDOWN/SDL_KEYUP and not SDL_TEXTINPUT
|
||||||
if (Build.VERSION.SDK_INT >= 11) {
|
|
||||||
if (event.isCtrlPressed()) {
|
if (event.isCtrlPressed()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return event.isPrintingKey() || event.getKeyCode() == KeyEvent.KEYCODE_SPACE;
|
return event.isPrintingKey() || event.getKeyCode() == KeyEvent.KEYCODE_SPACE;
|
||||||
}
|
}
|
||||||
|
@ -1557,9 +1550,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
|
||||||
mDisplay = ((WindowManager)context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
|
mDisplay = ((WindowManager)context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
|
||||||
mSensorManager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE);
|
mSensorManager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= 12) {
|
|
||||||
setOnGenericMotionListener(SDLActivity.getMotionListener());
|
setOnGenericMotionListener(SDLActivity.getMotionListener());
|
||||||
}
|
|
||||||
|
|
||||||
// Some arbitrary defaults to avoid a potential division by zero
|
// Some arbitrary defaults to avoid a potential division by zero
|
||||||
mWidth = 1.0f;
|
mWidth = 1.0f;
|
||||||
|
@ -1776,18 +1767,13 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
|
||||||
int i = -1;
|
int i = -1;
|
||||||
float x,y,p;
|
float x,y,p;
|
||||||
|
|
||||||
// !!! FIXME: dump this SDK check after 2.0.4 ships and require API14.
|
|
||||||
// 12290 = Samsung DeX mode desktop mouse
|
// 12290 = Samsung DeX mode desktop mouse
|
||||||
if ((event.getSource() == InputDevice.SOURCE_MOUSE || event.getSource() == 12290) && SDLActivity.mSeparateMouseAndTouch) {
|
if ((event.getSource() == InputDevice.SOURCE_MOUSE || event.getSource() == 12290) && SDLActivity.mSeparateMouseAndTouch) {
|
||||||
if (Build.VERSION.SDK_INT < 14) {
|
|
||||||
mouseButton = 1; // all mouse buttons are the left button
|
|
||||||
} else {
|
|
||||||
try {
|
try {
|
||||||
mouseButton = (Integer) event.getClass().getMethod("getButtonState").invoke(event);
|
mouseButton = (Integer) event.getClass().getMethod("getButtonState").invoke(event);
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
mouseButton = 1; // oh well.
|
mouseButton = 1; // oh well.
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// We need to check if we're in relative mouse mode and get the axis offset rather than the x/y values
|
// We need to check if we're in relative mouse mode and get the axis offset rather than the x/y values
|
||||||
// if we are. We'll leverage our existing mouse motion listener
|
// if we are. We'll leverage our existing mouse motion listener
|
||||||
|
@ -2164,33 +2150,3 @@ class SDLClipboardHandler_API11 implements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class SDLClipboardHandler_Old implements
|
|
||||||
SDLClipboardHandler {
|
|
||||||
|
|
||||||
protected android.text.ClipboardManager mClipMgrOld;
|
|
||||||
|
|
||||||
SDLClipboardHandler_Old() {
|
|
||||||
mClipMgrOld = (android.text.ClipboardManager) SDL.getContext().getSystemService(Context.CLIPBOARD_SERVICE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean clipboardHasText() {
|
|
||||||
return mClipMgrOld.hasText();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String clipboardGetText() {
|
|
||||||
CharSequence text;
|
|
||||||
text = mClipMgrOld.getText();
|
|
||||||
if (text != null) {
|
|
||||||
return text.toString();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void clipboardSetText(String string) {
|
|
||||||
mClipMgrOld.setText(string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -39,12 +39,8 @@ public class SDLControllerManager
|
||||||
if (mJoystickHandler == null) {
|
if (mJoystickHandler == null) {
|
||||||
if (Build.VERSION.SDK_INT >= 19) {
|
if (Build.VERSION.SDK_INT >= 19) {
|
||||||
mJoystickHandler = new SDLJoystickHandler_API19();
|
mJoystickHandler = new SDLJoystickHandler_API19();
|
||||||
} else if (Build.VERSION.SDK_INT >= 16) {
|
|
||||||
mJoystickHandler = new SDLJoystickHandler_API16();
|
|
||||||
} else if (Build.VERSION.SDK_INT >= 12) {
|
|
||||||
mJoystickHandler = new SDLJoystickHandler_API12();
|
|
||||||
} else {
|
} else {
|
||||||
mJoystickHandler = new SDLJoystickHandler();
|
mJoystickHandler = new SDLJoystickHandler_API16();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,8 +478,6 @@ class SDLHapticHandler {
|
||||||
// so the first controller seen by SDL matches what the receiver
|
// so the first controller seen by SDL matches what the receiver
|
||||||
// considers to be the first controller
|
// considers to be the first controller
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= 16)
|
|
||||||
{
|
|
||||||
for (int i = deviceIds.length - 1; i > -1; i--) {
|
for (int i = deviceIds.length - 1; i > -1; i--) {
|
||||||
SDLHaptic haptic = getHaptic(deviceIds[i]);
|
SDLHaptic haptic = getHaptic(deviceIds[i]);
|
||||||
if (haptic == null) {
|
if (haptic == null) {
|
||||||
|
@ -499,16 +493,11 @@ class SDLHapticHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Check VIBRATOR_SERVICE */
|
/* Check VIBRATOR_SERVICE */
|
||||||
Vibrator vib = (Vibrator) SDL.getContext().getSystemService(Context.VIBRATOR_SERVICE);
|
Vibrator vib = (Vibrator) SDL.getContext().getSystemService(Context.VIBRATOR_SERVICE);
|
||||||
if (vib != null) {
|
if (vib != null) {
|
||||||
if (Build.VERSION.SDK_INT >= 11) {
|
|
||||||
hasVibratorService = vib.hasVibrator();
|
hasVibratorService = vib.hasVibrator();
|
||||||
} else {
|
|
||||||
hasVibratorService = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasVibratorService) {
|
if (hasVibratorService) {
|
||||||
SDLHaptic haptic = getHaptic(deviceId_VIBRATOR_SERVICE);
|
SDLHaptic haptic = getHaptic(deviceId_VIBRATOR_SERVICE);
|
||||||
|
|
Loading…
Reference in New Issue