Skip to content

Commit

Permalink
[Fix] #67 qa bottom sheet (#68)
Browse files Browse the repository at this point in the history
* [fix] 닉네임 로직 수정

- isError 확인

* [fix] 공유하기 토스트 추가

- 토스트 추가

* [fix] 공유, 수정, 삭제 버튼 노출

* [fix] 메모 입력 버그 수정

* [chore] 코딩 컨벤션 반영

* [FIX] #67-링크 추가 화면에서 포킷목록 조회 bottomSheet에서 포킷목록이 많을 경우 화면을 꽉 채우는 문제 수정

* [FIX] #67-bottomSheet의 구분을 위한 그림자 추가

* [FIX] #67-홈 화면에서 bottomSheet의 배경 색상 수정

* [FIX] #67-라미인드 화면 배경 색상 조정

* [FIX] #67-리마인드 화면에서 "오늘 이 링크는 어때요?"에 표시되는 link UI의 카테고리 표시 부분 임시 숨김처리 수행

* [FIX] #67-검색 화면에서 공유 기능 누락 추가

---------

Co-authored-by: jiwon2724 <stopone3119@naver.com>
  • Loading branch information
l5x5l and jiwon2724 authored Aug 31, 2024
1 parent 39b6e7a commit b45db2c
Show file tree
Hide file tree
Showing 12 changed files with 180 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBarsIgnoringVisibility
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.windowInsetsBottomHeight
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.Surface
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
Expand All @@ -22,6 +24,7 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
Expand All @@ -34,9 +37,10 @@ import pokitmons.pokit.core.ui.theme.PokitTheme
fun PokitBottomSheet(
onHideBottomSheet: () -> Unit,
show: Boolean = false,
skipPartiallyExpanded: Boolean = true,
content: @Composable (ColumnScope.() -> Unit),
) {
val bottomSheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)
val bottomSheetState = rememberModalBottomSheetState(skipPartiallyExpanded = skipPartiallyExpanded)
var visibility by remember { mutableStateOf(show) }
val scope = rememberCoroutineScope()

