From ec5747aadd940c4bf39a67f05d6e1dde6dd84af1 Mon Sep 17 00:00:00 2001 From: JeonK1 Date: Sat, 21 Sep 2024 15:45:09 +0900 Subject: [PATCH] =?UTF-8?q?:sparkle:=20=ED=9E=88=EC=8A=A4=ED=86=A0?= =?UTF-8?q?=EB=A6=AC=20=EC=83=81=EC=84=B8=ED=99=94=EB=A9=B4=20=EA=B3=B5?= =?UTF-8?q?=EC=9C=A0=ED=95=98=EA=B8=B0=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/groupdetail/HistoryDetailActivity.kt | 2 ++ .../main/groupdetail/HistoryDetailScreen.kt | 35 ++++++++++++++++--- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/presentation/src/main/java/com/mashup/gabbangzip/sharedalbum/presentation/ui/main/groupdetail/HistoryDetailActivity.kt b/presentation/src/main/java/com/mashup/gabbangzip/sharedalbum/presentation/ui/main/groupdetail/HistoryDetailActivity.kt index 8ada2969b..07b4452f5 100644 --- a/presentation/src/main/java/com/mashup/gabbangzip/sharedalbum/presentation/ui/main/groupdetail/HistoryDetailActivity.kt +++ b/presentation/src/main/java/com/mashup/gabbangzip/sharedalbum/presentation/ui/main/groupdetail/HistoryDetailActivity.kt @@ -10,6 +10,7 @@ import androidx.activity.compose.setContent import androidx.activity.enableEdgeToEdge import com.mashup.gabbangzip.sharedalbum.presentation.theme.SharedAlbumTheme import com.mashup.gabbangzip.sharedalbum.presentation.ui.model.GroupKeyword +import com.mashup.gabbangzip.sharedalbum.presentation.utils.shareBitmap class HistoryDetailActivity : ComponentActivity() { private val state by lazy { intent.getSerializableExtra(KEY_HISTORY) as HistoryDetailState? } @@ -29,6 +30,7 @@ class HistoryDetailActivity : ComponentActivity() { keyword = GroupKeyword.getKeyword(state.keyword), item = state.history, onClickBackButton = { finish() }, + onClickShareButton = { bitmap -> shareBitmap(bitmap) }, ) } } diff --git a/presentation/src/main/java/com/mashup/gabbangzip/sharedalbum/presentation/ui/main/groupdetail/HistoryDetailScreen.kt b/presentation/src/main/java/com/mashup/gabbangzip/sharedalbum/presentation/ui/main/groupdetail/HistoryDetailScreen.kt index d046bdfff..78278c9a0 100644 --- a/presentation/src/main/java/com/mashup/gabbangzip/sharedalbum/presentation/ui/main/groupdetail/HistoryDetailScreen.kt +++ b/presentation/src/main/java/com/mashup/gabbangzip/sharedalbum/presentation/ui/main/groupdetail/HistoryDetailScreen.kt @@ -1,5 +1,7 @@ package com.mashup.gabbangzip.sharedalbum.presentation.ui.main.groupdetail +import android.graphics.Bitmap +import android.graphics.Picture import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box @@ -13,16 +15,19 @@ import androidx.compose.foundation.lazy.grid.LazyVerticalGrid import androidx.compose.foundation.lazy.grid.items import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import com.mashup.gabbangzip.sharedalbum.presentation.R import com.mashup.gabbangzip.sharedalbum.presentation.theme.Gray0 import com.mashup.gabbangzip.sharedalbum.presentation.theme.PicTypography import com.mashup.gabbangzip.sharedalbum.presentation.theme.SharedAlbumTheme import com.mashup.gabbangzip.sharedalbum.presentation.ui.common.PicBackButtonTopBar import com.mashup.gabbangzip.sharedalbum.presentation.ui.common.PicCroppedPhoto +import com.mashup.gabbangzip.sharedalbum.presentation.ui.common.PicNormalButton import com.mashup.gabbangzip.sharedalbum.presentation.ui.common.PicPhotoCardFrame import com.mashup.gabbangzip.sharedalbum.presentation.ui.common.PicTopBarTitleAlign import com.mashup.gabbangzip.sharedalbum.presentation.ui.main.groupdetail.model.HistoryItem @@ -30,6 +35,8 @@ import com.mashup.gabbangzip.sharedalbum.presentation.ui.main.grouphome.model.Ca import com.mashup.gabbangzip.sharedalbum.presentation.ui.model.GroupKeyword import com.mashup.gabbangzip.sharedalbum.presentation.ui.model.PicPhotoFrame import com.mashup.gabbangzip.sharedalbum.presentation.utils.ImmutableList +import com.mashup.gabbangzip.sharedalbum.presentation.utils.captureIntoCanvas +import com.mashup.gabbangzip.sharedalbum.presentation.utils.createBitmap @Composable fun HistoryDetailScreen( @@ -37,7 +44,9 @@ fun HistoryDetailScreen( keyword: GroupKeyword, item: HistoryItem, onClickBackButton: () -> Unit, + onClickShareButton: (Bitmap) -> Unit, ) { + val picture = remember { Picture() } Column( modifier = Modifier .fillMaxSize() @@ -52,11 +61,28 @@ fun HistoryDetailScreen( titleAlign = PicTopBarTitleAlign.LEFT, backButtonClicked = onClickBackButton, ) - HistoryPhotoCard( + Box( + modifier = Modifier.weight(1f), + contentAlignment = Alignment.Center, + ) { + HistoryPhotoCard( + modifier = Modifier + .wrapContentSize() + .captureIntoCanvas(picture), + keyword = keyword, + item = item, + ) + } + PicNormalButton( modifier = Modifier - .weight(1f), - keyword = keyword, - item = item, + .padding(bottom = 79.dp) + .align(Alignment.CenterHorizontally), + iconRes = R.drawable.ic_share, + isSingleClick = true, + onButtonClicked = { + val bitmap = picture.createBitmap() + onClickShareButton(bitmap) + }, ) } } @@ -155,6 +181,7 @@ private fun HistoryDetailScreenPreview() { ), ), onClickBackButton = {}, + onClickShareButton = {}, ) } }