Using now AndroidContext.applicationContext in ImageService.android
This commit is contained in:
parent
e1bb7722ff
commit
f107d947ff
|
@ -9,7 +9,6 @@ import androidx.fragment.app.FragmentActivity
|
||||||
import net.codinux.banking.persistence.AndroidContext
|
import net.codinux.banking.persistence.AndroidContext
|
||||||
import net.codinux.banking.ui.service.AuthenticationService
|
import net.codinux.banking.ui.service.AuthenticationService
|
||||||
import net.codinux.banking.ui.service.BiometricAuthenticationService
|
import net.codinux.banking.ui.service.BiometricAuthenticationService
|
||||||
import net.codinux.banking.ui.service.ImageService
|
|
||||||
|
|
||||||
class MainActivity : FragmentActivity() {
|
class MainActivity : FragmentActivity() {
|
||||||
|
|
||||||
|
@ -22,7 +21,6 @@ class MainActivity : FragmentActivity() {
|
||||||
|
|
||||||
AndroidContext.applicationContext = this.applicationContext
|
AndroidContext.applicationContext = this.applicationContext
|
||||||
|
|
||||||
ImageService.context = this.applicationContext
|
|
||||||
AuthenticationService.biometricAuthenticationService = BiometricAuthenticationService(this)
|
AuthenticationService.biometricAuthenticationService = BiometricAuthenticationService(this)
|
||||||
|
|
||||||
setContent {
|
setContent {
|
||||||
|
|
|
@ -1,22 +1,16 @@
|
||||||
package net.codinux.banking.ui.service
|
package net.codinux.banking.ui.service
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.graphics.BitmapFactory
|
import android.graphics.BitmapFactory
|
||||||
import androidx.compose.ui.graphics.ImageBitmap
|
import androidx.compose.ui.graphics.ImageBitmap
|
||||||
import androidx.compose.ui.graphics.asImageBitmap
|
import androidx.compose.ui.graphics.asImageBitmap
|
||||||
|
import net.codinux.banking.persistence.AndroidContext
|
||||||
import net.codinux.log.Log
|
import net.codinux.log.Log
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
import java.security.MessageDigest
|
import java.security.MessageDigest
|
||||||
|
|
||||||
|
|
||||||
object ImageService {
|
private val cacheDir by lazy { File(AndroidContext.applicationContext.cacheDir, "imageCache").also { it.mkdirs() } }
|
||||||
|
|
||||||
lateinit var context: Context
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private val cacheDir by lazy { File(ImageService.context.cacheDir, "imageCache").also { it.mkdirs() } }
|
|
||||||
|
|
||||||
private val messageDigest = MessageDigest.getInstance("SHA-256")
|
private val messageDigest = MessageDigest.getInstance("SHA-256")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue