Skip to content

Commit a7ed663

Browse files
author
Iain Connor
committed
Fixed upating of header footer views
1 parent 2222ab3 commit a7ed663

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

library/src/main/java/com/tippingcanoe/dewey/Dewey.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,5 +243,6 @@ public void remeasureItemWidth() {
243243
((DeweyLayoutManager) getLayoutManager()).updateUniformCellWidth();
244244
forceLayout();
245245
requestLayout();
246+
deweyDecorator.forceUpdateLayout();
246247
}
247248
}

library/src/main/java/com/tippingcanoe/dewey/DeweyDecorator.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ public void onItemRangeMoved(int fromPosition, int toPosition, int itemCount) {
111111
});
112112
}
113113

114+
protected void forceUpdateLayout() {
115+
headerView = footerView = null;
116+
updateLayout();
117+
}
118+
114119
@SuppressWarnings("unchecked")
115120
protected void updateLayout () {
116121
if ( adapter.getItemCount() > 3 ) {
@@ -193,10 +198,10 @@ protected void measureView ( View view ) {
193198
}
194199

195200
protected int getWidthForView ( View view ) {
196-
if ( view.getLayoutParams().width != ViewGroup.LayoutParams.MATCH_PARENT && view.getLayoutParams().width != ViewGroup.LayoutParams.WRAP_CONTENT ) {
197-
return view.getLayoutParams().width;
198-
} else if ( ((DeweyLayoutManager) dewey.getLayoutManager()).getForcedCellWidth() > 0 ) {
201+
if ( ((DeweyLayoutManager) dewey.getLayoutManager()).getForcedCellWidth() > 0 ) {
199202
return ((DeweyLayoutManager) dewey.getLayoutManager()).getForcedCellWidth();
203+
} else if ( view.getLayoutParams().width != ViewGroup.LayoutParams.MATCH_PARENT && view.getLayoutParams().width != ViewGroup.LayoutParams.WRAP_CONTENT ) {
204+
return view.getLayoutParams().width;
200205
}
201206

202207
return 0;

0 commit comments

Comments
 (0)