Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] #58 메인 화면 QA 진행 #60

Merged
merged 11 commits into from
Aug 28, 2024
Merged
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
4 changes: 3 additions & 1 deletion app/src/main/java/pokitmons/pokit/navigation/RootNavHost.kt
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ fun RootNavHost(
onNavigateToPokitDetail = { navHostController.navigate("${PokitDetail.route}/$it") },
onNavigateAddLink = { navHostController.navigate(AddLink.route) },
onNavigateAddPokit = { navHostController.navigate(AddPokit.route) },
onNavigateToLinkModify = { navHostController.navigate("${AddLink.route}?${AddLink.linkIdArg}=$it") }
onNavigateToLinkModify = { navHostController.navigate("${AddLink.route}?${AddLink.linkIdArg}=$it") },
onNavigateToPokitModify = { navHostController.navigate("${AddPokit.route}?${AddPokit.pokitIdArg}=$it") },
onNavigateToAlarm = { navHostController.navigate(Alarm.route) }
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.strayalpaca.pokitdetail.components.block
package pokitmons.pokit.core.ui.components.block.linkurlcard

import androidx.compose.foundation.Image
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
Expand All @@ -15,19 +16,20 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.unit.dp
import coil.compose.rememberAsyncImagePainter
import com.strayalpaca.pokitdetail.model.Link
import pokitmons.pokit.core.ui.theme.PokitTheme
import pokitmons.pokit.core.ui.utils.noRippleClickable

@Composable
internal fun Link(
link: Link,
fun LinkUrlCard(
modifier: Modifier = Modifier,
openWebBrowserByClick: Boolean = true,
thumbnailPainter: Painter,
url: String,
title: String,
openWebBrowserByClick: Boolean,
) {
val uriHandler = LocalUriHandler.current

Expand All @@ -38,7 +40,7 @@ internal fun Link(
.height(IntrinsicSize.Min)
.noRippleClickable {
if (openWebBrowserByClick) {
uriHandler.openUri(link.url)
uriHandler.openUri(url)
}
}
.border(
Expand All @@ -48,12 +50,10 @@ internal fun Link(
)
) {
Image(
painter = rememberAsyncImagePainter(
model = link.imageUrl
),
painter = thumbnailPainter,
contentDescription = null,
contentScale = ContentScale.Crop,
modifier = Modifier.width(124.dp)
modifier = Modifier.width(124.dp).fillMaxHeight()
)

Column(
Expand All @@ -63,7 +63,7 @@ internal fun Link(
) {
Text(
modifier = Modifier.fillMaxWidth(),
text = link.title,
text = title,
maxLines = 2,
style = PokitTheme.typography.body3Medium.copy(color = PokitTheme.colors.textSecondary)
)
Expand All @@ -72,7 +72,7 @@ internal fun Link(

Text(
modifier = Modifier.fillMaxWidth(),
text = link.url,
text = url,
maxLines = 2,
style = PokitTheme.typography.detail2.copy(color = PokitTheme.colors.textTertiary)
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package pokitmons.pokit.core.ui.components.block.linkurlcard

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import pokitmons.pokit.core.ui.R
import pokitmons.pokit.core.ui.theme.PokitTheme

@Preview(showBackground = true)
@Composable
private fun LinkUrlCardPreview() {
PokitTheme {
Surface(modifier = Modifier.fillMaxSize()) {
Column(
modifier = Modifier.fillMaxSize(),
verticalArrangement = Arrangement.spacedBy(12.dp)
) {
LinkUrlCard(
thumbnailPainter = painterResource(id = R.drawable.icon_24_google),
url = "https://naver.com",
title = "네이버",
openWebBrowserByClick = false
)

LinkUrlCard(
modifier = Modifier.padding(20.dp),
thumbnailPainter = painterResource(id = R.drawable.icon_24_google),
url = "https://naver.com",
title = "네이버",
openWebBrowserByClick = false
)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pokitmons.pokit.search.components.linkdetailbottomsheet
package pokitmons.pokit.core.ui.components.template.linkdetailbottomsheet

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
Expand All @@ -22,25 +22,33 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import pokitmons.pokit.core.ui.R
import pokitmons.pokit.core.ui.components.block.linkurlcard.LinkUrlCard
import pokitmons.pokit.core.ui.components.template.bottomsheet.PokitBottomSheet
import pokitmons.pokit.core.ui.theme.PokitTheme
import pokitmons.pokit.core.ui.theme.color.Orange50
import pokitmons.pokit.search.model.Link

@Composable
fun LinkDetailBottomSheet(
link: Link,
title: String,
memo: String,
url: String,
thumbnailPainter: Painter,
bookmark: Boolean,
openWebBrowserByClick: Boolean,
linkType: String,
dateString: String,
onHideBottomSheet: () -> Unit,
show: Boolean = false,
onClickRemoveLink: (Link) -> Unit,
onClickModifyLink: (Link) -> Unit,
onClickBookmark: () -> Unit,
onClickBookmark: (() -> Unit)? = null,
onClickRemoveLink: (() -> Unit)? = null,
onClickModifyLink: (() -> Unit)? = null,
onClickShareLink: (() -> Unit)? = null,
) {
PokitBottomSheet(
onHideBottomSheet = onHideBottomSheet,
Expand Down Expand Up @@ -71,7 +79,7 @@ fun LinkDetailBottomSheet(
Spacer(modifier = Modifier.width(4.dp))

Text(
text = stringResource(id = link.linkType.textResourceId),
text = linkType,
modifier = Modifier
.border(
width = 1.dp,
Expand All @@ -90,7 +98,7 @@ fun LinkDetailBottomSheet(
Spacer(modifier = Modifier.height(8.dp))

Text(
text = link.title,
text = title,
maxLines = 2,
overflow = TextOverflow.Ellipsis,
style = PokitTheme.typography.title3.copy(color = PokitTheme.colors.textPrimary)
Expand All @@ -100,7 +108,7 @@ fun LinkDetailBottomSheet(

Text(
modifier = Modifier.fillMaxWidth(),
text = link.dateString,
text = dateString,
style = PokitTheme.typography.detail2.copy(color = PokitTheme.colors.textTertiary),
textAlign = TextAlign.End
)
Expand All @@ -118,12 +126,17 @@ fun LinkDetailBottomSheet(
.fillMaxWidth()
.padding(horizontal = 20.dp, vertical = 24.dp)
) {
Link(link = link)
LinkUrlCard(
thumbnailPainter = thumbnailPainter,
url = url,
title = title,
openWebBrowserByClick = openWebBrowserByClick
)

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

Text(
text = link.memo,
text = memo,
modifier = Modifier
.fillMaxWidth()
.background(
Expand Down Expand Up @@ -151,67 +164,76 @@ fun LinkDetailBottomSheet(
Image(
modifier = Modifier
.size(36.dp)
.padding(6.dp)
.clickable(
indication = null,
interactionSource = remember { MutableInteractionSource() },
onClick = onClickBookmark
)
.padding(6.dp),
onClick = {
onClickBookmark?.invoke()
}
),
painter = painterResource(id = R.drawable.icon_24_star),
contentDescription = "bookmark",
colorFilter = ColorFilter.tint(
color = if (link.bookmark) PokitTheme.colors.brand else PokitTheme.colors.iconTertiary
color = if (bookmark) PokitTheme.colors.brand else PokitTheme.colors.iconTertiary
)
)

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

// Image(
// modifier = Modifier
// .size(36.dp)
// .padding(6.dp),
// painter = painterResource(id = R.drawable.icon_24_share),
// contentDescription = "share",
// colorFilter = ColorFilter.tint(
// color = PokitTheme.colors.iconSecondary
// )
// )
//
// Image(
// modifier = Modifier
// .size(36.dp)
// .clickable(
// indication = null,
// interactionSource = remember { MutableInteractionSource() },
// onClick = {
// onClickModifyLink(link)
// }
// )
// .padding(6.dp),
// painter = painterResource(id = R.drawable.icon_24_edit),
// contentDescription = "edit",
// colorFilter = ColorFilter.tint(
// color = PokitTheme.colors.iconSecondary
// )
// )
//
// Image(
// modifier = Modifier
// .size(36.dp)
// .clickable(
// indication = null,
// interactionSource = remember { MutableInteractionSource() },
// onClick = {
// onClickRemoveLink(link)
// }
// )
// .padding(6.dp),
// painter = painterResource(id = R.drawable.icon_24_trash),
// contentDescription = "remove",
// colorFilter = ColorFilter.tint(
// color = PokitTheme.colors.iconSecondary
// )
// )
onClickShareLink?.let {
Image(
modifier = Modifier
.size(36.dp)
.padding(6.dp)
.clickable(
indication = null,
interactionSource = remember { MutableInteractionSource() },
onClick = onClickShareLink
),
painter = painterResource(id = R.drawable.icon_24_share),
contentDescription = "share",
colorFilter = ColorFilter.tint(
color = PokitTheme.colors.iconSecondary
)
)
}

onClickModifyLink?.let {
Image(
modifier = Modifier
.size(36.dp)
.padding(6.dp)
.clickable(
indication = null,
interactionSource = remember { MutableInteractionSource() },
onClick = onClickModifyLink
),
painter = painterResource(id = R.drawable.icon_24_edit),
contentDescription = "edit",
colorFilter = ColorFilter.tint(
color = PokitTheme.colors.iconSecondary
)
)
}

onClickRemoveLink?.let {
Image(
modifier = Modifier
.size(36.dp)
.padding(6.dp)
.clickable(
indication = null,
interactionSource = remember { MutableInteractionSource() },
onClick = onClickRemoveLink
),
painter = painterResource(id = R.drawable.icon_24_trash),
contentDescription = "remove",
colorFilter = ColorFilter.tint(
color = PokitTheme.colors.iconSecondary
)
)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package pokitmons.pokit.core.ui.components.template.linkdetailbottomsheet

import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import pokitmons.pokit.core.ui.R
import pokitmons.pokit.core.ui.theme.PokitTheme

@Preview(showBackground = true)
@Composable
private fun LinkDetailBottomSheetPreview() {
PokitTheme {
Surface(modifier = Modifier.fillMaxSize()) {
LinkDetailBottomSheet(
title = "title",
memo = "some memo",
url = "https://naver.com",
thumbnailPainter = painterResource(id = R.drawable.icon_24_google),
bookmark = true,
openWebBrowserByClick = false,
show = true,
linkType = "TEXT",
dateString = "2024.08.27",
onHideBottomSheet = { },
onClickBookmark = { },
onClickModifyLink = { },
onClickRemoveLink = { },
onClickShareLink = { }
)
}
}
}
Loading
Loading