Hi, anyone here has idea on when this issue will b...
# android
w
Hi, anyone here has idea on when this issue will be fixed? We are planning on modularise our app but found kotlin android extension doesn’t support multi modules yet.
p
I’ve modularized my app few weeks ago and using kotlin-extension without any issues
I’ve probably never faced this issue because I’m creating custom views for my common layouts
by doing so, I’m not facing include limitation when I’d like to add custom attributes to my view
and I can easily create localized and common view logic inside these custom views 🙂
w
oh great. Have you experienced using the view imports like
kotlinx.android.synthetic
when the view is in library?
p
not really. I wasn’t sure if caching was working and was wishing to create an easy-to use API for my custom views while hiding implementation details like IDs. So I’ve created something like: library XML:
Copy code
<merge xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    tools:parentTag="io.zla.android.ui.widget.UserHeadersView">

    <TextView
        android:id="@+id/userCoverImage"
        ...>
Custom view in library:
Copy code
class UserHeadersView @JvmOverloads constructor(
        context: Context,
        attrs: AttributeSet? = null,
        defStyle: Int = 0
) : ShimmerLayout(context, attrs, defStyle) {

    init {
        context.layoutInflater.inflate(R.layout.layout_user_headers, this)
    }

    val coverImage: TextView = findViewById(R.id.userCoverImage)
Layout in app:
Copy code
<my.package.UserHeadersView
    android:id="@+id/myUserHeadersView"
Client in app:
Copy code
myUserHeadersView.coverImage.setDrawableXXX(....)
That’s a basic example. Actually I’ve created other nice functions allowing me to just provide coverUrl and other fields and custom view is doing the boring work (use Picasso, data validation, etc)