summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAngus Kong <shkong@google.com>2013-10-14 05:16:34 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-10-14 05:16:34 +0000
commit24d94d6140ee5ecdf66b28218e8dd9dfe5edfb19 (patch)
treec0b626c16e8712de5c2c44e62669b4ebb91307de /src
parent28019abc86de3d96a32595e69f6c549353b2c4ec (diff)
parent02cafdfb92a2d53b76c2bb180ee5289a80f4f4ac (diff)
downloadandroid_packages_apps_Snap-24d94d6140ee5ecdf66b28218e8dd9dfe5edfb19.tar.gz
android_packages_apps_Snap-24d94d6140ee5ecdf66b28218e8dd9dfe5edfb19.tar.bz2
android_packages_apps_Snap-24d94d6140ee5ecdf66b28218e8dd9dfe5edfb19.zip
Merge "Workaround to prevent the data focus callback." into gb-ub-photos-carlsbad
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/CameraActivity.java7
-rw-r--r--src/com/android/camera/ui/FilmStripView.java23
-rw-r--r--src/com/android/camera/ui/PieMenuButton.java2
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
+};