From: David A. Velasco Date: Thu, 5 Jul 2012 10:05:00 +0000 (+0200) Subject: Completing previous commit X-Git-Tag: oc-android-1.4.3~309 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/890bf7fa51135aa24e07ab8d02c002b22a66716a Completing previous commit --- diff --git a/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java b/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java index 5245abf7..188d1f0b 100644 --- a/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java +++ b/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java @@ -719,7 +719,7 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements // If we are on a large device -> update fragment if (mDualPane) { - // 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' + // 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' FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.file_details_container, new FileDetailFragment(file, AccountUtils.getCurrentOwnCloudAccount(this)), FileDetailFragment.FTAG); transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); diff --git a/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java b/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java index 0bf9564b..533809fb 100644 --- a/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java +++ b/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java @@ -218,7 +218,6 @@ public class FileDetailFragment extends SherlockFragment implements if (mFile.getStoragePath() != null) { // Update preview ImageView preview = (ImageView) getView().findViewById(R.id.fdPreview); - boolean previewIsSet = false; try { if (mFile.getMimetype().startsWith("image/")) { BitmapFactory.Options options = new Options(); @@ -246,9 +245,7 @@ public class FileDetailFragment extends SherlockFragment implements } } if (bmp != null) { - //preview.setImageBitmap(bmp); - preview.setImageDrawable(new BitmapDrawable(preview.getResources(), bmp)); - previewIsSet = true; + preview.setImageBitmap(bmp); } } } catch (OutOfMemoryError e) { @@ -262,12 +259,8 @@ public class FileDetailFragment extends SherlockFragment implements } catch (Throwable t) { preview.setVisibility(View.INVISIBLE); Log.e(TAG, "Unexpected error while creating image preview " + mFile.getFileLength(), t); - - } finally { - if (!previewIsSet) { - resetPreview(); - } } + // Change download button to open button downloadButton.setText(R.string.filedetails_open); downloadButton.setOnClickListener(new OnClickListener() { @@ -315,8 +308,6 @@ public class FileDetailFragment extends SherlockFragment implements } else { // Make download button effective downloadButton.setOnClickListener(this); - // Be sure that preview image is reset; the fragment is reused when possible, a preview of other file could be there - resetPreview(); } } } @@ -415,16 +406,4 @@ public class FileDetailFragment extends SherlockFragment implements } - - /** - * Make the preview image shows the ownCloud logo. - * - * To be called when setting a preview image is not possible. - */ - private void resetPreview() { - ImageView preview = (ImageView) getView().findViewById(R.id.fdPreview); - preview.setImageDrawable(getResources().getDrawable(R.drawable.owncloud_logo)); - } - - }