summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d
diff options
context:
space:
mode:
authorRay Chen <raychen@google.com>2011-08-18 20:24:35 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-08-18 20:24:35 -0700
commite979160a10fcfc9d580b6bbacc11af6ee40ef32a (patch)
tree5f5663293cb0845a75f523d44d2c408e3086360b /src/com/android/gallery3d
parentd39cf88ba45d82e5dbb7475a6de042ea072c100c (diff)
parent06d90f453e650ddece8423ef2bef888f64b40ae3 (diff)
downloadandroid_packages_apps_Snap-e979160a10fcfc9d580b6bbacc11af6ee40ef32a.tar.gz
android_packages_apps_Snap-e979160a10fcfc9d580b6bbacc11af6ee40ef32a.tar.bz2
android_packages_apps_Snap-e979160a10fcfc9d580b6bbacc11af6ee40ef32a.zip
Merge "Fix 5179285 "Show on Map" intent for geotagged images mis-formatted in French"
Diffstat (limited to 'src/com/android/gallery3d')
-rw-r--r--src/com/android/gallery3d/ui/DetailsWindow.java3
-rw-r--r--src/com/android/gallery3d/util/GalleryUtils.java13
2 files changed, 13 insertions, 3 deletions
diff --git a/src/com/android/gallery3d/ui/DetailsWindow.java b/src/com/android/gallery3d/ui/DetailsWindow.java
index 03e216922..760b73a91 100644
--- a/src/com/android/gallery3d/ui/DetailsWindow.java
+++ b/src/com/android/gallery3d/ui/DetailsWindow.java
@@ -28,6 +28,7 @@ import com.android.gallery3d.common.Utils;
import com.android.gallery3d.data.MediaDetails;
import com.android.gallery3d.util.Future;
import com.android.gallery3d.util.FutureListener;
+import com.android.gallery3d.util.GalleryUtils;
import com.android.gallery3d.util.ReverseGeocoder;
import com.android.gallery3d.util.ThreadPool.Job;
import com.android.gallery3d.util.ThreadPool.JobContext;
@@ -310,7 +311,7 @@ public class DetailsWindow extends GLView {
}
private String getLocationText(double[] latlng) {
- String text = String.format("(%f, %f)", latlng[0], latlng[1]);
+ String text = GalleryUtils.formatLatitudeLongitude("(%f,%f)", latlng[0], latlng[1]);
mAddressLookupJob = mContext.getThreadPool().submit(
new AddressLookupJob(latlng),
new FutureListener<Address>() {
diff --git a/src/com/android/gallery3d/util/GalleryUtils.java b/src/com/android/gallery3d/util/GalleryUtils.java
index 2fed46a22..47beb2d09 100644
--- a/src/com/android/gallery3d/util/GalleryUtils.java
+++ b/src/com/android/gallery3d/util/GalleryUtils.java
@@ -43,6 +43,7 @@ import android.view.WindowManager;
import java.util.Arrays;
import java.util.List;
+import java.util.Locale;
public class GalleryUtils {
private static final String TAG = "GalleryUtils";
@@ -206,13 +207,21 @@ public class GalleryUtils {
// TODO: change || to && after we fix the default location issue
return (latitude != MediaItem.INVALID_LATLNG || longitude != MediaItem.INVALID_LATLNG);
}
+
+ public static String formatLatitudeLongitude(String format, double latitude,
+ double longitude) {
+ // We need to specify the locale otherwise it may go wrong in some language
+ // (e.g. Locale.FRENCH)
+ return String.format(Locale.ENGLISH, format, latitude, longitude);
+ }
+
public static void showOnMap(Context context, double latitude, double longitude) {
try {
// We don't use "geo:latitude,longitude" because it only centers
// the MapView to the specified location, but we need a marker
// for further operations (routing to/from).
// The q=(lat, lng) syntax is suggested by geo-team.
- String uri = String.format("http://maps.google.com/maps?f=q&q=(%f,%f)",
+ String uri = formatLatitudeLongitude("http://maps.google.com/maps?f=q&q=(%f,%f)",
latitude, longitude);
ComponentName compName = new ComponentName(MAPS_PACKAGE_NAME,
MAPS_CLASS_NAME);
@@ -222,7 +231,7 @@ public class GalleryUtils {
} catch (ActivityNotFoundException e) {
// Use the "geo intent" if no GMM is installed
Log.e(TAG, "GMM activity not found!", e);
- String url = String.format("geo:%f,%f", latitude, longitude);
+ String url = formatLatitudeLongitude("geo:%f,%f", latitude, longitude);
Intent mapsIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
context.startActivity(mapsIntent);
}