mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-30 22:34:02 +01:00 
			
		
		
		
	LocationPickerActivity.java: refactor showInMapApp method
Before this change, the showInMapApp method had correct behavior, but could be rewritten to become more clear. After this change, the showInMapApp code has been rewritten. Specifically, common code in an if statement has been factored out.
This commit is contained in:
		
							parent
							
								
									97fa77deb8
								
							
						
					
					
						commit
						efe6eb27ed
					
				
					 1 changed files with 9 additions and 7 deletions
				
			
		|  | @ -400,16 +400,18 @@ public class LocationPickerActivity extends BaseActivity implements | |||
|      * If there is no EXIF data, the map will center on the commons app map center. | ||||
|      */ | ||||
|     private void showInMapApp() { | ||||
| 
 | ||||
|         fr.free.nrw.commons.location.LatLng position = null; | ||||
|         //Check to see if EXIF location data is available | ||||
|         if(cameraPosition != null){ | ||||
|             Utils.handleGeoCoordinates(this, | ||||
|                 new fr.free.nrw.commons.location.LatLng(cameraPosition.getLatitude(), | ||||
|                     cameraPosition.getLongitude(), 0.0f)); | ||||
|         if(activity.equals("UploadActivity")){ | ||||
|             position = new fr.free.nrw.commons.location.LatLng(cameraPosition.getLatitude(), | ||||
|                 cameraPosition.getLongitude(), 0.0f); | ||||
|         } else { | ||||
|             Utils.handleGeoCoordinates(this, | ||||
|                 new fr.free.nrw.commons.location.LatLng(mapView.getMapCenter().getLatitude(), | ||||
|                     mapView.getMapCenter().getLongitude(), 0.0f)); | ||||
|             position = new fr.free.nrw.commons.location.LatLng(mapView.getMapCenter().getLatitude(), | ||||
|                 mapView.getMapCenter().getLongitude(), 0.0f); | ||||
|         } | ||||
| 
 | ||||
|         Utils.handleGeoCoordinates(this, position); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jason Whitmore
						Jason Whitmore