468 lines
15 KiB
Smali
468 lines
15 KiB
Smali
.class public Landroidx/core/graphics/TypefaceCompat;
|
|
.super Ljava/lang/Object;
|
|
.source "TypefaceCompat.java"
|
|
|
|
|
|
# static fields
|
|
.field private static final sTypefaceCache:Landroidx/collection/LruCache;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Landroidx/collection/LruCache<",
|
|
"Ljava/lang/String;",
|
|
"Landroid/graphics/Typeface;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
.field private static final sTypefaceCompatImpl:Landroidx/core/graphics/TypefaceCompatBaseImpl;
|
|
|
|
|
|
# direct methods
|
|
.method static constructor <clinit>()V
|
|
.locals 2
|
|
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/16 v1, 0x1c
|
|
|
|
if-lt v0, v1, :cond_0
|
|
|
|
new-instance v0, Landroidx/core/graphics/TypefaceCompatApi28Impl;
|
|
|
|
invoke-direct {v0}, Landroidx/core/graphics/TypefaceCompatApi28Impl;-><init>()V
|
|
|
|
sput-object v0, Landroidx/core/graphics/TypefaceCompat;->sTypefaceCompatImpl:Landroidx/core/graphics/TypefaceCompatBaseImpl;
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/16 v1, 0x1a
|
|
|
|
if-lt v0, v1, :cond_1
|
|
|
|
new-instance v0, Landroidx/core/graphics/TypefaceCompatApi26Impl;
|
|
|
|
invoke-direct {v0}, Landroidx/core/graphics/TypefaceCompatApi26Impl;-><init>()V
|
|
|
|
sput-object v0, Landroidx/core/graphics/TypefaceCompat;->sTypefaceCompatImpl:Landroidx/core/graphics/TypefaceCompatBaseImpl;
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/16 v1, 0x18
|
|
|
|
if-lt v0, v1, :cond_2
|
|
|
|
invoke-static {}, Landroidx/core/graphics/TypefaceCompatApi24Impl;->isUsable()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_2
|
|
|
|
new-instance v0, Landroidx/core/graphics/TypefaceCompatApi24Impl;
|
|
|
|
invoke-direct {v0}, Landroidx/core/graphics/TypefaceCompatApi24Impl;-><init>()V
|
|
|
|
sput-object v0, Landroidx/core/graphics/TypefaceCompat;->sTypefaceCompatImpl:Landroidx/core/graphics/TypefaceCompatBaseImpl;
|
|
|
|
goto :goto_0
|
|
|
|
:cond_2
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/16 v1, 0x15
|
|
|
|
if-lt v0, v1, :cond_3
|
|
|
|
new-instance v0, Landroidx/core/graphics/TypefaceCompatApi21Impl;
|
|
|
|
invoke-direct {v0}, Landroidx/core/graphics/TypefaceCompatApi21Impl;-><init>()V
|
|
|
|
sput-object v0, Landroidx/core/graphics/TypefaceCompat;->sTypefaceCompatImpl:Landroidx/core/graphics/TypefaceCompatBaseImpl;
|
|
|
|
goto :goto_0
|
|
|
|
:cond_3
|
|
new-instance v0, Landroidx/core/graphics/TypefaceCompatBaseImpl;
|
|
|
|
invoke-direct {v0}, Landroidx/core/graphics/TypefaceCompatBaseImpl;-><init>()V
|
|
|
|
sput-object v0, Landroidx/core/graphics/TypefaceCompat;->sTypefaceCompatImpl:Landroidx/core/graphics/TypefaceCompatBaseImpl;
|
|
|
|
:goto_0
|
|
new-instance v0, Landroidx/collection/LruCache;
|
|
|
|
const/16 v1, 0x10
|
|
|
|
invoke-direct {v0, v1}, Landroidx/collection/LruCache;-><init>(I)V
|
|
|
|
sput-object v0, Landroidx/core/graphics/TypefaceCompat;->sTypefaceCache:Landroidx/collection/LruCache;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private constructor <init>()V
|
|
.locals 0
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static create(Landroid/content/Context;Landroid/graphics/Typeface;I)Landroid/graphics/Typeface;
|
|
.locals 2
|
|
.param p0 # Landroid/content/Context;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.param p1 # Landroid/graphics/Typeface;
|
|
.annotation build Landroidx/annotation/Nullable;
|
|
.end annotation
|
|
.end param
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
|
|
if-eqz p0, :cond_1
|
|
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/16 v1, 0x15
|
|
|
|
if-ge v0, v1, :cond_0
|
|
|
|
invoke-static {p0, p1, p2}, Landroidx/core/graphics/TypefaceCompat;->getBestFontFromFamily(Landroid/content/Context;Landroid/graphics/Typeface;I)Landroid/graphics/Typeface;
|
|
|
|
move-result-object p0
|
|
|
|
if-eqz p0, :cond_0
|
|
|
|
return-object p0
|
|
|
|
:cond_0
|
|
invoke-static {p1, p2}, Landroid/graphics/Typeface;->create(Landroid/graphics/Typeface;I)Landroid/graphics/Typeface;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
|
|
:cond_1
|
|
new-instance p0, Ljava/lang/IllegalArgumentException;
|
|
|
|
const-string p1, "Context cannot be null"
|
|
|
|
invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p0
|
|
.end method
|
|
|
|
.method public static createFromFontInfo(Landroid/content/Context;Landroid/os/CancellationSignal;[Landroidx/core/provider/FontsContractCompat$FontInfo;I)Landroid/graphics/Typeface;
|
|
.locals 1
|
|
.param p0 # Landroid/content/Context;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.param p1 # Landroid/os/CancellationSignal;
|
|
.annotation build Landroidx/annotation/Nullable;
|
|
.end annotation
|
|
.end param
|
|
.param p2 # [Landroidx/core/provider/FontsContractCompat$FontInfo;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.annotation build Landroidx/annotation/Nullable;
|
|
.end annotation
|
|
|
|
.annotation build Landroidx/annotation/RestrictTo;
|
|
value = {
|
|
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP_PREFIX:Landroidx/annotation/RestrictTo$Scope;
|
|
}
|
|
.end annotation
|
|
|
|
sget-object v0, Landroidx/core/graphics/TypefaceCompat;->sTypefaceCompatImpl:Landroidx/core/graphics/TypefaceCompatBaseImpl;
|
|
|
|
invoke-virtual {v0, p0, p1, p2, p3}, Landroidx/core/graphics/TypefaceCompatBaseImpl;->createFromFontInfo(Landroid/content/Context;Landroid/os/CancellationSignal;[Landroidx/core/provider/FontsContractCompat$FontInfo;I)Landroid/graphics/Typeface;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static createFromResourcesFamilyXml(Landroid/content/Context;Landroidx/core/content/res/FontResourcesParserCompat$FamilyResourceEntry;Landroid/content/res/Resources;IILandroidx/core/content/res/ResourcesCompat$FontCallback;Landroid/os/Handler;Z)Landroid/graphics/Typeface;
|
|
.locals 7
|
|
.param p0 # Landroid/content/Context;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.param p1 # Landroidx/core/content/res/FontResourcesParserCompat$FamilyResourceEntry;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.param p2 # Landroid/content/res/Resources;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.param p5 # Landroidx/core/content/res/ResourcesCompat$FontCallback;
|
|
.annotation build Landroidx/annotation/Nullable;
|
|
.end annotation
|
|
.end param
|
|
.param p6 # Landroid/os/Handler;
|
|
.annotation build Landroidx/annotation/Nullable;
|
|
.end annotation
|
|
.end param
|
|
.annotation build Landroidx/annotation/Nullable;
|
|
.end annotation
|
|
|
|
.annotation build Landroidx/annotation/RestrictTo;
|
|
value = {
|
|
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP_PREFIX:Landroidx/annotation/RestrictTo$Scope;
|
|
}
|
|
.end annotation
|
|
|
|
instance-of v1, p1, Landroidx/core/content/res/FontResourcesParserCompat$ProviderResourceEntry;
|
|
|
|
if-eqz v1, :cond_3
|
|
|
|
move-object v0, p1
|
|
|
|
check-cast v0, Landroidx/core/content/res/FontResourcesParserCompat$ProviderResourceEntry;
|
|
|
|
const/4 v1, 0x1
|
|
|
|
const/4 v4, 0x0
|
|
|
|
if-eqz p7, :cond_0
|
|
|
|
invoke-virtual {v0}, Landroidx/core/content/res/FontResourcesParserCompat$ProviderResourceEntry;->getFetchStrategy()I
|
|
|
|
move-result v5
|
|
|
|
if-nez v5, :cond_1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
if-nez p5, :cond_1
|
|
|
|
:goto_0
|
|
const/4 v4, 0x1
|
|
|
|
:cond_1
|
|
if-eqz p7, :cond_2
|
|
|
|
invoke-virtual {v0}, Landroidx/core/content/res/FontResourcesParserCompat$ProviderResourceEntry;->getTimeout()I
|
|
|
|
move-result v1
|
|
|
|
move v5, v1
|
|
|
|
goto :goto_1
|
|
|
|
:cond_2
|
|
const/4 v1, -0x1
|
|
|
|
const/4 v5, -0x1
|
|
|
|
:goto_1
|
|
invoke-virtual {v0}, Landroidx/core/content/res/FontResourcesParserCompat$ProviderResourceEntry;->getRequest()Landroidx/core/provider/FontRequest;
|
|
|
|
move-result-object v1
|
|
|
|
move-object v0, p0
|
|
|
|
move-object v2, p5
|
|
|
|
move-object v3, p6
|
|
|
|
move v6, p4
|
|
|
|
invoke-static/range {v0 .. v6}, Landroidx/core/provider/FontsContractCompat;->getFontSync(Landroid/content/Context;Landroidx/core/provider/FontRequest;Landroidx/core/content/res/ResourcesCompat$FontCallback;Landroid/os/Handler;ZII)Landroid/graphics/Typeface;
|
|
|
|
move-result-object v0
|
|
|
|
goto :goto_2
|
|
|
|
:cond_3
|
|
sget-object v1, Landroidx/core/graphics/TypefaceCompat;->sTypefaceCompatImpl:Landroidx/core/graphics/TypefaceCompatBaseImpl;
|
|
|
|
move-object v0, p1
|
|
|
|
check-cast v0, Landroidx/core/content/res/FontResourcesParserCompat$FontFamilyFilesResourceEntry;
|
|
|
|
invoke-virtual {v1, p0, v0, p2, p4}, Landroidx/core/graphics/TypefaceCompatBaseImpl;->createFromFontFamilyFilesResourceEntry(Landroid/content/Context;Landroidx/core/content/res/FontResourcesParserCompat$FontFamilyFilesResourceEntry;Landroid/content/res/Resources;I)Landroid/graphics/Typeface;
|
|
|
|
move-result-object v0
|
|
|
|
if-eqz p5, :cond_5
|
|
|
|
if-eqz v0, :cond_4
|
|
|
|
invoke-virtual {p5, v0, p6}, Landroidx/core/content/res/ResourcesCompat$FontCallback;->callbackSuccessAsync(Landroid/graphics/Typeface;Landroid/os/Handler;)V
|
|
|
|
goto :goto_2
|
|
|
|
:cond_4
|
|
const/4 v1, -0x3
|
|
|
|
invoke-virtual {p5, v1, p6}, Landroidx/core/content/res/ResourcesCompat$FontCallback;->callbackFailAsync(ILandroid/os/Handler;)V
|
|
|
|
:cond_5
|
|
:goto_2
|
|
if-eqz v0, :cond_6
|
|
|
|
sget-object v1, Landroidx/core/graphics/TypefaceCompat;->sTypefaceCache:Landroidx/collection/LruCache;
|
|
|
|
invoke-static {p2, p3, p4}, Landroidx/core/graphics/TypefaceCompat;->createResourceUid(Landroid/content/res/Resources;II)Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-virtual {v1, v2, v0}, Landroidx/collection/LruCache;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
:cond_6
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public static createFromResourcesFontFile(Landroid/content/Context;Landroid/content/res/Resources;ILjava/lang/String;I)Landroid/graphics/Typeface;
|
|
.locals 6
|
|
.param p0 # Landroid/content/Context;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.param p1 # Landroid/content/res/Resources;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.annotation build Landroidx/annotation/Nullable;
|
|
.end annotation
|
|
|
|
.annotation build Landroidx/annotation/RestrictTo;
|
|
value = {
|
|
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP_PREFIX:Landroidx/annotation/RestrictTo$Scope;
|
|
}
|
|
.end annotation
|
|
|
|
sget-object v0, Landroidx/core/graphics/TypefaceCompat;->sTypefaceCompatImpl:Landroidx/core/graphics/TypefaceCompatBaseImpl;
|
|
|
|
move-object v1, p0
|
|
|
|
move-object v2, p1
|
|
|
|
move v3, p2
|
|
|
|
move-object v4, p3
|
|
|
|
move v5, p4
|
|
|
|
invoke-virtual/range {v0 .. v5}, Landroidx/core/graphics/TypefaceCompatBaseImpl;->createFromResourcesFontFile(Landroid/content/Context;Landroid/content/res/Resources;ILjava/lang/String;I)Landroid/graphics/Typeface;
|
|
|
|
move-result-object p0
|
|
|
|
if-eqz p0, :cond_0
|
|
|
|
invoke-static {p1, p2, p4}, Landroidx/core/graphics/TypefaceCompat;->createResourceUid(Landroid/content/res/Resources;II)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
sget-object p2, Landroidx/core/graphics/TypefaceCompat;->sTypefaceCache:Landroidx/collection/LruCache;
|
|
|
|
invoke-virtual {p2, p1, p0}, Landroidx/collection/LruCache;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
:cond_0
|
|
return-object p0
|
|
.end method
|
|
|
|
.method private static createResourceUid(Landroid/content/res/Resources;II)Ljava/lang/String;
|
|
.locals 1
|
|
|
|
new-instance v0, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
invoke-virtual {p0, p1}, Landroid/content/res/Resources;->getResourcePackageName(I)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
const-string p0, "-"
|
|
|
|
invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v0, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static findFromCache(Landroid/content/res/Resources;II)Landroid/graphics/Typeface;
|
|
.locals 1
|
|
.param p0 # Landroid/content/res/Resources;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.annotation build Landroidx/annotation/Nullable;
|
|
.end annotation
|
|
|
|
.annotation build Landroidx/annotation/RestrictTo;
|
|
value = {
|
|
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP_PREFIX:Landroidx/annotation/RestrictTo$Scope;
|
|
}
|
|
.end annotation
|
|
|
|
sget-object v0, Landroidx/core/graphics/TypefaceCompat;->sTypefaceCache:Landroidx/collection/LruCache;
|
|
|
|
invoke-static {p0, p1, p2}, Landroidx/core/graphics/TypefaceCompat;->createResourceUid(Landroid/content/res/Resources;II)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {v0, p0}, Landroidx/collection/LruCache;->get(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object p0
|
|
|
|
check-cast p0, Landroid/graphics/Typeface;
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method private static getBestFontFromFamily(Landroid/content/Context;Landroid/graphics/Typeface;I)Landroid/graphics/Typeface;
|
|
.locals 2
|
|
.annotation build Landroidx/annotation/Nullable;
|
|
.end annotation
|
|
|
|
sget-object v0, Landroidx/core/graphics/TypefaceCompat;->sTypefaceCompatImpl:Landroidx/core/graphics/TypefaceCompatBaseImpl;
|
|
|
|
invoke-virtual {v0, p1}, Landroidx/core/graphics/TypefaceCompatBaseImpl;->getFontFamily(Landroid/graphics/Typeface;)Landroidx/core/content/res/FontResourcesParserCompat$FontFamilyFilesResourceEntry;
|
|
|
|
move-result-object p1
|
|
|
|
if-nez p1, :cond_0
|
|
|
|
const/4 p0, 0x0
|
|
|
|
return-object p0
|
|
|
|
:cond_0
|
|
sget-object v0, Landroidx/core/graphics/TypefaceCompat;->sTypefaceCompatImpl:Landroidx/core/graphics/TypefaceCompatBaseImpl;
|
|
|
|
invoke-virtual {p0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v0, p0, p1, v1, p2}, Landroidx/core/graphics/TypefaceCompatBaseImpl;->createFromFontFamilyFilesResourceEntry(Landroid/content/Context;Landroidx/core/content/res/FontResourcesParserCompat$FontFamilyFilesResourceEntry;Landroid/content/res/Resources;I)Landroid/graphics/Typeface;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|