Browse Source

added comments on the functionality of the two activities

Sebastian Vendt 6 years ago
parent
commit
a6f60916bf

+ 7 - 11
app/src/main/java/com/motionlogger/sebastianvendt/motionlogger/MainActivity.java

@@ -18,26 +18,22 @@ import android.widget.TextView;
 import java.util.Iterator;
 import java.util.List;
 
+/*
+Main activity to prepare the collection of sensor data
+- checks permisions to write to the external storage
+- checks if the sensors are available to read
+- links to the activity to start the recording
+- UI for the following settings:
+ */
 
 public class MainActivity extends AppCompatActivity {
     private SensorManager mSensorManager;
     private TextView console;
 
-    private View.OnTouchListener handleTouch = new View.OnTouchListener() {
-
-        public boolean onTouch(View v, MotionEvent event) {
-            int x = (int) event.getX();
-            int y = (int) event.getY();
-            Log.d("TAG", "touched" + x + " " + y + " ");
-            return true;
-        }
-    };
-
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_main);
-        findViewById(android.R.id.content).setOnTouchListener(handleTouch);
         console = (TextView) findViewById(R.id.Console);
         console.setMovementMethod(new ScrollingMovementMethod());
         //Check the availability of the external storage

+ 16 - 2
app/src/main/java/com/motionlogger/sebastianvendt/motionlogger/TouchInterface.java

@@ -13,6 +13,20 @@ import java.io.FileOutputStream;
 import java.io.FileWriter;
 import java.io.IOException;
 
+/*
+The interface for the actual logging of sensor data while the user taps on the screen
+shows the picture of a keyboard, logs the sensor data in all directions from the motion sensor and the gyroscope (maybe neglate one axis)
+into a file with unique filename (year, month, day, time) +  taps in that session
+output will be a column oriented csv file
+ACC-X | ACC-Y | ACC-Z | GYR-X | GYR-Y | GYR-Z | TOUCH (0/1) | LOC-X | LOC-Y
+This allows a postprocessing with matlab to cut the windows of the touch events and also allows for data augmentation later on
+windows of fixed size will be extracted
+-> check how long most touch events last since we have a fixed window size
+shows a heatmap of the touches within the last session, shows a counter
+has a button to end the record, to pause it and to resume it
+
+ */
+
 public class TouchInterface extends AppCompatActivity {
 
     private File recordFolder;
@@ -43,7 +57,7 @@ public class TouchInterface extends AppCompatActivity {
         } catch (IOException e) {
             e.printStackTrace();
         }*/
-
+        //Files storage directory is under Main Storage - Android - Data - com.motionlogger.sebastianvendt.motionlogger - files
         File path = this.getExternalFilesDir(null);
         recordFile = new File(path, "myFile.txt");
         FileOutputStream stream = null;
@@ -54,7 +68,7 @@ public class TouchInterface extends AppCompatActivity {
         }
 
         try {
-            stream.write("texttextext".getBytes());
+            stream.write("test".getBytes());
             stream.close();
         } catch (java.io.IOException e) {
             e.printStackTrace();