mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 09:49:30 +01:00
Various picture in picture updates.
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
|
||||
package org.thoughtcrime.securesms.avatar
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
@@ -14,8 +14,13 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalInspectionMode
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.viewinterop.AndroidView
|
||||
import org.signal.core.ui.compose.DayNightPreviews
|
||||
import org.signal.core.ui.compose.Previews
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.components.AvatarImageView
|
||||
import org.thoughtcrime.securesms.conversation.colors.AvatarColor
|
||||
import org.thoughtcrime.securesms.database.model.ProfileAvatarFileDetails
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId
|
||||
@@ -44,9 +49,11 @@ fun AvatarImage(
|
||||
contentDescription: String? = null
|
||||
) {
|
||||
if (LocalInspectionMode.current) {
|
||||
Spacer(
|
||||
Image(
|
||||
painter = painterResource(R.drawable.ic_avatar_abstract_02),
|
||||
contentDescription = null,
|
||||
modifier = modifier
|
||||
.background(color = Color.Red, shape = CircleShape)
|
||||
.background(color = Color(AvatarColor.random().colorInt()), CircleShape)
|
||||
)
|
||||
} else {
|
||||
val context = LocalContext.current
|
||||
@@ -76,6 +83,16 @@ fun AvatarImage(
|
||||
}
|
||||
}
|
||||
|
||||
@DayNightPreviews
|
||||
@Composable
|
||||
private fun AvatarImagePreview() {
|
||||
Previews.Preview {
|
||||
AvatarImage(
|
||||
recipientId = RecipientId.from(1)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private data class AvatarImageState(
|
||||
val displayName: String?,
|
||||
val self: Recipient,
|
||||
|
||||
Reference in New Issue
Block a user