Commit Graph

175 Commits

Author SHA1 Message Date
Philipp Wiesemann
0a18d8218d Android: Fixed ignoring a return value while handling motion events.
This should not have caused problems yet because the return value was identical.
2016-01-26 22:20:05 +01:00
Philipp Wiesemann
d880e95d7f Android: Fixed finishing Activity on some devices if right mouse button pressed.
Partially fixes Bugzilla #3227.
2016-01-13 19:31:03 +01:00
Philipp Wiesemann
c518619898 Android: Fixed a comment. 2016-01-12 22:22:24 +01:00
Philipp Wiesemann
70ee80c035 Android: Added missing import statement.
It did not compile without.
2015-10-15 22:26:00 +02:00
Ryan C. Gordon
b3e68cdba0 Fix some Android keyboards that didn't work properly.
This conversation came from Joshua Granick on Twitter, starting here:

https://twitter.com/singmajesty/status/653640543675641857

"We found an issue where certain Android keyboards (like the S6 with
predictive text) wouldn't work ... Certain keyboards use a predictive text
mode that does not dispatch a traditional onKey events, which is troublesome
... but telling the OS to use a "visible password" keyboard helps deal with
this problem ... perhaps there's some other way (onKeyPreIme?) to do
"textediting" events, but for now, this should be a fast fix ...
I hear it affects the Galaxy Tab A 8.0", Galaxy S6, Asus ZenPhone 2, maybe
others"
2015-10-15 12:52:00 -04:00
Philipp Wiesemann
f313feca74 Android: Added a new method in SDLSurface. 2015-10-07 21:16:40 +02:00
Philipp Wiesemann
cb9dbdc0b6 Android: Removed three internal functions not used by SDL.
They were not needed internally since the switch to the common EGL backend.

Thanks to the SDL mailing list for pointing out that the functions seem unused.
2015-09-27 20:12:47 +02:00
Philipp Wiesemann
f4eb7eac1c Android: Improved last error message for failed APK expansion file use. 2015-09-18 21:26:28 +02:00
Philipp Wiesemann
ddba08b7b2 Android: Added additional error messages for APK expansion file use. 2015-09-17 22:36:11 +02:00
Philipp Wiesemann
bdaf9012cb Android: Fixed trying to read from APK expansion files without version hint set.
This also fixed overwriting the asset error message which is more useful if no
APK expansion files are available and the requested file was not found.
2015-09-17 22:30:24 +02:00
Philipp Wiesemann
0caa59e76b Android: Renamed SDLActivity's Java method used for APK expansion files.
The name was not correct.
2015-09-17 22:24:54 +02:00
Philipp Wiesemann
5e66b35e84 Android: Removed empty onDraw() override method from SDLActivity.
It was redundant because SDLActivity already inherits an empty method from the
base class SurfaceView (which does not implement it but inherits it from View).
Visibility of onDraw() in SDLActivity is now protected again instead of public.
2015-09-17 22:14:37 +02:00
Philipp Wiesemann
2e96b9d137 Android: Fixed unused variable warning. 2015-09-05 20:21:35 +02:00
Philipp Wiesemann
bb625edb1b Android: Fixed missing break warning. 2015-09-05 20:21:06 +02:00
Sam Lantinga
19f7bccc32 Fixed bug 2949 - [Android] Virtual DPAD remote not registered
Sylvain

I have an android device to which I try to connect the google virtual remote application.
https://play.google.com/store/apps/details?id=com.google.android.tv.remote

The java method "pollInputDevices()" detects it as an input source 0x701 which is (SOURCE_KEYBOARD | SOURCE_GAMEPAD | SOURCE_DPAD).

It it not added because it does not AND-bitwise with "SOURCE_CLASS_JOYSTICK".
It's only a virtual DPAD and it works when checking also with SOURCE_CLASS_BUTTON
2015-06-16 23:58:09 -07:00
Sam Lantinga
c3f6296f6f Fixed bug 2774 - Android: screen distorted in Landscape after background/foreground
Sylvain

With a Landscape application.
Going to background with Home Key, then foreground.
The screen is distorted.

This has been reported by Samsung. It happens on S5 and Samsung Alpha, see the video attached.

I have captured the following logcat:

V/SDL     (20549): onResume()
V/SDL     (20549): surfaceCreated()
V/SDL     (20549): surfaceChanged()
V/SDL     (20549): pixel format RGB_565
V/SDL     (20549): Window size:1920x1080
I/SDL     (20549): SDL_Android_Init()
I/SDL     (20549): SDL_Android_Init() finished!
V/SDL     (20549): SDL audio: opening device
V/SDL     (20549): SDL audio: wanted stereo 16-bit 22.05kHz, 256 frames buffer
V/SDL     (20549): SDL audio: got stereo 16-bit 22.05kHz, 1764 frames buffer
V/SDL     (20549): onWindowFocusChanged(): true
V/SDL     (20549): onWindowFocusChanged(): false
V/SDL     (20549): onPause()
V/SDL     (20549): nativePause()
V/SDL     (20549): surfaceDestroyed()

