Java Code Examples for com.eveningoutpost.dexdrip.Home#staticRefreshBGCharts()

The following examples show how to use com.eveningoutpost.dexdrip.Home#staticRefreshBGCharts() . 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: ColorPicker.java    From xDrip with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onDialogClosed(boolean positiveResult) {
    super.onDialogClosed(positiveResult);
    ColorCache.invalidateCache();

    // TODO maybe a better way to send this message to the chart
    if (mParent != null) {
        Log.d(TAG, "Calling refresh on parent");
        try {
            mParent.refreshDrawableState();
        } catch (Exception e) {
            Log.e(TAG, "Got exception refreshing drawablestate: " + e);
        }
    } else {
        Log.d(TAG, "mparent is null :(");
    }
    notifyChanged();

    // TODO probably should check whether data has actually changed before updating all the graphics
    Home.staticRefreshBGCharts(true);
    WidgetUpdateService.staticRefreshWidgets();
    Notifications.staticUpdateNotification();
}
 
Example 2
Source File: NightscoutUploader.java    From xDrip with GNU General Public License v3.0 6 votes vote down vote up
public boolean uploadRest(List<BgReading> glucoseDataSets, List<BloodTest> meterRecords, List<Calibration> calRecords) {

        boolean apiStatus = false;

        if (enableRESTUpload) {
            long start = System.currentTimeMillis();
            Log.i(TAG, String.format("Starting upload of %s record using a REST API", glucoseDataSets.size()));
            apiStatus = doRESTUpload(prefs, glucoseDataSets, meterRecords, calRecords);
            Log.i(TAG, String.format("Finished upload of %s record using a REST API in %s ms result: %b", glucoseDataSets.size(), System.currentTimeMillis() - start, apiStatus));

            if (prefs.getBoolean("cloud_storage_api_download_enable", false)) {
                start = System.currentTimeMillis();
                final boolean substatus = doRESTtreatmentDownload(prefs);
                if (substatus) {
                    Home.staticRefreshBGCharts();
                }
                Log.i(TAG, String.format("Finished download using a REST API in %s ms result: %b", System.currentTimeMillis() - start, substatus));
            }
        }
        return apiStatus;
    }
 
Example 3
Source File: ColorPicker.java    From xDrip-plus with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onDialogClosed(boolean positiveResult) {
    super.onDialogClosed(positiveResult);
    ColorCache.invalidateCache();

    // TODO maybe a better way to send this message to the chart
    if (mParent != null) {
        Log.d(TAG, "Calling refresh on parent");
        try {
            mParent.refreshDrawableState();
        } catch (Exception e) {
            Log.e(TAG, "Got exception refreshing drawablestate: " + e);
        }
    } else {
        Log.d(TAG, "mparent is null :(");
    }
    notifyChanged();

    // TODO probably should check whether data has actually changed before updating all the graphics
    Home.staticRefreshBGCharts(true);
    WidgetUpdateService.staticRefreshWidgets();
    Notifications.staticUpdateNotification();
}
 
Example 4
Source File: NightscoutUploader.java    From xDrip-plus with GNU General Public License v3.0 6 votes vote down vote up
public boolean uploadRest(List<BgReading> glucoseDataSets, List<BloodTest> meterRecords, List<Calibration> calRecords) {

        boolean apiStatus = false;

        if (enableRESTUpload) {
            long start = System.currentTimeMillis();
            Log.i(TAG, String.format("Starting upload of %s record using a REST API", glucoseDataSets.size()));
            apiStatus = doRESTUpload(prefs, glucoseDataSets, meterRecords, calRecords);
            Log.i(TAG, String.format("Finished upload of %s record using a REST API in %s ms result: %b", glucoseDataSets.size(), System.currentTimeMillis() - start, apiStatus));

            if (prefs.getBoolean("cloud_storage_api_download_enable", false)) {
                start = System.currentTimeMillis();
                final boolean substatus = doRESTtreatmentDownload(prefs);
                if (substatus) {
                    Home.staticRefreshBGCharts();
                }
                Log.i(TAG, String.format("Finished download using a REST API in %s ms result: %b", System.currentTimeMillis() - start, substatus));
            }
        }
        return apiStatus;
    }
 
