Changeset 1806
- Timestamp:
- 10/24/14 13:15:06 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-androidmonitor/src/de/ugoe/cs/autoquest/androidmonitor/Androidmonitor.java
r1756 r1806 1 1 package de.ugoe.cs.autoquest.androidmonitor; 2 2 3 import java.io.File;4 import java.io.FileOutputStream;5 import java.io.StringWriter;6 3 import java.lang.reflect.Field; 7 8 import org.xmlpull.v1.XmlSerializer;9 4 10 5 import de.ugoe.cs.autoquest.androidmonitor.AndroidmonitorCompositeOnClickListener; … … 15 10 import android.content.pm.PackageManager.NameNotFoundException; 16 11 import android.os.Build; 12 import android.text.Editable; 13 import android.text.TextWatcher; 17 14 import android.util.Log; 18 import android.util.Xml;19 15 import android.view.View; 20 16 import android.view.ViewGroup; 17 import android.widget.EditText; 18 import android.widget.TextView; 21 19 22 20 public class Androidmonitor { … … 47 45 logFile = new AndroidmonitorLogFile(getAppLable(activity), 48 46 activity.getFilesDir()); 47 48 //Log.i("info", "start main Activity" + activity.getPackageName()); 49 49 50 50 addLogListenerToView(getRootView(activity)); 51 51 52 // tbd53 // listen to changes and update o wn listener52 // TODO 53 // listen to changes and update on listener 54 54 // find out if it is possible to directly call addLogListenerToView 55 55 // again 56 56 // activity.onContentChanged(); 57 57 58 //TODO 58 59 // write backPresss as event to xml file 59 60 // activity.onBackPressed(); 60 61 62 //TODO 61 63 // handle onStop() method of the activity 62 64 // add a function that end up tracking if onStop() is given otherwise … … 133 135 134 136 // save original listener to add it later on to the groupLisatener 135 View.OnClickListener listener = getOnClickListener(view);136 137 if ( listener != null) {137 View.OnClickListener onClicklistener = getOnClickListener(view); 138 139 if (onClicklistener != null) { 138 140 // create new compositeOnClickListener to handle multiple listeners 139 141 // for one view … … 145 147 groupListener.addOnClickListener(new View.OnClickListener() { 146 148 public void onClick(View v) { 147 148 149 logFile.addEvent(v, "onClick"); 149 150 // track information ...151 // Log.d("MyLog",152 // "activity:" + activityName + " id:" + v.getId()153 // + " element:"154 // + v.getClass().getSimpleName() + " x:" + v.getX() + " y:"155 // + v.getY() + " time:"156 // + System.currentTimeMillis());157 158 150 } 159 151 }); 160 152 // add original onClick listener to groupListener of the view 161 groupListener.addOnClickListener(listener); 162 } 153 groupListener.addOnClickListener(onClicklistener); 154 } 155 // if view is a TextView add a addTextChangedListener to this view 156 // EditText extends TextView 157 if (view instanceof EditText) { 158 159 TextView textView = (TextView)view; 160 textView.addTextChangedListener(new TextWatcher(){ 161 162 @Override 163 public void beforeTextChanged(CharSequence s, int start, 164 int count, int after) { 165 // do nothing 166 } 167 168 @Override 169 public void onTextChanged(CharSequence s, int start, 170 int before, int count) { 171 // do nothing 172 } 173 174 @Override 175 public void afterTextChanged(Editable s) { 176 // TODO logText 177 Log.i("type: ", "stostring: " + s.toString()); 178 179 } 180 181 }); 182 Log.i("type: ", view.hashCode() + " is EditText"); 183 } 184 163 185 } 164 186
Note: See TracChangeset
for help on using the changeset viewer.