Skip to content

Commit 8c4e5df

Browse files
author
James O'Brien
committed
LayoutParams casting issue when recycling state
If the StaggeredGridView has a headerview but no content there will a casting exception when casting AbsListView.LayoutParams to StaggeredGridView.LayoutParams. This patch set confirms that the params are an instance of StaggeredGridView.LayoutParams before proceeding.
1 parent 84a06f8 commit 8c4e5df

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

library/src/main/java/com/etsy/android/grid/ExtendableListView.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2593,9 +2593,10 @@ private void clearRecycledState(ArrayList<FixedViewInfo> infos) {
25932593
if (infos == null) return;
25942594
for (FixedViewInfo info : infos) {
25952595
final View child = info.view;
2596-
final LayoutParams p = (LayoutParams) child.getLayoutParams();
2597-
if (p != null) {
2598-
p.recycledHeaderFooter = false;
2596+
final ViewGroup.LayoutParams p = child.getLayoutParams();
2597+
2598+
if (p instanceof LayoutParams) {
2599+
((LayoutParams) p).recycledHeaderFooter = false;
25992600
}
26002601
}
26012602
}

0 commit comments

Comments
 (0)