summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoris Liu <tianliu@google.com>2013-02-11 21:33:29 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-02-11 21:33:29 +0000
commit401756be3f741a0ac9255f103b07ccc645ff2252 (patch)
tree91a1a63b42a522e3434617f53c8c85e34cc0996e
parentcef6ad5d4a60a6e2960f7f72de624d5e60b3908a (diff)
parenta6a3be3200f50dd1d18e9f2e970f4b6eac7af86c (diff)
downloadandroid_packages_apps_Gallery2-401756be3f741a0ac9255f103b07ccc645ff2252.tar.gz
android_packages_apps_Gallery2-401756be3f741a0ac9255f103b07ccc645ff2252.tar.bz2
android_packages_apps_Gallery2-401756be3f741a0ac9255f103b07ccc645ff2252.zip
Merge "Fix camera setting icons appearing in wrong place" into gb-ub-photos-bryce
-rw-r--r--res/layout-land/photo_module_content.xml4
-rw-r--r--res/layout-land/video_module.xml2
-rw-r--r--res/layout-port/photo_module_content.xml2
-rw-r--r--res/layout-port/video_module.xml2
-rw-r--r--src/com/android/camera/ui/PieMenuButton.java61
5 files changed, 66 insertions, 5 deletions
diff --git a/res/layout-land/photo_module_content.xml b/res/layout-land/photo_module_content.xml
index 2afcf4081..d734f8329 100644
--- a/res/layout-land/photo_module_content.xml
+++ b/res/layout-land/photo_module_content.xml
@@ -37,14 +37,14 @@
android:layout_width="80dip"
android:layout_height="80dip"
android:layout_marginTop="-5dip"
- android:layout_marginRight="-2dip"
+ android:layout_marginRight="-2dip"
android:layout_gravity="top|right"/>
<include layout="@layout/review_module_control"
android:layout_marginRight="2dip" />
- <View
+ <com.android.camera.ui.PieMenuButton
android:id="@+id/menu"
style="@style/SwitcherButton"
android:contentDescription="@string/accessibility_menu_button"
diff --git a/res/layout-land/video_module.xml b/res/layout-land/video_module.xml
index 8dcdc848c..972a7f901 100644
--- a/res/layout-land/video_module.xml
+++ b/res/layout-land/video_module.xml
@@ -45,7 +45,7 @@
<include layout="@layout/review_module_control"
android:layout_marginRight="2dip" />
- <View
+ <com.android.camera.ui.PieMenuButton
android:id="@+id/menu"
style="@style/SwitcherButton"
android:layout_alignParentRight="true"
diff --git a/res/layout-port/photo_module_content.xml b/res/layout-port/photo_module_content.xml
index 79438a5d0..a82a7a138 100644
--- a/res/layout-port/photo_module_content.xml
+++ b/res/layout-port/photo_module_content.xml
@@ -43,7 +43,7 @@
<include layout="@layout/review_module_control"
android:layout_marginBottom="2dip" />
- <View
+ <com.android.camera.ui.PieMenuButton
android:id="@+id/menu"
style="@style/SwitcherButton"
android:layout_gravity="bottom|right"
diff --git a/res/layout-port/video_module.xml b/res/layout-port/video_module.xml
index 7aedb8c4b..d8a6490d4 100644
--- a/res/layout-port/video_module.xml
+++ b/res/layout-port/video_module.xml
@@ -45,7 +45,7 @@
<include layout="@layout/review_module_control"
android:layout_marginBottom="2dip" />
- <View
+ <com.android.camera.ui.PieMenuButton
android:id="@+id/menu"
style="@style/SwitcherButton"
android:contentDescription="@string/accessibility_menu_button"
diff --git a/src/com/android/camera/ui/PieMenuButton.java b/src/com/android/camera/ui/PieMenuButton.java
new file mode 100644
index 000000000..e5719310a
--- /dev/null
+++ b/src/com/android/camera/ui/PieMenuButton.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.camera.ui;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.view.View;
+
+public class PieMenuButton extends View {
+ private boolean mPressed;
+ private boolean mReadyToClick = false;
+ public PieMenuButton(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ protected void drawableStateChanged() {
+ super.drawableStateChanged();
+ mPressed = isPressed();
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ if (MotionEvent.ACTION_UP == event.getAction() && mPressed) {
+ // Perform a customized click as soon as the ACTION_UP event
+ // is received. The reason for doing this is that Framework
+ // delays the performClick() call after ACTION_UP. But we do not
+ // want the delay because it affects an important state change
+ // for PieRenderer.
+ mReadyToClick = true;
+ performClick();
+ }
+ return super.onTouchEvent(event);
+ }
+
+ @Override
+ public boolean performClick() {
+ if (mReadyToClick) {
+ // We only respond to our customized click which happens right
+ // after ACTION_UP event is received, with no delay.
+ mReadyToClick = false;
+ return super.performClick();
+ }
+ return false;
+ }
+}; \ No newline at end of file