mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-16 01:05:04 +01:00
37 lines
1.0 KiB
Kotlin
37 lines
1.0 KiB
Kotlin
/*
|
|
* Nextcloud Talk - Android Client
|
|
*
|
|
* SPDX-FileCopyrightText: 2024 Your Name <your@email.com>
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
*/
|
|
|
|
package com.nextcloud.talk.contacts
|
|
|
|
import android.app.Application
|
|
import coil.ImageLoader
|
|
import coil.ImageLoaderFactory
|
|
import coil.disk.DiskCache
|
|
import coil.memory.MemoryCache
|
|
import coil.util.DebugLogger
|
|
import com.nextcloud.talk.utils.ContactUtils
|
|
|
|
class ContactsApplication : Application(), ImageLoaderFactory {
|
|
override fun newImageLoader(): ImageLoader {
|
|
val imageLoader = ImageLoader.Builder(this)
|
|
.memoryCache {
|
|
MemoryCache.Builder(this)
|
|
.maxSizePercent(ContactUtils.CACHE_MEMORY_SIZE_PERCENTAGE)
|
|
.build()
|
|
}
|
|
.diskCache {
|
|
DiskCache.Builder()
|
|
.maxSizePercent(ContactUtils.CACHE_DISK_SIZE_PERCENTAGE)
|
|
.directory(cacheDir)
|
|
.build()
|
|
}
|
|
.logger(DebugLogger())
|
|
.build()
|
|
return imageLoader
|
|
}
|
|
}
|