diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/CallActivity.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/CallActivity.java index cf699b6..651ca22 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/CallActivity.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/CallActivity.java @@ -31,6 +31,7 @@ import org.communiquons.android.comunic.client.ui.asynctasks.HangUpCallTask; import org.communiquons.android.comunic.client.ui.asynctasks.RespondToCallTask; import org.communiquons.android.comunic.client.ui.models.CallPeerConnection; import org.communiquons.android.comunic.client.ui.receivers.PendingCallsBroadcastReceiver; +import org.communiquons.android.comunic.client.ui.utils.UiUtils; import org.communiquons.signalexchangerclient.SignalExchangerCallback; import org.communiquons.signalexchangerclient.SignalExchangerClient; import org.communiquons.signalexchangerclient.SignalExchangerInitConfig; @@ -96,7 +97,7 @@ public class CallActivity extends BaseActivity implements SignalExchangerCallbac * Specify whether call was stopped or not */ private boolean mStopped = false; - + private boolean mIsCameraStopped = false; /** * Connections list @@ -119,7 +120,7 @@ public class CallActivity extends BaseActivity implements SignalExchangerCallbac private LinearLayout mRemoteVideosLayout; private SurfaceViewRenderer mLocalVideoView; private View mButtonsView; - private ImageButton mSwitchCameraButton; + private ImageButton mStopCameraButton; @Override @@ -202,13 +203,19 @@ public class CallActivity extends BaseActivity implements SignalExchangerCallbac private void initViews(){ mProgressBar = findViewById(R.id.progressBar); - mHangUpButton = findViewById(R.id.hangUp); - mHangUpButton.setOnClickListener(v -> hangUp()); 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()); + + mHangUpButton = findViewById(R.id.hangUp); + mHangUpButton.setOnClickListener(v -> hangUp()); + + ImageButton switchCameraButton = findViewById(R.id.switchCameraButton); + switchCameraButton.setOnClickListener(v -> switchCamera()); + + mStopCameraButton = findViewById(R.id.stopCameraButton); + mStopCameraButton.setOnClickListener(v -> toggleStopCamera()); + } @@ -467,6 +474,19 @@ public class CallActivity extends BaseActivity implements SignalExchangerCallbac c.getPeerConnectionClient().switchCamera(); } + private void toggleStopCamera(){ + mIsCameraStopped = !mIsCameraStopped; + for(CallPeerConnection c : mList) { + if(mIsCameraStopped) + c.getPeerConnectionClient().stopVideoSource(); + else + c.getPeerConnectionClient().startVideoSource(); + } + + mStopCameraButton.setImageDrawable(UiUtils.getDrawable(this, + mIsCameraStopped ? R.drawable.ic_videocam_off : R.drawable.ic_videocam)); + } + private void switchButtonsVisibility(){ boolean show = !getSupportActionBar().isShowing(); diff --git a/app/src/main/res/drawable/ic_videocam.xml b/app/src/main/res/drawable/ic_videocam.xml new file mode 100644 index 0000000..24f4a32 --- /dev/null +++ b/app/src/main/res/drawable/ic_videocam.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_videocam_off.xml b/app/src/main/res/drawable/ic_videocam_off.xml new file mode 100644 index 0000000..f15568a --- /dev/null +++ b/app/src/main/res/drawable/ic_videocam_off.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/activity_call.xml b/app/src/main/res/layout/activity_call.xml index 54fb174..e13d783 100644 --- a/app/src/main/res/layout/activity_call.xml +++ b/app/src/main/res/layout/activity_call.xml @@ -41,7 +41,7 @@ app:layout_constraintBottom_toTopOf="@+id/buttonsLayout" app:layout_constraintEnd_toEndOf="parent" /> - - - + app:layout_constraintStart_toStartOf="parent" + android:orientation="horizontal"> + android:tint="@android:color/white" /> - + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index a0fba68..0ad1596 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -334,4 +334,5 @@ Appel terminé. Raccrocher Changer de caméra + Arrêter la caméra \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e578257..e414624 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -333,4 +333,5 @@ Call terminated Hang up Switch camera + Stop camera