Made RootView updateable

Changed the group/menu icon to be thicker.
This commit is contained in:
Philip Abbey
2023-12-21 15:32:24 +00:00
parent c4e9eb1fb0
commit 332a10867d
16 changed files with 98 additions and 16 deletions

View File

@ -1 +1,7 @@
<svg height="18" viewBox="0 -960 960 960" width="18" xmlns="http://www.w3.org/2000/svg"><path d="M479.858-160Q460-160 446-174.142q-14-14.141-14-34Q432-228 446.142-242q14.141-14 34-14Q500-256 514-241.858q14 14.141 14 34Q528-188 513.858-174q-14.141 14-34 14Zm0-272Q460-432 446-446.142q-14-14.141-14-34Q432-500 446.142-514q14.141-14 34-14Q500-528 514-513.858q14 14.141 14 34Q528-460 513.858-446q-14.141 14-34 14Zm0-272Q460-704 446-718.142q-14-14.141-14-34Q432-772 446.142-786q14.141-14 34-14Q500-800 514-785.858q14 14.141 14 34Q528-732 513.858-718q-14.141 14-34 14Z" fill="darkgrey" stroke="darkgrey"/></svg> <svg height="18" viewBox="0 0 200 500" width="18" xmlns="http://www.w3.org/2000/svg">
<g transform="matrix(1, 0, 0, 1, 0, 0)">
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="0"/>
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="200"/>
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="400"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 605 B

After

Width:  |  Height:  |  Size: 406 B

View File

@ -1 +1,7 @@
<svg height="21" viewBox="0 -960 960 960" width="21" xmlns="http://www.w3.org/2000/svg"><path d="M479.858-160Q460-160 446-174.142q-14-14.141-14-34Q432-228 446.142-242q14.141-14 34-14Q500-256 514-241.858q14 14.141 14 34Q528-188 513.858-174q-14.141 14-34 14Zm0-272Q460-432 446-446.142q-14-14.141-14-34Q432-500 446.142-514q14.141-14 34-14Q500-528 514-513.858q14 14.141 14 34Q528-460 513.858-446q-14.141 14-34 14Zm0-272Q460-704 446-718.142q-14-14.141-14-34Q432-772 446.142-786q14.141-14 34-14Q500-800 514-785.858q14 14.141 14 34Q528-732 513.858-718q-14.141 14-34 14Z" fill="darkgrey" stroke="darkgrey"/></svg> <svg height="21" viewBox="0 0 200 500" width="21" xmlns="http://www.w3.org/2000/svg">
<g transform="matrix(1, 0, 0, 1, 0, 0)">
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="0"/>
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="200"/>
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="400"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 605 B

After

Width:  |  Height:  |  Size: 406 B

View File

@ -1 +1,7 @@
<svg height="24" viewBox="0 -960 960 960" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M479.858-160Q460-160 446-174.142q-14-14.141-14-34Q432-228 446.142-242q14.141-14 34-14Q500-256 514-241.858q14 14.141 14 34Q528-188 513.858-174q-14.141 14-34 14Zm0-272Q460-432 446-446.142q-14-14.141-14-34Q432-500 446.142-514q14.141-14 34-14Q500-528 514-513.858q14 14.141 14 34Q528-460 513.858-446q-14.141 14-34 14Zm0-272Q460-704 446-718.142q-14-14.141-14-34Q432-772 446.142-786q14.141-14 34-14Q500-800 514-785.858q14 14.141 14 34Q528-732 513.858-718q-14.141 14-34 14Z" fill="darkgrey" stroke="darkgrey"/></svg> <svg height="24" viewBox="0 0 200 500" width="24" xmlns="http://www.w3.org/2000/svg">
<g transform="matrix(1, 0, 0, 1, 0, 0)">
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="0"/>
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="200"/>
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="400"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 605 B

After

Width:  |  Height:  |  Size: 406 B

View File

