From 1e27ff5d4ae1da82f2586ea6394494c2f65d4c04 Mon Sep 17 00:00:00 2001 From: Matt Pennig Date: Mon, 25 Apr 2016 11:58:18 -0500 Subject: [PATCH 1/2] Adding test cases for multi-line controls in multiattribute tiles --- .../tile-multiattribute-generic.groovy | 37 ++++++++++++++++++- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/devicetypes/smartthings/tile-ux/tile-multiattribute-generic.src/tile-multiattribute-generic.groovy b/devicetypes/smartthings/tile-ux/tile-multiattribute-generic.src/tile-multiattribute-generic.groovy index 4a63c6d..bb131cf 100644 --- a/devicetypes/smartthings/tile-ux/tile-multiattribute-generic.src/tile-multiattribute-generic.groovy +++ b/devicetypes/smartthings/tile-ux/tile-multiattribute-generic.src/tile-multiattribute-generic.groovy @@ -67,14 +67,47 @@ metadata { attributeState "VALUE_DOWN", action: "levelDown" } } + multiAttributeTile(name:"lengthyTile", type:"generic", width:6, height:4) { + tileAttribute("device.lengthyText", key: "PRIMARY_CONTROL") { + attributeState "default", label:'The value of this tile is long and should wrap to two lines', backgroundColor:"#79b821" + } + tileAttribute("device.lengthyText", key: "SECONDARY_CONTROL") { + attributeState "default", label:'The value of this tile is long and should wrap to two lines', backgroundColor:"#79b821" + } + } + multiAttributeTile(name:"multilineTile", type:"generic", width:6, height:4) { + tileAttribute("device.multilineText", key: "PRIMARY_CONTROL") { + attributeState "default", label:'Line 1 YES\nLine 2 YES\nLine 3 NO', backgroundColor:"#79b821" + } + tileAttribute("device.multilineText", key: "SECONDARY_CONTROL") { + attributeState "default", label:'Line 1 YES\nLine 2 YES\nLine 3 NO', backgroundColor:"#79b821" + } + } + multiAttributeTile(name:"lengthyTileWithIcon", type:"generic", width:6, height:4) { + tileAttribute("device.lengthyText", key: "PRIMARY_CONTROL") { + attributeState "default", label:'The value of this tile is long and should wrap to two lines', backgroundColor:"#79b821", icon: "st.switches.switch.on" + } + tileAttribute("device.lengthyText", key: "SECONDARY_CONTROL") { + attributeState "default", label:'The value of this tile is long and should wrap to two lines', backgroundColor:"#79b821", icon: "st.switches.switch.on" + } + } + multiAttributeTile(name:"multilineTileWithIcon", type:"generic", width:6, height:4) { + tileAttribute("device.multilineText", key: "PRIMARY_CONTROL") { + attributeState "default", label:'Line 1 YES\nLine 2 YES\nLine 3 NO', backgroundColor:"#79b821", icon: "st.switches.switch.on" + } + tileAttribute("device.multilineText", key: "SECONDARY_CONTROL") { + attributeState "default", label:'Line 1 YES\nLine 2 YES\nLine 3 NO', backgroundColor:"#79b821", icon: "st.switches.switch.on" + } + } main(["basicTile"]) - details(["basicTile", "sliderTile", "valueTile"]) + details(["basicTile", "sliderTile", "valueTile", "lengthyTile", "multilineTile", "lengthyTileWithIcon", "multilineTileWithIcon"]) } } def installed() { - + sendEvent(name: "lengthyText", value: "The value of this tile is long and should wrap to two lines") + sendEvent(name: "multilineText", value: "Line 1 YES\nLine 2 YES\nLine 3 NO") } def parse() { From 5ac08e5a9272c6f764727c1b61cc1ccf29e26c29 Mon Sep 17 00:00:00 2001 From: Matt Pennig Date: Tue, 26 Apr 2016 13:13:20 -0500 Subject: [PATCH 2/2] adding multi-line text for standard and value tiles --- .../tile-basic-standard.groovy | 14 +++++++++++++- .../tile-basic-value.src/tile-basic-value.groovy | 14 ++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/devicetypes/smartthings/tile-ux/tile-basic-standard.src/tile-basic-standard.groovy b/devicetypes/smartthings/tile-ux/tile-basic-standard.src/tile-basic-standard.groovy index 3999313..d2b7e35 100644 --- a/devicetypes/smartthings/tile-ux/tile-basic-standard.src/tile-basic-standard.groovy +++ b/devicetypes/smartthings/tile-ux/tile-basic-standard.src/tile-basic-standard.groovy @@ -80,19 +80,31 @@ metadata { state "default", label:'' } - main("standard1") + // multi-line text (explicit newlines) + standardTile("multiLine", "device.multiLine", width: 2, height: 2) { + state "default", label: '${currentValue}' + } + + standardTile("multiLineWithIcon", "device.multiLine", width: 2, height: 2) { + state "default", label: '${currentValue}', icon: "st.switches.switch.off" + } + + main("actionRings") details([ "actionRings", "actionFlat", "noActionFlat", "flatLabel", "flatIconLabel", "flatIcon", "flatDefaultState", "flatImplicitDefaultState1", "flatImplicitDefaultState2", + + "multiLine", "multiLineWithIcon" ]) } } def installed() { sendEvent(name: "switch", value: "off") + sendEvent(name: "multiLine", value: "Line 1\nLine 2\nLine 3") } def parse(String description) { diff --git a/devicetypes/smartthings/tile-ux/tile-basic-value.src/tile-basic-value.groovy b/devicetypes/smartthings/tile-ux/tile-basic-value.src/tile-basic-value.groovy index cc79f11..8ea7dee 100644 --- a/devicetypes/smartthings/tile-ux/tile-basic-value.src/tile-basic-value.groovy +++ b/devicetypes/smartthings/tile-ux/tile-basic-value.src/tile-basic-value.groovy @@ -69,16 +69,25 @@ metadata { ] } - valueTile("noValue", "device.nada", width: 2, height: 2) { + valueTile("noValue", "device.nada", width: 4, height: 2) { state "default", label:'${currentValue}' } + valueTile("multiLine", "device.multiLine", width: 3, height: 2) { + state "default", label: '${currentValue}' + } + + valueTile("multiLineWithIcon", "device.multiLine", width: 3, height: 2) { + state "default", label: '${currentValue}', icon: "st.switches.switch.off" + } + main("text") details([ "text", "longText", "integer", "integerFloat", "pi", "floatAsText", "bgColor", "bgColorRange", "bgColorRangeSingleItem", - "bgColorRangeConflict", "noValue" + "bgColorRangeConflict", "noValue", + "multiLine", "multiLineWithIcon" ]) } } @@ -90,6 +99,7 @@ def installed() { sendEvent(name: "integerFloat", value: 47.0) sendEvent(name: "pi", value: 3.14159) sendEvent(name: "floatAsText", value: "3.14159") + sendEvent(name: "multiLine", value: "Line 1\nLine 2\nLine 3") } def parse(String description) {