Skip to content

Commit 463fabc

Browse files
alex-signalcody-signal
authored andcommitted
Polish pending participants views.
1 parent 23d82a3 commit 463fabc

3 files changed

Lines changed: 48 additions & 49 deletions

File tree

app/src/main/java/org/thoughtcrime/securesms/components/webrtc/PendingParticipantsBottomSheet.kt

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ import androidx.compose.foundation.layout.padding
1616
import androidx.compose.foundation.layout.size
1717
import androidx.compose.foundation.lazy.LazyColumn
1818
import androidx.compose.foundation.shape.CircleShape
19-
import androidx.compose.foundation.shape.RoundedCornerShape
2019
import androidx.compose.material.icons.Icons
2120
import androidx.compose.material.icons.filled.Person
2221
import androidx.compose.material3.Icon
2322
import androidx.compose.material3.MaterialTheme
24-
import androidx.compose.material3.Surface
2523
import androidx.compose.material3.Text
2624
import androidx.compose.material3.TextButton
2725
import androidx.compose.runtime.Composable
@@ -37,14 +35,14 @@ import androidx.compose.ui.res.colorResource
3735
import androidx.compose.ui.res.pluralStringResource
3836
import androidx.compose.ui.res.stringResource
3937
import androidx.compose.ui.res.vectorResource
40-
import androidx.compose.ui.tooling.preview.Preview
4138
import androidx.compose.ui.unit.dp
4239
import androidx.compose.ui.viewinterop.AndroidView
4340
import androidx.core.os.bundleOf
4441
import androidx.fragment.app.setFragmentResult
4542
import org.signal.core.ui.BottomSheets
4643
import org.signal.core.ui.Buttons
47-
import org.signal.core.ui.theme.SignalTheme
44+
import org.signal.core.ui.DarkPreview
45+
import org.signal.core.ui.Previews
4846
import org.thoughtcrime.securesms.R
4947
import org.thoughtcrime.securesms.components.AvatarImageView
5048
import org.thoughtcrime.securesms.compose.ComposeBottomSheetDialogFragment
@@ -132,29 +130,27 @@ class PendingParticipantsBottomSheet : ComposeBottomSheetDialogFragment() {
132130
}
133131
}
134132

