Skip to content

Commit

Permalink
发布1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
junixapp committed Jun 21, 2019
1 parent 9aaeabd commit 18e202a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion matisse/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ publish {
userOrg = 'li-xiaojun'
groupId = 'com.lxj'
artifactId = 'matisse'
publishVersion = '1.0.3'
publishVersion = '1.0.4'
repoName = 'jrepo'
desc = '图片,视频选择和裁剪库,知乎Matisse的增强版。'
website = 'https://github.com/li-xiaojun/Matisse'
Expand Down
23 changes: 14 additions & 9 deletions matisse/src/main/java/com/lxj/matisse/ui/MatisseActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ public void onBackPressed() {
super.onBackPressed();
}

ArrayList<Uri> selectedUris = new ArrayList<>();
ArrayList<String> selectedPaths = new ArrayList<>();
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Expand All @@ -195,15 +197,9 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
int collectionType = resultBundle.getInt(SelectedItemCollection.STATE_COLLECTION_TYPE,
SelectedItemCollection.COLLECTION_UNDEFINED);
if (data.getBooleanExtra(BasePreviewActivity.EXTRA_RESULT_APPLY, false)) {
if(mSpec.isCrop && selected.size()==1 && selected.get(0).isImage()){
//start crop
startCrop(this, selected.get(0).uri);
return;
}

Intent result = new Intent();
ArrayList<Uri> selectedUris = new ArrayList<>();
ArrayList<String> selectedPaths = new ArrayList<>();
selectedUris.clear();
selectedPaths.clear();
if (selected != null) {
for (Item item : selected) {
selectedUris.add(item.getContentUri());
Expand All @@ -213,6 +209,11 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
result.putParcelableArrayListExtra(MatisseConst.EXTRA_RESULT_SELECTION, selectedUris);
result.putStringArrayListExtra(MatisseConst.EXTRA_RESULT_SELECTION_PATH, selectedPaths);
result.putExtra(MatisseConst.EXTRA_RESULT_ORIGINAL_ENABLE, mOriginalEnable);
if(mSpec.isCrop && selected!=null && selected.size()==1 && selected.get(0).isImage()){
//开启裁剪
startCrop(this, selected.get(0).uri);
return;
}
setResult(RESULT_OK, result);
finish();
} else {
Expand All @@ -232,8 +233,12 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
final Uri resultUri = UCrop.getOutput(data);
if (resultUri != null) {
//finish with result.
Intent result = new Intent();
Intent result = getIntent();
result.putExtra(MatisseConst.EXTRA_RESULT_CROP_PATH, resultUri.getPath());
ArrayList<Uri> selectedUris = (ArrayList<Uri>) mSelectedCollection.asListOfUri();
result.putParcelableArrayListExtra(MatisseConst.EXTRA_RESULT_SELECTION, selectedUris);
ArrayList<String> selectedPaths = (ArrayList<String>) mSelectedCollection.asListOfString();
result.putStringArrayListExtra(MatisseConst.EXTRA_RESULT_SELECTION_PATH, selectedPaths);
setResult(RESULT_OK, result);
finish();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
captureText.setText("拍照路径:"+capturePath);
}else if((cropPath = Matisse.obtainCropResult(data))!=null){
captureText.setVisibility(View.VISIBLE);
captureText.setText("裁剪的路径:"+cropPath);
String s = "裁剪的路径:"+cropPath;
s += "\n 原图路径:" + Matisse.obtainSelectPathResult(data).get(0);
captureText.setText(s);
}else {
mAdapter.setData(Matisse.obtainSelectUriResult(data), Matisse.obtainSelectPathResult(data));
Log.e("OnActivityResult", "originalState: "+String.valueOf(Matisse.obtainOriginalState(data)));
Expand Down

0 comments on commit 18e202a

Please sign in to comment.