Merge remote-tracking branch 'remotes/upstream/resizedImages' into beta
authortobiasKaminsky <tobias@kaminsky.me>
Sat, 31 Oct 2015 07:36:39 +0000 (08:36 +0100)
committertobiasKaminsky <tobias@kaminsky.me>
Sat, 31 Oct 2015 07:36:39 +0000 (08:36 +0100)
1  2 
src/com/owncloud/android/datamodel/ThumbnailsCacheManager.java
src/com/owncloud/android/ui/adapter/FileListListAdapter.java

@@@ -410,27 -364,21 +410,34 @@@ public class ThumbnailsCacheManager 
  
          }
  
 +        private Bitmap handlePNG(Bitmap bitmap, int px){
 +            Bitmap resultBitmap = Bitmap.createBitmap(px,
 +                    px,
 +                    Bitmap.Config.ARGB_8888);
 +            Canvas c = new Canvas(resultBitmap);
 +
 +            c.drawColor(MainApp.getAppContext().getResources().
 +                    getColor(R.color.background_color));
 +            c.drawBitmap(bitmap, 0, 0, null);
 +
 +            return resultBitmap;
 +        }
 +
          private Bitmap doFileInBackground(Boolean mIsThumbnail) {
-             Bitmap thumbnail = null;
              File file = (File)mFile;
  
-             final String imageKey = String.valueOf(file.hashCode());
+             // distinguish between thumbnail and resized image
+             String temp = String.valueOf(file.hashCode());
+             if (mIsThumbnail){
+                 temp = "t" + temp;
+             } else {
+                 temp = "r" + temp;
+             }
+             final String imageKey = temp;
  
              // Check disk cache in background thread
-             thumbnail = getBitmapFromDiskCache(imageKey);
+             Bitmap thumbnail = getBitmapFromDiskCache(imageKey);
  
              // Not found in disk cache
              if (thumbnail == null) {