Commit Graph

273 Commits

Author SHA1 Message Date
Philipp Wiesemann
50b5d62934 Added javadoc comment for consistency. 2014-08-11 23:16:47 +02:00
Sam Lantinga
b69ed39252 Merged changes from Alexey Petruchik to support Android obb files
http://developer.android.com/google/play/expansion-files.html
2014-06-21 20:35:36 -07:00
Sam Lantinga
d2163b6749 Fixed bug 2558 - Missing FINGERUP in Android
Sylvain

If you play with the TouchScreen with +3 fingers randomly / pressing simultaneously all fingers.

You triggers FINGER DOWN events, but not always all the associated FINGER UP events.

So, after a while SDL_GetNumFingers() can report a wrong number of fingers pressed !


The explanation is hidden there : http://developer.android.com/reference/android/view/MotionEvent.html

Each pointer has a unique id that is assigned when it first goes down (indicated by ACTION_DOWN or ACTION_POINTER_DOWN).
A pointer id remains valid until the pointer eventually goes up (indicated by ACTION_UP or ACTION_POINTER_UP) or when the gesture is canceled (indicated by ACTION_CANCEL).

in ACTION_CANCEL :

The current gesture has been aborted. You will not receive any more points in it. You should treat this as an up event, but not perform any action that you normally would.
Constant Value: 3 (0x00000003)
2014-06-15 19:32:39 -07:00
Philipp Wiesemann
3674fe380b Changed two Java nested classes into static nested classes.
Both do not need an implicitly created reference to enclosing class.
2014-06-08 13:14:20 +02:00
Philipp Wiesemann
16a52c4987 Added javadoc comments to document methods used by JNI. 2014-05-29 23:05:18 +02:00
Philipp Wiesemann
98abcdc843 Added javadoc comments to prevent unused parameter warning. 2014-05-29 22:58:06 +02:00
Philipp Wiesemann
d9b9067e85 Fixed implicit boxing and unboxing of Java Objects warning. 2014-05-29 22:53:53 +02:00
stopiccot
09ed1dc424 added comment
--HG--
branch : apk
2014-04-30 23:05:05 +03:00
stopiccot
1e528e6976 access google apk library through reflection
--HG--
branch : apk
2014-04-30 22:51:29 +03:00
stopiccot
17b9ef82d9 Fixing issues discovered by Philipp Wiesemann
--HG--
branch : apk
2014-04-23 03:42:32 +03:00
stopiccot
df6159bfef inital apk extension support
--HG--
branch : apk
2014-04-07 21:20:39 +03:00
Philipp Wiesemann
bb9a20954a Fixed unused local variable warning. 2014-04-05 23:24:33 +02:00
Gabriel Jacobo
6438cb2372 Try to work around Android's handling of static variables in terminated apps
Android, we want to love you, but you don't make it easy for us...
2014-02-12 18:12:14 -03:00
dbrady
99745583e9 fixed hat code validation. 2014-01-28 15:28:20 -08:00
Philipp Wiesemann
b155b04c15 Removed unused variable from Java class for Android.
The audio thread was moved to native side and "protected" prevented a warning.
2014-01-26 23:50:35 +01:00
Gabriel Jacobo
61e75f2da8 Bug 2358 - [Android] Sort joystick axes - Fix by David Brady 2014-01-24 09:54:04 -03:00
Philipp Wiesemann
ffb9a7697b Fixed missing @Override annotation warning in source for Android. 2013-12-24 20:04:53 +01:00
Gabriel Jacobo
3bbcbd6cb5 [Android] Hotplugging support for joysticks 2013-12-10 16:24:11 -03:00
Gabriel Jacobo
d5a570b8bf [Android] Handle native thread finishing when not commanded from the Java side 2013-12-05 10:51:38 -03:00
Sam Lantinga
1bc76ccb74 Don't crash when no WM is present.
CR: Sam Lantinga.
2013-11-27 10:29:27 -08:00
Gabriel Jacobo
e0b4d63b5b [Android] Fixes #2228, reworked touch code
Lets Android take care of which is the primary pointer (the one acting as the
mouse in SDL), reorganized the Java side code as well to make it easier to
understand.
2013-11-25 12:28:09 -03:00
Philipp Wiesemann
068ec0d37d Fixed bug 2258 - Crash when using Android clipboard
chw

