mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-23 13:59:29 +00:00
Can hide hang up button
This commit is contained in:
parent
f818028920
commit
8d87b8dc57
@ -49,6 +49,8 @@ import org.webrtc.VideoSink;
|
|||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static org.webrtc.RendererCommon.ScalingType.SCALE_ASPECT_FILL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call activity
|
* Call activity
|
||||||
*
|
*
|
||||||
@ -116,6 +118,7 @@ public class CallActivity extends BaseActivity implements SignalExchangerCallbac
|
|||||||
private ImageButton mHangUpButton;
|
private ImageButton mHangUpButton;
|
||||||
private LinearLayout mRemoteVideosLayout;
|
private LinearLayout mRemoteVideosLayout;
|
||||||
private SurfaceViewRenderer mLocalVideoView;
|
private SurfaceViewRenderer mLocalVideoView;
|
||||||
|
private View mButtonsView;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -202,6 +205,7 @@ public class CallActivity extends BaseActivity implements SignalExchangerCallbac
|
|||||||
mHangUpButton.setOnClickListener(v -> hangUp());
|
mHangUpButton.setOnClickListener(v -> hangUp());
|
||||||
mRemoteVideosLayout = findViewById(R.id.remoteVideosLayout);
|
mRemoteVideosLayout = findViewById(R.id.remoteVideosLayout);
|
||||||
mLocalVideoView = findViewById(R.id.local_video);
|
mLocalVideoView = findViewById(R.id.local_video);
|
||||||
|
mButtonsView = findViewById(R.id.buttonsLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -383,15 +387,16 @@ public class CallActivity extends BaseActivity implements SignalExchangerCallbac
|
|||||||
SurfaceViewRenderer remoteView = new SurfaceViewRenderer(this);
|
SurfaceViewRenderer remoteView = new SurfaceViewRenderer(this);
|
||||||
remoteView.init(eglBase.getEglBaseContext(), null);
|
remoteView.init(eglBase.getEglBaseContext(), null);
|
||||||
remoteView.setZOrderMediaOverlay(false);
|
remoteView.setZOrderMediaOverlay(false);
|
||||||
|
remoteView.setScalingType(SCALE_ASPECT_FILL);
|
||||||
|
remoteView.setEnableHardwareScaler(false);
|
||||||
callPeer.setRemoteViewView(remoteView);
|
callPeer.setRemoteViewView(remoteView);
|
||||||
|
remoteView.setOnClickListener(v -> switchButtonsVisibility());
|
||||||
|
|
||||||
mRemoteVideosLayout.addView(remoteView, new LinearLayout.LayoutParams(
|
mRemoteVideosLayout.addView(remoteView, new LinearLayout.LayoutParams(
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT, 0, 1));
|
ViewGroup.LayoutParams.MATCH_PARENT, 0, 1));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//callPeer.setLocalProxyVideoSink(mLocalProxyVideoSink);
|
|
||||||
|
|
||||||
ProxyVideoSink remoteProxyRenderer = new ProxyVideoSink();
|
ProxyVideoSink remoteProxyRenderer = new ProxyVideoSink();
|
||||||
remoteProxyRenderer.setTarget(callPeer.getRemoteViewView());
|
remoteProxyRenderer.setTarget(callPeer.getRemoteViewView());
|
||||||
callPeer.getRemoteSinks().add(remoteProxyRenderer);
|
callPeer.getRemoteSinks().add(remoteProxyRenderer);
|
||||||
@ -453,6 +458,20 @@ public class CallActivity extends BaseActivity implements SignalExchangerCallbac
|
|||||||
mList.remove(callPeer);
|
mList.remove(callPeer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void switchButtonsVisibility(){
|
||||||
|
|
||||||
|
boolean show = !getSupportActionBar().isShowing();
|
||||||
|
|
||||||
|
if(show)
|
||||||
|
getSupportActionBar().show();
|
||||||
|
else
|
||||||
|
getSupportActionBar().hide();
|
||||||
|
|
||||||
|
mButtonsView.setVisibility(show ? View.VISIBLE : View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//Based on https://github.com/vivek1794/webrtc-android-codelab
|
//Based on https://github.com/vivek1794/webrtc-android-codelab
|
||||||
@Nullable
|
@Nullable
|
||||||
private VideoCapturer createCameraCapturer(CameraEnumerator enumerator){
|
private VideoCapturer createCameraCapturer(CameraEnumerator enumerator){
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/remoteVideosLayout"
|
android:id="@+id/remoteVideosLayout"
|
||||||
android:layout_width="0dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
@ -31,29 +31,40 @@
|
|||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
<ImageButton
|
<org.webrtc.SurfaceViewRenderer
|
||||||
android:id="@+id/hangUp"
|
android:id="@+id/local_video"
|
||||||
|
android:layout_width="@dimen/account_image_default_width"
|
||||||
|
android:layout_height="@dimen/account_image_default_height"
|
||||||
|
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/buttonsLayout"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
|
<android.support.constraint.ConstraintLayout
|
||||||
|
android:id="@+id/buttonsLayout"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="8dp"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
android:layout_marginBottom="8dp"
|
android:layout_marginBottom="8dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/hangUp"
|
||||||
|
android:layout_width="51dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
android:backgroundTint="@color/holo_red_dark"
|
android:backgroundTint="@color/holo_red_dark"
|
||||||
|
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"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
android:contentDescription="@string/action_hang_up"/>
|
|
||||||
|
|
||||||
<org.webrtc.SurfaceViewRenderer
|
</android.support.constraint.ConstraintLayout>
|
||||||
android:id="@+id/local_video"
|
|
||||||
android:layout_width="@dimen/account_image_default_width"
|
|
||||||
android:layout_height="@dimen/account_image_default_height"
|
|
||||||
android:layout_marginEnd="8dp"
|
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/hangUp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent" />
|
|
||||||
|
|
||||||
|
|
||||||
</android.support.constraint.ConstraintLayout>
|
</android.support.constraint.ConstraintLayout>
|
Loading…
Reference in New Issue
Block a user