comparison src/uk/ac/qmul/eecs/ccmi/accessibility/AccessibleCheckbox.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
17 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 along with this program. If not, see <http://www.gnu.org/licenses/>.
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.activities.R; 21 import uk.ac.qmul.eecs.ccmi.activities.R;
22 import uk.ac.qmul.eecs.ccmi.utilities.ILogger;
22 import android.content.Context; 23 import android.content.Context;
23 import android.util.AttributeSet; 24 import android.util.AttributeSet;
24 import android.view.MotionEvent; 25 import android.view.MotionEvent;
25 import android.view.View; 26 import android.view.View;
26 import android.view.accessibility.AccessibilityEvent; 27 import android.view.accessibility.AccessibilityEvent;
98 99
99 setOnClickListener(new View.OnClickListener(){ 100 setOnClickListener(new View.OnClickListener(){
100 @Override 101 @Override
101 public void onClick(View view) { 102 public void onClick(View view) {
102 spinner.setSelection((spinner.getSelectedItemPosition()+1) % spinner.getCount()); 103 spinner.setSelection((spinner.getSelectedItemPosition()+1) % spinner.getCount());
104 ILogger.logTap("checkbox (new value="+spinner.getSelectedItem().toString()+')');
103 if(service != null){ 105 if(service != null){
104 service.speak(spinner.getSelectedItem().toString()+(checks[spinner.getSelectedItemPosition()] ? " " : " un")+"checked"); 106 service.speak(spinner.getSelectedItem().toString()+(checks[spinner.getSelectedItemPosition()] ? " " : " un")+"checked");
105 } 107 }
106 } 108 }
107 }); 109 });
116 }else{ 118 }else{
117 markedValues[itemPosition] = markedValues[itemPosition].replaceAll("(^<)|(>$)", ""); 119 markedValues[itemPosition] = markedValues[itemPosition].replaceAll("(^<)|(>$)", "");
118 } 120 }
119 if(service != null) 121 if(service != null)
120 service.speak(spinner.getSelectedItem().toString()+(checks[spinner.getSelectedItemPosition()] ? "" : "un")+"checked"); 122 service.speak(spinner.getSelectedItem().toString()+(checks[spinner.getSelectedItemPosition()] ? "" : "un")+"checked");
121 123 ILogger.log("user long tap: spinner");
124 ILogger.log(spinner.getSelectedItem().toString()+' '+(checks[spinner.getSelectedItemPosition()] ? "" : "un")+"checked");
122 spinner.setAdapter(new ArrayAdapter<String>(getContext(),R.layout.list_item_1,markedValues)); 125 spinner.setAdapter(new ArrayAdapter<String>(getContext(),R.layout.list_item_1,markedValues));
123 spinner.setSelection(itemPosition); 126 spinner.setSelection(itemPosition);
124 return true; 127 return true;
125 } 128 }
126 }); 129 });