The Android clipboard manager methods must be called from the UI thread,
otherwise crashes of the dalvikvm happen.
2013-11-23 23:38:16 +01:00
Gabriel Jacobo
c99c529099 [Android] Fixes #2247, enable hardware acceleration by default.
Setting android:hardwareAccelerated="true" seems to fix some random behaviors
in certain devices like the XperiaE.

Ref: http://developer.android.com/guide/topics/graphics/hardware-accel.html
2013-11-22 10:26:28 -03:00
Gabriel Jacobo
fbda2dcacf Adds testgles2
Source code copied from: https://github.com/fantasydr/sdl-2.0-gles (thanks!)

Minor fixes, configure script changes done by me.
2013-11-19 10:56:38 -03:00
Gabriel Jacobo
50454ffe1f [Android] Try to improve handling of DPAD|GAMEPAD + KEYBOARD devices
It seems some devices report themselves as DPAD or GAMEPAD and KEYBOARD as well,
and we need to route different keycodes to different parts of SDL.
2013-11-19 10:00:05 -03:00
Gabriel Jacobo
e16f591102 [Android] Try to improve handling of some dpad+gamepad+keyboard corner cases 2013-11-11 11:12:43 -03:00
Gabriel Jacobo
258f349104 [Android] Fixes Bug 2031 - Backspace Not Sending Events From On-Screen Keyboard
Thanks Joe LeVeque!
2013-11-11 10:59:15 -03:00
Gabriel Jacobo
7ed94cd043 [Android] Improve handling of keyboard, dpad and gamepad events
Thanks Dimitris Zenios for the report!
2013-11-11 10:49:48 -03:00
Gabriel Jacobo
36a24d1c0b [Android] Fixes bug 2217, better joystick axes handling on Android. 2013-11-11 10:15:35 -03:00
Philipp Wiesemann
15c259e7ba Fixed joystick crash on Android if joystick subsystem not initialized. 2013-11-10 17:50:40 +01:00
Philipp Wiesemann
3e318670be Replaced search loop with indexOf() in Java file. 2013-11-10 17:44:51 +01:00
Philipp Wiesemann
05ce5d124c Replaced implicit boxing with explicit boxing in Java file. 2013-11-10 17:42:01 +01:00
Philipp Wiesemann
33f48a6ddb Renamed a class in Java file for consistency. 2013-11-10 17:40:26 +01:00
Philipp Wiesemann
7b12da4100 Removed not needed imports from Java file. 2013-11-10 17:38:03 +01:00
Philipp Wiesemann
8c3a433919 Added missing @Override annotations in Java file. 2013-11-10 17:35:07 +01:00
Philipp Wiesemann
b2c9b7a871 Changed motion listener implementation not to inherit from Activity class. 2013-11-10 15:04:58 +01:00
Philipp Wiesemann
7888ae8351 Moved two function calls so they are only called if needed.
If the MotionEvent is not from joystick the return values are not needed.
2013-11-10 14:58:48 +01:00
Gabriel Jacobo
becbba3801 [Android] Fixes Bug 2041 - can't get SDL_QUIT event...
Thanks to Denis Bernard!

Also, changed the Android manifest so the app doesn't quit with orientation
changes, and made testgles.c exit properly on Android.
2013-11-06 11:23:24 -03:00
Gabriel Jacobo
515ee991e4 Adds Joystick support for Android
This bumps the build SDK level to 12 (up from 10). Runtime requirements remain
the same (at API level < 12 joystick support is disabled).

Also enables building SDL for armv7 and x86.
2013-11-05 20:07:39 -03:00
Sam Lantinga
ba407b9ae8 Fixed bug 2156 - Android: Accelerometer values fed to joystick driver are inverted for the X axis and wrong for Z
Denis Bernard

Background information: http://developer.android.com/reference/android/hardware/SensorEvent.html#values

