mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2025-12-14 18:18:16 +00:00
Add error handling for empty menu data
New string resource for menu definition errors and updates HomeAssistantApp to show an error message when the menu data is empty.
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
<string id="NoConfigUrl" scope="glance">No configuration URL in the application settings.</string>
|
||||
<string id="NoInternet">No Internet connection.</string>
|
||||
<string id="NoJson">No JSON returned from HTTP request.</string>
|
||||
<string id="NoMenu">Menu definition error, check the instructions.</string>
|
||||
<string id="NoPhone" scope="glance">No Phone connection.</string>
|
||||
<string id="NoPhoneNoCache" scope="glance">No phone connection, no cached menu.</string>
|
||||
<string id="NoResponse">No Response, check Internet connection</string>
|
||||
|
||||
@@ -218,6 +218,8 @@ class HomeAssistantApp extends Application.AppBase {
|
||||
} else {
|
||||
if (data == null) {
|
||||
ErrorView.show(WatchUi.loadResource($.Rez.Strings.NoJson) as Lang.String);
|
||||
} else if (data.size() == 0) {
|
||||
ErrorView.show(WatchUi.loadResource($.Rez.Strings.NoMenu) as Lang.String);
|
||||
} else {
|
||||
buildMenu(data);
|
||||
WatchUi.switchToView(mHaMenu, new HomeAssistantViewDelegate(false), WatchUi.SLIDE_IMMEDIATE);
|
||||
|
||||
Reference in New Issue
Block a user