Merge branch 'develop' of
https://github.com/JF002/InfiniTime into StepsApp
This commit is contained in:
@@ -3,66 +3,61 @@
|
||||
#include "displayapp/screens/Symbols.h"
|
||||
#include "displayapp/screens/BatteryIcon.h"
|
||||
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
namespace {
|
||||
static void ButtonEventHandler(lv_obj_t * obj, lv_event_t event) {
|
||||
QuickSettings* screen = static_cast<QuickSettings *>(obj->user_data);
|
||||
static void ButtonEventHandler(lv_obj_t* obj, lv_event_t event) {
|
||||
QuickSettings* screen = static_cast<QuickSettings*>(obj->user_data);
|
||||
screen->OnButtonEvent(obj, event);
|
||||
}
|
||||
|
||||
static void lv_update_task(struct _lv_task_t *task) {
|
||||
auto user_data = static_cast<QuickSettings *>(task->user_data);
|
||||
static void lv_update_task(struct _lv_task_t* task) {
|
||||
auto user_data = static_cast<QuickSettings*>(task->user_data);
|
||||
user_data->UpdateScreen();
|
||||
}
|
||||
}
|
||||
|
||||
QuickSettings::QuickSettings(
|
||||
Pinetime::Applications::DisplayApp *app,
|
||||
Pinetime::Controllers::Battery& batteryController,
|
||||
Controllers::DateTime& dateTimeController,
|
||||
Controllers::BrightnessController& brightness,
|
||||
Pinetime::Controllers::Settings &settingsController) :
|
||||
Screen(app),
|
||||
batteryController{batteryController},
|
||||
dateTimeController{dateTimeController},
|
||||
brightness{brightness},
|
||||
settingsController{settingsController}
|
||||
{
|
||||
QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app,
|
||||
Pinetime::Controllers::Battery& batteryController,
|
||||
Controllers::DateTime& dateTimeController,
|
||||
Controllers::BrightnessController& brightness,
|
||||
Pinetime::Controllers::Settings& settingsController)
|
||||
: Screen(app),
|
||||
batteryController {batteryController},
|
||||
dateTimeController {dateTimeController},
|
||||
brightness {brightness},
|
||||
settingsController {settingsController} {
|
||||
|
||||
// Time
|
||||
label_time = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes());
|
||||
lv_label_set_align( label_time, LV_LABEL_ALIGN_CENTER );
|
||||
label_time = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes());
|
||||
lv_label_set_align(label_time, LV_LABEL_ALIGN_CENTER);
|
||||
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 15, 4);
|
||||
|
||||
batteryIcon = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
|
||||
lv_obj_align(batteryIcon, nullptr, LV_ALIGN_IN_TOP_RIGHT, -15, 4);
|
||||
|
||||
|
||||
lv_obj_t * lbl_btn;
|
||||
lv_obj_t* lbl_btn;
|
||||
|
||||
btn1 = lv_btn_create(lv_scr_act(), nullptr);
|
||||
btn1->user_data = this;
|
||||
lv_obj_set_event_cb(btn1, ButtonEventHandler);
|
||||
lv_obj_align(btn1, nullptr, LV_ALIGN_CENTER, -50, -30);
|
||||
lv_obj_align(btn1, nullptr, LV_ALIGN_CENTER, -50, -30);
|
||||
lv_obj_set_style_local_radius(btn1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 20);
|
||||
lv_obj_set_style_local_bg_color(btn1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
|
||||
lv_obj_set_style_local_bg_color(btn1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
|
||||
lv_obj_set_style_local_bg_grad_dir(btn1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_GRAD_DIR_NONE);
|
||||
|
||||
lv_btn_set_fit2(btn1, LV_FIT_TIGHT, LV_FIT_TIGHT);
|
||||
lv_btn_set_fit2(btn1, LV_FIT_TIGHT, LV_FIT_TIGHT);
|
||||
|
||||
btn1_lvl = lv_label_create(btn1, nullptr);
|
||||
lv_obj_set_style_local_text_font(btn1_lvl, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48);
|
||||
lv_label_set_text_static(btn1_lvl, brightness.GetIcon());
|
||||
|
||||
|
||||
btn2 = lv_btn_create(lv_scr_act(), nullptr);
|
||||
btn2->user_data = this;
|
||||
lv_obj_set_event_cb(btn2, ButtonEventHandler);
|
||||
lv_obj_align(btn2, nullptr, LV_ALIGN_CENTER, 50, -30);
|
||||
lv_obj_align(btn2, nullptr, LV_ALIGN_CENTER, 50, -30);
|
||||
lv_obj_set_style_local_radius(btn2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 20);
|
||||
lv_obj_set_style_local_bg_color(btn2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
|
||||
lv_obj_set_style_local_bg_grad_dir(btn2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_GRAD_DIR_NONE);
|
||||
@@ -71,7 +66,6 @@ QuickSettings::QuickSettings(
|
||||
lbl_btn = lv_label_create(btn2, nullptr);
|
||||
lv_obj_set_style_local_text_font(lbl_btn, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48);
|
||||
lv_label_set_text_static(lbl_btn, Symbols::highlight);
|
||||
|
||||
|
||||
btn3 = lv_btn_create(lv_scr_act(), nullptr);
|
||||
btn3->user_data = this;
|
||||
@@ -86,9 +80,9 @@ QuickSettings::QuickSettings(
|
||||
lv_btn_set_fit2(btn3, LV_FIT_TIGHT, LV_FIT_TIGHT);
|
||||
|
||||
btn3_lvl = lv_label_create(btn3, nullptr);
|
||||
lv_obj_set_style_local_text_font(btn3_lvl, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48);
|
||||
lv_obj_set_style_local_text_font(btn3_lvl, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48);
|
||||
|
||||
if ( settingsController.GetVibrationStatus() == Controllers::Settings::Vibration::ON ) {
|
||||
if (settingsController.GetVibrationStatus() == Controllers::Settings::Vibration::ON) {
|
||||
lv_obj_add_state(btn3, LV_STATE_CHECKED);
|
||||
lv_label_set_text_static(btn3_lvl, Symbols::notificationsOn);
|
||||
} else {
|
||||
@@ -98,7 +92,7 @@ QuickSettings::QuickSettings(
|
||||
btn4 = lv_btn_create(lv_scr_act(), nullptr);
|
||||
btn4->user_data = this;
|
||||
lv_obj_set_event_cb(btn4, ButtonEventHandler);
|
||||
lv_obj_align(btn4, nullptr, LV_ALIGN_CENTER, 50, 60);
|
||||
lv_obj_align(btn4, nullptr, LV_ALIGN_CENTER, 50, 60);
|
||||
lv_obj_set_style_local_radius(btn4, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 20);
|
||||
lv_obj_set_style_local_bg_color(btn4, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
|
||||
lv_obj_set_style_local_bg_grad_dir(btn4, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_GRAD_DIR_NONE);
|
||||
@@ -108,17 +102,15 @@ QuickSettings::QuickSettings(
|
||||
lv_obj_set_style_local_text_font(lbl_btn, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48);
|
||||
lv_label_set_text_static(lbl_btn, Symbols::settings);
|
||||
|
||||
lv_obj_t * backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
|
||||
lv_obj_set_size(backgroundLabel, 240, 240);
|
||||
lv_obj_set_pos(backgroundLabel, 0, 0);
|
||||
lv_label_set_text_static(backgroundLabel, "");
|
||||
|
||||
taskUpdate = lv_task_create(lv_update_task, 500000, LV_TASK_PRIO_MID, this);
|
||||
|
||||
}
|
||||
|
||||
|
||||
QuickSettings::~QuickSettings() {
|
||||
lv_task_del(taskUpdate);
|
||||
lv_obj_clean(lv_scr_act());
|
||||
@@ -126,39 +118,37 @@ QuickSettings::~QuickSettings() {
|
||||
}
|
||||
|
||||
void QuickSettings::UpdateScreen() {
|
||||
lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes());
|
||||
lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes());
|
||||
lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
|
||||
}
|
||||
|
||||
void QuickSettings::OnButtonEvent(lv_obj_t *object, lv_event_t event) {
|
||||
if(object == btn2 && event == LV_EVENT_PRESSED) {
|
||||
|
||||
void QuickSettings::OnButtonEvent(lv_obj_t* object, lv_event_t event) {
|
||||
if (object == btn2 && event == LV_EVENT_PRESSED) {
|
||||
|
||||
running = false;
|
||||
app->StartApp(Apps::FlashLight, DisplayApp::FullRefreshDirections::None);
|
||||
|
||||
} else if(object == btn1 && event == LV_EVENT_PRESSED) {
|
||||
|
||||
} else if (object == btn1 && event == LV_EVENT_PRESSED) {
|
||||
|
||||
brightness.Step();
|
||||
lv_label_set_text_static(btn1_lvl, brightness.GetIcon());
|
||||
settingsController.SetBrightness( brightness.Level() );
|
||||
settingsController.SetBrightness(brightness.Level());
|
||||
|
||||
} else if(object == btn3 && event == LV_EVENT_VALUE_CHANGED) {
|
||||
|
||||
if(lv_obj_get_state(btn3, LV_BTN_PART_MAIN) & LV_STATE_CHECKED) {
|
||||
settingsController.SetVibrationStatus( Controllers::Settings::Vibration::ON );
|
||||
} else if (object == btn3 && event == LV_EVENT_VALUE_CHANGED) {
|
||||
|
||||
if (lv_obj_get_state(btn3, LV_BTN_PART_MAIN) & LV_STATE_CHECKED) {
|
||||
settingsController.SetVibrationStatus(Controllers::Settings::Vibration::ON);
|
||||
lv_label_set_text_static(btn3_lvl, Symbols::notificationsOn);
|
||||
} else {
|
||||
settingsController.SetVibrationStatus(Controllers::Settings::Vibration::OFF);
|
||||
lv_label_set_text_static(btn3_lvl, Symbols::notificationsOff);
|
||||
}
|
||||
|
||||
} else if(object == btn4 && event == LV_EVENT_PRESSED) {
|
||||
} else if (object == btn4 && event == LV_EVENT_PRESSED) {
|
||||
running = false;
|
||||
settingsController.SetSettingsMenu(0);
|
||||
app->StartApp(Apps::Settings, DisplayApp::FullRefreshDirections::Up);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool QuickSettings::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
||||
|
@@ -10,47 +10,44 @@
|
||||
#include "components/settings/Settings.h"
|
||||
#include "components/battery/BatteryController.h"
|
||||
|
||||
|
||||
namespace Pinetime {
|
||||
|
||||
namespace Applications {
|
||||
namespace Screens {
|
||||
|
||||
class QuickSettings : public Screen{
|
||||
public:
|
||||
QuickSettings(DisplayApp* app,
|
||||
Pinetime::Controllers::Battery& batteryController,
|
||||
Controllers::DateTime& dateTimeController,
|
||||
Controllers::BrightnessController& brightness,
|
||||
Pinetime::Controllers::Settings &settingsController);
|
||||
class QuickSettings : public Screen {
|
||||
public:
|
||||
QuickSettings(DisplayApp* app,
|
||||
Pinetime::Controllers::Battery& batteryController,
|
||||
Controllers::DateTime& dateTimeController,
|
||||
Controllers::BrightnessController& brightness,
|
||||
Pinetime::Controllers::Settings& settingsController);
|
||||
|
||||
~QuickSettings() override;
|
||||
~QuickSettings() override;
|
||||
|
||||
bool Refresh() override;
|
||||
|
||||
bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
|
||||
void OnButtonEvent(lv_obj_t *object, lv_event_t event);
|
||||
bool Refresh() override;
|
||||
|
||||
void UpdateScreen();
|
||||
bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
|
||||
void OnButtonEvent(lv_obj_t* object, lv_event_t event);
|
||||
|
||||
private:
|
||||
void UpdateScreen();
|
||||
|
||||
Pinetime::Controllers::Battery& batteryController;
|
||||
Controllers::DateTime& dateTimeController;
|
||||
Controllers::BrightnessController& brightness;
|
||||
Controllers::Settings& settingsController;
|
||||
private:
|
||||
Pinetime::Controllers::Battery& batteryController;
|
||||
Controllers::DateTime& dateTimeController;
|
||||
Controllers::BrightnessController& brightness;
|
||||
Controllers::Settings& settingsController;
|
||||
|
||||
lv_task_t* taskUpdate;
|
||||
lv_obj_t * batteryIcon;
|
||||
lv_obj_t * label_time;
|
||||
|
||||
lv_obj_t * btn1;
|
||||
lv_obj_t * btn1_lvl;
|
||||
lv_obj_t * btn2;
|
||||
lv_obj_t * btn3;
|
||||
lv_obj_t * btn3_lvl;
|
||||
lv_obj_t * btn4;
|
||||
lv_task_t* taskUpdate;
|
||||
lv_obj_t* batteryIcon;
|
||||
lv_obj_t* label_time;
|
||||
|
||||
lv_obj_t* btn1;
|
||||
lv_obj_t* btn1_lvl;
|
||||
lv_obj_t* btn2;
|
||||
lv_obj_t* btn3;
|
||||
lv_obj_t* btn3_lvl;
|
||||
lv_obj_t* btn4;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -8,19 +8,16 @@
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
namespace {
|
||||
static void event_handler(lv_obj_t * obj, lv_event_t event) {
|
||||
SettingDisplay* screen = static_cast<SettingDisplay *>(obj->user_data);
|
||||
static void event_handler(lv_obj_t* obj, lv_event_t event) {
|
||||
SettingDisplay* screen = static_cast<SettingDisplay*>(obj->user_data);
|
||||
screen->UpdateSelected(obj, event);
|
||||
}
|
||||
}
|
||||
|
||||
SettingDisplay::SettingDisplay(
|
||||
Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Settings &settingsController) :
|
||||
Screen(app),
|
||||
settingsController{settingsController}
|
||||
{
|
||||
SettingDisplay::SettingDisplay(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
|
||||
: Screen(app), settingsController {settingsController} {
|
||||
|
||||
lv_obj_t * container1 = lv_cont_create(lv_scr_act(), nullptr);
|
||||
lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr);
|
||||
|
||||
lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
|
||||
lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10);
|
||||
@@ -32,31 +29,31 @@ SettingDisplay::SettingDisplay(
|
||||
lv_obj_set_height(container1, LV_VER_RES - 50);
|
||||
lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT);
|
||||
|
||||
lv_obj_t * title = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text_static(title,"Display timeout");
|
||||
lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text_static(title, "Display timeout");
|
||||
lv_label_set_align(title, LV_LABEL_ALIGN_CENTER);
|
||||
lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 10, 15);
|
||||
|
||||
lv_obj_t * icon = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
|
||||
lv_label_set_text_static(icon, Symbols::sun);
|
||||
lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER);
|
||||
lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0);
|
||||
|
||||
|
||||
optionsTotal = 0;
|
||||
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
|
||||
lv_checkbox_set_text_static(cbOption[optionsTotal], " 5 seconds");
|
||||
cbOption[optionsTotal]->user_data = this;
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.GetScreenTimeOut() == 5000 ) {
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.GetScreenTimeOut() == 5000) {
|
||||
lv_checkbox_set_checked(cbOption[optionsTotal], true);
|
||||
}
|
||||
optionsTotal++;
|
||||
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
|
||||
lv_checkbox_set_text_static(cbOption[optionsTotal], " 15 seconds");
|
||||
cbOption[optionsTotal]->user_data = this;
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.GetScreenTimeOut() == 15000 ) {
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.GetScreenTimeOut() == 15000) {
|
||||
lv_checkbox_set_checked(cbOption[optionsTotal], true);
|
||||
}
|
||||
optionsTotal++;
|
||||
@@ -64,7 +61,7 @@ SettingDisplay::SettingDisplay(
|
||||
lv_checkbox_set_text_static(cbOption[optionsTotal], " 20 seconds");
|
||||
cbOption[optionsTotal]->user_data = this;
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.GetScreenTimeOut() == 20000 ) {
|
||||
if (settingsController.GetScreenTimeOut() == 20000) {
|
||||
lv_checkbox_set_checked(cbOption[optionsTotal], true);
|
||||
}
|
||||
optionsTotal++;
|
||||
@@ -72,7 +69,7 @@ SettingDisplay::SettingDisplay(
|
||||
lv_checkbox_set_text_static(cbOption[optionsTotal], " 30 seconds");
|
||||
cbOption[optionsTotal]->user_data = this;
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.GetScreenTimeOut() == 30000 ) {
|
||||
if (settingsController.GetScreenTimeOut() == 30000) {
|
||||
lv_checkbox_set_checked(cbOption[optionsTotal], true);
|
||||
}
|
||||
optionsTotal++;
|
||||
@@ -87,18 +84,25 @@ bool SettingDisplay::Refresh() {
|
||||
return running;
|
||||
}
|
||||
|
||||
|
||||
void SettingDisplay::UpdateSelected(lv_obj_t *object, lv_event_t event) {
|
||||
if(event == LV_EVENT_VALUE_CHANGED) {
|
||||
for(int i = 0; i < optionsTotal; i++) {
|
||||
if ( object == cbOption[i] ) {
|
||||
void SettingDisplay::UpdateSelected(lv_obj_t* object, lv_event_t event) {
|
||||
if (event == LV_EVENT_VALUE_CHANGED) {
|
||||
for (int i = 0; i < optionsTotal; i++) {
|
||||
if (object == cbOption[i]) {
|
||||
lv_checkbox_set_checked(cbOption[i], true);
|
||||
|
||||
if ( i == 0 ) { settingsController.SetScreenTimeOut(5000); };
|
||||
if ( i == 1 ) { settingsController.SetScreenTimeOut(15000); };
|
||||
if ( i == 2 ) { settingsController.SetScreenTimeOut(20000); };
|
||||
if ( i == 3 ) { settingsController.SetScreenTimeOut(30000); };
|
||||
|
||||
|
||||
if (i == 0) {
|
||||
settingsController.SetScreenTimeOut(5000);
|
||||
};
|
||||
if (i == 1) {
|
||||
settingsController.SetScreenTimeOut(15000);
|
||||
};
|
||||
if (i == 2) {
|
||||
settingsController.SetScreenTimeOut(20000);
|
||||
};
|
||||
if (i == 3) {
|
||||
settingsController.SetScreenTimeOut(30000);
|
||||
};
|
||||
|
||||
app->PushMessage(Applications::Display::Messages::UpdateTimeOut);
|
||||
|
||||
} else {
|
||||
|
@@ -10,20 +10,18 @@ namespace Pinetime {
|
||||
namespace Applications {
|
||||
namespace Screens {
|
||||
|
||||
class SettingDisplay : public Screen{
|
||||
public:
|
||||
SettingDisplay(DisplayApp* app, Pinetime::Controllers::Settings &settingsController);
|
||||
~SettingDisplay() override;
|
||||
class SettingDisplay : public Screen {
|
||||
public:
|
||||
SettingDisplay(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
|
||||
~SettingDisplay() override;
|
||||
|
||||
bool Refresh() override;
|
||||
void UpdateSelected(lv_obj_t *object, lv_event_t event);
|
||||
|
||||
private:
|
||||
bool Refresh() override;
|
||||
void UpdateSelected(lv_obj_t* object, lv_event_t event);
|
||||
|
||||
Controllers::Settings& settingsController;
|
||||
uint8_t optionsTotal;
|
||||
lv_obj_t * cbOption[4];
|
||||
|
||||
private:
|
||||
Controllers::Settings& settingsController;
|
||||
uint8_t optionsTotal;
|
||||
lv_obj_t* cbOption[4];
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -7,19 +7,16 @@
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
namespace {
|
||||
static void event_handler(lv_obj_t * obj, lv_event_t event) {
|
||||
SettingTimeFormat* screen = static_cast<SettingTimeFormat *>(obj->user_data);
|
||||
static void event_handler(lv_obj_t* obj, lv_event_t event) {
|
||||
SettingTimeFormat* screen = static_cast<SettingTimeFormat*>(obj->user_data);
|
||||
screen->UpdateSelected(obj, event);
|
||||
}
|
||||
}
|
||||
|
||||
SettingTimeFormat::SettingTimeFormat(
|
||||
Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Settings &settingsController) :
|
||||
Screen(app),
|
||||
settingsController{settingsController}
|
||||
{
|
||||
SettingTimeFormat::SettingTimeFormat(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
|
||||
: Screen(app), settingsController {settingsController} {
|
||||
|
||||
lv_obj_t * container1 = lv_cont_create(lv_scr_act(), nullptr);
|
||||
lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr);
|
||||
|
||||
lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
|
||||
lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10);
|
||||
@@ -31,12 +28,12 @@ SettingTimeFormat::SettingTimeFormat(
|
||||
lv_obj_set_height(container1, LV_VER_RES - 50);
|
||||
lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT);
|
||||
|
||||
lv_obj_t * title = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text_static(title,"Time format");
|
||||
lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text_static(title, "Time format");
|
||||
lv_label_set_align(title, LV_LABEL_ALIGN_CENTER);
|
||||
lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 15, 15);
|
||||
|
||||
lv_obj_t * icon = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
|
||||
lv_label_set_text_static(icon, Symbols::clock);
|
||||
lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER);
|
||||
@@ -46,8 +43,8 @@ SettingTimeFormat::SettingTimeFormat(
|
||||
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
|
||||
lv_checkbox_set_text_static(cbOption[optionsTotal], " 12-hour");
|
||||
cbOption[optionsTotal]->user_data = this;
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12 ) {
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) {
|
||||
lv_checkbox_set_checked(cbOption[optionsTotal], true);
|
||||
}
|
||||
|
||||
@@ -55,8 +52,8 @@ SettingTimeFormat::SettingTimeFormat(
|
||||
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
|
||||
lv_checkbox_set_text_static(cbOption[optionsTotal], " 24-hour");
|
||||
cbOption[optionsTotal]->user_data = this;
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24 ) {
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) {
|
||||
lv_checkbox_set_checked(cbOption[optionsTotal], true);
|
||||
}
|
||||
optionsTotal++;
|
||||
@@ -71,16 +68,19 @@ bool SettingTimeFormat::Refresh() {
|
||||
return running;
|
||||
}
|
||||
|
||||
|
||||
void SettingTimeFormat::UpdateSelected(lv_obj_t *object, lv_event_t event) {
|
||||
if(event == LV_EVENT_VALUE_CHANGED) {
|
||||
for(int i = 0; i < optionsTotal; i++) {
|
||||
if ( object == cbOption[i] ) {
|
||||
void SettingTimeFormat::UpdateSelected(lv_obj_t* object, lv_event_t event) {
|
||||
if (event == LV_EVENT_VALUE_CHANGED) {
|
||||
for (int i = 0; i < optionsTotal; i++) {
|
||||
if (object == cbOption[i]) {
|
||||
lv_checkbox_set_checked(cbOption[i], true);
|
||||
|
||||
if ( i == 0 ) { settingsController.SetClockType(Controllers::Settings::ClockType::H12); };
|
||||
if ( i == 1 ) { settingsController.SetClockType(Controllers::Settings::ClockType::H24); };
|
||||
|
||||
|
||||
if (i == 0) {
|
||||
settingsController.SetClockType(Controllers::Settings::ClockType::H12);
|
||||
};
|
||||
if (i == 1) {
|
||||
settingsController.SetClockType(Controllers::Settings::ClockType::H24);
|
||||
};
|
||||
|
||||
} else {
|
||||
lv_checkbox_set_checked(cbOption[i], false);
|
||||
}
|
||||
|
@@ -10,20 +10,18 @@ namespace Pinetime {
|
||||
namespace Applications {
|
||||
namespace Screens {
|
||||
|
||||
class SettingTimeFormat : public Screen{
|
||||
public:
|
||||
SettingTimeFormat(DisplayApp* app, Pinetime::Controllers::Settings &settingsController);
|
||||
~SettingTimeFormat() override;
|
||||
class SettingTimeFormat : public Screen {
|
||||
public:
|
||||
SettingTimeFormat(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
|
||||
~SettingTimeFormat() override;
|
||||
|
||||
bool Refresh() override;
|
||||
void UpdateSelected(lv_obj_t *object, lv_event_t event);
|
||||
|
||||
private:
|
||||
bool Refresh() override;
|
||||
void UpdateSelected(lv_obj_t* object, lv_event_t event);
|
||||
|
||||
Controllers::Settings& settingsController;
|
||||
uint8_t optionsTotal;
|
||||
lv_obj_t * cbOption[2];
|
||||
|
||||
private:
|
||||
Controllers::Settings& settingsController;
|
||||
uint8_t optionsTotal;
|
||||
lv_obj_t* cbOption[2];
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -8,19 +8,16 @@
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
namespace {
|
||||
static void event_handler(lv_obj_t * obj, lv_event_t event) {
|
||||
SettingWakeUp* screen = static_cast<SettingWakeUp *>(obj->user_data);
|
||||
static void event_handler(lv_obj_t* obj, lv_event_t event) {
|
||||
SettingWakeUp* screen = static_cast<SettingWakeUp*>(obj->user_data);
|
||||
screen->UpdateSelected(obj, event);
|
||||
}
|
||||
}
|
||||
|
||||
SettingWakeUp::SettingWakeUp(
|
||||
Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Settings &settingsController) :
|
||||
Screen(app),
|
||||
settingsController{settingsController}
|
||||
{
|
||||
SettingWakeUp::SettingWakeUp(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
|
||||
: Screen(app), settingsController {settingsController} {
|
||||
|
||||
lv_obj_t * container1 = lv_cont_create(lv_scr_act(), nullptr);
|
||||
lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr);
|
||||
|
||||
lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
|
||||
lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10);
|
||||
@@ -32,12 +29,12 @@ SettingWakeUp::SettingWakeUp(
|
||||
lv_obj_set_height(container1, LV_VER_RES - 50);
|
||||
lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT);
|
||||
|
||||
lv_obj_t * title = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text_static(title,"Wake Up");
|
||||
lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text_static(title, "Wake Up");
|
||||
lv_label_set_align(title, LV_LABEL_ALIGN_CENTER);
|
||||
lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 15, 15);
|
||||
|
||||
lv_obj_t * icon = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
|
||||
lv_label_set_text_static(icon, Symbols::clock);
|
||||
lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER);
|
||||
@@ -47,32 +44,32 @@ SettingWakeUp::SettingWakeUp(
|
||||
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
|
||||
lv_checkbox_set_text_static(cbOption[optionsTotal], " None");
|
||||
cbOption[optionsTotal]->user_data = this;
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::None ) {
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::None) {
|
||||
lv_checkbox_set_checked(cbOption[optionsTotal], true);
|
||||
}
|
||||
optionsTotal++;
|
||||
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
|
||||
lv_checkbox_set_text_static(cbOption[optionsTotal], " Single Tap");
|
||||
cbOption[optionsTotal]->user_data = this;
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::SingleTap ) {
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::SingleTap) {
|
||||
lv_checkbox_set_checked(cbOption[optionsTotal], true);
|
||||
}
|
||||
optionsTotal++;
|
||||
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
|
||||
lv_checkbox_set_text_static(cbOption[optionsTotal], " Double Tap");
|
||||
cbOption[optionsTotal]->user_data = this;
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::DoubleTap ) {
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::DoubleTap) {
|
||||
lv_checkbox_set_checked(cbOption[optionsTotal], true);
|
||||
}
|
||||
optionsTotal++;
|
||||
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
|
||||
lv_checkbox_set_text_static(cbOption[optionsTotal], " Raise Wrist");
|
||||
cbOption[optionsTotal]->user_data = this;
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist ) {
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist) {
|
||||
lv_checkbox_set_checked(cbOption[optionsTotal], true);
|
||||
}
|
||||
optionsTotal++;
|
||||
@@ -87,18 +84,25 @@ bool SettingWakeUp::Refresh() {
|
||||
return running;
|
||||
}
|
||||
|
||||
|
||||
void SettingWakeUp::UpdateSelected(lv_obj_t *object, lv_event_t event) {
|
||||
if(event == LV_EVENT_VALUE_CHANGED) {
|
||||
for(int i = 0; i < optionsTotal; i++) {
|
||||
if ( object == cbOption[i] ) {
|
||||
void SettingWakeUp::UpdateSelected(lv_obj_t* object, lv_event_t event) {
|
||||
if (event == LV_EVENT_VALUE_CHANGED) {
|
||||
for (int i = 0; i < optionsTotal; i++) {
|
||||
if (object == cbOption[i]) {
|
||||
lv_checkbox_set_checked(cbOption[i], true);
|
||||
|
||||
if ( i == 0 ) { settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::None); };
|
||||
if ( i == 1 ) { settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::SingleTap); };
|
||||
if ( i == 2 ) { settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap); };
|
||||
if ( i == 3 ) { settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist); };
|
||||
|
||||
|
||||
if (i == 0) {
|
||||
settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::None);
|
||||
};
|
||||
if (i == 1) {
|
||||
settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::SingleTap);
|
||||
};
|
||||
if (i == 2) {
|
||||
settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap);
|
||||
};
|
||||
if (i == 3) {
|
||||
settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist);
|
||||
};
|
||||
|
||||
} else {
|
||||
lv_checkbox_set_checked(cbOption[i], false);
|
||||
}
|
||||
|
@@ -10,20 +10,18 @@ namespace Pinetime {
|
||||
namespace Applications {
|
||||
namespace Screens {
|
||||
|
||||
class SettingWakeUp : public Screen{
|
||||
public:
|
||||
SettingWakeUp(DisplayApp* app, Pinetime::Controllers::Settings &settingsController);
|
||||
~SettingWakeUp() override;
|
||||
class SettingWakeUp : public Screen {
|
||||
public:
|
||||
SettingWakeUp(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
|
||||
~SettingWakeUp() override;
|
||||
|
||||
bool Refresh() override;
|
||||
void UpdateSelected(lv_obj_t *object, lv_event_t event);
|
||||
|
||||
private:
|
||||
bool Refresh() override;
|
||||
void UpdateSelected(lv_obj_t* object, lv_event_t event);
|
||||
|
||||
Controllers::Settings& settingsController;
|
||||
uint8_t optionsTotal;
|
||||
lv_obj_t * cbOption[4];
|
||||
|
||||
private:
|
||||
Controllers::Settings& settingsController;
|
||||
uint8_t optionsTotal;
|
||||
lv_obj_t* cbOption[4];
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -7,21 +7,18 @@
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
namespace {
|
||||
static void event_handler(lv_obj_t * obj, lv_event_t event) {
|
||||
SettingWatchFace* screen = static_cast<SettingWatchFace *>(obj->user_data);
|
||||
static void event_handler(lv_obj_t* obj, lv_event_t event) {
|
||||
SettingWatchFace* screen = static_cast<SettingWatchFace*>(obj->user_data);
|
||||
screen->UpdateSelected(obj, event);
|
||||
}
|
||||
}
|
||||
|
||||
SettingWatchFace::SettingWatchFace(
|
||||
Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Settings &settingsController) :
|
||||
Screen(app),
|
||||
settingsController{settingsController}
|
||||
{
|
||||
SettingWatchFace::SettingWatchFace(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
|
||||
: Screen(app), settingsController {settingsController} {
|
||||
|
||||
lv_obj_t * container1 = lv_cont_create(lv_scr_act(), nullptr);
|
||||
lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr);
|
||||
|
||||
//lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
|
||||
// lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
|
||||
lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
|
||||
lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10);
|
||||
lv_obj_set_style_local_pad_inner(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 5);
|
||||
@@ -32,12 +29,12 @@ SettingWatchFace::SettingWatchFace(
|
||||
lv_obj_set_height(container1, LV_VER_RES - 50);
|
||||
lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT);
|
||||
|
||||
lv_obj_t * title = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text_static(title,"Watch face");
|
||||
lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text_static(title, "Watch face");
|
||||
lv_label_set_align(title, LV_LABEL_ALIGN_CENTER);
|
||||
lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 10, 15);
|
||||
|
||||
lv_obj_t * icon = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
|
||||
lv_label_set_text_static(icon, Symbols::clock);
|
||||
lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER);
|
||||
@@ -47,8 +44,8 @@ SettingWatchFace::SettingWatchFace(
|
||||
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
|
||||
lv_checkbox_set_text_static(cbOption[optionsTotal], " Digital face");
|
||||
cbOption[optionsTotal]->user_data = this;
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.GetClockFace() == 0 ) {
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.GetClockFace() == 0) {
|
||||
lv_checkbox_set_checked(cbOption[optionsTotal], true);
|
||||
}
|
||||
|
||||
@@ -56,8 +53,8 @@ SettingWatchFace::SettingWatchFace(
|
||||
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
|
||||
lv_checkbox_set_text_static(cbOption[optionsTotal], " Analog face");
|
||||
cbOption[optionsTotal]->user_data = this;
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.GetClockFace() == 1 ) {
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.GetClockFace() == 1) {
|
||||
lv_checkbox_set_checked(cbOption[optionsTotal], true);
|
||||
}
|
||||
|
||||
@@ -73,11 +70,10 @@ bool SettingWatchFace::Refresh() {
|
||||
return running;
|
||||
}
|
||||
|
||||
|
||||
void SettingWatchFace::UpdateSelected(lv_obj_t *object, lv_event_t event) {
|
||||
if(event == LV_EVENT_VALUE_CHANGED) {
|
||||
for(uint8_t i = 0; i < optionsTotal; i++) {
|
||||
if ( object == cbOption[i] ) {
|
||||
void SettingWatchFace::UpdateSelected(lv_obj_t* object, lv_event_t event) {
|
||||
if (event == LV_EVENT_VALUE_CHANGED) {
|
||||
for (uint8_t i = 0; i < optionsTotal; i++) {
|
||||
if (object == cbOption[i]) {
|
||||
lv_checkbox_set_checked(cbOption[i], true);
|
||||
settingsController.SetClockFace(i);
|
||||
} else {
|
||||
|
@@ -10,20 +10,18 @@ namespace Pinetime {
|
||||
namespace Applications {
|
||||
namespace Screens {
|
||||
|
||||
class SettingWatchFace : public Screen{
|
||||
public:
|
||||
SettingWatchFace(DisplayApp* app, Pinetime::Controllers::Settings &settingsController);
|
||||
~SettingWatchFace() override;
|
||||
class SettingWatchFace : public Screen {
|
||||
public:
|
||||
SettingWatchFace(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
|
||||
~SettingWatchFace() override;
|
||||
|
||||
bool Refresh() override;
|
||||
void UpdateSelected(lv_obj_t *object, lv_event_t event);
|
||||
|
||||
private:
|
||||
bool Refresh() override;
|
||||
void UpdateSelected(lv_obj_t* object, lv_event_t event);
|
||||
|
||||
Controllers::Settings& settingsController;
|
||||
uint8_t optionsTotal;
|
||||
lv_obj_t * cbOption[2];
|
||||
|
||||
private:
|
||||
Controllers::Settings& settingsController;
|
||||
uint8_t optionsTotal;
|
||||
lv_obj_t* cbOption[2];
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -8,27 +8,27 @@
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
Settings::Settings(
|
||||
Pinetime::Applications::DisplayApp *app,
|
||||
Pinetime::Controllers::Settings &settingsController) :
|
||||
Screen(app),
|
||||
settingsController{settingsController},
|
||||
screens{app,
|
||||
settingsController.GetSettingsMenu(),
|
||||
{
|
||||
[this]() -> std::unique_ptr<Screen> { return CreateScreen1(); },
|
||||
[this]() -> std::unique_ptr<Screen> { return CreateScreen2(); }
|
||||
},
|
||||
Screens::ScreenListModes::UpDown
|
||||
} {}
|
||||
Settings::Settings(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
|
||||
: Screen(app),
|
||||
settingsController {settingsController},
|
||||
screens {app,
|
||||
settingsController.GetSettingsMenu(),
|
||||
{[this]() -> std::unique_ptr<Screen> {
|
||||
return CreateScreen1();
|
||||
},
|
||||
[this]() -> std::unique_ptr<Screen> {
|
||||
return CreateScreen2();
|
||||
}},
|
||||
Screens::ScreenListModes::UpDown} {
|
||||
}
|
||||
|
||||
Settings::~Settings() {
|
||||
lv_obj_clean(lv_scr_act());
|
||||
}
|
||||
|
||||
bool Settings::Refresh() {
|
||||
|
||||
if(running)
|
||||
|
||||
if (running)
|
||||
running = screens.Refresh();
|
||||
return running;
|
||||
}
|
||||
@@ -39,31 +39,24 @@ bool Settings::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
||||
|
||||
std::unique_ptr<Screen> Settings::CreateScreen1() {
|
||||
|
||||
std::array<Screens::List::Applications, 4> applications {
|
||||
{
|
||||
{Symbols::sun, "Display", Apps::SettingDisplay},
|
||||
{Symbols::clock, "Wake Up", Apps::SettingWakeUp},
|
||||
{Symbols::clock, "Time format", Apps::SettingTimeFormat},
|
||||
{Symbols::clock, "Watch face", Apps::SettingWatchFace},
|
||||
}
|
||||
|
||||
};
|
||||
std::array<Screens::List::Applications, 4> applications {{
|
||||
{Symbols::sun, "Display", Apps::SettingDisplay},
|
||||
{Symbols::clock, "Wake Up", Apps::SettingWakeUp},
|
||||
{Symbols::clock, "Time format", Apps::SettingTimeFormat},
|
||||
{Symbols::clock, "Watch face", Apps::SettingWatchFace},
|
||||
}};
|
||||
|
||||
return std::unique_ptr<Screen>(new Screens::List(0, 2, app, settingsController, applications));
|
||||
}
|
||||
|
||||
|
||||
std::unique_ptr<Screen> Settings::CreateScreen2() {
|
||||
|
||||
std::array<Screens::List::Applications, 4> applications {
|
||||
{
|
||||
{Symbols::shoe, "Steps", Apps::SettingSteps},
|
||||
{Symbols::batteryHalf, "Battery", Apps::BatteryInfo},
|
||||
{Symbols::check, "Firmware", Apps::FirmwareValidation},
|
||||
{Symbols::list, "About", Apps::SysInfo},
|
||||
}
|
||||
|
||||
};
|
||||
std::array<Screens::List::Applications, 4> applications {{
|
||||
{Symbols::shoe, "Steps", Apps::SettingSteps},
|
||||
{Symbols::batteryHalf, "Battery", Apps::BatteryInfo},
|
||||
{Symbols::check, "Firmware", Apps::FirmwareValidation},
|
||||
{Symbols::list, "About", Apps::SysInfo},
|
||||
}};
|
||||
|
||||
return std::unique_ptr<Screen>(new Screens::List(1, 2, app, settingsController, applications));
|
||||
}
|
||||
|
@@ -6,31 +6,26 @@
|
||||
|
||||
namespace Pinetime {
|
||||
|
||||
|
||||
namespace Applications {
|
||||
namespace Screens {
|
||||
|
||||
class Settings : public Screen{
|
||||
public:
|
||||
Settings(DisplayApp* app,
|
||||
Pinetime::Controllers::Settings &settingsController);
|
||||
~Settings() override;
|
||||
class Settings : public Screen {
|
||||
public:
|
||||
Settings(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
|
||||
~Settings() override;
|
||||
|
||||
bool Refresh() override;
|
||||
|
||||
void OnButtonEvent(lv_obj_t *object, lv_event_t event);
|
||||
bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
|
||||
bool Refresh() override;
|
||||
|
||||
private:
|
||||
void OnButtonEvent(lv_obj_t* object, lv_event_t event);
|
||||
bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
|
||||
|
||||
Controllers::Settings& settingsController;
|
||||
|
||||
ScreenList<2> screens;
|
||||
|
||||
std::unique_ptr<Screen> CreateScreen1();
|
||||
std::unique_ptr<Screen> CreateScreen2();
|
||||
private:
|
||||
Controllers::Settings& settingsController;
|
||||
|
||||
ScreenList<2> screens;
|
||||
|
||||
std::unique_ptr<Screen> CreateScreen1();
|
||||
std::unique_ptr<Screen> CreateScreen2();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user