public class

FontsContractCompat.FontRequestCallback

extends java.lang.Object

 java.lang.Object

↳androidx.core.provider.FontsContractCompat.FontRequestCallback

Subclasses:

TypefaceCompat.ResourcesCallbackAdapter

Overview

Interface used to receive asynchronously fetched typefaces.

Summary

Fields
public static final intFAIL_REASON_FONT_LOAD_ERROR

Constant returned by FontsContractCompat.FontRequestCallback.onTypefaceRequestFailed(int) signaling that the font returned by the provider was not loaded properly.

public static final intFAIL_REASON_FONT_NOT_FOUND

Constant returned by FontsContractCompat.FontRequestCallback.onTypefaceRequestFailed(int) signaling that the font provider did not return any results for the given query.

public static final intFAIL_REASON_FONT_UNAVAILABLE

Constant returned by FontsContractCompat.FontRequestCallback.onTypefaceRequestFailed(int) signaling that the font provider found the queried font, but it is currently unavailable.

public static final intFAIL_REASON_MALFORMED_QUERY

Constant returned by FontsContractCompat.FontRequestCallback.onTypefaceRequestFailed(int) signaling that the given query was not supported by the provider.

public static final intFAIL_REASON_PROVIDER_NOT_FOUND

Constant returned by FontsContractCompat.FontRequestCallback.onTypefaceRequestFailed(int) signaling that the given provider was not found on the device.

public static final intFAIL_REASON_SECURITY_VIOLATION

Constant that signals that the font was not loaded due to security issues.

public static final intFAIL_REASON_WRONG_CERTIFICATES

Constant returned by FontsContractCompat.FontRequestCallback.onTypefaceRequestFailed(int) signaling that the given provider must be authenticated and the given certificates do not match its signature.

public static final intRESULT_OK

Constructors
publicFontRequestCallback()

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

Fields

public static final int RESULT_OK

Deprecated: Not being used by any cross library, and should not be used, internal implementation detail.

public static final int FAIL_REASON_PROVIDER_NOT_FOUND

Constant returned by FontsContractCompat.FontRequestCallback.onTypefaceRequestFailed(int) signaling that the given provider was not found on the device.

public static final int FAIL_REASON_WRONG_CERTIFICATES

Constant returned by FontsContractCompat.FontRequestCallback.onTypefaceRequestFailed(int) signaling that the given provider must be authenticated and the given certificates do not match its signature.

public static final int FAIL_REASON_FONT_LOAD_ERROR

Constant returned by FontsContractCompat.FontRequestCallback.onTypefaceRequestFailed(int) signaling that the font returned by the provider was not loaded properly.

public static final int FAIL_REASON_SECURITY_VIOLATION

Constant that signals that the font was not loaded due to security issues. This usually means the font was attempted to load on a restricted context.

public static final int FAIL_REASON_FONT_NOT_FOUND

Constant returned by FontsContractCompat.FontRequestCallback.onTypefaceRequestFailed(int) signaling that the font provider did not return any results for the given query.

public static final int FAIL_REASON_FONT_UNAVAILABLE

Constant returned by FontsContractCompat.FontRequestCallback.onTypefaceRequestFailed(int) signaling that the font provider found the queried font, but it is currently unavailable.

public static final int FAIL_REASON_MALFORMED_QUERY

Constant returned by FontsContractCompat.FontRequestCallback.onTypefaceRequestFailed(int) signaling that the given query was not supported by the provider.

Constructors

public FontRequestCallback()

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.