Commit graph

289 commits

Author SHA1 Message Date
Rémi Verschelde 37bac7d75d
Merge pull request #40672 from nekomatata/virtual-keyboard-height-fix-3.2
[3.2] Virtual keyboard size adjustment fixes
2020-07-27 08:57:52 +02:00
Rémi Verschelde a2edf04fd2
Merge pull request #40469 from nekomatata/virtual-keyboard-enter-fixes-3.2
[3.2] Fix Return key events in LineEdit & TextEdit on Android
2020-07-26 20:26:02 +02:00
PouleyKetchoupp 69db38742f Virtual keyboard size adjustment fixes
1. Disable virtual keyboard focus adjustment on Android
The default adjustment setting was causing the view to pan down in order
to adjust the focus on the text content.
We don't need any focus adjustment since we're using a fixed size window
for our application.
Documentation:
https://developer.android.com/reference/android/view/WindowManager.LayoutParams#SOFT_INPUT_ADJUST_NOTHING

2. Fix virtual keyboard height regression
Disabling virtual keyboard focus adjustement caused get_keyboard_height
to always return 0 because it was calculated when the view is resized.
In order to fix it, a PopupWindow is now created on top of the main view
and is set for focus adjustments so the keyboard size can be calculated
based on this popup without affecting the main view.
2020-07-24 18:26:20 +02:00
Rémi Verschelde b40f3f9740 Style: Sync other changes from new fix_style.sh and clang_format.sh 2020-07-24 10:39:18 +02:00
PouleyKetchoupp c0b394572f Fix Return key events in LineEdit & TextEdit on Android
Depending on the device implementation, editor actions could be
received with different action ids or not at all for multi-line.

Added a parameter to virtual keyboards to properly handle single-line
and multi-line cases in all situations.

Single-line:
Input type set to text without multiline to make sure actions are sent.
IME options are set to DONE action to force action id consistency.

Multi-line:
Input type set to text and multiline to make sure enter triggers new lines.
Actions are disabled by the multiline flag, so '\n' characters are
handled in text changed callbacks.
2020-07-17 18:25:40 +02:00
Rémi Verschelde 0246a1a276 Revert "Enable the ability to use Godot as a subview within an Android app"
This reverts commit 920639511d.

The changes are good, this revert is only done for release management reasons
as we want this feature to get more testing before making it in a stable build,
but a 3.2.3 release is imminent to handle some regressions in 3.2.2.

This will be re-committed in a 3.2-based feature branch, and we'll merge it
again once we're confident about it (probably for 3.2.4).
2020-07-10 08:51:21 +02:00
Fredia Huya-Kouadio 623a1ae5b3 Fix the logic to enable focus awareness 2020-06-27 16:40:22 -07:00
Fredia Huya-Kouadio 920639511d Enable the ability to use Godot as a subview within an Android app 2020-06-25 19:57:03 -07:00
Fredia Huya-Kouadio 944210923f Follow up cleanup for the godotpayment project module
(cherry picked from commit 206cbd960b)
2020-06-24 22:52:05 +02:00
Timo Schwarzer 5053ab684a
Remove GodotPayment android plugin
This is now available in a separate repository
at https://github.com/godotengine/godot-google-play-billing
2020-06-22 11:11:41 +02:00
Fredia Huya-Kouadio 61aa477e1c Clean up the GodotPlugin public API. 2020-06-16 09:24:41 -07:00
Fredia Huya-Kouadio d1e4cede90 Add support for focus awareness 2020-06-04 15:51:51 -07:00
Fredia Huya-Kouadio bea913a874 Stop ignoring hidden files and directories in the assets directory
(cherry picked from commit bf76d2afcf)
2020-06-04 12:09:39 +02:00
volzhs c86ddd6b61 Add missing consumePurchase plugin method for GodotPayment 2020-05-28 11:51:14 +09:00
Rémi Verschelde f03bc21e09
Merge pull request #39103 from m4gr3d/enable_legacy_external_storage
Enable legacy external storage for Android 10
2020-05-27 22:57:24 +02:00
Fredia Huya-Kouadio 2e7e3dcfe4 Enable legacy external storage for Android 10 2020-05-27 13:34:40 -07:00
Fredia Huya-Kouadio 0181e89e43 Validate that Use Custom Build is enabled when Plugins are selected
Remove `GodotPayment` from the default build template
2020-05-27 12:04:31 -07:00
Fredia Huya-Kouadio 06b7f611f8 Provide the ability for clients of the Godot library to add their own command line arguments 2020-05-27 02:12:54 -07:00
Timo Schwarzer 8373c0792a
Re-implement GodotPayment Android plugin using the Google Play Billing library 2020-05-25 21:09:45 +02:00
PouleyKetchoupp f4f4b77d23 Use long instead of int for object id in Android java wrapper
Using int for 64-bit values might cause issues with objects not found
in ObjectDB when the id is truncated.

