Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

Unable to provide our own PositionType within a section. #113

Open
rberends opened this issue Feb 12, 2020 · 0 comments
Open

Unable to provide our own PositionType within a section. #113

rberends opened this issue Feb 12, 2020 · 0 comments
Labels
new Describes the issue is reported recently and not reviewed by the maintainers

Comments

@rberends
Copy link

rberends commented Feb 12, 2020

Please complete the following information:

  • Android API level: [N/A]
  • Library Version: [3.0.0]
  • Recyclerview Version [N/A]

For our own Section implementation, which features a header, a ListSection and a footer, we would like the ability to customize PositionType for an itemPosition in a section. Unfortunately, those methods are currently not accessible within Sections, as they are limited in access to the package (package private).

image

Would it be possible to make getPositionType() and getCount() public, so we can have access to these methods and get the correct position data for our custom decorator?

An example in the existing HeaderSection class, where the header is taken into account:

  @Override int getPositionType(int itemPosition, int adapterPosition,
      RecyclerView.LayoutManager layoutManager) {
    int result = super.getPositionType(itemPosition, adapterPosition, layoutManager);
    if (itemPosition == 0 && getCount() > 1) {
      result = result ^ BOTTOM;
    } else if (itemPosition != 0 && (result & TOP) == TOP) {
      result = result ^ TOP;
    }
    return result;
  }

We would for example like the ability to override this behaviour and have our own values returned based on design/business logic, providing us with TOP, MIDDLE and LAST according to how we would divide a section.

@rberends rberends added the new Describes the issue is reported recently and not reviewed by the maintainers label Feb 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new Describes the issue is reported recently and not reviewed by the maintainers
Projects
None yet
Development

No branches or pull requests

1 participant