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.
This commit is contained in:
Julian Winkler
2024-10-23 16:35:58 +02:00
parent bcdf3eb3ce
commit ade5e1f1ca

View File

@@ -8,6 +8,8 @@ import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.PackageParser; import android.content.pm.PackageParser;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
@@ -170,6 +172,12 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
fragment.onStart(); fragment.onStart();
} }
TypedArray ta = obtainStyledAttributes(new int[] {R.attr.windowBackground});
Drawable background = ta.getDrawable(0);
if (background != null)
window.setBackgroundDrawable(background);
ta.recycle();
return; return;
} }