-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
β¦or traditional views
assetImageView.isVisible = assetType == TYPE_SMALL_ICON || assetType == TYPE_LARGE_ICON | ||
} | ||
|
||
fun setAssetType(@AssetType type: Int) { | ||
fun setAssetType(@AssetType type: Int, dimensions: ImageDimensions? = null) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added 396f739
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Update also the READMEs that we have for each component |
<attr name="listRowAssetHeight" format="integer"> | ||
<enum name="undefined" value="64" /> | ||
</attr> | ||
<attr name="listRowAssetWidth" format="integer"> | ||
<enum name="undefined" value="64" /> |
There was a problem hiding this comment.
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"
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
π± New catalog for testing generated: Download |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice job π
ποΈ 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:
βοΈ Checks
π§ͺ How can I test this?
Traditional views:
Compose: