use of com.eveningoutpost.dexdrip.Models.ActiveBgAlert in project xDrip by NightscoutFoundation.
the class FakeNumbers method addListenerOnButton.
public void addListenerOnButton() {
button = (Button) findViewById(R.id.log);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
EditText value = (EditText) findViewById(R.id.bg_value);
int intValue = Integer.parseInt(value.getText().toString());
int filterdValue = intValue;
if (intValue > 200) {
filterdValue = (int) (filterdValue * 1.2);
}
BgReading bgReading = BgReading.create(intValue * 1000, filterdValue * 1000, getApplicationContext(), new Date().getTime());
Intent intent = new Intent(getApplicationContext(), Home.class);
startActivity(intent);
finish();
}
});
button = (Button) findViewById(R.id.StartTest);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
ActiveBgAlert aba = ActiveBgAlert.getOnly();
ActiveBgAlert.ClearData();
ActiveBgAlert.Create("some string", true, new Date().getTime());
}
});
button = (Button) findViewById(R.id.StartTestAlerts);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
AlertType.testAll(getApplicationContext());
BgReading.TestgetUnclearTimes();
}
});
}
use of com.eveningoutpost.dexdrip.Models.ActiveBgAlert in project xDrip-plus by jamorham.
the class FakeNumbers method addListenerOnButton.
public void addListenerOnButton() {
button = (Button) findViewById(R.id.log);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
EditText value = (EditText) findViewById(R.id.bg_value);
int intValue = Integer.parseInt(value.getText().toString());
int filterdValue = intValue;
if (intValue > 200) {
filterdValue = (int) (filterdValue * 1.2);
}
BgReading bgReading = BgReading.create(intValue * 1000, filterdValue * 1000, getApplicationContext(), new Date().getTime());
Intent intent = new Intent(getApplicationContext(), Home.class);
startActivity(intent);
finish();
}
});
button = (Button) findViewById(R.id.StartTest);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
ActiveBgAlert aba = ActiveBgAlert.getOnly();
ActiveBgAlert.ClearData();
ActiveBgAlert.Create("some string", true, new Date().getTime());
}
});
button = (Button) findViewById(R.id.StartTestAlerts);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
AlertType.testAll(getApplicationContext());
BgReading.TestgetUnclearTimes();
}
});
}
use of com.eveningoutpost.dexdrip.Models.ActiveBgAlert in project xDrip-plus by jamorham.
the class AlertPlayer method ClockTick.
// Check the state and alrarm if needed
public void ClockTick(Context ctx, boolean trendingToAlertEnd, String bgValue) {
if (trendingToAlertEnd) {
Log.d(TAG, "ClockTick: This alert is trending to it's end will not do anything");
return;
}
ActiveBgAlert activeBgAlert = ActiveBgAlert.getOnly();
if (activeBgAlert == null) {
// Nothing to do ...
return;
}
if (activeBgAlert.ready_to_alarm()) {
// also don't cancel notification
stopAlert(ctx, false, false, false);
int timeFromStartPlaying = activeBgAlert.getUpdatePlayTime();
AlertType alert = AlertType.get_alert(activeBgAlert.alert_uuid);
if (alert == null) {
Log.d(TAG, "ClockTick: The alert was already deleted... will not play");
ActiveBgAlert.ClearData();
return;
}
Log.d(TAG, "ClockTick: Playing the alert again");
long nextAlertTime = alert.getNextAlertTime(ctx);
activeBgAlert.updateNextAlertAt(nextAlertTime);
Vibrate(ctx, alert, bgValue, alert.override_silent_mode, timeFromStartPlaying);
}
}
use of com.eveningoutpost.dexdrip.Models.ActiveBgAlert in project xDrip by NightscoutFoundation.
the class AlertPlayer method PreSnooze.
public synchronized void PreSnooze(Context ctx, String uuid, int repeatTime) {
Log.i(TAG, "PreSnooze called repeatTime = " + repeatTime);
stopAlert(ctx, true, false);
ActiveBgAlert.Create(uuid, true, new Date().getTime() + repeatTime * 60000);
ActiveBgAlert activeBgAlert = ActiveBgAlert.getOnly();
if (activeBgAlert == null) {
Log.wtf(TAG, "Just created the alert, where did it go...");
return;
}
activeBgAlert.snooze(repeatTime);
}
use of com.eveningoutpost.dexdrip.Models.ActiveBgAlert in project xDrip by NightscoutFoundation.
the class AlertPlayer method ClockTick.
// Check the state and alrarm if needed
public void ClockTick(Context ctx, boolean trendingToAlertEnd, String bgValue) {
if (trendingToAlertEnd) {
Log.d(TAG, "ClockTick: This alert is trending to it's end will not do anything");
return;
}
ActiveBgAlert activeBgAlert = ActiveBgAlert.getOnly();
if (activeBgAlert == null) {
// Nothing to do ...
return;
}
if (activeBgAlert.ready_to_alarm()) {
// also don't cancel notification
stopAlert(ctx, false, false, false);
int timeFromStartPlaying = activeBgAlert.getUpdatePlayTime();
AlertType alert = AlertType.get_alert(activeBgAlert.alert_uuid);
if (alert == null) {
Log.d(TAG, "ClockTick: The alert was already deleted... will not play");
ActiveBgAlert.ClearData();
return;
}
Log.d(TAG, "ClockTick: Playing the alert again");
long nextAlertTime = alert.getNextAlertTime(ctx);
activeBgAlert.updateNextAlertAt(nextAlertTime);
Vibrate(ctx, alert, bgValue, alert.override_silent_mode, timeFromStartPlaying);
}
}
Aggregations