PineTimeStyle
This commit is contained in:
		
							parent
							
								
									378fa6b401
								
							
						
					
					
						commit
						a4968b5029
					
				
							
								
								
									
										1261
									
								
								src/displayapp/fonts/open_sans_light.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1261
									
								
								src/displayapp/fonts/open_sans_light.c
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										294
									
								
								src/displayapp/screens/PineTimeStyle.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										294
									
								
								src/displayapp/screens/PineTimeStyle.cpp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,294 @@
 | 
			
		||||
#include "PineTimeStyle.h"
 | 
			
		||||
 | 
			
		||||
#include <date/date.h>
 | 
			
		||||
#include <lvgl/lvgl.h>
 | 
			
		||||
#include <cstdio>
 | 
			
		||||
#include "BatteryIcon.h"
 | 
			
		||||
#include "BleIcon.h"
 | 
			
		||||
#include "NotificationIcon.h"
 | 
			
		||||
#include "Symbols.h"
 | 
			
		||||
#include "components/battery/BatteryController.h"
 | 
			
		||||
#include "components/ble/BleController.h"
 | 
			
		||||
#include "components/ble/NotificationManager.h"
 | 
			
		||||
#include "components/heartrate/HeartRateController.h"
 | 
			
		||||
#include "components/settings/Settings.h"
 | 
			
		||||
#include "../DisplayApp.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * PineTimeStyle watchface for Infinitime created by Kieran Cawthray
 | 
			
		||||
 * Based on WatchFaceDigital
 | 
			
		||||
 * Style/layout copied from TimeStyle for Pebble by Dan Tilden (github.com/tilden)
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
using namespace Pinetime::Applications::Screens;
 | 
			
		||||
 | 
			
		||||
