Skip to content

Commit 4fc90f3

Browse files
Merge pull request #11919 from PhilLab/move-to-next-image-after-deletion
When deleting image in preview activity, move to the next image
2 parents 078296f + e0519e8 commit 4fc90f3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

app/src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,15 @@ public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationRe
232232
super.onRemoteOperationFinish(operation, result);
233233

234234
if (operation instanceof RemoveFileOperation) {
235-
finish();
235+
// initialize the pager with the new file list
236+
initViewPager(getUser().get());
237+
if (mViewPager.getAdapter().getCount() > 0) {
238+
// Trigger page reselection, to update the title
239+
onPageSelected(mViewPager.getCurrentItem());
240+
} else {
241+
// Last file has been deleted, so finish the activity
242+
finish();
243+
}
236244
} else if (operation instanceof SynchronizeFileOperation) {
237245
onSynchronizeFileOperationFinish(result);
238246
}

0 commit comments

Comments
 (0)