show toast after failure to disable video

(cherry picked from commit d95b30f71661644ccd43da6380c9e1706df91204)
This commit is contained in:
Daniel Gultsch 2024-08-05 12:55:37 +02:00 committed by Arne
parent 83afc93fa6
commit 49ea241655
2 changed files with 9 additions and 3 deletions

View file

@ -1168,7 +1168,7 @@ public class RtpSessionActivity extends XmppActivity
MainThreadExecutor.getInstance());
}
private void enableVideo(View view) {
private void enableVideo(final View view) {
try {
requireRtpConnection().setVideoEnabled(true);
} catch (final IllegalStateException e) {
@ -1178,14 +1178,19 @@ public class RtpSessionActivity extends XmppActivity
updateInCallButtonConfigurationVideo(true, requireRtpConnection().isCameraSwitchable());
}
private void disableVideo(View view) {
private void disableVideo(final View view) {
final JingleRtpConnection rtpConnection = requireRtpConnection();
final ContentAddition pending = rtpConnection.getPendingContentAddition();
if (pending != null && pending.direction == ContentAddition.Direction.OUTGOING) {
rtpConnection.retractContentAdd();
return;
}
requireRtpConnection().setVideoEnabled(false);
try {
requireRtpConnection().setVideoEnabled(false);
} catch (final IllegalStateException e) {
Toast.makeText(this, R.string.could_not_disable_video, Toast.LENGTH_SHORT).show();
return;
}
updateInCallButtonConfigurationVideo(false, requireRtpConnection().isCameraSwitchable());
}

View file

@ -1000,6 +1000,7 @@
<string name="no_active_accounts_support_this">No active accounts support this feature</string>
<string name="backup_started_message">The backup has been started. Youll get a notification once it has been completed.</string>
<string name="unable_to_enable_video">Unable to enable video.</string>
<string name="could_not_disable_video">Could not disable video.</string>
<string name="plain_text_document">Plain text document</string>
<string name="account_registrations_are_not_supported">Account registrations are not supported</string>
<string name="no_xmpp_adddress_found">No Jabber ID found</string>