提交 cb23f4ee 编写于 作者: B Blankj

see 10/25 log

上级 85fce6cc
......@@ -612,7 +612,7 @@ getComments : 获取压缩文件中的注释链表
Gradle:
``` groovy
compile 'com.blankj:utilcode:1.9.4'
compile 'com.blankj:utilcode:1.9.5'
```
......@@ -635,7 +635,7 @@ Utils.init(application);
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.9.4-brightgreen.svg
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.9.5-brightgreen.svg
[auc]: https://github.com/Blankj/AndroidUtilCode
[apisvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
......
......@@ -612,7 +612,7 @@ getComments
Gradle:
``` groovy
compile 'com.blankj:utilcode:1.9.4'
compile 'com.blankj:utilcode:1.9.5'
```
......@@ -635,7 +635,7 @@ Utils.init(application);
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.9.4-brightgreen.svg
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.9.5-brightgreen.svg
[auc]: https://github.com/Blankj/AndroidUtilCode
[apisvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
......
......@@ -29,8 +29,8 @@ ext {
minSdkVersion = 14
targetSdkVersion = 22
versionCode = 100900400
versionName = '1.9.4'
versionCode = 100900500
versionName = '1.9.5'
// App dependencies
supportVersion = '25.3.1'
......
* 17/10/25 修复LogUtils边框
* 17/10/25 修复LogUtils边框,修复getBitmap从流获取
* 17/09/30 完善FragmentUtils,发布1.9.2
* 17/09/29 完善FragmentUtils和isInstallApp
* 17/09/28 完善FragmentUtils
......
......@@ -35,6 +35,8 @@ import android.support.annotation.IntRange;
import android.support.v4.content.ContextCompat;
import android.view.View;
import com.blankj.utilcode.constant.MemoryConstants;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
......@@ -240,12 +242,8 @@ public final class ImageUtils {
*/
public static Bitmap getBitmap(final InputStream is, final int maxWidth, final int maxHeight) {
if (is == null) return null;
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeStream(is, null, options);
options.inSampleSize = calculateInSampleSize(options, maxWidth, maxHeight);
options.inJustDecodeBounds = false;
return BitmapFactory.decodeStream(is, null, options);
byte[] bytes = input2Byte(is);
return getBitmap(bytes, 0, maxWidth, maxHeight);
}
/**
......@@ -1776,4 +1774,22 @@ public final class ImageUtils {
}
return inSampleSize;
}
private static byte[] input2Byte(final InputStream is) {
if (is == null) return null;
try {
ByteArrayOutputStream os = new ByteArrayOutputStream();
byte[] b = new byte[MemoryConstants.KB];
int len;
while ((len = is.read(b, 0, MemoryConstants.KB)) != -1) {
os.write(b, 0, len);
}
return os.toByteArray();
} catch (IOException e) {
e.printStackTrace();
return null;
} finally {
CloseUtils.closeIO(is);
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册