diff --git a/feature/addlink/src/main/java/com/strayalpaca/addlink/AddLinkScreen.kt b/feature/addlink/src/main/java/com/strayalpaca/addlink/AddLinkScreen.kt index 16249455..f08baec8 100644 --- a/feature/addlink/src/main/java/com/strayalpaca/addlink/AddLinkScreen.kt +++ b/feature/addlink/src/main/java/com/strayalpaca/addlink/AddLinkScreen.kt @@ -273,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)) diff --git a/feature/addlink/src/main/java/com/strayalpaca/addlink/AddLinkViewModel.kt b/feature/addlink/src/main/java/com/strayalpaca/addlink/AddLinkViewModel.kt index 3ef65cd4..84b04a4e 100644 --- a/feature/addlink/src/main/java/com/strayalpaca/addlink/AddLinkViewModel.kt +++ b/feature/addlink/src/main/java/com/strayalpaca/addlink/AddLinkViewModel.kt @@ -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 { diff --git a/feature/home/src/main/java/pokitmons/pokit/home/pokit/PokitScreen.kt b/feature/home/src/main/java/pokitmons/pokit/home/pokit/PokitScreen.kt index 5af92453..da716fc9 100644 --- a/feature/home/src/main/java/pokitmons/pokit/home/pokit/PokitScreen.kt +++ b/feature/home/src/main/java/pokitmons/pokit/home/pokit/PokitScreen.kt @@ -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 @@ -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 @@ -47,6 +50,8 @@ 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 @@ -54,6 +59,7 @@ fun PokitScreen( when (pokitOptionBottomSheetType) { BottomSheetType.MODIFY -> { ModifyBottomSheetContent( + onClickShare = { Toast.makeText(context, "준비중입니다.", Toast.LENGTH_SHORT).show() }, onClickModify = remember { { viewModel.hidePokitDetailRemoveBottomSheet() diff --git a/feature/home/src/main/java/pokitmons/pokit/home/pokit/UnclassifiedScreen.kt b/feature/home/src/main/java/pokitmons/pokit/home/pokit/UnclassifiedScreen.kt index 6a780f86..011e44cc 100644 --- a/feature/home/src/main/java/pokitmons/pokit/home/pokit/UnclassifiedScreen.kt +++ b/feature/home/src/main/java/pokitmons/pokit/home/pokit/UnclassifiedScreen.kt @@ -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 @@ -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 @@ -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, @@ -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 ) } @@ -56,6 +69,7 @@ fun UnclassifiedScreen( when (pokitOptionBottomSheetType) { BottomSheetType.MODIFY -> { ModifyBottomSheetContent( + onClickShare = { Toast.makeText(context, "준비중입니다.", Toast.LENGTH_SHORT).show() }, onClickModify = remember { { viewModel.hideLinkOptionBottomSheet() diff --git a/feature/home/src/main/java/pokitmons/pokit/home/remind/RemindScreen.kt b/feature/home/src/main/java/pokitmons/pokit/home/remind/RemindScreen.kt index 6b900077..04973cb2 100644 --- a/feature/home/src/main/java/pokitmons/pokit/home/remind/RemindScreen.kt +++ b/feature/home/src/main/java/pokitmons/pokit/home/remind/RemindScreen.kt @@ -1,5 +1,7 @@ package pokitmons.pokit.home.remind +import android.content.Context +import android.widget.Toast import androidx.compose.foundation.horizontalScroll import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -17,6 +19,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 @@ -54,6 +57,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 && @@ -70,6 +75,7 @@ fun RemindScreen( when (pokitOptionBottomSheetType) { BottomSheetType.MODIFY -> { ModifyBottomSheetContent( + onClickShare = { Toast.makeText(context, "준비중입니다.", Toast.LENGTH_SHORT).show() }, onClickModify = remember { { viewModel.hideLinkOptionBottomSheet() diff --git a/feature/login/src/main/java/pokitmons/pokit/nickname/InputNicknameScreen.kt b/feature/login/src/main/java/pokitmons/pokit/nickname/InputNicknameScreen.kt index ce096374..f3173f75 100644 --- a/feature/login/src/main/java/pokitmons/pokit/nickname/InputNicknameScreen.kt +++ b/feature/login/src/main/java/pokitmons/pokit/nickname/InputNicknameScreen.kt @@ -67,11 +67,11 @@ fun InputNicknameScreen( maxLength = NICKNAME_MAX_LENGTH, sub = when { inputNicknameState.isDuplicate -> stringResource(id = Login.string.nickname_already_in_use) - inputNicknameState.isRegex -> stringResource(id = Login.string.input_restriction_message) - inputNicknameState.nickname.length < NICKNAME_MAX_LENGTH -> stringResource(id = Login.string.input_max_length) + !inputNicknameState.isRegex -> stringResource(id = Login.string.input_restriction_message) + inputNicknameState.nickname.length >= NICKNAME_MAX_LENGTH -> stringResource(id = Login.string.input_max_length) else -> "" }, - isError = inputNicknameState.nickname.length > NICKNAME_MAX_LENGTH || inputNicknameState.isDuplicate || inputNicknameState.isRegex, + isError = inputNicknameState.isRegex || inputNicknameState.isDuplicate || inputNicknameState.nickname.length >= NICKNAME_MAX_LENGTH, hintText = stringResource(id = Login.string.input_nickname_hint), onChangeText = { text -> Log.d("!! : ", text) @@ -79,9 +79,7 @@ fun InputNicknameScreen( viewModel.apply { inputText(text) if (checkNicknameRegex(text)) { - Log.d("!! : ", "else call") checkDuplicateNickname(text) - } else { } } } diff --git a/feature/pokitdetail/src/main/java/com/strayalpaca/pokitdetail/PokitDetailScreen.kt b/feature/pokitdetail/src/main/java/com/strayalpaca/pokitdetail/PokitDetailScreen.kt index eef10b24..1dd8c7df 100644 --- a/feature/pokitdetail/src/main/java/com/strayalpaca/pokitdetail/PokitDetailScreen.kt +++ b/feature/pokitdetail/src/main/java/com/strayalpaca/pokitdetail/PokitDetailScreen.kt @@ -1,5 +1,8 @@ package com.strayalpaca.pokitdetail +import android.content.Context +import android.content.Intent +import android.widget.Toast import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize @@ -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 coil.compose.rememberAsyncImagePainter @@ -215,6 +219,7 @@ fun PokitDetailScreen( } if (state.currentLink != null) { + val context: Context = LocalContext.current LinkDetailBottomSheet( title = state.currentLink.title, memo = state.currentLink.memo, @@ -226,6 +231,13 @@ fun PokitDetailScreen( dateString = state.currentLink.dateString, onHideBottomSheet = hideLinkDetailBottomSheet, show = state.linkDetailBottomSheetVisible, + onClickShareLink = { + val intent = Intent(Intent.ACTION_SEND_MULTIPLE).apply { + type = "text/plain" + putExtra(Intent.EXTRA_TEXT, state.currentLink.url) + } + context.startActivity(Intent.createChooser(intent, "Pokit")) + }, onClickBookmark = onClickBookmark ) } @@ -282,9 +294,11 @@ fun PokitDetailScreen( onHideBottomSheet = hideLinkModifyBottomSheet, show = state.linkBottomSheetType != null ) { + val context: Context = LocalContext.current when (state.linkBottomSheetType) { BottomSheetType.MODIFY -> { ModifyBottomSheetContent( + onClickShare = { Toast.makeText(context, "준비중입니다.", Toast.LENGTH_SHORT).show() }, onClickModify = remember { { state.currentLink?.let { link -> @@ -319,7 +333,9 @@ fun PokitDetailScreen( ) { when (state.pokitBottomSheetType) { BottomSheetType.MODIFY -> { + val context: Context = LocalContext.current ModifyBottomSheetContent( + onClickShare = { Toast.makeText(context, "준비중입니다.", Toast.LENGTH_SHORT).show() }, onClickModify = remember { { hidePokitModifyBottomSheet() diff --git a/feature/search/src/main/java/pokitmons/pokit/search/SearchScreen.kt b/feature/search/src/main/java/pokitmons/pokit/search/SearchScreen.kt index 8063935c..cebf33dc 100644 --- a/feature/search/src/main/java/pokitmons/pokit/search/SearchScreen.kt +++ b/feature/search/src/main/java/pokitmons/pokit/search/SearchScreen.kt @@ -1,5 +1,7 @@ package pokitmons.pokit.search +import android.content.Context +import android.content.Intent import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize @@ -10,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.unit.dp import coil.compose.rememberAsyncImagePainter @@ -48,6 +51,8 @@ fun SearchScreenContainer( val pokitList by viewModel.pokitList.collectAsState() val pokitPagingState by viewModel.pokitPagingState.collectAsState() + val context: Context = LocalContext.current + state.currentLink?.let { link -> LinkDetailBottomSheet( title = link.title, @@ -60,6 +65,13 @@ fun SearchScreenContainer( dateString = link.dateString, onHideBottomSheet = viewModel::hideLinkDetailBottomSheet, show = state.showLinkDetailBottomSheet, + onClickShareLink = { + val intent = Intent(Intent.ACTION_SEND_MULTIPLE).apply { + type = "text/plain" + putExtra(Intent.EXTRA_TEXT, state.currentLink?.url) + } + context.startActivity(Intent.createChooser(intent, "Pokit")) + }, onClickModifyLink = { viewModel.hideLinkDetailBottomSheet() onNavigateToLinkModify(link.id)