Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions platform/android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ val parsedBuildProperties: JsonObject = run {
}

extra["minSdkVersion"] = parsedBuildProperties.lookup<Any?>("buildSettings.android.minSdkVersion").firstOrNull()?.toString()?.toIntOrNull()
?: 15
?: 21

val coronaBuilder = if (windows) {
"$nativeDir/Corona/win/bin/CoronaBuilder.exe"
Expand Down Expand Up @@ -195,10 +195,10 @@ android {
lintOptions {
isCheckReleaseBuilds = true
}
compileSdk = 35
compileSdk = 36
defaultConfig {
applicationId = coronaAppPackage
targetSdk = 35
targetSdk = 36
minSdk = (extra["minSdkVersion"] as Int)
versionCode = coronaVersionCode
versionName = coronaVersionName
Expand Down Expand Up @@ -1150,4 +1150,5 @@ dependencies {
implementation(project(":plugin"))
}
implementation("androidx.multidex:multidex:2.0.1")
implementation("androidx.core:core:1.17.0")
}
4 changes: 2 additions & 2 deletions platform/android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ buildscript {
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21")
classpath("com.android.tools.build:gradle:8.8.0")
classpath("com.beust:klaxon:5.5")
classpath("com.android.tools.build:gradle:8.13.0")
classpath("com.beust:klaxon:5.6")
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
9 changes: 7 additions & 2 deletions platform/android/sdk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ val buildDirectory = layout.buildDirectory.asFile.get()
android {
namespace = "com.ansca.corona"
ndkVersion = "18.1.5063045"
compileSdk = 35
compileSdk = 36

defaultConfig {
minSdk = 15
minSdk = 21
version = 1
}
sourceSets["main"].manifest.srcFile(file("AndroidManifest-New.xml"))
Expand All @@ -27,6 +27,11 @@ android {

}

// Need for Android Edge To Edge
dependencies {
implementation("androidx.core:core:1.17.0")
}

tasks.create<Copy>("updateWidgetResources") {
group = "Corona"
val widgetResLocation = "$buildDirectory/generated/widgetResources"
Expand Down
19 changes: 19 additions & 0 deletions platform/android/sdk/src/com/ansca/corona/CoronaActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
import com.ansca.corona.storage.ResourceServices;
import android.view.DisplayCutout;
import android.view.ViewTreeObserver;

import androidx.core.view.WindowCompat;

/**
* The activity window that hosts the Corona project.
* @see <a href="http://developer.android.com/reference/android/app/Activity.html">Activity</a>
Expand Down Expand Up @@ -190,6 +193,7 @@ protected void onCreate(Bundle savedInstanceState) {

fStartTime = System.currentTimeMillis();


// Work around FileProvider issue in level 25:
// http://stackoverflow.com/questions/38200282/android-os-fileuriexposedexception-file-storage-emulated-0-test-txt-exposed
// TODO: Fix this properly by using FileProvider appropriately
Expand Down Expand Up @@ -281,6 +285,21 @@ protected void onCreate(Bundle savedInstanceState) {
ex.printStackTrace();
}

// Set edgeToEdge before splashScreen comes up
try {
android.content.pm.ActivityInfo activityInfo;
activityInfo = getPackageManager().getActivityInfo(getComponentName(), android.content.pm.PackageManager.GET_META_DATA);
if ((activityInfo != null) && (activityInfo.metaData != null)) {
Boolean edgeToEdge = activityInfo.metaData.getBoolean("edgeToEdge");
if (edgeToEdge == true) {
WindowCompat.enableEdgeToEdge(getWindow());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can potentially backfire as we aren't using compat anywhere else. Got to think on it.

}
}
}
catch (Exception ex) {
ex.printStackTrace();
}

// fCoronaRuntime = new CoronaRuntime(this, false); // for Tegra debugging

showCoronaSplashScreen();
Expand Down
29 changes: 15 additions & 14 deletions platform/android/sdk/src/com/ansca/corona/NativeToJavaBridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -3303,24 +3303,25 @@ protected static void callSetNavigationBarColor(CoronaRuntime runtime, double re
(int)(255 * blue)
);

Window window = activity.getWindow();
View decorView = window.getDecorView();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) { // Android 15+
Window window = activity.getWindow();
View decorView = window.getDecorView();
// Add bottom insert
decorView.setOnApplyWindowInsetsListener((view, insets) -> {
Insets navBarInsets = insets.getInsets(WindowInsets.Type.navigationBars());
view.setBackgroundColor(color);
view.setPadding(0, 0, 0, navBarInsets.bottom);
return insets;
});
decorView.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
@Override
public WindowInsets onApplyWindowInsets(View view, WindowInsets insets) {
Insets statusBarInsets = insets.getInsets(WindowInsets.Type.statusBars());
view.setBackgroundColor(color);

window.setNavigationBarColor(color);
// Update Insert
decorView.post(() -> {
decorView.requestApplyInsets();
// Adjust padding to avoid overlap
view.setPadding(0, statusBarInsets.top, 0, 0);
return insets;
}
});
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// For Android 14 and below
window.setStatusBarColor(color);
} else {
CoronaEnvironment.getCoronaActivity().setNavigationBarColor(red, green, blue);
Log.i( "Corona", "WARNING: SetNavigationBarColor is not support on this version of Android" );
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,11 @@ public class StoreActivity extends android.app.Activity {
protected void onCreate(android.os.Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

// Do not continue if a Nook EAN was not provided.
if (getIntent().getStringExtra(EXTRA_NOOK_APP_EAN) == null) {
finish();
return;
}

// Only lock orientation on devices that don’t support multi-window / resizable
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.N) {
int orientation = android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
if (android.os.Build.VERSION.SDK_INT >= 9) {
orientation = android.content.pm.ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
}
setRequestedOrientation(orientation);
}

// Display this activity full screen if requested
boolean isFullScreen = getIntent().getBooleanExtra(EXTRA_FULL_SCREEN, false);
if (isFullScreen) {
getWindow().addFlags(android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN);
Expand All @@ -76,9 +65,9 @@ protected void onCreate(android.os.Bundle savedInstanceState) {
getWindow().clearFlags(android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN);
}

// Initialize this flag to false
fHasShownStore = false;
}

/** This method is called when this activity can be interacted with. */
@Override
protected void onResume() {
Expand Down
1 change: 1 addition & 0 deletions platform/android/template/AndroidManifest.template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
@USER_CORONA_WINDOW_MOVES_WHEN_KEYBOARD_APPEARS@
@USER_INITIAL_SYSTEM_UI_VISIBILITY@
@USER_REQUESTED_DEFAULT_ORIENTATION@
@USER_EDGE_TO_EDGE@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@USER_MAIN_INTENT_FILTER_CATEGORIES@
Expand Down
1 change: 1 addition & 0 deletions platform/android/template/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
@USER_CORONA_WINDOW_MOVES_WHEN_KEYBOARD_APPEARS@
@USER_INITIAL_SYSTEM_UI_VISIBILITY@
@USER_REQUESTED_DEFAULT_ORIENTATION@
@USER_EDGE_TO_EDGE@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@USER_MAIN_INTENT_FILTER_CATEGORIES@
Expand Down
16 changes: 16 additions & 0 deletions platform/android/template/update_manifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ local googlePlayGamesAppId = false
local facebookAppId = false
local coronaWindowMovesWhenKeyboardAppears = false
local initialSystemUiVisibility = nil
local edgeToEdge = true
local allowAppsReadOnlyAccessToFiles = true
local strings = {}
local apkFiles = { "...NONE..." } -- necessary due to the way ant treats empty filelists
Expand Down Expand Up @@ -528,6 +529,11 @@ if "table" == type(buildSettings) then
initialSystemUiVisibility = buildSettings.android.initialSystemUiVisibility
end

-- Fetch the "EdgeToEdge" flag used to set the edge to edge before the splashScreen is shown.
if type(buildSettings.android.edgeToEdge) == "boolean" then
edgeToEdge = buildSettings.android.edgeToEdge
end

-- Fetch a flag indicating if Corona's FileContentProvider should provide public read-only access to files.
if type(buildSettings.android.allowAppsReadOnlyAccessToFiles) == "boolean" then
allowAppsReadOnlyAccessToFiles = buildSettings.android.allowAppsReadOnlyAccessToFiles
Expand Down Expand Up @@ -714,6 +720,16 @@ if initialSystemUiVisibility then
end
manifestKeys.USER_INITIAL_SYSTEM_UI_VISIBILITY = stringBuffer


-- Create a meta-data tag for the "Edge to Edge" setting, if provided.
stringBuffer = ""
if edgeToEdge then
stringBuffer = '<meta-data android:name="edgeToEdge" android:value="true" />'
else
stringBuffer = '<meta-data android:name="edgeToEdge" android:value="false" />'
end
manifestKeys.USER_EDGE_TO_EDGE = stringBuffer

-- Create a "largeHeap" application tag attribute if set.
stringBuffer = ""
if largeHeap == true then
Expand Down
Loading