mirror of
https://github.com/InfiniTimeOrg/InfiniTime.git
synced 2024-10-22 15:11:51 +02:00
Compare commits
3 commits
f0211e5fcb
...
42bcd56545
Author | SHA1 | Date | |
---|---|---|---|
42bcd56545 | |||
2a8e953cb6 | |||
0954e3b2b0 |
|
@ -62,7 +62,7 @@
|
|||
#define configTICK_RATE_HZ 1024
|
||||
#define configMAX_PRIORITIES (3)
|
||||
#define configMINIMAL_STACK_SIZE (120)
|
||||
#define configTOTAL_HEAP_SIZE (1024 * 35)
|
||||
#define configTOTAL_HEAP_SIZE (1024 * 40)
|
||||
#define configMAX_TASK_NAME_LEN (4)
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#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"
|
||||
|
@ -102,7 +101,6 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
|
|||
spiNorFlash {spiNorFlash},
|
||||
lvgl {lcd, filesystem},
|
||||
timer(this, TimerCallback),
|
||||
popupMessage {Screens::Symbols::lock, 90, 90},
|
||||
controllers {batteryController,
|
||||
bleController,
|
||||
dateTimeController,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
set(FONTS jetbrains_mono_42 jetbrains_mono_76 jetbrains_mono_bold_20
|
||||
jetbrains_mono_extrabold_compressed lv_font_sys_48 lv_font_sys_80
|
||||
jetbrains_mono_extrabold_compressed lv_font_sys_48
|
||||
open_sans_light fontawesome_weathericons)
|
||||
find_program(LV_FONT_CONV "lv_font_conv" NO_CACHE REQUIRED
|
||||
HINTS "${CMAKE_SOURCE_DIR}/node_modules/.bin")
|
||||
|
|
|
@ -64,16 +64,6 @@
|
|||
"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": [
|
||||
{
|
||||
|
|
|
@ -64,9 +64,6 @@ 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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +1,40 @@
|
|||
#include "displayapp/widgets/PopupMessage.h"
|
||||
#include "displayapp/InfiniTimeTheme.h"
|
||||
#include <libraries/log/nrf_log.h>
|
||||
|
||||
using namespace Pinetime::Applications::Widgets;
|
||||
|
||||
PopupMessage::PopupMessage(const char* msg, int16_t h, int16_t w) : message {msg}, height {h}, width {w} {
|
||||
PopupMessage::PopupMessage() {
|
||||
}
|
||||
|
||||
void PopupMessage::Create() {
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
void PopupMessage::SetHidden(bool hidden) {
|
||||
|
@ -24,11 +43,11 @@ void PopupMessage::SetHidden(bool hidden) {
|
|||
}
|
||||
isHidden = hidden;
|
||||
// create/delete on demand
|
||||
if (btnPopup == nullptr && !isHidden) {
|
||||
if (popup == nullptr && !isHidden) {
|
||||
Create();
|
||||
} else if (btnPopup != nullptr) {
|
||||
lv_obj_del(btnPopup);
|
||||
btnPopup = nullptr;
|
||||
} else if (popup != nullptr) {
|
||||
lv_obj_del(popup);
|
||||
popup = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,18 +6,14 @@ namespace Pinetime {
|
|||
namespace Widgets {
|
||||
class PopupMessage {
|
||||
public:
|
||||
// The caller owns the message string, it is not copied.
|
||||
PopupMessage(const char* msg, int16_t h, int16_t w);
|
||||
PopupMessage();
|
||||
void Create();
|
||||
void SetHidden(bool hidden);
|
||||
bool IsHidden();
|
||||
|
||||
private:
|
||||
const char* message;
|
||||
lv_obj_t* btnPopup = nullptr;
|
||||
lv_obj_t* popup = nullptr;
|
||||
bool isHidden = true;
|
||||
int16_t height;
|
||||
int16_t width;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -419,8 +419,7 @@ 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_80)
|
||||
LV_FONT_DECLARE(lv_font_sys_48)
|
||||
|
||||
/* Enable it if you have fonts with a lot of characters.
|
||||
* The limit depends on the font size, font face and bpp
|
||||
|
|
Loading…
Reference in a new issue