-
Notifications
You must be signed in to change notification settings - Fork 2
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
웹뷰 요약하기 화면 개발 #235
Merged
Merged
웹뷰 요약하기 화면 개발 #235
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5a8e575
[feat] 탑바 actionIcon있는 경우 확장되도록 수정
ddyeon 88ece4d
[feat] 홈화면에서 웹뷰 이동시 연결 로직 수정
ddyeon 60751c0
[feat] 요약하기 홈 화면 연결
devdayeon 9fd6576
[fix] 린트 수정
devdayeon dc64ddd
[fix] 린트 수정
devdayeon dbba30b
Merge branch 'develop' into feature/summary
ddyeon 4c9102a
Merge branch 'develop' into feature/summary
ddyeon fd034b5
[fix] 린트 적용
devdayeon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
core/webview/src/main/java/com/mashup/dorabangs/core/model/AISummaryUiModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.mashup.dorabangs.core.model | ||
|
||
import java.io.Serializable | ||
|
||
@kotlinx.serialization.Serializable | ||
data class AISummaryUiModel( | ||
val description: String? = "", | ||
val keywords: List<String?>? = listOf(), | ||
val url: String? = "", | ||
) : Serializable |
55 changes: 55 additions & 0 deletions
55
core/webview/src/main/java/com/mashup/dorabangs/core/summary/AISummaryNavigation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.mashup.dorabangs.core.summary | ||
|
||
import android.net.Uri | ||
import androidx.compose.animation.AnimatedContentTransitionScope | ||
import androidx.compose.animation.core.tween | ||
import androidx.navigation.NavController | ||
import androidx.navigation.NavGraphBuilder | ||
import androidx.navigation.NavOptions | ||
import androidx.navigation.compose.composable | ||
import androidx.navigation.navArgument | ||
import com.mashup.core.navigation.NavigationRoute | ||
import com.mashup.core.navigation.bundleSerializable | ||
import com.mashup.core.navigation.serializableNavType | ||
import com.mashup.dorabangs.core.model.AISummaryUiModel | ||
import kotlinx.serialization.encodeToString | ||
import kotlinx.serialization.json.Json | ||
|
||
fun NavController.navigateToAISummary(navOptions: NavOptions? = null, summaryUiModel: AISummaryUiModel) { | ||
val summary = Uri.encode(Json.encodeToString(summaryUiModel)) | ||
navigate("${NavigationRoute.AISummaryScreen.route}/summary=$summary", navOptions) | ||
} | ||
|
||
fun NavGraphBuilder.aiSummaryNavigation( | ||
navigateToPopBackStack: () -> Unit, | ||
) { | ||
composable( | ||
route = "${NavigationRoute.AISummaryScreen.route}/summary={summary}", | ||
arguments = listOf( | ||
navArgument(name = "summary") { | ||
type = serializableNavType<AISummaryUiModel>() | ||
}, | ||
), | ||
enterTransition = { | ||
slideIntoContainer( | ||
towards = AnimatedContentTransitionScope.SlideDirection.Left, | ||
animationSpec = tween(250), | ||
) | ||
}, | ||
exitTransition = { | ||
slideOutOfContainer( | ||
towards = AnimatedContentTransitionScope.SlideDirection.Right, | ||
animationSpec = tween(400), | ||
) | ||
}, | ||
) { navBackStackEntry -> | ||
val aiSummary = navBackStackEntry.arguments?.bundleSerializable("summary") as AISummaryUiModel? | ||
|
||
aiSummary?.let { summary -> | ||
AISummaryRoute( | ||
aiSummaryUiModel = summary, | ||
navigateToPopBackStack = navigateToPopBackStack, | ||
) | ||
} | ||
} | ||
} |
126 changes: 126 additions & 0 deletions
126
core/webview/src/main/java/com/mashup/dorabangs/core/summary/AISummaryScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
package com.mashup.dorabangs.core.summary | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.layout.wrapContentHeight | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import com.mashup.dorabangs.core.designsystem.R | ||
import com.mashup.dorabangs.core.designsystem.component.buttons.DoraButtons | ||
import com.mashup.dorabangs.core.designsystem.component.card.FeedCardKeyword | ||
import com.mashup.dorabangs.core.designsystem.component.topbar.DoraTopBar | ||
import com.mashup.dorabangs.core.designsystem.theme.DoraColorTokens | ||
import com.mashup.dorabangs.core.designsystem.theme.DoraTypoTokens | ||
import com.mashup.dorabangs.core.model.AISummaryUiModel | ||
import com.mashup.dorabangs.core.webview.R as webViewR | ||
|
||
@Composable | ||
fun AISummaryRoute( | ||
aiSummaryUiModel: AISummaryUiModel, | ||
navigateToPopBackStack: () -> Unit, | ||
) { | ||
AISummaryScreen( | ||
aiSummaryUiModel = aiSummaryUiModel, | ||
navigateToPopBackStack = navigateToPopBackStack, | ||
) | ||
} | ||
|
||
@Composable | ||
fun AISummaryScreen( | ||
aiSummaryUiModel: AISummaryUiModel, | ||
navigateToPopBackStack: () -> Unit, | ||
modifier: Modifier = Modifier, | ||
) { | ||
Column( | ||
modifier = modifier.fillMaxSize().background(color = DoraColorTokens.White), | ||
) { | ||
DoraTopBar.BackNavigationTopBar( | ||
modifier = Modifier.fillMaxWidth(), | ||
title = "", | ||
isTitleCenter = true, | ||
onClickBackIcon = navigateToPopBackStack, | ||
isShowBottomDivider = true, | ||
) | ||
Spacer(modifier = Modifier.height(30.dp)) | ||
AISummaryContent( | ||
aiSummaryUiModel = aiSummaryUiModel, | ||
modifier = Modifier.padding(horizontal = 20.dp), | ||
) | ||
Spacer(modifier = Modifier.weight(1f)) | ||
DoraButtons.DoraBtnMaxFull( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(20.dp), | ||
enabled = true, | ||
buttonText = "닫기", | ||
onClickButton = navigateToPopBackStack, | ||
) | ||
} | ||
} | ||
|
||
@Composable | ||
fun AISummaryContent( | ||
aiSummaryUiModel: AISummaryUiModel, | ||
modifier: Modifier, | ||
) { | ||
Column( | ||
modifier = modifier | ||
.fillMaxWidth() | ||
.wrapContentHeight() | ||
.background(color = DoraColorTokens.White), | ||
) { | ||
Row( | ||
modifier = Modifier, | ||
) { | ||
Icon( | ||
modifier = Modifier.size(14.dp), | ||
tint = Color.Unspecified, | ||
painter = painterResource(id = webViewR.drawable.icon_summary_star), | ||
contentDescription = "summary_icon", | ||
) | ||
Text( | ||
text = stringResource(id = R.string.feed_card_content_title), | ||
modifier = Modifier | ||
.align(Alignment.CenterVertically) | ||
.padding(start = 6.dp), | ||
textAlign = TextAlign.Center, | ||
style = DoraTypoTokens.caption2Bold, | ||
color = DoraColorTokens.G9, | ||
) | ||
} | ||
Spacer(modifier = Modifier.height(10.dp)) | ||
Text( | ||
text = aiSummaryUiModel.description.orEmpty(), | ||
style = DoraTypoTokens.caption2Medium, | ||
color = DoraColorTokens.G7, | ||
) | ||
Spacer(modifier = Modifier.height(20.dp)) | ||
FeedCardKeyword(keywordList = aiSummaryUiModel.keywords?.take(3)) | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun PreviewAISummaryScreen() { | ||
AISummaryScreen( | ||
aiSummaryUiModel = AISummaryUiModel(), | ||
modifier = Modifier, | ||
navigateToPopBackStack = {}, | ||
) | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요런것두 있었구만