fix scroll bug

This commit is contained in:
2026-05-15 10:12:09 +05:00
parent 6779b6f3b7
commit c9ec43de04
8 changed files with 232 additions and 52 deletions
@@ -0,0 +1,24 @@
package sh.sar.basedbank.util
import android.content.Context
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import java.io.File
object ContactImageCache {
private fun file(context: Context, hash: String) =
File(context.cacheDir, "cimg_${hash.replace(Regex("[^A-Za-z0-9]"), "_")}.png")
fun save(context: Context, hash: String, bitmap: Bitmap) {
try {
file(context, hash).outputStream().use {
bitmap.compress(Bitmap.CompressFormat.PNG, 90, it)
}
} catch (_: Exception) {}
}
fun load(context: Context, hash: String): Bitmap? = try {
BitmapFactory.decodeFile(file(context, hash).absolutePath)
} catch (_: Exception) { null }
}