App
RasterLayerSettingsFragment.java
Go to the documentation of this file.
1 package mhr.app.fragments.layers;
2 
3 import mhr.app.AppMainActivity;
4 import mhr.app.R;
5 import mhr.appandroid.adapters.APDImagePresentation;
6 
7 import mhr.appcore.blending.BlendMode;
8 
9 import mhr.appcore.image.layers.LayerSpecificPresentation;
10 import mhr.appcore.image.layers.RasterLayerSpecificPresentation;
11 
12 import android.app.Activity;
13 import android.app.Fragment;
14 import android.os.Bundle;
15 import android.view.LayoutInflater;
16 import android.view.View;
17 import android.view.View.OnClickListener;
18 import android.view.ViewGroup;
19 import android.widget.ArrayAdapter;
20 import android.widget.Button;
21 import android.widget.Spinner;
22 
26 public class RasterLayerSettingsFragment extends LayerSettingsFragment implements OnClickListener {
27 
28 
29  //===== INTERFACES, CLASSES, ENUMS ==========================================================================================================//
30  //----- NON-PUBLIC --------------------------------------------------------------------------------------------------------------------------//
31  //----- PUBLIC ------------------------------------------------------------------------------------------------------------------------------//
32 
33  //===== FIELDS ==============================================================================================================================//
34  //----- NON-PUBLIC --------------------------------------------------------------------------------------------------------------------------//
35  protected Spinner blendModeSp;
36 
37  //----- PUBLIC ------------------------------------------------------------------------------------------------------------------------------//
38 
39  //===== CONSTRUCTORS, DESTRUCTORS, RELATED METHODS ==========================================================================================//
40  //----- NON-PUBLIC --------------------------------------------------------------------------------------------------------------------------//
41  @Override
42  protected View initView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
43  root = inflater.inflate(R.layout.fragment_raster_layer_settings, container, false);
44  blendModeSp = (Spinner) root.findViewById(R.id.RasterLayerBlendModeSp);
45  ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(activity, R.array.BlendModeNames, android.R.layout.simple_spinner_item);
46  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
47  blendModeSp.setAdapter(adapter);
48  return root;
49  }
50  //----- PUBLIC ------------------------------------------------------------------------------------------------------------------------------//
51 
52  //===== METHODS =============================================================================================================================//
53  //----- NON-PUBLIC --------------------------------------------------------------------------------------------------------------------------//
54 
55  @Override
57  blendModeSp.setSelection(((RasterLayerSpecificPresentation) pres).mode.getValue());
58  }
59 
60  @Override
62  ((RasterLayerSpecificPresentation) pres).mode = BlendMode.fromValue(blendModeSp.getSelectedItemPosition());
63  }
64 
65  //----- PUBLIC ------------------------------------------------------------------------------------------------------------------------------//
66 
67  //===== CALLBACKS ===========================================================================================================================//
68  @Override
69  public void onClick(View v) {
70  switch (v.getId()) {
71  default:
72  super.onClick(v);
73  break;
74  }
75  }
76 
77  //----- LIFE CYCLE --------------------------------------------------------------------------------------------------------------------------//
78 
79  // @Override
80  // public void onAttach(Activity activity) {
81  // super.onAttach(activity);
82  // /*
83  // * called once the fragment is associated with its activity.
84  // */
85  // }
86 
87  // @Override
88  // public void onCreate(Bundle savedInstanceState) {
89  // super.onCreate(savedInstanceState);
90  // /*
91  // * called to do initial creation of the fragment.
92  // *
93  // * The system calls this when creating the fragment. Within your implementation, you should initialize essential components of the fragment that you want
94  // * to retain when the fragment is paused or stopped, then resumed.
95  // */
96  // }
97 
98  // @Override
99  // public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
100  // return super.onCreateView(inflater, container, savedInstanceState);
101  // /*
102  // * creates and returns the view hierarchy associated with the fragment.
103  // *
104  // * 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
105  // * 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.
106  // *
107  // * Zde začíná životní cyklus při návratu z backstacku
108  // */
109  // }
110 
111  // @Override
112  // public void onActivityCreated(Bundle savedInstanceState) {
113  // super.onActivityCreated(savedInstanceState);
114  // /*
115  // * tells the fragment that its activity has completed its own Activity.onCreate().
116  // */
117  // }
118 
119  // @Override // Vyžaduje API 17
120  // public void onViewStateRestored(Bundle savedInstanceState) {
121  // super.onViewStateRestored(savedInstanceState);
122  // /*
123  // * tells the fragment that all of the saved state of its view hierarchy has been restored.
124  // */
125  // }
126 
127  // @Override
128  // public void onStart() {
129  // super.onStart();
130  // /*
131  // * makes the fragment visible to the user (based on its containing activity being started).
132  // */
133  // }
134  //
135  // @Override
136  // public void onResume() {
137  // super.onResume();
138  // /*
139  // * makes the fragment interacting with the user (based on its containing activity being resumed).
140  // */
141  // }
142 
143  // @Override
144  // public void onPause() {
145  // super.onPause();
146  // /*
147  // * 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.
148  // *
149  // * 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).
150  // * 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).
151  // */
152  // }
153 
154  // @Override
155  // public void onStop() {
156  // super.onStop();
157  // /*
158  // * 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.
159  // */
160  // }
161 
162  // @Override
163  // public void onDestroyView() {
164  // super.onDestroyView();
165  // /*
166  // * allows the fragment to clean up resources associated with its View.
167  // *
168  // * Zde končí životní cyklus při umístění do backstacku
169  // */
170  // }
171 
172  // @Override
173  // public void onDestroy() {
174  // super.onDestroy();
175  // /*
176  // * called to do final cleanup of the fragment's state.
177  // */
178  // }
179 
180  // @Override
181  // public void onDetach() {
182  // super.onDetach();
183  // /*
184  // * called immediately prior to the fragment no longer being associated with its activity.
185  // */
186  // }
187 }