From 593ebad25404efab4b906070273337c0cc67d23f Mon Sep 17 00:00:00 2001 From: khaykov Date: Wed, 18 Nov 2020 16:21:37 -0800 Subject: [PATCH] Updated naming + comment. --- .../ui/reader/discover/ReaderPostUiStateBuilder.kt | 14 +++++++------- .../ui/reader/views/ReaderPostDetailHeaderView.kt | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderPostUiStateBuilder.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderPostUiStateBuilder.kt index e83252e2d1ed..33a81a82f678 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderPostUiStateBuilder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderPostUiStateBuilder.kt @@ -216,23 +216,23 @@ class ReaderPostUiStateBuilder @Inject constructor( post: ReaderPost, onBlogSectionClicked: (Long, Long) -> Unit, postListType: ReaderPostListType? = null, - showP2SpecificLayout: Boolean = false - ) = buildBlogSectionUiState(post, onBlogSectionClicked, postListType, showP2SpecificLayout) + isP2Post: Boolean = false + ) = buildBlogSectionUiState(post, onBlogSectionClicked, postListType, isP2Post) private fun buildBlogSectionUiState( post: ReaderPost, onBlogSectionClicked: (Long, Long) -> Unit, postListType: ReaderPostListType?, - showP2SpecificLayout: Boolean = false + isP2Post: Boolean = false ): ReaderBlogSectionUiState { return ReaderBlogSectionUiState( postId = post.postId, blogId = post.blogId, - blogName = buildBlogName(post, showP2SpecificLayout), + blogName = buildBlogName(post, isP2Post), blogUrl = buildBlogUrl(post), dateLine = buildDateLine(post), avatarOrBlavatarUrl = buildAvatarOrBlavatarUrl(post), - isAuthorAvatarVisible = showP2SpecificLayout, + isAuthorAvatarVisible = isP2Post, authorAvatarUrl = gravatarUtilsWrapper.fixGravatarUrlWithResource( post.postAvatar, R.dimen.avatar_sz_medium @@ -312,11 +312,11 @@ class ReaderPostUiStateBuilder @Inject constructor( private fun buildExcerpt(post: ReaderPost) = post.takeIf { post.cardType != PHOTO && post.hasExcerpt() }?.excerpt - private fun buildBlogName(post: ReaderPost, showP2SpecificLayout: Boolean = false): UiString { + private fun buildBlogName(post: ReaderPost, isP2Post: Boolean = false): UiString { val blogName = post.takeIf { it.hasBlogName() }?.blogName?.let { UiStringText(it) } ?: UiStringRes(R.string.untitled_in_parentheses) - if (!showP2SpecificLayout) { + if (!isP2Post) { return blogName } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderPostDetailHeaderView.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderPostDetailHeaderView.kt index 5f91f4e24942..1c2fb993c006 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderPostDetailHeaderView.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderPostDetailHeaderView.kt @@ -78,7 +78,6 @@ class ReaderPostDetailHeaderView @JvmOverloads constructor( private fun updateBlavatar(state: ReaderBlogSectionUiState) { uiHelpers.updateVisibility(image_avatar_or_blavatar, state.avatarOrBlavatarUrl != null) - uiHelpers.updateVisibility(authors_avatar, state.isAuthorAvatarVisible) if (state.avatarOrBlavatarUrl == null) { imageManager.cancelRequestAndClearImageView(image_avatar_or_blavatar) } else { @@ -87,6 +86,8 @@ class ReaderPostDetailHeaderView @JvmOverloads constructor( BLAVATAR_CIRCULAR, state.avatarOrBlavatarUrl ) } + // we don't show the p2 style of header in post details yet + uiHelpers.updateVisibility(authors_avatar, state.isAuthorAvatarVisible) } private fun updateFollowButton(followButtonUiState: FollowButtonUiState) {