Transition full screen call UX to terminal state when call handled by linked device.

This commit is contained in:
Cody Henthorne 2024-04-04 11:53:29 -04:00 committed by Greyson Parrelli
parent 16588c401e
commit dd28523b05
8 changed files with 27 additions and 17 deletions

View file

@ -34,7 +34,7 @@ public class CallParticipantsLayout extends FlexboxLayout {
private CallParticipant focusedParticipant = null;
private boolean shouldRenderInPip;
private boolean isPortrait;
private boolean isIncomingRing;
private boolean hideAvatar;
private int navBarBottomInset;
private LayoutStrategy layoutStrategy;
@ -54,7 +54,7 @@ public class CallParticipantsLayout extends FlexboxLayout {
@NonNull CallParticipant focusedParticipant,
boolean shouldRenderInPip,
boolean isPortrait,
boolean isIncomingRing,
boolean hideAvatar,
int navBarBottomInset,
@NonNull LayoutStrategy layoutStrategy)
{
@ -62,7 +62,7 @@ public class CallParticipantsLayout extends FlexboxLayout {
this.focusedParticipant = focusedParticipant;
this.shouldRenderInPip = shouldRenderInPip;
this.isPortrait = isPortrait;
this.isIncomingRing = isIncomingRing;
this.hideAvatar = hideAvatar;
this.navBarBottomInset = navBarBottomInset;
this.layoutStrategy = layoutStrategy;
@ -134,7 +134,7 @@ public class CallParticipantsLayout extends FlexboxLayout {
callParticipantView.setBottomInset(navBarBottomInset);
}
if (isIncomingRing) {
if (hideAvatar) {
callParticipantView.hideAvatar();
} else {
callParticipantView.showAvatar();

View file

@ -49,7 +49,7 @@ data class CallParticipantsState(
val allRemoteParticipants: List<CallParticipant> = remoteParticipants.allParticipants
val isFolded: Boolean = foldableState.isFolded
val isLargeVideoGroup: Boolean = allRemoteParticipants.size > SMALL_GROUP_MAX && !isInPipMode && !isFolded
val isIncomingRing: Boolean = callState == WebRtcViewModel.State.CALL_INCOMING
val hideAvatar: Boolean = callState.isIncomingOrHandledElsewhere
val raisedHands: List<GroupCallRaiseHandEvent>
get() {

View file

@ -16,7 +16,7 @@ class WebRtcCallParticipantsPage {
private final boolean isRenderInPip;
private final boolean isPortrait;
private final boolean isLandscapeEnabled;
private final boolean isIncomingRing;
private final boolean hideAvatar;
private final int navBarBottomInset;
static WebRtcCallParticipantsPage forMultipleParticipants(@NonNull List<CallParticipant> callParticipants,
@ -24,10 +24,10 @@ class WebRtcCallParticipantsPage {
boolean isRenderInPip,
boolean isPortrait,
boolean isLandscapeEnabled,
boolean isIncomingRing,
boolean hideAvatar,
int navBarBottomInset)
{
return new WebRtcCallParticipantsPage(callParticipants, focusedParticipant, false, isRenderInPip, isPortrait, isLandscapeEnabled, isIncomingRing, navBarBottomInset);
return new WebRtcCallParticipantsPage(callParticipants, focusedParticipant, false, isRenderInPip, isPortrait, isLandscapeEnabled, hideAvatar, navBarBottomInset);
}
static WebRtcCallParticipantsPage forSingleParticipant(@NonNull CallParticipant singleParticipant,
@ -44,7 +44,7 @@ class WebRtcCallParticipantsPage {
boolean isRenderInPip,
boolean isPortrait,
boolean isLandscapeEnabled,
boolean isIncomingRing,
boolean hideAvatar,
int navBarBottomInset)
{
this.callParticipants = callParticipants;
@ -53,7 +53,7 @@ class WebRtcCallParticipantsPage {
this.isRenderInPip = isRenderInPip;
this.isPortrait = isPortrait;
this.isLandscapeEnabled = isLandscapeEnabled;
this.isIncomingRing = isIncomingRing;
this.hideAvatar = hideAvatar;
this.navBarBottomInset = navBarBottomInset;
}
@ -77,8 +77,8 @@ class WebRtcCallParticipantsPage {
return isPortrait;
}
public boolean isIncomingRing() {
return isIncomingRing;
public boolean shouldHideAvatar() {
return hideAvatar;
}
public int getNavBarBottomInset() {
@ -98,7 +98,7 @@ class WebRtcCallParticipantsPage {
isRenderInPip == that.isRenderInPip &&
isPortrait == that.isPortrait &&
isLandscapeEnabled == that.isLandscapeEnabled &&
isIncomingRing == that.isIncomingRing &&
hideAvatar == that.hideAvatar &&
callParticipants.equals(that.callParticipants) &&
focusedParticipant.equals(that.focusedParticipant) &&
navBarBottomInset == that.navBarBottomInset;
@ -106,6 +106,6 @@ class WebRtcCallParticipantsPage {
@Override
public int hashCode() {
return Objects.hash(callParticipants, focusedParticipant, isSpeaker, isRenderInPip, isPortrait, isLandscapeEnabled, isIncomingRing, navBarBottomInset);
return Objects.hash(callParticipants, focusedParticipant, isSpeaker, isRenderInPip, isPortrait, isLandscapeEnabled, hideAvatar, navBarBottomInset);
}
}

View file

@ -86,7 +86,7 @@ class WebRtcCallParticipantsPagerAdapter extends ListAdapter<WebRtcCallParticipa
@Override
void bind(WebRtcCallParticipantsPage page) {
callParticipantsLayout.update(page.getCallParticipants(), page.getFocusedParticipant(), page.isRenderInPip(), page.isPortrait(), page.isIncomingRing(), page.getNavBarBottomInset(), page.getLayoutStrategy());
callParticipantsLayout.update(page.getCallParticipants(), page.getFocusedParticipant(), page.isRenderInPip(), page.isPortrait(), page.shouldHideAvatar(), page.getNavBarBottomInset(), page.getLayoutStrategy());
}
}

View file

@ -429,7 +429,7 @@ public class WebRtcCallView extends InsetAwareConstraintLayout {
List<WebRtcCallParticipantsPage> pages = new ArrayList<>(2);
if (!state.getGridParticipants().isEmpty()) {
pages.add(WebRtcCallParticipantsPage.forMultipleParticipants(state.getGridParticipants(), state.getFocusedParticipant(), state.isInPipMode(), isPortrait, isLandscapeEnabled, state.isIncomingRing(), navBarBottomInset));
pages.add(WebRtcCallParticipantsPage.forMultipleParticipants(state.getGridParticipants(), state.getFocusedParticipant(), state.isInPipMode(), isPortrait, isLandscapeEnabled, state.getHideAvatar(), navBarBottomInset));
}
if (state.getFocusedParticipant() != CallParticipant.EMPTY && state.getAllRemoteParticipants().size() > 1) {

View file

@ -416,6 +416,8 @@ public class WebRtcCallViewModel extends ViewModel {
case CALL_ACCEPTED_ELSEWHERE:
case CALL_DECLINED_ELSEWHERE:
case CALL_ONGOING_ELSEWHERE:
callState = WebRtcControls.CallState.HANDLED_ELSEWHERE;
break;
case CALL_NEEDS_PERMISSION:
case CALL_BUSY:
case CALL_DISCONNECTED:

View file

@ -105,7 +105,7 @@ public final class WebRtcControls {
* This is only true at the very start of a call and will then never be true again
*/
public boolean hideControlsSheetInitially() {
return displayIncomingCallButtons() || callState == CallState.NONE;
return displayIncomingCallButtons() || callState == CallState.NONE || isHandledElsewhere();
}
public boolean displayErrorControls() {
@ -263,6 +263,10 @@ public final class WebRtcControls {
return callState == CallState.INCOMING;
}
private boolean isHandledElsewhere() {
return callState == CallState.HANDLED_ELSEWHERE;
}
private boolean isAtLeastOutgoing() {
return callState.isAtLeast(CallState.OUTGOING);
}
@ -284,6 +288,7 @@ public final class WebRtcControls {
public enum CallState {
NONE,
ERROR,
HANDLED_ELSEWHERE,
PRE_JOIN,
RECONNECTING,
INCOMING,

View file

@ -51,6 +51,9 @@ class WebRtcViewModel(state: WebRtcServiceState) {
val inOngoingCall: Boolean
get() = this == CALL_INCOMING || this == CALL_OUTGOING || this == CALL_CONNECTED || this == CALL_RINGING || this == CALL_RECONNECTING
val isIncomingOrHandledElsewhere
get() = this == CALL_INCOMING || this == CALL_ACCEPTED_ELSEWHERE || this == CALL_DECLINED_ELSEWHERE || this == CALL_ONGOING_ELSEWHERE
}
enum class GroupCallState {