Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

<application
android:name=".MemorySealApplication"
Expand Down
Binary file added common/resource/src/main/res/drawable/ic_shovels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,54 @@ fun MSTitleDialog(
}
}

@Composable
fun MSTitleDialog(
title: String,
onConfirm: () -> Unit,
onCancel: () -> Unit,
modifier: Modifier = Modifier,
confirmText: String = "확인",
confirmButtonColor: Color = MSTheme.color.primaryNormal,
confirmTextColor: Color = MSTheme.color.white,
content: @Composable ColumnScope.() -> Unit,
) {
Dialog(onDismissRequest = onCancel) {
Column(
modifier = modifier
.fillMaxWidth()
.wavyStroke(
color = MSTheme.color.white,
fillColor = MSTheme.color.white,
contentPadding = 20.dp,
)
) {
MSText(
text = title,
fontSize = 20.dp,
)
content()
MSButton(
modifier = Modifier.fillMaxWidth(),
onClick = onConfirm,
colors = ButtonDefaults.buttonColors(
containerColor = confirmButtonColor
),
pressColors = ButtonDefaults.buttonColors(
containerColor = confirmButtonColor
),
wavyStrokeColor = confirmButtonColor,
contentPadding = PaddingValues(11.dp)
) {
MSText(
text = confirmText,
fontSize = 16.dp,
color = confirmTextColor
)
}
}
}
}

