Commit 4787cd559a899e20ff825391bf455338514630be
1 parent
28b544c8
优化预览图片质量,尺寸100->320
Showing
6 changed files
with
10 additions
and
10 deletions
config.gradle
lib_media/src/main/java/com/cnlive/media/ui/widget/crop/CropUtil.java
| @@ -181,7 +181,7 @@ public class CropUtil { | @@ -181,7 +181,7 @@ public class CropUtil { | ||
| 181 | if (file.exists()) | 181 | if (file.exists()) |
| 182 | file.delete(); | 182 | file.delete(); |
| 183 | FileOutputStream fos = new FileOutputStream(file); | 183 | FileOutputStream fos = new FileOutputStream(file); |
| 184 | - bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos); | 184 | + bitmap.compress(Bitmap.CompressFormat.JPEG, 320, fos); |
| 185 | fos.flush(); | 185 | fos.flush(); |
| 186 | fos.close(); | 186 | fos.close(); |
| 187 | bitmap.recycle(); | 187 | bitmap.recycle(); |
lib_media/src/main/java/com/cnlive/media/utils/AndroidQUtil.java
| @@ -183,7 +183,7 @@ public class AndroidQUtil { | @@ -183,7 +183,7 @@ public class AndroidQUtil { | ||
| 183 | if (imageFileDirctory.exists()) { | 183 | if (imageFileDirctory.exists()) { |
| 184 | File imageFile = new File(PICTURES + "/" + signImage + "/" + fileName); | 184 | File imageFile = new File(PICTURES + "/" + signImage + "/" + fileName); |
| 185 | FileOutputStream fileOutputStream = new FileOutputStream(imageFile, false); | 185 | FileOutputStream fileOutputStream = new FileOutputStream(imageFile, false); |
| 186 | - bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream); | 186 | + bitmap.compress(Bitmap.CompressFormat.JPEG, 320, fileOutputStream); |
| 187 | fileOutputStream.flush(); | 187 | fileOutputStream.flush(); |
| 188 | return imageFile.getAbsolutePath(); | 188 | return imageFile.getAbsolutePath(); |
| 189 | } else if (imageFileDirctory.mkdir()) { | 189 | } else if (imageFileDirctory.mkdir()) { |
| @@ -191,7 +191,7 @@ public class AndroidQUtil { | @@ -191,7 +191,7 @@ public class AndroidQUtil { | ||
| 191 | File imageFile = new File(PICTURES + "/" + signImage + "/" + fileName); | 191 | File imageFile = new File(PICTURES + "/" + signImage + "/" + fileName); |
| 192 | //通过流将图片写入 | 192 | //通过流将图片写入 |
| 193 | FileOutputStream fileOutputStream = new FileOutputStream(imageFile); | 193 | FileOutputStream fileOutputStream = new FileOutputStream(imageFile); |
| 194 | - bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream); | 194 | + bitmap.compress(Bitmap.CompressFormat.JPEG, 320, fileOutputStream); |
| 195 | fileOutputStream.flush(); | 195 | fileOutputStream.flush(); |
| 196 | fileOutputStream.close(); | 196 | fileOutputStream.close(); |
| 197 | return imageFile.getAbsolutePath(); | 197 | return imageFile.getAbsolutePath(); |
lib_media/src/main/java/com/cnlive/media/utils/FileUtils.java
| @@ -166,7 +166,7 @@ public class FileUtils { | @@ -166,7 +166,7 @@ public class FileUtils { | ||
| 166 | try { | 166 | try { |
| 167 | FileOutputStream fout = new FileOutputStream(jpegName); | 167 | FileOutputStream fout = new FileOutputStream(jpegName); |
| 168 | BufferedOutputStream bos = new BufferedOutputStream(fout); | 168 | BufferedOutputStream bos = new BufferedOutputStream(fout); |
| 169 | - b.compress(Bitmap.CompressFormat.JPEG, 100, bos); | 169 | + b.compress(Bitmap.CompressFormat.JPEG, 320, bos); |
| 170 | bos.flush(); | 170 | bos.flush(); |
| 171 | bos.close(); | 171 | bos.close(); |
| 172 | File newFile= new File(jpegName); | 172 | File newFile= new File(jpegName); |
lib_media/src/main/java/com/cnlive/media/utils/GlideCacheUtil.java
| @@ -378,7 +378,7 @@ public class GlideCacheUtil { | @@ -378,7 +378,7 @@ public class GlideCacheUtil { | ||
| 378 | @Override | 378 | @Override |
| 379 | public void subscribe(ObservableEmitter<Bitmap> emitter) throws Exception { | 379 | public void subscribe(ObservableEmitter<Bitmap> emitter) throws Exception { |
| 380 | ContentResolver contentResolver = context.getContentResolver(); | 380 | ContentResolver contentResolver = context.getContentResolver(); |
| 381 | - Bitmap bm = contentResolver.loadThumbnail(mediaUri, new Size(100, 100), null); | 381 | + Bitmap bm = contentResolver.loadThumbnail(mediaUri, new Size(320, 320), null); |
| 382 | if (bm != null) { | 382 | if (bm != null) { |
| 383 | emitter.onNext(bm); | 383 | emitter.onNext(bm); |
| 384 | } else { | 384 | } else { |
lib_media/src/main/java/com/cnlive/media/utils/album/AlbumProcessUtil.java
| @@ -113,7 +113,7 @@ public class AlbumProcessUtil { | @@ -113,7 +113,7 @@ public class AlbumProcessUtil { | ||
| 113 | filePic.createNewFile(); | 113 | filePic.createNewFile(); |
| 114 | } | 114 | } |
| 115 | FileOutputStream fos = new FileOutputStream(filePic); | 115 | FileOutputStream fos = new FileOutputStream(filePic); |
| 116 | - mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos); | 116 | + mBitmap.compress(Bitmap.CompressFormat.JPEG, 320, fos); |
| 117 | fos.flush(); | 117 | fos.flush(); |
| 118 | fos.close(); | 118 | fos.close(); |
| 119 | 119 | ||
| @@ -414,7 +414,7 @@ public class AlbumProcessUtil { | @@ -414,7 +414,7 @@ public class AlbumProcessUtil { | ||
| 414 | filePic.createNewFile(); | 414 | filePic.createNewFile(); |
| 415 | } | 415 | } |
| 416 | FileOutputStream fos = new FileOutputStream(filePic); | 416 | FileOutputStream fos = new FileOutputStream(filePic); |
| 417 | - mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos); | 417 | + mBitmap.compress(Bitmap.CompressFormat.JPEG, 320, fos); |
| 418 | fos.flush(); | 418 | fos.flush(); |
| 419 | fos.close(); | 419 | fos.close(); |
| 420 | 420 | ||
| @@ -441,7 +441,7 @@ public class AlbumProcessUtil { | @@ -441,7 +441,7 @@ public class AlbumProcessUtil { | ||
| 441 | filePic.createNewFile(); | 441 | filePic.createNewFile(); |
| 442 | } | 442 | } |
| 443 | FileOutputStream fos = new FileOutputStream(filePic); | 443 | FileOutputStream fos = new FileOutputStream(filePic); |
| 444 | - mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos); | 444 | + mBitmap.compress(Bitmap.CompressFormat.JPEG, 320, fos); |
| 445 | fos.flush(); | 445 | fos.flush(); |
| 446 | fos.close(); | 446 | fos.close(); |
| 447 | 447 | ||
| @@ -464,7 +464,7 @@ public class AlbumProcessUtil { | @@ -464,7 +464,7 @@ public class AlbumProcessUtil { | ||
| 464 | filePic.createNewFile(); | 464 | filePic.createNewFile(); |
| 465 | } | 465 | } |
| 466 | FileOutputStream fos = new FileOutputStream(filePic); | 466 | FileOutputStream fos = new FileOutputStream(filePic); |
| 467 | - mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos); | 467 | + mBitmap.compress(Bitmap.CompressFormat.JPEG, 320, fos); |
| 468 | fos.flush(); | 468 | fos.flush(); |
| 469 | fos.close(); | 469 | fos.close(); |
| 470 | } catch (IOException e) { | 470 | } catch (IOException e) { |