App
DebugToolSettingsFragment.java
Go to the documentation of this file.
1 package mhr.app.debug;
2 
3 import mhr.app.AppMainActivity;
4 import mhr.app.R;
5 import mhr.appcore.commands.imagecommands.ApplyUndoPatchCommand;
6 import mhr.appcore.commands.imagecommands.MergeAllCommand;
7 import android.app.Activity;
8 import android.app.Fragment;
9 import android.os.Bundle;
10 import android.view.LayoutInflater;
11 import android.view.View;
12 import android.view.View.OnClickListener;
13 import android.view.ViewGroup;
14 import android.widget.Toast;
15 
16 public class DebugToolSettingsFragment extends Fragment implements OnClickListener {
17 
18  //===================================================================================================================================================//
19  //===== PUBLIC ==============================================================================================================================//
20  //----- interface a třídy -------------------------------------------------------------------------------------------------------------------//
21  //----- pole --------------------------------------------------------------------------------------------------------------------------------//
22  //----- acesory a primitivní metody ---------------------------------------------------------------------------------------------------------//
23  //----- konstruktory ------------------------------------------------------------------------------------------------------------------------//
24  //----- destruktory -------------------------------------------------------------------------------------------------------------------------//
25  //----- metody ------------------------------------------------------------------------------------------------------------------------------//
26 
27  //===================================================================================================================================================//
28  //===== LIFE CYCLE ==========================================================================================================================//
29 
30  @Override
31  public void onAttach(Activity activity) {
32  super.onAttach(activity);
33  /*
34  * called once the fragment is associated with its activity.
35  */
36  }
37 
38  @Override
39  public void onCreate(Bundle savedInstanceState) {
40  super.onCreate(savedInstanceState);
41  /*
42  * called to do initial creation of the fragment.
43  *
44  * The system calls this when creating the fragment. Within your implementation, you should initialize essential components of the fragment that you want
45  * to retain when the fragment is paused or stopped, then resumed.
46  */
47  }
48 
49  @Override
50  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
51 // return super.onCreateView(inflater, container, savedInstanceState);
52  /*
53  * creates and returns the view hierarchy associated with the fragment.
54  *
55  * 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
56  * 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.
57  */
58  View v = inflater.inflate(R.layout.fragment_debug_tool_settings, container, false);
59  root = v;
60  return v;
61  }
62 
63  @Override
64  public void onActivityCreated(Bundle savedInstanceState) {
65  super.onActivityCreated(savedInstanceState);
66  /*
67  * tells the fragment that its activity has completed its own Activity.onCreate().
68  */
69  activity = (AppMainActivity) getActivity();
70  root.findViewById(R.id.DebugToolShowDialogBtn).setOnClickListener(this);
71  root.findViewById(R.id.DebugToolRenderAllBtn).setOnClickListener(this);
72  root.findViewById(R.id.DebugToolTryExceptionFeedbackBtn).setOnClickListener(this);
73  root.findViewById(R.id.DebugToolUndoBtn).setOnClickListener(this);
74  root.findViewById(R.id.DebugToolMergeAllBtn).setOnClickListener(this);
75  }
76 
77  //@Override // Vyžaduje API 17
78  //public void onViewStateRestored(Bundle savedInstanceState) {
79  // super.onViewStateRestored(savedInstanceState);
80  // /*
81  // * tells the fragment that all of the saved state of its view hierarchy has been restored.
82  // */
83  //}
84 
85  @Override
86  public void onStart() {
87  super.onStart();
88  /*
89  * makes the fragment visible to the user (based on its containing activity being started).
90  */
91  }
92 
93  @Override
94  public void onResume() {
95  super.onResume();
96  /*
97  * makes the fragment interacting with the user (based on its containing activity being resumed).
98  */
99  }
100 
101  @Override
102  public void onPause() {
103  super.onPause();
104  /*
105  * 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.
106  *
107  * 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).
108  * 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).
109  */
110  }
111 
112  @Override
113  public void onStop() {
114  super.onStop();
115  /*
116  * 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.
117  */
118  }
119 
120  @Override
121  public void onDestroyView() {
122  super.onDestroyView();
123  /*
124  * allows the fragment to clean up resources associated with its View.
125  */
126  }
127 
128  @Override
129  public void onDestroy() {
130  super.onDestroy();
131  /*
132  * called to do final cleanup of the fragment's state.
133  */
134  }
135 
136  @Override
137  public void onDetach() {
138  super.onDetach();
139  /*
140  * called immediately prior to the fragment no longer being associated with its activity.
141  */
142  }
143 
144  public void onClick(View v) {
145  int id = v.getId();
146  switch (id) {
147  case R.id.DebugToolShowDialogBtn:
149  break;
150  case R.id.DebugToolRenderAllBtn:
152  break;
153  case R.id.DebugToolTryExceptionFeedbackBtn:
154 // throw new RuntimeException("There is UI test exc");
155  activity.onExceptionFeedback(new RuntimeException("There is exception message"));
156  break;
157  case R.id.DebugToolUndoBtn:
159  break;
160  case R.id.DebugToolMergeAllBtn:
162  default:
163  break;
164  }
165  }
166 
167  //===================================================================================================================================================//
168  //===== NON-PUBLIC ==========================================================================================================================//
169  //----- interface a třídy -------------------------------------------------------------------------------------------------------------------//
170  //----- pole --------------------------------------------------------------------------------------------------------------------------------//
171  protected View root;
173  //----- acesory a primitivní metody ---------------------------------------------------------------------------------------------------------//
174  //----- konstruktory ------------------------------------------------------------------------------------------------------------------------//
175  //----- destruktory -------------------------------------------------------------------------------------------------------------------------//
176  //----- metody ------------------------------------------------------------------------------------------------------------------------------//
177 
178  //===================================================================================================================================================//
179  //===== DEPRECATED ==========================================================================================================================//
180 }