Changeset 1882 for trunk/autoquest-androidmonitor
- Timestamp:
- 02/25/15 12:53:12 (10 years ago)
- Location:
- trunk/autoquest-androidmonitor/src/main/java/de/ugoe/cs/autoquest/androidmonitor
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-androidmonitor/src/main/java/de/ugoe/cs/autoquest/androidmonitor/AndroidMonitor.java
r1871 r1882 54 54 55 55 /** 56 * <p> 57 * Represents the position of the current view element in the tree structure of an activity. 58 * </p> 59 */ 60 private int elementPosition = 0; 61 62 /** 56 63 * Constructor method to get a monitor object. 57 64 * … … 118 125 */ 119 126 private View findFirstView(View view) { 127 elementPosition = 0; 120 128 if (view.getParent() != null && (view.getParent() instanceof ViewGroup)) { 121 129 return findFirstView((View) view.getParent()); … … 149 157 150 158 if (!AndroidMonitorLogFile.isComponentLogged(view.hashCode())) { 151 AndroidMonitor.logFile.addComponent(view, parentHash, activityName );152 153 Log.i("object type", "");159 AndroidMonitor.logFile.addComponent(view, parentHash, activityName, getElementPosition()); 160 161 // Log.i("object type", ""); 154 162 155 163 // save original listener to add it later on to the groupLisatener … … 167 175 groupListener.addOnClickListener(new View.OnClickListener() { 168 176 public void onClick(View v) { 169 170 177 AndroidMonitor.logFile.addEvent(v, "onClick"); 171 178 // check if something changed in the activity … … 202 209 parentHash = view.hashCode(); 203 210 // traverse all views of the activity 204 if (view instanceof ViewGroup) { 211 if (view instanceof ViewGroup) { 205 212 ViewGroup group = (ViewGroup) view; 206 for (int i = 0; i < group.getChildCount(); i++) { 213 for (int i = 0; i < group.getChildCount(); i++) { 207 214 View child = group.getChildAt(i); 208 215 addLogListenerToView(child, parentHash); … … 299 306 return logFile; 300 307 } 308 309 private int getElementPosition(){ 310 int element = elementPosition; 311 elementPosition ++; 312 return element; 313 } 301 314 } -
trunk/autoquest-androidmonitor/src/main/java/de/ugoe/cs/autoquest/androidmonitor/AndroidMonitorLogFile.java
r1871 r1882 260 260 * name of the activity that is analyzed 261 261 */ 262 public void addComponent(View view, int parentHash, String activityName ) {262 public void addComponent(View view, int parentHash, String activityName, int position) { 263 263 XmlSerializer serializer = Xml.newSerializer(); 264 264 StringWriter writer = new StringWriter(); … … 290 290 serializer.attribute("", "value", "" + view.getId()); 291 291 serializer.endTag("", "param"); 292 293 serializer.startTag("", "param"); 294 serializer.attribute("", "name", "position"); 295 serializer.attribute("", "value", "" + position); 296 serializer.endTag("", "param"); 292 297 293 298 if (view instanceof TextView) {
Note: See TracChangeset
for help on using the changeset viewer.