Skip to content
Snippets Groups Projects
Commit df872e86 authored by Peter Joseph De Jonckheere CESM2014's avatar Peter Joseph De Jonckheere CESM2014
Browse files

Bug fixes for dnd and possibly saving and uploading this needs to be tested,...

Bug fixes for dnd and possibly saving and uploading this needs to be tested, according to user trial response.
parent a316c66f
No related branches found
No related tags found
No related merge requests found
......@@ -31,7 +31,7 @@ public class SaveFile {
String line = "";
if (isExternalStorageMounted()) {
File dir = getDirectory(context);
File file = new File(dir, "TIMESTAMPLOG");
File file = new File(dir, "TIMESTAMPLOG.txt");
if (!file.exists()) {
try {
file.createNewFile();
......@@ -71,7 +71,7 @@ public class SaveFile {
if (isExternalStorageMounted()) {
File dir = getDirectory(context);
if (dir.isDirectory()) {
File file = new File(dir, "NOTLOG");
File file = new File(dir, "NOTLOG.txt");
try {
if(!file.exists()) {
file.createNewFile();
......@@ -151,7 +151,7 @@ public class SaveFile {
if (isExternalStorageMounted()) {
File dir = getDirectory(context);
if (dir.isDirectory()) {
File file = new File(dir, "TYPELOG");
File file = new File(dir, "TYPELOG.txt");
try {
if(!file.exists()) {
file.createNewFile();
......
......@@ -66,13 +66,17 @@ public class SedentaryStimulus extends BroadcastReceiver implements Stimulus {
private boolean checkTime(SharedPreferences shared, Context context){
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, shared.getInt(context.getString(R.string.dnd_shour), 23));
cal.set(Calendar.MINUTE, shared.getInt(context.getString(R.string.dnd_smin), 0));
Calendar cal2 = Calendar.getInstance();
int days = checkMonth(cal2.get(Calendar.MONTH));
cal2.set(Calendar.DATE, ((cal2.get(Calendar.DATE)+ 1)% days));
if(shared.getInt(context.getString(R.string.dnd_shour), 23) > shared.getInt(context.getString(R.string.dnd_ehour), 9)) {
cal2.set(Calendar.DATE, ((cal2.get(Calendar.DATE) + 1) % days));
}
cal2.set(Calendar.HOUR_OF_DAY, shared.getInt(context.getString(R.string.dnd_ehour), 9));
cal2.set(Calendar.MINUTE, shared.getInt(context.getString(R.string.dnd_emin), 0));
Calendar curCal = Calendar.getInstance();
if(curCal.getTime().after(cal.getTime()) && curCal.getTime().before(cal2.getTime())){
return false;
return false;
} else {
return true;
}
......
......@@ -59,8 +59,9 @@ public class SigMotionDetect extends Service implements StimulusStrategy {
Intent i = new Intent(this, com.notificationFramework.stimulus.SedentaryStimulus.class);
PendingIntent pi = PendingIntent.getBroadcast(this, R.integer.alarm_rc, i, 0);
SharedPreferences shared = this.getSharedPreferences(getString(R.string.preference_file_key), Context.MODE_PRIVATE);
int interval = shared.getInt(getString(R.string.daily_goal), getResources().getInteger(R.integer.notify_period_minutes));
am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime()+(1000*60*interval), pi);
// int interval = shared.getInt(getString(R.string.daily_goal), getResources().getInteger(R.integer.notify_period_minutes));
// am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime()+(1000*60*interval), pi);
am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 3000, pi);
}
public void monitor() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment