Skip to content

armgit / haven

Public Imported from GitHub
0

Haven is for people who need a way to protect their personal spaces and possessions without compromising their own privacy, through an Android app and on-device sensors

ensure sensor configurations are properly saved

n8fr851186eba3b66
diff --git a/src/main/java/org/havenapp/main/ui/AccelConfigureActivity.java b/src/main/java/org/havenapp/main/ui/AccelConfigureActivity.java
index cb205bc..b53a196 100644
--- a/src/main/java/org/havenapp/main/ui/AccelConfigureActivity.java
+++ b/src/main/java/org/havenapp/main/ui/AccelConfigureActivity.java
@@ -91,6 +91,8 @@ public class AccelConfigureActivity extends AppCompatActivity implements SensorE
@Override
public void onValueChanged(int oldValue, int newValue) {
mWaveform.setThreshold(newValue);
+ mPrefManager.setAccelerometerSensitivity(newValue+"");
+
}
});
@@ -268,23 +270,24 @@ public class AccelConfigureActivity extends AppCompatActivity implements SensorE
}
- 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();
+ }
}
diff --git a/src/main/java/org/havenapp/main/ui/CameraConfigureActivity.java b/src/main/java/org/havenapp/main/ui/CameraConfigureActivity.java
index e90a36e..84284f3 100644
--- a/src/main/java/org/havenapp/main/ui/CameraConfigureActivity.java
+++ b/src/main/java/org/havenapp/main/ui/CameraConfigureActivity.java
@@ -105,20 +105,12 @@ public class CameraConfigureActivity extends AppCompatActivity {
}
- /**
- * 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;
@@ -129,7 +121,7 @@ public class CameraConfigureActivity extends AppCompatActivity {
*/
@Override
public void onBackPressed() {
- close();
+ finish();
}
@Override
diff --git a/src/main/java/org/havenapp/main/ui/MicrophoneConfigureActivity.java b/src/main/java/org/havenapp/main/ui/MicrophoneConfigureActivity.java
index 287b7c5..c808e6a 100644
--- a/src/main/java/org/havenapp/main/ui/MicrophoneConfigureActivity.java
+++ b/src/main/java/org/havenapp/main/ui/MicrophoneConfigureActivity.java
@@ -60,6 +60,7 @@ public class MicrophoneConfigureActivity extends AppCompatActivity implements Mi
@Override
public void onValueChanged(int oldValue, int newValue) {
mWaveform.setThreshold(newValue);
+ mPrefManager.setMicrophoneSensitivity(newValue+"");
}
});
@@ -193,12 +194,6 @@ public class MicrophoneConfigureActivity extends AppCompatActivity implements Mi
}
- private void save ()
- {
- mPrefManager.setMicrophoneSensitivity(mNumberTrigger.getValue()+"");
- finish();
- }
-
@Override
public void onSignalReceived(short[] signal) {
/*
@@ -247,14 +242,24 @@ public class MicrophoneConfigureActivity extends AppCompatActivity implements Mi
}
+
+
+
@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();
+ }
}