Steps to reproduce: compile testjoystick.c as an android app (change screen size according to your device). While running the app, also run:

adb logcat -c; adb logcat -s 'SDL:*' 'SDL/APP:*'

When tilting the device left/right, the joystick moves in the opposite direction of what one would expect. Or at least, the behaviour is not consistent with the Y axis.

Also when the device sits on a table (obviously not moving), the Z axis value oscillates between -32000 and +32000 (by overflow):

I/SDL/APP ( 1994): Joystick 0 axis 2 value: 32511
I/SDL/APP ( 1994): Joystick 0 axis 2 value: 32575
I/SDL/APP ( 1994): Joystick 0 axis 2 value: 32383
I/SDL/APP ( 1994): Joystick 0 axis 2 value: -32386
I/SDL/APP ( 1994): Joystick 0 axis 2 value: -32450
I/SDL/APP ( 1994): Joystick 0 axis 2 value: -32578

This is caused by the accelerometer yielding a constant value around 9.81 for Z and feeding something like 0.9 to 1.1 to the joystick driver, resulting in the overflow.

Proposed fix in SDLActivity.java (swap X and subtract G from Z reading)
2013-10-20 23:52:02 -07:00
Sam Lantinga
0fe40360a5 Fixed bug 2155 - automatically remap accelerometer coordinates according to screen orientation on Android
Denis Bernard

Background information: http://android-developers.blogspot.fr/2010/09/one-screen-turn-deserves-another.html and http://developer.android.com/reference/android/hardware/SensorEvent.html

Right now, the Android accelerometer event handler feeds raw accelerometer data  to the SDL Joystick driver. The result is that for landscape-only applications, the axis need to be swapped if running on a portrait device (like a phone), and vice-versa: running a portrait only app on a landscape device like a tablet.

The purpose of this patch is to perform coordinate remapping of the accelerometer data before feeding it to the SDL joystick driver so that the X axis of the joystick is always aligned with the X axis of the display, same for the Y axis.

This has been tested on applications that support screen orientation changes as well as applications with fixed screen orientations, both on phones and tablets.
2013-10-17 23:44:30 -07:00
Sam Lantinga
fc1340575e Fixed bug 2146 - Enable static linking of libSDL on Android
Denis Bernard

This patch to Android.mk adds support for static linking of libSDL for Android applications. A patched readme with static build instructions is also provided.

It does not break existing build environments setup according to the README-android.txt since the static library version will not be built in not required.

The static build uses the Android NDK module system (see docs/IMPORT-MODULE.html in the NDK folder and step 5 in the instructions below).

Instructions:
1. Copy the android-project directory wherever you want to keep your projects
   and rename it to the name of your project.
2. Create a symlink to SDL/src/main/android/SDL_android_main.c as
   <project>/jni/src/SDL_android_main.c
3. Rename <project>/jni/src/Android_static.mk to <project>/jni/src/Android.mk
   (overwrite the existing one)
4. Edit <project>/jni/src/Android.mk to include your source files
5. create and export an environment variable named NDK_MODULE_PATH that points
   to the parent directory of this SDL directory. e.g.:

   export NDK_MODULE_PATH="$PWD"/..

6. Edit <project>/src/org/libsdl/app/SDLActivity.java and remove the call to
   System.loadLibrary("SDL2") line 42.
7. Run 'ndk-build' (a script provided by the NDK). This compiles the C source

Although this requires an environment variable to be setup, it can be added once and for all to the main Android.mk of the project.
2013-10-10 21:51:39 -07:00
Philipp Wiesemann
f50e84c7c2 Added detection of touch devices before first touch events happen on Android.
On Android available touch devices are now added with video initialization (like
the keyboard). This fixes SDL_GetNumTouchDevices() returning 0 before any touch
events happened although there is a touch screen available. The adding of touch
devices after a touch event was received is still active to allow connecting
devices later (if this is possible) and to provide a fallback if the new init
did not work somehow. For the implementation JNI was used and API level 9 is
required. There seems to be nothing in the Android NDK's input header (input.h)
to implement everything on C side without communication with Java side.
2013-10-05 17:08:19 +02:00
Gabriel Jacobo
86025d2275 Fixes #2036 and #2038, bypass camera zoom and shutter keypresses on Android. 2013-08-22 10:22:22 -03:00
Gabriel Jacobo
84f07d804a Fixes bug #2037, common EGL code for Android and X11 2013-08-19 16:29:46 -03:00
Gabriel Jacobo
4c2136d6d2 Fixes #2022, do not resume on Android when surfaceChanged
If the app is in landscape mode and the user presses the power button, a pause
is followed immediately by a surfaceChanged event because the lock screen
is shown in portrait mode. This triggers a "false" resume.
So, we just pause and resume following the onWindowFocusChanged events.