@ -1 +1,7 @@
<svg height="26" viewBox="0 -960 960 960" width="26" xmlns="http://www.w3.org/2000/svg"><path d="M479.858-160Q460-160 446-174.142q-14-14.141-14-34Q432-228 446.142-242q14.141-14 34-14Q500-256 514-241.858q14 14.141 14 34Q528-188 513.858-174q-14.141 14-34 14Zm0-272Q460-432 446-446.142q-14-14.141-14-34Q432-500 446.142-514q14.141-14 34-14Q500-528 514-513.858q14 14.141 14 34Q528-460 513.858-446q-14.141 14-34 14Zm0-272Q460-704 446-718.142q-14-14.141-14-34Q432-772 446.142-786q14.141-14 34-14Q500-800 514-785.858q14 14.141 14 34Q528-732 513.858-718q-14.141 14-34 14Z" fill="darkgrey" stroke="darkgrey"/></svg> <svg height="26" viewBox="0 0 200 500" width="26" xmlns="http://www.w3.org/2000/svg">
<g transform="matrix(1, 0, 0, 1, 0, 0)">
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="0"/>
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="200"/>
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="400"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 605 B

After

Width:  |  Height:  |  Size: 406 B

View File

@ -1 +1,7 @@
<svg height="28" viewBox="0 -960 960 960" width="28" xmlns="http://www.w3.org/2000/svg"><path d="M479.858-160Q460-160 446-174.142q-14-14.141-14-34Q432-228 446.142-242q14.141-14 34-14Q500-256 514-241.858q14 14.141 14 34Q528-188 513.858-174q-14.141 14-34 14Zm0-272Q460-432 446-446.142q-14-14.141-14-34Q432-500 446.142-514q14.141-14 34-14Q500-528 514-513.858q14 14.141 14 34Q528-460 513.858-446q-14.141 14-34 14Zm0-272Q460-704 446-718.142q-14-14.141-14-34Q432-772 446.142-786q14.141-14 34-14Q500-800 514-785.858q14 14.141 14 34Q528-732 513.858-718q-14.141 14-34 14Z" fill="darkgrey" stroke="darkgrey"/></svg> <svg height="28" viewBox="0 0 200 500" width="28" xmlns="http://www.w3.org/2000/svg">
<g transform="matrix(1, 0, 0, 1, 0, 0)">
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="0"/>
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="200"/>
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="400"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 605 B

After

Width:  |  Height:  |  Size: 406 B

View File

@ -1 +1,7 @@
<svg height="30" viewBox="0 -960 960 960" width="30" xmlns="http://www.w3.org/2000/svg"><path d="M479.858-160Q460-160 446-174.142q-14-14.141-14-34Q432-228 446.142-242q14.141-14 34-14Q500-256 514-241.858q14 14.141 14 34Q528-188 513.858-174q-14.141 14-34 14Zm0-272Q460-432 446-446.142q-14-14.141-14-34Q432-500 446.142-514q14.141-14 34-14Q500-528 514-513.858q14 14.141 14 34Q528-460 513.858-446q-14.141 14-34 14Zm0-272Q460-704 446-718.142q-14-14.141-14-34Q432-772 446.142-786q14.141-14 34-14Q500-800 514-785.858q14 14.141 14 34Q528-732 513.858-718q-14.141 14-34 14Z" fill="darkgrey" stroke="darkgrey"/></svg> <svg height="30" viewBox="0 0 200 500" width="30" xmlns="http://www.w3.org/2000/svg">
<g transform="matrix(1, 0, 0, 1, 0, 0)">
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="0"/>
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="200"/>
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="400"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 605 B

After

Width:  |  Height:  |  Size: 406 B

View File

@ -1 +1,7 @@
<svg height="32" viewBox="0 -960 960 960" width="32" xmlns="http://www.w3.org/2000/svg"><path d="M479.858-160Q460-160 446-174.142q-14-14.141-14-34Q432-228 446.142-242q14.141-14 34-14Q500-256 514-241.858q14 14.141 14 34Q528-188 513.858-174q-14.141 14-34 14Zm0-272Q460-432 446-446.142q-14-14.141-14-34Q432-500 446.142-514q14.141-14 34-14Q500-528 514-513.858q14 14.141 14 34Q528-460 513.858-446q-14.141 14-34 14Zm0-272Q460-704 446-718.142q-14-14.141-14-34Q432-772 446.142-786q14.141-14 34-14Q500-800 514-785.858q14 14.141 14 34Q528-732 513.858-718q-14.141 14-34 14Z" fill="darkgrey" stroke="darkgrey"/></svg> <svg height="32" viewBox="0 0 200 500" width="32" xmlns="http://www.w3.org/2000/svg">
<g transform="matrix(1, 0, 0, 1, 0, 0)">
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="0"/>
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="200"/>
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="400"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 605 B

After

Width:  |  Height:  |  Size: 406 B

View File

@ -1 +1,7 @@
<svg height="38" viewBox="0 -960 960 960" width="38" xmlns="http://www.w3.org/2000/svg"><path d="M479.858-160Q460-160 446-174.142q-14-14.141-14-34Q432-228 446.142-242q14.141-14 34-14Q500-256 514-241.858q14 14.141 14 34Q528-188 513.858-174q-14.141 14-34 14Zm0-272Q460-432 446-446.142q-14-14.141-14-34Q432-500 446.142-514q14.141-14 34-14Q500-528 514-513.858q14 14.141 14 34Q528-460 513.858-446q-14.141 14-34 14Zm0-272Q460-704 446-718.142q-14-14.141-14-34Q432-772 446.142-786q14.141-14 34-14Q500-800 514-785.858q14 14.141 14 34Q528-732 513.858-718q-14.141 14-34 14Z" fill="darkgrey" stroke="darkgrey"/></svg> <svg height="38" viewBox="0 0 200 500" width="38" xmlns="http://www.w3.org/2000/svg">
<g transform="matrix(1, 0, 0, 1, 0, 0)">
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="0"/>
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="200"/>
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="400"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 605 B

After

Width:  |  Height:  |  Size: 406 B

View File

@ -1 +1,7 @@
<svg height="42" viewBox="0 -960 960 960" width="42" xmlns="http://www.w3.org/2000/svg"><path d="M479.858-160Q460-160 446-174.142q-14-14.141-14-34Q432-228 446.142-242q14.141-14 34-14Q500-256 514-241.858q14 14.141 14 34Q528-188 513.858-174q-14.141 14-34 14Zm0-272Q460-432 446-446.142q-14-14.141-14-34Q432-500 446.142-514q14.141-14 34-14Q500-528 514-513.858q14 14.141 14 34Q528-460 513.858-446q-14.141 14-34 14Zm0-272Q460-704 446-718.142q-14-14.141-14-34Q432-772 446.142-786q14.141-14 34-14Q500-800 514-785.858q14 14.141 14 34Q528-732 513.858-718q-14.141 14-34 14Z" fill="darkgrey" stroke="darkgrey"/></svg> <svg height="42" viewBox="0 0 200 500" width="42" xmlns="http://www.w3.org/2000/svg">
<g transform="matrix(1, 0, 0, 1, 0, 0)">
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="0"/>
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="200"/>
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="400"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 605 B

After

Width:  |  Height:  |  Size: 406 B

View File

@ -1 +1,7 @@
<svg height="46" viewBox="0 -960 960 960" width="46" xmlns="http://www.w3.org/2000/svg"><path d="M479.858-160Q460-160 446-174.142q-14-14.141-14-34Q432-228 446.142-242q14.141-14 34-14Q500-256 514-241.858q14 14.141 14 34Q528-188 513.858-174q-14.141 14-34 14Zm0-272Q460-432 446-446.142q-14-14.141-14-34Q432-500 446.142-514q14.141-14 34-14Q500-528 514-513.858q14 14.141 14 34Q528-460 513.858-446q-14.141 14-34 14Zm0-272Q460-704 446-718.142q-14-14.141-14-34Q432-772 446.142-786q14.141-14 34-14Q500-800 514-785.858q14 14.141 14 34Q528-732 513.858-718q-14.141 14-34 14Z" fill="darkgrey" stroke="darkgrey"/></svg> <svg height="46" viewBox="0 0 200 500" width="46" xmlns="http://www.w3.org/2000/svg">
<g transform="matrix(1, 0, 0, 1, 0, 0)">
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="0"/>
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="200"/>
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="400"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 605 B

