Giter VIP home page Giter VIP logo

Comments (20)

AcgnCodeMonkey avatar AcgnCodeMonkey commented on May 24, 2024 1

good,it is ok. @fondesa

from recycler-view-divider.

AcgnCodeMonkey avatar AcgnCodeMonkey commented on May 24, 2024

QQ截图20191023160611
left and right space also not equal.

from recycler-view-divider.

AcgnCodeMonkey avatar AcgnCodeMonkey commented on May 24, 2024

but if i use GridLayoutManager,those questions is ok.

from recycler-view-divider.

fondesa avatar fondesa commented on May 24, 2024

Interesting. Guess I found the problem calculating the group count of a StaggeredGridLayoutManager. Is your project open source so I can directly test my changes there? Otherwise I'll try to reproduce your layout

from recycler-view-divider.

AcgnCodeMonkey avatar AcgnCodeMonkey commented on May 24, 2024

Interesting. Guess I found the problem calculating the group count of a StaggeredGridLayoutManager. Is your project open source so I can directly test my changes there? Otherwise I'll try to reproduce your layout

sorry,my project is enterprise project,i think you can write a simple demo to test this bug

from recycler-view-divider.

fondesa avatar fondesa commented on May 24, 2024

Ok no problem, I'll keep you up-to-date

from recycler-view-divider.

AcgnCodeMonkey avatar AcgnCodeMonkey commented on May 24, 2024

Ok no problem, I'll keep you up-to-date

https://blog.csdn.net/qq_33373648/article/details/77584995
you can consult this blog.

from recycler-view-divider.

fondesa avatar fondesa commented on May 24, 2024

This PR should fix it: #37

from recycler-view-divider.

fondesa avatar fondesa commented on May 24, 2024

Update to 3.0.2 and feel free to reopen the issue if it's not solved for you yet.

from recycler-view-divider.

AcgnCodeMonkey avatar AcgnCodeMonkey commented on May 24, 2024

QQ截图20191024160247
QQ截图20191024160319
first page is normal,but second page is wrong

from recycler-view-divider.

AcgnCodeMonkey avatar AcgnCodeMonkey commented on May 24, 2024

@fondesa
this is a demo.
Demo.zip

from recycler-view-divider.

AcgnCodeMonkey avatar AcgnCodeMonkey commented on May 24, 2024

QQ截图20191024160319

from recycler-view-divider.

fondesa avatar fondesa commented on May 24, 2024

Ok thanks, I'll look into it

from recycler-view-divider.

fondesa avatar fondesa commented on May 24, 2024

@AcgnCodeMonkey I found the problem.
It's related to the internal usage of parent.getChildAdapterPosition(child) which, with StaggeredGridLayoutManager, doesn't match the position in which the item is rendered.

This will be harder than I thought to fix it since the "entire" library is based on the item's position.
Probably a solution would be to limit the position-dependent features of this library only for StaggeredGridLayoutManager.

from recycler-view-divider.

AcgnCodeMonkey avatar AcgnCodeMonkey commented on May 24, 2024

because my kotlin is careless,i try do it.

// val lineAccumulatedSpan = lm.getAccumulatedSpanInLine(spanSize, itemPosition, groupIndex)
var lineAccumulatedSpan = 0
if (parent.layoutManager is StaggeredGridLayoutManager) {
val params = view.layoutParams as StaggeredGridLayoutManager.LayoutParams
lineAccumulatedSpan = params.spanIndex % spanCount + 1
} else {
lineAccumulatedSpan = lm.getAccumulatedSpanInLine(spanSize, itemPosition, groupIndex)
}
and test result as follows :
QQ截图20191028153352
QQ截图20191028153447
i check most pages ,all page is right.
i think you can draw lessons from that.

from recycler-view-divider.

AcgnCodeMonkey avatar AcgnCodeMonkey commented on May 24, 2024

@fondesa

from recycler-view-divider.

fondesa avatar fondesa commented on May 24, 2024

@AcgnCodeMonkey Yes but this is not the problem. Your code works only if there's a basic configuration of the divider (e.g. all the dividers have the same size).
If the dividers have different configurations (e.g. they change the size based on groupIndex), the layout manager will render a wrong grid since the groupIndex isn't calculated right.

from recycler-view-divider.

fondesa avatar fondesa commented on May 24, 2024

@AcgnCodeMonkey I've probably found a good solution for it. I'm working on it.

from recycler-view-divider.

fondesa avatar fondesa commented on May 24, 2024

Here we go: #39

The problem was related to the item position.
Since StaggeredGridLayoutManager can change the position of the items without change their adapter positions, I had to add a partial support to it cause all the managers were currently based on groupIndex and groupCount. Now I added a list of managers not dependent to those two variables.
I checked your sample and it works.

from recycler-view-divider.

fondesa avatar fondesa commented on May 24, 2024

@AcgnCodeMonkey 3.1.0 out. Can you confirm it works?

from recycler-view-divider.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.