Skip to content

Commit 1669f28

Browse files
author
Chris Banes
committed
Fix Refreshing on ListView when using a Header Background
1 parent 3553b4a commit 1669f28

2 files changed

Lines changed: 33 additions & 2 deletions

File tree

library/src/com/handmark/pulltorefresh/library/PullToRefreshListView.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ void onRefreshing(final boolean doScroll) {
105105
}
106106

107107
// Hide our original Loading View
108-
origLoadingView.setVisibility(View.INVISIBLE);
108+
origLoadingView.reset();
109+
origLoadingView.hideAllViews();
109110

110111
// Make sure the opposite end is hidden too
111112
oppositeListViewLoadingView.setVisibility(View.GONE);
@@ -169,7 +170,7 @@ void onReset() {
169170
if (listViewLoadingLayout.getVisibility() == View.VISIBLE) {
170171

171172
// Set our Original View to Visible
172-
originalLoadingLayout.setVisibility(View.VISIBLE);
173+
originalLoadingLayout.showInvisibleViews();
173174

174175
// Hide the ListView Header/Footer
175176
listViewLoadingLayout.setVisibility(View.GONE);

library/src/com/handmark/pulltorefresh/library/internal/LoadingLayout.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,36 @@ public final void adjustWidthUsingRightPadding(final int width) {
192192
getPaddingBottom());
193193
}
194194

195+
public final void hideAllViews() {
196+
if (View.VISIBLE == mHeaderText.getVisibility()) {
197+
mHeaderText.setVisibility(View.INVISIBLE);
198+
}
199+
if (View.VISIBLE == mHeaderProgress.getVisibility()) {
200+
mHeaderProgress.setVisibility(View.INVISIBLE);
201+
}
202+
if (View.VISIBLE == mHeaderImage.getVisibility()) {
203+
mHeaderImage.setVisibility(View.INVISIBLE);
204+
}
205+
if (View.VISIBLE == mSubHeaderText.getVisibility()) {
206+
mSubHeaderText.setVisibility(View.INVISIBLE);
207+
}
208+
}
209+
210+
public final void showInvisibleViews() {
211+
if (View.INVISIBLE == mHeaderText.getVisibility()) {
212+
mHeaderText.setVisibility(View.VISIBLE);
213+
}
214+
if (View.INVISIBLE == mHeaderProgress.getVisibility()) {
215+
mHeaderProgress.setVisibility(View.VISIBLE);
216+
}
217+
if (View.INVISIBLE == mHeaderImage.getVisibility()) {
218+
mHeaderImage.setVisibility(View.VISIBLE);
219+
}
220+
if (View.INVISIBLE == mSubHeaderText.getVisibility()) {
221+
mSubHeaderText.setVisibility(View.VISIBLE);
222+
}
223+
}
224+
195225
public final void onPull(float scaleOfLayout) {
196226
if (!mUseIntrinsicAnimation) {
197227
onPullImpl(scaleOfLayout);

0 commit comments

Comments
 (0)