package com.barvoy.sensorama;

import android.app.Activity;
import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import java.util.Timer;
import java.util.TimerTask;


import com.barvoy.sensorama.Sensorama;
import com.barvoy.sensorama.SRDataPoint;

public class MainActivity extends Activity {

    public Sensorama S;
    public int sampleNumber;

    @Override
    public final void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        S = new Sensorama(this);

        Timer timer = new Timer();
        timer.scheduleAtFixedRate(new TimerTask() {
            @Override
            public void run() {
                System.out.printf("en:%d %d", S.isEnabled() ? 1 : 0, sampleNumber);
                System.out.println("");
                if (S.isEnabled()) {
                    S.capture();
                }
                sampleNumber++;
            }
        }, 0, 1000);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    public void recordingStartEnd(View view) {
        // Do something in response to button
        Button buttonStartEnd = (Button) findViewById(view.getId());

        String textCurrent = buttonStartEnd.getText().toString();

        String textStart = "Start recording";
        if (textCurrent.equals(textStart)) {
            buttonStartEnd.setText("Stop recording");
            S.enable(true);
            System.out.println("Started");
        } else {
            buttonStartEnd.setText(textStart);
            S.enable(false);
            System.out.println("Stopped");
        }
    }

    public void recordingShare(View view) {
        // Do something in response to button
        System.out.println("recordingShare");
        S.dumpPoints();
    }
}

@@ -271,16 +271,107 @@
 Button;%0A
+import android.widget.TextView;%0A%0Aimport java.text.SimpleDateFormat;%0Aimport java.util.Date;%0A
 import j
@@ -794,24 +794,76 @@
 ama(this);%0A%0A
+        sampleUpdateDate(sampleDateFmt() + %22...%22);%0A%0A
         Time
@@ -2448,24 +2448,71 @@
 %22Started%22);%0A
+            sampleUpdateDate(sampleDateFmt());%0A
         %7D el
@@ -2647,15 +2647,587 @@
     
-%7D%0A    %7D
+    sampleUpdateDate(getSampleDate() + %22-%22 + sampleDateFmt());%0A        %7D%0A    %7D%0A%0A    public String sampleDateFmt() %7B%0A        SimpleDateFormat sdf = new SimpleDateFormat(%22yyyy-MM-dd-HH.mm%22);%0A        return sdf.format(new Date());%0A    %7D%0A%0A    public String getSampleDate() %7B%0A        TextView userDate = (TextView)findViewById(R.id.userDate);%0A        return userDate.getText().toString();%0A    %7D%0A%0A    public void sampleUpdateDate(String str) %7B%0A        // Set the date of the start%0A        TextView userDate = (TextView)findViewById(R.id.userDate);%0A        userDate.setText(str);%0A    %7D%0A
 %0A%0A  
@@ -3338,18 +3338,17 @@
 ut.print
-ln
+f
 (%22record
@@ -3355,20 +3355,44 @@
 ingShare
-%22
+: %25s%5Cn%22, getSampleDate()
 );%0A
+%0A
         

Bring simple sample naming. FROM-TO