diff options
author | Ruben Brunk <rubenbrunk@google.com> | 2013-07-18 16:37:30 -0700 |
---|---|---|
committer | Ruben Brunk <rubenbrunk@google.com> | 2013-08-01 09:46:44 -0700 |
commit | 203eb404a7cd6a80397535e63d22b3772939f03d (patch) | |
tree | c6cc970ad5bf9fc710cb3a8a2a667729b2439623 /src/com/android/gallery3d/filtershow/editors/EditorRotate.java | |
parent | 3a5bc6b23096365e1a814f8999937028bc12b401 (diff) | |
download | android_packages_apps_Snap-203eb404a7cd6a80397535e63d22b3772939f03d.tar.gz android_packages_apps_Snap-203eb404a7cd6a80397535e63d22b3772939f03d.tar.bz2 android_packages_apps_Snap-203eb404a7cd6a80397535e63d22b3772939f03d.zip |
Refactoring Geometry handling.
Bug: 9170644
Bug: 9366654
Bug: 9366263
- Consolidates all the geometry transforms in GeometryMathUtils and
significantly reduces complexity.
- Removes GeometryMetadata object and dependent code.
- Removes ImageGeometry and geometry update callbacks.
Change-Id: I59add51907459593244c9ebaadef585efc7486d5
Diffstat (limited to 'src/com/android/gallery3d/filtershow/editors/EditorRotate.java')
-rw-r--r-- | src/com/android/gallery3d/filtershow/editors/EditorRotate.java | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/src/com/android/gallery3d/filtershow/editors/EditorRotate.java b/src/com/android/gallery3d/filtershow/editors/EditorRotate.java index e66be2cc1..9452bf0c0 100644 --- a/src/com/android/gallery3d/filtershow/editors/EditorRotate.java +++ b/src/com/android/gallery3d/filtershow/editors/EditorRotate.java @@ -17,6 +17,7 @@ package com.android.gallery3d.filtershow.editors; import android.content.Context; +import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; @@ -24,15 +25,19 @@ import android.widget.FrameLayout; import android.widget.LinearLayout; import com.android.gallery3d.R; +import com.android.gallery3d.filtershow.filters.FilterRepresentation; +import com.android.gallery3d.filtershow.filters.FilterRotateRepresentation; 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 String TAG = EditorRotate.class.getSimpleName(); public static final int ID = R.id.editorRotate; ImageRotate mImageRotate; public EditorRotate() { super(ID); + mChangesGeometry = true; } @Override @@ -42,9 +47,23 @@ public class EditorRotate extends Editor implements EditorInfo { mImageRotate = new ImageRotate(context); } mView = mImageShow = mImageRotate; - mImageRotate.bindAsImageLoadListener(); mImageRotate.setEditor(this); - mImageRotate.syncLocalToMasterGeometry(); + } + + @Override + public void reflectCurrentFilter() { + MasterImage master = MasterImage.getImage(); + master.setCurrentFilterRepresentation(master.getPreset() + .getFilterWithSerializationName(FilterRotateRepresentation.SERIALIZATION_NAME)); + super.reflectCurrentFilter(); + FilterRepresentation rep = getLocalRepresentation(); + if (rep == null || rep instanceof FilterRotateRepresentation) { + mImageRotate.setFilterRotateRepresentation((FilterRotateRepresentation) rep); + } else { + Log.w(TAG, "Could not reflect current filter, not of type: " + + FilterRotateRepresentation.class.getSimpleName()); + } + mImageRotate.invalidate(); } @Override @@ -54,13 +73,19 @@ public class EditorRotate extends Editor implements EditorInfo { @Override public void onClick(View arg0) { mImageRotate.rotate(); - button.setText(mContext.getString(getTextId()) + " " + mImageRotate.getLocalValue()); - mImageRotate.saveAndSetPreset(); + String displayVal = mContext.getString(getTextId()) + " " + + mImageRotate.getLocalValue(); + button.setText(displayVal); } }); } @Override + public void finalApplyCalled() { + commitLocalRepresentation(mImageRotate.getFinalRepresentation()); + } + + @Override public int getTextId() { return R.string.rotate; } |