Source:
<code>private void unpackMediaIntent(@NonNull Intent intent) { @SuppressWarnings("unchecked") List<MediaModel> mediaList = (List<MediaModel>) intent.getSerializableExtra(KEY_MEDIA_LIST); if (mediaList != null && !mediaList.isEmpty()) { if (!intent.getBooleanExtra(KEY_UPLOAD_MEDIA_FROM_EDITOR, false)) { PostUploadNotifier.cancelFinalNotificationForMedia(this, mSiteStore.getSiteByLocalId( mediaList.get(0).getLocalSiteId())); mMediaBatchUploaded.addAll(mediaList); } registerPostModelsForMedia(mediaList, intent.getBooleanExtra(KEY_SHOULD_RETRY, false)); <START> ArrayList<MediaModel> toBeUploadedMediaList = new ArrayList<>(mediaList); <END> for (MediaModel media : mediaList) { MediaModel localMedia = mMediaStore.getMediaWithLocalId(media.getId()); if (localMedia != null && MediaUploadState.fromString(localMedia.getUploadState()) == MediaUploadState.UPLOADED) { toBeUploadedMediaList.remove(media); continue; } mMediaUploadHandler.upload(media); } if (!toBeUploadedMediaList.isEmpty()) { mPostUploadNotifier.addMediaInfoToForegroundNotification(toBeUploadedMediaList); } } }</code><technical_language>wondering if improve clarify of this code. some I a bit confusing while parsing it: - "toBeUploadedMediaList" is initialized media want upload - "toBeUploadedMediaList" is decide want upload, show notification consider following: - initialize "toBeUploadedMediaList" empty list - if media uploaded, add list - iterate "toBeUploadedMediaList" enqueue items this list this: ArrayList<MediaModel> toBeUploadedMediaList = new ArrayList<>(); for (MediaModel media : mediaList) { MediaModel localMedia = mMediaStore.getMediaWithLocalId(media.getId()); boolean notUploadedYet = localMedia != null && MediaUploadState.fromString(localMedia.getUploadState()) != MediaUploadState.UPLOADED; if (notUploadedYet) { toBeUploadedMediaList.add(localMedia); } } for (MediaModel media : toBeUploadedMediaList) { mMediaUploadHandler.upload(media); } if (!toBeUploadedMediaList.isEmpty()) { mPostUploadNotifier.addMediaInfoToForegroundNotification(toBeUploadedMediaList); } Wdyt</technical_language>

Target:
private void unpackMediaIntent(@NonNull Intent intent) { @SuppressWarnings("unchecked") List<MediaModel> mediaList = (List<MediaModel>) intent.getSerializableExtra(KEY_MEDIA_LIST); if (mediaList != null && !mediaList.isEmpty()) { if (!intent.getBooleanExtra(KEY_UPLOAD_MEDIA_FROM_EDITOR, false)) { PostUploadNotifier.cancelFinalNotificationForMedia(this, mSiteStore.getSiteByLocalId( mediaList.get(0).getLocalSiteId())); mMediaBatchUploaded.addAll(mediaList); } registerPostModelsForMedia(mediaList, intent.getBooleanExtra(KEY_SHOULD_RETRY, false)); ArrayList<MediaModel> toBeUploadedMediaList = new ArrayList<>(); for (MediaModel media : mediaList) { MediaModel localMedia = mMediaStore.getMediaWithLocalId(media.getId()); boolean notUploadedYet = localMedia != null && MediaUploadState.fromString(localMedia.getUploadState()) != MediaUploadState.UPLOADED; if (notUploadedYet) { toBeUploadedMediaList.add(localMedia); } } for (MediaModel media : toBeUploadedMediaList) { mMediaUploadHandler.upload(media); } if (!toBeUploadedMediaList.isEmpty()) { mPostUploadNotifier.addMediaInfoToForegroundNotification(toBeUploadedMediaList); } } }