diff options
author | Angus Kong <shkong@google.com> | 2013-10-13 19:26:02 -0700 |
---|---|---|
committer | Angus Kong <shkong@google.com> | 2013-10-13 19:26:02 -0700 |
commit | 02cafdfb92a2d53b76c2bb180ee5289a80f4f4ac (patch) | |
tree | 69f4f95615b05fc844db684ee299c13932b5751c | |
parent | 2d5c74785d19f1944cab92948a6fa8233086ebc1 (diff) | |
download | android_packages_apps_Snap-02cafdfb92a2d53b76c2bb180ee5289a80f4f4ac.tar.gz android_packages_apps_Snap-02cafdfb92a2d53b76c2bb180ee5289a80f4f4ac.tar.bz2 android_packages_apps_Snap-02cafdfb92a2d53b76c2bb180ee5289a80f4f4ac.zip |
Workaround to prevent the data focus callback.
bug:11205669
Change-Id: I5b2d33422ec5f6fe21c81e39d24f36ec8b61ce4e
-rw-r--r-- | src/com/android/camera/CameraActivity.java | 7 | ||||
-rw-r--r-- | src/com/android/camera/ui/FilmStripView.java | 23 | ||||
-rw-r--r-- | src/com/android/camera/ui/PieMenuButton.java | 2 |
3 files changed, 22 insertions, 10 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java index dae2d0804..52d0e4d47 100644 --- a/src/com/android/camera/CameraActivity.java +++ b/src/com/android/camera/CameraActivity.java @@ -334,13 +334,16 @@ public class CameraActivity extends Activity } @Override - public void onCurrentDataChanged(final int dataID, final boolean current) { + public void onDataFocusChanged(final int dataID, final boolean focused) { // Delay hiding action bar if there is any user interaction if (mMainHandler.hasMessages(HIDE_ACTION_BAR)) { mMainHandler.removeMessages(HIDE_ACTION_BAR); mMainHandler.sendEmptyMessageDelayed(HIDE_ACTION_BAR, SHOW_ACTION_BAR_TIMEOUT_MS); } + // TODO: This callback is UI event callback, should always + // happen on UI thread. Find the reason for this + // runOnUiThread() and fix it. runOnUiThread(new Runnable() { @Override public void run() { @@ -352,7 +355,7 @@ public class CameraActivity extends Activity } boolean isCameraID = currentData.getLocalDataType() == LocalData.LOCAL_CAMERA_PREVIEW; - if (!current) { + if (!focused) { if (isCameraID) { mCurrentModule.onPreviewFocusChanged(false); CameraActivity.this.setSystemBarsVisibility(true); diff --git a/src/com/android/camera/ui/FilmStripView.java b/src/com/android/camera/ui/FilmStripView.java index 19ff4d2ad..5de2d7cff 100644 --- a/src/com/android/camera/ui/FilmStripView.java +++ b/src/com/android/camera/ui/FilmStripView.java @@ -343,10 +343,10 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener { * The callback when the item is centered/off-centered. * * @param dataID The ID of the image data. - * @param current {@code true} if the data is the current one. + * @param focused {@code true} if the data is focused. * {@code false} otherwise. */ - public void onCurrentDataChanged(int dataID, boolean current); + public void onDataFocusChanged(int dataID, boolean focused); /** * Toggles the visibility of the ActionBar. @@ -894,7 +894,7 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener { // Going to change the current item, notify the listener. if (mListener != null) { - mListener.onCurrentDataChanged(mViewItem[mCurrentItem].getId(), false); + mListener.onDataFocusChanged(mViewItem[mCurrentItem].getId(), false); } final int adjust = nearest - mCurrentItem; if (adjust > 0) { @@ -927,7 +927,7 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener { } invalidate(); if (mListener != null) { - mListener.onCurrentDataChanged(mViewItem[mCurrentItem].getId(), true); + mListener.onDataFocusChanged(mViewItem[mCurrentItem].getId(), true); } } @@ -1056,6 +1056,13 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener { // If this is a photo sphere, show the button to view it. If it's a full // 360 photo sphere, show the tiny planet button. + if (data.getViewType() == ImageData.VIEW_TYPE_STICKY) { + // This is a workaround to prevent an unnecessary update of + // PhotoSphere metadata which fires a data focus change callback + // at a weird timing. + return; + } + // TODO: Remove this from FilmstripView as it breaks the design. data.isPhotoSphere(mActivity, new PanoramaSupportCallback() { @Override public void panoramaInfoAvailable(final boolean isPanorama, @@ -1063,7 +1070,9 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener { // Make sure the returned data is for the current image. if (requestId == getCurrentId()) { if (mListener != null) { - mListener.onCurrentDataChanged(requestId, true); + // TODO: Remove this hack since there is no data focus + // change actually. + mListener.onDataFocusChanged(requestId, true); } mBottomControls.setViewPhotoSphereButtonVisibility(isPanorama); mBottomControls.setTinyPlanetButtonVisibility(isPanorama360); @@ -1833,7 +1842,7 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener { mDataIdOnUserScrolling = 0; // Remove all views from the mViewItem buffer, except the camera view. if (mListener != null && mViewItem[mCurrentItem] != null) { - mListener.onCurrentDataChanged(mViewItem[mCurrentItem].getId(), false); + mListener.onDataFocusChanged(mViewItem[mCurrentItem].getId(), false); } for (int i = 0; i < mViewItem.length; i++) { if (mViewItem[i] == null) { @@ -1874,7 +1883,7 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener { invalidate(); if (mListener != null) { - mListener.onCurrentDataChanged(mViewItem[mCurrentItem].getId(), true); + mListener.onDataFocusChanged(mViewItem[mCurrentItem].getId(), true); } } diff --git a/src/com/android/camera/ui/PieMenuButton.java b/src/com/android/camera/ui/PieMenuButton.java index 0e23226b2..0ad93fa0b 100644 --- a/src/com/android/camera/ui/PieMenuButton.java +++ b/src/com/android/camera/ui/PieMenuButton.java @@ -59,4 +59,4 @@ public class PieMenuButton extends View { } return false; } -};
\ No newline at end of file +}; |