Skip to content

Commit

Permalink
ensure sensor configurations are properly saved
Browse files Browse the repository at this point in the history
  • Loading branch information
n8fr8 committed Jan 19, 2018
1 parent 8ff99eb commit 51186eb
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
21 changes: 12 additions & 9 deletions src/main/java/org/havenapp/main/ui/AccelConfigureActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ protected void onCreate(Bundle savedInstanceState) {
@Override
public void onValueChanged(int oldValue, int newValue) {
mWaveform.setThreshold(newValue);
mPrefManager.setAccelerometerSensitivity(newValue+"");

}
});

Expand Down Expand Up @@ -268,23 +270,24 @@ protected void onDestroy() {

}

private void save ()
{
//mPrefManager.setMicrophoneSensitivity(mNumberTrigger.getValue()+"");

mPrefManager.setAccelerometerSensitivity(mNumberTrigger.getValue()+"");
finish();
}


@Override
public boolean onOptionsItemSelected (MenuItem item) {
switch (item.getItemId()){
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
save();
finish();
break;
}
return true;
}

/**
* When user closes the activity
*/
@Override
public void onBackPressed() {
finish();
}
}
12 changes: 2 additions & 10 deletions src/main/java/org/havenapp/main/ui/CameraConfigureActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,20 +105,12 @@ else if (camera.equals(PreferenceManager.BACK))
}


/**
* Closes the monitor activity and unset session properties
*/
private void close() {

finish();

}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
close();
finish();
break;
}
return true;
Expand All @@ -129,7 +121,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
*/
@Override
public void onBackPressed() {
close();
finish();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ protected void onCreate(Bundle savedInstanceState) {
@Override
public void onValueChanged(int oldValue, int newValue) {
mWaveform.setThreshold(newValue);
mPrefManager.setMicrophoneSensitivity(newValue+"");
}
});

Expand Down Expand Up @@ -193,12 +194,6 @@ protected void onDestroy() {

}

private void save ()
{
mPrefManager.setMicrophoneSensitivity(mNumberTrigger.getValue()+"");
finish();
}

@Override
public void onSignalReceived(short[] signal) {
/*
Expand Down Expand Up @@ -247,14 +242,24 @@ public void onMicError() {

}




@Override
public boolean onOptionsItemSelected (MenuItem item) {
switch (item.getItemId()){
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
save();
finish();
break;
}
return true;
}

/**
* When user closes the activity
*/
@Override
public void onBackPressed() {
finish();
}
}

0 comments on commit 51186eb

Please sign in to comment.