Skip to content

Commit

Permalink
Merge pull request #2949 from Philoul/wear/new_custom_watchface
Browse files Browse the repository at this point in the history
Wear Remove AAPS WF and include a custom version into assets
  • Loading branch information
MilosKozak authored Oct 19, 2023
2 parents fcee367 + 5bf7566 commit 3ffc75b
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 325 deletions.
Binary file added plugins/configuration/src/main/assets/AAPS.zip
Binary file not shown.
26 changes: 0 additions & 26 deletions wear/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,31 +70,6 @@
</intent-filter>
</service>

<service
android:name=".watchfaces.AapsWatchface"
android:allowEmbedded="true"
android:exported="false"
android:label="@string/label_watchface"
android:permission="android.permission.BIND_WALLPAPER">
<meta-data
android:name="android.service.wallpaper"
android:resource="@xml/watch_face" />
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="@drawable/watchface_graph" />
<meta-data
android:name="com.google.android.wearable.watchface.wearableConfigurationAction"
android:value="watch_face_configuration_home" />

<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />

<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
</intent-filter>
</service>

<service
android:name=".watchfaces.AapsLargeWatchface"
android:allowEmbedded="true"
Expand Down Expand Up @@ -576,7 +551,6 @@
<action android:name="watch_face_configuration_circle" />
<action android:name="watch_face_configuration_custom" />
<action android:name="watch_face_configuration_digitalstyle" />
<action android:name="watch_face_configuration_home" />
<action android:name="watch_face_configuration_largehome" />
<action android:name="watch_face_configuration_nochart" />

Expand Down
2 changes: 0 additions & 2 deletions wear/src/main/kotlin/app/aaps/wear/di/WearServicesModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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.AapsWatchface
import app.aaps.wear.watchfaces.BigChartWatchface
import app.aaps.wear.watchfaces.CircleWatchface
import app.aaps.wear.watchfaces.CustomWatchface
Expand Down Expand Up @@ -51,7 +50,6 @@ abstract class WearServicesModule {
@ContributesAndroidInjector abstract fun contributesWallpaperComplication(): WallpaperComplication

@ContributesAndroidInjector abstract fun contributesBaseWatchFace(): BaseWatchFace
@ContributesAndroidInjector abstract fun contributesAapsWatchface(): AapsWatchface
@ContributesAndroidInjector abstract fun contributesAapsLargeWatchface(): AapsLargeWatchface
@ContributesAndroidInjector abstract fun contributesDigitalStyleWatchface(): DigitalStyleWatchface
@ContributesAndroidInjector abstract fun contributesBIGChart(): BigChartWatchface
Expand Down
107 changes: 0 additions & 107 deletions wear/src/main/kotlin/app/aaps/wear/watchfaces/AapsWatchface.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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.ActivityHomeBinding
import app.aaps.wear.databinding.ActivityHomeLargeBinding
import app.aaps.wear.databinding.ActivityNochartBinding

Expand All @@ -14,15 +13,14 @@ import app.aaps.wear.databinding.ActivityNochartBinding
*/
class WatchfaceViewAdapter(
aL: ActivityHomeLargeBinding? = null,
aa: ActivityHomeBinding? = null,
bC: ActivityBigchartBinding? = null,
ds: ActivityDigitalstyleBinding? = null,
nC: ActivityNochartBinding? = null,
cU: ActivityCustomBinding? = null
) {

init {
if (aL == null && aa == null && bC == null && ds == null && nC == null && cU == null) {
if (aL == null && bC == null && ds == null && nC == null && cU == null) {
throw IllegalArgumentException("Require at least on Binding parameter")
}
}
Expand All @@ -31,58 +29,57 @@ class WatchfaceViewAdapter(

// Required attributes
val mainLayout =
aL?.mainLayout ?: aa?.mainLayout ?: bC?.mainLayout ?: bC?.mainLayout ?: ds?.mainLayout ?: nC?.mainLayout ?: cU?.mainLayout
aL?.mainLayout ?: bC?.mainLayout ?: bC?.mainLayout ?: ds?.mainLayout ?: nC?.mainLayout ?: cU?.mainLayout
?: throw IllegalArgumentException(errorMessage)
val timestamp =
aL?.timestamp ?: aa?.timestamp ?: bC?.timestamp ?: bC?.timestamp ?: ds?.timestamp ?: nC?.timestamp ?: cU?.timestamp
aL?.timestamp ?: bC?.timestamp ?: bC?.timestamp ?: ds?.timestamp ?: nC?.timestamp ?: cU?.timestamp
?: throw IllegalArgumentException(errorMessage)
val root =
aL?.root ?: aa?.root ?: bC?.root ?: bC?.root ?: ds?.root ?: nC?.root ?: cU?.root
aL?.root ?: bC?.root ?: bC?.root ?: ds?.root ?: nC?.root ?: cU?.root
?: throw IllegalArgumentException(errorMessage)

// Optional attributes
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 sgv = aL?.sgv ?: bC?.sgv ?: bC?.sgv ?: ds?.sgv ?: nC?.sgv ?: cU?.sgv
val direction = aL?.direction ?: ds?.direction
val loop = cU?.loop
val delta = aL?.delta ?: aa?.delta ?: bC?.delta ?: bC?.delta ?: ds?.delta ?: nC?.delta ?: cU?.delta
val delta = aL?.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 uploaderBattery = aL?.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 time = aL?.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 = 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 chart = bC?.chart ?: bC?.chart ?: ds?.chart ?: cU?.chart
val status = aL?.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
val weekNumber = ds?.weekNumber ?: cU?.weekNumber
// val minuteHand = cU?.minuteHand
// val secondaryLayout = aL?.secondaryLayout ?: aa?.secondaryLayout ?: ds?.secondaryLayout
// val secondaryLayout = aL?.secondaryLayout ?: ds?.secondaryLayout
// val hourHand = cU?.hourHand

companion object {

fun getBinding(bindLayout: ViewBinding): WatchfaceViewAdapter {
return when (bindLayout) {
is ActivityHomeLargeBinding -> WatchfaceViewAdapter(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)
is ActivityBigchartBinding -> WatchfaceViewAdapter(null, bindLayout)
is ActivityDigitalstyleBinding -> WatchfaceViewAdapter(null, null, bindLayout)
is ActivityNochartBinding -> WatchfaceViewAdapter(null, null, null, bindLayout)
is ActivityCustomBinding -> WatchfaceViewAdapter(null, null, null, null, bindLayout)
else -> throw IllegalArgumentException("ViewBinding is not implement in WatchfaceViewAdapter")
}
}
Expand Down
Binary file removed wear/src/main/res/drawable/watchface_graph.png
Binary file not shown.
Binary file removed wear/src/main/res/drawable/watchface_graph_2.png
Binary file not shown.
135 changes: 0 additions & 135 deletions wear/src/main/res/layout/activity_home.xml

This file was deleted.

Loading

0 comments on commit 3ffc75b

Please sign in to comment.