Set icon and text color in Overview according to MGC plugin

This commit is contained in:
Philoul 2021-12-06 23:48:10 +01:00
parent a75451e80e
commit 61017e1b54

View file

@ -557,10 +557,13 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
val xDripIsBgSource = xdripPlugin.isEnabled() val xDripIsBgSource = xdripPlugin.isEnabled()
val dexcomIsSource = dexcomPlugin.isEnabled() val dexcomIsSource = dexcomPlugin.isEnabled()
binding.buttonsLayout.calibrationButton.visibility = ((xDripIsBgSource || dexcomIsSource) && actualBG != null && sp.getBoolean(R.string.key_show_calibration_button, true)).toVisibility() binding.buttonsLayout.calibrationButton.visibility = ((xDripIsBgSource || dexcomIsSource) && actualBG != null && sp.getBoolean(R.string.key_show_calibration_button, true)).toVisibility()
if (dexcomPlugin.isEnabled()) if (dexcomPlugin.isEnabled()) {
binding.buttonsLayout.cgmButton.setCompoundDrawables(rh.gd(R.drawable.ic_xdrip), null, null, null) binding.buttonsLayout.cgmButton.setCompoundDrawablesWithIntrinsicBounds(null, rh.gd(R.drawable.ic_byoda), null, null)
else if (xdripPlugin.isEnabled()) binding.buttonsLayout.cgmButton.setTextColor(rh.gc(R.color.white))
binding.buttonsLayout.cgmButton.setCompoundDrawables(rh.gd(R.drawable.ic_byoda), null, null, null) } else if (xdripPlugin.isEnabled()) {
binding.buttonsLayout.cgmButton.setCompoundDrawablesWithIntrinsicBounds(null, rh.gd(R.drawable.ic_xdrip), null, null)
binding.buttonsLayout.cgmButton.setTextColor(rh.gc(R.color.colorCalibrationButton))
}
binding.buttonsLayout.cgmButton.visibility = (sp.getBoolean(R.string.key_show_cgm_button, false) && (xDripIsBgSource || dexcomIsSource)).toVisibility() binding.buttonsLayout.cgmButton.visibility = (sp.getBoolean(R.string.key_show_cgm_button, false) && (xDripIsBgSource || dexcomIsSource)).toVisibility()
// Automation buttons // Automation buttons