FontRequestCallback

open class FontRequestCallback
kotlin.Any
   ↳ androidx.core.provider.FontsContractCompat.FontRequestCallback

Interface used to receive asynchronously fetched typefaces.

Summary

Constants
static Int

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

static Int

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

static Int

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

static Int

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

static Int

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

static Int

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

static Int

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

Public constructors

Public methods
open Unit

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

open Unit

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

Constants

FAIL_REASON_FONT_LOAD_ERROR

static val FAIL_REASON_FONT_LOAD_ERROR: Int

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

Value: -3

FAIL_REASON_FONT_NOT_FOUND

static val FAIL_REASON_FONT_NOT_FOUND: Int

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

Value: 1

FAIL_REASON_FONT_UNAVAILABLE

static val FAIL_REASON_FONT_UNAVAILABLE: Int

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

Value: 2

FAIL_REASON_MALFORMED_QUERY

static val FAIL_REASON_MALFORMED_QUERY: Int

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

Value: 3

FAIL_REASON_PROVIDER_NOT_FOUND

static val FAIL_REASON_PROVIDER_NOT_FOUND: Int

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

Value: -1

FAIL_REASON_SECURITY_VIOLATION

static val FAIL_REASON_SECURITY_VIOLATION: Int

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.

Value: -4

FAIL_REASON_WRONG_CERTIFICATES

static val FAIL_REASON_WRONG_CERTIFICATES: Int

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

Value: -2

Public constructors

<init>

FontRequestCallback()

Public methods

onTypefaceRetrieved

open fun onTypefaceRetrieved(typeface: Typeface!): Unit

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.

onTypefaceRequestFailed

open fun onTypefaceRequestFailed(reason: Int): Unit

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.