diff options
author | Yuli Huang <yuli@google.com> | 2011-12-02 09:08:12 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-12-02 09:08:12 -0800 |
commit | 63a3e9848a857d0681270353f4be50d108017fa4 (patch) | |
tree | c3d0e91296e6cbad62ec4c54591b858ca1f2772f /src/com/android/gallery3d/photoeditor/actions/EffectAction.java | |
parent | 9718b6b4dd0073ac91adf3ac0995fcab8576d9c5 (diff) | |
parent | 72f77e4e3147cc856a472f31999d98d08fc19edc (diff) | |
download | android_packages_apps_Snap-63a3e9848a857d0681270353f4be50d108017fa4.tar.gz android_packages_apps_Snap-63a3e9848a857d0681270353f4be50d108017fa4.tar.bz2 android_packages_apps_Snap-63a3e9848a857d0681270353f4be50d108017fa4.zip |
Merge "Simplify EffectAction."
Diffstat (limited to 'src/com/android/gallery3d/photoeditor/actions/EffectAction.java')
-rw-r--r-- | src/com/android/gallery3d/photoeditor/actions/EffectAction.java | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/src/com/android/gallery3d/photoeditor/actions/EffectAction.java b/src/com/android/gallery3d/photoeditor/actions/EffectAction.java index c17ec232e..08b46e97f 100644 --- a/src/com/android/gallery3d/photoeditor/actions/EffectAction.java +++ b/src/com/android/gallery3d/photoeditor/actions/EffectAction.java @@ -19,7 +19,6 @@ package com.android.gallery3d.photoeditor.actions; import android.content.Context; import android.util.AttributeSet; import android.view.Gravity; -import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; @@ -37,46 +36,36 @@ public abstract class EffectAction extends LinearLayout { /** * Listener of effect action. */ - public interface Listener { + public interface ActionListener { - void onClick(); - - void onDone(); + /** + * Invoked when the action is okayed (effect is applied and completed). + */ + void onOk(); } protected EffectToolFactory factory; - private Listener listener; private Toast tooltip; private FilterStack filterStack; private boolean pushedFilter; private boolean disableFilterOutput; private FilterChangedCallback lastFilterChangedCallback; + private ActionListener listener; public EffectAction(Context context, AttributeSet attrs) { super(context, attrs); } - public void setListener(Listener l) { - listener = l; - findViewById(R.id.effect_button).setOnClickListener( - (listener == null) ? null : new View.OnClickListener() { - - @Override - public void onClick(View v) { - listener.onClick(); - } - }); - } - public CharSequence name() { return ((TextView) findViewById(R.id.effect_label)).getText(); } - public void begin(FilterStack filterStack, EffectToolFactory factory) { + public void begin(FilterStack filterStack, EffectToolFactory factory, ActionListener listener) { // This view is already detached from UI view hierarchy by reaching here; findViewById() // could only access its own child views from here. this.filterStack = filterStack; this.factory = factory; + this.listener = listener; // Shows the tooltip if it's available. if (getTag() != null) { @@ -151,10 +140,8 @@ public abstract class EffectAction extends LinearLayout { } } - protected void notifyDone() { - if (listener != null) { - listener.onDone(); - } + protected void notifyOk() { + listener.onOk(); } /** |