talk-android/app/src/main/java/com/nextcloud/talk/contacts/ContactsApplication.kt
sowjanyakch 4508cbb0aa
work on codacy warnings
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
2024-08-09 15:44:36 +02:00

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