mirror of
https://github.com/love2d/love-android.git
synced 2026-08-12 08:31:04 +02:00
Android 11.0 compatibility (#195)
* Update dependencies and target SDK * Update Gradle to 6.6.1 * Update target API level to 30 * Update AGP to 4.0.1 * Update Android Build Dependencies (androidx.appcompat:appcompat:1.2.0, androidx.multidex:multidex:2.0.1) * Update readme * Move /sdcard/lovegame directory. (closes #194) * Potentially fixes black screen when reopening LOVE from app drawer (fixes #190) * Downloader cleanup. * Merge SDL AndroidManifest.xml to LOVE * Implement partial "Share to LOVE" support. * Enable resizeableActivity
This commit is contained in:
+2
-1
@@ -25,4 +25,5 @@ local.properties
|
||||
|
||||
# Gradle build files
|
||||
build
|
||||
.externalNativeBuild
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
|
||||
@@ -33,27 +33,24 @@ In the repository directory. For the last command, add `--depth 1` if needed.
|
||||
Instructions:
|
||||
-------------
|
||||
|
||||
Detailed instructions can be viewed at https://bitbucket.org/MartinFelis/love-android-sdl2/wiki/Home (at the moment)
|
||||
Detailed instructions can be viewed at https://github.com/love2d/love-android/wiki
|
||||
|
||||
Quick Start:
|
||||
------------
|
||||
|
||||
Install the Android NDK and the Android SDK with SDK API 28, set the
|
||||
environment variables:
|
||||
Install the Android SDK with SDK API 30 and Android NDK 21.3.6528147, set the environment variables:
|
||||
|
||||
* `ANDROID_HOME` to your Android SDK location.
|
||||
|
||||
* `ANDROID_NDK_HOME` to your Android NDK location. NDK r16 or later!
|
||||
|
||||
(you may have to adjust the paths to the install directories of the Android
|
||||
SDK and Android NDK on your system) and run
|
||||
SDK on your system) and run
|
||||
|
||||
```
|
||||
./gradlew assembleNormal
|
||||
```
|
||||
|
||||
in the root folder of this project. This should give you a .apk file in the app/build/outputs/apk/normal
|
||||
subdirectory that you can then sign and install on your phone. The .apk flavor is what you normally have
|
||||
in the root folder of this project. This should give you a .apk file in the `app/build/outputs/apk/normal`
|
||||
subdirectory that you can then sign and install on your phone. The `normal` .apk flavor is what you normally have
|
||||
when downloading one from love2d.org. If you want to build the ["embed"](https://love2d.org/wiki/Game_Distribution/APKTool
|
||||
APK, change `assembleNormal` to `assembleEmbedRelease` instead at command above.
|
||||
|
||||
@@ -63,7 +60,7 @@ and on the tab "SDK Tools", select NDK. After that, open the repository root.
|
||||
Bugs:
|
||||
-----
|
||||
|
||||
Bugs and feature requests should be reported to the issue tracker at https://bitbucket.org/MartinFelis/love-android-sdl2/issues?status=new&status=open
|
||||
Bugs and feature requests should be reported to the issue tracker at https://github.com/love2d/love-android/issues
|
||||
|
||||
Changelog:
|
||||
----------
|
||||
@@ -72,7 +69,7 @@ Changelog:
|
||||
|
||||
* Contains all relevant changes for desktop LÖVE [11.3](https://love2d.org/wiki/11.3).
|
||||
* Added support for microphone recording on Android. **This is disabled in Play Store builds**.
|
||||
* Added t.audio.mic (false by default). On Android, setting it to true requests microphone recording permission from the user.
|
||||
* Added t.audio.mic (`false` by default). On Android, setting it to true requests microphone recording permission from the user.
|
||||
* Fixed performance regression on Android devices with Adreno GPU.
|
||||
* Fixed video playback support on Android devices with Adreno GPU.
|
||||
|
||||
|
||||
+9
-8
@@ -1,14 +1,15 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
buildToolsVersion "28.0.3"
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion '30.0.2'
|
||||
ndkVersion '21.3.6528147'
|
||||
defaultConfig {
|
||||
applicationId "org.love2d.android"
|
||||
applicationId 'org.love2d.android'
|
||||
versionCode 29
|
||||
versionName "11.3a"
|
||||
versionName '11.3a'
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 28
|
||||
targetSdkVersion 30
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
@@ -26,7 +27,7 @@ android {
|
||||
}
|
||||
embed {
|
||||
dimension 'mode'
|
||||
applicationIdSuffix "embed"
|
||||
applicationIdSuffix '.embed'
|
||||
}
|
||||
}
|
||||
lintOptions {
|
||||
@@ -35,8 +36,8 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api 'androidx.multidex:multidex:2.0.0'
|
||||
api 'androidx.multidex:multidex:2.0.1'
|
||||
api fileTree(dir: 'libs', include: ['*.jar'])
|
||||
api 'androidx.appcompat:appcompat:1.1.0-alpha01'
|
||||
api 'androidx.appcompat:appcompat:1.2.0'
|
||||
api project(':love')
|
||||
}
|
||||
|
||||
Vendored
+1
-5
@@ -16,8 +16,4 @@
|
||||
# public *;
|
||||
#}
|
||||
|
||||
-keep class br.com.tapps.love.LoveActivity { *; }
|
||||
|
||||
-keepclassmembers class br.com.tapps.love.LoveActivity {
|
||||
public com.naef.jnlua.LuaState createLuaState();
|
||||
}
|
||||
-keep class org.love2d.android.GameActivity { *; }
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
android:icon="@drawable/love"
|
||||
android:label="LÖVE for Android"
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:node="replace" >
|
||||
android:hardwareAccelerated="true"
|
||||
tools:node="replace" >
|
||||
<activity
|
||||
android:name="org.love2d.android.GameActivity"
|
||||
android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|keyboard|keyboardHidden|navigation"
|
||||
|
||||
@@ -1,20 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="org.love2d.android.executable"
|
||||
android:installLocation="auto" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="23" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28" />
|
||||
|
||||
<!-- OpenGL ES 2.0 -->
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
<!-- Touchscreen support -->
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
|
||||
<!-- Game controller support -->
|
||||
<uses-feature android:name="android.hardware.bluetooth" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.gamepad" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.usb.host" android:required="false" />
|
||||
<!-- External mouse input events -->
|
||||
<uses-feature android:name="android.hardware.type.pc" android:required="false" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/love"
|
||||
android:label="LÖVE for Android"
|
||||
android:usesCleartextTraffic="true" >
|
||||
android:usesCleartextTraffic="true"
|
||||
android:hardwareAccelerated="true" >
|
||||
<service android:name="org.love2d.android.DownloadService" />
|
||||
<activity
|
||||
android:name="org.love2d.android.GameActivity"
|
||||
@@ -22,7 +32,7 @@
|
||||
android:label="LÖVE for Android"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="landscape"
|
||||
android:resizeableActivity="false"
|
||||
android:resizeableActivity="true"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
@@ -43,7 +53,6 @@
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="content" />
|
||||
<data android:host="*" />
|
||||
<data android:mimeType="application/x-love-game" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
@@ -51,9 +60,13 @@
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="content" />
|
||||
<data android:host="*" />
|
||||
<data android:mimeType="application/octet-stream" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEND" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:mimeType="application/*" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="org.love2d.android.DownloadActivity"
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||
classpath 'com.android.tools.build:gradle:4.0.1'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+6
-6
@@ -1,6 +1,6 @@
|
||||
#Sun Nov 18 11:20:03 CET 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
|
||||
#Thu Oct 01 16:43:18 SGT 2020
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-all.zip
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/usr/bin/env sh
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
@@ -6,42 +6,6 @@
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
@@ -60,6 +24,46 @@ cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
@@ -85,7 +89,7 @@ location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
@@ -150,11 +154,19 @@ if $cygwin ; then
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
||||
Vendored
+84
-90
@@ -1,90 +1,84 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
|
||||
+10
-8
@@ -6,14 +6,15 @@ android {
|
||||
// See https://code.google.com/p/android/issues/detail?id=52962
|
||||
// and http://stackoverflow.com/questions/27277433/why-does-gradle-build-my-module-in-release-mode-when-the-app-is-in-debug
|
||||
// defaultPublishConfig "debug"
|
||||
compileSdkVersion 28
|
||||
buildToolsVersion '28.0.3'
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion '30.0.2'
|
||||
ndkVersion '21.3.6528147'
|
||||
|
||||
defaultConfig {
|
||||
compileSdkVersion 28
|
||||
buildToolsVersion "28.0.3"
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion "30.0.2"
|
||||
minSdkVersion 14
|
||||
resValue "bool", "embed", "false"
|
||||
resValue 'bool', 'embed', 'false'
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
arguments "-j4"
|
||||
@@ -24,6 +25,7 @@ android {
|
||||
// libraries Gradle should build and package with your APK.
|
||||
abiFilters 'armeabi-v7a', 'arm64-v8a'
|
||||
}
|
||||
targetSdkVersion 30
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
@@ -41,7 +43,7 @@ android {
|
||||
}
|
||||
embed {
|
||||
dimension 'mode'
|
||||
resValue "bool", "embed", "true"
|
||||
resValue 'bool', 'embed', 'true'
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
@@ -59,7 +61,7 @@ android {
|
||||
}
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
path "src/jni/Android.mk"
|
||||
path 'src/jni/Android.mk'
|
||||
}
|
||||
}
|
||||
lintOptions {
|
||||
@@ -73,5 +75,5 @@ android {
|
||||
|
||||
dependencies {
|
||||
api fileTree(dir: 'libs', include: ['*.jar'])
|
||||
api 'androidx.appcompat:appcompat:1.1.0-alpha01'
|
||||
api 'androidx.appcompat:appcompat:1.2.0'
|
||||
}
|
||||
|
||||
@@ -243,6 +243,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
|
||||
// love2d-mod-start: allow restarting of the native thread
|
||||
public void startNative() {
|
||||
boolean hadSDLThread = SDLActivity.mSDLThread != null;
|
||||
|
||||
// Set up JNI
|
||||
SDL.setupJNI();
|
||||
|
||||
@@ -283,6 +285,10 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
SDLActivity.onNativeDropFile(filename);
|
||||
}
|
||||
}
|
||||
|
||||
if (hadSDLThread) {
|
||||
resumeNativeThread();
|
||||
}
|
||||
}
|
||||
// love2d-mod-end: allow restarting of the native thread
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ import android.content.Intent;
|
||||
import android.media.AudioManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Vibrator;
|
||||
import android.util.Log;
|
||||
import android.util.DisplayMetrics;
|
||||
@@ -112,6 +111,7 @@ public class GameActivity extends SDLActivity {
|
||||
storagePermissionUnnecessary = false;
|
||||
embed = context.getResources().getBoolean(R.bool.embed);
|
||||
|
||||
// Get filename from "Open with" of another application
|
||||
handleIntent(this.getIntent());
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -134,7 +134,17 @@ public class GameActivity extends SDLActivity {
|
||||
}
|
||||
|
||||
protected void handleIntent(Intent intent) {
|
||||
Uri game = intent.getData();
|
||||
Uri game = null;
|
||||
|
||||
// Try to handle "Share" intent.
|
||||
// This is actually "bit tricky" to get working in user phone
|
||||
// because shared static variables issue in the native side
|
||||
// (user have to clear LOVE for Android in their recent apps list).
|
||||
if (Intent.ACTION_SEND.equals(intent.getAction())) {
|
||||
game = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
||||
} else {
|
||||
game = intent.getData();
|
||||
}
|
||||
|
||||
if (!embed && game != null) {
|
||||
String scheme = game.getScheme();
|
||||
@@ -229,17 +239,13 @@ public class GameActivity extends SDLActivity {
|
||||
}
|
||||
|
||||
protected void checkLovegameFolder() {
|
||||
// If no game.love was found fall back to the game in <external storage>/lovegame
|
||||
// if using normal or playstore build
|
||||
// If no game.love was found and embed flavor is not used, fall back to the game in
|
||||
// <external storage>/Android/data/<package name>/games/lovegame
|
||||
if (!embed) {
|
||||
Log.d("GameActivity", "fallback to lovegame folder");
|
||||
if (hasExternalStoragePermission()) {
|
||||
File ext = Environment.getExternalStorageDirectory();
|
||||
if ((new File(ext, "/lovegame/main.lua")).exists()) {
|
||||
gamePath = ext.getPath() + "/lovegame/";
|
||||
}
|
||||
} else {
|
||||
Log.d("GameActivity", "Cannot load game from /sdcard/lovegame: permission not granted");
|
||||
File ext = getExternalFilesDir("games");
|
||||
if ((new File(ext, "/lovegame/main.lua")).exists()) {
|
||||
gamePath = ext.getPath() + "/lovegame/";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -295,7 +301,6 @@ public class GameActivity extends SDLActivity {
|
||||
} else {
|
||||
Log.d("GameActivity", "cannot open game " + gamePath + ": no external storage permission given!");
|
||||
}
|
||||
|
||||
} else {
|
||||
self.checkLovegameFolder();
|
||||
if (gamePath.length() > 0)
|
||||
|
||||
@@ -27,6 +27,7 @@ import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.Manifest;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
@@ -37,7 +38,7 @@ public class DownloadActivity extends Activity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT >= 29 ||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q ||
|
||||
ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED)
|
||||
{
|
||||
runDownloader();
|
||||
|
||||
@@ -60,14 +60,14 @@ public class DownloadService extends IntentService {
|
||||
request.setTitle(uri.getLastPathSegment());
|
||||
request.setMimeType("application/x-love-game");
|
||||
|
||||
// in order for this if to run, you must use the android 3.2 to compile your app
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
DownloadRequestSettings_API11 settings = new DownloadRequestSettings_API11();
|
||||
settings.setup(request);
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
|
||||
request.allowScanningByMediaScanner();
|
||||
}
|
||||
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, uri.getLastPathSegment());
|
||||
// get download service and enqueue file
|
||||
|
||||
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
||||
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, uri.getLastPathSegment());
|
||||
|
||||
// get download service and enqueue file
|
||||
Log.d("DownloadActivity", "creating manager");
|
||||
DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
|
||||
Log.d("DownloadActivity", "enqueuing download");
|
||||
@@ -78,26 +78,6 @@ public class DownloadService extends IntentService {
|
||||
registerReceiver(downloadReceiver, intentFilter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context used to check the device version and DownloadManager information
|
||||
* @return true if the download manager is available
|
||||
*/
|
||||
public static boolean isDownloadManagerAvailable(Context context) {
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.GINGERBREAD) {
|
||||
return false;
|
||||
}
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
intent.setClassName("com.android.providers.downloads.ui", "com.android.providers.downloads.ui.DownloadList");
|
||||
List<ResolveInfo> list = context.getPackageManager().queryIntentActivities(intent,
|
||||
PackageManager.MATCH_DEFAULT_ONLY);
|
||||
return list.size() > 0;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private BroadcastReceiver downloadReceiver = new BroadcastReceiver() {
|
||||
|
||||
@Override
|
||||
@@ -107,10 +87,3 @@ public class DownloadService extends IntentService {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
class DownloadRequestSettings_API11 {
|
||||
public static void setup(DownloadManager.Request request) {
|
||||
request.allowScanningByMediaScanner();
|
||||
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user