diff --git a/src/handler/eventHandler.cpp b/src/handler/eventHandler.cpp index 578e678..a9a62cb 100644 --- a/src/handler/eventHandler.cpp +++ b/src/handler/eventHandler.cpp @@ -224,20 +224,18 @@ int EventHandler::pointerHandler(const int type, const int par1, const int par2) { _menu.drawLoadingScreen(); - Log::writeLog("Start Login from loginscreen"); - - //TODO use progressbar and log (check what can go wrong?) catch? if (_nextcloud.login(_loginView->getURL(), _loginView->getUsername(), _loginView->getPassword())) { _listView = std::unique_ptr(new ListView(_menu.getContentRect(), _nextcloud.getItems())); _loginView.reset(); + + FullUpdate(); } else { - //TODO redraw login screen so that loading disappears - Message(ICON_WARNING, "Warning", "Something went wrong...", 1200); + _menu.clearLoadingScreen(); + Log::writeLog("login failed."); } - FullUpdate(); return 1; } } diff --git a/src/handler/menuHandler.cpp b/src/handler/menuHandler.cpp index 8c2e8e4..b3bc756 100644 --- a/src/handler/menuHandler.cpp +++ b/src/handler/menuHandler.cpp @@ -89,3 +89,9 @@ void MenuHandler::drawLoadingScreen() DrawTextRect2(&_loadingScreenRect, "Loading..."); PartialUpdate(_loadingScreenRect.x, _loadingScreenRect.y, _loadingScreenRect.w, _loadingScreenRect.h); } + +void MenuHandler::clearLoadingScreen() +{ + FillArea(_loadingScreenRect.x, _loadingScreenRect.y, _loadingScreenRect.w, _loadingScreenRect.h/4, WHITE); + PartialUpdate(_loadingScreenRect.x, _loadingScreenRect.y, _loadingScreenRect.w, _loadingScreenRect.h); +} diff --git a/src/handler/menuHandler.h b/src/handler/menuHandler.h index 4286103..d4c0fa1 100644 --- a/src/handler/menuHandler.h +++ b/src/handler/menuHandler.h @@ -39,6 +39,8 @@ public: void drawLoadingScreen(); + void clearLoadingScreen(); + private: ifont *_menuFont; ifont *_loadingFont;