From 1bcd04ac4b38b50e993533f1f18b5e5f3bc34008 Mon Sep 17 00:00:00 2001 From: Yuli Huang Date: Sat, 3 Dec 2011 03:23:52 +0800 Subject: Fix effect-label layout and a TODO. 1. Seekbar was wrongly placed below effect label because of the added order. 2. Fix a TODO by refactoring EffectToolFactory to EffectToolKit. Change-Id: I8d37c2c2b6d15f2af65d4e6b27116afe01df63c9 --- .../android/gallery3d/photoeditor/EffectsBar.java | 17 +-- .../actions/ColorTemperatureAction.java | 2 +- .../gallery3d/photoeditor/actions/CropAction.java | 2 +- .../photoeditor/actions/DoodleAction.java | 4 +- .../photoeditor/actions/EffectAction.java | 13 +- .../photoeditor/actions/EffectToolFactory.java | 122 ------------------- .../photoeditor/actions/EffectToolKit.java | 133 +++++++++++++++++++++ .../photoeditor/actions/FaceTanAction.java | 2 +- .../photoeditor/actions/FaceliftAction.java | 2 +- .../photoeditor/actions/FillLightAction.java | 2 +- .../photoeditor/actions/FisheyeAction.java | 2 +- .../gallery3d/photoeditor/actions/FlipAction.java | 4 +- .../gallery3d/photoeditor/actions/GrainAction.java | 2 +- .../photoeditor/actions/HighlightAction.java | 2 +- .../photoeditor/actions/RedEyeAction.java | 2 +- .../photoeditor/actions/RotateAction.java | 4 +- .../photoeditor/actions/SaturationAction.java | 2 +- .../photoeditor/actions/ShadowAction.java | 2 +- .../photoeditor/actions/SharpenAction.java | 2 +- .../photoeditor/actions/StraightenAction.java | 2 +- .../gallery3d/photoeditor/actions/TintAction.java | 2 +- .../photoeditor/actions/VignetteAction.java | 2 +- 22 files changed, 160 insertions(+), 167 deletions(-) delete mode 100644 src/com/android/gallery3d/photoeditor/actions/EffectToolFactory.java create mode 100644 src/com/android/gallery3d/photoeditor/actions/EffectToolKit.java (limited to 'src/com/android') diff --git a/src/com/android/gallery3d/photoeditor/EffectsBar.java b/src/com/android/gallery3d/photoeditor/EffectsBar.java index 0fd6b758c..de47159a3 100644 --- a/src/com/android/gallery3d/photoeditor/EffectsBar.java +++ b/src/com/android/gallery3d/photoeditor/EffectsBar.java @@ -22,11 +22,9 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; -import android.widget.TextView; import com.android.gallery3d.R; import com.android.gallery3d.photoeditor.actions.EffectAction; -import com.android.gallery3d.photoeditor.actions.EffectToolFactory; /** * Effects bar that contains all effects and shows them in categorized views. @@ -37,7 +35,6 @@ public class EffectsBar extends LinearLayout { private FilterStack filterStack; private EffectsMenu effectsMenu; private View effectsGallery; - private ViewGroup effectToolPanel; private EffectAction activeEffect; public EffectsBar(Context context, AttributeSet attrs) { @@ -91,9 +88,6 @@ public class EffectsBar extends LinearLayout { // Set the clicked effect active before exiting effects-gallery. activeEffect = effect; exitEffectsGallery(); - // Create effect tool panel first before the factory could create tools within. - // TODO: Refactor to encapsulate effect-tool panel in effect-tool factory. - createEffectToolPanel(); EffectAction.ActionListener listener = new EffectAction.ActionListener() { @Override @@ -101,20 +95,12 @@ public class EffectsBar extends LinearLayout { exit(null); } }; - activeEffect.begin(filterStack, new EffectToolFactory( - effectToolPanel, inflater), listener); + activeEffect.begin(getRootView(), filterStack, listener); } } }); } - private void createEffectToolPanel() { - effectToolPanel = (ViewGroup) inflater.inflate( - R.layout.photoeditor_effect_tool_panel, this, false); - ((TextView) effectToolPanel.findViewById(R.id.effect_label)).setText(activeEffect.name()); - addView(effectToolPanel, 0); - } - private boolean exitEffectsGallery() { if (effectsGallery != null) { if (activeEffect != null) { @@ -136,7 +122,6 @@ public class EffectsBar extends LinearLayout { @Override public void run() { SpinnerProgressDialog.dismissDialog(); - effectToolPanel = null; activeEffect = null; if (runnableOnDone != null) { runnableOnDone.run(); diff --git a/src/com/android/gallery3d/photoeditor/actions/ColorTemperatureAction.java b/src/com/android/gallery3d/photoeditor/actions/ColorTemperatureAction.java index ac329a038..76bc44633 100644 --- a/src/com/android/gallery3d/photoeditor/actions/ColorTemperatureAction.java +++ b/src/com/android/gallery3d/photoeditor/actions/ColorTemperatureAction.java @@ -36,7 +36,7 @@ public class ColorTemperatureAction extends EffectAction { public void prepare() { final ColorTemperatureFilter filter = new ColorTemperatureFilter(); - ScaleSeekBar scalePicker = factory.createScalePicker(EffectToolFactory.ScaleType.COLOR); + ScaleSeekBar scalePicker = toolKit.addScalePicker(EffectToolKit.ScaleType.COLOR); scalePicker.setOnScaleChangeListener(new ScaleSeekBar.OnScaleChangeListener() { @Override diff --git a/src/com/android/gallery3d/photoeditor/actions/CropAction.java b/src/com/android/gallery3d/photoeditor/actions/CropAction.java index 0a3d12f56..e06c4e93b 100644 --- a/src/com/android/gallery3d/photoeditor/actions/CropAction.java +++ b/src/com/android/gallery3d/photoeditor/actions/CropAction.java @@ -39,7 +39,7 @@ public class CropAction extends EffectAction { final CropFilter filter = new CropFilter(); disableFilterOutput(); - CropView cropView = factory.createCropView(); + CropView cropView = toolKit.addCropView(); cropView.setOnCropChangeListener(new CropView.OnCropChangeListener() { @Override diff --git a/src/com/android/gallery3d/photoeditor/actions/DoodleAction.java b/src/com/android/gallery3d/photoeditor/actions/DoodleAction.java index ca999c1f2..f1482874a 100644 --- a/src/com/android/gallery3d/photoeditor/actions/DoodleAction.java +++ b/src/com/android/gallery3d/photoeditor/actions/DoodleAction.java @@ -38,7 +38,7 @@ public class DoodleAction extends EffectAction { final DoodleFilter filter = new DoodleFilter(); disableFilterOutput(); - final DoodleView doodleView = factory.createDoodleView(); + final DoodleView doodleView = toolKit.addDoodleView(); doodleView.setOnDoodleChangeListener(new DoodleView.OnDoodleChangeListener() { @Override @@ -58,7 +58,7 @@ public class DoodleAction extends EffectAction { } }); - ColorSeekBar colorPicker = factory.createColorPicker(); + ColorSeekBar colorPicker = toolKit.addColorPicker(); colorPicker.setOnColorChangeListener(new ColorSeekBar.OnColorChangeListener() { @Override diff --git a/src/com/android/gallery3d/photoeditor/actions/EffectAction.java b/src/com/android/gallery3d/photoeditor/actions/EffectAction.java index 08b46e97f..e7ab3378b 100644 --- a/src/com/android/gallery3d/photoeditor/actions/EffectAction.java +++ b/src/com/android/gallery3d/photoeditor/actions/EffectAction.java @@ -19,6 +19,7 @@ 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; @@ -44,7 +45,7 @@ public abstract class EffectAction extends LinearLayout { void onOk(); } - protected EffectToolFactory factory; + protected EffectToolKit toolKit; private Toast tooltip; private FilterStack filterStack; private boolean pushedFilter; @@ -56,15 +57,11 @@ public abstract class EffectAction extends LinearLayout { super(context, attrs); } - public CharSequence name() { - return ((TextView) findViewById(R.id.effect_label)).getText(); - } - - public void begin(FilterStack filterStack, EffectToolFactory factory, ActionListener listener) { + public void begin(View root, FilterStack filterStack, ActionListener listener) { // This view is already detached from UI view hierarchy by reaching here; findViewById() // could only access its own child views from here. + toolKit = new EffectToolKit(root, ((TextView) findViewById(R.id.effect_label)).getText()); this.filterStack = filterStack; - this.factory = factory; this.listener = listener; // Shows the tooltip if it's available. @@ -87,7 +84,7 @@ public abstract class EffectAction extends LinearLayout { */ public void end(final Runnable runnableOnODone) { // Remove created tools before ending and output the pushed filter if it wasn't outputted. - factory.removeTools(); + toolKit.close(); if (pushedFilter && disableFilterOutput) { outputFilter(); } diff --git a/src/com/android/gallery3d/photoeditor/actions/EffectToolFactory.java b/src/com/android/gallery3d/photoeditor/actions/EffectToolFactory.java deleted file mode 100644 index f68db8b6a..000000000 --- a/src/com/android/gallery3d/photoeditor/actions/EffectToolFactory.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.gallery3d.photoeditor.actions; - -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import com.android.gallery3d.R; -import com.android.gallery3d.photoeditor.PhotoView; - -/** - * Factory to create tools that will be used by effect actions. - */ -public class EffectToolFactory { - - public enum ScaleType { - LIGHT, SHADOW, COLOR, GENERIC - } - - private final ViewGroup effectToolPanel; - private final LayoutInflater inflater; - private ViewGroup effectToolFullscreen; - - public EffectToolFactory(ViewGroup effectToolPanel, LayoutInflater inflater) { - this.effectToolPanel = effectToolPanel; - this.inflater = inflater; - } - - public PhotoView getPhotoView() { - return (PhotoView) effectToolPanel.getRootView().findViewById(R.id.photo_view); - } - - public void removeTools() { - // Remove all created tools. - if (effectToolFullscreen != null) { - ((ViewGroup) effectToolFullscreen.getParent()).removeView(effectToolFullscreen); - effectToolFullscreen = null; - } - ((ViewGroup) effectToolPanel.getParent()).removeView(effectToolPanel); - } - - private View createFullscreenTool(int toolId) { - // Create full screen effect tool on top of photo-view and place it within the same - // view group that contains photo-view. - PhotoView photoView = getPhotoView(); - ViewGroup parent = (ViewGroup) photoView.getParent(); - effectToolFullscreen = (ViewGroup) inflater.inflate( - R.layout.photoeditor_effect_tool_fullscreen, parent, false); - parent.addView(effectToolFullscreen, parent.indexOfChild(photoView) + 1); - FullscreenToolView tool = (FullscreenToolView) inflater.inflate( - toolId, effectToolFullscreen, false); - tool.setPhotoBounds(photoView.getPhotoBounds()); - effectToolFullscreen.addView(tool); - return tool; - } - - private View createPanelTool(int toolId) { - View tool = inflater.inflate(toolId, effectToolPanel, false); - effectToolPanel.addView(tool); - return tool; - } - - private int getScalePickerBackground(ScaleType type) { - switch (type) { - case LIGHT: - return R.drawable.photoeditor_scale_seekbar_light; - - case SHADOW: - return R.drawable.photoeditor_scale_seekbar_shadow; - - case COLOR: - return R.drawable.photoeditor_scale_seekbar_color; - } - return R.drawable.photoeditor_scale_seekbar_generic; - } - - public ScaleSeekBar createScalePicker(ScaleType type) { - ScaleSeekBar scalePicker = (ScaleSeekBar) createPanelTool( - R.layout.photoeditor_scale_seekbar); - scalePicker.setBackgroundResource(getScalePickerBackground(type)); - return scalePicker; - } - - public ColorSeekBar createColorPicker() { - return (ColorSeekBar) createPanelTool(R.layout.photoeditor_color_seekbar); - } - - public DoodleView createDoodleView() { - return (DoodleView) createFullscreenTool(R.layout.photoeditor_doodle_view); - } - - public TouchView createTouchView() { - return (TouchView) createFullscreenTool(R.layout.photoeditor_touch_view); - } - - public FlipView createFlipView() { - return (FlipView) createFullscreenTool(R.layout.photoeditor_flip_view); - } - - public RotateView createRotateView() { - return (RotateView) createFullscreenTool(R.layout.photoeditor_rotate_view); - } - - public CropView createCropView() { - return (CropView) createFullscreenTool(R.layout.photoeditor_crop_view); - } -} diff --git a/src/com/android/gallery3d/photoeditor/actions/EffectToolKit.java b/src/com/android/gallery3d/photoeditor/actions/EffectToolKit.java new file mode 100644 index 000000000..59c90ede2 --- /dev/null +++ b/src/com/android/gallery3d/photoeditor/actions/EffectToolKit.java @@ -0,0 +1,133 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.gallery3d.photoeditor.actions; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import com.android.gallery3d.R; +import com.android.gallery3d.photoeditor.PhotoView; + +/** + * Tool kit used by effect actions to retrieve tools, including managing tool creation/removal. + */ +public class EffectToolKit { + + public enum ScaleType { + LIGHT, SHADOW, COLOR, GENERIC + } + + private final LayoutInflater inflater; + private final PhotoView photoView; + private final ViewGroup toolPanel; + private final ViewGroup toolFullscreen; + + public EffectToolKit(View root, CharSequence label) { + inflater = (LayoutInflater) root.getContext().getSystemService( + Context.LAYOUT_INFLATER_SERVICE); + + // Create effect tool panel as the first child of effects-bar. + ViewGroup effectsBar = (ViewGroup) root.findViewById(R.id.effects_bar); + toolPanel = (ViewGroup) inflater.inflate( + R.layout.photoeditor_effect_tool_panel, effectsBar, false); + ((TextView) toolPanel.findViewById(R.id.effect_label)).setText(label); + effectsBar.addView(toolPanel, 0); + + // Create effect tool full-screen on top of photo-view and place it within the same + // view group that contains photo-view. + photoView = (PhotoView) root.findViewById(R.id.photo_view); + ViewGroup parent = (ViewGroup) photoView.getParent(); + toolFullscreen = (ViewGroup) inflater.inflate( + R.layout.photoeditor_effect_tool_fullscreen, parent, false); + parent.addView(toolFullscreen, parent.indexOfChild(photoView) + 1); + } + + public PhotoView getPhotoView() { + return photoView; + } + + /** + * Close to remove all created tools. + */ + public void close() { + ((ViewGroup) toolFullscreen.getParent()).removeView(toolFullscreen); + ((ViewGroup) toolPanel.getParent()).removeView(toolPanel); + } + + private View addFullscreenTool(int toolId) { + FullscreenToolView tool = (FullscreenToolView) inflater.inflate( + toolId, toolFullscreen, false); + tool.setPhotoBounds(getPhotoView().getPhotoBounds()); + toolFullscreen.addView(tool); + return tool; + } + + private View addPanelTool(int toolId) { + // Add the tool right above the effect-label in the panel. + View tool = inflater.inflate(toolId, toolPanel, false); + toolPanel.addView(tool, toolPanel.indexOfChild(toolPanel.findViewById(R.id.effect_label))); + return tool; + } + + private int getScalePickerBackground(ScaleType type) { + switch (type) { + case LIGHT: + return R.drawable.photoeditor_scale_seekbar_light; + + case SHADOW: + return R.drawable.photoeditor_scale_seekbar_shadow; + + case COLOR: + return R.drawable.photoeditor_scale_seekbar_color; + } + return R.drawable.photoeditor_scale_seekbar_generic; + } + + public ScaleSeekBar addScalePicker(ScaleType type) { + ScaleSeekBar scalePicker = (ScaleSeekBar) addPanelTool( + R.layout.photoeditor_scale_seekbar); + scalePicker.setBackgroundResource(getScalePickerBackground(type)); + return scalePicker; + } + + public ColorSeekBar addColorPicker() { + return (ColorSeekBar) addPanelTool(R.layout.photoeditor_color_seekbar); + } + + public DoodleView addDoodleView() { + return (DoodleView) addFullscreenTool(R.layout.photoeditor_doodle_view); + } + + public TouchView addTouchView() { + return (TouchView) addFullscreenTool(R.layout.photoeditor_touch_view); + } + + public FlipView addFlipView() { + return (FlipView) addFullscreenTool(R.layout.photoeditor_flip_view); + } + + public RotateView addRotateView() { + return (RotateView) addFullscreenTool(R.layout.photoeditor_rotate_view); + } + + public CropView addCropView() { + return (CropView) addFullscreenTool(R.layout.photoeditor_crop_view); + } +} diff --git a/src/com/android/gallery3d/photoeditor/actions/FaceTanAction.java b/src/com/android/gallery3d/photoeditor/actions/FaceTanAction.java index 6faa778a0..6b8f1d1b7 100644 --- a/src/com/android/gallery3d/photoeditor/actions/FaceTanAction.java +++ b/src/com/android/gallery3d/photoeditor/actions/FaceTanAction.java @@ -36,7 +36,7 @@ public class FaceTanAction extends EffectAction { public void prepare() { final FaceTanFilter filter = new FaceTanFilter(); - ScaleSeekBar scalePicker = factory.createScalePicker(EffectToolFactory.ScaleType.GENERIC); + ScaleSeekBar scalePicker = toolKit.addScalePicker(EffectToolKit.ScaleType.GENERIC); scalePicker.setOnScaleChangeListener(new ScaleSeekBar.OnScaleChangeListener() { @Override diff --git a/src/com/android/gallery3d/photoeditor/actions/FaceliftAction.java b/src/com/android/gallery3d/photoeditor/actions/FaceliftAction.java index 9afa7baab..4c1a91892 100644 --- a/src/com/android/gallery3d/photoeditor/actions/FaceliftAction.java +++ b/src/com/android/gallery3d/photoeditor/actions/FaceliftAction.java @@ -36,7 +36,7 @@ public class FaceliftAction extends EffectAction { public void prepare() { final FaceliftFilter filter = new FaceliftFilter(); - ScaleSeekBar scalePicker = factory.createScalePicker(EffectToolFactory.ScaleType.GENERIC); + ScaleSeekBar scalePicker = toolKit.addScalePicker(EffectToolKit.ScaleType.GENERIC); scalePicker.setOnScaleChangeListener(new ScaleSeekBar.OnScaleChangeListener() { @Override diff --git a/src/com/android/gallery3d/photoeditor/actions/FillLightAction.java b/src/com/android/gallery3d/photoeditor/actions/FillLightAction.java index dbb52b57e..323bfd62e 100644 --- a/src/com/android/gallery3d/photoeditor/actions/FillLightAction.java +++ b/src/com/android/gallery3d/photoeditor/actions/FillLightAction.java @@ -36,7 +36,7 @@ public class FillLightAction extends EffectAction { public void prepare() { final FillLightFilter filter = new FillLightFilter(); - ScaleSeekBar scalePicker = factory.createScalePicker(EffectToolFactory.ScaleType.LIGHT); + ScaleSeekBar scalePicker = toolKit.addScalePicker(EffectToolKit.ScaleType.LIGHT); scalePicker.setOnScaleChangeListener(new ScaleSeekBar.OnScaleChangeListener() { @Override diff --git a/src/com/android/gallery3d/photoeditor/actions/FisheyeAction.java b/src/com/android/gallery3d/photoeditor/actions/FisheyeAction.java index fdff064ee..df7ed7877 100644 --- a/src/com/android/gallery3d/photoeditor/actions/FisheyeAction.java +++ b/src/com/android/gallery3d/photoeditor/actions/FisheyeAction.java @@ -36,7 +36,7 @@ public class FisheyeAction extends EffectAction { public void prepare() { final FisheyeFilter filter = new FisheyeFilter(); - ScaleSeekBar scalePicker = factory.createScalePicker(EffectToolFactory.ScaleType.GENERIC); + ScaleSeekBar scalePicker = toolKit.addScalePicker(EffectToolKit.ScaleType.GENERIC); scalePicker.setOnScaleChangeListener(new ScaleSeekBar.OnScaleChangeListener() { @Override diff --git a/src/com/android/gallery3d/photoeditor/actions/FlipAction.java b/src/com/android/gallery3d/photoeditor/actions/FlipAction.java index 6381d7fe1..71e5a90f6 100644 --- a/src/com/android/gallery3d/photoeditor/actions/FlipAction.java +++ b/src/com/android/gallery3d/photoeditor/actions/FlipAction.java @@ -40,13 +40,13 @@ public class FlipAction extends EffectAction { final FlipFilter filter = new FlipFilter(); disableFilterOutput(); - final FlipView flipView = factory.createFlipView(); + final FlipView flipView = toolKit.addFlipView(); flipView.setOnFlipChangeListener(new FlipView.OnFlipChangeListener() { float horizontalDegrees; float verticalDegrees; Runnable queuedTransform; - PhotoView photoView = factory.getPhotoView(); + PhotoView photoView = toolKit.getPhotoView(); @Override public void onAngleChanged(float horizontalDegrees, float verticalDegrees, diff --git a/src/com/android/gallery3d/photoeditor/actions/GrainAction.java b/src/com/android/gallery3d/photoeditor/actions/GrainAction.java index 4f643211a..5e99129df 100644 --- a/src/com/android/gallery3d/photoeditor/actions/GrainAction.java +++ b/src/com/android/gallery3d/photoeditor/actions/GrainAction.java @@ -36,7 +36,7 @@ public class GrainAction extends EffectAction { public void prepare() { final GrainFilter filter = new GrainFilter(); - ScaleSeekBar scalePicker = factory.createScalePicker(EffectToolFactory.ScaleType.GENERIC); + ScaleSeekBar scalePicker = toolKit.addScalePicker(EffectToolKit.ScaleType.GENERIC); scalePicker.setOnScaleChangeListener(new ScaleSeekBar.OnScaleChangeListener() { @Override diff --git a/src/com/android/gallery3d/photoeditor/actions/HighlightAction.java b/src/com/android/gallery3d/photoeditor/actions/HighlightAction.java index fc06b737a..18d7add3c 100644 --- a/src/com/android/gallery3d/photoeditor/actions/HighlightAction.java +++ b/src/com/android/gallery3d/photoeditor/actions/HighlightAction.java @@ -36,7 +36,7 @@ public class HighlightAction extends EffectAction { public void prepare() { final HighlightFilter filter = new HighlightFilter(); - ScaleSeekBar scalePicker = factory.createScalePicker(EffectToolFactory.ScaleType.LIGHT); + ScaleSeekBar scalePicker = toolKit.addScalePicker(EffectToolKit.ScaleType.LIGHT); scalePicker.setOnScaleChangeListener(new ScaleSeekBar.OnScaleChangeListener() { @Override diff --git a/src/com/android/gallery3d/photoeditor/actions/RedEyeAction.java b/src/com/android/gallery3d/photoeditor/actions/RedEyeAction.java index cea1aaecf..b957715d4 100644 --- a/src/com/android/gallery3d/photoeditor/actions/RedEyeAction.java +++ b/src/com/android/gallery3d/photoeditor/actions/RedEyeAction.java @@ -36,7 +36,7 @@ public class RedEyeAction extends EffectAction { public void prepare() { final RedEyeFilter filter = new RedEyeFilter(); - TouchView touchView = factory.createTouchView(); + TouchView touchView = toolKit.addTouchView(); touchView.setSingleTapListener(new TouchView.SingleTapListener() { final RectF bounds = new RectF(0, 0, 1, 1); diff --git a/src/com/android/gallery3d/photoeditor/actions/RotateAction.java b/src/com/android/gallery3d/photoeditor/actions/RotateAction.java index 8adf3e582..98d65550a 100644 --- a/src/com/android/gallery3d/photoeditor/actions/RotateAction.java +++ b/src/com/android/gallery3d/photoeditor/actions/RotateAction.java @@ -40,12 +40,12 @@ public class RotateAction extends EffectAction { final RotateFilter filter = new RotateFilter(); disableFilterOutput(); - final RotateView rotateView = factory.createRotateView(); + final RotateView rotateView = toolKit.addRotateView(); rotateView.setOnRotateChangeListener(new RotateView.OnRotateChangeListener() { float rotateDegrees; Runnable queuedTransform; - PhotoView photoView = factory.getPhotoView(); + PhotoView photoView = toolKit.getPhotoView(); @Override public void onAngleChanged(float degrees, boolean fromUser) { diff --git a/src/com/android/gallery3d/photoeditor/actions/SaturationAction.java b/src/com/android/gallery3d/photoeditor/actions/SaturationAction.java index b3ffe6470..6afd7ba72 100644 --- a/src/com/android/gallery3d/photoeditor/actions/SaturationAction.java +++ b/src/com/android/gallery3d/photoeditor/actions/SaturationAction.java @@ -36,7 +36,7 @@ public class SaturationAction extends EffectAction { public void prepare() { final SaturationFilter filter = new SaturationFilter(); - ScaleSeekBar scalePicker = factory.createScalePicker(EffectToolFactory.ScaleType.COLOR); + ScaleSeekBar scalePicker = toolKit.addScalePicker(EffectToolKit.ScaleType.COLOR); scalePicker.setOnScaleChangeListener(new ScaleSeekBar.OnScaleChangeListener() { @Override diff --git a/src/com/android/gallery3d/photoeditor/actions/ShadowAction.java b/src/com/android/gallery3d/photoeditor/actions/ShadowAction.java index 87781af6e..cfd053853 100644 --- a/src/com/android/gallery3d/photoeditor/actions/ShadowAction.java +++ b/src/com/android/gallery3d/photoeditor/actions/ShadowAction.java @@ -36,7 +36,7 @@ public class ShadowAction extends EffectAction { public void prepare() { final ShadowFilter filter = new ShadowFilter(); - ScaleSeekBar scalePicker = factory.createScalePicker(EffectToolFactory.ScaleType.SHADOW); + ScaleSeekBar scalePicker = toolKit.addScalePicker(EffectToolKit.ScaleType.SHADOW); scalePicker.setOnScaleChangeListener(new ScaleSeekBar.OnScaleChangeListener() { @Override diff --git a/src/com/android/gallery3d/photoeditor/actions/SharpenAction.java b/src/com/android/gallery3d/photoeditor/actions/SharpenAction.java index 760f3909c..7c00b21c9 100644 --- a/src/com/android/gallery3d/photoeditor/actions/SharpenAction.java +++ b/src/com/android/gallery3d/photoeditor/actions/SharpenAction.java @@ -36,7 +36,7 @@ public class SharpenAction extends EffectAction { public void prepare() { final SharpenFilter filter = new SharpenFilter(); - ScaleSeekBar scalePicker = factory.createScalePicker(EffectToolFactory.ScaleType.GENERIC); + ScaleSeekBar scalePicker = toolKit.addScalePicker(EffectToolKit.ScaleType.GENERIC); scalePicker.setOnScaleChangeListener(new ScaleSeekBar.OnScaleChangeListener() { @Override diff --git a/src/com/android/gallery3d/photoeditor/actions/StraightenAction.java b/src/com/android/gallery3d/photoeditor/actions/StraightenAction.java index 5fb5ecdb7..55eb8fd6e 100644 --- a/src/com/android/gallery3d/photoeditor/actions/StraightenAction.java +++ b/src/com/android/gallery3d/photoeditor/actions/StraightenAction.java @@ -37,7 +37,7 @@ public class StraightenAction extends EffectAction { public void prepare() { final StraightenFilter filter = new StraightenFilter(); - RotateView rotateView = factory.createRotateView(); + RotateView rotateView = toolKit.addRotateView(); rotateView.setOnRotateChangeListener(new RotateView.OnRotateChangeListener() { @Override diff --git a/src/com/android/gallery3d/photoeditor/actions/TintAction.java b/src/com/android/gallery3d/photoeditor/actions/TintAction.java index 54c234384..417c8f5d3 100644 --- a/src/com/android/gallery3d/photoeditor/actions/TintAction.java +++ b/src/com/android/gallery3d/photoeditor/actions/TintAction.java @@ -36,7 +36,7 @@ public class TintAction extends EffectAction { public void prepare() { final TintFilter filter = new TintFilter(); - ColorSeekBar colorPicker = factory.createColorPicker(); + ColorSeekBar colorPicker = toolKit.addColorPicker(); colorPicker.setOnColorChangeListener(new ColorSeekBar.OnColorChangeListener() { @Override diff --git a/src/com/android/gallery3d/photoeditor/actions/VignetteAction.java b/src/com/android/gallery3d/photoeditor/actions/VignetteAction.java index fd5121fce..9f6bcc76f 100644 --- a/src/com/android/gallery3d/photoeditor/actions/VignetteAction.java +++ b/src/com/android/gallery3d/photoeditor/actions/VignetteAction.java @@ -36,7 +36,7 @@ public class VignetteAction extends EffectAction { public void prepare() { final VignetteFilter filter = new VignetteFilter(); - ScaleSeekBar scalePicker = factory.createScalePicker(EffectToolFactory.ScaleType.GENERIC); + ScaleSeekBar scalePicker = toolKit.addScalePicker(EffectToolKit.ScaleType.GENERIC); scalePicker.setOnScaleChangeListener(new ScaleSeekBar.OnScaleChangeListener() { @Override -- cgit v1.2.3