فهرست منبع

When deleting image in preview activity, move to the next image

Instead of closing the preview after the deletion of an image file, the
next image is shown. This allows to conveniently go through a list of
images and delete unwanted ones, without the flow being interrupted.

Closes #11918

Signed-off-by: Philipp Hasper <vcs@hasper.info>
Philipp Hasper 1 سال پیش
والد
کامیت
e0519e841a
1فایلهای تغییر یافته به همراه9 افزوده شده و 1 حذف شده
  1. 9 1
      app/src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java

+ 9 - 1
app/src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java

@@ -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);
         }