Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions app/src/main/java/io/pslab/activity/AccelerometerActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,11 @@ public class AccelerometerActivity extends AppCompatActivity {

public boolean recordData = false;
public boolean locationPref;
private boolean checkGpsOnResume = false;
private boolean isRecordingStarted = false;
private boolean isDataRecorded = false;
public GPSLogger gpsLogger;
public CSVLogger accLogger;

private Menu menu;
AccelerometerAdapter adapter;

BottomSheetBehavior bottomSheetBehavior;
GestureDetector gestureDetector;

@BindView(R.id.accel_toolbar)
Toolbar mToolbar;
@BindView(R.id.accel_coordinator_layout)
Expand All @@ -85,6 +78,10 @@ public class AccelerometerActivity extends AppCompatActivity {
ImageView bottomSheetSchematic;
@BindView(R.id.custom_dialog_desc)
TextView bottomSheetDesc;
private boolean checkGpsOnResume = false;
private boolean isRecordingStarted = false;
private boolean isDataRecorded = false;
private Menu menu;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -97,7 +94,7 @@ protected void onCreate(Bundle savedInstanceState) {
tvShadow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(bottomSheetBehavior.getState()==BottomSheetBehavior.STATE_EXPANDED)
if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED)
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
tvShadow.setVisibility(View.GONE);
}
Expand Down Expand Up @@ -131,7 +128,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
return true;
}
if (recordData) {
item.setIcon(R.drawable.record_icon);
item.setIcon(R.drawable.ic_record_white);
adapter.setRecordingStatus(false);
recordData = false;
CustomSnackBar.showSnackBar(coordinatorLayout, getString(R.string.data_recording_paused), null, null);
Expand Down Expand Up @@ -163,7 +160,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
case R.id.record_csv_data:
if (isDataRecorded) {
MenuItem item1 = menu.findItem(R.id.record_pause_data);
item1.setIcon(R.drawable.record_icon);
item1.setIcon(R.drawable.ic_record_white);

// Export Data
ArrayList<Entry> dataX = adapter.getEntries(0);
Expand Down Expand Up @@ -214,7 +211,7 @@ public void onClick(DialogInterface dialogInterface, int i) {
case R.id.delete_csv_data:
if (isDataRecorded) {
MenuItem item1 = menu.findItem(R.id.record_pause_data);
item1.setIcon(R.drawable.record_icon);
item1.setIcon(R.drawable.ic_record_white);
adapter.setRecordingStatus(false);
recordData = false;
isRecordingStarted = false;
Expand Down Expand Up @@ -247,7 +244,7 @@ public void onClick(DialogInterface dialogInterface, int i) {
@Override
protected void onDestroy() {
super.onDestroy();
if(isRecordingStarted) {
if (isRecordingStarted) {
accLogger.deleteFile();
isRecordingStarted = false;
}
Expand Down
30 changes: 12 additions & 18 deletions app/src/main/java/io/pslab/activity/MultimeterActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,11 @@

public class MultimeterActivity extends AppCompatActivity {

private ScienceLab scienceLab;

public static final String PREFS_NAME = "customDialogPreference";
public static final String NAME = "savingData";
private static final int MY_PERMISSIONS_REQUEST_STORAGE_FOR_DATA = 101;
public boolean recordData = false;
public CSVLogger multimeterLogger;
@BindView(R.id.multimeter_toolbar)
Toolbar mToolbar;
@BindView(R.id.quantity)
Expand All @@ -74,7 +77,6 @@ public class MultimeterActivity extends AppCompatActivity {
Button read;
@BindView(R.id.selector)
SwitchCompat aSwitch;

@BindView(R.id.multimeter_coordinator_layout)
CoordinatorLayout coordinatorLayout;
//bottomSheet
Expand All @@ -94,27 +96,19 @@ public class MultimeterActivity extends AppCompatActivity {
ImageView bottomSheetSchematic;
@BindView(R.id.custom_dialog_desc)
TextView bottomSheetDesc;

public boolean recordData = false;

BottomSheetBehavior bottomSheetBehavior;
GestureDetector gestureDetector;
SharedPreferences multimeter_data;
private ScienceLab scienceLab;
private int knobState;
private String dataRecorded;
private String valueRecorded;
private Menu menu;
private Boolean switchIsChecked;
private String[] knobMarker;
public CSVLogger multimeterLogger;
private boolean isRecordingStarted = false;
private boolean isDataRecorded = false;

BottomSheetBehavior bottomSheetBehavior;
GestureDetector gestureDetector;
public static final String PREFS_NAME = "customDialogPreference";
private static final int MY_PERMISSIONS_REQUEST_STORAGE_FOR_DATA = 101;

public static final String NAME = "savingData";
SharedPreferences multimeter_data;

@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down Expand Up @@ -412,7 +406,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
return true;
}
if (recordData) {
item.setIcon(R.drawable.record_icon);
item.setIcon(R.drawable.ic_record_white);
recordData = false;
CustomSnackBar.showSnackBar(coordinatorLayout, getString(R.string.data_recording_paused), null, null);
} else {
Expand All @@ -429,7 +423,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
case R.id.record_csv_data:
if (isDataRecorded) {
MenuItem item1 = menu.findItem(R.id.record_pause_data);
item1.setIcon(R.drawable.record_icon);
item1.setIcon(R.drawable.ic_record_white);
multimeterLogger.writeCSVFile(dataRecorded + "\n" + valueRecorded + "\n");
dataRecorded = "Data";
valueRecorded = "Value";
Expand Down Expand Up @@ -462,7 +456,7 @@ public void onClick(DialogInterface dialogInterface, int i) {
case R.id.delete_csv_data:
if (isDataRecorded) {
MenuItem item1 = menu.findItem(R.id.record_pause_data);
item1.setIcon(R.drawable.record_icon);
item1.setIcon(R.drawable.ic_record_white);
recordData = false;
isRecordingStarted = false;
isDataRecorded = false;
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/menu/data_log_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/record_pause_data"
android:icon="@drawable/record_icon"
android:icon="@drawable/ic_record_white"
android:title="@string/record_csv_data"
app:showAsAction="always" />
<item
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/menu/multimeter_log_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/record_pause_data"
android:icon="@drawable/record_icon"
android:icon="@drawable/ic_record_white"
android:title="@string/record_csv_data"
app:showAsAction="always" />
<item
Expand Down