mirror of
https://github.com/esphome/esphome.git
synced 2025-09-14 17:22:20 +01:00
[online_image] add option to show placeholder while downloading (#7083)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
@@ -35,6 +35,14 @@ OnlineImage::OnlineImage(const std::string &url, int width, int height, ImageFor
|
||||
this->set_url(url);
|
||||
}
|
||||
|
||||
void OnlineImage::draw(int x, int y, display::Display *display, Color color_on, Color color_off) {
|
||||
if (this->data_start_) {
|
||||
Image::draw(x, y, display, color_on, color_off);
|
||||
} else if (this->placeholder_) {
|
||||
this->placeholder_->draw(x, y, display, color_on, color_off);
|
||||
}
|
||||
}
|
||||
|
||||
void OnlineImage::release() {
|
||||
if (this->buffer_) {
|
||||
ESP_LOGD(TAG, "Deallocating old buffer...");
|
||||
|
Reference in New Issue
Block a user