FontsContractCompat.FontRequestCallback

Added in 1.1.0

class FontsContractCompat.FontRequestCallback


Interface used to receive asynchronously fetched typefaces.

Summary

Constants

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

Public constructors

Public functions

Unit

Called when a Typeface request done via requestFont fails.

Unit

Called then a Typeface request done via requestFont is complete.

Constants

FAIL_REASON_FONT_LOAD_ERROR

Added in 1.1.0
const val FAIL_REASON_FONT_LOAD_ERROR = -3: Int

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

FAIL_REASON_FONT_NOT_FOUND

Added in 1.1.0
const val FAIL_REASON_FONT_NOT_FOUND = 1: Int

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

FAIL_REASON_FONT_UNAVAILABLE

Added in 1.1.0
const val FAIL_REASON_FONT_UNAVAILABLE = 2: Int

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

FAIL_REASON_MALFORMED_QUERY

Added in 1.1.0
const val FAIL_REASON_MALFORMED_QUERY = 3: Int

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

FAIL_REASON_PROVIDER_NOT_FOUND

Added in 1.1.0
const val FAIL_REASON_PROVIDER_NOT_FOUND = -1: Int

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

FAIL_REASON_SECURITY_VIOLATION

Added in 1.1.0
const val FAIL_REASON_SECURITY_VIOLATION = -4: 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.

FAIL_REASON_WRONG_CERTIFICATES

Added in 1.1.0
const val FAIL_REASON_WRONG_CERTIFICATES = -2: Int

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

Public constructors

FontRequestCallback

Added in 1.1.0
FontRequestCallback()

Public functions

onTypefaceRequestFailed

Added in 1.1.0
fun onTypefaceRequestFailed(reason: Int): Unit

Called when a Typeface request done via requestFont fails.

onTypefaceRetrieved

Added in 1.1.0
fun onTypefaceRetrieved(typeface: Typeface!): Unit

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

Parameters
typeface: Typeface!

The Typeface object retrieved.