From 5c348074202050ae3f31a7c02b15c41c8305a441 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 14 Dec 2021 15:26:00 +0100 Subject: [PATCH] remove unused file --- .../androidaps/utils/ListDiffCallback.kt | 65 ------------------- 1 file changed, 65 deletions(-) delete mode 100644 core/src/main/java/info/nightscout/androidaps/utils/ListDiffCallback.kt diff --git a/core/src/main/java/info/nightscout/androidaps/utils/ListDiffCallback.kt b/core/src/main/java/info/nightscout/androidaps/utils/ListDiffCallback.kt deleted file mode 100644 index d1e6947e74..0000000000 --- a/core/src/main/java/info/nightscout/androidaps/utils/ListDiffCallback.kt +++ /dev/null @@ -1,65 +0,0 @@ -package info.nightscout.androidaps.utils - -import androidx.recyclerview.widget.DiffUtil -import androidx.recyclerview.widget.ListUpdateCallback -import androidx.recyclerview.widget.RecyclerView - -open class ListDiffCallback(private val newItems: List, private val oldItems: List) : DiffUtil.Callback() { - - override fun getOldListSize(): Int = oldItems.size - - override fun getNewListSize(): Int = newItems.size - - /** - * Called by the DiffUtil to decide whether two object represent the same Item. - *

- * For example, if your items have unique ids, this method should check their id equality. - * - * @param oldItemPosition The position of the item in the old list - * @param newItemPosition The position of the item in the new list - * @return True if the two items represent the same object or false if they are different. - */ - override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean = - newItems[newItemPosition] == oldItems[oldItemPosition] - - /** - * Called by the DiffUtil when it wants to check whether two items have the same data. - * DiffUtil uses this information to detect if the contents of an item has changed. - *

- * DiffUtil uses this method to check equality instead of {@link Object#equals(Object)} - * so that you can change its behavior depending on your UI. - * For example, if you are using DiffUtil with a - * {@link RecyclerView.Adapter RecyclerView.Adapter}, you should - * return whether the items' visual representations are the same. - *

- * This method is called only if {@link #areItemsTheSame(int, int)} returns - * {@code true} for these items. - * - * @param oldItemPosition The position of the item in the old list - * @param newItemPosition The position of the item in the new list which replaces the - * oldItem - * @return True if the contents of the items are the same or false if they are different. - */ - override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean = - newItems[newItemPosition] == oldItems[oldItemPosition] -} - -class ListUpdateCallbackHelper(val adapter: RecyclerView.Adapter<*>, val insertCallback: (Int) -> Unit) : ListUpdateCallback { - - override fun onChanged(position: Int, count: Int, payload: Any?) { - adapter.notifyItemRangeChanged(position, count, payload) - } - - override fun onInserted(position: Int, count: Int) { - adapter.notifyItemRangeInserted(position, count) - insertCallback(position) - } - - override fun onMoved(fromPosition: Int, toPosition: Int) { - adapter.notifyItemMoved(fromPosition, toPosition) - } - - override fun onRemoved(position: Int, count: Int) { - adapter.notifyItemRangeRemoved(position, count) - } -} \ No newline at end of file