(cherry picked from commit 39f59786fa)
2020-05-25 16:36:34 +02:00
SkyJJ 2197ef0566 Fix Android LineEdit editing bugs
(cherry picked from commit cc473b948f)
2020-05-20 12:07:08 +02:00
Fredia Huya-Kouadio a71a338c59 Implementation of the Godot Android Plugin configuration file 2020-05-16 23:09:45 -07:00
thebestnom 30680a4afe Android: Migrate deprecated support library to AndroidX 2020-05-10 19:08:27 +03:00
Rémi Verschelde e637fe9dd3 clang-format: Add JavaImportGroups for Java code
(cherry picked from commit 6038325470)
2020-05-07 13:36:27 +02:00
Fredia Huya-Kouadio 918f5dee23 Address OS.request_permissions() bug when non-platform permission(s) is included
(cherry picked from commit ef62506e5c)
2020-05-06 23:29:29 +02:00
Fredia Huya-Kouadio 17ad99c206 Fix Android templates size regression
The issue was caused by PR #36906 which changes prevented the generated shared libraries from being stripped.
Since the change is only needed for development (debugging) purposes, it's commented out by default.

(cherry picked from commit 2f38cfd9ab)
2020-04-23 11:08:46 +02:00
Fredia Huya-Kouadio b7fa9cf8ff Fix compilation issue by updating a call to runOnGLThread that was missed by PR #37175 2020-04-16 16:16:24 -07:00
Rémi Verschelde c4a849588b
Merge pull request #37175 from m4gr3d/make_godot_plugin_callbacks_generic_3.2
[3.2] Update the naming scheme for the GodotPlugin's methods
2020-04-17 00:08:27 +02:00
fhuya 373db27788 Migrate legacy apache dependency to the GodotPayment plugin
This is the only location in the codebase where it's being used, so no need to make the main lib have a dependency on it.

(cherry picked from commit c591cb8fda)
2020-04-16 11:41:23 +02:00
Rémi Verschelde 88e1264893 Android: Bump build tools to 29.0.3
(cherry picked from commit ca896ddbf0)
2020-04-16 11:41:11 +02:00
fhuya ff7b455478 Delete unused drawable resources.
(cherry picked from commit 73d4e2eefb)
2020-04-16 11:40:56 +02:00
fhuya fd045b8b91 Update Android custom template build configuration.
(cherry picked from commit 9c11076a20)
2020-04-16 11:40:06 +02:00
Rémi Verschelde 5698a9ec74
Merge pull request #37305 from m4gr3d/implement_plugin_signals_3.2
[3.2] Add signal support to Godot Android plugin:
2020-04-10 18:42:32 +02:00
Rémi Verschelde 798bf901b8 Android: Downgrade gradle plugin to 3.5.3
With the NDK installed locally, gradle plugin 3.6.0 seems to enforce
a specific older NDK version, and will fail building if you don't have
it installed with:

```
No version of NDK matched the requested version 20.0.5594570.
Versions available locally: 21.0.6113669
```

Upstream issue: https://github.com/gradle/gradle/issues/12440

(cherry picked from commit ba2ec53a26)
2020-04-02 23:34:02 +02:00
fhuya b995256bca Update the naming scheme for the GodotPlugin's methods in preparation of the vulkan integration. 2020-03-28 15:42:21 -07:00
fhuya 0c782ca2b2 Backport Kotlin support 2020-03-27 10:18:30 -07:00
fhuya f69760b4be Add signal support to Godot Android plugin:
Supports registering and emitting signal from a Godot Android plugin
2020-03-27 01:37:41 -07:00
fhuya 7135bc3e37 Miscellaneous cleanup for the Android codebase:
- update gradle plugins versions
- cleanup java_godot_lib_jni

Note: logic was mostly moved around and no new logic/functionality was added.
2020-03-25 09:00:37 -07:00
PouleyKetchoupp 2e4e1e0324 Fix text_entered signal when max_length is used in LineEdit on Android
Fixes #35954

