浏览代码

Adjust the thumbnails size to the size used on screen

David A. Velasco 10 年之前
父节点
当前提交
a09a837585
共有 3 个文件被更改,包括 28 次插入7 次删除
  1. 4 4
      res/layout/list_item.xml
  2. 21 0
      res/values/dims.xml
  3. 3 3
      src/com/owncloud/android/datamodel/ThumbnailsCacheManager.java

+ 4 - 4
res/layout/list_item.xml

@@ -32,16 +32,16 @@
 
         <ImageView
             android:id="@+id/imageView2"
-            android:layout_width="32dp"
-            android:layout_height="32dp"
+            android:layout_width="@dimen/file_icon_size"
+            android:layout_height="@dimen/file_icon_size"
             android:layout_gravity="center_vertical"
             android:layout_marginLeft="22dp"
             android:src="@drawable/local_file_indicator" />
 
         <ImageView
             android:id="@+id/imageView1"
-            android:layout_width="32dp"
-            android:layout_height="32dp"
+            android:layout_width="@dimen/file_icon_size"
+            android:layout_height="@dimen/file_icon_size"
             android:layout_gravity="center_vertical"
             android:layout_marginLeft="9dp"
             android:src="@drawable/ic_menu_archive" />

+ 21 - 0
res/values/dims.xml

@@ -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>

+ 3 - 3
src/com/owncloud/android/datamodel/ThumbnailsCacheManager.java

@@ -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(