Skip to content

Commit 62557e7

Browse files
sorenoidSoren Roth
and
Soren Roth
authored
some small fixes (#508)
Co-authored-by: Soren Roth <[email protected]>
1 parent 9ac85a7 commit 62557e7

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

toolkit/popup/src/main/java/com/arcgismaps/toolkit/popup/internal/element/media/MediaElementState.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ internal class MediaElementState(
7777
""
7878
},
7979
MediaImageProvider(
80-
fileName = "media-${Objects.hash(mediaPopupElement.title, media.title, media.caption)}",
80+
fileName = "media-${Objects.hash(mediaPopupElement.title, media.title, media.caption)}.png",
8181
folderName = mediaFolder
8282
) {
8383
media.generateChart(chartParams).getOrThrow().image.bitmap
@@ -173,7 +173,7 @@ internal fun rememberMediaElementState(
173173
val mediaFolder = "${LocalContext.current.cacheDir.canonicalPath}/popup_media"
174174
val context = LocalContext.current
175175
return rememberSaveable(
176-
inputs = arrayOf(popup, element),
176+
inputs = arrayOf(popup, element.toJson()),
177177
saver = MediaElementState.Saver(element, scope, mediaFolder, chartParams, context)
178178
) {
179179
MediaElementState(

toolkit/popup/src/main/java/com/arcgismaps/toolkit/popup/internal/util/MediaImageProvider.kt

+3-5
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,9 @@ internal class MediaImageProvider(
4040
val directory = File(folderName)
4141
directory.mkdirs()
4242
val file = File(directory, fileName)
43-
if (!file.exists()) {
44-
file.createNewFile()
45-
BufferedOutputStream(FileOutputStream(file)).use { bos ->
46-
bitmap.compress(Bitmap.CompressFormat.PNG, 100, bos)
47-
}
43+
file.createNewFile()
44+
BufferedOutputStream(FileOutputStream(file)).use { bos ->
45+
bitmap.compress(Bitmap.CompressFormat.PNG, 100, bos)
4846
}
4947
file.canonicalPath
5048
}

0 commit comments

Comments
 (0)