Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yonbor605 committed Sep 29, 2018
1 parent 6089332 commit 00194ab
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.zhihu.matisse.listener.OnCheckedListener;
import com.zhihu.matisse.listener.OnSelectedListener;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
Expand Down Expand Up @@ -62,6 +63,7 @@ public class ImageVideoSelector2Activity extends BaseActivity implements View.On
private UriAdapter mAdapter;
private GridImageAdapter mAdapter2;
private int maxSelectNum = 9;
private List<String> mSelectedPicPath = new ArrayList<>();

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand Down Expand Up @@ -233,7 +235,20 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.e("OnActivityResult ", String.valueOf(Matisse.obtainOriginalState(data)));


mAdapter2.setData(Matisse.obtainResult(data), Matisse.obtainPathResult(data));
List<String> pathList = Matisse.obtainPathResult(data);

for (int i = 0; i < pathList.size(); i++) {
mSelectedPicPath.add(pathList.get(i));
}


if (mSelectedPicPath.size() <= maxSelectNum) {
mAdapter2.setData(Matisse.obtainResult(data), mSelectedPicPath);
} else {
// showToast("所选图片超过最大限制张数");
mAdapter2.setData(Matisse.obtainResult(data), mSelectedPicPath.subList(0, maxSelectNum));
}

}
}

Expand Down

0 comments on commit 00194ab

Please sign in to comment.