Show / hide call views according to call type.

This commit is contained in:
onurays 2020-06-04 11:43:21 +03:00 committed by Valere
parent 79f804b2d4
commit 24cea5110e
2 changed files with 20 additions and 4 deletions

View File

@ -28,6 +28,7 @@ import android.os.Parcelable
import android.view.View import android.view.View
import android.view.Window import android.view.Window
import android.view.WindowManager import android.view.WindowManager
import androidx.core.view.isVisible
import butterknife.BindView import butterknife.BindView
import com.airbnb.mvrx.MvRx import com.airbnb.mvrx.MvRx
import com.airbnb.mvrx.viewModel import com.airbnb.mvrx.viewModel
@ -130,10 +131,7 @@ class VectorCallActivity : VectorBaseActivity() {
finish() finish()
} }
iv_end_call.setOnClickListener { configureCallViews()
callViewModel.handle(VectorCallViewActions.EndCall)
finish()
}
callViewModel.viewEvents callViewModel.viewEvents
.observe() .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<out String>, grantResults: IntArray) { override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
if (requestCode == CAPTURE_PERMISSION_REQUEST_CODE && allGranted(grantResults)) { if (requestCode == CAPTURE_PERMISSION_REQUEST_CODE && allGranted(grantResults)) {
start() start()

View File

@ -36,6 +36,7 @@
android:id="@+id/layout_call_actions" android:id="@+id/layout_call_actions"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="80dp" android:layout_height="80dp"
android:layout_marginBottom="48dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"