diff options
| author | ilotterytea <iltsu@alright.party> | 2024-10-08 01:54:47 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2024-10-08 01:54:47 +0500 |
| commit | c5ee68a647871ca7bc8044a96759e7c00f9188db (patch) | |
| tree | 5101f68c9d33ed0c2c7ebb00178fe9d4537d9fe0 /android | |
| parent | 8e046a873ae0df5d7215103f69bcd0fcae5a2a00 (diff) | |
feat: Android support (again)
Diffstat (limited to 'android')
| -rw-r--r-- | android/AndroidManifest.xml | 29 | ||||
| -rw-r--r-- | android/build.gradle | 89 | ||||
| -rw-r--r-- | android/ic_launcher-web.png | bin | 0 -> 22195 bytes | |||
| -rw-r--r-- | android/proguard-rules.pro | 43 | ||||
| -rw-r--r-- | android/project.properties | 9 | ||||
| -rw-r--r-- | android/res/drawable-anydpi-v26/ic_launcher.xml | 6 | ||||
| -rw-r--r-- | android/res/drawable-anydpi-v26/ic_launcher_foreground.xml | 40 | ||||
| -rw-r--r-- | android/res/drawable-hdpi/ic_launcher.png | bin | 0 -> 16820 bytes | |||
| -rw-r--r-- | android/res/drawable-mdpi/ic_launcher.png | bin | 0 -> 16124 bytes | |||
| -rw-r--r-- | android/res/drawable-xhdpi/ic_launcher.png | bin | 0 -> 17915 bytes | |||
| -rw-r--r-- | android/res/drawable-xxhdpi/ic_launcher.png | bin | 0 -> 18746 bytes | |||
| -rw-r--r-- | android/res/drawable-xxxhdpi/ic_launcher.png | bin | 0 -> 19448 bytes | |||
| -rw-r--r-- | android/res/values-v21/styles.xml | 6 | ||||
| -rw-r--r-- | android/res/values/color.xml | 4 | ||||
| -rw-r--r-- | android/res/values/strings.xml | 6 | ||||
| -rw-r--r-- | android/res/values/styles.xml | 6 | ||||
| -rw-r--r-- | android/src/main/java/kz/ilotterytea/maxon/AndroidLauncher.java | 15 |
17 files changed, 253 insertions, 0 deletions
diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml new file mode 100644 index 0000000..352f4c1 --- /dev/null +++ b/android/AndroidManifest.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools"> + + <uses-feature android:glEsVersion="0x00020000" android:required="true" /> + + <application + android:allowBackup="true" + android:fullBackupContent="true" + android:icon="@drawable/ic_launcher" + android:isGame="true" + android:appCategory="game" + android:label="@string/app_name" + android:theme="@style/AppTheme" + tools:ignore="UnusedAttribute"> + <activity + android:name="kz.ilotterytea.maxon.AndroidLauncher" + android:label="@string/app_name" + android:screenOrientation="portrait" + android:configChanges="keyboard|keyboardHidden|navigation|orientation|screenSize|screenLayout" + android:exported="true"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + </application> + +</manifest> diff --git a/android/build.gradle b/android/build.gradle new file mode 100644 index 0000000..1b3a289 --- /dev/null +++ b/android/build.gradle @@ -0,0 +1,89 @@ +android { + namespace "kz.ilotterytea.maxon" + buildToolsVersion "35.0.0" + compileSdkVersion 35 + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = ['src'] + aidl.srcDirs = ['src'] + renderscript.srcDirs = ['src'] + res.srcDirs = ['res'] + assets.srcDirs = ['../assets'] + jniLibs.srcDirs = ['libs'] + } + + } + packagingOptions { + exclude 'META-INF/robovm/ios/robovm.xml' + } + defaultConfig { + applicationId "kz.ilotterytea.maxon" + minSdkVersion 19 + targetSdkVersion 35 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled true + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + + +// called every time gradle gets executed, takes the native dependencies of +// the natives configuration, and extracts them to the proper libs/ folders +// so they get packed with the APK. +tasks.register('copyAndroidNatives') { + doFirst { + file("libs/armeabi-v7a/").mkdirs() + file("libs/arm64-v8a/").mkdirs() + file("libs/x86_64/").mkdirs() + file("libs/x86/").mkdirs() + + configurations.natives.copy().files.each { jar -> + def outputDir = null + if (jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a") + if (jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a") + if (jar.name.endsWith("natives-x86_64.jar")) outputDir = file("libs/x86_64") + if (jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86") + if (outputDir != null) { + copy { + from zipTree(jar) + into outputDir + include "*.so" + } + } + } + } +} + +tasks.matching { it.name.contains("merge") && it.name.contains("JniLibFolders") }.configureEach { packageTask -> + packageTask.dependsOn 'copyAndroidNatives' +} + +tasks.register('run', Exec) { + def path + def localProperties = project.file("../local.properties") + if (localProperties.exists()) { + Properties properties = new Properties() + localProperties.withInputStream { instr -> + properties.load(instr) + } + def sdkDir = properties.getProperty('sdk.dir') + if (sdkDir) { + path = sdkDir + } else { + path = "$System.env.ANDROID_HOME" + } + } else { + path = "$System.env.ANDROID_HOME" + } + + def adb = path + "/platform-tools/adb" + commandLine "$adb", 'shell', 'am', 'start', '-n', 'kz.ilotterytea.maxon/kz.ilotterytea.maxon.AndroidLauncher' +} + +eclipse.project.name = appName + "-android" diff --git a/android/ic_launcher-web.png b/android/ic_launcher-web.png Binary files differnew file mode 100644 index 0000000..8f0110d --- /dev/null +++ b/android/ic_launcher-web.png diff --git a/android/proguard-rules.pro b/android/proguard-rules.pro new file mode 100644 index 0000000..bd5dddb --- /dev/null +++ b/android/proguard-rules.pro @@ -0,0 +1,43 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +-verbose + +-dontwarn com.badlogic.gdx.backends.android.AndroidFragmentApplication + +# Required if using libGDX Scene2d Skins (JSON Skin descriptors) +-keep public class com.badlogic.gdx.scenes.scene2d.** { *; } +-keep public class com.badlogic.gdx.graphics.g2d.BitmapFont { *; } +-keep public class com.badlogic.gdx.graphics.Color { *; } + +# Required if using Gdx-Controllers extension +# -keep class com.badlogic.gdx.controllers.android.AndroidControllers + +# Required if using Box2D extension +-keepclassmembers class com.badlogic.gdx.physics.box2d.World { + boolean contactFilter(long, long); + void beginContact(long); + void endContact(long); + void preSolve(long, long); + void postSolve(long, long); + boolean reportFixture(long); + float reportRayFixture(long, float, float, float, float, float); +} diff --git a/android/project.properties b/android/project.properties new file mode 100644 index 0000000..3fefa92 --- /dev/null +++ b/android/project.properties @@ -0,0 +1,9 @@ +# This file is used by the Eclipse ADT plugin. It is unnecessary for IDEA and Android Studio projects, which +# configure Proguard and the Android target via the build.gradle file. + +# To enable ProGuard to work with Eclipse ADT, uncomment this (available properties: sdk.dir, user.home) +# and ensure proguard.jar in the Android SDK is up to date (or alternately reduce the android target to 23 or lower): +# proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-rules.pro + +# Project target. +target=android-19 diff --git a/android/res/drawable-anydpi-v26/ic_launcher.xml b/android/res/drawable-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..6c7313a --- /dev/null +++ b/android/res/drawable-anydpi-v26/ic_launcher.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<adaptive-icon + xmlns:android="http://schemas.android.com/apk/res/android"> + <background android:drawable="@color/ic_background_color"/> + <foreground android:drawable="@drawable/ic_launcher_foreground"/> +</adaptive-icon> diff --git a/android/res/drawable-anydpi-v26/ic_launcher_foreground.xml b/android/res/drawable-anydpi-v26/ic_launcher_foreground.xml new file mode 100644 index 0000000..5916ee8 --- /dev/null +++ b/android/res/drawable-anydpi-v26/ic_launcher_foreground.xml @@ -0,0 +1,40 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="108dp" + android:height="108dp" + android:viewportWidth="108" + android:viewportHeight="108"> + <path + android:pathData="M22,48.667l2.987,0l0,10.667l-2.987,0z" + android:fillColor="#000000" + android:strokeColor="#00000000" + android:fillAlpha="1"/> + <path + android:pathData="M26.907,52.72l2.987,0l0,6.613l-2.987,0z" + android:fillColor="#000000" + android:strokeColor="#00000000" + android:fillAlpha="1"/> + <path + android:pathData="M26.907,48.667l2.987,0l0,2.56l-2.987,0z" + android:fillColor="#000000" + android:strokeColor="#00000000" + android:fillAlpha="1"/> + <path + android:pathData="M31.813,48.667L31.813,52.72 31.813,55.067 31.813,56.767 31.813,59.333l2.992,0 2.117,0c1.654,0 2.998,-1.481 2.998,-3.307 0,-1.826 -1.344,-3.307 -2.998,-3.307l-2.117,0L34.805,48.667ZM34.805,55.067l1.269,0c0.469,0 0.848,0.384 0.848,0.853 0,0.469 -0.379,0.847 -0.848,0.847l-1.269,0z" + android:fillColor="#000000" + android:strokeColor="#00000000" + android:fillAlpha="1"/> + <path + android:pathData="m44.192,48.667c-1.65,0 -2.992,1.481 -2.992,3.307 0,0.023 -0,0.044 0,0.067 0,0.004 -0,0.009 0,0.013l0,3.893c-0.001,0.027 0,0.053 0,0.08 0,1.826 1.341,3.307 2.992,3.307l2.112,0 0.247,0 2.739,0 0.247,0 2.112,0c1.651,0 2.992,-1.481 2.992,-3.307 0,-1.826 -1.341,-3.307 -2.992,-3.307l-1.199,0 -0.48,0 -2.372,0l0,2.347l2.372,0 0.48,0 0.353,0c0.468,0 0.846,0.384 0.846,0.853 0,0.469 -0.378,0.847 -0.846,0.847l-0.833,0 -0.433,0 -0.247,0 -2.739,0 -0.247,0 -0.433,0 -0.833,0c-0.459,0 -0.832,-0.363 -0.846,-0.82l0,-3.893 0,-0.013c0.021,-0.45 0.391,-0.807 0.846,-0.807l0.833,0 0.433,0 1.293,0l0,0.007L54.207,51.24L54.207,48.667l-4.917,0 -1.692,0 -1.293,0 -2.112,0z" + android:fillColor="#e74a45" + android:strokeColor="#00000000" + android:fillAlpha="1"/> + <path + android:pathData="M56.133,48.667L56.133,51.238l5.406,0 1.859,0 1.105,0 0.43,0 0.827,0c0.452,0 0.82,0.356 0.84,0.806l0,0.013 0,3.891c-0.014,0.456 -0.384,0.819 -0.84,0.819l-0.827,0 -0.43,0 -1.899,0 -1.065,0 -2.442,0L59.098,52.724L56.133,52.724l0,4.044 0,1.752 0,0.813l5.406,0 1.065,0 1.899,0 2.098,0c1.639,0 2.971,-1.48 2.971,-3.305 0,-0.027 0.001,-0.053 0,-0.08L69.573,52.058c0,-0.004 -0,-0.009 0,-0.013 0,-0.022 0,-0.044 0,-0.067 0,-1.825 -1.332,-3.305 -2.971,-3.305l-2.098,0 -1.105,0l0,-0.007L56.133,48.667Z" + android:fillColor="#e74a45" + android:strokeColor="#00000000" + android:fillAlpha="1"/> + <path + android:pathData="M69.572,48.667L73.72,48.667L77.787,52.733 81.853,48.667l4.147,0l-5.333,5.333 5.333,5.333L81.853,59.333L77.787,55.267 73.72,59.333l-4.147,0l5.333,-5.333z" + android:fillColor="#e74a45" + android:strokeColor="#00000000"/> +</vector> diff --git a/android/res/drawable-hdpi/ic_launcher.png b/android/res/drawable-hdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000..91f696b --- /dev/null +++ b/android/res/drawable-hdpi/ic_launcher.png diff --git a/android/res/drawable-mdpi/ic_launcher.png b/android/res/drawable-mdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000..c1ab239 --- /dev/null +++ b/android/res/drawable-mdpi/ic_launcher.png diff --git a/android/res/drawable-xhdpi/ic_launcher.png b/android/res/drawable-xhdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000..2011cc0 --- /dev/null +++ b/android/res/drawable-xhdpi/ic_launcher.png diff --git a/android/res/drawable-xxhdpi/ic_launcher.png b/android/res/drawable-xxhdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000..25fcef0 --- /dev/null +++ b/android/res/drawable-xxhdpi/ic_launcher.png diff --git a/android/res/drawable-xxxhdpi/ic_launcher.png b/android/res/drawable-xxxhdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000..d109946 --- /dev/null +++ b/android/res/drawable-xxxhdpi/ic_launcher.png diff --git a/android/res/values-v21/styles.xml b/android/res/values-v21/styles.xml new file mode 100644 index 0000000..fcc6217 --- /dev/null +++ b/android/res/values-v21/styles.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <style name="AppTheme" parent="android:Theme.Material.Light.NoActionBar.Fullscreen"> + <item name="android:colorBackground">@color/ic_background_color</item> + </style> +</resources> diff --git a/android/res/values/color.xml b/android/res/values/color.xml new file mode 100644 index 0000000..933353e --- /dev/null +++ b/android/res/values/color.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <color name="ic_background_color">#FFFFFFFF</color> +</resources> diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml new file mode 100644 index 0000000..cbe6c20 --- /dev/null +++ b/android/res/values/strings.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + <string name="app_name">Maxon Petting Simulator</string> + +</resources> diff --git a/android/res/values/styles.xml b/android/res/values/styles.xml new file mode 100644 index 0000000..77377af --- /dev/null +++ b/android/res/values/styles.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <style name="AppTheme" parent="android:Theme.Holo.Light.NoActionBar.Fullscreen"> + <item name="android:windowBackground">@color/ic_background_color</item> + </style> +</resources> diff --git a/android/src/main/java/kz/ilotterytea/maxon/AndroidLauncher.java b/android/src/main/java/kz/ilotterytea/maxon/AndroidLauncher.java new file mode 100644 index 0000000..94f678e --- /dev/null +++ b/android/src/main/java/kz/ilotterytea/maxon/AndroidLauncher.java @@ -0,0 +1,15 @@ +package kz.ilotterytea.maxon; + +import android.os.Bundle; + +import com.badlogic.gdx.backends.android.AndroidApplication; +import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; + +public class AndroidLauncher extends AndroidApplication { + @Override + protected void onCreate (Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); + initialize(MaxonGame.getInstance(), config); + } +} |
