Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
xueliang1 committed Mar 16, 2018
1 parent 9f62469 commit 7017949
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '26.0.2'
}

dependencies {
Expand All @@ -30,5 +31,4 @@ dependencies {
implementation project(':leftsection')
implementation 'com.github.bumptech.glide:glide:4.6.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ protected void onCreate(Bundle savedInstanceState) {

List<ImageInfo> list = new ArrayList<>();
list.add(new ImageInfo(true, "图组1"));
list.add(new ImageInfo(false, "图组1"));
list.add(new ImageInfo(false, "图组1"));

list.add(new ImageInfo(true, "图组2"));
list.add(new ImageInfo(false, "图组1"));
list.add(new ImageInfo(false, "图组1"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,17 @@ public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
if (isC) {
for (int i1 = position + 1; i1 < adapter.getItemCount(); i1++) {
if (adapter.getItem(i1).isSection()) {
int index = i1 - firstVisibleItem - 1;
if (index < 0) {
index = 0;
}
if (index <= lastVisibleItem) {
bottom = parent.getChildAt(index).getBottom() + dex4S;

View view = parent.getLayoutManager().findViewByPosition(i1 - 1);
if (view != null) {
bottom = view.getBottom() + dex4S;
}
if (bottom < top&&bottom!=0) {
bottom = parent.getChildAt(index + 1).getBottom() + dex4S;

if (bottom < top && bottom != 0) {
view = parent.getLayoutManager().findViewByPosition(i1);
if (view != null) {
bottom = view.getBottom() + dex4S;
}
}

break;
Expand All @@ -205,7 +207,6 @@ public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {

Rect rect = new Rect(left, top, right, bottom);


RectF rectF = new RectF(rect);
c.drawRect(rectF, paint);

Expand Down Expand Up @@ -250,7 +251,7 @@ public void getItemOffsets(Rect outRect, View view, RecyclerView parent, Recycle
int top = 0;
int left = 0;
int right = 0;
if (position > 0 && adapter.getItem(position - index).isSection()) {
if (adapter.getItem(position - index).isSection()) {
top = (int) this.decTopMargin;
}

Expand Down

0 comments on commit 7017949

Please sign in to comment.