use toolbar to display status text in RtpSessionActivity

This commit is contained in:
Daniel Gultsch 2020-04-14 19:35:26 +02:00
parent 339bdaea06
commit b20b00e77f
2 changed files with 29 additions and 25 deletions

View file

@ -70,6 +70,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
Log.d(Config.LOGTAG, "RtpSessionActivity.onCreate()");
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_rtp_session);
setSupportActionBar(binding.toolbar);
}
@Override
@ -314,34 +315,34 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
private void updateStateDisplay(final RtpEndUserState state) {
switch (state) {
case INCOMING_CALL:
binding.status.setText(R.string.rtp_state_incoming_call);
setTitle(R.string.rtp_state_incoming_call);
break;
case CONNECTING:
binding.status.setText(R.string.rtp_state_connecting);
setTitle(R.string.rtp_state_connecting);
break;
case CONNECTED:
binding.status.setText(R.string.rtp_state_connected);
setTitle(R.string.rtp_state_connected);
break;
case ACCEPTING_CALL:
binding.status.setText(R.string.rtp_state_accepting_call);
setTitle(R.string.rtp_state_accepting_call);
break;
case ENDING_CALL:
binding.status.setText(R.string.rtp_state_ending_call);
setTitle(R.string.rtp_state_ending_call);
break;
case FINDING_DEVICE:
binding.status.setText(R.string.rtp_state_finding_device);
setTitle(R.string.rtp_state_finding_device);
break;
case RINGING:
binding.status.setText(R.string.rtp_state_ringing);
setTitle(R.string.rtp_state_ringing);
break;
case DECLINED_OR_BUSY:
binding.status.setText(R.string.rtp_state_declined_or_busy);
setTitle(R.string.rtp_state_declined_or_busy);
break;
case CONNECTIVITY_ERROR:
binding.status.setText(R.string.rtp_state_connectivity_error);
setTitle(R.string.rtp_state_connectivity_error);
break;
case APPLICATION_ERROR:
binding.status.setText(R.string.rtp_state_application_failure);
setTitle(R.string.rtp_state_application_failure);
break;
case ENDED:
throw new IllegalStateException("Activity should have called finishAndReleaseWakeLock();");

View file

@ -11,45 +11,48 @@
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:paddingTop="32dp"
android:paddingRight="16dp"
android:paddingBottom="32dp">
android:layout_height="wrap_content">
<TextView
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.Conversations.Title"
android:textColor="@color/white"
tools:text="Incoming call" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="?popupOverlayStyle" />
<TextView
android:id="@+id/with"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/status"
android:layout_marginLeft="16dp"
android:layout_marginTop="0dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="32dp"
android:textAppearance="@style/TextAppearance.Conversations.Display2"
android:textColor="@color/white"
tools:text="Juliet Capulet" />
</android.support.design.widget.AppBarLayout>
<org.webrtc.SurfaceViewRenderer
android:id="@+id/local_video"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_below="@+id/app_bar_layout"
android:layout_alignParentRight="true"/>
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:visibility="gone" />
<org.webrtc.SurfaceViewRenderer
android:id="@+id/remote_video"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_below="@+id/app_bar_layout"
android:layout_alignParentLeft="true"/>
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:visibility="gone" />
<RelativeLayout
android:layout_width="288dp"