public void displayCurrentInfo() { final TextView currentBgValueText = (TextView) findViewById(R.id.currentBgValueRealTime); final TextView notificationText = (TextView) findViewById(R.id.notices); final TextView deltaText = (TextView) findViewById(R.id.bgDelta); if ((currentBgValueText.getPaintFlags() & Paint.STRIKE_THRU_TEXT_FLAG) > 0) { currentBgValueText.setPaintFlags( currentBgValueText.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG)); } Bg lastBgreading = Bg.last(); if (lastBgreading != null) { notificationText.setText(lastBgreading.readingAge()); String bgDelta = new String(String.format(Locale.ENGLISH, "%.2f", lastBgreading.bgdelta)); if (lastBgreading.bgdelta >= 0) bgDelta = "+" + bgDelta; deltaText.setText(bgDelta); currentBgValueText.setText( extendedGraphBuilder.unitized_string(lastBgreading.sgv_double()) + " " + lastBgreading.slopeArrow()); if ((new Date().getTime()) - (60000 * 16) - lastBgreading.datetime > 0) { notificationText.setTextColor(Color.parseColor("#C30909")); currentBgValueText.setPaintFlags( currentBgValueText.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); } else { notificationText.setTextColor(Color.WHITE); } double estimate = lastBgreading.sgv_double(); if (extendedGraphBuilder.unitized(estimate) <= extendedGraphBuilder.lowMark) { currentBgValueText.setTextColor(Color.parseColor("#C30909")); } else if (extendedGraphBuilder.unitized(estimate) >= extendedGraphBuilder.highMark) { currentBgValueText.setTextColor(Color.parseColor("#FFBB33")); } else { currentBgValueText.setTextColor(Color.WHITE); } } // Stats age update statsAge = (TextView) findViewById(R.id.statsAge); Stats lastRun = Stats.last(); if (lastRun != null) statsAge.setText(lastRun.statAge()); // OpenAPS age update openAPSAgeTextView = (TextView) findViewById(R.id.openapsAge); openAPSAgeTextView.setText(openAPSFragment.age()); // Temp Basal running update Date timeNow = new Date(); sysMsg = (TextView) findViewById(R.id.sysmsg); TempBasal lastTempBasal = TempBasal.last(); String appStatus; if (lastTempBasal.isactive(null)) { // Active temp Basal appStatus = lastTempBasal.basal_adjustemnt + " Temp active: " + lastTempBasal.rate + "U(" + lastTempBasal.ratePercent + "%) " + lastTempBasal.durationLeft() + "mins left"; } else { // No temp Basal running, show default Double currentBasal = Profile.ProfileAsOf(timeNow, this.getBaseContext()).current_basal; appStatus = "No temp basal, current basal: " + currentBasal + "U"; } sysMsg.setText(appStatus); }