@@ -80,12 +80,12 @@ public void onRestoreInstanceState(Bundle savedInstanceState) {
8080 ArrayList <Attachment > attachmentList = savedInstanceState .getParcelableArrayList (STATE_KEY_ATTACHMENTS );
8181 // noinspection ConstantConditions, we know this is set in onSaveInstanceState
8282 for (Attachment attachment : attachmentList ) {
83- attachments .put (attachment .uri , attachment );
83+ attachments .put (attachment .getUri () , attachment );
8484 attachmentMvpView .addAttachmentView (attachment );
8585
86- if (attachment .state == LoadingState .URI_ONLY ) {
86+ if (attachment .getState () == LoadingState .URI_ONLY ) {
8787 initAttachmentInfoLoader (attachment );
88- } else if (attachment .state == LoadingState .METADATA ) {
88+ } else if (attachment .getState () == LoadingState .METADATA ) {
8989 initAttachmentContentLoader (attachment );
9090 }
9191 }
@@ -107,7 +107,7 @@ public boolean checkOkForSendingOrDraftSaving() {
107107
108108 private boolean hasLoadingAttachments () {
109109 for (Attachment attachment : attachments .values ()) {
110- Loader loader = loaderManager .getLoader (attachment .loaderId );
110+ Loader loader = loaderManager .getLoader (attachment .getLoaderId () );
111111 if (loader != null && loader .isStarted ()) {
112112 return true ;
113113 }
@@ -183,11 +183,12 @@ private void addInlineAttachment(AttachmentViewInfo attachmentViewInfo) {
183183 attachment = attachment .deriveWithMetadataLoaded (
184184 attachmentViewInfo .mimeType , attachmentViewInfo .displayName , attachmentViewInfo .size );
185185
186- inlineAttachments .put (attachment .uri , new InlineAttachment (attachmentViewInfo .part .getContentId (), attachment ));
186+ inlineAttachments .put (
187+ attachment .getUri (), new InlineAttachment (attachmentViewInfo .part .getContentId (), attachment ));
187188
188189 Bundle bundle = new Bundle ();
189- bundle .putParcelable (LOADER_ARG_ATTACHMENT , attachment .uri );
190- loaderManager .initLoader (attachment .loaderId , bundle , mInlineAttachmentContentLoaderCallback );
190+ bundle .putParcelable (LOADER_ARG_ATTACHMENT , attachment .getUri () );
191+ loaderManager .initLoader (attachment .getLoaderId () , bundle , mInlineAttachmentContentLoaderCallback );
191192 }
192193
193194 private void addInternalAttachment (Uri uri , String contentType , boolean allowMessageType ) {
@@ -243,37 +244,37 @@ public void processMessageToForwardAsAttachment(MessageViewInfo messageViewInfo)
243244 }
244245
245246 private void addAttachmentAndStartLoader (Attachment attachment ) {
246- attachments .put (attachment .uri , attachment );
247+ attachments .put (attachment .getUri () , attachment );
247248 listener .onAttachmentAdded ();
248249 attachmentMvpView .addAttachmentView (attachment );
249250
250- if (attachment .state == LoadingState .URI_ONLY ) {
251+ if (attachment .getState () == LoadingState .URI_ONLY ) {
251252 initAttachmentInfoLoader (attachment );
252- } else if (attachment .state == LoadingState .METADATA ) {
253+ } else if (attachment .getState () == LoadingState .METADATA ) {
253254 initAttachmentContentLoader (attachment );
254255 } else {
255256 throw new IllegalStateException ("Attachment can only be added in URI_ONLY or METADATA state!" );
256257 }
257258 }
258259
259260 private void initAttachmentInfoLoader (Attachment attachment ) {
260- if (attachment .state != LoadingState .URI_ONLY ) {
261+ if (attachment .getState () != LoadingState .URI_ONLY ) {
261262 throw new IllegalStateException ("initAttachmentInfoLoader can only be called for URI_ONLY state!" );
262263 }
263264
264265 Bundle bundle = new Bundle ();
265- bundle .putParcelable (LOADER_ARG_ATTACHMENT , attachment .uri );
266- loaderManager .initLoader (attachment .loaderId , bundle , mAttachmentInfoLoaderCallback );
266+ bundle .putParcelable (LOADER_ARG_ATTACHMENT , attachment .getUri () );
267+ loaderManager .initLoader (attachment .getLoaderId () , bundle , mAttachmentInfoLoaderCallback );
267268 }
268269
269270 private void initAttachmentContentLoader (Attachment attachment ) {
270- if (attachment .state != LoadingState .METADATA ) {
271+ if (attachment .getState () != LoadingState .METADATA ) {
271272 throw new IllegalStateException ("initAttachmentContentLoader can only be called for METADATA state!" );
272273 }
273274
274275 Bundle bundle = new Bundle ();
275- bundle .putParcelable (LOADER_ARG_ATTACHMENT , attachment .uri );
276- loaderManager .initLoader (attachment .loaderId , bundle , mAttachmentContentLoaderCallback );
276+ bundle .putParcelable (LOADER_ARG_ATTACHMENT , attachment .getUri () );
277+ loaderManager .initLoader (attachment .getLoaderId () , bundle , mAttachmentContentLoaderCallback );
277278 }
278279
279280 private int getNextFreeLoaderId () {
@@ -296,16 +297,16 @@ public void onLoadFinished(Loader<Attachment> loader, Attachment attachment) {
296297 int loaderId = loader .getId ();
297298 loaderManager .destroyLoader (loaderId );
298299
299- if (!attachments .containsKey (attachment .uri )) {
300+ if (!attachments .containsKey (attachment .getUri () )) {
300301 return ;
301302 }
302303
303- if (attachment .state == LoadingState .METADATA ) {
304+ if (attachment .getState () == LoadingState .METADATA ) {
304305 attachmentMvpView .updateAttachmentView (attachment );
305- attachments .put (attachment .uri , attachment );
306+ attachments .put (attachment .getUri () , attachment );
306307 initAttachmentContentLoader (attachment );
307308 } else {
308- attachments .remove (attachment .uri );
309+ attachments .remove (attachment .getUri () );
309310 attachmentMvpView .removeAttachmentView (attachment );
310311 }
311312 }
@@ -329,15 +330,15 @@ public void onLoadFinished(Loader<Attachment> loader, Attachment attachment) {
329330 int loaderId = loader .getId ();
330331 loaderManager .destroyLoader (loaderId );
331332
332- if (!attachments .containsKey (attachment .uri )) {
333+ if (!attachments .containsKey (attachment .getUri () )) {
333334 return ;
334335 }
335336
336- if (attachment .state == Attachment .LoadingState .COMPLETE ) {
337+ if (attachment .getState () == Attachment .LoadingState .COMPLETE ) {
337338 attachmentMvpView .updateAttachmentView (attachment );
338- attachments .put (attachment .uri , attachment );
339+ attachments .put (attachment .getUri () , attachment );
339340 } else {
340- attachments .remove (attachment .uri );
341+ attachments .remove (attachment .getUri () );
341342 attachmentMvpView .removeAttachmentView (attachment );
342343 }
343344
@@ -363,11 +364,11 @@ public void onLoadFinished(Loader<Attachment> loader, Attachment attachment) {
363364 int loaderId = loader .getId ();
364365 loaderManager .destroyLoader (loaderId );
365366
366- if (attachment .state == Attachment .LoadingState .COMPLETE ) {
367- inlineAttachments .put (attachment .uri , new InlineAttachment (
368- inlineAttachments .get (attachment .uri ).getContentId (), attachment ));
367+ if (attachment .getState () == Attachment .LoadingState .COMPLETE ) {
368+ inlineAttachments .put (attachment .getUri () , new InlineAttachment (
369+ inlineAttachments .get (attachment .getUri () ).getContentId (), attachment ));
369370 } else {
370- inlineAttachments .remove (attachment .uri );
371+ inlineAttachments .remove (attachment .getUri () );
371372 }
372373
373374 postPerformStalledAction ();
@@ -432,7 +433,7 @@ public void attachmentProgressDialogCancelled() {
432433 public void onClickRemoveAttachment (Uri uri ) {
433434 Attachment attachment = attachments .get (uri );
434435
435- loaderManager .destroyLoader (attachment .loaderId );
436+ loaderManager .destroyLoader (attachment .getLoaderId () );
436437
437438 attachmentMvpView .removeAttachmentView (attachment );
438439 attachments .remove (uri );
0 commit comments