diff --git a/app/src/main/java/com/deniscerri/ytdl/database/dao/DownloadDao.kt b/app/src/main/java/com/deniscerri/ytdl/database/dao/DownloadDao.kt index d7e8cf43..0a7594ce 100644 --- a/app/src/main/java/com/deniscerri/ytdl/database/dao/DownloadDao.kt +++ b/app/src/main/java/com/deniscerri/ytdl/database/dao/DownloadDao.kt @@ -364,12 +364,16 @@ interface DownloadDao { items.forEachIndexed { idx, it -> updateDownloadID(-(it.id), newIDs[idx]) + updateDownloadRowNumber(newIDs[idx], items.size - idx) } } @Query("Update downloads set id=:newId where id=:id") suspend fun updateDownloadID(id: Long, newId: Long) + @Query("Update downloads set rowNumber=:newNr where id=:id") + suspend fun updateDownloadRowNumber(id: Long, newNr: Int) + @Query("SELECT id from downloads WHERE id > :item1 AND id < :item2 AND status in (:statuses) ORDER BY id DESC") fun getIDsBetweenTwoItems(item1: Long, item2: Long, statuses: List) : List diff --git a/app/src/main/java/com/deniscerri/ytdl/ui/adapter/ConfigureMultipleDownloadsAdapter.kt b/app/src/main/java/com/deniscerri/ytdl/ui/adapter/ConfigureMultipleDownloadsAdapter.kt index 62928dd8..8c7ea468 100644 --- a/app/src/main/java/com/deniscerri/ytdl/ui/adapter/ConfigureMultipleDownloadsAdapter.kt +++ b/app/src/main/java/com/deniscerri/ytdl/ui/adapter/ConfigureMultipleDownloadsAdapter.kt @@ -281,7 +281,7 @@ class ConfigureMultipleDownloadsAdapter(onItemClickListener: OnItemClickListener companion object { private val DIFF_CALLBACK: DiffUtil.ItemCallback = object : DiffUtil.ItemCallback() { override fun areItemsTheSame(oldItem: DownloadItemConfigureMultiple, newItem: DownloadItemConfigureMultiple): Boolean { - return oldItem.url == newItem.url + return oldItem.id == newItem.id } override fun areContentsTheSame(oldItem: DownloadItemConfigureMultiple, newItem: DownloadItemConfigureMultiple): Boolean {