Select or capture image in PostGalleryActivity.

This commit is contained in:
Alex Ning 2021-07-16 08:44:51 +08:00
parent 4f4dc821d4
commit a610be7d16
2 changed files with 7 additions and 1 deletions

View File

@ -378,7 +378,10 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee
} }
public void selectImage() { public void selectImage() {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, resources.getString(R.string.select_from_gallery)), PICK_IMAGE_REQUEST_CODE);
} }
public void captureImage() { public void captureImage() {

View File

@ -121,6 +121,9 @@ public class RedditGallerySubmissionRecyclerViewAdapter extends RecyclerView.Ada
} }
public void addImage(String imageUrl) { public void addImage(String imageUrl) {
if (redditGalleryImageInfoList == null) {
redditGalleryImageInfoList = new ArrayList<>();
}
redditGalleryImageInfoList.add(new RedditGalleryImageInfo(imageUrl)); redditGalleryImageInfoList.add(new RedditGalleryImageInfo(imageUrl));
notifyItemInserted(redditGalleryImageInfoList.size() - 1); notifyItemInserted(redditGalleryImageInfoList.size() - 1);
} }