mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-29 04:17:12 +01:00
Automatically remove images that are not uploaded in PostGalleryActivity.
This commit is contained in:
parent
5a12266c6f
commit
19a94f7e0a
@ -266,6 +266,12 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee
|
||||
isSpoiler = savedInstanceState.getBoolean(IS_SPOILER_STATE);
|
||||
isNSFW = savedInstanceState.getBoolean(IS_NSFW_STATE);
|
||||
redditGalleryImageInfoList = savedInstanceState.getParcelableArrayList(REDDIT_GALLERY_IMAGE_INFO_STATE);
|
||||
if (redditGalleryImageInfoList != null && !redditGalleryImageInfoList.isEmpty()) {
|
||||
if (redditGalleryImageInfoList.get(redditGalleryImageInfoList.size() - 1).payload == null) {
|
||||
imageUri = Uri.parse(redditGalleryImageInfoList.get(redditGalleryImageInfoList.size() - 1).imageUrlString);
|
||||
uploadImage();
|
||||
}
|
||||
}
|
||||
adapter.setRedditGalleryImageInfoList(redditGalleryImageInfoList);
|
||||
|
||||
if (subredditName != null) {
|
||||
@ -461,12 +467,14 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee
|
||||
} catch (ExecutionException | InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
handler.post(() -> {
|
||||
adapter.removeFailedToUploadImage();
|
||||
Snackbar.make(coordinatorLayout, R.string.get_image_bitmap_failed, Snackbar.LENGTH_LONG).show();
|
||||
isUploading = false;
|
||||
});
|
||||
} catch (XmlPullParserException | JSONException | IOException e) {
|
||||
e.printStackTrace();
|
||||
handler.post(() -> {
|
||||
adapter.removeFailedToUploadImage();
|
||||
Snackbar.make(coordinatorLayout, R.string.error_processing_image, Snackbar.LENGTH_LONG).show();
|
||||
isUploading = false;
|
||||
});
|
||||
|
@ -136,6 +136,11 @@ public class RedditGallerySubmissionRecyclerViewAdapter extends RecyclerView.Ada
|
||||
notifyItemChanged(redditGalleryImageInfoList.size() - 1);
|
||||
}
|
||||
|
||||
public void removeFailedToUploadImage() {
|
||||
redditGalleryImageInfoList.remove(redditGalleryImageInfoList.size() - 1);
|
||||
notifyItemRemoved(redditGalleryImageInfoList.size());
|
||||
}
|
||||
|
||||
class ImageViewHolder extends RecyclerView.ViewHolder {
|
||||
@BindView(R.id.aspect_ratio_gif_image_view_item_reddit_gallery_submission_image)
|
||||
AspectRatioGifImageView imageView;
|
||||
|
Loading…
Reference in New Issue
Block a user