1-12修改

This commit is contained in:
kehaoyuan
2018-01-12 08:26:13 +08:00
parent 95af9902e7
commit bc7aaa8b08
57 changed files with 521 additions and 251 deletions

View File

@ -301,7 +301,7 @@ public class ShareUtils {
public static Bitmap compressBitmap(Bitmap bitmap) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 85, bos);
float zoom = (float) Math.sqrt(10 * 1024 / (float) bos.toByteArray().length);
float zoom = (float) Math.sqrt(8 * 1024 / (float) bos.toByteArray().length);
Matrix matrix = new Matrix();
matrix.setScale(zoom, zoom);
@ -311,7 +311,7 @@ public class ShareUtils {
result.compress(Bitmap.CompressFormat.JPEG, 85, bos);
while (bos.toByteArray().length > 10 * 1024) {
while (bos.toByteArray().length > 8 * 1024) {
System.out.println(bos.toByteArray().length);
matrix.setScale(0.9f, 0.9f);
result = Bitmap.createBitmap(result, 0, 0, result.getWidth(), result.getHeight(), matrix, true);