diff options
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; } |