• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#windowsobjective-ccocoaqtpython誰得phprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

packages/apps/Gallery2


Commit MetaInfo

修订版376be105e4396612a28c8911ce98d823a328d407 (tree)
时间2011-08-19 11:45:53
作者Ray Chen <raychen@goog...>
CommiterRay Chen

Log Message

Fix 5179285 "Show on Map" intent for geotagged images mis-formatted in French

Change-Id: I4af6b549b534786163505d41b181888d347743d9

更改概述

差异

--- 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;
2828 import com.android.gallery3d.data.MediaDetails;
2929 import com.android.gallery3d.util.Future;
3030 import com.android.gallery3d.util.FutureListener;
31+import com.android.gallery3d.util.GalleryUtils;
3132 import com.android.gallery3d.util.ReverseGeocoder;
3233 import com.android.gallery3d.util.ThreadPool.Job;
3334 import com.android.gallery3d.util.ThreadPool.JobContext;
@@ -310,7 +311,7 @@ public class DetailsWindow extends GLView {
310311 }
311312
312313 private String getLocationText(double[] latlng) {
313- String text = String.format("(%f, %f)", latlng[0], latlng[1]);
314+ String text = GalleryUtils.formatLatitudeLongitude("(%f,%f)", latlng[0], latlng[1]);
314315 mAddressLookupJob = mContext.getThreadPool().submit(
315316 new AddressLookupJob(latlng),
316317 new FutureListener<Address>() {
--- a/src/com/android/gallery3d/util/GalleryUtils.java
+++ b/src/com/android/gallery3d/util/GalleryUtils.java
@@ -43,6 +43,7 @@ import android.view.WindowManager;
4343
4444 import java.util.Arrays;
4545 import java.util.List;
46+import java.util.Locale;
4647
4748 public class GalleryUtils {
4849 private static final String TAG = "GalleryUtils";
@@ -206,13 +207,21 @@ public class GalleryUtils {
206207 // TODO: change || to && after we fix the default location issue
207208 return (latitude != MediaItem.INVALID_LATLNG || longitude != MediaItem.INVALID_LATLNG);
208209 }
210+
211+ public static String formatLatitudeLongitude(String format, double latitude,
212+ double longitude) {
213+ // We need to specify the locale otherwise it may go wrong in some language
214+ // (e.g. Locale.FRENCH)
215+ return String.format(Locale.ENGLISH, format, latitude, longitude);
216+ }
217+
209218 public static void showOnMap(Context context, double latitude, double longitude) {
210219 try {
211220 // We don't use "geo:latitude,longitude" because it only centers
212221 // the MapView to the specified location, but we need a marker
213222 // for further operations (routing to/from).
214223 // The q=(lat, lng) syntax is suggested by geo-team.
215- String uri = String.format("http://maps.google.com/maps?f=q&q=(%f,%f)",
224+ String uri = formatLatitudeLongitude("http://maps.google.com/maps?f=q&q=(%f,%f)",
216225 latitude, longitude);
217226 ComponentName compName = new ComponentName(MAPS_PACKAGE_NAME,
218227 MAPS_CLASS_NAME);
@@ -222,7 +231,7 @@ public class GalleryUtils {
222231 } catch (ActivityNotFoundException e) {
223232 // Use the "geo intent" if no GMM is installed
224233 Log.e(TAG, "GMM activity not found!", e);
225- String url = String.format("geo:%f,%f", latitude, longitude);
234+ String url = formatLatitudeLongitude("geo:%f,%f", latitude, longitude);
226235 Intent mapsIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
227236 context.startActivity(mapsIntent);
228237 }