Commit Graph

243 Commits

Author SHA1 Message Date
Sam Lantinga
84b38f9ecf Reimplemented Android cursor API support using reflection so it builds with older SDKs 2018-03-16 11:08:53 -07:00
Sam Lantinga
e99c0c8b98 Added Android custom cursor implementation
This is commented out in SDLActivity.java, with the note #CURSORIMPLEENTATION because it requires API 24, which is higher than the minimum required SDK
2018-03-15 18:22:48 -07:00
Sam Lantinga
542e3d764e Try to dynamically create a default Android game controller mapping based on the buttons and axes on the controller.
Include the controller USB VID/PID in the GUID where possible, as we do on other platforms.
2018-03-06 14:51:50 -08:00
Sam Lantinga
47c07044ad Temporarily disabled fullscreen switching code on Android, until we can resolve bug 4096 - Enabling fullscreen on Android causes the app to toggle fullscreen mode continuously in a loop 2018-03-01 08:22:56 -08:00
Sam Lantinga
6fcd640364 On Android show the system UI when an SDL window is windowed, hide the system UI when it's fullscreen, like we do on iOS.
We're increasing the Android SDK minimum version to API 19, this doesn't increase the minimum target API, which is API 14.
2018-02-11 18:23:37 -08:00
Sam Lantinga
f1e0f8998a Fixed bug 4021 - Android, hard-coded Keycode value
Sylvain

There is an hard-coded keycode value in SDLActivity.java
2018-02-07 15:10:50 -08:00
Cole Campbell
29b9c44a4b Allow Android Java shim to be built as an AAR 2018-01-09 19:11:34 -05:00
Sam Lantinga
2c08c2b899 Added SDL_IsAndroidTV() 2018-02-06 15:03:35 -08:00
Sam Lantinga
819ee1e1cc Removed armeabi from the SDL build API list, since it's not supported by the latest Android SDK 2018-01-27 12:07:05 -08:00
Sam Lantinga
e7ea3f1100 Fixed bug 4001 - Android, prevent error message box to crash
Sylvain

Prevent the error message box to crash after being clicked.
Because of "SDLActivity.mSingleton.finish();"
2017-12-19 11:19:10 -08:00
Sam Lantinga
ef7a48c03e Fixed bug 4004 - iOS: don't hide keyboard on RETURN
Dominik Reichardt

