Added 'Raise Alarm' button on main screen
This commit is contained in:
@@ -566,7 +566,7 @@ public class LogManager implements AuthCallbackInterface, EventCallbackInterface
|
||||
return;
|
||||
}
|
||||
|
||||
Log.v(TAG,"writeToRemoteServer(): calling UploadSdData()");
|
||||
Log.d(TAG,"writeToRemoteServer(): calling UploadSdData()");
|
||||
uploadSdData();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,9 @@
|
||||
|
||||
package uk.org.openseizuredetector;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
@@ -158,6 +160,38 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
});
|
||||
|
||||
// Deal with the 'Raise Alarm'
|
||||
button = (Button) findViewById(R.id.manualAlarmButton);
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
Log.v(TAG, "manualAlarmButton.onClick()");
|
||||
// Confirmation dialog based on: https://stackoverflow.com/a/12213536/2104584
|
||||
//AlertDialog.Builder builder = new AlertDialog.Builder(getBaseContext());
|
||||
//builder.setTitle("Raise Alarm");
|
||||
//builder.setMessage(String.format("Raise a Seizure Detected Alarm NOW?"));
|
||||
//builder.setPositiveButton("YES", new DialogInterface.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(DialogInterface dialog, int which) {
|
||||
if (mConnection.mBound) {
|
||||
mConnection.mSdServer.raiseManualAlarm();
|
||||
}
|
||||
// dialog.dismiss();
|
||||
// }
|
||||
//});
|
||||
//builder.setNegativeButton("NO", new DialogInterface.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(DialogInterface dialog, int which) {
|
||||
// dialog.dismiss();
|
||||
// }
|
||||
//});
|
||||
//AlertDialog alert = builder.create();
|
||||
//if (!(this).isFinishing()) {
|
||||
// alert.show();
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -520,6 +520,13 @@ public class SdServer extends Service implements SdDataReceiver {
|
||||
}
|
||||
}
|
||||
|
||||
public void raiseManualAlarm() {
|
||||
Log.d(TAG,"raiseManualAlarm()");
|
||||
SdData sdData = mSdData;
|
||||
sdData.alarmState = 5;
|
||||
onSdDataReceived(sdData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the data received from the SdData source. On exit, the mSdData structure is populated with
|
||||
* the appropriate data.
|
||||
|
||||
Reference in New Issue
Block a user