small fix
This commit is contained in:
parent
6fb5b51fb8
commit
938e85d993
@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<runningDeviceTargetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="RUNNING_DEVICE_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="SERIAL_NUMBER" />
|
||||
<value value="RF8T107E6PV" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</runningDeviceTargetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2023-10-30T15:01:39.013836900Z" />
|
||||
</component>
|
||||
</project>
|
@ -61,20 +61,22 @@ abstract class AppDatabase : RoomDatabase() {
|
||||
|
||||
var image1 = converters.imageResourceToByteArray(appContext, R.drawable.image_bouquet1)
|
||||
var image2 = converters.imageResourceToByteArray(appContext, R.drawable.image_bouquet2)
|
||||
val resizedImage1 = converters.resizeByteArrayImage(image1, 300, 300)
|
||||
val resizedImage2 = converters.resizeByteArrayImage(image2, 300, 300)
|
||||
val bouquets = listOf(
|
||||
Bouquet(
|
||||
1,
|
||||
"Bouquet1",
|
||||
5,
|
||||
3432,
|
||||
image1,
|
||||
resizedImage1,
|
||||
),
|
||||
Bouquet(
|
||||
2,
|
||||
"Bouquet2",
|
||||
9,
|
||||
2342,
|
||||
image2,
|
||||
resizedImage2,
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -35,4 +35,13 @@ class Converters {
|
||||
bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream)
|
||||
return stream.toByteArray()
|
||||
}
|
||||
fun resizeByteArrayImage(imageData: ByteArray, reqWidth: Int, reqHeight: Int): ByteArray {
|
||||
val originalBitmap = BitmapFactory.decodeByteArray(imageData, 0, imageData.size)
|
||||
|
||||
val resizedBitmap = Bitmap.createScaledBitmap(originalBitmap, reqWidth, reqHeight, true)
|
||||
|
||||
val outputStream = ByteArrayOutputStream()
|
||||
resizedBitmap.compress(Bitmap.CompressFormat.PNG, 100, outputStream)
|
||||
return outputStream.toByteArray()
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user