After

Width:  |  Height:  |  Size: 406 B

View File

@ -1 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M479.858-160Q460-160 446-174.142q-14-14.141-14-34Q432-228 446.142-242q14.141-14 34-14Q500-256 514-241.858q14 14.141 14 34Q528-188 513.858-174q-14.141 14-34 14Zm0-272Q460-432 446-446.142q-14-14.141-14-34Q432-500 446.142-514q14.141-14 34-14Q500-528 514-513.858q14 14.141 14 34Q528-460 513.858-446q-14.141 14-34 14Zm0-272Q460-704 446-718.142q-14-14.141-14-34Q432-772 446.142-786q14.141-14 34-14Q500-800 514-785.858q14 14.141 14 34Q528-732 513.858-718q-14.141 14-34 14Z" fill="darkgrey" stroke="darkgrey"/></svg> <?xml version="1.0" encoding="utf-8"?>
<svg viewBox="0 0 200 500" width="48" height="48" xmlns="http://www.w3.org/2000/svg">
<g transform="matrix(1, 0, 0, 1, 0, 0)">
<rect x="0" y="0" width="200" height="100" style="fill: rgb(0, 0, 0)" rx="40" ry="40"/>
<rect x="0" y="200" width="200" height="100" style="fill: rgb(0, 0, 0)" rx="40" ry="40"/>
<rect x="0" y="400" width="200" height="100" style="fill: rgb(0, 0, 0)" rx="40" ry="40"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 606 B

After

Width:  |  Height:  |  Size: 464 B

View File

@ -1 +1,7 @@
<svg height="53" viewBox="0 -960 960 960" width="53" xmlns="http://www.w3.org/2000/svg"><path d="M479.858-160Q460-160 446-174.142q-14-14.141-14-34Q432-228 446.142-242q14.141-14 34-14Q500-256 514-241.858q14 14.141 14 34Q528-188 513.858-174q-14.141 14-34 14Zm0-272Q460-432 446-446.142q-14-14.141-14-34Q432-500 446.142-514q14.141-14 34-14Q500-528 514-513.858q14 14.141 14 34Q528-460 513.858-446q-14.141 14-34 14Zm0-272Q460-704 446-718.142q-14-14.141-14-34Q432-772 446.142-786q14.141-14 34-14Q500-800 514-785.858q14 14.141 14 34Q528-732 513.858-718q-14.141 14-34 14Z" fill="darkgrey" stroke="darkgrey"/></svg> <svg height="53" viewBox="0 0 200 500" width="53" xmlns="http://www.w3.org/2000/svg">
<g transform="matrix(1, 0, 0, 1, 0, 0)">
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="0"/>
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="200"/>
<rect height="100" rx="40" ry="40" style="fill: rgb(0, 0, 0)" width="200" x="0" y="400"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 605 B

After

Width:  |  Height:  |  Size: 406 B

View File

