From ade5e1f1cab0a7a2678df2fbd4f161157ebd1279 Mon Sep 17 00:00:00 2001 From: Julian Winkler Date: Wed, 23 Oct 2024 16:35:58 +0200 Subject: [PATCH] Activity: set windowBackground on start This overwrites the GTK window backgrounds and therefore makes theming more consistent when GTK theme and Android theme doesn't match. --- src/api-impl/android/app/Activity.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/api-impl/android/app/Activity.java b/src/api-impl/android/app/Activity.java index 87d4c75e..d76f62ac 100644 --- a/src/api-impl/android/app/Activity.java +++ b/src/api-impl/android/app/Activity.java @@ -8,6 +8,8 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageParser; import android.content.res.Configuration; +import android.content.res.TypedArray; +import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.os.Handler; @@ -170,6 +172,12 @@ public class Activity extends ContextThemeWrapper implements Window.Callback { fragment.onStart(); } + TypedArray ta = obtainStyledAttributes(new int[] {R.attr.windowBackground}); + Drawable background = ta.getDrawable(0); + if (background != null) + window.setBackgroundDrawable(background); + ta.recycle(); + return; }