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

Commit 196b7313 authored by Diego Perez's avatar Diego Perez
Browse files

Set the correct class loader in Resources

The class loader in Resources is now used to inflate drawables. Because
layoutlib was using the system class loader, the drawables would fail to
inflate.
With this change, Resources will use the layoutlib class loader instead
of the system one.

Test: Tested from the studio side
Change-Id: I933ff68e704f9d3599b69cd74e98e44bdca3c789
parent 789c4b4b
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.LruCache;
import android.util.TypedValue;
import android.view.DisplayAdjustments;
import android.view.ViewGroup.LayoutParams;

import java.io.File;
@@ -71,7 +72,8 @@ public class Resources_Delegate {
            DisplayMetrics metrics,
            Configuration config,
            LayoutlibCallback layoutlibCallback) {
        Resources resources = new Resources(assets, metrics, config);
        Resources resources = new Resources(Resources_Delegate.class.getClassLoader());
        resources.setImpl(new ResourcesImpl(assets, metrics, config, new DisplayAdjustments()));
        resources.mContext = context;
        resources.mLayoutlibCallback = layoutlibCallback;
        return Resources.mSystem = resources;