mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-31 23:03:54 +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.
|
* If there is no EXIF data, the map will center on the commons app map center.
|
||||||
*/
|
*/
|
||||||
private void showInMapApp() {
|
private void showInMapApp() {
|
||||||
|
|
||||||
|
fr.free.nrw.commons.location.LatLng position = null;
|
||||||
//Check to see if EXIF location data is available
|
//Check to see if EXIF location data is available
|
||||||
if(cameraPosition != null){
|
if(activity.equals("UploadActivity")){
|
||||||
Utils.handleGeoCoordinates(this,
|
position = new fr.free.nrw.commons.location.LatLng(cameraPosition.getLatitude(),
|
||||||
new fr.free.nrw.commons.location.LatLng(cameraPosition.getLatitude(),
|
cameraPosition.getLongitude(), 0.0f);
|
||||||
cameraPosition.getLongitude(), 0.0f));
|
|
||||||
} else {
|
} else {
|
||||||
Utils.handleGeoCoordinates(this,
|
position = new fr.free.nrw.commons.location.LatLng(mapView.getMapCenter().getLatitude(),
|
||||||
new fr.free.nrw.commons.location.LatLng(mapView.getMapCenter().getLatitude(),
|
mapView.getMapCenter().getLongitude(), 0.0f);
|
||||||
mapView.getMapCenter().getLongitude(), 0.0f));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Utils.handleGeoCoordinates(this, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue