Skip to content

Commit b6eeb97

Browse files
rh101halx99
authored andcommitted
AxmolActivity will extend AppCompatActivity
Min SDK set to 21 Tests updated to support AppCompatActivity MultiDexEnabled for cpp-tests
1 parent bf32039 commit b6eeb97

File tree

13 files changed

+33
-25
lines changed

13 files changed

+33
-25
lines changed

1k/build.profiles

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ target_sdk=35
5454

5555
# The android min sdk version, @gradle
5656
# as min as possible
57-
min_sdk=17
57+
min_sdk=21
5858

5959
# The gradle version, @setup.ps1
6060
# as latest as possible

core/platform/android/java/src/dev/axmol/lib/AxmolActivity.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ of this software and associated documentation files (the "Software"), to deal
2525
****************************************************************************/
2626
package dev.axmol.lib;
2727

28-
import android.app.Activity;
2928
import android.app.KeyguardManager;
3029
import android.content.Context;
3130
import android.content.Intent;
@@ -46,14 +45,16 @@ of this software and associated documentation files (the "Software"), to deal
4645
import android.view.Window;
4746
import android.view.WindowManager;
4847

48+
import androidx.appcompat.app.AppCompatActivity;
49+
4950
import dev.axmol.lib.AxmolEngine.AxmolEngineListener;
5051

5152
import javax.microedition.khronos.egl.EGL10;
5253
import javax.microedition.khronos.egl.EGLConfig;
5354
import javax.microedition.khronos.egl.EGLDisplay;
5455
import javax.microedition.khronos.egl.EGLContext;
5556

