mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-21 20:19:23 +01:00
Add debug code
This commit is contained in:
parent
9cf02aedda
commit
87fd45cfa1
3 changed files with 21 additions and 16 deletions
|
@ -2,6 +2,7 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="com.android.alarm.permission.SET_ALARM"/>
|
||||
|
|
|
@ -37,20 +37,20 @@ public class AlarmReceiver extends BroadcastReceiver {
|
|||
Date tomorrow;
|
||||
LocalTime todayNow = LocalTime.now();
|
||||
|
||||
/*if (BuildConfig.DEBUG) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
Date nextSchedule = calendar.getTime();
|
||||
calendar.setTimeInMillis(nextSchedule.getTime());
|
||||
} else {*/
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 11);
|
||||
today = calendar.getTime();
|
||||
calendar.add(Calendar.DAY_OF_YEAR, 1);
|
||||
tomorrow = calendar.getTime();
|
||||
if (todayNow.isBefore(LocalTime.NOON)) {
|
||||
calendar.setTimeInMillis(today.getTime());
|
||||
} else {
|
||||
calendar.setTimeInMillis(tomorrow.getTime());
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 11);
|
||||
today = calendar.getTime();
|
||||
calendar.add(Calendar.DAY_OF_YEAR, 1);
|
||||
tomorrow = calendar.getTime();
|
||||
if (todayNow.isBefore(LocalTime.NOON)) {
|
||||
calendar.setTimeInMillis(today.getTime());
|
||||
} else {
|
||||
calendar.setTimeInMillis(tomorrow.getTime());
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
PendingIntent alarmIntent;
|
||||
|
||||
|
@ -59,14 +59,14 @@ public class AlarmReceiver extends BroadcastReceiver {
|
|||
|
||||
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
|
||||
|
||||
/*if (BuildConfig.DEBUG) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP,(calendar.getTimeInMillis()),
|
||||
AlarmManager.ELAPSED_REALTIME, alarmIntent);
|
||||
} else {*/
|
||||
} else {
|
||||
|
||||
alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, (calendar.getTimeInMillis()),
|
||||
AlarmManager.INTERVAL_DAY, alarmIntent);
|
||||
//}
|
||||
alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, (calendar.getTimeInMillis()),
|
||||
AlarmManager.INTERVAL_DAY, alarmIntent);
|
||||
}
|
||||
|
||||
Log.d(TAG, "Alarm scheduled for " + UtilDate.convertDate(calendar.getTimeInMillis()));
|
||||
if (BuildConfig.DEBUG) {
|
||||
|
|
|
@ -164,8 +164,12 @@ public class Prescription implements Serializable {
|
|||
}*/
|
||||
|
||||
if (numberOfDays > 0) {
|
||||
float currentStock = 0;
|
||||
float newStock = 0;
|
||||
double takeDuringPeriod = this.take * numberOfDays;
|
||||
setStock((float) (getStock() - takeDuringPeriod));
|
||||
currentStock = getStock();
|
||||
newStock = (float) (currentStock - takeDuringPeriod);
|
||||
setStock((float) newStock);
|
||||
setLast_update(new Date().getTime());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue