chore: wear watchface use databinding

This commit is contained in:
Andries Smit 2022-07-05 22:07:38 +02:00
parent 9a409a5d12
commit 5c923d4a07
30 changed files with 743 additions and 706 deletions

View file

@ -6,6 +6,7 @@ import info.nightscout.androidaps.comm.DataLayerListenerServiceWear
import info.nightscout.androidaps.complications.*
import info.nightscout.androidaps.tile.*
import info.nightscout.androidaps.watchfaces.*
import info.nightscout.androidaps.watchfaces.utils.BaseWatchFace
@Module
@Suppress("unused")

View file

@ -1,116 +1,93 @@
package info.nightscout.androidaps.watchfaces
import android.graphics.Color
import androidx.annotation.LayoutRes
import android.view.LayoutInflater
import androidx.core.content.ContextCompat
import androidx.viewbinding.ViewBinding
import com.ustwo.clockwise.common.WatchMode
import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.ActivityHomeLargeBinding
import info.nightscout.androidaps.watchfaces.utils.BaseWatchFace
class AapsLargeWatchface : BaseWatchFace() {
@LayoutRes override fun layoutResource(): Int = R.layout.activity_home_large
private lateinit var binding: ActivityHomeLargeBinding
override fun inflateLayout(inflater: LayoutInflater): ViewBinding {
binding = ActivityHomeLargeBinding.inflate(inflater)
return binding
}
override fun setColorDark() {
mLinearLayout?.setBackgroundColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_background else R.color.dark_mLinearLayout))
mTime?.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime))
mRelativeLayout?.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
when (singleBg.sgvLevel) {
1L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_highColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_highColor))
mDirection?.setTextColor(ContextCompat.getColor(this, R.color.dark_highColor))
}
0L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mDirection?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
}
-1L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_lowColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_lowColor))
mDirection?.setTextColor(ContextCompat.getColor(this, R.color.dark_lowColor))
}
binding.secondaryLayout.setBackgroundColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_background else R.color.dark_mLinearLayout))
binding.time.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime))
binding.mainLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
val color = when (singleBg.sgvLevel) {
1L -> R.color.dark_highColor
0L -> R.color.dark_midColor
-1L -> R.color.dark_lowColor
else -> R.color.dark_midColor
}
if (ageLevel == 1) mTimestamp?.setTextColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_midColor else R.color.dark_mTimestamp1_home))
else mTimestamp?.setTextColor(ContextCompat.getColor(this, R.color.dark_TimestampOld))
if (status.batteryLevel == 1) mUploaderBattery?.setTextColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_midColor else R.color.dark_uploaderBattery))
else mUploaderBattery?.setTextColor(ContextCompat.getColor(this, R.color.dark_uploaderBatteryEmpty))
mStatus?.setTextColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_midColor else R.color.dark_mStatus_home))
binding.sgv.setTextColor(ContextCompat.getColor(this, color))
binding.delta.setTextColor(ContextCompat.getColor(this, color))
binding.direction.setTextColor(ContextCompat.getColor(this, color))
val colorTime = if (ageLevel == 1) if (dividerMatchesBg) R.color.dark_midColor else R.color.dark_mTimestamp1_home else R.color.dark_TimestampOld
binding.timestamp.setTextColor(ContextCompat.getColor(this, colorTime))
val colourBat = if (status.batteryLevel == 1) if (dividerMatchesBg) R.color.dark_midColor else R.color.dark_uploaderBattery else R.color.dark_uploaderBatteryEmpty
binding.uploaderBattery.setTextColor(ContextCompat.getColor(this, colourBat))
binding.status.setTextColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_midColor else R.color.dark_mStatus_home))
}
override fun setColorBright() {
if (currentWatchMode == WatchMode.INTERACTIVE) {
mLinearLayout?.setBackgroundColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.light_background else R.color.light_stripe_background))
mRelativeLayout?.setBackgroundColor(ContextCompat.getColor(this, R.color.light_background))
when (singleBg.sgvLevel) {
1L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.light_highColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.light_highColor))
mDirection?.setTextColor(ContextCompat.getColor(this, R.color.light_highColor))
}
0L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.light_midColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.light_midColor))
mDirection?.setTextColor(ContextCompat.getColor(this, R.color.light_midColor))
}
-1L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.light_lowColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.light_lowColor))
mDirection?.setTextColor(ContextCompat.getColor(this, R.color.light_lowColor))
}
binding.secondaryLayout.setBackgroundColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.light_background else R.color.light_stripe_background))
binding.mainLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.light_background))
val color = when (singleBg.sgvLevel) {
1L -> R.color.light_highColor
0L -> R.color.light_midColor
-1L -> R.color.light_lowColor
else -> R.color.light_midColor
}
if (ageLevel == 1) mTimestamp?.setTextColor(if (dividerMatchesBg) Color.BLACK else Color.WHITE)
else mTimestamp?.setTextColor(Color.RED)
binding.sgv.setTextColor(ContextCompat.getColor(this, color))
binding.delta.setTextColor(ContextCompat.getColor(this, color))
binding.direction.setTextColor(ContextCompat.getColor(this, color))
if (status.batteryLevel == 1) mUploaderBattery?.setTextColor(if (dividerMatchesBg) Color.BLACK else Color.WHITE)
else mUploaderBattery?.setTextColor(Color.RED)
val colorTime = if (ageLevel == 1) if (dividerMatchesBg) Color.BLACK else Color.WHITE else Color.RED
binding.timestamp.setTextColor(colorTime)
val colourBat = if (status.batteryLevel == 1) if (dividerMatchesBg) Color.BLACK else Color.WHITE else Color.RED
binding.uploaderBattery.setTextColor(colourBat)
mStatus?.setTextColor(if (dividerMatchesBg) Color.BLACK else Color.WHITE)
mTime?.setTextColor(Color.BLACK)
binding.status.setTextColor(if (dividerMatchesBg) Color.BLACK else Color.WHITE)
binding.time.setTextColor(Color.BLACK)
} else {
mRelativeLayout?.setBackgroundColor(Color.BLACK)
mLinearLayout?.setBackgroundColor(if (dividerMatchesBg) Color.BLACK else Color.LTGRAY)
when (singleBg.sgvLevel) {
1L -> {
mSgv?.setTextColor(Color.YELLOW)
mDirection?.setTextColor(Color.YELLOW)
mDelta?.setTextColor(Color.YELLOW)
}
0L -> {
mSgv?.setTextColor(Color.WHITE)
mDirection?.setTextColor(Color.WHITE)
mDelta?.setTextColor(Color.WHITE)
}
-1L -> {
mSgv?.setTextColor(Color.RED)
mDirection?.setTextColor(Color.RED)
mDelta?.setTextColor(Color.RED)
}
binding.mainLayout.setBackgroundColor(Color.BLACK)
binding.secondaryLayout.setBackgroundColor(if (dividerMatchesBg) Color.BLACK else Color.LTGRAY)
val color = when (singleBg.sgvLevel) {
1L -> Color.YELLOW
0L -> Color.WHITE
-1L -> Color.RED
else -> Color.WHITE
}
mUploaderBattery?.setTextColor(if (dividerMatchesBg) Color.WHITE else Color.BLACK)
mTimestamp?.setTextColor(if (dividerMatchesBg) Color.WHITE else Color.BLACK)
mStatus?.setTextColor(if (dividerMatchesBg) Color.WHITE else Color.BLACK)
mTime?.setTextColor(Color.WHITE)
binding.sgv.setTextColor(ContextCompat.getColor(this, color))
binding.delta.setTextColor(ContextCompat.getColor(this, color))
binding.direction.setTextColor(ContextCompat.getColor(this, color))
binding.uploaderBattery.setTextColor(if (dividerMatchesBg) Color.WHITE else Color.BLACK)
binding.timestamp.setTextColor(if (dividerMatchesBg) Color.WHITE else Color.BLACK)
binding.status.setTextColor(if (dividerMatchesBg) Color.WHITE else Color.BLACK)
binding.time.setTextColor(Color.WHITE)
}
}
override fun setColorLowRes() {
mLinearLayout?.setBackgroundColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_background else R.color.dark_mLinearLayout))
mTime?.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime))
mRelativeLayout?.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mDirection?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mTimestamp?.setTextColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_midColor else R.color.dark_mTimestamp1_home))
mUploaderBattery?.setTextColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_midColor else R.color.dark_uploaderBattery))
mStatus?.setTextColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_midColor else R.color.dark_mStatus_home))
binding.secondaryLayout.setBackgroundColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_background else R.color.dark_mLinearLayout))
binding.time.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime))
binding.mainLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
binding.sgv.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.delta.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.direction.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.timestamp.setTextColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_midColor else R.color.dark_mTimestamp1_home))
binding.uploaderBattery.setTextColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_midColor else R.color.dark_uploaderBattery))
binding.status.setTextColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_midColor else R.color.dark_mStatus_home))
}
}
}

View file

