From 24cea5110e2d91264e870a11175f46ee7c424ff3 Mon Sep 17 00:00:00 2001 From: onurays Date: Thu, 4 Jun 2020 11:43:21 +0300 Subject: [PATCH] Show / hide call views according to call type. --- .../riotx/features/call/VectorCallActivity.kt | 23 +++++++++++++++---- vector/src/main/res/layout/activity_call.xml | 1 + 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/vector/src/main/java/im/vector/riotx/features/call/VectorCallActivity.kt b/vector/src/main/java/im/vector/riotx/features/call/VectorCallActivity.kt index e2a9888e82..b4090fa948 100644 --- a/vector/src/main/java/im/vector/riotx/features/call/VectorCallActivity.kt +++ b/vector/src/main/java/im/vector/riotx/features/call/VectorCallActivity.kt @@ -28,6 +28,7 @@ import android.os.Parcelable import android.view.View import android.view.Window import android.view.WindowManager +import androidx.core.view.isVisible import butterknife.BindView import com.airbnb.mvrx.MvRx import com.airbnb.mvrx.viewModel @@ -130,10 +131,7 @@ class VectorCallActivity : VectorBaseActivity() { finish() } - iv_end_call.setOnClickListener { - callViewModel.handle(VectorCallViewActions.EndCall) - finish() - } + configureCallViews() callViewModel.viewEvents .observe() @@ -148,6 +146,23 @@ class VectorCallActivity : VectorBaseActivity() { } } + private fun configureCallViews() { + if (callArgs.isVideoCall) { + iv_call_speaker.isVisible = false + iv_call_flip_camera.isVisible = true + iv_call_videocam_off.isVisible = true + } else { + iv_call_speaker.isVisible = true + iv_call_flip_camera.isVisible = false + iv_call_videocam_off.isVisible = false + } + + iv_end_call.setOnClickListener { + callViewModel.handle(VectorCallViewActions.EndCall) + finish() + } + } + override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) { if (requestCode == CAPTURE_PERMISSION_REQUEST_CODE && allGranted(grantResults)) { start() diff --git a/vector/src/main/res/layout/activity_call.xml b/vector/src/main/res/layout/activity_call.xml index 3b158d8828..be6165815f 100644 --- a/vector/src/main/res/layout/activity_call.xml +++ b/vector/src/main/res/layout/activity_call.xml @@ -36,6 +36,7 @@ android:id="@+id/layout_call_actions" android:layout_width="match_parent" android:layout_height="80dp" + android:layout_marginBottom="48dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent"