summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuli Huang <yuli@google.com>2011-12-05 21:00:58 +0800
committerYuli Huang <yuli@google.com>2011-12-06 00:52:50 +0800
commit72a8d96b9b77a48562e1a650a928638281f9c7aa (patch)
tree5e75d1f27e6df9b03341d2313cf7c0b600964917
parent1bcd04ac4b38b50e993533f1f18b5e5f3bc34008 (diff)
downloadandroid_packages_apps_Snap-72a8d96b9b77a48562e1a650a928638281f9c7aa.tar.gz
android_packages_apps_Snap-72a8d96b9b77a48562e1a650a928638281f9c7aa.tar.bz2
android_packages_apps_Snap-72a8d96b9b77a48562e1a650a928638281f9c7aa.zip
Improve Doodle UI for ending Doodle effect.
As doodle-view was removed before the final doodle results are produced by MFF and displayed, doodles drawn disappeared temporarily when the user exits Doodle effect. Change-Id: I72822ba840f41f509fe4e9a2e1022a5b40b14e6a
-rw-r--r--src/com/android/gallery3d/photoeditor/actions/EffectAction.java16
-rw-r--r--src/com/android/gallery3d/photoeditor/actions/EffectToolKit.java23
2 files changed, 32 insertions, 7 deletions
diff --git a/src/com/android/gallery3d/photoeditor/actions/EffectAction.java b/src/com/android/gallery3d/photoeditor/actions/EffectAction.java
index e7ab3378b..92bcee4a9 100644
--- a/src/com/android/gallery3d/photoeditor/actions/EffectAction.java
+++ b/src/com/android/gallery3d/photoeditor/actions/EffectAction.java
@@ -83,8 +83,14 @@ public abstract class EffectAction extends LinearLayout {
* Ends the effect and then executes the runnable after the effect is finished.
*/
public void end(final Runnable runnableOnODone) {
- // Remove created tools before ending and output the pushed filter if it wasn't outputted.
- toolKit.close();
+ // Cancel the tooltip if it's still showing.
+ if ((tooltip != null) && (tooltip.getView().getParent() != null)) {
+ tooltip.cancel();
+ tooltip = null;
+ }
+ // End tool editing by canceling unfinished touch events.
+ toolKit.cancel();
+ // Output the pushed filter if it wasn't outputted.
if (pushedFilter && disableFilterOutput) {
outputFilter();
}
@@ -104,11 +110,7 @@ public abstract class EffectAction extends LinearLayout {
}
private void finish(Runnable runnableOnDone) {
- // Close the tooltip if it's still showing.
- if ((tooltip != null) && (tooltip.getView().getParent() != null)) {
- tooltip.cancel();
- tooltip = null;
- }
+ toolKit.close();
pushedFilter = false;
disableFilterOutput = false;
lastFilterChangedCallback = null;
diff --git a/src/com/android/gallery3d/photoeditor/actions/EffectToolKit.java b/src/com/android/gallery3d/photoeditor/actions/EffectToolKit.java
index 59c90ede2..fbb54d948 100644
--- a/src/com/android/gallery3d/photoeditor/actions/EffectToolKit.java
+++ b/src/com/android/gallery3d/photoeditor/actions/EffectToolKit.java
@@ -17,7 +17,9 @@
package com.android.gallery3d.photoeditor.actions;
import android.content.Context;
+import android.os.SystemClock;
import android.view.LayoutInflater;
+import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
@@ -64,6 +66,27 @@ public class EffectToolKit {
}
/**
+ * Cancel pending touch events and stop dispatching further touch events to tools.
+ */
+ public void cancel() {
+ long now = SystemClock.uptimeMillis();
+ MotionEvent cancelEvent = MotionEvent.obtain(now, now, MotionEvent.ACTION_CANCEL, 0, 0, 0);
+ toolFullscreen.dispatchTouchEvent(cancelEvent);
+ toolPanel.dispatchTouchEvent(cancelEvent);
+ cancelEvent.recycle();
+ View.OnTouchListener listener = new View.OnTouchListener() {
+
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ // Consume all further touch events and don't dispatch them.
+ return true;
+ }
+ };
+ toolFullscreen.setOnTouchListener(listener);
+ toolPanel.setOnTouchListener(listener);
+ }
+
+ /**
* Close to remove all created tools.
*/
public void close() {