Example 5
Source File: BgReading.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
public synchronized static void processFromMultiMessage(byte[] payload) {
    try {
        final BgReadingMultiMessage bgmm = BgReadingMultiMessage.ADAPTER.decode(payload);
        if ((bgmm != null) && (bgmm.bgreading_message != null)) {
            for (BgReadingMessage btm : bgmm.bgreading_message) {
                processFromMessage(btm);
            }
            Home.staticRefreshBGCharts();
        }
    } catch (IOException | NullPointerException | IllegalStateException e) {
        UserError.Log.e(TAG, "exception processFromMessage: " + e);
    }
}
 
Example 6
Source File: BloodTest.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
public static void processFromMultiMessage(byte[] payload) {
    try {
        final BloodTestMultiMessage btmm = BloodTestMultiMessage.ADAPTER.decode(payload);
        if ((btmm != null) && (btmm.bloodtest_message != null)) {
            for (BloodTestMessage btm : btmm.bloodtest_message) {
                processFromMessage(btm);
            }
            Home.staticRefreshBGCharts();
        }
    } catch (IOException | NullPointerException | IllegalStateException e) {
        UserError.Log.e(TAG, "exception processFromMessage: " + e);
    }
}
 
Example 7
Source File: Treatments.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
public static void delete_by_uuid(String uuid, boolean from_interactive) {
    Treatments thistreat = byuuid(uuid);
    if (thistreat != null) {

        UploaderQueue.newEntry("delete", thistreat);
        if (from_interactive) {
            GcmActivity.push_delete_treatment(thistreat);
            SyncService.startSyncService(3000); // sync in 3 seconds
        }

        thistreat.delete();
        Home.staticRefreshBGCharts();
    }
}
 
Example 8
Source File: BgReading.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
public synchronized static void processFromMultiMessage(byte[] payload) {
    try {
        final BgReadingMultiMessage bgmm = BgReadingMultiMessage.ADAPTER.decode(payload);
        if ((bgmm != null) && (bgmm.bgreading_message != null)) {
            for (BgReadingMessage btm : bgmm.bgreading_message) {
                processFromMessage(btm);
            }
            Home.staticRefreshBGCharts();
        }
    } catch (IOException | NullPointerException | IllegalStateException e) {
        UserError.Log.e(TAG, "exception processFromMessage: " + e);
    }
}
 
Example 9
Source File: BgReading.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public synchronized static void processFromMultiMessage(byte[] payload) {
    try {
        final BgReadingMultiMessage bgmm = BgReadingMultiMessage.ADAPTER.decode(payload);
        if ((bgmm != null) && (bgmm.bgreading_message != null)) {
            for (BgReadingMessage btm : bgmm.bgreading_message) {
                processFromMessage(btm);
            }
            Home.staticRefreshBGCharts();
        }
    } catch (IOException | NullPointerException | IllegalStateException e) {
        UserError.Log.e(TAG, "exception processFromMessage: " + e);
    }
}
 
Example 10
Source File: BloodTest.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public static void processFromMultiMessage(byte[] payload) {
    try {
        final BloodTestMultiMessage btmm = BloodTestMultiMessage.ADAPTER.decode(payload);
        if ((btmm != null) && (btmm.bloodtest_message != null)) {
            for (BloodTestMessage btm : btmm.bloodtest_message) {
                processFromMessage(btm);
            }
            Home.staticRefreshBGCharts();
        }
    } catch (IOException | NullPointerException | IllegalStateException e) {
        UserError.Log.e(TAG, "exception processFromMessage: " + e);
    }
}
 
Example 11
Source File: Treatments.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public static void delete_by_uuid(String uuid, boolean from_interactive) {
    Treatments thistreat = byuuid(uuid);
    if (thistreat != null) {

        UploaderQueue.newEntry("delete", thistreat);
        if (from_interactive) {
            GcmActivity.push_delete_treatment(thistreat);
            SyncService.startSyncService(3000); // sync in 3 seconds
        }

        thistreat.delete();
        Home.staticRefreshBGCharts();
    }
}
 
Example 12
Source File: BgReading.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public synchronized static void processFromMultiMessage(byte[] payload) {
    try {
        final BgReadingMultiMessage bgmm = BgReadingMultiMessage.ADAPTER.decode(payload);
        if ((bgmm != null) && (bgmm.bgreading_message != null)) {
            for (BgReadingMessage btm : bgmm.bgreading_message) {
                processFromMessage(btm);
            }
            Home.staticRefreshBGCharts();
        }
    } catch (IOException | NullPointerException | IllegalStateException e) {
        UserError.Log.e(TAG, "exception processFromMessage: " + e);
    }
}