Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

fix: element not disappearing when removing from On device - #18182

Open
daniele-verducci wants to merge 1 commit into
masterfrom
fix/on-device-list-not-updated
Open

daniele-verducci wants to merge 1 commit into
masterfrom
fix/on-device-list-not-updated

Conversation

@daniele-verducci

@daniele-verducci daniele-verducci commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

If downloaded file is removed from view OnlyOnDevice, make the list refresh instead of updating the item, so it disappears correclty

🖼️ Screenshots

🏚️ Before 🏡 After
Screen_recording_20261201_122107.webm
Screen_recording_20261201_123330.webm

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI (N/A)

…ist refresh instead of updating the item, so it disappears correcltu

Signed-off-by: daniele-verducci <daniele.verducci@nextcloud.com>
@daniele-verducci daniele-verducci added this to the Nextcloud App 35.2.0 milestone Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

stable22-IT test failed, but no output was generated. Maybe a preliminary stage failed.

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

📱 QA build

Download app-qa-debug.apk
QR code Open the QR code for this download
Commit 5eefb5d
Version 18182
Available until 7 days after this build

The QA build installs alongside a released Nextcloud app, so you can keep
using your existing install while testing.

Downloading the file requires a GitHub account, so open this link on the
device you want to test on, or transfer the APK to it.

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

SpotBugs

CategoryBaseNew
Bad practice2222
Correctness4040
Dodgy code106106
Experimental11
Malicious code vulnerability11
Multithreaded correctness1313
Performance1717
Security1515
Total215215

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Dec 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...wncloud/android/ui/activity/FileDisplayActivity.kt 0.00% 1 Missing ⚠️

📢 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) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx. I'll change once #18184 is merged

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merged

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants