mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-15 13:35:04 -05:00
made useImageAsIs determination a bit more foolproof (samsung)
This commit is contained in:
parent
ca262d3523
commit
aaf3ecaf41
@ -131,11 +131,16 @@ public class FileBackend {
|
|||||||
if (path == null) {
|
if (path == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
File file = new File(path);
|
||||||
|
long size = file.length();
|
||||||
|
if (size == 0 || size >= 524288 ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||||
options.inJustDecodeBounds = true;
|
options.inJustDecodeBounds = true;
|
||||||
try {
|
try {
|
||||||
BitmapFactory.decodeStream(mXmppConnectionService.getContentResolver().openInputStream(uri), null, options);
|
BitmapFactory.decodeStream(mXmppConnectionService.getContentResolver().openInputStream(uri), null, options);
|
||||||
if (options == null || options.outMimeType == null) {
|
if (options == null || options.outMimeType == null || options.outHeight <= 0 || options.outWidth <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return (options.outWidth <= Config.IMAGE_SIZE && options.outHeight <= Config.IMAGE_SIZE && options.outMimeType.contains(Config.IMAGE_FORMAT.name().toLowerCase()));
|
return (options.outWidth <= Config.IMAGE_SIZE && options.outHeight <= Config.IMAGE_SIZE && options.outMimeType.contains(Config.IMAGE_FORMAT.name().toLowerCase()));
|
||||||
|
Loading…
Reference in New Issue
Block a user