Skip to content

Conversation

@jeprubio
Copy link
Contributor

@jeprubio jeprubio commented Jan 8, 2026

🥅 What's the goal?

Update MediaCard so that it also handles imagePosition to left and right.

Specs:
https://www.figma.com/design/tKdPOfcUALzVIh5oizFbm7/%F0%9F%94%B8-Cards-Specs?node-id=11252-17819&t=07VsJqXhuGmrwcIq-4

Examples:
https://www.figma.com/design/WCkDDzlXE16R6yXaljxddj/M%C3%ADstica-Mobile?node-id=54711-14370&t=v3KwV70ZvdIgGul4-4

🚧 How do we do it?

  • Add the imagePosition parameter to MediaCard.
  • Add imageContentScale parameter to MediaCard.
  • Add screenshot tests and a placeholder image for the tests and previews.

☑️ Checks

  • I updated the documentation, including readmes and wikis. If this is a breaking change, tag the PR with "Breaking Change" label and remember to include breaking change migration guide in release notes where this version is released.
  • Tested with dark mode.
  • Tested with API 24.
  • Sync done with iOS team for this feature to ensure alignment, if applies.
  • Accessibility considerations.

🧪 How can I test this?

  • 🖼️ Screenshots/Videos
Before After
Before.mov
After.mov
  • Mistica App QR or download link ([Firebase] 📱 New catalog for testing generated comment)
  • Reviewed by Mistica design team (added mistica-design to reviewers)

Comment on lines -244 to -246
private fun applyLinkTextFix(text: String): String {
return text.padEnd(18, ' ')
}
Copy link
Contributor Author

@jeprubio jeprubio Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to an extension and reused in the MediaCard

CardActions(primaryButton, linkButton)
}
}
MediaCardImagePosition.Left -> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New Left image position

}
}
}
MediaCardImagePosition.Right -> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right image position

sealed class MediaCardImage(val contentDescription: String?) {
class MediaCardImageResource(@DrawableRes val imageRes: Int, contentDescription: String? = null) : MediaCardImage(contentDescription)
class MediaCardImageBitmap(val imageBitmap: ImageBitmap, contentDescription: String? = null) : MediaCardImage(contentDescription)
public sealed class MediaCardImage(public val contentDescription: String?) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added public visibility explicitely

public class MediaCardImageBitmap(public val imageBitmap: ImageBitmap, contentDescription: String? = null) : MediaCardImage(contentDescription)
}

public enum class MediaCardImagePosition {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New enum for the image position

@Telefonica Telefonica deleted a comment from github-actions bot Jan 8, 2026
@Telefonica Telefonica deleted a comment from github-actions bot Jan 8, 2026
@Telefonica Telefonica deleted a comment from github-actions bot Jan 8, 2026
Comment on lines +43 to +44
imagePosition: MediaCardImagePosition = MediaCardImagePosition.Top,
imageContentScale: ContentScale = ContentScale.Crop,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New parameters to MediaCard

@Telefonica Telefonica deleted a comment from github-actions bot Jan 8, 2026
@Telefonica Telefonica deleted a comment from github-actions bot Jan 8, 2026
}
linkButton?.let {
Button(
modifier = if (primaryButton == null) Modifier.offset(x = (-8).dp) else Modifier,
Copy link
Contributor Author

@jeprubio jeprubio Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now we can use invalidatePaddings and invalidateMinWidth so the offset(x = (-8).dp) hack is no longer needed.

@jeprubio jeprubio marked this pull request as ready for review January 8, 2026 11:47
@jeprubio jeprubio requested a review from Copilot January 8, 2026 11:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the MediaCard component to support left and right image positioning in addition to the existing top position, aligning with updated design specifications.

Key Changes

  • Added imagePosition parameter to MediaCard to control image placement (Top, Left, Right)
  • Added imageContentScale parameter to allow customization of image scaling behavior
  • Extracted link text padding utility function to shared location for reuse across card components

Reviewed changes

Copilot reviewed 6 out of 31 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
MediaCard.kt Added image position variants with different layouts and made API classes public
Card.kt Enhanced to support vertical button orientation and configurable padding for flexible layouts
HighLightedCard.kt Refactored to use shared link text padding utility
TextUtils.kt Added shared utility function for link text padding
MediaCardTest.kt Added comprehensive parameterized tests for all image positions and button combinations
MediaCards.kt Updated catalog demo to include image position selector

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jeprubio jeprubio requested review from a team and neo-sagittal and removed request for a team January 8, 2026 11:58
@jeprubio jeprubio requested review from a team, juangardi21 and yceballost and removed request for a team January 8, 2026 12:00
@github-actions
Copy link

github-actions bot commented Jan 8, 2026

[Firebase] 📱 New catalog for testing generated:
Download from Firebase
Download from App Tester

@Telefonica Telefonica deleted a comment from github-actions bot Jan 8, 2026
@jeprubio jeprubio removed the request for review from neo-sagittal January 8, 2026 12:08
CardImage(
mediaCardImage = image,
modifier = Modifier
.width(150.dp)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be this mediaCardImage width extracted to a const val?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure 687c1f5

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be implemented in xml too? Also media card readme should be updated

Copy link
Contributor Author

@jeprubio jeprubio Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think xml can be done in a different task if needed as we did lately in other tasks like when applying accessibility in views and in compose separately.

Also, doing it in xml when we know for sure we won't need this as we do everything new in compose I'm not sure it makes sense. It would probably never be needed/used by anybody.

I've added a couple of images to the readme and improved that README.md

Copy link
Contributor

@pmartinbTEF pmartinbTEF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! just a couple of questions

@Telefonica Telefonica deleted a comment from github-actions bot Jan 9, 2026
@Telefonica Telefonica deleted a comment from github-actions bot Jan 9, 2026
@jeprubio jeprubio requested a review from pmartinbTEF January 9, 2026 10:35
@github-actions
Copy link

github-actions bot commented Jan 9, 2026

[Firebase] 📱 New catalog for testing generated:
Download from Firebase
Download from App Tester

Copy link
Contributor

@juangardi21 juangardi21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice job!

Copy link
Contributor

@pmartinbTEF pmartinbTEF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@github-actions
Copy link

[Firebase] 📱 New catalog for testing generated:
Download from Firebase
Download from App Tester

@jeprubio jeprubio requested review from a team and AnaMontes11 and removed request for a team and yceballost January 12, 2026 15:41
Copy link

@AnaMontes11 AnaMontes11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jeprubio jeprubio merged commit 4626b3f into main Jan 12, 2026
4 checks passed
@jeprubio jeprubio deleted the feature/ANDROID-17239-MediaCardImagePosition branch January 12, 2026 16:39
@jeprubio jeprubio changed the title ANDROID-17239 MediaCard imagePosition left/right ANDROID-17239 Compose MediaCard imagePosition left/right Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants