added in version 26.1.0
belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1

FontsContractCompat.FontRequestCallback

public static class FontsContractCompat.FontRequestCallback
extends Object

java.lang.Object
   ↳ android.support.v4.provider.FontsContractCompat.FontRequestCallback


Interface used to receive asynchronously fetched typefaces.

Summary

Constants

int FAIL_REASON_FONT_LOAD_ERROR

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

int FAIL_REASON_FONT_NOT_FOUND

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

int FAIL_REASON_FONT_UNAVAILABLE

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

int FAIL_REASON_MALFORMED_QUERY

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

int FAIL_REASON_PROVIDER_NOT_FOUND

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

int FAIL_REASON_SECURITY_VIOLATION

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

int FAIL_REASON_WRONG_CERTIFICATES

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

Public constructors

FontsContractCompat.FontRequestCallback()

Public methods

void onTypefaceRequestFailed(int reason)

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

void onTypefaceRetrieved(Typeface typeface)

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

Inherited methods

From class java.lang.Object

Constants

FAIL_REASON_FONT_LOAD_ERROR

added in version 26.1.0
int FAIL_REASON_FONT_LOAD_ERROR

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

Constant Value: -3 (0xfffffffd)

FAIL_REASON_FONT_NOT_FOUND

added in version 26.1.0
int FAIL_REASON_FONT_NOT_FOUND

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

Constant Value: 1 (0x00000001)

FAIL_REASON_FONT_UNAVAILABLE

added in version 26.1.0
int FAIL_REASON_FONT_UNAVAILABLE

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

Constant Value: 2 (0x00000002)

FAIL_REASON_MALFORMED_QUERY

added in version 26.1.0
int FAIL_REASON_MALFORMED_QUERY

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

Constant Value: 3 (0x00000003)

FAIL_REASON_PROVIDER_NOT_FOUND

added in version 26.1.0
int FAIL_REASON_PROVIDER_NOT_FOUND

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

Constant Value: -1 (0xffffffff)

FAIL_REASON_SECURITY_VIOLATION

added in version 27.1.0
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.

Constant Value: -4 (0xfffffffc)

FAIL_REASON_WRONG_CERTIFICATES

added in version 26.1.0
int FAIL_REASON_WRONG_CERTIFICATES

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

Constant Value: -2 (0xfffffffe)

Public constructors

FontsContractCompat.FontRequestCallback

added in version 26.1.0
FontsContractCompat.FontRequestCallback ()

Public methods

onTypefaceRequestFailed

added in version 26.1.0
void onTypefaceRequestFailed (int reason)

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

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

onTypefaceRetrieved

added in version 26.1.0
void onTypefaceRetrieved (Typeface typeface)

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

Parameters
typeface Typeface: The Typeface object retrieved.