import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
-import android.widget.*;
+import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
+import android.widget.FrameLayout;
+import android.widget.ImageButton;
+import android.widget.LinearLayout;
+import android.widget.ListView;
+import android.widget.ShareActionProvider;
import android.widget.ShareActionProvider.OnShareTargetSelectedListener;
+import android.widget.Toast;
import com.android.gallery3d.R;
import com.android.gallery3d.data.LocalAlbum;
import com.android.gallery3d.filtershow.editors.EditorRedEye;
import com.android.gallery3d.filtershow.editors.EditorRotate;
import com.android.gallery3d.filtershow.editors.EditorStraighten;
-import com.android.gallery3d.filtershow.editors.ImageOnlyEditor;
import com.android.gallery3d.filtershow.editors.EditorTinyPlanet;
-import com.android.gallery3d.filtershow.filters.*;
+import com.android.gallery3d.filtershow.editors.ImageOnlyEditor;
+import com.android.gallery3d.filtershow.filters.FilterColorBorderRepresentation;
+import com.android.gallery3d.filtershow.filters.FilterFxRepresentation;
+import com.android.gallery3d.filtershow.filters.FilterImageBorderRepresentation;
+import com.android.gallery3d.filtershow.filters.FilterRepresentation;
+import com.android.gallery3d.filtershow.filters.FiltersManager;
+import com.android.gallery3d.filtershow.filters.ImageFilter;
+import com.android.gallery3d.filtershow.filters.ImageFilterBorder;
+import com.android.gallery3d.filtershow.filters.ImageFilterRS;
import com.android.gallery3d.filtershow.imageshow.GeometryMetadata;
import com.android.gallery3d.filtershow.imageshow.ImageCrop;
-import com.android.gallery3d.filtershow.imageshow.ImageFlip;
-import com.android.gallery3d.filtershow.imageshow.ImageRotate;
import com.android.gallery3d.filtershow.imageshow.ImageShow;
-import com.android.gallery3d.filtershow.imageshow.ImageStraighten;
import com.android.gallery3d.filtershow.imageshow.ImageTinyPlanet;
import com.android.gallery3d.filtershow.imageshow.ImageZoom;
import com.android.gallery3d.filtershow.imageshow.MasterImage;
mImageShow.getImagePreset().mGeoData.setCropExtras(mCropExtras);
// FIXME: moving to editors breaks the crop action
-// mImageCrop.setExtras(mCropExtras);
+ EditorCrop crop = (EditorCrop) mEditorPlaceHolder.getEditor(EditorCrop.ID);
+
+ crop.setExtras(mCropExtras);
String s = getString(R.string.Fixed);
-// mImageCrop.setAspectString(s);
-// mImageCrop.setCropActionFlag(true);
+ crop.setAspectString(s);
+ crop.setCropActionFlag(true);
mPanelController.setFixedAspect(mCropExtras.getAspectX() > 0
&& mCropExtras.getAspectY() > 0);
}
}
}
+ MasterImage.getImage().setOriginalGeometry(largeBitmap);
mLoadBitmapTask = null;
if (mAction == CROP_ACTION) {
- // FIXME: broken by the move to editors
- // mPanelController.showComponent(findViewById(R.id.cropButton));
+
+ mPanelController.showComponent(findViewById(EditorCrop.ID));
} else if (mAction == TINY_PLANET_ACTION) {
- mPanelController.showComponent(findViewById(R.id.tinyplanetButton));
+ mPanelController.showComponent(findViewById(EditorTinyPlanet.ID));
}
super.onPostExecute(result);
String text = representation.getName();
icon.setup(text, mPanelController, panel);
icon.setFilterRepresentation(representation);
- if (representation instanceof FilterTinyPlanetRepresentation) {
- // needed to hide tinyplanet on startup
- icon.setId(R.id.tinyplanetButton);
- }
+ icon.setId(representation.getEditorId());
mPanelController.addComponent(button, icon);
panel.addView(icon);
return icon;
import android.widget.FrameLayout;
import com.android.gallery3d.R;
+import com.android.gallery3d.filtershow.CropExtras;
import com.android.gallery3d.filtershow.imageshow.ImageCrop;
import com.android.gallery3d.filtershow.imageshow.MasterImage;
private static final String LOGTAG = "EditorCrop";
ImageCrop mImageCrop;
+ private String mAspectString = null;
+ private boolean mCropActionFlag = false;
+ private CropExtras mCropExtras = null;
public EditorCrop() {
super(ID);
public void createEditor(Context context, FrameLayout frameLayout) {
super.createEditor(context, frameLayout);
mView = mImageShow = mImageCrop = new ImageCrop(context);
+ mImageCrop.setExtras(mCropExtras);
+ mImageCrop.setAspectString(mAspectString);
+ mImageCrop.setCropActionFlag(mCropActionFlag);
mImageCrop.setImageLoader(MasterImage.getImage().getImageLoader());
mImageCrop.setEditor(this);
mImageCrop.syncLocalToMasterGeometry();
public boolean getOverlayOnly() {
return true;
}
+
+ public void setExtras(CropExtras cropExtras) {
+ mCropExtras = cropExtras;
+ }
+
+ public void setAspectString(String s) {
+ mAspectString = s;
+ }
+
+ public void setCropActionFlag(boolean b) {
+ mCropActionFlag = b;
+ }
+
}
package com.android.gallery3d.filtershow.imageshow;
import android.graphics.*;
+import android.os.Handler;
+import android.os.Message;
import android.util.Log;
import com.android.gallery3d.filtershow.FilterShowActivity;
private Point mImageShowSize = new Point();
+ final private static int NEW_GEOMETRY = 1;
+
+ private final Handler mHandler = new Handler() {
+ @Override
+ public void handleMessage(Message msg) {
+ switch (msg.what) {
+ case NEW_GEOMETRY: {
+ hasNewGeometry();
+ break;
+ }
+ }
+ }
+ };
+
private MasterImage() {
}
return mFilteredPreview;
}
+ public void setOriginalGeometry(Bitmap originalBitmapLarge) {
+ GeometryMetadata geo = getPreset().mGeoData;
+ float w = originalBitmapLarge.getWidth();
+ float h = originalBitmapLarge.getHeight();
+ RectF r = new RectF(0, 0, w, h);
+ geo.setPhotoBounds(r);
+ geo.setCropBounds(r);
+ getPreset().setGeometry(geo);
+ }
+
public Bitmap getFilteredImage() {
return mFilteredPreview.getConsumer();
}
}
public void notifyGeometryChange() {
+ mHandler.sendEmptyMessage(NEW_GEOMETRY);
+ }
+
+ public void hasNewGeometry() {
updatePresets(true);
for (GeometryListener listener : mGeometryListeners) {
listener.geometryChanged();