From ada2ea57b410f4037f020017b1c3812ebca22b6a Mon Sep 17 00:00:00 2001 From: Anas Karbila Date: Thu, 20 Apr 2017 21:44:13 +0900 Subject: [PATCH] Settings: PreviewPagerAdapter: copy the full theme getThemeResId() returns the theme resource id which is defined inside AndroidManifest.xml. If you set a theme via code (or add extra attributes using applyStyle method), the new theme will not be carried over. Fix this by using setTo method with the context theme as argument. Issue: https://issuetracker.google.com/37543358 Test: set new theme via code (or add extra attributes using applyStyle method) and check if they are carried over to the configContext context Change-Id: I82739fe47b2d5b2d05da4cb3759b630b10dc8c8f --- src/com/android/settings/PreviewPagerAdapter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/settings/PreviewPagerAdapter.java b/src/com/android/settings/PreviewPagerAdapter.java index 50015183ddd..bb68055d7cb 100644 --- a/src/com/android/settings/PreviewPagerAdapter.java +++ b/src/com/android/settings/PreviewPagerAdapter.java @@ -74,7 +74,7 @@ public class PreviewPagerAdapter extends PagerAdapter { // Create a new configuration for the specified value. It won't // have any theme set, so manually apply the current theme. final Context configContext = context.createConfigurationContext(configurations[j]); - configContext.setTheme(context.getThemeResId()); + configContext.getTheme().setTo(context.getTheme()); final LayoutInflater configInflater = LayoutInflater.from(configContext); final ViewStub sampleViewStub = new ViewStub(configContext);