Fix splash screen loading and improve Edge to Edge feature

This commit is contained in:
Simon Stürz 2026-01-12 16:55:23 +01:00
parent 4f7c97dc4a
commit 983911c202
4 changed files with 25 additions and 10 deletions

@ -1 +1 @@
Subproject commit 4ab1f560a95294c9e5abac569943e8219dc89b77 Subproject commit 725c6fd690b878959d81c0b4068394e77683fd7f

View File

@ -17,7 +17,6 @@ import android.content.IntentFilter;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.location.LocationManager; import android.location.LocationManager;
import androidx.core.content.FileProvider; import androidx.core.content.FileProvider;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowCompat; import androidx.core.view.WindowCompat;
import android.view.WindowInsets; import android.view.WindowInsets;
import android.graphics.Insets; import android.graphics.Insets;
@ -32,6 +31,7 @@ public class NymeaAppActivity extends QtActivity
{ {
private static final String TAG = "nymea-app: NymeaAppActivity"; private static final String TAG = "nymea-app: NymeaAppActivity";
private static Context context = null; private static Context context = null;
private boolean mDecorFitsSystemWindows = true;
private static native void darkModeEnabledChangedJNI(); private static native void darkModeEnabledChangedJNI();
private static native void notificationActionReceivedJNI(String data); private static native void notificationActionReceivedJNI(String data);
@ -50,7 +50,13 @@ public class NymeaAppActivity extends QtActivity
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
Log.w(TAG, "Create activity"); Log.w(TAG, "Create activity");
setTheme(R.style.NormalTheme);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= 35) {
// Let the system handle insets to avoid double padding in Qt content.
WindowCompat.setDecorFitsSystemWindows(getWindow(), true);
mDecorFitsSystemWindows = true;
}
// Move th app to the background (Edge to edge is forced since SDK 35) // Move th app to the background (Edge to edge is forced since SDK 35)
//WindowCompat.setDecorFitsSystemWindows(getWindow(), true); //WindowCompat.setDecorFitsSystemWindows(getWindow(), true);
this.context = getApplicationContext(); this.context = getApplicationContext();
@ -150,7 +156,7 @@ public class NymeaAppActivity extends QtActivity
} }
public int topPadding() { public int topPadding() {
if (Build.VERSION.SDK_INT < 35) { if (mDecorFitsSystemWindows || Build.VERSION.SDK_INT < 35) {
return 0; return 0;
} }
@ -169,7 +175,7 @@ public class NymeaAppActivity extends QtActivity
} }
public int bottomPadding() { public int bottomPadding() {
if (Build.VERSION.SDK_INT < 35) { if (mDecorFitsSystemWindows || Build.VERSION.SDK_INT < 35) {
return 0; return 0;
} }
@ -187,7 +193,7 @@ public class NymeaAppActivity extends QtActivity
} }
public int leftPadding() { public int leftPadding() {
if (Build.VERSION.SDK_INT < 35) { if (mDecorFitsSystemWindows || Build.VERSION.SDK_INT < 35) {
return 0; return 0;
} }
@ -205,7 +211,7 @@ public class NymeaAppActivity extends QtActivity
} }
public int rightPadding() { public int rightPadding() {
if (Build.VERSION.SDK_INT < 35) { if (mDecorFitsSystemWindows || Build.VERSION.SDK_INT < 35) {
return 0; return 0;
} }

View File

@ -31,6 +31,10 @@
#include <QJniObject> #include <QJniObject>
#include <QTimer> #include <QTimer>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QtAndroid>
#endif
// WindowManager.LayoutParams // WindowManager.LayoutParams
#define FLAG_TRANSLUCENT_STATUS 0x04000000 #define FLAG_TRANSLUCENT_STATUS 0x04000000
#define FLAG_TRANSLUCENT_NAVIGATION 0x08000000 #define FLAG_TRANSLUCENT_NAVIGATION 0x08000000
@ -110,10 +114,15 @@ void PlatformHelperAndroid::hideSplashScreen()
{ {
// Android's splash will flicker when fading out twice // Android's splash will flicker when fading out twice
static bool alreadyHiding = false; static bool alreadyHiding = false;
if (!alreadyHiding) { if (alreadyHiding) {
//QtAndroid::hideSplashScreen(250); return;
alreadyHiding = true;
} }
alreadyHiding = true;
PlatformHelper::hideSplashScreen();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QtAndroid::hideSplashScreen(250);
#endif
} }
QString PlatformHelperAndroid::machineHostname() const QString PlatformHelperAndroid::machineHostname() const

@ -1 +1 @@
Subproject commit b57d178bf33ca647798b4ff02d63869b2b15fa4d Subproject commit a1226a693739b02ab3b3d6123fb2508712fe5f80