Skip to content
This repository was archived by the owner on Jul 7, 2019. It is now read-only.

Commit fc55627

Browse files
authored
Merge pull request #32 from zhukic/1.2.3
1.2.3
2 parents 77383d9 + 44456c5 commit fc55627

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The Gradle dependency is available via [jCenter](https://bintray.com/zhukic/mave
1212

1313
Add this to your `build.gradle` file.
1414
```gradle
15-
implementation 'com.github.zhukic:sectioned-recyclerview:1.2.2'
15+
implementation 'com.github.zhukic:sectioned-recyclerview:1.2.3'
1616
```
1717

1818
# How it works

sectioned-recyclerview/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apply plugin: 'com.android.library'
33
ext {
44
PUBLISH_GROUP_ID = 'com.github.zhukic'
55
PUBLISH_ARTIFACT_ID = 'sectioned-recyclerview'
6-
PUBLISH_VERSION = '1.2.2'
6+
PUBLISH_VERSION = '1.2.3'
77
}
88

99
android {

sectioned-recyclerview/src/main/java/com/zhukic/sectionedrecyclerview/SectionManager.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -949,11 +949,12 @@ NotifyResult onItemInserted(int itemPosition) {
949949
int sectionIndex(@IntRange(from = 0, to = Integer.MAX_VALUE) int adapterPosition) {
950950
int sectionIndex = 0;
951951

952-
for (Section section : sections) {
952+
for (int i = 0; i < sections.size(); i++) {
953+
final Section section = sections.get(i);
953954
if (adapterPosition == section.getSubheaderPosition()) {
954-
return sections.indexOf(section);
955+
return i;
955956
} else if (adapterPosition > section.getSubheaderPosition()) {
956-
sectionIndex = sections.indexOf(section);
957+
sectionIndex = i;
957958
}
958959
}
959960

@@ -1081,14 +1082,14 @@ private Section getLastSection() {
10811082
private int sectionIndexByItemPosition(@IntRange(from = 0, to = Integer.MAX_VALUE) int itemPosition) {
10821083
int itemCount = 0;
10831084

1084-
for (Section section : sections) {
1085+
for (int i = 0; i < sections.size(); i++) {
1086+
final Section section = sections.get(i);
10851087

10861088
itemCount += section.getItemCount();
10871089

10881090
if (itemCount > itemPosition) {
1089-
return sections.indexOf(section);
1091+
return i;
10901092
}
1091-
10921093
}
10931094

10941095
return sections.size() - 1;

0 commit comments

Comments
 (0)