App

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

LaplacianOfGaussianSharpenPopUpFragment.java
Go to the documentation of this file.
1 package mhr.app.fragments.toolbox.filters;
2
3 import android.widget.CheckBox;
4 import android.widget.CompoundButton;
5 import android.widget.CompoundButton.OnCheckedChangeListener;
6 import mhr.app.R;
7 import mhr.app.fragments.toolbox.CancellableToolPopUpFragment;
8 import mhr.appandroid.views.LabelledSeekBar;
9 import mhr.appandroid.views.LabelledSeekBar.LabelledSBChangeListener;
10 import mhr.appcore.commands.toolcommands.CancelableToolUpdateCommand;
11 import mhr.appcore.tools.Tool;
12 import mhr.appcore.tools.actiondata.CancelableToolActionData;
13 import mhr.appcore.tools.actiondata.CancelableToolActionData.Action;
14 import mhr.appcore.tools.actiondata.GaussianBlurFilterCancelableToolActionData;
15 import mhr.appcore.tools.actiondata.GaussianSharpenFilterCancelableToolActionData;
16 import mhr.appcore.tools.actiondata.LaplaceSharpenFilterCancelableToolActionData;
17 import mhr.appcore.tools.actiondata.LaplacianOfGaussianSharpenFilterCancelableToolActionData;
18 import mhr.appcore.tools.cancelable.filter.GaussianBlurFilterCancelableTool;
19 import mhr.appcore.tools.cancelable.filter.GaussianSharpenFilterCancelableTool;
20 import mhr.appcore.tools.cancelable.filter.LaplaceSharpenFilterCancelableTool;
21 import mhr.appcore.tools.cancelable.filter.LaplacianOfGaussianSharpenFilterCancelableTool;
22
26 public class LaplacianOfGaussianSharpenPopUpFragment extends CancellableToolPopUpFragment implements LabelledSBChangeListener, OnCheckedChangeListener {
27
28
29 //===== INTERFACES, CLASSES, ENUMS ==========================================================================================================//
30 //----- NON-PUBLIC --------------------------------------------------------------------------------------------------------------------------//
31 //----- PUBLIC ------------------------------------------------------------------------------------------------------------------------------//
32
33 //===== FIELDS ==============================================================================================================================//
34 //----- NON-PUBLIC --------------------------------------------------------------------------------------------------------------------------//
35 protected LabelledSeekBar forceValueLSB = null;
36 protected LabelledSeekBar sigmaValueLSB = null;
37 protected CheckBox areaChB = null;
38
39 //----- PUBLIC ------------------------------------------------------------------------------------------------------------------------------//
40
41 //===== CONSTRUCTORS, DESTRUCTORS, RELATED METHODS ==========================================================================================//
42 //----- NON-PUBLIC --------------------------------------------------------------------------------------------------------------------------//
43 @Override
44 protected void onInitView() {
45 forceValueLSB = (LabelledSeekBar) root.findViewById(R.id.ForceValueLSB);
46 forceValueLSB.setLabelledSBChangeListener(this);
47
48 sigmaValueLSB = (LabelledSeekBar) root.findViewById(R.id.SigmaValueLSB);
49 sigmaValueLSB.setLabelledSBChangeListener(this);
50
51 areaChB = (CheckBox) root.findViewById(R.id.EqualizeAreaChB);
52 areaChB.setOnCheckedChangeListener(this);
53
54 }
55 //----- PUBLIC ------------------------------------------------------------------------------------------------------------------------------//
56 public LaplacianOfGaussianSharpenPopUpFragment() {
57
58 }
59
60 //===== METHODS =============================================================================================================================//
61 //----- NON-PUBLIC --------------------------------------------------------------------------------------------------------------------------//
62 @Override
63 protected Tool getTool() {
64
65 return new LaplacianOfGaussianSharpenFilterCancelableTool();
66 }
67
68 @Override
69 protected CancelableToolActionData getUpdateToolData() {
70 return new LaplacianOfGaussianSharpenFilterCancelableToolActionData(Action.UPDATE_PREVIEW, sigmaValueLSB.getProgress(), forceValueLSB.getProgress(), areaChB.isChecked());
71 }
72
73
74 @Override
75 protected int getLayoutId() {
76 return R.layout.fragment_filter_tool_laplacian_of_gaussian_sharpen_settings;
77 }
78
79 @Override
80 protected void onCancel() {
81 forceValueLSB.setProgress(0);
82 sigmaValueLSB.setProgress(0.35f);
83 areaChB.setChecked(false);
84 }
85 //----- PUBLIC ------------------------------------------------------------------------------------------------------------------------------//
86
87 //===== CALLBACKS ===========================================================================================================================//
88
89 @Override
90 public void onValueChanged(LabelledSeekBar sb, float value, boolean fromUser) {
91 if (livePreviewOn) {
92 activity.addCommand(new CancelableToolUpdateCommand(getUpdateToolData()));
93 }
94 }
95 @Override
96 public void onValueChangeStart(LabelledSeekBar sb) {
97 }
98 @Override
99 public void onValueChangeStop(LabelledSeekBar sb) {
100 }
101
102 @Override
103 public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
104 super.onCheckedChanged(buttonView, isChecked);
105 if (livePreviewOn) {
106 activity.addCommand(new CancelableToolUpdateCommand(getUpdateToolData()));
107 }
108 }
109
110
111 }