Refine ComposeFavScene
This commit is contained in:
1 parent
2b6bcf6698
commit
371622770b
1 file changed
+18
-2
@@ -5,7 +5,9 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.itemsIndexed
|
||||
import androidx.compose.material3.ElevatedCard
|
||||
@@ -24,8 +26,10 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.ComposeView
|
||||
import androidx.compose.ui.res.dimensionResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.paging.Pager
|
||||
import androidx.paging.PagingConfig
|
||||
@@ -78,7 +82,11 @@ class ComposeFavScene : BaseScene() {
|
||||
}.flow.cachedIn(lifecycleScope)
|
||||
}.collectAsLazyPagingItems()
|
||||
val height = remember { (3 * Settings.listThumbSize * 3).pxToDp.dp }
|
||||
LazyColumn(contentPadding = it) {
|
||||
LazyColumn(
|
||||
modifier = Modifier.padding(horizontal = dimensionResource(id = R.dimen.gallery_list_margin_h), vertical = dimensionResource(id = R.dimen.gallery_list_margin_v)),
|
||||
verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.gallery_list_interval)),
|
||||
contentPadding = it,
|
||||
) {
|
||||
items(
|
||||
count = data.itemCount,
|
||||
key = data.itemKey(key = { item -> item.gid }),
|
||||
@@ -87,7 +95,15 @@ class ComposeFavScene : BaseScene() {
|
||||
val item = data[index]
|
||||
if (item != null) {
|
||||
GalleryInfoListItem(
|
||||
onClick = {},
|
||||
onClick = {
|
||||
navAnimated(
|
||||
R.id.galleryDetailScene,
|
||||
bundleOf(
|
||||
GalleryDetailScene.KEY_ACTION to GalleryDetailScene.ACTION_GALLERY_INFO,
|
||||
GalleryDetailScene.KEY_GALLERY_INFO to item,
|
||||
),
|
||||
)
|
||||
},
|
||||
onLongClick = {},
|
||||
info = item,
|
||||
modifier = Modifier.height(height),
|
||||
|
||||
Reference in new issue
Block a user