android-components / mozilla.components.browser.icons / BrowserIcons

BrowserIcons

class BrowserIcons (source)

Entry point for loading icons for websites.

Parameters

generator - The IconGenerator to generate an icon if no icon could be loaded.

decoders - List of IconDecoder instances to use when decoding a loaded icon into a android.graphics.Bitmap.

Constructors

| Name | Summary | |—|—| | <init> | BrowserIcons(context: <ERROR CLASS>, httpClient: Client, generator: IconGenerator = DefaultIconGenerator(), preparers: List<IconPreprarer> = listOf( TippyTopIconPreparer(context.assets), MemoryIconPreparer(sharedMemoryCache), DiskIconPreparer(sharedDiskCache) ), loaders: List<IconLoader> = listOf( MemoryIconLoader(sharedMemoryCache), DiskIconLoader(sharedDiskCache), HttpIconLoader(httpClient), DataUriIconLoader() ), decoders: List<IconDecoder> = listOf( AndroidIconDecoder(), ICOIconDecoder() ), processors: List<IconProcessor> = listOf( MemoryIconProcessor(sharedMemoryCache), DiskIconProcessor(sharedDiskCache) ), jobDispatcher: CoroutineDispatcher = Executors.newFixedThreadPool(THREADS).asCoroutineDispatcher())
Entry point for loading icons for websites. |

Functions

Name Summary
install fun install(engine: Engine, sessionManager: SessionManager): Unit
Installs the “icons” extension in the engine in order to dynamically load icons for loaded websites.
loadIcon fun loadIcon(request: IconRequest): Deferred<Icon>
Asynchronously loads an Icon for the given IconRequest.
loadIntoView fun loadIntoView(view: <ERROR CLASS>, request: IconRequest, placeholder: <ERROR CLASS>? = null, error: <ERROR CLASS>? = null): Job
Loads an icon asynchronously using BrowserIcons and then displays it in the ImageView. If the view is detached from the window before loading is completed, then loading is cancelled.
onLowMemory fun onLowMemory(): Unit

Extension Functions

Name Summary
loadResourceAsString fun Any.loadResourceAsString(path: String): String
Loads a file from the resources folder and returns its content as a string object.