summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRuben Brunk <rubenbrunk@google.com>2013-04-01 23:07:42 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-04-01 23:07:42 +0000
commit8985b7b890aa7e84effe44ac11989c6158767f0d (patch)
treea9473fc477984b498454f24ca26e33a73d07eaf3
parent87efd29660cfc53023667ff8c124364fcdbcc88c (diff)
parentebe79e4f32a6d8871e49fc91c45a3ef2d61e7f9a (diff)
downloadandroid_packages_apps_Snap-8985b7b890aa7e84effe44ac11989c6158767f0d.tar.gz
android_packages_apps_Snap-8985b7b890aa7e84effe44ac11989c6158767f0d.tar.bz2
android_packages_apps_Snap-8985b7b890aa7e84effe44ac11989c6158767f0d.zip
Merge "Added apply UI callbacks for rotate/mirror operations." into gb-ub-photos-bryce
-rw-r--r--src/com/android/gallery3d/filtershow/editors/EditorFlip.java17
-rw-r--r--src/com/android/gallery3d/filtershow/editors/EditorRotate.java18
-rw-r--r--src/com/android/gallery3d/filtershow/imageshow/ImageFlip.java16
-rw-r--r--src/com/android/gallery3d/filtershow/imageshow/ImageRotate.java9
4 files changed, 59 insertions, 1 deletions
diff --git a/src/com/android/gallery3d/filtershow/editors/EditorFlip.java b/src/com/android/gallery3d/filtershow/editors/EditorFlip.java
index c996dcbe3..de6240c7a 100644
--- a/src/com/android/gallery3d/filtershow/editors/EditorFlip.java
+++ b/src/com/android/gallery3d/filtershow/editors/EditorFlip.java
@@ -17,13 +17,18 @@
package com.android.gallery3d.filtershow.editors;
import android.content.Context;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
import android.widget.FrameLayout;
+import android.widget.LinearLayout;
import com.android.gallery3d.R;
import com.android.gallery3d.filtershow.imageshow.ImageFlip;
import com.android.gallery3d.filtershow.imageshow.MasterImage;
public class EditorFlip extends Editor implements EditorInfo {
+ public static final String LOGTAG = "EditorFlip";
public static final int ID = R.id.editorFlip;
ImageFlip mImageFlip;
@@ -44,6 +49,18 @@ public class EditorFlip extends Editor implements EditorInfo {
}
@Override
+ public void openUtilityPanel(final LinearLayout accessoryViewList) {
+ final Button button = (Button) accessoryViewList.findViewById(R.id.applyEffect);
+ button.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View arg0) {
+ mImageFlip.flip();
+ mImageFlip.saveAndSetPreset();
+ }
+ });
+ }
+
+ @Override
public int getTextId() {
return R.string.mirror;
}
diff --git a/src/com/android/gallery3d/filtershow/editors/EditorRotate.java b/src/com/android/gallery3d/filtershow/editors/EditorRotate.java
index e49555831..a637c08ff 100644
--- a/src/com/android/gallery3d/filtershow/editors/EditorRotate.java
+++ b/src/com/android/gallery3d/filtershow/editors/EditorRotate.java
@@ -17,13 +17,18 @@
package com.android.gallery3d.filtershow.editors;
import android.content.Context;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
import android.widget.FrameLayout;
+import android.widget.LinearLayout;
import com.android.gallery3d.R;
import com.android.gallery3d.filtershow.imageshow.ImageRotate;
import com.android.gallery3d.filtershow.imageshow.MasterImage;
public class EditorRotate extends Editor implements EditorInfo {
+ public static final String LOGTAG = "EditorRotate";
public static final int ID = R.id.editorRotate;
ImageRotate mImageRotate;
@@ -44,6 +49,19 @@ public class EditorRotate extends Editor implements EditorInfo {
}
@Override
+ public void openUtilityPanel(final LinearLayout accessoryViewList) {
+ final Button button = (Button) accessoryViewList.findViewById(R.id.applyEffect);
+ button.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View arg0) {
+ mImageRotate.rotate();
+ button.setText(mContext.getString(getTextId()) + " " + mImageRotate.getLocalValue());
+ mImageRotate.saveAndSetPreset();
+ }
+ });
+ }
+
+ @Override
public int getTextId() {
return R.string.rotate;
}
diff --git a/src/com/android/gallery3d/filtershow/imageshow/ImageFlip.java b/src/com/android/gallery3d/filtershow/imageshow/ImageFlip.java
index 70637a30c..15197b055 100644
--- a/src/com/android/gallery3d/filtershow/imageshow/ImageFlip.java
+++ b/src/com/android/gallery3d/filtershow/imageshow/ImageFlip.java
@@ -58,6 +58,22 @@ public class ImageFlip extends ImageGeometry {
return (rot / 90) % 2 != 0;
}
+ public void flip() {
+ FLIP flip = getLocalFlip();
+ boolean next = true;
+ // Picks next flip in order from enum FLIP (wrapping)
+ for (FLIP f : FLIP.values()) {
+ if (next) {
+ mNextFlip = f;
+ next = false;
+ }
+ if (f.equals(flip)) {
+ next = true;
+ }
+ }
+ setLocalFlip(mNextFlip);
+ }
+
@Override
protected void setActionMove(float x, float y) {
super.setActionMove(x, y);
diff --git a/src/com/android/gallery3d/filtershow/imageshow/ImageRotate.java b/src/com/android/gallery3d/filtershow/imageshow/ImageRotate.java
index c4b9aa27d..ab8023e02 100644
--- a/src/com/android/gallery3d/filtershow/imageshow/ImageRotate.java
+++ b/src/com/android/gallery3d/filtershow/imageshow/ImageRotate.java
@@ -54,6 +54,13 @@ public class ImageRotate extends ImageGeometry {
mAngle = (mBaseAngle - angle) % 360;
}
+ public void rotate() {
+ mAngle += 90;
+ mAngle = snappedAngle(mAngle);
+ mAngle %= 360;
+ setLocalRotation(mAngle);
+ }
+
@Override
protected void setActionDown(float x, float y) {
super.setActionDown(x, y);
@@ -76,7 +83,7 @@ public class ImageRotate extends ImageGeometry {
}
@Override
- protected int getLocalValue() {
+ public int getLocalValue() {
return constrainedRotation(snappedAngle(getLocalRotation()));
}