Background / Foreground

V/SDL     (20549): onResume()
V/SDL     (20549): surfaceCreated()
V/SDL     (20549): surfaceChanged()
V/SDL     (20549): pixel format RGB_565
V/SDL     (20549): Window size:1080x1920
V/SDL     (20549): surfaceChanged()
V/SDL     (20549): pixel format RGB_565
V/SDL     (20549): Window size:1920x1080
V/SDL     (20549): onWindowFocusChanged(): true
V/SDL     (20549): nativeResume()



This seems to be related to the fact that I have in "AndroidManifest.xml":
android:configChanges="..."
Because of the fields: "orientation" and also "screenSize".


I have looked for another way to solve the issue. Discarding the "surfaceChanged" call, based on the "requestedOrientation" and the new Orientation. It seems to be better.


On my failing test case, the first "surfaceChanged()" is discarded. Sometimes the "focusChanged()" might appear between the two "surfaceChanged()", while the surface is not yet ready. Thus, discarding also the "nativeResume()".

So, for robustness, a call to "nativeResume()" is added at the end of "surfaceChanged()".

Some update:

1/ First I tried, to discard the surface using the current orientation (rather than width / heigh). -> that solve the issue sometimes, but not always.

2/ Samsung Certification now accepts my application that were previously failing.

3/ I personally now owns a Samsung S5, and was able to solve the issue on my side.

4/ I now use the patch and get no complaints from my users. (but I admit, nobody seemed to be complaining before neither...).

5/ I have added a v2 because of a new smart-phone called "Black Berry Passport" that has a square screen of 1440x1440. This screen has a "status bar" so the resolution is in fact : 1440x1308. (as reported by "surfaceChanged").

Problem is: the portrait resolution is in fact a Landscape!

So the "v1" patch is always discarding the "surface" of BlackBerry Passport. Which is terribly bad.


Hence, I added the "v2" patch not to discard the surface when aspect ratio is < 1.20. (BB 1440/1308 is : 1.1009). Which seems fair.
2015-06-16 22:16:35 -07:00
Philipp Wiesemann
2ff0535704 Android: Added deactivated intent filter for testing drop file support. 2015-06-05 19:40:50 +02:00
Philipp Wiesemann
1e002e220b Android: Added missing space in three log messages.
Also fixed a typo and changed tag string to constant.
2015-05-31 19:23:16 +02:00
Ryan C. Gordon
dcd8ca19be Android: Added basic drop file support (thanks, "noxalus"!).
This lets SDL-based apps respond to "Open With" commands properly, as they
can now obtain the requested path via a standard SDL dropfile event.

This is only checked on startup, so apps don't get drop events at any other
time, even if Android supports that, but this is still a definite
improvement.

Fixes Bugzilla #2762.
2015-05-26 20:36:45 -04:00
Philipp Wiesemann
3e0d9b02d6 Android: Fixed touch pressure being out of range.
According to the documentation of Android's MotionEvent, the getPressure() may
return values higher than 1 on some devices. To prevent passing such values into
SDL they are now corrected to 1 in Java before the JNI call (where it is assumed
to be correct).

Currently SDL only sends SDL_FINGERMOTION events if the touch state (position or
pressure) changed. By correcting pressure down to 1 some events may get dropped
in the rare case that only the pressure was changed but was out of range and the
position did not change.
2015-05-22 22:34:08 +02:00
Philipp Wiesemann
c239a3abee Android: Replaced logging tag strings with constant. 2015-05-16 21:15:59 +02:00
Reto Schneider
a81dd20654 Remove trailing spaces in Android source code. 2015-04-08 12:14:36 +02:00
Philipp Wiesemann
6d57df4eb0 Android: Fixed lint warning about order of elements in AndroidManifest.xml. 2015-04-13 20:52:38 +02:00
Philipp Wiesemann
98aaddbdde Android: Fixed calling a getter method twice. 2015-04-08 22:24:33 +02:00
Ryan C. Gordon
b0ad5c3e78 Log Android hardware at startup (thanks, rettichschnidi!).
Fixes Bugzilla #2653.
2015-04-08 01:37:17 -04:00
Joseba García Etxebarria
a00125c9be Cast the result of calling getButtonState to an Integer 2015-04-02 00:55:45 +02:00
Ryan C. Gordon
244550f0d7 Android: more separate-mouse-and-touch work.
This avoids a hint lookup for each mouse event we get by setting a static Java
variable from native code during our hint watcher callback.

