Merge "Change versionCode to 40001 and versionName to 1.1.40001." into gb-ub-photos-arches
diff --git a/src/com/android/gallery3d/app/GalleryActionBar.java b/src/com/android/gallery3d/app/GalleryActionBar.java
index 620add6..4b9ef53 100644
--- a/src/com/android/gallery3d/app/GalleryActionBar.java
+++ b/src/com/android/gallery3d/app/GalleryActionBar.java
@@ -380,8 +380,6 @@
}
private Menu mActionBarMenu;
- private MenuItem mSharePanoramaMenuItem;
- private MenuItem mShareMenuItem;
private ShareActionProvider mSharePanoramaActionProvider;
private ShareActionProvider mShareActionProvider;
@@ -389,15 +387,21 @@
mActivity.getMenuInflater().inflate(menuRes, menu);
mActionBarMenu = menu;
- mSharePanoramaMenuItem = menu.findItem(R.id.action_share_panorama);
- mSharePanoramaActionProvider = (ShareActionProvider)
- mSharePanoramaMenuItem.getActionProvider();
- mSharePanoramaActionProvider.setShareHistoryFileName("panorama_share_history.xml");
+ MenuItem item = menu.findItem(R.id.action_share_panorama);
+ if (item != null) {
+ mSharePanoramaActionProvider = (ShareActionProvider)
+ item.getActionProvider();
+ mSharePanoramaActionProvider
+ .setShareHistoryFileName("panorama_share_history.xml");
+ }
- mShareMenuItem = menu.findItem(R.id.action_share);
- mShareActionProvider = (ShareActionProvider)
- mShareMenuItem.getActionProvider();
- mShareActionProvider.setShareHistoryFileName("share_history.xml");
+ item = menu.findItem(R.id.action_share);
+ if (item != null) {
+ mShareActionProvider = (ShareActionProvider)
+ item.getActionProvider();
+ mShareActionProvider
+ .setShareHistoryFileName("share_history.xml");
+ }
}
public Menu getMenu() {
@@ -405,23 +409,10 @@
}
public void setShareIntents(Intent sharePanoramaIntent, Intent shareIntent) {
- // if panorama sharing is enabled, rename share to share as photo,
- // and move it to overflow
- if (mSharePanoramaMenuItem != null) {
- if (sharePanoramaIntent != null) {
- mActivity.invalidateOptionsMenu();
- mShareMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
- mShareMenuItem.setTitle(
- mContext.getResources().getString(R.string.share_as_photo));
- } else {
- mSharePanoramaMenuItem.setVisible(false);
- mShareMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
- mShareMenuItem.setTitle(
- mContext.getResources().getString(R.string.share));
- }
+ if (mSharePanoramaActionProvider != null) {
mSharePanoramaActionProvider.setShareIntent(sharePanoramaIntent);
}
- if (mShareMenuItem != null) {
+ if (mShareActionProvider != null) {
mShareActionProvider.setShareIntent(shareIntent);
}
}
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index 5c9c598..7f8414c 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -347,27 +347,29 @@
.getMediaObject(screenNailItemPath);
mScreenNailItem.setScreenNail(mAppBridge.attachScreenNail());
- // Check if the path is a secure album.
- if (SecureSource.isSecurePath(mSetPathString)) {
- mSecureAlbum = (SecureAlbum) mActivity.getDataManager()
- .getMediaSet(mSetPathString);
- mShowSpinner = false;
- }
if (data.getBoolean(KEY_SHOW_WHEN_LOCKED, false)) {
// Set the flag to be on top of the lock screen.
mFlags |= FLAG_SHOW_WHEN_LOCKED;
}
- // Don't display "empty album" action item for capture intents
- if(!mSetPathString.equals("/local/all/0")) {
+ // Don't display "empty album" action item or panorama
+ // progress for capture intents.
+ if (!mSetPathString.equals("/local/all/0")) {
+ // Check if the path is a secure album.
+ if (SecureSource.isSecurePath(mSetPathString)) {
+ mSecureAlbum = (SecureAlbum) mActivity.getDataManager()
+ .getMediaSet(mSetPathString);
+ mShowSpinner = false;
+ } else {
+ // Use lightcycle album to handle panorama progress if
+ // the path is not a secure album.
+ if (LightCycleHelper.hasLightCycleCapture(mActivity.getAndroidContext())) {
+ mSetPathString = LightCycleHelper.wrapGalleryPath(mSetPathString);
+ }
+ }
mSetPathString = "/filter/empty/{"+mSetPathString+"}";
}
- // Add support for showing panorama progress.
- if (LightCycleHelper.hasLightCycleCapture(mActivity.getAndroidContext())) {
- mSetPathString = LightCycleHelper.wrapGalleryPath(mSetPathString);
- }
-
// Combine the original MediaSet with the one for ScreenNail
// from AppBridge.
mSetPathString = "/combo/item/{" + screenNailSetPath +
@@ -645,6 +647,18 @@
supportedOperations &= ~MediaObject.SUPPORT_EDIT;
}
MenuExecutor.updateMenuOperation(menu, supportedOperations);
+ if ((supportedOperations & MediaObject.SUPPORT_PANORAMA360) != 0) {
+ mActivity.invalidateOptionsMenu();
+ item = menu.findItem(R.id.action_share);
+ item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
+ item.setTitle(
+ mActivity.getResources().getString(R.string.share_as_photo));
+ } else if ((supportedOperations & MediaObject.SUPPORT_SHARE) != 0) {
+ item = menu.findItem(R.id.action_share);
+ item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+ item.setTitle(
+ mActivity.getResources().getString(R.string.share));
+ }
}
private boolean canDoSlideShow() {
diff --git a/src/com/android/gallery3d/app/StitchingChangeListener.java b/src/com/android/gallery3d/app/StitchingChangeListener.java
index 980f145..40f59a5 100644
--- a/src/com/android/gallery3d/app/StitchingChangeListener.java
+++ b/src/com/android/gallery3d/app/StitchingChangeListener.java
@@ -16,12 +16,14 @@
package com.android.gallery3d.app;
+import com.android.gallery3d.data.Path;
+
import android.net.Uri;
public interface StitchingChangeListener {
- public void onStitchingQueued(String filePath);
+ public void onStitchingQueued(Path path);
- public void onStitchingResult(String filePath, Uri uri);
+ public void onStitchingResult(Path path, Uri uri);
- public void onStitchingProgress(String filePath, int progress);
+ public void onStitchingProgress(Path path, int progress);
}
diff --git a/src/com/android/gallery3d/data/SecureAlbum.java b/src/com/android/gallery3d/data/SecureAlbum.java
index 382de5b..4e33cda 100644
--- a/src/com/android/gallery3d/data/SecureAlbum.java
+++ b/src/com/android/gallery3d/data/SecureAlbum.java
@@ -25,6 +25,7 @@
import com.android.gallery3d.app.GalleryApp;
import com.android.gallery3d.app.StitchingChangeListener;
+import com.android.gallery3d.app.StitchingProgressManager;
import com.android.gallery3d.util.MediaSetUtils;
import java.util.ArrayList;
@@ -43,9 +44,10 @@
// The types of items in mAllItems. True is video and false is image.
private ArrayList<Boolean> mAllItemTypes = new ArrayList<Boolean>();
private ArrayList<Path> mExistingItems = new ArrayList<Path>();
- private ArrayList<String> mStitchingFilePaths = new ArrayList<String>();
+ private ArrayList<Path> mStitchingItems = new ArrayList<Path>();
private Context mContext;
private DataManager mDataManager;
+ private StitchingProgressManager mStitchingProgressManager;
private static final Uri[] mWatchUris =
{Images.Media.EXTERNAL_CONTENT_URI, Video.Media.EXTERNAL_CONTENT_URI};
private final ChangeNotifier mNotifier;
@@ -62,7 +64,8 @@
mUnlockItem = unlock;
mShowUnlockItem = (!isCameraBucketEmpty(Images.Media.EXTERNAL_CONTENT_URI)
|| !isCameraBucketEmpty(Video.Media.EXTERNAL_CONTENT_URI));
- application.getStitchingProgressManager().addChangeListener(this);
+ mStitchingProgressManager = application.getStitchingProgressManager();
+ mStitchingProgressManager.addChangeListener(this);
}
public void addMediaItem(boolean isVideo, int id) {
@@ -79,14 +82,31 @@
mNotifier.fakeChange();
}
+ // The sequence is stitching items, local media items, and unlock image.
@Override
public ArrayList<MediaItem> getMediaItem(int start, int count) {
- if (start >= mExistingItems.size() + 1) {
+ int stitchingCount = mStitchingItems.size();
+ int existingCount = mExistingItems.size();
+ if (start >= stitchingCount + existingCount + 1) {
return new ArrayList<MediaItem>();
}
- int end = Math.min(start + count, mExistingItems.size());
- ArrayList<Path> subset = new ArrayList<Path>(
- mExistingItems.subList(start, end));
+
+ // Add paths of requested stitching items.
+ int end = Math.min(start + count, stitchingCount + existingCount);
+ ArrayList<Path> subset = new ArrayList<Path>();
+ if (start < stitchingCount) {
+ subset.addAll(mStitchingItems.subList(
+ start, Math.min(stitchingCount, end)));
+ }
+
+ // Add paths of requested local media items.
+ if (end >= stitchingCount) {
+ int existingStart = Math.max(0, start - stitchingCount);
+ int existingEnd = end - stitchingCount;
+ subset.addAll(mExistingItems.subList(existingStart, existingEnd));
+ }
+
+ // Convert paths to media items.
final MediaItem[] buf = new MediaItem[end - start];
ItemConsumer consumer = new ItemConsumer() {
@Override
@@ -105,7 +125,8 @@
@Override
public int getMediaItemCount() {
- return mExistingItems.size() + (mShowUnlockItem ? 1 : 0);
+ return (mStitchingItems.size() + mExistingItems.size()
+ + (mShowUnlockItem ? 1 : 0));
}
@Override
@@ -183,19 +204,24 @@
}
@Override
- public void onStitchingQueued(String filePath) {
- mStitchingFilePaths.add(filePath);
+ public void onStitchingQueued(Path path) {
+ mStitchingItems.add(path);
+ notifyContentChanged();
}
@Override
- public void onStitchingResult(String filePath, Uri uri) {
- if (mStitchingFilePaths.remove(filePath)) {
+ public void onStitchingResult(Path path, Uri uri) {
+ if (mStitchingItems.remove(path)) {
int id = Integer.parseInt(uri.getLastPathSegment());
addMediaItem(false, id);
+ notifyContentChanged();
}
}
@Override
- public void onStitchingProgress(String filePath, int progress) {
+ public void onStitchingProgress(Path path, int progress) {
+ if (mStitchingItems.contains(path)) {
+ notifyContentChanged();
+ }
}
}