135-
@Preview(showSystemUi = true)
133+
@DarkPreview
136134
@Composable
137135
private fun PendingParticipantsSheetPreview() {
138-
SignalTheme(isDarkMode = true) {
139-
Surface(shape = RoundedCornerShape(18.dp, 18.dp)) {
140-
PendingParticipantsSheet(
141-
pendingParticipants = listOf(
142-
PendingParticipantCollection.State.PENDING,
143-
PendingParticipantCollection.State.APPROVED,
144-
PendingParticipantCollection.State.DENIED
145-
).map {
146-
PendingParticipantCollection.Entry(
147-
recipient = Recipient.UNKNOWN,
148-
state = it,
149-
stateChangeAt = System.currentTimeMillis().milliseconds
150-
)
151-
},
152-
onApproveAll = {},
153-
onDenyAll = {},
154-
onApprove = {},
155-
onDeny = {}
156-
)
157-
}
136+
Previews.BottomSheetPreview {
137+
PendingParticipantsSheet(
138+
pendingParticipants = listOf(
139+
PendingParticipantCollection.State.PENDING,
140+
PendingParticipantCollection.State.APPROVED,
141+
PendingParticipantCollection.State.DENIED
142+
).map {
143+
PendingParticipantCollection.Entry(
144+
recipient = Recipient(systemContactName = "Test User"),
145+
state = it,
146+
stateChangeAt = System.currentTimeMillis().milliseconds
147+
)
148+
},
149+
onApproveAll = {},
150+
onDenyAll = {},
151+
onApprove = {},
152+
onDeny = {}
153+
)
158154
}
159155
}
160156

app/src/main/java/org/thoughtcrime/securesms/components/webrtc/PendingParticipantsView.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,14 @@ class PendingParticipantsView @JvmOverloads constructor(
6060

6161
name.text = SpannableStringBuilder(firstRecipient.getShortDisplayName(context))
6262
.append(" ")
63-
.append(SpanUtil.ofSize(
64-
SignalSymbols.getSpannedString(context, SignalSymbols.Weight.REGULAR, SignalSymbols.Glyph.CHEVRON_RIGHT),
65-
16
66-
))
63+
.append(
64+
SpanUtil.ofSize(
65+
SignalSymbols.getSpannedString(context, SignalSymbols.Weight.REGULAR, SignalSymbols.Glyph.CHEVRON_RIGHT),
66+
16
67+
)
68+
)
6769
name.setOnClickListener { listener?.onLaunchRecipientSheet(firstRecipient) }
68-
70+
6971
allow.setOnClickListener { listener?.onAllowPendingRecipient(firstRecipient) }
7072
reject.setOnClickListener { listener?.onRejectPendingRecipient(firstRecipient) }
7173

app/src/main/java/org/thoughtcrime/securesms/components/webrtc/requests/CallLinkIncomingRequestSheet.kt

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import androidx.compose.foundation.lazy.LazyColumn
1515
import androidx.compose.foundation.shape.CircleShape
1616
import androidx.compose.material3.Icon
1717
import androidx.compose.material3.MaterialTheme
18-
import androidx.compose.material3.Surface
1918
import androidx.compose.material3.Text
2019
import androidx.compose.runtime.Composable
2120
import androidx.compose.runtime.rxjava3.subscribeAsState
@@ -25,19 +24,22 @@ import androidx.compose.ui.Modifier
2524
import androidx.compose.ui.graphics.Color
2625
import androidx.compose.ui.platform.LocalContext
2726
import androidx.compose.ui.platform.LocalInspectionMode
27+
import androidx.compose.ui.res.dimensionResource
2828
import androidx.compose.ui.res.painterResource
2929
import androidx.compose.ui.res.stringResource
30-
import androidx.compose.ui.tooling.preview.Preview
30+
import androidx.compose.ui.text.style.TextAlign
3131
import androidx.compose.ui.unit.dp
3232
import androidx.compose.ui.viewinterop.AndroidView
3333
import androidx.core.os.bundleOf
3434
import androidx.fragment.app.FragmentManager
3535
import org.signal.core.ui.BottomSheets
36+
import org.signal.core.ui.DarkPreview
3637
import org.signal.core.ui.Dividers
38+
import org.signal.core.ui.Previews
3739
import org.signal.core.ui.Rows
38-
import org.signal.core.ui.theme.SignalTheme
3940
import org.signal.core.util.getParcelableCompat
4041
import org.thoughtcrime.securesms.R
42+
import org.thoughtcrime.securesms.avatar.AvatarImage
4143
import org.thoughtcrime.securesms.components.AvatarImageView
4244
import org.thoughtcrime.securesms.compose.ComposeBottomSheetDialogFragment
4345
import org.thoughtcrime.securesms.dependencies.AppDependencies
@@ -100,22 +102,20 @@ class CallLinkIncomingRequestSheet : ComposeBottomSheetDialogFragment() {
100102
}
101103
}
102104

103-
@Preview
105+
@DarkPreview
104106
@Composable
105107
private fun CallLinkIncomingRequestSheetContentPreview() {
106-
SignalTheme(isDarkMode = true) {
107-
Surface {
108-
CallLinkIncomingRequestSheetContent(
109-
state = CallLinkIncomingRequestState(
110-
name = "Miles Morales",
111-
subtitle = "+1 (555) 555-5555",
112-
groupsInCommon = "Member of Webheads",
113-
isSystemContact = true
114-
),
115-
onApproveEntry = {},
116-
onDenyEntry = {}
117-
)
118-
}
108+
Previews.BottomSheetPreview {
109+
CallLinkIncomingRequestSheetContent(
110+
state = CallLinkIncomingRequestState(
111+
name = "Miles Morales",
112+
subtitle = "+1 (555) 555-5555",
113+
groupsInCommon = "Member of Webheads, Group B, Group C, Group D, and 83 others.",
114+
isSystemContact = true
115+
),
116+
onApproveEntry = {},
117+
onDenyEntry = {}
118+
)
119119
}
120120
}
121121

@@ -130,7 +130,7 @@ private fun CallLinkIncomingRequestSheetContent(
130130
horizontalAlignment = Alignment.CenterHorizontally
131131
) {
132132
item { BottomSheets.Handle() }
133-
item { Avatar(state.recipient) }
133+
item { AvatarImage(recipient = state.recipient, modifier = Modifier.size(80.dp)) }
134134
item {
135135
Title(
136136
recipientName = state.name,
@@ -151,8 +151,9 @@ private fun CallLinkIncomingRequestSheetContent(
151151
item {
152152
Text(
153153
text = state.groupsInCommon,
154+
textAlign = TextAlign.Center,
154155
style = MaterialTheme.typography.bodyMedium,
155-
modifier = Modifier.padding(6.dp)
156+
modifier = Modifier.padding(vertical = 6.dp, horizontal = dimensionResource(R.dimen.core_ui__gutter))
156157
)
157158
}
158159
}

0 commit comments

Comments
 (0)