@ -1,110 +1,109 @@
package info.nightscout.androidaps.watchfaces
import android.graphics.Color
import android.view.LayoutInflater
import androidx.annotation.ColorInt
import androidx.annotation.LayoutRes
import androidx.core.content.ContextCompat
import androidx.viewbinding.ViewBinding
import com.ustwo.clockwise.common.WatchMode
import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.ActivityHome2Binding
import info.nightscout.androidaps.watchfaces.utils.BaseWatchFace
class AapsV2Watchface : BaseWatchFace() {
@LayoutRes override fun layoutResource(): Int = R.layout.activity_home_2
private lateinit var binding: ActivityHome2Binding
override fun inflateLayout(inflater: LayoutInflater): ViewBinding {
binding = ActivityHome2Binding.inflate(inflater)
return binding
}
override fun setColorDark() {
@ColorInt val dividerTxtColor = if (dividerMatchesBg) ContextCompat.getColor(this, R.color.dark_midColor) else Color.BLACK
@ColorInt val dividerBatteryOkColor = ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_midColor else R.color.dark_uploaderBattery)
@ColorInt val dividerBgColor = ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_background else R.color.dark_statusView)
mLinearLayout?.setBackgroundColor(dividerBgColor)
mLinearLayout2?.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
mRelativeLayout?.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
mTime?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mIOB1?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mIOB2?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mCOB1?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mCOB2?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mDay?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mMonth?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mLoop?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.secondaryLayout.setBackgroundColor(dividerBgColor)
binding.tertiaryLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
binding.mainLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
binding.time.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.iob1.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.iob2.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.cob1.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.cob2.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.day.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.month.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.loop.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
setTextSizes()
when (singleBg.sgvLevel) {
1L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_highColor))
mDirection?.setTextColor(ContextCompat.getColor(this, R.color.dark_highColor))
}
0L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mDirection?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
}
-1L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_lowColor))
mDirection?.setTextColor(ContextCompat.getColor(this, R.color.dark_lowColor))
}
val color = when (singleBg.sgvLevel) {
1L -> R.color.dark_highColor
0L -> R.color.dark_midColor
-1L -> R.color.dark_lowColor
else -> R.color.dark_midColor
}
if (ageLevel == 1) mTimestamp?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
else mTimestamp?.setTextColor(ContextCompat.getColor(this, R.color.dark_TimestampOld))
binding.sgv.setTextColor(ContextCompat.getColor(this, color))
binding.direction.setTextColor(ContextCompat.getColor(this, color))
if (status.batteryLevel == 1) mUploaderBattery?.setTextColor(dividerBatteryOkColor)
else mUploaderBattery?.setTextColor(ContextCompat.getColor(this, R.color.dark_uploaderBatteryEmpty))
val colorTime = if (ageLevel == 1) R.color.dark_midColor else R.color.dark_TimestampOld
binding.timestamp.setTextColor(ContextCompat.getColor(this, colorTime))
val colourBat = if (status.batteryLevel == 1) dividerBatteryOkColor else ContextCompat.getColor(this, R.color.dark_uploaderBatteryEmpty)
binding.uploaderBattery.setTextColor(colourBat)
mRigBattery?.setTextColor(dividerTxtColor)
mDelta?.setTextColor(dividerTxtColor)
mAvgDelta?.setTextColor(dividerTxtColor)
mBasalRate?.setTextColor(dividerTxtColor)
mBgi?.setTextColor(dividerTxtColor)
binding.rigBattery.setTextColor(dividerTxtColor)
binding.delta.setTextColor(dividerTxtColor)
binding.avgDelta.setTextColor(dividerTxtColor)
binding.basalRate?.setTextColor(dividerTxtColor)
binding.bgi.setTextColor(dividerTxtColor)
when (loopLevel) {
-1 -> mLoop?.setBackgroundResource(R.drawable.loop_grey_25)
1 -> mLoop?.setBackgroundResource(R.drawable.loop_green_25)
else -> mLoop?.setBackgroundResource(R.drawable.loop_red_25)
}
if (chart != null) {
highColor = ContextCompat.getColor(this, R.color.dark_highColor)
lowColor = ContextCompat.getColor(this, R.color.dark_lowColor)
midColor = ContextCompat.getColor(this, R.color.dark_midColor)
gridColor = ContextCompat.getColor(this, R.color.dark_gridColor)
basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_dark)
basalCenterColor = ContextCompat.getColor(this, R.color.basal_light)
pointSize = 2
setupCharts()
-1 -> binding.loop.setBackgroundResource(R.drawable.loop_grey_25)
1 -> binding.loop.setBackgroundResource(R.drawable.loop_green_25)
else -> binding.loop.setBackgroundResource(R.drawable.loop_red_25)
}
highColor = ContextCompat.getColor(this, R.color.dark_highColor)
lowColor = ContextCompat.getColor(this, R.color.dark_lowColor)
midColor = ContextCompat.getColor(this, R.color.dark_midColor)
gridColor = ContextCompat.getColor(this, R.color.dark_gridColor)
basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_dark)
basalCenterColor = ContextCompat.getColor(this, R.color.basal_light)
pointSize = 2
setupCharts()
}
override fun setColorLowRes() {
@ColorInt val dividerTxtColor = if (dividerMatchesBg) ContextCompat.getColor(this, R.color.dark_midColor) else Color.BLACK
@ColorInt val dividerBgColor = ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_background else R.color.dark_statusView)
mLinearLayout?.setBackgroundColor(dividerBgColor)
mLinearLayout2?.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
mRelativeLayout?.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
mLoop?.setBackgroundResource(R.drawable.loop_grey_25)
mLoop?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mDirection?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mTimestamp?.setTextColor(ContextCompat.getColor(this, R.color.dark_Timestamp))
mDelta?.setTextColor(dividerTxtColor)
mAvgDelta?.setTextColor(dividerTxtColor)
mRigBattery?.setTextColor(dividerTxtColor)
mUploaderBattery?.setTextColor(dividerTxtColor)
mBasalRate?.setTextColor(dividerTxtColor)
mBgi?.setTextColor(dividerTxtColor)
mIOB1?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mIOB2?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mCOB1?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mCOB2?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mDay?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mMonth?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mTime?.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime))
if (chart != null) {
highColor = ContextCompat.getColor(this, R.color.dark_midColor)
lowColor = ContextCompat.getColor(this, R.color.dark_midColor)
midColor = ContextCompat.getColor(this, R.color.dark_midColor)
gridColor = ContextCompat.getColor(this, R.color.dark_gridColor)
basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_dark_lowres)
basalCenterColor = ContextCompat.getColor(this, R.color.basal_light_lowres)
pointSize = 2
setupCharts()
}
binding.secondaryLayout.setBackgroundColor(dividerBgColor)
binding.tertiaryLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
binding.mainLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
binding.loop.setBackgroundResource(R.drawable.loop_grey_25)
binding.loop.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.sgv.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.direction.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.timestamp.setTextColor(ContextCompat.getColor(this, R.color.dark_Timestamp))
binding.delta.setTextColor(dividerTxtColor)
binding.avgDelta.setTextColor(dividerTxtColor)
binding.rigBattery.setTextColor(dividerTxtColor)
binding.uploaderBattery.setTextColor(dividerTxtColor)
binding.basalRate?.setTextColor(dividerTxtColor)
binding.bgi.setTextColor(dividerTxtColor)
binding.iob1.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.iob2.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.cob1.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.cob2.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.day.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.month.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.time.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime))
highColor = ContextCompat.getColor(this, R.color.dark_midColor)
lowColor = ContextCompat.getColor(this, R.color.dark_midColor)
midColor = ContextCompat.getColor(this, R.color.dark_midColor)
gridColor = ContextCompat.getColor(this, R.color.dark_gridColor)
basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_dark_lowres)
basalCenterColor = ContextCompat.getColor(this, R.color.basal_light_lowres)
pointSize = 2
setupCharts()
setTextSizes()
}
@ -112,58 +111,50 @@ class AapsV2Watchface : BaseWatchFace() {
if (currentWatchMode == WatchMode.INTERACTIVE) {
@ColorInt val dividerTxtColor = if (dividerMatchesBg) Color.BLACK else ContextCompat.getColor(this, R.color.dark_midColor)
@ColorInt val dividerBgColor = ContextCompat.getColor(this, if (dividerMatchesBg) R.color.light_background else R.color.light_stripe_background)
mLinearLayout?.setBackgroundColor(dividerBgColor)
mLinearLayout2?.setBackgroundColor(ContextCompat.getColor(this, R.color.light_background))
mRelativeLayout?.setBackgroundColor(ContextCompat.getColor(this, R.color.light_background))
mTime?.setTextColor(Color.BLACK)
mIOB1?.setTextColor(Color.BLACK)
mIOB2?.setTextColor(Color.BLACK)
mCOB1?.setTextColor(Color.BLACK)
mCOB2?.setTextColor(Color.BLACK)
mDay?.setTextColor(Color.BLACK)
mMonth?.setTextColor(Color.BLACK)
mLoop?.setTextColor(Color.BLACK)
binding.secondaryLayout.setBackgroundColor(dividerBgColor)
binding.tertiaryLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.light_background))
binding.mainLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.light_background))
binding.time.setTextColor(Color.BLACK)
binding.iob1.setTextColor(Color.BLACK)
binding.iob2.setTextColor(Color.BLACK)
binding.cob1.setTextColor(Color.BLACK)
binding.cob2.setTextColor(Color.BLACK)
binding.day.setTextColor(Color.BLACK)
binding.month.setTextColor(Color.BLACK)
binding.loop.setTextColor(Color.BLACK)
setTextSizes()
when (singleBg.sgvLevel) {
1L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.light_highColor))
mDirection?.setTextColor(ContextCompat.getColor(this, R.color.light_highColor))
}
0L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.light_midColor))
mDirection?.setTextColor(ContextCompat.getColor(this, R.color.light_midColor))
}
-1L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.light_lowColor))
mDirection?.setTextColor(ContextCompat.getColor(this, R.color.light_lowColor))
}
val color = when (singleBg.sgvLevel) {
1L -> R.color.light_highColor
0L -> R.color.light_midColor
-1L -> R.color.light_lowColor
else -> R.color.light_midColor
}
if (ageLevel == 1) mTimestamp?.setTextColor(Color.BLACK)
else mTimestamp?.setTextColor(Color.RED)
if (status.batteryLevel == 1) mUploaderBattery?.setTextColor(dividerTxtColor)
else mUploaderBattery?.setTextColor(Color.RED)
mRigBattery?.setTextColor(dividerTxtColor)
mDelta?.setTextColor(dividerTxtColor)
mAvgDelta?.setTextColor(dividerTxtColor)
mBasalRate?.setTextColor(dividerTxtColor)
mBgi?.setTextColor(dividerTxtColor)
binding.sgv.setTextColor(ContextCompat.getColor(this, color))
binding.direction.setTextColor(ContextCompat.getColor(this, color))
val colorTime = if (ageLevel == 1) Color.BLACK else Color.RED
binding.timestamp.setTextColor(colorTime)
val colourBat = if (status.batteryLevel == 1) dividerTxtColor else Color.RED
binding.uploaderBattery.setTextColor(colourBat)
binding.rigBattery.setTextColor(dividerTxtColor)
binding.delta.setTextColor(dividerTxtColor)
binding.avgDelta.setTextColor(dividerTxtColor)
binding.basalRate?.setTextColor(dividerTxtColor)
binding.bgi.setTextColor(dividerTxtColor)
when (loopLevel) {
-1 -> mLoop?.setBackgroundResource(R.drawable.loop_grey_25)
1 -> mLoop?.setBackgroundResource(R.drawable.loop_green_25)
else -> mLoop?.setBackgroundResource(R.drawable.loop_red_25)
}
if (chart != null) {
highColor = ContextCompat.getColor(this, R.color.light_highColor)
lowColor = ContextCompat.getColor(this, R.color.light_lowColor)
midColor = ContextCompat.getColor(this, R.color.light_midColor)
gridColor = ContextCompat.getColor(this, R.color.light_gridColor)
basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_light)
basalCenterColor = ContextCompat.getColor(this, R.color.basal_dark)
pointSize = 2
setupCharts()
-1 -> binding.loop.setBackgroundResource(R.drawable.loop_grey_25)
1 -> binding.loop.setBackgroundResource(R.drawable.loop_green_25)
else -> binding.loop.setBackgroundResource(R.drawable.loop_red_25)
}
highColor = ContextCompat.getColor(this, R.color.light_highColor)
lowColor = ContextCompat.getColor(this, R.color.light_lowColor)
midColor = ContextCompat.getColor(this, R.color.light_midColor)
gridColor = ContextCompat.getColor(this, R.color.light_gridColor)
basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_light)
basalCenterColor = ContextCompat.getColor(this, R.color.basal_dark)
pointSize = 2
setupCharts()
} else {
setColorDark()
}
@ -171,11 +162,11 @@ class AapsV2Watchface : BaseWatchFace() {
private fun setTextSizes() {
if (status.detailedIob) {
mIOB1?.textSize = 14f
mIOB2?.textSize = 10f
binding.iob1.textSize = 14f
binding.iob2.textSize = 10f
} else {
mIOB1?.textSize = 10f
mIOB2?.textSize = 14f
binding.iob1.textSize = 10f
binding.iob2.textSize = 14f
}
}
}
}

