mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2024-12-20 20:44:05 +01:00
improving location parsing
This commit is contained in:
parent
92607617cf
commit
8fc291fda5
@ -99,8 +99,8 @@ public class ParcelableLocation implements Serializable, Parcelable, JSONParcela
|
|||||||
latitude = Double.NaN;
|
latitude = Double.NaN;
|
||||||
longitude = Double.NaN;
|
longitude = Double.NaN;
|
||||||
} else {
|
} else {
|
||||||
latitude = ParseUtils.parseDouble(longlat[0]);
|
latitude = ParseUtils.parseDouble(longlat[0], Double.NaN);
|
||||||
longitude = ParseUtils.parseDouble(longlat[1]);
|
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) {
|
public static String toString(final ParcelableLocation location) {
|
||||||
if (!isValidLocation(location)) return null;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -356,7 +356,7 @@ public final class ContentValuesCreator implements TwidereConstants {
|
|||||||
values.put(Statuses.IS_POSSIBLY_SENSITIVE, status.isPossiblySensitive());
|
values.put(Statuses.IS_POSSIBLY_SENSITIVE, status.isPossiblySensitive());
|
||||||
final GeoLocation location = status.getGeoLocation();
|
final GeoLocation location = status.getGeoLocation();
|
||||||
if (location != null) {
|
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();
|
final Place place = status.getPlace();
|
||||||
if (place != null) {
|
if (place != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user