Commit b31a17f2 authored by mail@toni-fetzer.de's avatar mail@toni-fetzer.de
Browse files

added a function to pause the plot.

fixed another ui button: one some phones, the "back" button was not visible
parent 3c4b5050
......@@ -6,8 +6,8 @@ android {
applicationId "de.tonifetzer.sensorrecorder"
minSdkVersion 14
targetSdkVersion 28
versionCode 5
versionName "1.2"
versionCode 6
versionName "1.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
......
......@@ -46,6 +46,8 @@ public class MainActivity extends AppCompatActivity {
private Button gravityButton;
private Button gyroscopeButton;
private Button barometerButton;
private Button orientationButton;
private ToggleButton pausePlotButton;
private SimpleXYSeries xBuffer;
private SimpleXYSeries yBuffer;
......@@ -88,6 +90,8 @@ public class MainActivity extends AppCompatActivity {
gravityButton = plotView.findViewById(R.id.buttonGravity);
gyroscopeButton = plotView.findViewById(R.id.buttonGyro);
barometerButton = plotView.findViewById(R.id.buttonBarometer);
orientationButton = plotView.findViewById(R.id.buttonOrientation);
pausePlotButton = plotView.findViewById(R.id.buttonPausePlotting);
//init the plotter data
xBuffer = new SimpleXYSeries("x");
......@@ -202,6 +206,30 @@ public class MainActivity extends AppCompatActivity {
}
});
orientationButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
cleanPlotterData();
currentSensorToPlot = SensorType.ORIENTATION_NEW;
plotClass.setTitle("Orientation Data");
}
});
pausePlotButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(isChecked){
pausePlotButton.setTextOn("Resume Plot");
redrawer.pause();
}
else{
pausePlotButton.setTextOn("Pause Plot");
redrawer.start();
}
}
});
}
private void startRecording() {
......
......@@ -4,74 +4,121 @@
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#333"
android:weightSum="2"
xmlns:ap="http://schemas.android.com/apk/res-auto">
<com.androidplot.xy.XYPlot
style="@style/APDefacto.Dark"
android:id="@+id/plot"
style="@style/APDefacto.Dark"
android:layout_width="fill_parent"
android:layout_height="400dp"
ap:title="Accelerometer Data"
ap:rangeTitle="range"
android:layout_height="wrap_content"
android:layout_weight="1"
ap:domainTitle="size"
ap:lineLabelRotationBottom="-45"
ap:lineLabels="left|bottom"
ap:lineLabelRotationBottom="-45"/>
ap:rangeTitle="range"
ap:title="Accelerometer Data" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="@+id/buttonAcc"
android:layout_width="120dp"
android:layout_height="36dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:text="Accelerometer" />
<Button
android:id="@+id/buttonLinearAcc"
android:layout_width="120dp"
android:layout_height="36dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:text="Linear Acc" />
<Button
android:id="@+id/buttonGravity"
android:layout_width="120dp"
android:layout_height="36dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:text="Gravity" />
<Button
android:id="@+id/buttonGyro"
android:layout_width="120dp"
android:layout_height="36dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:text="Gyroscope" />
<Button
android:id="@+id/buttonBarometer"
android:layout_width="120dp"
android:layout_height="36dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:text="Barometer" />
<Button
android:id="@+id/buttonBack"
android:layout_width="120dp"
android:layout_height="36dp"
android:layout_marginLeft="250dp"
android:layout_marginTop="10dp"
android:text="Back" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="@+id/buttonAcc"
android:layout_width="120dp"
android:layout_height="36dp"
android:layout_marginLeft="5dp"
android:text="Accelerometer" />
<Button
android:id="@+id/buttonLinearAcc"
android:layout_width="120dp"
android:layout_height="36dp"
android:layout_marginLeft="5dp"
android:text="Linear Acc" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="@+id/buttonGravity"
android:layout_width="120dp"
android:layout_height="36dp"
android:layout_marginLeft="5dp"
android:text="Gravity" />
<Button
android:id="@+id/buttonGyro"
android:layout_width="120dp"
android:layout_height="36dp"
android:layout_marginLeft="5dp"
android:text="Gyroscope" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="@+id/buttonBarometer"
android:layout_width="120dp"
android:layout_height="36dp"
android:layout_marginLeft="5dp"
android:text="Barometer" />
<Button
android:id="@+id/buttonOrientation"
android:layout_width="120dp"
android:layout_height="36dp"
android:layout_marginLeft="5dp"
android:text="Orientation" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="@+id/buttonBack"
android:layout_width="120dp"
android:layout_height="36dp"
android:layout_marginLeft="5dp"
android:text="Back" />
<ToggleButton
android:id="@+id/buttonPausePlotting"
android:layout_width="120dp"
android:layout_height="36dp"
android:layout_marginLeft="5dp"
android:textOff="Pause Plot"
android:textOn="Resume Plot" />
</LinearLayout>
</LinearLayout>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment