Skip to content

LayoutItemType.getLayoutID() should by LayoutItemType.getViewType() #44

@MarcusWolschon

Description

@MarcusWolschon

LayoutItemType
must implement a "fun getLayoutID() : Int".

a)
Most of the time, it is not used as a layout ID but just as a convenient value for itemViewType
b)
Hardcoding layout IDs prevents the use of ViewBinding to instantiate layouts.

Instead we could give the TreeViewBinder a function to instantiate a new view
with a default implementation that inflates a layout.

This way the provideViewHolder() method can be given a view of a specific type and thus increase type safety and null safety.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions