used isOlderThan

This commit is contained in:
Roumen Georgiev 2018-04-04 09:37:08 +03:00 committed by GitHub
parent d50f31e7a6
commit f284483500
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -217,12 +217,11 @@ public class CareportalFragment extends SubscriberFragment implements View.OnCli
if (sage != null) { if (sage != null) {
careportalEvent = MainApp.getDbHelper().getLastCareportalEvent(CareportalEvent.SENSORCHANGE); careportalEvent = MainApp.getDbHelper().getLastCareportalEvent(CareportalEvent.SENSORCHANGE);
if(careportalEvent != null) { if(careportalEvent != null) {
isOld = careportalEvent.age(7).substring(0, 5); if(careportalEvent.isOlderThan(7)){
if(isOld.equals("isOLD")){
sage.setTextColor(MainApp.sResources.getColor(R.color.low)); sage.setTextColor(MainApp.sResources.getColor(R.color.low));
sage.setText(careportalEvent.age(7).substring(5)); sage.setText(careportalEvent.age());
} else { } else {
sage.setText(careportalEvent.age(7)); sage.setText(careportalEvent.age());
} }
} else { } else {
@ -232,12 +231,11 @@ public class CareportalFragment extends SubscriberFragment implements View.OnCli
if (iage != null) { if (iage != null) {
careportalEvent = MainApp.getDbHelper().getLastCareportalEvent(CareportalEvent.INSULINCHANGE); careportalEvent = MainApp.getDbHelper().getLastCareportalEvent(CareportalEvent.INSULINCHANGE);
if(careportalEvent != null) { if(careportalEvent != null) {
isOld = careportalEvent.age(7).substring(0, 5); if(careportalEvent.isOlderThan(5)){
if(isOld.equals("isOLD")){
iage.setTextColor(MainApp.sResources.getColor(R.color.low)); iage.setTextColor(MainApp.sResources.getColor(R.color.low));
iage.setText(careportalEvent.age(7).substring(5)); iage.setText(careportalEvent.age());
} else { } else {
iage.setText(careportalEvent.age(7)); iage.setText(careportalEvent.age());
} }
} else { } else {
@ -247,12 +245,11 @@ public class CareportalFragment extends SubscriberFragment implements View.OnCli
if (cage != null) { if (cage != null) {
careportalEvent = MainApp.getDbHelper().getLastCareportalEvent(CareportalEvent.SITECHANGE); careportalEvent = MainApp.getDbHelper().getLastCareportalEvent(CareportalEvent.SITECHANGE);
if (careportalEvent != null) { if (careportalEvent != null) {
isOld = careportalEvent.age(3).substring(0, 5); if(careportalEvent.isOlderThan(3)){
if(isOld.equals("isOLD")){
cage.setTextColor(MainApp.sResources.getColor(R.color.low)); cage.setTextColor(MainApp.sResources.getColor(R.color.low));
cage.setText(careportalEvent.age(3).substring(5)); cage.setText(careportalEvent.age());
} else { } else {
cage.setText(careportalEvent.age(3)); cage.setText(careportalEvent.age());
} }
} else { } else {
@ -262,12 +259,11 @@ public class CareportalFragment extends SubscriberFragment implements View.OnCli
if (pbage != null) { if (pbage != null) {
careportalEvent = MainApp.getDbHelper().getLastCareportalEvent(CareportalEvent.PUMPBATTERYCHANGE); careportalEvent = MainApp.getDbHelper().getLastCareportalEvent(CareportalEvent.PUMPBATTERYCHANGE);
if(careportalEvent != null) { if(careportalEvent != null) {
isOld = careportalEvent.age(15).substring(0, 5); if(careportalEvent.isOlderThan(15)){
if(isOld.equals("isOLD")){
pbage.setTextColor(MainApp.sResources.getColor(R.color.low)); pbage.setTextColor(MainApp.sResources.getColor(R.color.low));
pbage.setText(careportalEvent.age(15).substring(5)); pbage.setText(careportalEvent.age());
} else { } else {
pbage.setText(careportalEvent.age(15)); pbage.setText(careportalEvent.age());
} }
} else { } else {