diff options
| -rw-r--r-- | src/com/android/camera/PanoramaModule.java | 6 | ||||
| -rw-r--r-- | src/com/android/camera/PhotoModule.java | 9 | ||||
| -rw-r--r-- | src/com/android/gallery3d/app/PhotoPage.java | 16 | ||||
| -rw-r--r-- | src/com/android/gallery3d/util/GalleryUtils.java | 48 |
4 files changed, 55 insertions, 24 deletions
diff --git a/src/com/android/camera/PanoramaModule.java b/src/com/android/camera/PanoramaModule.java index 57405ecd8..66cdc2d30 100644 --- a/src/com/android/camera/PanoramaModule.java +++ b/src/com/android/camera/PanoramaModule.java @@ -914,12 +914,11 @@ public class PanoramaModule implements CameraModule, ExifInterface exif = new ExifInterface(); try { exif.readExif(jpegData); - exif.addGpsDateTimeStampTag(mTimeTaken); exif.addDateTimeStampTag(ExifInterface.TAG_DATE_TIME, mTimeTaken, TimeZone.getDefault()); exif.setTag(exif.buildTag(ExifInterface.TAG_ORIENTATION, ExifInterface.getOrientationValueForRotation(orientation))); - writeLocation(loc, exif); + writeLocation(loc, mTimeTaken, exif); exif.writeExif(jpegData, filepath); } catch (IOException e) { Log.e(TAG, "Cannot set exif for " + filepath, e); @@ -932,11 +931,12 @@ public class PanoramaModule implements CameraModule, return null; } - private static void writeLocation(Location location, ExifInterface exif) { + private static void writeLocation(Location location, long timestamp, ExifInterface exif) { if (location == null) { return; } exif.addGpsTags(location.getLatitude(), location.getLongitude()); + exif.addGpsDateTimeStampTag(timestamp); exif.setTag(exif.buildTag(ExifInterface.TAG_GPS_PROCESSING_METHOD, location.getProvider())); } diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java index add797391..7854ca258 100644 --- a/src/com/android/camera/PhotoModule.java +++ b/src/com/android/camera/PhotoModule.java @@ -80,6 +80,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Formatter; import java.util.List; +import java.util.TimeZone; public class PhotoModule implements CameraModule, @@ -890,6 +891,14 @@ public class PhotoModule exif.setTag(directionRefTag); exif.setTag(directionTag); } + if (mLocation != null) { + exif.addGpsTags(mLocation.getLatitude(), mLocation.getLongitude()); + exif.addGpsDateTimeStampTag(date); + exif.setTag(exif.buildTag(ExifInterface.TAG_GPS_PROCESSING_METHOD, + mLocation.getProvider())); + } + exif.addDateTimeStampTag(ExifInterface.TAG_DATE_TIME, + date, TimeZone.getDefault()); if (isSamsungHDR) { final long finalDate = date; diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java index 899309d8f..76234bda8 100644 --- a/src/com/android/gallery3d/app/PhotoPage.java +++ b/src/com/android/gallery3d/app/PhotoPage.java @@ -164,6 +164,8 @@ public abstract class PhotoPage extends ActivityState implements private boolean mHasCameraScreennailOrPlaceholder = false; private boolean mRecenterCameraOnResume = true; + private int mGalleryMode = GalleryActionBar.ALBUM_FILMSTRIP_MODE_SELECTED; + // These are only valid after the panorama callback private boolean mIsPanorama; private boolean mIsPanorama360; @@ -1503,18 +1505,26 @@ public abstract class PhotoPage extends ActivityState implements @Override public int size() { - return mMediaSet != null ? mMediaSet.getMediaItemCount() : 1; + if (mMediaSet == null) { + return 1; + } + return (mGalleryMode == GalleryActionBar.ALBUM_GRID_MODE_SELECTED) + ? mMediaSet.getMediaItemCount() + : mMediaSet.getMediaItemCount() - 1; } @Override public int setIndex() { - return mModel.getCurrentIndex(); + return (mGalleryMode == GalleryActionBar.ALBUM_GRID_MODE_SELECTED) + ? mModel.getCurrentIndex() + : mModel.getCurrentIndex() - 1; } } @Override public void onAlbumModeSelected(int mode) { - if (mode == GalleryActionBar.ALBUM_GRID_MODE_SELECTED) { + mGalleryMode = mode; + if (mGalleryMode == GalleryActionBar.ALBUM_GRID_MODE_SELECTED) { switchToGrid(); } } diff --git a/src/com/android/gallery3d/util/GalleryUtils.java b/src/com/android/gallery3d/util/GalleryUtils.java index 7b824275c..6a216cc7f 100644 --- a/src/com/android/gallery3d/util/GalleryUtils.java +++ b/src/com/android/gallery3d/util/GalleryUtils.java @@ -271,25 +271,37 @@ public class GalleryUtils { } 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 = formatLatitudeLongitude("http://maps.google.com/maps?f=q&q=(%f,%f)", - latitude, longitude); - ComponentName compName = new ComponentName(MAPS_PACKAGE_NAME, - MAPS_CLASS_NAME); - Intent mapsIntent = new Intent(Intent.ACTION_VIEW, - Uri.parse(uri)).setComponent(compName); - context.startActivity(mapsIntent); - } catch (ActivityNotFoundException e) { - // Use the "geo intent" if no GMM is installed - Log.e(TAG, "GMM activity not found!", e); - String url = formatLatitudeLongitude("geo:%f,%f", latitude, longitude); - Intent mapsIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); - context.startActivity(mapsIntent); + // We use isIntentResolved here, because startActivity could derive in ProxyLauncher + // invocation, which makes an startActivity, and if the intent not exists we get a FC. + + // 1.- GMM with MapView + // 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. + ComponentName gmmCompName = new ComponentName(MAPS_PACKAGE_NAME, MAPS_CLASS_NAME); + String gmmUri = formatLatitudeLongitude("http://maps.google.com/maps?f=q&q=(%f,%f)", + 0.0d, 0.0d); + Intent gmmIntent = new Intent(); + gmmIntent.setComponent(gmmCompName); + gmmIntent.setData(Uri.parse(gmmUri)); + gmmIntent.setAction(Intent.ACTION_VIEW); + if (isIntentResolved(context, gmmIntent)) { + context.startActivity(gmmIntent); + return; } + + // 2.- Geolocation content provider + Log.w(TAG, "GMM activity not found! Trying with geo scheme"); + String geoUri = formatLatitudeLongitude("geo:%f,%f", 0.0d, 0.0d); + Intent geoIntent = new Intent(); + geoIntent.setData(Uri.parse(geoUri)); + geoIntent.setAction(Intent.ACTION_VIEW); + if (isIntentResolved(context, geoIntent)) { + context.startActivity(geoIntent); + } + + // No maps. Why isGeolocationViewAvailable method not working? } public static boolean isGeolocationViewAvailable(Context context) { |
