Skip to content

Commit 6fd95ea

Browse files
author
duyu
committed
修复预览时单选错误问题
1 parent 5be2361 commit 6fd95ea

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

library/src/main/java/com/rain/library/ui/PhotoPreviewActivity.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,15 @@ public void onClick(View v) {
145145
}
146146
String path = photos.get(pos).getOriginalImagePath();
147147
if (selectPhotos.contains(path)) {
148+
selectPhotosInfo.remove(photos.get(pos));
148149
selectPhotos.remove(path);
149150
checkbox.setChecked(false);
150151
} else {
151152
if (maxPickSize == selectPhotos.size()) {
152153
checkbox.setChecked(false);
153154
return;
154155
}
156+
selectPhotosInfo.add(photos.get(pos));
155157
selectPhotos.add(path);
156158
checkbox.setChecked(true);
157159
}
@@ -229,7 +231,8 @@ public boolean onOptionsItemSelected(MenuItem item) {
229231
public void onSuccess(File file) {
230232
if (file.exists()) {
231233
Rlog.e("Rain", "Luban compression success:" + file.getAbsolutePath() + " ; image length = " + file.length());
232-
selectPhotosInfo.get(imageFilePath.size()).setCompressionImagePath(file.getAbsolutePath());
234+
Photo photo = selectPhotosInfo.get(imageFilePath.size());
235+
photo.setCompressionImagePath(file.getAbsolutePath());
233236
imageFilePath.add(file.getAbsolutePath());
234237
if (imageFilePath != null && imageFilePath.size() > 0 && imageFilePath.size() == selectPhotos.size()) {
235238
Rlog.e("Rain", "all select image compression success!");

0 commit comments

Comments
 (0)