Mercurial > hg > ccmiandroid
comparison src/uk/ac/qmul/eecs/ccmi/accessibility/LayoutSonifier.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 |
---|---|
16 You should have received a copy of the GNU General Public License | 16 You should have received a copy of the GNU General Public License |
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.utilities.ILogger; | |
21 import android.view.MotionEvent; | 22 import android.view.MotionEvent; |
22 import android.view.View; | 23 import android.view.View; |
23 import android.view.ViewGroup; | 24 import android.view.ViewGroup; |
24 import android.widget.Spinner; | 25 import android.widget.Spinner; |
25 import android.widget.TextView; | 26 import android.widget.TextView; |
102 return; | 103 return; |
103 if(v instanceof TextView ){ | 104 if(v instanceof TextView ){ |
104 accessibilityService.vibrate(); | 105 accessibilityService.vibrate(); |
105 CharSequence contentDescription = v.getContentDescription(); | 106 CharSequence contentDescription = v.getContentDescription(); |
106 /* if the view has accessibility content description set, use it */ | 107 /* if the view has accessibility content description set, use it */ |
107 if(contentDescription != null ) | 108 if(contentDescription != null ){ |
108 accessibilityService.speak(contentDescription.toString() + | 109 accessibilityService.speak(contentDescription.toString() + |
109 ((v instanceof TextView) ? ((TextView)v).getText() : "") ); | 110 ((v instanceof TextView) ? ((TextView)v).getText() : "") ); |
110 else | 111 ILogger.logHover(contentDescription.toString()); |
112 }else{ | |
111 accessibilityService.speak(((TextView)v).getText().toString()); | 113 accessibilityService.speak(((TextView)v).getText().toString()); |
114 ILogger.logHover(((TextView)v).getText().toString()); | |
115 } | |
112 }else if(v instanceof AccessibleCheckbox){ | 116 }else if(v instanceof AccessibleCheckbox){ |
113 AccessibleCheckbox ab = (AccessibleCheckbox)v; | 117 AccessibleCheckbox ab = (AccessibleCheckbox)v; |
114 boolean isChecked = ab.getChecks()[ab.getSelectedValuePosition()]; | 118 boolean isChecked = ab.getChecks()[ab.getSelectedValuePosition()]; |
115 accessibilityService.vibrate(); | 119 accessibilityService.vibrate(); |
116 accessibilityService.speak(ab.getSelectedValue()+ (isChecked ? ", checked" : ", unchecked")); | 120 accessibilityService.speak(ab.getSelectedValue()+ (isChecked ? ", checked" : ", unchecked")); |
121 ILogger.logHover("check box"); | |
117 }else if (v instanceof Spinner){ | 122 }else if (v instanceof Spinner){ |
118 accessibilityService.vibrate(); | 123 accessibilityService.vibrate(); |
119 accessibilityService.speak(v.getContentDescription()+" "+((Spinner)v).getSelectedItem()); | 124 accessibilityService.speak(v.getContentDescription()+" "+((Spinner)v).getSelectedItem()); |
125 ILogger.logHover("spinner"); | |
120 } | 126 } |
121 } | 127 } |
122 | 128 |
123 private static View findView(ViewGroup viewGroup, float x, float y, float offsetX, float offsetY){ | 129 private static View findView(ViewGroup viewGroup, float x, float y, float offsetX, float offsetY){ |
124 x-= offsetX; | 130 x-= offsetX; |