Merge pull request #11919 from PhilLab/move-to-next-image-after-deletion

When deleting image in preview activity, move to the next image
This commit is contained in:
Andy Scherzinger 2023-09-25 16:42:36 +02:00 committed by GitHub
commit 4fc90f3dab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -232,7 +232,15 @@ public class PreviewImageActivity extends FileActivity implements
super.onRemoteOperationFinish(operation, result);
if (operation instanceof RemoveFileOperation) {
finish();
// initialize the pager with the new file list
initViewPager(getUser().get());
if (mViewPager.getAdapter().getCount() > 0) {
// Trigger page reselection, to update the title
onPageSelected(mViewPager.getCurrentItem());
} else {
// Last file has been deleted, so finish the activity
finish();
}
} else if (operation instanceof SynchronizeFileOperation) {
onSynchronizeFileOperationFinish(result);
}