소스 검색

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