Java Code Examples for com.eveningoutpost.dexdrip.Models.Calibration#latestForGraph()
The following examples show how to use
com.eveningoutpost.dexdrip.Models.Calibration#latestForGraph() .
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: BgGraphBuilder.java From xDrip with GNU General Public License v3.0 | 6 votes |
public BgGraphBuilder(Context context, long start, long end, int numValues){ end_time = end; start_time = start; bgReadings = BgReading.latestForGraph( numValues, start, end); calibrations = Calibration.latestForGraph( numValues, start, end); this.context = context; this.prefs = PreferenceManager.getDefaultSharedPreferences(context); this.highMark = Double.parseDouble(prefs.getString("highValue", "170")); this.lowMark = Double.parseDouble(prefs.getString("lowValue", "70")); this.doMgdl = (prefs.getString("units", "mgdl").equals("mgdl")); defaultMinY = unitized(40); defaultMaxY = unitized(250); pointSize = isXLargeTablet(context) ? 5 : 3; axisTextSize = isXLargeTablet(context) ? 20 : Axis.DEFAULT_TEXT_SIZE_SP; previewAxisTextSize = isXLargeTablet(context) ? 12 : 5; hoursPreviewStep = isXLargeTablet(context) ? 2 : 1; }
Example 2
Source File: BgGraphBuilder.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
public BgGraphBuilder(Context context, long start, long end, int numValues){ end_time = end; start_time = start; bgReadings = BgReading.latestForGraph( numValues, start, end); calibrations = Calibration.latestForGraph( numValues, start, end); this.context = context; this.prefs = PreferenceManager.getDefaultSharedPreferences(context); this.highMark = Double.parseDouble(prefs.getString("highValue", "170")); this.lowMark = Double.parseDouble(prefs.getString("lowValue", "70")); this.doMgdl = (prefs.getString("units", "mgdl").equals("mgdl")); defaultMinY = unitized(40); defaultMaxY = unitized(250); pointSize = isXLargeTablet(context) ? 5 : 3; axisTextSize = isXLargeTablet(context) ? 20 : Axis.DEFAULT_TEXT_SIZE_SP; previewAxisTextSize = isXLargeTablet(context) ? 12 : 5; hoursPreviewStep = isXLargeTablet(context) ? 2 : 1; }
Example 3
Source File: BgGraphBuilder.java From xDrip-Experimental with GNU General Public License v3.0 | 6 votes |
public BgGraphBuilder(Context context, long start, long end, int numValues){ end_time = end; start_time = start; bgReadings = BgReading.latestForGraph( numValues, start, end); calibrations = Calibration.latestForGraph( numValues, start, end); this.context = context; this.prefs = PreferenceManager.getDefaultSharedPreferences(context); this.highMark = Double.parseDouble(prefs.getString("highValue", "170")); this.lowMark = Double.parseDouble(prefs.getString("lowValue", "70")); this.doMgdl = (prefs.getString("units", "mgdl").equals("mgdl")); defaultMinY = unitized(40); defaultMaxY = unitized(250); pointSize = isXLargeTablet(context) ? 5 : 3; axisTextSize = isXLargeTablet(context) ? 20 : Axis.DEFAULT_TEXT_SIZE_SP; previewAxisTextSize = isXLargeTablet(context) ? 12 : 5; hoursPreviewStep = isXLargeTablet(context) ? 2 : 1; }
Example 4
Source File: ListenerService.java From xDrip with GNU General Public License v3.0 | 5 votes |
public static DataMap getCalibrations(long startTime) { Calibration last = Calibration.last(); if (last != null) { Log.d(TAG, "getCalibrations last.timestamp:" + JoH.dateTimeText(last.timestamp)); } List<Calibration> graph = Calibration.latestForGraph(60, startTime, Long.MAX_VALUE); //calibrations = Calibration.latestForGraph(numValues, start - (3 * Constants.DAY_IN_MS), end); if (!graph.isEmpty()) { Log.d(TAG, "getCalibrations graph size=" + graph.size()); final ArrayList<DataMap> dataMaps = new ArrayList<>(graph.size()); DataMap entries = null; //if (last.slope_confidence != 0) entries = dataMapForWatchface(last); for (Calibration data : graph) { if (data.slope_confidence != 0) { if (entries == null) { entries = dataMapForWatchface(data); dataMaps.add(dataMapForWatchface(data)); } else dataMaps.add(dataMapForWatchface(data)); } } if (entries != null) { entries.putDataMapArrayList("entries", dataMaps); Log.d(TAG, "getCalibrations entries=" + entries); } return entries; } else return null; }
Example 5
Source File: CalibrationDataTable.java From xDrip with GNU General Public License v3.0 | 5 votes |
private void getData() { final long startTime = new Date().getTime() - (60000 * 60 * 24 * 3);//3 days final List<Calibration> latest = Calibration.latestForGraph(60, startTime); CalibrationDataCursorAdapter adapter = new CalibrationDataCursorAdapter(this, latest); this.setListAdapter(adapter); String msg = ""; int size = 0; if (latest != null) size = latest.size(); if (size == 0) { msg = getResources().getString(R.string.notify_table_size, "Calibration", size); JoH.static_toast(xdrip.getAppContext(), msg, Toast.LENGTH_SHORT); } }
Example 6
Source File: ListenerService.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
public static DataMap getCalibrations(long startTime) { Calibration last = Calibration.last(); if (last != null) { Log.d(TAG, "getCalibrations last.timestamp:" + JoH.dateTimeText(last.timestamp)); } List<Calibration> graph = Calibration.latestForGraph(60, startTime, Long.MAX_VALUE); //calibrations = Calibration.latestForGraph(numValues, start - (3 * Constants.DAY_IN_MS), end); if (!graph.isEmpty()) { Log.d(TAG, "getCalibrations graph size=" + graph.size()); final ArrayList<DataMap> dataMaps = new ArrayList<>(graph.size()); DataMap entries = null; //if (last.slope_confidence != 0) entries = dataMapForWatchface(last); for (Calibration data : graph) { if (data.slope_confidence != 0) { if (entries == null) { entries = dataMapForWatchface(data); dataMaps.add(dataMapForWatchface(data)); } else dataMaps.add(dataMapForWatchface(data)); } } if (entries != null) { entries.putDataMapArrayList("entries", dataMaps); Log.d(TAG, "getCalibrations entries=" + entries); } return entries; } else return null; }
Example 7
Source File: CalibrationDataTable.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
private void getData() { final long startTime = new Date().getTime() - (60000 * 60 * 24 * 3);//3 days final List<Calibration> latest = Calibration.latestForGraph(60, startTime); CalibrationDataCursorAdapter adapter = new CalibrationDataCursorAdapter(this, latest); this.setListAdapter(adapter); String msg = ""; int size = 0; if (latest != null) size = latest.size(); if (size == 0) { msg = getResources().getString(R.string.notify_table_size, "Calibration", size); JoH.static_toast(xdrip.getAppContext(), msg, Toast.LENGTH_SHORT); } }
Example 8
Source File: BgGraphBuilder.java From xDrip with GNU General Public License v3.0 | 4 votes |
public BgGraphBuilder(Context context, long start, long end, int numValues, boolean show_prediction, final boolean useArchive) { // swap argument order if needed if (start > end) { long temp = end; end = start; start = temp; if (d) Log.d(TAG, "Swapping timestamps"); } if (d) Log.d(TAG, "Called timestamps: " + JoH.dateTimeText(start) + " -> " + JoH.dateTimeText(end)); this.prefs = PreferenceManager.getDefaultSharedPreferences(context); prediction_enabled = show_prediction; if (prediction_enabled) simulation_enabled = prefs.getBoolean("simulations_enabled", true); end_time = end / FUZZER; start_time = start / FUZZER; readings_lock.lock(); try { // store the initialization values used for this instance loaded_numValues=numValues; loaded_start=start; loaded_end=end; bgReadings = BgReading.latestForGraph(numValues, start, end); if (DexCollectionType.getDexCollectionType() == DexCollectionType.LibreReceiver) Libre2RawValues = Libre2RawValue.latestForGraph(numValues * 5, start, end); plugin_adjusted = false; } finally { readings_lock.unlock(); } if ((end - start) > 80000000) { try { capturePercentage = ((bgReadings.size() * 100) / ((end - start) / 300000)); //Log.d(TAG, "CPTIMEPERIOD: " + Long.toString(end - start) + " percentage: " + JoH.qs(capturePercentage)); } catch (Exception e) { capturePercentage = -1; // invalid reading } } bloodtests = BloodTest.latestForGraph(numValues, start, end); // get extra calibrations so we can use them for historical readings calibrations = Calibration.latestForGraph(numValues, start - (3 * Constants.DAY_IN_MS), end); treatments = Treatments.latestForGraph(numValues, start, end + (120 * 60 * 1000)); this.context = context; this.highMark = tolerantParseDouble(prefs.getString("highValue", "170")); this.lowMark = tolerantParseDouble(prefs.getString("lowValue", "70")); this.doMgdl = (prefs.getString("units", "mgdl").equals("mgdl")); defaultMinY = unitized(40); defaultMaxY = unitized(250); pointSize = isXLargeTablet(context) ? 5 : 3; axisTextSize = isXLargeTablet(context) ? 20 : Axis.DEFAULT_TEXT_SIZE_SP; previewAxisTextSize = isXLargeTablet(context) ? 12 : 5; hoursPreviewStep = isXLargeTablet(context) ? 2 : 1; }
Example 9
Source File: BgGraphBuilder.java From xDrip-plus with GNU General Public License v3.0 | 4 votes |
public BgGraphBuilder(Context context, long start, long end, int numValues, boolean show_prediction, final boolean useArchive) { // swap argument order if needed if (start > end) { long temp = end; end = start; start = temp; if (d) Log.d(TAG, "Swapping timestamps"); } if (d) Log.d(TAG, "Called timestamps: " + JoH.dateTimeText(start) + " -> " + JoH.dateTimeText(end)); this.prefs = PreferenceManager.getDefaultSharedPreferences(context); prediction_enabled = show_prediction; if (prediction_enabled) simulation_enabled = prefs.getBoolean("simulations_enabled", true); end_time = end / FUZZER; start_time = start / FUZZER; readings_lock.lock(); try { // store the initialization values used for this instance loaded_numValues=numValues; loaded_start=start; loaded_end=end; bgReadings = BgReading.latestForGraph(numValues, start, end); if (DexCollectionType.getDexCollectionType() == DexCollectionType.LibreReceiver) Libre2RawValues = Libre2RawValue.latestForGraph(numValues * 5, start, end); plugin_adjusted = false; } finally { readings_lock.unlock(); } if ((end - start) > 80000000) { try { capturePercentage = ((bgReadings.size() * 100) / ((end - start) / 300000)); //Log.d(TAG, "CPTIMEPERIOD: " + Long.toString(end - start) + " percentage: " + JoH.qs(capturePercentage)); } catch (Exception e) { capturePercentage = -1; // invalid reading } } bloodtests = BloodTest.latestForGraph(numValues, start, end); // get extra calibrations so we can use them for historical readings calibrations = Calibration.latestForGraph(numValues, start - (3 * Constants.DAY_IN_MS), end); treatments = Treatments.latestForGraph(numValues, start, end + (120 * 60 * 1000)); this.context = context; this.highMark = tolerantParseDouble(prefs.getString("highValue", "170")); this.lowMark = tolerantParseDouble(prefs.getString("lowValue", "70")); this.doMgdl = (prefs.getString("units", "mgdl").equals("mgdl")); defaultMinY = unitized(40); defaultMaxY = unitized(250); pointSize = isXLargeTablet(context) ? 5 : 3; axisTextSize = isXLargeTablet(context) ? 20 : Axis.DEFAULT_TEXT_SIZE_SP; previewAxisTextSize = isXLargeTablet(context) ? 12 : 5; hoursPreviewStep = isXLargeTablet(context) ? 2 : 1; }