Merge "Fix broken delegates for FontFamily and PathParser" into nyc-dev
am: 37e16f8
* commit '37e16f8e3bc3b3e3d3a4c37b5b7ccda953c78ac9':
Fix broken delegates for FontFamily and PathParser
Change-Id: Id418eaa3ccf69a4a757f8410f152718e4088f373
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user