Skip to content

Commit

Permalink
feat : 사진 변경사항 적용
Browse files Browse the repository at this point in the history
- 고정 크기로 변경
- 사진이 없을 경우 대처
  • Loading branch information
chws0508 committed Mar 24, 2024
1 parent 2153afc commit 022192c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ data class Post(
val content: String,
val postTopic: PostTopic,
val createDate: Date,
val postImageUrl: String,
val postImageUrl: String?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,18 @@ fun Date.toRelativeString(context: Context): String {
)
}

is DurationFromNow.OneMinuteToOneHour -> context.getString(
R.string.minute_format,
durationFromNow.minutes,
)
is DurationFromNow.OneHourToOneDay -> context.getString(
R.string.hour_format,
durationFromNow.minutes,
durationFromNow.hours,
)

is DurationFromNow.OneDayToSevenDay -> context.getString(
R.string.second_format,
durationFromNow.days,
)

is DurationFromNow.OneMinuteToOneHour -> context.getString(
R.string.day_format,
durationFromNow.days,
)

is DurationFromNow.SevenDayToOneYear -> date.format(DateTimeFormatter.ofPattern(DATE_FORMAT))
is DurationFromNow.OverOneYear -> context.getString(
R.string.years_format,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ 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.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
Expand Down Expand Up @@ -114,18 +115,19 @@ fun PostListScreen(
fontSize = 12.sp
)
}
GlideImage(
modifier = Modifier
.constrainAs(image) {
top.linkTo(column.top)
bottom.linkTo(column.bottom)
end.linkTo(parent.end)
height = Dimension.fillToConstraints
width = Dimension.ratio("1:1")
},
imageModel = { post.postImageUrl },
previewPlaceholder = R.drawable.ic_freedom,
)
post.postImageUrl?.let {
GlideImage(
modifier = Modifier
.size(72.dp)
.constrainAs(image) {
top.linkTo(parent.top)
bottom.linkTo(parent.bottom)
end.linkTo(parent.end)
},
imageModel = { it },
previewPlaceholder = R.drawable.ic_freedom,
)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ class PostListViewModel @Inject constructor() : ViewModel() {
Post(
postId = it.toLong(),
title = postTopic.toString(),
content = postTopic.toString()+"\n${postTopic.toString()}",
content = postTopic.toString()+"아아아아아아아아아아아아아아아아아아아아아아아아아아아아아아아",
postTopic = postTopic,
createDate = Date(LocalDateTime.now()),
postImageUrl = "http://withpeace.s3-website.kr.object.ncloudstorage.com/userProfile/1",
postImageUrl = null,
)
}
}

0 comments on commit 022192c

Please sign in to comment.