Compare commits

..

1 commit

Author SHA1 Message Date
tgc-dk 90a71175a4
Merge f0211e5fcb into a2356f2f4a 2024-10-03 20:24:04 +00:00
8 changed files with 39 additions and 38 deletions

View file

@ -62,7 +62,7 @@
#define configTICK_RATE_HZ 1024
#define configMAX_PRIORITIES (3)
#define configMINIMAL_STACK_SIZE (120)
#define configTOTAL_HEAP_SIZE (1024 * 40)
#define configTOTAL_HEAP_SIZE (1024 * 35)
#define configMAX_TASK_NAME_LEN (4)
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1

View file

@ -30,6 +30,7 @@
#include "displayapp/screens/Weather.h"
#include "displayapp/screens/PassKey.h"
#include "displayapp/screens/Error.h"
#include "displayapp/screens/Symbols.h"
#include "drivers/Cst816s.h"
#include "drivers/St7789.h"
@ -101,6 +102,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
spiNorFlash {spiNorFlash},
lvgl {lcd, filesystem},
timer(this, TimerCallback),
popupMessage {Screens::Symbols::lock, 90, 90},
controllers {batteryController,
bleController,
dateTimeController,

View file

@ -1,5 +1,5 @@
set(FONTS jetbrains_mono_42 jetbrains_mono_76 jetbrains_mono_bold_20
jetbrains_mono_extrabold_compressed lv_font_sys_48
jetbrains_mono_extrabold_compressed lv_font_sys_48 lv_font_sys_80
open_sans_light fontawesome_weathericons)
find_program(LV_FONT_CONV "lv_font_conv" NO_CACHE REQUIRED
HINTS "${CMAKE_SOURCE_DIR}/node_modules/.bin")

View file

@ -64,6 +64,16 @@
"bpp": 1,
"size": 48
},
"lv_font_sys_80": {
"sources": [
{
"file": "material-design-icons/MaterialIcons-Regular.ttf",
"range": "0xe897"
}
],
"bpp": 1,
"size": 80
},
"fontawesome_weathericons": {
"sources": [
{

View file

@ -64,6 +64,9 @@ namespace Pinetime {
static constexpr const char* flashlight = "\xEF\x80\x8B";
static constexpr const char* paintbrushLg = "\xEE\x90\x8A";
// wake-up screenlock icon, from material icons
static constexpr const char* lock = "\xEE\xA2\x97";
}
}
}

View file

@ -1,40 +1,21 @@
#include "displayapp/widgets/PopupMessage.h"
#include "displayapp/InfiniTimeTheme.h"
#include <libraries/log/nrf_log.h>
using namespace Pinetime::Applications::Widgets;
PopupMessage::PopupMessage() {
PopupMessage::PopupMessage(const char* msg, int16_t h, int16_t w) : message {msg}, height {h}, width {w} {
}
void PopupMessage::Create() {
popup = lv_obj_create(lv_scr_act(), nullptr);
lv_obj_set_size(popup, 90, 90);
lv_obj_align(popup, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
lv_obj_set_style_local_bg_color(popup, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, Colors::bg);
lv_obj_set_style_local_bg_opa(popup, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_60);
lv_obj_t* lockBody = lv_obj_create(popup, nullptr);
lv_obj_set_size(lockBody, 55, 50);
lv_obj_align(lockBody, popup, LV_ALIGN_CENTER, 0, 10);
lv_obj_set_style_local_bg_color(lockBody, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
lv_obj_set_style_local_bg_opa(lockBody, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_0);
lv_obj_set_style_local_border_color(lockBody, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
lv_obj_set_style_local_border_width(lockBody, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, 22);
lv_obj_set_style_local_border_side(lockBody, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_BORDER_SIDE_FULL);
lv_obj_set_style_local_border_opa(lockBody, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_100);
lv_obj_t* lockTop = lv_obj_create(popup, nullptr);
lv_obj_set_size(lockTop, 30, 35);
lv_obj_align(lockTop, popup, LV_ALIGN_CENTER, 0, -20);
lv_obj_set_style_local_bg_color(lockTop, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
lv_obj_set_style_local_bg_opa(lockTop, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_0);
lv_obj_set_style_local_border_color(lockTop, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
lv_obj_set_style_local_border_width(lockTop, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, 6);
lv_obj_set_style_local_border_side(lockTop, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_BORDER_SIDE_FULL);
lv_obj_set_style_local_border_opa(lockTop, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_100);
lv_obj_set_hidden(popup, isHidden);
btnPopup = lv_btn_create(lv_scr_act(), nullptr);
btnPopup->user_data = this;
lv_obj_set_size(btnPopup, height, width);
lv_obj_align(btnPopup, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
lv_obj_set_style_local_bg_opa(btnPopup, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_60);
lv_obj_set_style_local_text_font(btnPopup, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_80);
lv_obj_t* lblMessage = lv_label_create(btnPopup, nullptr);
lv_label_set_text_static(lblMessage, message);
lv_obj_set_hidden(btnPopup, isHidden);
}
void PopupMessage::SetHidden(bool hidden) {
@ -43,11 +24,11 @@ void PopupMessage::SetHidden(bool hidden) {
}
isHidden = hidden;
// create/delete on demand
if (popup == nullptr && !isHidden) {
if (btnPopup == nullptr && !isHidden) {
Create();
} else if (popup != nullptr) {
lv_obj_del(popup);
popup = nullptr;
} else if (btnPopup != nullptr) {
lv_obj_del(btnPopup);
btnPopup = nullptr;
}
}

View file

@ -6,14 +6,18 @@ namespace Pinetime {
namespace Widgets {
class PopupMessage {
public:
PopupMessage();
// The caller owns the message string, it is not copied.
PopupMessage(const char* msg, int16_t h, int16_t w);
void Create();
void SetHidden(bool hidden);
bool IsHidden();
private:
lv_obj_t* popup = nullptr;
const char* message;
lv_obj_t* btnPopup = nullptr;
bool isHidden = true;
int16_t height;
int16_t width;
};
}
}

View file

@ -419,7 +419,8 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
LV_FONT_DECLARE(jetbrains_mono_76) \
LV_FONT_DECLARE(open_sans_light) \
LV_FONT_DECLARE(fontawesome_weathericons) \
LV_FONT_DECLARE(lv_font_sys_48)
LV_FONT_DECLARE(lv_font_sys_48) \
LV_FONT_DECLARE(lv_font_sys_80)
/* Enable it if you have fonts with a lot of characters.
* The limit depends on the font size, font face and bpp