This commit is contained in:
Milos Kozak 2022-03-30 20:13:42 +02:00
commit 0ec2a498c4
47 changed files with 423 additions and 264 deletions

View file

@ -70,7 +70,6 @@ class MainActivity : NoSplashAppCompatActivity() {
private val disposable = CompositeDisposable()
@Inject lateinit var aapsSchedulers: AapsSchedulers
@Inject lateinit var rxBus: RxBus
@Inject lateinit var androidPermission: AndroidPermission
@Inject lateinit var sp: SP
@Inject lateinit var versionCheckerUtils: VersionCheckerUtils

View file

@ -52,7 +52,6 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
@Inject lateinit var injector: HasAndroidInjector
@Inject lateinit var aapsSchedulers: AapsSchedulers
@Inject lateinit var rxBus: RxBus
@Inject lateinit var sp: SP
@Inject lateinit var profileFunction: ProfileFunction
@Inject lateinit var defaultValueHelper: DefaultValueHelper

View file

@ -38,7 +38,6 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() {
@Inject lateinit var defaultProfile: DefaultProfile
@Inject lateinit var defaultProfileDPV: DefaultProfileDPV
@Inject lateinit var localProfilePlugin: LocalProfilePlugin
@Inject lateinit var rxBus: RxBus
@Inject lateinit var dateUtil: DateUtil
@Inject lateinit var activePlugin: ActivePlugin
@Inject lateinit var repository: AppRepository

View file

@ -142,7 +142,7 @@ class OverviewData @Inject constructor(
fun lastBgColor(context: Context?): Int {
return when {
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)
}
}

View file

@ -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(), "%")
} else {
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))
}
}
}

View file

@ -31,7 +31,6 @@ import javax.inject.Inject
class SmsCommunicatorOtpActivity : NoSplashAppCompatActivity() {
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var rxBus: RxBus
@Inject lateinit var smsCommunicatorPlugin: SmsCommunicatorPlugin
@Inject lateinit var otp: OneTimePassword
@Inject lateinit var uel: UserEntryLogger

View file

@ -143,7 +143,7 @@ class BGSourceFragment : DaggerFragment() {
val previous = glucoseValues[position - 1]
val diff = previous.timestamp - glucoseValue.timestamp
if (diff < T.secs(20).msecs())
holder.binding.root.setBackgroundColor(rh.gc(R.color.errorAlertBackground))
holder.binding.root.setBackgroundColor(rh.gac(context, R.attr.bgsourceError))
}
holder.binding.root.setOnLongClickListener {

View file

@ -34,7 +34,6 @@ class SetupWizardActivity : NoSplashAppCompatActivity() {
@Inject lateinit var injector: HasAndroidInjector
@Inject lateinit var localProfilePlugin: LocalProfilePlugin
@Inject lateinit var swDefinition: SWDefinition
@Inject lateinit var rxBus: RxBus
@Inject lateinit var sp: SP
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var aapsSchedulers: AapsSchedulers

View file

@ -5,5 +5,5 @@
android:viewportHeight="24">
<path
android:pathData="M12.107,3.666c-4.603,0 -8.335,3.732 -8.335,8.335s3.732,8.335 8.335,8.335s8.335,-3.731 8.335,-8.335V3.666H12.107zM12.107,18.335c-3.498,0 -6.334,-2.836 -6.334,-6.334c0,-3.498 2.836,-6.334 6.334,-6.334c3.498,0 6.334,2.836 6.334,6.334C18.442,15.499 15.606,18.335 12.107,18.335z"
android:fillColor="@color/colorLightGray"/>
android:fillColor="?attr/cgmdexColor"/>
</vector>

View file

@ -6,11 +6,11 @@
<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:strokeAlpha="0.5"
android:fillColor="#FFFFFF"
android:fillColor="?attr/colorControlNormal"
android:fillAlpha="0.5"/>
<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:strokeAlpha="0.5"
android:fillColor="#FFFFFF"
android:fillColor="?attr/colorControlNormal"
android:fillAlpha="0.5"/>
</vector>

View file

@ -6,6 +6,6 @@
<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:strokeAlpha="0.5"
android:fillColor="#FFFFFF"
android:fillColor="?attr/colorControlNormal"
android:fillAlpha="0.5"/>
</vector>

View file

@ -6,6 +6,6 @@
<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:strokeAlpha="0.5"
android:fillColor="#FFFFFF"
android:fillColor="?attr/colorControlNormal"
android:fillAlpha="0.5"/>
</vector>

View file

@ -6,16 +6,16 @@
<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:strokeAlpha="0.5"
android:fillColor="#FFFFFF"
android:fillColor="?attr/colorControlNormal"
android:fillAlpha="0.5"/>
<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:strokeAlpha="0.5"
android:fillColor="#FFFFFF"
android:fillColor="?attr/colorControlNormal"
android:fillAlpha="0.5"/>
<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:strokeAlpha="0.5"
android:fillColor="#FFFFFF"
android:fillColor="?attr/colorControlNormal"
android:fillAlpha="0.5"/>
</vector>

View file

@ -6,7 +6,7 @@
<path
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:strokeAlpha="0.5" />

View file

@ -62,7 +62,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:background="@color/black_overlay"
android:background="@color/black_alpha_40"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingRight="16dp">

View file

@ -173,10 +173,10 @@ class AutomationFragment : DaggerFragment(), OnStartDragListener {
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val automation = automationPlugin.at(position)
holder.binding.rootLayout.setBackgroundColor(
rh.gc(
if (automation.userAction) R.color.mdtp_line_dark
else if (automation.areActionsValid()) R.color.ribbonDefault
else R.color.errorAlertBackground
rh.gac( context,
if (automation.userAction) R.attr.userAction
else if (automation.areActionsValid()) R.attr.validActions
else R.attr.actionsError
)
)
holder.binding.eventTitle.text = automation.title

View file

@ -4,6 +4,7 @@ import android.graphics.Typeface
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.TextView
import info.nightscout.androidaps.automation.R
import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger
import info.nightscout.androidaps.utils.resources.ResourceHelper
@ -28,7 +29,7 @@ class StaticLabel(private val rh: ResourceHelper) : Element() {
LinearLayout(root.context).apply {
orientation = LinearLayout.HORIZONTAL
layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
setBackgroundColor(rh.gc(android.R.color.black))
setBackgroundColor(rh.gac(context, R.attr.automationBackgroundColor))
addView(
TextView(root.context).apply {
text = label

View file

@ -165,7 +165,7 @@ class TriggerConnector(injector: HasAndroidInjector) : Trigger(injector) {
text = rh.gs(connectorType.stringRes)
gravity = gravity or Gravity.CENTER_VERTICAL
setTypeface(typeface, Typeface.BOLD)
setBackgroundColor(rh.gc(R.color.black_overlay))
setBackgroundColor(rh.gac(context, R.attr.automationOverlayColor))
layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT).also { ll ->
ll.setMargins(rh.dpToPx(3), rh.dpToPx(3), rh.dpToPx(3), rh.dpToPx(3))
}

View file

@ -134,33 +134,33 @@ public class ComboFragment extends DaggerFragment {
PumpState ps = comboPlugin.getPump().state;
if (ps.insulinState == PumpState.EMPTY || ps.batteryState == PumpState.EMPTY
|| ps.activeAlert != null && ps.activeAlert.errorCode != null) {
stateView.setTextColor(Color.RED);
stateView.setTextColor(rh.gac(getContext(), R.attr.warningColor));
stateView.setTypeface(null, Typeface.BOLD);
} else if (comboPlugin.getPump().state.suspended
|| ps.activeAlert != null && ps.activeAlert.warningCode != null) {
stateView.setTextColor(Color.YELLOW);
stateView.setTextColor(rh.gac(getContext(), R.attr.omniYellowColor));
stateView.setTypeface(null, Typeface.BOLD);
} else {
stateView.setTextColor(Color.WHITE);
stateView.setTextColor(rh.gac(getContext(), R.attr.defaultTextColor));
stateView.setTypeface(null, Typeface.NORMAL);
}
// activity
String activity = comboPlugin.getPump().activity;
if (activity != null) {
activityView.setTextColor(Color.WHITE);
activityView.setTextColor(rh.gac(getContext(), R.attr.defaultTextColor));
activityView.setTextSize(14);
activityView.setText(activity);
} else if (commandQueue.size() > 0) {
activityView.setTextColor(Color.WHITE);
activityView.setTextColor(rh.gac(getContext(), R.attr.defaultTextColor));
activityView.setTextSize(14);
activityView.setText("");
} else if (comboPlugin.isInitialized()) {
activityView.setTextColor(Color.WHITE);
activityView.setTextColor(rh.gac(getContext(), R.attr.defaultTextColor));
activityView.setTextSize(20);
activityView.setText("{fa-bed}");
} else {
activityView.setTextColor(Color.RED);
activityView.setTextColor(rh.gac(getContext(), R.attr.warningColor));
activityView.setTextSize(14);
activityView.setText(rh.gs(R.string.pump_unreachable));
}
@ -170,10 +170,10 @@ public class ComboFragment extends DaggerFragment {
batteryView.setTextSize(20);
if (ps.batteryState == PumpState.EMPTY) {
batteryView.setText("{fa-battery-empty}");
batteryView.setTextColor(Color.RED);
batteryView.setTextColor(rh.gac(getContext(), R.attr.warningColor));
} else if (ps.batteryState == PumpState.LOW) {
batteryView.setText("{fa-battery-quarter}");
batteryView.setTextColor(Color.YELLOW);
batteryView.setTextColor(rh.gac(getContext(), R.attr.omniYellowColor));
} else {
batteryView.setText("{fa-battery-full}");
batteryView.setTextColor(Color.WHITE);
@ -192,16 +192,16 @@ public class ComboFragment extends DaggerFragment {
}
if (ps.insulinState == PumpState.UNKNOWN) {
reservoirView.setTextColor(Color.WHITE);
reservoirView.setTextColor(rh.gac(getContext(), R.attr.defaultTextColor));
reservoirView.setTypeface(null, Typeface.NORMAL);
} else if (ps.insulinState == PumpState.LOW) {
reservoirView.setTextColor(Color.YELLOW);
reservoirView.setTextColor(rh.gac(getContext(), R.attr.omniYellowColor));
reservoirView.setTypeface(null, Typeface.BOLD);
} else if (ps.insulinState == PumpState.EMPTY) {
reservoirView.setTextColor(Color.RED);
reservoirView.setTextColor(rh.gac(getContext(), R.attr.warningColor));
reservoirView.setTypeface(null, Typeface.BOLD);
} else {
reservoirView.setTextColor(Color.WHITE);
reservoirView.setTextColor(rh.gac(getContext(), R.attr.defaultTextColor));
reservoirView.setTypeface(null, Typeface.NORMAL);
}
@ -210,13 +210,13 @@ public class ComboFragment extends DaggerFragment {
long min = (System.currentTimeMillis() - comboPlugin.getPump().lastSuccessfulCmdTime) / 1000 / 60;
if (comboPlugin.getPump().lastSuccessfulCmdTime + 60 * 1000 > System.currentTimeMillis()) {
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()) {
lastConnectionView.setText(rh.gs(R.string.combo_no_pump_connection, min));
lastConnectionView.setTextColor(Color.RED);
lastConnectionView.setTextColor(rh.gac(getContext(), R.attr.warningColor));
} else {
lastConnectionView.setText(minAgo);
lastConnectionView.setTextColor(Color.WHITE);
lastConnectionView.setTextColor(rh.gac(getContext(), R.attr.defaultTextColor));
}
// last bolus

View file

@ -1,15 +1,33 @@
package info.nightscout.androidaps.activities
import android.content.Context
import android.os.Bundle
import info.nightscout.androidaps.core.R
import info.nightscout.androidaps.events.EventThemeSwitch
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.utils.locale.LocaleHelper
import io.reactivex.rxjava3.disposables.CompositeDisposable
import javax.inject.Inject
open class NoSplashAppCompatActivity : DaggerAppCompatActivityWithResult() {
override fun onCreate(savedInstanceState: Bundle?) {
@Inject lateinit var rxBus: RxBus
private val compositeDisposable = CompositeDisposable()
public override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setTheme(R.style.AppTheme_NoActionBar)
compositeDisposable.add(rxBus.toObservable(EventThemeSwitch::class.java).subscribe {
recreate()
})
}
override fun onDestroy() {
compositeDisposable.clear()
super.onDestroy()
}
override fun attachBaseContext(newBase: Context) {

View file

@ -44,7 +44,6 @@ import kotlin.math.roundToInt
class TDDStatsActivity : NoSplashAppCompatActivity() {
@Inject lateinit var rxBus: RxBus
@Inject lateinit var sp: SP
@Inject lateinit var profileFunction: ProfileFunction
@Inject lateinit var activePlugin: ActivePlugin
@ -89,27 +88,27 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
// add stats headers to tables
binding.mainTable.addView(
TableRow(this).also { trHead ->
trHead.setBackgroundColor(Color.DKGRAY)
trHead.setBackgroundColor(rh.gac(this, R.attr.tddHeaderBackground))
trHead.layoutParams = TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
trHead.addView(TextView(this).also { labelDate ->
labelDate.text = rh.gs(R.string.date)
labelDate.setTextColor(Color.WHITE)
labelDate.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
trHead.addView(TextView(this).also { labelBasalRate ->
labelBasalRate.text = rh.gs(R.string.basalrate)
labelBasalRate.setTextColor(Color.WHITE)
labelBasalRate.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
trHead.addView(TextView(this).also { labelBolus ->
labelBolus.text = rh.gs(R.string.bolus)
labelBolus.setTextColor(Color.WHITE)
labelBolus.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
trHead.addView(TextView(this).also { labelTdd ->
labelTdd.text = rh.gs(R.string.tdd)
labelTdd.setTextColor(Color.WHITE)
labelTdd.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
trHead.addView(TextView(this).also { labelRatio ->
labelRatio.text = rh.gs(R.string.ratio)
labelRatio.setTextColor(Color.WHITE)
labelRatio.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
}, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
)
@ -117,19 +116,19 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
// cumulative table
binding.cumulativeTable.addView(
TableRow(this).also { ctrHead ->
ctrHead.setBackgroundColor(Color.DKGRAY)
ctrHead.setBackgroundColor(rh.gac(this, R.attr.tddHeaderBackground))
ctrHead.layoutParams = TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
ctrHead.addView(TextView(this).also { labelCumAmountDays ->
labelCumAmountDays.text = rh.gs(R.string.amount_days)
labelCumAmountDays.setTextColor(Color.WHITE)
labelCumAmountDays.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
ctrHead.addView(TextView(this).also { labelCumTdd ->
labelCumTdd.text = rh.gs(R.string.tdd)
labelCumTdd.setTextColor(Color.WHITE)
labelCumTdd.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
ctrHead.addView(TextView(this).also { labelCumRatio ->
labelCumRatio.text = rh.gs(R.string.ratio)
labelCumRatio.setTextColor(Color.WHITE)
labelCumRatio.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
}, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
)
@ -137,19 +136,19 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
// exponential table
binding.expweightTable.addView(
TableRow(this).also { etrHead ->
etrHead.setBackgroundColor(Color.DKGRAY)
etrHead.setBackgroundColor(rh.gac(this, R.attr.tddHeaderBackground))
etrHead.layoutParams = TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
etrHead.addView(TextView(this).also { labelExpWeight ->
labelExpWeight.text = rh.gs(R.string.weight)
labelExpWeight.setTextColor(Color.WHITE)
labelExpWeight.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
etrHead.addView(TextView(this).also { labelExpTdd ->
labelExpTdd.text = rh.gs(R.string.tdd)
labelExpTdd.setTextColor(Color.WHITE)
labelExpTdd.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
etrHead.addView(TextView(this).also { labelExpRatio ->
labelExpRatio.text = rh.gs(R.string.ratio)
labelExpRatio.setTextColor(Color.WHITE)
labelExpRatio.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
}, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
)
@ -285,9 +284,9 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
// Create the table row
binding.mainTable.addView(
TableRow(this@TDDStatsActivity).also { tr ->
if (i % 2 != 0) tr.setBackgroundColor(Color.DKGRAY)
if (i % 2 != 0) tr.setBackgroundColor(rh.gac(this, R.attr.tddHeaderBackground))
if (dummies.contains(record))
tr.setBackgroundColor(Color.argb(125, 255, 0, 0))
tr.setBackgroundColor(rh.gac(this, R.attr.dummyBackground))
tr.id = 100 + i
tr.layoutParams = TableLayout.LayoutParams(
@ -299,27 +298,27 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
tr.addView(TextView(this@TDDStatsActivity).also { labelDATE ->
labelDATE.id = 200 + i
labelDATE.text = df1.format(Date(record.timestamp))
labelDATE.setTextColor(Color.WHITE)
labelDATE.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
tr.addView(TextView(this@TDDStatsActivity).also { labelBASAL ->
labelBASAL.id = 300 + i
labelBASAL.text = rh.gs(R.string.formatinsulinunits, record.basalAmount)
labelBASAL.setTextColor(Color.WHITE)
labelBASAL.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
tr.addView(TextView(this@TDDStatsActivity).also { labelBOLUS ->
labelBOLUS.id = 400 + i
labelBOLUS.text = rh.gs(R.string.formatinsulinunits, record.bolusAmount)
labelBOLUS.setTextColor(Color.WHITE)
labelBOLUS.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
tr.addView(TextView(this@TDDStatsActivity).also { labelTDD ->
labelTDD.id = 500 + i
labelTDD.text = rh.gs(R.string.formatinsulinunits, tdd)
labelTDD.setTextColor(Color.WHITE)
labelTDD.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
tr.addView(TextView(this@TDDStatsActivity).also { labelRATIO ->
labelRATIO.id = 600 + i
labelRATIO.text = (100 * tdd / magicNumber).roundToInt().toString() + "%"
labelRATIO.setTextColor(Color.WHITE)
labelRATIO.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
}, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
)
@ -338,7 +337,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
// Create the cumulative table row
binding.cumulativeTable.addView(
TableRow(this@TDDStatsActivity).also { ctr ->
if (i % 2 == 0) ctr.setBackgroundColor(Color.DKGRAY)
if (i % 2 == 0) ctr.setBackgroundColor(rh.gac(this, R.attr.tddHeaderBackground))
ctr.id = 700 + i
ctr.layoutParams = TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
@ -346,19 +345,19 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
ctr.addView(TextView(this@TDDStatsActivity).also { labelDAYS ->
labelDAYS.id = 800 + i
labelDAYS.text = i.toString()
labelDAYS.setTextColor(Color.WHITE)
labelDAYS.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
ctr.addView(TextView(this@TDDStatsActivity).also { labelCUMTDD ->
labelCUMTDD.id = 900 + i
labelCUMTDD.text = rh.gs(R.string.formatinsulinunits, sum / i)
labelCUMTDD.setTextColor(Color.WHITE)
labelCUMTDD.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
ctr.addView(TextView(this@TDDStatsActivity).also { labelCUMRATIO ->
labelCUMRATIO.id = 1000 + i
labelCUMRATIO.text = (100 * sum / i / magicNumber).roundToInt().toString() + "%"
labelCUMRATIO.setTextColor(Color.WHITE)
labelCUMRATIO.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
}, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
)
@ -366,7 +365,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
if (isOldData(historyList) && activePlugin.activePump.pumpDescription.needsManualTDDLoad) {
binding.message.visibility = View.VISIBLE
binding.message.text = rh.gs(R.string.olddata_Message)
} else binding.mainTable.setBackgroundColor(Color.TRANSPARENT)
} else binding.mainTable.setBackgroundColor(rh.gac(this, R.attr.mainTableBackground))
if (historyList.isNotEmpty() && df1.format(Date(historyList[0].timestamp)) == df1.format(Date())) {
//Today should not be included
historyList.removeAt(0)
@ -390,7 +389,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
// Create the exponential table row
binding.expweightTable.addView(
TableRow(this@TDDStatsActivity).also { etr ->
if (i % 2 != 0) etr.setBackgroundColor(Color.DKGRAY)
if (i % 2 != 0) etr.setBackgroundColor(rh.gac(this, R.attr.tddHeaderBackground))
etr.id = 1100 + i
etr.layoutParams = TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
@ -398,7 +397,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
etr.addView(TextView(this@TDDStatsActivity).also { labelWEIGHT ->
labelWEIGHT.id = 1200 + i
labelWEIGHT.text = "0.3\n0.5\n0.7"
labelWEIGHT.setTextColor(Color.WHITE)
labelWEIGHT.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
etr.addView(TextView(this@TDDStatsActivity).also { labelEXPTDD ->
labelEXPTDD.id = 1300 + i
@ -407,7 +406,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
${rh.gs(R.string.formatinsulinunits, weighted05)}
${rh.gs(R.string.formatinsulinunits, weighted07)}
""".trimIndent()
labelEXPTDD.setTextColor(Color.WHITE)
labelEXPTDD.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
etr.addView(TextView(this@TDDStatsActivity).also { labelEXPRATIO ->
labelEXPRATIO.id = 1400 + i
@ -416,7 +415,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
${(100 * weighted05 / magicNumber).roundToInt()}%
${(100 * weighted07 / magicNumber).roundToInt()}%
""".trimIndent()
labelEXPRATIO.setTextColor(Color.WHITE)
labelEXPRATIO.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
}, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
)

View file

@ -1,3 +1,3 @@
package info.nightscout.androidaps.events
class EventThemeSwitch : Event()
package info.nightscout.androidaps.events
class EventThemeSwitch : Event()

View file

@ -87,8 +87,8 @@ class PrefImportListActivity : DaggerAppCompatActivity() {
prefFile.metadata[PrefsMetadataKey.AAPS_FLAVOUR]?.let {
metaVariantFormat.text = it.value
val color = if (it.status == PrefsStatus.OK) R.color.metadataOk else R.color.metadataTextWarning
metaVariantFormat.setTextColor(rh.gc(color))
val colorattr = if (it.status == PrefsStatus.OK) R.attr.metadataTextOkColor else R.attr.metadataTextWarningColor
metaVariantFormat.setTextColor(rh.gac( metaVariantFormat.context, colorattr))
}
prefFile.metadata[PrefsMetadataKey.CREATED_AT]?.let {
@ -97,8 +97,8 @@ class PrefImportListActivity : DaggerAppCompatActivity() {
prefFile.metadata[PrefsMetadataKey.AAPS_VERSION]?.let {
metaAppVersion.text = it.value
val color = if (it.status == PrefsStatus.OK) R.color.metadataOk else R.color.metadataTextWarning
metaAppVersion.setTextColor(rh.gc(color))
val colorattr = if (it.status == PrefsStatus.OK) R.attr.metadataTextOkColor else R.attr.metadataTextWarningColor
metaAppVersion.setTextColor(rh.gac( metaVariantFormat.context, colorattr))
}
prefFile.metadata[PrefsMetadataKey.DEVICE_NAME]?.let {

View file

@ -1,6 +1,5 @@
package info.nightscout.androidaps.utils
import android.graphics.Color
import android.widget.TextView
import info.nightscout.androidaps.core.R
import info.nightscout.androidaps.database.entities.TherapyEvent
@ -12,28 +11,25 @@ import javax.inject.Singleton
@Singleton
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) =
view?.setTextColor(when {
value >= urgentLevel -> urgentColor
value >= warnLevel -> warnColor
else -> normalColor
})
view?.setTextColor( rh.gac( view.context ,when {
value >= urgentLevel -> R.attr.urgentColor
value >= warnLevel -> R.attr.warnColor
else -> R.attr.defaultTextColor
}))
fun setColorInverse(view: TextView?, value: Double, warnLevel: Double, urgentLevel: Double) =
view?.setTextColor(when {
value <= urgentLevel -> urgentColor
value <= warnLevel -> warnColor
else -> normalColor
})
view?.setTextColor( rh.gac( view.context , when {
value <= urgentLevel -> R.attr.urgentColor
value <= warnLevel -> R.attr.warnColor
else -> R.attr.defaultTextColor
}))
fun setColorByAge(view: TextView?, therapyEvent: TherapyEvent, warnThreshold: Double, urgentThreshold: Double) =
view?.setTextColor(when {
therapyEvent.isOlderThan(urgentThreshold) -> rh.gc(R.color.low)
therapyEvent.isOlderThan(warnThreshold) -> rh.gc(R.color.high)
else -> Color.WHITE
})
view?.setTextColor( rh.gac( view.context , when {
therapyEvent.isOlderThan(urgentThreshold) -> R.attr.lowColor
therapyEvent.isOlderThan(warnThreshold) -> R.attr.highColor
else -> R.attr.defaultTextColor
}))
}

View file

@ -5,5 +5,5 @@
android:viewportHeight="24">
<path
android:pathData="M18.783,12.728c-0.1,-2.66 -0.143,-5.908 0.243,-7.753l0.001,-0.001c0,0 -0.001,0 -0.001,0c0,0 0,-0.001 0,-0.001l-0.001,0.001c-1.845,0.386 -5.093,0.343 -7.753,0.243l-0.351,2.225c0,0 2.111,0.12 4.003,0.146L4.229,18.283l1.488,1.488L16.412,9.076c0.026,1.892 0.146,4.003 0.146,4.003L18.783,12.728z"
android:fillColor="@color/white"/>
android:fillColor="?attr/icCheckboxTrendColor"/>
</vector>

View file

@ -179,7 +179,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/reload"
style="@style/ButtonSmallFontStyle"
style="?android:attr/buttonStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"

View file

@ -9,7 +9,6 @@
<color name="mdtp_line_dark">#808080</color>
<color name="colorLightGray">#d8d8d8</color>
<color name="cardColorBackground">#212121</color>
<color name="black_overlay">#66000000</color>
<color name="gray">#BBBBBB</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
@ -172,6 +171,7 @@
<color name="info">#77dd77</color>
<color name="error_background">#66FC0000</color>
<color name="ok_background">@color/colorPrimaryDark</color>
<color name="dummy_background">#7DFF0000</color>
<color name="tempTargetBackground">#77dd77</color>
<color name="exercise">#67DFE8</color>
@ -212,9 +212,64 @@
<color name="sphere_plastic_grey">#8c8c8c</color>
<color name="lightSandGray">#72000000</color>
<color name="sandGray">#c8666666</color>
<color name="treatment">#B2B2B2</color>
<color name="midgray">#B2B2B2</color>
<color name="lightgray">#4dB1B1B1</color>
<color name="mdtp_button_selected">#33969696</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>

View file

@ -125,7 +125,7 @@
<item name="cgmxdripColor">@color/colorCalibrationButton</item>
<!---BG color-->
<item name="bgLow">@color/low</item>
<item name="bgHigh">@color/high</item>
<item name="highColor">@color/high</item>
<item name="bgInRange">@color/inrange</item>
<!---Profile Helper -->
<item name="helperProfileColor">@color/helperProfile</item>
@ -144,6 +144,31 @@
<item name="cobAlertColor">@color/cobAlert</item>
<!---Fill dialog -->
<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>
<!---Automation -->
<item name="userAction">@color/mdtp_line_dark</item>
<item name="validActions">@color/ribbonDefault</item>
<item name="actionsError">@color/errorAlertBackground</item>
<item name="automationBackgroundColor">@color/black</item>
<item name="automationOverlayColor">@color/black_alpha_40</item>
<!---BG source -->
<item name="bgsourceError">@color/errorAlertBackground</item>
<!---TDD-statistics -->
<item name="tddHeaderBackground">@android:color/darker_gray</item>
<item name="mainTableBackground">@android:color/transparent</item>
<item name="dummyBackground">@color/dummy_background</item>
<!-- Icon Colors -->
<item name="icCheckboxTrendColor">@color/white</item>
</style>
<style name="Theme.MaterialComponents.DayNight.DarkActionBar" parent="Theme.MaterialComponents.DayNight.Bridge"/>

View file

@ -99,7 +99,7 @@
<attr name="cgmxdripColor" format="reference|color" />
<!---BG 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" />
<!---Profile Helper -->
<attr name="helperProfileColor" format="reference|color" />
@ -109,6 +109,10 @@
<attr name="errorBackgroundColor" format="reference|color" />
<!---Warning -->
<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 -->
<attr name="defaultTextColor" format="reference|color" />
<!---Profile viewer TempBasal -->
@ -118,4 +122,25 @@
<attr name="cobAlertColor" format="reference|color" />
<!---Fill dialog -->
<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" />
<!---Automation -->
<attr name="userAction" format="reference|color" />
<attr name="validActions" format="reference|color" />
<attr name="actionsError" format="reference|color" />
<attr name="automationBackgroundColor" format="reference|color" />
<attr name="automationOverlayColor" format="reference|color" />
<!---BG source -->
<attr name="bgsourceError" format="reference|color" />
<!---TDD-statistics -->
<attr name="tddHeaderBackground" format="reference|color" />
<attr name="mainTableBackground" format="reference|color" />
<attr name="dummyBackground" format="reference|color" />
<!-- Icon Colors -->
<attr name="icCheckboxTrendColor" format="reference|color" />
</resources>

View file

@ -9,7 +9,6 @@
<color name="mdtp_line_dark">#808080</color>
<color name="colorLightGray">#d8d8d8</color>
<color name="cardColorBackground">@color/lightgray</color>
<color name="black_overlay">#66000000</color>
<color name="gray">#BBBBBB</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
@ -81,7 +80,7 @@
<!-- BgReading-->
<color name="inrange">#00FF00</color>
<color name="low">#FF0000</color>
<color name="high">#FFFF00</color>
<color name="high">#FFFB8C00</color>
<color name="iob">#1e88e5</color>
<color name="extendedBolus">#67DFE8</color>
<color name="iobPredAS">#1ea3e5</color>
@ -173,6 +172,7 @@
<color name="info">#77dd77</color>
<color name="error_background">#66FC0000</color>
<color name="ok_background">@color/white</color>
<color name="dummy_background">#7DFF0000</color>
<color name="tempTargetBackground">#77dd77</color>
<color name="exercise">#67DFE8</color>
@ -213,9 +213,77 @@
<color name="sphere_plastic_grey">#8c8c8c</color>
<color name="lightSandGray">#72000000</color>
<color name="sandGray">#c8666666</color>
<color name="treatment">#B2B2B2</color>
<color name="midgray">#B2B2B2</color>
<color name="lightgray">#4dB1B1B1</color>
<color name="mdtp_button_selected">#33969696</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>
<!---Example light theme colors -->
<color name="aaps_theme_light_primary">#1D5FA5</color>
<color name="aaps_theme_light_onPrimary">#FFFFFF</color>
<color name="aaps_theme_light_secondary">#5954A8</color>
<color name="aaps_theme_light_onSecondary">#FFFFFF</color>
<color name="aaps_theme_light_error">#B3261E</color>
<color name="aaps_theme_light_onError">#FFFFFF</color>
<color name="aaps_theme_light_background">#FFFBFE</color>
<color name="aaps_theme_light_onBackground">#1C1B1F</color>
<color name="aaps_theme_light_surface">#FFFBFE</color>
<color name="aaps_theme_light_onSurface">#1C1B1F</color>
<color name="aaps_theme_light_surfaceVariant">#E7E0EC</color>
</resources>

View file

@ -2,22 +2,26 @@
<resources xmlns:ns2="http://schemas.android.com/tools">
<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<!---Example light theme colors -->
<item name="colorPrimary">@color/lightSandGray</item>
<item name="colorOnPrimary">@color/aaps_theme_light_onPrimary</item>
<item name="colorSecondary">@color/aaps_theme_light_secondary</item>
<item name="colorOnSecondary">@color/aaps_theme_light_onSecondary</item>
<item name="colorError">@color/aaps_theme_light_error</item>
<item name="colorOnError">@color/aaps_theme_light_onError</item>
<item name="android:colorBackground">@color/aaps_theme_light_background</item>
<item name="colorOnBackground">@color/aaps_theme_light_onBackground</item>
<item name="colorSurface">@color/aaps_theme_light_surface</item>
<item name="colorOnSurface">@color/aaps_theme_light_onSurface</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@android:color/holo_blue_light</item>
<item name="colorAccent">@color/aaps_theme_light_secondary</item>
<item name="dialogTitleBackground">@color/dialog_title_background</item>
<item name="dialogTitleColor">@color/dialog_title_color</item>
<item name="dialogTitleIconTint">@color/dialog_title_icon_tint</item>
<!-- New MaterialComponents attributes. -->
<item name="colorSecondary">@android:color/holo_blue_light</item>
<item name="colorPrimaryVariant">@color/primaryLightColorDefault</item>
<item name="colorSecondaryVariant">@color/secondaryLightColorDefault</item>
<item name="colorOnPrimary">@color/primaryTextColorDefault</item>
<item name="colorSurface">@color/white</item>
<item name="colorOnSurface">@color/gray</item>
<item name="colorOnSecondary">@color/black</item>
<item name="colorOnBackground">@color/white</item>
<item name="colorOnError">@color/black</item>
<item name="scrimBackground">@color/white</item>
<item name="popupMenuStyle">@style/Widget.MaterialComponents.PopupMenu</item>
<item name="actionOverflowMenuStyle">@style/Widget.MaterialComponents.PopupMenu.Overflow</item>
@ -120,11 +124,11 @@
<item name="viewPortbackgroundColor">@color/white_alpha_20</item>
<item name="tempTargetBackgroundColor">@color/tempTargetBackground</item>
<!---CGM source-->
<item name="cgmdexColor">@color/colorLightGray</item>
<item name="cgmdexColor">@color/mdtp_line_dark</item>
<item name="cgmxdripColor">@color/colorCalibrationButton</item>
<!---BG color-->
<item name="bgLow">@color/low</item>
<item name="bgHigh">@color/high</item>
<item name="highColor">@color/high</item>
<item name="bgInRange">@color/inrange</item>
<!---Profile Helper -->
<item name="helperProfileColor">@color/helperProfile</item>
@ -143,6 +147,31 @@
<item name="cobAlertColor">@color/cobAlert</item>
<!---Fill dialog -->
<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>
<!---Automation -->
<item name="userAction">@color/mdtp_line_dark</item>
<item name="validActions">@color/ribbonDefault</item>
<item name="actionsError">@color/errorAlertBackground</item>
<item name="automationBackgroundColor">@color/black</item>
<item name="automationOverlayColor">@color/black_alpha_40</item>
<!---BG source -->
<item name="bgsourceError">@color/errorAlertBackground</item>
<!---TDD-statistics -->
<item name="tddHeaderBackground">@android:color/darker_gray</item>
<item name="mainTableBackground">@android:color/transparent</item>
<item name="dummyBackground">@color/dummy_background</item>
<!-- Icon Colors -->
<!-- Trend Arrow -->
<item name="icCheckboxTrendColor">@color/black</item>
</style>
<style name="Theme.MaterialComponents.DayNight.DarkActionBar" parent="Theme.MaterialComponents.DayNight.Bridge"/>

View file

@ -38,7 +38,6 @@ import javax.inject.Inject
class DanaHistoryActivity : NoSplashAppCompatActivity() {
@Inject lateinit var rxBus: RxBus
@Inject lateinit var profileFunction: ProfileFunction
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var activePlugin: ActivePlugin

View file

@ -26,7 +26,6 @@ import kotlin.math.min
class DanaUserOptionsActivity : NoSplashAppCompatActivity() {
@Inject lateinit var rxBus: RxBus
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var context: Context
@Inject lateinit var danaPump: DanaPump

View file

@ -30,7 +30,6 @@ import javax.inject.Inject
class BLEScanActivity : NoSplashAppCompatActivity() {
@Inject lateinit var sp: SP
@Inject lateinit var rxBus: RxBus
@Inject lateinit var blePreCheck: BlePreCheck
@Inject lateinit var context: Context

View file

@ -22,7 +22,6 @@ import kotlin.experimental.xor
class EnterPinActivity : NoSplashAppCompatActivity() {
@Inject lateinit var rxBus: RxBus
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var danaRSPlugin: DanaRSPlugin
@Inject lateinit var sp: SP

View file

@ -32,7 +32,6 @@ import javax.inject.Inject
class DiaconnG8BLEScanActivity : NoSplashAppCompatActivity() {
@Inject lateinit var sp: SP
@Inject lateinit var rxBus: RxBus
@Inject lateinit var blePreCheck: BlePreCheck
@Inject lateinit var context: Context

View file

@ -33,7 +33,6 @@ import javax.inject.Inject
class DiaconnG8HistoryActivity : NoSplashAppCompatActivity() {
@Inject lateinit var rxBus: RxBus
@Inject lateinit var profileFunction: ProfileFunction
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var activePlugin: ActivePlugin

View file

@ -25,7 +25,6 @@ import javax.inject.Inject
class DiaconnG8UserOptionsActivity : NoSplashAppCompatActivity() {
@Inject lateinit var rxBus: RxBus
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var context: Context
@Inject lateinit var diaconnG8Pump: DiaconnG8Pump

View file

@ -92,7 +92,7 @@ class MedtronicFragment : DaggerFragment() {
binding.rlStatus.text = rh.gs(RileyLinkServiceState.NotStarted.resourceId)
binding.pumpStatusIcon.setTextColor(Color.WHITE)
binding.pumpStatusIcon.setTextColor(rh.gac(context,R.attr.defaultTextColor))
@SuppressLint("SetTextI18n")
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))
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 =
rileyLinkServiceData.rileyLinkError?.let {
@ -272,7 +272,7 @@ class MedtronicFragment : DaggerFragment() {
val min = (System.currentTimeMillis() - medtronicPumpStatus.lastConnection) / 1000 / 60
if (medtronicPumpStatus.lastConnection + 60 * 1000 > System.currentTimeMillis()) {
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()) {
if (min < 60) {
@ -288,10 +288,10 @@ class MedtronicFragment : DaggerFragment() {
binding.lastConnection.text = (rh.gq(R.plurals.duration_days, d, d) + " "
+ rh.gs(R.string.ago))
}
binding.lastConnection.setTextColor(Color.RED)
binding.lastConnection.setTextColor(rh.gac(context,R.attr.warningColor))
} else {
binding.lastConnection.text = minAgo
binding.lastConnection.setTextColor(Color.WHITE)
binding.lastConnection.setTextColor(rh.gac(context,R.attr.defaultTextColor))
}
}

View file

@ -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.ui.wizard.common.activity.OmnipodWizardActivityBase
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
abstract class WizardFragmentBase : DaggerFragment() {
protected lateinit var viewModel: ViewModelBase
@Inject lateinit var rh: ResourceHelper
var _binding: OmnipodCommonWizardBaseFragmentBinding? = null
var _progressIndicationBinding: OmnipodCommonWizardProgressIndicationBinding? = null
@ -48,7 +51,7 @@ abstract class WizardFragmentBase : DaggerFragment() {
if (nextPage == null) {
binding.navButtonsLayout.buttonNext.text = getString(R.string.omnipod_common_wizard_button_finish)
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()

View file

@ -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>

View file

@ -209,11 +209,11 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
private fun setTextViewColor(check_result: Boolean, textview: TextView, record: HistoryRecord) {
if (check_result && !record.isSuccess()) {
// Record says not success
textview.setTextColor(android.graphics.Color.YELLOW)
textview.setTextColor(rh.gac( textview.context, R.attr.omniYellowColor))
return
}
// On success set color
val textColor = when (record.commandType) {
val textColorAttr = when (record.commandType) {
// Operational
OmnipodCommandType.INITIALIZE_POD,
OmnipodCommandType.CONFIGURE_ALERTS,
@ -223,25 +223,25 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
OmnipodCommandType.SUSPEND_DELIVERY,
OmnipodCommandType.RESUME_DELIVERY,
OmnipodCommandType.SET_BASAL_PROFILE -> {
android.graphics.Color.CYAN
R.attr.omniCyanColor
}
// User action
OmnipodCommandType.PLAY_TEST_BEEP,
OmnipodCommandType.ACKNOWLEDGE_ALERTS,
OmnipodCommandType.CANCEL_BOLUS -> {
android.graphics.Color.GREEN
R.attr.omniCyanColor
}
// Insulin treatment
OmnipodCommandType.SET_BOLUS,
OmnipodCommandType.SET_TEMPORARY_BASAL -> {
android.graphics.Color.WHITE
R.attr.defaultTextColor
}
else ->
// 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) {

View file

@ -28,7 +28,6 @@ import javax.inject.Inject
class DashPodManagementActivity : NoSplashAppCompatActivity() {
@Inject lateinit var rxBus: RxBus
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var commandQueue: CommandQueue
@Inject lateinit var injector: HasAndroidInjector

View file

@ -267,14 +267,14 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
val quality =
"${podStateManager.successfulConnectionAttemptsAfterRetries}/$connectionAttempts :: $successPercentageString"
bluetoothStatusBinding.omnipodDashBluetoothConnectionQuality.text = quality
val connectionStatsColor = when {
val connectionStatsColor = rh.gac( context, when {
connectionSuccessPercentage < 70 && podStateManager.successfulConnectionAttemptsAfterRetries > 50 ->
Color.RED
R.attr.warningColor
connectionSuccessPercentage < 90 && podStateManager.successfulConnectionAttemptsAfterRetries > 50 ->
Color.YELLOW
R.attr.omniYellowColor
else ->
Color.WHITE
}
R.attr.defaultTextColor
})
bluetoothStatusBinding.omnipodDashBluetoothConnectionQuality.setTextColor(connectionStatsColor)
bluetoothStatusBinding.omnipodDashDeliveryStatus.text = podStateManager.deliveryStatus?.let {
podStateManager.deliveryStatus.toString()
@ -296,11 +296,11 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
podInfoBinding.firmwareVersion.text = PLACEHOLDER
podInfoBinding.timeOnPod.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.totalDelivered.text = PLACEHOLDER
podInfoBinding.reservoir.text = PLACEHOLDER
podInfoBinding.reservoir.setTextColor(Color.WHITE)
podInfoBinding.reservoir.setTextColor(rh.gac(context,R.attr.defaultTextColor))
podInfoBinding.podActiveAlerts.text = PLACEHOLDER
} else {
podInfoBinding.uniqueId.text = podStateManager.uniqueId.toString()
@ -335,14 +335,15 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
).isNegative
} ?: false
podInfoBinding.timeOnPod.setTextColor(
rh.gac( context,
when {
!podStateManager.sameTimeZone ->
Color.MAGENTA
R.attr.omniMagentaColor
timeDeviationTooBig ->
Color.YELLOW
R.attr.omniYellowColor
else ->
Color.WHITE
}
R.attr.defaultTextColor
})
)
// Update Pod expiry time
@ -352,14 +353,15 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
}
?: PLACEHOLDER
podInfoBinding.podExpiryDate.setTextColor(
when {
rh.gac( context,
when {
expiresAt != null && ZonedDateTime.now().isAfter(expiresAt) ->
Color.RED
R.attr.warningColor
expiresAt != null && ZonedDateTime.now().isAfter(expiresAt.minusHours(4)) ->
Color.YELLOW
R.attr.omniYellowColor
else ->
Color.WHITE
}
R.attr.defaultTextColor
})
)
podStateManager.alarmType?.let {
@ -399,7 +401,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
if (podStateManager.pulsesRemaining == null) {
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 {
// TODO
// val lowReservoirThreshold = (omnipodAlertUtil.lowReservoirAlertUnits
@ -411,11 +413,12 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
(podStateManager.pulsesRemaining!! * PodConstants.POD_PULSE_BOLUS_UNITS)
)
podInfoBinding.reservoir.setTextColor(
rh.gac(context,
if (podStateManager.pulsesRemaining!! < lowReservoirThreshold) {
Color.RED
R.attr.warningColor
} else {
Color.WHITE
}
R.attr.defaultTextColor
})
)
}
@ -426,10 +429,10 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
if (errors.size == 0) {
podInfoBinding.errors.text = PLACEHOLDER
podInfoBinding.errors.setTextColor(Color.WHITE)
podInfoBinding.errors.setTextColor(rh.gac(context,R.attr.defaultTextColor))
} else {
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 =
rh.gac(context,
if (omnipodDashPumpPlugin.isUnreachableAlertTimeoutExceeded(getPumpUnreachableTimeout().toMillis())) {
Color.RED
R.attr.warningColor
} else {
Color.WHITE
}
R.attr.defaultTextColor
})
podInfoBinding.lastConnection.setTextColor(lastConnectionColor)
} else {
podInfoBinding.lastConnection.setTextColor(Color.WHITE)
podInfoBinding.lastConnection.setTextColor(rh.gac(context,R.attr.defaultTextColor ))
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 ->
Color.RED
R.attr.warningColor
podStateManager.activeCommand != null ->
Color.YELLOW
R.attr.omniYellowColor
else ->
Color.WHITE
}
R.attr.defaultTextColor
})
podInfoBinding.podStatus.setTextColor(podStatusColor)
}
private fun updateLastBolus() {
var textColor = Color.WHITE
var textColorAttr = R.attr.defaultTextColor
podStateManager.activeCommand?.let {
val requestedBolus = it.requestedBolus
if (requestedBolus != null) {
@ -532,14 +536,14 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
readableDuration(Duration.ofMillis(SystemClock.elapsedRealtime() - it.createdRealtime))
)
text += " (uncertain) "
textColor = Color.RED
textColorAttr = R.attr.warningColor
podInfoBinding.lastBolus.text = text
podInfoBinding.lastBolus.setTextColor(textColor)
podInfoBinding.lastBolus.setTextColor(rh.gac(context, textColorAttr))
return
}
}
podInfoBinding.lastBolus.setTextColor(textColor)
podInfoBinding.lastBolus.setTextColor(rh.gac(context, textColorAttr))
podStateManager.lastBolus?.let {
// display requested units if delivery is in progress
val bolusSize = it.deliveredUnits()
@ -552,10 +556,10 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
readableDuration(Duration.ofMillis(System.currentTimeMillis() - it.startTime))
)
if (!it.deliveryComplete) {
textColor = Color.YELLOW
textColorAttr = R.attr.omniYellowColor
}
podInfoBinding.lastBolus.text = text
podInfoBinding.lastBolus.setTextColor(textColor)
podInfoBinding.lastBolus.setTextColor(rh.gac(context, textColorAttr))
return
}
podInfoBinding.lastBolus.text = PLACEHOLDER

View file

@ -43,7 +43,6 @@ import javax.inject.Inject
*/
class ErosPodManagementActivity : NoSplashAppCompatActivity() {
@Inject lateinit var rxBus: RxBus
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var commandQueue: CommandQueue
@Inject lateinit var podStateManager: ErosPodStateManager

View file

@ -245,7 +245,7 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
rileyLinkServiceState.isError && rileyLinkError != null -> "{fa-bluetooth-b} " + rh.gs(rileyLinkError.getResourceId(RileyLinkTargetDevice.Omnipod))
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() {
@ -273,11 +273,11 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
podInfoBinding.firmwareVersion.text = PLACEHOLDER
podInfoBinding.timeOnPod.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.totalDelivered.text = PLACEHOLDER
podInfoBinding.reservoir.text = PLACEHOLDER
podInfoBinding.reservoir.setTextColor(Color.WHITE)
podInfoBinding.reservoir.setTextColor(rh.gac(context, R.attr.defaultTextColor))
podInfoBinding.podActiveAlerts.text = PLACEHOLDER
} else {
podInfoBinding.uniqueId.text = podStateManager.address.toString()
@ -287,25 +287,27 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
podInfoBinding.timeOnPod.text = readableZonedTime(podStateManager.time)
podInfoBinding.timeOnPod.setTextColor(
rh.gac(context,
if (podStateManager.timeDeviatesMoreThan(OmnipodConstants.TIME_DEVIATION_THRESHOLD)) {
Color.RED
R.attr.defaultTextColor
} else {
Color.WHITE
}
R.attr.warningColor
})
)
val expiresAt = podStateManager.expiresAt
if (expiresAt == null) {
podInfoBinding.podExpiryDate.text = PLACEHOLDER
podInfoBinding.podExpiryDate.setTextColor(Color.WHITE)
podInfoBinding.podExpiryDate.setTextColor(rh.gac(context, R.attr.defaultTextColor))
} else {
podInfoBinding.podExpiryDate.text = readableZonedTime(expiresAt)
podInfoBinding.podExpiryDate.setTextColor(
rh.gac(context,
if (DateTime.now().isAfter(expiresAt)) {
Color.RED
R.attr.warningColor
} else {
Color.WHITE
R.attr.defaultTextColor
}
)
))
}
if (podStateManager.isPodFaulted) {
@ -331,18 +333,19 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
// reservoir
if (podStateManager.reservoirLevel == null) {
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 {
val lowReservoirThreshold = (omnipodAlertUtil.lowReservoirAlertUnits
?: OmnipodConstants.DEFAULT_MAX_RESERVOIR_ALERT_THRESHOLD).toDouble()
podInfoBinding.reservoir.text = rh.gs(R.string.omnipod_common_overview_reservoir_value, podStateManager.reservoirLevel)
podInfoBinding.reservoir.setTextColor(
rh.gac(context,
if (podStateManager.reservoirLevel < lowReservoirThreshold) {
Color.RED
R.attr.warningColor
} else {
Color.WHITE
}
R.attr.defaultTextColor
})
)
}
@ -355,10 +358,10 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
if (errors.size == 0) {
podInfoBinding.errors.text = PLACEHOLDER
podInfoBinding.errors.setTextColor(Color.WHITE)
podInfoBinding.errors.setTextColor(rh.gac(context, R.attr.defaultTextColor))
} else {
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) {
podInfoBinding.lastConnection.text = readableDuration(podStateManager.lastSuccessfulCommunication)
val lastConnectionColor =
rh.gac(context,
if (omnipodErosPumpPlugin.isUnreachableAlertTimeoutExceeded(getPumpUnreachableTimeout().millis)) {
Color.RED
R.attr.warningColor
} else {
Color.WHITE
}
R.attr.defaultTextColor
})
podInfoBinding.lastConnection.setTextColor(lastConnectionColor)
} else {
podInfoBinding.lastConnection.setTextColor(Color.WHITE)
podInfoBinding.lastConnection.setTextColor(rh.gac(context, R.attr.defaultTextColor))
podInfoBinding.lastConnection.text = if (podStateManager.hasPodState() && podStateManager.lastSuccessfulCommunication != null) {
readableDuration(podStateManager.lastSuccessfulCommunication)
} else {
@ -418,11 +422,12 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
}
val podStatusColor =
rh.gac( context,
if (!podStateManager.isPodActivationCompleted || podStateManager.isPodDead || podStateManager.isSuspended || (podStateManager.isPodRunning && !podStateManager.isBasalCertain)) {
Color.RED
R.attr.warningColor
} else {
Color.WHITE
}
R.attr.defaultTextColor
})
podInfoBinding.podStatus.setTextColor(podStatusColor)
}
@ -436,11 +441,10 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
readableDuration(podStateManager.lastBolusStartTime)
)
val textColor: Int
if (podStateManager.isLastBolusCertain) {
textColor = Color.WHITE
textColor = rh.gac(context, R.attr.defaultTextColor)
} else {
textColor = Color.RED
textColor = rh.gac(context, R.attr.warningColor)
text += " (" + rh.gs(R.string.omnipod_eros_uncertain) + ")"
}
@ -449,7 +453,7 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
} else {
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.hasTempBasal()) {
podInfoBinding.tempBasal.text = "???"
podInfoBinding.tempBasal.setTextColor(Color.RED)
podInfoBinding.tempBasal.setTextColor(rh.gac(context, R.attr.warningColor))
} else {
val now = DateTime.now()
@ -471,9 +475,9 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
val textColor: Int
text = rh.gs(R.string.omnipod_common_overview_temp_basal_value, amount, dateUtil.timeString(startTime.millis), minutesRunning, duration.standardMinutes)
if (podStateManager.isTempBasalCertain) {
textColor = Color.WHITE
textColor = rh.gac(context, R.attr.defaultTextColor)
} else {
textColor = Color.RED
textColor = rh.gac(context, R.attr.warningColor)
text += " (" + rh.gs(R.string.omnipod_eros_uncertain) + ")"
}
@ -485,9 +489,9 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
val textColor: Int
if (!podStateManager.isPodActivationCompleted || podStateManager.isTempBasalCertain) {
textColor = Color.WHITE
textColor = rh.gac(context, R.attr.defaultTextColor)
} else {
textColor = Color.RED
textColor = rh.gac(context, R.attr.warningColor)
text += " (" + rh.gs(R.string.omnipod_eros_uncertain) + ")"
}

View file

@ -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>