pocmo / recompose

recompose is a tool for converting Android layouts in XML to Kotlin code using Jetpack Compose.
Apache License 2.0
794 stars 49 forks source link

TextView: Add support for android:maxLines #74

Closed pocmo closed 4 years ago

pocmo commented 4 years ago

android:maxLines Makes the TextView be at most this many lines tall. When used on an editable text, the inputType attribute's value must be combined with the textMultiLine flag for the maxLines attribute to apply.

XML attribute: https://developer.android.com/reference/android/widget/TextView?hl=en#attr_android:maxLines

Jetpack Compose:

Text(
   ...
   maxLines = Int = Int.MAX_VALUE
   ...
)

We are parsing TextView here: https://github.com/pocmo/recompose/blob/main/recompose-parser/src/main/kotlin/recompose/parser/xml/view/TextView.kt

And create a TextViewNode from it: https://github.com/pocmo/recompose/blob/main/recompose-ast/src/main/kotlin/recompose/ast/view/TextViewNode.kt

And we turn the node into Kotlin code here: https://github.com/pocmo/recompose/blob/main/recompose-composer/src/main/kotlin/recompose/composer/visitor/ComposingVisitor.kt#L82-L94

To solve this issue:

anesabml commented 4 years ago

Can I work on this?

pocmo commented 4 years ago

Yep! Assigned. :)

jerryOkafor commented 4 years ago

I need one too. I have been following with curiosity and now I want to contribute.

pocmo commented 4 years ago

@jerryOkafor Maybe issue #73 to start? I'll make sure to file some more issues today. :)

jerryOkafor commented 4 years ago

Sure. I will work on it.