Java Code Examples for com.eveningoutpost.dexdrip.UtilityModels.Notifications#bgUnclearAlert()

The following examples show how to use com.eveningoutpost.dexdrip.UtilityModels.Notifications#bgUnclearAlert() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BgReading.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
public static boolean getAndRaiseUnclearReading(Context context) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    if(prefs.getLong("alerts_disabled_until", 0) > new Date().getTime()){
        Log.d("NOTIFICATIONS", "getAndRaiseUnclearReading Notifications are currently disabled!!");
        UserNotification.DeleteNotificationByType("bg_unclear_readings_alert");
        return false;
    }

    Boolean bg_unclear_readings_alerts = prefs.getBoolean("bg_unclear_readings_alerts", false);
    if (!bg_unclear_readings_alerts
            || !DexCollectionType.hasFiltered()
            || Ob1G5CollectionService.usingG6()
            || Ob1G5CollectionService.usingNativeMode()) {
        Log.d(TAG_ALERT, "getUnclearReading returned false since feature is disabled");
        UserNotification.DeleteNotificationByType("bg_unclear_readings_alert");
        return false;
    }
    Long UnclearTimeSetting = Long.parseLong(prefs.getString("bg_unclear_readings_minutes", "90")) * 60000;

    Long UnclearTime = BgReading.getUnclearTime(UnclearTimeSetting);

    if (UnclearTime >= UnclearTimeSetting ) {
        Log.d("NOTIFICATIONS", "Readings have been unclear for too long!!");
        Notifications.bgUnclearAlert(context);
        return true;
    }

    UserNotification.DeleteNotificationByType("bg_unclear_readings_alert");

    if (UnclearTime > 0 ) {
        Log.d(TAG_ALERT, "We are in an clear state, but not for too long. Alerts are disabled");
        return true;
    }

    return false;
}
 
Example 2
Source File: BgReading.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
public static boolean getAndRaiseUnclearReading(Context context) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    if(prefs.getLong("alerts_disabled_until", 0) > new Date().getTime()){
        Log.d("NOTIFICATIONS", "getAndRaiseUnclearReading Notifications are currently disabled!!");
        UserNotification.DeleteNotificationByType("bg_unclear_readings_alert");
        return false;
    }

    Boolean bg_unclear_readings_alerts = prefs.getBoolean("bg_unclear_readings_alerts", false);
    if (!bg_unclear_readings_alerts
            || !DexCollectionType.hasFiltered()
            || Ob1G5CollectionService.usingG6()
            || Ob1G5CollectionService.usingNativeMode()) {
        Log.d(TAG_ALERT, "getUnclearReading returned false since feature is disabled");
        UserNotification.DeleteNotificationByType("bg_unclear_readings_alert");
        return false;
    }
    Long UnclearTimeSetting = Long.parseLong(prefs.getString("bg_unclear_readings_minutes", "90")) * 60000;

    Long UnclearTime = BgReading.getUnclearTime(UnclearTimeSetting);

    if (UnclearTime >= UnclearTimeSetting ) {
        Log.d("NOTIFICATIONS", "Readings have been unclear for too long!!");
        Notifications.bgUnclearAlert(context);
        return true;
    }

    UserNotification.DeleteNotificationByType("bg_unclear_readings_alert");

    if (UnclearTime > 0 ) {
        Log.d(TAG_ALERT, "We are in an clear state, but not for too long. Alerts are disabled");
        return true;
    }

    return false;
}
 
Example 3
Source File: BgReading.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public static boolean getAndRaiseUnclearReading(Context context) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    if(prefs.getLong("alerts_disabled_until", 0) > new Date().getTime()){
        Log.d("NOTIFICATIONS", "getAndRaiseUnclearReading Notifications are currently disabled!!");
        UserNotification.DeleteNotificationByType("bg_unclear_readings_alert");
        return false;
    }

    Boolean bg_unclear_readings_alerts = prefs.getBoolean("bg_unclear_readings_alerts", false);
    if (!bg_unclear_readings_alerts
            || !DexCollectionType.hasFiltered()
            || Ob1G5CollectionService.usingG6()
            || Ob1G5CollectionService.usingNativeMode()) {
        Log.d(TAG_ALERT, "getUnclearReading returned false since feature is disabled");
        UserNotification.DeleteNotificationByType("bg_unclear_readings_alert");
        return false;
    }
    Long UnclearTimeSetting = Long.parseLong(prefs.getString("bg_unclear_readings_minutes", "90")) * 60000;

    Long UnclearTime = BgReading.getUnclearTime(UnclearTimeSetting);

    if (UnclearTime >= UnclearTimeSetting ) {
        Log.d("NOTIFICATIONS", "Readings have been unclear for too long!!");
        Notifications.bgUnclearAlert(context);
        return true;
    }

    UserNotification.DeleteNotificationByType("bg_unclear_readings_alert");

    if (UnclearTime > 0 ) {
        Log.d(TAG_ALERT, "We are in an clear state, but not for too long. Alerts are disabled");
        return true;
    }

    return false;
}
 
Example 4
Source File: BgReading.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public static boolean getAndRaiseUnclearReading(Context context) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    if(prefs.getLong("alerts_disabled_until", 0) > new Date().getTime()){
        Log.d("NOTIFICATIONS", "getAndRaiseUnclearReading Notifications are currently disabled!!");
        UserNotification.DeleteNotificationByType("bg_unclear_readings_alert");
        return false;
    }

    Boolean bg_unclear_readings_alerts = prefs.getBoolean("bg_unclear_readings_alerts", false);
    if (!bg_unclear_readings_alerts
            || !DexCollectionType.hasFiltered()
            || Ob1G5CollectionService.usingG6()
            || Ob1G5CollectionService.usingNativeMode()) {
        Log.d(TAG_ALERT, "getUnclearReading returned false since feature is disabled");
        UserNotification.DeleteNotificationByType("bg_unclear_readings_alert");
        return false;
    }
    Long UnclearTimeSetting = Long.parseLong(prefs.getString("bg_unclear_readings_minutes", "90")) * 60000;

    Long UnclearTime = BgReading.getUnclearTime(UnclearTimeSetting);

    if (UnclearTime >= UnclearTimeSetting ) {
        Log.d("NOTIFICATIONS", "Readings have been unclear for too long!!");
        Notifications.bgUnclearAlert(context);
        return true;
    }

    UserNotification.DeleteNotificationByType("bg_unclear_readings_alert");

    if (UnclearTime > 0 ) {
        Log.d(TAG_ALERT, "We are in an clear state, but not for too long. Alerts are disabled");
        return true;
    }

    return false;
}
 
Example 5
Source File: AlertType.java    From xDrip-Experimental with GNU General Public License v3.0 5 votes vote down vote up
public static AlertType get_highest_active_alert(Context context, double bg, AtomicBoolean unclearReading) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    if(prefs.getLong("alerts_disabled_until", 0) > new Date().getTime()){
        Log.d("NOTIFICATIONS", "Notifications are currently disabled!!");
        return null;
    }

    if (bg <= 14) { // Special dexcom codes should not set off low alarms
        return null;
    }

    Boolean bg_unclear_readings_alerts = prefs.getBoolean("bg_unclear_readings_alerts", false);
    Long UnclearTimeSetting = Long.parseLong(prefs.getString("bg_unclear_readings_minutes", "90")) * 60000;

    Long UnclearTime = BgReading.getUnclearTime(UnclearTimeSetting);

    AlertType at;
    if (UnclearTime >= UnclearTimeSetting && bg_unclear_readings_alerts ) {
        Log.d("NOTIFICATIONS", "Readings have been unclear for too long!!");
        unclearReading.set(true);
        Notifications.bgUnclearAlert(context);
    }
    if ((UnclearTime > 0 ) && bg_unclear_readings_alerts) {
        Log.d(TAG_ALERT, "We are in an clear state, but not for too long. Alerts are disabled");
        return null;
    }
    at = get_highest_active_alert_helper(bg, prefs);
    if (at != null) {
        Log.d(TAG_ALERT, "get_highest_active_alert_helper returned alert uuid = " + at.uuid + " alert name = " + at.name);
    } else {
        Log.d(TAG_ALERT, "get_highest_active_alert_helper returned NULL");
    }
    return at;
}