mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-28 12:44:34 +01:00
Fix speakerphone drawables for selection.
This commit is contained in:
committed by
Greyson Parrelli
parent
98e3530acd
commit
c8f1ebdf4c
@@ -86,21 +86,12 @@ class WebRtcAudioOutputToggleButton @JvmOverloads constructor(context: Context,
|
|||||||
|
|
||||||
val currentOutput = outputState.getCurrentOutput()
|
val currentOutput = outputState.getCurrentOutput()
|
||||||
|
|
||||||
val numberOfOutputs = outputState.getOutputs().size
|
val shouldShowDropdownForSpeaker = outputState.getOutputs().size >= SHOW_PICKER_THRESHOLD || !outputState.getOutputs().contains(WebRtcAudioOutput.HANDSET)
|
||||||
val extra = if (numberOfOutputs < SHOW_PICKER_THRESHOLD) {
|
val extra = when (currentOutput) {
|
||||||
when (currentOutput) {
|
WebRtcAudioOutput.HANDSET -> intArrayOf(R.attr.state_speaker_off)
|
||||||
WebRtcAudioOutput.HANDSET -> intArrayOf(R.attr.state_speaker_off)
|
WebRtcAudioOutput.SPEAKER -> if (shouldShowDropdownForSpeaker) intArrayOf(R.attr.state_speaker_selected) else intArrayOf(R.attr.state_speaker_on)
|
||||||
WebRtcAudioOutput.SPEAKER -> intArrayOf(R.attr.state_speaker_on)
|
WebRtcAudioOutput.BLUETOOTH_HEADSET -> intArrayOf(R.attr.state_bt_headset_selected)
|
||||||
WebRtcAudioOutput.BLUETOOTH_HEADSET -> intArrayOf(R.attr.state_bt_headset_selected) // should never be seen in practice.
|
WebRtcAudioOutput.WIRED_HEADSET -> intArrayOf(R.attr.state_wired_headset_selected)
|
||||||
WebRtcAudioOutput.WIRED_HEADSET -> intArrayOf(R.attr.state_wired_headset_selected) // should never be seen in practice.
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
when (currentOutput) {
|
|
||||||
WebRtcAudioOutput.HANDSET -> intArrayOf(R.attr.state_handset_selected)
|
|
||||||
WebRtcAudioOutput.SPEAKER -> intArrayOf(R.attr.state_speaker_selected)
|
|
||||||
WebRtcAudioOutput.BLUETOOTH_HEADSET -> intArrayOf(R.attr.state_bt_headset_selected)
|
|
||||||
WebRtcAudioOutput.WIRED_HEADSET -> intArrayOf(R.attr.state_wired_headset_selected)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.i(TAG, "Switching to $currentOutput")
|
Log.i(TAG, "Switching to $currentOutput")
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<item app:state_speaker_on="true">
|
<item app:state_speaker_on="true">
|
||||||
<layer-list>
|
<layer-list>
|
||||||
<item android:drawable="@drawable/webrtc_call_screen_circle_unchecked" />
|
<item android:drawable="@drawable/webrtc_call_screen_circle_unchecked" />
|
||||||
<item android:bottom="14dp" android:drawable="@drawable/symbol_speaker_fill_white_24" android:left="14dp" android:right="14dp" android:top="14dp" />
|
<item android:bottom="14dp" android:drawable="@drawable/symbol_speaker_fill_24" android:left="14dp" android:right="14dp" android:top="14dp" />
|
||||||
</layer-list>
|
</layer-list>
|
||||||
</item>
|
</item>
|
||||||
<item app:state_handset_selected="true">
|
<item app:state_handset_selected="true">
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
android:left="4dp"
|
android:left="4dp"
|
||||||
android:right="4dp"
|
android:right="4dp"
|
||||||
android:drawable="@drawable/webrtc_call_screen_circle_checked" />
|
android:drawable="@drawable/webrtc_call_screen_circle_checked" />
|
||||||
<item android:bottom="14dp" android:drawable="@drawable/symbol_speaker_fill_white_24" android:left="14dp" android:right="14dp" android:top="14dp" />
|
<item android:bottom="14dp" android:drawable="@drawable/symbol_speaker_fill_24" android:left="14dp" android:right="14dp" android:top="14dp" />
|
||||||
</layer-list>
|
</layer-list>
|
||||||
</item>
|
</item>
|
||||||
<item app:state_handset_selected="true">
|
<item app:state_handset_selected="true">
|
||||||
|
|||||||
Reference in New Issue
Block a user