Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1ae31cc4 authored by Daniel Hunt's avatar Daniel Hunt Committed by Edward Savage-Jones
Browse files

Correct colors for icons in "Search settings" for dark theme

Create a themed app context with theme from R.style.Theme_Settings.
After that create a context with theme from themed app context
before getting the drawable from the package.

Bug: 139695450
Test: Manual - set dark theme and search for 'media volume'
      in settings. The icon should be visible
Change-Id: I40ea745046074ddd80c01cb35ebaf566ffa80b74
parent c12771af
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -27,7 +27,9 @@ import android.graphics.drawable.Drawable;
import android.os.BadParcelableException;
import android.text.TextUtils;
import android.util.Log;
import android.view.ContextThemeWrapper;

import com.android.settings.intelligence.R;
import com.android.settings.intelligence.search.ResultPayload;
import com.android.settings.intelligence.search.ResultPayloadUtils;
import com.android.settings.intelligence.search.SearchResult;
@@ -162,7 +164,11 @@ public class CursorToSearchResultConverter {
        Context packageContext = contextMap.get(pkgName);
        if (packageContext == null) {
            try {
                packageContext = mContext.createPackageContext(pkgName, 0);
                final Context themedAppContext = new ContextThemeWrapper(
                        mContext, R.style.Theme_Settings);
                packageContext = new ContextThemeWrapper(
                        themedAppContext.createPackageContext(pkgName, 0),
                        themedAppContext.getTheme());
                contextMap.put(pkgName, packageContext);
            } catch (PackageManager.NameNotFoundException e) {
                Log.e(TAG, "Cannot create Context for package: " + pkgName);