(cherry picked from commit c169367e83)
2020-03-25 11:38:53 +01:00
fhuya 9a035efe62 Complete the implementation of the GodotPayment plugin.
Move the remaining plugin components within the plugin source code.

(cherry picked from commit 99173c5fc4)
2020-03-25 11:38:53 +01:00
fhuya cd2b2bf8bf Enable Android studio debugger.
(cherry picked from commit 41dadb2b2b)
2020-03-25 11:38:53 +01:00
fhuya c3660bb4dc Re-architecture of the Godot Android plugin. 2020-03-09 10:30:02 +01:00
PouleyKetchoupp b2ac2b6201 Fixed LineEdit virtual keyboard inputs on Android
Changed the condition to add a length filter to make it consistent with the documentation (0 means no character limit). Otherwise the default value in LineEdit causes the virtual keyboard to be non-fonctional on Android.

(cherry picked from commit 196860508a)
2020-02-06 13:02:07 +01:00
fhuya 9bd841b86d Address crash caused by missing dependency. 2020-01-27 10:45:25 -08:00
fhuya e41caac7db Address crash caused by missing dependency. 2020-01-27 10:26:01 -08:00
Bruno Lourenço a3bcdbeb78 Android virtual keyboard respecting LineEdit max length. 2020-01-23 01:52:49 +00:00
Bruno Lourenço abe83a1c84 Add support for Android adaptive icons. 2020-01-14 16:11:07 +00:00
Alexander Holland dd2fd4e853 fixes android double tap regression 2020-01-13 12:46:33 +01:00
Alexander Holland b1b308411a Fixes Android FileDialog
- Go up was not working, simplify was used one time too much
- Added GestureHandler
  - Added doubleTap to recognize open dir
  - Fixed scroll where sometimes the scroll jumped between start and end when pointer was outside or on the edge of the scroll area
2020-01-10 15:25:08 +01:00
Rémi Verschelde a7f49ac9a1 Update copyright statements to 2020
Happy new year to the wonderful Godot community!

We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
fhuya 50ab6decfe Replace the android.defaultConfig.applicationId in build.gradle with the package/unique_name. 2019-12-30 10:33:48 -05:00
Rémi Verschelde 8938577459 i18n: Sync translations with Weblate + update template
Also fix a few stray clang-format formatting errors that passed
through CI unnoticed.
2019-12-22 13:27:02 +01:00
Fabio Alessandrelli ca19a3fe9a Fix crash on Android with no manifest permissions.
API allows for null array of permissions. It is now normalized with an
empty array.
2019-12-17 14:46:04 +01:00
Fabio Alessandrelli fafda80a4b Add GodotNetUtils Java class for Android.
Provides access to a MulticastLock.
As specified by the Android API, broadcast/multicast packets may be
filtered on some phones unless the application explicitly acquires
a "MulticastLock".
2019-12-14 18:10:36 +01:00
Rémi Verschelde c41c24562d Style: Add missing copyright headers 2019-11-22 08:37:09 +01:00
Cagdas 0088385556 Add request permission automatically at android 2019-10-22 22:52:13 +03:00
Rémi Verschelde acd5c7e767
Merge pull request #32858 from m4gr3d/expand_singleton_base_api
Add `View SingletonBase#onMainCreateView(Activity activity)` api
2019-10-22 13:52:39 +02:00
Fredia Huya-Kouadio 4407350608 Add View onMainCreateView(Activity activity) api to the Godot.SingletonBase class.
The new api allows plugins to define and provide their views for inclusion in the Godot Android view hierarchy.
2019-10-18 10:05:53 -07:00
Hugo Locurcio c8a8be6dd1
Optimize images losslessly using oxipng -o6 --strip all --zopfli 2019-10-12 23:23:33 +02:00
Alexander Holland db582a2c8c Adds Pen support for Android 2019-10-04 23:57:01 +02:00
Rémi Verschelde 0c7b3fff44 Android: Fix manifest parsing and APK names in export code
A better fix would be to make Godot's export code properly parse the
tag over multiple lines (and maybe even use XMLParser instead of doing
it ad-hoc?).

As for the APK names, we could alternatively pick the first .apk found
in the `debug` and `release` folders without expecting a specific name.

