mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 17:46:37 +03:00
Merge pull request #1114 from owncloud/tryFix1113
Removed squared background for transparencies from file type icons and thumbnails (stays for images in gallery view)
This commit is contained in:
commit
f626b13634
2 changed files with 9 additions and 18 deletions
|
@ -34,8 +34,8 @@ import android.graphics.Bitmap;
|
||||||
import android.graphics.Bitmap.CompressFormat;
|
import android.graphics.Bitmap.CompressFormat;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Shader;
|
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.media.ThumbnailUtils;
|
import android.media.ThumbnailUtils;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
@ -290,9 +290,6 @@ public class ThumbnailsCacheManager {
|
||||||
GetMethod get = new GetMethod(uri);
|
GetMethod get = new GetMethod(uri);
|
||||||
int status = mClient.executeMethod(get);
|
int status = mClient.executeMethod(get);
|
||||||
if (status == HttpStatus.SC_OK) {
|
if (status == HttpStatus.SC_OK) {
|
||||||
// byte[] bytes = get.getResponseBody();
|
|
||||||
// Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0,
|
|
||||||
// bytes.length);
|
|
||||||
InputStream inputStream = get.getResponseBodyAsStream();
|
InputStream inputStream = get.getResponseBodyAsStream();
|
||||||
Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
|
Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
|
||||||
thumbnail = ThumbnailUtils.extractThumbnail(bitmap, px, px);
|
thumbnail = ThumbnailUtils.extractThumbnail(bitmap, px, px);
|
||||||
|
@ -326,16 +323,9 @@ public class ThumbnailsCacheManager {
|
||||||
px,
|
px,
|
||||||
Bitmap.Config.ARGB_8888);
|
Bitmap.Config.ARGB_8888);
|
||||||
Canvas c = new Canvas(resultBitmap);
|
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);
|
c.drawBitmap(bitmap, 0, 0, null);
|
||||||
|
|
||||||
return resultBitmap;
|
return resultBitmap;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* @author Bartek Przybylski
|
* @author Bartek Przybylski
|
||||||
* @author Tobias Kaminsky
|
* @author Tobias Kaminsky
|
||||||
* @author David A. Velasco
|
* @author David A. Velasco
|
||||||
|
* @author masensio
|
||||||
* Copyright (C) 2011 Bartek Przybylski
|
* Copyright (C) 2011 Bartek Przybylski
|
||||||
* Copyright (C) 2015 ownCloud Inc.
|
* Copyright (C) 2015 ownCloud Inc.
|
||||||
*
|
*
|
||||||
|
@ -30,7 +31,6 @@ import android.accounts.Account;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.text.format.DateUtils;
|
import android.text.format.DateUtils;
|
||||||
|
@ -323,11 +323,11 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file.getMimetype().equalsIgnoreCase("image/png")) {
|
if (file.getMimetype().equalsIgnoreCase("image/png")) {
|
||||||
Drawable backrepeat = mContext.getResources().
|
fileIcon.setBackgroundColor(mContext.getResources()
|
||||||
getDrawable(R.drawable.backrepeat);
|
.getColor(R.color.background_color));
|
||||||
fileIcon.setBackground(backrepeat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
fileIcon.setImageResource(DisplayUtils.getFileTypeIconId(file.getMimetype(),
|
fileIcon.setImageResource(DisplayUtils.getFileTypeIconId(file.getMimetype(),
|
||||||
file.getFileName()));
|
file.getFileName()));
|
||||||
|
@ -335,6 +335,7 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Folder
|
// Folder
|
||||||
|
|
||||||
if (checkIfFileIsSharedWithMe(file)) {
|
if (checkIfFileIsSharedWithMe(file)) {
|
||||||
fileIcon.setImageResource(R.drawable.shared_with_me_folder);
|
fileIcon.setImageResource(R.drawable.shared_with_me_folder);
|
||||||
} else if (file.isShareByLink()) {
|
} else if (file.isShareByLink()) {
|
||||||
|
|
Loading…
Reference in a new issue