summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/List.cpp
diff options
context:
space:
mode:
authorAvamander <avamander@gmail.com>2021-04-18 20:28:14 +0300
committerAvamander <avamander@gmail.com>2021-04-24 11:39:53 +0300
commit40d45d923b033363ff1304b47eac238dd4495a57 (patch)
tree9e7b668fdf23a7be892b8e2bf8b4d62b884cee06 /src/displayapp/screens/List.cpp
parente56ebb8bd621cc8838e86fa032d680a6e7a35ffc (diff)
Reformatted all the files according to clang-format style
Diffstat (limited to 'src/displayapp/screens/List.cpp')
-rw-r--r--src/displayapp/screens/List.cpp48
1 files changed, 21 insertions, 27 deletions
diff --git a/src/displayapp/screens/List.cpp b/src/displayapp/screens/List.cpp
index 82da4d4c..b4f4d2cf 100644
--- a/src/displayapp/screens/List.cpp
+++ b/src/displayapp/screens/List.cpp
@@ -5,39 +5,37 @@
using namespace Pinetime::Applications::Screens;
namespace {
- static void ButtonEventHandler(lv_obj_t * obj, lv_event_t event) {
- List* screen = static_cast<List *>(obj->user_data);
+ static void ButtonEventHandler(lv_obj_t* obj, lv_event_t event) {
+ List* screen = static_cast<List*>(obj->user_data);
screen->OnButtonEvent(obj, event);
}
}
-List::List(uint8_t screenID, uint8_t numScreens,
- DisplayApp* app,
- Controllers::Settings &settingsController,
- std::array<Applications, MAXLISTITEMS>& applications) :
- Screen(app),
- settingsController{settingsController}
-{
+List::List(uint8_t screenID,
+ uint8_t numScreens,
+ DisplayApp* app,
+ Controllers::Settings& settingsController,
+ std::array<Applications, MAXLISTITEMS>& applications)
+ : Screen(app), settingsController {settingsController} {
// Set the background to Black
lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(0, 0, 0));
settingsController.SetSettingsMenu(screenID);
- if ( numScreens > 1 ) {
+ if (numScreens > 1) {
pageIndicatorBasePoints[0].x = 240 - 1;
pageIndicatorBasePoints[0].y = 6;
pageIndicatorBasePoints[1].x = 240 - 1;
pageIndicatorBasePoints[1].y = 240 - 6;
-
+
pageIndicatorBase = lv_line_create(lv_scr_act(), NULL);
lv_obj_set_style_local_line_width(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3);
lv_obj_set_style_local_line_color(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
lv_obj_set_style_local_line_rounded(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, true);
lv_line_set_points(pageIndicatorBase, pageIndicatorBasePoints, 2);
-
uint16_t indicatorSize = 228 / numScreens;
uint16_t indicatorPos = indicatorSize * screenID;
@@ -53,10 +51,9 @@ List::List(uint8_t screenID, uint8_t numScreens,
lv_line_set_points(pageIndicator, pageIndicatorPoints, 2);
}
-
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);
@@ -67,12 +64,12 @@ List::List(uint8_t screenID, uint8_t numScreens,
lv_obj_set_height(container1, LV_VER_RES);
lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT);
- lv_obj_t * labelBt;
- lv_obj_t * labelBtIco;
+ lv_obj_t* labelBt;
+ lv_obj_t* labelBtIco;
- for(int i = 0; i < MAXLISTITEMS; i++) {
+ for (int i = 0; i < MAXLISTITEMS; i++) {
apps[i] = applications[i].application;
- if ( applications[i].application != Apps::None) {
+ if (applications[i].application != Apps::None) {
itemApps[i] = lv_btn_create(container1, nullptr);
lv_obj_set_style_local_bg_opa(itemApps[i], LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_20);
@@ -91,19 +88,17 @@ List::List(uint8_t screenID, uint8_t numScreens,
labelBt = lv_label_create(itemApps[i], nullptr);
lv_label_set_text_fmt(labelBt, " %s", applications[i].name);
-
}
}
- 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, LV_HOR_RES, LV_VER_RES);
lv_obj_set_pos(backgroundLabel, 0, 0);
lv_label_set_text_static(backgroundLabel, "");
-
}
-List::~List() {
+List::~List() {
lv_obj_clean(lv_scr_act());
}
@@ -112,10 +107,10 @@ bool List::Refresh() {
return running;
}
-void List::OnButtonEvent(lv_obj_t * object, lv_event_t event) {
- if ( event == LV_EVENT_RELEASED ) {
- for(int i = 0; i < MAXLISTITEMS; i++) {
- if ( apps[i] != Apps::None && object == itemApps[i] ) {
+void List::OnButtonEvent(lv_obj_t* object, lv_event_t event) {
+ if (event == LV_EVENT_RELEASED) {
+ for (int i = 0; i < MAXLISTITEMS; i++) {
+ if (apps[i] != Apps::None && object == itemApps[i]) {
app->StartApp(apps[i], DisplayApp::FullRefreshDirections::Up);
running = false;
return;
@@ -123,4 +118,3 @@ void List::OnButtonEvent(lv_obj_t * object, lv_event_t event) {
}
}
}
-