Skip to content

Commit fd9a329

Browse files
authored
courses: smoother progress grid item callback diffing (fixes #12239) (#12212)
1 parent c9db498 commit fd9a329

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ android {
1212
applicationId "org.ole.planet.myplanet"
1313
minSdk = 26
1414
targetSdk = 36
15-
versionCode = 4985
16-
versionName = "0.49.85"
15+
versionCode = 4986
16+
versionName = "0.49.86"
1717
ndkVersion = '26.3.11579264'
1818
vectorDrawables.useSupportLibrary = true
1919
}

app/src/main/java/org/ole/planet/myplanet/ui/courses/ProgressGridAdapter.kt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ import org.ole.planet.myplanet.databinding.RowMyProgressGridBinding
1212
import org.ole.planet.myplanet.utils.DiffUtils
1313

1414
class ProgressGridAdapter(private val context: Context) :
15-
ListAdapter<JsonObject, ProgressGridAdapter.ViewHolderMyProgress>(DIFF_CALLBACK) {
15+
ListAdapter<JsonObject, ProgressGridAdapter.ViewHolderMyProgress>(
16+
DiffUtils.itemCallback<JsonObject>(
17+
areItemsTheSame = { oldItem, newItem -> oldItem["stepId"] == newItem["stepId"] },
18+
areContentsTheSame = { oldItem, newItem -> oldItem == newItem }
19+
)
20+
) {
1621
private lateinit var rowMyProgressGridBinding: RowMyProgressGridBinding
1722
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolderMyProgress {
1823
rowMyProgressGridBinding =
@@ -47,11 +52,4 @@ class ProgressGridAdapter(private val context: Context) :
4752
RecyclerView.ViewHolder(rowMyProgressGridBinding.root) {
4853
var tvProgress = rowMyProgressGridBinding.tvProgress
4954
}
50-
51-
companion object {
52-
val DIFF_CALLBACK = DiffUtils.itemCallback<JsonObject>(
53-
areItemsTheSame = { oldItem, newItem -> oldItem["stepId"] == newItem["stepId"] },
54-
areContentsTheSame = { oldItem, newItem -> oldItem == newItem }
55-
)
56-
}
5755
}

0 commit comments

Comments
 (0)