Adjust the thumbnails size to the size used on screen
authorDavid A. Velasco <dvelasco@solidgear.es>
Mon, 3 Nov 2014 10:27:51 +0000 (11:27 +0100)
committerDavid A. Velasco <dvelasco@solidgear.es>
Mon, 3 Nov 2014 10:27:51 +0000 (11:27 +0100)
res/layout/list_item.xml
res/values/dims.xml [new file with mode: 0644]
src/com/owncloud/android/datamodel/ThumbnailsCacheManager.java

index a4113de..c6c7b92 100644 (file)
 \r
         <ImageView\r
             android:id="@+id/imageView2"\r
-            android:layout_width="32dp"\r
-            android:layout_height="32dp"\r
+            android:layout_width="@dimen/file_icon_size"\r
+            android:layout_height="@dimen/file_icon_size"\r
             android:layout_gravity="center_vertical"\r
             android:layout_marginLeft="22dp"\r
             android:src="@drawable/local_file_indicator" />\r
 \r
         <ImageView\r
             android:id="@+id/imageView1"\r
-            android:layout_width="32dp"\r
-            android:layout_height="32dp"\r
+            android:layout_width="@dimen/file_icon_size"\r
+            android:layout_height="@dimen/file_icon_size"\r
             android:layout_gravity="center_vertical"\r
             android:layout_marginLeft="9dp"\r
             android:src="@drawable/ic_menu_archive" />\r
diff --git a/res/values/dims.xml b/res/values/dims.xml
new file mode 100644 (file)
index 0000000..d433cba
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ownCloud Android client application
+
+  Copyright (C) 2014 ownCloud Inc.
+
+  This program is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+-->
+<resources>
+       <dimen name="file_icon_size">32dp</dimen>
+</resources>
index 82fdd8f..5540aa5 100644 (file)
@@ -42,6 +42,7 @@ import android.util.TypedValue;
 import android.widget.ImageView;
 
 import com.owncloud.android.MainApp;
+import com.owncloud.android.R;
 import com.owncloud.android.lib.common.OwnCloudAccount;
 import com.owncloud.android.lib.common.OwnCloudClient;
 import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
@@ -216,9 +217,8 @@ public class ThumbnailsCacheManager {
                 if (thumbnail == null || mFile.needsUpdateThumbnail()) { 
                     // Converts dp to pixel
                     Resources r = MainApp.getAppContext().getResources();
-                    int px = (int) Math.round(TypedValue.applyDimension(
-                            TypedValue.COMPLEX_UNIT_DIP, 150, r.getDisplayMetrics()
-                    ));
+                    
+                    int px = (int) Math.round(r.getDimension(R.dimen.file_icon_size));
                     
                     if (mFile.isDown()){
                         Bitmap bitmap = BitmapUtils.decodeSampledBitmapFromFile(