From 1ef9ed5202099a45f76159bd2f25747be4811660 Mon Sep 17 00:00:00 2001 From: ganfra Date: Wed, 27 Jan 2021 16:05:55 +0100 Subject: [PATCH] VoIP : clean code --- .../sdk/api/session/room/model/call/CallCapabilities.kt | 2 +- .../java/im/vector/app/features/call/CallAudioManager.kt | 5 ----- .../app/features/call/transfer/CallTransferActivity.kt | 2 -- .../app/features/call/transfer/CallTransferPagerAdapter.kt | 6 ++---- .../app/features/call/transfer/CallTransferViewModel.kt | 1 - .../vector/app/features/userdirectory/UserListController.kt | 2 +- .../src/main/res/layout/view_bottom_sheet_action_button.xml | 2 +- 7 files changed, 5 insertions(+), 15 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallCapabilities.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallCapabilities.kt index 50fc9361e9..d911ca3b88 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallCapabilities.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallCapabilities.kt @@ -29,4 +29,4 @@ data class CallCapabilities( @Json(name = "m.call.transferee") val transferee: Boolean? = null ) -fun CallCapabilities?.supportCallTransfer() = true//this?.transferee.orFalse() +fun CallCapabilities?.supportCallTransfer() = this?.transferee.orFalse() diff --git a/vector/src/main/java/im/vector/app/features/call/CallAudioManager.kt b/vector/src/main/java/im/vector/app/features/call/CallAudioManager.kt index 3a24cf6d48..d34cb0af94 100644 --- a/vector/src/main/java/im/vector/app/features/call/CallAudioManager.kt +++ b/vector/src/main/java/im/vector/app/features/call/CallAudioManager.kt @@ -48,7 +48,6 @@ class CallAudioManager( private var savedIsSpeakerPhoneOn = false private var savedIsMicrophoneMute = false - private var savedAudioMode = AudioManager.MODE_INVALID private var connectedBlueToothHeadset: BluetoothProfile? = null private var wantsBluetoothConnection = false @@ -100,8 +99,6 @@ class CallAudioManager( val audioManager = audioManager ?: return savedIsSpeakerPhoneOn = audioManager.isSpeakerphoneOn savedIsMicrophoneMute = audioManager.isMicrophoneMute - savedAudioMode = audioManager.mode - // Request audio playout focus (without ducking) and install listener for changes in focus. // Remove the deprecation forces us to use 2 different method depending on API level @@ -171,8 +168,6 @@ class CallAudioManager( // Restore previously stored audio states. setSpeakerphoneOn(savedIsSpeakerPhoneOn) setMicrophoneMute(savedIsMicrophoneMute) - audioManager?.mode = savedAudioMode - connectedBlueToothHeadset?.let { if (audioManager != null && isBluetoothHeadsetConnected(audioManager!!)) { audioManager?.stopBluetoothSco() diff --git a/vector/src/main/java/im/vector/app/features/call/transfer/CallTransferActivity.kt b/vector/src/main/java/im/vector/app/features/call/transfer/CallTransferActivity.kt index 53fd828a7e..0a7144f213 100644 --- a/vector/src/main/java/im/vector/app/features/call/transfer/CallTransferActivity.kt +++ b/vector/src/main/java/im/vector/app/features/call/transfer/CallTransferActivity.kt @@ -20,7 +20,6 @@ import android.content.Context import android.content.Intent import android.os.Bundle import android.os.Parcelable -import androidx.coordinatorlayout.widget.CoordinatorLayout import com.airbnb.mvrx.MvRx import com.airbnb.mvrx.viewModel import com.google.android.material.tabs.TabLayoutMediator @@ -31,7 +30,6 @@ import im.vector.app.core.platform.VectorBaseActivity import im.vector.app.databinding.ActivityCallTransferBinding import im.vector.app.features.contactsbook.ContactsBookViewModel import im.vector.app.features.contactsbook.ContactsBookViewState -import im.vector.app.features.userdirectory.UserListSharedActionViewModel import im.vector.app.features.userdirectory.UserListViewModel import im.vector.app.features.userdirectory.UserListViewState import kotlinx.parcelize.Parcelize diff --git a/vector/src/main/java/im/vector/app/features/call/transfer/CallTransferPagerAdapter.kt b/vector/src/main/java/im/vector/app/features/call/transfer/CallTransferPagerAdapter.kt index 2fbf7e6caa..1f2d3070dd 100644 --- a/vector/src/main/java/im/vector/app/features/call/transfer/CallTransferPagerAdapter.kt +++ b/vector/src/main/java/im/vector/app/features/call/transfer/CallTransferPagerAdapter.kt @@ -29,7 +29,7 @@ import im.vector.app.features.userdirectory.UserListFragmentArgs class CallTransferPagerAdapter( private val fragmentActivity: FragmentActivity -) : FragmentStateAdapter(fragmentActivity), Restorable{ +) : FragmentStateAdapter(fragmentActivity), Restorable { val userListFragment: UserListFragment? get() = findFragmentAtPosition(0) as? UserListFragment @@ -76,7 +76,7 @@ class CallTransferPagerAdapter( dialPadFragment?.applyCallback() } - private fun DialPadFragment.applyCallback(): DialPadFragment{ + private fun DialPadFragment.applyCallback(): DialPadFragment { callback = object : DialPadFragment.Callback { override fun onOkClicked(formatted: String?, raw: String?) { if (raw.isNullOrEmpty()) return @@ -85,6 +85,4 @@ class CallTransferPagerAdapter( } return this } - - } diff --git a/vector/src/main/java/im/vector/app/features/call/transfer/CallTransferViewModel.kt b/vector/src/main/java/im/vector/app/features/call/transfer/CallTransferViewModel.kt index b4d6734817..2fa016feea 100644 --- a/vector/src/main/java/im/vector/app/features/call/transfer/CallTransferViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/call/transfer/CallTransferViewModel.kt @@ -103,5 +103,4 @@ class CallTransferViewModel @AssistedInject constructor(@Assisted initialState: } } } - } diff --git a/vector/src/main/java/im/vector/app/features/userdirectory/UserListController.kt b/vector/src/main/java/im/vector/app/features/userdirectory/UserListController.kt index bf9e6fd196..a7ec9cd8c3 100644 --- a/vector/src/main/java/im/vector/app/features/userdirectory/UserListController.kt +++ b/vector/src/main/java/im/vector/app/features/userdirectory/UserListController.kt @@ -64,7 +64,7 @@ class UserListController @Inject constructor(private val session: Session, }) } } - if(currentState.showContactBookAction) { + if (currentState.showContactBookAction) { actionItem { id(R.drawable.ic_baseline_perm_contact_calendar_24) title(stringProvider.getString(R.string.contacts_book_title)) diff --git a/vector/src/main/res/layout/view_bottom_sheet_action_button.xml b/vector/src/main/res/layout/view_bottom_sheet_action_button.xml index c0e0ba7bcb..ec2e7d2bfe 100644 --- a/vector/src/main/res/layout/view_bottom_sheet_action_button.xml +++ b/vector/src/main/res/layout/view_bottom_sheet_action_button.xml @@ -44,7 +44,7 @@ android:textSize="16sp" app:layout_constrainedWidth="true" app:layout_constraintBottom_toTopOf="@+id/bottomSheetActionSubTitle" - app:layout_constraintEnd_toStartOf="@+id/itemVerificationActionIcon" + app:layout_constraintEnd_toStartOf="@+id/bottomSheetActionIcon" app:layout_constraintStart_toEndOf="@+id/bottomSheetActionLeftIcon" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_chainStyle="packed"