Removed widget specific code

This commit is contained in:
Philip Abbey
2024-02-11 19:35:34 +00:00
parent b65d45c955
commit a65dcd6811
12 changed files with 19 additions and 685 deletions

View File

@ -20,3 +20,4 @@
| 2.5 | A small memory efficiency of about 1kB by removing `RezStrings.mc`. This will aid widgets on old watches that only have 60kB available to an application and are using about 45kB before the menu is fetched, hence 1kB is more significant to those devices. |
| 2.6 | Added more information reporting to the background service, in addition to the device battery level and charging status, we now include location, location accuracy, and (if supported by your device) the activity information. Note the updates are sent periodically and are not event driven. |
| 2.7 | Bug fix release: 1. Handling a settings change, 2. Avoid caching a bad menu, 3. Managing bad JSON in menu definitions. |
| 2.8 | Separation release. The application and widget are no longer joined and now have separate source code repositories. The widget version is now in "maintenance only mode" and will not receive new features, whilst the application version can now take advantage of not being constrained by the widget's memory limitation, which should allow new features to be added in the future. |

View File

@ -22,9 +22,17 @@ As of version 2.0, there are now two installable versions. For older devices bef
| Version | Explanation |
|------------------------|-------------|
| Application (original) | For newer devices that allow glance views in their applications, e.g. Venu 2, the GarminHomeAssistant application can be started either from a glance or from the list of applications and activities. Head over to the [GarminHomeAssistant](https://apps.garmin.com/en-US/apps/61c91d28-ec5e-438d-9f83-39e9f45b199d) application page on the [Connect IQ application store](https://apps.garmin.com/en-US/) to download the application. The application can be started two different ways, either from the glance in the carousel, or as an application from the list of applications & activities. With the latter, it is worth marking the application as a favourite.<br/><img src="images/Venu2_app_start.png" width="200" title="Venu 2" style="margin:5px"/><img src="images/Vivoactive3_app_start.jpg" width="200" title="Venu 2" style="margin:5px"/><br/>If you place the application on your list of favourites, and rearrange it to appear near the top, then the item is just one button press away from the watch face. This second picture here shows the application menu on a Vivoactive 3 watch.<br/><img src="images/Venu2_glance_start.png" width="200" title="Venu 2" style="margin:5px"/><br/>On newer watches, you can also start the application from the glance carousel. The glance view here typically displays some trackable status, so ours provides some early indication of availability. Older watches will still allow you to start this application from the list of applications and activities. |
| Widget | For older devices that use widgets, e.g. Venu (1) as opposed to applications with "glances", the GarminHomeAssistant application can instead be started from the widget carousel. This is a separate item in the Connect IQ AppStore and with this installation, the application will no longer appear in the list of applications and activities. Head over to the [GarminHomeAssistant](https://apps.garmin.com/en-US/apps/) widget page on the [Connect IQ application store](https://apps.garmin.com/en-US/) to download the widget.<br/><img src="images/Venu_Widget_sim.png" width="200" title="Venu 2" style="margin:5px"/><br/>Typically the widget view implements something similar to the glance view, e.g. status, and exists in a widget carousel to allow you to select an application to launch.<br>**Please note that memory in widgets is more limited than applications. This means a large menu definition can crash the widget without the code catching the error.** |
| Widget | **"Maintenance only mode"** so no new features will be added to this version.<br>For older devices that use widgets, e.g. Venu (1) as opposed to applications with "glances", the GarminHomeAssistant application can instead be started from the widget carousel. This is a separate item in the Connect IQ AppStore and with this installation, the application will no longer appear in the list of applications and activities. Head over to the [GarminHomeAssistant](https://apps.garmin.com/en-US/apps/) widget page on the [Connect IQ application store](https://apps.garmin.com/en-US/) to download the widget.<br/><img src="images/Venu_Widget_sim.png" width="200" title="Venu 2" style="margin:5px"/><br/>Typically the widget view implements something similar to the glance view, e.g. status, and exists in a widget carousel to allow you to select an application to launch.<br>**Please note that memory in widgets is more limited than applications. This means a large menu definition can crash the widget without the code catching the error.**<br> This version was born out of the application version and from Ver 2.0 shared the same source code repository until Ver 2.8 when they were [separated](https://github.com/house-of-abbey/GarminHomeAssistantWidget) to allow the application version to take advantage of its increase memory availability. |
As the source code base for both is the same, the version numbers of each will be kept in step. That means that the widget version starts version numbering at 2.0.
### Source Code Repositories
* [Application](https://github.com/house-of-abbey/GarminHomeAssistant)
* [Widget](https://github.com/house-of-abbey/GarminHomeAssistantWidget)
### Connect IQ Store
* [Application](https://apps.garmin.com/en-US/apps/61c91d28-ec5e-438d-9f83-39e9f45b199d)
* [Widget](https://apps.garmin.com/en-US/apps/559f5174-177f-4f46-b170-f31c7e74dea3)
## Dashboard Definition

View File

@ -29,13 +29,8 @@ rem Assume we can create and use this directory
set DEST=export
rem Device for simulation
rem set DEVICE=venu2
set DEVICE=vivoactive3
rem Application
rem set JUNGLE=monkey.jungle
rem Or Widget
set JUNGLE=monkey-widget.jungle
set DEVICE=venu2
set JUNGLE=monkey.jungle
rem C:\>java -jar %SDK_PATH%\monkeybrains.jar -h
rem usage: monkeyc [-a <arg>] [-b <arg>] [--build-stats <arg>] [-c <arg>] [-d <arg>]
@ -104,7 +99,7 @@ rem Compile PRG for a single device for side loading
-Dapple.awt.UIElement=true ^
-jar %SDK_PATH%\monkeybrains.jar ^
--output %SRC%\bin\HomeAssistant.prg ^
--jungles %SRC%\monkey-widget.jungle ^
--jungles %SRC%\%JUNGLE% ^
--private-key %SRC%\..\developer_key ^
--device %DEVICE%_sim ^
--warn ^

View File

@ -98,23 +98,6 @@ echo.
--release
rem --warn
echo.
echo Starting export of HomeAssistant Widget
echo.
"%JAVA_PATH%\java.exe" ^
-Xms1g ^
-Dfile.encoding=UTF-8 ^
-Dapple.awt.UIElement=true ^
-jar %SDK_PATH%\monkeybrains.jar ^
--api-level 3.1.0 ^
--output %SRC%\export\HomeAssistant-widget.iq ^
--jungles %SRC%\monkey-widget.jungle ^
--private-key %SRC%\..\developer_key ^
--package-app ^
--release
rem --warn
echo.
echo Finished exporting HomeAssistant
dir %SRC%\export\HomeAssistant*.iq

View File

@ -1,28 +0,0 @@
//-----------------------------------------------------------------------------------
//
// Distributed under MIT Licence
// See https://github.com/house-of-abbey/GarminHomeAssistant/blob/main/LICENSE.
//
//-----------------------------------------------------------------------------------
//
// GarminHomeAssistant is a Garmin IQ application written in Monkey C and routinely
// tested on a Venu 2 device. The source code is provided at:
// https://github.com/house-of-abbey/GarminHomeAssistant.
//
// P A Abbey & J D Abbey & Someone0nEarth, 20 December 2023
//
//
// Description:
//
// A tedious diversion intended to make it possible to have the same source code for
// both a widget and an application. This file provides a single constant to
// determine which, and then the source file is conditionally included by the each
// .jungle file.
//
//-----------------------------------------------------------------------------------
using Toybox.Lang;
class WidgetApp {
static const isWidget = false;
}

View File

@ -1,28 +0,0 @@
//-----------------------------------------------------------------------------------
//
// Distributed under MIT Licence
// See https://github.com/house-of-abbey/GarminHomeAssistant/blob/main/LICENSE.
//
//-----------------------------------------------------------------------------------
//
// GarminHomeAssistant is a Garmin IQ application written in Monkey C and routinely
// tested on a Venu 2 device. The source code is provided at:
// https://github.com/house-of-abbey/GarminHomeAssistant.
//
// P A Abbey & J D Abbey & Someone0nEarth, 20 December 2023
//
//
// Description:
//
// A tedious diversion intended to make it possible to have the same source code for
// both a widget and an application. This file provides a single constant to
// determine which, and then the source file is conditionally included by the each
// .jungle file.
//
//-----------------------------------------------------------------------------------
using Toybox.Lang;
class WidgetApp {
static const isWidget = true;
}

View File

@ -1,196 +0,0 @@
<?xml version="1.0"?>
<!--
Distributed under MIT Licence
See https://github.com/house-of-abbey/GarminHomeAssistant/blob/main/LICENSE.
GarminHomeAssistant is a Garmin IQ application written in Monkey C and routinely
tested on a Venu 2 device. The source code is provided at:
https://github.com/house-of-abbey/GarminHomeAssistant.
P A Abbey & J D Abbey & Someone0nEarth, 31 October 2023
Device Information & References:
* https://developer.garmin.com/connect-iq/compatible-devices/
* https://developer.garmin.com/connect-iq/reference-guides/devices-reference/
Someone0nEarth's Test Widget id="bf69be91-5833-4d96-92ea-c5f1a9db5dcc" type="widget"
philipabbey's Test Widget id="4901cdfb-b4a2-4f33-96c7-f5be5992809e" type="widget"
Live Widget id="585af26f-6ff7-44e8-80dc-b3670e5b8648" type="widget"
-->
<iq:manifest version="3" xmlns:iq="http://www.garmin.com/xml/connectiq">
<!--
Use "Monkey C: Edit Application" from the Visual Studio Code command palette
to update the application attributes.
-->
<iq:application id="4901cdfb-b4a2-4f33-96c7-f5be5992809e" type="widget" name="@Strings.AppName" entry="HomeAssistantApp" launcherIcon="@Drawables.LauncherIcon" minApiLevel="3.1.0">
<!--
Use the following from the Visual Studio Code comand palette to edit
the build targets:
"Monkey C: Set Products by Product Category" - Lets you add all products
that belong to the same product category
"Monkey C: Edit Products" - Lets you add or remove any product
-->
<iq:products>
<iq:product id="approachs7042mm" />
<iq:product id="approachs7047mm" />
<iq:product id="d2air" />
<iq:product id="d2airx10" />
<iq:product id="d2delta" />
<iq:product id="d2deltapx" />
<iq:product id="d2deltas" />
<iq:product id="d2mach1" />
<iq:product id="descentg1" />
<iq:product id="descentmk2" />
<iq:product id="descentmk2s" />
<iq:product id="edge1030" />
<iq:product id="edge1030bontrager" />
<iq:product id="edge1030plus" />
<iq:product id="edge1040" />
<iq:product id="edge520plus" />
<iq:product id="edge530" />
<iq:product id="edge820" />
<iq:product id="edge830" />
<iq:product id="edgeexplore" />
<iq:product id="edgeexplore2" />
<iq:product id="enduro" />
<iq:product id="epix2" />
<iq:product id="epix2pro42mm" />
<iq:product id="epix2pro47mm" />
<iq:product id="epix2pro51mm" />
<iq:product id="fenix5" />
<iq:product id="fenix5plus" />
<iq:product id="fenix5s" />
<iq:product id="fenix5splus" />
<iq:product id="fenix5x" />
<iq:product id="fenix5xplus" />
<iq:product id="fenix6" />
<iq:product id="fenix6pro" />
<iq:product id="fenix6s" />
<iq:product id="fenix6spro" />
<iq:product id="fenix6xpro" />
<iq:product id="fenix7" />
<iq:product id="fenix7pro" />
<iq:product id="fenix7pronowifi" />
<iq:product id="fenix7s" />
<iq:product id="fenix7spro" />
<iq:product id="fenix7x" />
<iq:product id="fenix7xpro" />
<iq:product id="fenix7xpronowifi" />
<iq:product id="fenixchronos" />
<iq:product id="fr245" />
<iq:product id="fr245m" />
<iq:product id="fr255" />
<iq:product id="fr255m" />
<iq:product id="fr255s" />
<iq:product id="fr255sm" />
<iq:product id="fr265" />
<iq:product id="fr265s" />
<iq:product id="fr55" />
<iq:product id="fr645" />
<iq:product id="fr645m" />
<iq:product id="fr745" />
<iq:product id="fr935" />
<iq:product id="fr945" />
<iq:product id="fr945lte" />
<iq:product id="fr955" />
<iq:product id="fr965" />
<iq:product id="gpsmap67" />
<iq:product id="instinct2" />
<iq:product id="instinct2s" />
<iq:product id="instinct2x" />
<iq:product id="instinctcrossover" />
<iq:product id="legacyherocaptainmarvel" />
<iq:product id="legacyherofirstavenger" />
<iq:product id="legacysagadarthvader" />
<iq:product id="legacysagarey" />
<iq:product id="marq2" />
<iq:product id="marq2aviator" />
<iq:product id="marqadventurer" />
<iq:product id="marqathlete" />
<iq:product id="marqaviator" />
<iq:product id="marqcaptain" />
<iq:product id="marqcommander" />
<iq:product id="marqdriver" />
<iq:product id="marqexpedition" />
<iq:product id="marqgolfer" />
<iq:product id="montana7xx" />
<iq:product id="venu" />
<iq:product id="venu2" />
<iq:product id="venu2plus" />
<iq:product id="venu2s" />
<iq:product id="venu3" />
<iq:product id="venu3s" />
<iq:product id="venud" />
<iq:product id="venusq" />
<iq:product id="venusq2" />
<iq:product id="venusq2m" />
<iq:product id="venusqm" />
<iq:product id="vivoactive3" />
<iq:product id="vivoactive3m" />
<iq:product id="vivoactive3mlte" />
<iq:product id="vivoactive4" />
<iq:product id="vivoactive4s" />
<iq:product id="vivoactive5" />
</iq:products>
<!--
Use "Monkey C: Edit Permissions" from the Visual Studio Code command
palette to update permissions.
-->
<iq:permissions>
<iq:uses-permission id="Background" />
<iq:uses-permission id="BluetoothLowEnergy" />
<iq:uses-permission id="Communications" />
<iq:uses-permission id="Positioning" />
</iq:permissions>
<!--
Use "Monkey C: Edit Languages" from the Visual Studio Code command
palette to edit your compatible language list.
-->
<iq:languages>
<iq:language>ara</iq:language>
<iq:language>bul</iq:language>
<iq:language>zhs</iq:language>
<iq:language>zht</iq:language>
<iq:language>hrv</iq:language>
<iq:language>ces</iq:language>
<iq:language>dan</iq:language>
<iq:language>dut</iq:language>
<iq:language>deu</iq:language>
<iq:language>gre</iq:language>
<iq:language>eng</iq:language>
<iq:language>est</iq:language>
<iq:language>fin</iq:language>
<iq:language>fre</iq:language>
<iq:language>heb</iq:language>
<iq:language>hun</iq:language>
<iq:language>ind</iq:language>
<iq:language>ita</iq:language>
<iq:language>jpn</iq:language>
<iq:language>kor</iq:language>
<iq:language>lav</iq:language>
<iq:language>lit</iq:language>
<iq:language>zsm</iq:language>
<iq:language>nob</iq:language>
<iq:language>pol</iq:language>
<iq:language>por</iq:language>
<iq:language>slo</iq:language>
<iq:language>ron</iq:language>
<!-- <iq:language>rus</iq:language> -->
<iq:language>slv</iq:language>
<iq:language>spa</iq:language>
<iq:language>swe</iq:language>
<iq:language>tha</iq:language>
<iq:language>tur</iq:language>
<iq:language>ukr</iq:language>
<iq:language>vie</iq:language>
</iq:languages>
<!--
Use "Monkey C: Configure Monkey Barrel" from the Visual Studio Code
command palette to edit the included barrels.
-->
<iq:barrels />
</iq:application>
</iq:manifest>

View File

@ -28,7 +28,7 @@
Testing in VSCode requires monkey.jungle, so for convenience, swap between
watch-app and widget by changing which of the next two lines are commented out
-->
<iq:application id="98c36259-498a-4458-9cef-74a273ad2bc3" type="watch-app" name="@Strings.AppName" entry="HomeAssistantApp" launcherIcon="@Drawables.LauncherIcon" minApiLevel="3.1.0">
<iq:application id="40131e87-31ff-454b-a8e2-92276ee399d6" type="watch-app" name="@Strings.AppName" entry="HomeAssistantApp" launcherIcon="@Drawables.LauncherIcon" minApiLevel="3.1.0">
<!--
<iq:application id="4901cdfb-b4a2-4f33-96c7-f5be5992809e" type="widget" name="@Strings.AppName" entry="HomeAssistantApp" launcherIcon="@Drawables.LauncherIcon" minApiLevel="3.1.0">
-->

View File

@ -1,205 +0,0 @@
#-----------------------------------------------------------------------------------
#
# Distributed under MIT Licence
# See https://github.com/house-of-abbey/GarminHomeAssistant/blob/main/LICENSE.
#
#-----------------------------------------------------------------------------------
#
# GarminHomeAssistant is a Garmin IQ application written in Monkey C and routinely
# tested on a Venu 2 device. The source code is provided at:
# https://github.com/house-of-abbey/GarminHomeAssistant.
#
# J D Abbey & P A Abbey, 28 December 2022
#
# Reference:
# * https://developer.garmin.com/connect-iq/reference-guides/jungle-reference/
#
#-----------------------------------------------------------------------------------
project.manifest = manifest-widget.xml
base.sourcePath = source;include/widget
# Device References
# * https://developer.garmin.com/connect-iq/compatible-devices/
# * https://developer.garmin.com/connect-iq/reference-guides/devices-reference/
#
# Widget launcher icon, multiple resolutions
# https://forums.garmin.com/developer/connect-iq/f/discussion/255433/widget-launcher-icon-multiple-resolutions/1563305
#
# Use the online SVG converter to write out PNGs from "resources\drawables\launcher.svg" by changing
# the 'width' and 'height' attributes of the SVG.
# https://svgtopng.com/
#
# The icons need to scale as a ratio of screen size 48:416 pixels
#
# Icon 53 48 46 42 37 32 30 28 26 24 21 18
# Screen 454 416 390 360 320 280 260 240 218 208 176 156
# Screen Size 390x390 launcher icon size 70x70
approachs7042mm.resourcePath = $(approachs7042mm.resourcePath);resources-launcher-70-70;resources-icons-46
# Screen Size 454x454 launcher icon size 80x80
approachs7047mm.resourcePath = $(approachs7047mm.resourcePath);resources-launcher-80-80;resources-icons-53
# Screen Size 390x390 launcher icon size 60x60
d2air.resourcePath = $(d2air.resourcePath);resources-launcher-60-60;resources-icons-46
# Screen Size 416x416 launcher icon size 70x70
d2airx10.resourcePath = $(d2airx10.resourcePath);resources-launcher-70-70;resources-icons-48
# Screen Size 240x240 launcher icon size 40x40
d2delta.resourcePath = $(d2delta.resourcePath);resources-launcher-40-40;resources-icons-28
d2deltapx.resourcePath = $(d2deltapx.resourcePath);resources-launcher-40-40;resources-icons-28
d2deltas.resourcePath = $(d2deltas.resourcePath);resources-launcher-40-40;resources-icons-28
# Screen Size 416x416 launcher icon size 60x60
d2mach1.resourcePath = $(d2mach1.resourcePath);resources-launcher-60-60;resources-icons-48
# Screen Size 176x176 launcher icon size 62x62
descentg1.resourcePath = $(descentg1.resourcePath);resources-launcher-62-62;resources-icons-21
# Screen Size 280x280 launcher icon size 40x40
descentmk2.resourcePath = $(descentmk2.resourcePath);resources-launcher-40-40;resources-icons-32
# Screen Size 240x240 launcher icon size 40x40
descentmk2s.resourcePath = $(descentmk2s.resourcePath);resources-launcher-40-40;resources-icons-28
# Screen Size 282x470 launcher icon size 36x36
edge1030.resourcePath = $(descentmk2s.resourcePath);resources-launcher-36-36;resources-icons-32
edge1030bontrager.resourcePath = $(edge1030bontrager.resourcePath);resources-launcher-36-36;resources-icons-32
edge1030plus.resourcePath = $(edge1030plus.resourcePath);resources-launcher-36-36;resources-icons-32
# Screen Size 282x470 launcher icon size 40x40
edge1040.resourcePath = $(edge1040.resourcePath);resources-launcher-40-40;resources-icons-32
# Screen Size 200x265 launcher icon size 35x35
edge520plus.resourcePath = $(edge520plus.resourcePath);resources-launcher-35-35;resources-icons-24
# Screen Size 246x322 launcher icon size 35x35
edge530.resourcePath = $(edge530.resourcePath);resources-launcher-35-35;resources-icons-28
# Screen Size 200x265 launcher icon size 35x35
edge820.resourcePath = $(edge820.resourcePath);resources-launcher-35-35;resources-icons-24
# Screen Size 246x322 launcher icon size 35x35
edge830.resourcePath = $(edge830.resourcePath);resources-launcher-35-35;resources-icons-28
# Screen Size 240x400 launcher icon size 36x36
edgeexplore.resourcePath = $(edgeexplore.resourcePath);resources-launcher-36-36;resources-icons-28
edgeexplore2.resourcePath = $(edgeexplore2.resourcePath);resources-launcher-36-36;resources-icons-28
# Screen Size 280x280 launcher icon size 40x40
enduro.resourcePath = $(enduro.resourcePath);resources-launcher-40-40;resources-icons-32
# Screen Size 416x416 launcher icon size 60x60
epix2.resourcePath = $(epix2.resourcePath);resources-launcher-60-60;resources-icons-48
# Screen Size 390x390 launcher icon size 60x60
epix2pro42mm.resourcePath = $(epix2pro42mm.resourcePath);resources-launcher-60-60;resources-icons-46
epix2pro47mm.resourcePath = $(epix2pro47mm.resourcePath);resources-launcher-60-60;resources-icons-46
# Screen Size 454x454 launcher icon size 60x60
epix2pro51mm.resourcePath = $(epix2pro51mm.resourcePath);resources-launcher-60-60;resources-icons-53
# Screen Size 240x240 launcher icon size 40x40
fenix5.resourcePath = $(fenix5.resourcePath);resources-launcher-40-40;resources-icons-28
fenix5plus.resourcePath = $(fenix5plus.resourcePath);resources-launcher-40-40;resources-icons-28
# Screen Size 218x218 launcher icon size 36x36
fenix5s.resourcePath = $(fenix5s.resourcePath);resources-launcher-36-36;resources-icons-26
# Screen Size 240x240 launcher icon size 40x40
fenix5splus.resourcePath = $(fenix5splus.resourcePath);resources-launcher-40-40;resources-icons-28
fenix5x.resourcePath = $(fenix5x.resourcePath);resources-launcher-40-40;resources-icons-28
fenix5xplus.resourcePath = $(fenix5xplus.resourcePath);resources-launcher-40-40;resources-icons-28
# Screen Size 260x260 launcher icon size 40x40
fenix6.resourcePath = $(fenix6.resourcePath);resources-launcher-40-40;resources-icons-30
fenix6pro.resourcePath = $(fenix6pro.resourcePath);resources-launcher-40-40;resources-icons-30
# Screen Size 240x240 launcher icon size 40x40
fenix6s.resourcePath = $(fenix6s.resourcePath);resources-launcher-40-40;resources-icons-28
fenix6spro.resourcePath = $(fenix6spro.resourcePath);resources-launcher-40-40;resources-icons-28
# Screen Size 280x280 launcher icon size 40x40
fenix6xpro.resourcePath = $(fenix6xpro.resourcePath);resources-launcher-40-40;resources-icons-32
# Screen Size 260x260 launcher icon size 40x40
fenix7.resourcePath = $(fenix7.resourcePath);resources-launcher-40-40;resources-icons-30
# Screen Size 260x260 launcher icon size 40x40
fenix7pro.resourcePath = $(fenix7pro.resourcePath);resources-launcher-40-40;resources-icons-30
fenix7pronowifi.resourcePath = $(fenix7pronowifi.resourcePath);resources-launcher-40-40;resources-icons-30
# Screen Size 218x218 launcher icon size 36x36
fenixchronos.resourcePath = $(fenixchronos.resourcePath);resources-launcher-36-36;resources-icons-26
# Screen Size 240x240 launcher icon size 40x40
fenix7s.resourcePath = $(fenix7s.resourcePath);resources-launcher-40-40;resources-icons-28
# Screen Size 240x240 launcher icon size 40x40
fenix7spro.resourcePath = $(fenix7spro.resourcePath);resources-launcher-40-40;resources-icons-28
# Screen Size 280x280 launcher icon size 40x40
fenix7x.resourcePath = $(fenix7x.resourcePath);resources-launcher-40-40;resources-icons-32
# Screen Size 280x280 launcher icon size 40x40
fenix7xpro.resourcePath = $(fenix7xpro.resourcePath);resources-launcher-40-40;resources-icons-32
fenix7xpronowifi.resourcePath = $(fenix7xpronowifi.resourcePath);resources-launcher-40-40;resources-icons-32
# Screen Size 240x240 launcher icon size 40x40
fr245.resourcePath = $(fr245.resourcePath);resources-launcher-40-40;resources-icons-28
fr245m.resourcePath = $(fr245m.resourcePath);resources-launcher-40-40;resources-icons-28
# Screen Size 260x260 launcher icon size 40x40
fr255.resourcePath = $(fr255.resourcePath);resources-launcher-40-40;resources-icons-30
fr255m.resourcePath = $(fr255m.resourcePath);resources-launcher-40-40;resources-icons-30
# Screen Size 218x218 launcher icon size 40x40
fr255s.resourcePath = $(fr255s.resourcePath);resources-launcher-40-40;resources-icons-26
fr255sm.resourcePath = $(fr255sm.resourcePath);resources-launcher-40-40;resources-icons-26
# Screen Size 416x416 launcher icon size 60x60
fr265.resourcePath = $(fr265.resourcePath);resources-launcher-60-60;resources-icons-48
fr265s.resourcePath = $(fr265s.resourcePath);resources-launcher-60-60;resources-icons-48
# Screen Size 208x208 launcher icon size 35x35
fr55.resourcePath = $(fr55.resourcePath);resources-launcher-35-35;resources-icons-24
# Screen Size 240x240 launcher icon size 40x40
fr645.resourcePath = $(fr645.resourcePath);resources-launcher-40-40;resources-icons-28
fr645m.resourcePath = $(fr645m.resourcePath);resources-launcher-40-40;resources-icons-28
# Screen Size 240x240 launcher icon size 40x40
fr745.resourcePath = $(fr745.resourcePath);resources-launcher-40-40;resources-icons-28
fr935.resourcePath = $(fr935.resourcePath);resources-launcher-40-40;resources-icons-28
fr945.resourcePath = $(fr945.resourcePath);resources-launcher-40-40;resources-icons-28
fr945lte.resourcePath = $(fr945lte.resourcePath);resources-launcher-40-40;resources-icons-28
# Screen Size 260x260 launcher icon size 40x40
fr955.resourcePath = $(fr955.resourcePath);resources-launcher-40-40;resources-icons-30
# Screen Size 454x454 launcher icon size 65x65
fr965.resourcePath = $(fr965.resourcePath);resources-launcher-65-65;resources-icons-53
# Screen Size 240x400 launcher icon size 38x33
gpsmap67.resourcePath = $(gpsmap67.resourcePath);resources-launcher-33-33;resources-icons-28
# Screen Size 176x176 launcher icon size 62x62
instinct2.resourcePath = $(instinct2.resourcePath);resources-launcher-62-62;resources-icons-21
# Screen Size 163x156 launcher icon size 54x54
instinct2s.resourcePath = $(instinct2s.resourcePath);resources-launcher-54-54;resources-icons-18
# Screen Size 176x176 launcher icon size 62x62
instinct2x.resourcePath = $(instinct2x.resourcePath);resources-launcher-62-62;resources-icons-21
# Screen Size 176x176 launcher icon size 26x26
instinctcrossover.resourcePath = $(instinctcrossover.resourcePath);resources-launcher-26-26;resources-icons-21
# Screen Size 218x218 launcher icon size 30x30
legacyherocaptainmarvel.resourcePath = $(legacyherocaptainmarvel.resourcePath);resources-launcher-30-30;resources-icons-26
# Screen Size 260x260 launcher icon size 35x35
legacyherofirstavenger.resourcePath = $(legacyherofirstavenger.resourcePath);resources-launcher-35-35;resources-icons-30
legacysagadarthvader.resourcePath = $(legacysagadarthvader.resourcePath);resources-launcher-35-35;resources-icons-30
# Screen Size 218x218 launcher icon size 30x30
legacysagarey.resourcePath = $(legacysagarey.resourcePath);resources-launcher-30-30;resources-icons-26
# Screen Size 390x390 launcher icon size 60x60
marq2.resourcePath = $(marq2.resourcePath);resources-launcher-60-60;resources-icons-46
marq2aviator.resourcePath = $(marq2aviator.resourcePath);resources-launcher-60-60;resources-icons-46
# Screen Size 240x240 launcher icon size 40x40
marqadventurer.resourcePath = $(marqadventurer.resourcePath);resources-launcher-40-40;resources-icons-28
marqathlete.resourcePath = $(marqathlete.resourcePath);resources-launcher-40-40;resources-icons-28
marqaviator.resourcePath = $(marqaviator.resourcePath);resources-launcher-40-40;resources-icons-28
marqcaptain.resourcePath = $(marqcaptain.resourcePath);resources-launcher-40-40;resources-icons-28
marqcommander.resourcePath = $(marqcommander.resourcePath);resources-launcher-40-40;resources-icons-28
marqdriver.resourcePath = $(marqdriver.resourcePath);resources-launcher-40-40;resources-icons-28
marqexpedition.resourcePath = $(marqexpedition.resourcePath);resources-launcher-40-40;resources-icons-28
marqgolfer.resourcePath = $(marqgolfer.resourcePath);resources-launcher-40-40;resources-icons-28
# Screen Size 480x800 launcher icon size 60x60
montana7xx.resourcePath = $(montana7xx.resourcePath);resources-launcher-60-60;resources-icons-53
# Screen Size 390x390 launcher icon size 60x60
venu.resourcePath = $(venu.resourcePath);resources-launcher-60-60;resources-icons-46
# Screen Size 416x416 launcher icon size 70x70
venu2.resourcePath = $(venu2.resourcePath);resources-launcher-70-70;resources-icons-48
venu2plus.resourcePath = $(venu2plus.resourcePath);resources-launcher-70-70;resources-icons-48
# Screen Size 360x360 launcher icon size 61x61
venu2s.resourcePath = $(venu2s.resourcePath);resources-launcher-61-61;resources-icons-42
# Screen Size 454x454 launcher icon size 70x70
venu3.resourcePath = $(venu3.resourcePath);resources-launcher-70-70;resources-icons-53
# Screen Size 390x390 launcher icon size 70x70
venu3s.resourcePath = $(venu3s.resourcePath);resources-launcher-70-70;resources-icons-46
# Screen Size 390x390 launcher icon size 60x60
venud.resourcePath = $(venud.resourcePath);resources-launcher-60-60;resources-icons-46
# Screen Size 240x240 launcher icon size 36x36
venusq.resourcePath = $(venusq.resourcePath);resources-launcher-36-36;resources-icons-28
# Screen Size 320x360 launcher icon size 40x40
venusq2.resourcePath = $(venusq2.resourcePath);resources-launcher-40-40;resources-icons-38
# Screen Size 320x360 launcher icon size 40x40
venusq2m.resourcePath = $(venusq2m.resourcePath);resources-launcher-40-40;resources-icons-38
# Screen Size 240x240 launcher icon size 36x36
venusqm.resourcePath = $(venusqm.resourcePath);resources-launcher-36-36;resources-icons-28
# Screen Size 240x240 launcher icon size 40x33
vivoactive3.resourcePath = $(vivoactive3.resourcePath);resources-launcher-33-33;resources-icons-28
vivoactive3m.resourcePath = $(vivoactive3m.resourcePath);resources-launcher-33-33;resources-icons-28
vivoactive3mlte.resourcePath = $(vivoactive3mlte.resourcePath);resources-launcher-33-33;resources-icons-28
# Screen Size 260x260 launcher icon size 35x35
vivoactive4.resourcePath = $(vivoactive4.resourcePath);resources-launcher-35-35;resources-icons-30
# Screen Size 218x218 launcher icon size 30x30
vivoactive4s.resourcePath = $(vivoactive4s.resourcePath);resources-launcher-30-30;resources-icons-26
# Screen Size 390x390 launcher icon size 70x70
vivoactive5.resourcePath = $(vivoactive5.resourcePath);resources-launcher-70-70;resources-icons-46

View File

@ -18,11 +18,6 @@
project.manifest = manifest.xml
# Testing in VSCode requires monkey.jungle, so for convenience, swap between
# watch-app and widget by changing which of the next two lines are commented out
base.sourcePath = source;include/app
#base.sourcePath = source;include/widget
# Device References
# * https://developer.garmin.com/connect-iq/compatible-devices/
# * https://developer.garmin.com/connect-iq/reference-guides/devices-reference/

View File

@ -115,14 +115,10 @@ class HomeAssistantApp extends Application.AppBase {
} else {
var isCached = fetchMenuConfig();
fetchApiStatus();
if (WidgetApp.isWidget) {
return [new RootView(self), new RootViewDelegate(self)] as Lang.Array<WatchUi.Views or WatchUi.InputDelegates>;
if (isCached) {
return [mHaMenu, new HomeAssistantViewDelegate(true)] as Lang.Array<WatchUi.Views or WatchUi.InputDelegates>;
} else {
if (isCached) {
return [mHaMenu, new HomeAssistantViewDelegate(true)] as Lang.Array<WatchUi.Views or WatchUi.InputDelegates>;
} else {
return [new WatchUi.View(), new WatchUi.BehaviorDelegate()] as Lang.Array<WatchUi.Views or WatchUi.InputDelegates>;
}
return [new WatchUi.View(), new WatchUi.BehaviorDelegate()] as Lang.Array<WatchUi.Views or WatchUi.InputDelegates>;
}
}
}
@ -188,9 +184,7 @@ class HomeAssistantApp extends Application.AppBase {
ErrorView.show(WatchUi.loadResource($.Rez.Strings.NoJson) as Lang.String);
} else {
buildMenu(data);
if (!WidgetApp.isWidget) {
WatchUi.switchToView(mHaMenu, new HomeAssistantViewDelegate(false), WatchUi.SLIDE_IMMEDIATE);
}
WatchUi.switchToView(mHaMenu, new HomeAssistantViewDelegate(false), WatchUi.SLIDE_IMMEDIATE);
}
}
break;

View File

@ -1,185 +0,0 @@
//-----------------------------------------------------------------------------------
//
// Distributed under MIT Licence
// See https://github.com/house-of-abbey/GarminHomeAssistant/blob/main/LICENSE.
//
//-----------------------------------------------------------------------------------
//
// GarminHomeAssistant is a Garmin IQ application written in Monkey C and routinely
// tested on a Venu 2 device. The source code is provided at:
// https://github.com/house-of-abbey/GarminHomeAssistant.
//
// P A Abbey & J D Abbey & Someone0nEarth, 5 December 2023
//
//
// Description:
//
// Application root view for GarminHomeAssistant
//
//-----------------------------------------------------------------------------------
using Toybox.Graphics;
using Toybox.Lang;
using Toybox.WatchUi;
using Toybox.System;
class RootView extends ScalableView {
// ATTENTION when the app is running as a "widget" (that means, it runs on devices
// without glance view support), the input events in this view are limited, as
// described under "Base View and the Widget Carousel" on:
//
// https://developer.garmin.com/connect-iq/connect-iq-basics/app-types/
//
// Also the view type of the base view is limited too (for example "WatchUi.Menu2"
// is not possible)).
//
// Also System.exit() is not working/do nothing when running as a widget: A widget will be
// terminated automatically by OS after some time or can be quit manually, when on the base
// view a swipe to left / "back button" press is done.
private static const scMidSep = 10; // Middle Separator "text:_text" in pixels
private var mApp as HomeAssistantApp;
private var mTitle as WatchUi.Text or Null;
private var mApiText as WatchUi.Text or Null;
private var mApiStatus as WatchUi.Text or Null;
private var mMenuText as WatchUi.Text or Null;
private var mMenuStatus as WatchUi.Text or Null;
private var mMemText as WatchUi.Text or Null;
private var mMemStatus as WatchUi.Text or Null;
private var mAntiAlias as Lang.Boolean = false;
function initialize(app as HomeAssistantApp) {
ScalableView.initialize();
mApp = app;
if (Graphics.Dc has :setAntiAlias) {
mAntiAlias = true;
}
}
function onLayout(dc as Graphics.Dc) as Void {
var w = dc.getWidth();
mTitle = new WatchUi.Text({
:text => WatchUi.loadResource($.Rez.Strings.AppName) as Lang.String,
:color => Graphics.COLOR_WHITE,
:font => Graphics.FONT_TINY,
:justification => Graphics.TEXT_JUSTIFY_CENTER | Graphics.TEXT_JUSTIFY_VCENTER,
:locX => w/2,
:locY => pixelsForScreen(30.0)
});
mApiText = new WatchUi.Text({
:text => "API:",
:color => Graphics.COLOR_WHITE,
:font => Graphics.FONT_XTINY,
:justification => Graphics.TEXT_JUSTIFY_RIGHT | Graphics.TEXT_JUSTIFY_VCENTER,
:locX => w/2 - scMidSep/2,
:locY => pixelsForScreen(50.0)
});
mApiStatus = new WatchUi.Text({
:text => WatchUi.loadResource($.Rez.Strings.Checking) as Lang.String,
:color => Graphics.COLOR_WHITE,
:font => Graphics.FONT_XTINY,
:justification => Graphics.TEXT_JUSTIFY_LEFT | Graphics.TEXT_JUSTIFY_VCENTER,
:locX => w/2 + scMidSep/2,
:locY => pixelsForScreen(50.0)
});
mMenuText = new WatchUi.Text({
:text => WatchUi.loadResource($.Rez.Strings.GlanceMenu) as Lang.String + ":",
:color => Graphics.COLOR_WHITE,
:font => Graphics.FONT_XTINY,
:justification => Graphics.TEXT_JUSTIFY_RIGHT | Graphics.TEXT_JUSTIFY_VCENTER,
:locX => w/2 - scMidSep/2,
:locY => pixelsForScreen(60.0)
});
mMenuStatus = new WatchUi.Text({
:text => WatchUi.loadResource($.Rez.Strings.Checking) as Lang.String,
:color => Graphics.COLOR_WHITE,
:font => Graphics.FONT_XTINY,
:justification => Graphics.TEXT_JUSTIFY_LEFT | Graphics.TEXT_JUSTIFY_VCENTER,
:locX => w/2 + scMidSep/2,
:locY => pixelsForScreen(60.0)
});
mMemText = new WatchUi.Text({
:text => WatchUi.loadResource($.Rez.Strings.Memory) as Lang.String + ":",
:color => Graphics.COLOR_WHITE,
:font => Graphics.FONT_XTINY,
:justification => Graphics.TEXT_JUSTIFY_RIGHT | Graphics.TEXT_JUSTIFY_VCENTER,
:locX => w/2 - scMidSep/2,
:locY => pixelsForScreen(70.0)
});
mMemStatus = new WatchUi.Text({
:text => WatchUi.loadResource($.Rez.Strings.Checking) as Lang.String,
:color => Graphics.COLOR_WHITE,
:font => Graphics.FONT_XTINY,
:justification => Graphics.TEXT_JUSTIFY_LEFT | Graphics.TEXT_JUSTIFY_VCENTER,
:locX => w/2 + scMidSep/2,
:locY => pixelsForScreen(70.0)
});
}
function onUpdate(dc as Graphics.Dc) as Void {
if (mAntiAlias) {
dc.setAntiAlias(true);
}
dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_BLACK);
dc.clear();
// Initialise this locally, otherwise the venu1 device runs out of memory when stored at class level.
var launcherIcon = Application.loadResource(Rez.Drawables.LauncherIcon);
var w = dc.getWidth();
var h = dc.getHeight();
dc.drawBitmap(w/2 - launcherIcon.getWidth()/2, h/8 - launcherIcon.getHeight()/2, launcherIcon);
mTitle.draw(dc);
mApiText.draw(dc);
mApiStatus.setText(mApp.getApiStatus());
mApiStatus.draw(dc);
mMenuText.draw(dc);
mMenuStatus.setText(mApp.getMenuStatus());
mMenuStatus.draw(dc);
mMemText.draw(dc);
var stats = System.getSystemStats();
var memUsed = (100f * stats.usedMemory) / stats.totalMemory;
mMemStatus.setText(memUsed.format("%.1f") + "%");
if (stats.usedMemory > Globals.scLowMem * stats.totalMemory) {
mMemStatus.setColor(Graphics.COLOR_RED);
} else {
mMemStatus.setColor(Graphics.COLOR_WHITE);
}
mMemStatus.draw(dc);
}
function onShow() as Void {
WatchUi.requestUpdate();
}
}
class RootViewDelegate extends WatchUi.BehaviorDelegate {
var mApp as HomeAssistantApp;
function initialize(app as HomeAssistantApp) {
BehaviorDelegate.initialize();
mApp = app;
}
function onTap(evt as WatchUi.ClickEvent) as Lang.Boolean {
return backToMainMenu();
}
function onSelect() as Lang.Boolean {
return backToMainMenu();
}
function onMenu() as Lang.Boolean {
return backToMainMenu();
}
private function backToMainMenu() as Lang.Boolean {
if (mApp.isHomeAssistantMenuLoaded()) {
mApp.pushHomeAssistantMenuView();
return true;
}
return false;
}
}