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

Update StickyListHeadersListView.java #350

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -303,16 +303,25 @@ private void updateOrClearHeader(int firstVisiblePosition) {
}
}

// It is not a mistake to call getFirstVisiblePosition() here.
// It is not a mistake to call getFirstVisiblePosition() here.
// Most of the time getFixedFirstVisibleItem() should be called
// but that does not work great together with getChildAt()
final boolean doesListHaveChildren = mList.getChildCount() != 0;
final boolean isFirstViewBelowTop = doesListHaveChildren
&& mList.getFirstVisiblePosition() == 0
&& mList.getChildAt(0).getTop() >= stickyHeaderTop();
// final boolean isFirstViewBelowTop = doesListHaveChildren
// && mList.getFirstVisiblePosition() == 0
// && mList.getChildAt(0).getTop() >= stickyHeaderTop();
final boolean isHeaderPositionOutsideAdapterRange = headerPosition > adapterCount - 1
|| headerPosition < 0;
if (!doesListHaveChildren || isHeaderPositionOutsideAdapterRange || isFirstViewBelowTop) {


// if (!doesListHaveChildren || isHeaderPositionOutsideAdapterRange || isFirstViewBelowTop) {
// clearHeader();
// return;
// }

//解决一屏的最后一个item删除的时候,header变为空白的bug
//Solve the last item deletion of one screen at a time when the header into the blank bug
if (!doesListHaveChildren || isHeaderPositionOutsideAdapterRange) {
clearHeader();
return;
}
Expand Down