GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — see 10/25 log · bbbBBBSG/AndroidUtilCode@cb23f4e

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • README-CN.md
  • README.md
  • build.gradle
  • update_log.md
  • utilcode/src/main/java/com/blankj/utilcode/util
    • ImageUtils.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎README-CN.md‎

Copy file name to clipboardExpand all lines: README-CN.md
+2-2Lines changed: 2 additions & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ getComments : 获取压缩文件中的注释链表
612612

613613
Gradle:
614614
``` groovy
615-
compile 'com.blankj:utilcode:1.9.4'
615+
compile 'com.blankj:utilcode:1.9.5'
616616
```
617617

618618

@@ -635,7 +635,7 @@ Utils.init(application);
635635

636636
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
637637

638-
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.9.4-brightgreen.svg
638+
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.9.5-brightgreen.svg
639639
[auc]: https://github.com/Blankj/AndroidUtilCode
640640

641641
[apisvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
Collapse file

‎README.md‎

Copy file name to clipboardExpand all lines: README.md
+2-2Lines changed: 2 additions & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ getComments
612612

613613
Gradle:
614614
``` groovy
615-
compile 'com.blankj:utilcode:1.9.4'
615+
compile 'com.blankj:utilcode:1.9.5'
616616
```
617617

618618

@@ -635,7 +635,7 @@ Utils.init(application);
635635

636636
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
637637

638-
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.9.4-brightgreen.svg
638+
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.9.5-brightgreen.svg
639639
[auc]: https://github.com/Blankj/AndroidUtilCode
640640

641641
[apisvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
Collapse file

‎build.gradle‎

Copy file name to clipboardExpand all lines: build.gradle
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ ext {
2929
minSdkVersion = 14
3030
targetSdkVersion = 22
3131

32-
versionCode = 100900400
33-
versionName = '1.9.4'
32+
versionCode = 100900500
33+
versionName = '1.9.5'
3434

3535
// App dependencies
3636
supportVersion = '25.3.1'
Collapse file

‎update_log.md‎

Copy file name to clipboardExpand all lines: update_log.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
* 17/10/25 修复LogUtils边框
1+
* 17/10/25 修复LogUtils边框,修复getBitmap从流获取
22
* 17/09/30 完善FragmentUtils,发布1.9.2
33
* 17/09/29 完善FragmentUtils和isInstallApp
44
* 17/09/28 完善FragmentUtils
Collapse file

‎utilcode/src/main/java/com/blankj/utilcode/util/ImageUtils.java‎

Copy file name to clipboardExpand all lines: utilcode/src/main/java/com/blankj/utilcode/util/ImageUtils.java
+22-6Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
import android.support.v4.content.ContextCompat;
3636
import android.view.View;
3737

38+
import com.blankj.utilcode.constant.MemoryConstants;
39+
3840
import java.io.BufferedOutputStream;
3941
import java.io.ByteArrayOutputStream;
4042
import java.io.File;
@@ -240,12 +242,8 @@ public static Bitmap getBitmap(final InputStream is) {
240242
*/
241243
public static Bitmap getBitmap(final InputStream is, final int maxWidth, final int maxHeight) {
242244
if (is == null) return null;
243-
BitmapFactory.Options options = new BitmapFactory.Options();
244-
options.inJustDecodeBounds = true;
245-
BitmapFactory.decodeStream(is, null, options);
246-
options.inSampleSize = calculateInSampleSize(options, maxWidth, maxHeight);
247-
options.inJustDecodeBounds = false;
248-
return BitmapFactory.decodeStream(is, null, options);
245+
byte[] bytes = input2Byte(is);
246+
return getBitmap(bytes, 0, maxWidth, maxHeight);
249247
}
250248

251249
/**
@@ -1776,4 +1774,22 @@ private static int calculateInSampleSize(final BitmapFactory.Options options,
17761774
}
17771775
return inSampleSize;
17781776
}
1777+
1778+
private static byte[] input2Byte(final InputStream is) {
1779+
if (is == null) return null;
1780+
try {
1781+
ByteArrayOutputStream os = new ByteArrayOutputStream();
1782+
byte[] b = new byte[MemoryConstants.KB];
1783+
int len;
1784+
while ((len = is.read(b, 0, MemoryConstants.KB)) != -1) {
1785+
os.write(b, 0, len);
1786+
}
1787+
return os.toByteArray();
1788+
} catch (IOException e) {
1789+
e.printStackTrace();
1790+
return null;
1791+
} finally {
1792+
CloseUtils.closeIO(is);
1793+
}
1794+
}
17791795
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.