Expand All @@ -63,31 +67,45 @@ fun PokitBottomSheet(
},
sheetState = bottomSheetState,
scrimColor = Color.Transparent,
shape = RoundedCornerShape(topStart = 20.dp, topEnd = 20.dp),
containerColor = PokitTheme.colors.backgroundBase,
dragHandle = {
Column {
Spacer(modifier = Modifier.height(8.dp))
containerColor = Color.Transparent,
dragHandle = null
) {
Spacer(modifier = Modifier.height(8.dp).background(Color.Transparent))

Box(
Modifier
.clip(RoundedCornerShape(4.dp))
.width(36.dp)
.height(4.dp)
.background(color = PokitTheme.colors.iconTertiary)
)
Surface(
shape = RoundedCornerShape(topStart = 20.dp, topEnd = 20.dp),
color = PokitTheme.colors.backgroundBase,
shadowElevation = 20.dp
) {
Column(
modifier = Modifier.fillMaxWidth()
) {
Column(
modifier = Modifier.fillMaxWidth(),
horizontalAlignment = Alignment.CenterHorizontally
) {
Spacer(modifier = Modifier.height(8.dp))

Box(
Modifier
.clip(RoundedCornerShape(4.dp))
.width(36.dp)
.height(4.dp)
.background(color = PokitTheme.colors.iconTertiary)
)

Spacer(modifier = Modifier.height(12.dp))
}

Spacer(modifier = Modifier.height(12.dp))
content()

Spacer(
Modifier.windowInsetsBottomHeight(
WindowInsets.navigationBarsIgnoringVisibility
)
)
}
}
) {
content()

Spacer(
Modifier.windowInsetsBottomHeight(
WindowInsets.navigationBarsIgnoringVisibility
)
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package pokitmons.pokit.core.ui.components.template.bottomsheet
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.Button
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand All @@ -27,36 +26,35 @@ private fun PokitSwitchRadioPreview() {
Surface(modifier = Modifier.fillMaxSize()) {
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
color = PokitTheme.colors.backgroundBase
) {
Button(onClick = { showBottomSheet = true }) {
Text(text = "Click!")
}
}

if (showBottomSheet) {
PokitBottomSheet(
onHideBottomSheet = { showBottomSheet = false }
) {
PokitBottomSheetItem(
text = "즐겨찾기",
resourceId = R.drawable.icon_24_star_1,
data = "즐겨찾기",
onClick = { }
)
PokitBottomSheet(
onHideBottomSheet = { showBottomSheet = false },
show = showBottomSheet
) {
PokitBottomSheetItem(
text = "즐겨찾기",
resourceId = R.drawable.icon_24_star_1,
data = "즐겨찾기",
onClick = { }
)

HorizontalDivider(
thickness = 1.dp,
color = PokitTheme.colors.borderTertiary
)
HorizontalDivider(
thickness = 1.dp,
color = PokitTheme.colors.borderTertiary
)

PokitBottomSheetItem(
text = "공유하기",
resourceId = R.drawable.icon_24_share,
data = "공유하기",
onClick = { showBottomSheet = false }
)
}
PokitBottomSheetItem(
text = "공유하기",
resourceId = R.drawable.icon_24_share,
data = "공유하기",
onClick = { showBottomSheet = false }
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ fun AddLinkScreenContainer(

PokitBottomSheet(
onHideBottomSheet = viewModel::hideSelectPokitBottomSheet,
show = state.step == ScreenStep.POKIT_SELECT
show = state.step == ScreenStep.POKIT_SELECT,
skipPartiallyExpanded = false
) {
val lazyColumnListState = rememberLazyListState()
val startPaging = remember {
Expand Down Expand Up @@ -272,17 +273,31 @@ fun AddLinkScreen(
text = memo,
hintText = stringResource(id = R.string.placeholder_memo),
onChangeText = inputMemo,
enable = enable
enable = enable,
isError = memo.length >= 100
)

Spacer(modifier = Modifier.height(4.dp))

Text(
modifier = Modifier.fillMaxWidth(),
text = "${memo.length}/100",
style = PokitTheme.typography.detail1.copy(color = PokitTheme.colors.textTertiary),
textAlign = TextAlign.End
)
Row(verticalAlignment = Alignment.CenterVertically) {
if (memo.length >= 100) {
Text(
color = PokitTheme.colors.error,
text = "최대 100자까지 입력 가능합니다.",
style = PokitTheme.typography.detail1
)
}

Spacer(modifier = Modifier.weight(1f))

Text(
color = if (memo.length >= 100) PokitTheme.colors.error else PokitTheme.colors.textTertiary,
modifier = Modifier.weight(1f),
text = "${memo.length}/100",
style = PokitTheme.typography.detail1,
textAlign = TextAlign.End
)
}

Spacer(modifier = Modifier.height(24.dp))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ class AddLinkViewModel @Inject constructor(
}

fun inputMemo(memo: String) {
_memo.update { memo }
if (memo.length <= 100) {
_memo.update { memo }
}
}

fun showSelectPokitBottomSheet() = intent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ fun HomeScreen(
onDismissRequest = {
showBottomSheet = false
},
sheetState = sheetState
sheetState = sheetState,
containerColor = PokitTheme.colors.backgroundBase
) {
Row(
modifier = Modifier
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package pokitmons.pokit.home.pokit

import android.content.Context
import android.widget.Toast
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
Expand All @@ -15,6 +17,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import coil.compose.rememberAsyncImagePainter
Expand Down Expand Up @@ -47,13 +50,16 @@ fun PokitScreen(
val pokitOptionBottomSheetType by viewModel.pokitOptionBottomSheetType.collectAsState()
val currentDetailSelectedCategory by viewModel.currentDetailSelectedCategory.collectAsState()

val context: Context = LocalContext.current

PokitBottomSheet(
onHideBottomSheet = viewModel::hidePokitDetailRemoveBottomSheet,
show = pokitOptionBottomSheetType != null
) {
when (pokitOptionBottomSheetType) {
BottomSheetType.MODIFY -> {
ModifyBottomSheetContent(
onClickShare = { Toast.makeText(context, "준비중입니다.", Toast.LENGTH_SHORT).show() },
onClickModify = remember {
{
viewModel.hidePokitDetailRemoveBottomSheet()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package pokitmons.pokit.home.pokit

import android.content.Context
import android.content.Intent
import android.widget.Toast
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.lazy.LazyColumn
Expand All @@ -9,6 +12,7 @@ import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
Expand All @@ -33,6 +37,8 @@ fun UnclassifiedScreen(
val currentSelectedLink by viewModel.currentSelectedLink.collectAsState()
val currentDetailShowLink by viewModel.currentDetailShowLink.collectAsState()

val context: Context = LocalContext.current

currentDetailShowLink?.let { link ->
LinkDetailBottomSheet(
title = link.title,
Expand All @@ -45,6 +51,13 @@ fun UnclassifiedScreen(
dateString = link.dateString,
onHideBottomSheet = viewModel::hideDetailLinkBottomSheet,
show = true,
onClickShareLink = {
val intent = Intent(Intent.ACTION_SEND_MULTIPLE).apply {
type = "text/plain"
putExtra(Intent.EXTRA_TEXT, link.url)
}
context.startActivity(Intent.createChooser(intent, "Pokit"))
},
onClickBookmark = viewModel::toggleBookmark
)
}
Expand All @@ -56,6 +69,7 @@ fun UnclassifiedScreen(
when (pokitOptionBottomSheetType) {
BottomSheetType.MODIFY -> {
ModifyBottomSheetContent(
onClickShare = { Toast.makeText(context, "준비중입니다.", Toast.LENGTH_SHORT).show() },
onClickModify = remember {
{
viewModel.hideLinkOptionBottomSheet()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package pokitmons.pokit.home.remind

import android.content.Context
import android.widget.Toast
import androidx.compose.foundation.background
import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
Expand All @@ -17,6 +20,7 @@ import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
Expand All @@ -32,6 +36,7 @@ import pokitmons.pokit.core.ui.components.template.modifybottomsheet.ModifyBotto
import pokitmons.pokit.core.ui.components.template.pokkiempty.EmptyPokki
import pokitmons.pokit.core.ui.components.template.pokkierror.ErrorPokki
import pokitmons.pokit.core.ui.components.template.removeItemBottomSheet.TwoButtonBottomSheetContent
import pokitmons.pokit.core.ui.theme.PokitTheme
import pokitmons.pokit.core.ui.R.string as coreString

@Composable
Expand All @@ -54,6 +59,8 @@ fun RemindScreen(
val pokitOptionBottomSheetType by viewModel.pokitOptionBottomSheetType.collectAsState()
val currentSelectedLink by viewModel.currentSelectedLink.collectAsState()

val context: Context = LocalContext.current

val showTotalEmpty by remember {
derivedStateOf {
todayContentsState == NetworkState.IDLE &&
Expand All @@ -70,6 +77,7 @@ fun RemindScreen(
when (pokitOptionBottomSheetType) {
BottomSheetType.MODIFY -> {
ModifyBottomSheetContent(
onClickShare = { Toast.makeText(context, "준비중입니다.", Toast.LENGTH_SHORT).show() },
onClickModify = remember {
{
viewModel.hideLinkOptionBottomSheet()
Expand Down Expand Up @@ -124,6 +132,7 @@ fun RemindScreen(
} else {
Column(
modifier = modifier
.background(PokitTheme.colors.backgroundBase)
.padding(20.dp)
.fillMaxHeight()
.verticalScroll(rememberScrollState())
Expand Down Expand Up @@ -154,7 +163,7 @@ fun RemindScreen(
title = todayContent.title,
sub = todayContent.createdAt,
painter = rememberAsyncImagePainter(todayContent.thumbNail),
badgeText = todayContent.data,
badgeText = null,
domain = todayContent.domain,
onClick = {
viewModel.showDetailLinkBottomSheet(remindResult = todayContent)
Expand Down
Loading

0 comments on commit b45db2c

Please sign in to comment.