diff --git a/app/src/main/java/org/linphone/ui/call/fragment/ActiveCallFragment.kt b/app/src/main/java/org/linphone/ui/call/fragment/ActiveCallFragment.kt index 6b8f52c93..1ceba113b 100644 --- a/app/src/main/java/org/linphone/ui/call/fragment/ActiveCallFragment.kt +++ b/app/src/main/java/org/linphone/ui/call/fragment/ActiveCallFragment.kt @@ -33,6 +33,7 @@ import androidx.annotation.UiThread import androidx.constraintlayout.widget.ConstraintSet import androidx.lifecycle.ViewModelProvider import androidx.navigation.fragment.findNavController +import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat import androidx.window.layout.FoldingFeature import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.bottomsheet.BottomSheetDialogFragment @@ -50,6 +51,7 @@ import org.linphone.utils.DialogUtils import org.linphone.utils.Event import org.linphone.utils.addCharacterAtPosition import org.linphone.utils.removeCharacterAtPosition +import org.linphone.utils.startAnimatedDrawable @UiThread class ActiveCallFragment : GenericCallFragment() { @@ -107,7 +109,19 @@ class ActiveCallFragment : GenericCallFragment() { private val actionsBottomSheetCallback = object : BottomSheetBehavior.BottomSheetCallback() { override fun onStateChanged(bottomSheet: View, newState: Int) { - callViewModel.extraActionsBottomSheetVisible.value = newState != BottomSheetBehavior.STATE_COLLAPSED + if (newState == BottomSheetBehavior.STATE_EXPANDED) { + val drawable = AnimatedVectorDrawableCompat.create( + requireContext(), + R.drawable.animated_handle_to_caret + ) + binding.bottomBar.mainActions.handle.setImageDrawable(drawable) + } else if (newState == BottomSheetBehavior.STATE_COLLAPSED) { + val drawable = AnimatedVectorDrawableCompat.create( + requireContext(), + R.drawable.animated_caret_to_handle + ) + binding.bottomBar.mainActions.handle.setImageDrawable(drawable) + } } override fun onSlide(bottomSheet: View, slideOffset: Float) { } @@ -235,8 +249,20 @@ class ActiveCallFragment : GenericCallFragment() { it.consume { val state = actionsBottomSheetBehavior.state if (state == BottomSheetBehavior.STATE_COLLAPSED) { + val drawable = AnimatedVectorDrawableCompat.create( + requireContext(), + R.drawable.animated_caret_to_handle + ) + binding.bottomBar.mainActions.handle.setImageDrawable(drawable) + binding.bottomBar.mainActions.handle.startAnimatedDrawable() actionsBottomSheetBehavior.state = BottomSheetBehavior.STATE_EXPANDED } else if (state == BottomSheetBehavior.STATE_EXPANDED) { + val drawable = AnimatedVectorDrawableCompat.create( + requireContext(), + R.drawable.animated_handle_to_caret + ) + binding.bottomBar.mainActions.handle.setImageDrawable(drawable) + binding.bottomBar.mainActions.handle.startAnimatedDrawable() actionsBottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED } } diff --git a/app/src/main/java/org/linphone/ui/call/viewmodel/CurrentCallViewModel.kt b/app/src/main/java/org/linphone/ui/call/viewmodel/CurrentCallViewModel.kt index 5fc997717..dd00f4488 100644 --- a/app/src/main/java/org/linphone/ui/call/viewmodel/CurrentCallViewModel.kt +++ b/app/src/main/java/org/linphone/ui/call/viewmodel/CurrentCallViewModel.kt @@ -151,8 +151,6 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() { // Extras actions - val extraActionsBottomSheetVisible = MutableLiveData() - val toggleExtraActionsBottomSheetEvent: MutableLiveData> by lazy { MutableLiveData>() } diff --git a/app/src/main/res/drawable/animated_caret_to_handle.xml b/app/src/main/res/drawable/animated_caret_to_handle.xml new file mode 100644 index 000000000..f5e1d0161 --- /dev/null +++ b/app/src/main/res/drawable/animated_caret_to_handle.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/animated_handle_to_caret.xml b/app/src/main/res/drawable/animated_handle_to_caret.xml new file mode 100644 index 000000000..54b52c05d --- /dev/null +++ b/app/src/main/res/drawable/animated_handle_to_caret.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + diff --git a/app/src/main/res/layout/call_actions_generic.xml b/app/src/main/res/layout/call_actions_generic.xml index 92f915da3..63d955a5b 100644 --- a/app/src/main/res/layout/call_actions_generic.xml +++ b/app/src/main/res/layout/call_actions_generic.xml @@ -15,13 +15,13 @@ android:paddingBottom="5dp" android:background="@drawable/shape_call_bottom_sheet_background"> -