mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-21 05:13:20 +01:00
44 lines
1.4 KiB
Java
44 lines
1.4 KiB
Java
package com.google.android.material.resources;
|
|
|
|
import android.graphics.Typeface;
|
|
import androidx.annotation.RestrictTo;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
|
/* loaded from: classes7.dex */
|
|
public final class CancelableFontCallback extends TextAppearanceFontCallback {
|
|
private final ApplyFont applyFont;
|
|
private boolean cancelled;
|
|
private final Typeface fallbackFont;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
public interface ApplyFont {
|
|
void apply(Typeface typeface);
|
|
}
|
|
|
|
public CancelableFontCallback(ApplyFont applyFont, Typeface typeface) {
|
|
this.fallbackFont = typeface;
|
|
this.applyFont = applyFont;
|
|
}
|
|
|
|
private void updateIfNotCancelled(Typeface typeface) {
|
|
if (this.cancelled) {
|
|
return;
|
|
}
|
|
this.applyFont.apply(typeface);
|
|
}
|
|
|
|
public void cancel() {
|
|
this.cancelled = true;
|
|
}
|
|
|
|
@Override // com.google.android.material.resources.TextAppearanceFontCallback
|
|
public void onFontRetrievalFailed(int i) {
|
|
updateIfNotCancelled(this.fallbackFont);
|
|
}
|
|
|
|
@Override // com.google.android.material.resources.TextAppearanceFontCallback
|
|
public void onFontRetrieved(Typeface typeface, boolean z) {
|
|
updateIfNotCancelled(typeface);
|
|
}
|
|
}
|