-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Open
Labels
Description
Description: The Catalog example MultiSectionListDemo crashes in case we define a SubHeader item or multiple CustomList items at the top of the overall list. The example is currently only working in case there is one single item at the first position, but there are further use cases than that, as just mentioned.
Minimal sample app repro: In the Catalog demo....
- Open file
MultiSectionListDemoFragment.java - Go to line 54
- Between lines 54 and 55, insert
data.add(new CustomListItemData("Subheader TEST")); - Final code snippet as of line 53:
List<CustomListItemData> data = new ArrayList<>();
int itemCount = 0;
data.add(new CustomListItemData("Subheader TEST"));
data.add(
new CustomListItemData(
String.format(view.getContext().getString(R.string.cat_list_item_text), 0), 0, 1));
This will make the app crashing due to a type cast error in onBindViewHolder. Probably, because the view type cannot be correctly derived as the index is missing.
The app is crashing as well if you add e.g. the following at the first position:
for (int i = 0; i < 3; i++) {
data.add(
new CustomListItemData(
String.format( view.getContext().getString(R.string.cat_list_item_text), itemCount + i), i,3));
}
Android API version: 16
Material Library version: 1.14.0-alpha08
Device: Google Pixel 9 Pro