dingyi222666 / TreeView

An Android TreeView with RecyclerView
Apache License 2.0
105 stars 9 forks source link

Support Leaf of different type than Branch #5

Closed shervinkoushan closed 1 year ago

shervinkoushan commented 1 year ago

Hi,

Thank you for creating this great library!

Is there a reason the data in a Leaf has to have the same type as the Branch?

fun <T : Any> DataSourceScope<T>.Leaf(
    name: String,
    data: T? = null
)
dingyi222666 commented 1 year ago

A possible suggestion is to create a common parent type.... In my use case, for example, displaying a file list, data are all File, so they are the same type. So can you describe your use case scenario?

shervinkoushan commented 1 year ago

I have a folder structure with items inside. Click on folder -> Go to folder view Click on item -> Go to item details

So they have some different fields. But creating a common parent type should be fine!