Merge pull request #1518 from osodebailar/features/gac_for_pumps_status_color
Theme switcher preparation: gac for pumps - status color
This commit is contained in:
commit
72ed212d37
21 changed files with 282 additions and 187 deletions
|
@ -142,7 +142,7 @@ class OverviewData @Inject constructor(
|
||||||
fun lastBgColor(context: Context?): Int {
|
fun lastBgColor(context: Context?): Int {
|
||||||
return when {
|
return when {
|
||||||
isLow -> rh.gac(context, R.attr.bgLow)
|
isLow -> rh.gac(context, R.attr.bgLow)
|
||||||
isHigh -> rh.gac(context, R.attr.bgHigh)
|
isHigh -> rh.gac(context, R.attr.highColor)
|
||||||
else -> rh.gac(context, R.attr.bgInRange)
|
else -> rh.gac(context, R.attr.bgInRange)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ class StatusLightHandler @Inject constructor(
|
||||||
handleLevel(careportal_battery_level, R.string.key_statuslights_bat_critical, 26.0, R.string.key_statuslights_bat_warning, 51.0, pump.batteryLevel.toDouble(), "%")
|
handleLevel(careportal_battery_level, R.string.key_statuslights_bat_critical, 26.0, R.string.key_statuslights_bat_warning, 51.0, pump.batteryLevel.toDouble(), "%")
|
||||||
} else {
|
} else {
|
||||||
careportal_battery_level?.text = rh.gs(R.string.notavailable)
|
careportal_battery_level?.text = rh.gs(R.string.notavailable)
|
||||||
careportal_battery_level?.setTextColor(Color.WHITE)
|
careportal_battery_level?.setTextColor(rh.gac(careportal_battery_level.context, R.attr.defaultTextColor))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
<path
|
<path
|
||||||
android:pathData="M20.234,10.422c-0.362,0 -0.656,0.294 -0.656,0.656v0.297h-0.469V9.031c0,-0.87 -0.708,-1.578 -1.578,-1.578H4.188c-0.87,0 -1.578,0.708 -1.578,1.578v5.938c0,0.87 0.708,1.578 1.578,1.578h13.344c0.72,0 1.323,-0.488 1.511,-1.149c0.01,0.001 0.018,0.006 0.028,0.006c0.332,0 0.602,-0.297 0.602,-0.664c0,-0.351 -0.25,-0.632 -0.563,-0.655v-1.46h0.469v0.297c0,0.362 0.294,0.656 0.656,0.656s0.656,-0.294 0.656,-0.656v-1.844C20.891,10.716 20.597,10.422 20.234,10.422zM18.109,14.969c0,0.318 -0.26,0.578 -0.578,0.578H4.188c-0.319,0 -0.578,-0.26 -0.578,-0.578V9.031c0,-0.319 0.259,-0.578 0.578,-0.578h13.344c0.318,0 0.578,0.259 0.578,0.578V14.969z"
|
android:pathData="M20.234,10.422c-0.362,0 -0.656,0.294 -0.656,0.656v0.297h-0.469V9.031c0,-0.87 -0.708,-1.578 -1.578,-1.578H4.188c-0.87,0 -1.578,0.708 -1.578,1.578v5.938c0,0.87 0.708,1.578 1.578,1.578h13.344c0.72,0 1.323,-0.488 1.511,-1.149c0.01,0.001 0.018,0.006 0.028,0.006c0.332,0 0.602,-0.297 0.602,-0.664c0,-0.351 -0.25,-0.632 -0.563,-0.655v-1.46h0.469v0.297c0,0.362 0.294,0.656 0.656,0.656s0.656,-0.294 0.656,-0.656v-1.844C20.891,10.716 20.597,10.422 20.234,10.422zM18.109,14.969c0,0.318 -0.26,0.578 -0.578,0.578H4.188c-0.319,0 -0.578,-0.26 -0.578,-0.578V9.031c0,-0.319 0.259,-0.578 0.578,-0.578h13.344c0.318,0 0.578,0.259 0.578,0.578V14.969z"
|
||||||
android:strokeAlpha="0.5"
|
android:strokeAlpha="0.5"
|
||||||
android:fillColor="#FFFFFF"
|
android:fillColor="?attr/colorControlNormal"
|
||||||
android:fillAlpha="0.5"/>
|
android:fillAlpha="0.5"/>
|
||||||
<path
|
<path
|
||||||
android:pathData="M9.703,10.273l-3.937,2.922l3.453,-1.218l1.781,1.765l4.438,-3.484l-4.297,1.687z"
|
android:pathData="M9.703,10.273l-3.937,2.922l3.453,-1.218l1.781,1.765l4.438,-3.484l-4.297,1.687z"
|
||||||
android:strokeAlpha="0.5"
|
android:strokeAlpha="0.5"
|
||||||
android:fillColor="#FFFFFF"
|
android:fillColor="?attr/colorControlNormal"
|
||||||
android:fillAlpha="0.5"/>
|
android:fillAlpha="0.5"/>
|
||||||
</vector>
|
</vector>
|
||||||
|
|
|
@ -6,6 +6,6 @@
|
||||||
<path
|
<path
|
||||||
android:pathData="M20.951,10.458h-1.99c-0.054,-0.733 -0.659,-1.313 -1.406,-1.313h-2.354c-0.747,0 -1.352,0.58 -1.406,1.313h-1.99c-0.388,0 -0.696,0.27 -0.771,0.622c-1.32,-0.021 -2.226,-0.555 -2.936,-0.999c-0.7,-0.437 -1.304,-0.814 -2.005,-0.434c-1.202,0.654 -0.843,2.024 -0.554,3.126c0.192,0.731 0.39,1.489 0.098,1.836c-0.603,0.718 -2.212,0.276 -2.781,0.045c-0.143,-0.057 -0.31,0.011 -0.369,0.156c-0.059,0.146 0.011,0.311 0.156,0.369c0.061,0.024 0.971,0.388 1.893,0.388c0.574,0 1.153,-0.142 1.534,-0.593c0.482,-0.571 0.256,-1.433 0.017,-2.345c-0.323,-1.234 -0.479,-2.074 0.276,-2.485c0.392,-0.213 0.762,-0.003 1.434,0.417c0.755,0.471 1.766,1.123 3.359,1.096C11.301,11.859 11.531,12 11.806,12h4.406v5.771l0.333,-0.854V12h4.406c0.443,0 0.802,-0.345 0.802,-0.771S21.394,10.458 20.951,10.458z"
|
android:pathData="M20.951,10.458h-1.99c-0.054,-0.733 -0.659,-1.313 -1.406,-1.313h-2.354c-0.747,0 -1.352,0.58 -1.406,1.313h-1.99c-0.388,0 -0.696,0.27 -0.771,0.622c-1.32,-0.021 -2.226,-0.555 -2.936,-0.999c-0.7,-0.437 -1.304,-0.814 -2.005,-0.434c-1.202,0.654 -0.843,2.024 -0.554,3.126c0.192,0.731 0.39,1.489 0.098,1.836c-0.603,0.718 -2.212,0.276 -2.781,0.045c-0.143,-0.057 -0.31,0.011 -0.369,0.156c-0.059,0.146 0.011,0.311 0.156,0.369c0.061,0.024 0.971,0.388 1.893,0.388c0.574,0 1.153,-0.142 1.534,-0.593c0.482,-0.571 0.256,-1.433 0.017,-2.345c-0.323,-1.234 -0.479,-2.074 0.276,-2.485c0.392,-0.213 0.762,-0.003 1.434,0.417c0.755,0.471 1.766,1.123 3.359,1.096C11.301,11.859 11.531,12 11.806,12h4.406v5.771l0.333,-0.854V12h4.406c0.443,0 0.802,-0.345 0.802,-0.771S21.394,10.458 20.951,10.458z"
|
||||||
android:strokeAlpha="0.5"
|
android:strokeAlpha="0.5"
|
||||||
android:fillColor="#FFFFFF"
|
android:fillColor="?attr/colorControlNormal"
|
||||||
android:fillAlpha="0.5"/>
|
android:fillAlpha="0.5"/>
|
||||||
</vector>
|
</vector>
|
||||||
|
|
|
@ -6,6 +6,6 @@
|
||||||
<path
|
<path
|
||||||
android:pathData="M19.455,9.988l-0.947,-1.652c-0.144,-0.252 -0.482,-0.329 -0.753,-0.174c-0.171,0.098 -0.266,0.267 -0.283,0.44l-1.149,-0.585c-0.093,-0.042 -0.202,-0.037 -0.292,0.015l-9.796,5.614l-0.156,-0.271c-0.187,-0.326 -0.61,-0.434 -0.945,-0.242c-0.336,0.192 -0.456,0.612 -0.269,0.938l2.747,4.79c0.187,0.326 0.61,0.434 0.945,0.242c0.336,-0.192 0.456,-0.612 0.269,-0.938L8.67,17.896l9.796,-5.614c0.09,-0.052 0.15,-0.143 0.16,-0.244l0.076,-1.289c0.158,0.072 0.351,0.076 0.522,-0.022C19.496,10.57 19.599,10.239 19.455,9.988zM17.407,12.176l-1.127,-1.769c-0.055,-0.086 -0.172,-0.11 -0.261,-0.054c-0.086,0.055 -0.115,0.165 -0.066,0.251c0.001,0.002 0.003,0.005 0.004,0.007l1.118,1.755l-0.752,0.431l-1.127,-1.769c-0.055,-0.086 -0.172,-0.111 -0.261,-0.054c-0.086,0.054 -0.115,0.165 -0.066,0.251c0.001,0.002 0.003,0.005 0.004,0.007l1.118,1.755l-0.752,0.431l-1.127,-1.769c-0.055,-0.086 -0.172,-0.111 -0.261,-0.054c-0.087,0.055 -0.115,0.165 -0.066,0.251c0.001,0.002 0.003,0.005 0.004,0.007l1.118,1.755l-0.655,0.375l-1.552,-2.482c-0.053,-0.084 -0.165,-0.111 -0.254,-0.06L6.82,14.666l-0.277,-0.483l9.652,-5.532l1.685,0.87l0.236,0.412l-0.101,1.894L17.407,12.176z"
|
android:pathData="M19.455,9.988l-0.947,-1.652c-0.144,-0.252 -0.482,-0.329 -0.753,-0.174c-0.171,0.098 -0.266,0.267 -0.283,0.44l-1.149,-0.585c-0.093,-0.042 -0.202,-0.037 -0.292,0.015l-9.796,5.614l-0.156,-0.271c-0.187,-0.326 -0.61,-0.434 -0.945,-0.242c-0.336,0.192 -0.456,0.612 -0.269,0.938l2.747,4.79c0.187,0.326 0.61,0.434 0.945,0.242c0.336,-0.192 0.456,-0.612 0.269,-0.938L8.67,17.896l9.796,-5.614c0.09,-0.052 0.15,-0.143 0.16,-0.244l0.076,-1.289c0.158,0.072 0.351,0.076 0.522,-0.022C19.496,10.57 19.599,10.239 19.455,9.988zM17.407,12.176l-1.127,-1.769c-0.055,-0.086 -0.172,-0.11 -0.261,-0.054c-0.086,0.055 -0.115,0.165 -0.066,0.251c0.001,0.002 0.003,0.005 0.004,0.007l1.118,1.755l-0.752,0.431l-1.127,-1.769c-0.055,-0.086 -0.172,-0.111 -0.261,-0.054c-0.086,0.054 -0.115,0.165 -0.066,0.251c0.001,0.002 0.003,0.005 0.004,0.007l1.118,1.755l-0.752,0.431l-1.127,-1.769c-0.055,-0.086 -0.172,-0.111 -0.261,-0.054c-0.087,0.055 -0.115,0.165 -0.066,0.251c0.001,0.002 0.003,0.005 0.004,0.007l1.118,1.755l-0.655,0.375l-1.552,-2.482c-0.053,-0.084 -0.165,-0.111 -0.254,-0.06L6.82,14.666l-0.277,-0.483l9.652,-5.532l1.685,0.87l0.236,0.412l-0.101,1.894L17.407,12.176z"
|
||||||
android:strokeAlpha="0.5"
|
android:strokeAlpha="0.5"
|
||||||
android:fillColor="#FFFFFF"
|
android:fillColor="?attr/colorControlNormal"
|
||||||
android:fillAlpha="0.5"/>
|
android:fillAlpha="0.5"/>
|
||||||
</vector>
|
</vector>
|
||||||
|
|
|
@ -6,16 +6,16 @@
|
||||||
<path
|
<path
|
||||||
android:pathData="M13.568,13.328c0.673,0 1.219,-0.546 1.219,-1.219s-0.546,-1.219 -1.219,-1.219c-0.493,0 -0.913,0.296 -1.105,0.718h-1.603L9.464,8.126c-0.078,-0.195 -0.246,-0.309 -0.48,-0.314c-0.21,0.006 -0.394,0.144 -0.459,0.343l-2.16,6.53l-1.131,-2.751c-0.077,-0.188 -0.26,-0.31 -0.463,-0.31h-2c-0.276,0 -0.5,0.224 -0.5,0.5s0.224,0.5 0.5,0.5h1.665l1.518,3.69c0.078,0.188 0.261,0.31 0.463,0.31c0.006,0 0.012,0 0.018,0c0.209,-0.008 0.392,-0.145 0.458,-0.343L9.045,9.77l1.012,2.525c0.076,0.19 0.26,0.314 0.464,0.314h1.941C12.654,13.031 13.074,13.328 13.568,13.328z"
|
android:pathData="M13.568,13.328c0.673,0 1.219,-0.546 1.219,-1.219s-0.546,-1.219 -1.219,-1.219c-0.493,0 -0.913,0.296 -1.105,0.718h-1.603L9.464,8.126c-0.078,-0.195 -0.246,-0.309 -0.48,-0.314c-0.21,0.006 -0.394,0.144 -0.459,0.343l-2.16,6.53l-1.131,-2.751c-0.077,-0.188 -0.26,-0.31 -0.463,-0.31h-2c-0.276,0 -0.5,0.224 -0.5,0.5s0.224,0.5 0.5,0.5h1.665l1.518,3.69c0.078,0.188 0.261,0.31 0.463,0.31c0.006,0 0.012,0 0.018,0c0.209,-0.008 0.392,-0.145 0.458,-0.343L9.045,9.77l1.012,2.525c0.076,0.19 0.26,0.314 0.464,0.314h1.941C12.654,13.031 13.074,13.328 13.568,13.328z"
|
||||||
android:strokeAlpha="0.5"
|
android:strokeAlpha="0.5"
|
||||||
android:fillColor="#FFFFFF"
|
android:fillColor="?attr/colorControlNormal"
|
||||||
android:fillAlpha="0.5"/>
|
android:fillAlpha="0.5"/>
|
||||||
<path
|
<path
|
||||||
android:pathData="M13.567,15.055c-0.276,0 -0.5,0.224 -0.5,0.5s0.224,0.5 0.5,0.5c2.176,0 3.945,-1.77 3.945,-3.945s-1.77,-3.946 -3.945,-3.946c-0.276,0 -0.5,0.224 -0.5,0.5s0.224,0.5 0.5,0.5c1.624,0 2.945,1.321 2.945,2.945S15.191,15.055 13.567,15.055z"
|
android:pathData="M13.567,15.055c-0.276,0 -0.5,0.224 -0.5,0.5s0.224,0.5 0.5,0.5c2.176,0 3.945,-1.77 3.945,-3.945s-1.77,-3.946 -3.945,-3.946c-0.276,0 -0.5,0.224 -0.5,0.5s0.224,0.5 0.5,0.5c1.624,0 2.945,1.321 2.945,2.945S15.191,15.055 13.567,15.055z"
|
||||||
android:strokeAlpha="0.5"
|
android:strokeAlpha="0.5"
|
||||||
android:fillColor="#FFFFFF"
|
android:fillColor="?attr/colorControlNormal"
|
||||||
android:fillAlpha="0.5"/>
|
android:fillAlpha="0.5"/>
|
||||||
<path
|
<path
|
||||||
android:pathData="M13.567,5.14c-0.276,0 -0.5,0.224 -0.5,0.5s0.224,0.5 0.5,0.5c3.291,0 5.969,2.677 5.969,5.968s-2.678,5.969 -5.969,5.969c-0.276,0 -0.5,0.224 -0.5,0.5s0.224,0.5 0.5,0.5c3.843,0 6.969,-3.126 6.969,-6.969S17.41,5.14 13.567,5.14z"
|
android:pathData="M13.567,5.14c-0.276,0 -0.5,0.224 -0.5,0.5s0.224,0.5 0.5,0.5c3.291,0 5.969,2.677 5.969,5.968s-2.678,5.969 -5.969,5.969c-0.276,0 -0.5,0.224 -0.5,0.5s0.224,0.5 0.5,0.5c3.843,0 6.969,-3.126 6.969,-6.969S17.41,5.14 13.567,5.14z"
|
||||||
android:strokeAlpha="0.5"
|
android:strokeAlpha="0.5"
|
||||||
android:fillColor="#FFFFFF"
|
android:fillColor="?attr/colorControlNormal"
|
||||||
android:fillAlpha="0.5"/>
|
android:fillAlpha="0.5"/>
|
||||||
</vector>
|
</vector>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
<path
|
<path
|
||||||
android:fillAlpha="0.5"
|
android:fillAlpha="0.5"
|
||||||
android:fillColor="#FFFFFF"
|
android:fillColor="?attr/colorControlNormal"
|
||||||
android:pathData="M 18 54 a 3 3 0 0 0 3 3 L 45 57 A 19 19 0 0 0 62 40 A 19 19 0 0 0 45 24 L 21 24 a 3 3 0 0 0 -3 3 Z M 67 40 A 22 22 0 0 1 45 62 L 19 62 a 6 6 0 0 1 -6 -6 L 13 25 a 6 6 0 0 1 6 -6 L 45 19 A 22 22 0 0 1 67 40"
|
android:pathData="M 18 54 a 3 3 0 0 0 3 3 L 45 57 A 19 19 0 0 0 62 40 A 19 19 0 0 0 45 24 L 21 24 a 3 3 0 0 0 -3 3 Z M 67 40 A 22 22 0 0 1 45 62 L 19 62 a 6 6 0 0 1 -6 -6 L 13 25 a 6 6 0 0 1 6 -6 L 45 19 A 22 22 0 0 1 67 40"
|
||||||
android:strokeAlpha="0.5" />
|
android:strokeAlpha="0.5" />
|
||||||
|
|
||||||
|
|
|
@ -134,33 +134,33 @@ public class ComboFragment extends DaggerFragment {
|
||||||
PumpState ps = comboPlugin.getPump().state;
|
PumpState ps = comboPlugin.getPump().state;
|
||||||
if (ps.insulinState == PumpState.EMPTY || ps.batteryState == PumpState.EMPTY
|
if (ps.insulinState == PumpState.EMPTY || ps.batteryState == PumpState.EMPTY
|
||||||
|| ps.activeAlert != null && ps.activeAlert.errorCode != null) {
|
|| ps.activeAlert != null && ps.activeAlert.errorCode != null) {
|
||||||
stateView.setTextColor(Color.RED);
|
stateView.setTextColor(rh.gac(getContext(), R.attr.warningColor));
|
||||||
stateView.setTypeface(null, Typeface.BOLD);
|
stateView.setTypeface(null, Typeface.BOLD);
|
||||||
} else if (comboPlugin.getPump().state.suspended
|
} else if (comboPlugin.getPump().state.suspended
|
||||||
|| ps.activeAlert != null && ps.activeAlert.warningCode != null) {
|
|| ps.activeAlert != null && ps.activeAlert.warningCode != null) {
|
||||||
stateView.setTextColor(Color.YELLOW);
|
stateView.setTextColor(rh.gac(getContext(), R.attr.omniYellowColor));
|
||||||
stateView.setTypeface(null, Typeface.BOLD);
|
stateView.setTypeface(null, Typeface.BOLD);
|
||||||
} else {
|
} else {
|
||||||
stateView.setTextColor(Color.WHITE);
|
stateView.setTextColor(rh.gac(getContext(), R.attr.defaultTextColor));
|
||||||
stateView.setTypeface(null, Typeface.NORMAL);
|
stateView.setTypeface(null, Typeface.NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// activity
|
// activity
|
||||||
String activity = comboPlugin.getPump().activity;
|
String activity = comboPlugin.getPump().activity;
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
activityView.setTextColor(Color.WHITE);
|
activityView.setTextColor(rh.gac(getContext(), R.attr.defaultTextColor));
|
||||||
activityView.setTextSize(14);
|
activityView.setTextSize(14);
|
||||||
activityView.setText(activity);
|
activityView.setText(activity);
|
||||||
} else if (commandQueue.size() > 0) {
|
} else if (commandQueue.size() > 0) {
|
||||||
activityView.setTextColor(Color.WHITE);
|
activityView.setTextColor(rh.gac(getContext(), R.attr.defaultTextColor));
|
||||||
activityView.setTextSize(14);
|
activityView.setTextSize(14);
|
||||||
activityView.setText("");
|
activityView.setText("");
|
||||||
} else if (comboPlugin.isInitialized()) {
|
} else if (comboPlugin.isInitialized()) {
|
||||||
activityView.setTextColor(Color.WHITE);
|
activityView.setTextColor(rh.gac(getContext(), R.attr.defaultTextColor));
|
||||||
activityView.setTextSize(20);
|
activityView.setTextSize(20);
|
||||||
activityView.setText("{fa-bed}");
|
activityView.setText("{fa-bed}");
|
||||||
} else {
|
} else {
|
||||||
activityView.setTextColor(Color.RED);
|
activityView.setTextColor(rh.gac(getContext(), R.attr.warningColor));
|
||||||
activityView.setTextSize(14);
|
activityView.setTextSize(14);
|
||||||
activityView.setText(rh.gs(R.string.pump_unreachable));
|
activityView.setText(rh.gs(R.string.pump_unreachable));
|
||||||
}
|
}
|
||||||
|
@ -170,10 +170,10 @@ public class ComboFragment extends DaggerFragment {
|
||||||
batteryView.setTextSize(20);
|
batteryView.setTextSize(20);
|
||||||
if (ps.batteryState == PumpState.EMPTY) {
|
if (ps.batteryState == PumpState.EMPTY) {
|
||||||
batteryView.setText("{fa-battery-empty}");
|
batteryView.setText("{fa-battery-empty}");
|
||||||
batteryView.setTextColor(Color.RED);
|
batteryView.setTextColor(rh.gac(getContext(), R.attr.warningColor));
|
||||||
} else if (ps.batteryState == PumpState.LOW) {
|
} else if (ps.batteryState == PumpState.LOW) {
|
||||||
batteryView.setText("{fa-battery-quarter}");
|
batteryView.setText("{fa-battery-quarter}");
|
||||||
batteryView.setTextColor(Color.YELLOW);
|
batteryView.setTextColor(rh.gac(getContext(), R.attr.omniYellowColor));
|
||||||
} else {
|
} else {
|
||||||
batteryView.setText("{fa-battery-full}");
|
batteryView.setText("{fa-battery-full}");
|
||||||
batteryView.setTextColor(Color.WHITE);
|
batteryView.setTextColor(Color.WHITE);
|
||||||
|
@ -192,16 +192,16 @@ public class ComboFragment extends DaggerFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ps.insulinState == PumpState.UNKNOWN) {
|
if (ps.insulinState == PumpState.UNKNOWN) {
|
||||||
reservoirView.setTextColor(Color.WHITE);
|
reservoirView.setTextColor(rh.gac(getContext(), R.attr.defaultTextColor));
|
||||||
reservoirView.setTypeface(null, Typeface.NORMAL);
|
reservoirView.setTypeface(null, Typeface.NORMAL);
|
||||||
} else if (ps.insulinState == PumpState.LOW) {
|
} else if (ps.insulinState == PumpState.LOW) {
|
||||||
reservoirView.setTextColor(Color.YELLOW);
|
reservoirView.setTextColor(rh.gac(getContext(), R.attr.omniYellowColor));
|
||||||
reservoirView.setTypeface(null, Typeface.BOLD);
|
reservoirView.setTypeface(null, Typeface.BOLD);
|
||||||
} else if (ps.insulinState == PumpState.EMPTY) {
|
} else if (ps.insulinState == PumpState.EMPTY) {
|
||||||
reservoirView.setTextColor(Color.RED);
|
reservoirView.setTextColor(rh.gac(getContext(), R.attr.warningColor));
|
||||||
reservoirView.setTypeface(null, Typeface.BOLD);
|
reservoirView.setTypeface(null, Typeface.BOLD);
|
||||||
} else {
|
} else {
|
||||||
reservoirView.setTextColor(Color.WHITE);
|
reservoirView.setTextColor(rh.gac(getContext(), R.attr.defaultTextColor));
|
||||||
reservoirView.setTypeface(null, Typeface.NORMAL);
|
reservoirView.setTypeface(null, Typeface.NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,13 +210,13 @@ public class ComboFragment extends DaggerFragment {
|
||||||
long min = (System.currentTimeMillis() - comboPlugin.getPump().lastSuccessfulCmdTime) / 1000 / 60;
|
long min = (System.currentTimeMillis() - comboPlugin.getPump().lastSuccessfulCmdTime) / 1000 / 60;
|
||||||
if (comboPlugin.getPump().lastSuccessfulCmdTime + 60 * 1000 > System.currentTimeMillis()) {
|
if (comboPlugin.getPump().lastSuccessfulCmdTime + 60 * 1000 > System.currentTimeMillis()) {
|
||||||
lastConnectionView.setText(R.string.combo_pump_connected_now);
|
lastConnectionView.setText(R.string.combo_pump_connected_now);
|
||||||
lastConnectionView.setTextColor(Color.WHITE);
|
lastConnectionView.setTextColor(rh.gac(getContext(), R.attr.defaultTextColor));
|
||||||
} else if (comboPlugin.getPump().lastSuccessfulCmdTime + 30 * 60 * 1000 < System.currentTimeMillis()) {
|
} else if (comboPlugin.getPump().lastSuccessfulCmdTime + 30 * 60 * 1000 < System.currentTimeMillis()) {
|
||||||
lastConnectionView.setText(rh.gs(R.string.combo_no_pump_connection, min));
|
lastConnectionView.setText(rh.gs(R.string.combo_no_pump_connection, min));
|
||||||
lastConnectionView.setTextColor(Color.RED);
|
lastConnectionView.setTextColor(rh.gac(getContext(), R.attr.warningColor));
|
||||||
} else {
|
} else {
|
||||||
lastConnectionView.setText(minAgo);
|
lastConnectionView.setText(minAgo);
|
||||||
lastConnectionView.setTextColor(Color.WHITE);
|
lastConnectionView.setTextColor(rh.gac(getContext(), R.attr.defaultTextColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
// last bolus
|
// last bolus
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package info.nightscout.androidaps.utils
|
package info.nightscout.androidaps.utils
|
||||||
|
|
||||||
import android.graphics.Color
|
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import info.nightscout.androidaps.core.R
|
import info.nightscout.androidaps.core.R
|
||||||
import info.nightscout.androidaps.database.entities.TherapyEvent
|
import info.nightscout.androidaps.database.entities.TherapyEvent
|
||||||
|
@ -12,28 +11,25 @@ import javax.inject.Singleton
|
||||||
@Singleton
|
@Singleton
|
||||||
class WarnColors @Inject constructor(val rh: ResourceHelper) {
|
class WarnColors @Inject constructor(val rh: ResourceHelper) {
|
||||||
|
|
||||||
private val normalColor = Color.WHITE
|
|
||||||
private val warnColor = Color.YELLOW
|
|
||||||
private val urgentColor = Color.RED
|
|
||||||
|
|
||||||
fun setColor(view: TextView?, value: Double, warnLevel: Double, urgentLevel: Double) =
|
fun setColor(view: TextView?, value: Double, warnLevel: Double, urgentLevel: Double) =
|
||||||
view?.setTextColor(when {
|
view?.setTextColor( rh.gac( view.context ,when {
|
||||||
value >= urgentLevel -> urgentColor
|
value >= urgentLevel -> R.attr.urgentColor
|
||||||
value >= warnLevel -> warnColor
|
value >= warnLevel -> R.attr.warnColor
|
||||||
else -> normalColor
|
else -> R.attr.defaultTextColor
|
||||||
})
|
}))
|
||||||
|
|
||||||
fun setColorInverse(view: TextView?, value: Double, warnLevel: Double, urgentLevel: Double) =
|
fun setColorInverse(view: TextView?, value: Double, warnLevel: Double, urgentLevel: Double) =
|
||||||
view?.setTextColor(when {
|
view?.setTextColor( rh.gac( view.context , when {
|
||||||
value <= urgentLevel -> urgentColor
|
value <= urgentLevel -> R.attr.urgentColor
|
||||||
value <= warnLevel -> warnColor
|
value <= warnLevel -> R.attr.warnColor
|
||||||
else -> normalColor
|
else -> R.attr.defaultTextColor
|
||||||
})
|
}))
|
||||||
|
|
||||||
fun setColorByAge(view: TextView?, therapyEvent: TherapyEvent, warnThreshold: Double, urgentThreshold: Double) =
|
fun setColorByAge(view: TextView?, therapyEvent: TherapyEvent, warnThreshold: Double, urgentThreshold: Double) =
|
||||||
view?.setTextColor(when {
|
view?.setTextColor( rh.gac( view.context , when {
|
||||||
therapyEvent.isOlderThan(urgentThreshold) -> rh.gc(R.color.low)
|
therapyEvent.isOlderThan(urgentThreshold) -> R.attr.lowColor
|
||||||
therapyEvent.isOlderThan(warnThreshold) -> rh.gc(R.color.high)
|
therapyEvent.isOlderThan(warnThreshold) -> R.attr.highColor
|
||||||
else -> Color.WHITE
|
else -> R.attr.defaultTextColor
|
||||||
})
|
}))
|
||||||
}
|
}
|
|
@ -212,9 +212,64 @@
|
||||||
<color name="sphere_plastic_grey">#8c8c8c</color>
|
<color name="sphere_plastic_grey">#8c8c8c</color>
|
||||||
<color name="lightSandGray">#72000000</color>
|
<color name="lightSandGray">#72000000</color>
|
||||||
<color name="sandGray">#c8666666</color>
|
<color name="sandGray">#c8666666</color>
|
||||||
<color name="treatment">#B2B2B2</color>
|
<color name="midgray">#B2B2B2</color>
|
||||||
<color name="lightgray">#4dB1B1B1</color>
|
<color name="lightgray">#4dB1B1B1</color>
|
||||||
<color name="mdtp_button_selected">#33969696</color>
|
<color name="mdtp_button_selected">#33969696</color>
|
||||||
<color name="plastic">#EBEBEA</color>
|
<color name="plastic">#EBEBEA</color>
|
||||||
|
|
||||||
|
<!-- dash and eros colors -->
|
||||||
|
<color name="omni_yellow">#FFFF00</color>
|
||||||
|
<color name="omni_cyan">#00FFFF</color>
|
||||||
|
<color name="omni_green">#00FF00</color>
|
||||||
|
|
||||||
|
<!-- Button icons - general -->
|
||||||
|
<color name="pod_icon_outline">#9E9E9E</color>
|
||||||
|
|
||||||
|
<!-- Omnipod Wizard -->
|
||||||
|
<color name="omnipod_wizard_progress_bar">#0099CC</color>
|
||||||
|
<color name="omnipod_wizard_finish_button">#ff669900</color>
|
||||||
|
<color name="icon_omnipod_wizard_success">#77DD77</color>
|
||||||
|
|
||||||
|
<!-- Omnipod tab - Button icons -->
|
||||||
|
<color name="ic_omnipod_overview_acknowledge_alerts">#FF4444</color>
|
||||||
|
<color name="ic_omnipod_overview_acknowledge_alerts_outline">@color/pod_icon_outline</color>
|
||||||
|
<color name="ic_omnipod_overview_pod_management">#4CAF50</color>
|
||||||
|
<color name="ic_omnipod_overview_pod_management_graph">@color/pod_icon_outline</color>
|
||||||
|
<color name="ic_omnipod_overview_pod_management_outline">@color/pod_icon_outline</color>
|
||||||
|
<color name="ic_omnipod_overview_refresh_pod_status">#42A5F5</color>
|
||||||
|
<color name="ic_omnipod_overview_refresh_pod_status_outline">@color/pod_icon_outline</color>
|
||||||
|
<color name="ic_omnipod_overview_resume_delivery">#67E86A</color>
|
||||||
|
<color name="ic_omnipod_overview_resume_delivery_outline">@color/pod_icon_outline</color>
|
||||||
|
<color name="ic_omnipod_overview_set_time">#B39DDB</color>
|
||||||
|
<color name="ic_omnipod_overview_set_time_outline">@color/pod_icon_outline</color>
|
||||||
|
<color name="ic_omnipod_overview_suspend_delivery">#ffbf00</color>
|
||||||
|
<color name="ic_omnipod_overview_suspend_delivery_outline">@color/pod_icon_outline</color>
|
||||||
|
|
||||||
|
<!-- Pod Management - Button icons -->
|
||||||
|
<color name="ic_pod_management_activate_pod">#67E86A</color>
|
||||||
|
<color name="ic_pod_management_activate_pod_outline">@color/pod_icon_outline</color>
|
||||||
|
<color name="ic_pod_management_deactivate_pod">#FF4444</color>
|
||||||
|
<color name="ic_pod_management_deactivate_pod_outline">@color/pod_icon_outline</color>
|
||||||
|
<color name="ic_pod_management_discard_pod">#85F803</color>
|
||||||
|
<color name="ic_pod_management_discard_pod_outline">@color/pod_icon_outline</color>
|
||||||
|
<color name="ic_pod_management_play_test_beep">#ffbf00</color>
|
||||||
|
<color name="ic_pod_management_play_test_beep_outline">@color/pod_icon_outline</color>
|
||||||
|
<color name="ic_pod_management_pulse_log">#4DD0E1</color>
|
||||||
|
<color name="ic_pod_management_pulse_log_outline">@color/pod_icon_outline</color>
|
||||||
|
<color name="ic_pod_management_pod_history">#FB8C00</color>
|
||||||
|
<color name="ic_pod_management_pod_history_outline">@color/pod_icon_outline</color>
|
||||||
|
|
||||||
|
<!-- Button icons - general -->
|
||||||
|
<color name="rl_icon_outline">#b9d2d2</color>
|
||||||
|
<color name="rl_board_shape">#66BB6A</color>
|
||||||
|
<color name="rl_antenna_shape">#FF7043</color>
|
||||||
|
|
||||||
|
<!-- Actions tab - Button icons -->
|
||||||
|
<color name="ic_pod_activity_reset_rileylink_config">@color/rl_board_shape</color>
|
||||||
|
<color name="ic_pod_activity_reset_rileylink_config_outline">@color/rl_icon_outline</color>
|
||||||
|
|
||||||
|
<!-- Pod Management - Button icons -->
|
||||||
|
<color name="ic_pod_management_rl_stats">@color/rl_board_shape</color>
|
||||||
|
<color name="ic_pod_management_rl_stats_outline">@color/rl_icon_outline</color>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -125,7 +125,7 @@
|
||||||
<item name="cgmxdripColor">@color/colorCalibrationButton</item>
|
<item name="cgmxdripColor">@color/colorCalibrationButton</item>
|
||||||
<!---BG color-->
|
<!---BG color-->
|
||||||
<item name="bgLow">@color/low</item>
|
<item name="bgLow">@color/low</item>
|
||||||
<item name="bgHigh">@color/high</item>
|
<item name="highColor">@color/high</item>
|
||||||
<item name="bgInRange">@color/inrange</item>
|
<item name="bgInRange">@color/inrange</item>
|
||||||
<!---Profile Helper -->
|
<!---Profile Helper -->
|
||||||
<item name="helperProfileColor">@color/helperProfile</item>
|
<item name="helperProfileColor">@color/helperProfile</item>
|
||||||
|
@ -144,6 +144,17 @@
|
||||||
<item name="cobAlertColor">@color/cobAlert</item>
|
<item name="cobAlertColor">@color/cobAlert</item>
|
||||||
<!---Fill dialog -->
|
<!---Fill dialog -->
|
||||||
<item name="actionsConfirmColor">@color/actionsConfirm</item>
|
<item name="actionsConfirmColor">@color/actionsConfirm</item>
|
||||||
|
<!-- dash and eros colors -->
|
||||||
|
<item name="omniMagentaColor">@color/prediction</item>
|
||||||
|
<item name="omniYellowColor">@color/omni_yellow</item>
|
||||||
|
<item name="omniCyanColor">@color/omni_cyan</item>
|
||||||
|
<item name="omniGreenColor">@color/omni_green</item>
|
||||||
|
<item name="omniGrayColor">@color/midgray</item>
|
||||||
|
<item name="omniWizardFinishButtonColor">@color/omnipod_wizard_finish_button</item>
|
||||||
|
<!---Warning Colors : WarnColors.kt-->
|
||||||
|
<item name="warnColor">@color/omni_yellow</item>
|
||||||
|
<item name="urgentColor">@color/alarm</item>
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Theme.MaterialComponents.DayNight.DarkActionBar" parent="Theme.MaterialComponents.DayNight.Bridge"/>
|
<style name="Theme.MaterialComponents.DayNight.DarkActionBar" parent="Theme.MaterialComponents.DayNight.Bridge"/>
|
||||||
|
|
|
@ -99,7 +99,7 @@
|
||||||
<attr name="cgmxdripColor" format="reference|color" />
|
<attr name="cgmxdripColor" format="reference|color" />
|
||||||
<!---BG color-->
|
<!---BG color-->
|
||||||
<attr name="bgLow" format="reference|color" />
|
<attr name="bgLow" format="reference|color" />
|
||||||
<attr name="bgHigh" format="reference|color" />
|
<attr name="highColor" format="reference|color" />
|
||||||
<attr name="bgInRange" format="reference|color" />
|
<attr name="bgInRange" format="reference|color" />
|
||||||
<!---Profile Helper -->
|
<!---Profile Helper -->
|
||||||
<attr name="helperProfileColor" format="reference|color" />
|
<attr name="helperProfileColor" format="reference|color" />
|
||||||
|
@ -109,6 +109,10 @@
|
||||||
<attr name="errorBackgroundColor" format="reference|color" />
|
<attr name="errorBackgroundColor" format="reference|color" />
|
||||||
<!---Warning -->
|
<!---Warning -->
|
||||||
<attr name="warningColor" format="reference|color" />
|
<attr name="warningColor" format="reference|color" />
|
||||||
|
<!---Warning Colors : WarnColors.kt-->
|
||||||
|
<attr name="normalColor" format="reference|color" />
|
||||||
|
<attr name="warnColor" format="reference|color" />
|
||||||
|
<attr name="urgentColor" format="reference|color" />
|
||||||
<!---TextColor -->
|
<!---TextColor -->
|
||||||
<attr name="defaultTextColor" format="reference|color" />
|
<attr name="defaultTextColor" format="reference|color" />
|
||||||
<!---Profile viewer TempBasal -->
|
<!---Profile viewer TempBasal -->
|
||||||
|
@ -118,4 +122,11 @@
|
||||||
<attr name="cobAlertColor" format="reference|color" />
|
<attr name="cobAlertColor" format="reference|color" />
|
||||||
<!---Fill dialog -->
|
<!---Fill dialog -->
|
||||||
<attr name="actionsConfirmColor" format="reference|color" />
|
<attr name="actionsConfirmColor" format="reference|color" />
|
||||||
|
<!-- dash and eros colors -->
|
||||||
|
<attr name="omniMagentaColor" format="reference|color" />
|
||||||
|
<attr name="omniYellowColor" format="reference|color" />
|
||||||
|
<attr name="omniCyanColor" format="reference|color" />
|
||||||
|
<attr name="omniGreenColor" format="reference|color" />
|
||||||
|
<attr name="omniGrayColor" format="reference|color" />
|
||||||
|
<attr name="omniWizardFinishButtonColor" format="reference|color" />
|
||||||
</resources>
|
</resources>
|
|
@ -81,7 +81,7 @@
|
||||||
<!-- BgReading-->
|
<!-- BgReading-->
|
||||||
<color name="inrange">#00FF00</color>
|
<color name="inrange">#00FF00</color>
|
||||||
<color name="low">#FF0000</color>
|
<color name="low">#FF0000</color>
|
||||||
<color name="high">#FFFF00</color>
|
<color name="high">#FFFB8C00</color>
|
||||||
<color name="iob">#1e88e5</color>
|
<color name="iob">#1e88e5</color>
|
||||||
<color name="extendedBolus">#67DFE8</color>
|
<color name="extendedBolus">#67DFE8</color>
|
||||||
<color name="iobPredAS">#1ea3e5</color>
|
<color name="iobPredAS">#1ea3e5</color>
|
||||||
|
@ -213,9 +213,64 @@
|
||||||
<color name="sphere_plastic_grey">#8c8c8c</color>
|
<color name="sphere_plastic_grey">#8c8c8c</color>
|
||||||
<color name="lightSandGray">#72000000</color>
|
<color name="lightSandGray">#72000000</color>
|
||||||
<color name="sandGray">#c8666666</color>
|
<color name="sandGray">#c8666666</color>
|
||||||
<color name="treatment">#B2B2B2</color>
|
<color name="midgray">#B2B2B2</color>
|
||||||
<color name="lightgray">#4dB1B1B1</color>
|
<color name="lightgray">#4dB1B1B1</color>
|
||||||
<color name="mdtp_button_selected">#33969696</color>
|
<color name="mdtp_button_selected">#33969696</color>
|
||||||
<color name="plastic">#EBEBEA</color>
|
<color name="plastic">#EBEBEA</color>
|
||||||
|
|
||||||
|
<!-- dash and eros colors -->
|
||||||
|
<color name="omni_yellow">#FFFF00</color>
|
||||||
|
<color name="omni_cyan">#00FFFF</color>
|
||||||
|
<color name="omni_green">#00FF00</color>
|
||||||
|
|
||||||
|
<!-- Button icons - general -->
|
||||||
|
<color name="pod_icon_outline">#9E9E9E</color>
|
||||||
|
|
||||||
|
<!-- Omnipod Wizard -->
|
||||||
|
<color name="omnipod_wizard_progress_bar">#0099CC</color>
|
||||||
|
<color name="omnipod_wizard_finish_button">#ff669900</color>
|
||||||
|
<color name="icon_omnipod_wizard_success">#77DD77</color>
|
||||||
|
|
||||||
|
<!-- Omnipod tab - Button icons -->
|
||||||
|
<color name="ic_omnipod_overview_acknowledge_alerts">#FF4444</color>
|
||||||
|
<color name="ic_omnipod_overview_acknowledge_alerts_outline">@color/pod_icon_outline</color>
|
||||||
|
<color name="ic_omnipod_overview_pod_management">#4CAF50</color>
|
||||||
|
<color name="ic_omnipod_overview_pod_management_graph">@color/pod_icon_outline</color>
|
||||||
|
<color name="ic_omnipod_overview_pod_management_outline">@color/pod_icon_outline</color>
|
||||||
|
<color name="ic_omnipod_overview_refresh_pod_status">#42A5F5</color>
|
||||||
|
<color name="ic_omnipod_overview_refresh_pod_status_outline">@color/pod_icon_outline</color>
|
||||||
|
<color name="ic_omnipod_overview_resume_delivery">#67E86A</color>
|
||||||
|
<color name="ic_omnipod_overview_resume_delivery_outline">@color/pod_icon_outline</color>
|
||||||
|
<color name="ic_omnipod_overview_set_time">#B39DDB</color>
|
||||||
|
<color name="ic_omnipod_overview_set_time_outline">@color/pod_icon_outline</color>
|
||||||
|
<color name="ic_omnipod_overview_suspend_delivery">#ffbf00</color>
|
||||||
|
<color name="ic_omnipod_overview_suspend_delivery_outline">@color/pod_icon_outline</color>
|
||||||
|
|
||||||
|
<!-- Pod Management - Button icons -->
|
||||||
|
<color name="ic_pod_management_activate_pod">#67E86A</color>
|
||||||
|
<color name="ic_pod_management_activate_pod_outline">@color/pod_icon_outline</color>
|
||||||
|
<color name="ic_pod_management_deactivate_pod">#FF4444</color>
|
||||||
|
<color name="ic_pod_management_deactivate_pod_outline">@color/pod_icon_outline</color>
|
||||||
|
<color name="ic_pod_management_discard_pod">#85F803</color>
|
||||||
|
<color name="ic_pod_management_discard_pod_outline">@color/pod_icon_outline</color>
|
||||||
|
<color name="ic_pod_management_play_test_beep">#ffbf00</color>
|
||||||
|
<color name="ic_pod_management_play_test_beep_outline">@color/pod_icon_outline</color>
|
||||||
|
<color name="ic_pod_management_pulse_log">#4DD0E1</color>
|
||||||
|
<color name="ic_pod_management_pulse_log_outline">@color/pod_icon_outline</color>
|
||||||
|
<color name="ic_pod_management_pod_history">#FB8C00</color>
|
||||||
|
<color name="ic_pod_management_pod_history_outline">@color/pod_icon_outline</color>
|
||||||
|
|
||||||
|
<!-- Button icons - general -->
|
||||||
|
<color name="rl_icon_outline">#b9d2d2</color>
|
||||||
|
<color name="rl_board_shape">#66BB6A</color>
|
||||||
|
<color name="rl_antenna_shape">#FF7043</color>
|
||||||
|
|
||||||
|
<!-- Actions tab - Button icons -->
|
||||||
|
<color name="ic_pod_activity_reset_rileylink_config">@color/rl_board_shape</color>
|
||||||
|
<color name="ic_pod_activity_reset_rileylink_config_outline">@color/rl_icon_outline</color>
|
||||||
|
|
||||||
|
<!-- Pod Management - Button icons -->
|
||||||
|
<color name="ic_pod_management_rl_stats">@color/rl_board_shape</color>
|
||||||
|
<color name="ic_pod_management_rl_stats_outline">@color/rl_icon_outline</color>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -124,7 +124,7 @@
|
||||||
<item name="cgmxdripColor">@color/colorCalibrationButton</item>
|
<item name="cgmxdripColor">@color/colorCalibrationButton</item>
|
||||||
<!---BG color-->
|
<!---BG color-->
|
||||||
<item name="bgLow">@color/low</item>
|
<item name="bgLow">@color/low</item>
|
||||||
<item name="bgHigh">@color/high</item>
|
<item name="highColor">@color/high</item>
|
||||||
<item name="bgInRange">@color/inrange</item>
|
<item name="bgInRange">@color/inrange</item>
|
||||||
<!---Profile Helper -->
|
<!---Profile Helper -->
|
||||||
<item name="helperProfileColor">@color/helperProfile</item>
|
<item name="helperProfileColor">@color/helperProfile</item>
|
||||||
|
@ -143,6 +143,16 @@
|
||||||
<item name="cobAlertColor">@color/cobAlert</item>
|
<item name="cobAlertColor">@color/cobAlert</item>
|
||||||
<!---Fill dialog -->
|
<!---Fill dialog -->
|
||||||
<item name="actionsConfirmColor">@color/actionsConfirm</item>
|
<item name="actionsConfirmColor">@color/actionsConfirm</item>
|
||||||
|
<!-- dash and eros colors -->
|
||||||
|
<item name="omniMagentaColor">@color/prediction</item>
|
||||||
|
<item name="omniYellowColor">@color/omni_yellow</item>
|
||||||
|
<item name="omniCyanColor">@color/omni_cyan</item>
|
||||||
|
<item name="omniGreenColor">@color/omni_green</item>
|
||||||
|
<item name="omniGrayColor">@color/midgray</item>
|
||||||
|
<item name="omniWizardFinishButtonColor">@color/omnipod_wizard_finish_button</item>
|
||||||
|
<!---Warning Colors : WarnColors.kt-->
|
||||||
|
<item name="warnColor">@color/high</item>
|
||||||
|
<item name="urgentColor">@color/alarm</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Theme.MaterialComponents.DayNight.DarkActionBar" parent="Theme.MaterialComponents.DayNight.Bridge"/>
|
<style name="Theme.MaterialComponents.DayNight.DarkActionBar" parent="Theme.MaterialComponents.DayNight.Bridge"/>
|
||||||
|
|
|
@ -92,7 +92,7 @@ class MedtronicFragment : DaggerFragment() {
|
||||||
|
|
||||||
binding.rlStatus.text = rh.gs(RileyLinkServiceState.NotStarted.resourceId)
|
binding.rlStatus.text = rh.gs(RileyLinkServiceState.NotStarted.resourceId)
|
||||||
|
|
||||||
binding.pumpStatusIcon.setTextColor(Color.WHITE)
|
binding.pumpStatusIcon.setTextColor(rh.gac(context,R.attr.defaultTextColor))
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
binding.pumpStatusIcon.text = "{fa-bed}"
|
binding.pumpStatusIcon.text = "{fa-bed}"
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ class MedtronicFragment : DaggerFragment() {
|
||||||
rileyLinkServiceData.rileyLinkServiceState.isError && rileyLinkError != null -> "{fa-bluetooth-b} " + rh.gs(rileyLinkError.getResourceId(RileyLinkTargetDevice.MedtronicPump))
|
rileyLinkServiceData.rileyLinkServiceState.isError && rileyLinkError != null -> "{fa-bluetooth-b} " + rh.gs(rileyLinkError.getResourceId(RileyLinkTargetDevice.MedtronicPump))
|
||||||
else -> "{fa-bluetooth-b} " + rh.gs(resourceId)
|
else -> "{fa-bluetooth-b} " + rh.gs(resourceId)
|
||||||
}
|
}
|
||||||
binding.rlStatus.setTextColor(if (rileyLinkError != null) Color.RED else Color.WHITE)
|
binding.rlStatus.setTextColor(rh.gac( context, if (rileyLinkError != null) R.attr.warningColor else R.attr.defaultTextColor))
|
||||||
|
|
||||||
binding.errors.text =
|
binding.errors.text =
|
||||||
rileyLinkServiceData.rileyLinkError?.let {
|
rileyLinkServiceData.rileyLinkError?.let {
|
||||||
|
@ -272,7 +272,7 @@ class MedtronicFragment : DaggerFragment() {
|
||||||
val min = (System.currentTimeMillis() - medtronicPumpStatus.lastConnection) / 1000 / 60
|
val min = (System.currentTimeMillis() - medtronicPumpStatus.lastConnection) / 1000 / 60
|
||||||
if (medtronicPumpStatus.lastConnection + 60 * 1000 > System.currentTimeMillis()) {
|
if (medtronicPumpStatus.lastConnection + 60 * 1000 > System.currentTimeMillis()) {
|
||||||
binding.lastConnection.setText(R.string.medtronic_pump_connected_now)
|
binding.lastConnection.setText(R.string.medtronic_pump_connected_now)
|
||||||
binding.lastConnection.setTextColor(Color.WHITE)
|
binding.lastConnection.setTextColor(rh.gac(context,R.attr.defaultTextColor))
|
||||||
} else if (medtronicPumpStatus.lastConnection + 30 * 60 * 1000 < System.currentTimeMillis()) {
|
} else if (medtronicPumpStatus.lastConnection + 30 * 60 * 1000 < System.currentTimeMillis()) {
|
||||||
|
|
||||||
if (min < 60) {
|
if (min < 60) {
|
||||||
|
@ -288,10 +288,10 @@ class MedtronicFragment : DaggerFragment() {
|
||||||
binding.lastConnection.text = (rh.gq(R.plurals.duration_days, d, d) + " "
|
binding.lastConnection.text = (rh.gq(R.plurals.duration_days, d, d) + " "
|
||||||
+ rh.gs(R.string.ago))
|
+ rh.gs(R.string.ago))
|
||||||
}
|
}
|
||||||
binding.lastConnection.setTextColor(Color.RED)
|
binding.lastConnection.setTextColor(rh.gac(context,R.attr.warningColor))
|
||||||
} else {
|
} else {
|
||||||
binding.lastConnection.text = minAgo
|
binding.lastConnection.text = minAgo
|
||||||
binding.lastConnection.setTextColor(Color.WHITE)
|
binding.lastConnection.setTextColor(rh.gac(context,R.attr.defaultTextColor))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,11 +15,14 @@ import info.nightscout.androidaps.plugins.pump.omnipod.common.databinding.Omnipo
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.databinding.OmnipodCommonWizardProgressIndicationBinding
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.databinding.OmnipodCommonWizardProgressIndicationBinding
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.activity.OmnipodWizardActivityBase
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.activity.OmnipodWizardActivityBase
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.viewmodel.ViewModelBase
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.viewmodel.ViewModelBase
|
||||||
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
|
import javax.inject.Inject
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
abstract class WizardFragmentBase : DaggerFragment() {
|
abstract class WizardFragmentBase : DaggerFragment() {
|
||||||
|
|
||||||
protected lateinit var viewModel: ViewModelBase
|
protected lateinit var viewModel: ViewModelBase
|
||||||
|
@Inject lateinit var rh: ResourceHelper
|
||||||
|
|
||||||
var _binding: OmnipodCommonWizardBaseFragmentBinding? = null
|
var _binding: OmnipodCommonWizardBaseFragmentBinding? = null
|
||||||
var _progressIndicationBinding: OmnipodCommonWizardProgressIndicationBinding? = null
|
var _progressIndicationBinding: OmnipodCommonWizardProgressIndicationBinding? = null
|
||||||
|
@ -48,7 +51,7 @@ abstract class WizardFragmentBase : DaggerFragment() {
|
||||||
if (nextPage == null) {
|
if (nextPage == null) {
|
||||||
binding.navButtonsLayout.buttonNext.text = getString(R.string.omnipod_common_wizard_button_finish)
|
binding.navButtonsLayout.buttonNext.text = getString(R.string.omnipod_common_wizard_button_finish)
|
||||||
binding.navButtonsLayout.buttonNext.backgroundTintList =
|
binding.navButtonsLayout.buttonNext.backgroundTintList =
|
||||||
ColorStateList.valueOf(resources.getColor(R.color.omnipod_wizard_finish_button, context?.theme))
|
ColorStateList.valueOf(rh.gac(context, R.attr.omniWizardFinishButtonColor))
|
||||||
}
|
}
|
||||||
|
|
||||||
updateProgressIndication()
|
updateProgressIndication()
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<!-- Button icons - general -->
|
|
||||||
<color name="pod_icon_outline">#9E9E9E</color>
|
|
||||||
|
|
||||||
<!-- Omnipod Wizard -->
|
|
||||||
<color name="omnipod_wizard_progress_bar">#0099CC</color>
|
|
||||||
<color name="omnipod_wizard_finish_button">#ff669900</color>
|
|
||||||
<color name="icon_omnipod_wizard_success">#77DD77</color>
|
|
||||||
|
|
||||||
<!-- Omnipod tab - Button icons -->
|
|
||||||
<color name="ic_omnipod_overview_acknowledge_alerts">#FF4444</color>
|
|
||||||
<color name="ic_omnipod_overview_acknowledge_alerts_outline">@color/pod_icon_outline</color>
|
|
||||||
<color name="ic_omnipod_overview_pod_management">#4CAF50</color>
|
|
||||||
<color name="ic_omnipod_overview_pod_management_graph">@color/pod_icon_outline</color>
|
|
||||||
<color name="ic_omnipod_overview_pod_management_outline">@color/pod_icon_outline</color>
|
|
||||||
<color name="ic_omnipod_overview_refresh_pod_status">#42A5F5</color>
|
|
||||||
<color name="ic_omnipod_overview_refresh_pod_status_outline">@color/pod_icon_outline</color>
|
|
||||||
<color name="ic_omnipod_overview_resume_delivery">#67E86A</color>
|
|
||||||
<color name="ic_omnipod_overview_resume_delivery_outline">@color/pod_icon_outline</color>
|
|
||||||
<color name="ic_omnipod_overview_set_time">#B39DDB</color>
|
|
||||||
<color name="ic_omnipod_overview_set_time_outline">@color/pod_icon_outline</color>
|
|
||||||
<color name="ic_omnipod_overview_suspend_delivery">#ffbf00</color>
|
|
||||||
<color name="ic_omnipod_overview_suspend_delivery_outline">@color/pod_icon_outline</color>
|
|
||||||
|
|
||||||
<!-- Pod Management - Button icons -->
|
|
||||||
<color name="ic_pod_management_activate_pod">#67E86A</color>
|
|
||||||
<color name="ic_pod_management_activate_pod_outline">@color/pod_icon_outline</color>
|
|
||||||
<color name="ic_pod_management_deactivate_pod">#FF4444</color>
|
|
||||||
<color name="ic_pod_management_deactivate_pod_outline">@color/pod_icon_outline</color>
|
|
||||||
<color name="ic_pod_management_discard_pod">#85F803</color>
|
|
||||||
<color name="ic_pod_management_discard_pod_outline">@color/pod_icon_outline</color>
|
|
||||||
<color name="ic_pod_management_play_test_beep">#ffbf00</color>
|
|
||||||
<color name="ic_pod_management_play_test_beep_outline">@color/pod_icon_outline</color>
|
|
||||||
<color name="ic_pod_management_pulse_log">#4DD0E1</color>
|
|
||||||
<color name="ic_pod_management_pulse_log_outline">@color/pod_icon_outline</color>
|
|
||||||
<color name="ic_pod_management_pod_history">#FB8C00</color>
|
|
||||||
<color name="ic_pod_management_pod_history_outline">@color/pod_icon_outline</color>
|
|
||||||
</resources>
|
|
|
@ -209,11 +209,11 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
|
||||||
private fun setTextViewColor(check_result: Boolean, textview: TextView, record: HistoryRecord) {
|
private fun setTextViewColor(check_result: Boolean, textview: TextView, record: HistoryRecord) {
|
||||||
if (check_result && !record.isSuccess()) {
|
if (check_result && !record.isSuccess()) {
|
||||||
// Record says not success
|
// Record says not success
|
||||||
textview.setTextColor(android.graphics.Color.YELLOW)
|
textview.setTextColor(rh.gac( textview.context, R.attr.omniYellowColor))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// On success set color
|
// On success set color
|
||||||
val textColor = when (record.commandType) {
|
val textColorAttr = when (record.commandType) {
|
||||||
// Operational
|
// Operational
|
||||||
OmnipodCommandType.INITIALIZE_POD,
|
OmnipodCommandType.INITIALIZE_POD,
|
||||||
OmnipodCommandType.CONFIGURE_ALERTS,
|
OmnipodCommandType.CONFIGURE_ALERTS,
|
||||||
|
@ -223,25 +223,25 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
|
||||||
OmnipodCommandType.SUSPEND_DELIVERY,
|
OmnipodCommandType.SUSPEND_DELIVERY,
|
||||||
OmnipodCommandType.RESUME_DELIVERY,
|
OmnipodCommandType.RESUME_DELIVERY,
|
||||||
OmnipodCommandType.SET_BASAL_PROFILE -> {
|
OmnipodCommandType.SET_BASAL_PROFILE -> {
|
||||||
android.graphics.Color.CYAN
|
R.attr.omniCyanColor
|
||||||
}
|
}
|
||||||
// User action
|
// User action
|
||||||
OmnipodCommandType.PLAY_TEST_BEEP,
|
OmnipodCommandType.PLAY_TEST_BEEP,
|
||||||
OmnipodCommandType.ACKNOWLEDGE_ALERTS,
|
OmnipodCommandType.ACKNOWLEDGE_ALERTS,
|
||||||
OmnipodCommandType.CANCEL_BOLUS -> {
|
OmnipodCommandType.CANCEL_BOLUS -> {
|
||||||
android.graphics.Color.GREEN
|
R.attr.omniCyanColor
|
||||||
}
|
}
|
||||||
// Insulin treatment
|
// Insulin treatment
|
||||||
OmnipodCommandType.SET_BOLUS,
|
OmnipodCommandType.SET_BOLUS,
|
||||||
OmnipodCommandType.SET_TEMPORARY_BASAL -> {
|
OmnipodCommandType.SET_TEMPORARY_BASAL -> {
|
||||||
android.graphics.Color.WHITE
|
R.attr.defaultTextColor
|
||||||
}
|
}
|
||||||
|
|
||||||
else ->
|
else ->
|
||||||
// Other
|
// Other
|
||||||
android.graphics.Color.LTGRAY
|
R.attr.omniGrayColor
|
||||||
}
|
}
|
||||||
textview.setTextColor(textColor)
|
textview.setTextColor(rh.gac( textview.context, textColorAttr))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setType(record: HistoryRecord, typeView: TextView) {
|
private fun setType(record: HistoryRecord, typeView: TextView) {
|
||||||
|
|
|
@ -267,14 +267,14 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
val quality =
|
val quality =
|
||||||
"${podStateManager.successfulConnectionAttemptsAfterRetries}/$connectionAttempts :: $successPercentageString"
|
"${podStateManager.successfulConnectionAttemptsAfterRetries}/$connectionAttempts :: $successPercentageString"
|
||||||
bluetoothStatusBinding.omnipodDashBluetoothConnectionQuality.text = quality
|
bluetoothStatusBinding.omnipodDashBluetoothConnectionQuality.text = quality
|
||||||
val connectionStatsColor = when {
|
val connectionStatsColor = rh.gac( context, when {
|
||||||
connectionSuccessPercentage < 70 && podStateManager.successfulConnectionAttemptsAfterRetries > 50 ->
|
connectionSuccessPercentage < 70 && podStateManager.successfulConnectionAttemptsAfterRetries > 50 ->
|
||||||
Color.RED
|
R.attr.warningColor
|
||||||
connectionSuccessPercentage < 90 && podStateManager.successfulConnectionAttemptsAfterRetries > 50 ->
|
connectionSuccessPercentage < 90 && podStateManager.successfulConnectionAttemptsAfterRetries > 50 ->
|
||||||
Color.YELLOW
|
R.attr.omniYellowColor
|
||||||
else ->
|
else ->
|
||||||
Color.WHITE
|
R.attr.defaultTextColor
|
||||||
}
|
})
|
||||||
bluetoothStatusBinding.omnipodDashBluetoothConnectionQuality.setTextColor(connectionStatsColor)
|
bluetoothStatusBinding.omnipodDashBluetoothConnectionQuality.setTextColor(connectionStatsColor)
|
||||||
bluetoothStatusBinding.omnipodDashDeliveryStatus.text = podStateManager.deliveryStatus?.let {
|
bluetoothStatusBinding.omnipodDashDeliveryStatus.text = podStateManager.deliveryStatus?.let {
|
||||||
podStateManager.deliveryStatus.toString()
|
podStateManager.deliveryStatus.toString()
|
||||||
|
@ -296,11 +296,11 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
podInfoBinding.firmwareVersion.text = PLACEHOLDER
|
podInfoBinding.firmwareVersion.text = PLACEHOLDER
|
||||||
podInfoBinding.timeOnPod.text = PLACEHOLDER
|
podInfoBinding.timeOnPod.text = PLACEHOLDER
|
||||||
podInfoBinding.podExpiryDate.text = PLACEHOLDER
|
podInfoBinding.podExpiryDate.text = PLACEHOLDER
|
||||||
podInfoBinding.podExpiryDate.setTextColor(Color.WHITE)
|
podInfoBinding.podExpiryDate.setTextColor(rh.gac(context,R.attr.defaultTextColor))
|
||||||
podInfoBinding.baseBasalRate.text = PLACEHOLDER
|
podInfoBinding.baseBasalRate.text = PLACEHOLDER
|
||||||
podInfoBinding.totalDelivered.text = PLACEHOLDER
|
podInfoBinding.totalDelivered.text = PLACEHOLDER
|
||||||
podInfoBinding.reservoir.text = PLACEHOLDER
|
podInfoBinding.reservoir.text = PLACEHOLDER
|
||||||
podInfoBinding.reservoir.setTextColor(Color.WHITE)
|
podInfoBinding.reservoir.setTextColor(rh.gac(context,R.attr.defaultTextColor))
|
||||||
podInfoBinding.podActiveAlerts.text = PLACEHOLDER
|
podInfoBinding.podActiveAlerts.text = PLACEHOLDER
|
||||||
} else {
|
} else {
|
||||||
podInfoBinding.uniqueId.text = podStateManager.uniqueId.toString()
|
podInfoBinding.uniqueId.text = podStateManager.uniqueId.toString()
|
||||||
|
@ -335,14 +335,15 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
).isNegative
|
).isNegative
|
||||||
} ?: false
|
} ?: false
|
||||||
podInfoBinding.timeOnPod.setTextColor(
|
podInfoBinding.timeOnPod.setTextColor(
|
||||||
|
rh.gac( context,
|
||||||
when {
|
when {
|
||||||
!podStateManager.sameTimeZone ->
|
!podStateManager.sameTimeZone ->
|
||||||
Color.MAGENTA
|
R.attr.omniMagentaColor
|
||||||
timeDeviationTooBig ->
|
timeDeviationTooBig ->
|
||||||
Color.YELLOW
|
R.attr.omniYellowColor
|
||||||
else ->
|
else ->
|
||||||
Color.WHITE
|
R.attr.defaultTextColor
|
||||||
}
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
// Update Pod expiry time
|
// Update Pod expiry time
|
||||||
|
@ -352,14 +353,15 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
?: PLACEHOLDER
|
?: PLACEHOLDER
|
||||||
podInfoBinding.podExpiryDate.setTextColor(
|
podInfoBinding.podExpiryDate.setTextColor(
|
||||||
when {
|
rh.gac( context,
|
||||||
|
when {
|
||||||
expiresAt != null && ZonedDateTime.now().isAfter(expiresAt) ->
|
expiresAt != null && ZonedDateTime.now().isAfter(expiresAt) ->
|
||||||
Color.RED
|
R.attr.warningColor
|
||||||
expiresAt != null && ZonedDateTime.now().isAfter(expiresAt.minusHours(4)) ->
|
expiresAt != null && ZonedDateTime.now().isAfter(expiresAt.minusHours(4)) ->
|
||||||
Color.YELLOW
|
R.attr.omniYellowColor
|
||||||
else ->
|
else ->
|
||||||
Color.WHITE
|
R.attr.defaultTextColor
|
||||||
}
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
podStateManager.alarmType?.let {
|
podStateManager.alarmType?.let {
|
||||||
|
@ -399,7 +401,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
if (podStateManager.pulsesRemaining == null) {
|
if (podStateManager.pulsesRemaining == null) {
|
||||||
podInfoBinding.reservoir.text =
|
podInfoBinding.reservoir.text =
|
||||||
rh.gs(R.string.omnipod_common_overview_reservoir_value_over50)
|
rh.gs(R.string.omnipod_common_overview_reservoir_value_over50)
|
||||||
podInfoBinding.reservoir.setTextColor(Color.WHITE)
|
podInfoBinding.reservoir.setTextColor(rh.gac(context,R.attr.defaultTextColor))
|
||||||
} else {
|
} else {
|
||||||
// TODO
|
// TODO
|
||||||
// val lowReservoirThreshold = (omnipodAlertUtil.lowReservoirAlertUnits
|
// val lowReservoirThreshold = (omnipodAlertUtil.lowReservoirAlertUnits
|
||||||
|
@ -411,11 +413,12 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
(podStateManager.pulsesRemaining!! * PodConstants.POD_PULSE_BOLUS_UNITS)
|
(podStateManager.pulsesRemaining!! * PodConstants.POD_PULSE_BOLUS_UNITS)
|
||||||
)
|
)
|
||||||
podInfoBinding.reservoir.setTextColor(
|
podInfoBinding.reservoir.setTextColor(
|
||||||
|
rh.gac(context,
|
||||||
if (podStateManager.pulsesRemaining!! < lowReservoirThreshold) {
|
if (podStateManager.pulsesRemaining!! < lowReservoirThreshold) {
|
||||||
Color.RED
|
R.attr.warningColor
|
||||||
} else {
|
} else {
|
||||||
Color.WHITE
|
R.attr.defaultTextColor
|
||||||
}
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,10 +429,10 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
|
|
||||||
if (errors.size == 0) {
|
if (errors.size == 0) {
|
||||||
podInfoBinding.errors.text = PLACEHOLDER
|
podInfoBinding.errors.text = PLACEHOLDER
|
||||||
podInfoBinding.errors.setTextColor(Color.WHITE)
|
podInfoBinding.errors.setTextColor(rh.gac(context,R.attr.defaultTextColor))
|
||||||
} else {
|
} else {
|
||||||
podInfoBinding.errors.text = StringUtils.join(errors, System.lineSeparator())
|
podInfoBinding.errors.text = StringUtils.join(errors, System.lineSeparator())
|
||||||
podInfoBinding.errors.setTextColor(Color.RED)
|
podInfoBinding.errors.setTextColor(rh.gac(context,R.attr.warningColor))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,14 +468,15 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
val lastConnectionColor =
|
val lastConnectionColor =
|
||||||
|
rh.gac(context,
|
||||||
if (omnipodDashPumpPlugin.isUnreachableAlertTimeoutExceeded(getPumpUnreachableTimeout().toMillis())) {
|
if (omnipodDashPumpPlugin.isUnreachableAlertTimeoutExceeded(getPumpUnreachableTimeout().toMillis())) {
|
||||||
Color.RED
|
R.attr.warningColor
|
||||||
} else {
|
} else {
|
||||||
Color.WHITE
|
R.attr.defaultTextColor
|
||||||
}
|
})
|
||||||
podInfoBinding.lastConnection.setTextColor(lastConnectionColor)
|
podInfoBinding.lastConnection.setTextColor(lastConnectionColor)
|
||||||
} else {
|
} else {
|
||||||
podInfoBinding.lastConnection.setTextColor(Color.WHITE)
|
podInfoBinding.lastConnection.setTextColor(rh.gac(context,R.attr.defaultTextColor ))
|
||||||
podInfoBinding.lastConnection.text = PLACEHOLDER
|
podInfoBinding.lastConnection.text = PLACEHOLDER
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -508,20 +512,20 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val podStatusColor = when {
|
val podStatusColor = rh.gac( context, when {
|
||||||
!podStateManager.isActivationCompleted || podStateManager.isPodKaput || podStateManager.isSuspended ->
|
!podStateManager.isActivationCompleted || podStateManager.isPodKaput || podStateManager.isSuspended ->
|
||||||
Color.RED
|
R.attr.warningColor
|
||||||
podStateManager.activeCommand != null ->
|
podStateManager.activeCommand != null ->
|
||||||
Color.YELLOW
|
R.attr.omniYellowColor
|
||||||
else ->
|
else ->
|
||||||
Color.WHITE
|
R.attr.defaultTextColor
|
||||||
}
|
})
|
||||||
podInfoBinding.podStatus.setTextColor(podStatusColor)
|
podInfoBinding.podStatus.setTextColor(podStatusColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateLastBolus() {
|
private fun updateLastBolus() {
|
||||||
|
|
||||||
var textColor = Color.WHITE
|
var textColorAttr = R.attr.defaultTextColor
|
||||||
podStateManager.activeCommand?.let {
|
podStateManager.activeCommand?.let {
|
||||||
val requestedBolus = it.requestedBolus
|
val requestedBolus = it.requestedBolus
|
||||||
if (requestedBolus != null) {
|
if (requestedBolus != null) {
|
||||||
|
@ -532,14 +536,14 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
readableDuration(Duration.ofMillis(SystemClock.elapsedRealtime() - it.createdRealtime))
|
readableDuration(Duration.ofMillis(SystemClock.elapsedRealtime() - it.createdRealtime))
|
||||||
)
|
)
|
||||||
text += " (uncertain) "
|
text += " (uncertain) "
|
||||||
textColor = Color.RED
|
textColorAttr = R.attr.warningColor
|
||||||
podInfoBinding.lastBolus.text = text
|
podInfoBinding.lastBolus.text = text
|
||||||
podInfoBinding.lastBolus.setTextColor(textColor)
|
podInfoBinding.lastBolus.setTextColor(rh.gac(context, textColorAttr))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
podInfoBinding.lastBolus.setTextColor(textColor)
|
podInfoBinding.lastBolus.setTextColor(rh.gac(context, textColorAttr))
|
||||||
podStateManager.lastBolus?.let {
|
podStateManager.lastBolus?.let {
|
||||||
// display requested units if delivery is in progress
|
// display requested units if delivery is in progress
|
||||||
val bolusSize = it.deliveredUnits()
|
val bolusSize = it.deliveredUnits()
|
||||||
|
@ -552,10 +556,10 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
readableDuration(Duration.ofMillis(System.currentTimeMillis() - it.startTime))
|
readableDuration(Duration.ofMillis(System.currentTimeMillis() - it.startTime))
|
||||||
)
|
)
|
||||||
if (!it.deliveryComplete) {
|
if (!it.deliveryComplete) {
|
||||||
textColor = Color.YELLOW
|
textColorAttr = R.attr.omniYellowColor
|
||||||
}
|
}
|
||||||
podInfoBinding.lastBolus.text = text
|
podInfoBinding.lastBolus.text = text
|
||||||
podInfoBinding.lastBolus.setTextColor(textColor)
|
podInfoBinding.lastBolus.setTextColor(rh.gac(context, textColorAttr))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
podInfoBinding.lastBolus.text = PLACEHOLDER
|
podInfoBinding.lastBolus.text = PLACEHOLDER
|
||||||
|
|
|
@ -245,7 +245,7 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
rileyLinkServiceState.isError && rileyLinkError != null -> "{fa-bluetooth-b} " + rh.gs(rileyLinkError.getResourceId(RileyLinkTargetDevice.Omnipod))
|
rileyLinkServiceState.isError && rileyLinkError != null -> "{fa-bluetooth-b} " + rh.gs(rileyLinkError.getResourceId(RileyLinkTargetDevice.Omnipod))
|
||||||
else -> "{fa-bluetooth-b} " + rh.gs(resourceId)
|
else -> "{fa-bluetooth-b} " + rh.gs(resourceId)
|
||||||
}
|
}
|
||||||
rileyLinkStatusBinding.rileyLinkStatus.setTextColor(if (rileyLinkServiceState.isError || rileyLinkError != null) Color.RED else Color.WHITE)
|
rileyLinkStatusBinding.rileyLinkStatus.setTextColor( rh.gac(context, if (rileyLinkServiceState.isError || rileyLinkError != null) R.attr.warningColor else R.attr.defaultTextColor))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateOmnipodStatus() {
|
private fun updateOmnipodStatus() {
|
||||||
|
@ -273,11 +273,11 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
podInfoBinding.firmwareVersion.text = PLACEHOLDER
|
podInfoBinding.firmwareVersion.text = PLACEHOLDER
|
||||||
podInfoBinding.timeOnPod.text = PLACEHOLDER
|
podInfoBinding.timeOnPod.text = PLACEHOLDER
|
||||||
podInfoBinding.podExpiryDate.text = PLACEHOLDER
|
podInfoBinding.podExpiryDate.text = PLACEHOLDER
|
||||||
podInfoBinding.podExpiryDate.setTextColor(Color.WHITE)
|
podInfoBinding.podExpiryDate.setTextColor(rh.gac(context, R.attr.defaultTextColor))
|
||||||
podInfoBinding.baseBasalRate.text = PLACEHOLDER
|
podInfoBinding.baseBasalRate.text = PLACEHOLDER
|
||||||
podInfoBinding.totalDelivered.text = PLACEHOLDER
|
podInfoBinding.totalDelivered.text = PLACEHOLDER
|
||||||
podInfoBinding.reservoir.text = PLACEHOLDER
|
podInfoBinding.reservoir.text = PLACEHOLDER
|
||||||
podInfoBinding.reservoir.setTextColor(Color.WHITE)
|
podInfoBinding.reservoir.setTextColor(rh.gac(context, R.attr.defaultTextColor))
|
||||||
podInfoBinding.podActiveAlerts.text = PLACEHOLDER
|
podInfoBinding.podActiveAlerts.text = PLACEHOLDER
|
||||||
} else {
|
} else {
|
||||||
podInfoBinding.uniqueId.text = podStateManager.address.toString()
|
podInfoBinding.uniqueId.text = podStateManager.address.toString()
|
||||||
|
@ -287,25 +287,27 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
|
|
||||||
podInfoBinding.timeOnPod.text = readableZonedTime(podStateManager.time)
|
podInfoBinding.timeOnPod.text = readableZonedTime(podStateManager.time)
|
||||||
podInfoBinding.timeOnPod.setTextColor(
|
podInfoBinding.timeOnPod.setTextColor(
|
||||||
|
rh.gac(context,
|
||||||
if (podStateManager.timeDeviatesMoreThan(OmnipodConstants.TIME_DEVIATION_THRESHOLD)) {
|
if (podStateManager.timeDeviatesMoreThan(OmnipodConstants.TIME_DEVIATION_THRESHOLD)) {
|
||||||
Color.RED
|
R.attr.defaultTextColor
|
||||||
} else {
|
} else {
|
||||||
Color.WHITE
|
R.attr.warningColor
|
||||||
}
|
})
|
||||||
)
|
)
|
||||||
val expiresAt = podStateManager.expiresAt
|
val expiresAt = podStateManager.expiresAt
|
||||||
if (expiresAt == null) {
|
if (expiresAt == null) {
|
||||||
podInfoBinding.podExpiryDate.text = PLACEHOLDER
|
podInfoBinding.podExpiryDate.text = PLACEHOLDER
|
||||||
podInfoBinding.podExpiryDate.setTextColor(Color.WHITE)
|
podInfoBinding.podExpiryDate.setTextColor(rh.gac(context, R.attr.defaultTextColor))
|
||||||
} else {
|
} else {
|
||||||
podInfoBinding.podExpiryDate.text = readableZonedTime(expiresAt)
|
podInfoBinding.podExpiryDate.text = readableZonedTime(expiresAt)
|
||||||
podInfoBinding.podExpiryDate.setTextColor(
|
podInfoBinding.podExpiryDate.setTextColor(
|
||||||
|
rh.gac(context,
|
||||||
if (DateTime.now().isAfter(expiresAt)) {
|
if (DateTime.now().isAfter(expiresAt)) {
|
||||||
Color.RED
|
R.attr.warningColor
|
||||||
} else {
|
} else {
|
||||||
Color.WHITE
|
R.attr.defaultTextColor
|
||||||
}
|
}
|
||||||
)
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (podStateManager.isPodFaulted) {
|
if (podStateManager.isPodFaulted) {
|
||||||
|
@ -331,18 +333,19 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
// reservoir
|
// reservoir
|
||||||
if (podStateManager.reservoirLevel == null) {
|
if (podStateManager.reservoirLevel == null) {
|
||||||
podInfoBinding.reservoir.text = rh.gs(R.string.omnipod_common_overview_reservoir_value_over50)
|
podInfoBinding.reservoir.text = rh.gs(R.string.omnipod_common_overview_reservoir_value_over50)
|
||||||
podInfoBinding.reservoir.setTextColor(Color.WHITE)
|
podInfoBinding.reservoir.setTextColor(rh.gac(context, R.attr.defaultTextColor))
|
||||||
} else {
|
} else {
|
||||||
val lowReservoirThreshold = (omnipodAlertUtil.lowReservoirAlertUnits
|
val lowReservoirThreshold = (omnipodAlertUtil.lowReservoirAlertUnits
|
||||||
?: OmnipodConstants.DEFAULT_MAX_RESERVOIR_ALERT_THRESHOLD).toDouble()
|
?: OmnipodConstants.DEFAULT_MAX_RESERVOIR_ALERT_THRESHOLD).toDouble()
|
||||||
|
|
||||||
podInfoBinding.reservoir.text = rh.gs(R.string.omnipod_common_overview_reservoir_value, podStateManager.reservoirLevel)
|
podInfoBinding.reservoir.text = rh.gs(R.string.omnipod_common_overview_reservoir_value, podStateManager.reservoirLevel)
|
||||||
podInfoBinding.reservoir.setTextColor(
|
podInfoBinding.reservoir.setTextColor(
|
||||||
|
rh.gac(context,
|
||||||
if (podStateManager.reservoirLevel < lowReservoirThreshold) {
|
if (podStateManager.reservoirLevel < lowReservoirThreshold) {
|
||||||
Color.RED
|
R.attr.warningColor
|
||||||
} else {
|
} else {
|
||||||
Color.WHITE
|
R.attr.defaultTextColor
|
||||||
}
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,10 +358,10 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
|
|
||||||
if (errors.size == 0) {
|
if (errors.size == 0) {
|
||||||
podInfoBinding.errors.text = PLACEHOLDER
|
podInfoBinding.errors.text = PLACEHOLDER
|
||||||
podInfoBinding.errors.setTextColor(Color.WHITE)
|
podInfoBinding.errors.setTextColor(rh.gac(context, R.attr.defaultTextColor))
|
||||||
} else {
|
} else {
|
||||||
podInfoBinding.errors.text = StringUtils.join(errors, System.lineSeparator())
|
podInfoBinding.errors.text = StringUtils.join(errors, System.lineSeparator())
|
||||||
podInfoBinding.errors.setTextColor(Color.RED)
|
podInfoBinding.errors.setTextColor(rh.gac(context, R.attr.warningColor))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,14 +369,15 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
if (podStateManager.isPodInitialized && podStateManager.lastSuccessfulCommunication != null) {
|
if (podStateManager.isPodInitialized && podStateManager.lastSuccessfulCommunication != null) {
|
||||||
podInfoBinding.lastConnection.text = readableDuration(podStateManager.lastSuccessfulCommunication)
|
podInfoBinding.lastConnection.text = readableDuration(podStateManager.lastSuccessfulCommunication)
|
||||||
val lastConnectionColor =
|
val lastConnectionColor =
|
||||||
|
rh.gac(context,
|
||||||
if (omnipodErosPumpPlugin.isUnreachableAlertTimeoutExceeded(getPumpUnreachableTimeout().millis)) {
|
if (omnipodErosPumpPlugin.isUnreachableAlertTimeoutExceeded(getPumpUnreachableTimeout().millis)) {
|
||||||
Color.RED
|
R.attr.warningColor
|
||||||
} else {
|
} else {
|
||||||
Color.WHITE
|
R.attr.defaultTextColor
|
||||||
}
|
})
|
||||||
podInfoBinding.lastConnection.setTextColor(lastConnectionColor)
|
podInfoBinding.lastConnection.setTextColor(lastConnectionColor)
|
||||||
} else {
|
} else {
|
||||||
podInfoBinding.lastConnection.setTextColor(Color.WHITE)
|
podInfoBinding.lastConnection.setTextColor(rh.gac(context, R.attr.defaultTextColor))
|
||||||
podInfoBinding.lastConnection.text = if (podStateManager.hasPodState() && podStateManager.lastSuccessfulCommunication != null) {
|
podInfoBinding.lastConnection.text = if (podStateManager.hasPodState() && podStateManager.lastSuccessfulCommunication != null) {
|
||||||
readableDuration(podStateManager.lastSuccessfulCommunication)
|
readableDuration(podStateManager.lastSuccessfulCommunication)
|
||||||
} else {
|
} else {
|
||||||
|
@ -418,11 +422,12 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
val podStatusColor =
|
val podStatusColor =
|
||||||
|
rh.gac( context,
|
||||||
if (!podStateManager.isPodActivationCompleted || podStateManager.isPodDead || podStateManager.isSuspended || (podStateManager.isPodRunning && !podStateManager.isBasalCertain)) {
|
if (!podStateManager.isPodActivationCompleted || podStateManager.isPodDead || podStateManager.isSuspended || (podStateManager.isPodRunning && !podStateManager.isBasalCertain)) {
|
||||||
Color.RED
|
R.attr.warningColor
|
||||||
} else {
|
} else {
|
||||||
Color.WHITE
|
R.attr.defaultTextColor
|
||||||
}
|
})
|
||||||
podInfoBinding.podStatus.setTextColor(podStatusColor)
|
podInfoBinding.podStatus.setTextColor(podStatusColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,11 +441,10 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
readableDuration(podStateManager.lastBolusStartTime)
|
readableDuration(podStateManager.lastBolusStartTime)
|
||||||
)
|
)
|
||||||
val textColor: Int
|
val textColor: Int
|
||||||
|
|
||||||
if (podStateManager.isLastBolusCertain) {
|
if (podStateManager.isLastBolusCertain) {
|
||||||
textColor = Color.WHITE
|
textColor = rh.gac(context, R.attr.defaultTextColor)
|
||||||
} else {
|
} else {
|
||||||
textColor = Color.RED
|
textColor = rh.gac(context, R.attr.warningColor)
|
||||||
text += " (" + rh.gs(R.string.omnipod_eros_uncertain) + ")"
|
text += " (" + rh.gs(R.string.omnipod_eros_uncertain) + ")"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,7 +453,7 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
podInfoBinding.lastBolus.text = PLACEHOLDER
|
podInfoBinding.lastBolus.text = PLACEHOLDER
|
||||||
podInfoBinding.lastBolus.setTextColor(Color.WHITE)
|
podInfoBinding.lastBolus.setTextColor(rh.gac(context, R.attr.defaultTextColor))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -457,7 +461,7 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
if (podStateManager.isPodActivationCompleted && podStateManager.isTempBasalRunning) {
|
if (podStateManager.isPodActivationCompleted && podStateManager.isTempBasalRunning) {
|
||||||
if (!podStateManager.hasTempBasal()) {
|
if (!podStateManager.hasTempBasal()) {
|
||||||
podInfoBinding.tempBasal.text = "???"
|
podInfoBinding.tempBasal.text = "???"
|
||||||
podInfoBinding.tempBasal.setTextColor(Color.RED)
|
podInfoBinding.tempBasal.setTextColor(rh.gac(context, R.attr.warningColor))
|
||||||
} else {
|
} else {
|
||||||
val now = DateTime.now()
|
val now = DateTime.now()
|
||||||
|
|
||||||
|
@ -471,9 +475,9 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
val textColor: Int
|
val textColor: Int
|
||||||
text = rh.gs(R.string.omnipod_common_overview_temp_basal_value, amount, dateUtil.timeString(startTime.millis), minutesRunning, duration.standardMinutes)
|
text = rh.gs(R.string.omnipod_common_overview_temp_basal_value, amount, dateUtil.timeString(startTime.millis), minutesRunning, duration.standardMinutes)
|
||||||
if (podStateManager.isTempBasalCertain) {
|
if (podStateManager.isTempBasalCertain) {
|
||||||
textColor = Color.WHITE
|
textColor = rh.gac(context, R.attr.defaultTextColor)
|
||||||
} else {
|
} else {
|
||||||
textColor = Color.RED
|
textColor = rh.gac(context, R.attr.warningColor)
|
||||||
text += " (" + rh.gs(R.string.omnipod_eros_uncertain) + ")"
|
text += " (" + rh.gs(R.string.omnipod_eros_uncertain) + ")"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -485,9 +489,9 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
val textColor: Int
|
val textColor: Int
|
||||||
|
|
||||||
if (!podStateManager.isPodActivationCompleted || podStateManager.isTempBasalCertain) {
|
if (!podStateManager.isPodActivationCompleted || podStateManager.isTempBasalCertain) {
|
||||||
textColor = Color.WHITE
|
textColor = rh.gac(context, R.attr.defaultTextColor)
|
||||||
} else {
|
} else {
|
||||||
textColor = Color.RED
|
textColor = rh.gac(context, R.attr.warningColor)
|
||||||
text += " (" + rh.gs(R.string.omnipod_eros_uncertain) + ")"
|
text += " (" + rh.gs(R.string.omnipod_eros_uncertain) + ")"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<!-- Button icons - general -->
|
|
||||||
<color name="rl_icon_outline">#b9d2d2</color>
|
|
||||||
<color name="rl_board_shape">#66BB6A</color>
|
|
||||||
<color name="rl_antenna_shape">#FF7043</color>
|
|
||||||
|
|
||||||
<!-- Actions tab - Button icons -->
|
|
||||||
<color name="ic_pod_activity_reset_rileylink_config">@color/rl_board_shape</color>
|
|
||||||
<color name="ic_pod_activity_reset_rileylink_config_outline">@color/rl_icon_outline</color>
|
|
||||||
|
|
||||||
<!-- Pod Management - Button icons -->
|
|
||||||
<color name="ic_pod_management_rl_stats">@color/rl_board_shape</color>
|
|
||||||
<color name="ic_pod_management_rl_stats_outline">@color/rl_icon_outline</color>
|
|
||||||
</resources>
|
|
Loading…
Reference in a new issue