Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: wrong number of products for lists + analytics events (#4648)
* Fix: wrong number of products for lists + analytics events * Use the dedicated method to launch ProductListsActivity * Shop list name removed from analytics event
- Loading branch information
Showing
6 changed files
with
93 additions
and
15 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
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
22 changes: 22 additions & 0 deletions
22
...main/java/openfoodfacts/github/scrachx/openfood/features/productlists/ProductListsDiff.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,22 @@ | ||
package openfoodfacts.github.scrachx.openfood.features.productlists | ||
|
||
import androidx.recyclerview.widget.DiffUtil | ||
import openfoodfacts.github.scrachx.openfood.models.entities.ProductLists | ||
|
||
class ProductListsDiffCallback( | ||
private val oldItems: List<ProductLists>, | ||
private val newItems: List<ProductLists>, | ||
) : DiffUtil.Callback() { | ||
|
||
override fun getOldListSize(): Int = oldItems.size | ||
|
||
override fun getNewListSize(): Int = newItems.size | ||
|
||
override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean { | ||
return oldItems[oldItemPosition].id == newItems[newItemPosition].id | ||
} | ||
|
||
override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean { | ||
return areItemsTheSame(oldItemPosition, newItemPosition) | ||
} | ||
} |