@@ -29,7 +29,7 @@ Tile::Tile(uint8_t screenID,
2929 Pinetime::Controllers::Battery& batteryController,
3030 Controllers::DateTime& dateTimeController,
3131 std::array<Applications, 6 >& applications)
32- : Screen(app), batteryController {batteryController}, dateTimeController {dateTimeController} {
32+ : Screen(app), batteryController {batteryController}, dateTimeController {dateTimeController}, pageIndicator(screenID, numScreens) {
3333
3434 settingsController.SetAppMenu (screenID);
3535
@@ -42,30 +42,7 @@ Tile::Tile(uint8_t screenID,
4242 batteryIcon.Create (lv_scr_act ());
4343 lv_obj_align (batteryIcon.GetObject (), nullptr , LV_ALIGN_IN_TOP_RIGHT, -8 , 0 );
4444
45- if (numScreens > 1 ) {
46- pageIndicatorBasePoints[0 ].x = LV_HOR_RES - 1 ;
47- pageIndicatorBasePoints[0 ].y = 0 ;
48- pageIndicatorBasePoints[1 ].x = LV_HOR_RES - 1 ;
49- pageIndicatorBasePoints[1 ].y = LV_VER_RES;
50-
51- pageIndicatorBase = lv_line_create (lv_scr_act (), nullptr );
52- lv_obj_set_style_local_line_width (pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3 );
53- lv_obj_set_style_local_line_color (pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex (0x111111 ));
54- lv_line_set_points (pageIndicatorBase, pageIndicatorBasePoints, 2 );
55-
56- const uint16_t indicatorSize = LV_VER_RES / numScreens;
57- const uint16_t indicatorPos = indicatorSize * screenID;
58-
59- pageIndicatorPoints[0 ].x = LV_HOR_RES - 1 ;
60- pageIndicatorPoints[0 ].y = indicatorPos;
61- pageIndicatorPoints[1 ].x = LV_HOR_RES - 1 ;
62- pageIndicatorPoints[1 ].y = indicatorPos + indicatorSize;
63-
64- pageIndicator = lv_line_create (lv_scr_act (), nullptr );
65- lv_obj_set_style_local_line_width (pageIndicator, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3 );
66- lv_obj_set_style_local_line_color (pageIndicator, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE (0xb0 , 0xb0 , 0xb0 ));
67- lv_line_set_points (pageIndicator, pageIndicatorPoints, 2 );
68- }
45+ pageIndicator.Create ();
6946
7047 uint8_t btIndex = 0 ;
7148 for (uint8_t i = 0 ; i < 6 ; i++) {
0 commit comments