-->\r
<manifest package="eu.alefzero.owncloud"\r
android:versionCode="1"\r
- android:versionName="0.1.132B" xmlns:android="http://schemas.android.com/apk/res/android">\r
+ android:versionName="0.1.133B" xmlns:android="http://schemas.android.com/apk/res/android">\r
\r
<uses-permission android:name="android.permission.GET_ACCOUNTS" />\r
<uses-permission android:name="android.permission.USE_CREDENTIALS" />\r
<ImageView
android:id="@+id/fdPreview"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:src="@drawable/owncloud_logo" />
\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
\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