Click on notifications about image downloads / uploads goes to gallery
[pub/Android/ownCloud.git] / src / com / owncloud / android / ui / activity / FileDetailActivity.java
index fbc4cb9..bdd475a 100644 (file)
@@ -40,7 +40,7 @@ import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;
 import com.owncloud.android.files.services.FileUploader;\r
 import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;\r
 import com.owncloud.android.ui.fragment.FileDetailFragment;\r
-import com.owncloud.android.ui.fragment.FilePreviewFragment;\r
+import com.owncloud.android.ui.preview.PreviewMediaFragment;\r
 \r
 import com.owncloud.android.R;\r
 \r
@@ -61,7 +61,7 @@ public class FileDetailActivity extends SherlockFragmentActivity implements File
     public static final int MODE_DETAILS = 0;\r
     public static final int MODE_PREVIEW = 1;\r
 \r
-    private static final String KEY_WAITING_TO_PREVIEW = "WAITING_TO_PREVIEW";\r
+    public static final String KEY_WAITING_TO_PREVIEW = "WAITING_TO_PREVIEW";\r
     \r
     private boolean mConfigurationChangedToLandscape = false;\r
     private FileDownloaderBinder mDownloaderBinder = null;\r
@@ -120,9 +120,9 @@ public class FileDetailActivity extends SherlockFragmentActivity implements File
         int mode = getIntent().getIntExtra(EXTRA_MODE, MODE_PREVIEW); \r
         \r
         Fragment newFragment = null;\r
-        if (FilePreviewFragment.canBePreviewed(mFile) && mode == MODE_PREVIEW) {\r
+        if (PreviewMediaFragment.canBePreviewed(mFile) && mode == MODE_PREVIEW) {\r
             if (mFile.isDown()) {\r
-                newFragment = new FilePreviewFragment(mFile, mAccount);\r
+                newFragment = new PreviewMediaFragment(mFile, mAccount);\r
             \r
             } else {\r
                 newFragment = new FileDetailFragment(mFile, mAccount);\r
@@ -169,7 +169,7 @@ public class FileDetailActivity extends SherlockFragmentActivity implements File
             FileDetailFragment detailsFragment = (fragment instanceof FileDetailFragment) ? (FileDetailFragment) fragment : null;\r
             if (detailsFragment != null) {\r
                 detailsFragment.listenForTransferProgress();\r
-                detailsFragment.updateFileDetails(mWaitingToPreview);   // let the fragment gets the mDownloadBinder through getDownloadBinder() (see FileDetailFragment#updateFileDetais())\r
+                detailsFragment.updateFileDetails(mWaitingToPreview, false);   // let the fragment gets the mDownloadBinder through getDownloadBinder() (see FileDetailFragment#updateFileDetais())\r
             }\r
         }\r
 \r
@@ -225,7 +225,7 @@ public class FileDetailActivity extends SherlockFragmentActivity implements File
         if (!mConfigurationChangedToLandscape) {\r
             Fragment fragment = getSupportFragmentManager().findFragmentByTag(FileDetailFragment.FTAG);\r
             if (fragment != null && fragment instanceof FileDetailFragment) {\r
-                ((FileDetailFragment) fragment).updateFileDetails(false);\r
+                ((FileDetailFragment) fragment).updateFileDetails(false, false);\r
             }\r
         }\r
     }\r
@@ -303,12 +303,14 @@ public class FileDetailActivity extends SherlockFragmentActivity implements File
     }\r
 \r
     @Override\r
-    public void notifySuccessfulDownload(OCFile file) {\r
-        if (mWaitingToPreview) {\r
-            FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();\r
-            transaction.replace(R.id.fragment, new FilePreviewFragment(file, mAccount), FileDetailFragment.FTAG); \r
-            transaction.commit();\r
-            mWaitingToPreview = false;\r
+    public void notifySuccessfulDownload(OCFile file, Intent intent, boolean success) {\r
+        if (success) {\r
+            if (mWaitingToPreview) {\r
+                FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();\r
+                transaction.replace(R.id.fragment, new PreviewMediaFragment(file, mAccount), FileDetailFragment.FTAG); \r
+                transaction.commit();\r
+                mWaitingToPreview = false;\r
+            }\r
         }\r
     }\r
     \r