Forces the use of a single RoboHash for performance
This commit is contained in:
@@ -10,13 +10,14 @@ object RoboHashCache {
|
|||||||
|
|
||||||
lateinit var robots: RoboHash
|
lateinit var robots: RoboHash
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
fun get(context: Context, hash: String): Bitmap {
|
fun get(context: Context, hash: String): Bitmap {
|
||||||
if (!this::robots.isInitialized) {
|
if (!this::robots.isInitialized) {
|
||||||
robots = RoboHash(context)
|
robots = RoboHash(context)
|
||||||
robots.useCache(LruCache(1000));
|
robots.useCache(LruCache(100));
|
||||||
}
|
}
|
||||||
|
|
||||||
return robots.imageForHandle(robots.calculateHandleFromUUID(UUID.nameUUIDFromBytes(hash.toByteArray())))
|
return robots.imageForHandle(robots.calculateHandleFromUUID(UUID.nameUUIDFromBytes("aaaa".toByteArray())))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user