Fix theme selection for android

pull/1135/head
Simon Stürz 2026-01-13 12:28:48 +01:00
parent d88c0f7897
commit 1b6b0156bc
2 changed files with 13 additions and 2 deletions

View File

@ -50,7 +50,13 @@ public class NymeaAppActivity extends QtActivity
@Override
public void onCreate(Bundle savedInstanceState) {
Log.w(TAG, "Create activity");
setTheme(R.style.NormalTheme);
int themeId = resolveStyleResource("NormalTheme");
if (themeId != 0) {
setTheme(themeId);
} else {
Log.w(TAG, "NormalTheme style missing, falling back to system theme");
setTheme(android.R.style.Theme_DeviceDefault_DayNight);
}
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= 35) {
// Let the system handle insets to avoid double padding in Qt content.
@ -259,4 +265,9 @@ public class NymeaAppActivity extends QtActivity
Log.e(TAG, "Failed to inspect android.app.static_init_classes meta-data", exception);
}
}
private int resolveStyleResource(String resourceName) {
// Resolve app resources dynamically to support branded package names.
return getResources().getIdentifier(resourceName, "style", getPackageName());
}
}

View File

@ -1,2 +1,2 @@
1.11.2
698
699