App

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

- File List
- File Members

DifferenceOfGaussianSharpenLayerSettingsFragment.java
Go to the documentation of this file.
1 package mhr.app.fragments.layers.filter;
2
3 import java.text.DecimalFormat;
4
5 import mhr.app.R;
6 import mhr.app.fragments.layers.LayerSettingsFragment;
7
8 import mhr.appandroid.views.LabelledSeekBar;
9 import mhr.appcore.image.layers.LayerSpecificPresentation;
10 import mhr.appcore.image.layers.filter.DifferenceOfGaussianSharpenFilterLayerSpecificPresentation;
11 import mhr.appcore.image.layers.filter.GaussianBlurFilterLayerSpecificPresentation;
12
13 import android.os.Bundle;
14 import android.view.LayoutInflater;
15 import android.view.View;
16 import android.view.View.OnClickListener;
17 import android.view.ViewGroup;
18 import android.widget.CheckBox;
19 import android.widget.SeekBar;
20 import android.widget.SeekBar.OnSeekBarChangeListener;
21 import android.widget.TextView;
22
26 public class DifferenceOfGaussianSharpenLayerSettingsFragment extends LayerSettingsFragment implements OnClickListener {
27
28
29 //===== INTERFACES, CLASSES, ENUMS ==========================================================================================================//
30 //----- NON-PUBLIC --------------------------------------------------------------------------------------------------------------------------//
31 //----- PUBLIC ------------------------------------------------------------------------------------------------------------------------------//
32
33 //===== FIELDS ==============================================================================================================================//
34 //----- NON-PUBLIC --------------------------------------------------------------------------------------------------------------------------//
35 protected LabelledSeekBar sigmaLSB;
36 protected LabelledSeekBar kLSB;
37 protected LabelledSeekBar forceLSB;
38 protected CheckBox equalizeAreaChB;
39
40
41 //----- PUBLIC ------------------------------------------------------------------------------------------------------------------------------//
42
43 //===== CONSTRUCTORS, DESTRUCTORS, RELATED METHODS ==========================================================================================//
44 //----- NON-PUBLIC --------------------------------------------------------------------------------------------------------------------------//
45 @Override
46 protected View initView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
47 root = inflater.inflate(R.layout.fragment_difference_of_gaussian_sharpen_layer_settings, container, false);
48 sigmaLSB = (LabelledSeekBar) root.findViewById(R.id.SigmaValueLSB);
49 kLSB = (LabelledSeekBar) root.findViewById(R.id.KValueLSB);
50 forceLSB = (LabelledSeekBar) root.findViewById(R.id.ForceValueLSB);
51 equalizeAreaChB = (CheckBox) root.findViewById(R.id.EqualizeAreaChB);
52 return root;
53 }
54 //----- PUBLIC ------------------------------------------------------------------------------------------------------------------------------//
55
56 //===== METHODS =============================================================================================================================//
57 //----- NON-PUBLIC --------------------------------------------------------------------------------------------------------------------------//
58 @Override
59 protected void updateFromPresentation(LayerSpecificPresentation pres) {
60 DifferenceOfGaussianSharpenFilterLayerSpecificPresentation p = (DifferenceOfGaussianSharpenFilterLayerSpecificPresentation) pres;
61 sigmaLSB.setProgress((float)p.sigma);
62 kLSB.setProgress((float)p.k);
63 forceLSB.setProgress((float)p.force);
64 equalizeAreaChB.setChecked(p.area);
65 }
66
67 @Override
68 protected void updatePresentation(LayerSpecificPresentation pres) {
69 DifferenceOfGaussianSharpenFilterLayerSpecificPresentation p = (DifferenceOfGaussianSharpenFilterLayerSpecificPresentation) pres;
70 p.sigma = sigmaLSB.getProgress();
71 p.k = kLSB.getProgress();
72 p.force = forceLSB.getProgress();
73 p.area = equalizeAreaChB.isChecked();
74 }
75
76 //----- PUBLIC ------------------------------------------------------------------------------------------------------------------------------//
77
78 //===== CALLBACKS ===========================================================================================================================//
79 @Override
80 public void onClick(View v) {
81 switch (v.getId()) {
82 default:
83 super.onClick(v);
84 break;
85 }
86 }
87
88 //----- LIFE CYCLE --------------------------------------------------------------------------------------------------------------------------//
89
90 // @Override
91 // public void onAttach(Activity activity) {
92 // super.onAttach(activity);
93 // /*
94 // * called once the fragment is associated with its activity.
95 // */
96 // }
97
98 // @Override
99 // public void onCreate(Bundle savedInstanceState) {
100 // super.onCreate(savedInstanceState);
101 // /*
102 // * called to do initial creation of the fragment.
103 // *
104 // * The system calls this when creating the fragment. Within your implementation, you should initialize essential components of the fragment that you want
105 // * to retain when the fragment is paused or stopped, then resumed.
106 // */
107 // }
108
109 // @Override
110 // public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
111 // return super.onCreateView(inflater, container, savedInstanceState);
112 // /*
113 // * creates and returns the view hierarchy associated with the fragment.
114 // *
115 // * The system calls this when it's time for the fragment to draw its user interface for the first time. To draw a UI for your fragment, you must return a
116 // * View from this method that is the root of your fragment's layout. You can return null if the fragment does not provide a UI.
117 // *
118 // * Zde začíná životní cyklus při návratu z backstacku
119 // */
120 // }
121
122 // @Override
123 // public void onActivityCreated(Bundle savedInstanceState) {
124 // super.onActivityCreated(savedInstanceState);
125 // /*
126 // * tells the fragment that its activity has completed its own Activity.onCreate().
127 // */
128 // }
129
130 // @Override // Vyžaduje API 17
131 // public void onViewStateRestored(Bundle savedInstanceState) {
132 // super.onViewStateRestored(savedInstanceState);
133 // /*
134 // * tells the fragment that all of the saved state of its view hierarchy has been restored.
135 // */
136 // }
137
138 // @Override
139 // public void onStart() {
140 // super.onStart();
141 // /*
142 // * makes the fragment visible to the user (based on its containing activity being started).
143 // */
144 // }
145 //
146 // @Override
147 // public void onResume() {
148 // super.onResume();
149 // /*
150 // * makes the fragment interacting with the user (based on its containing activity being resumed).
151 // */
152 // }
153
154 // @Override
155 // public void onPause() {
156 // super.onPause();
157 // /*
158 // * fragment is no longer interacting with the user either because its activity is being paused or a fragment operation is modifying it in the activity.
159 // *
160 // * The system calls this method as the first indication that the user is leaving the fragment (though it does not always mean the fragment is being destroyed).
161 // * This is usually where you should commit any changes that should be persisted beyond the current user session (because the user might not come back).
162 // */
163 // }
164
165 // @Override
166 // public void onStop() {
167 // super.onStop();
168 // /*
169 // * fragment is no longer visible to the user either because its activity is being stopped or a fragment operation is modifying it in the activity.
170 // */
171 // }
172
173 // @Override
174 // public void onDestroyView() {
175 // super.onDestroyView();
176 // /*
177 // * allows the fragment to clean up resources associated with its View.
178 // *
179 // * Zde končí životní cyklus při umístění do backstacku
180 // */
181 // }
182
183 // @Override
184 // public void onDestroy() {
185 // super.onDestroy();
186 // /*
187 // * called to do final cleanup of the fragment's state.
188 // */
189 // }
190
191 // @Override
192 // public void onDetach() {
193 // super.onDetach();
194 // /*
195 // * called immediately prior to the fragment no longer being associated with its activity.
196 // */
197 // }
198 }