File tree Expand file tree Collapse file tree 2 files changed +5
-48
lines changed
app/src/main/java/org/thoughtcrime/securesms/ui Expand file tree Collapse file tree 2 files changed +5
-48
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,7 @@ import org.thoughtcrime.securesms.ui.theme.LocalType
8080import org.thoughtcrime.securesms.ui.theme.PreviewTheme
8181import org.thoughtcrime.securesms.ui.theme.SessionColorsParameterProvider
8282import org.thoughtcrime.securesms.ui.theme.ThemeColors
83+ import org.thoughtcrime.securesms.util.AvatarBadge
8384import org.thoughtcrime.securesms.util.AvatarUIData
8485
8586
@@ -750,7 +751,7 @@ fun AvatarQrWidget(
750751 label = " corner_radius"
751752 )
752753
753- // Scale animations for content
754+ // Scale animations for content (used when going from QR back to avatar)
754755 val avatarScale by animateFloatAsState(
755756 targetValue = if (showQR) 0.8f else 1f ,
756757 animationSpec = animationSpecFast,
@@ -835,7 +836,6 @@ fun AvatarQrWidget(
835836 }
836837 Avatar (
837838 modifier = avatarModifier
838- .size(animatedSize)
839839 .graphicsLayer(
840840 alpha = avatarAlpha,
841841 scaleX = avatarScale,
@@ -844,7 +844,7 @@ fun AvatarQrWidget(
844844 ,
845845 size = animatedSize,
846846 maxSizeLoad = LocalDimensions .current.iconXXLargeAvatar,
847- data = avatarUIData
847+ data = avatarUIData,
848848 )
849849
850850 // QR with scale and alpha
Original file line number Diff line number Diff line change @@ -104,20 +104,11 @@ fun BaseAvatar(
104104
105105 // Badge content, if any.
106106 if (badge != null ) {
107- var badgeSize = size * 0.4f
108- var offset = 0 .dp
109-
110- if (badgeSize < MIN_BADGE_SIZE ){
111- // apply an opinionated minimum size for the badge
112- badgeSize = MIN_BADGE_SIZE
113- offset = 1 .dp // the forced min size looks better with a slight offset
114- }
115-
116107 Box (
117108 modifier = Modifier
118109 .align(Alignment .BottomEnd )
119- .offset(x = offset , y = offset )
120- .size(badgeSize )
110+ .offset(x = 1 .dp , y = 1 .dp )
111+ .size(max(size * 0.4f , MIN_BADGE_SIZE ) )
121112 ) {
122113 badge()
123114 }
@@ -398,40 +389,6 @@ fun PreviewAvatarSinglePhoto(){
398389 }
399390}
400391
401- @Preview
402- @Composable
403- fun PreviewAvatarBadge (){
404- PreviewTheme {
405- Avatar (
406- size = LocalDimensions .current.iconLarge,
407- badge = AvatarBadge .Admin ,
408- data = AvatarUIData (
409- listOf (AvatarUIElement (
410- name = " AT" ,
411- color = primaryGreen,
412- remoteFile = null
413- )))
414- )
415- }
416- }
417-
418- @Preview
419- @Composable
420- fun PreviewAvatarBadgeSmall (){
421- PreviewTheme {
422- Avatar (
423- size = LocalDimensions .current.iconMediumAvatar,
424- badge = AvatarBadge .Admin ,
425- data = AvatarUIData (
426- listOf (AvatarUIElement (
427- name = " AT" ,
428- color = primaryGreen,
429- remoteFile = null
430- )))
431- )
432- }
433- }
434-
435392@Preview
436393@Composable
437394fun PreviewAvatarElementUnclipped (){
You can’t perform that action at this time.
0 commit comments