Reduce the timeout for the popup window and allow users to click to dismiss.

This commit is contained in:
Alex Hart
2025-11-10 12:02:05 -04:00
parent 2225a14e13
commit ddaabafe44
2 changed files with 23 additions and 6 deletions

View File

@@ -30,7 +30,7 @@ import java.util.concurrent.TimeUnit;
public class CallParticipantsListUpdatePopupWindow extends PopupWindow implements DefaultLifecycleObserver {
private static final long DURATION = TimeUnit.SECONDS.toMillis(10);
private static final long DURATION = TimeUnit.SECONDS.toMillis(5);
private final ViewGroup parent;
private final AvatarImageView avatarImageView;
@@ -55,6 +55,7 @@ public class CallParticipantsListUpdatePopupWindow extends PopupWindow implement
this.handler = new Handler(Looper.getMainLooper());
setOnDismissListener(this::showPending);
getContentView().setOnClickListener(v -> dismiss());
setAnimationStyle(R.style.PopupAnimation);
}

View File

@@ -12,6 +12,7 @@ import androidx.compose.animation.fadeOut
import androidx.compose.animation.slideInVertically
import androidx.compose.animation.slideOutVertically
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
@@ -36,6 +37,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import kotlinx.coroutines.delay
@@ -81,11 +83,19 @@ fun CallParticipantUpdatePopup(
.fillMaxWidth()
) {
LaunchedEffect(controller.displayState, controller.participants) {
delay(controller.displayDuration)
controller.hide()
if (controller.displayState != DisplayState.NONE) {
delay(controller.displayDuration)
controller.hide()
}
}
PopupContent(controller.displayState, participants = controller.participants)
PopupContent(
displayState = controller.displayState,
participants = controller.participants,
onClick = {
controller.hide()
}
)
}
}
@@ -95,7 +105,8 @@ fun CallParticipantUpdatePopup(
@Composable
private fun PopupContent(
displayState: DisplayState,
participants: Set<CallParticipantListUpdate.Wrapper>
participants: Set<CallParticipantListUpdate.Wrapper>,
onClick: () -> Unit
) {
val context = LocalContext.current
@@ -144,6 +155,10 @@ private fun PopupContent(
color = colorResource(R.color.signal_light_colorSecondaryContainer),
shape = RoundedCornerShape(percent = 50)
)
.clickable(
onClick = onClick,
role = Role.Button
)
) {
Box(
modifier = Modifier.size(48.dp)
@@ -250,7 +265,8 @@ private fun PopupContentPreview() {
Previews.Preview {
PopupContent(
displayState = DisplayState.ADD,
participants = participants.take(1).map { CallParticipantListUpdate.createWrapper(it) }.toSet()
participants = participants.take(1).map { CallParticipantListUpdate.createWrapper(it) }.toSet(),
onClick = {}
)
}
}