1

I came across the Epoxy library while looking for information about RecyclerView.

Epoxy is a library that makes RecyclerView easier to use.

I haven't applied it to my app yet, but I think it will be easier if I apply it.

Because the RecyclerView I use is based on two view types, and both items are dynamically added/removed frequently (DiffUitl is also used).

However, while reading the description of the Epoxy library in Git,

I came across the following:

Additionally, Epoxy adds support for saving view state and automatic diffing of item changes.

I'm curious as to what automatic diffing you're talking about here works based on. Is it DiffUtil internally or simply notifyDatasetChanged()?

If it uses DiffUtil then I'm going to use Epoxy or I'll consider it.

4

1 回答 1

2

或者只是 notifyDatasetChanged()?

他们没有notifyDatasetChanged()按照文档使用:

Epoxy 的自动差异化以减少开销,同时也有效地仅更新更改的视图。


内部是 DiffUtil

DiffUtil用于EpoxyControllerclass,但不用于EpoxyAdapterclass文档说:

Android 支持库类 DiffUtil 用于在 EpoxyController 中进行比较。由于遗留原因,较旧的 EpoxyAdapter 使用自定义解决方案进行差异化。

所以,当你还在设计你的应用程序时,我希望你会使用EpoxyController而不是遗留的EpoxyAdapter;因此,DiffUtil已经被使用了。


如果它使用 DiffUtil 那么我将使用 Epoxy 或者我会考虑它

由你决定; 一般来说,使用图书馆在连续性、安全性、限制、复杂性等方面有利有弊。

于 2021-10-08T22:25:59.947 回答