From ec6bcec849769b8b24359f82ee09925c5c0cf096 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 16 Apr 2020 00:08:58 +0200 Subject: [PATCH] use different aspect ratio for landscape --- .../conversations/ui/RtpSessionActivity.java | 20 +++++- .../xmpp/jingle/JingleRtpConnection.java | 3 +- src/main/res/layout/activity_rtp_session.xml | 10 +-- src/main/res/values-land/dimens.xml | 4 ++ src/main/res/values/dimens.xml | 62 ++++++++++--------- 5 files changed, 62 insertions(+), 37 deletions(-) create mode 100644 src/main/res/values-land/dimens.xml diff --git a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java index be8c21862..05fcf035b 100644 --- a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java @@ -304,7 +304,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe putScreenInCallMode(); } binding.with.setText(getWith().getDisplayName()); - updateVideoViews(); + updateVideoViews(currentState); updateStateDisplay(currentState); updateButtonConfiguration(currentState); } @@ -508,7 +508,14 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe this.binding.inCallActionLeft.setVisibility(View.VISIBLE); } - private void updateVideoViews() { + private void updateVideoViews(final RtpEndUserState state) { + if (END_CARD.contains(state) || state == RtpEndUserState.ENDING_CALL) { + binding.localVideo.setVisibility(View.GONE); + binding.remoteVideo.setVisibility(View.GONE); + binding.appBarLayout.setVisibility(View.VISIBLE); + getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); + return; + } final Optional localVideoTrack = requireRtpConnection().geLocalVideoTrack(); if (localVideoTrack.isPresent()) { ensureSurfaceViewRendererIsSetup(binding.localVideo); @@ -523,7 +530,10 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe if (remoteVideoTrack.isPresent()) { ensureSurfaceViewRendererIsSetup(binding.remoteVideo); remoteVideoTrack.get().addSink(binding.remoteVideo); + binding.appBarLayout.setVisibility(View.GONE); + getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); } else { + getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); binding.remoteVideo.setVisibility(View.GONE); } } @@ -590,6 +600,10 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe return; } if (this.rtpConnectionReference == null) { + if (END_CARD.contains(state)) { + Log.d(Config.LOGTAG,"not reinitializing session"); + return; + } //this happens when going from proposed session to actual session reInitializeActivityWithRunningRapSession(account, with, sessionId); return; @@ -607,7 +621,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe updateStateDisplay(state); updateButtonConfiguration(state); //TODO kill video when in final or error stages - updateVideoViews(); + updateVideoViews(state); }); } else { Log.d(Config.LOGTAG, "received update for other rtp session"); diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java index 5e2446788..7682c1b91 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java @@ -910,7 +910,6 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web @Override public void onConnectionChange(final PeerConnection.PeerConnectionState newState) { Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": PeerConnectionState changed to " + newState); - updateEndUserState(); if (newState == PeerConnection.PeerConnectionState.CONNECTED && this.rtpConnectionStarted == 0) { this.rtpConnectionStarted = SystemClock.elapsedRealtime(); } @@ -920,6 +919,8 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web return; } sendSessionTerminate(Reason.CONNECTIVITY_ERROR); + } else { + updateEndUserState(); } } diff --git a/src/main/res/layout/activity_rtp_session.xml b/src/main/res/layout/activity_rtp_session.xml index a9b279334..f9eba40b0 100644 --- a/src/main/res/layout/activity_rtp_session.xml +++ b/src/main/res/layout/activity_rtp_session.xml @@ -11,7 +11,8 @@ + android:layout_height="wrap_content" + android:visibility="visible"> + 96dp + 128dp + \ No newline at end of file diff --git a/src/main/res/values/dimens.xml b/src/main/res/values/dimens.xml index 9eb4b102b..ae22105c8 100644 --- a/src/main/res/values/dimens.xml +++ b/src/main/res/values/dimens.xml @@ -1,38 +1,42 @@ - - 8dp - 8dp - 16dp - 8dp - 8dp - 12dp - 48dp - 11sp - 224dp - 16dp + + 8dp + 8dp + 16dp + 8dp + 8dp + 12dp + 48dp + + 11sp + 224dp + 16dp - 80dp - 56dp - 96dp - 4dp + 80dp + 56dp + 96dp + 4dp - 8dp - 96dp - 32dp - 48dp - 56dp - 56dp + 8dp + 96dp + 32dp + 48dp + 56dp + 56dp - 4dp - 4dp + 4dp + 4dp - - 4dp - 8dp + + 4dp + 8dp - 1200dp + 1200dp - 0.12 + 0.12 - 256dp + 256dp + + 128dp + 96dp