Added same animation as in call options menu to audio routes menu
This commit is contained in:
parent
78bb966228
commit
5cb7f4d091
5 changed files with 69 additions and 42 deletions
|
@ -172,11 +172,10 @@ dependencies {
|
||||||
implementation 'androidx.core:core-ktx:1.3.2'
|
implementation 'androidx.core:core-ktx:1.3.2'
|
||||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.1'
|
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.1'
|
||||||
implementation 'androidx.navigation:navigation-ui-ktx:2.3.1'
|
implementation 'androidx.navigation:navigation-ui-ktx:2.3.1'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
|
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||||
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
||||||
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
|
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
|
||||||
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
|
|
||||||
|
|
||||||
implementation 'com.google.android.material:material:1.2.1'
|
implementation 'com.google.android.material:material:1.2.1'
|
||||||
implementation 'com.google.android:flexbox:2.0.0'
|
implementation 'com.google.android:flexbox:2.0.0'
|
||||||
|
|
|
@ -81,6 +81,16 @@ class ControlsFragment : GenericFragment<CallControlsFragmentBinding>() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val audioRoutesMenuAnimator: ValueAnimator by lazy {
|
||||||
|
ValueAnimator.ofFloat(resources.getDimension(R.dimen.call_audio_routes_menu_translate_y), 0f).apply {
|
||||||
|
addUpdateListener {
|
||||||
|
val value = it.animatedValue as Float
|
||||||
|
view?.findViewById<LinearLayout>(R.id.audio_routes_menu)?.translationY = value
|
||||||
|
}
|
||||||
|
duration = if (corePreferences.enableAnimations) 500 else 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||||
super.onActivityCreated(savedInstanceState)
|
super.onActivityCreated(savedInstanceState)
|
||||||
|
|
||||||
|
@ -169,6 +179,16 @@ class ControlsFragment : GenericFragment<CallControlsFragmentBinding>() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
controlsViewModel.toggleAudioRoutesMenuEvent.observe(viewLifecycleOwner, {
|
||||||
|
it.consume { open ->
|
||||||
|
if (open) {
|
||||||
|
audioRoutesMenuAnimator.start()
|
||||||
|
} else {
|
||||||
|
audioRoutesMenuAnimator.reverse()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
controlsViewModel.somethingClickedEvent.observe(viewLifecycleOwner, {
|
controlsViewModel.somethingClickedEvent.observe(viewLifecycleOwner, {
|
||||||
it.consume {
|
it.consume {
|
||||||
sharedViewModel.resetHiddenInterfaceTimerInVideoCallEvent.value = Event(true)
|
sharedViewModel.resetHiddenInterfaceTimerInVideoCallEvent.value = Event(true)
|
||||||
|
|
|
@ -87,6 +87,10 @@ class ControlsViewModel : ViewModel() {
|
||||||
MutableLiveData<Event<Boolean>>()
|
MutableLiveData<Event<Boolean>>()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val toggleAudioRoutesMenuEvent: MutableLiveData<Event<Boolean>> by lazy {
|
||||||
|
MutableLiveData<Event<Boolean>>()
|
||||||
|
}
|
||||||
|
|
||||||
val somethingClickedEvent = MutableLiveData<Event<Boolean>>()
|
val somethingClickedEvent = MutableLiveData<Event<Boolean>>()
|
||||||
|
|
||||||
val chatAllowed = !LinphoneApplication.corePreferences.disableChat
|
val chatAllowed = !LinphoneApplication.corePreferences.disableChat
|
||||||
|
@ -249,6 +253,7 @@ class ControlsViewModel : ViewModel() {
|
||||||
fun toggleRoutesMenu() {
|
fun toggleRoutesMenu() {
|
||||||
somethingClickedEvent.value = Event(true)
|
somethingClickedEvent.value = Event(true)
|
||||||
audioRoutesVisibility.value = audioRoutesVisibility.value != true
|
audioRoutesVisibility.value = audioRoutesVisibility.value != true
|
||||||
|
toggleAudioRoutesMenuEvent.value = Event(audioRoutesVisibility.value ?: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun toggleRecording(closeMenu: Boolean) {
|
fun toggleRecording(closeMenu: Boolean) {
|
||||||
|
|
|
@ -100,12 +100,52 @@
|
||||||
android:padding="15dp"
|
android:padding="15dp"
|
||||||
android:src="@drawable/speaker" />
|
android:src="@drawable/speaker" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/audio_routes_menu"
|
||||||
|
android:translationY="@dimen/call_audio_routes_menu_translate_y"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_above="@id/audio_routes"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:selected="@{viewModel.isBluetoothHeadsetSelected}"
|
||||||
|
android:onClick="@{() -> viewModel.forceBluetoothAudioRoute()}"
|
||||||
|
android:contentDescription="@string/content_description_use_bluetooth_headset"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/call_button_size"
|
||||||
|
android:background="?attr/button_background_drawable"
|
||||||
|
android:padding="15dp"
|
||||||
|
android:src="@drawable/route_bluetooth" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:selected="@{!viewModel.isSpeakerSelected && !viewModel.isBluetoothHeadsetSelected}"
|
||||||
|
android:onClick="@{() -> viewModel.forceEarpieceAudioRoute()}"
|
||||||
|
android:contentDescription="@string/content_description_use_earpiece"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/call_button_size"
|
||||||
|
android:background="?attr/button_background_drawable"
|
||||||
|
android:padding="15dp"
|
||||||
|
android:src="@drawable/route_earpiece" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:selected="@{viewModel.isSpeakerSelected}"
|
||||||
|
android:onClick="@{() -> viewModel.forceSpeakerAudioRoute()}"
|
||||||
|
android:contentDescription="@string/content_description_use_speaker"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/call_button_size"
|
||||||
|
android:background="?attr/button_background_drawable"
|
||||||
|
android:padding="15dp"
|
||||||
|
android:src="@drawable/route_speaker" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:id="@+id/audio_routes"
|
||||||
android:onClick="@{() -> viewModel.toggleRoutesMenu()}"
|
android:onClick="@{() -> viewModel.toggleRoutesMenu()}"
|
||||||
android:visibility="@{viewModel.audioRoutesEnabled ? View.VISIBLE : View.GONE, default=gone}"
|
android:visibility="@{viewModel.audioRoutesEnabled ? View.VISIBLE : View.INVISIBLE, default=invisible}"
|
||||||
android:selected="@{viewModel.audioRoutesVisibility}"
|
android:selected="@{viewModel.audioRoutesVisibility}"
|
||||||
android:contentDescription="@string/content_description_toggle_audio_menu"
|
android:contentDescription="@string/content_description_toggle_audio_menu"
|
||||||
android:id="@+id/audio_route"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/call_button_size"
|
android:layout_height="@dimen/call_button_size"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
|
@ -113,44 +153,6 @@
|
||||||
android:padding="15dp"
|
android:padding="15dp"
|
||||||
android:src="@drawable/routes" />
|
android:src="@drawable/routes" />
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:visibility="@{viewModel.audioRoutesVisibility ? View.VISIBLE : View.GONE, default=gone}"
|
|
||||||
android:selected="@{viewModel.isBluetoothHeadsetSelected}"
|
|
||||||
android:onClick="@{() -> viewModel.forceBluetoothAudioRoute()}"
|
|
||||||
android:contentDescription="@string/content_description_use_bluetooth_headset"
|
|
||||||
android:id="@+id/route_bluetooth"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/call_button_size"
|
|
||||||
android:layout_above="@id/audio_route"
|
|
||||||
android:background="?attr/button_background_drawable"
|
|
||||||
android:padding="15dp"
|
|
||||||
android:src="@drawable/route_bluetooth" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:visibility="@{viewModel.audioRoutesVisibility ? View.VISIBLE : View.GONE, default=gone}"
|
|
||||||
android:selected="@{!viewModel.isSpeakerSelected && !viewModel.isBluetoothHeadsetSelected}"
|
|
||||||
android:onClick="@{() -> viewModel.forceEarpieceAudioRoute()}"
|
|
||||||
android:contentDescription="@string/content_description_use_earpiece"
|
|
||||||
android:id="@+id/route_earpiece"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/call_button_size"
|
|
||||||
android:layout_above="@id/route_bluetooth"
|
|
||||||
android:background="?attr/button_background_drawable"
|
|
||||||
android:padding="15dp"
|
|
||||||
android:src="@drawable/route_earpiece" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:visibility="@{viewModel.audioRoutesVisibility ? View.VISIBLE : View.GONE, default=gone}"
|
|
||||||
android:selected="@{viewModel.isSpeakerSelected}"
|
|
||||||
android:onClick="@{() -> viewModel.forceSpeakerAudioRoute()}"
|
|
||||||
android:contentDescription="@string/content_description_use_speaker"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/call_button_size"
|
|
||||||
android:layout_above="@id/route_earpiece"
|
|
||||||
android:background="?attr/button_background_drawable"
|
|
||||||
android:padding="15dp"
|
|
||||||
android:src="@drawable/route_speaker" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
|
|
|
@ -14,4 +14,5 @@
|
||||||
<dimen name="contact_avatar_size">35dp</dimen>
|
<dimen name="contact_avatar_size">35dp</dimen>
|
||||||
<dimen name="call_button_size">60dp</dimen>
|
<dimen name="call_button_size">60dp</dimen>
|
||||||
<dimen name="call_options_menu_translate_y">300dp</dimen>
|
<dimen name="call_options_menu_translate_y">300dp</dimen>
|
||||||
|
<dimen name="call_audio_routes_menu_translate_y">240dp</dimen>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in a new issue