public class

TypefaceCompat.ResourcesCallbackAdapter

extends FontsContractCompat.FontRequestCallback

 java.lang.Object

androidx.core.provider.FontsContractCompat.FontRequestCallback

↳androidx.core.graphics.TypefaceCompat.ResourcesCallbackAdapter

Overview

Converts FontsContractCompat.FontRequestCallback callback functions into ResourcesCompat.FontCallback equivalents. RestrictTo(LIBRARY) since it is used by the deprecated FontsContractCompat.getFontSync(Context, FontRequest, ResourcesCompat.FontCallback, Handler, boolean, int, int) function.

Summary

Fields
from FontsContractCompat.FontRequestCallbackFAIL_REASON_FONT_LOAD_ERROR, FAIL_REASON_FONT_NOT_FOUND, FAIL_REASON_FONT_UNAVAILABLE, FAIL_REASON_MALFORMED_QUERY, FAIL_REASON_PROVIDER_NOT_FOUND, FAIL_REASON_SECURITY_VIOLATION, FAIL_REASON_WRONG_CERTIFICATES, RESULT_OK
Constructors
publicResourcesCallbackAdapter(ResourcesCompat.FontCallback fontCallback)

Methods
public voidonTypefaceRequestFailed(int reason)

Called when a Typeface request done via FontsContractCompat.requestFont(Context, FontRequest, FontsContractCompat.FontRequestCallback, Handler) fails.

public voidonTypefaceRetrieved(Typeface typeface)

Called then a Typeface request done via FontsContractCompat.requestFont(Context, FontRequest, FontsContractCompat.FontRequestCallback, Handler) is complete.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public ResourcesCallbackAdapter(ResourcesCompat.FontCallback fontCallback)

Methods

public void onTypefaceRetrieved(Typeface typeface)

Called then a Typeface request done via FontsContractCompat.requestFont(Context, FontRequest, FontsContractCompat.FontRequestCallback, Handler) is complete. Note that this method will not be called if FontsContractCompat.FontRequestCallback.onTypefaceRequestFailed(int) is called instead.

Parameters:

typeface: The Typeface object retrieved.

public void onTypefaceRequestFailed(int reason)

Called when a Typeface request done via FontsContractCompat.requestFont(Context, FontRequest, FontsContractCompat.FontRequestCallback, Handler) fails.

Parameters:

reason: May be one of FontsContractCompat.FontRequestCallback.FAIL_REASON_PROVIDER_NOT_FOUND, FontsContractCompat.FontRequestCallback.FAIL_REASON_FONT_NOT_FOUND, FontsContractCompat.FontRequestCallback.FAIL_REASON_FONT_LOAD_ERROR, FontsContractCompat.FontRequestCallback.FAIL_REASON_FONT_UNAVAILABLE, FontsContractCompat.FontRequestCallback.FAIL_REASON_MALFORMED_QUERY or FontsContractCompat.FontRequestCallback.FAIL_REASON_WRONG_CERTIFICATES, or a provider defined positive code number.