Skip to content

Commit

Permalink
Merge pull request StephenBlackWasAlreadyTaken#61 from AdrianLxM/minu…
Browse files Browse the repository at this point in the history
…te-ago-delta-reba

Minute ago delta rebased
  • Loading branch information
StephenBlackWasAlreadyTaken committed Jun 18, 2015
2 parents 7f6e1b4 + 94b4564 commit 80ab948
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion app/src/main/java/com/eveningoutpost/dexdrip/Home.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ public void onPause() {
public void updateCurrentBgInfo() {
final TextView notificationText = (TextView) findViewById(R.id.notices);
notificationText.setText("");
notificationText.setTextColor(Color.RED);
isBTWixel = CollectionServiceStarter.isBTWixel(getApplicationContext());
isDexbridgeWixel = CollectionServiceStarter.isDexbridgeWixel(getApplicationContext());
isBTShare = CollectionServiceStarter.isBTShare(getApplicationContext());
Expand Down Expand Up @@ -319,6 +320,9 @@ public void displayCurrentInfo() {
currentBgValueText.setPaintFlags(currentBgValueText.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
dexbridgeBattery.setPaintFlags(dexbridgeBattery.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
} else {
if (notificationText.getText().length()==0){
notificationText.setTextColor(Color.WHITE);
}
if (!predictive) {
estimate = lastBgreading.calculated_value;
String stringEstimate = bgGraphBuilder.unitized_string(estimate);
Expand All @@ -333,7 +337,15 @@ public void displayCurrentInfo() {
currentBgValueText.setText(stringEstimate + " " + BgReading.slopeArrow());
}
}
if (bgGraphBuilder.unitized(estimate) <= bgGraphBuilder.lowMark) {
int minutes = (int)(System.currentTimeMillis() - lastBgreading.timestamp) / (60 * 1000);
notificationText.append("\n" + minutes + ((minutes==1)?" Minute ago":" Minutes ago"));
List<BgReading> bgReadingList = BgReading.latest(2);
if(bgReadingList != null && bgReadingList.size() == 2) {
// same logic as in xDripWidget (refactor that to BGReadings to avoid redundancy / later inconsistencies)?
notificationText.append("\n"
+ bgGraphBuilder.unitizedDeltaString(lastBgreading.calculated_value - bgReadingList.get(1).calculated_value));
}
if(bgGraphBuilder.unitized(estimate) <= bgGraphBuilder.lowMark) {
currentBgValueText.setTextColor(Color.parseColor("#C30909"));
} else if (bgGraphBuilder.unitized(estimate) >= bgGraphBuilder.highMark) {
currentBgValueText.setTextColor(Color.parseColor("#FFBB33"));
Expand Down

0 comments on commit 80ab948

Please sign in to comment.