Completing previous commit
authorDavid A. Velasco <dvelasco@solidgear.es>
Thu, 5 Jul 2012 10:05:00 +0000 (12:05 +0200)
committerDavid A. Velasco <dvelasco@solidgear.es>
Thu, 5 Jul 2012 10:05:00 +0000 (12:05 +0200)
src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java
src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java

index 5245abf..188d1f0 100644 (file)
@@ -719,7 +719,7 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
         \r
         // If we are on a large device -> update fragment\r
         if (mDualPane) {\r
-            // buttons in the details view a are problematic when trying to reuse an existing fragment; create always a new one solves some of them, BUT no all; downloads are 'dangerous'\r
+            // buttons in the details view are problematic when trying to reuse an existing fragment; create always a new one solves some of them, BUT no all; downloads are 'dangerous'\r
             FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();\r
             transaction.replace(R.id.file_details_container, new FileDetailFragment(file, AccountUtils.getCurrentOwnCloudAccount(this)), FileDetailFragment.FTAG);\r
             transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);\r
index 0bf9564..533809f 100644 (file)
@@ -218,7 +218,6 @@ public class FileDetailFragment extends SherlockFragment implements
             if (mFile.getStoragePath() != null) {\r
                 // Update preview\r
                 ImageView preview = (ImageView) getView().findViewById(R.id.fdPreview);\r
-                boolean previewIsSet = false;\r
                 try {\r
                     if (mFile.getMimetype().startsWith("image/")) {\r
                         BitmapFactory.Options options = new Options();\r
@@ -246,9 +245,7 @@ public class FileDetailFragment extends SherlockFragment implements
                             }\r
                         }\r
                         if (bmp != null) {\r
-                            //preview.setImageBitmap(bmp);\r
-                            preview.setImageDrawable(new BitmapDrawable(preview.getResources(), bmp));\r
-                            previewIsSet = true;\r
+                            preview.setImageBitmap(bmp);\r
                         }\r
                     }\r
                 } catch (OutOfMemoryError e) {\r
@@ -262,12 +259,8 @@ public class FileDetailFragment extends SherlockFragment implements
                 } catch (Throwable t) {\r
                     preview.setVisibility(View.INVISIBLE);\r
                     Log.e(TAG, "Unexpected error while creating image preview " + mFile.getFileLength(), t);\r
-                    \r
-                } finally {\r
-                    if (!previewIsSet) {\r
-                        resetPreview();\r
-                    }\r
                 }\r
+                \r
                 // Change download button to open button\r
                 downloadButton.setText(R.string.filedetails_open);\r
                 downloadButton.setOnClickListener(new OnClickListener() {\r
@@ -315,8 +308,6 @@ public class FileDetailFragment extends SherlockFragment implements
             } else {\r
                 // Make download button effective\r
                 downloadButton.setOnClickListener(this);\r
-                // Be sure that preview image is reset; the fragment is reused when possible, a preview of other file could be there\r
-                resetPreview();\r
             }\r
         }\r
     }\r
@@ -415,16 +406,4 @@ public class FileDetailFragment extends SherlockFragment implements
         \r
     }\r
     \r
-    \r
-    /**\r
-     * Make the preview image shows the ownCloud logo.\r
-     * \r
-     * To be called when setting a preview image is not possible.\r
-     */\r
-    private void resetPreview() {\r
-        ImageView preview = (ImageView) getView().findViewById(R.id.fdPreview);\r
-        preview.setImageDrawable(getResources().getDrawable(R.drawable.owncloud_logo));\r
-    }\r
-\r
-\r
 }\r