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

Commit 171a2a93 authored by Jerome Gaillard's avatar Jerome Gaillard Committed by Android (Google) Code Review
Browse files

Merge "Get color state list file content from PSI instead of disk" into mnc-ub-dev

parents 3b90b74c b63da06a
Loading
Loading
Loading
Loading
+23 −16
Original line number Diff line number Diff line
@@ -327,12 +327,19 @@ public final class BridgeTypedArray extends TypedArray {
            return null;
        }

        // let the framework inflate the ColorStateList from the XML file.

        try {
            // Get the state list file content from callback to parse PSI file
            XmlPullParser parser = mContext.getLayoutlibCallback().getXmlFileParser(value);
            if (parser == null) {
                // If used with a version of Android Studio that does not implement getXmlFileParser
                // fall back to reading the file from disk
                File f = new File(value);
                if (f.isFile()) {
            try {
                XmlPullParser parser = ParserFactory.create(f);

                    parser = ParserFactory.create(f);
                }
            }
            if (parser != null) {
                BridgeXmlBlockParser blockParser = new BridgeXmlBlockParser(
                        parser, mContext, resValue.isFramework());
                try {
@@ -341,6 +348,7 @@ public final class BridgeTypedArray extends TypedArray {
                } finally {
                    blockParser.ensurePopped();
                }
            }
        } catch (XmlPullParserException e) {
            Bridge.getLog().error(LayoutLog.TAG_BROKEN,
                    "Failed to configure parser for " + value, e, null);
@@ -353,7 +361,6 @@ public final class BridgeTypedArray extends TypedArray {

            return null;
        }
        }

        try {
            int color = ResourceHelper.getColor(value);