|
|
|
|
@ -6,8 +6,8 @@ import androidx.recyclerview.widget.DiffUtil |
|
|
|
|
import androidx.recyclerview.widget.RecyclerView |
|
|
|
|
import net.pokeranalytics.android.ui.view.BindableHolder |
|
|
|
|
import net.pokeranalytics.android.ui.view.RowRepresentable |
|
|
|
|
import net.pokeranalytics.android.ui.view.RowViewType |
|
|
|
|
import net.pokeranalytics.android.ui.view.RowRepresentableDiffCallback |
|
|
|
|
import net.pokeranalytics.android.ui.view.RowViewType |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* An interface used to provide RowRepresentableAdapter content and value in the form of rows |
|
|
|
|
@ -116,24 +116,11 @@ class RowRepresentableAdapter( |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Refresh all adapter rows |
|
|
|
|
*/ |
|
|
|
|
fun refreshAllRows() { |
|
|
|
|
this.rows = rowRepresentableDataSource.adapterRows() |
|
|
|
|
notifyDataSetChanged() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Update UI |
|
|
|
|
*/ |
|
|
|
|
fun updateRows(newRows: ArrayList<RowRepresentable>) { |
|
|
|
|
val diffResult = DiffUtil.calculateDiff( |
|
|
|
|
RowRepresentableDiffCallback( |
|
|
|
|
newRows, |
|
|
|
|
rows |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
val diffResult = DiffUtil.calculateDiff(RowRepresentableDiffCallback(newRows, rows, rowRepresentableDataSource)) |
|
|
|
|
this.rows = newRows |
|
|
|
|
diffResult.dispatchUpdatesTo(this) |
|
|
|
|
} |
|
|
|
|
|