added debug variable
This commit is contained in:
parent
bc3383b42e
commit
2492c12804
@ -28,6 +28,7 @@ public class WaldemarWidget extends AppWidgetProvider {
|
||||
private static final double MILLISECONDS_PER_DAY = SECONDS_PER_DAY * 1000;
|
||||
private static final int CURRENTLY_NOT_USED_REQUEST_CODE = 0;
|
||||
private static final int SUSPICIOUS_FLAGS = 0;
|
||||
private static final boolean DEBUG = false;
|
||||
static AlarmManager myAlarmManager;
|
||||
static PendingIntent myPendingIntent;
|
||||
|
||||
@ -48,12 +49,13 @@ public class WaldemarWidget extends AppWidgetProvider {
|
||||
AlarmManager alarmManager = (AlarmManager) context
|
||||
.getSystemService(Context.ALARM_SERVICE);
|
||||
long midnightInMillis = getMidnightInMillis();
|
||||
//alarmManager.setRepeating(AlarmManager.RTC, midnightInMillis,
|
||||
// AlarmManager.INTERVAL_DAY, pendingIntent);
|
||||
alarmManager.setRepeating(AlarmManager.RTC, midnightInMillis,
|
||||
AlarmManager.INTERVAL_FIFTEEN_MINUTES, pendingIntent);
|
||||
|
||||
WaldemarWidget.saveAlarmManager(alarmManager, pendingIntent);
|
||||
long interval = AlarmManager.INTERVAL_DAY;
|
||||
if (DEBUG) {
|
||||
interval = AlarmManager.INTERVAL_FIFTEEN_MINUTES;
|
||||
}
|
||||
alarmManager.setRepeating(AlarmManager.RTC, midnightInMillis, interval,
|
||||
pendingIntent);
|
||||
saveAlarmManager(alarmManager, pendingIntent);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -140,8 +142,10 @@ public class WaldemarWidget extends AppWidgetProvider {
|
||||
status = "";
|
||||
}
|
||||
|
||||
if (DEBUG) {
|
||||
DateFormat format = SimpleDateFormat.getTimeInstance(SimpleDateFormat.MEDIUM, Locale.getDefault());
|
||||
status = status + "\n" + format.format(new Date());
|
||||
}
|
||||
|
||||
remoteViews.setProgressBar(R.id.progress, duration, duration - days, false);
|
||||
remoteViews.setTextViewText(R.id.status, status);
|
||||
@ -149,7 +153,7 @@ public class WaldemarWidget extends AppWidgetProvider {
|
||||
appWidgetManager.updateAppWidget(appWidgetId, remoteViews);
|
||||
}
|
||||
|
||||
static void saveAlarmManager(AlarmManager alarmManager,
|
||||
private void saveAlarmManager(AlarmManager alarmManager,
|
||||
PendingIntent pendingIntent) {
|
||||
myAlarmManager = alarmManager;
|
||||
myPendingIntent = pendingIntent;
|
||||
|
Loading…
Reference in New Issue
Block a user