Skip to content

Redesign Reader post detail header for adaptive layout#22754

Draft
nbradbury wants to merge 23 commits intotrunkfrom
feature/CMM-2002-adaptive-post-details
Draft

Redesign Reader post detail header for adaptive layout#22754
nbradbury wants to merge 23 commits intotrunkfrom
feature/CMM-2002-adaptive-post-details

Conversation

@nbradbury
Copy link
Copy Markdown
Contributor

Description

Redesigns the Reader post detail header to support an adaptive layout with the following changes:

  • Featured image moved into header view — relocated from the collapsing toolbar to ReaderPostDetailHeaderView, below the title. Uses ShapeableImageView with rounded corners and supports tap-to-preview.
  • Portrait-aware image handling — new PortraitAwareCropTransformation for Glide that fits portrait images to height and centers horizontally with background fill, instead of cropping. Applied to both post cards and post detail.
  • Reading time — displays estimated reading time with a clock icon below the post title.
  • Redesigned blog section — author name and date shown on separate rows instead of inline with a dot separator.
  • Like/comment counts in header — interaction counts moved into the header view with theme-aware styling.
  • Excerpt display — post excerpt shown below the featured image when available.
  • Simplified toolbar — removed collapsing toolbar image behavior; toolbar icon colors are now applied once at init instead of on every scroll event.
  • Code cleanup — removed dead injections, inlined trivial delegations, and replaced ?attr/colorOnSurfaceVariant (Material3-only) with theme-compatible alternatives to fix a crash in reading preferences themes.

Testing instructions

Post detail header layout:

  1. Open the Reader tab and tap on any post
  2. Verify the post detail shows: blog avatar + name, author name on its own row, date on its own row, post title, reading time with clock icon, featured image (if present), excerpt (if present), like/comment counts
  • Layout renders correctly without crashes
  • Featured image tapping opens media preview

Portrait featured images:

  1. Find or create a post with a portrait (tall) featured image
  2. Open the post detail
  • Portrait image is fully visible (not cropped), centered horizontally with background fill
  1. Go back to the Reader feed
  • Post card also shows the portrait image fitted, not cropped

Reading preferences themes:

  1. Open a post detail, tap the reading preferences icon in the toolbar
  2. Switch between different themes (System, Soft, Sepia, Evening, OLED, etc.)
  • Post detail renders without crashes in all themes
  • Toolbar icons remain visible and correctly colored

nbradbury and others added 14 commits March 25, 2026 10:21
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Only use editorial.image, featured_image, or featured_media.uri
as featured image sources instead of scanning post content for
suitable images or videos.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reorder ConstraintLayout constraints so the visual hierarchy is:
blog header → featured image → title → excerpt → interactions → footer

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When a Reader post has a portrait featured image, the image is now
scaled to fit the container height and centered horizontally with a
gray background fill, instead of being center-cropped which often
cuts off heads and other important content.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move featured image from collapsing AppBar to inline in the header view
with adaptive aspect ratio. Restructure blog section so site name,
author, and date each appear on their own line with absolute date+time
format. Add reading time indicator and excerpt display to the header.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Extract Regex and date format constants in header UI state builder
- Replace verbose null-check patterns with setTextOrHide helper
- Hoist Paint allocation to class property in PortraitAwareCropTransformation
- Remove unnecessary list allocation in applyInteractionSectionTheme

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ibute

Replace ?attr/colorOnSurfaceVariant (Material3-only) with compatible
alternatives since the reading preferences ContextThemeWrapper uses
Theme.MaterialComponents.DayNight which lacks this attribute.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…stener

- Remove unused postDetailsHeaderViewUiStateBuilder injection from fragment
- Replace per-scroll toolbar coloring with one-time setup in initAppBar
- Inline trivial buildPostDetailsHeaderUiState delegation
- Remove unnecessary default values in ReaderFeaturedImageUiState

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dangermattic
Copy link
Copy Markdown
Collaborator

dangermattic commented Mar 27, 2026

2 Warnings
⚠️ View files have been modified, but no screenshot or video is included in the pull request. Consider adding some for clarity.
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.
1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Copy Markdown
Contributor

wpmobilebot commented Mar 27, 2026

App Icon📲 You can test the changes from this Pull Request in Jetpack Android by scanning the QR code below to install the corresponding build.

App NameJetpack Android
Build TypeDebug
Versionpr22754-4691444
Build Number1488
Application IDcom.jetpack.android.prealpha
Commit4691444
Installation URL2fa98ucff0nh0
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot
Copy link
Copy Markdown
Contributor

wpmobilebot commented Mar 27, 2026

App Icon📲 You can test the changes from this Pull Request in WordPress Android by scanning the QR code below to install the corresponding build.

App NameWordPress Android
Build TypeDebug
Versionpr22754-4691444
Build Number1488
Application IDorg.wordpress.android.prealpha
Commit4691444
Installation URL1k0s6oa07g7eo
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot
Copy link
Copy Markdown
Contributor

wpmobilebot commented Mar 27, 2026

🤖 Build Failure Analysis

This build has failures. Claude has analyzed them - check the build annotations for details.

nbradbury and others added 5 commits March 27, 2026 12:19
Replace HtmlCompat.fromHtml() with lighter HtmlUtils.fastStripHtml()
for word counting, fix detekt ReturnCount and checkstyle empty-line
violations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Chain blog name and author vertically against the avatar, add
marginStart with goneMarginStart so text aligns flush when there
is no avatar.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ptive-post-details

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
nbradbury and others added 4 commits March 27, 2026 13:18
Move blog name to top, post title second, avatar with author and
date below title, then featured image, blog description (up to 3
lines), and reading time.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Anchor dateline start directly to avatar so it stays positioned
when author name is hidden. Add barrier below blog name and follow
button so the post title clears both.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
findPost() excludes the text column for performance, so
shouldAddFeaturedImage() couldn't detect the image was already
in the post body HTML. Fetch with text column included when
returning from comments to preserve deduplication.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants