App

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

- File List
- File Members

DifferenceOfGaussianSharpenPopUpFragment.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.DifferenceOfGaussianSharpenFilterCancelableToolActionData;
15 import mhr.appcore.tools.cancelable.filter.DifferenceOfGaussianSharpenFilterCancelableTool;
16
20 public class DifferenceOfGaussianSharpenPopUpFragment extends CancellableToolPopUpFragment implements LabelledSBChangeListener, OnCheckedChangeListener {
21
22
23 //===== INTERFACES, CLASSES, ENUMS ==========================================================================================================//
24 //----- NON-PUBLIC --------------------------------------------------------------------------------------------------------------------------//
25 //----- PUBLIC ------------------------------------------------------------------------------------------------------------------------------//
26
27 //===== FIELDS ==============================================================================================================================//
28 //----- NON-PUBLIC --------------------------------------------------------------------------------------------------------------------------//
29 protected LabelledSeekBar forceValueLSB = null;
30 protected LabelledSeekBar sigmaValueLSB = null;
31 protected LabelledSeekBar kValueLSB = null;
32 protected CheckBox areaChB = null;
33
34 //----- PUBLIC ------------------------------------------------------------------------------------------------------------------------------//
35
36 //===== CONSTRUCTORS, DESTRUCTORS, RELATED METHODS ==========================================================================================//
37 //----- NON-PUBLIC --------------------------------------------------------------------------------------------------------------------------//
38 @Override
39 protected void onInitView() {
40 forceValueLSB = (LabelledSeekBar) root.findViewById(R.id.ForceValueLSB);
41 forceValueLSB.setLabelledSBChangeListener(this);
42
43 sigmaValueLSB = (LabelledSeekBar) root.findViewById(R.id.SigmaValueLSB);
44 sigmaValueLSB.setLabelledSBChangeListener(this);
45
46 kValueLSB = (LabelledSeekBar) root.findViewById(R.id.KValueLSB);
47 kValueLSB.setLabelledSBChangeListener(this);
48
49 areaChB = (CheckBox) root.findViewById(R.id.EqualizeAreaChB);
50 areaChB.setOnCheckedChangeListener(this);
51
52 }
53 //----- PUBLIC ------------------------------------------------------------------------------------------------------------------------------//
54 public DifferenceOfGaussianSharpenPopUpFragment() {
55
56 }
57
58 //===== METHODS =============================================================================================================================//
59 //----- NON-PUBLIC --------------------------------------------------------------------------------------------------------------------------//
60 @Override
61 protected Tool getTool() {
62
63 return new DifferenceOfGaussianSharpenFilterCancelableTool();
64 }
65
66 @Override
67 protected CancelableToolActionData getUpdateToolData() {
68 return new DifferenceOfGaussianSharpenFilterCancelableToolActionData(Action.UPDATE_PREVIEW, sigmaValueLSB.getProgress(), kValueLSB.getProgress(), forceValueLSB.getProgress(), areaChB.isChecked());
69 }
70
71
72 @Override
73 protected int getLayoutId() {
74 return R.layout.fragment_filter_tool_difference_of_gaussian_sharpen_settings;
75 }
76
77 @Override
78 protected void onCancel() {
79 forceValueLSB.setProgress(0);
80 sigmaValueLSB.setProgress(0.35f);
81 kValueLSB.setProgress(1.6f);
82 areaChB.setChecked(false);
83 }
84 //----- PUBLIC ------------------------------------------------------------------------------------------------------------------------------//
85
86 //===== CALLBACKS ===========================================================================================================================//
87
88 @Override
89 public void onValueChanged(LabelledSeekBar sb, float value, boolean fromUser) {
90 if (livePreviewOn) {
91 activity.addCommand(new CancelableToolUpdateCommand(getUpdateToolData()));
92 }
93 }
94 @Override
95 public void onValueChangeStart(LabelledSeekBar sb) {
96 }
97 @Override
98 public void onValueChangeStop(LabelledSeekBar sb) {
99 }
100
101 @Override
102 public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
103 super.onCheckedChanged(buttonView, isChecked);
104 if (livePreviewOn) {
105 activity.addCommand(new CancelableToolUpdateCommand(getUpdateToolData()));
106 }
107 }
108
109
110 }