\r
import android.accounts.Account;\r
import android.accounts.AccountManager;\r
+import android.app.ActionBar.LayoutParams;\r
import android.content.BroadcastReceiver;\r
import android.content.Context;\r
import android.content.Intent;\r
import android.content.pm.PackageManager;\r
import android.graphics.Bitmap;\r
import android.graphics.BitmapFactory;\r
+import android.graphics.BitmapFactory.Options;\r
+import android.graphics.Path.FillType;\r
import android.net.Uri;\r
import android.os.Bundle;\r
import android.util.Log;\r
Intent i = new Intent(getActivity(), FileDownloader.class);\r
i.putExtra(FileDownloader.EXTRA_ACCOUNT,\r
mIntent.getParcelableExtra(FileDownloader.EXTRA_ACCOUNT));\r
- i.putExtra(FileDownloader.EXTRA_FILE_PATH, mFile.getRemotePath());\r
+ i.putExtra(FileDownloader.EXTRA_REMOTE_PATH, mFile.getRemotePath());\r
+ i.putExtra(FileDownloader.EXTRA_FILE_PATH, mFile.getURLDecodedRemotePath());\r
i.putExtra(FileDownloader.EXTRA_FILE_SIZE, mFile.getFileLength());\r
getActivity().startService(i);\r
}\r
\r
// Update preview\r
if (mFile.getStoragePath() != null) {\r
+ ImageView preview = (ImageView) getView().findViewById(R.id.fdPreview);\r
try {\r
if (mFile.getMimetype().startsWith("image/")) {\r
- ImageView preview = (ImageView) getView().findViewById(\r
- R.id.fdPreview);\r
- Bitmap bmp = BitmapFactory.decodeFile(mFile.getStoragePath());\r
+ BitmapFactory.Options options = new Options();\r
+ options.inScaled = true;\r
+ options.inMutable = false;\r
+ options.inPreferQualityOverSpeed = false;\r
+ options.inPurgeable = true;\r
+\r
+ Bitmap bmp = BitmapFactory.decodeFile(mFile.getStoragePath(), options);\r
+\r
+ int width = options.outWidth;\r
+ int height = options.outHeight;\r
+ int scale = 1;\r
+ if (width >= 2048 || height >= 2048) {\r
+ scale = (int) (Math.ceil(Math.max(height, width)/2048.));\r
+ options.inSampleSize = scale;\r
+ bmp.recycle();\r
+\r
+ bmp = BitmapFactory.decodeFile(mFile.getStoragePath(), options);\r
+ }\r
preview.setImageBitmap(bmp);\r
}\r
} catch (OutOfMemoryError e) {\r
+ preview.setVisibility(View.INVISIBLE);\r
Log.e(TAG, "Out of memory occured for file with size " + mFile.getFileLength());\r
}\r
downloadButton.setText(R.string.filedetails_open);\r