@Preview
@Composable
fun MSDialogPreview() {
Expand All @@ -190,4 +238,4 @@ fun MSDialogPreview() {
onConfirm = {}
)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
package com.idiotfrogs.designsystem.component

import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.LocalRippleConfiguration
import androidx.compose.material3.Tab
import androidx.compose.material3.TabPosition
import androidx.compose.material3.TabRow
import androidx.compose.material3.TabRowDefaults.tabIndicatorOffset
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.idiotfrogs.designsystem.theme.MSTheme
Expand All @@ -19,37 +27,58 @@ import com.idiotfrogs.designsystem.util.wavyStroke
@Composable
fun MSTabBar(
tabs: List<String>,
showBorder: Boolean = false,
selectedIndex: Int,
onClick: (Int) -> Unit,
modifier: Modifier = Modifier,
) {
CompositionLocalProvider(LocalRippleConfiguration provides null) {
TabRow(
modifier = modifier,
selectedTabIndex = selectedIndex,
containerColor = MSTheme.color.white,
indicator = { tabPositions ->
Box(
modifier = Modifier
.tabIndicatorOffset(tabPositions[selectedIndex])
.padding(horizontal = 54.dp)
.wavyStroke(
color = MSTheme.color.greyG5,
drawType = DrawType.BOTTOM,
spacing = 3.dp,
var tabPositions by remember { mutableStateOf<List<TabPosition>?>(null) }

Column {
CompositionLocalProvider(LocalRippleConfiguration provides null) {
TabRow(
modifier = modifier.then(
if (showBorder) {
Modifier.border(
width = 2.dp,
color = MSTheme.color.bgNormal
)
)
},
divider = {},
) {
tabs.forEachIndexed { index, tab ->
MSTabItem(
selected = selectedIndex == index,
text = tab,
onClick = { onClick(index) },
)
} else {
Modifier
}
),
selectedTabIndex = selectedIndex,
containerColor = MSTheme.color.white,
indicator = { tabPositions = it },
divider = {},
) {
tabs.forEachIndexed { index, tab ->
MSTabItem(
selected = selectedIndex == index,
text = tab,
onClick = { onClick(index) },
)
}
}
}
Box(
modifier = Modifier
.then(
if (tabPositions != null) {
Modifier
.tabIndicatorOffset(tabPositions!![selectedIndex])
} else {
Modifier
}
)
.offset(y = 1.dp)
.padding(horizontal = 54.dp)
.wavyStroke(
color = MSTheme.color.greyG5,
drawType = DrawType.BOTTOM,
spacing = 3.dp
)
)
}
}

Expand Down
17 changes: 16 additions & 1 deletion core/designsystem/stability/designsystem-debug.stability
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,12 @@ public fun com.idiotfrogs.designsystem.component.MSPlainTextField(modifier: andr
- scrollState: STABLE (marked @Stable or @Immutable)

@Composable
public fun com.idiotfrogs.designsystem.component.MSTabBar(tabs: kotlin.collections.List<kotlin.String>, selectedIndex: kotlin.Int, onClick: kotlin.Function1<kotlin.Int, kotlin.Unit>, modifier: androidx.compose.ui.Modifier): kotlin.Unit
public fun com.idiotfrogs.designsystem.component.MSTabBar(tabs: kotlin.collections.List<kotlin.String>, showBorder: kotlin.Boolean, selectedIndex: kotlin.Int, onClick: kotlin.Function1<kotlin.Int, kotlin.Unit>, modifier: androidx.compose.ui.Modifier): kotlin.Unit
skippable: false
restartable: true
params:
- tabs: RUNTIME (requires runtime check)
- showBorder: STABLE (primitive type)
- selectedIndex: STABLE (primitive type)
- onClick: STABLE (function type)
- modifier: STABLE (marked @Stable or @Immutable)
Expand Down Expand Up @@ -242,6 +243,20 @@ public fun com.idiotfrogs.designsystem.component.MSTitleDialog(title: kotlin.Str
- cancelTextColor: STABLE (marked @Stable or @Immutable)
- content: STABLE (composable function type)

@Composable
public fun com.idiotfrogs.designsystem.component.MSTitleDialog(title: kotlin.String, onConfirm: kotlin.Function0<kotlin.Unit>, onCancel: kotlin.Function0<kotlin.Unit>, modifier: androidx.compose.ui.Modifier, confirmText: kotlin.String, confirmButtonColor: androidx.compose.ui.graphics.Color, confirmTextColor: androidx.compose.ui.graphics.Color, content: @[Composable] @[ExtensionFunctionType] androidx.compose.runtime.internal.ComposableFunction1<androidx.compose.foundation.layout.ColumnScope, kotlin.Unit>): kotlin.Unit
skippable: true
restartable: true
params:
- title: STABLE (String is immutable)
- onConfirm: STABLE (function type)
- onCancel: STABLE (function type)
- modifier: STABLE (marked @Stable or @Immutable)
- confirmText: STABLE (String is immutable)
- confirmButtonColor: STABLE (marked @Stable or @Immutable)
- confirmTextColor: STABLE (marked @Stable or @Immutable)
- content: STABLE (composable function type)

@Composable
public fun com.idiotfrogs.designsystem.component.MSToast(hazeState: dev.chrisbanes.haze.HazeState, modifier: androidx.compose.ui.Modifier, content: @[Composable] @[ExtensionFunctionType] androidx.compose.runtime.internal.ComposableFunction1<androidx.compose.foundation.layout.RowScope, kotlin.Unit>): kotlin.Unit
skippable: true
Expand Down
17 changes: 16 additions & 1 deletion core/designsystem/stability/designsystem-release.stability
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,12 @@ public fun com.idiotfrogs.designsystem.component.MSPlainTextField(modifier: andr
- scrollState: STABLE (marked @Stable or @Immutable)

@Composable
public fun com.idiotfrogs.designsystem.component.MSTabBar(tabs: kotlin.collections.List<kotlin.String>, selectedIndex: kotlin.Int, onClick: kotlin.Function1<kotlin.Int, kotlin.Unit>, modifier: androidx.compose.ui.Modifier): kotlin.Unit
public fun com.idiotfrogs.designsystem.component.MSTabBar(tabs: kotlin.collections.List<kotlin.String>, showBorder: kotlin.Boolean, selectedIndex: kotlin.Int, onClick: kotlin.Function1<kotlin.Int, kotlin.Unit>, modifier: androidx.compose.ui.Modifier): kotlin.Unit
skippable: false
restartable: true
params:
- tabs: RUNTIME (requires runtime check)
- showBorder: STABLE (primitive type)
- selectedIndex: STABLE (primitive type)
- onClick: STABLE (function type)
- modifier: STABLE (marked @Stable or @Immutable)
Expand Down Expand Up @@ -242,6 +243,20 @@ public fun com.idiotfrogs.designsystem.component.MSTitleDialog(title: kotlin.Str
- cancelTextColor: STABLE (marked @Stable or @Immutable)
- content: STABLE (composable function type)

@Composable
public fun com.idiotfrogs.designsystem.component.MSTitleDialog(title: kotlin.String, onConfirm: kotlin.Function0<kotlin.Unit>, onCancel: kotlin.Function0<kotlin.Unit>, modifier: androidx.compose.ui.Modifier, confirmText: kotlin.String, confirmButtonColor: androidx.compose.ui.graphics.Color, confirmTextColor: androidx.compose.ui.graphics.Color, content: @[Composable] @[ExtensionFunctionType] androidx.compose.runtime.internal.ComposableFunction1<androidx.compose.foundation.layout.ColumnScope, kotlin.Unit>): kotlin.Unit
skippable: true
restartable: true
params:
- title: STABLE (String is immutable)
- onConfirm: STABLE (function type)
- onCancel: STABLE (function type)
- modifier: STABLE (marked @Stable or @Immutable)
- confirmText: STABLE (String is immutable)
- confirmButtonColor: STABLE (marked @Stable or @Immutable)
- confirmTextColor: STABLE (marked @Stable or @Immutable)
- content: STABLE (composable function type)

@Composable
public fun com.idiotfrogs.designsystem.component.MSToast(hazeState: dev.chrisbanes.haze.HazeState, modifier: androidx.compose.ui.Modifier, content: @[Composable] @[ExtensionFunctionType] androidx.compose.runtime.internal.ComposableFunction1<androidx.compose.foundation.layout.RowScope, kotlin.Unit>): kotlin.Unit
skippable: true
Expand Down
14 changes: 11 additions & 3 deletions feature/home/src/main/java/com/idiotfrogs/home/HomeScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.ime
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
Expand All @@ -19,6 +18,7 @@ import androidx.compose.foundation.layout.systemBarsPadding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.foundation.text.input.rememberTextFieldState
Expand Down Expand Up @@ -55,8 +55,8 @@ import com.idiotfrogs.model.timecapsule.TimeCapsuleRole
import com.idiotfrogs.navigation.LocalComposeMSNavigator
import com.idiotfrogs.navigation.Routes
import com.idiotfrogs.util.UiState
import com.idiotfrogs.extension.toDday
import com.idiotfrogs.extension.toYearMonthDay
import com.idiotfrogs.model.timecapsule.TimeCapsuleStatus
import com.idiotfrogs.resource.R
import dev.chrisbanes.haze.hazeSource
import dev.chrisbanes.haze.rememberHazeState
Expand Down Expand Up @@ -178,6 +178,12 @@ fun HomeScreen(
}
}

val lazyListState = rememberLazyListState()
val showBorder = remember {
lazyListState.firstVisibleItemScrollOffset > 0 || // 1px이라도 μ›€μ§μ˜€κ±°λ‚˜
lazyListState.firstVisibleItemIndex > 0 // 첫 번째 μ•„μ΄ν…œμ„ λ„˜μ–΄κ°„ 경우
}

Column(
modifier = Modifier
.fillMaxSize()
Expand All @@ -190,6 +196,7 @@ fun HomeScreen(
navigateToProfile = { onAction(HomeAction.NavigateToProfile) }
)
MSTabBar(
showBorder = showBorder,
tabs = HomeTab.entries.map { it.title },
selectedIndex = currentTab.ordinal,
onClick = { currentTab = HomeTab.entries[it] },
Expand Down Expand Up @@ -232,6 +239,7 @@ fun HomeScreen(
val data = data.capsules[role].orEmpty()

LazyColumn(
state = lazyListState,
modifier = Modifier.fillMaxSize(),
contentPadding = PaddingValues(
top = 24.dp,
Expand All @@ -246,7 +254,7 @@ fun HomeScreen(
modifier = Modifier.noRippleClickable {
onAction(HomeAction.NavigateToDetail(it.timeCapsuleId))
},
countdown = it.openedAt.toDday(),
buried = it.timeCapsuleStatus == TimeCapsuleStatus.BURIED,
targetDate = it.openedAt.toYearMonthDay(),
title = it.title,
imageUrl = it.mainImageUrl
Expand Down
Loading
Loading