-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: added the async diff comparing.
- Loading branch information
Showing
10 changed files
with
216 additions
and
97 deletions.
There are no files selected for viewing
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
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
15 changes: 15 additions & 0 deletions
15
adaptiverecyclerview/src/main/java/com/devrapid/adaptiverecyclerview/DefaultMultiDiffUtil.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.devrapid.adaptiverecyclerview | ||
|
||
internal class DefaultMultiDiffUtil<VT : ViewTypeFactory, M : IVisitable<VT>> : AdaptiveDiffUtil<VT, M>() { | ||
override var oldList = mutableListOf<M>() | ||
override var newList = mutableListOf<M>() | ||
|
||
override fun getOldListSize() = oldList.size | ||
|
||
override fun getNewListSize() = newList.size | ||
|
||
override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int) = | ||
oldList[oldItemPosition].hashCode() == newList[newItemPosition].hashCode() | ||
|
||
override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int) = true | ||
} |
11 changes: 11 additions & 0 deletions
11
adaptiverecyclerview/src/main/java/com/devrapid/adaptiverecyclerview/Message.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.devrapid.adaptiverecyclerview | ||
|
||
internal class Message<M> { | ||
var type = -1 | ||
var position = -1 | ||
var range = -1..-1 | ||
var newList = mutableListOf<M>() | ||
var newItem: M? = null | ||
var header = true | ||
var footer = true | ||
} |
12 changes: 12 additions & 0 deletions
12
adaptiverecyclerview/src/main/java/com/devrapid/adaptiverecyclerview/MessageType.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.devrapid.adaptiverecyclerview | ||
|
||
object MessageType { | ||
internal const val MESSAGE_APPEND_LIST = 1 | ||
internal const val MESSAGE_APPEND_SINGLE = 2 | ||
internal const val MESSAGE_ADD_LIST = 3 | ||
internal const val MESSAGE_ADD_SINGLE = 4 | ||
internal const val MESSAGE_DROP_RANGE = 5 | ||
internal const val MESSAGE_DROP_SINGLE = 6 | ||
internal const val MESSAGE_DROP_ALL = 7 | ||
internal const val MESSAGE_REPLACE_ALL = 8 | ||
} |
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
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
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
Oops, something went wrong.