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

Commit a0a51b6f authored by Diego Perez's avatar Diego Perez
Browse files

Fix broken delegates for FontFamily and PathParser

The theme editor is throwing an exception with the last embedded
layoutlib because a missing method. Added also another missing method in
FontFamily.

Change-Id: I710ba7618df6444a3185b581cdc5dc8400f7c604
parent 73c9391d
Loading
Loading
Loading
Loading
+18 −10
Original line number Diff line number Diff line
@@ -245,6 +245,13 @@ public class FontFamily_Delegate {
        return sFontLocation;
    }

    // ---- delegate methods ----
    @LayoutlibDelegate
    /*package*/ static boolean addFont(FontFamily thisFontFamily, String path, int ttcIndex) {
        final FontFamily_Delegate delegate = getDelegate(thisFontFamily.mNativePtr);
        return delegate != null && delegate.addFont(path, ttcIndex);
    }

    // ---- native methods ----

    @LayoutlibDelegate
@@ -270,16 +277,8 @@ public class FontFamily_Delegate {
    }

    @LayoutlibDelegate
    /*package*/ static boolean nAddFont(long nativeFamily, final String path, int ttcIndex) {
        // FIXME: support ttc fonts. Hack JRE??
        final FontFamily_Delegate delegate = getDelegate(nativeFamily);
        if (delegate != null) {
            if (sFontLocation == null) {
                delegate.mPostInitRunnables.add(() -> delegate.addFont(path));
                return true;
            }
            return delegate.addFont(path);
        }
    /*package*/ static boolean nAddFont(long nativeFamily, ByteBuffer font, int ttcIndex) {
        assert false : "The only client of this method has been overriden.";
        return false;
    }

@@ -390,6 +389,15 @@ public class FontFamily_Delegate {
        mPostInitRunnables = null;
    }

    private boolean addFont(final String path, int ttcIndex) {
        // FIXME: support ttc fonts. Hack JRE??
        if (sFontLocation == null) {
            mPostInitRunnables.add(() -> addFont(path));
            return true;
        }
        return addFont(path);
    }

     private boolean addFont(@NonNull String path) {
         return addFont(path, DEFAULT_FONT_WEIGHT, path.endsWith(FONT_SUFFIX_ITALIC));
     }
+2 −3
Original line number Diff line number Diff line
@@ -64,15 +64,14 @@ public class PathParser_Delegate {
    }

    @LayoutlibDelegate
    /*package*/ static boolean nParseStringForPath(long pathPtr, @NonNull String pathString, int
    /*package*/ static void nParseStringForPath(long pathPtr, @NonNull String pathString, int
            stringLength) {
        Path_Delegate path_delegate = Path_Delegate.getDelegate(pathPtr);
        if (path_delegate == null) {
            return false;
            return;
        }
        assert pathString.length() == stringLength;
        PathDataNode.nodesToPath(createNodesFromPathData(pathString), path_delegate);
        return true;
    }

    @LayoutlibDelegate
+1 −0
Original line number Diff line number Diff line
@@ -192,6 +192,7 @@ public final class CreateInfo implements ICreateInfo {
        "android.graphics.BitmapFactory#setDensityFromOptions",
        "android.graphics.drawable.AnimatedVectorDrawable$VectorDrawableAnimatorRT#useLastSeenTarget",
        "android.graphics.drawable.GradientDrawable#buildRing",
        "android.graphics.FontFamily#addFont",
        "android.graphics.Typeface#getSystemFontConfigLocation",
        "android.graphics.Typeface#makeFamilyFromParsed",
        "android.os.Handler#sendMessageAtTime",