Also, wait for SDL_APP_WILLENTERBACKGROUND and SDL_APP_DIDENTERBACKGROUND before
blocking the event pump.
2013-08-12 11:13:50 -03:00
Gabriel Jacobo
d0ac9f02aa Start Android Audio Thread after audio buffer and AudioTrack are ready.
Also, it starts the Audio Thread from the native side, putting the code in line
with other backends.
2013-08-08 21:25:09 -03:00
Gabriel Jacobo
7da63a0c08 Add some protection against double init of the Android audio backend 2013-08-08 09:47:42 -03:00
Philipp Wiesemann
c14d87dec4 Fixed volume keys not being handled by Android if screen keyboard is visible.
See bug #1569.
2013-08-04 23:28:34 +02:00
Gabriel Jacobo
8d20160ad0 Fixes bug #1889, allows for GL Context deletion/recreation on Android
Thanks ny00!
2013-08-03 12:54:39 -03:00
Gabriel Jacobo
4b9c3c0664 Temporary fix for bug #1639 SDL does not message back closing of screen keyboard
See FIXME notes on patch for details.
2013-08-02 12:38:39 -03:00
Sam Lantinga
c7dfdbb52f Fixed bug 1569 - Android volume keys not honoured inside SDL
Joseba García Echebarria

The current version of SDL HG in Android doesn't do anything when volume keys are pressed.
The change makes SDL ignore volume keys so that they're handled by the OS and the sound volume can be changed within an app.
2013-07-31 21:08:22 -07:00
Gabriel Jacobo
53cf4bf3c6 Set mAudioTrack to null when AudioTrack initialization fails
Prevents potential problems when stopping the app.
2013-07-31 16:25:50 -03:00
Gabriel Jacobo
b5b67aacf8 Fix for bug 2001, verify that the AudioTrack is properly initialized
...and fail to initialize the audio backend if it's not!
2013-07-31 10:04:59 -03:00
Gabriel Jacobo
8ebc49587f Consider the case where an attribute is set to EGL_DONT_CARE in eglChooseConfig
SDL doesn't currently use EGL_DONT_CARE, but it doesn' hurt to future proof.
2013-07-26 12:37:36 -03:00
Gabriel Jacobo
77cacb8357 [Android] Bug 1827, select the best matching config provided by eglChooseConfig 2013-07-26 12:22:40 -03:00
Eric Wing
03cc44af03 Android: Removed all unnecessary dependencies on C++.
C++ is a bit of a minefield on Android. Much functionality still doesn't work, and Android can't decide on which C++ standard library to use, so it provides 3 different ones, all of which are incompatible with each other. (It looks like clang is coming too which will add a new compiler and a 4th standard library.)

As middleware, SDL might be distributed as a binary and intermixed with other projects already using C++. If C++ is intermixed in a bad way, bad things will happen. Removing dependencies on C++ will avoid this problem and downstream users won't have to worry/care.
2013-07-22 02:51:45 -07:00
Gabriel Jacobo
93274d6d53 Adds Input Focus handling on Android to improve pausing/resuming behavior
Ref: http://android-developers.blogspot.com/2011/11/making-android-games-that-play-nice.html
2013-07-09 10:25:16 -03:00
Gabriel Jacobo
fe40941788 Fixes Bug 1896 - Android app is running while the screen is locked
Original patch by ny00@outlook.com
2013-07-06 15:22:49 -03:00
Philipp Wiesemann
1e57fbb3ea Updated names of README files in source comments. 2013-06-09 11:58:31 +02:00
Philipp Wiesemann
ace9a18a3d Fixed Android Lint warning in AndroidManifest.xml.
If targetSdkVersion not set it becomes same as minSdkVersion and causes warning.
2013-06-09 11:51:59 +02:00
Philipp Wiesemann
0122ce66f8 Added deactivated loading of SDL2_net to Java file. 2013-05-30 12:23:36 +02:00
Sam Lantinga
3beb70c4bc Added mobile application events, with implementations for iOS and Android 2013-05-18 12:48:50 -07:00
Philipp Wiesemann
23dad5b9c7 Corrected comment in Java file. 2013-05-18 14:04:37 +02:00
Philipp Wiesemann
1cdf7f6988 Changed import statements in Java file. 2013-05-18 14:03:45 +02:00
Sam Lantinga
f14452ed24 There's no need to keep these private. If you extend SDLActivity, you should know what you're doing. 2013-05-15 23:18:29 -07:00
Philipp Wiesemann
f67a75ebbb Fixed Android Lint warning in AndroidManifest.xml. 2013-05-10 21:19:40 +02:00
Philipp Wiesemann
2cba589334 Removed not needed block from Java file. 2013-05-05 16:01:19 +02:00
Philipp Wiesemann
b6c14af95e Changed signatures of methods in Java file to return boolean, adapted C++ file.
This way more checking for errors is possible which is currently not done here.
2013-05-05 15:54:56 +02:00
Philipp Wiesemann
1773e82524 Changed signature of method recently added in Java file. 2013-05-05 15:50:21 +02:00
Philipp Wiesemann
6bf81bca0b Added a method in Java file which may be overridden for custom messages. 2013-05-05 12:53:57 +02:00
Philipp Wiesemann
daf329ee15 Fixed possible leak and its Android Lint warning in Java file. 2013-05-05 12:50:34 +02:00
Philipp Wiesemann
1f697948fd Removed not needed casts from Java file. 2013-04-27 17:23:20 +02:00
Philipp Wiesemann
b281192487 Removed not needed import statements from Java file. 2013-04-27 17:17:37 +02:00
Philipp Wiesemann
7edda57b2d Removed dead store from Java file because value never used. 2013-04-27 17:15:40 +02:00
Philipp Wiesemann
0ef57149cc Renamed inner class in Java file to avoid confusion with an unrelated class. 2013-04-27 17:10:14 +02:00
Philipp Wiesemann
881b76836e Changed Java source file to use constant from API instead of just a String. 2013-04-27 14:26:15 +02:00
Philipp Wiesemann
420b355303 Added missing @Override annotations in Java source file to reduce warnings. 2013-04-27 14:13:30 +02:00
Philipp Wiesemann
a94cf44b93 Corrected a comment in Java source file. 2013-04-27 13:33:05 +02:00
Gabriel Jacobo
4881297e05 Fix for bug #1776 by Jonathan Dearborn 2013-04-19 14:40:39 -03:00
Sam Lantinga
d7e7bfe9ad Fixed bug 1779 - SDL's Android project template has old default icons from Android.
Philipp Wiesemann

SDL's Android project template has old default icons from Android while iOS project template has custom icons with SDL's logo.

There is a Wizard in the Android Developer Tools to create "Android Icon Sets". As an example I created icons from the iOS loading screen and attached them in a ZIP archive. They are named "ic_launcher.png" instead of "icon.png" because that is the new name used in Android projects. To use them the AndroidManifest.xml needs to be changed to have "@drawable/ic_launcher" instead of "@drawable/icon". I do not know why there was no icon created for ldpi. Maybe it is deprecated.
2013-04-02 07:55:25 -07:00
Gabriel Jacobo
b19f55242a Backed out changeset: 9cef1005df5f 2013-04-01 13:20:22 -03:00
Sam Lantinga
91094c910e Fixed bug 1700 - Joysticks not supported in Android 2013-03-19 23:03:57 -07:00
Gabriel Jacobo
639d80667e Fixes AndroidManifest comment, Android API level 10 = Android 2.3.3 2013-03-04 10:39:21 -03:00
Sam Lantinga
ab93f37976 Fixed bug 1740 - Android pixel format constants out of sync
wjp

