Android: remove old code after Android-16 has been set as minimum requirement
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
diff --git a/android-project/app/build.gradle b/android-project/app/build.gradle
index 3900943..7e238a5 100644
--- a/android-project/app/build.gradle
+++ b/android-project/app/build.gradle
@@ -13,13 +13,13 @@ android {
if (buildAsApplication) {
applicationId "org.libsdl.app"
}
- minSdkVersion 14
+ minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
externalNativeBuild {
ndkBuild {
- arguments "APP_PLATFORM=android-14"
+ arguments "APP_PLATFORM=android-16"
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
}
}
diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
index 7e4f363..4ac9fb1 100644
--- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
+++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
@@ -245,12 +245,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
mSingleton = this;
SDL.setContext(this);
- if (Build.VERSION.SDK_INT >= 11) {
- mClipboardHandler = new SDLClipboardHandler_API11();
- } else {
- /* Before API 11, no clipboard notification (eg no SDL_CLIPBOARDUPDATE) */
- mClipboardHandler = new SDLClipboardHandler_Old();
- }
+ mClipboardHandler = new SDLClipboardHandler_API11();
mHIDDeviceManager = HIDDeviceManager.acquire(this);
@@ -1035,10 +1030,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
public static boolean isTextInputEvent(KeyEvent event) {
// 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()) {
- return false;
- }
+ if (event.isCtrlPressed()) {
+ return false;
}
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();
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
mWidth = 1.0f;
@@ -1776,17 +1767,12 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
int i = -1;
float x,y,p;
- // !!! FIXME: dump this SDK check after 2.0.4 ships and require API14.
// 12290 = Samsung DeX mode desktop mouse
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 {
- mouseButton = (Integer) event.getClass().getMethod("getButtonState").invoke(event);
- } catch(Exception e) {
- mouseButton = 1; // oh well.
- }
+ try {
+ mouseButton = (Integer) event.getClass().getMethod("getButtonState").invoke(event);
+ } catch(Exception e) {
+ 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
@@ -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);
- }
-}
-
diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java b/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java
index 6c5623d..b5276b9 100644
--- a/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java
+++ b/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java
@@ -39,12 +39,8 @@ public class SDLControllerManager
if (mJoystickHandler == null) {
if (Build.VERSION.SDK_INT >= 19) {
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 {
- mJoystickHandler = new SDLJoystickHandler();
+ mJoystickHandler = new SDLJoystickHandler_API16();
}
}
@@ -482,21 +478,18 @@ class SDLHapticHandler {
// so the first controller seen by SDL matches what the receiver
// considers to be the first controller
- if (Build.VERSION.SDK_INT >= 16)
- {
- for (int i = deviceIds.length - 1; i > -1; i--) {
- SDLHaptic haptic = getHaptic(deviceIds[i]);
- if (haptic == null) {
- InputDevice device = InputDevice.getDevice(deviceIds[i]);
- Vibrator vib = device.getVibrator();
- if (vib.hasVibrator()) {
- haptic = new SDLHaptic();
- haptic.device_id = deviceIds[i];
- haptic.name = device.getName();
- haptic.vib = vib;
- mHaptics.add(haptic);
- SDLControllerManager.nativeAddHaptic(haptic.device_id, haptic.name);
- }
+ for (int i = deviceIds.length - 1; i > -1; i--) {
+ SDLHaptic haptic = getHaptic(deviceIds[i]);
+ if (haptic == null) {
+ InputDevice device = InputDevice.getDevice(deviceIds[i]);
+ Vibrator vib = device.getVibrator();
+ if (vib.hasVibrator()) {
+ haptic = new SDLHaptic();
+ haptic.device_id = deviceIds[i];
+ haptic.name = device.getName();
+ haptic.vib = vib;
+ mHaptics.add(haptic);
+ SDLControllerManager.nativeAddHaptic(haptic.device_id, haptic.name);
}
}
}
@@ -504,11 +497,7 @@ class SDLHapticHandler {
/* Check VIBRATOR_SERVICE */
Vibrator vib = (Vibrator) SDL.getContext().getSystemService(Context.VIBRATOR_SERVICE);
if (vib != null) {
- if (Build.VERSION.SDK_INT >= 11) {
- hasVibratorService = vib.hasVibrator();
- } else {
- hasVibratorService = true;
- }
+ hasVibratorService = vib.hasVibrator();
if (hasVibratorService) {
SDLHaptic haptic = getHaptic(deviceId_VIBRATOR_SERVICE);
@@ -843,4 +832,4 @@ class SDLGenericMotionListener_API26 extends SDLGenericMotionListener_API24 {
// Relative mouse in capture mode will only have relative for X/Y
return event.getY(0);
}
-}
\ No newline at end of file
+}