mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix(android): formatted string NoSuchMethodError (#10704)
This commit is contained in:
committed by
GitHub
parent
04aa2bacbc
commit
358791795f
Binary file not shown.
@@ -7,12 +7,14 @@ import android.text.style.TypefaceSpan;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by hhristov on 2/27/17.
|
* Created by hhristov on 2/27/17.
|
||||||
* Updated by CatchABus on 1/26/25.
|
|
||||||
*/
|
*/
|
||||||
@SuppressLint("ParcelCreator")
|
@SuppressLint("ParcelCreator")
|
||||||
public class CustomTypefaceSpan extends TypefaceSpan {
|
public class CustomTypefaceSpan extends TypefaceSpan {
|
||||||
|
private final Typeface typeface;
|
||||||
|
|
||||||
public CustomTypefaceSpan(Typeface typeface) {
|
public CustomTypefaceSpan(Typeface typeface) {
|
||||||
super(typeface);
|
super((String)null);
|
||||||
|
this.typeface = typeface;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateDrawState(TextPaint ds) {
|
public void updateDrawState(TextPaint ds) {
|
||||||
@@ -27,7 +29,7 @@ public class CustomTypefaceSpan extends TypefaceSpan {
|
|||||||
final Typeface old = paint.getTypeface();
|
final Typeface old = paint.getTypeface();
|
||||||
final int oldStyle = (old == null) ? 0 : old.getStyle();
|
final int oldStyle = (old == null) ? 0 : old.getStyle();
|
||||||
|
|
||||||
Typeface typeface = this.getTypeface();
|
Typeface typeface = this.typeface;
|
||||||
int fake = oldStyle & ~typeface.getStyle();
|
int fake = oldStyle & ~typeface.getStyle();
|
||||||
if ((fake & android.graphics.Typeface.BOLD) != 0) {
|
if ((fake & android.graphics.Typeface.BOLD) != 0) {
|
||||||
paint.setFakeBoldText(true);
|
paint.setFakeBoldText(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user