From 1f95e6af8718125987aa9e7de021a5215443678c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joris=20Pelgr=C3=B6m?= Date: Sun, 8 May 2022 19:13:28 +0200 Subject: [PATCH] Allow refreshing Wear template tile by tapping anywhere (#2508) - The touch target for the refresh button is really small and there aren't any other conflicting actions, so allow tapping anywhere to refresh the content --- .../companion/android/tiles/TemplateTile.kt | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/wear/src/main/java/io/homeassistant/companion/android/tiles/TemplateTile.kt b/wear/src/main/java/io/homeassistant/companion/android/tiles/TemplateTile.kt index a167e3bd00e..cd06d9574f5 100644 --- a/wear/src/main/java/io/homeassistant/companion/android/tiles/TemplateTile.kt +++ b/wear/src/main/java/io/homeassistant/companion/android/tiles/TemplateTile.kt @@ -128,18 +128,7 @@ class TemplateTile : TileService() { .setResourceId("refresh") .setWidth(dp(24f)) .setHeight(dp(24f)) - .setModifiers( - ModifiersBuilders.Modifiers.Builder() - .setClickable( - ModifiersBuilders.Clickable.Builder() - .setOnClick( - ActionBuilders.LoadAction.Builder().build() - ) - .setId("refresh") - .build() - ) - .build() - ) + .setModifiers(getRefreshModifiers()) .build() ) .setRotateContents(false) @@ -147,6 +136,20 @@ class TemplateTile : TileService() { ) .build() ) + setModifiers(getRefreshModifiers()) } .build() + + private fun getRefreshModifiers(): ModifiersBuilders.Modifiers { + return ModifiersBuilders.Modifiers.Builder() + .setClickable( + ModifiersBuilders.Clickable.Builder() + .setOnClick( + ActionBuilders.LoadAction.Builder().build() + ) + .setId("refresh") + .build() + ) + .build() + } }