PineTimeStyle::PineTimeStyle(DisplayApp* app,
 | 
			
		||||
                             Controllers::DateTime& dateTimeController,
 | 
			
		||||
                             Controllers::Battery& batteryController,
 | 
			
		||||
                             Controllers::Ble& bleController,
 | 
			
		||||
                             Controllers::NotificationManager& notificatioManager,
 | 
			
		||||
                             Controllers::Settings& settingsController,
 | 
			
		||||
                             Controllers::HeartRateController& heartRateController)
 | 
			
		||||
  : Screen(app),
 | 
			
		||||
    currentDateTime {{}},
 | 
			
		||||
    dateTimeController {dateTimeController},
 | 
			
		||||
    batteryController {batteryController},
 | 
			
		||||
    bleController {bleController},
 | 
			
		||||
    notificatioManager {notificatioManager},
 | 
			
		||||
    settingsController {settingsController},
 | 
			
		||||
    heartRateController {heartRateController} {
 | 
			
		||||
 | 
			
		||||
  /* This sets the watchface number to return to after leaving the menu*/
 | 
			
		||||
  settingsController.SetClockFace(2);
 | 
			
		||||
 | 
			
		||||
  displayedChar[0] = 0;
 | 
			
		||||
  displayedChar[1] = 0;
 | 
			
		||||
  displayedChar[2] = 0;
 | 
			
		||||
  displayedChar[3] = 0;
 | 
			
		||||
  displayedChar[4] = 0;
 | 
			
		||||
 | 
			
		||||
  /*Create a 200px wide background rectangle*/
 | 
			
		||||
 | 
			
		||||
  timebar = lv_obj_create(lv_scr_act(), nullptr);
 | 
			
		||||
  lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
 | 
			
		||||
  lv_obj_set_style_local_radius(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0);
 | 
			
		||||
  lv_obj_set_size(timebar, 200, 240);
 | 
			
		||||
  lv_obj_align(timebar, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 5, 0);
 | 
			
		||||
 | 
			
		||||
  /*Display the time*/
 | 
			
		||||
 | 
			
		||||
  timeDD1 = lv_label_create(lv_scr_act(), nullptr);
 | 
			
		||||
  lv_obj_set_style_local_text_font(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &open_sans_light);
 | 
			
		||||
  lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x008080));
 | 
			
		||||
  lv_label_set_text(timeDD1, "12");
 | 
			
		||||
  lv_obj_align(timeDD1, timebar, LV_ALIGN_IN_TOP_MID, 5, 5);
 | 
			
		||||
 | 
			
		||||
  timeDD2 = lv_label_create(lv_scr_act(), nullptr);
 | 
			
		||||
  lv_obj_set_style_local_text_font(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &open_sans_light);
 | 
			
		||||
  lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x008080));
 | 
			
		||||
  lv_label_set_text(timeDD2, "34");
 | 
			
		||||
  lv_obj_align(timeDD2, timebar, LV_ALIGN_IN_BOTTOM_MID, 5, -5);
 | 
			
		||||
 | 
			
		||||
  /*Create a 40px wide bar down the right side of the screen*/
 | 
			
		||||
 | 
			
		||||
  sidebar = lv_obj_create(lv_scr_act(), nullptr);
 | 
			
		||||
  lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x008080));
 | 
			
		||||
  lv_obj_set_style_local_radius(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0);
 | 
			
		||||
  lv_obj_set_size(sidebar, 40, 240);
 | 
			
		||||
  lv_obj_align(sidebar, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, 0, 0);
 | 
			
		||||
 | 
			
		||||
  /*Display icons*/
 | 
			
		||||
 | 
			
		||||
  batteryIcon = lv_label_create(lv_scr_act(), nullptr);
 | 
			
		||||
  lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
 | 
			
		||||
  lv_label_set_text(batteryIcon, Symbols::batteryFull);
 | 
			
		||||
  lv_obj_align(batteryIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 2);
 | 
			
		||||
 | 
			
		||||
  batteryPlug = lv_label_create(lv_scr_act(), nullptr);
 | 
			
		||||
  lv_obj_set_style_local_text_color(batteryPlug, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
 | 
			
		||||
  //lv_label_set_text(batteryPlug, Symbols::plug);
 | 
			
		||||
  lv_obj_align(batteryPlug, sidebar, LV_ALIGN_IN_TOP_MID, 0, 2);
 | 
			
		||||
 | 
			
		||||
  bleIcon = lv_label_create(lv_scr_act(), nullptr);
 | 
			
		||||
  lv_obj_set_style_local_text_color(bleIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
 | 
			
		||||
  //lv_label_set_text(bleIcon, BleIcon::GetIcon(false));
 | 
			
		||||
  lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25);
 | 
			
		||||
 | 
			
		||||
  notificationIcon = lv_label_create(lv_scr_act(), nullptr);
 | 
			
		||||
  lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
 | 
			
		||||
  //lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false));
 | 
			
		||||
  lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 40);
 | 
			
		||||
 | 
			
		||||
  /* Calendar icon */
 | 
			
		||||
 | 
			
		||||
  calendarOuter = lv_obj_create(lv_scr_act(), nullptr);
 | 
			
		||||
  lv_obj_set_style_local_bg_color(calendarOuter, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
 | 
			
		||||
  lv_obj_set_style_local_radius(calendarOuter, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0);
 | 
			
		||||
  lv_obj_set_size(calendarOuter, 34, 34);
 | 
			
		||||
  lv_obj_align(calendarOuter, sidebar, LV_ALIGN_CENTER, 0, 0);
 | 
			
		||||
 | 
			
		||||
  calendarInner = lv_obj_create(lv_scr_act(), nullptr);
 | 
			
		||||
  lv_obj_set_style_local_bg_color(calendarInner, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xffffff));
 | 
			
		||||
  lv_obj_set_style_local_radius(calendarInner, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0);
 | 
			
		||||
  lv_obj_set_size(calendarInner, 27, 27);
 | 
			
		||||
  lv_obj_align(calendarInner, calendarOuter, LV_ALIGN_CENTER, 0, 0);
 | 
			
		||||
 | 
			
		||||
  calendarBar1 = lv_obj_create(lv_scr_act(), nullptr);
 | 
			
		||||
  lv_obj_set_style_local_bg_color(calendarBar1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
 | 
			
		||||
  lv_obj_set_style_local_radius(calendarBar1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0);
 | 
			
		||||
  lv_obj_set_size(calendarBar1, 3, 12);
 | 
			
		||||
  lv_obj_align(calendarBar1, calendarOuter, LV_ALIGN_IN_TOP_MID, -6, -3);
 | 
			
		||||
 | 
			
		||||
  calendarBar2 = lv_obj_create(lv_scr_act(), nullptr);
 | 
			
		||||
  lv_obj_set_style_local_bg_color(calendarBar2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
 | 
			
		||||
  lv_obj_set_style_local_radius(calendarBar2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0);
 | 
			
		||||
  lv_obj_set_size(calendarBar2, 3, 12);
 | 
			
		||||
  lv_obj_align(calendarBar2, calendarOuter, LV_ALIGN_IN_TOP_MID, 6, -3);
 | 
			
		||||
 | 
			
		||||
  calendarCrossBar1 = lv_obj_create(lv_scr_act(), nullptr);
 | 
			
		||||
  lv_obj_set_style_local_bg_color(calendarCrossBar1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
 | 
			
		||||
  lv_obj_set_style_local_radius(calendarCrossBar1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0);
 | 
			
		||||
  lv_obj_set_size(calendarCrossBar1, 8, 3);
 | 
			
		||||
  lv_obj_align(calendarCrossBar1, calendarBar1, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
 | 
			
		||||
 | 
			
		||||
  calendarCrossBar2 = lv_obj_create(lv_scr_act(), nullptr);
 | 
			
		||||
  lv_obj_set_style_local_bg_color(calendarCrossBar2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
 | 
			
		||||
  lv_obj_set_style_local_radius(calendarCrossBar2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0);
 | 
			
		||||
  lv_obj_set_size(calendarCrossBar2, 8, 3);
 | 
			
		||||
  lv_obj_align(calendarCrossBar2, calendarBar2, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
 | 
			
		||||
 | 
			
		||||
  /*Display date*/
 | 
			
		||||
 | 
			
		||||
  dateDayOfWeek = lv_label_create(lv_scr_act(), nullptr);
 | 
			
		||||
  lv_obj_set_style_local_text_color(dateDayOfWeek, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
 | 
			
		||||
  lv_label_set_text(dateDayOfWeek, "THU");
 | 
			
		||||
  lv_obj_align(dateDayOfWeek, sidebar, LV_ALIGN_CENTER, 0, -34);
 | 
			
		||||
 | 
			
		||||
  dateDay = lv_label_create(lv_scr_act(), nullptr);
 | 
			
		||||
  lv_obj_set_style_local_text_color(dateDay, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
 | 
			
		||||
  lv_label_set_text(dateDay, "25");
 | 
			
		||||
  lv_obj_align(dateDay, sidebar, LV_ALIGN_CENTER, 0, 3);
 | 
			
		||||
 | 
			
		||||
  dateMonth = lv_label_create(lv_scr_act(), nullptr);
 | 
			
		||||
  lv_obj_set_style_local_text_color(dateMonth, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
 | 
			
		||||
  lv_label_set_text(dateMonth, "MAR");
 | 
			
		||||
  lv_obj_align(dateMonth, sidebar, LV_ALIGN_CENTER, 0, 32);
 | 
			
		||||
 | 
			
		||||
  /*Display heartrate info*/
 | 
			
		||||
 | 
			
		||||
  heartbeatIcon = lv_label_create(lv_scr_act(), nullptr);
 | 
			
		||||
  lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
 | 
			
		||||
  lv_label_set_text(heartbeatIcon, Symbols::heartBeat);
 | 
			
		||||
  lv_obj_align(heartbeatIcon, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, -30);
 | 
			
		||||
 | 
			
		||||
  heartbeatValue = lv_label_create(lv_scr_act(), nullptr);
 | 
			
		||||
  lv_obj_set_style_local_text_color(heartbeatValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
 | 
			
		||||
  lv_label_set_text(heartbeatValue, "---");
 | 
			
		||||
  lv_obj_align(heartbeatValue, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, -10);
 | 
			
		||||
 | 
			
		||||
  backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
 | 
			
		||||
  lv_obj_set_click(backgroundLabel, true);
 | 
			
		||||
  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(backgroundLabel, "");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
PineTimeStyle::~PineTimeStyle() {
 | 
			
		||||
  lv_obj_clean(lv_scr_act());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool PineTimeStyle::Refresh() {
 | 
			
		||||
  batteryPercentRemaining = batteryController.PercentRemaining();
 | 
			
		||||
  if (batteryPercentRemaining.IsUpdated()) {
 | 
			
		||||
    auto batteryPercent = batteryPercentRemaining.Get();
 | 
			
		||||
    if (batteryController.IsCharging()) {
 | 
			
		||||
      auto isCharging = batteryController.IsCharging() || batteryController.IsPowerPresent();
 | 
			
		||||
      lv_label_set_text(batteryPlug, BatteryIcon::GetPlugIcon(isCharging));
 | 
			
		||||
      lv_obj_realign(batteryPlug);
 | 
			
		||||
      lv_label_set_text(batteryIcon, "");
 | 
			
		||||
    } else {
 | 
			
		||||
      lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent));
 | 
			
		||||
      lv_label_set_text(batteryPlug, "");
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  bleState = bleController.IsConnected();
 | 
			
		||||
  if (bleState.IsUpdated()) {
 | 
			
		||||
    if (bleState.Get() == true) {
 | 
			
		||||
      lv_label_set_text(bleIcon, BleIcon::GetIcon(true));
 | 
			
		||||
      lv_obj_realign(bleIcon);
 | 
			
		||||
    } else {
 | 
			
		||||
      lv_label_set_text(bleIcon, BleIcon::GetIcon(false));
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  notificationState = notificatioManager.AreNewNotificationsAvailable();
 | 
			
		||||
  if (notificationState.IsUpdated()) {
 | 
			
		||||
    if (notificationState.Get() == true) {
 | 
			
		||||
      lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(true));
 | 
			
		||||
      lv_obj_realign(notificationIcon);
 | 
			
		||||
      //lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, -8, 25);
 | 
			
		||||
    } else {
 | 
			
		||||
      lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false));
 | 
			
		||||
      //lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  currentDateTime = dateTimeController.CurrentDateTime();
 | 
			
		||||
 | 
			
		||||
  if (currentDateTime.IsUpdated()) {
 | 
			
		||||
    auto newDateTime = currentDateTime.Get();
 | 
			
		||||
 | 
			
		||||
    auto dp = date::floor<date::days>(newDateTime);
 | 
			
		||||
    auto time = date::make_time(newDateTime - dp);
 | 
			
		||||
    auto yearMonthDay = date::year_month_day(dp);
 | 
			
		||||
 | 
			
		||||
    auto year = (int) yearMonthDay.year();
 | 
			
		||||
    auto month = static_cast<Pinetime::Controllers::DateTime::Months>((unsigned) yearMonthDay.month());
 | 
			
		||||
    auto day = (unsigned) yearMonthDay.day();
 | 
			
		||||
    auto dayOfWeek = static_cast<Pinetime::Controllers::DateTime::Days>(date::weekday(yearMonthDay).iso_encoding());
 | 
			
		||||
 | 
			
		||||
    int hour = time.hours().count();
 | 
			
		||||
    auto minute = time.minutes().count();
 | 
			
		||||
 | 
			
		||||
    char minutesChar[3];
 | 
			
		||||
    sprintf(minutesChar, "%02d", static_cast<int>(minute));
 | 
			
		||||
 | 
			
		||||
    char hoursChar[3];
 | 
			
		||||
    sprintf(hoursChar, "%02d", hour);
 | 
			
		||||
 | 
			
		||||
    if (hoursChar[0] != displayedChar[0] || hoursChar[1] != displayedChar[1] || minutesChar[0] != displayedChar[2] ||
 | 
			
		||||
        minutesChar[1] != displayedChar[3]) {
 | 
			
		||||
      displayedChar[0] = hoursChar[0];
 | 
			
		||||
      displayedChar[1] = hoursChar[1];
 | 
			
		||||
      displayedChar[2] = minutesChar[0];
 | 
			
		||||
      displayedChar[3] = minutesChar[1];
 | 
			
		||||
 | 
			
		||||
      char hourStr[3];
 | 
			
		||||
      char minStr[3];
 | 
			
		||||
 | 
			
		||||
      /*Display the time as 2 pairs of digits*/
 | 
			
		||||
      sprintf(hourStr, "%c%c", hoursChar[0], hoursChar[1]);
 | 
			
		||||
      lv_label_set_text(timeDD1, hourStr);
 | 
			
		||||
 | 
			
		||||
      sprintf(minStr, "%c%c", minutesChar[0], minutesChar[1]);
 | 
			
		||||
      lv_label_set_text(timeDD2, minStr);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ((year != currentYear) || (month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) {
 | 
			
		||||
      char dayOfWeekStr[4];
 | 
			
		||||
      char dayStr[3];
 | 
			
		||||
      char monthStr[4];
 | 
			
		||||
 | 
			
		||||
      sprintf(dayOfWeekStr, "%s", dateTimeController.DayOfWeekShortToString());
 | 
			
		||||
      sprintf(dayStr, "%d", day);
 | 
			
		||||
      sprintf(monthStr, "%s", dateTimeController.MonthShortToString());
 | 
			
		||||
 | 
			
		||||
      lv_label_set_text(dateDayOfWeek, dayOfWeekStr);
 | 
			
		||||
      lv_label_set_text(dateDay, dayStr);
 | 
			
		||||
      lv_obj_realign(dateDay);
 | 
			
		||||
      lv_label_set_text(dateMonth, monthStr);
 | 
			
		||||
 | 
			
		||||
      currentYear = year;
 | 
			
		||||
      currentMonth = month;
 | 
			
		||||
      currentDayOfWeek = dayOfWeek;
 | 
			
		||||
      currentDay = day;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  heartbeat = heartRateController.HeartRate();
 | 
			
		||||
  heartbeatRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped;
 | 
			
		||||
  if (heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) {
 | 
			
		||||
    char heartbeatBuffer[4];
 | 
			
		||||
    if (heartbeatRunning.Get())
 | 
			
		||||
      sprintf(heartbeatBuffer, "%d", heartbeat.Get());
 | 
			
		||||
    else
 | 
			
		||||
      sprintf(heartbeatBuffer, "---");
 | 
			
		||||
 | 
			
		||||
    lv_label_set_text(heartbeatValue, heartbeatBuffer);
 | 
			
		||||
    lv_obj_realign(heartbeatValue);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return running;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										83
									
								
								src/displayapp/screens/PineTimeStyle.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								src/displayapp/screens/PineTimeStyle.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,83 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <lvgl/src/lv_core/lv_obj.h>
 | 
			
		||||
#include <chrono>
 | 
			
		||||
#include <cstdint>
 | 
			
		||||
#include <memory>
 | 
			
		||||
#include "Screen.h"
 | 
			
		||||
#include "ScreenList.h"
 | 
			
		||||
#include "components/datetime/DateTimeController.h"
 | 
			
		||||
 | 
			
		||||
namespace Pinetime {
 | 
			
		||||
  namespace Controllers {
 | 
			
		||||
    class Settings;
 | 
			
		||||
    class Battery;
 | 
			
		||||
    class Ble;
 | 
			
		||||
    class NotificationManager;
 | 
			
		||||
    class HeartRateController;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  namespace Applications {
 | 
			
		||||
    namespace Screens {
 | 
			
		||||
      class PineTimeStyle : public Screen {
 | 
			
		||||
      public:
 | 
			
		||||
        PineTimeStyle(DisplayApp* app,
 | 
			
		||||
                      Controllers::DateTime& dateTimeController,
 | 
			
		||||
                      Controllers::Battery& batteryController,
 | 
			
		||||
                      Controllers::Ble& bleController,
 | 
			
		||||
                      Controllers::NotificationManager& notificatioManager,
 | 
			
		||||
                      Controllers::Settings& settingsController,
 | 
			
		||||
                      Controllers::HeartRateController& heartRateController);
 | 
			
		||||
        ~PineTimeStyle() override;
 | 
			
		||||
 | 
			
		||||
        bool Refresh() override;
 | 
			
		||||
 | 
			
		||||
        void OnObjectEvent(lv_obj_t* pObj, lv_event_t i);
 | 
			
		||||
 | 
			
		||||
      private:
 | 
			
		||||
        char displayedChar[5];
 | 
			
		||||
 | 
			
		||||
        uint16_t currentYear = 1970;
 | 
			
		||||
        Pinetime::Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown;
 | 
			
		||||
        Pinetime::Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown;
 | 
			
		||||
        uint8_t currentDay = 0;
 | 
			
		||||
 | 
			
		||||
        DirtyValue<int> batteryPercentRemaining {};
 | 
			
		||||
        DirtyValue<bool> bleState {};
 | 
			
		||||
        DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime {};
 | 
			
		||||
        DirtyValue<uint8_t> heartbeat {};
 | 
			
		||||
        DirtyValue<bool> heartbeatRunning {};
 | 
			
		||||
        DirtyValue<bool> notificationState {};
 | 
			
		||||
 | 
			
		||||
        lv_obj_t* timebar;
 | 
			
		||||
        lv_obj_t* sidebar;
 | 
			
		||||
        lv_obj_t* timeDD1;
 | 
			
		||||
        lv_obj_t* timeDD2;
 | 
			
		||||
        lv_obj_t* dateDayOfWeek;
 | 
			
		||||
        lv_obj_t* dateDay;
 | 
			
		||||
        lv_obj_t* dateMonth;
 | 
			
		||||
        lv_obj_t* backgroundLabel;
 | 
			
		||||
        lv_obj_t* batteryIcon;
 | 
			
		||||
        lv_obj_t* bleIcon;
 | 
			
		||||
        lv_obj_t* batteryPlug;
 | 
			
		||||
        lv_obj_t* calendarOuter;
 | 
			
		||||
        lv_obj_t* calendarInner;
 | 
			
		||||
        lv_obj_t* calendarBar1;
 | 
			
		||||
        lv_obj_t* calendarBar2;
 | 
			
		||||
        lv_obj_t* calendarCrossBar1;
 | 
			
		||||
        lv_obj_t* calendarCrossBar2;
 | 
			
		||||
        lv_obj_t* heartbeatIcon;
 | 
			
		||||
        lv_obj_t* heartbeatValue;
 | 
			
		||||
        lv_obj_t* heartbeatBpm;
 | 
			
		||||
        lv_obj_t* notificationIcon;
 | 
			
		||||
 | 
			
		||||
        Controllers::DateTime& dateTimeController;
 | 
			
		||||
        Controllers::Battery& batteryController;
 | 
			
		||||
        Controllers::Ble& bleController;
 | 
			
		||||
        Controllers::NotificationManager& notificatioManager;
 | 
			
		||||
        Controllers::Settings& settingsController;
 | 
			
		||||
        Controllers::HeartRateController& heartRateController;
 | 
			
		||||
      };
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user