mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 15:50:16 +02:00
Animate voice search button visibility and reuse generic strings
Switch the voice search button toggle to AnimatedVisibility with a horizontal expand/shrink from the start, matching the pattern used elsewhere (NavDrawer now-playing). Rename show_voice_search_button_on/off to visible_ui/hidden_ui so the labels can be reused by other toggles.
This commit is contained in:
parent
bfbceb1999
commit
e77bfeaa9f
2 changed files with 11 additions and 5 deletions
|
|
@ -4,7 +4,9 @@ import android.view.Gravity
|
|||
import androidx.activity.compose.BackHandler
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.expandHorizontally
|
||||
import androidx.compose.animation.expandVertically
|
||||
import androidx.compose.animation.shrinkHorizontally
|
||||
import androidx.compose.animation.shrinkVertically
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.focusGroup
|
||||
|
|
@ -524,7 +526,11 @@ fun SearchPage(
|
|||
.focusRestorer(textFieldFocusRequester)
|
||||
.focusRequester(focusRequesters[SEARCH_ROW]),
|
||||
) {
|
||||
if (voiceSearchButtonVisible) {
|
||||
AnimatedVisibility(
|
||||
visible = voiceSearchButtonVisible,
|
||||
enter = expandHorizontally(expandFrom = Alignment.Start),
|
||||
exit = shrinkHorizontally(shrinkTowards = Alignment.Start),
|
||||
) {
|
||||
VoiceSearchButton(
|
||||
onSpeechResult = { spokenText ->
|
||||
query = spokenText
|
||||
|
|
@ -846,9 +852,9 @@ fun SearchViewOptionsDialog(
|
|||
supportingContent = {
|
||||
Text(
|
||||
if (voiceSearchButtonVisible) {
|
||||
stringResource(R.string.show_voice_search_button_on)
|
||||
stringResource(R.string.visible_ui)
|
||||
} else {
|
||||
stringResource(R.string.show_voice_search_button_off)
|
||||
stringResource(R.string.hidden_ui)
|
||||
},
|
||||
)
|
||||
},
|
||||
|
|
|
|||
|
|
@ -450,8 +450,8 @@
|
|||
<string name="combined_search_results_on">Show all results in a single list</string>
|
||||
<string name="combined_search_results_off">Show results by category</string>
|
||||
<string name="show_voice_search_button">Show voice search button</string>
|
||||
<string name="show_voice_search_button_on">Visible</string>
|
||||
<string name="show_voice_search_button_off">Hidden</string>
|
||||
<string name="visible_ui">Visible</string>
|
||||
<string name="hidden_ui">Hidden</string>
|
||||
<string name="results">Results</string>
|
||||
<string name="resolution_switching">Resolution switching</string>
|
||||
<string name="local">Local</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue