From b048a279ee9820bd4acce81e066b6da4792bffcc Mon Sep 17 00:00:00 2001 From: Philoul Date: Wed, 18 Oct 2023 22:05:48 +0200 Subject: [PATCH] Wear Remove AAPS V2 Watchface --- wear/src/main/AndroidManifest.xml | 26 -- .../app/aaps/wear/di/WearServicesModule.kt | 2 - .../aaps/wear/watchfaces/AapsV2Watchface.kt | 172 ----------- .../watchfaces/utils/WatchfaceViewAdapter.kt | 62 ++-- wear/src/main/res/layout/activity_home_2.xml | 285 ------------------ wear/src/main/res/values/strings.xml | 1 - .../xml/watch_face_configuration_home2.xml | 42 --- 7 files changed, 29 insertions(+), 561 deletions(-) delete mode 100644 wear/src/main/kotlin/app/aaps/wear/watchfaces/AapsV2Watchface.kt delete mode 100644 wear/src/main/res/layout/activity_home_2.xml delete mode 100644 wear/src/main/res/xml/watch_face_configuration_home2.xml diff --git a/wear/src/main/AndroidManifest.xml b/wear/src/main/AndroidManifest.xml index 0a21c75013..78b8b21191 100644 --- a/wear/src/main/AndroidManifest.xml +++ b/wear/src/main/AndroidManifest.xml @@ -95,31 +95,6 @@ - - - - - - - - - - - - - - - diff --git a/wear/src/main/kotlin/app/aaps/wear/di/WearServicesModule.kt b/wear/src/main/kotlin/app/aaps/wear/di/WearServicesModule.kt index 9a7f137b0f..e1be969b11 100644 --- a/wear/src/main/kotlin/app/aaps/wear/di/WearServicesModule.kt +++ b/wear/src/main/kotlin/app/aaps/wear/di/WearServicesModule.kt @@ -20,7 +20,6 @@ import app.aaps.wear.tile.QuickWizardTileService import app.aaps.wear.tile.TempTargetTileService import app.aaps.wear.tile.TileBase import app.aaps.wear.watchfaces.AapsLargeWatchface -import app.aaps.wear.watchfaces.AapsV2Watchface import app.aaps.wear.watchfaces.AapsWatchface import app.aaps.wear.watchfaces.BigChartWatchface import app.aaps.wear.watchfaces.CircleWatchface @@ -53,7 +52,6 @@ abstract class WearServicesModule { @ContributesAndroidInjector abstract fun contributesBaseWatchFace(): BaseWatchFace @ContributesAndroidInjector abstract fun contributesAapsWatchface(): AapsWatchface - @ContributesAndroidInjector abstract fun contributesAapsV2Watchface(): AapsV2Watchface @ContributesAndroidInjector abstract fun contributesAapsLargeWatchface(): AapsLargeWatchface @ContributesAndroidInjector abstract fun contributesDigitalStyleWatchface(): DigitalStyleWatchface @ContributesAndroidInjector abstract fun contributesBIGChart(): BigChartWatchface diff --git a/wear/src/main/kotlin/app/aaps/wear/watchfaces/AapsV2Watchface.kt b/wear/src/main/kotlin/app/aaps/wear/watchfaces/AapsV2Watchface.kt deleted file mode 100644 index df7723998d..0000000000 --- a/wear/src/main/kotlin/app/aaps/wear/watchfaces/AapsV2Watchface.kt +++ /dev/null @@ -1,172 +0,0 @@ -package app.aaps.wear.watchfaces - -import android.graphics.Color -import android.view.LayoutInflater -import androidx.annotation.ColorInt -import androidx.core.content.ContextCompat -import androidx.viewbinding.ViewBinding -import app.aaps.wear.R -import app.aaps.wear.databinding.ActivityHome2Binding -import app.aaps.wear.watchfaces.utils.BaseWatchFace -import com.ustwo.clockwise.common.WatchMode - -class AapsV2Watchface : BaseWatchFace() { - - private lateinit var binding: ActivityHome2Binding - - override fun inflateLayout(inflater: LayoutInflater): ViewBinding { - binding = ActivityHome2Binding.inflate(inflater) - return binding - } - - override fun setColorDark() { - @ColorInt val dividerTxtColor = if (dividerMatchesBg) ContextCompat.getColor(this, R.color.dark_midColor) else Color.BLACK - @ColorInt val dividerBatteryOkColor = ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_midColor else R.color.dark_uploaderBattery) - @ColorInt val dividerBgColor = ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_background else R.color.dark_statusView) - binding.secondaryLayout.setBackgroundColor(dividerBgColor) - binding.tertiaryLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background)) - binding.mainLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background)) - binding.time.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor)) - binding.iob1.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor)) - binding.iob2.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor)) - binding.cob1.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor)) - binding.cob2.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor)) - binding.day.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor)) - binding.month.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor)) - binding.loop.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor)) - setTextSizes() - val color = when (singleBg.sgvLevel) { - 1L -> R.color.dark_highColor - 0L -> R.color.dark_midColor - -1L -> R.color.dark_lowColor - else -> R.color.dark_midColor - } - binding.sgv.setTextColor(ContextCompat.getColor(this, color)) - binding.direction.setTextColor(ContextCompat.getColor(this, color)) - - val colorTime = if (ageLevel == 1) R.color.dark_midColor else R.color.dark_TimestampOld - binding.timestamp.setTextColor(ContextCompat.getColor(this, colorTime)) - val colourBat = if (status.batteryLevel == 1) dividerBatteryOkColor else ContextCompat.getColor(this, R.color.dark_uploaderBatteryEmpty) - binding.uploaderBattery.setTextColor(colourBat) - - binding.rigBattery.setTextColor(dividerTxtColor) - binding.delta.setTextColor(dividerTxtColor) - binding.avgDelta.setTextColor(dividerTxtColor) - binding.basalRate.setTextColor(dividerTxtColor) - binding.bgi.setTextColor(dividerTxtColor) - when (loopLevel) { - -1 -> binding.loop.setBackgroundResource(R.drawable.loop_grey_25) - 1 -> binding.loop.setBackgroundResource(R.drawable.loop_green_25) - else -> binding.loop.setBackgroundResource(R.drawable.loop_red_25) - } - - highColor = ContextCompat.getColor(this, R.color.dark_highColor) - lowColor = ContextCompat.getColor(this, R.color.dark_lowColor) - midColor = ContextCompat.getColor(this, R.color.dark_midColor) - gridColor = ContextCompat.getColor(this, R.color.dark_gridColor) - basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_dark) - basalCenterColor = ContextCompat.getColor(this, R.color.basal_light) - pointSize = 2 - setupCharts() - } - - override fun setColorLowRes() { - @ColorInt val dividerTxtColor = if (dividerMatchesBg) ContextCompat.getColor(this, R.color.dark_midColor) else Color.BLACK - @ColorInt val dividerBgColor = ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_background else R.color.dark_statusView) - binding.secondaryLayout.setBackgroundColor(dividerBgColor) - binding.tertiaryLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background)) - binding.mainLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background)) - binding.loop.setBackgroundResource(R.drawable.loop_grey_25) - binding.loop.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor)) - binding.sgv.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor)) - binding.direction.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor)) - binding.timestamp.setTextColor(ContextCompat.getColor(this, R.color.dark_Timestamp)) - binding.delta.setTextColor(dividerTxtColor) - binding.avgDelta.setTextColor(dividerTxtColor) - binding.rigBattery.setTextColor(dividerTxtColor) - binding.uploaderBattery.setTextColor(dividerTxtColor) - binding.basalRate.setTextColor(dividerTxtColor) - binding.bgi.setTextColor(dividerTxtColor) - binding.iob1.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor)) - binding.iob2.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor)) - binding.cob1.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor)) - binding.cob2.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor)) - binding.day.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor)) - binding.month.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor)) - binding.time.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime)) - - highColor = ContextCompat.getColor(this, R.color.dark_midColor) - lowColor = ContextCompat.getColor(this, R.color.dark_midColor) - midColor = ContextCompat.getColor(this, R.color.dark_midColor) - gridColor = ContextCompat.getColor(this, R.color.dark_gridColor) - basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_dark_lowres) - basalCenterColor = ContextCompat.getColor(this, R.color.basal_light_lowres) - pointSize = 2 - setupCharts() - - setTextSizes() - } - - override fun setColorBright() { - if (currentWatchMode == WatchMode.INTERACTIVE) { - @ColorInt val dividerTxtColor = if (dividerMatchesBg) Color.BLACK else ContextCompat.getColor(this, R.color.dark_midColor) - @ColorInt val dividerBgColor = ContextCompat.getColor(this, if (dividerMatchesBg) R.color.light_background else R.color.light_stripe_background) - binding.secondaryLayout.setBackgroundColor(dividerBgColor) - binding.tertiaryLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.light_background)) - binding.mainLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.light_background)) - binding.time.setTextColor(Color.BLACK) - binding.iob1.setTextColor(Color.BLACK) - binding.iob2.setTextColor(Color.BLACK) - binding.cob1.setTextColor(Color.BLACK) - binding.cob2.setTextColor(Color.BLACK) - binding.day.setTextColor(Color.BLACK) - binding.month.setTextColor(Color.BLACK) - binding.loop.setTextColor(Color.BLACK) - setTextSizes() - val color = when (singleBg.sgvLevel) { - 1L -> R.color.light_highColor - 0L -> R.color.light_midColor - -1L -> R.color.light_lowColor - else -> R.color.light_midColor - } - binding.sgv.setTextColor(ContextCompat.getColor(this, color)) - binding.direction.setTextColor(ContextCompat.getColor(this, color)) - val colorTime = if (ageLevel == 1) Color.BLACK else Color.RED - binding.timestamp.setTextColor(colorTime) - val colourBat = if (status.batteryLevel == 1) dividerTxtColor else Color.RED - binding.uploaderBattery.setTextColor(colourBat) - binding.rigBattery.setTextColor(dividerTxtColor) - binding.delta.setTextColor(dividerTxtColor) - binding.avgDelta.setTextColor(dividerTxtColor) - binding.basalRate.setTextColor(dividerTxtColor) - binding.bgi.setTextColor(dividerTxtColor) - when (loopLevel) { - -1 -> binding.loop.setBackgroundResource(R.drawable.loop_grey_25) - 1 -> binding.loop.setBackgroundResource(R.drawable.loop_green_25) - else -> binding.loop.setBackgroundResource(R.drawable.loop_red_25) - } - - highColor = ContextCompat.getColor(this, R.color.light_highColor) - lowColor = ContextCompat.getColor(this, R.color.light_lowColor) - midColor = ContextCompat.getColor(this, R.color.light_midColor) - gridColor = ContextCompat.getColor(this, R.color.light_gridColor) - basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_light) - basalCenterColor = ContextCompat.getColor(this, R.color.basal_dark) - pointSize = 2 - setupCharts() - - } else { - setColorDark() - } - } - - private fun setTextSizes() { - if (detailedIob) { - binding.iob1.textSize = 14f - binding.iob2.textSize = 10f - } else { - binding.iob1.textSize = 10f - binding.iob2.textSize = 14f - } - } -} diff --git a/wear/src/main/kotlin/app/aaps/wear/watchfaces/utils/WatchfaceViewAdapter.kt b/wear/src/main/kotlin/app/aaps/wear/watchfaces/utils/WatchfaceViewAdapter.kt index 18c06f1ef1..8e89ddc8e2 100644 --- a/wear/src/main/kotlin/app/aaps/wear/watchfaces/utils/WatchfaceViewAdapter.kt +++ b/wear/src/main/kotlin/app/aaps/wear/watchfaces/utils/WatchfaceViewAdapter.kt @@ -4,7 +4,6 @@ import androidx.viewbinding.ViewBinding import app.aaps.wear.databinding.ActivityBigchartBinding import app.aaps.wear.databinding.ActivityCustomBinding import app.aaps.wear.databinding.ActivityDigitalstyleBinding -import app.aaps.wear.databinding.ActivityHome2Binding import app.aaps.wear.databinding.ActivityHomeBinding import app.aaps.wear.databinding.ActivityHomeLargeBinding import app.aaps.wear.databinding.ActivityNochartBinding @@ -15,7 +14,6 @@ import app.aaps.wear.databinding.ActivityNochartBinding */ class WatchfaceViewAdapter( aL: ActivityHomeLargeBinding? = null, - a2: ActivityHome2Binding? = null, aa: ActivityHomeBinding? = null, bC: ActivityBigchartBinding? = null, ds: ActivityDigitalstyleBinding? = null, @@ -24,7 +22,7 @@ class WatchfaceViewAdapter( ) { init { - if (aL == null && a2 == null && aa == null && bC == null && ds == null && nC == null && cU == null) { + if (aL == null && aa == null && bC == null && ds == null && nC == null && cU == null) { throw IllegalArgumentException("Require at least on Binding parameter") } } @@ -33,47 +31,46 @@ class WatchfaceViewAdapter( // Required attributes val mainLayout = - aL?.mainLayout ?: a2?.mainLayout ?: aa?.mainLayout ?: bC?.mainLayout ?: bC?.mainLayout ?: ds?.mainLayout ?: nC?.mainLayout ?: cU?.mainLayout + aL?.mainLayout ?: aa?.mainLayout ?: bC?.mainLayout ?: bC?.mainLayout ?: ds?.mainLayout ?: nC?.mainLayout ?: cU?.mainLayout ?: throw IllegalArgumentException(errorMessage) val timestamp = - aL?.timestamp ?: a2?.timestamp ?: aa?.timestamp ?: bC?.timestamp ?: bC?.timestamp ?: ds?.timestamp ?: nC?.timestamp ?: cU?.timestamp + aL?.timestamp ?: aa?.timestamp ?: bC?.timestamp ?: bC?.timestamp ?: ds?.timestamp ?: nC?.timestamp ?: cU?.timestamp ?: throw IllegalArgumentException(errorMessage) val root = - aL?.root ?: a2?.root ?: aa?.root ?: bC?.root ?: bC?.root ?: ds?.root ?: nC?.root ?: cU?.root + aL?.root ?: aa?.root ?: bC?.root ?: bC?.root ?: ds?.root ?: nC?.root ?: cU?.root ?: throw IllegalArgumentException(errorMessage) // Optional attributes - val sgv = aL?.sgv ?: a2?.sgv ?: aa?.sgv ?: bC?.sgv ?: bC?.sgv ?: ds?.sgv ?: nC?.sgv ?: cU?.sgv - val direction = aL?.direction ?: a2?.direction ?: aa?.direction ?: ds?.direction - val loop = a2?.loop ?: cU?.loop - val delta = aL?.delta ?: a2?.delta ?: aa?.delta ?: bC?.delta ?: bC?.delta ?: ds?.delta ?: nC?.delta ?: cU?.delta - val avgDelta = a2?.avgDelta ?: bC?.avgDelta ?: bC?.avgDelta ?: ds?.avgDelta ?: nC?.avgDelta ?: cU?.avgDelta - val uploaderBattery = aL?.uploaderBattery ?: a2?.uploaderBattery ?: aa?.uploaderBattery ?: ds?.uploaderBattery ?: cU?.uploaderBattery - val rigBattery = a2?.rigBattery ?: ds?.rigBattery ?: cU?.rigBattery - val basalRate = a2?.basalRate ?: ds?.basalRate ?: cU?.basalRate - val bgi = a2?.bgi ?: ds?.bgi ?: cU?.bgi - val AAPSv2 = a2?.AAPSv2 ?: ds?.AAPSv2 ?: cU?.AAPSv2 - val cob1 = a2?.cob1 ?: ds?.cob1 ?: cU?.cob1 - val cob2 = a2?.cob2 ?: ds?.cob2 ?: cU?.cob2 - val time = aL?.time ?: a2?.time ?: aa?.time ?: bC?.time ?: bC?.time ?: nC?.time ?: cU?.time + val sgv = aL?.sgv ?: aa?.sgv ?: bC?.sgv ?: bC?.sgv ?: ds?.sgv ?: nC?.sgv ?: cU?.sgv + val direction = aL?.direction ?: aa?.direction ?: ds?.direction + val loop = cU?.loop + val delta = aL?.delta ?: aa?.delta ?: bC?.delta ?: bC?.delta ?: ds?.delta ?: nC?.delta ?: cU?.delta + val avgDelta = bC?.avgDelta ?: bC?.avgDelta ?: ds?.avgDelta ?: nC?.avgDelta ?: cU?.avgDelta + val uploaderBattery = aL?.uploaderBattery ?: aa?.uploaderBattery ?: ds?.uploaderBattery ?: cU?.uploaderBattery + val rigBattery = ds?.rigBattery ?: cU?.rigBattery + val basalRate = ds?.basalRate ?: cU?.basalRate + val bgi = ds?.bgi ?: cU?.bgi + val AAPSv2 = ds?.AAPSv2 ?: cU?.AAPSv2 + val cob1 = ds?.cob1 ?: cU?.cob1 + val cob2 = ds?.cob2 ?: cU?.cob2 + val time = aL?.time ?: aa?.time ?: bC?.time ?: bC?.time ?: nC?.time ?: cU?.time val second = cU?.second val minute = ds?.minute ?: cU?.minute val hour = ds?.hour ?: cU?.hour - val day = a2?.day ?: ds?.day ?: cU?.day - val month = a2?.month ?: ds?.month ?: cU?.month - val iob1 = a2?.iob1 ?: ds?.iob1 ?: cU?.iob1 - val iob2 = a2?.iob2 ?: ds?.iob2 ?: cU?.iob2 - val chart = a2?.chart ?: aa?.chart ?: bC?.chart ?: bC?.chart ?: ds?.chart ?: cU?.chart + val day = ds?.day ?: cU?.day + val month = ds?.month ?: cU?.month + val iob1 = ds?.iob1 ?: cU?.iob1 + val iob2 = ds?.iob2 ?: cU?.iob2 + val chart = aa?.chart ?: bC?.chart ?: bC?.chart ?: ds?.chart ?: cU?.chart val status = aL?.status ?: aa?.status ?: bC?.status ?: bC?.status ?: nC?.status val timePeriod = ds?.timePeriod ?: aL?.timePeriod ?: nC?.timePeriod ?: bC?.timePeriod ?: cU?.timePeriod val dayName = ds?.dayName ?: cU?.dayName val mainMenuTap = ds?.mainMenuTap val chartZoomTap = ds?.chartZoomTap - val dateTime = ds?.dateTime ?: a2?.dateTime + val dateTime = ds?.dateTime val weekNumber = ds?.weekNumber ?: cU?.weekNumber // val minuteHand = cU?.minuteHand - // val secondaryLayout = aL?.secondaryLayout ?: a2?.secondaryLayout ?: aa?.secondaryLayout ?: ds?.secondaryLayout - // val tertiaryLayout = a2?.tertiaryLayout + // val secondaryLayout = aL?.secondaryLayout ?: aa?.secondaryLayout ?: ds?.secondaryLayout // val hourHand = cU?.hourHand companion object { @@ -81,12 +78,11 @@ class WatchfaceViewAdapter( 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 ActivityDigitalstyleBinding -> WatchfaceViewAdapter(null, null, null, null, bindLayout) - is ActivityNochartBinding -> WatchfaceViewAdapter(null, null, null, null, null, bindLayout) - is ActivityCustomBinding -> WatchfaceViewAdapter(null, null, null, null, null, null, bindLayout) + is ActivityHomeBinding -> WatchfaceViewAdapter(null, bindLayout) + is ActivityBigchartBinding -> WatchfaceViewAdapter(null, null, bindLayout) + is ActivityDigitalstyleBinding -> WatchfaceViewAdapter(null, null, null, bindLayout) + is ActivityNochartBinding -> WatchfaceViewAdapter(null, null, null, null, bindLayout) + is ActivityCustomBinding -> WatchfaceViewAdapter(null, null, null, null, null, bindLayout) else -> throw IllegalArgumentException("ViewBinding is not implement in WatchfaceViewAdapter") } } diff --git a/wear/src/main/res/layout/activity_home_2.xml b/wear/src/main/res/layout/activity_home_2.xml deleted file mode 100644 index 0244393e33..0000000000 --- a/wear/src/main/res/layout/activity_home_2.xml +++ /dev/null @@ -1,285 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/wear/src/main/res/values/strings.xml b/wear/src/main/res/values/strings.xml index 6599af1430..285977b53a 100644 --- a/wear/src/main/res/values/strings.xml +++ b/wear/src/main/res/values/strings.xml @@ -7,7 +7,6 @@ AAPS(BigChart) AAPS(NoChart) AAPS(Circle) - AAPS(v2) AAPS(DigitalStyle) AAPS(Custom) AAPS(Actions) diff --git a/wear/src/main/res/xml/watch_face_configuration_home2.xml b/wear/src/main/res/xml/watch_face_configuration_home2.xml deleted file mode 100644 index 3d86ad7cc6..0000000000 --- a/wear/src/main/res/xml/watch_face_configuration_home2.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - -