mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 14:53:59 +01:00 
			
		
		
		
	Fix caption lost on accepting 'Is this a pic of'
Fixes issue 5842 by correcting the implementation of onUserConfirmedUploadIsOfPlace in UploadMediaDetailsContract's UserActionListener
This commit is contained in:
		
							parent
							
								
									235e8cdba2
								
							
						
					
					
						commit
						3b6de969b8
					
				
					 3 changed files with 16 additions and 15 deletions
				
			
		|  | @ -398,7 +398,7 @@ public class UploadMediaDetailFragment extends UploadBaseFragment implements | |||
|                 final boolean response = UploadActivity.nearbyPopupAnswers.get(nearbyPlace); | ||||
|                 if (response) { | ||||
|                     if (callback != null) { | ||||
|                         presenter.onUserConfirmedUploadIsOfPlace(nearbyPlace); | ||||
|                         presenter.onUserConfirmedUploadIsOfPlace(nearbyPlace, indexOfFragment); | ||||
|                     } | ||||
|                 } | ||||
|             } else { | ||||
|  | @ -445,7 +445,7 @@ public class UploadMediaDetailFragment extends UploadBaseFragment implements | |||
|                 () -> { | ||||
|                     // Execute when user confirms the upload is of the specified place | ||||
|                     UploadActivity.nearbyPopupAnswers.put(place, true); | ||||
|                     presenter.onUserConfirmedUploadIsOfPlace(place); | ||||
|                     presenter.onUserConfirmedUploadIsOfPlace(place, indexOfFragment); | ||||
|                 }, | ||||
|                 () -> { | ||||
|                     // Execute when user cancels the upload of the specified place | ||||
|  | @ -486,7 +486,7 @@ public class UploadMediaDetailFragment extends UploadBaseFragment implements | |||
|             if (UploadActivity.nearbyPopupAnswers.containsKey(nearbyPlace)) { | ||||
|                 final boolean response = UploadActivity.nearbyPopupAnswers.get(nearbyPlace); | ||||
|                 if (response) { | ||||
|                     presenter.onUserConfirmedUploadIsOfPlace(nearbyPlace); | ||||
|                     presenter.onUserConfirmedUploadIsOfPlace(nearbyPlace, indexOfFragment); | ||||
|                 } | ||||
|             } else { | ||||
|                 showNearbyPlaceFound(nearbyPlace); | ||||
|  |  | |||
|  | @ -117,6 +117,6 @@ interface UploadMediaDetailsContract { | |||
| 
 | ||||
|         fun onEditButtonClicked(indexInViewFlipper: Int) | ||||
| 
 | ||||
|         fun onUserConfirmedUploadIsOfPlace(place: Place?) | ||||
|         fun onUserConfirmedUploadIsOfPlace(place: Place?, uploadItemIndex: Int) | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -322,23 +322,24 @@ public class UploadMediaPresenter implements UserActionListener, SimilarImageInt | |||
|   } | ||||
| 
 | ||||
|   /** | ||||
|    * Updates the information regarding the specified place for uploads | ||||
|    * Updates the information regarding the specified place for the specified upload item | ||||
|    * when the user confirms the suggested nearby place. | ||||
|    * | ||||
|    * @param place The place to be associated with the uploads. | ||||
|    * @param uploadItemIndex Index of the uploadItem whose detected place has been confirmed | ||||
|    */ | ||||
|   @Override | ||||
|   public void onUserConfirmedUploadIsOfPlace(final Place place) { | ||||
|       final List<UploadItem> uploads = repository.getUploads(); | ||||
|       for (final UploadItem uploadItem : uploads) { | ||||
|           uploadItem.setPlace(place); | ||||
|           final List<UploadMediaDetail> uploadMediaDetails = uploadItem.getUploadMediaDetails(); | ||||
|           // Update UploadMediaDetail object for this UploadItem | ||||
|           uploadMediaDetails.set(0, new UploadMediaDetail(place)); | ||||
|       } | ||||
|       // Now that all UploadItems and their associated UploadMediaDetail objects have been updated, | ||||
|   public void onUserConfirmedUploadIsOfPlace(final Place place, final int uploadItemIndex) { | ||||
|       final UploadItem uploadItem = repository.getUploads().get(uploadItemIndex); | ||||
| 
 | ||||
|       uploadItem.setPlace(place); | ||||
|       final List<UploadMediaDetail> uploadMediaDetails = uploadItem.getUploadMediaDetails(); | ||||
|       // Update UploadMediaDetail object for this UploadItem | ||||
|       uploadMediaDetails.set(0, new UploadMediaDetail(place)); | ||||
| 
 | ||||
|       // Now that the UploadItem and its associated UploadMediaDetail objects have been updated, | ||||
|       // update the view with the modified media details of the first upload item | ||||
|       view.updateMediaDetails(uploads.get(0).getUploadMediaDetails()); | ||||
|       view.updateMediaDetails(uploadMediaDetails); | ||||
|       UploadActivity.setUploadIsOfAPlace(true); | ||||
|   } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 savsch
						savsch