Also attempts to do the right thing with mouse buttons if you happen to be
on an API14 (Ice Cream Sandwich, Android 4.0) or later device. We still
target API12 (Honeycomb MR1, Android 3.1) for SDL 2.0.4 though.

This isn't tested, so I'm pushing to see what the Android buildbot says. Stand
back, I'm a professional!
2015-04-01 12:14:56 -04:00
Joseba García Etxebarria
fe4155e517 Renamed SDLGenericMotionListener back to SDLGenericMotionListener_API12 2015-03-27 18:09:51 -04:00
Philipp Wiesemann
728db68685 Android: Removed outdated comment from source. 2015-03-25 22:47:22 +01:00
Joseba García Etxebarria
648ac3e582 * More Android patch work 2015-03-24 21:02:28 +01:00
Joseba García Etxebarria
b1c3794e4b * Improve mouse support in Android. These changes require Android API v12 to compile 2015-03-24 20:45:29 +01:00
Philipp Wiesemann
65ef074256 Fixed wrong comment in implementation for Android. 2015-01-31 10:32:45 +01:00
Philipp Wiesemann
0770f17f4f Fixed bug 2816 - [patch] Android: Expose screen refresh rate
Jonas Kulla

Display::getRefreshRate() is available on all API levels.
2015-01-23 20:29:08 +01:00
Philipp Wiesemann
7758e7c831 Added name for second Java Thread on Android. 2014-11-23 20:35:51 +01:00
Philipp Wiesemann
e97261d145 Fixed bug 2759 - Android findLibrary() returns NULL
Sylvain

extra patch with minor modifications:
- typo
- cancel-able set to false
- add the error message, so that the user can report it.
2014-10-24 11:53:34 +02:00
Philipp Wiesemann
d37316fe5d Added an option to define libraries to be loaded on Android in a derived class.
This way it is no more needed to modify SDLActivity.java to add own libraries.
2014-10-23 16:45:18 +02:00
Philipp Wiesemann
5a0a4d6f56 Fixed alert dialog for not loaded libraries on Android being cancelable.
If the alert dialog could be canceled the Activity would not be finished here.
Also setting the property to "true" would be redundant because that is default.
2014-10-23 16:41:01 +02:00
Philipp Wiesemann
fc4c480457 Fixed missing @Override annotation warning in source for Android. 2014-10-23 16:39:15 +02:00
Philipp Wiesemann
39d104f5f6 Fixed upper case button in alert dialog for not loaded libraries on Android.
This is more consistent with the buttons of other dialogs on Android.
2014-10-23 16:38:03 +02:00
Philipp Wiesemann
45abe97d21 Fixed typo in message of alert dialog for not loaded libraries on Android. 2014-10-23 16:34:48 +02:00
Philipp Wiesemann
402661665d Fixed writing new errors to standard output instead of error output on Android. 2014-10-23 16:33:27 +02:00
Philipp Wiesemann
28e6e9079b Fixed documentation in source for Android. 2014-10-23 16:31:02 +02:00
Gabriel Jacobo
ec40387505 [Android] #2759: Show a message on failure to load a .so library (by Sylvain) 2014-10-21 11:44:35 -03:00
Philipp Wiesemann
ab7bcfc0a3 Fixed setting of screen saver state crashing on some version of Android.
Setting Window flags seems to affect Views and must be handled on UI thread.
2014-10-20 22:19:09 +02:00
Gabriel Jacobo
32120029aa Bug 2739 - [Android] No support for SDL_DisableScreenSaver by Martin Gerhardy 2014-10-20 10:10:39 -03:00
Philipp Wiesemann
fa7abca4ec Fixed bug 2476 - Allow custom main() arguments
rettichschnidi

I would like to pass custom arguments from my Java code (subclass of SDLActivity) to the native SDL2 binary.
2014-10-17 23:36:45 +02:00
Philipp Wiesemann
a992769e0a Fixed broken layout for buttons with configured color in messagebox on Android. 2014-09-25 20:56:27 +02:00
Philipp Wiesemann
87dede4f00 Added setting configured color to button texts for messagebox on Android. 2014-09-24 23:46:46 +02:00
Gabriel Jacobo
c8bc78fd0f [Android] Fixes #2679 - Crash resuming from screen off
Before destroying the static Java-side data, wait for the SDL native thread,
*and* the listener thread that waits on it to trigger a clean up.
2014-09-17 08:59:43 -03:00
Philipp Wiesemann
e13a86c874 Fixed key down closing messagebox dialog instead of key up on Android.
This fixed sending key up event to SDL a dialog closed by down did not consume.
2014-09-14 19:44:53 +02:00