Can switch camera

This commit is contained in:
Pierre HUBERT 2019-02-27 10:17:44 +01:00
parent 8d87b8dc57
commit db3f22e058
5 changed files with 40 additions and 5 deletions

View File

@ -119,6 +119,7 @@ public class CallActivity extends BaseActivity implements SignalExchangerCallbac
private LinearLayout mRemoteVideosLayout;
private SurfaceViewRenderer mLocalVideoView;
private View mButtonsView;
private ImageButton mSwitchCameraButton;
@Override
@ -206,6 +207,8 @@ public class CallActivity extends BaseActivity implements SignalExchangerCallbac
mRemoteVideosLayout = findViewById(R.id.remoteVideosLayout);
mLocalVideoView = findViewById(R.id.local_video);
mButtonsView = findViewById(R.id.buttonsLayout);
mSwitchCameraButton = findViewById(R.id.switchCameraButton);
mSwitchCameraButton.setOnClickListener(v -> switchCamera());
}
@ -459,6 +462,11 @@ public class CallActivity extends BaseActivity implements SignalExchangerCallbac
}
private void switchCamera(){
for(CallPeerConnection c : mList)
c.getPeerConnectionClient().switchCamera();
}
private void switchButtonsVisibility(){
boolean show = !getSupportActionBar().isShowing();

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M20,4h-3.17L15,2L9,2L7.17,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2zM15,15.5L15,13L9,13v2.5L5.5,12 9,8.5L9,11h6L15,8.5l3.5,3.5 -3.5,3.5z"/>
</vector>

View File

@ -43,11 +43,11 @@
<android.support.constraint.ConstraintLayout
android:id="@+id/buttonsLayout"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"
android:background="@android:color/black"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
@ -62,7 +62,23 @@
android:tint="@android:color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/switchCameraButton"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:contentDescription="@string/action_switch_camera"
android:src="@drawable/ic_camera_switch"
android:tint="@android:color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/hangUp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>

View File

@ -333,4 +333,5 @@
<string name="err_connect_signaling_server">Impossible de connecter au signaling server !</string>
<string name="notice_call_terminated">Appel terminé.</string>
<string name="action_hang_up">Raccrocher</string>
<string name="action_switch_camera">Changer de caméra</string>
</resources>

View File

@ -332,4 +332,5 @@
<string name="err_connect_signaling_server">Could not connect to signaling server!</string>
<string name="notice_call_terminated">Call terminated</string>
<string name="action_hang_up">Hang up</string>
<string name="action_switch_camera">Switch camera</string>
</resources>