Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANDROID-14098 set asset dimensions #322

Merged
merged 8 commits into from
Dec 19, 2023

Conversation

jeprubio
Copy link
Contributor

@jeprubio jeprubio commented Dec 18, 2023

🎟️ Jira ticket

ANDROID-14098

πŸ₯… What's the goal?

Be able to set asset dimensions in ListRow.

🚧 How do we do it?

Trying not to add breaking changes:

  • Add TYPE_IMAGE_ROUNDED and the possibility to set the dimensions in the traditional views version -> 8ce1102
  • Add ImageAsset to compose ListRowIcon to accept different sizes -> 68ee6ec

β˜‘οΈ Checks

  • I updated the documentation, including readmes and wikis. If this is a breaking change, update UPGRADING.md to inform users how to proceed. If no updates are necessary, indicate so.
  • Tested with dark mode.
  • Tested with API 23.

πŸ§ͺ How can I test this?

Traditional views:
TraditionalViews
Compose:
Compose

  • Mistica App QR or download link
  • Reviewed by Mistica design team
  • ...

@jeprubio jeprubio marked this pull request as ready for review December 18, 2023 16:53
@jeprubio jeprubio requested review from a team, yamal-alm, pmartinbTEF and jeslat and removed request for a team and pmartinbTEF December 18, 2023 16:53
assetImageView.isVisible = assetType == TYPE_SMALL_ICON || assetType == TYPE_LARGE_ICON
}

fun setAssetType(@AssetType type: Int) {
fun setAssetType(@AssetType type: Int, dimensions: ImageDimensions? = null) {
Copy link
Contributor

@dpastor dpastor Dec 18, 2023

Choose a reason for hiding this comment

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

Appart from programatic configuration we expose also configurable elements with xml attributes. Check ListRowView styleable in attrs_components.xml to add new asset type enum and height/width attributes. Ideally if databinding method matches attribute definition behaviour, its better, so there's no difference in the usage when using databinding and when not.

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, I forgot doing that, I'll do that now. Thanks!

Copy link
Contributor Author

@jeprubio jeprubio Dec 19, 2023

Choose a reason for hiding this comment

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

Added 396f739
Screenshot 2023-12-19 at 10 15 14
Screenshot 2023-12-19 at 10 17 07

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it working the binding method with this new parameter? Or is it just ignored because is nullable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That one of the fun setAssetType will be null with binding and there are the other two of setAssetHeight and setAssetWidth to set the dimensions. That param is in order to use it when creating the element programmatically, but can be changed, it was thought as a shortcut.

@jeslat
Copy link
Contributor

jeslat commented Dec 19, 2023

Update also the READMEs that we have for each component

@jeprubio jeprubio requested a review from dpastor December 19, 2023 09:22
@Telefonica Telefonica deleted a comment from github-actions bot Dec 19, 2023
@Telefonica Telefonica deleted a comment from github-actions bot Dec 19, 2023
@Telefonica Telefonica deleted a comment from github-actions bot Dec 19, 2023
@Telefonica Telefonica deleted a comment from github-actions bot Dec 19, 2023
Comment on lines 74 to 78
<attr name="listRowAssetHeight" format="integer">
<enum name="undefined" value="64" />
</attr>
<attr name="listRowAssetWidth" format="integer">
<enum name="undefined" value="64" />
Copy link
Contributor

Choose a reason for hiding this comment

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

should these attrs be of type "dimension" in case someone uses them as follows?

listRowAssetWidth="@dimen/some_width"

Copy link
Contributor

@jeslat jeslat Dec 19, 2023

Choose a reason for hiding this comment

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

+1, I think it should be dimension to avoid putting just a raw number, we should use dp

Copy link
Contributor Author

@jeprubio jeprubio Dec 19, 2023

Choose a reason for hiding this comment

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

Yup, I can do this now. Good shout.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, both in 1c1ee2b

import com.telefonica.mistica.R

@RunWith(RobolectricTestRunner::class)
internal class ListRowItemKtTest: ScreenshotsTest() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, why that Kt in the middle of the class name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When you create a test with Android Studio it creates them this way sometimes, I'm not sure which rules does it follow. I can remove that if you want.

@Telefonica Telefonica deleted a comment from github-actions bot Dec 19, 2023
@Telefonica Telefonica deleted a comment from github-actions bot Dec 19, 2023
@jeprubio jeprubio requested a review from jeslat December 19, 2023 15:43
@jeprubio jeprubio requested a review from yamal-alm December 19, 2023 15:43
Copy link

πŸ“± New catalog for testing generated: Download

Copy link
Contributor

@jeslat jeslat left a comment

Choose a reason for hiding this comment

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

🌭

Copy link
Contributor

@yamal-alm yamal-alm left a comment

Choose a reason for hiding this comment

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

nice job πŸ‘

@jeprubio jeprubio merged commit 28222a0 into main Dec 19, 2023
5 checks passed
@jeprubio jeprubio deleted the feature/ANDROID-14098-SetAssetDimensions branch December 19, 2023 16:10
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.

4 participants