Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加takePicCrop配置项 #273

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public Configuration[] newArray(int size) {
private int imageLoaderType;
private int imageConfig;
private boolean hideCamera;
private boolean takePicCrop;//画廊中选择相机拍摄照片后直接打开裁剪
private boolean isPlayGif;
private boolean hidePreview;
private boolean isVideoPreview;
Expand Down Expand Up @@ -104,6 +105,7 @@ protected Configuration(Parcel in) {
imageLoaderType = in.readInt();
imageConfig = in.readInt();
hideCamera = in.readByte() != 0;
takePicCrop = in.readByte() != 0;
isPlayGif = in.readByte() != 0;
hidePreview = in.readByte() != 0;
isVideoPreview = in.readByte() != 0;
Expand Down Expand Up @@ -172,6 +174,13 @@ public boolean isHideCamera() {
public void setHideCamera(boolean hideCamera) {
this.hideCamera = hideCamera;
}
public boolean isTakePicCrop() {
return takePicCrop;
}

public void setTakePicCrop(boolean takePicCrop) {
this.takePicCrop = takePicCrop;
}

//#ADD
public int getImageLoaderType() {
Expand Down Expand Up @@ -364,6 +373,7 @@ public void writeToParcel(Parcel parcel, int i) {
parcel.writeInt(imageLoaderType);
parcel.writeInt(imageConfig);
parcel.writeByte((byte) (hideCamera ? 1 : 0));
parcel.writeByte((byte) (takePicCrop ? 1 : 0));
parcel.writeByte((byte) (isPlayGif ? 1 : 0));
parcel.writeByte((byte) (hidePreview ? 1 : 0));
parcel.writeByte((byte) (isVideoPreview ? 1 : 0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@ public RxGalleryFinal hideCamera() {
return this;
}

/**
* 相册中选择拍摄照片后直接打开裁剪
* 如果不调用该方法,默认回到相册
*/
public RxGalleryFinal takePicCrop() {
configuration.setHideCamera(false);
configuration.setTakePicCrop(true);
return this;
}

/**
* set to true to hide the bottom controls (shown by default)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,9 @@ public void onNext(MediaBean mediaBean) {
if (bk != -1) {
mMediaBeanList.add(1, mediaBean);
mMediaGridAdapter.notifyDataSetChanged();
if (mConfiguration.isTakePicCrop()) {
onObItemClick(1);
}
} else {
Logger.i("获取:无");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ private void openRadio() {
.radio()
.cropAspectRatioOptions(0, new AspectRatio("3:3", 30, 10))
.crop()
.takePicCrop()
.imageLoader(ImageLoaderType.FRESCO)
.subscribe(new RxBusResultDisposable<ImageRadioResultEvent>() {
@Override
Expand Down