@ -138,7 +138,7 @@ class ErrorDelegate extends WatchUi.BehaviorDelegate {
WatchUi.BehaviorDelegate.initialize(); WatchUi.BehaviorDelegate.initialize();
} }
function onBack() { function onBack() as Lang.Boolean {
getApp().getQuitTimer().reset(); getApp().getQuitTimer().reset();
ErrorView.unShow(); ErrorView.unShow();
return true; return true;

View File

@ -352,6 +352,10 @@ class HomeAssistantApp extends Application.AppBase {
); );
} }
function setApiStatus(s as Lang.String) {
mApiStatus = s;
}
(:glance) (:glance)
function getApiStatus() as Lang.String { function getApiStatus() as Lang.String {
return mApiStatus; return mApiStatus;

View File

@ -32,6 +32,8 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
private var strApiFlood = WatchUi.loadResource($.Rez.Strings.ApiFlood); private var strApiFlood = WatchUi.loadResource($.Rez.Strings.ApiFlood);
private var strApiUrlNotFound = WatchUi.loadResource($.Rez.Strings.ApiUrlNotFound); private var strApiUrlNotFound = WatchUi.loadResource($.Rez.Strings.ApiUrlNotFound);
private var strUnhandledHttpErr = WatchUi.loadResource($.Rez.Strings.UnhandledHttpErr); private var strUnhandledHttpErr = WatchUi.loadResource($.Rez.Strings.UnhandledHttpErr);
private var strUnavailable = WatchUi.loadResource($.Rez.Strings.Unavailable);
private var strAvailable = WatchUi.loadResource($.Rez.Strings.Available);
private var mApiKey as Lang.String; private var mApiKey as Lang.String;
@ -74,6 +76,7 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
// Provide the ability to terminate updating chain of calls for a permanent network error. // Provide the ability to terminate updating chain of calls for a permanent network error.
var keepUpdating = true; var keepUpdating = true;
var status = strUnavailable;
switch (responseCode) { switch (responseCode) {
case Communications.BLE_HOST_TIMEOUT: case Communications.BLE_HOST_TIMEOUT:
case Communications.BLE_CONNECTION_UNAVAILABLE: case Communications.BLE_CONNECTION_UNAVAILABLE:
@ -144,6 +147,7 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
break; break;
case 200: case 200:
status = strAvailable;
var state = data.get("state") as Lang.String; var state = data.get("state") as Lang.String;
if (Globals.scDebug) { if (Globals.scDebug) {
System.println((data.get("attributes") as Lang.Dictionary).get("friendly_name") + " State=" + state); System.println((data.get("attributes") as Lang.Dictionary).get("friendly_name") + " State=" + state);
@ -165,6 +169,7 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
// Now this feels very "closely coupled" to the application, but it is the most reliable method instead of using a timer. // Now this feels very "closely coupled" to the application, but it is the most reliable method instead of using a timer.
getApp().updateNextMenuItem(); getApp().updateNextMenuItem();
} }
getApp().setApiStatus(status);
} }
function getState() as Void { function getState() as Void {
@ -221,6 +226,7 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
System.println("HomeAssistantToggleMenuItem onReturnSetState() Response Data: " + data); System.println("HomeAssistantToggleMenuItem onReturnSetState() Response Data: " + data);
} }
var status = strUnavailable;
switch (responseCode) { switch (responseCode) {
case Communications.BLE_HOST_TIMEOUT: case Communications.BLE_HOST_TIMEOUT:
case Communications.BLE_CONNECTION_UNAVAILABLE: case Communications.BLE_CONNECTION_UNAVAILABLE:
@ -270,6 +276,7 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
setUiToggle(state); setUiToggle(state);
} }
} }
status = strAvailable;
break; break;
default: default:
@ -278,6 +285,7 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
} }
ErrorView.show(strUnhandledHttpErr + responseCode); ErrorView.show(strUnhandledHttpErr + responseCode);
} }
getApp().setApiStatus(status);
} }
function setState(s as Lang.Boolean) as Void { function setState(s as Lang.Boolean) as Void {

View File

@ -95,9 +95,6 @@ class RootView extends ScalableView {
:locX => w/2 + scMidSep/2, :locX => w/2 + scMidSep/2,
:locY => pixelsForScreen(70.0) :locY => pixelsForScreen(70.0)
}); });
} }
function onUpdate(dc as Graphics.Dc) as Void { function onUpdate(dc as Graphics.Dc) as Void {