Skip to content

Commit

Permalink
[optimize] Support vertical scrolling for multi-select action bar on …
Browse files Browse the repository at this point in the history
…landscape search page
  • Loading branch information
SkyD666 committed Dec 17, 2023
1 parent 5a723c8 commit c5ce8ba
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ android {
minSdk 24
targetSdk 34
versionCode 56
versionName "2.0-alpha14"
versionName "2.0-beta01"
flavorDimensions = ["versionName"]

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.compose.animation.togetherWith
import androidx.compose.foundation.background
import androidx.compose.foundation.basicMarquee
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
Expand All @@ -27,7 +28,9 @@ import androidx.compose.foundation.lazy.staggeredgrid.LazyStaggeredGridState
import androidx.compose.foundation.lazy.staggeredgrid.LazyVerticalStaggeredGrid
import androidx.compose.foundation.lazy.staggeredgrid.StaggeredGridCells
import androidx.compose.foundation.lazy.staggeredgrid.items
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowDropDown
import androidx.compose.material.icons.filled.ArrowDropUp
Expand Down Expand Up @@ -288,11 +291,11 @@ internal fun MultiSelectActionBar(
)
}
if (windowSizeClass.isCompact) {
Row(modifier = modifier) {
Row(modifier = modifier.horizontalScroll(rememberScrollState())) {
items.forEachIndexed { _, function -> function() }
}
} else {
Column(modifier = modifier) {
Column(modifier = modifier.verticalScroll(rememberScrollState())) {
items.forEachIndexed { _, function -> function() }
}
}
Expand Down
11 changes: 4 additions & 7 deletions app/src/main/java/com/skyd/rays/ui/screen/search/SearchScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import androidx.compose.animation.fadeOut
import androidx.compose.animation.shrinkHorizontally
import androidx.compose.animation.shrinkVertically
import androidx.compose.foundation.clickable
import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -248,12 +247,10 @@ fun SearchScreen(viewModel: SearchViewModel = hiltViewModel()) {
mutableStateOf(false)
}
MultiSelectActionBar(
modifier = Modifier
.run {
if (windowSizeClass.isCompact) padding(end = fabWidht)
else this
}
.horizontalScroll(rememberScrollState()),
modifier = Modifier.run {
if (windowSizeClass.isCompact) padding(end = fabWidht)
else this
},
selectedStickers = selectedStickers,
onEditClick = {
openAddScreen(
Expand Down

0 comments on commit c5ce8ba

Please sign in to comment.