Fixes #32414.
2019-10-03 12:13:45 +02:00
Rémi Verschelde 2b628e5d5b
Merge pull request #32269 from m4gr3d/improve_build_time
Update the Godot gradle build tasks to provide additional flexibility
2019-09-24 16:29:34 +02:00
fhuya ef143447ad Updates the Godot gradle tasks to enable manual runs of the scons command.
Example: To generate for the `release` build target and for the `armv7`, `arm64v8` and `x86` architectures, run the commands:
```
cd godot
scons -j4 platform=android target=release android_arch=armv7
scons -j4 platform=android target=release android_arch=arm64v8
scons -j4 platform=android target=release android_arch=x86
cd platform/android/java
./gradlew generateGodotTemplates
```

Notes:
- The generated build templates will be located in the `godot/bin` directory (i.e: `android_debug.apk`, `android_release.apk`, `android_source.zip`).
- The gradle command will only generate templates for the target(s) with available native shared libraries. For example, running the commands above will only generate the `android_release.apk` and `android_source.zip` files.

To delete the generated artifacts, the following commands can be used:
```
cd platform/android/java
./gradlew cleanGodotTemplates
```
2019-09-24 06:18:21 -07:00
Rémi Verschelde 823c3def72 Fix copyright headers and style issues 2019-09-24 11:52:06 +02:00
Rémi Verschelde ce384f885c
Merge pull request #32250 from lawnjelly/android-keyboard2
Fix Android keyboard crash with left cursor
2019-09-23 22:09:09 +02:00
lawnjelly ad5d0cca4d Fix Android keyboard crash with left cursor
Fixes #32168.
Previously we were returning all key up and key down messages as unhandled to the OS. This was resulting in crashes on certain keypresses (left cursor), for undetermined reason.

This PR defaults all key up and keydown messages to be returned as handled by Godot, except those explicitly coded as exceptions (currently volume keys only).
2019-09-23 18:08:41 +01:00
fhuya a7712cc9e4 Add new events and accompanying logic to notify when the app is paused and resumed on Android devices. 2019-09-19 13:29:49 -07:00
fhuya 7fabfd402f Split the Android platform java logic into an Android library module (lib) and an application module (app).
The application module `app` serves double duties of providing the prebuilt Godot binaries ('android_debug.apk', 'android_release.apk') and the Godot custom build template ('android_source.zip').
2019-09-04 16:20:22 -07:00
Rémi Verschelde f38c64e8b1
Merge pull request #31709 from akien-mga/android-fix-thirdparty
Android: Fix another regression with Secure.ANDROID_ID, and fix formatting and documentation of thirdparty code
2019-08-27 20:16:08 +02:00
Rémi Verschelde b7c46ed929
Merge pull request #31713 from volzhs/fix-vibrate
Suppress MissingPermission warning for Android vibration
2019-08-27 17:42:32 +02:00
Rémi Verschelde eb8d181cb2 Android: Sync Google billing library with upstream, unmodified
Synced with 7a94c6905a.
2019-08-27 15:15:37 +02:00
volzhs 8cda898fbb Suppress MissingPermission warning for Android vibration
It does check its permission every `vibrate_handheld()` calls.
Vibrate permission is added by checking it on export settings.

And there are some changes for deprecated method.
2019-08-27 22:01:45 +09:00
Rémi Verschelde 472d10a0ad Android: Reapply custom changes to Google expansion.downloader lib
I don't know why they're needed, but readding for now to keep things
working as they were.
2019-08-27 14:30:14 +02:00
Rémi Verschelde ee5898f58a Android: Resync Google expansion.downloader library with upstream, unmodified
Synced with 9ecf54e5ce.
2019-08-27 14:10:31 +02:00
Rémi Verschelde ce60217894 Android: Reapply changes to Google licensing lib from #24145
But document them better this time.
2019-08-27 14:10:30 +02:00
Rémi Verschelde 6f0367052a Android: Resync Google licensing lib with upstream, unmodified
It had been synced with style changes (spaces -> tabs), not sure why
I accepted to merge it this way back then...

Synced with eb57657f66,
same as before.

