improving location parsing

This commit is contained in:
Mariotaku Lee 2015-04-04 02:47:55 +08:00
parent 92607617cf
commit 8fc291fda5
2 changed files with 8 additions and 4 deletions

View File

@ -99,8 +99,8 @@ public class ParcelableLocation implements Serializable, Parcelable, JSONParcela
latitude = Double.NaN;
longitude = Double.NaN;
} else {
latitude = ParseUtils.parseDouble(longlat[0]);
longitude = ParseUtils.parseDouble(longlat[1]);
latitude = ParseUtils.parseDouble(longlat[0], Double.NaN);
longitude = ParseUtils.parseDouble(longlat[1], Double.NaN);
}
}
@ -197,6 +197,10 @@ public class ParcelableLocation implements Serializable, Parcelable, JSONParcela
public static String toString(final ParcelableLocation location) {
if (!isValidLocation(location)) return null;
return location.latitude + "," + location.longitude;
return toString(location.latitude, location.longitude);
}
public static String toString(double latitude, double longitude) {
return latitude + "," + longitude;
}
}

View File

@ -356,7 +356,7 @@ public final class ContentValuesCreator implements TwidereConstants {
values.put(Statuses.IS_POSSIBLY_SENSITIVE, status.isPossiblySensitive());
final GeoLocation location = status.getGeoLocation();
if (location != null) {
values.put(Statuses.LOCATION, location.getLatitude() + "," + location.getLongitude());
values.put(Statuses.LOCATION, ParcelableLocation.toString(location.getLatitude(), location.getLongitude()));
}
final Place place = status.getPlace();
if (place != null) {