Skip to content

Commit

Permalink
Fix deprecation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
DRSchlaubi committed Sep 28, 2024
1 parent e747b85 commit a4dfe23
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 23 deletions.
50 changes: 28 additions & 22 deletions app/shared/src/commonMain/kotlin/components/SearchBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Clear
import androidx.compose.material.icons.filled.Mic
import androidx.compose.material.icons.filled.Search
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.material3.ripple
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
Expand All @@ -25,7 +25,6 @@ import cafe.adriel.lyricist.LocalStrings
import dev.schlaubi.tonbrett.app.ColorScheme
import dev.schlaubi.tonbrett.app.api.IO
import dev.schlaubi.tonbrett.app.api.LocalContext
import dev.schlaubi.tonbrett.common.Sound
import dev.schlaubi.tonbrett.common.SoundGroup
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.FlowPreview
Expand Down Expand Up @@ -92,31 +91,38 @@ fun SearchBar(updateSounds: SoundUpdater) {
}
}

Key.Escape -> -1 // reset selection until menu reopens
Key.Escape -> {
showSuggestions(false)
-1
} // reset selection until menu reopens
else -> return@onPreviewKeyEvent false
}
true
}) {
DockedSearchBar(
value, ::updateSearch, { showSuggestions(false) }, showSuggestions, ::showSuggestions,
modifier = Modifier.fillMaxWidth().padding(horizontal = 5.dp),
placeholder = { Text(strings.searchExplainer, color = ColorScheme.current.textColor.copy(alpha = .7f)) },
trailingIcon = {
TrailingIcon(value, {
updateSearch(it)
}, false)
},
colors = SearchBarDefaults.colors(
containerColor = ColorScheme.current.searchBarColor,
inputFieldColors = TextFieldDefaults.colors(
focusedContainerColor = ColorScheme.current.searchBarColor,
unfocusedContainerColor = ColorScheme.current.searchBarColor,
focusedPlaceholderColor = ColorScheme.current.secondaryContainer,
unfocusedPlaceholderColor = ColorScheme.current.secondaryContainer,
focusedTextColor = ColorScheme.current.textColor,
unfocusedTextColor = ColorScheme.current.textColor
{
SearchBarDefaults.InputField(
value, ::updateSearch, { showSuggestions(false) },
showSuggestions, ::showSuggestions,
modifier = Modifier.fillMaxWidth().padding(horizontal = 5.dp),
trailingIcon = {
TrailingIcon(value, {
updateSearch(it)
}, false)
},
placeholder = {
Text(
strings.searchExplainer,
color = ColorScheme.current.textColor.copy(alpha = .7f)
)
},
colors = TextFieldDefaults.colors(unfocusedTextColor = ColorScheme.current.textColor, focusedTextColor = ColorScheme.current.textColor)
)
)
},
showSuggestions, ::showSuggestions,
modifier = Modifier.fillMaxWidth().padding(horizontal = 5.dp),
colors = SearchBarDefaults.colors(containerColor = ColorScheme.current.searchBarColor)

) {
ProvideEnterPressFlow(enterPresses) {
SearchSuggestions(
Expand Down Expand Up @@ -164,7 +170,7 @@ private fun TrailingIcon(value: String, updateSearch: (String) -> Unit, supports

Icon(icon, null, Modifier
.rotate(iconRotation)
.clickable(interactionSource, indication = rememberRipple(), enabled = value.isNotEmpty()) {
.clickable(interactionSource, indication = ripple(), enabled = value.isNotEmpty()) {
updateSearch("")
}
)
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ktor = "2.3.12"
kmongo = "5.1.0"
kord = "0.14.0"
mikbot = "3.37.3"
ksp = "2.0.20-1.0.25"
ksp = "2.0.20-1.0.24"
kordex = "1.9.0-SNAPSHOT"
android = "8.6.1"
compose = "1.7.0-beta02"
Expand Down

0 comments on commit a4dfe23

Please sign in to comment.