comparison src/uk/ac/qmul/eecs/ccmi/accessibility/AccessibleDialogBuilder.java @ 1:66b3a838feca logging tip

Added logging of user interaction
author Fiore Martin <fiore@eecs.qmul.ac.uk>
date Tue, 12 Feb 2013 15:31:48 +0000
parents e0ee6ac3a45f
children
comparison
equal deleted inserted replaced
0:e0ee6ac3a45f 1:66b3a838feca
18 */ 18 */
19 package uk.ac.qmul.eecs.ccmi.accessibility; 19 package uk.ac.qmul.eecs.ccmi.accessibility;
20 20
21 import uk.ac.qmul.eecs.ccmi.accessibility.AccessibilityService.SoundEvent; 21 import uk.ac.qmul.eecs.ccmi.accessibility.AccessibilityService.SoundEvent;
22 import uk.ac.qmul.eecs.ccmi.activities.R; 22 import uk.ac.qmul.eecs.ccmi.activities.R;
23 import uk.ac.qmul.eecs.ccmi.utilities.ILogger;
23 import android.app.AlertDialog; 24 import android.app.AlertDialog;
24 import android.app.Dialog; 25 import android.app.Dialog;
25 import android.content.Context; 26 import android.content.Context;
26 import android.content.DialogInterface; 27 import android.content.DialogInterface;
27 import android.os.Bundle; 28 import android.os.Bundle;
81 /* args to be used in onCreateDialog by the dialog fragment */ 82 /* args to be used in onCreateDialog by the dialog fragment */
82 Bundle args = new Bundle(); 83 Bundle args = new Bundle();
83 args.putInt("dialogType", type); 84 args.putInt("dialogType", type);
84 args.putString("tag", tag); 85 args.putString("tag", tag);
85 accessibleDialogFragment.setArguments(args); 86 accessibleDialogFragment.setArguments(args);
87
88 ILogger.logDialog(tag);
86 /* show the dialog */ 89 /* show the dialog */
87 accessibleDialogFragment.show(fragmentManager,tag); 90 accessibleDialogFragment.show(fragmentManager,tag);
88 } 91 }
89 92
90 /** 93 /**
108 args.putInt("dialogType", R.layout.text_dialog); 111 args.putInt("dialogType", R.layout.text_dialog);
109 args.putString("tag", tag); 112 args.putString("tag", tag);
110 if(text != null) 113 if(text != null)
111 args.putString("text", text); 114 args.putString("text", text);
112 accessibleDialogFragment.setArguments(args); 115 accessibleDialogFragment.setArguments(args);
116
117 ILogger.logDialog(tag);
113 /* show the dialog */ 118 /* show the dialog */
114 accessibleDialogFragment.show(fragmentManager,tag); 119 accessibleDialogFragment.show(fragmentManager,tag);
115 } 120 }
116 121
117 /** 122 /**
134 /* args to be used in onCreateDialog by the dialog fragment */ 139 /* args to be used in onCreateDialog by the dialog fragment */
135 Bundle args = new Bundle(); 140 Bundle args = new Bundle();
136 args.putInt("dialogType", R.layout.selection_dialog); 141 args.putInt("dialogType", R.layout.selection_dialog);
137 args.putString("tag", tag); 142 args.putString("tag", tag);
138 accessibleDialogFragment.setArguments(args); 143 accessibleDialogFragment.setArguments(args);
144
145 ILogger.logDialog(tag);
139 /* show the dialog */ 146 /* show the dialog */
140 accessibleDialogFragment.show(fragmentManager,tag); 147 accessibleDialogFragment.show(fragmentManager,tag);
141 } 148 }
142 149
143 /** 150 /**
163 /* args to be used in onCreateDialog by the dialog fragment */ 170 /* args to be used in onCreateDialog by the dialog fragment */
164 Bundle args = new Bundle(); 171 Bundle args = new Bundle();
165 args.putInt("dialogType", R.layout.checkbox_dialog); 172 args.putInt("dialogType", R.layout.checkbox_dialog);
166 args.putString("tag", tag); 173 args.putString("tag", tag);
167 accessibleDialogFragment.setArguments(args); 174 accessibleDialogFragment.setArguments(args);
175
176 ILogger.logDialog(tag);
168 /* show the dialog */ 177 /* show the dialog */
169 accessibleDialogFragment.show(fragmentManager,tag); 178 accessibleDialogFragment.show(fragmentManager,tag);
170 } 179 }
171 180
172 public static class AccessibleDialogFragment extends DialogFragment { 181 public static class AccessibleDialogFragment extends DialogFragment {
259 @Override 268 @Override
260 public boolean dispatchTouchEvent(MotionEvent evt){ 269 public boolean dispatchTouchEvent(MotionEvent evt){
261 LayoutSonifier.getInstance().onTouch(layout, evt, accessibilityService); 270 LayoutSonifier.getInstance().onTouch(layout, evt, accessibilityService);
262 return super.dispatchTouchEvent(evt); 271 return super.dispatchTouchEvent(evt);
263 } 272 }
273
274 @Override
275 public void onBackPressed(){
276 super.onBackPressed();
277 ILogger.logTap("back (cancel)");
278 }
264 } 279 }
265 280
266 } 281 }