Skip to content

Commit

Permalink
clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
limuyang committed Jan 6, 2020
1 parent f3971a0 commit dedd998
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ import com.chad.library.adapter.base.provider.BaseItemProvider
import com.chad.library.adapter.base.provider.BaseNodeProvider
import com.chad.library.adapter.base.viewholder.BaseViewHolder

abstract class BaseNodeAdapter(data: MutableList<BaseNode>? = null)
: BaseProviderMultiAdapter<BaseNode>(data) {
abstract class BaseNodeAdapter(nodeList: MutableList<BaseNode>? = null)
: BaseProviderMultiAdapter<BaseNode>(null) {

private val fullSpanNodeTypeSet = HashSet<Int>()

init {
if (!data.isNullOrEmpty()) {
val flatData = flatData(data)
data.clear()
data.addAll(flatData)
if (!nodeList.isNullOrEmpty()) {
val flatData = flatData(nodeList)
this.data.addAll(flatData)
}
}

Expand Down Expand Up @@ -244,13 +243,13 @@ abstract class BaseNodeAdapter(data: MutableList<BaseNode>? = null)
fun nodeAddData(parentNode: BaseNode, data: BaseNode) {
parentNode.childNode?.let {
it.add(data)
val childIndex = it.size

if (parentNode is BaseExpandNode && !parentNode.isExpanded) {
return
}

val parentIndex = this.data.indexOf(parentNode)
val childIndex = it.size
addData(parentIndex + childIndex, data)
}
}
Expand Down

0 comments on commit dedd998

Please sign in to comment.