In SDL HG (2.0) the pixel format constants in
android-project/src/org/libsdl/app/SDLActivity.java seem to have gone out of
sync with include/SDL_pixels.h in HG rev b1124b32b07d.

E.g., at a glance it seems like 0x85151002 should have become 0x15151002.
2013-03-03 21:52:51 -08:00
Sam Lantinga
a65e5a3850 Removed local.properties from android-project folder
Alexey Petruchik

Please remove local.properties from android-project folder and add it to hgignore
According to the local.properties:
# This file must *NOT* be checked in Version Control Systems,
2013-02-23 02:25:34 -08:00
Sam Lantinga
9da7324da4 Fixed bug 1711 - Comment in "manifest" element within android-project/AndroidManifest.xml is the source of troubles
ny00@outlook.com

Let me quote the following opening tag from
android-project/AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    <!-- Replace org.libsdl.app with the identifier of your game, e.g.
         com.gamemaker.game
     -->
      package="org.libsdl.app"
      android:versionCode="1"
      android:versionName="1.0"
      android:installLocation="auto">

The comment (with the text "Replace org.libsdl.app with...") seems to be a
cause of troubles. Here are a few examples I've spotted:

1) While using nkd-build from android-ndk-r8d, I receive the following error:

Invalid attribute name: <!-- replace org.libsdl.app with the identifier of your
game, e.g.
         com.gamemaker.game
     --
