From: David A. Velasco Date: Wed, 2 Sep 2015 09:00:30 +0000 (+0200) Subject: Merge pull request #1114 from owncloud/tryFix1113 X-Git-Tag: oc-android-1.8~25 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/f626b136340578c29a52abbe247b5d10cf90b50f?hp=f70817f5fb489f8301d2919d02a90ca428bc366e Merge pull request #1114 from owncloud/tryFix1113 Removed squared background for transparencies from file type icons and thumbnails (stays for images in gallery view) --- diff --git a/src/com/owncloud/android/datamodel/ThumbnailsCacheManager.java b/src/com/owncloud/android/datamodel/ThumbnailsCacheManager.java index 362106e6..ce8bfd4a 100644 --- a/src/com/owncloud/android/datamodel/ThumbnailsCacheManager.java +++ b/src/com/owncloud/android/datamodel/ThumbnailsCacheManager.java @@ -34,8 +34,8 @@ import android.graphics.Bitmap; import android.graphics.Bitmap.CompressFormat; import android.graphics.BitmapFactory; import android.graphics.Canvas; -import android.graphics.Shader; import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.media.ThumbnailUtils; import android.net.Uri; @@ -290,9 +290,6 @@ public class ThumbnailsCacheManager { GetMethod get = new GetMethod(uri); int status = mClient.executeMethod(get); if (status == HttpStatus.SC_OK) { -// byte[] bytes = get.getResponseBody(); -// Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, -// bytes.length); InputStream inputStream = get.getResponseBodyAsStream(); Bitmap bitmap = BitmapFactory.decodeStream(inputStream); thumbnail = ThumbnailUtils.extractThumbnail(bitmap, px, px); @@ -326,16 +323,9 @@ public class ThumbnailsCacheManager { px, Bitmap.Config.ARGB_8888); Canvas c = new Canvas(resultBitmap); - Bitmap checker = BitmapFactory.decodeResource(MainApp.getAppContext().getResources(), - R.drawable.checker_16_16); - - BitmapDrawable background; - background = new BitmapDrawable(MainApp.getAppContext().getResources(), checker); - - background.setBounds(0, 0, px, px); - background.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT); - background.draw(c); + c.drawColor(MainApp.getAppContext().getResources(). + getColor(R.color.background_color)); c.drawBitmap(bitmap, 0, 0, null); return resultBitmap; diff --git a/src/com/owncloud/android/ui/adapter/FileListListAdapter.java b/src/com/owncloud/android/ui/adapter/FileListListAdapter.java index 0c72052a..27fc8c15 100644 --- a/src/com/owncloud/android/ui/adapter/FileListListAdapter.java +++ b/src/com/owncloud/android/ui/adapter/FileListListAdapter.java @@ -4,6 +4,7 @@ * @author Bartek Przybylski * @author Tobias Kaminsky * @author David A. Velasco + * @author masensio * Copyright (C) 2011 Bartek Przybylski * Copyright (C) 2015 ownCloud Inc. * @@ -30,7 +31,6 @@ import android.accounts.Account; import android.content.Context; import android.content.SharedPreferences; import android.graphics.Bitmap; -import android.graphics.drawable.Drawable; import android.os.Build; import android.preference.PreferenceManager; import android.text.format.DateUtils; @@ -322,12 +322,12 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter { } } - if (file.getMimetype().equalsIgnoreCase("image/png")){ - Drawable backrepeat = mContext.getResources(). - getDrawable(R.drawable.backrepeat); - fileIcon.setBackground(backrepeat); + if (file.getMimetype().equalsIgnoreCase("image/png")) { + fileIcon.setBackgroundColor(mContext.getResources() + .getColor(R.color.background_color)); } + } else { fileIcon.setImageResource(DisplayUtils.getFileTypeIconId(file.getMimetype(), file.getFileName())); @@ -335,6 +335,7 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter { } else { // Folder + if (checkIfFileIsSharedWithMe(file)) { fileIcon.setImageResource(R.drawable.shared_with_me_folder); } else if (file.isShareByLink()) {