Commit graph

114 commits

Author SHA1 Message Date
Rémi Verschelde 0ae65472e7
clang-format: Enable BreakBeforeTernaryOperators
clang-format keeps breaking the way it handles break *after* ternary operators,
so I give up and go with the only style they seem to actually test.
2021-10-28 15:57:41 +02:00
Rémi Verschelde 3a6be64c12
clang-format: Various fixes to comments alignment from clang-format 13
All reviewed manually and occasionally rewritten to avoid bad auto formatting.
2021-10-28 15:43:36 +02:00
Rémi Verschelde 3b11e33a09
clang-format: Disable alignment of operands, too unreliable
Sets `AlignOperands` to `DontAlign`.

`clang-format` developers seem to mostly care about space-based indentation and
every other version of clang-format breaks the bad mismatch of tabs and spaces
that it seems to use for operand alignment. So it's better without, so that it
respects our two-tabs `ContinuationIndentWidth`.
2021-10-28 15:19:35 +02:00
PouleyKetchoupp 0b681d5834 Add support for adding plugin views behind the main view on Android
Doesn't change the default behavior, but allows plugins to add their
view behind the main view, which gives more control over what happens
with inputs and can be useful along with transparent rendering.
2021-09-01 10:01:55 -07:00
Marcus Brummer 47f338fc12 Check if vibration duration is > 0 on Android 2021-08-21 17:33:25 +02:00
Fredia Huya-Kouadio f4222733ca Delegate handling and implementation of the restart functionality to the Godot host. 2021-08-18 10:24:42 -07:00
ne0fhyk 3a00ff1cce Add partial support for Android scoped storage.
This is done by providing API access to app specific directories which don't have any limitations and allows us to bump the target sdk version to 30.
In addition, we're also bumping the min sdk version to 19 as version 18 is no longer supported by Google Play Services and only account of 0.3% of Android devices.
2021-08-16 23:11:56 -07:00
Pedro J. Estébanez e745088f1f Switch to input buffering on Android
Key, touch and joystick events will be passed directly from the UI thread to Godot, so they can benefit from agile input flushing.

As another consequence of this new way of passing events, less Java object are created at runtime (`Runnable`), which is good since the garbage collector needs to run less.

`AndroidInputHandler` is introduced to have a smaller cross-thread surface. `main_loop_request_go_back()` is removed in favor just inline calling `send_window_event()` at the most caller's convenience (i.e., leveraging the new `p_deferred`` parameter as appropriate).

Lastly, `get_mouse_position()` and `get_mouse_button_state()` now just call through `Input` to avoid the need of sync of mouse data tracked on the UI thread.
2021-08-13 11:45:50 +02:00
Fredia Huya-Kouadio 28a99e4cf6 Resolve issue where the Godot app remains stuck when resuming.
This was caused by the fact that a new instance of Godot was created at resume while a previous instance already existed.
The previous instance would then go through its cleanup lifecycle, and would thus attempt to close the entire app, leading to the system to restart the app, thus starting the cycle anew.
The fix involves reusing the previous instance of Godot if one is available instead of creating a new one, as well as giving control to the host activity for how the process should be terminated.
2021-08-12 21:05:18 -07:00
Marcus Brummer 20b3e2cc94 Properly finishes Godot's Android activity when destroyed by the system 2021-08-12 15:33:51 +02:00
Rémi Verschelde 5d7c23dcc6
Merge pull request #50220 from madmiraal/fix-50125
Queue the calls to GodotLib.key when Android virtual done is pressed
2021-07-06 23:46:21 +02:00
Marcel Admiraal 57317ce7b8 Remove Android onKeyMultiple override 2021-07-06 17:39:42 +01:00
Marcel Admiraal 1856f16378 Queue the calls to GodotLib.key when Android virtual done is pressed 2021-07-06 17:32:09 +01:00
Rémi Verschelde c47b6f4b5c
Merge pull request #50107 from madmiraal/android-use-lambdas
Replace single method anonymous classes with lambdas in Godot Java code
2021-07-06 18:10:38 +02:00
Marcel Admiraal 23e152040b Use static inner classes in Godot Java code 2021-07-03 05:50:04 +01:00
Marcel Admiraal a7825ca12a Replace single method anonymous classes with lambdas in Godot Java code 2021-07-03 05:13:31 +01:00
Rémi Verschelde f2229bb1ea
Merge pull request #50085 from madmiraal/android-replace-stringbuffer
Use StringBuilder instead StringBuffer in Godot Java code
2021-07-02 22:09:50 +02:00
Rémi Verschelde aee59c3547
Merge pull request #50083 from madmiraal/android-fix-raw-use
Fix raw use of parameterized Class
2021-07-02 22:09:39 +02:00
Marcel Admiraal 3f95bbed73 Remove redundant explicit types in Godot Java code 2021-07-02 17:45:30 +01:00
Marcel Admiraal 61ee51d2bf Use StringBuilder instead StringBuffer in Godot Java code 2021-07-02 16:57:12 +01:00
Rémi Verschelde 710effdaad
Merge pull request #50078 from madmiraal/android-remove-unused-imports 2021-07-02 17:45:29 +02:00
Marcel Admiraal d237f7d33d Fix raw use of parameterized Class 2021-07-02 16:35:52 +01:00
Marcel Admiraal a38fd4a4c2 Remove unused imports from Android Java code 2021-07-02 12:57:55 +01:00
Rémi Verschelde 6ef0b8fcd3
Merge pull request #50074 from madmiraal/android-replace-c-array
Use Java array declarations not C-style declarations in Android Java code
2021-07-02 13:44:22 +02:00
Rémi Verschelde 42184dd6d5
Merge pull request #50072 from madmiraal/android-remove-interface-modifiers
Remove redundant interface modifiers from Android Java code
2021-07-02 12:35:14 +02:00
Marcel Admiraal 721b3d56c5 Use Java array declarations not C-style declarations in Android Java code 2021-07-02 11:09:09 +01:00
Marcel Admiraal a74e803a4f Remove redundant interface modifiers from Android Java code 2021-07-02 09:37:45 +01:00
Marcel Admiraal 360447001d Remove unnecessary semicolons from Android Java code 2021-07-02 08:54:09 +01:00
Marcel Admiraal 8270e101a7 Fix unchecked call to put() warning in GodotInputHandler.java 2021-06-30 12:13:05 +01:00
Rémi Verschelde bc1fcb9c65
Merge pull request #49435 from madmiraal/add-android-external-dir
Add OS.get_external_data_dir() to get Android external directory
2021-06-10 22:11:02 +02:00
Marcel Admiraal b3a962945e Add OS.get_external_data_dir() to get Android external directory 2021-06-10 16:48:17 +01:00
Marcel Admiraal 4ba2ed332e Remove unused AudioDriverAndroid from Android 2021-06-10 08:32:56 +01:00
Rémi Verschelde c1c76850cb
Style: Cleanup uses of double spaces between words
Or after punctuation. Tried to leave third-party stuff alone, unless it has
been heavily modified for Godot.
2021-06-07 11:03:08 +02:00
Szymon Majewski 5634093703 Fixed screen orientation on Android 2021-05-24 16:58:35 -07:00
thebestnom f5b5e00a01 Android: Add support for cursor icons 2021-05-19 22:01:51 +03:00
Fredia Huya-Kouadio 1f16ba2696 Add support for forwarding callbacks from Godot's parent activity. 2021-04-12 16:48:35 -07:00
Fredia Huya-Kouadio a21457155b Fix issue causing the response callback to be invoked with the invalid requestCode and deprecate support for forwarding callbacks from Godot's parent activity. 2021-04-09 13:42:49 -07:00
Bastiaan Olij b3a43430aa Fixes on android:
- creating Vulkan context instead of OpenGL
- checking for validity of ENV in wrapper classes
- fix for access to JavaVM from threads
2021-03-18 10:41:54 +11:00
Fredia Huya-Kouadio 8f285d93e8 Fix onMainRequestPermissionsResult callback for Android plugins. 2021-03-17 09:23:58 -07:00
Fredia Huya-Kouadio 2d574bcc85 Leverage java annotations to simplify the logic used to register the Godot plugin methods. 2021-03-16 01:16:08 -07:00
Fredia Huya-Kouadio 6fd881e43c Update the logic to load Godot Android plugins packaged into the binary.
The previous logic had the side effect of imposing a limit of one plugin per `aar` binary. The update lifts that restriction.
2021-02-26 08:38:39 -08:00
Fredia Huya-Kouadio 3ce7678374 Update the initialization timeline for the Godot fragment to be more consistent with the previous activity based timeline. 2021-02-24 06:16:07 -08:00
Fredia Huya-Kouadio fe9f0758db Expose GodotPlugin's utility methods used for registration and signal emitting.
This enables creation and use of a plugin like class by composition rather than inheritance.
2021-02-15 15:55:59 -08:00
Michael Conrad cc2547a9e9 Fix joystick axis mapping issues with NVIDIA shield. Probably others.
Issues addressed:

a) Axis mappings were including virtual mouse axes on NVIDIA Shield TV.

The virtual mouse axes have the same axis numbers as the normal analog stick numbers. This was completely breaking joypad support on NVIDIA Shield TV.

b) Joypads were being tracked in a List with the index in the list being treated as the Godot device id.

If a device were to be removed, any device later in the list would be shifted, potentially causing future events with the shifted joypads to have incorrect IDs according to the Godot engine.

c) Unnecessary events were being sent to the Godot engine.

A check was added (per Joystick) that will prevent sending events for all axes when only a single axis value changed.
A similar check was added for "HATs".

See #45712
2021-02-09 08:37:22 -05:00
Rémi Verschelde af878716f2
CI: Update to clang-format 11 and apply ternary operator changes 2021-01-12 19:32:53 +01:00
Rémi Verschelde b5334d14f7
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
thebestnom e7f259c366 Android: Allow Mouse Capture 2020-12-08 22:14:08 +02:00
alan-w-255 7fa803fa2c
fix android wrong multi-touch pointerid
Fixes #43519.
2020-12-03 13:34:04 +01:00
Aaron Franke 02161aad5a
Remove empty lines around braces with the formatting script 2020-11-16 23:38:11 -05:00
Rémi Verschelde 484c3d5e27
Merge pull request #43248 from HEAVYPOLY/master
Change android orientations from sensor to user
2020-11-16 22:12:53 +01:00