Эх сурвалжийг харах

if image is encrypted -> download file as no resized image is possible

tobiasKaminsky 7 жил өмнө
parent
commit
7bb8a28bd6

+ 5 - 0
src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java

@@ -358,6 +358,11 @@ public class PreviewImageActivity extends FileActivity implements
             }
             setDrawerIndicatorEnabled(false);
 
+            if (currentFile.isEncrypted() && !currentFile.isDown() &&
+                    !mPreviewImagePagerAdapter.pendingErrorAt(position)) {
+                requestForDownload(currentFile);
+            }
+
             // Call to reset image zoom to initial state
             ((PreviewImagePagerAdapter) mViewPager.getAdapter()).resetZoom();
         }

+ 5 - 1
src/main/java/com/owncloud/android/ui/preview/PreviewImagePagerAdapter.java

@@ -151,7 +151,11 @@ public class PreviewImagePagerAdapter extends FragmentStatePagerAdapter {
                 ((FileDownloadFragment) fragment).setError(true);
                 mDownloadErrors.remove(i);
             } else {
-                fragment = PreviewImageFragment.newInstance(file, mObsoletePositions.contains(i), true);
+                if (file.isEncrypted()) {
+                    fragment = FileDownloadFragment.newInstance(file, mAccount, mObsoletePositions.contains(i));
+                } else {
+                    fragment = PreviewImageFragment.newInstance(file, mObsoletePositions.contains(i), true);
+                }
             }
         }