mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Show Last Known Location in LocationPickerActivity (#4816)
* Show Last Known Location in LocationPickerActivity * Removed extra empty line * Added tests * Added tests * Added tests * Added tests * Added tests * Added tests * Added tests
This commit is contained in:
parent
458024bdee
commit
c2bc5b4f23
2 changed files with 41 additions and 2 deletions
|
|
@ -9,6 +9,7 @@ import static fr.free.nrw.commons.category.CategoryClientKt.CATEGORY_UNCATEGORIS
|
|||
import static fr.free.nrw.commons.description.EditDescriptionConstants.LIST_OF_DESCRIPTION_AND_CAPTION;
|
||||
import static fr.free.nrw.commons.description.EditDescriptionConstants.UPDATED_WIKITEXT;
|
||||
import static fr.free.nrw.commons.description.EditDescriptionConstants.WIKITEXT;
|
||||
import static fr.free.nrw.commons.upload.mediaDetails.UploadMediaDetailFragment.LAST_LOCATION;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
|
|
@ -821,11 +822,15 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment implements
|
|||
*/
|
||||
double defaultLatitude = 37.773972;
|
||||
double defaultLongitude = -122.431297;
|
||||
|
||||
if (media.getCoordinates() != null) {
|
||||
defaultLatitude = media.getCoordinates().getLatitude();
|
||||
defaultLongitude = media.getCoordinates().getLongitude();
|
||||
} else {
|
||||
String[] lastLocation = applicationKvStore.getString(LAST_LOCATION,(defaultLatitude + "," + defaultLongitude)).split(",");
|
||||
defaultLatitude = Double.parseDouble(lastLocation[0]);
|
||||
defaultLongitude = Double.parseDouble(lastLocation[1]);
|
||||
}
|
||||
|
||||
startActivityForResult(new LocationPicker.IntentBuilder()
|
||||
.defaultLocation(new CameraPosition.Builder()
|
||||
.target(new LatLng(defaultLatitude, defaultLongitude))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue