mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-23 13:59:29 +00:00
Can stop microphone
This commit is contained in:
parent
f17909886d
commit
4ba29bccd2
@ -98,6 +98,7 @@ public class CallActivity extends BaseActivity implements SignalExchangerCallbac
|
|||||||
*/
|
*/
|
||||||
private boolean mStopped = false;
|
private boolean mStopped = false;
|
||||||
private boolean mIsCameraStopped = false;
|
private boolean mIsCameraStopped = false;
|
||||||
|
private boolean mIsMicrophoneStopped = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connections list
|
* Connections list
|
||||||
@ -121,6 +122,7 @@ public class CallActivity extends BaseActivity implements SignalExchangerCallbac
|
|||||||
private SurfaceViewRenderer mLocalVideoView;
|
private SurfaceViewRenderer mLocalVideoView;
|
||||||
private View mButtonsView;
|
private View mButtonsView;
|
||||||
private ImageButton mStopCameraButton;
|
private ImageButton mStopCameraButton;
|
||||||
|
private ImageButton mStopMicrophoneButton;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -216,6 +218,8 @@ public class CallActivity extends BaseActivity implements SignalExchangerCallbac
|
|||||||
mStopCameraButton = findViewById(R.id.stopCameraButton);
|
mStopCameraButton = findViewById(R.id.stopCameraButton);
|
||||||
mStopCameraButton.setOnClickListener(v -> toggleStopCamera());
|
mStopCameraButton.setOnClickListener(v -> toggleStopCamera());
|
||||||
|
|
||||||
|
mStopMicrophoneButton = findViewById(R.id.stopMicrophoneButton);
|
||||||
|
mStopMicrophoneButton.setOnClickListener(v -> toggleStopMicrophone());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -487,6 +491,16 @@ public class CallActivity extends BaseActivity implements SignalExchangerCallbac
|
|||||||
mIsCameraStopped ? R.drawable.ic_videocam_off : R.drawable.ic_videocam));
|
mIsCameraStopped ? R.drawable.ic_videocam_off : R.drawable.ic_videocam));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void toggleStopMicrophone(){
|
||||||
|
mIsMicrophoneStopped = !mIsMicrophoneStopped;
|
||||||
|
|
||||||
|
for(CallPeerConnection c : mList)
|
||||||
|
c.getPeerConnectionClient().setAudioEnabled(!mIsMicrophoneStopped);
|
||||||
|
|
||||||
|
mStopMicrophoneButton.setImageDrawable(UiUtils.getDrawable(this,
|
||||||
|
mIsMicrophoneStopped ? R.drawable.ic_mic_off : R.drawable.ic_mic));
|
||||||
|
}
|
||||||
|
|
||||||
private void switchButtonsVisibility(){
|
private void switchButtonsVisibility(){
|
||||||
|
|
||||||
boolean show = !getSupportActionBar().isShowing();
|
boolean show = !getSupportActionBar().isShowing();
|
||||||
|
9
app/src/main/res/drawable/ic_mic.xml
Normal file
9
app/src/main/res/drawable/ic_mic.xml
Normal 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="M12,14c1.66,0 2.99,-1.34 2.99,-3L15,5c0,-1.66 -1.34,-3 -3,-3S9,3.34 9,5v6c0,1.66 1.34,3 3,3zM17.3,11c0,3 -2.54,5.1 -5.3,5.1S6.7,14 6.7,11L5,11c0,3.41 2.72,6.23 6,6.72L11,21h2v-3.28c3.28,-0.48 6,-3.3 6,-6.72h-1.7z"/>
|
||||||
|
</vector>
|
9
app/src/main/res/drawable/ic_mic_off.xml
Normal file
9
app/src/main/res/drawable/ic_mic_off.xml
Normal 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="M19,11h-1.7c0,0.74 -0.16,1.43 -0.43,2.05l1.23,1.23c0.56,-0.98 0.9,-2.09 0.9,-3.28zM14.98,11.17c0,-0.06 0.02,-0.11 0.02,-0.17L15,5c0,-1.66 -1.34,-3 -3,-3S9,3.34 9,5v0.18l5.98,5.99zM4.27,3L3,4.27l6.01,6.01L9.01,11c0,1.66 1.33,3 2.99,3 0.22,0 0.44,-0.03 0.65,-0.08l1.66,1.66c-0.71,0.33 -1.5,0.52 -2.31,0.52 -2.76,0 -5.3,-2.1 -5.3,-5.1L5,11c0,3.41 2.72,6.23 6,6.72L11,21h2v-3.28c0.91,-0.13 1.77,-0.45 2.54,-0.9L19.73,21 21,19.73 4.27,3z"/>
|
||||||
|
</vector>
|
@ -59,8 +59,8 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="0dp"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="0dp"
|
||||||
android:contentDescription="@string/action_switch_camera"
|
android:contentDescription="@string/action_switch_camera"
|
||||||
android:src="@drawable/ic_camera_switch"
|
android:src="@drawable/ic_camera_switch"
|
||||||
android:tint="@android:color/white" />
|
android:tint="@android:color/white" />
|
||||||
@ -71,8 +71,8 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="0dp"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="0dp"
|
||||||
android:contentDescription="@string/action_stop_camera"
|
android:contentDescription="@string/action_stop_camera"
|
||||||
android:src="@drawable/ic_videocam"
|
android:src="@drawable/ic_videocam"
|
||||||
android:tint="@android:color/white" />
|
android:tint="@android:color/white" />
|
||||||
@ -82,11 +82,25 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
android:backgroundTint="@color/holo_red_dark"
|
android:backgroundTint="@color/holo_red_dark"
|
||||||
android:contentDescription="@string/action_hang_up"
|
android:contentDescription="@string/action_hang_up"
|
||||||
android:src="@drawable/ic_call"
|
android:src="@drawable/ic_call"
|
||||||
android:tint="@android:color/white" />
|
android:tint="@android:color/white" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/stopMicrophoneButton"
|
||||||
|
style="@style/Widget.AppCompat.Button.Borderless"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_marginStart="0dp"
|
||||||
|
android:layout_marginEnd="0dp"
|
||||||
|
android:contentDescription="@string/action_stop_camera"
|
||||||
|
android:src="@drawable/ic_mic"
|
||||||
|
android:tint="@android:color/white" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
Loading…
Reference in New Issue
Block a user