As discussed in 2012 the iOS onscreen keyboard hides when you hit RETURN (see https://discourse.libsdl.org/t/on-screen-keyboard-change/19216).
IMO this is a bad idea to not be able to influence this behavior and just recently this was fixed for Android by adding the hint SDL_HINT_ANDROID_RETURN_HIDES_IME in changeset 11768	0f2fb9ec6ad6.
2017-12-19 10:57:21 -08:00
Sam Lantinga
46de6618ab Add the ability to set SDL to handle Return as 'hide IME' on Android softkeyboard. (thanks Rachel!) 2017-12-12 12:52:23 -08:00
Sam Lantinga
605298f114 Fixed Android build error on older SDK 2017-11-12 10:59:05 -08:00
Sam Lantinga
8fc8354b07 Fixed bug 3917 - Android, issues with getManifestEnvironmentVariable
Sylvain

What about getting some return code instead of creating another native function.
2017-11-04 22:03:28 -07:00
Sam Lantinga
46bbc5d328 Fixed bug 3917 - Android, issues with getManifestEnvironmentVariable
We're going to push the manifest environment variables from the Java side instead of continually querying for them from the native side.
2017-11-04 09:37:29 -07:00
Sam Lantinga
65195e610d Make SDL fullscreen windows on Android actually fullscreen 2017-11-02 10:41:55 -07:00
Sam Lantinga
084cfc4173 Fixed bug 3933 - Android, no need of the listener thread
Sylvain

A listener thread has been added to know when the native thread would end.
But now, it is more easy to only check that after the main function has returned. It's one thread less.
2017-11-02 08:46:14 -07:00
Sam Lantinga
b4e2edf099 Allow the activity to persist through connecting or disconnecting a keyboard 2017-11-01 18:41:11 -07:00
Sam Lantinga
efa038fbaf Moved the meta-data into the right section 2017-11-01 18:40:11 -07:00
Sam Lantinga
98af57285f Added controller mapping for Android TV remotes
Also fixed the back button on the remote exiting the application
2017-11-01 10:06:58 -07:00
Sam Lantinga
8c4dc3c464 Add SDL_GetDisplayDPI implementation on Android. (thanks Rachel!) 2017-10-31 13:49:59 -07:00
Sam Lantinga
082143db78 Fixed Java string comparison with "" 2017-10-29 21:09:09 -07:00
Sam Lantinga
d985978f55 android: Fix softkeyboard issue in SDL on Android. 2017-10-26 10:41:38 -07:00
Sam Lantinga
467aa0904e Added the ability to set SDL hints from AndroidManifest.xml (thanks Rachel!)
This is especially useful for things like the accelerometer hint which could be needed before application main().
2017-10-24 00:17:07 -07:00
Sam Lantinga
7658113c79 Fixed crash if mSurface isn't set up when we pause the application 2017-10-24 00:04:40 -07:00
Sam Lantinga
ef9f4473dc Removed unneeded file automatically generated by Android Studio 2017-10-23 23:35:04 -07:00
Sam Lantinga
95e883fbda Updated the minimum and target SDK versions in AndroidManifest.xml 2017-10-23 23:26:40 -07:00
Sam Lantinga
be3cbc7751 Updated Android build tools version, which bumped minimum deployment target to API 14
Also added native code to the Android gradle project, which allows using gradle or Android Studio to build the entire SDL application without a separate ndk-build step.
2017-10-23 23:23:47 -07:00
Sam Lantinga
108a029672 Fixed build with older Android SDK 2017-10-23 23:23:34 -07:00
Sam Lantinga
b0c78879e9 Switched to new style gradle Android application build process 2017-10-23 15:23:43 -07:00
Sam Lantinga
dfec20b5f5 Reverted changes a970b2ae1bd7 and 4a94743e31fe
I don't want to introduce any regressions with Android TV remote support
2017-10-20 10:29:22 -07:00
Sam Lantinga
04affe2c5e Fixed Android joystick detection 2017-10-19 15:37:52 -07:00
Sam Lantinga
01f3a63f9c Don't use DPAD devices as joystick input on Android 2017-10-19 13:54:56 -07:00
Sam Lantinga
b050f9e559 Android Studio code analyzer fixes 2017-10-13 19:55:07 -07:00
Sam Lantinga
2cb9922b26 Fixed bug 3843 - Android missing some code in SDLHapticHandler
Sylvain

Some check for android SDK version are missing from https://hg.libsdl.org/SDL/rev/04dd43a2c83a
here's a patch
2017-09-23 12:37:09 -07:00
Sam Lantinga
27a3eaf558 Separated out SDL Android java code so audio, controller, and filesystem APIs can be used independently of the SDL activity, in Qt apps for example. 2017-09-22 08:31:56 -07:00
Sam Lantinga
2cefd7c3ab Separated out SDL Android java code so audio, controller, and filesystem APIs can be used independently of the SDL activity, in Qt apps for example. 2017-09-22 08:30:46 -07:00
Sam Lantinga
63768bd4df Update Android SDK required to API level 16
Sylvain

Some API 16 methods are used (InputDevice: getDescriptor(), getVibrator()), so we need to compile at least with SDK API 16. Hence default.properties and project.properties have been modified to use android-16.

There are also some modification to SDLActivity.java not to use getVibrator() if we run under API 16. And not to check to presence of hasVibrator() if we are under API 11.
-some hard-coded constant can be expandend.
- rename a local variable (hasVibrator to hasVibratorService)
2017-08-31 15:12:08 -07:00
Sam Lantinga
4292e5e41e Fixed bug 3789 - Android : small clean up
Sylvain

Since https://hg.libsdl.org/SDL/rev/a8c29f5b679f
SDL_android_main.c is empty and then produce a warning
nativeInit does not exist and dont need to be mark undefined
2017-08-30 14:25:01 -07:00
Sam Lantinga
b59772873f Add a way to set the context when other activities are active so many SDL API functions still work. 2017-08-28 23:04:47 -07:00
Sam Lantinga
37da5482a6 Allow overriding the main entry point on Android 2017-08-28 14:40:21 -07:00
Sam Lantinga
c5ce1120af Removed the need for libSDL2main.a on Android, and separated JNI initialization out for other integrations 2017-08-28 14:34:15 -07:00
Sam Lantinga
c509aaffad Fixed bug 2361 - [Android] Joysticks do not have unique IDs
David Brady

When I attempted to make a mapping file for Android gamepads, I quickly discovered that most of the ones that I have here show up as the same device (Broadcom Bluetooth HID), meaning that it was impossible to make mappings on Android, since every device looked the same.

This patch will check for the existence of the getDescriptor function added in Jelly Bean, and use it if it's there.  The Android Dashboard says that the majority of Android phones should support this function, and doing it this way will not force us to bump up our API version.
2017-08-28 10:03:39 -07:00
Sam Lantinga
3c6c5caeb6 Fixed bug 2277 - Hardware keyboard control key sequences don't get reported
chw

Control key sequences from hardware keyboards (wireless/USB/bluetooth) get not properly reported on Android devices.
The attached patch uses the idea from http://stackoverflow.com/questions/12337117/capture-all-ctrl-under-android to make control key sequences appear as normal SDL_KEYDOWN events instead of cooked text input.
2017-08-28 09:54:16 -07:00
Sam Lantinga
8fb2683fa6 Fixed bug 2266 - please add notifications for clipboard updates on Android
Sylvain

Hi! here's a patch for that with two class loaded regarding API level.
Test both case : before API 11 and after.

I also remove now unused GetSystemServiceFromUIThread() and minor clean-up (haptic warning prototype).
2017-08-27 18:43:52 -07:00
Sam Lantinga
60ba8a83cc Fixed bug 2265 - Voice to text feature on Android repeats some text via SDL_TEXTINPUT
Sylvain

Small patch for this issue. I tested it and it seems to work.

- it can send several backspaces (instead of only 1).
- it calls directly "sendKeyEvent()" instead of "super.sendKeyEvent()".
  otherwise, it would go through the android internals, calling again "onKey()".
  and then the "backspace" would arrive after the next "commitText()".
2017-08-27 18:36:54 -07:00
Sam Lantinga
06a9ec9872 Fixed bug 3191 - haptic system on android?
Sylvain

- add vibrator service in the list of haptic devices. I use an hard-coded device_id for it ...
2017-08-14 06:18:08 -07:00
Sam Lantinga
eb57ec3a85 Provide the correct state of the on-screen keyboard to the API (patch from Sylvain) 2017-08-13 21:05:15 -07:00
Sam Lantinga
de2277d193 Fixed bug 3235 - Make the Android window creation similar to iOS' window creation
Sylvain

Here's a patch.
It tries to get the hint first. Resizable will allow any orientation. Otherwise it uses width/height window.

setOrientation method is splitted in static and non-static, so that it can be overloaded in a user subclass.

Some artefact observed :
surfaceChanged() can be called twice at the beginning. When the phone starts in portrait and run a landscape application.
2017-08-13 20:55:59 -07:00
Sam Lantinga
bc7363f38d Fixed bug 3191 - haptic system on android?
Patch provided by jintiao and Milan Nikolic, thanks!
2017-08-12 08:15:09 -07:00