View file

@ -1,114 +1,106 @@
package info.nightscout.androidaps.watchfaces
import android.graphics.Color
import androidx.annotation.LayoutRes
import android.view.LayoutInflater
import androidx.core.content.ContextCompat
import androidx.viewbinding.ViewBinding
import com.ustwo.clockwise.common.WatchMode
import info.nightscout.androidaps.R
import info.nightscout.androidaps.watchfaces.utils.BaseWatchFace
import info.nightscout.androidaps.databinding.ActivityHomeBinding
class AapsWatchface : BaseWatchFace() {
@LayoutRes override fun layoutResource(): Int = R.layout.activity_home
private lateinit var binding: ActivityHomeBinding
override fun inflateLayout(inflater: LayoutInflater): ViewBinding {
binding = ActivityHomeBinding.inflate(inflater)
return binding
}
override fun setColorDark() {
mLinearLayout?.setBackgroundColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_background else R.color.dark_statusView))
mTime?.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime))
mRelativeLayout?.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
when (singleBg.sgvLevel) {
1L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_highColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_highColor))
mDirection?.setTextColor(ContextCompat.getColor(this, R.color.dark_highColor))
}
0L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mDirection?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
}
-1L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_lowColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_lowColor))
mDirection?.setTextColor(ContextCompat.getColor(this, R.color.dark_lowColor))
}
}
if (ageLevel == 1) mTimestamp?.setTextColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_midColor else R.color.dark_mTimestamp1_home))
else mTimestamp?.setTextColor(ContextCompat.getColor(this, R.color.dark_TimestampOld))
if (status.batteryLevel == 1) mUploaderBattery?.setTextColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_midColor else R.color.dark_uploaderBattery))
else mUploaderBattery?.setTextColor(ContextCompat.getColor(this, R.color.dark_uploaderBatteryEmpty))
mStatus?.setTextColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_midColor else R.color.dark_mStatus_home))
if (chart != null) {
highColor = ContextCompat.getColor(this, R.color.dark_highColor)
lowColor = ContextCompat.getColor(this, R.color.dark_lowColor)
midColor = ContextCompat.getColor(this, R.color.dark_midColor)
gridColor = ContextCompat.getColor(this, R.color.dark_gridColor)
basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_dark)
basalCenterColor = ContextCompat.getColor(this, R.color.basal_light)
pointSize = 2
setupCharts()
binding.secondaryLayout.setBackgroundColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_background else R.color.dark_statusView))
binding.time.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime))
val color = when (singleBg.sgvLevel) {
1L -> R.color.dark_highColor
0L -> R.color.dark_midColor
-1L -> R.color.dark_lowColor
else -> R.color.dark_midColor
}
binding.sgv.setTextColor(ContextCompat.getColor(this, color))
binding.delta.setTextColor(ContextCompat.getColor(this, color))
binding.direction.setTextColor(ContextCompat.getColor(this, color))
val colorTime = if (ageLevel == 1) if (dividerMatchesBg) R.color.dark_midColor else R.color.dark_mTimestamp1_home else R.color.dark_TimestampOld
binding.timestamp.setTextColor(ContextCompat.getColor(this, colorTime))
val colourBat = if (status.batteryLevel == 1) if (dividerMatchesBg) R.color.dark_midColor else R.color.dark_uploaderBattery else R.color.dark_uploaderBatteryEmpty
binding.uploaderBattery.setTextColor(ContextCompat.getColor(this, colourBat))
binding.status.setTextColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_midColor else R.color.dark_mStatus_home))
highColor = ContextCompat.getColor(this, R.color.dark_highColor)
lowColor = ContextCompat.getColor(this, R.color.dark_lowColor)
midColor = ContextCompat.getColor(this, R.color.dark_midColor)
gridColor = ContextCompat.getColor(this, R.color.dark_gridColor)
basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_dark)
basalCenterColor = ContextCompat.getColor(this, R.color.basal_light)
pointSize = 2
setupCharts()
}
override fun setColorLowRes() {
mTime?.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime))
mRelativeLayout?.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mTimestamp?.setTextColor(ContextCompat.getColor(this, R.color.dark_Timestamp))
if (chart != null) {
highColor = ContextCompat.getColor(this, R.color.dark_midColor)
lowColor = ContextCompat.getColor(this, R.color.dark_midColor)
midColor = ContextCompat.getColor(this, R.color.dark_midColor)
gridColor = ContextCompat.getColor(this, R.color.dark_gridColor)
basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_dark_lowres)
basalCenterColor = ContextCompat.getColor(this, R.color.basal_light_lowres)
pointSize = 2
setupCharts()
}
binding.time.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime))
binding.mainLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
binding.sgv.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.delta.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.timestamp.setTextColor(ContextCompat.getColor(this, R.color.dark_Timestamp))
highColor = ContextCompat.getColor(this, R.color.dark_midColor)
lowColor = ContextCompat.getColor(this, R.color.dark_midColor)
midColor = ContextCompat.getColor(this, R.color.dark_midColor)
gridColor = ContextCompat.getColor(this, R.color.dark_gridColor)
basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_dark_lowres)
basalCenterColor = ContextCompat.getColor(this, R.color.basal_light_lowres)
pointSize = 2
setupCharts()
}
override fun setColorBright() {
if (currentWatchMode == WatchMode.INTERACTIVE) {
mLinearLayout?.setBackgroundColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.light_background else R.color.light_stripe_background))
mRelativeLayout?.setBackgroundColor(ContextCompat.getColor(this, R.color.light_background))
when (singleBg.sgvLevel) {
1L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.light_highColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.light_highColor))
mDirection?.setTextColor(ContextCompat.getColor(this, R.color.light_highColor))
}
0L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.light_midColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.light_midColor))
mDirection?.setTextColor(ContextCompat.getColor(this, R.color.light_midColor))
}
-1L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.light_lowColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.light_lowColor))
mDirection?.setTextColor(ContextCompat.getColor(this, R.color.light_lowColor))
}
}
if (ageLevel == 1) mTimestamp?.setTextColor(if (dividerMatchesBg) Color.BLACK else Color.WHITE)
else mTimestamp?.setTextColor(Color.RED)
if (status.batteryLevel == 1) mUploaderBattery?.setTextColor(if (dividerMatchesBg) Color.BLACK else Color.WHITE)
else mUploaderBattery?.setTextColor(Color.RED)
mStatus?.setTextColor(if (dividerMatchesBg) Color.BLACK else Color.WHITE)
mTime?.setTextColor(Color.BLACK)
if (chart != null) {
highColor = ContextCompat.getColor(this, R.color.light_highColor)
lowColor = ContextCompat.getColor(this, R.color.light_lowColor)
midColor = ContextCompat.getColor(this, R.color.light_midColor)
gridColor = ContextCompat.getColor(this, R.color.light_gridColor)
basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_light)
basalCenterColor = ContextCompat.getColor(this, R.color.basal_dark)
pointSize = 2
setupCharts()
binding.secondaryLayout.setBackgroundColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.light_background else R.color.light_stripe_background))
binding.mainLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.light_background))
val color = when (singleBg.sgvLevel) {
1L -> R.color.light_highColor
0L -> R.color.light_midColor
-1L -> R.color.light_lowColor
else -> R.color.light_midColor
}
binding.sgv.setTextColor(ContextCompat.getColor(this, color))
binding.delta.setTextColor(ContextCompat.getColor(this, color))
binding.direction.setTextColor(ContextCompat.getColor(this, color))
val colorTime = if (ageLevel == 1) if (dividerMatchesBg) Color.BLACK else Color.WHITE else Color.RED
binding.timestamp.setTextColor(colorTime)
val colourBat = if (status.batteryLevel == 1) if (dividerMatchesBg) Color.BLACK else Color.WHITE else Color.RED
binding.uploaderBattery.setTextColor(colourBat)
binding.status.setTextColor(if (dividerMatchesBg) Color.BLACK else Color.WHITE)
binding.time.setTextColor(Color.BLACK)
highColor = ContextCompat.getColor(this, R.color.light_highColor)
lowColor = ContextCompat.getColor(this, R.color.light_lowColor)
midColor = ContextCompat.getColor(this, R.color.light_midColor)
gridColor = ContextCompat.getColor(this, R.color.light_gridColor)
basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_light)
basalCenterColor = ContextCompat.getColor(this, R.color.basal_dark)
pointSize = 2
setupCharts()
} else {
setColorDark()
}
}
}
}

View file

@ -3,119 +3,110 @@
package info.nightscout.androidaps.watchfaces
import android.annotation.SuppressLint
import androidx.annotation.LayoutRes
import android.view.LayoutInflater
import androidx.core.content.ContextCompat
import androidx.viewbinding.ViewBinding
import com.ustwo.clockwise.common.WatchMode
import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.ActivityBigchartBinding
import info.nightscout.androidaps.databinding.ActivityBigchartSmallBinding
import info.nightscout.androidaps.watchfaces.utils.BaseWatchFace
import info.nightscout.androidaps.watchfaces.utils.WatchfaceViewAdapter
class BigChartWatchface : BaseWatchFace() {
@LayoutRes override fun layoutResource(): Int =
if (resources.displayMetrics.widthPixels < SCREEN_SIZE_SMALL || resources.displayMetrics.heightPixels < SCREEN_SIZE_SMALL) R.layout.activity_bigchart_small
else R.layout.activity_bigchart
private lateinit var binding: WatchfaceViewAdapter
override fun inflateLayout(inflater: LayoutInflater): ViewBinding {
if (resources.displayMetrics.widthPixels < SCREEN_SIZE_SMALL || resources.displayMetrics.heightPixels < SCREEN_SIZE_SMALL) {
val layoutBinding = ActivityBigchartSmallBinding.inflate(inflater)
binding = WatchfaceViewAdapter.getBinding(layoutBinding)
return layoutBinding
}
val layoutBinding = ActivityBigchartBinding.inflate(inflater)
binding = WatchfaceViewAdapter.getBinding(layoutBinding)
return layoutBinding
}
@SuppressLint("SetTextI18n")
override fun setDataFields() {
super.setDataFields()
mStatus?.text = status.externalStatus + if (sp.getBoolean(R.string.key_show_cob, true)) (" " + this.status.cob) else ""
binding.status?.text = status.externalStatus + if (sp.getBoolean(R.string.key_show_cob, true)) (" " + this.status.cob) else ""
}
override fun setColorLowRes() {
mTime?.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime))
mStatus?.setTextColor(ContextCompat.getColor(this, R.color.dark_statusView))
mRelativeLayout?.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mAvgDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mTimestamp?.setTextColor(ContextCompat.getColor(this, R.color.dark_Timestamp))
if (chart != null) {
highColor = ContextCompat.getColor(this, R.color.dark_midColor)
lowColor = ContextCompat.getColor(this, R.color.dark_midColor)
midColor = ContextCompat.getColor(this, R.color.dark_midColor)
gridColor = ContextCompat.getColor(this, R.color.dark_gridColor)
basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_dark_lowres)
basalCenterColor = ContextCompat.getColor(this, R.color.basal_light_lowres)
pointSize = 2
setupCharts()
}
binding.time?.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime))
binding.status?.setTextColor(ContextCompat.getColor(this, R.color.dark_statusView))
binding.mainLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
binding.sgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.delta?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.avgDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.timestamp.setTextColor(ContextCompat.getColor(this, R.color.dark_Timestamp))
highColor = ContextCompat.getColor(this, R.color.dark_midColor)
lowColor = ContextCompat.getColor(this, R.color.dark_midColor)
midColor = ContextCompat.getColor(this, R.color.dark_midColor)
gridColor = ContextCompat.getColor(this, R.color.dark_gridColor)
basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_dark_lowres)
basalCenterColor = ContextCompat.getColor(this, R.color.basal_light_lowres)
pointSize = 2
setupCharts()
}
override fun setColorDark() {
mTime?.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime))
mStatus?.setTextColor(ContextCompat.getColor(this, R.color.dark_statusView))
mRelativeLayout?.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
when (singleBg.sgvLevel) {
1L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_highColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_highColor))
mAvgDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_highColor))
}
binding.time?.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime))
binding.status?.setTextColor(ContextCompat.getColor(this, R.color.dark_statusView))
binding.mainLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
val color = when (singleBg.sgvLevel) {
1L -> R.color.dark_highColor
0L -> R.color.dark_midColor
-1L -> R.color.dark_lowColor
else -> R.color.dark_midColor
}
binding.sgv?.setTextColor(ContextCompat.getColor(this, color))
binding.delta?.setTextColor(ContextCompat.getColor(this, color))
binding.avgDelta?.setTextColor(ContextCompat.getColor(this, color))
0L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mAvgDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
}
val colorTime = if (ageLevel == 1) R.color.dark_Timestamp else R.color.dark_TimestampOld
binding.timestamp.setTextColor(ContextCompat.getColor(this, colorTime))
-1L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_lowColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_lowColor))
mAvgDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_lowColor))
}
}
if (ageLevel == 1) {
mTimestamp?.setTextColor(ContextCompat.getColor(this, R.color.dark_Timestamp))
} else {
mTimestamp?.setTextColor(ContextCompat.getColor(this, R.color.dark_TimestampOld))
}
if (chart != null) {
highColor = ContextCompat.getColor(this, R.color.dark_highColor)
lowColor = ContextCompat.getColor(this, R.color.dark_lowColor)
midColor = ContextCompat.getColor(this, R.color.dark_midColor)
gridColor = ContextCompat.getColor(this, R.color.dark_gridColor)
basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_dark)
basalCenterColor = ContextCompat.getColor(this, R.color.basal_light)
pointSize = 2
setupCharts()
}
highColor = ContextCompat.getColor(this, R.color.dark_highColor)
lowColor = ContextCompat.getColor(this, R.color.dark_lowColor)
midColor = ContextCompat.getColor(this, R.color.dark_midColor)
gridColor = ContextCompat.getColor(this, R.color.dark_gridColor)
basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_dark)
basalCenterColor = ContextCompat.getColor(this, R.color.basal_light)
pointSize = 2
setupCharts()
}
override fun setColorBright() {
if (currentWatchMode == WatchMode.INTERACTIVE) {
mTime?.setTextColor(ContextCompat.getColor(this, R.color.light_bigchart_time))
mStatus?.setTextColor(ContextCompat.getColor(this, R.color.light_bigchart_status))
mRelativeLayout?.setBackgroundColor(ContextCompat.getColor(this, R.color.light_background))
when (singleBg.sgvLevel) {
1L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.light_highColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.light_highColor))
mAvgDelta?.setTextColor(ContextCompat.getColor(this, R.color.light_highColor))
}
0L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.light_midColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.light_midColor))
mAvgDelta?.setTextColor(ContextCompat.getColor(this, R.color.light_midColor))
}
-1L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.light_lowColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.light_lowColor))
mAvgDelta?.setTextColor(ContextCompat.getColor(this, R.color.light_lowColor))
}
}
if (ageLevel == 1) mTimestamp?.setTextColor(ContextCompat.getColor(this, R.color.light_mTimestamp1))
else mTimestamp?.setTextColor(ContextCompat.getColor(this, R.color.light_mTimestamp))
if (chart != null) {
highColor = ContextCompat.getColor(this, R.color.light_highColor)
lowColor = ContextCompat.getColor(this, R.color.light_lowColor)
midColor = ContextCompat.getColor(this, R.color.light_midColor)
gridColor = ContextCompat.getColor(this, R.color.light_gridColor)
basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_light)
basalCenterColor = ContextCompat.getColor(this, R.color.basal_dark)
pointSize = 2
setupCharts()
binding.time?.setTextColor(ContextCompat.getColor(this, R.color.light_bigchart_time))
binding.status?.setTextColor(ContextCompat.getColor(this, R.color.light_bigchart_status))
binding.mainLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.light_background))
val color = when (singleBg.sgvLevel) {
1L -> R.color.light_highColor
0L -> R.color.light_midColor
-1L -> R.color.light_lowColor
else -> R.color.light_midColor
}
binding.sgv?.setTextColor(ContextCompat.getColor(this, color))
binding.delta?.setTextColor(ContextCompat.getColor(this, color))
binding.avgDelta?.setTextColor(ContextCompat.getColor(this, color))
val colorTime = if (ageLevel == 1) R.color.light_mTimestamp1 else R.color.light_mTimestamp
binding.timestamp.setTextColor(ContextCompat.getColor(this, colorTime))
highColor = ContextCompat.getColor(this, R.color.light_highColor)
lowColor = ContextCompat.getColor(this, R.color.light_lowColor)
midColor = ContextCompat.getColor(this, R.color.light_midColor)
gridColor = ContextCompat.getColor(this, R.color.light_gridColor)
basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_light)
basalCenterColor = ContextCompat.getColor(this, R.color.basal_dark)
pointSize = 2
setupCharts()
} else {
setColorDark()
}

View file

