Skip to content

Commit

Permalink
[Fix] 문답, 문답 상세화면 유저 이미지 없어지는 오류 수정 (#125)
Browse files Browse the repository at this point in the history
* [build] : cloudy 라이브러리 버전 업데이트

* [fix] : 문답 상세 - 소개 탭의 유저 이미지가 나오지 않는 오류 수정

* [fix] : 문답 - 문답 리스트의 유저 이미지가 나오지 않는 오류 수정
  • Loading branch information
ham2174 authored Nov 1, 2024
1 parent 66e14af commit ae0052d
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.layer.GraphicsLayer
import androidx.compose.ui.graphics.rememberGraphicsLayer
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
Expand Down Expand Up @@ -78,24 +80,23 @@ fun BottlesProfile(
modifier: Modifier = Modifier,
imageUrl: String,
profileImageType: ProfileImageType,
isBlur: Boolean = true
isBlur: Boolean = true,
graphicsLayer: GraphicsLayer = rememberGraphicsLayer()
) {
CoilImage(
modifier = modifier
.size(size = profileImageType.size)
.clip(shape = CircleShape)
.then(
if (isBlur) {
Modifier.cloudy(radius = 5)
} else {
Modifier
}
.cloudy(
enabled = isBlur,
radius = 5,
graphicsLayer = graphicsLayer
),
imageModel = { imageUrl },
previewPlaceholder = painterResource(id = R.drawable.sample_image),
imageOptions = ImageOptions(
contentScale = ContentScale.Crop
),
previewPlaceholder = painterResource(id = R.drawable.sample_image),
loading = {
Box(
modifier = Modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ 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.layer.GraphicsLayer
import androidx.compose.ui.graphics.rememberGraphicsLayer
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
Expand Down Expand Up @@ -74,7 +76,8 @@ fun BottlesUserInfo(
userName: String,
userAge: Int,
isBlur: Boolean = true,
profileImageType: ProfileImageType = ProfileImageType.LG
profileImageType: ProfileImageType = ProfileImageType.LG,
graphicsLayer: GraphicsLayer = rememberGraphicsLayer()
) {
Column(
modifier = modifier.fillMaxWidth(),
Expand All @@ -86,7 +89,8 @@ fun BottlesUserInfo(
BottlesProfile(
imageUrl = imageUrl,
profileImageType = profileImageType,
isBlur = isBlur
isBlur = isBlur,
graphicsLayer = graphicsLayer
)

Row(
Expand Down Expand Up @@ -127,6 +131,7 @@ private fun UserInfoPreview() {
imageUrl = "",
userName = "냥냥이",
userAge = 15,
graphicsLayer = rememberGraphicsLayer()
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import com.team.bottles.core.ui.model.Bottle
fun BottleItem(
modifier: Modifier = Modifier,
bottle: Bottle,
graphicsLayer: GraphicsLayer,
onClickItem: () -> Unit,
) {
Column(
Expand Down Expand Up @@ -126,7 +127,7 @@ fun BottleItem(
.clip(shape = CircleShape)
.cloudy(
radius = 5,
graphicsLayer = rememberGraphicsLayer()
graphicsLayer = graphicsLayer
),
imageModel = { bottle.imageUrl },
previewPlaceholder = painterResource(id = R.drawable.sample_image),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.rememberGraphicsLayer
import androidx.compose.ui.tooling.preview.Preview
import com.team.bottles.core.designsystem.theme.BottlesTheme
import com.team.bottles.core.ui.BottleItem
Expand All @@ -18,8 +19,10 @@ import kotlinx.collections.immutable.toImmutableList
fun BottleList(
modifier: Modifier = Modifier,
bottles: ImmutableList<Bottle>,
onClickItem: (Bottle) -> Unit
onClickItem: (Bottle) -> Unit,
) {
val graphicsLayer = rememberGraphicsLayer()

LazyColumn(
modifier = modifier.fillMaxSize(),
contentPadding = PaddingValues(
Expand All @@ -38,8 +41,10 @@ fun BottleList(
) { bottle ->
BottleItem(
bottle = bottle,
onClickItem = { onClickItem(bottle) },
)
graphicsLayer = graphicsLayer
) {
onClickItem(bottle)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.rememberGraphicsLayer
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.platform.LocalFocusManager
Expand Down Expand Up @@ -128,6 +129,8 @@ internal fun PingPongDetailScreen(
.padding(innerPadding)
.nestedScroll(connection = pullRefreshState.nestedScrollConnection)
) {
val graphicsLayer = rememberGraphicsLayer()

LazyColumn(
modifier = Modifier.fillMaxSize(),
state = when (uiState.currentTab) {
Expand All @@ -151,6 +154,7 @@ internal fun PingPongDetailScreen(
partnerLetter = uiState.partnerLetter,
partnerKeyPoints = uiState.partnerKeyPoints,
deleteAfterDay = uiState.deleteAfterDay,
graphicsLayer = graphicsLayer
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.layer.GraphicsLayer
import androidx.compose.ui.graphics.rememberGraphicsLayer
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import com.team.bottles.core.designsystem.R
Expand All @@ -27,14 +29,16 @@ internal fun LazyListScope.introductionContents(
partnerProfile: UserProfile,
partnerKeyPoints: List<UserKeyPoint>,
partnerLetter: String,
graphicsLayer: GraphicsLayer
) {
item(key = "Introduction Contents") {
when (isStoppedPingPong) {
false -> {
BottlesUserInfo(
imageUrl = partnerProfile.imageUrl,
userName = partnerProfile.userName,
userAge = partnerProfile.age
userAge = partnerProfile.age,
graphicsLayer = graphicsLayer
)

Spacer(modifier = Modifier.height(height = BottlesTheme.spacing.extraLarge))
Expand Down Expand Up @@ -66,6 +70,7 @@ internal fun LazyListScope.introductionContents(
@Composable
private fun IntroductionContentsPreview() {
BottlesTheme {
val graphicsLayer = rememberGraphicsLayer()
LazyColumn(
modifier = Modifier.fillMaxSize(),
state = rememberLazyListState(),
Expand All @@ -80,6 +85,7 @@ private fun IntroductionContentsPreview() {
partnerProfile = UserProfile.sampleUserProfile(),
partnerKeyPoints = UserKeyPoint.exampleUerKeyPoints(),
partnerLetter = "편지내용입니다.",
graphicsLayer = graphicsLayer
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ okHttp = "4.12.0"
kotlinx-serialization-converter = "1.0.0"

# blur-effect
cloudy = "0.2.1"
cloudy = "0.2.3"

# coil
landscapist-coil-compose = "2.3.6"
Expand Down

0 comments on commit ae0052d

Please sign in to comment.