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

Commit 08e2a4b5 authored by Xavier Ducrohet's avatar Xavier Ducrohet
Browse files

Fix handling of reference XML file in layout files

This allows layout that references animation to properly load
in the layout editor in ADT
parent 7953e7d8
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -53,6 +53,8 @@ public final class ServiceManager {
     * Return a list of all currently running services.
     */
    public static String[] listServices() throws RemoteException {
        // actual implementation returns null sometimes, so it's ok
        // to return null instead of an empty list.
        return null;
    }

+2 −0
Original line number Diff line number Diff line
@@ -87,6 +87,8 @@ public final class AccessibilityManager {
     * @return An unmodifiable list with {@link ServiceInfo}s.
     */
    public List<ServiceInfo> getAccessibilityServiceList() {
        // normal implementation does this in some case, so let's do the same
        // (unmodifiableList wrapped around null).
        List<ServiceInfo> services = null;
        return Collections.unmodifiableList(services);
    }
+78 −46
Original line number Diff line number Diff line
@@ -385,6 +385,11 @@ public final class BridgeResources extends Resources {
                if (ResourceHelper.stringToFloat(v, outValue)) {
                    return;
                }

                // else it's a string
                outValue.type = TypedValue.TYPE_STRING;
                outValue.string = v;
                return;
            }
        }

@@ -435,6 +440,33 @@ public final class BridgeResources extends Resources {
        return null;
    }

    @Override
    public XmlResourceParser loadXmlResourceParser(String file, int id,
            int assetCookie, String type) throws NotFoundException {
        // even though we know the XML file to load directly, we still need to resolve the
        // id so that we can know if it's a platform or project resource.
        // (mPlatformResouceFlag will get the result and will be used later).
        getResourceValue(id, mPlatformResourceFlag);

        File f = new File(file);
        try {
            KXmlParser parser = new KXmlParser();
            parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
            parser.setInput(new FileReader(f));

            return new BridgeXmlBlockParser(parser, mContext, mPlatformResourceFlag[0]);
        } catch (XmlPullParserException e) {
            NotFoundException newE = new NotFoundException();
            newE.initCause(e);
            throw newE;
        } catch (FileNotFoundException e) {
            NotFoundException newE = new NotFoundException();
            newE.initCause(e);
            throw newE;
        }
    }


    @Override
    public InputStream openRawResource(int id) throws NotFoundException {
        IResourceValue value = getResourceValue(id, mPlatformResourceFlag);