Using now AndroidContext.applicationContext in ImageService.android

This commit is contained in:
dankito 2024-10-04 05:48:52 +02:00
parent e1bb7722ff
commit f107d947ff
2 changed files with 2 additions and 10 deletions

View File

@ -9,7 +9,6 @@ import androidx.fragment.app.FragmentActivity
import net.codinux.banking.persistence.AndroidContext
import net.codinux.banking.ui.service.AuthenticationService
import net.codinux.banking.ui.service.BiometricAuthenticationService
import net.codinux.banking.ui.service.ImageService
class MainActivity : FragmentActivity() {
@ -22,7 +21,6 @@ class MainActivity : FragmentActivity() {
AndroidContext.applicationContext = this.applicationContext
ImageService.context = this.applicationContext
AuthenticationService.biometricAuthenticationService = BiometricAuthenticationService(this)
setContent {

View File

@ -1,22 +1,16 @@
package net.codinux.banking.ui.service
import android.content.Context
import android.graphics.BitmapFactory
import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.graphics.asImageBitmap
import net.codinux.banking.persistence.AndroidContext
import net.codinux.log.Log
import java.io.File
import java.net.URL
import java.security.MessageDigest
object ImageService {
lateinit var context: Context
}
private val cacheDir by lazy { File(ImageService.context.cacheDir, "imageCache").also { it.mkdirs() } }
private val cacheDir by lazy { File(AndroidContext.applicationContext.cacheDir, "imageCache").also { it.mkdirs() } }
private val messageDigest = MessageDigest.getInstance("SHA-256")