App
PointOperationToolSettingsFragment.java
Go to the documentation of this file.
1 package mhr.app.fragments.toolbox;
2 
3 import mhr.app.AppMainActivity;
4 import mhr.app.R;
5 import mhr.app.fragments.toolbox.pointops.BrightnessPopUpFragment;
6 import mhr.app.fragments.toolbox.pointops.ContrastPopUpFragment;
7 import mhr.app.fragments.toolbox.pointops.CurvesPopUpFragment;
8 import mhr.app.fragments.toolbox.pointops.GammaPopUpFragment;
9 import mhr.appandroid.displayer.DisplayerTouchNavigator;
10 import android.app.Activity;
11 import android.app.Fragment;
12 import android.os.Bundle;
13 import android.view.LayoutInflater;
14 import android.view.View;
15 import android.view.View.OnClickListener;
16 import android.view.ViewGroup;
17 import android.widget.Button;
18 
22 public class PointOperationToolSettingsFragment extends Fragment implements OnClickListener {
23 
24  //===== INTERFACES, CLASSES, ENUMS ==========================================================================================================//
25  //----- NON-PUBLIC --------------------------------------------------------------------------------------------------------------------------//
26  //----- PUBLIC ------------------------------------------------------------------------------------------------------------------------------//
27 
28  //===== FIELDS ==============================================================================================================================//
29  //----- NON-PUBLIC --------------------------------------------------------------------------------------------------------------------------//
30  protected View root;
32  protected boolean firstCreated = true;
33 
34  protected DisplayerTouchNavigator navig = null;
35 
36  protected Button brightnessBtn;
37  protected Button contrastBtn;
38  protected Button gammaBtn;
39  protected Button curvesBtn;
40 
41  //----- PUBLIC ------------------------------------------------------------------------------------------------------------------------------//
42 
43  //===== CONSTRUCTORS, DESTRUCTORS, RELATED METHODS ==========================================================================================//
44  //----- NON-PUBLIC --------------------------------------------------------------------------------------------------------------------------//
52  protected View initView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
53  root = inflater.inflate(R.layout.fragment_point_operation_tool_settings, container, false);
54 
55  brightnessBtn= (Button) root.findViewById(R.id.PointOperationToolBrightnessBtn);
56  contrastBtn= (Button) root.findViewById(R.id.PointOperationToolContrastBtn);
57  gammaBtn= (Button) root.findViewById(R.id.PointOperationToolGammaBtn);
58  curvesBtn= (Button) root.findViewById(R.id.PointOperationToolCurvesBtn);
59 
60  brightnessBtn.setOnClickListener(this);
61  contrastBtn.setOnClickListener(this);
62  gammaBtn.setOnClickListener(this);
63  curvesBtn.setOnClickListener(this);
64 
65  firstCreated = false;
66 
67  return root;
68  }
69 
70  //----- PUBLIC ------------------------------------------------------------------------------------------------------------------------------//
71 
72  //===== METHODS =============================================================================================================================//
73  //----- NON-PUBLIC --------------------------------------------------------------------------------------------------------------------------//
74 
75  //----- PUBLIC ------------------------------------------------------------------------------------------------------------------------------//
76 
77  //===== CALLBACKS ===========================================================================================================================//
78  @Override
79  public void onClick(View v) {
80  int id = v.getId();
81  switch (id) {
82  case R.id.PointOperationToolBrightnessBtn:
84  break;
85  case R.id.PointOperationToolContrastBtn:
87  break;
88  case R.id.PointOperationToolGammaBtn:
90  break;
91  case R.id.PointOperationToolCurvesBtn:
93  break;
94  }
95 
96  }
97 
98  //----- LIFE CYCLE --------------------------------------------------------------------------------------------------------------------------//
99 
100  @Override
101  public void onAttach(Activity activity) {
102  super.onAttach(activity);
103  /*
104  * called once the fragment is associated with its activity.
105  */
106  this.activity = (AppMainActivity) activity;
107  if (navig == null) { // instance bude cachovana
108  navig = new DisplayerTouchNavigator(this.activity.getBitmapDisplayer(), this.activity);
109  }
110  }
111 
112  // @Override
113  // public void onCreate(Bundle savedInstanceState) {
114  // super.onCreate(savedInstanceState);
115  // /*
116  // * called to do initial creation of the fragment.
117  // *
118  // * The system calls this when creating the fragment. Within your implementation, you should initialize essential components of the fragment that you want
119  // * to retain when the fragment is paused or stopped, then resumed.
120  // */
121  // }
122 
123  @Override
124  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
125  /*
126  * creates and returns the view hierarchy associated with the fragment.
127  *
128  * 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
129  * 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.
130  *
131  * Zde začíná životní cyklus při návratu z backstacku
132  */
133  if (firstCreated) {
134  firstCreated = false;
135  return initView(inflater, container, savedInstanceState);
136  } else {
137  return root;
138  }
139  }
140 
141  // @Override
142  // public void onActivityCreated(Bundle savedInstanceState) {
143  // super.onActivityCreated(savedInstanceState);
144  // /*
145  // * tells the fragment that its activity has completed its own Activity.onCreate().
146  // */
147  // }
148 
149  // @Override // Vyžaduje API 17
150  // public void onViewStateRestored(Bundle savedInstanceState) {
151  // super.onViewStateRestored(savedInstanceState);
152  // /*
153  // * tells the fragment that all of the saved state of its view hierarchy has been restored.
154  // */
155  // }
156 
157  // @Override
158  // public void onStart() {
159  // super.onStart();
160  // /*
161  // * makes the fragment visible to the user (based on its containing activity being started).
162  // */
163  // }
164 
165  @Override
166  public void onResume() {
167  super.onResume();
168  /*
169  * makes the fragment interacting with the user (based on its containing activity being resumed).
170  */
172  }
173 
174  @Override
175  public void onPause() {
176  super.onPause();
177  /*
178  * 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.
179  *
180  * 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).
181  * 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).
182  */
184  }
185 
186  // @Override
187  // public void onStop() {
188  // super.onStop();
189  // /*
190  // * 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.
191  // */
192  // }
193 
194  // @Override
195  // public void onDestroyView() {
196  // super.onDestroyView();
197  // /*
198  // * allows the fragment to clean up resources associated with its View.
199  // *
200  // * Zde končí životní cyklus při umístění do backstacku
201  // */
202  // }
203 
204  // @Override
205  // public void onDestroy() {
206  // super.onDestroy();
207  // /*
208  // * called to do final cleanup of the fragment's state.
209  // */
210  // }
211 
212  // @Override
213  // public void onDetach() {
214  // super.onDetach();
215  // /*
216  // * called immediately prior to the fragment no longer being associated with its activity.
217  // */
218  // }
219 }