Fix crash and UI issues in call screen.

This commit is contained in:
Cody Henthorne 2021-12-17 10:36:07 -05:00 committed by Greyson Parrelli
parent 0dcae81dba
commit 90d4069d0a
5 changed files with 25 additions and 28 deletions

View file

@ -256,7 +256,6 @@ public class WebRtcCallActivity extends BaseActivity implements SafetyNumberChan
private void processIntent(@NonNull Intent intent) {
if (ANSWER_ACTION.equals(intent.getAction())) {
viewModel.setRecipient(EventBus.getDefault().getStickyEvent(WebRtcViewModel.class).getRecipient());
handleAnswerWithAudio();
} else if (DENY_ACTION.equals(intent.getAction())) {
handleDenyCall();
@ -403,24 +402,19 @@ public class WebRtcCallActivity extends BaseActivity implements SafetyNumberChan
}
private void handleAnswerWithAudio() {
Recipient recipient = viewModel.getRecipient().get();
Permissions.with(this)
.request(Manifest.permission.RECORD_AUDIO)
.ifNecessary()
.withRationaleDialog(getString(R.string.WebRtcCallActivity_to_answer_the_call_give_signal_access_to_your_microphone),
R.drawable.ic_mic_solid_24)
.withPermanentDenialDialog(getString(R.string.WebRtcCallActivity_signal_requires_microphone_and_camera_permissions_in_order_to_make_or_receive_calls))
.onAllGranted(() -> {
callScreen.setStatus(getString(R.string.RedPhone_answering));
if (!recipient.equals(Recipient.UNKNOWN)) {
Permissions.with(this)
.request(Manifest.permission.RECORD_AUDIO)
.ifNecessary()
.withRationaleDialog(getString(R.string.WebRtcCallActivity_to_answer_the_call_from_s_give_signal_access_to_your_microphone, recipient.getDisplayName(this)),
R.drawable.ic_mic_solid_24)
.withPermanentDenialDialog(getString(R.string.WebRtcCallActivity_signal_requires_microphone_and_camera_permissions_in_order_to_make_or_receive_calls))
.onAllGranted(() -> {
callScreen.setRecipient(recipient);
callScreen.setStatus(getString(R.string.RedPhone_answering));
ApplicationDependencies.getSignalCallManager().acceptCall(false);
})
.onAnyDenied(this::handleDenyCall)
.execute();
}
ApplicationDependencies.getSignalCallManager().acceptCall(false);
})
.onAnyDenied(this::handleDenyCall)
.execute();
}
private void handleAnswerWithVideo() {

View file

@ -85,16 +85,18 @@ class WebRtcCallParticipantsPage {
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
WebRtcCallParticipantsPage that = (WebRtcCallParticipantsPage) o;
final WebRtcCallParticipantsPage that = (WebRtcCallParticipantsPage) o;
return isSpeaker == that.isSpeaker &&
isRenderInPip == that.isRenderInPip &&
focusedParticipant.equals(that.focusedParticipant) &&
isPortrait == that.isPortrait &&
isLandscapeEnabled == that.isLandscapeEnabled &&
isIncomingRing == that.isIncomingRing &&
callParticipants.equals(that.callParticipants) &&
isPortrait == that.isPortrait;
focusedParticipant.equals(that.focusedParticipant);
}
@Override
public int hashCode() {
return Objects.hash(callParticipants, isSpeaker, focusedParticipant, isRenderInPip, isPortrait);
return Objects.hash(callParticipants, focusedParticipant, isSpeaker, isRenderInPip, isPortrait, isLandscapeEnabled, isIncomingRing);
}
}

View file

@ -226,6 +226,7 @@ public class WebRtcCallView extends ConstraintLayout {
incomingCallViews.add(decline);
incomingCallViews.add(declineLabel);
incomingCallViews.add(footerGradient);
incomingCallViews.add(incomingRingStatus);
adjustableMarginsSet.add(micToggle);
adjustableMarginsSet.add(cameraDirectionToggle);
@ -589,8 +590,7 @@ public class WebRtcCallView extends ConstraintLayout {
if (webRtcControls.displayIncomingCallButtons()) {
visibleViewSet.addAll(incomingCallViews);
incomingRingStatus.setVisibility(VISIBLE);
incomingRingStatus.setText(R.string.WebRtcCallView__signal_call);
incomingRingStatus.setText(webRtcControls.displayAnswerWithAudio() ? R.string.WebRtcCallView__signal_call : R.string.WebRtcCallView__signal_video_call);
answer.setImageDrawable(AppCompatResources.getDrawable(getContext(), R.drawable.webrtc_call_screen_answer));
}
@ -599,9 +599,6 @@ public class WebRtcCallView extends ConstraintLayout {
visibleViewSet.add(answerWithAudio);
visibleViewSet.add(answerWithAudioLabel);
incomingRingStatus.setVisibility(VISIBLE);
incomingRingStatus.setText(R.string.WebRtcCallView__signal_video_call);
answer.setImageDrawable(AppCompatResources.getDrawable(getContext(), R.drawable.webrtc_call_screen_answer_with_video));
}
@ -934,8 +931,10 @@ public class WebRtcCallView extends ConstraintLayout {
constraintSet.applyTo(parent);
if (showSmallHeader) {
smallHeaderConstraints.setVisibility(incomingRingStatus.getId(), visibleViewSet.contains(incomingRingStatus) ? View.VISIBLE : View.GONE);
smallHeaderConstraints.applyTo(toolbar);
} else {
largeHeaderConstraints.setVisibility(incomingRingStatus.getId(), visibleViewSet.contains(incomingRingStatus) ? View.VISIBLE : View.GONE);
largeHeaderConstraints.applyTo(toolbar);
}
}

View file

@ -12,11 +12,12 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:drawablePadding="4dp"
android:gravity="center"
android:textAppearance="@style/TextAppearance.Signal.Body2"
android:textColor="@color/core_white"
android:visibility="gone"
app:drawableStartCompat="@drawable/ic_signal_logo_small"
android:drawablePadding="4dp"
app:layout_constraintBottom_toBottomOf="@id/action_bar_guideline"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"

View file

@ -1899,6 +1899,7 @@
<string name="UnauthorizedReminder_this_is_likely_because_you_registered_your_phone_number_with_Signal_on_a_different_device">This is likely because you registered your phone number with Signal on a different device. Tap to re-register.</string>
<!-- WebRtcCallActivity -->
<string name="WebRtcCallActivity_to_answer_the_call_give_signal_access_to_your_microphone">To answer the call, give Signal access to your microphone.</string>
<string name="WebRtcCallActivity_to_answer_the_call_from_s_give_signal_access_to_your_microphone">To answer the call from %s, give Signal access to your microphone.</string>
<string name="WebRtcCallActivity_signal_requires_microphone_and_camera_permissions_in_order_to_make_or_receive_calls">Signal requires Microphone and Camera permissions in order to make or receive calls, but they have been permanently denied. Please continue to app settings, select \"Permissions\", and enable \"Microphone\" and \"Camera\".</string>
<string name="WebRtcCallActivity__answered_on_a_linked_device">Answered on a linked device.</string>