mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 12:09:45 +01:00
parent
0123aa2cc1
commit
af95d66583
@ -34,6 +34,7 @@ import android.content.IntentFilter;
|
|||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
@ -201,6 +202,8 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private BroadcastReceiver networkBroadcastReceier;
|
private BroadcastReceiver networkBroadcastReceier;
|
||||||
|
|
||||||
|
private Handler handler = new Handler();
|
||||||
|
|
||||||
private static int getSystemUiVisibility() {
|
private static int getSystemUiVisibility() {
|
||||||
int flags = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN;
|
int flags = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN;
|
||||||
flags |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
flags |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
||||||
@ -333,9 +336,11 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
if (video) {
|
if (video) {
|
||||||
message = "videoOff";
|
message = "videoOff";
|
||||||
if (enable) {
|
if (enable) {
|
||||||
|
microphoneControlButton.setAlpha(1.0f);
|
||||||
message = "videoOn";
|
message = "videoOn";
|
||||||
startVideoCapture();
|
startVideoCapture();
|
||||||
} else {
|
} else {
|
||||||
|
cameraControlButton.setAlpha(0.7f);
|
||||||
if (videoCapturer != null) {
|
if (videoCapturer != null) {
|
||||||
try {
|
try {
|
||||||
videoCapturer.stopCapture();
|
videoCapturer.stopCapture();
|
||||||
@ -358,6 +363,9 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
message = "audioOff";
|
message = "audioOff";
|
||||||
if (enable) {
|
if (enable) {
|
||||||
message = "audioOn";
|
message = "audioOn";
|
||||||
|
microphoneControlButton.setAlpha(1.0f);
|
||||||
|
} else {
|
||||||
|
microphoneControlButton.setAlpha(0.7f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (localMediaStream != null && localMediaStream.audioTracks.size() > 0) {
|
if (localMediaStream != null && localMediaStream.audioTracks.size() > 0) {
|
||||||
@ -541,14 +549,11 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
if (!videoOn) {
|
if (!videoOn) {
|
||||||
onCameraClick();
|
onCameraClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
cameraControlButton.setImageResource(R.drawable.ic_videocam_off_white_24px);
|
cameraControlButton.setImageResource(R.drawable.ic_videocam_off_white_24px);
|
||||||
if (cameraSwitchButton != null) {
|
if (cameraSwitchButton != null) {
|
||||||
cameraSwitchButton.setVisibility(View.INVISIBLE);
|
cameraSwitchButton.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
cameraControlButton.setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EffortlessPermissions.hasPermissions(this, PERMISSIONS_MICROPHONE)) {
|
if (EffortlessPermissions.hasPermissions(this, PERMISSIONS_MICROPHONE)) {
|
||||||
@ -569,7 +574,7 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
if (cameraEnumerator.getDeviceNames().length == 0) {
|
if (cameraEnumerator.getDeviceNames().length == 0) {
|
||||||
cameraControlButton.setVisibility(View.GONE);
|
cameraControlButton.setVisibility(View.GONE);
|
||||||
} else if (cameraEnumerator.getDeviceNames().length == 1) {
|
} else if (cameraEnumerator.getDeviceNames().length == 1) {
|
||||||
cameraSwitchButton.setVisibility(View.INVISIBLE);
|
cameraSwitchButton.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EffortlessPermissions.hasPermissions(this, PERMISSIONS_CAMERA) ||
|
if (EffortlessPermissions.hasPermissions(this, PERMISSIONS_CAMERA) ||
|
||||||
@ -653,17 +658,15 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private void startCall() {
|
private void startCall() {
|
||||||
inCall = true;
|
inCall = true;
|
||||||
animateCallControls(false, 5000);
|
animateCallControls(false, 7500);
|
||||||
startPullingSignalingMessages(false);
|
startPullingSignalingMessages(false);
|
||||||
//registerNetworkReceiver();
|
//registerNetworkReceiver();
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick({R.id.pip_video_view, R.id.remote_renderers_layout})
|
@OnClick({R.id.pip_video_view, R.id.remote_renderers_layout})
|
||||||
public void showCallControls() {
|
public void showCallControls() {
|
||||||
if (callControls.getVisibility() != View.VISIBLE) {
|
|
||||||
animateCallControls(true, 0);
|
animateCallControls(true, 0);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void startPullingSignalingMessages(boolean restart) {
|
public void startPullingSignalingMessages(boolean restart) {
|
||||||
|
|
||||||
@ -1368,11 +1371,19 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
long duration;
|
long duration;
|
||||||
|
|
||||||
if (show) {
|
if (show) {
|
||||||
|
handler.removeCallbacksAndMessages(null);
|
||||||
alpha = 1.0f;
|
alpha = 1.0f;
|
||||||
duration = 1000;
|
duration = 1000;
|
||||||
|
if (callControls.getVisibility() != View.VISIBLE) {
|
||||||
|
callControls.setAlpha(0.0f);
|
||||||
|
callControls.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
handler.postDelayed(() -> animateCallControls(false, 0), 5000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
alpha = 0.0f;
|
alpha = 0.0f;
|
||||||
duration = 2500;
|
duration = 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
callControls.animate()
|
callControls.animate()
|
||||||
@ -1388,8 +1399,7 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
if (!show) {
|
if (!show) {
|
||||||
callControls.setVisibility(View.INVISIBLE);
|
callControls.setVisibility(View.INVISIBLE);
|
||||||
} else {
|
} else {
|
||||||
callControls.setVisibility(View.VISIBLE);
|
handler.postDelayed(() -> animateCallControls(false, 0), 5000);
|
||||||
animateCallControls(false, 10000);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,8 +40,8 @@
|
|||||||
android:id="@+id/pip_video_view"
|
android:id="@+id/pip_video_view"
|
||||||
android:layout_width="120dp"
|
android:layout_width="120dp"
|
||||||
android:layout_height="120dp"
|
android:layout_height="120dp"
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
android:layout_margin="16dp"
|
android:layout_margin="16dp"
|
||||||
android:visibility="invisible"/>
|
android:visibility="invisible"/>
|
||||||
|
|
||||||
@ -49,42 +49,45 @@
|
|||||||
android:id="@+id/call_controls"
|
android:id="@+id/call_controls"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_centerHorizontal="true">
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginBottom="16dp">
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/call_control_hangup"
|
android:id="@+id/call_control_hangup"
|
||||||
android:layout_width="36dp"
|
android:layout_width="44dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="56dp"
|
||||||
android:layout_marginEnd="@dimen/margin_between_elements"
|
android:layout_marginEnd="16dp"
|
||||||
android:background="?android:selectableItemBackgroundBorderless"
|
android:background="?android:selectableItemBackgroundBorderless"
|
||||||
android:src="@drawable/ic_call_end_white_24px"
|
android:src="@drawable/ic_call_end_white_24px"
|
||||||
android:tint="@color/nc_darkRed"
|
android:tint="@color/nc_darkRed"
|
||||||
android:tintMode="src_in"/>
|
android:tintMode="src_in"/>
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/call_control_camera"
|
android:id="@+id/call_control_microphone"
|
||||||
android:layout_width="36dp"
|
android:layout_width="32dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="56dp"
|
||||||
android:layout_marginEnd="@dimen/margin_between_elements"
|
android:layout_marginEnd="@dimen/margin_between_elements"
|
||||||
android:layout_toEndOf="@id/call_control_hangup"
|
android:layout_toEndOf="@id/call_control_hangup"
|
||||||
android:background="?android:selectableItemBackgroundBorderless"
|
android:alpha="0.7"
|
||||||
android:src="@drawable/ic_videocam_off_white_24px"/>
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/call_control_microphone"
|
|
||||||
android:layout_width="24dp"
|
|
||||||
android:layout_height="48dp"
|
|
||||||
android:layout_marginEnd="@dimen/margin_between_elements"
|
|
||||||
android:layout_toEndOf="@id/call_control_camera"
|
|
||||||
android:background="?android:selectableItemBackgroundBorderless"
|
android:background="?android:selectableItemBackgroundBorderless"
|
||||||
android:src="@drawable/ic_mic_off_white_24px"/>
|
android:src="@drawable/ic_mic_off_white_24px"/>
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/call_control_switch_camera"
|
android:id="@+id/call_control_camera"
|
||||||
android:layout_width="36dp"
|
android:layout_width="44dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="56dp"
|
||||||
|
android:layout_marginEnd="@dimen/margin_between_elements"
|
||||||
android:layout_toEndOf="@id/call_control_microphone"
|
android:layout_toEndOf="@id/call_control_microphone"
|
||||||
|
android:alpha="0.7"
|
||||||
|
android:background="?android:selectableItemBackgroundBorderless"
|
||||||
|
android:src="@drawable/ic_videocam_off_white_24px"/>
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/call_control_switch_camera"
|
||||||
|
android:layout_width="44dp"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:layout_toEndOf="@id/call_control_camera"
|
||||||
android:background="?android:selectableItemBackgroundBorderless"
|
android:background="?android:selectableItemBackgroundBorderless"
|
||||||
android:src="@drawable/ic_switch_video_white_24px"
|
android:src="@drawable/ic_switch_video_white_24px"
|
||||||
android:visibility="invisible"/>
|
android:visibility="invisible"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user