Last active
June 15, 2020 18:57
-
-
Save pranay1494/8c69a627359783960dd700fece3899f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onSectionClicked(entity: Sections, absolutePosition: Int) { | |
if (viewModel.orignalSectionList.size <= 1) return | |
val mainAdapter = adapterWrapper.getMainAdapter() | |
adapterWrapper.swapAdapter() | |
viewModel.sectionList.forEachIndexed { index, section -> | |
val nestedSelectHeaderAdapter = NestedSelectHeaderAdapter(section, this@NestedFilterViewFragment) | |
mainAdapter.addAdapter(nestedSelectHeaderAdapter) | |
if (entity.sectionIndex == index && section.isSelected) { | |
addAdapterToMergeAdapter(section, index + 1) | |
} | |
} | |
adapterWrapper.refreshAdapters() | |
} | |
private fun addAdapterToMergeAdapter(element: Sections, elementPosition: Int) { | |
adapterWrapper.addAdapterAt( | |
elementPosition, | |
FilterSelectionAdapter( | |
element.items.toMutableList(), | |
element.isMultiSelectEnabled | |
).apply { | |
setComponentInteractionListener(this@NestedFilterViewFragment) | |
} | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment