diff options
author | Alex Ning <chineseperson5@gmail.com> | 2021-07-16 00:44:51 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2021-07-16 00:44:51 +0000 |
commit | a610be7d16316a17d4c6910027d135ceda09f2ed (patch) | |
tree | 8fd28866e6f57412548ab0d07e6b7ae42f84b871 /app/src/main/java/ml | |
parent | 4f4dc821d4daaf332c16d970256999c9532fcb3c (diff) | |
download | infinity-for-reddit-a610be7d16316a17d4c6910027d135ceda09f2ed.tar infinity-for-reddit-a610be7d16316a17d4c6910027d135ceda09f2ed.tar.gz infinity-for-reddit-a610be7d16316a17d4c6910027d135ceda09f2ed.tar.bz2 infinity-for-reddit-a610be7d16316a17d4c6910027d135ceda09f2ed.tar.lz infinity-for-reddit-a610be7d16316a17d4c6910027d135ceda09f2ed.tar.xz infinity-for-reddit-a610be7d16316a17d4c6910027d135ceda09f2ed.tar.zst infinity-for-reddit-a610be7d16316a17d4c6910027d135ceda09f2ed.zip |
Select or capture image in PostGalleryActivity.
Diffstat (limited to '')
2 files changed, 7 insertions, 1 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java index 9b80db16..50109df3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java @@ -378,7 +378,10 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee } 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() { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RedditGallerySubmissionRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RedditGallerySubmissionRecyclerViewAdapter.java index a03d28ec..b81f235b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RedditGallerySubmissionRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RedditGallerySubmissionRecyclerViewAdapter.java @@ -121,6 +121,9 @@ public class RedditGallerySubmissionRecyclerViewAdapter extends RecyclerView.Ada } public void addImage(String imageUrl) { + if (redditGalleryImageInfoList == null) { + redditGalleryImageInfoList = new ArrayList<>(); + } redditGalleryImageInfoList.add(new RedditGalleryImageInfo(imageUrl)); notifyItemInserted(redditGalleryImageInfoList.size() - 1); } |