mirror of
https://github.com/Tencent/QMUI_Android.git
synced 2026-10-17 04:31:16 +08:00
feat: QMUIStickySectionAdapter findPosition return itemIndex
This commit is contained in:
@@ -13,7 +13,7 @@ object Dep {
|
||||
|
||||
object QMUI {
|
||||
const val group = "com.qmuiteam"
|
||||
const val qmuiVer = "2.1.0.25"
|
||||
const val qmuiVer = "2.1.0.26"
|
||||
const val archVer = "2.1.0.4"
|
||||
const val typeVer = "0.1.0.8"
|
||||
|
||||
|
||||
@@ -503,11 +503,11 @@ public abstract class QMUIStickySectionAdapter<
|
||||
}
|
||||
int itemIndex = getItemIndex(i);
|
||||
if (itemIndex == ITEM_INDEX_SECTION_HEADER) {
|
||||
if (positionFinder.find(section, null)) {
|
||||
if (positionFinder.find(section, null, -1)) {
|
||||
return i;
|
||||
}
|
||||
} else if (itemIndex >= 0) {
|
||||
if (positionFinder.find(section, section.getItemAt(itemIndex))) {
|
||||
if (positionFinder.find(section, section.getItemAt(itemIndex), itemIndex)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -519,12 +519,12 @@ public abstract class QMUIStickySectionAdapter<
|
||||
loop:
|
||||
for (int i = 0; i < mCurrentData.size(); i++) {
|
||||
QMUISection<H, T> section = mCurrentData.get(i);
|
||||
if (positionFinder.find(section, null)) {
|
||||
if (positionFinder.find(section, null, -1)) {
|
||||
targetSection = section;
|
||||
break;
|
||||
}
|
||||
for (int j = 0; j < section.getItemCount(); j++) {
|
||||
if (positionFinder.find(section, section.getItemAt(j))) {
|
||||
if (positionFinder.find(section, section.getItemAt(j), j)) {
|
||||
targetSection = section;
|
||||
targetItem = section.getItemAt(j);
|
||||
boolean isFold = section.isFold();
|
||||
@@ -751,7 +751,7 @@ public abstract class QMUIStickySectionAdapter<
|
||||
* @param item
|
||||
* @return
|
||||
*/
|
||||
boolean find(@NonNull QMUISection<H, T> section, @Nullable T item);
|
||||
boolean find(@NonNull QMUISection<H, T> section, @Nullable T item, int itemIndex);
|
||||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
+1
-1
@@ -202,7 +202,7 @@ public abstract class QDBaseSectionLayoutFragment extends BaseFragment {
|
||||
case 2: {
|
||||
int targetPosition = mAdapter.findPosition(new QMUIStickySectionAdapter.PositionFinder<SectionHeader, SectionItem>() {
|
||||
@Override
|
||||
public boolean find(@NonNull QMUISection<SectionHeader, SectionItem> section, @Nullable SectionItem item) {
|
||||
public boolean find(@NonNull QMUISection<SectionHeader, SectionItem> section, @Nullable SectionItem item, int itemIndex) {
|
||||
return "header 4".equals(section.getHeader().getText()) && (item != null && "item 13".equals(item.getText()));
|
||||
}
|
||||
}, true);
|
||||
|
||||
Reference in New Issue
Block a user