use different aspect ratio for landscape

This commit is contained in:
Daniel Gultsch 2020-04-16 00:08:58 +02:00
parent 36e117979a
commit ec6bcec849
5 changed files with 62 additions and 37 deletions

View File

@ -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<VideoTrack> 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");

View File

@ -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();
}
}

View File

@ -11,7 +11,8 @@
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:visibility="visible">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
@ -36,9 +37,10 @@
</android.support.design.widget.AppBarLayout>
<org.webrtc.SurfaceViewRenderer
app:elevation="4dp"
android:id="@+id/local_video"
android:layout_width="80dp"
android:layout_height="128dp"
android:layout_width="@dimen/local_video_preview_width"
android:layout_height="@dimen/local_video_preview_height"
android:layout_below="@+id/app_bar_layout"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
@ -50,7 +52,7 @@
<org.webrtc.SurfaceViewRenderer
android:id="@+id/remote_video"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_height="match_parent"
android:layout_below="@+id/app_bar_layout"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"

View File

@ -0,0 +1,4 @@
<resources>
<dimen name="local_video_preview_height">96dp</dimen>
<dimen name="local_video_preview_width">128dp</dimen>
</resources>

View File

@ -1,38 +1,42 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">8dp</dimen>
<dimen name="activity_vertical_margin">8dp</dimen>
<dimen name="card_padding_regular">16dp</dimen>
<dimen name="card_padding_list">8dp</dimen> <!-- card_padding_regular minus list_padding -->
<dimen name="list_padding">8dp</dimen>
<dimen name="image_button_padding">12dp</dimen>
<dimen name="key_action_width">48dp</dimen> <!-- icon width (24dp) + 2 * image button padding -->
<dimen name="fineprint_size">11sp</dimen>
<dimen name="audio_player_width">224dp</dimen>
<dimen name="avatar_item_distance">16dp</dimen>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">8dp</dimen>
<dimen name="activity_vertical_margin">8dp</dimen>
<dimen name="card_padding_regular">16dp</dimen>
<dimen name="card_padding_list">8dp</dimen> <!-- card_padding_regular minus list_padding -->
<dimen name="list_padding">8dp</dimen>
<dimen name="image_button_padding">12dp</dimen>
<dimen name="key_action_width">48dp
</dimen> <!-- icon width (24dp) + 2 * image button padding -->
<dimen name="fineprint_size">11sp</dimen>
<dimen name="audio_player_width">224dp</dimen>
<dimen name="avatar_item_distance">16dp</dimen>
<dimen name="media_preview_size">80dp</dimen>
<dimen name="media_size">56dp</dimen> <!-- ideally not larger than avatar_on_details_screen -->
<dimen name="browser_media_size">96dp</dimen>
<dimen name="toolbar_elevation">4dp</dimen>
<dimen name="media_preview_size">80dp</dimen>
<dimen name="media_size">56dp</dimen> <!-- ideally not larger than avatar_on_details_screen -->
<dimen name="browser_media_size">96dp</dimen>
<dimen name="toolbar_elevation">4dp</dimen>
<dimen name="publish_avatar_top_margin">8dp</dimen>
<dimen name="publish_avatar_size">96dp</dimen>
<dimen name="avatar_on_status_message">32dp</dimen>
<dimen name="avatar">48dp</dimen>
<dimen name="avatar_on_details_screen_size">56dp</dimen>
<dimen name="avatar_on_conversation_overview">56dp</dimen>
<dimen name="publish_avatar_top_margin">8dp</dimen>
<dimen name="publish_avatar_size">96dp</dimen>
<dimen name="avatar_on_status_message">32dp</dimen>
<dimen name="avatar">48dp</dimen>
<dimen name="avatar_on_details_screen_size">56dp</dimen>
<dimen name="avatar_on_conversation_overview">56dp</dimen>
<dimen name="input_label_vertical_spacing">4dp</dimen>
<dimen name="input_label_horizontal_spacing">4dp</dimen>
<dimen name="input_label_vertical_spacing">4dp</dimen>
<dimen name="input_label_horizontal_spacing">4dp</dimen>
<!-- scanner -->
<dimen name="scan_laser_width">4dp</dimen>
<dimen name="scan_dot_size">8dp</dimen>
<!-- scanner -->
<dimen name="scan_laser_width">4dp</dimen>
<dimen name="scan_dot_size">8dp</dimen>
<dimen name="swipe_escape_velocity">1200dp</dimen> <!-- android default is 120dp -->
<dimen name="swipe_escape_velocity">1200dp</dimen> <!-- android default is 120dp -->
<dimen name="background_image_opacity">0.12</dimen>
<dimen name="background_image_opacity">0.12</dimen>
<dimen name="sd_label_max_width">256dp</dimen>
<dimen name="sd_label_max_width">256dp</dimen>
<dimen name="local_video_preview_height">128dp</dimen>
<dimen name="local_video_preview_width">96dp</dimen>
</resources>