56-
public abstract class AxmolActivity extends Activity implements AxmolEngineListener {
57+
public abstract class AxmolActivity extends AppCompatActivity implements AxmolEngineListener {
5758
// ===========================================================
5859
// Constants
5960
// ===========================================================

core/platform/android/java/src/dev/axmol/lib/AxmolEngine.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ of this software and associated documentation files (the "Software"), to deal
3030
import android.content.pm.PackageManager;
3131
import android.graphics.Rect;
3232
import android.media.AudioManager;
33-
import android.app.Activity;
3433
import android.content.ComponentName;
3534
import android.content.Context;
3635
import android.content.Intent;
@@ -59,6 +58,8 @@ of this software and associated documentation files (the "Software"), to deal
5958
import android.view.WindowInsets;
6059
import android.view.WindowManager;
6160

61+
import androidx.appcompat.app.AppCompatActivity;
62+
6263
import com.android.vending.expansion.zipfile.APKExpansionSupport;
6364
import com.android.vending.expansion.zipfile.ZipResourceFile;
6465

@@ -95,7 +96,7 @@ public class AxmolEngine {
9596
private static boolean sCompassEnabled;
9697
private static boolean sActivityVisible;
9798
private static String sPackageName;
98-
private static Activity sActivity = null;
99+
private static AppCompatActivity sActivity = null;
99100
private static AxmolEngineListener sAxmolEngineListener;
100101
private static Set<OnActivityResultListener> onActivityResultListeners = new LinkedHashSet<OnActivityResultListener>();
101102
private static Vibrator sVibrateService = null;
@@ -128,7 +129,7 @@ public void run() {
128129
}
129130

130131
private static boolean sInited = false;
131-
public static void init(final Activity activity) {
132+
public static void init(final AppCompatActivity activity) {
132133
sActivity = activity;
133134
AxmolEngine.sAxmolEngineListener = (AxmolEngineListener)activity;
134135
if (!sInited) {
@@ -202,7 +203,7 @@ public static ZipResourceFile getObbFile() {
202203
return sOBBFile;
203204
}
204205

205-
public static Activity getActivity() {
206+
public static AppCompatActivity getActivity() {
206207
return sActivity;
207208
}
208209

core/platform/android/java/src/dev/axmol/lib/AxmolMediaEngine.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ of this software and associated documentation files (the "Software"), to deal
2323
****************************************************************************/
2424
package dev.axmol.lib;
2525

26-
import android.app.Activity;
2726
import android.content.Context;
2827
import android.media.MediaCodecInfo;
2928
import android.media.MediaFormat;
@@ -32,6 +31,7 @@ of this software and associated documentation files (the "Software"), to deal
3231
import android.util.Log;
3332

3433
import androidx.annotation.Nullable;
34+
import androidx.appcompat.app.AppCompatActivity;
3535
import androidx.media3.common.Format;
3636
import androidx.media3.common.MediaItem;
3737
import androidx.media3.common.PlaybackException;
@@ -127,7 +127,7 @@ public class AxmolMediaEngine extends DefaultRenderersFactory implements Player.
127127

128128
public static native void nativeStoreCurrentTime(long nativeObj, double currentTime);
129129

130-
public static void setContext(Activity activity) {
130+
public static void setContext(AppCompatActivity activity) {
131131
sContext = activity.getApplicationContext();
132132
}
133133

core/platform/android/libaxmol/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ dependencies {
5555
//api "androidx.media3:media3-exoplayer-ima:$media3_version"
5656

5757
implementation "androidx.annotation:annotation:$annotation_ver"
58+
implementation "androidx.appcompat:appcompat:$appcompat_ver"
5859

5960
api ("com.google.guava:guava:$guava_ver-android") {
6061
// Exclude dependencies that are only used by Guava at compile time

templates/common/proj.android/app/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
android:screenOrientation="sensorLandscape"
1919
android:configChanges="orientation|keyboardHidden|screenSize"
2020
android:label="@string/app_name"
21-
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
21+
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
2222
android:launchMode="singleTask"
2323
android:taskAffinity=""
2424
android:exported="true" >

tests/cpp-tests/proj.android/app/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
android:screenOrientation="sensorLandscape"
2222
android:configChanges="orientation|keyboardHidden|screenSize"
2323
android:label="@string/app_name"
24-
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
24+
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
2525
android:launchMode="singleTask"
2626
android:taskAffinity=""
2727
android:exported="true" >

tests/cpp-tests/proj.android/app/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ android {
3737
ndk {
3838
abiFilters = __1K_ARCHS.split(':').collect{it as String}
3939
}
40+
41+
multiDexEnabled true
4042
}
4143

4244
sourceSets.main {
@@ -112,6 +114,9 @@ android.applicationVariants.configureEach { variant ->
112114
dependencies {
113115
implementation fileTree(dir: 'libs', include: ['*.jar'])
114116
implementation project(':libaxmol')
117+
118+
implementation 'androidx.appcompat:appcompat:1.7.0'
119+
//implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.22"))
115120
}
116121

117122
project.afterEvaluate {

tests/cpp-tests/proj.android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ __1K_ARCHS=arm64-v8a
3030

3131
android.injected.testOnly=false
3232
android.useAndroidX=true
33-
33+
android.enableJetifier=true

tests/fairygui-tests/proj.android/app/AndroidManifest.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@
33
android:installLocation="auto">
44

55
<uses-feature android:glEsVersion="0x00020000" />
6-
6+
77
<application
88
android:usesCleartextTraffic="true"
99
android:label="@string/app_name"
1010
android:allowBackup="true"
1111
android:icon="@mipmap/ic_launcher">
12-
12+
1313
<!-- Tell AxmolActivity the name of our .so -->
1414
<meta-data android:name="android.app.lib_name"
1515
android:value="fairygui-tests" />
16-
16+
1717
<activity
1818
android:name=".AppActivity"
1919
android:screenOrientation="sensorLandscape"
2020
android:configChanges="orientation|keyboardHidden|screenSize"
2121
android:label="@string/app_name"
22-
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
22+
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
2323
android:launchMode="singleTask"
2424
android:taskAffinity=""
2525
android:exported="true" >

0 commit comments

Comments
 (0)