mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-30 12:57: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);
|
isSpoiler = savedInstanceState.getBoolean(IS_SPOILER_STATE);
|
||||||
isNSFW = savedInstanceState.getBoolean(IS_NSFW_STATE);
|
isNSFW = savedInstanceState.getBoolean(IS_NSFW_STATE);
|
||||||
redditGalleryImageInfoList = savedInstanceState.getParcelableArrayList(REDDIT_GALLERY_IMAGE_INFO_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);
|
adapter.setRedditGalleryImageInfoList(redditGalleryImageInfoList);
|
||||||
|
|
||||||
if (subredditName != null) {
|
if (subredditName != null) {
|
||||||
@ -461,12 +467,14 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee
|
|||||||
} catch (ExecutionException | InterruptedException e) {
|
} catch (ExecutionException | InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
handler.post(() -> {
|
handler.post(() -> {
|
||||||
|
adapter.removeFailedToUploadImage();
|
||||||
Snackbar.make(coordinatorLayout, R.string.get_image_bitmap_failed, Snackbar.LENGTH_LONG).show();
|
Snackbar.make(coordinatorLayout, R.string.get_image_bitmap_failed, Snackbar.LENGTH_LONG).show();
|
||||||
isUploading = false;
|
isUploading = false;
|
||||||
});
|
});
|
||||||
} catch (XmlPullParserException | JSONException | IOException e) {
|
} catch (XmlPullParserException | JSONException | IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
handler.post(() -> {
|
handler.post(() -> {
|
||||||
|
adapter.removeFailedToUploadImage();
|
||||||
Snackbar.make(coordinatorLayout, R.string.error_processing_image, Snackbar.LENGTH_LONG).show();
|
Snackbar.make(coordinatorLayout, R.string.error_processing_image, Snackbar.LENGTH_LONG).show();
|
||||||
isUploading = false;
|
isUploading = false;
|
||||||
});
|
});
|
||||||
|
@ -136,6 +136,11 @@ public class RedditGallerySubmissionRecyclerViewAdapter extends RecyclerView.Ada
|
|||||||
notifyItemChanged(redditGalleryImageInfoList.size() - 1);
|
notifyItemChanged(redditGalleryImageInfoList.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeFailedToUploadImage() {
|
||||||
|
redditGalleryImageInfoList.remove(redditGalleryImageInfoList.size() - 1);
|
||||||
|
notifyItemRemoved(redditGalleryImageInfoList.size());
|
||||||
|
}
|
||||||
|
|
||||||
class ImageViewHolder extends RecyclerView.ViewHolder {
|
class ImageViewHolder extends RecyclerView.ViewHolder {
|
||||||
@BindView(R.id.aspect_ratio_gif_image_view_item_reddit_gallery_submission_image)
|
@BindView(R.id.aspect_ratio_gif_image_view_item_reddit_gallery_submission_image)
|
||||||
AspectRatioGifImageView imageView;
|
AspectRatioGifImageView imageView;
|
||||||
|
Loading…
Reference in New Issue
Block a user