Skip to content

Commit

Permalink
feat(widgets): 'Gesture' support indicator bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Lzw655 committed Aug 25, 2024
1 parent 2582cb8 commit 8662369
Show file tree
Hide file tree
Showing 19 changed files with 918 additions and 256 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# ChangeLog

## v0.1.2 - 2024-08-13
## v0.2.0 - 2024-08-20

### Enhancements:

* feat(examples): 'ESP_UI_Phone' add partition requirement
* feat(widgets): 'Navigation Bar' support flex visual mode
* feat(widgets): 'Gesture' support indicator bar

## v0.1.1~1 - 2024-08-16

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "app_examples/phone/squareline/src/phone_app_squareline.hpp"

#define EXAMPLE_SHOW_MEM_INFO (1)
#define EXAMPLE_USE_EXTERNAL_STYLESHEET (1)
#define EXAMPLE_USE_EXTERNAL_STYLESHEET (0)
#if EXAMPLE_USE_EXTERNAL_STYLESHEET
#include "esp_ui_phone_1024_600_stylesheet.h"
#endif
Expand Down
5 changes: 1 addition & 4 deletions idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
version: 0.1.2
version: 0.2.0
description: This package is a UI runtime framework based on LVGL, designed to provide a consistent UI development experience for screens of various sizes and shapes.
url: https://github.com/espressif/esp-ui
issues: https://github.com/espressif/esp-ui/issues
repository: https://github.com/espressif/esp-ui.git
examples:
- examples/esp_idf/esp_ui_s3_lcd_ev_board
- examples/esp_idf/esp_ui_phone_p4_function_ev_board
dependencies:
idf: ">=5.0"
cmake_utilities: "0.*"
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=esp-ui
version=0.1.2
version=0.2.0
author=espressif
maintainer=espressif
sentence=This package is a UI runtime framework based on LVGL, designed to provide a consistent UI development experience for screens of various sizes and shapes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ PhoneAppComplexConf::PhoneAppComplexConf(bool use_status_bar, bool use_navigatio
},
.status_bar_visual_mode = (use_status_bar) ? ESP_UI_STATUS_BAR_VISUAL_MODE_SHOW_FIXED :
ESP_UI_STATUS_BAR_VISUAL_MODE_HIDE,
.navigation_bar_visual_mode = (use_navigation_bar) ? ESP_UI_NAVIGATION_BAR_VISUAL_MODE_SHOW_FIXED :
.navigation_bar_visual_mode = (use_navigation_bar) ? ESP_UI_NAVIGATION_BAR_VISUAL_MODE_SHOW_FLEX :
ESP_UI_NAVIGATION_BAR_VISUAL_MODE_HIDE,
.flags = {
.enable_status_icon_common_size = 1,
Expand Down
35 changes: 35 additions & 0 deletions src/core/esp_ui_core_home.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,41 @@ bool ESP_UI_CoreHome::calibrateCoreObjectSize(const ESP_UI_StyleSize_t &parent,
return true;
}

bool ESP_UI_CoreHome::calibrateCoreObjectSize(const ESP_UI_StyleSize_t &parent, ESP_UI_StyleSize_t &target,
bool allow_zero) const
{
uint16_t parent_w = 0;
uint16_t parent_h = 0;
uint16_t min_size = allow_zero ? 0 : 1;

parent_w = parent.width;
parent_h = parent.height;

// Check width
if (target.flags.enable_width_percent) {
ESP_UI_CHECK_VALUE_RETURN(target.width_percent, min_size, 100, false, "Invalid width percent");
target.width = (parent_w * target.width_percent) / 100;
} else {
ESP_UI_CHECK_VALUE_RETURN(target.width, min_size, parent_w, false, "Invalid width");
}

// Check height
if (target.flags.enable_height_percent) {
ESP_UI_CHECK_VALUE_RETURN(target.height_percent, min_size, 100, false, "Invalid Height percent");
target.height = (parent_h * target.height_percent) / 100;
} else {
ESP_UI_CHECK_VALUE_RETURN(target.height, min_size, parent_h, false, "Invalid Height");
}

// Process square
if (target.flags.enable_square) {
target.width = min(target.width, target.height);
target.height = target.width;
}

return true;
}

bool ESP_UI_CoreHome::calibrateCoreFont(const ESP_UI_StyleSize_t *parent, ESP_UI_StyleFont_t &target) const
{
uint8_t size_px = 0;
Expand Down
1 change: 1 addition & 0 deletions src/core/esp_ui_core_home.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class ESP_UI_CoreHome {
bool showContainerBorder(void);
bool hideContainerBorder(void);
bool calibrateCoreObjectSize(const ESP_UI_StyleSize_t &parent, ESP_UI_StyleSize_t &target) const;
bool calibrateCoreObjectSize(const ESP_UI_StyleSize_t &parent, ESP_UI_StyleSize_t &target, bool allow_zero) const;
bool calibrateCoreFont(const ESP_UI_StyleSize_t *parent, ESP_UI_StyleFont_t &target) const;
bool calibrateCoreIconImage(const ESP_UI_StyleImage_t &target) const;

Expand Down
2 changes: 1 addition & 1 deletion src/core/esp_ui_lv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ using ESP_UI_LvAnim_t = std::shared_ptr<lv_anim_t>;
#define LvAnimConstructor() \
({ \
lv_anim_t *anim = new lv_anim_t; \
if (anim == nullptr) { \
if (anim != nullptr) { \
lv_anim_init(anim); \
}; \
anim; \
Expand Down
2 changes: 2 additions & 0 deletions src/systems/phone/esp_ui_phone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ bool ESP_UI_Phone::calibrateStylesheet(const ESP_UI_StyleSize_t &screen_size, ES
_stylesheet.home.flags.enable_recents_screen = 0;
}
ESP_UI_CHECK_FALSE_RETURN(_home.calibrateData(screen_size, stylesheet.home), false, "Invalid home data");
ESP_UI_CHECK_FALSE_RETURN(_manager.calibrateData(screen_size, _home, stylesheet.manager), false,
"Invalid manager data");

return true;
}
Expand Down
Loading

0 comments on commit 8662369

Please sign in to comment.