From d52af200f88c3f3b32f443a220e8b0d3210e7bef Mon Sep 17 00:00:00 2001 From: ze-zeh Date: Tue, 1 Oct 2024 00:34:46 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[Feat]=20=ED=83=AD=20=EC=8A=A4=ED=81=AC?= =?UTF-8?q?=EB=A1=A4=20=ED=96=88=EC=9D=84=20=EB=95=8C=20=EC=95=B5=EC=BB=A4?= =?UTF-8?q?=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/team/ppac/mypage/MyPageScreen.kt | 31 +++++++++++++++++++ .../mypage/component/RecentMemeContent.kt | 1 - 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/feature/mypage/src/main/java/team/ppac/mypage/MyPageScreen.kt b/feature/mypage/src/main/java/team/ppac/mypage/MyPageScreen.kt index 105a7d09..bf5fdafc 100644 --- a/feature/mypage/src/main/java/team/ppac/mypage/MyPageScreen.kt +++ b/feature/mypage/src/main/java/team/ppac/mypage/MyPageScreen.kt @@ -19,12 +19,16 @@ import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.foundation.lazy.staggeredgrid.LazyVerticalStaggeredGrid import androidx.compose.foundation.lazy.staggeredgrid.StaggeredGridCells import androidx.compose.foundation.lazy.staggeredgrid.StaggeredGridItemSpan +import androidx.compose.foundation.lazy.staggeredgrid.rememberLazyStaggeredGridState import androidx.compose.material.ExperimentalMaterialApi import androidx.compose.material.Text import androidx.compose.material.pullrefresh.pullRefresh import androidx.compose.material.pullrefresh.rememberPullRefreshState import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.derivedStateOf +import androidx.compose.runtime.getValue +import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip @@ -38,6 +42,7 @@ import kotlinx.coroutines.flow.flowOf import team.ppac.common.android.component.FarmemeMemeItem import team.ppac.common.android.component.error.FarmemeErrorScreen import team.ppac.common.android.util.showSkeleton +import team.ppac.common.android.util.systemBarHeight import team.ppac.common.android.util.visibility import team.ppac.designsystem.FarmemeTheme import team.ppac.designsystem.R @@ -134,8 +139,16 @@ private fun MyPageContent( savedMemes: LazyPagingItems, registeredMemes: LazyPagingItems, ) { + val staggeredGridState = rememberLazyStaggeredGridState() + val showStickyHeader by remember { + derivedStateOf { + staggeredGridState.firstVisibleItemIndex > 3 + } + } + LazyVerticalStaggeredGrid( modifier = modifier.wrapContentHeight(), + state = staggeredGridState, columns = StaggeredGridCells.Fixed(2), horizontalArrangement = Arrangement.spacedBy(space = (-28).dp), ) { @@ -165,8 +178,12 @@ private fun MyPageContent( isLoading = uiState.isLoading, ) } + item(span = StaggeredGridItemSpan.FullLine) { + Spacer(modifier = Modifier.height(40.dp - systemBarHeight)) + } item(span = StaggeredGridItemSpan.FullLine) { MyPageMemesTabBar( + modifier = Modifier.padding(top = systemBarHeight), currentTabType = uiState.currentTabType, onClick = { tab -> onIntent(MyPageIntent.ClickMemesTab(currentTabType = tab)) @@ -236,6 +253,20 @@ private fun MyPageContent( Spacer(modifier = Modifier.height(30.dp)) } } + if (showStickyHeader) { + Box( + modifier = Modifier + .background(color = FarmemeTheme.backgroundColor.white) + .padding(top = systemBarHeight), + ) { + MyPageMemesTabBar( + currentTabType = uiState.currentTabType, + onClick = { tab -> + onIntent(MyPageIntent.ClickMemesTab(currentTabType = tab)) + }, + ) + } + } } @Composable diff --git a/feature/mypage/src/main/java/team/ppac/mypage/component/RecentMemeContent.kt b/feature/mypage/src/main/java/team/ppac/mypage/component/RecentMemeContent.kt index 1289b232..f10ccf1d 100644 --- a/feature/mypage/src/main/java/team/ppac/mypage/component/RecentMemeContent.kt +++ b/feature/mypage/src/main/java/team/ppac/mypage/component/RecentMemeContent.kt @@ -61,7 +61,6 @@ internal fun RecentMemeContent( } else { RecentMemeEmpty() } - Spacer(modifier = Modifier.height(46.dp)) } } } From b6a7f7133d1999f441368a50f33c12cfb4cbbe8a Mon Sep 17 00:00:00 2001 From: ze-zeh Date: Tue, 1 Oct 2024 16:47:02 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[Refactor]=20Spacer=EB=8F=84=20=EC=95=B5?= =?UTF-8?q?=EC=BB=A4=EB=90=98=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mypage/src/main/java/team/ppac/mypage/MyPageScreen.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/feature/mypage/src/main/java/team/ppac/mypage/MyPageScreen.kt b/feature/mypage/src/main/java/team/ppac/mypage/MyPageScreen.kt index bf5fdafc..1fdafeaf 100644 --- a/feature/mypage/src/main/java/team/ppac/mypage/MyPageScreen.kt +++ b/feature/mypage/src/main/java/team/ppac/mypage/MyPageScreen.kt @@ -254,7 +254,7 @@ private fun MyPageContent( } } if (showStickyHeader) { - Box( + Column( modifier = Modifier .background(color = FarmemeTheme.backgroundColor.white) .padding(top = systemBarHeight), @@ -265,6 +265,12 @@ private fun MyPageContent( onIntent(MyPageIntent.ClickMemesTab(currentTabType = tab)) }, ) + Spacer( + modifier = Modifier + .fillMaxWidth() + .height(1.dp) + .background(FarmemeTheme.borderColor.tertiary), + ) } } }