fix(home): 팔로잉 최근 소식 표시를 보완한다
This commit is contained in:
@@ -8,7 +8,9 @@ import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.extensions.loadUrl
|
||||
import kr.co.vividnext.sodalive.v2.main.home.data.FollowingNewsType
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.HomeFollowingNewsUiItem
|
||||
import kr.co.vividnext.sodalive.v2.widget.feed.FeedContentCategory
|
||||
import kr.co.vividnext.sodalive.v2.widget.feed.FeedContentView
|
||||
import kr.co.vividnext.sodalive.v2.widget.feed.FeedRankHighlight
|
||||
import kr.co.vividnext.sodalive.v2.widget.feed.FeedItem
|
||||
import kr.co.vividnext.sodalive.v2.widget.feed.FeedRankView
|
||||
import kr.co.vividnext.sodalive.v2.widget.feed.FeedSize
|
||||
@@ -76,12 +78,24 @@ class HomeFollowingNewsAdapter(
|
||||
|
||||
override fun bind(item: HomeFollowingNewsUiItem) {
|
||||
val ranking = item as HomeFollowingNewsUiItem.Ranking
|
||||
val context = view.context
|
||||
val rankText = "${ranking.rank}위"
|
||||
val message = context.getString(
|
||||
R.string.screen_home_following_creator_ranking_news_message,
|
||||
ranking.creatorNickname,
|
||||
rankText
|
||||
)
|
||||
val feedItem = FeedItem.Rank(
|
||||
feedId = ranking.newsId,
|
||||
imageUrl = ranking.thumbnailImageUrl.orEmpty(),
|
||||
rankText = ranking.rank.toString(),
|
||||
message = ranking.body.ifBlank { ranking.title },
|
||||
highlightRanges = emptyList()
|
||||
message = message,
|
||||
highlightRanges = listOf(
|
||||
FeedRankHighlight(
|
||||
start = message.indexOf(rankText),
|
||||
endExclusive = message.indexOf(rankText) + rankText.length
|
||||
)
|
||||
)
|
||||
)
|
||||
view.setFeedSize(feedSize(FeedVariant.Rank, parent))
|
||||
view.bind(feedItem)
|
||||
@@ -135,7 +149,8 @@ class HomeFollowingNewsAdapter(
|
||||
contentId = content.targetId.toString(),
|
||||
contentTitle = content.title,
|
||||
contentImageUrl = content.thumbnailImageUrl.orEmpty(),
|
||||
createdAtText = content.visibleFromText
|
||||
createdAtText = content.visibleFromText,
|
||||
category = content.type.toFeedContentCategory()
|
||||
)
|
||||
view.setFeedSize(feedSize(FeedVariant.Content, parent))
|
||||
view.bind(feedItem)
|
||||
@@ -164,5 +179,13 @@ class HomeFollowingNewsAdapter(
|
||||
imageView.loadUrl(url)
|
||||
}
|
||||
}
|
||||
|
||||
private fun FollowingNewsType.toFeedContentCategory(): FeedContentCategory = when (this) {
|
||||
FollowingNewsType.AUDIO_CONTENT -> FeedContentCategory.Audio
|
||||
FollowingNewsType.PHOTO_CONTENT -> FeedContentCategory.Photo
|
||||
FollowingNewsType.COMMUNITY_POST,
|
||||
FollowingNewsType.CREATOR_RANKING,
|
||||
FollowingNewsType.CONTENT_RANKING -> FeedContentCategory.Content
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user