/home/ny00123/util/android-ndk-r8d/build/gmsl/__gmsl:512: *** non-numeric
second argument to `wordlist' function: ''.  Stop.

2) Repeating this but with android-ndk-r6b (an earlier revision), it reduces to
a warning and actual complication is not halted.

3) Following the instructions in README.android and using Eclipse (from a
recently downloaded ADT Bundle), I cannot seem to be able to create an Android
project from existing sources (one of the SDL test apps for now).
* On a side note, I can't find where I may choose the "Build Target" before
clicking "Finish", but it does not seem to be related to this bug report.
Anyway, following the choice of the project path and a click on "Finish",
nothing seems to occur.
If I rather do so after removing the above comment from AndroidManifest.xml,
though, the project appears on Eclipse as expected once I click on "Finish".
2013-02-08 01:12:48 -08:00
Gabriel Jacobo
11e188634e #1702,Android soft keyboard fails to pass all input, by Jonathan Dearborn 2013-01-26 12:31:55 -03:00
Gabriel Jacobo
06cac2693e Fixed SDLActivity::audioInit return type, thanks Andreas! 2013-01-08 08:28:39 -03:00
Gabriel Jacobo
69acbe58d2 Fix Audio Buffer allocation on Android >= 4.2 2013-01-07 12:22:26 -03:00
Sam Lantinga
94ec418971 Fixed bug 1616 - SDL does not use values set with SDL_GL_SetAttribute on Android
Philipp Wiesemann 2012-10-06 07:19:57 PDT

SDL does not use values set with SDL_GL_SetAttribute on Android.

I attached a patch which adds this functionality and makes it possible to set
(for example) depth buffer size or anti-aliasing in the actual application
instead of modifying the Java source (which seems currently the only way).
2012-12-31 14:57:36 -08:00
Sam Lantinga
9e89faaf15 Synchronized the on-screen keyboard state with whether we are accepting text input.
The functions to show/hide/toggle the on-screen keyboard have been folded into the text input state.
Calling SDL_StartTextInput() will automatically show the on-screen keyboard if it's available.
Calling SDL_StopTextInput() will automatically hide the on-screen keyboard if it's available.
There is a new API function SDL_IsTextInputActive() which will return whether text input is currently active.
Text input is disabled by default, you must call SDL_StartTextInput() when you are ready to accept text input.
SDL_HasScreenKeyboardSupport() no longer needs to be passed a window.
The iPhone-specific on-screen keyboard functions have been removed.
2012-11-04 21:53:28 -08:00
Sam Lantinga
48fe3e9f09 Cleaned up OpenGL initialization a bit so we fail if we can't create a surface. 2012-11-04 08:51:43 -08:00
Sam Lantinga
f7f237c125 Simplified the manifest a little - we don't need a Java class in there. :) 2012-11-02 03:03:55 -07:00
Sam Lantinga
94ca45bd69 Updated the Android project template and README.android
Added information on how to customize your application name and icon.
Added information on using STL with an Android application
Increased the minimum API level to 10, because that's the lowest API
that currently has an emulator image for testing.
2012-11-02 02:37:49 -07:00
Sam Lantinga
38732d0a49 Fixed bug 1614 - SDL for Android does not implement TextInput API
Andrey Isakov 2012-10-03 08:30:25 PDT

I've found out in the process of porting one OS project to Android/SDL2 that
there is no support for TextInput events/APIs on Android.
So I implemented some kind of initial support of that feature, and at the very
least it seems to work fine with latin chars input with soft and hardware
keyboards on my Moto Milestone2. I've also tried playing around with more
complex IMEs, like japanese, logging the process and it seemed to work too. I'm
not sure since the app itself I am working on does not have support for
non-latin input.

The main point of the patch is to place a fake input view in the region
specified by SDL_SetTextInputRect and create a custom InputConnection for it.
The reason to make it a separate view is to support Android's pan&scan on input
feature properly. For details please refer to
http://android-developers.blogspot.com/2009/04/updating-applications-for-on-screen.html
Even though the manual states that SetTextInputRect is used to determine the
IME variants position, I thought this would be a proper use for this too.
2012-10-03 20:49:16 -07:00
Gabriel Jacobo
f5b7a7d7db Fixes bug #1506, Changing orientation on the Android device throws off touch scaling 2012-08-24 13:10:29 -03:00
Sam Lantinga
e6d37e6522 Fixed bug 1564 - SDL has no function to open a screen keyboard on Android.
Philipp Wiesemann implemented a general on-screen keyboard API for SDL, and I switched iOS code over to use it.
2012-08-11 10:15:59 -07:00
Ryan C. Gordon
d20ba4537e Make Android port compatible with older API versions again.
Fixes Bugzilla #1563.

Thanks to Philipp Wiesemann for the patch!
2012-08-03 23:59:05 -04:00
Gabriel Jacobo
95b70995ba Fix Android's SDLActivity for devices that may send more than one surfaceChanged
event in a row (ie, the Kindle Fire)
2012-06-24 21:10:17 -03:00
Gabriel Jacobo
1be4f2c07f Fixes #1422, restores GL context automatically under Android 2012-06-19 13:57:42 -03:00
Sam Lantinga
608641e290 Quick android Makefile fix from Gabriel Jacobo 2012-02-14 20:54:44 -05:00
Sam Lantinga
4f291e8eae Updated the Android Java activity for SDL2 2012-02-04 16:39:52 -05:00
Sam Lantinga
a1d5bd8db6 Fixed bug 1368 - Enabling joystick subsystem cause an infinite loop
morgan.devel@gmail.com 2012-01-13 00:32:23 PST

The android version of SDL_SYS_JoystickUpdate doesn't check if there is
actually new data and always generate the SDL_JOYAXISMOTION event.
Consequently, doing a while(SDL_PollEvent()) will result in an endless loop.

The attached patch fix this issue.

It also scale the incoming values properly in the Sint16 range. The scale from
[-gravity;+gravity] is done directly in the java part because one may want to
map the sensor values with a non-linear method for example.
2012-01-13 20:57:35 -05:00
Sam Lantinga
d2b3d8f75a Fixed bug 1293 - [Android] Support Pause/Resume
Gabriel Jacobo 2011-12-23 12:55:11 PST

The attached files provide some improvement over the current handling of
pause/resume in Android.
- I disabled the exit(status) instruction in SDL_main as that makes the entire
app instead of the SDL thread exit (while not needed for pause/resume it is
needed for Live Wallpapers, an SDLActivity for which I'll upload in a separate
bug).
- Added nativePause and nativeResume which basically just mark the window as
visible/hidden, something that the end user needs to take into consideration
(ideally pausing the event loop).

Also, this arrangement creates a new GL context when needed, which at least in
my test system is every time you go away from the app and come back to it. So,
this means that the textures need to be generated again after resuming (a
problem the end user didn't have before because the app exited completely when
it should've been pausing). I'd like to know if there's a standard way of
letting the user know that the GL context has changed and that he needs to
refresh his textures, or if this is out of the scope of the library and each
user handles it in their own way (I don't know how/if this same thing is
handled in  the iPhone backend, but it would be wise to try to imitate that).

Gabriel Jacobo 2011-12-23 12:57:10 PST
Also, in the SDLActivity the EGL handling code is moved up to the Activity from
the Surface code, as I think it is possible (in theory) that the surface is
destroyed temporarily while the context remains alive (though in practice in my
test system this is not the case)
2012-01-08 01:05:25 -05:00
Ryan C. Gordon
f0c4d8739b Bumped default Android API target to 5 (Android 2.0, up from 1.6).
We need this for GLES2 support.
2011-10-15 14:25:00 -07:00
Tim Angus
d6af3b40e5 * Support OpenGL ES 2 on Android 2011-08-26 13:15:05 +01:00
Ryan C. Gordon
d37f894242 Added support for multitouch on Android.
Fixes Bugzilla #1294.

Thanks to Gabriel Jacobo for the patch!
2011-10-13 01:21:35 -04:00
Tim Angus
edc8ca6ac0 * Fix many memory leaks in Android FS code
* Set SDL error string with Java exception details when one occurs
* Fix tabulation of SDLActivity::getContext
2011-08-26 13:11:53 +01:00
Ryan C. Gordon
4ef8847cc5 Allow Android platforms to read from .apk files via the RWOPS interface.
Fixes Bugzilla #1261.

Thanks to Tim Angus for the patch!
2011-07-29 16:51:25 -04:00
Sam Lantinga
1f86c7c17d Try to create an OpenGL ES 2.0 context on Android and successfully fall back to OpenGL ES 1.1 if that fails. 2011-02-07 17:44:07 -08:00
Sam Lantinga
271a5e7540 The window is changed to reflect the actual screen dimensions, for now.
Implemented SDL_SetWindowTitle(), which turned out to be fairly complex
2011-01-13 15:10:17 -08:00
Sam Lantinga
9a23f9d63a Fixed audio buffer lifecycle and implemented audio shutdown 2011-01-13 12:32:55 -08:00
Sam Lantinga
46004aa2fe Working audio implementation contributed by Joseph Lunderville 2011-01-13 11:14:20 -08:00
Sam Lantinga
d83df90435 Implemented translation from Android keycodes to SDL scancodes 2011-01-12 21:21:21 -08:00
Sam Lantinga
2a89441cce Fixed video mode format for unknown surface format 2011-01-12 19:33:29 -08:00
Sam Lantinga
9590d26387 More Android cleanup:
* Formalized the interface with Java methods in SDL_android.h
* We don't need the feature system, at least right now
* Fixed waiting for the SDLMain thread
2011-01-12 17:53:06 -08:00
Sam Lantinga
3d23aa104e Whoops, need to pass that SDL format into native code 2011-01-12 16:35:03 -08:00
Sam Lantinga
be09e4e9a0 Added some missing pixel formats and SDL_GetPixelFormatName() 2011-01-12 14:53:23 -08:00
Sam Lantinga
307c1da714 Fill in the video mode with the correct screen format 2011-01-12 14:29:01 -08:00
Sam Lantinga
4bb49ad70f A bit of cleanup in the Android driver 2011-01-12 13:52:41 -08:00
Sam Lantinga
b6c7ff60dc Added the Android project and lots of info to README.android 2011-01-06 17:12:31 -08:00
Gabriel Jacobo
48789acdd8 Improve handling of focus behaviour on Android. Patch by Alexey Petruchik 2014-05-10 18:24:39 -03:00