Skip to content

Commit

Permalink
fix single compress
Browse files Browse the repository at this point in the history
  • Loading branch information
Qixingchen committed Aug 30, 2019
1 parent de1d8c0 commit 35299a1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/src/main/java/moe/xing/getimage/GetImageActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,16 @@ private File takenPhotoFile() throws IOException {

private void sendSingleAnsAndFinish(@NonNull final File image) {
if (getIntent().getBooleanExtra(NEED_COMPRESS, true)) {
//小于1.5倍压缩目标的不压缩
if (image.length() <= getIntent().getIntExtra(MAX_SIZE_IN_KIB, 700) * 1024 * 1.5) {
RxGetImage.getInstance().onAns(image, getSubscriberID());
RxGetImage.getInstance().onComplete(getSubscriberID());
finish();
return;
}

Luban.compress(this, image)
.setMaxSize(getIntent().getIntExtra(MAX_SIZE_IN_KIB, 150))
.setMaxSize(getIntent().getIntExtra(MAX_SIZE_IN_KIB, 700))
.setMaxWidth(getIntent().getIntExtra(MAX_WIDTH_IN_PX, 1920))
.setMaxHeight(getIntent().getIntExtra(MAX_HEIGHT_IN_PX, 1920))
.putGear(Luban.CUSTOM_GEAR).asObservable()
Expand Down

0 comments on commit 35299a1

Please sign in to comment.