Custom-changes will be reapplied in the next commit, if relevant.
2019-08-27 13:44:16 +02:00
Rémi Verschelde 071ebb1e48 Android: Fix another regression with Secure.ANDROID_ID
Regression from #24145, which was missed in #28146.
2019-08-27 13:44:07 +02:00
Rémi Verschelde 04ac6a43a4 Android: Style fixes to manifest and build.gradle 2019-08-27 11:16:55 +02:00
Rémi Verschelde 1afd77e375 Android: Bump gradle version to 5.1.1
Matching changes made in #31521 and #31547 but only in the Jetbrains
IDE config.
2019-08-27 10:22:05 +02:00
fhuya 5eaaabceaf Update the fallback input mapping for the Oculus mobile devices. 2019-08-26 18:48:54 -07:00
Rémi Verschelde 1a4dbd9ee2
Merge pull request #31437 from volzhs/vibrate-mobile
Support vibration for Android and iOS
2019-08-21 21:10:22 +02:00
volzhs 4061e5bb75 Support vibration for Android and iOS 2019-08-21 23:38:53 +09:00
fhuya f35b1f3b91 Shut down Godot processes on app exit. 2019-08-20 22:35:46 -07:00
fhuya dea414abc8 Make the meta-data name attribute settable. This will facilitate reuse for ARCore integration. 2019-07-02 11:21:26 -07:00
Rémi Verschelde d2c416ec62
Merge pull request #29824 from m4gr3d/add_ovr_export
Add XR mode selection to the Android export process.
2019-07-02 10:36:30 +02:00
fhuya 12e0dc1b65 Add XR mode selection to the Android export process. 2019-07-02 00:12:38 -07:00
lawnjelly 512f8ebb93 Fix some keyboards not working with Android
Fixes #17004

Currently the keydown and keyup messages are handled with method like this:

if ((source & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK
|| (source & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD
|| (source & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) {
// joystick input
}
else
{
// keyboard input
}

The constant for SOURCE_DPAD is 513
10 0000 0001

and the constant for SOURCE_KEYBOARD is 257
1 0000 0001

However, rather confusingly, for many keyboards the source sent by android is 769
11 0000 0001

Thus the keyboard is passing the check as being a DPAD and being processed as a joystick rather than keyboard. This PR handles the specific case of 769, allowing input from physical keyboards.
2019-06-21 12:57:33 +01:00
fhuya 2c3536810a Setup Godot to support the Oculus Mobile SDK. 2019-05-30 16:35:50 -07:00
wombatstampede 6e46701e64 Android: Include Joysticks/Gamepads which are available on app start. 2019-05-28 18:23:30 +02:00
Rémi Verschelde 900d90bb61 Git: Explicitly list binary files as such to avoid EOL change
text=auto works well in Git 2.10+ but it's broken in previous versions,
which are still used in production on e.g. Ubuntu 16.04 LTS.

Also fix a couple missed text files with CRLF terminators.
.bat files likely require it to be processed properly on Windows,
but core.autocrlf should take care of converting them on the fly
when checking out on Windows.
2019-05-25 10:43:48 +02:00
Rémi Verschelde e0574e1d98 Fix typos with codespell
Using codespell 1.15.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
doubleclick
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2019-05-19 13:10:35 +02:00
Aaron Franke 702b539405
Change "ID" to lowercase "id"
Reasoning: ID is not an acronym, it is simply short for identification, so it logically should not be capitalized. But even if it was an acronym, other acronyms in Godot are not capitalized, like p_rid, p_ip, and p_json.
2019-05-09 06:25:32 -04:00
Juan Linietsky cf5881f574 Rename wrong field. 2019-04-24 17:01:20 -03:00
Juan Linietsky a424d39f76 Remove forgotten strings in configuration files 2019-04-24 16:31:23 -03:00
Juan Linietsky dd03dcbd5a Android now (optionally) builds the template when exporting
Added new way to create add-ons
Removed old way to create add-ons
2019-04-07 15:46:52 -03:00
Rémi Verschelde f20c9c25eb
Merge pull request #28164 from BastiaanOlij/AndroidCameraPermission
Add camera permissions to android
2019-04-19 11:27:11 +02:00
Bastiaan Olij fab84c7dff Add camera permissions to android 2019-04-18 23:16:41 +10:00
volzhs 5a4b2087a0 Fix get_unique_id() on Android 2019-04-18 08:07:03 +09:00
Rémi Verschelde c8994b56f9 Style: Apply new changes from clang-format 8.0
It seems to stay compatible with formatting done by clang-format 6.0 and 7.0,
so contributors can keep using those versions for now (they will not undo those
changes).
2019-04-09 17:09:48 +02:00
Bastiaan Olij b2c0a687f1 Restructuring glue code to make it easier to extend 2019-04-05 21:44:06 +11:00