Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
亨睿 committed Feb 17, 2020
1 parent a10d554 commit 9dc23a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
13 changes: 5 additions & 8 deletions src/examples/home/views/HomeVIew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,15 @@ void HomeView::willUnmount() {
}

bool HomeView::shouldUpdate() {
bool result = false;
if (isDirty()) {
return true;
result = true;
}
if (millis() - getLastUpdate() > 500) {
_blinking = !_blinking;
return true;
result = true;
}
if (ServiceClient.isLoading() && (millis() - getLastUpdate() > 250)) {
_loadingBlinking = !_loadingBlinking;
return true;
}
return false;
return result;
}

void HomeView::update() {
Expand Down Expand Up @@ -63,7 +60,7 @@ void HomeView::render(CanvasContext *context) {
_drawWeather(context);
_drawStocks(context);
if (ServiceClient.isLoading()) {
if (!_loadingBlinking) {
if (!_blinking) {
context->fillCircle(getClientWidth() / 2, 2, 2);
}
}
Expand Down
1 change: 0 additions & 1 deletion src/examples/home/views/HomeView.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class HomeView : public View {
uint8_t _sideViewIndex = 0;
long _millisSinceLastSideViewIndexChanged = 0;
bool _blinking = false;
bool _loadingBlinking = false;

void _drawDateTime(CanvasContext *context);
void _drawWeather(CanvasContext *context);
Expand Down

0 comments on commit 9dc23a5

Please sign in to comment.