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


class BrowserIcons : MemoryConsumer (source)

Entry point for loading icons for websites.


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


| 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. |


Name Summary
install fun install(engine: Engine, store: BrowserStore): 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
The device is running low on memory. This component should trim its memory usage.
onTrimMemory fun onTrimMemory(level: Int): Unit
Notifies this component that it should try to release memory.

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.