From 798451195c5a2486bf22914fd1a040fabd105244 Mon Sep 17 00:00:00 2001 From: Renan Lukas <14964993+RenanLukas@users.noreply.github.com> Date: Wed, 5 Jun 2024 18:17:17 -0300 Subject: [PATCH 01/18] Remove reader improvements feature config --- WordPress/build.gradle | 1 - .../config/ReaderImprovementsFeatureConfig.kt | 16 ---------------- 2 files changed, 17 deletions(-) delete mode 100644 WordPress/src/main/java/org/wordpress/android/util/config/ReaderImprovementsFeatureConfig.kt diff --git a/WordPress/build.gradle b/WordPress/build.gradle index 0ad75722b44b..e97b150768cc 100644 --- a/WordPress/build.gradle +++ b/WordPress/build.gradle @@ -144,7 +144,6 @@ android { buildConfigField "boolean", "CONTACT_SUPPORT_CHATBOT", "false" buildConfigField "boolean", "ENABLE_DOMAIN_MANAGEMENT_FEATURE", "false" buildConfigField "boolean", "PLANS_IN_SITE_CREATION", "false" - buildConfigField "boolean", "READER_IMPROVEMENTS", "false" buildConfigField "boolean", "BLOGANUARY_DASHBOARD_NUDGE", "false" buildConfigField "boolean", "DYNAMIC_DASHBOARD_CARDS", "false" buildConfigField "boolean", "STATS_TRAFFIC_SUBSCRIBERS_TABS", "false" diff --git a/WordPress/src/main/java/org/wordpress/android/util/config/ReaderImprovementsFeatureConfig.kt b/WordPress/src/main/java/org/wordpress/android/util/config/ReaderImprovementsFeatureConfig.kt deleted file mode 100644 index f913ece9e614..000000000000 --- a/WordPress/src/main/java/org/wordpress/android/util/config/ReaderImprovementsFeatureConfig.kt +++ /dev/null @@ -1,16 +0,0 @@ -package org.wordpress.android.util.config - -import org.wordpress.android.BuildConfig -import org.wordpress.android.annotation.Feature -import javax.inject.Inject - -private const val READER_IMPROVEMENTS_REMOTE_FIELD = "reader_improvements" - -@Feature(remoteField = READER_IMPROVEMENTS_REMOTE_FIELD, defaultValue = true) -class ReaderImprovementsFeatureConfig @Inject constructor( - appConfig: AppConfig -) : FeatureConfig( - appConfig, - BuildConfig.READER_IMPROVEMENTS, - READER_IMPROVEMENTS_REMOTE_FIELD, -) From afe6bae8ef3ab85c10589a8e40cb1ef1b7a74442 Mon Sep 17 00:00:00 2001 From: Renan Lukas <14964993+RenanLukas@users.noreply.github.com> Date: Wed, 5 Jun 2024 20:06:13 -0300 Subject: [PATCH 02/18] Remove feature flag logic --- .../ui/reader/ReaderPostDetailFragment.kt | 24 +--- .../ui/reader/adapters/ReaderPostAdapter.java | 19 ++- .../reader/discover/ReaderDiscoverAdapter.kt | 38 ++---- .../reader/discover/ReaderDiscoverFragment.kt | 21 +--- .../discover/ReaderDiscoverViewModel.kt | 50 +++----- .../discover/ReaderPostUiStateBuilder.kt | 49 +------- .../ReaderInterestsCardViewHolder.kt | 82 ------------ .../ReaderRecommendedBlogsCardViewHolder.kt | 38 ------ .../tagsfeed/ReaderTagsFeedViewModel.kt | 2 +- .../reader/views/ReaderExpandableTagsView.kt | 30 +---- .../views/ReaderPostDetailHeaderView.kt | 58 +-------- ...aderPostDetailsHeaderViewUiStateBuilder.kt | 3 - .../ui/reader/views/ReaderTagHeaderView.kt | 18 +-- .../main/res/layout/reader_cardview_xpost.xml | 63 ---------- .../reader_include_post_detail_footer.xml | 86 ------------- .../main/res/layout/reader_interest_card.xml | 36 ------ .../layout/reader_post_detail_header_view.xml | 117 ------------------ .../layout/reader_recommended_blogs_card.xml | 40 ------ .../src/main/res/values-night/colors.xml | 1 - WordPress/src/main/res/values/colors.xml | 1 - WordPress/src/main/res/values/dimens.xml | 1 - .../discover/ReaderDiscoverViewModelTest.kt | 12 +- .../discover/ReaderPostUiStateBuilderTest.kt | 2 +- 23 files changed, 49 insertions(+), 742 deletions(-) delete mode 100644 WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderInterestsCardViewHolder.kt delete mode 100644 WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderRecommendedBlogsCardViewHolder.kt delete mode 100644 WordPress/src/main/res/layout/reader_cardview_xpost.xml delete mode 100644 WordPress/src/main/res/layout/reader_include_post_detail_footer.xml delete mode 100644 WordPress/src/main/res/layout/reader_interest_card.xml delete mode 100644 WordPress/src/main/res/layout/reader_post_detail_header_view.xml delete mode 100644 WordPress/src/main/res/layout/reader_recommended_blogs_card.xml diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostDetailFragment.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostDetailFragment.kt index 12898f1f38de..2add180af668 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostDetailFragment.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostDetailFragment.kt @@ -145,7 +145,6 @@ import org.wordpress.android.util.WPPermissionUtils.READER_FILE_DOWNLOAD_PERMISS import org.wordpress.android.util.WPSwipeToRefreshHelper.buildSwipeToRefreshHelper import org.wordpress.android.util.config.CommentsSnippetFeatureConfig import org.wordpress.android.util.config.LikesEnhancementsFeatureConfig -import org.wordpress.android.util.config.ReaderImprovementsFeatureConfig import org.wordpress.android.util.config.ReaderReadingPreferencesFeatureConfig import org.wordpress.android.util.extensions.getColorFromAttribute import org.wordpress.android.util.extensions.getParcelableCompat @@ -283,9 +282,6 @@ class ReaderPostDetailFragment : ViewPagerFragment(), @Inject lateinit var jetpackBrandingUtils: JetpackBrandingUtils - @Inject - lateinit var readerImprovementsFeatureConfig: ReaderImprovementsFeatureConfig - @Inject lateinit var readingPreferencesFeatureConfig: ReaderReadingPreferencesFeatureConfig @@ -484,31 +480,15 @@ class ReaderPostDetailFragment : ViewPagerFragment(), } private fun initLayoutFooter(view: View) { - val isReaderImprovementsEnabled = readerImprovementsFeatureConfig.isEnabled() view.findViewById(R.id.layout_post_detail_footer).apply { - layoutResource = if (isReaderImprovementsEnabled) { - R.layout.reader_include_post_detail_footer_new - } else { - R.layout.reader_include_post_detail_footer - } + layoutResource = R.layout.reader_include_post_detail_footer_new setOnInflateListener { _, inflated -> - layoutFooterBinding = if (isReaderImprovementsEnabled) { - ReaderIncludePostDetailFooterNewBinding.bind(inflated).mapBinding().apply { + layoutFooterBinding = ReaderIncludePostDetailFooterNewBinding.bind(inflated).mapBinding().apply { // the new bar should hide on scroll val params = root.layoutParams as CoordinatorLayout.LayoutParams params.behavior = HideBottomViewOnScrollBehavior() } - } else { - ReaderIncludePostDetailFooterBinding.bind(inflated).mapBinding().apply { - // the old bar should have the elevated surface color background - val elevationOverlayProvider = ElevationOverlayProvider(root.context) - val appbarElevation = resources.getDimension(R.dimen.appbar_elevation) - val elevatedSurfaceColor = elevationOverlayProvider - .compositeOverlayWithThemeSurfaceColorIfNeeded(appbarElevation) - root.setBackgroundColor(elevatedSurfaceColor) - } - } layoutFooterBinding.root.isInvisible = true } }.also { stub -> diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/adapters/ReaderPostAdapter.java b/WordPress/src/main/java/org/wordpress/android/ui/reader/adapters/ReaderPostAdapter.java index 54b22755cc1a..d4adb1f2b9b3 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/adapters/ReaderPostAdapter.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/adapters/ReaderPostAdapter.java @@ -67,7 +67,6 @@ import org.wordpress.android.util.NetworkUtilsWrapper; import org.wordpress.android.util.SiteUtils; import org.wordpress.android.util.ToastUtils; -import org.wordpress.android.util.config.ReaderImprovementsFeatureConfig; import org.wordpress.android.util.extensions.ContextExtensionsKt; import org.wordpress.android.util.image.BlavatarShape; import org.wordpress.android.util.image.ImageManager; @@ -135,7 +134,6 @@ public class ReaderPostAdapter extends RecyclerView.Adapter>() { private val items = mutableListOf() override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ReaderViewHolder<*> { @@ -47,24 +44,9 @@ class ReaderDiscoverAdapter( parent ) - INTEREST_VIEW_TYPE -> { - if (isReaderImprovementsEnabled) { - ReaderInterestsCardNewViewHolder(uiHelpers, parent) - } else { - ReaderInterestsCardViewHolder(uiHelpers, parent) - } - } + INTEREST_VIEW_TYPE -> ReaderInterestsCardNewViewHolder(uiHelpers, parent) - RECOMMENDED_BLOGS_VIEW_TYPE -> - if (isReaderImprovementsEnabled) { - ReaderRecommendedBlogsCardNewViewHolder( - parent, imageManager - ) - } else { - ReaderRecommendedBlogsCardViewHolder( - parent, imageManager, uiHelpers - ) - } + RECOMMENDED_BLOGS_VIEW_TYPE -> ReaderRecommendedBlogsCardNewViewHolder(parent, imageManager) READER_ANNOUNCEMENT_TYPE -> ReaderAnnouncementCardViewHolder(parent) @@ -75,15 +57,13 @@ class ReaderDiscoverAdapter( override fun getItemCount(): Int = items.size override fun onBindViewHolder(holder: ReaderViewHolder<*>, position: Int) { - if (isReaderImprovementsEnabled) { - // hide the item divider by setting the HideItemDivider object as view tag, which is used by the - // DividerItemDecorator to skip drawing the bottom divider for the item. It should be hidden for any - // recommendation cards and cards above them. - val nextPosition = position + 1 - val shouldHideDivider = isRecommendationCard(position) || - (nextPosition < itemCount && isRecommendationCard(nextPosition)) - holder.itemView.tag = HideItemDivider.takeIf { shouldHideDivider } - } + // hide the item divider by setting the HideItemDivider object as view tag, which is used by the + // DividerItemDecorator to skip drawing the bottom divider for the item. It should be hidden for any + // recommendation cards and cards above them. + val nextPosition = position + 1 + val shouldHideDivider = isRecommendationCard(position) || + (nextPosition < itemCount && isRecommendationCard(nextPosition)) + holder.itemView.tag = HideItemDivider.takeIf { shouldHideDivider } holder.onBind(items[position]) } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverFragment.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverFragment.kt index 6bc60f163672..56ad7adcfe3b 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverFragment.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverFragment.kt @@ -49,7 +49,6 @@ import org.wordpress.android.ui.utils.UiHelpers import org.wordpress.android.ui.utils.addItemDivider import org.wordpress.android.util.NetworkUtilsWrapper import org.wordpress.android.util.WPSwipeToRefreshHelper -import org.wordpress.android.util.config.ReaderImprovementsFeatureConfig import org.wordpress.android.util.image.ImageManager import org.wordpress.android.viewmodel.observeEvent import org.wordpress.android.widgets.RecyclerItemDecoration @@ -80,9 +79,6 @@ class ReaderDiscoverFragment : ViewPagerFragment(R.layout.reader_discover_fragme private lateinit var parentViewModel: ReaderViewModel - @Inject - lateinit var readerImprovementsFeatureConfig: ReaderImprovementsFeatureConfig - private var binding: ReaderDiscoverFragmentLayoutBinding? = null override fun onCreate(savedInstanceState: Bundle?) { @@ -100,31 +96,20 @@ class ReaderDiscoverFragment : ViewPagerFragment(R.layout.reader_discover_fragme imageManager, readerTracker, networkUtilsWrapper, - readerImprovementsFeatureConfig.isEnabled() ) // set the background color as we have different colors for the new and legacy designs that are not easy to // change via styles, because of the FeatureConfig logic - val backgroundColor = if (readerImprovementsFeatureConfig.isEnabled()) { - R.color.reader_post_list_background_new - } else { - R.color.reader_post_list_background - } + val backgroundColor = R.color.reader_post_list_background_new recyclerView.setBackgroundColor(ContextCompat.getColor(requireContext(), backgroundColor)) - val spacingVerticalRes = if (readerImprovementsFeatureConfig.isEnabled()) { - R.dimen.reader_card_gutters_new - } else { - R.dimen.reader_card_gutters - } + val spacingVerticalRes = R.dimen.reader_card_gutters_new val spacingHorizontal = resources.getDimensionPixelSize(R.dimen.reader_card_margin) val spacingVertical = resources.getDimensionPixelSize(spacingVerticalRes) recyclerView.addItemDecoration(RecyclerItemDecoration(spacingHorizontal, spacingVertical, false)) // add a proper item divider to the RecyclerView when Reader Improvements are enabled - if (readerImprovementsFeatureConfig.isEnabled()) { - recyclerView.addItemDivider(R.drawable.default_list_divider) - } + recyclerView.addItemDivider(R.drawable.default_list_divider) WPSwipeToRefreshHelper.buildSwipeToRefreshHelper(ptrLayout) { viewModel.swipeToRefresh() } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverViewModel.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverViewModel.kt index 7408e7f23735..467b84bb0f45 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverViewModel.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverViewModel.kt @@ -42,7 +42,6 @@ import org.wordpress.android.ui.reader.utils.ReaderUtilsWrapper import org.wordpress.android.ui.reader.viewmodels.ReaderViewModel import org.wordpress.android.ui.utils.UiString.UiStringRes import org.wordpress.android.util.DisplayUtilsWrapper -import org.wordpress.android.util.config.ReaderImprovementsFeatureConfig import org.wordpress.android.viewmodel.Event import org.wordpress.android.viewmodel.ScopedViewModel import javax.inject.Inject @@ -62,7 +61,6 @@ class ReaderDiscoverViewModel @Inject constructor( private val readerTracker: ReaderTracker, displayUtilsWrapper: DisplayUtilsWrapper, private val getFollowedTagsUseCase: GetFollowedTagsUseCase, - private val readerImprovementsFeatureConfig: ReaderImprovementsFeatureConfig, private val readerAnnouncementHelper: ReaderAnnouncementHelper, @Named(UI_THREAD) private val mainDispatcher: CoroutineDispatcher, @Named(IO_THREAD) private val ioDispatcher: CoroutineDispatcher @@ -236,40 +234,20 @@ class ReaderDiscoverViewModel @Inject constructor( private suspend fun convertCardsToUiStates(posts: ReaderDiscoverCards): List { return posts.cards.map { card -> when (card) { - is ReaderPostCard -> if (readerImprovementsFeatureConfig.isEnabled()) { - postUiStateBuilder.mapPostToNewUiState( - source = ReaderTracker.SOURCE_DISCOVER, - post = card.post, - photonWidth = photonWidth, - photonHeight = photonHeight, - postListType = TAG_FOLLOWED, - onButtonClicked = this@ReaderDiscoverViewModel::onButtonClicked, - onItemClicked = this@ReaderDiscoverViewModel::onPostItemClicked, - onItemRendered = this@ReaderDiscoverViewModel::onItemRendered, - onMoreButtonClicked = this@ReaderDiscoverViewModel::onMoreButtonClickedNew, - onMoreDismissed = this@ReaderDiscoverViewModel::onMoreMenuDismissedNew, - onVideoOverlayClicked = this@ReaderDiscoverViewModel::onVideoOverlayClicked, - onPostHeaderViewClicked = this@ReaderDiscoverViewModel::onPostHeaderClicked, - ) - } else { - postUiStateBuilder.mapPostToUiState( - source = ReaderTracker.SOURCE_DISCOVER, - post = card.post, - isDiscover = true, - photonWidth = photonWidth, - photonHeight = photonHeight, - onButtonClicked = this@ReaderDiscoverViewModel::onButtonClicked, - onItemClicked = this@ReaderDiscoverViewModel::onPostItemClicked, - onItemRendered = this@ReaderDiscoverViewModel::onItemRendered, - onDiscoverSectionClicked = this@ReaderDiscoverViewModel::onDiscoverClicked, - onMoreButtonClicked = this@ReaderDiscoverViewModel::onMoreButtonClicked, - onMoreDismissed = this@ReaderDiscoverViewModel::onMoreMenuDismissed, - onVideoOverlayClicked = this@ReaderDiscoverViewModel::onVideoOverlayClicked, - onPostHeaderViewClicked = { onPostHeaderClicked(card.post.postId, card.post.blogId) }, - onTagItemClicked = this@ReaderDiscoverViewModel::onTagItemClicked, - postListType = TAG_FOLLOWED - ) - } + is ReaderPostCard -> postUiStateBuilder.mapPostToUiState( + source = ReaderTracker.SOURCE_DISCOVER, + post = card.post, + photonWidth = photonWidth, + photonHeight = photonHeight, + postListType = TAG_FOLLOWED, + onButtonClicked = this@ReaderDiscoverViewModel::onButtonClicked, + onItemClicked = this@ReaderDiscoverViewModel::onPostItemClicked, + onItemRendered = this@ReaderDiscoverViewModel::onItemRendered, + onMoreButtonClicked = this@ReaderDiscoverViewModel::onMoreButtonClickedNew, + onMoreDismissed = this@ReaderDiscoverViewModel::onMoreMenuDismissedNew, + onVideoOverlayClicked = this@ReaderDiscoverViewModel::onVideoOverlayClicked, + onPostHeaderViewClicked = this@ReaderDiscoverViewModel::onPostHeaderClicked, + ) is InterestsYouMayLikeCard -> { postUiStateBuilder.mapTagListToReaderInterestUiState( card.interests, 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 d9dfc8b418ba..e0389ac5dc16 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 @@ -73,47 +73,6 @@ class ReaderPostUiStateBuilder @Inject constructor( private val readerPostTagsUiStateBuilder: ReaderPostTagsUiStateBuilder, @Named(BG_THREAD) private val bgDispatcher: CoroutineDispatcher ) { - @Suppress("LongParameterList") - suspend fun mapPostToUiState( - source: String, - post: ReaderPost, - isDiscover: Boolean = false, - photonWidth: Int, - photonHeight: Int, - postListType: ReaderPostListType, - onButtonClicked: (Long, Long, ReaderPostCardActionType) -> Unit, - onItemClicked: (Long, Long) -> Unit, - onItemRendered: (ReaderCardUiState) -> Unit, - onDiscoverSectionClicked: (Long, Long) -> Unit, - onMoreButtonClicked: (ReaderPostUiState) -> Unit, - onMoreDismissed: (ReaderPostUiState) -> Unit, - onVideoOverlayClicked: (Long, Long) -> Unit, - onPostHeaderViewClicked: () -> Unit, - onTagItemClicked: (String) -> Unit, - moreMenuItems: List? = null - ): ReaderPostUiState { - return withContext(bgDispatcher) { - mapPostToUiStateBlocking( - source, - post, - isDiscover, - photonWidth, - photonHeight, - postListType, - onButtonClicked, - onItemClicked, - onItemRendered, - onDiscoverSectionClicked, - onMoreButtonClicked, - onMoreDismissed, - onVideoOverlayClicked, - onPostHeaderViewClicked, - onTagItemClicked, - moreMenuItems - ) - } - } - @Suppress("LongParameterList") fun mapPostToUiStateBlocking( source: String, @@ -167,7 +126,7 @@ class ReaderPostUiStateBuilder @Inject constructor( } @Suppress("LongParameterList") - suspend fun mapPostToNewUiState( + suspend fun mapPostToUiState( source: String, post: ReaderPost, photonWidth: Int, @@ -248,10 +207,9 @@ class ReaderPostUiStateBuilder @Inject constructor( fun mapPostToBlogSectionUiState( post: ReaderPost, - isReaderImprovementsEnabled: Boolean, onBlogSectionClicked: () -> Unit ): ReaderBlogSectionUiState { - return buildBlogSection(post, onBlogSectionClicked, isReaderImprovementsEnabled = isReaderImprovementsEnabled) + return buildBlogSection(post, onBlogSectionClicked) } fun mapPostToActions( @@ -315,7 +273,6 @@ class ReaderPostUiStateBuilder @Inject constructor( onBlogSectionClicked: () -> Unit, postListType: ReaderPostListType? = null, isP2Post: Boolean = false, - isReaderImprovementsEnabled: Boolean = false, ): ReaderBlogSectionUiState { return ReaderBlogSectionUiState( postId = post.postId, @@ -324,7 +281,7 @@ class ReaderPostUiStateBuilder @Inject constructor( blogUrl = buildBlogUrl(post), dateLine = buildDateLine(post), avatarOrBlavatarUrl = buildAvatarOrBlavatarUrl(post), - isAuthorAvatarVisible = isP2Post || (isReaderImprovementsEnabled && post.hasBlogImageUrl()), + isAuthorAvatarVisible = isP2Post || post.hasBlogImageUrl(), blavatarType = SiteUtils.getSiteImageType(isP2Post, CIRCULAR), authorAvatarUrl = avatarUtilsWrapper.rewriteAvatarUrlWithResource( post.postAvatar, diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderInterestsCardViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderInterestsCardViewHolder.kt deleted file mode 100644 index a7af7f511a04..000000000000 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderInterestsCardViewHolder.kt +++ /dev/null @@ -1,82 +0,0 @@ -package org.wordpress.android.ui.reader.discover.viewholders - -import android.view.GestureDetector -import android.view.MotionEvent -import android.view.ViewGroup -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import androidx.recyclerview.widget.RecyclerView.OnItemTouchListener -import org.wordpress.android.databinding.ReaderInterestCardBinding -import org.wordpress.android.ui.reader.discover.ReaderCardUiState -import org.wordpress.android.ui.reader.discover.ReaderCardUiState.ReaderInterestsCardUiState -import org.wordpress.android.ui.reader.discover.ReaderInterestAdapter -import org.wordpress.android.ui.utils.UiHelpers -import org.wordpress.android.util.extensions.viewBinding - -private const val Y_BUFFER = 10 - -class ReaderInterestsCardViewHolder( - uiHelpers: UiHelpers, - parentView: ViewGroup -) : ReaderViewHolder(parentView.viewBinding(ReaderInterestCardBinding::inflate)) { - init { - with(binding.interestsList) { - if (adapter == null) { - layoutManager = LinearLayoutManager(context, RecyclerView.HORIZONTAL, false) - val readerInterestAdapter = ReaderInterestAdapter(uiHelpers) - adapter = readerInterestAdapter - } - } - } - - override fun onBind(uiState: ReaderCardUiState) = with(binding) { - uiState as ReaderInterestsCardUiState - setOnTouchItemListener() - (interestsList.adapter as ReaderInterestAdapter).update(uiState.interest) - } - - private fun setOnTouchItemListener() = with(binding) { - val gestureDetector = GestureDetector(interestsList.context, GestureListener()) - interestsList.addOnItemTouchListener(object : OnItemTouchListener { - override fun onInterceptTouchEvent(recyclerView: RecyclerView, e: MotionEvent): Boolean { - return gestureDetector.onTouchEvent(e) - } - - override fun onTouchEvent(recyclerView: RecyclerView, e: MotionEvent) { - // NO OP - } - - override fun onRequestDisallowInterceptTouchEvent(disallowIntercept: Boolean) { - // NO OP - } - }) - } - - private inner class GestureListener : GestureDetector.SimpleOnGestureListener() { - /** - * Capture the DOWN as soon as it's detected to prevent the viewPager from intercepting touch events - * We need to do this immediately, because if we don't, then the next move event could potentially - * trigger the viewPager to switch tabs - */ - override fun onDown(e: MotionEvent): Boolean = with(binding) { - interestsList.parent.requestDisallowInterceptTouchEvent(true) - return super.onDown(e) - } - - override fun onScroll( - e1: MotionEvent?, - e2: MotionEvent, - distanceX: Float, - distanceY: Float - ): Boolean = with(binding) { - if (kotlin.math.abs(distanceX) > kotlin.math.abs(distanceY)) { - // Detected a horizontal scroll, prevent the viewpager from switching tabs - interestsList.parent.requestDisallowInterceptTouchEvent(true) - } else if (kotlin.math.abs(distanceY) > Y_BUFFER) { - // Detected a vertical scroll allow the viewpager to switch tabs - interestsList.parent.requestDisallowInterceptTouchEvent(false) - } - return super.onScroll(e1, e2, distanceX, distanceY) - } - } -} diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderRecommendedBlogsCardViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderRecommendedBlogsCardViewHolder.kt deleted file mode 100644 index 1823d0c29913..000000000000 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderRecommendedBlogsCardViewHolder.kt +++ /dev/null @@ -1,38 +0,0 @@ -package org.wordpress.android.ui.reader.discover.viewholders - -import android.view.ViewGroup -import org.wordpress.android.R -import org.wordpress.android.databinding.ReaderRecommendedBlogsCardBinding -import org.wordpress.android.ui.reader.discover.ReaderCardUiState -import org.wordpress.android.ui.reader.discover.ReaderCardUiState.ReaderRecommendedBlogsCardUiState -import org.wordpress.android.ui.reader.discover.ReaderRecommendedBlogsAdapter -import org.wordpress.android.ui.utils.UiHelpers -import org.wordpress.android.ui.utils.addItemDivider -import org.wordpress.android.util.AppLog -import org.wordpress.android.util.extensions.viewBinding -import org.wordpress.android.util.image.ImageManager - -class ReaderRecommendedBlogsCardViewHolder( - parentView: ViewGroup, - imageManager: ImageManager, - uiHelpers: UiHelpers, -) : ReaderViewHolder( - parentView.viewBinding(ReaderRecommendedBlogsCardBinding::inflate) -) { - private val recommendedBlogsAdapter = - ReaderRecommendedBlogsAdapter(imageManager, uiHelpers) - - init { - with(binding) { - recommendedBlogs.adapter = recommendedBlogsAdapter - parentView.context.getDrawable(R.drawable.default_list_divider)?.let { - recommendedBlogs.addItemDivider(it) - } ?: AppLog.w(AppLog.T.READER, "Discover list divider null") - } - } - - override fun onBind(uiState: ReaderCardUiState) { - uiState as ReaderRecommendedBlogsCardUiState - recommendedBlogsAdapter.submitList(uiState.blogs) - } -} diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/viewmodels/tagsfeed/ReaderTagsFeedViewModel.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/viewmodels/tagsfeed/ReaderTagsFeedViewModel.kt index 149db5634938..2daa867d0a95 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/viewmodels/tagsfeed/ReaderTagsFeedViewModel.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/viewmodels/tagsfeed/ReaderTagsFeedViewModel.kt @@ -511,7 +511,7 @@ class ReaderTagsFeedViewModel @Inject constructor( val photonHeight = (photonWidth * FEATURED_IMAGE_HEIGHT_WIDTH_RATION).toInt() _openMoreMenuEvents.postValue( MoreMenuUiState( - readerCardUiState = readerPostUiStateBuilder.mapPostToNewUiState( + readerCardUiState = readerPostUiStateBuilder.mapPostToUiState( source = ReaderTracker.SOURCE_TAGS_FEED, post = post, photonWidth = photonWidth, diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderExpandableTagsView.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderExpandableTagsView.kt index f1631c825cc9..5d979ea3d51f 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderExpandableTagsView.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderExpandableTagsView.kt @@ -19,7 +19,6 @@ import org.wordpress.android.ui.reader.models.ReaderReadingPreferences import org.wordpress.android.ui.reader.tracker.ReaderTracker import org.wordpress.android.ui.reader.utils.toTypeface import org.wordpress.android.ui.utils.UiHelpers -import org.wordpress.android.util.config.ReaderImprovementsFeatureConfig import javax.inject.Inject import android.R as AndroidR @@ -34,9 +33,6 @@ class ReaderExpandableTagsView @JvmOverloads constructor( @Inject lateinit var readerTracker: ReaderTracker - @Inject - lateinit var readerImprovementsFeatureConfig: ReaderImprovementsFeatureConfig - private var tagsUiState: List? = null private val tagChips @@ -58,7 +54,7 @@ class ReaderExpandableTagsView @JvmOverloads constructor( get() = !isChipWithinBounds(overflowIndicatorChip) private val chipStyle - get() = if (readerImprovementsFeatureConfig.isEnabled()) ChipStyle.New else ChipStyle.Legacy + get() = ChipStyle.Default init { (context.applicationContext as WordPress).component().inject(this) @@ -200,29 +196,7 @@ class ReaderExpandableTagsView @JvmOverloads constructor( @ColorRes fun overflowStrokeColorRes(isCollapsed: Boolean): Int? = null - object Legacy : ChipStyle { - override val chipLayoutRes: Int - get() = R.layout.reader_expandable_tags_view_chip - override val overflowChipLayoutRes: Int - get() = R.layout.reader_expandable_tags_view_overflow_chip - - override fun overflowChipText(resources: Resources, hiddenChipsCount: Int): String { - return String.format( - resources.getString(R.string.reader_expandable_tags_view_overflow_indicator_expand_title), - hiddenChipsCount - ) - } - - override fun overflowBackgroundColorRes(isCollapsed: Boolean): Int { - return if (isCollapsed) { - R.color.on_surface_chip - } else { - AndroidR.color.transparent - } - } - } - - object New : ChipStyle { + object Default : ChipStyle { override val chipLayoutRes: Int get() = R.layout.reader_expandable_tags_view_chip_new override val overflowChipLayoutRes: Int 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 40de09630823..145ac1763852 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 @@ -11,7 +11,6 @@ import androidx.core.view.isVisible import com.google.android.material.textview.MaterialTextView import org.wordpress.android.R import org.wordpress.android.WordPress -import org.wordpress.android.databinding.ReaderPostDetailHeaderViewBinding import org.wordpress.android.databinding.ReaderPostDetailHeaderViewNewBinding import org.wordpress.android.ui.reader.models.ReaderReadingPreferences import org.wordpress.android.ui.reader.utils.ReaderUtils @@ -22,7 +21,6 @@ import org.wordpress.android.ui.reader.views.uistates.ReaderBlogSectionUiState import org.wordpress.android.ui.reader.views.uistates.ReaderPostDetailsHeaderViewUiState.ReaderPostDetailsHeaderUiState import org.wordpress.android.ui.utils.UiHelpers import org.wordpress.android.ui.utils.UiString -import org.wordpress.android.util.config.ReaderImprovementsFeatureConfig import org.wordpress.android.util.extensions.getDrawableResIdFromAttribute import org.wordpress.android.util.extensions.setVisible import org.wordpress.android.util.image.ImageManager @@ -45,24 +43,11 @@ class ReaderPostDetailHeaderView @JvmOverloads constructor( @Inject lateinit var uiHelpers: UiHelpers - @Inject - lateinit var readerImprovementsFeatureConfig: ReaderImprovementsFeatureConfig - init { (context.applicationContext as WordPress).component().inject(this) - binding = if (readerImprovementsFeatureConfig.isEnabled()) { - val viewBinding = ReaderPostDetailHeaderViewNewBinding.inflate(LayoutInflater.from(context), this, true) - ReaderPostDetailHeaderBinding.ImprovementsEnabled( - viewBinding, - uiHelpers - ) - } else { - val viewBinding = ReaderPostDetailHeaderViewBinding.inflate(LayoutInflater.from(context), this, true) - ReaderPostDetailHeaderBinding.ImprovementsDisabled( - viewBinding, - uiHelpers - ) - } + binding = ReaderPostDetailHeaderBinding.ImprovementsEnabled( + ReaderPostDetailHeaderViewNewBinding.inflate(LayoutInflater.from(context), this, true), uiHelpers + ) } fun updatePost( @@ -153,43 +138,6 @@ class ReaderPostDetailHeaderView @JvmOverloads constructor( fun updateInteractionSection(state: InteractionSectionUiState, readingPreferences: ReaderReadingPreferences?) - class ImprovementsDisabled( - private val binding: ReaderPostDetailHeaderViewBinding, - private val uiHelpers: UiHelpers, - ) : ReaderPostDetailHeaderBinding { - override val titleText: MaterialTextView - get() = binding.textTitle - override val blogNameText: MaterialTextView - get() = binding.layoutBlogSection.textAuthorAndBlogName - override val blogUrlText: MaterialTextView - get() = binding.layoutBlogSection.textBlogUrl - override val expandableTagsView: ReaderExpandableTagsView - get() = binding.expandableTagsView - override val blogAvatarImage: ImageView - get() = binding.layoutBlogSection.imageAvatarOrBlavatar - override val authorAvatarImage: ImageView - get() = binding.layoutBlogSection.authorsAvatar - override val followButton: ReaderFollowButton - get() = binding.headerFollowButton - override val blogSectionRoot: ViewGroup - get() = binding.layoutBlogSection.root - - override fun setAuthorAndDate(authorName: String?, dateLine: String) = with(binding) { - uiHelpers.setTextOrHide(textAuthor, authorName) - uiHelpers.setTextOrHide(postDetailTextDateline, dateLine) - - textBy.setVisible(authorName != null) - postDetailDotSeparator.setVisible(authorName != null) - } - - override fun updateInteractionSection( - state: InteractionSectionUiState, - readingPreferences: ReaderReadingPreferences? - ) { - // do nothing - } - } - class ImprovementsEnabled( private val binding: ReaderPostDetailHeaderViewNewBinding, private val uiHelpers: UiHelpers, diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderPostDetailsHeaderViewUiStateBuilder.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderPostDetailsHeaderViewUiStateBuilder.kt index 6639bb584946..9aaf7fbdb514 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderPostDetailsHeaderViewUiStateBuilder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderPostDetailsHeaderViewUiStateBuilder.kt @@ -14,7 +14,6 @@ import org.wordpress.android.ui.reader.views.uistates.ReaderPostDetailsHeaderVie import org.wordpress.android.ui.utils.UiString.UiStringRes import org.wordpress.android.ui.utils.UiString.UiStringText import org.wordpress.android.util.DateTimeUtilsWrapper -import org.wordpress.android.util.config.ReaderImprovementsFeatureConfig import javax.inject.Inject @Reusable @@ -23,7 +22,6 @@ class ReaderPostDetailsHeaderViewUiStateBuilder @Inject constructor( private val postUiStateBuilder: ReaderPostUiStateBuilder, private val readerPostTagsUiStateBuilder: ReaderPostTagsUiStateBuilder, private val dateTimeUtilsWrapper: DateTimeUtilsWrapper, - private val readerImprovementsFeatureConfig: ReaderImprovementsFeatureConfig, ) { fun mapPostToUiState( post: ReaderPost, @@ -33,7 +31,6 @@ class ReaderPostDetailsHeaderViewUiStateBuilder @Inject constructor( val textTitle = post .takeIf { post.hasTitle() } ?.title?.let { UiStringText(it) } - ?: UiStringRes(R.string.reader_untitled_post).takeIf { !readerImprovementsFeatureConfig.isEnabled() } return ReaderPostDetailsHeaderUiState( title = textTitle, diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderTagHeaderView.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderTagHeaderView.kt index 9955cec53611..ddc222df6ed2 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderTagHeaderView.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderTagHeaderView.kt @@ -12,7 +12,6 @@ import org.wordpress.android.databinding.ReaderTagHeaderViewNewBinding import org.wordpress.android.ui.reader.views.ReaderTagHeaderViewUiState.ReaderTagHeaderUiState import org.wordpress.android.ui.utils.UiHelpers import org.wordpress.android.util.LocaleProvider -import org.wordpress.android.util.config.ReaderImprovementsFeatureConfig import javax.inject.Inject /** @@ -28,9 +27,6 @@ class ReaderTagHeaderView @JvmOverloads constructor( @Inject lateinit var uiHelpers: UiHelpers - @Inject - lateinit var readerImprovementsFeatureConfig: ReaderImprovementsFeatureConfig - @Inject lateinit var localeProvider: LocaleProvider @@ -38,22 +34,14 @@ class ReaderTagHeaderView @JvmOverloads constructor( init { (context.applicationContext as WordPress).component().inject(this) - binding = if (readerImprovementsFeatureConfig.isEnabled()) { - val readerTagHeaderViewNewBinding = - ReaderTagHeaderViewNewBinding.inflate(LayoutInflater.from(context), this, true) + val readerTagHeaderViewNewBinding = + ReaderTagHeaderViewNewBinding.inflate(LayoutInflater.from(context), this, true) + binding = ReaderTagBinding.ImprovementsEnabled( textTag = readerTagHeaderViewNewBinding.textTag, followButton = readerTagHeaderViewNewBinding.followContainer.followButton, textTagFollowCount = readerTagHeaderViewNewBinding.followContainer.textBlogFollowCount, ) - } else { - val readerTagHeaderViewBinding = - ReaderTagHeaderViewBinding.inflate(LayoutInflater.from(context), this, true) - ReaderTagBinding.ImprovementsDisabled( - textTag = readerTagHeaderViewBinding.textTag, - followButton = readerTagHeaderViewBinding.followButton, - ) - } binding.followButton.setOnClickListener { onFollowBtnClicked?.invoke() } } diff --git a/WordPress/src/main/res/layout/reader_cardview_xpost.xml b/WordPress/src/main/res/layout/reader_cardview_xpost.xml deleted file mode 100644 index 98e73bf8f94a..000000000000 --- a/WordPress/src/main/res/layout/reader_cardview_xpost.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/WordPress/src/main/res/layout/reader_include_post_detail_footer.xml b/WordPress/src/main/res/layout/reader_include_post_detail_footer.xml deleted file mode 100644 index 721e0f2d79cd..000000000000 --- a/WordPress/src/main/res/layout/reader_include_post_detail_footer.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/WordPress/src/main/res/layout/reader_interest_card.xml b/WordPress/src/main/res/layout/reader_interest_card.xml deleted file mode 100644 index 3714b62b67a6..000000000000 --- a/WordPress/src/main/res/layout/reader_interest_card.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - diff --git a/WordPress/src/main/res/layout/reader_post_detail_header_view.xml b/WordPress/src/main/res/layout/reader_post_detail_header_view.xml deleted file mode 100644 index 90319c8161b8..000000000000 --- a/WordPress/src/main/res/layout/reader_post_detail_header_view.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/WordPress/src/main/res/layout/reader_recommended_blogs_card.xml b/WordPress/src/main/res/layout/reader_recommended_blogs_card.xml deleted file mode 100644 index 0f73ecde117f..000000000000 --- a/WordPress/src/main/res/layout/reader_recommended_blogs_card.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - diff --git a/WordPress/src/main/res/values-night/colors.xml b/WordPress/src/main/res/values-night/colors.xml index 0c22d35eff0f..aff0f28ee677 100644 --- a/WordPress/src/main/res/values-night/colors.xml +++ b/WordPress/src/main/res/values-night/colors.xml @@ -44,7 +44,6 @@ @color/transparent - @color/background_dark @color/background_dark @color/background_dark @color/white diff --git a/WordPress/src/main/res/values/colors.xml b/WordPress/src/main/res/values/colors.xml index 724347897179..4c3648a441cd 100644 --- a/WordPress/src/main/res/values/colors.xml +++ b/WordPress/src/main/res/values/colors.xml @@ -61,7 +61,6 @@ @color/background_default - @color/neutral_0 @color/white diff --git a/WordPress/src/main/res/values/dimens.xml b/WordPress/src/main/res/values/dimens.xml index 921a63906006..a5200bbac5c1 100644 --- a/WordPress/src/main/res/values/dimens.xml +++ b/WordPress/src/main/res/values/dimens.xml @@ -130,7 +130,6 @@ 12dp 18dp - 6dp 0dp 0dp 0dp diff --git a/WordPress/src/test/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverViewModelTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverViewModelTest.kt index 06995bd7a6b1..c1b6ad0192d4 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverViewModelTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverViewModelTest.kt @@ -71,7 +71,6 @@ import org.wordpress.android.ui.reader.views.uistates.ReaderBlogSectionUiState import org.wordpress.android.ui.reader.views.uistates.ReaderBlogSectionUiState.ReaderBlogSectionClickData import org.wordpress.android.ui.utils.UiString.UiStringRes import org.wordpress.android.util.DisplayUtilsWrapper -import org.wordpress.android.util.config.ReaderImprovementsFeatureConfig import org.wordpress.android.util.image.ImageType.BLAVATAR_CIRCULAR import org.wordpress.android.viewmodel.Event import org.wordpress.android.viewmodel.ReactiveMutableLiveData @@ -135,9 +134,6 @@ class ReaderDiscoverViewModelTest : BaseUnitTest() { @Mock private lateinit var parentViewModel: ReaderViewModel - @Mock - private lateinit var readerImprovementsFeatureConfig: ReaderImprovementsFeatureConfig - @Mock private lateinit var mReaderAnnouncementHelper: ReaderAnnouncementHelper @@ -163,7 +159,6 @@ class ReaderDiscoverViewModelTest : BaseUnitTest() { readerTracker, displayUtilsWrapper, getFollowedTagsUseCase, - readerImprovementsFeatureConfig, mReaderAnnouncementHelper, testDispatcher(), testDispatcher() @@ -179,19 +174,16 @@ class ReaderDiscoverViewModelTest : BaseUnitTest() { uiStateBuilder.mapPostToUiState( source = anyString(), post = anyOrNull(), - isDiscover = anyBoolean(), photonWidth = anyInt(), photonHeight = anyInt(), postListType = anyOrNull(), onButtonClicked = anyOrNull(), onItemClicked = anyOrNull(), onItemRendered = anyOrNull(), - onDiscoverSectionClicked = anyOrNull(), onMoreButtonClicked = anyOrNull(), onMoreDismissed = anyOrNull(), onVideoOverlayClicked = anyOrNull(), onPostHeaderViewClicked = anyOrNull(), - onTagItemClicked = anyOrNull(), moreMenuItems = anyOrNull() ) ).thenAnswer { @@ -209,7 +201,7 @@ class ReaderDiscoverViewModelTest : BaseUnitTest() { } whenever( - uiStateBuilder.mapPostToNewUiState( + uiStateBuilder.mapPostToUiState( source = anyString(), post = anyOrNull(), photonWidth = anyInt(), @@ -261,7 +253,6 @@ class ReaderDiscoverViewModelTest : BaseUnitTest() { whenever(reblogUseCase.onReblogSiteSelected(anyInt(), anyOrNull())).thenReturn(mock()) whenever(reblogUseCase.convertReblogStateToNavigationEvent(anyOrNull())).thenReturn(mock()) whenever(getFollowedTagsUseCase.get()).thenReturn(ReaderTagList().apply { add(mock()) }) - whenever(readerImprovementsFeatureConfig.isEnabled()).thenReturn(false) } @Test @@ -396,7 +387,6 @@ class ReaderDiscoverViewModelTest : BaseUnitTest() { @Test fun `if ReaderPostCard exist then ReaderPostNewUiState will be present in the ContentUIState`() = test { // Arrange - whenever(readerImprovementsFeatureConfig.isEnabled()).thenReturn(true) val uiStates = init(autoUpdateFeed = false).uiStates // Act fakeDiscoverFeed.value = ReaderDiscoverCards(createDummyReaderPostCardList()) diff --git a/WordPress/src/test/java/org/wordpress/android/ui/reader/discover/ReaderPostUiStateBuilderTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/reader/discover/ReaderPostUiStateBuilderTest.kt index 34d170375c98..6f192ff4733d 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/reader/discover/ReaderPostUiStateBuilderTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/reader/discover/ReaderPostUiStateBuilderTest.kt @@ -1305,7 +1305,7 @@ class ReaderPostUiStateBuilderTest : BaseUnitTest() { postListType: ReaderPostListType = TAG_FOLLOWED, onButtonClicked: (Long, Long, ReaderPostCardActionType) -> Unit = mock() ): ReaderPostNewUiState { - return builder.mapPostToNewUiState( + return builder.mapPostToUiState( source = "source", post = post, photonWidth = 0, From 28e0af042c5ae0b48e79c01cfd9bed8ba975ccfc Mon Sep 17 00:00:00 2001 From: Renan Lukas <14964993+RenanLukas@users.noreply.github.com> Date: Thu, 6 Jun 2024 13:22:33 -0300 Subject: [PATCH 03/18] Remove unused UI --- .../ui/reader/ReaderPostDetailFragment.kt | 10 --- .../ui/reader/ReaderPostListFragment.java | 21 ++--- .../reader/discover/ReaderDiscoverFragment.kt | 4 +- .../reader/views/ReaderExpandableTagsView.kt | 2 +- ...aderPostDetailsHeaderViewUiStateBuilder.kt | 1 - .../ui/reader/views/ReaderSiteHeaderView.java | 69 ++++++-------- .../res/layout/reader_site_header_view.xml | 89 ------------------- .../src/main/res/values-night/colors.xml | 2 +- WordPress/src/main/res/values/colors.xml | 2 +- WordPress/src/main/res/values/dimens.xml | 2 +- 10 files changed, 37 insertions(+), 165 deletions(-) delete mode 100644 WordPress/src/main/res/layout/reader_site_header_view.xml diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostDetailFragment.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostDetailFragment.kt index 2add180af668..4b05209f8384 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostDetailFragment.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostDetailFragment.kt @@ -63,7 +63,6 @@ import org.wordpress.android.R import org.wordpress.android.WordPress import org.wordpress.android.analytics.AnalyticsTracker import org.wordpress.android.databinding.ReaderFragmentPostDetailBinding -import org.wordpress.android.databinding.ReaderIncludePostDetailFooterBinding import org.wordpress.android.databinding.ReaderIncludePostDetailFooterNewBinding import org.wordpress.android.datasets.ReaderPostTable import org.wordpress.android.fluxc.Dispatcher @@ -1870,15 +1869,6 @@ class ReaderPostDetailFragment : ViewPagerFragment(), val like: View, ) - private fun ReaderIncludePostDetailFooterBinding.mapBinding(): PostDetailFooterBarBinding = - PostDetailFooterBarBinding( - root, - bookmark, - reblog, - countComments, - countLikes, - ) - private fun ReaderIncludePostDetailFooterNewBinding.mapBinding(): PostDetailFooterBarBinding = PostDetailFooterBarBinding( root, diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostListFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostListFragment.java index d62a859bfdeb..6b053418bf0e 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostListFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostListFragment.java @@ -137,7 +137,6 @@ import org.wordpress.android.util.StringUtils; import org.wordpress.android.util.ToastUtils; import org.wordpress.android.util.WPActivityUtils; -import org.wordpress.android.util.config.ReaderImprovementsFeatureConfig; import org.wordpress.android.util.config.SeenUnseenWithCounterFeatureConfig; import org.wordpress.android.util.image.ImageManager; import org.wordpress.android.widgets.AppReviewManager; @@ -185,7 +184,6 @@ public class ReaderPostListFragment extends ViewPagerFragment @Inject ReaderTracker mReaderTracker; @Inject SnackbarSequencer mSnackbarSequencer; @Inject DisplayUtilsWrapper mDisplayUtilsWrapper; - @Inject ReaderImprovementsFeatureConfig mReaderImprovementsFeatureConfig; private ReaderPostAdapter mPostAdapter; private ReaderSiteSearchAdapter mSiteSearchAdapter; private ReaderSearchSuggestionAdapter mSearchSuggestionAdapter; @@ -1066,27 +1064,20 @@ public void onShowCustomEmptyView(EmptyViewMessageType emptyViewMsgType) { } }); - // set the background color as we have different colors for the new and legacy designs that are not easy to - // change via styles, because of the FeatureConfig logic - int backgroundColor = mReaderImprovementsFeatureConfig.isEnabled() - ? R.color.reader_post_list_background_new - : R.color.reader_post_list_background; - mRecyclerView.setBackgroundColor(ContextCompat.getColor(requireContext(), backgroundColor)); + mRecyclerView.setBackgroundColor(ContextCompat.getColor( + requireContext(), R.color.reader_post_list_background) + ); // add the item decoration (dividers) to the recycler, skipping the first item if the first // item is the tag toolbar (shown when viewing posts in followed tags) - this is to avoid // having the tag toolbar take up more vertical space than necessary - int spacingVerticalRes = mReaderImprovementsFeatureConfig.isEnabled() - ? R.dimen.reader_card_gutters_new - : R.dimen.reader_card_gutters; + int spacingVerticalRes = R.dimen.reader_card_gutters; int spacingHorizontal = getResources().getDimensionPixelSize(R.dimen.reader_card_margin); int spacingVertical = getResources().getDimensionPixelSize(spacingVerticalRes); mRecyclerView.addItemDecoration(new RecyclerItemDecoration(spacingHorizontal, spacingVertical, false)); - // add a proper item divider to the RecyclerView when Reader Improvements are enabled - if (mReaderImprovementsFeatureConfig.isEnabled()) { - mRecyclerView.addItemDivider(R.drawable.default_list_divider); - } + // add a proper item divider to the RecyclerView + mRecyclerView.addItemDivider(R.drawable.default_list_divider); mRecyclerView.setToolbarBackgroundColor(0); mRecyclerView.setToolbarSpinnerDrawable(R.drawable.ic_dropdown_primary_30_24dp); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverFragment.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverFragment.kt index 56ad7adcfe3b..cb2d69a87876 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverFragment.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverFragment.kt @@ -100,10 +100,10 @@ class ReaderDiscoverFragment : ViewPagerFragment(R.layout.reader_discover_fragme // set the background color as we have different colors for the new and legacy designs that are not easy to // change via styles, because of the FeatureConfig logic - val backgroundColor = R.color.reader_post_list_background_new + val backgroundColor = R.color.reader_post_list_background recyclerView.setBackgroundColor(ContextCompat.getColor(requireContext(), backgroundColor)) - val spacingVerticalRes = R.dimen.reader_card_gutters_new + val spacingVerticalRes = R.dimen.reader_card_gutters val spacingHorizontal = resources.getDimensionPixelSize(R.dimen.reader_card_margin) val spacingVertical = resources.getDimensionPixelSize(spacingVerticalRes) recyclerView.addItemDecoration(RecyclerItemDecoration(spacingHorizontal, spacingVertical, false)) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderExpandableTagsView.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderExpandableTagsView.kt index 5d979ea3d51f..8278d140eb54 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderExpandableTagsView.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderExpandableTagsView.kt @@ -167,7 +167,7 @@ class ReaderExpandableTagsView @JvmOverloads constructor( chipStyle.overflowBackgroundColorRes(isSingleLine)?.let { chipBackgroundColorRes -> overflowIndicatorChip.setChipBackgroundColorResource(chipBackgroundColorRes) } - chipStyle.overflowStrokeColorRes(isSingleLine)?.let { chipStrokeColorRes -> + chipStyle.overflowStrokeColorRes(isSingleLine).let { chipStrokeColorRes -> overflowIndicatorChip.setChipStrokeColorResource(chipStrokeColorRes) } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderPostDetailsHeaderViewUiStateBuilder.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderPostDetailsHeaderViewUiStateBuilder.kt index 9aaf7fbdb514..12f889e73b18 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderPostDetailsHeaderViewUiStateBuilder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderPostDetailsHeaderViewUiStateBuilder.kt @@ -64,7 +64,6 @@ class ReaderPostDetailsHeaderViewUiStateBuilder @Inject constructor( ): ReaderBlogSectionUiState { return postUiStateBuilder.mapPostToBlogSectionUiState( post, - readerImprovementsFeatureConfig.isEnabled(), onBlogSectionClicked ) } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderSiteHeaderView.java b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderSiteHeaderView.java index 7516e164beae..1535fbcfc696 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderSiteHeaderView.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderSiteHeaderView.java @@ -29,7 +29,6 @@ import org.wordpress.android.util.SiteUtils; import org.wordpress.android.util.ToastUtils; import org.wordpress.android.util.UrlUtils; -import org.wordpress.android.util.config.ReaderImprovementsFeatureConfig; import org.wordpress.android.util.image.BlavatarShape; import org.wordpress.android.util.image.ImageManager; @@ -62,11 +61,10 @@ public interface OnBlogInfoLoadedListener { private final ExecutorService mExecutorService = Executors.newSingleThreadExecutor(); private final Handler mMainHandler = new Handler(Looper.getMainLooper()); - + @Inject AccountStore mAccountStore; @Inject ImageManager mImageManager; @Inject ReaderTracker mReaderTracker; - @Inject ReaderImprovementsFeatureConfig mReaderImprovementsFeatureConfig; public ReaderSiteHeaderView(Context context) { this(context, null); @@ -84,13 +82,7 @@ public ReaderSiteHeaderView(Context context, AttributeSet attrs, int defStyleAtt } private void initView(Context context) { - final int layoutRes; - if (mReaderImprovementsFeatureConfig.isEnabled()) { - layoutRes = R.layout.reader_site_header_view_new; - } else { - layoutRes = R.layout.reader_site_header_view; - } - final View view = inflate(context, layoutRes, this); + final View view = inflate(context, R.layout.reader_site_header_view_new, this); mFollowButton = view.findViewById(R.id.follow_button); view.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); } @@ -188,15 +180,11 @@ private void showBlogInfo(ReaderBlog blogInfo, String source) { txtDescription.setVisibility(View.GONE); } - if (mReaderImprovementsFeatureConfig.isEnabled()) { - final String imageUrl = blogInfo.getImageUrl(); - if (imageUrl != null && !imageUrl.isEmpty()) { - showBlavatarImage(blogInfo, blavatarImg); - } else { - blavatarImg.setVisibility(View.GONE); - } - } else { + final String imageUrl = blogInfo.getImageUrl(); + if (imageUrl != null && !imageUrl.isEmpty()) { showBlavatarImage(blogInfo, blavatarImg); + } else { + blavatarImg.setVisibility(View.GONE); } loadFollowCount(blogInfo, txtFollowCount); @@ -224,35 +212,28 @@ public void onClick(View v) { } private void loadFollowCount(ReaderBlog blogInfo, TextView txtFollowCount) { - if (mReaderImprovementsFeatureConfig.isEnabled()) { - final CompactDecimalFormat compactDecimalFormat = - CompactDecimalFormat.getInstance(LocaleManager.getSafeLocale(getContext()), - CompactDecimalFormat.CompactStyle.SHORT); - - final int followersStringRes; - if (blogInfo.numSubscribers == 1) { - followersStringRes = R.string.reader_label_subscribers_count_single; - } else { - followersStringRes = R.string.reader_label_subscribers_count; - } + final CompactDecimalFormat compactDecimalFormat = + CompactDecimalFormat.getInstance(LocaleManager.getSafeLocale(getContext()), + CompactDecimalFormat.CompactStyle.SHORT); - final String formattedNumberSubscribers; - // Reference: pcdRpT-3BI-p2#comment-5978 - if (blogInfo.numSubscribers >= MINIMUM_NUMBER_FOLLOWERS_FORMAT) { - formattedNumberSubscribers = compactDecimalFormat.format(blogInfo.numSubscribers); - } else { - formattedNumberSubscribers = NumberFormat.getInstance().format(blogInfo.numSubscribers); - } - txtFollowCount.setText(String.format( - LocaleManager.getSafeLocale(getContext()), - getContext().getString(followersStringRes), formattedNumberSubscribers) - ); + final int followersStringRes; + if (blogInfo.numSubscribers == 1) { + followersStringRes = R.string.reader_label_subscribers_count_single; + } else { + followersStringRes = R.string.reader_label_subscribers_count; + } + + final String formattedNumberSubscribers; + // Reference: pcdRpT-3BI-p2#comment-5978 + if (blogInfo.numSubscribers >= MINIMUM_NUMBER_FOLLOWERS_FORMAT) { + formattedNumberSubscribers = compactDecimalFormat.format(blogInfo.numSubscribers); } else { - txtFollowCount.setText(String.format( - LocaleManager.getSafeLocale(getContext()), - getContext().getString(R.string.reader_label_subscribe_count), - blogInfo.numSubscribers)); + formattedNumberSubscribers = NumberFormat.getInstance().format(blogInfo.numSubscribers); } + txtFollowCount.setText(String.format( + LocaleManager.getSafeLocale(getContext()), + getContext().getString(followersStringRes), formattedNumberSubscribers) + ); } private void showBlavatarImage(ReaderBlog blogInfo, ImageView blavatarImg) { diff --git a/WordPress/src/main/res/layout/reader_site_header_view.xml b/WordPress/src/main/res/layout/reader_site_header_view.xml deleted file mode 100644 index c9e2b2afb772..000000000000 --- a/WordPress/src/main/res/layout/reader_site_header_view.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/WordPress/src/main/res/values-night/colors.xml b/WordPress/src/main/res/values-night/colors.xml index aff0f28ee677..f338b5879b70 100644 --- a/WordPress/src/main/res/values-night/colors.xml +++ b/WordPress/src/main/res/values-night/colors.xml @@ -44,7 +44,7 @@ @color/transparent - @color/background_dark + @color/background_dark @color/background_dark @color/white diff --git a/WordPress/src/main/res/values/colors.xml b/WordPress/src/main/res/values/colors.xml index 4c3648a441cd..9495d5e7b512 100644 --- a/WordPress/src/main/res/values/colors.xml +++ b/WordPress/src/main/res/values/colors.xml @@ -61,7 +61,7 @@ @color/background_default - @color/white + @color/white #ffededed diff --git a/WordPress/src/main/res/values/dimens.xml b/WordPress/src/main/res/values/dimens.xml index a5200bbac5c1..ff82a2182480 100644 --- a/WordPress/src/main/res/values/dimens.xml +++ b/WordPress/src/main/res/values/dimens.xml @@ -130,7 +130,7 @@ 12dp 18dp - 0dp + 0dp 0dp 0dp 20dp From a3ea9f7665d13623bc023c8f3ea5978eb594dbed Mon Sep 17 00:00:00 2001 From: Renan Lukas <14964993+RenanLukas@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:28:07 -0300 Subject: [PATCH 04/18] Fix ReaderPostUiStateBuilder unit tests --- .../android/ui/reader/discover/ReaderDiscoverViewModel.kt | 2 +- .../android/ui/reader/discover/ReaderPostUiStateBuilder.kt | 2 +- .../ui/reader/viewmodels/tagsfeed/ReaderTagsFeedViewModel.kt | 2 +- .../ui/reader/discover/ReaderDiscoverViewModelTest.kt | 5 ++--- .../ui/reader/discover/ReaderPostUiStateBuilderTest.kt | 4 ++-- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverViewModel.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverViewModel.kt index 467b84bb0f45..33e42e95ade6 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverViewModel.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverViewModel.kt @@ -234,7 +234,7 @@ class ReaderDiscoverViewModel @Inject constructor( private suspend fun convertCardsToUiStates(posts: ReaderDiscoverCards): List { return posts.cards.map { card -> when (card) { - is ReaderPostCard -> postUiStateBuilder.mapPostToUiState( + is ReaderPostCard -> postUiStateBuilder.mapPostToNewUiState( source = ReaderTracker.SOURCE_DISCOVER, post = card.post, photonWidth = photonWidth, 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 e0389ac5dc16..9dde480b77a5 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 @@ -126,7 +126,7 @@ class ReaderPostUiStateBuilder @Inject constructor( } @Suppress("LongParameterList") - suspend fun mapPostToUiState( + suspend fun mapPostToNewUiState( source: String, post: ReaderPost, photonWidth: Int, diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/viewmodels/tagsfeed/ReaderTagsFeedViewModel.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/viewmodels/tagsfeed/ReaderTagsFeedViewModel.kt index 2daa867d0a95..149db5634938 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/viewmodels/tagsfeed/ReaderTagsFeedViewModel.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/viewmodels/tagsfeed/ReaderTagsFeedViewModel.kt @@ -511,7 +511,7 @@ class ReaderTagsFeedViewModel @Inject constructor( val photonHeight = (photonWidth * FEATURED_IMAGE_HEIGHT_WIDTH_RATION).toInt() _openMoreMenuEvents.postValue( MoreMenuUiState( - readerCardUiState = readerPostUiStateBuilder.mapPostToUiState( + readerCardUiState = readerPostUiStateBuilder.mapPostToNewUiState( source = ReaderTracker.SOURCE_TAGS_FEED, post = post, photonWidth = photonWidth, diff --git a/WordPress/src/test/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverViewModelTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverViewModelTest.kt index c1b6ad0192d4..00174373b862 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverViewModelTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverViewModelTest.kt @@ -6,7 +6,6 @@ import org.assertj.core.api.Assertions.assertThat import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -import org.mockito.ArgumentMatchers.anyBoolean import org.mockito.ArgumentMatchers.anyInt import org.mockito.ArgumentMatchers.anyString import org.mockito.Mock @@ -171,7 +170,7 @@ class ReaderDiscoverViewModelTest : BaseUnitTest() { whenever(readerUtilsWrapper.getTagFromTagName(anyOrNull(), anyOrNull())).thenReturn(mock()) whenever(menuUiStateBuilder.buildMoreMenuItems(anyOrNull(), any(), anyOrNull())).thenReturn(mock()) whenever( - uiStateBuilder.mapPostToUiState( + uiStateBuilder.mapPostToNewUiState( source = anyString(), post = anyOrNull(), photonWidth = anyInt(), @@ -201,7 +200,7 @@ class ReaderDiscoverViewModelTest : BaseUnitTest() { } whenever( - uiStateBuilder.mapPostToUiState( + uiStateBuilder.mapPostToNewUiState( source = anyString(), post = anyOrNull(), photonWidth = anyInt(), diff --git a/WordPress/src/test/java/org/wordpress/android/ui/reader/discover/ReaderPostUiStateBuilderTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/reader/discover/ReaderPostUiStateBuilderTest.kt index 6f192ff4733d..2b907f35d5ae 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/reader/discover/ReaderPostUiStateBuilderTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/reader/discover/ReaderPostUiStateBuilderTest.kt @@ -1281,7 +1281,7 @@ class ReaderPostUiStateBuilderTest : BaseUnitTest() { postListType: ReaderPostListType = TAG_FOLLOWED, onButtonClicked: (Long, Long, ReaderPostCardActionType) -> Unit = mock() ): ReaderPostUiState { - return builder.mapPostToUiState( + return builder.mapPostToUiStateBlocking( source = "source", post = post, isDiscover = false, @@ -1305,7 +1305,7 @@ class ReaderPostUiStateBuilderTest : BaseUnitTest() { postListType: ReaderPostListType = TAG_FOLLOWED, onButtonClicked: (Long, Long, ReaderPostCardActionType) -> Unit = mock() ): ReaderPostNewUiState { - return builder.mapPostToUiState( + return builder.mapPostToNewUiState( source = "source", post = post, photonWidth = 0, From 79ab3a839773a191cccfd534a7c9f022037179aa Mon Sep 17 00:00:00 2001 From: Renan Lukas <14964993+RenanLukas@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:32:44 -0300 Subject: [PATCH 05/18] Fix detekt --- .../ui/reader/ReaderPostDetailFragment.kt | 1 - .../discover/ReaderDiscoverViewModel.kt | 42 +++---------------- ...aderPostDetailsHeaderViewUiStateBuilder.kt | 2 - .../ui/reader/views/ReaderTagHeaderView.kt | 1 - 4 files changed, 5 insertions(+), 41 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostDetailFragment.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostDetailFragment.kt index 4b05209f8384..0488ec65a924 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostDetailFragment.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostDetailFragment.kt @@ -53,7 +53,6 @@ import com.google.android.material.appbar.AppBarLayout import com.google.android.material.appbar.CollapsingToolbarLayout import com.google.android.material.behavior.HideBottomViewOnScrollBehavior import com.google.android.material.dialog.MaterialAlertDialogBuilder -import com.google.android.material.elevation.ElevationOverlayProvider import com.google.android.material.snackbar.Snackbar import dagger.hilt.android.AndroidEntryPoint import org.greenrobot.eventbus.EventBus diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverViewModel.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverViewModel.kt index 33e42e95ade6..4c3e83718bf7 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverViewModel.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverViewModel.kt @@ -20,7 +20,6 @@ import org.wordpress.android.ui.bloggingprompts.BloggingPromptsPostTagProvider.C import org.wordpress.android.ui.pages.SnackbarMessageHolder import org.wordpress.android.ui.reader.ReaderTypes.ReaderPostListType.TAG_FOLLOWED import org.wordpress.android.ui.reader.discover.ReaderCardUiState.ReaderPostNewUiState -import org.wordpress.android.ui.reader.discover.ReaderCardUiState.ReaderPostUiState import org.wordpress.android.ui.reader.discover.ReaderCardUiState.ReaderRecommendedBlogsCardUiState.ReaderRecommendedBlogUiState import org.wordpress.android.ui.reader.discover.ReaderNavigationEvents.ShowBlogPreview import org.wordpress.android.ui.reader.discover.ReaderNavigationEvents.ShowPostsByTag @@ -243,8 +242,8 @@ class ReaderDiscoverViewModel @Inject constructor( onButtonClicked = this@ReaderDiscoverViewModel::onButtonClicked, onItemClicked = this@ReaderDiscoverViewModel::onPostItemClicked, onItemRendered = this@ReaderDiscoverViewModel::onItemRendered, - onMoreButtonClicked = this@ReaderDiscoverViewModel::onMoreButtonClickedNew, - onMoreDismissed = this@ReaderDiscoverViewModel::onMoreMenuDismissedNew, + onMoreButtonClicked = this@ReaderDiscoverViewModel::onMoreButtonClicked, + onMoreDismissed = this@ReaderDiscoverViewModel::onMoreMenuDismissed, onVideoOverlayClicked = this@ReaderDiscoverViewModel::onVideoOverlayClicked, onPostHeaderViewClicked = this@ReaderDiscoverViewModel::onPostHeaderClicked, ) @@ -363,13 +362,6 @@ class ReaderDiscoverViewModel @Inject constructor( } } - private fun onTagItemClicked(tagSlug: String) { - launch(ioDispatcher) { - val readerTag = readerUtilsWrapper.getTagFromTagName(tagSlug, FOLLOWED) - _navigationEvents.postValue(Event(ShowPostsByTag(readerTag))) - } - } - private fun onPostItemClicked(postId: Long, blogId: Long) { launch { findPost(postId, blogId)?.let { @@ -435,39 +427,15 @@ class ReaderDiscoverViewModel @Inject constructor( // TODO malinjir: add on discover clicked listener } - private fun onMoreButtonClicked(postUiState: ReaderPostUiState) { + private fun onMoreButtonClicked(postUiState: ReaderPostNewUiState) { changeMoreMenuVisibility(postUiState, true) } - private fun onMoreMenuDismissed(postUiState: ReaderPostUiState) { + private fun onMoreMenuDismissed(postUiState: ReaderPostNewUiState) { changeMoreMenuVisibility(postUiState, false) } - private fun changeMoreMenuVisibility(currentUiState: ReaderPostUiState, show: Boolean) { - launch { - findPost(currentUiState.postId, currentUiState.blogId)?.let { post -> - val moreMenuItems = if (show) { - readerPostMoreButtonUiStateBuilder.buildMoreMenuItems( - post, false, this@ReaderDiscoverViewModel::onButtonClicked - ) - } else { - null - } - - replaceUiStateItem(currentUiState, currentUiState.copy(moreMenuItems = moreMenuItems)) - } - } - } - - private fun onMoreButtonClickedNew(postUiState: ReaderPostNewUiState) { - changeMoreMenuVisibilityNew(postUiState, true) - } - - private fun onMoreMenuDismissedNew(postUiState: ReaderPostNewUiState) { - changeMoreMenuVisibilityNew(postUiState, false) - } - - private fun changeMoreMenuVisibilityNew(currentUiState: ReaderPostNewUiState, show: Boolean) { + private fun changeMoreMenuVisibility(currentUiState: ReaderPostNewUiState, show: Boolean) { launch { findPost(currentUiState.postId, currentUiState.blogId)?.let { post -> val moreMenuItems = if (show) { diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderPostDetailsHeaderViewUiStateBuilder.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderPostDetailsHeaderViewUiStateBuilder.kt index 12f889e73b18..7872badb82e3 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderPostDetailsHeaderViewUiStateBuilder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderPostDetailsHeaderViewUiStateBuilder.kt @@ -1,7 +1,6 @@ package org.wordpress.android.ui.reader.views import dagger.Reusable -import org.wordpress.android.R import org.wordpress.android.fluxc.store.AccountStore import org.wordpress.android.models.ReaderPost import org.wordpress.android.ui.reader.discover.ReaderPostTagsUiStateBuilder @@ -11,7 +10,6 @@ import org.wordpress.android.ui.reader.views.uistates.InteractionSectionUiState import org.wordpress.android.ui.reader.views.uistates.ReaderBlogSectionUiState import org.wordpress.android.ui.reader.views.uistates.ReaderPostDetailsHeaderAction import org.wordpress.android.ui.reader.views.uistates.ReaderPostDetailsHeaderViewUiState.ReaderPostDetailsHeaderUiState -import org.wordpress.android.ui.utils.UiString.UiStringRes import org.wordpress.android.ui.utils.UiString.UiStringText import org.wordpress.android.util.DateTimeUtilsWrapper import javax.inject.Inject diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderTagHeaderView.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderTagHeaderView.kt index ddc222df6ed2..de19c9f7fbd4 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderTagHeaderView.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderTagHeaderView.kt @@ -7,7 +7,6 @@ import android.widget.RelativeLayout import androidx.core.view.isGone import com.google.android.material.textview.MaterialTextView import org.wordpress.android.WordPress -import org.wordpress.android.databinding.ReaderTagHeaderViewBinding import org.wordpress.android.databinding.ReaderTagHeaderViewNewBinding import org.wordpress.android.ui.reader.views.ReaderTagHeaderViewUiState.ReaderTagHeaderUiState import org.wordpress.android.ui.utils.UiHelpers From 0827d2a6222c8597dff95007db214ec73f5177ae Mon Sep 17 00:00:00 2001 From: Renan Lukas <14964993+RenanLukas@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:45:33 -0300 Subject: [PATCH 06/18] Remove unused files and new suffix --- .../ui/reader/adapters/ReaderPostAdapter.java | 2 +- .../reader/discover/ReaderDiscoverAdapter.kt | 4 +- .../discover/ReaderInterestNewAdapter.kt | 52 ---------- .../discover/ReaderRecommendedBlogsAdapter.kt | 4 +- .../ReaderRecommendedBlogsNewAdapter.kt | 38 -------- .../ReaderInterestNewViewHolder.kt | 19 ---- .../viewholders/ReaderInterestViewHolder.kt | 11 +-- ...er.kt => ReaderInterestsCardViewHolder.kt} | 12 +-- .../ReaderRecommendedBlogNewViewHolder.kt | 53 ----------- .../ReaderRecommendedBlogViewHolder.kt | 36 +++---- ...ReaderRecommendedBlogsCardNewViewHolder.kt | 10 +- ...post_new.xml => reader_cardview_xpost.xml} | 0 ..._card_new.xml => reader_interest_card.xml} | 0 .../main/res/layout/reader_interest_item.xml | 23 +---- .../res/layout/reader_interest_item_new.xml | 8 -- .../layout/reader_recommended_blog_item.xml | 95 ++++++------------- .../reader_recommended_blog_item_new.xml | 68 ------------- ....xml => reader_recommended_blogs_card.xml} | 2 +- 18 files changed, 71 insertions(+), 366 deletions(-) delete mode 100644 WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderInterestNewAdapter.kt delete mode 100644 WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderRecommendedBlogsNewAdapter.kt delete mode 100644 WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderInterestNewViewHolder.kt rename WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/{ReaderInterestsCardNewViewHolder.kt => ReaderInterestsCardViewHolder.kt} (89%) delete mode 100644 WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderRecommendedBlogNewViewHolder.kt rename WordPress/src/main/res/layout/{reader_cardview_xpost_new.xml => reader_cardview_xpost.xml} (100%) rename WordPress/src/main/res/layout/{reader_interest_card_new.xml => reader_interest_card.xml} (100%) delete mode 100644 WordPress/src/main/res/layout/reader_interest_item_new.xml delete mode 100644 WordPress/src/main/res/layout/reader_recommended_blog_item_new.xml rename WordPress/src/main/res/layout/{reader_recommended_blogs_card_new.xml => reader_recommended_blogs_card.xml} (99%) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/adapters/ReaderPostAdapter.java b/WordPress/src/main/java/org/wordpress/android/ui/reader/adapters/ReaderPostAdapter.java index d4adb1f2b9b3..c790360358eb 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/adapters/ReaderPostAdapter.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/adapters/ReaderPostAdapter.java @@ -276,7 +276,7 @@ public int getItemViewType(int position) { return new GapMarkerViewHolder(new ReaderGapMarkerView(context)); case VIEW_TYPE_XPOST: - postView = LayoutInflater.from(context).inflate(R.layout.reader_cardview_xpost_new, parent, false); + postView = LayoutInflater.from(context).inflate(R.layout.reader_cardview_xpost, parent, false); return new ReaderXPostViewHolder(postView); case VIEW_TYPE_REMOVED_POST: postView = LayoutInflater.from(context).inflate( diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverAdapter.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverAdapter.kt index fa718bc0f35c..c4e76d1bd203 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverAdapter.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverAdapter.kt @@ -9,7 +9,7 @@ import org.wordpress.android.ui.reader.discover.ReaderCardUiState.ReaderPostNewU import org.wordpress.android.ui.reader.discover.ReaderCardUiState.ReaderPostUiState import org.wordpress.android.ui.reader.discover.ReaderCardUiState.ReaderRecommendedBlogsCardUiState import org.wordpress.android.ui.reader.discover.viewholders.ReaderAnnouncementCardViewHolder -import org.wordpress.android.ui.reader.discover.viewholders.ReaderInterestsCardNewViewHolder +import org.wordpress.android.ui.reader.discover.viewholders.ReaderInterestsCardViewHolder import org.wordpress.android.ui.reader.discover.viewholders.ReaderPostNewViewHolder import org.wordpress.android.ui.reader.discover.viewholders.ReaderPostViewHolder import org.wordpress.android.ui.reader.discover.viewholders.ReaderRecommendedBlogsCardNewViewHolder @@ -44,7 +44,7 @@ class ReaderDiscoverAdapter( parent ) - INTEREST_VIEW_TYPE -> ReaderInterestsCardNewViewHolder(uiHelpers, parent) + INTEREST_VIEW_TYPE -> ReaderInterestsCardViewHolder(uiHelpers, parent) RECOMMENDED_BLOGS_VIEW_TYPE -> ReaderRecommendedBlogsCardNewViewHolder(parent, imageManager) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderInterestNewAdapter.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderInterestNewAdapter.kt deleted file mode 100644 index 19e3d38519c2..000000000000 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderInterestNewAdapter.kt +++ /dev/null @@ -1,52 +0,0 @@ -package org.wordpress.android.ui.reader.discover - -import android.view.ViewGroup -import androidx.recyclerview.widget.DiffUtil -import androidx.recyclerview.widget.DiffUtil.Callback -import androidx.recyclerview.widget.RecyclerView.Adapter -import org.wordpress.android.ui.reader.discover.ReaderCardUiState.ReaderInterestsCardUiState.ReaderInterestUiState -import org.wordpress.android.ui.reader.discover.viewholders.ReaderInterestNewViewHolder -import org.wordpress.android.ui.utils.UiHelpers - -class ReaderInterestNewAdapter( - private val uiHelpers: UiHelpers -) : Adapter() { - private val items = mutableListOf() - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ReaderInterestNewViewHolder { - return ReaderInterestNewViewHolder(uiHelpers, parent) - } - - override fun getItemCount(): Int = items.size - - override fun onBindViewHolder(holder: ReaderInterestNewViewHolder, position: Int) { - holder.onBind(items[position]) - } - - fun update(newItems: List) { - val diffResult = DiffUtil.calculateDiff(InterestDiffUtil(items, newItems)) - items.clear() - items.addAll(newItems) - diffResult.dispatchUpdatesTo(this) - } - - class InterestDiffUtil( - private val oldList: List, - private val newList: List - ) : Callback() { - override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean { - val newItem = newList[newItemPosition] - val oldItem = oldList[oldItemPosition] - - return (oldItem == newItem) - } - - override fun getOldListSize(): Int = oldList.size - - override fun getNewListSize(): Int = newList.size - - override fun areContentsTheSame( - oldItemPosition: Int, - newItemPosition: Int - ): Boolean = oldList[oldItemPosition] == newList[newItemPosition] - } -} diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderRecommendedBlogsAdapter.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderRecommendedBlogsAdapter.kt index 5b46d6d80faf..ca49bbb27294 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderRecommendedBlogsAdapter.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderRecommendedBlogsAdapter.kt @@ -5,15 +5,13 @@ import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import org.wordpress.android.ui.reader.discover.ReaderCardUiState.ReaderRecommendedBlogsCardUiState.ReaderRecommendedBlogUiState import org.wordpress.android.ui.reader.discover.viewholders.ReaderRecommendedBlogViewHolder -import org.wordpress.android.ui.utils.UiHelpers import org.wordpress.android.util.image.ImageManager class ReaderRecommendedBlogsAdapter( private val imageManager: ImageManager, - private val uiHelpers: UiHelpers, ) : ListAdapter(RecommendedBlogsDiffUtil()) { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ReaderRecommendedBlogViewHolder { - return ReaderRecommendedBlogViewHolder(parent, imageManager, uiHelpers) + return ReaderRecommendedBlogViewHolder(parent, imageManager) } override fun onBindViewHolder(holder: ReaderRecommendedBlogViewHolder, position: Int) { diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderRecommendedBlogsNewAdapter.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderRecommendedBlogsNewAdapter.kt deleted file mode 100644 index a46ce0a6b1e2..000000000000 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderRecommendedBlogsNewAdapter.kt +++ /dev/null @@ -1,38 +0,0 @@ -package org.wordpress.android.ui.reader.discover - -import android.view.ViewGroup -import androidx.recyclerview.widget.DiffUtil -import androidx.recyclerview.widget.ListAdapter -import org.wordpress.android.ui.reader.discover.ReaderCardUiState.ReaderRecommendedBlogsCardUiState.ReaderRecommendedBlogUiState -import org.wordpress.android.ui.reader.discover.viewholders.ReaderRecommendedBlogNewViewHolder -import org.wordpress.android.util.image.ImageManager - -class ReaderRecommendedBlogsNewAdapter( - private val imageManager: ImageManager, -) : ListAdapter(RecommendedBlogsDiffUtil()) { - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ReaderRecommendedBlogNewViewHolder { - return ReaderRecommendedBlogNewViewHolder(parent, imageManager) - } - - override fun onBindViewHolder(holder: ReaderRecommendedBlogNewViewHolder, position: Int) { - holder.onBind(getItem(position)) - } - - class RecommendedBlogsDiffUtil : DiffUtil.ItemCallback() { - override fun areItemsTheSame( - oldItem: ReaderRecommendedBlogUiState, - newItem: ReaderRecommendedBlogUiState - ): Boolean = oldItem.blogId == newItem.blogId && oldItem.feedId == newItem.feedId - - override fun areContentsTheSame( - oldItem: ReaderRecommendedBlogUiState, - newItem: ReaderRecommendedBlogUiState - ): Boolean = oldItem == newItem - - // Returning true suppresses the default item animation. - override fun getChangePayload( - oldItem: ReaderRecommendedBlogUiState, - newItem: ReaderRecommendedBlogUiState - ): Any? = true - } -} diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderInterestNewViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderInterestNewViewHolder.kt deleted file mode 100644 index b671cdcdab5b..000000000000 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderInterestNewViewHolder.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.wordpress.android.ui.reader.discover.viewholders - -import android.view.ViewGroup -import androidx.recyclerview.widget.RecyclerView -import org.wordpress.android.databinding.ReaderInterestItemNewBinding -import org.wordpress.android.ui.reader.discover.ReaderCardUiState.ReaderInterestsCardUiState.ReaderInterestUiState -import org.wordpress.android.ui.utils.UiHelpers -import org.wordpress.android.util.extensions.viewBinding - -class ReaderInterestNewViewHolder( - private val uiHelpers: UiHelpers, - parent: ViewGroup, - private val binding: ReaderInterestItemNewBinding = parent.viewBinding(ReaderInterestItemNewBinding::inflate) -) : RecyclerView.ViewHolder(binding.root) { - fun onBind(uiState: ReaderInterestUiState) = with(binding) { - uiHelpers.setTextOrHide(chip, uiState.interest) - chip.setOnClickListener { uiState.onClicked.invoke(uiState.interest) } - } -} diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderInterestViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderInterestViewHolder.kt index a9c76598b295..1f69cf313bf3 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderInterestViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderInterestViewHolder.kt @@ -1,7 +1,6 @@ package org.wordpress.android.ui.reader.discover.viewholders import android.view.ViewGroup -import androidx.appcompat.content.res.AppCompatResources.getColorStateList import androidx.recyclerview.widget.RecyclerView import org.wordpress.android.databinding.ReaderInterestItemBinding import org.wordpress.android.ui.reader.discover.ReaderCardUiState.ReaderInterestsCardUiState.ReaderInterestUiState @@ -14,13 +13,7 @@ class ReaderInterestViewHolder( private val binding: ReaderInterestItemBinding = parent.viewBinding(ReaderInterestItemBinding::inflate) ) : RecyclerView.ViewHolder(binding.root) { fun onBind(uiState: ReaderInterestUiState) = with(binding) { - uiHelpers.setTextOrHide(interest, uiState.interest) - interest.setOnClickListener { uiState.onClicked.invoke(uiState.interest) } - - with(uiState.chipStyle) { - interest.setChipStrokeColorResource(chipStrokeColorResId) - interest.setChipBackgroundColorResource(chipFillColorResId) - interest.setTextColor(getColorStateList(interest.context, chipFontColorResId)) - } + uiHelpers.setTextOrHide(chip, uiState.interest) + chip.setOnClickListener { uiState.onClicked.invoke(uiState.interest) } } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderInterestsCardNewViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderInterestsCardViewHolder.kt similarity index 89% rename from WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderInterestsCardNewViewHolder.kt rename to WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderInterestsCardViewHolder.kt index b5b255a497b9..309d2ea991c2 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderInterestsCardNewViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderInterestsCardViewHolder.kt @@ -10,24 +10,24 @@ import com.google.android.flexbox.FlexDirection import com.google.android.flexbox.FlexWrap import com.google.android.flexbox.FlexboxLayoutManager import org.wordpress.android.R -import org.wordpress.android.databinding.ReaderInterestCardNewBinding +import org.wordpress.android.databinding.ReaderInterestCardBinding import org.wordpress.android.ui.reader.discover.ReaderCardUiState -import org.wordpress.android.ui.reader.discover.ReaderInterestNewAdapter +import org.wordpress.android.ui.reader.discover.ReaderInterestAdapter import org.wordpress.android.ui.utils.UiHelpers import org.wordpress.android.util.extensions.viewBinding import org.wordpress.android.widgets.RecyclerItemDecoration private const val Y_BUFFER = 10 -class ReaderInterestsCardNewViewHolder( +class ReaderInterestsCardViewHolder( uiHelpers: UiHelpers, parentView: ViewGroup -) : ReaderViewHolder(parentView.viewBinding(ReaderInterestCardNewBinding::inflate)) { +) : ReaderViewHolder(parentView.viewBinding(ReaderInterestCardBinding::inflate)) { init { with(binding.recommendedTags) { if (adapter == null) { layoutManager = FlexboxLayoutManager(context, FlexDirection.ROW, FlexWrap.WRAP) - val readerInterestAdapter = ReaderInterestNewAdapter(uiHelpers) + val readerInterestAdapter = ReaderInterestAdapter(uiHelpers) setItemSpacing() adapter = readerInterestAdapter } @@ -50,7 +50,7 @@ class ReaderInterestsCardNewViewHolder( override fun onBind(uiState: ReaderCardUiState) = with(binding) { uiState as ReaderCardUiState.ReaderInterestsCardUiState setOnTouchItemListener() - (recommendedTags.adapter as ReaderInterestNewAdapter).update(uiState.interest) + (recommendedTags.adapter as ReaderInterestAdapter).update(uiState.interest) } private fun setOnTouchItemListener() = with(binding) { diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderRecommendedBlogNewViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderRecommendedBlogNewViewHolder.kt deleted file mode 100644 index 71bf49520c0b..000000000000 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderRecommendedBlogNewViewHolder.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.wordpress.android.ui.reader.discover.viewholders - -import android.view.ViewGroup -import androidx.recyclerview.widget.RecyclerView -import org.wordpress.android.databinding.ReaderRecommendedBlogItemNewBinding -import org.wordpress.android.ui.reader.discover.ReaderCardUiState.ReaderRecommendedBlogsCardUiState.ReaderRecommendedBlogUiState -import org.wordpress.android.util.extensions.viewBinding -import org.wordpress.android.util.image.ImageManager -import org.wordpress.android.util.image.ImageType.BLAVATAR_CIRCULAR - -class ReaderRecommendedBlogNewViewHolder( - parent: ViewGroup, - private val imageManager: ImageManager, - private val binding: ReaderRecommendedBlogItemNewBinding = - parent.viewBinding(ReaderRecommendedBlogItemNewBinding::inflate) -) : RecyclerView.ViewHolder(binding.root) { - fun onBind(uiState: ReaderRecommendedBlogUiState) = - with(binding) { - siteName.text = uiState.name - siteUrl.text = uiState.url - updateSiteFollowButton(uiState, this) - updateBlogImage(uiState.iconUrl) - root.setOnClickListener { - uiState.onItemClicked(uiState.blogId, uiState.feedId, uiState.isFollowed) - } - } - - private fun updateSiteFollowButton( - uiState: ReaderRecommendedBlogUiState, - binding: ReaderRecommendedBlogItemNewBinding - ) { - with(binding.siteFollowButton) { - isEnabled = uiState.isFollowEnabled - setIsFollowed(uiState.isFollowed) - contentDescription = context.getString(uiState.followContentDescription.stringRes) - setOnClickListener { - uiState.onFollowClicked(uiState) - } - } - } - - private fun updateBlogImage(iconUrl: String?) = with(binding) { - if (iconUrl != null) { - imageManager.loadIntoCircle( - imageView = siteIcon, - imageType = BLAVATAR_CIRCULAR, - imgUrl = iconUrl - ) - } else { - imageManager.cancelRequestAndClearImageView(siteIcon) - } - } -} diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderRecommendedBlogViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderRecommendedBlogViewHolder.kt index 6f0d75122667..4c39cbb75d39 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderRecommendedBlogViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderRecommendedBlogViewHolder.kt @@ -4,7 +4,6 @@ import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import org.wordpress.android.databinding.ReaderRecommendedBlogItemBinding import org.wordpress.android.ui.reader.discover.ReaderCardUiState.ReaderRecommendedBlogsCardUiState.ReaderRecommendedBlogUiState -import org.wordpress.android.ui.utils.UiHelpers import org.wordpress.android.util.extensions.viewBinding import org.wordpress.android.util.image.ImageManager import org.wordpress.android.util.image.ImageType.BLAVATAR_CIRCULAR @@ -12,25 +11,30 @@ import org.wordpress.android.util.image.ImageType.BLAVATAR_CIRCULAR class ReaderRecommendedBlogViewHolder( parent: ViewGroup, private val imageManager: ImageManager, - private val uiHelpers: UiHelpers, private val binding: ReaderRecommendedBlogItemBinding = parent.viewBinding(ReaderRecommendedBlogItemBinding::inflate) ) : RecyclerView.ViewHolder(binding.root) { - fun onBind(uiState: ReaderRecommendedBlogUiState) = with(binding) { - with(uiState) { - siteName.text = name - siteUrl.text = url - uiHelpers.setTextOrHide(siteDescription, description) - siteFollowButton.apply { - setIsFollowed(isFollowed) - contentDescription = context.getString(followContentDescription.stringRes) - setOnClickListener { - onFollowClicked(uiState) - } - } - updateBlogImage(iconUrl) + fun onBind(uiState: ReaderRecommendedBlogUiState) = + with(binding) { + siteName.text = uiState.name + siteUrl.text = uiState.url + updateSiteFollowButton(uiState, this) + updateBlogImage(uiState.iconUrl) root.setOnClickListener { - onItemClicked(blogId, feedId, isFollowed) + uiState.onItemClicked(uiState.blogId, uiState.feedId, uiState.isFollowed) + } + } + + private fun updateSiteFollowButton( + uiState: ReaderRecommendedBlogUiState, + binding: ReaderRecommendedBlogItemBinding + ) { + with(binding.siteFollowButton) { + isEnabled = uiState.isFollowEnabled + setIsFollowed(uiState.isFollowed) + contentDescription = context.getString(uiState.followContentDescription.stringRes) + setOnClickListener { + uiState.onFollowClicked(uiState) } } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderRecommendedBlogsCardNewViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderRecommendedBlogsCardNewViewHolder.kt index b74d57be38c9..40bdc0da0ef7 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderRecommendedBlogsCardNewViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/viewholders/ReaderRecommendedBlogsCardNewViewHolder.kt @@ -1,21 +1,21 @@ package org.wordpress.android.ui.reader.discover.viewholders import android.view.ViewGroup -import org.wordpress.android.databinding.ReaderRecommendedBlogsCardNewBinding +import org.wordpress.android.databinding.ReaderRecommendedBlogsCardBinding import org.wordpress.android.ui.reader.discover.ReaderCardUiState import org.wordpress.android.ui.reader.discover.ReaderCardUiState.ReaderRecommendedBlogsCardUiState -import org.wordpress.android.ui.reader.discover.ReaderRecommendedBlogsNewAdapter +import org.wordpress.android.ui.reader.discover.ReaderRecommendedBlogsAdapter import org.wordpress.android.util.extensions.viewBinding import org.wordpress.android.util.image.ImageManager class ReaderRecommendedBlogsCardNewViewHolder( parentView: ViewGroup, imageManager: ImageManager, -) : ReaderViewHolder( - parentView.viewBinding(ReaderRecommendedBlogsCardNewBinding::inflate) +) : ReaderViewHolder( + parentView.viewBinding(ReaderRecommendedBlogsCardBinding::inflate) ) { private val recommendedBlogsAdapter = - ReaderRecommendedBlogsNewAdapter(imageManager) + ReaderRecommendedBlogsAdapter(imageManager) init { with(binding) { diff --git a/WordPress/src/main/res/layout/reader_cardview_xpost_new.xml b/WordPress/src/main/res/layout/reader_cardview_xpost.xml similarity index 100% rename from WordPress/src/main/res/layout/reader_cardview_xpost_new.xml rename to WordPress/src/main/res/layout/reader_cardview_xpost.xml diff --git a/WordPress/src/main/res/layout/reader_interest_card_new.xml b/WordPress/src/main/res/layout/reader_interest_card.xml similarity index 100% rename from WordPress/src/main/res/layout/reader_interest_card_new.xml rename to WordPress/src/main/res/layout/reader_interest_card.xml diff --git a/WordPress/src/main/res/layout/reader_interest_item.xml b/WordPress/src/main/res/layout/reader_interest_item.xml index 95c3296904fb..628aa040c3c3 100644 --- a/WordPress/src/main/res/layout/reader_interest_item.xml +++ b/WordPress/src/main/res/layout/reader_interest_item.xml @@ -1,23 +1,8 @@ - - - - + tools:text="A Text in a chip" /> diff --git a/WordPress/src/main/res/layout/reader_interest_item_new.xml b/WordPress/src/main/res/layout/reader_interest_item_new.xml deleted file mode 100644 index 628aa040c3c3..000000000000 --- a/WordPress/src/main/res/layout/reader_interest_item_new.xml +++ /dev/null @@ -1,8 +0,0 @@ - - diff --git a/WordPress/src/main/res/layout/reader_recommended_blog_item.xml b/WordPress/src/main/res/layout/reader_recommended_blog_item.xml index 4dcf2bcb37d8..54ed1bc6c9ae 100644 --- a/WordPress/src/main/res/layout/reader_recommended_blog_item.xml +++ b/WordPress/src/main/res/layout/reader_recommended_blog_item.xml @@ -4,102 +4,65 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="?attr/selectableItemBackground"> + android:background="?attr/selectableItemBackground" + android:paddingBottom="@dimen/margin_medium_large" + android:paddingEnd="@dimen/margin_extra_large" + android:paddingStart="@dimen/margin_extra_large" + android:paddingTop="@dimen/margin_medium_large"> - - - - - - - - + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_chainStyle="packed" + tools:text="Site site Site site Site site Site site Site site Site site Site site " /> - - + tools:text="site.com site.com site.com site.com site.com site.com site.com site.com " /> + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> diff --git a/WordPress/src/main/res/layout/reader_recommended_blog_item_new.xml b/WordPress/src/main/res/layout/reader_recommended_blog_item_new.xml deleted file mode 100644 index 54ed1bc6c9ae..000000000000 --- a/WordPress/src/main/res/layout/reader_recommended_blog_item_new.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - diff --git a/WordPress/src/main/res/layout/reader_recommended_blogs_card_new.xml b/WordPress/src/main/res/layout/reader_recommended_blogs_card.xml similarity index 99% rename from WordPress/src/main/res/layout/reader_recommended_blogs_card_new.xml rename to WordPress/src/main/res/layout/reader_recommended_blogs_card.xml index 28e942f12f3b..4897bd40c5c5 100644 --- a/WordPress/src/main/res/layout/reader_recommended_blogs_card_new.xml +++ b/WordPress/src/main/res/layout/reader_recommended_blogs_card.xml @@ -32,7 +32,7 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/recommended_blogs_header" tools:itemCount="3" - tools:listitem="@layout/reader_recommended_blog_item_new" /> + tools:listitem="@layout/reader_recommended_blog_item" /> Date: Thu, 6 Jun 2024 17:02:08 -0300 Subject: [PATCH 07/18] Continue removing reader unused files and new suffix --- .../ui/reader/ReaderPostDetailFragment.kt | 8 ++-- .../ui/reader/adapters/ReaderPostAdapter.java | 2 +- .../reader/views/ReaderExpandableTagsView.kt | 6 +-- .../views/ReaderPostDetailHeaderView.kt | 6 +-- .../ui/reader/views/ReaderSiteHeaderView.java | 2 +- .../ui/reader/views/ReaderTagHeaderView.kt | 12 ++--- .../layout/reader_cardview_removed_post.xml | 4 +- .../reader_cardview_removed_post_new.xml | 47 ------------------- .../reader_expandable_tags_view_chip_new.xml | 8 ---- ...der_expandable_tags_view_overflow_chip.xml | 1 - ...expandable_tags_view_overflow_chip_new.xml | 9 ---- .../layout/reader_fragment_post_detail.xml | 2 +- ... => reader_include_post_detail_footer.xml} | 0 .../main/res/layout/reader_interest_item.xml | 2 +- ...xml => reader_post_detail_header_view.xml} | 0 ...ew_new.xml => reader_site_header_view.xml} | 0 .../res/layout/reader_tag_header_view.xml | 29 +++++------- .../res/layout/reader_tag_header_view_new.xml | 40 ---------------- .../src/main/res/values/reader_styles.xml | 18 +------ 19 files changed, 36 insertions(+), 160 deletions(-) delete mode 100644 WordPress/src/main/res/layout/reader_cardview_removed_post_new.xml delete mode 100644 WordPress/src/main/res/layout/reader_expandable_tags_view_chip_new.xml delete mode 100644 WordPress/src/main/res/layout/reader_expandable_tags_view_overflow_chip_new.xml rename WordPress/src/main/res/layout/{reader_include_post_detail_footer_new.xml => reader_include_post_detail_footer.xml} (100%) rename WordPress/src/main/res/layout/{reader_post_detail_header_view_new.xml => reader_post_detail_header_view.xml} (100%) rename WordPress/src/main/res/layout/{reader_site_header_view_new.xml => reader_site_header_view.xml} (100%) delete mode 100644 WordPress/src/main/res/layout/reader_tag_header_view_new.xml diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostDetailFragment.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostDetailFragment.kt index 0488ec65a924..47c381deb1a1 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostDetailFragment.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostDetailFragment.kt @@ -62,7 +62,7 @@ import org.wordpress.android.R import org.wordpress.android.WordPress import org.wordpress.android.analytics.AnalyticsTracker import org.wordpress.android.databinding.ReaderFragmentPostDetailBinding -import org.wordpress.android.databinding.ReaderIncludePostDetailFooterNewBinding +import org.wordpress.android.databinding.ReaderIncludePostDetailFooterBinding import org.wordpress.android.datasets.ReaderPostTable import org.wordpress.android.fluxc.Dispatcher import org.wordpress.android.fluxc.generated.SiteActionBuilder @@ -479,10 +479,10 @@ class ReaderPostDetailFragment : ViewPagerFragment(), private fun initLayoutFooter(view: View) { view.findViewById(R.id.layout_post_detail_footer).apply { - layoutResource = R.layout.reader_include_post_detail_footer_new + layoutResource = R.layout.reader_include_post_detail_footer setOnInflateListener { _, inflated -> - layoutFooterBinding = ReaderIncludePostDetailFooterNewBinding.bind(inflated).mapBinding().apply { + layoutFooterBinding = ReaderIncludePostDetailFooterBinding.bind(inflated).mapBinding().apply { // the new bar should hide on scroll val params = root.layoutParams as CoordinatorLayout.LayoutParams params.behavior = HideBottomViewOnScrollBehavior() @@ -1868,7 +1868,7 @@ class ReaderPostDetailFragment : ViewPagerFragment(), val like: View, ) - private fun ReaderIncludePostDetailFooterNewBinding.mapBinding(): PostDetailFooterBarBinding = + private fun ReaderIncludePostDetailFooterBinding.mapBinding(): PostDetailFooterBarBinding = PostDetailFooterBarBinding( root, bookmark, diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/adapters/ReaderPostAdapter.java b/WordPress/src/main/java/org/wordpress/android/ui/reader/adapters/ReaderPostAdapter.java index c790360358eb..de82ad15e77c 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/adapters/ReaderPostAdapter.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/adapters/ReaderPostAdapter.java @@ -280,7 +280,7 @@ public int getItemViewType(int position) { return new ReaderXPostViewHolder(postView); case VIEW_TYPE_REMOVED_POST: postView = LayoutInflater.from(context).inflate( - R.layout.reader_cardview_removed_post_new, parent, false + R.layout.reader_cardview_removed_post, parent, false ); return new ReaderRemovedPostViewHolder(postView); default: diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderExpandableTagsView.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderExpandableTagsView.kt index 8278d140eb54..8cff56f5ec6b 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderExpandableTagsView.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderExpandableTagsView.kt @@ -196,11 +196,11 @@ class ReaderExpandableTagsView @JvmOverloads constructor( @ColorRes fun overflowStrokeColorRes(isCollapsed: Boolean): Int? = null - object Default : ChipStyle { + data object Default : ChipStyle { override val chipLayoutRes: Int - get() = R.layout.reader_expandable_tags_view_chip_new + get() = R.layout.reader_expandable_tags_view_chip override val overflowChipLayoutRes: Int - get() = R.layout.reader_expandable_tags_view_overflow_chip_new + get() = R.layout.reader_expandable_tags_view_overflow_chip override fun overflowChipText(resources: Resources, hiddenChipsCount: Int): String { return String.format( 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 145ac1763852..87469df6e5c6 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 @@ -11,7 +11,7 @@ import androidx.core.view.isVisible import com.google.android.material.textview.MaterialTextView import org.wordpress.android.R import org.wordpress.android.WordPress -import org.wordpress.android.databinding.ReaderPostDetailHeaderViewNewBinding +import org.wordpress.android.databinding.ReaderPostDetailHeaderViewBinding import org.wordpress.android.ui.reader.models.ReaderReadingPreferences import org.wordpress.android.ui.reader.utils.ReaderUtils import org.wordpress.android.ui.reader.utils.toTypeface @@ -46,7 +46,7 @@ class ReaderPostDetailHeaderView @JvmOverloads constructor( init { (context.applicationContext as WordPress).component().inject(this) binding = ReaderPostDetailHeaderBinding.ImprovementsEnabled( - ReaderPostDetailHeaderViewNewBinding.inflate(LayoutInflater.from(context), this, true), uiHelpers + ReaderPostDetailHeaderViewBinding.inflate(LayoutInflater.from(context), this, true), uiHelpers ) } @@ -139,7 +139,7 @@ class ReaderPostDetailHeaderView @JvmOverloads constructor( fun updateInteractionSection(state: InteractionSectionUiState, readingPreferences: ReaderReadingPreferences?) class ImprovementsEnabled( - private val binding: ReaderPostDetailHeaderViewNewBinding, + private val binding: ReaderPostDetailHeaderViewBinding, private val uiHelpers: UiHelpers, ) : ReaderPostDetailHeaderBinding { override val titleText: MaterialTextView diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderSiteHeaderView.java b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderSiteHeaderView.java index 1535fbcfc696..5ef68491adea 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderSiteHeaderView.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderSiteHeaderView.java @@ -82,7 +82,7 @@ public ReaderSiteHeaderView(Context context, AttributeSet attrs, int defStyleAtt } private void initView(Context context) { - final View view = inflate(context, R.layout.reader_site_header_view_new, this); + final View view = inflate(context, R.layout.reader_site_header_view, this); mFollowButton = view.findViewById(R.id.follow_button); view.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderTagHeaderView.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderTagHeaderView.kt index de19c9f7fbd4..f1a67443a53c 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderTagHeaderView.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderTagHeaderView.kt @@ -7,7 +7,7 @@ import android.widget.RelativeLayout import androidx.core.view.isGone import com.google.android.material.textview.MaterialTextView import org.wordpress.android.WordPress -import org.wordpress.android.databinding.ReaderTagHeaderViewNewBinding +import org.wordpress.android.databinding.ReaderTagHeaderViewBinding import org.wordpress.android.ui.reader.views.ReaderTagHeaderViewUiState.ReaderTagHeaderUiState import org.wordpress.android.ui.utils.UiHelpers import org.wordpress.android.util.LocaleProvider @@ -33,13 +33,13 @@ class ReaderTagHeaderView @JvmOverloads constructor( init { (context.applicationContext as WordPress).component().inject(this) - val readerTagHeaderViewNewBinding = - ReaderTagHeaderViewNewBinding.inflate(LayoutInflater.from(context), this, true) + val readerTagHeaderViewBinding = + ReaderTagHeaderViewBinding.inflate(LayoutInflater.from(context), this, true) binding = ReaderTagBinding.ImprovementsEnabled( - textTag = readerTagHeaderViewNewBinding.textTag, - followButton = readerTagHeaderViewNewBinding.followContainer.followButton, - textTagFollowCount = readerTagHeaderViewNewBinding.followContainer.textBlogFollowCount, + textTag = readerTagHeaderViewBinding.textTag, + followButton = readerTagHeaderViewBinding.followContainer.followButton, + textTagFollowCount = readerTagHeaderViewBinding.followContainer.textBlogFollowCount, ) binding.followButton.setOnClickListener { onFollowBtnClicked?.invoke() } } diff --git a/WordPress/src/main/res/layout/reader_cardview_removed_post.xml b/WordPress/src/main/res/layout/reader_cardview_removed_post.xml index 25da2931ae9a..52ef9975ea90 100644 --- a/WordPress/src/main/res/layout/reader_cardview_removed_post.xml +++ b/WordPress/src/main/res/layout/reader_cardview_removed_post.xml @@ -3,7 +3,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" - style="@style/ReaderCardView" + style="@style/ReaderCardViewNew" android:id="@+id/post_container" android:layout_width="match_parent" android:layout_height="wrap_content"> @@ -18,7 +18,7 @@ - - - - - - - - - - - diff --git a/WordPress/src/main/res/layout/reader_expandable_tags_view_chip_new.xml b/WordPress/src/main/res/layout/reader_expandable_tags_view_chip_new.xml deleted file mode 100644 index 333ff4dd5277..000000000000 --- a/WordPress/src/main/res/layout/reader_expandable_tags_view_chip_new.xml +++ /dev/null @@ -1,8 +0,0 @@ - - diff --git a/WordPress/src/main/res/layout/reader_expandable_tags_view_overflow_chip.xml b/WordPress/src/main/res/layout/reader_expandable_tags_view_overflow_chip.xml index 90754b506b61..43894b82f1ce 100644 --- a/WordPress/src/main/res/layout/reader_expandable_tags_view_overflow_chip.xml +++ b/WordPress/src/main/res/layout/reader_expandable_tags_view_overflow_chip.xml @@ -6,5 +6,4 @@ android:layout_height="wrap_content" android:checkable="true" android:text="@string/reader_expandable_tags_view_overflow_indicator_collapse_title" - app:rippleColor="@color/on_surface_disabled_transparent_selector" style="@style/ReaderExpandableTagsViewChip" /> diff --git a/WordPress/src/main/res/layout/reader_expandable_tags_view_overflow_chip_new.xml b/WordPress/src/main/res/layout/reader_expandable_tags_view_overflow_chip_new.xml deleted file mode 100644 index fb125ec1724d..000000000000 --- a/WordPress/src/main/res/layout/reader_expandable_tags_view_overflow_chip_new.xml +++ /dev/null @@ -1,9 +0,0 @@ - - diff --git a/WordPress/src/main/res/layout/reader_fragment_post_detail.xml b/WordPress/src/main/res/layout/reader_fragment_post_detail.xml index 094d497c93e7..9423149afb78 100644 --- a/WordPress/src/main/res/layout/reader_fragment_post_detail.xml +++ b/WordPress/src/main/res/layout/reader_fragment_post_detail.xml @@ -162,7 +162,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" - tools:layout="@layout/reader_include_post_detail_footer_new" /> + tools:layout="@layout/reader_include_post_detail_footer" /> diff --git a/WordPress/src/main/res/layout/reader_post_detail_header_view_new.xml b/WordPress/src/main/res/layout/reader_post_detail_header_view.xml similarity index 100% rename from WordPress/src/main/res/layout/reader_post_detail_header_view_new.xml rename to WordPress/src/main/res/layout/reader_post_detail_header_view.xml diff --git a/WordPress/src/main/res/layout/reader_site_header_view_new.xml b/WordPress/src/main/res/layout/reader_site_header_view.xml similarity index 100% rename from WordPress/src/main/res/layout/reader_site_header_view_new.xml rename to WordPress/src/main/res/layout/reader_site_header_view.xml diff --git a/WordPress/src/main/res/layout/reader_tag_header_view.xml b/WordPress/src/main/res/layout/reader_tag_header_view.xml index 9a1b91a6b0a2..01ed19db8532 100644 --- a/WordPress/src/main/res/layout/reader_tag_header_view.xml +++ b/WordPress/src/main/res/layout/reader_tag_header_view.xml @@ -1,10 +1,9 @@ - @@ -12,29 +11,25 @@ android:id="@+id/layout_tag_info" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingStart="@dimen/reader_tag_header_horizontal_padding" - android:paddingEnd="@dimen/reader_tag_header_horizontal_padding" - android:paddingTop="@dimen/reader_tag_header_vertical_padding" - android:paddingBottom="@dimen/reader_tag_header_vertical_padding"> + android:padding="@dimen/margin_extra_large"> + tools:text="Lorem ipsum dolor sit amet" /> - - - - - - - - - - - - - diff --git a/WordPress/src/main/res/values/reader_styles.xml b/WordPress/src/main/res/values/reader_styles.xml index f9aea6b3e587..85f838e4de5a 100644 --- a/WordPress/src/main/res/values/reader_styles.xml +++ b/WordPress/src/main/res/values/reader_styles.xml @@ -423,21 +423,7 @@ @color/reader_interest_filter_chip_ripple_selector - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - -