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

View File

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