Merge pull request #1889 from Andries-Smit/chore/watchface-databinding

Chore: watchface use databinding
This commit is contained in:
Milos Kozak 2022-07-06 22:00:04 +02:00 committed by GitHub
commit 0397308dad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 812 additions and 843 deletions

View file

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

View file

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

View file

@ -1,114 +1,106 @@
package info.nightscout.androidaps.watchfaces package info.nightscout.androidaps.watchfaces
import android.graphics.Color import android.graphics.Color
import androidx.annotation.LayoutRes import android.view.LayoutInflater
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.viewbinding.ViewBinding
import com.ustwo.clockwise.common.WatchMode import com.ustwo.clockwise.common.WatchMode
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.watchfaces.utils.BaseWatchFace
import info.nightscout.androidaps.databinding.ActivityHomeBinding
class AapsWatchface : BaseWatchFace() { 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() { override fun setColorDark() {
mLinearLayout?.setBackgroundColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_background else R.color.dark_statusView)) binding.secondaryLayout.setBackgroundColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_background else R.color.dark_statusView))
mTime?.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime)) binding.time.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime))
mRelativeLayout?.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background)) val color = when (singleBg.sgvLevel) {
when (singleBg.sgvLevel) { 1L -> R.color.dark_highColor
1L -> { 0L -> R.color.dark_midColor
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_highColor)) -1L -> R.color.dark_lowColor
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_highColor)) else -> R.color.dark_midColor
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.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() { override fun setColorLowRes() {
mTime?.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime)) binding.time.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime))
mRelativeLayout?.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background)) binding.mainLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor)) binding.sgv.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor)) binding.delta.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
mTimestamp?.setTextColor(ContextCompat.getColor(this, R.color.dark_Timestamp)) binding.timestamp.setTextColor(ContextCompat.getColor(this, R.color.dark_Timestamp))
if (chart != null) {
highColor = ContextCompat.getColor(this, R.color.dark_midColor) highColor = ContextCompat.getColor(this, R.color.dark_midColor)
lowColor = ContextCompat.getColor(this, R.color.dark_midColor) lowColor = ContextCompat.getColor(this, R.color.dark_midColor)
midColor = ContextCompat.getColor(this, R.color.dark_midColor) midColor = ContextCompat.getColor(this, R.color.dark_midColor)
gridColor = ContextCompat.getColor(this, R.color.dark_gridColor) gridColor = ContextCompat.getColor(this, R.color.dark_gridColor)
basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_dark_lowres) basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_dark_lowres)
basalCenterColor = ContextCompat.getColor(this, R.color.basal_light_lowres) basalCenterColor = ContextCompat.getColor(this, R.color.basal_light_lowres)
pointSize = 2 pointSize = 2
setupCharts() setupCharts()
}
} }
override fun setColorBright() { override fun setColorBright() {
if (currentWatchMode == WatchMode.INTERACTIVE) { if (currentWatchMode == WatchMode.INTERACTIVE) {
mLinearLayout?.setBackgroundColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.light_background else R.color.light_stripe_background)) binding.secondaryLayout.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)) binding.mainLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.light_background))
when (singleBg.sgvLevel) { val color = when (singleBg.sgvLevel) {
1L -> { 1L -> R.color.light_highColor
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.light_highColor)) 0L -> R.color.light_midColor
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.light_highColor)) -1L -> R.color.light_lowColor
mDirection?.setTextColor(ContextCompat.getColor(this, R.color.light_highColor)) else -> R.color.light_midColor
}
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.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 { } else {
setColorDark() setColorDark()
} }
} }
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,5 @@
@file:Suppress("DEPRECATION") @file:Suppress("DEPRECATION")
package info.nightscout.androidaps.watchfaces.utils
package info.nightscout.androidaps.watchfaces
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.BroadcastReceiver import android.content.BroadcastReceiver
@ -13,14 +12,10 @@ import android.os.Vibrator
import android.support.wearable.watchface.WatchFaceStyle import android.support.wearable.watchface.WatchFaceStyle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup
import android.view.WindowInsets import android.view.WindowInsets
import android.view.WindowManager import android.view.WindowManager
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import androidx.annotation.LayoutRes
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.viewbinding.ViewBinding
import com.ustwo.clockwise.common.WatchFaceTime import com.ustwo.clockwise.common.WatchFaceTime
import com.ustwo.clockwise.common.WatchMode import com.ustwo.clockwise.common.WatchMode
import com.ustwo.clockwise.common.WatchShape import com.ustwo.clockwise.common.WatchShape
@ -45,7 +40,6 @@ import info.nightscout.shared.weardata.EventData
import info.nightscout.shared.weardata.EventData.ActionResendData import info.nightscout.shared.weardata.EventData.ActionResendData
import io.reactivex.rxjava3.disposables.CompositeDisposable import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign import io.reactivex.rxjava3.kotlin.plusAssign
import lecho.lib.hellocharts.view.LineChartView
import javax.inject.Inject import javax.inject.Inject
import kotlin.math.floor import kotlin.math.floor
@ -55,6 +49,7 @@ import kotlin.math.floor
* Refactored by dlvoy on 2019-11-2019 * Refactored by dlvoy on 2019-11-2019
* Refactored by MilosKozak 24/04/2022 * Refactored by MilosKozak 24/04/2022
*/ */
abstract class BaseWatchFace : WatchFace() { abstract class BaseWatchFace : WatchFace() {
@Inject lateinit var wearUtil: WearUtil @Inject lateinit var wearUtil: WearUtil
@ -74,45 +69,10 @@ abstract class BaseWatchFace : WatchFace() {
private val graphData get() = rawData.graphData private val graphData get() = rawData.graphData
// Layout // Layout
@LayoutRes abstract fun layoutResource(): Int // @LayoutRes abstract fun layoutResource(): Int
abstract fun inflateLayout(inflater: LayoutInflater): ViewBinding
private val displaySize = Point() private val displaySize = Point()
var mTime: TextView? = null
var mHour: TextView? = null
var mMinute: TextView? = null
var mSgv: TextView? = null
var mDirection: TextView? = null
var mTimestamp: TextView? = null
var mUploaderBattery: TextView? = null
var mRigBattery: TextView? = null
var mDelta: TextView? = null
var mAvgDelta: TextView? = null
var mStatus: TextView? = null
var mBasalRate: TextView? = null
var mIOB1: TextView? = null
var mIOB2: TextView? = null
var mCOB1: TextView? = null
var mCOB2: TextView? = null
var mBgi: TextView? = null
var mLoop: TextView? = null
private var mTimePeriod: TextView? = null
var mDay: TextView? = null
private var mDayName: TextView? = null
var mMonth: TextView? = null
private var isAAPSv2: View? = null
var mHighLight: TextView? = null
var mLowLight: TextView? = null
var mGlucoseDial: ImageView? = null
var mDeltaGauge: ImageView? = null
var mHourHand: ImageView? = null
var mMinuteHand: ImageView? = null
var mRelativeLayout: ViewGroup? = null
var mLinearLayout: LinearLayout? = null
var mLinearLayout2: LinearLayout? = null
private var mDate: LinearLayout? = null
private var mChartTap: LinearLayout? = null // Steampunk only
private var mMainMenuTap: LinearLayout? = null // Steampunk,Digital only
var chart: LineChartView? = null
var ageLevel = 1 var ageLevel = 1
var loopLevel = -1 var loopLevel = -1
@ -148,10 +108,12 @@ abstract class BaseWatchFace : WatchFace() {
private lateinit var mTimePaint: Paint private lateinit var mTimePaint: Paint
private lateinit var mSvgPaint: Paint private lateinit var mSvgPaint: Paint
private lateinit var mDirectionPaint: Paint private lateinit var mDirectionPaint: Paint
private lateinit var binding: WatchfaceViewAdapter
private var mLastSvg = "" private var mLastSvg = ""
private var mLastDirection = "" private var mLastDirection = ""
private var mYOffset = 0f private var mYOffset = 0f
override fun onCreate() { override fun onCreate() {
// Not derived from DaggerService, do injection here // Not derived from DaggerService, do injection here
AndroidInjection.inject(this) AndroidInjection.inject(this)
@ -188,13 +150,17 @@ abstract class BaseWatchFace : WatchFace() {
persistence.turnOff() persistence.turnOff()
setupBatteryReceiver() setupBatteryReceiver()
setupSimpleUi() setupSimpleUi()
layoutView = (getSystemService(LAYOUT_INFLATER_SERVICE) as LayoutInflater).inflate(layoutResource(), null)
val inflater = (getSystemService(LAYOUT_INFLATER_SERVICE) as LayoutInflater)
val bindLayout = inflateLayout(inflater)
binding = WatchfaceViewAdapter.getBinding(bindLayout)
layoutView = binding.root
performViewSetup() performViewSetup()
rxBus.send(EventWearToMobile(ActionResendData("BaseWatchFace::onCreate"))) rxBus.send(EventWearToMobile(ActionResendData("BaseWatchFace::onCreate")))
} }
override fun onTapCommand(tapType: Int, x: Int, y: Int, eventTime: Long) { override fun onTapCommand(tapType: Int, x: Int, y: Int, eventTime: Long) {
chart?.let { chart -> binding.chart?.let { chart ->
if (tapType == TAP_TYPE_TAP && x >= chart.left && x <= chart.right && y >= chart.top && y <= chart.bottom) { if (tapType == TAP_TYPE_TAP && x >= chart.left && x <= chart.right && y >= chart.top && y <= chart.bottom) {
if (eventTime - chartTapTime < 800) { if (eventTime - chartTapTime < 800) {
changeChartTimeframe() changeChartTimeframe()
@ -203,7 +169,7 @@ abstract class BaseWatchFace : WatchFace() {
return return
} }
} }
mSgv?.let { mSgv -> binding.sgv?.let { mSgv ->
val extra = (mSgv.right - mSgv.left) / 2 val extra = (mSgv.right - mSgv.left) / 2
if (tapType == TAP_TYPE_TAP && x + extra >= mSgv.left && x - extra <= mSgv.right && y >= mSgv.top && y <= mSgv.bottom) { if (tapType == TAP_TYPE_TAP && x + extra >= mSgv.left && x - extra <= mSgv.right && y >= mSgv.top && y <= mSgv.bottom) {
if (eventTime - sgvTapTime < 800) { if (eventTime - sgvTapTime < 800) {
@ -212,7 +178,7 @@ abstract class BaseWatchFace : WatchFace() {
sgvTapTime = eventTime sgvTapTime = eventTime
} }
} }
mChartTap?.let { mChartTap -> binding.chartZoomTap?.let { mChartTap ->
if (tapType == TAP_TYPE_TAP && x >= mChartTap.left && x <= mChartTap.right && y >= mChartTap.top && y <= mChartTap.bottom) { if (tapType == TAP_TYPE_TAP && x >= mChartTap.left && x <= mChartTap.right && y >= mChartTap.top && y <= mChartTap.bottom) {
if (eventTime - chartTapTime < 800) { if (eventTime - chartTapTime < 800) {
changeChartTimeframe() changeChartTimeframe()
@ -221,7 +187,7 @@ abstract class BaseWatchFace : WatchFace() {
return return
} }
} }
mMainMenuTap?.let { mMainMenuTap -> binding.mainMenuTap?.let { mMainMenuTap ->
if (tapType == TAP_TYPE_TAP && x >= mMainMenuTap.left && x <= mMainMenuTap.right && y >= mMainMenuTap.top && y <= mMainMenuTap.bottom) { if (tapType == TAP_TYPE_TAP && x >= mMainMenuTap.left && x <= mMainMenuTap.right && y >= mMainMenuTap.top && y <= mMainMenuTap.bottom) {
if (eventTime - mainMenuTapTime < 800) { if (eventTime - mainMenuTapTime < 800) {
startActivity(Intent(this, MainMenuActivity::class.java).also { it.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) }) startActivity(Intent(this, MainMenuActivity::class.java).also { it.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) })
@ -288,42 +254,6 @@ abstract class BaseWatchFace : WatchFace() {
} }
private fun performViewSetup() { private fun performViewSetup() {
mTime = layoutView?.findViewById(R.id.watch_time)
mHour = layoutView?.findViewById(R.id.hour)
mMinute = layoutView?.findViewById(R.id.minute)
mDay = layoutView?.findViewById(R.id.day)
mDayName = layoutView?.findViewById(R.id.dayname)
mMonth = layoutView?.findViewById(R.id.month)
mTimePeriod = layoutView?.findViewById(R.id.timePeriod)
mDate = layoutView?.findViewById(R.id.date_time)
mLoop = layoutView?.findViewById(R.id.loop)
mSgv = layoutView?.findViewById(R.id.sgv)
mDirection = layoutView?.findViewById(R.id.direction)
mTimestamp = layoutView?.findViewById(R.id.timestamp)
mIOB1 = layoutView?.findViewById(R.id.iob_text)
mIOB2 = layoutView?.findViewById(R.id.iobView)
mCOB1 = layoutView?.findViewById(R.id.cob_text)
mCOB2 = layoutView?.findViewById(R.id.cobView)
mBgi = layoutView?.findViewById(R.id.bgiView)
mStatus = layoutView?.findViewById(R.id.externaltstatus)
mBasalRate = layoutView?.findViewById(R.id.tmpBasal)
mUploaderBattery = layoutView?.findViewById(R.id.uploader_battery)
mRigBattery = layoutView?.findViewById(R.id.rig_battery)
mDelta = layoutView?.findViewById(R.id.delta)
mAvgDelta = layoutView?.findViewById(R.id.avgdelta)
isAAPSv2 = layoutView?.findViewById(R.id.AAPSv2)
mHighLight = layoutView?.findViewById(R.id.highLight)
mLowLight = layoutView?.findViewById(R.id.lowLight)
mRelativeLayout = layoutView?.findViewById(R.id.main_layout)
mLinearLayout = layoutView?.findViewById(R.id.secondary_layout)
mLinearLayout2 = layoutView?.findViewById(R.id.tertiary_layout)
mGlucoseDial = layoutView?.findViewById(R.id.glucose_dial)
mDeltaGauge = layoutView?.findViewById(R.id.delta_pointer)
mHourHand = layoutView?.findViewById(R.id.hour_hand)
mMinuteHand = layoutView?.findViewById(R.id.minute_hand)
mChartTap = layoutView?.findViewById(R.id.chart_zoom_tap)
mMainMenuTap = layoutView?.findViewById(R.id.main_menu_tap)
chart = layoutView?.findViewById(R.id.chart)
layoutSet = true layoutSet = true
setupCharts() setupCharts()
setDataFields() setDataFields()
@ -364,10 +294,10 @@ abstract class BaseWatchFace : WatchFace() {
onDrawSimpleUi(canvas) onDrawSimpleUi(canvas)
} else { } else {
if (layoutSet) { if (layoutSet) {
mRelativeLayout?.measure(specW, specH) binding.mainLayout.measure(specW, specH)
val y = if (forceSquareCanvas) displaySize.x else displaySize.y // Square Steampunk val y = if (forceSquareCanvas) displaySize.x else displaySize.y // Square Steampunk
mRelativeLayout?.layout(0, 0, displaySize.x, y) binding.mainLayout.layout(0, 0, displaySize.x, y)
mRelativeLayout?.draw(canvas) binding.mainLayout.draw(canvas)
} }
} }
} }
@ -417,6 +347,7 @@ abstract class BaseWatchFace : WatchFace() {
return status == BatteryManager.BATTERY_STATUS_CHARGING || status == BatteryManager.BATTERY_STATUS_FULL return status == BatteryManager.BATTERY_STATUS_CHARGING || status == BatteryManager.BATTERY_STATUS_FULL
} }
@SuppressLint("MissingPermission")
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
private fun checkVibrateHourly(oldTime: WatchFaceTime, newTime: WatchFaceTime) { private fun checkVibrateHourly(oldTime: WatchFaceTime, newTime: WatchFaceTime) {
val hourlyVibratePref = sp.getBoolean(R.string.key_vibrate_hourly, false) val hourlyVibratePref = sp.getBoolean(R.string.key_vibrate_hourly, false)
@ -431,54 +362,54 @@ abstract class BaseWatchFace : WatchFace() {
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
open fun setDataFields() { open fun setDataFields() {
setDateAndTime() setDateAndTime()
mSgv?.text = singleBg.sgvString binding.sgv?.text = singleBg.sgvString
mSgv?.visibility = sp.getBoolean(R.string.key_show_bg, true).toVisibilityKeepSpace() binding.sgv?.visibility = sp.getBoolean(R.string.key_show_bg, true).toVisibilityKeepSpace()
strikeThroughSgvIfNeeded() strikeThroughSgvIfNeeded()
mDirection?.text = "${singleBg.slopeArrow}\uFE0E" binding.direction?.text = "${singleBg.slopeArrow}\uFE0E"
mDirection?.visibility = sp.getBoolean(R.string.key_show_direction, true).toVisibility() binding.direction?.visibility = sp.getBoolean(R.string.key_show_direction, true).toVisibility()
mDelta?.text = singleBg.delta binding.delta?.text = singleBg.delta
mDelta?.visibility = sp.getBoolean(R.string.key_show_delta, true).toVisibility() binding.delta?.visibility = sp.getBoolean(R.string.key_show_delta, true).toVisibility()
mAvgDelta?.text = singleBg.avgDelta binding.avgDelta?.text = singleBg.avgDelta
mAvgDelta?.visibility = sp.getBoolean(R.string.key_show_avg_delta, true).toVisibility() binding.avgDelta?.visibility = sp.getBoolean(R.string.key_show_avg_delta, true).toVisibility()
mCOB1?.visibility = sp.getBoolean(R.string.key_show_cob, true).toVisibility() binding.cob1?.visibility = sp.getBoolean(R.string.key_show_cob, true).toVisibility()
mCOB2?.text = status.cob binding.cob2?.text = status.cob
mCOB2?.visibility = sp.getBoolean(R.string.key_show_cob, true).toVisibility() binding.cob2?.visibility = sp.getBoolean(R.string.key_show_cob, true).toVisibility()
mIOB1?.visibility = sp.getBoolean(R.string.key_show_iob, true).toVisibility() binding.iob1?.visibility = sp.getBoolean(R.string.key_show_iob, true).toVisibility()
mIOB2?.visibility = sp.getBoolean(R.string.key_show_iob, true).toVisibility() binding.iob2?.visibility = sp.getBoolean(R.string.key_show_iob, true).toVisibility()
mIOB1?.text = if (status.detailedIob) status.iobSum else getString(R.string.activity_IOB) binding.iob1?.text = if (status.detailedIob) status.iobSum else getString(R.string.activity_IOB)
mIOB2?.text = if (status.detailedIob) status.iobDetail else status.iobSum binding.iob2?.text = if (status.detailedIob) status.iobDetail else status.iobSum
mTimestamp?.visibility = sp.getBoolean(R.string.key_show_ago, true).toVisibility() binding.timestamp.visibility = sp.getBoolean(R.string.key_show_ago, true).toVisibility()
mTimestamp?.text = readingAge(if (isAAPSv2 != null) true else sp.getBoolean(R.string.key_show_external_status, true)) binding.timestamp.text = readingAge(if (binding.AAPSv2 != null) true else sp.getBoolean(R.string.key_show_external_status, true))
mUploaderBattery?.visibility = sp.getBoolean(R.string.key_show_uploader_battery, true).toVisibility() binding.uploaderBattery?.visibility = sp.getBoolean(R.string.key_show_uploader_battery, true).toVisibility()
mUploaderBattery?.text = binding.uploaderBattery?.text =
when { when {
isAAPSv2 != null -> status.battery + "%" binding.AAPSv2 != null -> status.battery + "%"
sp.getBoolean(R.string.key_show_external_status, true) -> "U: ${status.battery}%" sp.getBoolean(R.string.key_show_external_status, true) -> "U: ${status.battery}%"
else -> "Uploader: ${status.battery}%" else -> "Uploader: ${status.battery}%"
} }
mRigBattery?.visibility = sp.getBoolean(R.string.key_show_rig_battery, false).toVisibility() binding.rigBattery?.visibility = sp.getBoolean(R.string.key_show_rig_battery, false).toVisibility()
mRigBattery?.text = status.rigBattery binding.rigBattery?.text = status.rigBattery
mBasalRate?.text = status.currentBasal binding.basalRate?.text = status.currentBasal
mBasalRate?.visibility = sp.getBoolean(R.string.key_show_temp_basal, true).toVisibility() binding.basalRate?.visibility = sp.getBoolean(R.string.key_show_temp_basal, true).toVisibility()
mBgi?.text = status.bgi binding.bgi?.text = status.bgi
mBgi?.visibility = status.showBgi.toVisibility() binding.bgi?.visibility = status.showBgi.toVisibility()
mStatus?.text = status.externalStatus binding.status?.text = status.externalStatus
mStatus?.visibility = sp.getBoolean(R.string.key_show_external_status, true).toVisibility() binding.status?.visibility = sp.getBoolean(R.string.key_show_external_status, true).toVisibility()
mLoop?.visibility = sp.getBoolean(R.string.key_show_external_status, true).toVisibility() binding.loop?.visibility = sp.getBoolean(R.string.key_show_external_status, true).toVisibility()
if (status.openApsStatus != -1L) { if (status.openApsStatus != -1L) {
val minutes = ((System.currentTimeMillis() - status.openApsStatus) / 1000 / 60).toInt() val minutes = ((System.currentTimeMillis() - status.openApsStatus) / 1000 / 60).toInt()
mLoop?.text = "$minutes'" binding.loop?.text = "$minutes'"
if (minutes > 14) { if (minutes > 14) {
loopLevel = 0 loopLevel = 0
mLoop?.setBackgroundResource(R.drawable.loop_red_25) binding.loop?.setBackgroundResource(R.drawable.loop_red_25)
} else { } else {
loopLevel = 1 loopLevel = 1
mLoop?.setBackgroundResource(R.drawable.loop_green_25) binding.loop?.setBackgroundResource(R.drawable.loop_green_25)
} }
} else { } else {
loopLevel = -1 loopLevel = -1
mLoop?.text = "-" binding.loop?.text = "-"
mLoop?.setBackgroundResource(R.drawable.loop_grey_25) binding.loop?.setBackgroundResource(R.drawable.loop_grey_25)
} }
setColor() setColor()
} }
@ -491,15 +422,15 @@ abstract class BaseWatchFace : WatchFace() {
} }
private fun setDateAndTime() { private fun setDateAndTime() {
mTime?.text = dateUtil.timeString() binding.time?.text = dateUtil.timeString()
mHour?.text = dateUtil.hourString() binding.hour?.text = dateUtil.hourString()
mMinute?.text = dateUtil.minuteString() binding.minute?.text = dateUtil.minuteString()
mDate?.visibility = sp.getBoolean(R.string.key_show_date, false).toVisibility() binding.dateTime?.visibility = sp.getBoolean(R.string.key_show_date, false).toVisibility()
mDayName?.text = dateUtil.dayNameString() binding.dayName?.text = dateUtil.dayNameString()
mDay?.text = dateUtil.dayString() binding.day?.text = dateUtil.dayString()
mMonth?.text = dateUtil.monthString() binding.month?.text = dateUtil.monthString()
mTimePeriod?.visibility = android.text.format.DateFormat.is24HourFormat(this).not().toVisibility() binding.timePeriod?.visibility = android.text.format.DateFormat.is24HourFormat(this).not().toVisibility()
mTimePeriod?.text = dateUtil.amPm() binding.timePeriod?.text = dateUtil.amPm()
} }
private fun setColor() { private fun setColor() {
@ -512,7 +443,8 @@ abstract class BaseWatchFace : WatchFace() {
} }
private fun strikeThroughSgvIfNeeded() { private fun strikeThroughSgvIfNeeded() {
mSgv?.let { mSgv -> @Suppress("DEPRECATION")
binding.sgv?.let { mSgv ->
if (ageLevel() <= 0 && singleBg.timeStamp > 0) mSgv.paintFlags = mSgv.paintFlags or Paint.STRIKE_THRU_TEXT_FLAG if (ageLevel() <= 0 && singleBg.timeStamp > 0) mSgv.paintFlags = mSgv.paintFlags or Paint.STRIKE_THRU_TEXT_FLAG
else mSgv.paintFlags = mSgv.paintFlags and Paint.STRIKE_THRU_TEXT_FLAG.inv() else mSgv.paintFlags = mSgv.paintFlags and Paint.STRIKE_THRU_TEXT_FLAG.inv()
} }
@ -559,7 +491,7 @@ abstract class BaseWatchFace : WatchFace() {
if (isSimpleUi) { if (isSimpleUi) {
return return
} }
if (chart != null && graphData.entries.size > 0) { if (binding.chart != null && graphData.entries.size > 0) {
val timeframe = sp.getInt(R.string.key_chart_time_frame, 3) val timeframe = sp.getInt(R.string.key_chart_time_frame, 3)
val bgGraphBuilder = val bgGraphBuilder =
if (lowResMode) if (lowResMode)
@ -572,8 +504,8 @@ abstract class BaseWatchFace : WatchFace() {
sp, dateUtil, graphData.entries, treatmentData.predictions, treatmentData.temps, treatmentData.basals, treatmentData.boluses, sp, dateUtil, graphData.entries, treatmentData.predictions, treatmentData.temps, treatmentData.basals, treatmentData.boluses,
pointSize, highColor, lowColor, midColor, gridColor, basalBackgroundColor, basalCenterColor, bolusColor, Color.GREEN, timeframe pointSize, highColor, lowColor, midColor, gridColor, basalBackgroundColor, basalCenterColor, bolusColor, Color.GREEN, timeframe
) )
chart?.lineChartData = bgGraphBuilder.lineData() binding.chart?.lineChartData = bgGraphBuilder.lineData()
chart?.isViewportCalculationEnabled = true binding.chart?.isViewportCalculationEnabled = true
} }
} }

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.watchfaces package info.nightscout.androidaps.watchfaces.utils
import android.graphics.DashPathEffect import android.graphics.DashPathEffect
import info.nightscout.androidaps.R import info.nightscout.androidaps.R

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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