Repository navigation
fix: element not disappearing when removing from On device - #18182
daniele-verducci wants to merge 1 commit into
Conversation
…ist refresh instead of updating the item, so it disappears correcltu Signed-off-by: daniele-verducci <daniele.verducci@nextcloud.com>
|
stable22-IT test failed, but no output was generated. Maybe a preliminary stage failed. |
📱 QA build
The QA build installs alongside a released Nextcloud app, so you can keep Downloading the file requires a GitHub account, so open this link on the |
|
master-IT test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/18182-IT-master-13-06 |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
| private fun updateFileListAfterRemoval(fragment: OCFileListFragment, removedFile: OCFile, onlyLocalCopy: Boolean) { | ||
| val adapter = fragment.adapter ?: return | ||
| if (onlyLocalCopy) { | ||
| if (onlyLocalCopy && !MainApp.isOnlyOnDevice) { |
There was a problem hiding this comment.
No need to refresh whole list. notifyItemRemoved can be used. Also we need to test if the element is count is 1 to cover cases like:
java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 0(offset:-1).state:2 com.owncloud.android.ui.EmptyRecyclerView{2978b14 VFED..... ......ID 0,0-1080,1920 #7f0a032e app:id/list_root}, adapter:com.owncloud.android.ui.adapter.filelist.FileListAdapter@ed1f09e, layout:androidx.recyclerview.widget.LinearLayoutManager@c5e7fbd, context:com.owncloud.android.ui.activity.FileDisplayActivity@c699086
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6821)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6757)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6753)
at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2362)
at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1662)
at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1622)
at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:697)
at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep1(RecyclerView.java:4591)
at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:4346)
at androidx.recyclerview.widget.RecyclerView.consumePendingUpdateOperations(RecyclerView.java:2106)
at androidx.recyclerview.widget.RecyclerView$1.run(RecyclerView.java:468)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1909)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1918)
at android.view.Choreographer.doCallbacks(Choreographer.java:1434)
at android.view.Choreographer.doFrame(Choreographer.java:1285)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1892)
at android.os.Handler.handleCallback(Handler.java:1080)
at android.os.Handler.dispatchMessageImpl(Handler.java:135)
at android.os.Handler.dispatchMessage(Handler.java:126)
if (onlyLocalCopy && !MainApp.isOnlyOnDevice) {
adapter.notifyItemChanged(removedFile)
return
}
val position = adapter.getItemPosition(removedFile)
adapter.notifyItemRemoved(position)
There was a problem hiding this comment.
Things to test:
Delete multiple files and folders
Delete one file or one folder
Have one item in the list and delete that one
repeat this scenario for All files, On Device, Shared
If downloaded file is removed from view OnlyOnDevice, make the list refresh instead of updating the item, so it disappears correclty
🖼️ Screenshots
Screen_recording_20261201_122107.webm
Screen_recording_20261201_123330.webm
🏁 Checklist
/backport to stable-xx.x🤖 AI (if applicable)