Skip to content
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

Adding an overridable method BaseNodeViewFactory.getViewType with default implementation returning the tree node level #53

Merged

Conversation

TomasJohansson
Copy link
Contributor

The method TreeViewAdapter.getItemViewType then uses BaseNodeViewFactory.getViewType instead of always having to return the tree node level.
Then the client code can use something else than the tree node level for selecting the Binder and its layout file.

See also issue 25 when this kind of feature was requested.
#25

Screenshot for a sample app where all items are displayed with the same binder and layout file
EXCEPT for one specific binder and layout file for Stockholm, i.e. the yellow item in the screenshot below.
sample_with_geographic_areas_getViewType

Here is the code using the getViewType method in the sample app for the above screnshot:
TomasJohansson@6992917#diff-effcb19dc75b5646f230694a17d35433

…lementation returning the treenode level.

It is now used from 'TreeViewAdapter.TreeViewAdapter' which previously always returned the treenode level,
but now the behaviour can be overridden since client code provides an instance of 'BaseNodeViewFactory' to the constructor of 'TreeView'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants