public void onFileClick(OCFile file) {\r
\r
if (file != null && FilePreviewFragment.canBePreviewed(file)) {\r
- if (file.isDown()) {\r
- // preview it\r
- startPreview(file);\r
+ if (file.isImage()) {\r
+ // preview image - it handles the download, if needed\r
+ startPreviewImage(file);\r
+ \r
+ } else if (file.isDown()) {\r
+ // general preview\r
+ startOtherPreview(file);\r
\r
} else {\r
// automatic download, preview on finish\r
startDetails(file);\r
}\r
}\r
+\r
+ private void startPreviewImage(OCFile file) {\r
+ Intent showDetailsIntent = new Intent(this, PreviewImageActivity.class);\r
+ showDetailsIntent.putExtra(FileDetailFragment.EXTRA_FILE, file);\r
+ showDetailsIntent.putExtra(FileDetailFragment.EXTRA_ACCOUNT, AccountUtils.getCurrentOwnCloudAccount(this));\r
+ startActivity(showDetailsIntent);\r
+ }\r
\r
- private void startPreview(OCFile file) {\r
- if (mDualPane && \r
- !file.isImage() // this is a trick to get a quick-to-implement 'full screen' preview for images in landscape\r
- ) {\r
+ private void startOtherPreview(OCFile file) {\r
+ if (mDualPane) {\r
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();\r
transaction.replace(R.id.file_details_container, new FilePreviewFragment(file, AccountUtils.getCurrentOwnCloudAccount(this)), FileDetailFragment.FTAG);\r
transaction.commit();\r
\r
- } else if (file.isImage()) {\r
- Intent showDetailsIntent = new Intent(this, PreviewImageActivity.class);\r
- showDetailsIntent.putExtra(FileDetailFragment.EXTRA_FILE, file);\r
- showDetailsIntent.putExtra(FileDetailFragment.EXTRA_ACCOUNT, AccountUtils.getCurrentOwnCloudAccount(this));\r
- startActivity(showDetailsIntent);\r
- \r
} else {\r
Intent showDetailsIntent = new Intent(this, FileDetailActivity.class);\r
showDetailsIntent.putExtra(FileDetailFragment.EXTRA_FILE, file);\r