diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/camera/CameraActivity.java | 96 | ||||
-rw-r--r-- | src/com/android/camera/ui/FilmStripView.java | 3 |
2 files changed, 62 insertions, 37 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java index 47a964f06..3521de2d4 100644 --- a/src/com/android/camera/CameraActivity.java +++ b/src/com/android/camera/CameraActivity.java @@ -230,38 +230,37 @@ public class CameraActivity extends Activity } @Override - public void onCurrentDataChanged(int dataID, boolean current) { - if (!current) { - hidePanoStitchingProgress(); - } else { - LocalData currentData = mDataAdapter.getLocalData(dataID); - if (currentData == null) { - Log.w(TAG, "Current data ID not found."); - hidePanoStitchingProgress(); - return; - } - - if (currentData.getLocalDataType() == - LocalData.LOCAL_CAMERA_PREVIEW) { - // Don't show the action bar in Camera preview. - mActionBar.hide(); - } else { - updateActionBarMenu(dataID); - } - - Uri contentUri = currentData.getContentUri(); - if (contentUri == null) { - hidePanoStitchingProgress(); - return; - } - int panoStitchingProgress = mPanoramaManager.getTaskProgress(contentUri); - if (panoStitchingProgress < 0) { - hidePanoStitchingProgress(); - return; + public void onCurrentDataChanged(final int dataID, final boolean current) { + runOnUiThread(new Runnable() { + @Override + public void run() { + if (!current) { + hidePanoStitchingProgress(); + } else { + LocalData currentData = mDataAdapter.getLocalData(dataID); + if (currentData == null) { + Log.w(TAG, "Current data ID not found."); + hidePanoStitchingProgress(); + return; + } + updateActionBarMenu(dataID); + + Uri contentUri = currentData.getContentUri(); + if (contentUri == null) { + hidePanoStitchingProgress(); + return; + } + int panoStitchingProgress = mPanoramaManager.getTaskProgress( + contentUri); + if (panoStitchingProgress < 0) { + hidePanoStitchingProgress(); + return; + } + showPanoStitchingProgress(); + updateStitchingProgress(panoStitchingProgress); + } } - showPanoStitchingProgress(); - updateStitchingProgress(panoStitchingProgress); - } + }); } @Override @@ -369,14 +368,35 @@ public class CameraActivity extends Activity setMenuItemVisible(mActionBarMenu, R.id.action_trim, (supported & SUPPORT_TRIM) != 0); - if ((supported & SUPPORT_SHARE) != 0) { - setMenuItemVisible(mActionBarMenu, R.id.action_share, true); - setStandardShareIntent(currentData.getContentUri(), currentData.getMimeType()); - } - if ((supported & SUPPORT_SHARE_PANORAMA360) != 0) { - setMenuItemVisible(mActionBarMenu, R.id.action_share_panorama, true); + boolean standardShare = (supported & SUPPORT_SHARE) != 0; + boolean panoramaShare = (supported & SUPPORT_SHARE_PANORAMA360) != 0; + setMenuItemVisible(mActionBarMenu, R.id.action_share, standardShare); + setMenuItemVisible(mActionBarMenu, R.id.action_share_panorama, panoramaShare); + + if (panoramaShare) { + // For 360 PhotoSphere, relegate standard share to the overflow menu + MenuItem item = mActionBarMenu.findItem(R.id.action_share); + if (item != null) { + item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); + item.setTitle(getResources().getString(R.string.share_as_photo)); + } + // And, promote "share as panorama" to action bar + item = mActionBarMenu.findItem(R.id.action_share_panorama); + if (item != null) { + item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); + } setPanoramaShareIntent(currentData.getContentUri()); } + if (standardShare) { + if (!panoramaShare) { + MenuItem item = mActionBarMenu.findItem(R.id.action_share); + if (item != null) { + item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); + item.setTitle(getResources().getString(R.string.share)); + } + } + setStandardShareIntent(currentData.getContentUri(), currentData.getMimeType()); + } boolean itemHasLocation = currentData.getLatLong() != null; setMenuItemVisible(mActionBarMenu, R.id.action_show_on_map, @@ -496,6 +516,7 @@ public class CameraActivity extends Activity // Configure the standard share action provider MenuItem item = menu.findItem(R.id.action_share); mStandardShareActionProvider = (ShareActionProvider) item.getActionProvider(); + mStandardShareActionProvider.setShareHistoryFileName("standard_share_history.xml"); if (mStandardShareIntent != null) { mStandardShareActionProvider.setShareIntent(mStandardShareIntent); } @@ -503,6 +524,7 @@ public class CameraActivity extends Activity // Configure the panorama share action provider item = menu.findItem(R.id.action_share_panorama); mPanoramaShareActionProvider = (ShareActionProvider) item.getActionProvider(); + mPanoramaShareActionProvider.setShareHistoryFileName("panorama_share_history.xml"); if (mPanoramaShareIntent != null) { mPanoramaShareActionProvider.setShareIntent(mPanoramaShareIntent); } diff --git a/src/com/android/camera/ui/FilmStripView.java b/src/com/android/camera/ui/FilmStripView.java index 1805177e2..fd532fb00 100644 --- a/src/com/android/camera/ui/FilmStripView.java +++ b/src/com/android/camera/ui/FilmStripView.java @@ -971,6 +971,9 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener { boolean isPanorama360) { // Make sure the returned data is for the current image. if (requestId == getCurrentId()) { + if (mListener != null) { + mListener.onCurrentDataChanged(requestId, true); + } mBottomControls.setViewPhotoSphereButtonVisibility(isPanorama); mBottomControls.setTinyPlanetButtonVisibility(isPanorama360); } |