@ -1,8 +1,11 @@
package info.nightscout.androidaps.watchfaces
import android.view.LayoutInflater
import android.view.View
import androidx.annotation.LayoutRes
import androidx.viewbinding.ViewBinding
import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.ActivityCockpitBinding
import info.nightscout.androidaps.watchfaces.utils.BaseWatchFace
/**
* Created by andrew-warrington on 18/11/2017.
@ -10,37 +13,36 @@ import info.nightscout.androidaps.R
*/
class CockpitWatchface : BaseWatchFace() {
@LayoutRes override fun layoutResource(): Int = R.layout.activity_cockpit
private lateinit var binding: ActivityCockpitBinding
override fun inflateLayout(inflater: LayoutInflater): ViewBinding {
binding = ActivityCockpitBinding.inflate(inflater)
return binding
}
override fun setColorDark() {
mRelativeLayout?.setBackgroundResource(R.drawable.airplane_cockpit_outside_clouds)
binding.mainLayout.setBackgroundResource(R.drawable.airplane_cockpit_outside_clouds)
setTextSizes()
when (singleBg.sgvLevel) {
1L -> {
mHighLight?.setBackgroundResource(R.drawable.airplane_led_yellow_lit)
mLowLight?.setBackgroundResource(R.drawable.airplane_led_grey_unlit)
}
0L -> {
mHighLight?.setBackgroundResource(R.drawable.airplane_led_grey_unlit)
mLowLight?.setBackgroundResource(R.drawable.airplane_led_grey_unlit)
}
-1L -> {
mHighLight?.setBackgroundResource(R.drawable.airplane_led_grey_unlit)
mLowLight?.setBackgroundResource(R.drawable.airplane_led_red_lit)
}
val led = when (singleBg.sgvLevel) {
1L -> R.drawable.airplane_led_yellow_lit
0L -> R.drawable.airplane_led_grey_unlit
-1L -> R.drawable.airplane_led_red_lit
else -> R.drawable.airplane_led_grey_unlit
}
binding.highLight.setBackgroundResource(led)
binding.lowLight.setBackgroundResource(led)
when (loopLevel) {
-1 -> mLoop?.setBackgroundResource(R.drawable.loop_grey_25)
1 -> mLoop?.setBackgroundResource(R.drawable.loop_green_25)
else -> mLoop?.setBackgroundResource(R.drawable.loop_red_25)
-1 -> binding.loop.setBackgroundResource(R.drawable.loop_grey_25)
1 -> binding.loop.setBackgroundResource(R.drawable.loop_green_25)
else -> binding.loop.setBackgroundResource(R.drawable.loop_red_25)
}
invalidate()
}
override fun setColorLowRes() {
mRelativeLayout?.setBackgroundResource(R.drawable.airplane_cockpit_outside_clouds_lowres)
binding.mainLayout.setBackgroundResource(R.drawable.airplane_cockpit_outside_clouds_lowres)
}
override fun setColorBright() {
@ -49,28 +51,28 @@ class CockpitWatchface : BaseWatchFace() {
private fun setTextSizes() {
if (status.detailedIob) {
if (bIsRound) mIOB2?.textSize = 10f
else mIOB2?.textSize = 9f
if (bIsRound) binding.iob2.textSize = 10f
else binding.iob2.textSize = 9f
} else {
if (bIsRound) mIOB2?.textSize = 13f
else mIOB2?.textSize = 12f
if (bIsRound) binding.iob2.textSize = 13f
else binding.iob2.textSize = 12f
}
if (mUploaderBattery?.visibility != View.GONE && mRigBattery?.visibility != View.GONE) {
if (binding.uploaderBattery.visibility != View.GONE && binding.rigBattery.visibility != View.GONE) {
if (bIsRound) {
mUploaderBattery?.textSize = 12f
mRigBattery?.textSize = 12f
binding.uploaderBattery.textSize = 12f
binding.rigBattery.textSize = 12f
} else {
mUploaderBattery?.textSize = 10f
mRigBattery?.textSize = 10f
binding.uploaderBattery.textSize = 10f
binding.rigBattery.textSize = 10f
}
} else {
if (bIsRound) {
mUploaderBattery?.textSize = 13f
mRigBattery?.textSize = 13f
binding.uploaderBattery.textSize = 13f
binding.rigBattery.textSize = 13f
} else {
mUploaderBattery?.textSize = 12f
mRigBattery?.textSize = 12f
binding.uploaderBattery.textSize = 12f
binding.rigBattery.textSize = 12f
}
}
}
}
}

View file

@ -4,18 +4,26 @@ package info.nightscout.androidaps.watchfaces
import android.annotation.SuppressLint
import android.support.wearable.watchface.WatchFaceStyle
import android.view.LayoutInflater
import android.view.View
import android.widget.LinearLayout
import android.widget.TextView
import androidx.annotation.LayoutRes
import androidx.core.content.ContextCompat
import androidx.viewbinding.ViewBinding
import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.ActivityDigitalstyleBinding
import info.nightscout.androidaps.extensions.toVisibility
import info.nightscout.androidaps.watchfaces.utils.BaseWatchFace
import info.nightscout.shared.logging.LTag
class DigitalStyleWatchface : BaseWatchFace() {
@LayoutRes override fun layoutResource(): Int = R.layout.activity_digitalstyle
private lateinit var binding: ActivityDigitalstyleBinding
override fun inflateLayout(inflater: LayoutInflater): ViewBinding {
binding = ActivityDigitalstyleBinding.inflate(inflater)
return binding
}
override fun getWatchFaceStyle(): WatchFaceStyle {
return WatchFaceStyle.Builder(this)
@ -26,39 +34,31 @@ class DigitalStyleWatchface : BaseWatchFace() {
}
override fun setColorDark() {
when (singleBg.sgvLevel) {
1L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_highColor))
mDirection?.setTextColor(ContextCompat.getColor(this, R.color.dark_highColor))
}
0L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mDirection?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
}
-1L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_lowColor))
mDirection?.setTextColor(ContextCompat.getColor(this, R.color.dark_lowColor))
}
val color = when (singleBg.sgvLevel) {
1L -> R.color.dark_highColor
0L -> R.color.dark_midColor
-1L -> R.color.dark_lowColor
else -> R.color.dark_midColor
}
if (ageLevel == 1) mTimestamp?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
else mTimestamp?.setTextColor(ContextCompat.getColor(this, R.color.dark_TimestampOld))
binding.sgv.setTextColor(ContextCompat.getColor(this, color))
binding.direction.setTextColor(ContextCompat.getColor(this, color))
if (status.batteryLevel == 1) mUploaderBattery?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
else mUploaderBattery?.setTextColor(ContextCompat.getColor(this, R.color.dark_uploaderBatteryEmpty))
val colorTime = if (ageLevel == 1) R.color.dark_midColor else R.color.dark_TimestampOld
binding.timestamp.setTextColor(ContextCompat.getColor(this, colorTime))
val colorBat = if (status.batteryLevel == 1) R.color.dark_midColor else R.color.dark_uploaderBatteryEmpty
binding.uploaderBattery.setTextColor(ContextCompat.getColor(this, colorBat))
highColor = ContextCompat.getColor(this, R.color.dark_highColor)
lowColor = ContextCompat.getColor(this, R.color.dark_lowColor)
midColor = ContextCompat.getColor(this, R.color.dark_midColor)
gridColor = ContextCompat.getColor(this, R.color.dark_gridColor)
basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_dark)
basalCenterColor = ContextCompat.getColor(this, R.color.basal_light)
pointSize = 1
setupCharts()
setWatchfaceStyle()
if (chart != null) {
highColor = ContextCompat.getColor(this, R.color.dark_highColor)
lowColor = ContextCompat.getColor(this, R.color.dark_lowColor)
midColor = ContextCompat.getColor(this, R.color.dark_midColor)
gridColor = ContextCompat.getColor(this, R.color.dark_gridColor)
basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_dark)
basalCenterColor = ContextCompat.getColor(this, R.color.basal_light)
pointSize = 1
setupCharts()
setWatchfaceStyle()
}
}
@SuppressLint("SetTextI18n")
@ -103,19 +103,19 @@ class DigitalStyleWatchface : BaseWatchFace() {
val isShowDate = sp.getBoolean(R.string.key_show_date, false)
if (!isShowDate) {
layoutView?.findViewById<View>(R.id.date_time)?.visibility = View.GONE
mHour?.textSize = 62f
mMinute?.textSize = 40f
mHour?.letterSpacing = (-0.066).toFloat()
mMinute?.letterSpacing = (-0.066).toFloat()
binding.hour.textSize = 62f
binding.minute.textSize = 40f
binding.hour.letterSpacing = (-0.066).toFloat()
binding.minute.letterSpacing = (-0.066).toFloat()
} else {
layoutView?.findViewById<View>(R.id.date_time)?.visibility = View.VISIBLE
mHour?.textSize = 40f
mMinute?.textSize = 26f
mHour?.letterSpacing = 0.toFloat()
mMinute?.letterSpacing = 0.toFloat()
binding.hour.textSize = 40f
binding.minute.textSize = 26f
binding.hour.letterSpacing = 0.toFloat()
binding.minute.letterSpacing = 0.toFloat()
/* display week number */
val mWeekNumber = layoutView?.findViewById<TextView>(R.id.weeknumber)
val mWeekNumber = layoutView?.findViewById<TextView>(R.id.week_number)
mWeekNumber?.visibility = sp.getBoolean(R.string.key_show_week_number, false).toVisibility()
mWeekNumber?.text = "(" + dateUtil.weekString() + ")"
}
@ -128,4 +128,4 @@ class DigitalStyleWatchface : BaseWatchFace() {
override fun setColorBright() {
setColorDark() /* getCurrentWatchMode() == WatchMode.AMBIENT or WatchMode.INTERACTIVE */
}
}
}

View file

@ -1,87 +1,78 @@
package info.nightscout.androidaps.watchfaces
import androidx.annotation.LayoutRes
import android.view.LayoutInflater
import androidx.core.content.ContextCompat
import androidx.viewbinding.ViewBinding
import com.ustwo.clockwise.common.WatchMode
import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.ActivityBigchartBinding
import info.nightscout.androidaps.databinding.ActivityBigchartSmallBinding
import info.nightscout.androidaps.databinding.ActivityNochartBinding
import info.nightscout.androidaps.databinding.ActivityNochartSmallBinding
import info.nightscout.androidaps.watchfaces.utils.BaseWatchFace
import info.nightscout.androidaps.watchfaces.utils.WatchfaceViewAdapter
class NoChartWatchface : BaseWatchFace() {
@LayoutRes override fun layoutResource(): Int =
if (resources.displayMetrics.widthPixels < SCREEN_SIZE_SMALL || resources.displayMetrics.heightPixels < SCREEN_SIZE_SMALL) R.layout.activity_nochart_small
else R.layout.activity_nochart
private lateinit var binding: WatchfaceViewAdapter
override fun inflateLayout(inflater: LayoutInflater): ViewBinding {
if (resources.displayMetrics.widthPixels < SCREEN_SIZE_SMALL || resources.displayMetrics.heightPixels < SCREEN_SIZE_SMALL) {
val layoutBinding = ActivityNochartSmallBinding.inflate(inflater)
binding = WatchfaceViewAdapter.getBinding(layoutBinding)
return layoutBinding
}
val layoutBinding = ActivityNochartBinding.inflate(inflater)
binding = WatchfaceViewAdapter.getBinding(layoutBinding)
return layoutBinding
}
override fun setColorLowRes() {
mTime?.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime))
mStatus?.setTextColor(ContextCompat.getColor(this, R.color.dark_statusView))
mRelativeLayout?.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mAvgDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mTimestamp?.setTextColor(ContextCompat.getColor(this, R.color.dark_Timestamp))
binding.time?.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime))
binding.status?.setTextColor(ContextCompat.getColor(this, R.color.dark_statusView))
binding.mainLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
binding.sgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.delta?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.avgDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.timestamp.setTextColor(ContextCompat.getColor(this, R.color.dark_Timestamp))
}
override fun setColorDark() {
mTime?.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime))
mStatus?.setTextColor(ContextCompat.getColor(this, R.color.dark_statusView))
mRelativeLayout?.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
when (singleBg.sgvLevel) {
1L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_highColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_highColor))
mAvgDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_highColor))
}
0L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mAvgDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
}
-1L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_lowColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_lowColor))
mAvgDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_lowColor))
}
}
if (ageLevel == 1) {
mTimestamp?.setTextColor(ContextCompat.getColor(this, R.color.dark_Timestamp))
} else {
mTimestamp?.setTextColor(ContextCompat.getColor(this, R.color.dark_TimestampOld))
binding.time?.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime))
binding.status?.setTextColor(ContextCompat.getColor(this, R.color.dark_statusView))
binding.mainLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
val color = when (singleBg.sgvLevel) {
1L -> R.color.dark_highColor
0L -> R.color.dark_midColor
-1L -> R.color.dark_lowColor
else -> R.color.dark_midColor
}
binding.sgv?.setTextColor(ContextCompat.getColor(this, color))
binding.delta?.setTextColor(ContextCompat.getColor(this, color))
binding.avgDelta?.setTextColor(ContextCompat.getColor(this, color))
val colorTime = if (ageLevel == 1) R.color.dark_Timestamp else R.color.dark_TimestampOld
binding.timestamp.setTextColor(ContextCompat.getColor(this, colorTime))
}
override fun setColorBright() {
if (currentWatchMode == WatchMode.INTERACTIVE) {
mTime?.setTextColor(ContextCompat.getColor(this, R.color.light_bigchart_time))
mStatus?.setTextColor(ContextCompat.getColor(this, R.color.light_bigchart_status))
mRelativeLayout?.setBackgroundColor(ContextCompat.getColor(this, R.color.light_background))
when (singleBg.sgvLevel) {
1L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.light_highColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.light_highColor))
mAvgDelta?.setTextColor(ContextCompat.getColor(this, R.color.light_highColor))
}
0L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.light_midColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.light_midColor))
mAvgDelta?.setTextColor(ContextCompat.getColor(this, R.color.light_midColor))
}
-1L -> {
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.light_lowColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.light_lowColor))
mAvgDelta?.setTextColor(ContextCompat.getColor(this, R.color.light_lowColor))
}
}
if (ageLevel == 1) {
mTimestamp?.setTextColor(ContextCompat.getColor(this, R.color.light_mTimestamp1))
} else {
mTimestamp?.setTextColor(ContextCompat.getColor(this, R.color.light_mTimestamp))
binding.time?.setTextColor(ContextCompat.getColor(this, R.color.light_bigchart_time))
binding.status?.setTextColor(ContextCompat.getColor(this, R.color.light_bigchart_status))
binding.mainLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.light_background))
val color = when (singleBg.sgvLevel) {
1L -> R.color.light_highColor
0L -> R.color.light_midColor
-1L -> R.color.light_lowColor
else -> R.color.light_midColor
}
binding.sgv?.setTextColor(ContextCompat.getColor(this, color))
binding.delta?.setTextColor(ContextCompat.getColor(this, color))
binding.avgDelta?.setTextColor(ContextCompat.getColor(this, color))
val colorTime = if (ageLevel == 1) R.color.light_mTimestamp1 else R.color.light_mTimestamp
binding.timestamp.setTextColor(ContextCompat.getColor(this, colorTime))
} else {
setColorDark()
}
}
}
}

View file

@ -2,12 +2,15 @@
package info.nightscout.androidaps.watchfaces
import android.view.LayoutInflater
import android.view.animation.Animation
import android.view.animation.LinearInterpolator
import android.view.animation.RotateAnimation
import androidx.annotation.LayoutRes
import androidx.core.content.ContextCompat
import androidx.viewbinding.ViewBinding
import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.ActivitySteampunkBinding
import info.nightscout.androidaps.watchfaces.utils.BaseWatchFace
import info.nightscout.shared.SafeParse.stringToFloat
import org.joda.time.TimeOfDay
@ -19,8 +22,12 @@ class SteampunkWatchface : BaseWatchFace() {
private var lastEndDegrees = 0f
private var deltaRotationAngle = 0f
private lateinit var binding: ActivitySteampunkBinding
@LayoutRes override fun layoutResource(): Int = R.layout.activity_steampunk
override fun inflateLayout(inflater: LayoutInflater): ViewBinding {
binding = ActivitySteampunkBinding.inflate(inflater)
return binding
}
override fun onCreate() {
forceSquareCanvas = true
@ -29,48 +36,48 @@ class SteampunkWatchface : BaseWatchFace() {
override fun setColorDark() {
if (ageLevel() <= 0 && singleBg.timeStamp != 0L) {
mLinearLayout2?.setBackgroundResource(R.drawable.redline)
mTimestamp?.setTextColor(ContextCompat.getColor(this, R.color.red_600))
binding.tertiaryLayout.setBackgroundResource(R.drawable.redline)
binding.timestamp.setTextColor(ContextCompat.getColor(this, R.color.red_600))
} else {
mLinearLayout2?.setBackgroundResource(0)
mTimestamp?.setTextColor(ContextCompat.getColor(this, R.color.black_86p))
binding.tertiaryLayout.setBackgroundResource(0)
binding.timestamp.setTextColor(ContextCompat.getColor(this, R.color.black_86p))
}
mLoop?.setTextColor(ContextCompat.getColor(this, if (loopLevel == 0) R.color.red_600 else R.color.black_86p))
binding.loop.setTextColor(ContextCompat.getColor(this, if (loopLevel == 0) R.color.red_600 else R.color.black_86p))
if (singleBg.sgvString != "---") {
var rotationAngle = 0f //by default, show ? on the dial (? is at 0 degrees on the dial)
var rotationAngle = 0f // by default, show ? on the dial (? is at 0 degrees on the dial)
if (singleBg.glucoseUnits != "-") {
//ensure the glucose dial is the correct units
mGlucoseDial?.setImageResource(if (singleBg.glucoseUnits == "mmol") R.drawable.steampunk_dial_mmol else R.drawable.steampunk_dial_mgdl)
// ensure the glucose dial is the correct units
binding.glucoseDial.setImageResource(if (singleBg.glucoseUnits == "mmol") R.drawable.steampunk_dial_mmol else R.drawable.steampunk_dial_mgdl)
//convert the Sgv to degrees of rotation
// convert the Sgv to degrees of rotation
rotationAngle =
if (singleBg.glucoseUnits == "mmol") stringToFloat(singleBg.sgvString) * 18f //convert to mg/dL, which is equivalent to degrees
else stringToFloat(singleBg.sgvString) //if glucose a value is received, use it to determine the amount of rotation of the dial.
else stringToFloat(singleBg.sgvString) // if glucose a value is received, use it to determine the amount of rotation of the dial.
}
if (rotationAngle > 330) rotationAngle = 330f //if the glucose value is higher than 330 then show "HIGH" on the dial. ("HIGH" is at 330 degrees on the dial)
if (rotationAngle != 0f && rotationAngle < 30) rotationAngle = 30f //if the glucose value is lower than 30 show "LOW" on the dial. ("LOW" is at 30 degrees on the dial)
if (rotationAngle > 330) rotationAngle = 330f // if the glucose value is higher than 330 then show "HIGH" on the dial. ("HIGH" is at 330 degrees on the dial)
if (rotationAngle != 0f && rotationAngle < 30) rotationAngle = 30f // if the glucose value is lower than 30 show "LOW" on the dial. ("LOW" is at 30 degrees on the dial)
if (lastEndDegrees == 0f) lastEndDegrees = rotationAngle
//rotate glucose dial
// rotate glucose dial
val rotate = RotateAnimation(lastEndDegrees, rotationAngle - lastEndDegrees, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f).apply {
fillAfter = true
interpolator = LinearInterpolator()
duration = 1
}
mGlucoseDial?.startAnimation(rotate)
binding.glucoseDial.startAnimation(rotate)
lastEndDegrees = rotationAngle //store the final angle as a starting point for the next rotation.
}
//set the delta gauge and rotate the delta pointer
var deltaIsNegative = 1f //by default go clockwise
if (singleBg.avgDelta != "--") { //if a legitimate delta value is
// set the delta gauge and rotate the delta pointer
var deltaIsNegative = 1f // by default go clockwise
if (singleBg.avgDelta != "--") { // if a legitimate delta value is
// received,
// then...
if (singleBg.avgDelta[0] == '-') deltaIsNegative = -1f //if the delta is negative, go counter-clockwise
val absAvgDelta = stringToFloat(singleBg.avgDelta.substring(1)) //get rid of the sign so it can be converted to float.
var autoGranularity = "0" //auto-granularity off
//ensure the delta gauge is the right units and granularity
// ensure the delta gauge is the right units and granularity
if (singleBg.glucoseUnits != "-") {
if (singleBg.glucoseUnits == "mmol") {
if (sp.getString("delta_granularity", "2") == "4") { //Auto granularity
@ -82,15 +89,15 @@ class SteampunkWatchface : BaseWatchFace() {
}
}
if (sp.getString("delta_granularity", "2") == "1" || autoGranularity == "1") { //low
mLinearLayout?.setBackgroundResource(R.drawable.steampunk_gauge_mmol_10)
binding.secondaryLayout.setBackgroundResource(R.drawable.steampunk_gauge_mmol_10)
deltaRotationAngle = absAvgDelta * 30f
}
if (sp.getString("delta_granularity", "2") == "2" || autoGranularity == "2") { //medium
mLinearLayout?.setBackgroundResource(R.drawable.steampunk_gauge_mmol_05)
binding.secondaryLayout.setBackgroundResource(R.drawable.steampunk_gauge_mmol_05)
deltaRotationAngle = absAvgDelta * 60f
}
if (sp.getString("delta_granularity", "2") == "3" || autoGranularity == "3") { //high
mLinearLayout?.setBackgroundResource(R.drawable.steampunk_gauge_mmol_03)
binding.secondaryLayout.setBackgroundResource(R.drawable.steampunk_gauge_mmol_03)
deltaRotationAngle = absAvgDelta * 100f
}
} else {
@ -103,44 +110,40 @@ class SteampunkWatchface : BaseWatchFace() {
}
}
if (sp.getString("delta_granularity", "2") == "1" || autoGranularity == "1") { //low
mLinearLayout?.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_20)
binding.secondaryLayout.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_20)
deltaRotationAngle = absAvgDelta * 1.5f
}
if (sp.getString("delta_granularity", "2") == "2" || autoGranularity == "2") { //medium
mLinearLayout?.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_10)
binding.secondaryLayout.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_10)
deltaRotationAngle = absAvgDelta * 3f
}
if (sp.getString("delta_granularity", "2") == "3" || autoGranularity == "3") { //high
mLinearLayout?.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_5)
binding.secondaryLayout.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_5)
deltaRotationAngle = absAvgDelta * 6f
}
}
}
if (deltaRotationAngle > 40) deltaRotationAngle = 40f
mDeltaGauge?.rotation = deltaRotationAngle * deltaIsNegative
binding.deltaPointer.rotation = deltaRotationAngle * deltaIsNegative
}
//rotate the minute hand.
mMinuteHand?.rotation = TimeOfDay().minuteOfHour * 6f
// rotate the minute hand.
binding.minuteHand.rotation = TimeOfDay().minuteOfHour * 6f
//rotate the hour hand.
mHourHand?.rotation = TimeOfDay().hourOfDay * 30f + TimeOfDay().minuteOfHour * 0.5f
// rotate the hour hand.
binding.hourHand.rotation = TimeOfDay().hourOfDay * 30f + TimeOfDay().minuteOfHour * 0.5f
setTextSizes()
mLoop?.setBackgroundResource(0)
if (chart != null) {
highColor = ContextCompat.getColor(this, R.color.black)
lowColor = ContextCompat.getColor(this, R.color.black)
midColor = ContextCompat.getColor(this, R.color.black)
gridColor = ContextCompat.getColor(this, R.color.grey_steampunk)
basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_dark)
basalCenterColor = ContextCompat.getColor(this, R.color.basal_dark)
pointSize = if (sp.getInt(R.string.key_chart_time_frame, 3) < 3) {
2
} else {
1
}
setupCharts()
}
binding.loop.setBackgroundResource(0)
highColor = ContextCompat.getColor(this, R.color.black)
lowColor = ContextCompat.getColor(this, R.color.black)
midColor = ContextCompat.getColor(this, R.color.black)
gridColor = ContextCompat.getColor(this, R.color.grey_steampunk)
basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_dark)
basalCenterColor = ContextCompat.getColor(this, R.color.basal_dark)
pointSize = if (sp.getInt(R.string.key_chart_time_frame, 3) < 3) 2 else 1
setupCharts()
invalidate()
}
@ -162,36 +165,23 @@ class SteampunkWatchface : BaseWatchFace() {
fontLarge = 13f
}
//top row. large font unless text too big (i.e. detailedIOB)
mCOB2?.textSize = fontLarge
mBasalRate?.textSize = fontLarge
if (status.iobDetail.length < 7) {
mIOB2?.textSize = fontLarge
} else {
mIOB2?.textSize = fontSmall
}
// top row. large font unless text too big (i.e. detailedIOB)
binding.cob2.textSize = fontLarge
binding.basalRate.textSize = fontLarge
val fontIob = if (status.iobDetail.length < 7) fontLarge else fontSmall
binding.iob2.textSize = fontIob
//bottom row. font medium unless text too long (i.e. longer than 9' timestamp)
mLoop?.let { mLoop ->
mTimestamp?.let { mTimestamp ->
if (mTimestamp.text.length < 3 || mLoop.text.length < 3) { //always resize these fields together, for symmetry.
mTimestamp.textSize = fontMedium
mLoop.textSize = fontMedium
} else {
mTimestamp.textSize = fontSmall
mLoop.textSize = fontSmall
}
}
}
// bottom row. font medium unless text too long (i.e. longer than 9' timestamp)
// always resize these fields together, for symmetry.
val font = if (binding.timestamp.text.length < 3 || binding.loop.text.length < 3) fontMedium else fontSmall
binding.loop.textSize = font
binding.timestamp.textSize = font
// if both batteries are shown, make them smaller.
val fontBat = if (sp.getBoolean(R.string.key_show_uploader_battery, true) && sp.getBoolean(R.string.key_show_rig_battery, false)) fontSmall else fontMedium
binding.uploaderBattery.textSize = fontBat
binding.rigBattery.textSize = fontBat
//if both batteries are shown, make them smaller.
if (sp.getBoolean(R.string.key_show_uploader_battery, true) && sp.getBoolean(R.string.key_show_rig_battery, false)) {
mUploaderBattery?.textSize = fontSmall
mRigBattery?.textSize = fontSmall
} else {
mUploaderBattery?.textSize = fontMedium
mRigBattery?.textSize = fontMedium
}
}
override fun changeChartTimeframe() {
@ -200,4 +190,4 @@ class SteampunkWatchface : BaseWatchFace() {
pointSize = if (timeframe < 3) 2 else 1
sp.putString(R.string.key_chart_time_frame, timeframe.toString())
}
}
}

View file

@ -0,0 +1,102 @@
package info.nightscout.androidaps.watchfaces.utils
import androidx.viewbinding.ViewBinding
import info.nightscout.androidaps.databinding.ActivityHomeLargeBinding
import info.nightscout.androidaps.databinding.ActivityHome2Binding
import info.nightscout.androidaps.databinding.ActivityHomeBinding
import info.nightscout.androidaps.databinding.ActivityBigchartBinding
import info.nightscout.androidaps.databinding.ActivityBigchartSmallBinding
import info.nightscout.androidaps.databinding.ActivityCockpitBinding
import info.nightscout.androidaps.databinding.ActivityDigitalstyleBinding
import info.nightscout.androidaps.databinding.ActivityNochartBinding
import info.nightscout.androidaps.databinding.ActivitySteampunkBinding
/**
* WatchfaceViewAdapter binds all WatchFace variants shared attributes to one common view adapter.
* Requires at least one of the ViewBinding as a parameter. Recommended to use the factory object to create the binding.
*/
class WatchfaceViewAdapter(
aL: ActivityHomeLargeBinding? = null,
a2: ActivityHome2Binding? = null,
aa: ActivityHomeBinding? = null,
bC: ActivityBigchartBinding? = null,
bCs: ActivityBigchartSmallBinding? = null,
cp: ActivityCockpitBinding? = null,
ds: ActivityDigitalstyleBinding? = null,
nC: ActivityNochartBinding? = null,
sP: ActivitySteampunkBinding? = null
) {
init {
if (aL == null && a2 == null && aa == null && bC == null && bCs == null && cp == null && ds == null && nC == null && sP == null) {
throw IllegalArgumentException("Require at least on Binding parameter")
}
}
private val errorMessage = "Missing require View Binding parameter"
// Required attributes
val mainLayout =
aL?.mainLayout ?: a2?.mainLayout ?: aa?.mainLayout ?: bC?.mainLayout ?: bC?.mainLayout ?: cp?.mainLayout ?: ds?.mainLayout ?: nC?.mainLayout ?: sP?.mainLayout
?: throw IllegalArgumentException(errorMessage)
val timestamp =
aL?.timestamp ?: a2?.timestamp ?: aa?.timestamp ?: bC?.timestamp ?: bC?.timestamp ?: cp?.timestamp ?: ds?.timestamp ?: nC?.timestamp ?: sP?.timestamp
?: throw IllegalArgumentException(errorMessage)
val root =
aL?.root ?: a2?.root ?: aa?.root ?: bC?.root ?: bC?.root ?: cp?.root ?: ds?.root ?: nC?.root ?: sP?.root
?: throw IllegalArgumentException(errorMessage)
// Optional attributes
val sgv = aL?.sgv ?: a2?.sgv ?: aa?.sgv ?: bC?.sgv ?: bC?.sgv ?: cp?.sgv ?: ds?.sgv ?: nC?.sgv
val direction = aL?.direction ?: a2?.direction ?: aa?.direction ?: cp?.direction ?: ds?.direction
val loop = a2?.loop ?: cp?.loop ?: sP?.loop
val delta = aL?.delta ?: a2?.delta ?: aa?.delta ?: bC?.delta ?: bC?.delta ?: cp?.delta ?: ds?.delta ?: nC?.delta
val avgDelta = a2?.avgDelta ?: bC?.avgDelta ?: bC?.avgDelta ?: cp?.avgDelta ?: ds?.avgDelta ?: nC?.avgDelta
val uploaderBattery = aL?.uploaderBattery ?: a2?.uploaderBattery ?: aa?.uploaderBattery ?: cp?.uploaderBattery ?: ds?.uploaderBattery ?: sP?.uploaderBattery
val rigBattery = a2?.rigBattery ?: cp?.rigBattery ?: ds?.rigBattery ?: sP?.rigBattery
val basalRate = a2?.basalRate ?: cp?.basalRate ?: ds?.basalRate ?: sP?.basalRate
val bgi = a2?.bgi ?: ds?.bgi
val AAPSv2 = a2?.AAPSv2 ?: cp?.AAPSv2 ?: ds?.AAPSv2 ?: sP?.AAPSv2
val cob1 = a2?.cob1 ?: ds?.cob1
val cob2 = a2?.cob2 ?: cp?.cob2 ?: ds?.cob2 ?: sP?.cob2
val time = aL?.time ?: a2?.time ?: aa?.time ?: bC?.time ?: bC?.time ?: cp?.time ?: nC?.time
val minute = ds?.minute
val hour = ds?.hour
val day = a2?.day ?: ds?.day
val month = a2?.month ?: ds?.month
val iob1 = a2?.iob1 ?: ds?.iob1
val iob2 = a2?.iob2 ?: cp?.iob2 ?: ds?.iob2 ?: sP?.iob2
val chart = a2?.chart ?: aa?.chart ?: bC?.chart ?: bC?.chart ?: ds?.chart ?: sP?.chart
val status = aL?.status ?: aa?.status ?: bC?.status ?: bC?.status ?: nC?.status
val timePeriod = ds?.timePeriod
val dayName = ds?.dayName
val mainMenuTap = ds?.mainMenuTap ?: sP?.mainMenuTap
val chartZoomTap = sP?.chartZoomTap
val dateTime = ds?.dateTime ?: a2?.dateTime
// val minuteHand = sP?.minuteHand
// val secondaryLayout = aL?.secondaryLayout ?: a2?.secondaryLayout ?: aa?.secondaryLayout ?: ds?.secondaryLayout ?: sP?.secondaryLayout
// val tertiaryLayout = a2?.tertiaryLayout ?: sP?.tertiaryLayout
// val highLight = cp?.highLight
// val lowLight = cp?.lowLight
// val deltaGauge = sP?.deltaPointer
// val hourHand = sP?.hourHand
// val glucoseDial = sP?.glucoseDial
companion object {
fun getBinding(bindLayout: ViewBinding): WatchfaceViewAdapter {
return when (bindLayout) {
is ActivityHomeLargeBinding -> WatchfaceViewAdapter(bindLayout)
is ActivityHome2Binding -> WatchfaceViewAdapter(null, bindLayout)
is ActivityHomeBinding -> WatchfaceViewAdapter(null, null, bindLayout)
is ActivityBigchartBinding -> WatchfaceViewAdapter(null, null, null, bindLayout)
is ActivityBigchartSmallBinding -> WatchfaceViewAdapter(null, null, null, null, bindLayout)
is ActivityCockpitBinding -> WatchfaceViewAdapter(null, null, null, null, null, bindLayout)
is ActivityDigitalstyleBinding -> WatchfaceViewAdapter(null, null, null, null, null, null, bindLayout)
is ActivityNochartBinding -> WatchfaceViewAdapter(null, null, null, null, null, null, null, bindLayout)
is ActivitySteampunkBinding -> WatchfaceViewAdapter(null, null, null, null, null, null, null, null, bindLayout)
else -> throw IllegalArgumentException("ViewBinding is not implement in WatchfaceViewAdapter")
}
}
}
}

View file

@ -46,7 +46,7 @@
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/avgdelta"
android:id="@+id/avg_delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
@ -68,7 +68,7 @@
android:gravity="center_horizontal" />
<TextView
android:id="@+id/externaltstatus"
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
@ -85,7 +85,7 @@
android:textAlignment="center">
<TextView
android:id="@+id/watch_time"
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"

View file

@ -46,7 +46,7 @@
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/avgdelta"
android:id="@+id/avg_delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal|center"
@ -60,7 +60,7 @@
</LinearLayout>
<TextView
android:id="@+id/externaltstatus"
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
@ -87,7 +87,7 @@
android:textAlignment="center">
<TextView
android:id="@+id/watch_time"
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"

View file

@ -209,7 +209,7 @@
android:layout_weight="0.020" />
<TextView
android:id="@+id/watch_time"
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_gravity="center"
@ -222,7 +222,7 @@
tools:text="12:00" />
<TextView
android:id="@+id/tmpBasal"
android:id="@+id/basalRate"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_gravity="bottom|center_horizontal"
@ -235,7 +235,7 @@
android:textStyle="bold" />
<TextView
android:id="@+id/iobView"
android:id="@+id/iob2"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_gravity="bottom|center_horizontal"
@ -248,7 +248,7 @@
android:textStyle="bold" />
<TextView
android:id="@+id/cobView"
android:id="@+id/cob2"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_gravity="bottom|center_horizontal"
@ -370,7 +370,7 @@
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/avgdelta"
android:id="@+id/avg_delta"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="center"

View file

@ -64,7 +64,7 @@
android:weightSum="5">
<TextView
android:id="@+id/cob_text"
android:id="@+id/cob1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
@ -76,7 +76,7 @@
tools:ignore="SmallSp, NestedWeights" />
<TextView
android:id="@+id/cobView"
android:id="@+id/cob2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
@ -239,7 +239,7 @@
android:weightSum="5">
<TextView
android:id="@+id/iob_text"
android:id="@+id/iob1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
@ -251,7 +251,7 @@
tools:ignore="SmallSp, NestedWeights" />
<TextView
android:id="@+id/iobView"
android:id="@+id/iob2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
@ -289,7 +289,7 @@
android:orientation="vertical"
android:weightSum="2">
<!-- right side 1/2 height - top halft -->
<!-- right side 1/2 height - top half -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
@ -323,7 +323,7 @@
android:orientation="horizontal">
<TextView
android:id="@+id/dayname"
android:id="@+id/day_name"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
@ -335,7 +335,7 @@
tools:text="DDD" />
<TextView
android:id="@+id/weeknumber"
android:id="@+id/week_number"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4"
@ -470,7 +470,7 @@
</LinearLayout>
<!-- right side 1/2 height - bottom halft -->
<!-- right side 1/2 height - bottom half -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
@ -482,7 +482,7 @@
android:orientation="vertical"
android:weightSum="10">
<!-- right side bottom - statusbar 2/10 -->
<!-- right side bottom - status bar 2/10 -->
<LinearLayout
android:id="@+id/secondary_layout"
android:layout_width="match_parent"
@ -505,7 +505,7 @@
tools:ignore="HardcodedText, SmallSp, NestedWeights" />
<TextView
android:id="@+id/avgdelta"
android:id="@+id/avg_delta"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
@ -542,7 +542,7 @@
tools:ignore="HardcodedText,SmallSp" />
<TextView
android:id="@+id/tmpBasal"
android:id="@+id/basalRate"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.7"
@ -554,7 +554,7 @@
tools:ignore="SmallSp" />
<TextView
android:id="@+id/bgiView"
android:id="@+id/bgi"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"

View file

@ -125,7 +125,7 @@
tools:ignore="SmallSp" />
<TextView
android:id="@+id/externaltstatus"
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10sp"
@ -139,7 +139,7 @@
</LinearLayout>
<TextView
android:id="@+id/watch_time"
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|top"

View file

@ -122,7 +122,7 @@
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/avgdelta"
android:id="@+id/avg_delta"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -164,7 +164,7 @@
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/tmpBasal"
android:id="@+id/basal_rate"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -177,7 +177,7 @@
android:textStyle="bold" />
<TextView
android:id="@+id/bgiView"
android:id="@+id/bgi"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -223,7 +223,7 @@
android:textAlignment="center">
<TextView
android:id="@+id/cob_text"
android:id="@+id/cob1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -235,7 +235,7 @@
tools:ignore="SmallSp" />
<TextView
android:id="@+id/cobView"
android:id="@+id/cob2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -254,7 +254,7 @@
android:layout_weight="1" />
<TextView
android:id="@+id/watch_time"
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -313,7 +313,7 @@
android:textAlignment="center">
<TextView
android:id="@+id/iob_text"
android:id="@+id/iob1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -326,7 +326,7 @@
tools:ignore="SmallSp" />
<TextView
android:id="@+id/iobView"
android:id="@+id/iob2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"

View file

@ -111,7 +111,7 @@
android:textSize="12sp" />
<TextView
android:id="@+id/externaltstatus"
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10sp"
@ -124,7 +124,7 @@
</LinearLayout>
<TextView
android:id="@+id/watch_time"
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|top"

View file

@ -46,7 +46,7 @@
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/avgdelta"
android:id="@+id/avg_delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
@ -60,7 +60,7 @@
</LinearLayout>
<TextView
android:id="@+id/externaltstatus"
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
@ -77,7 +77,7 @@
android:textAlignment="center">
<TextView
android:id="@+id/watch_time"
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"

View file

@ -46,7 +46,7 @@
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/avgdelta"
android:id="@+id/avg_delta"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
@ -67,7 +67,7 @@
android:gravity="center_horizontal" />
<TextView
android:id="@+id/externaltstatus"
android:id="@+id/status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -86,7 +86,7 @@
android:textAlignment="center">
<TextView
android:id="@+id/watch_time"
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"

View file

@ -90,7 +90,7 @@
android:orientation="horizontal">
<TextView
android:id="@+id/cobView"
android:id="@+id/cob2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
@ -112,7 +112,7 @@
android:orientation="horizontal">
<TextView
android:id="@+id/tmpBasal"
android:id="@+id/basalRate"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
@ -134,7 +134,7 @@
android:orientation="horizontal">
<TextView
android:id="@+id/iobView"
android:id="@+id/iob2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"

View file

@ -45,7 +45,7 @@
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/avgdelta"
android:id="@+id/avg_delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
@ -67,7 +67,7 @@
android:gravity="center_horizontal" />
<TextView
android:id="@+id/externaltstatus"
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
@ -83,7 +83,7 @@
android:orientation="horizontal">
<TextView
android:id="@+id/watch_time"
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"

View file

@ -45,7 +45,7 @@
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/avgdelta"
android:id="@+id/avg_delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal|center"
@ -59,7 +59,7 @@
</LinearLayout>
<TextView
android:id="@+id/externaltstatus"
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
@ -86,7 +86,7 @@
android:textAlignment="center">
<TextView
android:id="@+id/watch_time"
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"

View file

@ -209,7 +209,7 @@
android:layout_weight="0.020" />
<TextView
android:id="@+id/watch_time"
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_gravity="center"
@ -222,7 +222,7 @@
tools:text="12:00" />
<TextView
android:id="@+id/tmpBasal"
android:id="@+id/basalRate"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_gravity="bottom|center_horizontal"
@ -235,7 +235,7 @@
android:textStyle="bold" />
<TextView
android:id="@+id/iobView"
android:id="@+id/iob2"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_gravity="bottom|center_horizontal"
@ -248,7 +248,7 @@
android:textStyle="bold" />
<TextView
android:id="@+id/cobView"
android:id="@+id/cob2"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_gravity="bottom|center_horizontal"
@ -370,7 +370,7 @@
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/avgdelta"
android:id="@+id/avg_delta"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="center"

View file

@ -63,7 +63,7 @@
android:weightSum="5">
<TextView
android:id="@+id/cob_text"
android:id="@+id/cob1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
@ -75,7 +75,7 @@
tools:ignore="SmallSp" />
<TextView
android:id="@+id/cobView"
android:id="@+id/cob2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
@ -237,7 +237,7 @@
android:weightSum="5">
<TextView
android:id="@+id/iob_text"
android:id="@+id/iob1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
@ -249,7 +249,7 @@
tools:ignore="SmallSp" />
<TextView
android:id="@+id/iobView"
android:id="@+id/iob2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
@ -320,7 +320,7 @@
android:orientation="horizontal">
<TextView
android:id="@+id/dayname"
android:id="@+id/day_name"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
@ -332,7 +332,7 @@
tools:text="DDD" />
<TextView
android:id="@+id/weeknumber"
android:id="@+id/week_number"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4"
@ -502,7 +502,7 @@
tools:ignore="HardcodedText,SmallSp" />
<TextView
android:id="@+id/avgdelta"
android:id="@+id/avg_delta"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
@ -539,7 +539,7 @@
tools:ignore="HardcodedText,SmallSp" />
<TextView
android:id="@+id/tmpBasal"
android:id="@+id/basalRate"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.7"
@ -551,7 +551,7 @@
tools:ignore="SmallSp" />
<TextView
android:id="@+id/bgiView"
android:id="@+id/bgi"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"

View file

@ -127,7 +127,7 @@
tools:ignore="SmallSp" />
<TextView
android:id="@+id/externaltstatus"
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10sp"
@ -143,7 +143,7 @@
</LinearLayout>
<TextView
android:id="@+id/watch_time"
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"

View file

@ -132,7 +132,7 @@
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/avgdelta"
android:id="@+id/avg_delta"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -174,7 +174,7 @@
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/tmpBasal"
android:id="@+id/basalRate"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -187,7 +187,7 @@
android:textStyle="bold" />
<TextView
android:id="@+id/bgiView"
android:id="@+id/bgi"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -233,7 +233,7 @@
android:textAlignment="center">
<TextView
android:id="@+id/cob_text"
android:id="@+id/cob1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -245,7 +245,7 @@
tools:ignore="SmallSp" />
<TextView
android:id="@+id/cobView"
android:id="@+id/cob2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -265,7 +265,7 @@
tools:ignore="NestedWeights" />
<TextView
android:id="@+id/watch_time"
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -322,7 +322,7 @@
android:textAlignment="center">
<TextView
android:id="@+id/iob_text"
android:id="@+id/iob1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -335,7 +335,7 @@
tools:ignore="SmallSp" />
<TextView
android:id="@+id/iobView"
android:id="@+id/iob2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"

View file

@ -113,7 +113,7 @@
android:textSize="14sp" />
<TextView
android:id="@+id/externaltstatus"
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10sp"
@ -126,7 +126,7 @@
</LinearLayout>
<TextView
android:id="@+id/watch_time"
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|top"

View file

@ -45,7 +45,7 @@
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/avgdelta"
android:id="@+id/avg_delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
@ -59,7 +59,7 @@
</LinearLayout>
<TextView
android:id="@+id/externaltstatus"
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
@ -76,7 +76,7 @@
android:textAlignment="center">
<TextView
android:id="@+id/watch_time"
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"

View file

@ -47,7 +47,7 @@
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/avgdelta"
android:id="@+id/avg_delta"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
@ -69,7 +69,7 @@
android:gravity="center_horizontal" />
<TextView
android:id="@+id/externaltstatus"
android:id="@+id/status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -88,7 +88,7 @@
android:textAlignment="center">
<TextView
android:id="@+id/watch_time"
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"

View file

@ -90,7 +90,7 @@
android:orientation="horizontal">
<TextView
android:id="@+id/cobView"
android:id="@+id/cob2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
@ -112,7 +112,7 @@
android:orientation="horizontal">
<TextView
android:id="@+id/tmpBasal"
android:id="@+id/basalRate"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
@ -134,7 +134,7 @@
android:orientation="horizontal">
<TextView
android:id="@+id/iobView"
android:id="@+id/iob2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"