Added in API level 26
Deprecated in API level 31

FontRequestCallback

open class FontRequestCallback
kotlin.Any
   ↳ android.provider.FontsContract.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 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 when a Typeface request done via requestFonts} fails.

open Unit

Called then a Typeface request done via requestFonts is complete.

Constants

FAIL_REASON_FONT_LOAD_ERROR

Added in API level 26
static val FAIL_REASON_FONT_LOAD_ERROR: Int

Deprecated: Deprecated in Java.

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

Value: -3

FAIL_REASON_FONT_NOT_FOUND

Added in API level 26
static val FAIL_REASON_FONT_NOT_FOUND: Int

Deprecated: Deprecated in Java.

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

Added in API level 26
static val FAIL_REASON_FONT_UNAVAILABLE: Int

Deprecated: Deprecated in Java.

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

Added in API level 26
static val FAIL_REASON_MALFORMED_QUERY: Int

Deprecated: Deprecated in Java.

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

Value: 3

FAIL_REASON_PROVIDER_NOT_FOUND

Added in API level 26
static val FAIL_REASON_PROVIDER_NOT_FOUND: Int

Deprecated: Deprecated in Java.

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

Value: -1

FAIL_REASON_WRONG_CERTIFICATES

Added in API level 26
static val FAIL_REASON_WRONG_CERTIFICATES: Int

Deprecated: Deprecated in Java.

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

FontRequestCallback

Added in API level 26
FontRequestCallback()

Public methods

onTypefaceRequestFailed

Added in API level 26
open fun onTypefaceRequestFailed(reason: Int): Unit

Deprecated: Deprecated in Java.

Called when a Typeface request done via requestFonts} fails.

Parameters
reason Int: One of FAIL_REASON_PROVIDER_NOT_FOUND, FAIL_REASON_FONT_NOT_FOUND, FAIL_REASON_FONT_LOAD_ERROR, FAIL_REASON_FONT_UNAVAILABLE or FAIL_REASON_MALFORMED_QUERY if returned by the system. May also be a positive value greater than 0 defined by the font provider as an additional error code. Refer to the provider's documentation for more information on possible returned error codes. Value is android.provider.FontsContract.FontRequestCallback#FAIL_REASON_PROVIDER_NOT_FOUND, android.provider.FontsContract.FontRequestCallback#FAIL_REASON_FONT_LOAD_ERROR, android.provider.FontsContract.FontRequestCallback#FAIL_REASON_FONT_NOT_FOUND, android.provider.FontsContract.FontRequestCallback#FAIL_REASON_FONT_UNAVAILABLE, or android.provider.FontsContract.FontRequestCallback#FAIL_REASON_MALFORMED_QUERY

onTypefaceRetrieved

Added in API level 26
open fun onTypefaceRetrieved(typeface: Typeface!): Unit

Deprecated: Deprecated in Java.

Called then a Typeface request done via requestFonts is complete. Note that this method will not be called if onTypefaceRequestFailed(int) is called instead.

Parameters
typeface Typeface!: The Typeface object retrieved.