NoChartWatchface: based on BaseWatchFace
This commit is contained in:
parent
db4b1d261b
commit
2b00ea745a
|
@ -1,13 +1,14 @@
|
|||
package info.nightscout.androidaps.watchfaces
|
||||
|
||||
import android.graphics.Color
|
||||
import androidx.annotation.LayoutRes
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.ustwo.clockwise.common.WatchMode
|
||||
import info.nightscout.androidaps.R
|
||||
|
||||
class AapsLargeWatchface : BaseWatchFace() {
|
||||
|
||||
override fun layoutResource(): Int = R.layout.activity_home_large
|
||||
@LayoutRes override fun layoutResource(): Int = R.layout.activity_home_large
|
||||
|
||||
override fun setColorDark() {
|
||||
mLinearLayout?.setBackgroundColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_background else R.color.dark_mLinearLayout))
|
||||
|
|
|
@ -2,13 +2,14 @@ package info.nightscout.androidaps.watchfaces
|
|||
|
||||
import android.graphics.Color
|
||||
import androidx.annotation.ColorInt
|
||||
import androidx.annotation.LayoutRes
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.ustwo.clockwise.common.WatchMode
|
||||
import info.nightscout.androidaps.R
|
||||
|
||||
class AapsV2Watchface : BaseWatchFace() {
|
||||
|
||||
override fun layoutResource(): Int = R.layout.activity_home_2
|
||||
@LayoutRes override fun layoutResource(): Int = R.layout.activity_home_2
|
||||
|
||||
override fun setColorDark() {
|
||||
@ColorInt val dividerTxtColor = if (dividerMatchesBg) ContextCompat.getColor(this, R.color.dark_midColor) else Color.BLACK
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package info.nightscout.androidaps.watchfaces
|
||||
|
||||
import android.graphics.Color
|
||||
import androidx.annotation.LayoutRes
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.ustwo.clockwise.common.WatchMode
|
||||
import info.nightscout.androidaps.R
|
||||
|
||||
class AapsWatchface : BaseWatchFace() {
|
||||
|
||||
override fun layoutResource(): Int = R.layout.activity_home
|
||||
@LayoutRes override fun layoutResource(): Int = R.layout.activity_home
|
||||
|
||||
override fun setColorDark() {
|
||||
mLinearLayout?.setBackgroundColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_background else R.color.dark_statusView))
|
||||
|
|
|
@ -337,11 +337,8 @@ abstract class BaseWatchFace : WatchFace() {
|
|||
missedReadingAlert()
|
||||
}
|
||||
|
||||
fun ageLevel(): Int {
|
||||
return if (timeSince() <= 1000 * 60 * 12) {
|
||||
1
|
||||
} else 0
|
||||
}
|
||||
fun ageLevel(): Int =
|
||||
if (timeSince() <= 1000 * 60 * 12) 1 else 0
|
||||
|
||||
fun timeSince(): Double {
|
||||
return (System.currentTimeMillis() - singleBg.timeStamp).toDouble()
|
||||
|
@ -414,13 +411,9 @@ abstract class BaseWatchFace : WatchFace() {
|
|||
|
||||
override fun onTimeChanged(oldTime: WatchFaceTime, newTime: WatchFaceTime) {
|
||||
if (layoutSet && (newTime.hasHourChanged(oldTime) || newTime.hasMinuteChanged(oldTime))) {
|
||||
val wl = wearUtil.getWakeLock("readingPrefs", 50)
|
||||
missedReadingAlert()
|
||||
checkVibrateHourly(oldTime, newTime)
|
||||
if (!isSimpleUi) {
|
||||
setDataFields()
|
||||
}
|
||||
wearUtil.releaseWakeLock(wl)
|
||||
if (!isSimpleUi) setDataFields()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -442,7 +435,8 @@ abstract class BaseWatchFace : WatchFace() {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n") fun setDataFields() {
|
||||
@SuppressLint("SetTextI18n")
|
||||
fun setDataFields() {
|
||||
setDateAndTime()
|
||||
mSgv?.text = singleBg.sgvString
|
||||
mSgv?.visibility = sp.getBoolean(R.string.key_show_bg, true).toVisibilityKeepSpace()
|
||||
|
@ -531,11 +525,8 @@ abstract class BaseWatchFace : WatchFace() {
|
|||
|
||||
override fun onWatchModeChanged(watchMode: WatchMode) {
|
||||
lowResMode = isLowRes(watchMode)
|
||||
if (isSimpleUi) {
|
||||
setSimpleUiAntiAlias()
|
||||
} else {
|
||||
setDataFields()
|
||||
}
|
||||
if (isSimpleUi) setSimpleUiAntiAlias()
|
||||
else setDataFields()
|
||||
invalidate()
|
||||
}
|
||||
|
||||
|
@ -605,5 +596,6 @@ abstract class BaseWatchFace : WatchFace() {
|
|||
var iFilter = IntentFilter(Intent.ACTION_BATTERY_CHANGED)
|
||||
val NORMAL_TYPEFACE: Typeface = Typeface.create(Typeface.SANS_SERIF, Typeface.NORMAL)
|
||||
val BOLD_TYPEFACE: Typeface = Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD)
|
||||
const val SCREEN_SIZE_SMALL = 280
|
||||
}
|
||||
}
|
|
@ -82,7 +82,7 @@ class BigChartWatchface : WatchFace() {
|
|||
private val displaySize = Point()
|
||||
private var specW = 0
|
||||
private var specH = 0
|
||||
private var statusView: TextView? = null
|
||||
private var mStatus: TextView? = null
|
||||
private var chartTapTime = 0L
|
||||
private var sgvTapTime = 0L
|
||||
|
||||
|
@ -172,7 +172,7 @@ class BigChartWatchface : WatchFace() {
|
|||
mAvgDelta = layoutView?.findViewById(R.id.avgdelta)
|
||||
mRelativeLayout = layoutView?.findViewById(R.id.main_layout)
|
||||
chart = layoutView?.findViewById(R.id.chart)
|
||||
statusView = layoutView?.findViewById(R.id.aps_status)
|
||||
mStatus = layoutView?.findViewById(R.id.externaltstatus)
|
||||
layoutSet = true
|
||||
showAgeAndStatus()
|
||||
mRelativeLayout?.measure(specW, specH)
|
||||
|
@ -271,8 +271,8 @@ class BigChartWatchface : WatchFace() {
|
|||
private fun showAgeAndStatus() {
|
||||
mTimestamp?.text = readingAge()
|
||||
mAvgDelta?.visibility = sp.getBoolean(R.string.key_show_external_status, true).toVisibility()
|
||||
statusView?.visibility = sp.getBoolean(R.string.key_show_external_status, true).toVisibility()
|
||||
statusView?.text = status.externalStatus + if (sp.getBoolean(R.string.key_show_cob, true)) (" " + this.status.cob) else ""
|
||||
mStatus?.visibility = sp.getBoolean(R.string.key_show_external_status, true).toVisibility()
|
||||
mStatus?.text = status.externalStatus + if (sp.getBoolean(R.string.key_show_cob, true)) (" " + this.status.cob) else ""
|
||||
}
|
||||
|
||||
private fun setColor() {
|
||||
|
@ -285,7 +285,7 @@ class BigChartWatchface : WatchFace() {
|
|||
|
||||
private fun setColorLowRes() {
|
||||
mTime?.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime))
|
||||
statusView?.setTextColor(ContextCompat.getColor(this, R.color.dark_statusView))
|
||||
mStatus?.setTextColor(ContextCompat.getColor(this, R.color.dark_statusView))
|
||||
mRelativeLayout?.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
|
||||
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
|
||||
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
|
||||
|
@ -305,7 +305,7 @@ class BigChartWatchface : WatchFace() {
|
|||
|
||||
private fun setColorDark() {
|
||||
mTime?.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime))
|
||||
statusView?.setTextColor(ContextCompat.getColor(this, R.color.dark_statusView))
|
||||
mStatus?.setTextColor(ContextCompat.getColor(this, R.color.dark_statusView))
|
||||
mRelativeLayout?.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
|
||||
when (singleBg.sgvLevel) {
|
||||
1L -> {
|
||||
|
@ -346,7 +346,7 @@ class BigChartWatchface : WatchFace() {
|
|||
private fun setColorBright() {
|
||||
if (currentWatchMode == WatchMode.INTERACTIVE) {
|
||||
mTime?.setTextColor(ContextCompat.getColor(this, R.color.light_bigchart_time))
|
||||
statusView?.setTextColor(ContextCompat.getColor(this, R.color.light_bigchart_status))
|
||||
mStatus?.setTextColor(ContextCompat.getColor(this, R.color.light_bigchart_status))
|
||||
mRelativeLayout?.setBackgroundColor(ContextCompat.getColor(this, R.color.light_background))
|
||||
when (singleBg.sgvLevel) {
|
||||
1L -> {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package info.nightscout.androidaps.watchfaces
|
||||
|
||||
import android.view.View
|
||||
import androidx.annotation.LayoutRes
|
||||
import info.nightscout.androidaps.R
|
||||
|
||||
/**
|
||||
|
@ -9,7 +10,7 @@ import info.nightscout.androidaps.R
|
|||
*/
|
||||
class CockpitWatchface : BaseWatchFace() {
|
||||
|
||||
override fun layoutResource(): Int = R.layout.activity_cockpit
|
||||
@LayoutRes override fun layoutResource(): Int = R.layout.activity_cockpit
|
||||
|
||||
override fun setColorDark() {
|
||||
mRelativeLayout?.setBackgroundResource(R.drawable.airplane_cockpit_outside_clouds)
|
||||
|
|
|
@ -7,6 +7,7 @@ import android.support.wearable.watchface.WatchFaceStyle
|
|||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.LayoutRes
|
||||
import androidx.core.content.ContextCompat
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.extensions.toVisibility
|
||||
|
@ -14,7 +15,7 @@ import info.nightscout.shared.logging.LTag
|
|||
|
||||
class DigitalStyleWatchface : BaseWatchFace() {
|
||||
|
||||
override fun layoutResource(): Int = R.layout.activity_digitalstyle
|
||||
@LayoutRes override fun layoutResource(): Int = R.layout.activity_digitalstyle
|
||||
|
||||
override fun getWatchFaceStyle(): WatchFaceStyle {
|
||||
return WatchFaceStyle.Builder(this)
|
||||
|
|
|
@ -1,240 +1,19 @@
|
|||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package info.nightscout.androidaps.watchfaces
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Paint
|
||||
import android.graphics.Point
|
||||
import android.graphics.Rect
|
||||
import android.os.PowerManager
|
||||
import android.support.wearable.watchface.WatchFaceStyle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.WindowInsets
|
||||
import android.view.WindowManager
|
||||
import android.widget.RelativeLayout
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.LayoutRes
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.ustwo.clockwise.common.WatchFaceTime
|
||||
import com.ustwo.clockwise.common.WatchMode
|
||||
import com.ustwo.clockwise.common.WatchShape
|
||||
import com.ustwo.clockwise.wearable.WatchFace
|
||||
import dagger.android.AndroidInjection
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.events.EventWearToMobile
|
||||
import info.nightscout.androidaps.extensions.toVisibility
|
||||
import info.nightscout.androidaps.interaction.menus.MainMenuActivity
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import info.nightscout.shared.weardata.EventData
|
||||
import info.nightscout.shared.weardata.EventData.ActionResendData
|
||||
import info.nightscout.shared.weardata.EventData.SingleBg
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||
import javax.inject.Inject
|
||||
import kotlin.math.floor
|
||||
|
||||
class NoChartWatchface : WatchFace() {
|
||||
class NoChartWatchface : BaseWatchFace() {
|
||||
|
||||
@Inject lateinit var rxBus: RxBus
|
||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var aapsLogger: AAPSLogger
|
||||
@Inject lateinit var sp: SP
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
@LayoutRes override fun layoutResource(): Int =
|
||||
if (resources.displayMetrics.widthPixels < SCREEN_SIZE_SMALL || resources.displayMetrics.heightPixels < SCREEN_SIZE_SMALL) R.layout.activity_nochart_small
|
||||
else R.layout.activity_nochart
|
||||
|
||||
private var disposable = CompositeDisposable()
|
||||
|
||||
private var singleBg = SingleBg(0, "---", "-", "--", "--", "--", 0, 0.0, 0.0, 0.0, 0)
|
||||
private var status = EventData.Status("no status", "IOB", "-.--", false, "--g", "-.--U/h", "--", "--", -1, "--", false, 1)
|
||||
|
||||
private var mTime: TextView? = null
|
||||
private var mSgv: TextView? = null
|
||||
private var mTimestamp: TextView? = null
|
||||
private var mDelta: TextView? = null
|
||||
private var mAvgDelta: TextView? = null
|
||||
private var mRelativeLayout: RelativeLayout? = null
|
||||
private var sgvLevel: Long = 0
|
||||
private var ageLevel = 1
|
||||
private var lowResMode = false
|
||||
private var layoutSet = false
|
||||
private var wakeLock: PowerManager.WakeLock? = null
|
||||
private var layoutView: View? = null
|
||||
private val displaySize = Point()
|
||||
private var specW = 0
|
||||
private var specH = 0
|
||||
private var statusView: TextView? = null
|
||||
private var sgvTapTime = 0L
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
override fun onCreate() {
|
||||
AndroidInjection.inject(this)
|
||||
super.onCreate()
|
||||
val display = (getSystemService(WINDOW_SERVICE) as WindowManager).defaultDisplay
|
||||
display.getSize(displaySize)
|
||||
wakeLock = (getSystemService(POWER_SERVICE) as PowerManager).newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "AndroidAPS:NOChart")
|
||||
specW = View.MeasureSpec.makeMeasureSpec(displaySize.x, View.MeasureSpec.EXACTLY)
|
||||
specH = View.MeasureSpec.makeMeasureSpec(displaySize.y, View.MeasureSpec.EXACTLY)
|
||||
val inflater = getSystemService(LAYOUT_INFLATER_SERVICE) as LayoutInflater
|
||||
val metrics = resources.displayMetrics
|
||||
layoutView = if (metrics.widthPixels < SCREEN_SIZE_SMALL || metrics.heightPixels < SCREEN_SIZE_SMALL) {
|
||||
inflater.inflate(R.layout.activity_nochart_small, null)
|
||||
} else {
|
||||
inflater.inflate(R.layout.activity_nochart, null)
|
||||
}
|
||||
disposable += rxBus
|
||||
.toObservable(SingleBg::class.java)
|
||||
.observeOn(aapsSchedulers.main)
|
||||
.subscribe { event: SingleBg ->
|
||||
aapsLogger.debug(LTag.WEAR, "SingleBg received")
|
||||
singleBg = event
|
||||
mSgv?.let { sgv ->
|
||||
sgv.text = singleBg.sgvString
|
||||
if (ageLevel() <= 0) sgv.paintFlags = sgv.paintFlags or Paint.STRIKE_THRU_TEXT_FLAG
|
||||
else sgv.paintFlags = sgv.paintFlags and Paint.STRIKE_THRU_TEXT_FLAG.inv()
|
||||
}
|
||||
mTime?.text = dateUtil.timeString()
|
||||
mDelta?.text = singleBg.delta
|
||||
mAvgDelta?.text = singleBg.avgDelta
|
||||
}
|
||||
disposable += rxBus
|
||||
.toObservable(EventData.Status::class.java)
|
||||
.observeOn(aapsSchedulers.main)
|
||||
.subscribe { event: EventData.Status ->
|
||||
// this event is received as last batch of data
|
||||
aapsLogger.debug(LTag.WEAR, "Status received")
|
||||
status = event
|
||||
showAgeAndStatus()
|
||||
mRelativeLayout?.measure(specW, specH)
|
||||
mRelativeLayout?.layout(0, 0, mRelativeLayout?.measuredWidth ?: 0, mRelativeLayout?.measuredHeight ?: 0)
|
||||
invalidate()
|
||||
setColor()
|
||||
}
|
||||
disposable += rxBus
|
||||
.toObservable(EventData.Preferences::class.java)
|
||||
.observeOn(aapsSchedulers.main)
|
||||
.subscribe {
|
||||
setColor()
|
||||
if (layoutSet) {
|
||||
showAgeAndStatus()
|
||||
mRelativeLayout?.measure(specW, specH)
|
||||
mRelativeLayout?.layout(0, 0, mRelativeLayout?.measuredWidth ?: 0, mRelativeLayout?.measuredHeight ?: 0)
|
||||
}
|
||||
invalidate()
|
||||
}
|
||||
performViewSetup()
|
||||
}
|
||||
|
||||
override fun onLayout(shape: WatchShape, screenBounds: Rect, screenInsets: WindowInsets) {
|
||||
super.onLayout(shape, screenBounds, screenInsets)
|
||||
layoutView?.onApplyWindowInsets(screenInsets)
|
||||
}
|
||||
|
||||
private fun performViewSetup() {
|
||||
mTime = layoutView?.findViewById(R.id.watch_time)
|
||||
mSgv = layoutView?.findViewById(R.id.sgv)
|
||||
mTimestamp = layoutView?.findViewById(R.id.timestamp)
|
||||
mDelta = layoutView?.findViewById(R.id.delta)
|
||||
mAvgDelta = layoutView?.findViewById(R.id.avgdelta)
|
||||
mRelativeLayout = layoutView?.findViewById(R.id.main_layout)
|
||||
statusView = layoutView?.findViewById(R.id.aps_status)
|
||||
layoutSet = true
|
||||
showAgeAndStatus()
|
||||
mRelativeLayout?.measure(specW, specH)
|
||||
mRelativeLayout?.layout(0, 0, mRelativeLayout?.measuredWidth ?: 0, mRelativeLayout?.measuredHeight ?: 0)
|
||||
rxBus.send(EventWearToMobile(ActionResendData("NOChart:performViewSetup")))
|
||||
}
|
||||
|
||||
override fun onTapCommand(tapType: Int, x: Int, y: Int, eventTime: Long) {
|
||||
mSgv?.let { mSgv ->
|
||||
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 (eventTime - sgvTapTime < 800) {
|
||||
startActivity(Intent(this, MainMenuActivity::class.java).also { it.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) })
|
||||
}
|
||||
sgvTapTime = eventTime
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onWatchModeChanged(watchMode: WatchMode) {
|
||||
if (lowResMode xor isLowRes(watchMode)) { //if there was a change in lowResMode
|
||||
lowResMode = isLowRes(watchMode)
|
||||
setColor()
|
||||
} else if (!sp.getBoolean("dark", true)) {
|
||||
//in bright mode: different colours if active:
|
||||
setColor()
|
||||
}
|
||||
}
|
||||
|
||||
private fun isLowRes(watchMode: WatchMode): Boolean {
|
||||
return watchMode == WatchMode.LOW_BIT || watchMode == WatchMode.LOW_BIT_BURN_IN
|
||||
}
|
||||
|
||||
override fun getWatchFaceStyle(): WatchFaceStyle {
|
||||
return WatchFaceStyle.Builder(this).setAcceptsTapEvents(true).build()
|
||||
}
|
||||
|
||||
private fun ageLevel(): Int = if (timeSince() <= 1000 * 60 * 12) 1 else 0
|
||||
|
||||
fun timeSince(): Double = (System.currentTimeMillis() - singleBg.timeStamp).toDouble()
|
||||
|
||||
private fun readingAge(): String =
|
||||
if (singleBg.timeStamp == 0L) "--'"
|
||||
else "${floor(timeSince() / (1000 * 60)).toInt()}'"
|
||||
|
||||
|
||||
override fun onDestroy() {
|
||||
disposable.clear()
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
override fun onDraw(canvas: Canvas) {
|
||||
if (layoutSet) {
|
||||
mRelativeLayout?.draw(canvas)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTimeChanged(oldTime: WatchFaceTime, newTime: WatchFaceTime) {
|
||||
if (layoutSet && (newTime.hasHourChanged(oldTime) || newTime.hasMinuteChanged(oldTime))) {
|
||||
mTime?.text = dateUtil.timeString()
|
||||
showAgeAndStatus()
|
||||
mSgv?.let { sgv ->
|
||||
if (ageLevel() <= 0) {
|
||||
sgv.paintFlags = sgv.paintFlags or Paint.STRIKE_THRU_TEXT_FLAG
|
||||
} else {
|
||||
sgv.paintFlags = sgv.paintFlags and Paint.STRIKE_THRU_TEXT_FLAG.inv()
|
||||
}
|
||||
}
|
||||
missedReadingAlert()
|
||||
mRelativeLayout?.measure(specW, specH)
|
||||
mRelativeLayout?.layout(0, 0, mRelativeLayout?.measuredWidth ?: 0, mRelativeLayout?.measuredHeight ?: 0)
|
||||
}
|
||||
}
|
||||
|
||||
private fun showAgeAndStatus() {
|
||||
mTimestamp?.text = readingAge()
|
||||
mAvgDelta?.visibility = sp.getBoolean(R.string.key_show_avg_delta, true).toVisibility()
|
||||
statusView?.text = status.externalStatus
|
||||
statusView?.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
private fun setColor() {
|
||||
when {
|
||||
lowResMode -> setColorLowRes()
|
||||
sp.getBoolean("dark", true) -> setColorDark()
|
||||
else -> setColorBright()
|
||||
}
|
||||
}
|
||||
|
||||
private fun setColorLowRes() {
|
||||
override fun setColorLowRes() {
|
||||
mTime?.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime))
|
||||
statusView?.setTextColor(ContextCompat.getColor(this, R.color.dark_statusView))
|
||||
mStatus?.setTextColor(ContextCompat.getColor(this, R.color.dark_statusView))
|
||||
mRelativeLayout?.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
|
||||
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
|
||||
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
|
||||
|
@ -242,11 +21,11 @@ class NoChartWatchface : WatchFace() {
|
|||
mTimestamp?.setTextColor(ContextCompat.getColor(this, R.color.dark_Timestamp))
|
||||
}
|
||||
|
||||
private fun setColorDark() {
|
||||
override fun setColorDark() {
|
||||
mTime?.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime))
|
||||
statusView?.setTextColor(ContextCompat.getColor(this, R.color.dark_statusView))
|
||||
mStatus?.setTextColor(ContextCompat.getColor(this, R.color.dark_statusView))
|
||||
mRelativeLayout?.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
|
||||
when (sgvLevel) {
|
||||
when (singleBg.sgvLevel) {
|
||||
1L -> {
|
||||
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.dark_highColor))
|
||||
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_highColor))
|
||||
|
@ -272,12 +51,12 @@ class NoChartWatchface : WatchFace() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun setColorBright() {
|
||||
override fun setColorBright() {
|
||||
if (currentWatchMode == WatchMode.INTERACTIVE) {
|
||||
mTime?.setTextColor(ContextCompat.getColor(this, R.color.light_bigchart_time))
|
||||
statusView?.setTextColor(ContextCompat.getColor(this, R.color.light_bigchart_status))
|
||||
mStatus?.setTextColor(ContextCompat.getColor(this, R.color.light_bigchart_status))
|
||||
mRelativeLayout?.setBackgroundColor(ContextCompat.getColor(this, R.color.light_background))
|
||||
when (sgvLevel) {
|
||||
when (singleBg.sgvLevel) {
|
||||
1L -> {
|
||||
mSgv?.setTextColor(ContextCompat.getColor(this, R.color.light_highColor))
|
||||
mDelta?.setTextColor(ContextCompat.getColor(this, R.color.light_highColor))
|
||||
|
@ -305,17 +84,4 @@ class NoChartWatchface : WatchFace() {
|
|||
setColorDark()
|
||||
}
|
||||
}
|
||||
|
||||
private fun missedReadingAlert() {
|
||||
val minutesSince = floor(timeSince() / (1000 * 60)).toInt()
|
||||
if (minutesSince >= 16 && (minutesSince - 16) % 5 == 0) {
|
||||
// attempt endTime recover missing data
|
||||
rxBus.send(EventWearToMobile(ActionResendData("NOChart::missedReadingAlert")))
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
const val SCREEN_SIZE_SMALL = 280
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ package info.nightscout.androidaps.watchfaces
|
|||
import android.view.animation.Animation
|
||||
import android.view.animation.LinearInterpolator
|
||||
import android.view.animation.RotateAnimation
|
||||
import androidx.annotation.LayoutRes
|
||||
import androidx.core.content.ContextCompat
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.shared.SafeParse.stringToFloat
|
||||
|
@ -17,7 +18,7 @@ class SteampunkWatchface : BaseWatchFace() {
|
|||
private var lastEndDegrees = 0f
|
||||
private var deltaRotationAngle = 0f
|
||||
|
||||
override fun layoutResource(): Int = R.layout.activity_steampunk
|
||||
@LayoutRes override fun layoutResource(): Int = R.layout.activity_steampunk
|
||||
|
||||
override fun onCreate() {
|
||||
forceSquareCanvas = true
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
android:gravity="center_horizontal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/aps_status"
|
||||
android:id="@+id/externaltstatus"
|
||||
android:textSize="18sp"
|
||||
android:text="E xU/h IOB: x (x+x)"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/aps_status"
|
||||
android:id="@+id/externaltstatus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/aps_status"
|
||||
android:id="@+id/externaltstatus"
|
||||
android:textSize="24sp"
|
||||
android:text="E xU/h IOB: x (x+x)"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -66,14 +66,6 @@
|
|||
android:layout_gravity="center_horizontal"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/chart"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_horizontal" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
android:gravity="center_horizontal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/aps_status"
|
||||
android:id="@+id/externaltstatus"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
android:gravity="center_horizontal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/aps_status"
|
||||
android:id="@+id/externaltstatus"
|
||||
android:textSize="18sp"
|
||||
android:text="E xU/h IOB: x (x+x)"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/aps_status"
|
||||
android:id="@+id/externaltstatus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/aps_status"
|
||||
android:id="@+id/externaltstatus"
|
||||
android:textSize="24sp"
|
||||
android:text="E xU/h IOB: x (x+x)"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -66,14 +66,6 @@
|
|||
android:layout_gravity="center_horizontal"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/chart"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_horizontal" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
android:gravity="center_horizontal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/aps_status"
|
||||
android:id="@+id/externaltstatus"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
|
|
Loading…
Reference in a new issue