mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Minor formatting/comments
This commit is contained in:
parent
e05f78ce85
commit
f0b9d35bfd
2 changed files with 6 additions and 9 deletions
|
|
@ -13,7 +13,7 @@ public class GPSExtractor {
|
|||
|
||||
private String filePath;
|
||||
private double decLatitude, decLongitude;
|
||||
Context context;
|
||||
private Context context;
|
||||
private static final String TAG = GPSExtractor.class.getName();
|
||||
public boolean imageCoordsExists;
|
||||
|
||||
|
|
@ -54,17 +54,17 @@ public class GPSExtractor {
|
|||
}
|
||||
else {
|
||||
imageCoordsExists = true;
|
||||
Log.d(TAG, "Picture has GPS info");
|
||||
|
||||
latitude = exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE);
|
||||
latitude_ref = exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE_REF);
|
||||
longitude = exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE);
|
||||
longitude_ref = exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE_REF);
|
||||
|
||||
|
||||
Log.d("Image", "Latitude: " + latitude + " " + latitude_ref);
|
||||
Log.d("Image", "Longitude: " + longitude + " " + longitude_ref);
|
||||
|
||||
decimalCoords = getDecimalCoords(latitude, latitude_ref, longitude, longitude_ref);
|
||||
return decimalCoords;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -79,8 +79,6 @@ public class GPSExtractor {
|
|||
//Converts format of coords into decimal coords as required by MediaWiki API
|
||||
private String getDecimalCoords(String latitude, String latitude_ref, String longitude, String longitude_ref) {
|
||||
|
||||
|
||||
|
||||
if(latitude_ref.equals("N")){
|
||||
decLatitude = convertToDegree(latitude);
|
||||
}
|
||||
|
|
@ -100,7 +98,6 @@ public class GPSExtractor {
|
|||
return decimalCoords;
|
||||
}
|
||||
|
||||
|
||||
private double convertToDegree(String stringDMS){
|
||||
double result;
|
||||
String[] DMS = stringDMS.split(",", 3);
|
||||
|
|
@ -123,5 +120,4 @@ public class GPSExtractor {
|
|||
result = degrees + (minutes/60) + (seconds/3600);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -201,8 +201,9 @@ public class ShareActivity
|
|||
//extract the coordinates of image in decimal degrees
|
||||
Log.d(TAG, "Calling GPSExtractor");
|
||||
GPSExtractor imageObj = new GPSExtractor(filePath, this);
|
||||
String decimalCoords = imageObj.getCoords();
|
||||
|
||||
//Gets image coords if exist, otherwise gets last known coords
|
||||
String decimalCoords = imageObj.getCoords();
|
||||
|
||||
if (decimalCoords != null) {
|
||||
Log.d(TAG, "Decimal coords of image: " + decimalCoords);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue