From dfa16620330d9785460c379fd9edda8ff1fbbd00 Mon Sep 17 00:00:00 2001 From: Julian Winkler Date: Fri, 10 Jan 2025 18:21:55 +0100 Subject: [PATCH] Theme.obtainStyledAttributes() set theme of returned TypedArray This is needed to infalte ColorStateLists properly --- src/api-impl/android/content/res/Resources.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/api-impl/android/content/res/Resources.java b/src/api-impl/android/content/res/Resources.java index 20fa8004..1f74e924 100644 --- a/src/api-impl/android/content/res/Resources.java +++ b/src/api-impl/android/content/res/Resources.java @@ -1270,6 +1270,7 @@ public class Resources { int len = attrs.length; TypedArray array = getCachedStyledAttributes(len); array.mRsrcs = attrs; + array.mTheme = this; mAssets.applyStyle(theme, 0, 0, null, attrs, array.mData, array.mIndices); return array; } @@ -1299,6 +1300,7 @@ public class Resources { int len = attrs.length; TypedArray array = getCachedStyledAttributes(len); array.mRsrcs = attrs; + array.mTheme = this; mAssets.applyStyle(theme, 0, resid, null, attrs, array.mData, array.mIndices); if (false) { @@ -1392,6 +1394,7 @@ public class Resources { set, attrs, array.mData, array.mIndices); array.mRsrcs = attrs; array.mXml = parser; + array.mTheme = this; if (false && set != null) { // TODO: set should probably never be null...? int[] data = array.mData;