mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Added image placeholder, restore round corners except for gifs
This commit is contained in:
parent
fdc696691a
commit
c77df7228e
2 changed files with 18 additions and 4 deletions
|
|
@ -54,6 +54,7 @@ import coil.dispose
|
|||
import coil.load
|
||||
import coil.request.videoFrameMillis
|
||||
import coil.size.Dimension
|
||||
import coil.transform.RoundedCornersTransformation
|
||||
import com.google.android.material.imageview.ShapeableImageView
|
||||
import kotlinx.coroutines.launch
|
||||
import org.linphone.BR
|
||||
|
|
@ -243,13 +244,14 @@ private fun loadImageForChatBubble(imageView: ImageView, file: String?, grid: Bo
|
|||
}
|
||||
val width = if (grid) Dimension(dimen) else Dimension.Undefined
|
||||
val height = Dimension(dimen)
|
||||
/* val radius = imageView.resources.getDimension(
|
||||
val radius = imageView.resources.getDimension(
|
||||
R.dimen.chat_bubble_images_rounded_corner_radius
|
||||
) */
|
||||
)
|
||||
if (FileUtils.isExtensionVideo(file)) {
|
||||
imageView.load(file) {
|
||||
placeholder(R.drawable.image_square)
|
||||
videoFrameMillis(0)
|
||||
// transformations(RoundedCornersTransformation(radius))
|
||||
transformations(RoundedCornersTransformation(radius))
|
||||
size(width, height)
|
||||
listener(
|
||||
onError = { _, result ->
|
||||
|
|
@ -262,8 +264,11 @@ private fun loadImageForChatBubble(imageView: ImageView, file: String?, grid: Bo
|
|||
}
|
||||
} else {
|
||||
imageView.load(file) {
|
||||
placeholder(R.drawable.image_square)
|
||||
// Can't have a transformation for gif file, breaks animation
|
||||
// transformations(RoundedCornersTransformation(radius))
|
||||
if (FileUtils.getExtensionFromFileName(file) != "gif") {
|
||||
transformations(RoundedCornersTransformation(radius))
|
||||
}
|
||||
size(width, height)
|
||||
listener(
|
||||
onError = { _, result ->
|
||||
|
|
|
|||
9
app/src/main/res/drawable/image_square.xml
Normal file
9
app/src/main/res/drawable/image_square.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="88dp"
|
||||
android:height="88dp"
|
||||
android:viewportWidth="256"
|
||||
android:viewportHeight="256">
|
||||
<path
|
||||
android:pathData="M208,32L48,32A16,16 0,0 0,32 48L32,208a16,16 0,0 0,16 16L208,224a16,16 0,0 0,16 -16L224,48A16,16 0,0 0,208 32ZM48,48L208,48v77.38l-24.69,-24.7a16,16 0,0 0,-22.62 0L53.37,208L48,208ZM208,208L76,208l96,-96 36,36v60ZM96,120A24,24 0,1 0,72 96,24 24,0 0,0 96,120ZM96,88a8,8 0,1 1,-8 8A8,8 0,0 1,96 88Z"
|
||||
android:fillColor="#4e6074"/>
|
||||
</vector>
|
||||
Loading…
Add table
Reference in a new issue