resolves conflicts
This commit is contained in:
@@ -25,6 +25,8 @@ namespace Pinetime {
|
||||
Metronome,
|
||||
Motion,
|
||||
Steps,
|
||||
Weather,
|
||||
PassKey,
|
||||
QuickSettings,
|
||||
Settings,
|
||||
SettingWatchFace,
|
||||
@@ -32,7 +34,6 @@ namespace Pinetime {
|
||||
SettingDisplay,
|
||||
SettingWakeUp,
|
||||
SettingSteps,
|
||||
SettingPineTimeStyle,
|
||||
SettingSetDate,
|
||||
SettingSetTime,
|
||||
SettingChimes,
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include "Colors.h"
|
||||
#include "displayapp/Colors.h"
|
||||
|
||||
using namespace Pinetime::Applications;
|
||||
using namespace Pinetime::Controllers;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <lvgl/src/lv_misc/lv_color.h>
|
||||
#include <components/settings/Settings.h>
|
||||
#include "components/settings/Settings.h"
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Applications {
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#include "DisplayApp.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
#include <libraries/log/nrf_log.h>
|
||||
#include <displayapp/screens/HeartRate.h>
|
||||
#include <displayapp/screens/Motion.h>
|
||||
#include <displayapp/screens/Timer.h>
|
||||
#include <displayapp/screens/Alarm.h>
|
||||
#include "displayapp/screens/HeartRate.h"
|
||||
#include "displayapp/screens/Motion.h"
|
||||
#include "displayapp/screens/Timer.h"
|
||||
#include "displayapp/screens/Alarm.h"
|
||||
#include "components/battery/BatteryController.h"
|
||||
#include "components/ble/BleController.h"
|
||||
#include "components/datetime/DateTimeController.h"
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "displayapp/screens/FlashLight.h"
|
||||
#include "displayapp/screens/BatteryInfo.h"
|
||||
#include "displayapp/screens/Steps.h"
|
||||
#include "displayapp/screens/PassKey.h"
|
||||
#include "displayapp/screens/Error.h"
|
||||
|
||||
#include "drivers/Cst816s.h"
|
||||
@@ -214,6 +215,10 @@ void DisplayApp::Refresh() {
|
||||
} else {
|
||||
LoadApp(Apps::Alarm, DisplayApp::FullRefreshDirections::None);
|
||||
}
|
||||
break;
|
||||
case Messages::ShowPairingKey:
|
||||
LoadApp(Apps::PassKey, DisplayApp::FullRefreshDirections::Up);
|
||||
break;
|
||||
case Messages::TouchEvent: {
|
||||
if (state != States::Running) {
|
||||
break;
|
||||
@@ -250,16 +255,36 @@ void DisplayApp::Refresh() {
|
||||
}
|
||||
} break;
|
||||
case Messages::ButtonPushed:
|
||||
if (currentApp == Apps::Clock) {
|
||||
PushMessageToSystemTask(System::Messages::GoToSleep);
|
||||
} else {
|
||||
if (!currentScreen->OnButtonPushed()) {
|
||||
if (!currentScreen->OnButtonPushed()) {
|
||||
if (currentApp == Apps::Clock) {
|
||||
PushMessageToSystemTask(System::Messages::GoToSleep);
|
||||
} else {
|
||||
LoadApp(returnToApp, returnDirection);
|
||||
brightnessController.Set(settingsController.GetBrightness());
|
||||
brightnessController.Backup();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Messages::ButtonLongPressed:
|
||||
if (currentApp != Apps::Clock) {
|
||||
if (currentApp == Apps::Notifications) {
|
||||
LoadApp(Apps::Clock, DisplayApp::FullRefreshDirections::Up);
|
||||
} else if (currentApp == Apps::QuickSettings) {
|
||||
LoadApp(Apps::Clock, DisplayApp::FullRefreshDirections::LeftAnim);
|
||||
} else {
|
||||
LoadApp(Apps::Clock, DisplayApp::FullRefreshDirections::Down);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Messages::ButtonLongerPressed:
|
||||
// Create reboot app and open it instead
|
||||
LoadApp(Apps::SysInfo, DisplayApp::FullRefreshDirections::Up);
|
||||
break;
|
||||
case Messages::ButtonDoubleClicked:
|
||||
if (currentApp != Apps::Notifications && currentApp != Apps::NotificationsPreview) {
|
||||
LoadApp(Apps::Notifications, DisplayApp::FullRefreshDirections::Down);
|
||||
}
|
||||
break;
|
||||
|
||||
case Messages::BleFirmwareUpdateStarted:
|
||||
LoadApp(Apps::FirmwareUpdate, DisplayApp::FullRefreshDirections::Down);
|
||||
@@ -334,6 +359,11 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
|
||||
ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::None);
|
||||
break;
|
||||
|
||||
case Apps::PassKey:
|
||||
currentScreen = std::make_unique<Screens::PassKey>(this, bleController.GetPairingKey());
|
||||
ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::SwipeDown);
|
||||
break;
|
||||
|
||||
case Apps::Notifications:
|
||||
currentScreen = std::make_unique<Screens::Notifications>(
|
||||
this, notificationManager, systemTask->nimble().alertService(), motorController, Screens::Notifications::Modes::Normal);
|
||||
@@ -389,10 +419,13 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
|
||||
currentScreen = std::make_unique<Screens::SettingSetTime>(this, dateTimeController);
|
||||
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
|
||||
break;
|
||||
<<<<<<< HEAD
|
||||
case Apps::SettingChimes:
|
||||
currentScreen = std::make_unique<Screens::SettingChimes>(this, settingsController);
|
||||
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
|
||||
break;
|
||||
=======
|
||||
>>>>>>> develop
|
||||
case Apps::BatteryInfo:
|
||||
currentScreen = std::make_unique<Screens::BatteryInfo>(this, batteryController);
|
||||
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
|
||||
@@ -413,7 +446,7 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
|
||||
currentScreen = std::make_unique<Screens::Twos>(this);
|
||||
break;
|
||||
case Apps::Paint:
|
||||
currentScreen = std::make_unique<Screens::InfiniPaint>(this, lvgl);
|
||||
currentScreen = std::make_unique<Screens::InfiniPaint>(this, lvgl, motorController);
|
||||
break;
|
||||
case Apps::Paddle:
|
||||
currentScreen = std::make_unique<Screens::Paddle>(this, lvgl);
|
||||
@@ -480,8 +513,9 @@ void DisplayApp::SetFullRefresh(DisplayApp::FullRefreshDirections direction) {
|
||||
}
|
||||
|
||||
void DisplayApp::PushMessageToSystemTask(Pinetime::System::Messages message) {
|
||||
if (systemTask != nullptr)
|
||||
if (systemTask != nullptr) {
|
||||
systemTask->PushMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayApp::Register(Pinetime::System::SystemTask* systemTask) {
|
||||
|
@@ -5,9 +5,9 @@
|
||||
#include <task.h>
|
||||
#include <memory>
|
||||
#include <systemtask/Messages.h>
|
||||
#include "Apps.h"
|
||||
#include "LittleVgl.h"
|
||||
#include "TouchEvents.h"
|
||||
#include "displayapp/Apps.h"
|
||||
#include "displayapp/LittleVgl.h"
|
||||
#include "displayapp/TouchEvents.h"
|
||||
#include "components/brightness/BrightnessController.h"
|
||||
#include "components/motor/MotorController.h"
|
||||
#include "components/firmwarevalidator/FirmwareValidator.h"
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "components/alarm/AlarmController.h"
|
||||
#include "touchhandler/TouchHandler.h"
|
||||
|
||||
#include "Messages.h"
|
||||
#include "displayapp/Messages.h"
|
||||
#include "BootErrors.h"
|
||||
|
||||
namespace Pinetime {
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#include "DisplayAppRecovery.h"
|
||||
#include "displayapp/DisplayAppRecovery.h"
|
||||
#include <FreeRTOS.h>
|
||||
#include <task.h>
|
||||
#include <libraries/log/nrf_log.h>
|
||||
#include <components/rle/RleDecoder.h>
|
||||
#include <touchhandler/TouchHandler.h>
|
||||
#include "components/rle/RleDecoder.h"
|
||||
#include "touchhandler/TouchHandler.h"
|
||||
#include "displayapp/icons/infinitime/infinitime-nb.c"
|
||||
#include "components/ble/BleController.h"
|
||||
|
||||
|
@@ -11,10 +11,10 @@
|
||||
#include <drivers/Watchdog.h>
|
||||
#include <components/motor/MotorController.h>
|
||||
#include "BootErrors.h"
|
||||
#include "TouchEvents.h"
|
||||
#include "Apps.h"
|
||||
#include "Messages.h"
|
||||
#include "DummyLittleVgl.h"
|
||||
#include "displayapp/TouchEvents.h"
|
||||
#include "displayapp/Apps.h"
|
||||
#include "displayapp/Messages.h"
|
||||
#include "displayapp/DummyLittleVgl.h"
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Drivers {
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <libs/lvgl/src/lv_core/lv_style.h>
|
||||
#include <libs/lvgl/src/lv_themes/lv_theme.h>
|
||||
#include <libs/lvgl/src/lv_hal/lv_hal.h>
|
||||
#include <lvgl/src/lv_core/lv_style.h>
|
||||
#include <lvgl/src/lv_themes/lv_theme.h>
|
||||
#include <lvgl/src/lv_hal/lv_hal.h>
|
||||
#include <drivers/St7789.h>
|
||||
#include <drivers/Cst816s.h>
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#include "LittleVgl.h"
|
||||
#include "lv_pinetime_theme.h"
|
||||
#include "displayapp/LittleVgl.h"
|
||||
#include "displayapp/lv_pinetime_theme.h"
|
||||
|
||||
#include <FreeRTOS.h>
|
||||
#include <task.h>
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
namespace Pinetime {
|
||||
namespace Applications {
|
||||
namespace Display {
|
||||
@@ -9,6 +10,9 @@ namespace Pinetime {
|
||||
UpdateBleConnection,
|
||||
TouchEvent,
|
||||
ButtonPushed,
|
||||
ButtonLongPressed,
|
||||
ButtonLongerPressed,
|
||||
ButtonDoubleClicked,
|
||||
NewNotification,
|
||||
TimerDone,
|
||||
BleFirmwareUpdateStarted,
|
||||
|
@@ -6,7 +6,7 @@
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_pinetime_theme.h"
|
||||
#include "displayapp/lv_pinetime_theme.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -119,7 +119,6 @@ static void basic_init(void) {
|
||||
lv_style_set_bg_color(&style_btn, LV_STATE_DISABLED | LV_STATE_CHECKED, lv_color_hex3(0x888));
|
||||
lv_style_set_border_color(&style_btn, LV_STATE_DEFAULT, theme.color_primary);
|
||||
lv_style_set_border_width(&style_btn, LV_STATE_DEFAULT, 0);
|
||||
lv_style_set_border_opa(&style_btn, LV_STATE_CHECKED, LV_OPA_TRANSP);
|
||||
|
||||
lv_style_set_text_color(&style_btn, LV_STATE_DEFAULT, lv_color_hex(0xffffff));
|
||||
lv_style_set_text_color(&style_btn, LV_STATE_CHECKED, lv_color_hex(0xffffff));
|
||||
|
@@ -15,9 +15,9 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "Alarm.h"
|
||||
#include "Screen.h"
|
||||
#include "Symbols.h"
|
||||
#include "displayapp/screens/Alarm.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "displayapp/screens/Symbols.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
using Pinetime::Controllers::AlarmController;
|
||||
@@ -36,7 +36,7 @@ Alarm::Alarm(DisplayApp* app, Controllers::AlarmController& alarmController)
|
||||
|
||||
alarmHours = alarmController.Hours();
|
||||
alarmMinutes = alarmController.Minutes();
|
||||
lv_label_set_text_fmt(time, "%02lu:%02lu", alarmHours, alarmMinutes);
|
||||
lv_label_set_text_fmt(time, "%02hhu:%02hhu", alarmHours, alarmMinutes);
|
||||
|
||||
lv_obj_align(time, lv_scr_act(), LV_ALIGN_CENTER, 0, -25);
|
||||
|
||||
@@ -223,7 +223,7 @@ void Alarm::ShowInfo() {
|
||||
auto secToAlarm = timeToAlarm % 60;
|
||||
|
||||
lv_label_set_text_fmt(
|
||||
txtMessage, "Time to\nalarm:\n%2d Days\n%2d Hours\n%2d Minutes\n%2d Seconds", daysToAlarm, hrsToAlarm, minToAlarm, secToAlarm);
|
||||
txtMessage, "Time to\nalarm:\n%2lu Days\n%2lu Hours\n%2lu Minutes\n%2lu Seconds", daysToAlarm, hrsToAlarm, minToAlarm, secToAlarm);
|
||||
} else {
|
||||
lv_label_set_text(txtMessage, "Alarm\nis not\nset.");
|
||||
}
|
||||
|
@@ -17,9 +17,9 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Screen.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "systemtask/SystemTask.h"
|
||||
#include "../LittleVgl.h"
|
||||
#include "displayapp/LittleVgl.h"
|
||||
#include "components/alarm/AlarmController.h"
|
||||
|
||||
namespace Pinetime {
|
||||
@@ -40,7 +40,9 @@ namespace Pinetime {
|
||||
Controllers::AlarmController& alarmController;
|
||||
|
||||
lv_obj_t *time, *btnEnable, *txtEnable, *btnMinutesUp, *btnMinutesDown, *btnHoursUp, *btnHoursDown, *txtMinUp, *txtMinDown,
|
||||
*txtHrUp, *txtHrDown, *btnRecur, *txtRecur, *btnMessage, *txtMessage, *btnInfo, *txtInfo;
|
||||
*txtHrUp, *txtHrDown, *btnRecur, *txtRecur, *btnInfo, *txtInfo;
|
||||
lv_obj_t* txtMessage = nullptr;
|
||||
lv_obj_t* btnMessage = nullptr;
|
||||
|
||||
enum class EnableButtonState { On, Off, Alerting };
|
||||
void SetEnableButtonState();
|
||||
|
@@ -1,10 +1,10 @@
|
||||
#include "ApplicationList.h"
|
||||
#include "displayapp/screens/ApplicationList.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <array>
|
||||
#include "Symbols.h"
|
||||
#include "Tile.h"
|
||||
#include "displayapp/screens/Symbols.h"
|
||||
#include "displayapp/screens/Tile.h"
|
||||
#include "displayapp/Apps.h"
|
||||
#include "../DisplayApp.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
|
@@ -2,8 +2,8 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "Screen.h"
|
||||
#include "ScreenList.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "displayapp/screens/ScreenList.h"
|
||||
#include "components/datetime/DateTimeController.h"
|
||||
#include "components/settings/Settings.h"
|
||||
#include "components/battery/BatteryController.h"
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "displayapp/screens/BatteryIcon.h"
|
||||
#include <cstdint>
|
||||
#include "BatteryIcon.h"
|
||||
#include "Symbols.h"
|
||||
#include "displayapp/screens/Symbols.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Applications {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#include "BatteryInfo.h"
|
||||
#include "../DisplayApp.h"
|
||||
#include "displayapp/screens/BatteryInfo.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
#include "components/battery/BatteryController.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
@@ -1,9 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <FreeRTOS.h>
|
||||
#include <timers.h>
|
||||
#include "Screen.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
namespace Pinetime {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#include "BleIcon.h"
|
||||
#include "Symbols.h"
|
||||
#include "displayapp/screens/BleIcon.h"
|
||||
#include "displayapp/screens/Symbols.h"
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
const char* BleIcon::GetIcon(bool isConnected) {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include "Brightness.h"
|
||||
#include "displayapp/screens/Brightness.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <lvgl/src/lv_core/lv_obj.h>
|
||||
#include <cstdint>
|
||||
#include "Screen.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "components/brightness/BrightnessController.h"
|
||||
|
||||
namespace Pinetime {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include "Clock.h"
|
||||
#include "displayapp/screens/Clock.h"
|
||||
|
||||
#include <date/date.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
@@ -6,10 +6,11 @@
|
||||
#include "components/motion/MotionController.h"
|
||||
#include "components/ble/BleController.h"
|
||||
#include "components/ble/NotificationManager.h"
|
||||
#include "../DisplayApp.h"
|
||||
#include "WatchFaceDigital.h"
|
||||
#include "WatchFaceAnalog.h"
|
||||
#include "PineTimeStyle.h"
|
||||
#include "components/settings/Settings.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
#include "displayapp/screens/WatchFaceDigital.h"
|
||||
#include "displayapp/screens/WatchFaceAnalog.h"
|
||||
#include "displayapp/screens/PineTimeStyle.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
@@ -54,6 +55,10 @@ bool Clock::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
||||
return screen->OnTouchEvent(event);
|
||||
}
|
||||
|
||||
bool Clock::OnButtonPushed() {
|
||||
return screen->OnButtonPushed();
|
||||
}
|
||||
|
||||
std::unique_ptr<Screen> Clock::WatchFaceDigitalScreen() {
|
||||
return std::make_unique<Screens::WatchFaceDigital>(app,
|
||||
dateTimeController,
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <components/heartrate/HeartRateController.h>
|
||||
#include "Screen.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "components/datetime/DateTimeController.h"
|
||||
|
||||
namespace Pinetime {
|
||||
@@ -32,6 +32,7 @@ namespace Pinetime {
|
||||
~Clock() override;
|
||||
|
||||
bool OnTouchEvent(TouchEvents event) override;
|
||||
bool OnButtonPushed() override;
|
||||
|
||||
private:
|
||||
Controllers::DateTime& dateTimeController;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include "DropDownDemo.h"
|
||||
#include "displayapp/screens/DropDownDemo.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <libraries/log/nrf_log.h>
|
||||
#include "../DisplayApp.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include "Screen.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include <lvgl/src/lv_core/lv_obj.h>
|
||||
|
||||
namespace Pinetime {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include "Error.h"
|
||||
#include "displayapp/screens/Error.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "Screen.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "BootErrors.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include "FirmwareUpdate.h"
|
||||
#include "displayapp/screens/FirmwareUpdate.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
#include "components/ble/BleController.h"
|
||||
#include "../DisplayApp.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "Screen.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include <lvgl/src/lv_core/lv_obj.h>
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#include "FirmwareValidation.h"
|
||||
#include "displayapp/screens/FirmwareValidation.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
#include "Version.h"
|
||||
#include "components/firmwarevalidator/FirmwareValidator.h"
|
||||
#include "../DisplayApp.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
@@ -18,7 +18,7 @@ FirmwareValidation::FirmwareValidation(Pinetime::Applications::DisplayApp* app,
|
||||
: Screen {app}, validator {validator} {
|
||||
labelVersion = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text_fmt(labelVersion,
|
||||
"Version : %d.%d.%d\n"
|
||||
"Version : %lu.%lu.%lu\n"
|
||||
"ShortRef : %s",
|
||||
Version::Major(),
|
||||
Version::Minor(),
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "Screen.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include <lvgl/src/lv_core/lv_obj.h>
|
||||
|
||||
namespace Pinetime {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "FlashLight.h"
|
||||
#include "../DisplayApp.h"
|
||||
#include "Symbols.h"
|
||||
#include "displayapp/screens/FlashLight.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
#include "displayapp/screens/Symbols.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "Screen.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "components/brightness/BrightnessController.h"
|
||||
#include "systemtask/SystemTask.h"
|
||||
#include <cstdint>
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#include <libs/lvgl/lvgl.h>
|
||||
#include "HeartRate.h"
|
||||
#include "displayapp/screens/HeartRate.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <components/heartrate/HeartRateController.h>
|
||||
|
||||
#include "../DisplayApp.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
|
@@ -2,11 +2,11 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include <chrono>
|
||||
#include "Screen.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include <bits/unique_ptr.h>
|
||||
#include "systemtask/SystemTask.h"
|
||||
#include <libs/lvgl/src/lv_core/lv_style.h>
|
||||
#include <libs/lvgl/src/lv_core/lv_obj.h>
|
||||
#include <lvgl/src/lv_core/lv_style.h>
|
||||
#include <lvgl/src/lv_core/lv_obj.h>
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Controllers {
|
||||
|
@@ -1,10 +1,15 @@
|
||||
#include "InfiniPaint.h"
|
||||
#include "../DisplayApp.h"
|
||||
#include "../LittleVgl.h"
|
||||
#include "displayapp/screens/InfiniPaint.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
#include "displayapp/LittleVgl.h"
|
||||
|
||||
#include <algorithm> // std::fill
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
InfiniPaint::InfiniPaint(Pinetime::Applications::DisplayApp* app, Pinetime::Components::LittleVgl& lvgl) : Screen(app), lvgl {lvgl} {
|
||||
InfiniPaint::InfiniPaint(Pinetime::Applications::DisplayApp* app,
|
||||
Pinetime::Components::LittleVgl& lvgl,
|
||||
Pinetime::Controllers::MotorController& motor)
|
||||
: Screen(app), lvgl {lvgl}, motor {motor} {
|
||||
std::fill(b, b + bufferSize, selectColor);
|
||||
}
|
||||
|
||||
@@ -15,6 +20,7 @@ InfiniPaint::~InfiniPaint() {
|
||||
bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
||||
switch (event) {
|
||||
case Pinetime::Applications::TouchEvents::LongTap:
|
||||
color = (color + 1) % 8;
|
||||
switch (color) {
|
||||
case 0:
|
||||
selectColor = LV_COLOR_MAGENTA;
|
||||
@@ -47,7 +53,7 @@ bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
||||
}
|
||||
|
||||
std::fill(b, b + bufferSize, selectColor);
|
||||
color++;
|
||||
motor.RunForDuration(35);
|
||||
return true;
|
||||
default:
|
||||
return true;
|
||||
|
@@ -2,7 +2,9 @@
|
||||
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <cstdint>
|
||||
#include "Screen.h"
|
||||
#include <algorithm> // std::fill
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "components/motor/MotorController.h"
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Components {
|
||||
@@ -13,7 +15,7 @@ namespace Pinetime {
|
||||
|
||||
class InfiniPaint : public Screen {
|
||||
public:
|
||||
InfiniPaint(DisplayApp* app, Pinetime::Components::LittleVgl& lvgl);
|
||||
InfiniPaint(DisplayApp* app, Pinetime::Components::LittleVgl& lvgl, Controllers::MotorController& motor);
|
||||
|
||||
~InfiniPaint() override;
|
||||
|
||||
@@ -23,6 +25,7 @@ namespace Pinetime {
|
||||
|
||||
private:
|
||||
Pinetime::Components::LittleVgl& lvgl;
|
||||
Controllers::MotorController& motor;
|
||||
static constexpr uint16_t width = 10;
|
||||
static constexpr uint16_t height = 10;
|
||||
static constexpr uint16_t bufferSize = width * height;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include "Label.h"
|
||||
#include "displayapp/screens/Label.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "Screen.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
namespace Pinetime {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "List.h"
|
||||
#include "../DisplayApp.h"
|
||||
#include "Symbols.h"
|
||||
#include "displayapp/screens/List.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
#include "displayapp/screens/Symbols.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include "Screen.h"
|
||||
#include "../Apps.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "displayapp/Apps.h"
|
||||
#include "components/settings/Settings.h"
|
||||
|
||||
#define MAXLISTITEMS 4
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "Meter.h"
|
||||
#include "displayapp/screens/Meter.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
#include "../DisplayApp.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include "Screen.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include <lvgl/src/lv_core/lv_style.h>
|
||||
#include <lvgl/src/lv_core/lv_obj.h>
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#include "Metronome.h"
|
||||
#include "Symbols.h"
|
||||
#include "displayapp/screens/Metronome.h"
|
||||
#include "displayapp/screens/Symbols.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
@@ -113,9 +113,16 @@ void Metronome::OnEvent(lv_obj_t* obj, lv_event_t event) {
|
||||
lv_label_set_text_fmt(bpmValue, "%03d", bpm);
|
||||
}
|
||||
tappedTime = xTaskGetTickCount();
|
||||
allowExit = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LV_EVENT_RELEASED:
|
||||
case LV_EVENT_PRESS_LOST:
|
||||
if (obj == bpmTap) {
|
||||
allowExit = false;
|
||||
}
|
||||
break;
|
||||
case LV_EVENT_CLICKED: {
|
||||
if (obj == playPause) {
|
||||
metronomeStarted = !metronomeStarted;
|
||||
@@ -135,3 +142,11 @@ void Metronome::OnEvent(lv_obj_t* obj, lv_event_t event) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool Metronome::OnTouchEvent(TouchEvents event) {
|
||||
if (event == TouchEvents::SwipeDown && allowExit) {
|
||||
running = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "systemtask/SystemTask.h"
|
||||
#include "components/motor/MotorController.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Applications {
|
||||
@@ -13,6 +14,7 @@ namespace Pinetime {
|
||||
~Metronome() override;
|
||||
void Refresh() override;
|
||||
void OnEvent(lv_obj_t* obj, lv_event_t event);
|
||||
bool OnTouchEvent(TouchEvents event) override;
|
||||
|
||||
private:
|
||||
TickType_t startTime = 0;
|
||||
@@ -24,6 +26,7 @@ namespace Pinetime {
|
||||
uint8_t counter = 1;
|
||||
|
||||
bool metronomeStarted = false;
|
||||
bool allowExit = false;
|
||||
|
||||
lv_obj_t *bpmArc, *bpmTap, *bpmValue;
|
||||
lv_obj_t *bpbDropdown, *currentBpbText;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include <libs/lvgl/lvgl.h>
|
||||
#include "Motion.h"
|
||||
#include "../DisplayApp.h"
|
||||
#include "displayapp/screens/Motion.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
#include "displayapp/DisplayApp.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
|
@@ -2,10 +2,10 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include <chrono>
|
||||
#include "Screen.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include <bits/unique_ptr.h>
|
||||
#include <libs/lvgl/src/lv_core/lv_style.h>
|
||||
#include <libs/lvgl/src/lv_core/lv_obj.h>
|
||||
#include <lvgl/src/lv_core/lv_style.h>
|
||||
#include <lvgl/src/lv_core/lv_obj.h>
|
||||
#include <components/motion/MotionController.h>
|
||||
|
||||
namespace Pinetime {
|
||||
|
@@ -15,10 +15,10 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "Music.h"
|
||||
#include "Symbols.h"
|
||||
#include "displayapp/screens/Music.h"
|
||||
#include "displayapp/screens/Symbols.h"
|
||||
#include <cstdint>
|
||||
#include "../DisplayApp.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
#include "components/ble/MusicService.h"
|
||||
#include "displayapp/icons/music/disc.cpp"
|
||||
#include "displayapp/icons/music/disc_f_1.cpp"
|
||||
@@ -277,12 +277,14 @@ bool Music::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
||||
return true;
|
||||
}
|
||||
case TouchEvents::SwipeDown: {
|
||||
lv_obj_set_hidden(btnNext, false);
|
||||
lv_obj_set_hidden(btnPrev, false);
|
||||
|
||||
lv_obj_set_hidden(btnVolDown, true);
|
||||
lv_obj_set_hidden(btnVolUp, true);
|
||||
return true;
|
||||
if (lv_obj_get_hidden(btnNext)) {
|
||||
lv_obj_set_hidden(btnNext, false);
|
||||
lv_obj_set_hidden(btnPrev, false);
|
||||
lv_obj_set_hidden(btnVolDown, true);
|
||||
lv_obj_set_hidden(btnVolUp, true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
case TouchEvents::SwipeLeft: {
|
||||
musicService.event(Controllers::MusicService::EVENT_MUSIC_NEXT);
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#include <FreeRTOS.h>
|
||||
#include <lvgl/src/lv_core/lv_obj.h>
|
||||
#include <string>
|
||||
#include "Screen.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Controllers {
|
||||
|
@@ -15,9 +15,9 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "Navigation.h"
|
||||
#include "displayapp/screens/Navigation.h"
|
||||
#include <cstdint>
|
||||
#include "../DisplayApp.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
#include "components/ble/NavigationService.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#include <FreeRTOS.h>
|
||||
#include <lvgl/src/lv_core/lv_obj.h>
|
||||
#include <string>
|
||||
#include "Screen.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include <array>
|
||||
|
||||
namespace Pinetime {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#include "NotificationIcon.h"
|
||||
#include "Symbols.h"
|
||||
#include "displayapp/screens/NotificationIcon.h"
|
||||
#include "displayapp/screens/Symbols.h"
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
const char* NotificationIcon::GetIcon(bool newNotificationAvailable) {
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#include "Notifications.h"
|
||||
#include <displayapp/DisplayApp.h>
|
||||
#include "displayapp/screens/Notifications.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
#include "components/ble/MusicService.h"
|
||||
#include "components/ble/AlertNotificationService.h"
|
||||
#include "Symbols.h"
|
||||
#include "displayapp/screens/Symbols.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
extern lv_font_t jetbrains_mono_extrabold_compressed;
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include "Screen.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "components/ble/NotificationManager.h"
|
||||
#include "components/motor/MotorController.h"
|
||||
|
||||
|
@@ -1,6 +1,8 @@
|
||||
#include "Paddle.h"
|
||||
#include "../DisplayApp.h"
|
||||
#include "../LittleVgl.h"
|
||||
#include "displayapp/screens/Paddle.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
#include "displayapp/LittleVgl.h"
|
||||
|
||||
#include <cstdlib> // for rand()
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
@@ -50,6 +52,13 @@ void Paddle::Refresh() {
|
||||
// checks if it has touched the side (right side)
|
||||
if (ballX >= LV_HOR_RES - ballSize - 1) {
|
||||
dx *= -1;
|
||||
dy += rand() % 3 - 1; // add a little randomization in wall bounce direction, one of [-1, 0, 1]
|
||||
if (dy > 5) { // limit dy to be in range [-5 to 5]
|
||||
dy = 5;
|
||||
}
|
||||
if (dy < -5) {
|
||||
dy = -5;
|
||||
}
|
||||
}
|
||||
|
||||
// checks if it is in the position of the paddle
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <cstdint>
|
||||
#include "Screen.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Components {
|
||||
|
24
src/displayapp/screens/PassKey.cpp
Normal file
24
src/displayapp/screens/PassKey.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "PassKey.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
PassKey::PassKey(Pinetime::Applications::DisplayApp* app, uint32_t key) : Screen(app) {
|
||||
passkeyLabel = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_set_style_local_text_color(passkeyLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFF00));
|
||||
lv_obj_set_style_local_text_font(passkeyLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42);
|
||||
lv_label_set_text_fmt(passkeyLabel, "%06u", key);
|
||||
lv_obj_align(passkeyLabel, nullptr, LV_ALIGN_CENTER, 0, -20);
|
||||
|
||||
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, "");
|
||||
}
|
||||
|
||||
PassKey::~PassKey() {
|
||||
lv_obj_clean(lv_scr_act());
|
||||
}
|
||||
|
21
src/displayapp/screens/PassKey.h
Normal file
21
src/displayapp/screens/PassKey.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include "Screen.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Applications {
|
||||
namespace Screens {
|
||||
|
||||
class PassKey : public Screen {
|
||||
public:
|
||||
PassKey(DisplayApp* app, uint32_t key);
|
||||
~PassKey() override;
|
||||
|
||||
private:
|
||||
lv_obj_t* passkeyLabel;
|
||||
lv_obj_t* backgroundLabel;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@@ -19,24 +19,31 @@
|
||||
* Style/layout copied from TimeStyle for Pebble by Dan Tilden (github.com/tilden)
|
||||
*/
|
||||
|
||||
#include "PineTimeStyle.h"
|
||||
#include "displayapp/screens/PineTimeStyle.h"
|
||||
#include <date/date.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <cstdio>
|
||||
#include <displayapp/Colors.h>
|
||||
#include "BatteryIcon.h"
|
||||
#include "BleIcon.h"
|
||||
#include "NotificationIcon.h"
|
||||
#include "Symbols.h"
|
||||
#include "displayapp/screens/BatteryIcon.h"
|
||||
#include "displayapp/screens/BleIcon.h"
|
||||
#include "displayapp/screens/NotificationIcon.h"
|
||||
#include "displayapp/screens/Symbols.h"
|
||||
#include "components/battery/BatteryController.h"
|
||||
#include "components/ble/BleController.h"
|
||||
#include "components/ble/NotificationManager.h"
|
||||
#include "components/motion/MotionController.h"
|
||||
#include "components/settings/Settings.h"
|
||||
#include "../DisplayApp.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
namespace {
|
||||
void event_handler(lv_obj_t* obj, lv_event_t event) {
|
||||
auto* screen = static_cast<PineTimeStyle*>(obj->user_data);
|
||||
screen->UpdateSelected(obj, event);
|
||||
}
|
||||
}
|
||||
|
||||
PineTimeStyle::PineTimeStyle(DisplayApp* app,
|
||||
Controllers::DateTime& dateTimeController,
|
||||
Controllers::Battery& batteryController,
|
||||
@@ -53,33 +60,30 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
|
||||
settingsController {settingsController},
|
||||
motionController {motionController} {
|
||||
|
||||
// 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
|
||||
// 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, Convert(settingsController.GetPTSColorBG()));
|
||||
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);
|
||||
lv_obj_align(timebar, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 0, 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, Convert(settingsController.GetPTSColorTime()));
|
||||
lv_label_set_text(timeDD1, "12");
|
||||
lv_label_set_text(timeDD1, "00");
|
||||
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, Convert(settingsController.GetPTSColorTime()));
|
||||
lv_label_set_text(timeDD2, "34");
|
||||
lv_label_set_text(timeDD2, "00");
|
||||
lv_obj_align(timeDD2, timebar, LV_ALIGN_IN_BOTTOM_MID, 5, -5);
|
||||
|
||||
timeAMPM = lv_label_create(lv_scr_act(), nullptr);
|
||||
@@ -97,74 +101,78 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
|
||||
|
||||
// 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_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
|
||||
lv_label_set_text(batteryIcon, Symbols::batteryFull);
|
||||
lv_obj_align(batteryIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 2);
|
||||
lv_obj_set_auto_realign(batteryIcon, true);
|
||||
|
||||
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_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25);
|
||||
lv_label_set_text(bleIcon, "");
|
||||
|
||||
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_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 40);
|
||||
lv_label_set_text(notificationIcon, "");
|
||||
|
||||
// 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_bg_color(calendarOuter, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
|
||||
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_bg_color(calendarInner, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
|
||||
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_bg_color(calendarBar1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
|
||||
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_bg_color(calendarBar2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
|
||||
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_bg_color(calendarCrossBar1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
|
||||
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_bg_color(calendarCrossBar2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
|
||||
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_obj_set_style_local_text_color(dateDayOfWeek, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
|
||||
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_obj_set_style_local_text_color(dateDay, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
|
||||
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_obj_set_style_local_text_color(dateMonth, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
|
||||
lv_label_set_text(dateMonth, "MAR");
|
||||
lv_obj_align(dateMonth, sidebar, LV_ALIGN_CENTER, 0, 32);
|
||||
|
||||
// Step count gauge
|
||||
needle_colors[0] = LV_COLOR_WHITE;
|
||||
if (settingsController.GetPTSColorBar() == Pinetime::Controllers::Settings::Colors::White) {
|
||||
needle_colors[0] = LV_COLOR_BLACK;
|
||||
} else {
|
||||
needle_colors[0] = LV_COLOR_WHITE;
|
||||
}
|
||||
stepGauge = lv_gauge_create(lv_scr_act(), nullptr);
|
||||
lv_gauge_set_needle_count(stepGauge, 1, needle_colors);
|
||||
lv_obj_set_size(stepGauge, 40, 40);
|
||||
@@ -193,6 +201,100 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
|
||||
lv_obj_set_pos(backgroundLabel, 0, 0);
|
||||
lv_label_set_text(backgroundLabel, "");
|
||||
|
||||
btnNextTime = lv_btn_create(lv_scr_act(), nullptr);
|
||||
btnNextTime->user_data = this;
|
||||
lv_obj_set_size(btnNextTime, 60, 60);
|
||||
lv_obj_align(btnNextTime, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -15, -80);
|
||||
lv_obj_set_style_local_bg_opa(btnNextTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50);
|
||||
lv_obj_set_style_local_value_str(btnNextTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, ">");
|
||||
lv_obj_set_event_cb(btnNextTime, event_handler);
|
||||
lv_obj_set_hidden(btnNextTime, true);
|
||||
|
||||
btnPrevTime = lv_btn_create(lv_scr_act(), nullptr);
|
||||
btnPrevTime->user_data = this;
|
||||
lv_obj_set_size(btnPrevTime, 60, 60);
|
||||
lv_obj_align(btnPrevTime, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 15, -80);
|
||||
lv_obj_set_style_local_bg_opa(btnPrevTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50);
|
||||
lv_obj_set_style_local_value_str(btnPrevTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "<");
|
||||
lv_obj_set_event_cb(btnPrevTime, event_handler);
|
||||
lv_obj_set_hidden(btnPrevTime, true);
|
||||
|
||||
btnNextBar = lv_btn_create(lv_scr_act(), nullptr);
|
||||
btnNextBar->user_data = this;
|
||||
lv_obj_set_size(btnNextBar, 60, 60);
|
||||
lv_obj_align(btnNextBar, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -15, 0);
|
||||
lv_obj_set_style_local_bg_opa(btnNextBar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50);
|
||||
lv_obj_set_style_local_value_str(btnNextBar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, ">");
|
||||
lv_obj_set_event_cb(btnNextBar, event_handler);
|
||||
lv_obj_set_hidden(btnNextBar, true);
|
||||
|
||||
btnPrevBar = lv_btn_create(lv_scr_act(), nullptr);
|
||||
btnPrevBar->user_data = this;
|
||||
lv_obj_set_size(btnPrevBar, 60, 60);
|
||||
lv_obj_align(btnPrevBar, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 15, 0);
|
||||
lv_obj_set_style_local_bg_opa(btnPrevBar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50);
|
||||
lv_obj_set_style_local_value_str(btnPrevBar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "<");
|
||||
lv_obj_set_event_cb(btnPrevBar, event_handler);
|
||||
lv_obj_set_hidden(btnPrevBar, true);
|
||||
|
||||
btnNextBG = lv_btn_create(lv_scr_act(), nullptr);
|
||||
btnNextBG->user_data = this;
|
||||
lv_obj_set_size(btnNextBG, 60, 60);
|
||||
lv_obj_align(btnNextBG, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -15, 80);
|
||||
lv_obj_set_style_local_bg_opa(btnNextBG, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50);
|
||||
lv_obj_set_style_local_value_str(btnNextBG, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, ">");
|
||||
lv_obj_set_event_cb(btnNextBG, event_handler);
|
||||
lv_obj_set_hidden(btnNextBG, true);
|
||||
|
||||
btnPrevBG = lv_btn_create(lv_scr_act(), nullptr);
|
||||
btnPrevBG->user_data = this;
|
||||
lv_obj_set_size(btnPrevBG, 60, 60);
|
||||
lv_obj_align(btnPrevBG, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 15, 80);
|
||||
lv_obj_set_style_local_bg_opa(btnPrevBG, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50);
|
||||
lv_obj_set_style_local_value_str(btnPrevBG, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "<");
|
||||
lv_obj_set_event_cb(btnPrevBG, event_handler);
|
||||
lv_obj_set_hidden(btnPrevBG, true);
|
||||
|
||||
btnReset = lv_btn_create(lv_scr_act(), nullptr);
|
||||
btnReset->user_data = this;
|
||||
lv_obj_set_size(btnReset, 60, 60);
|
||||
lv_obj_align(btnReset, lv_scr_act(), LV_ALIGN_CENTER, 0, 80);
|
||||
lv_obj_set_style_local_bg_opa(btnReset, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50);
|
||||
lv_obj_set_style_local_value_str(btnReset, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "Rst");
|
||||
lv_obj_set_event_cb(btnReset, event_handler);
|
||||
lv_obj_set_hidden(btnReset, true);
|
||||
|
||||
btnRandom = lv_btn_create(lv_scr_act(), nullptr);
|
||||
btnRandom->user_data = this;
|
||||
lv_obj_set_size(btnRandom, 60, 60);
|
||||
lv_obj_align(btnRandom, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
|
||||
lv_obj_set_style_local_bg_opa(btnRandom, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50);
|
||||
lv_obj_set_style_local_value_str(btnRandom, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "Rnd");
|
||||
lv_obj_set_event_cb(btnRandom, event_handler);
|
||||
lv_obj_set_hidden(btnRandom, true);
|
||||
|
||||
btnClose = lv_btn_create(lv_scr_act(), nullptr);
|
||||
btnClose->user_data = this;
|
||||
lv_obj_set_size(btnClose, 60, 60);
|
||||
lv_obj_align(btnClose, lv_scr_act(), LV_ALIGN_CENTER, 0, -80);
|
||||
lv_obj_set_style_local_bg_opa(btnClose, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50);
|
||||
lv_obj_set_style_local_value_str(btnClose, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "X");
|
||||
lv_obj_set_event_cb(btnClose, event_handler);
|
||||
lv_obj_set_hidden(btnClose, true);
|
||||
|
||||
btnSet = lv_btn_create(lv_scr_act(), nullptr);
|
||||
btnSet->user_data = this;
|
||||
lv_obj_set_height(btnSet, 150);
|
||||
lv_obj_set_width(btnSet, 150);
|
||||
lv_obj_align(btnSet, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
|
||||
lv_obj_set_style_local_radius(btnSet, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 30);
|
||||
lv_obj_set_style_local_bg_opa(btnSet, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50);
|
||||
lv_obj_set_event_cb(btnSet, event_handler);
|
||||
lbl_btnSet = lv_label_create(btnSet, nullptr);
|
||||
lv_obj_set_style_local_text_font(lbl_btnSet, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48);
|
||||
lv_label_set_text_static(lbl_btnSet, Symbols::settings);
|
||||
lv_obj_set_hidden(btnSet, true);
|
||||
|
||||
taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
|
||||
Refresh();
|
||||
}
|
||||
@@ -202,11 +304,55 @@ PineTimeStyle::~PineTimeStyle() {
|
||||
lv_obj_clean(lv_scr_act());
|
||||
}
|
||||
|
||||
bool PineTimeStyle::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
||||
if ((event == Pinetime::Applications::TouchEvents::LongTap) && lv_obj_get_hidden(btnRandom)) {
|
||||
lv_obj_set_hidden(btnSet, false);
|
||||
savedTick = lv_tick_get();
|
||||
return true;
|
||||
}
|
||||
if ((event == Pinetime::Applications::TouchEvents::DoubleTap) && (lv_obj_get_hidden(btnRandom) == false)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void PineTimeStyle::CloseMenu() {
|
||||
settingsController.SaveSettings();
|
||||
lv_obj_set_hidden(btnNextTime, true);
|
||||
lv_obj_set_hidden(btnPrevTime, true);
|
||||
lv_obj_set_hidden(btnNextBar, true);
|
||||
lv_obj_set_hidden(btnPrevBar, true);
|
||||
lv_obj_set_hidden(btnNextBG, true);
|
||||
lv_obj_set_hidden(btnPrevBG, true);
|
||||
lv_obj_set_hidden(btnReset, true);
|
||||
lv_obj_set_hidden(btnRandom, true);
|
||||
lv_obj_set_hidden(btnClose, true);
|
||||
}
|
||||
|
||||
bool PineTimeStyle::OnButtonPushed() {
|
||||
if (!lv_obj_get_hidden(btnClose)) {
|
||||
CloseMenu();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void PineTimeStyle::SetBatteryIcon() {
|
||||
auto batteryPercent = batteryPercentRemaining.Get();
|
||||
lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent));
|
||||
}
|
||||
|
||||
void PineTimeStyle::AlignIcons() {
|
||||
if (notificationState.Get() && bleState.Get()) {
|
||||
lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 8, 25);
|
||||
lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, -8, 25);
|
||||
} else if (notificationState.Get() && !bleState.Get()) {
|
||||
lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25);
|
||||
} else {
|
||||
lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25);
|
||||
}
|
||||
}
|
||||
|
||||
void PineTimeStyle::Refresh() {
|
||||
isCharging = batteryController.IsCharging();
|
||||
if (isCharging.IsUpdated()) {
|
||||
@@ -226,13 +372,13 @@ void PineTimeStyle::Refresh() {
|
||||
bleState = bleController.IsConnected();
|
||||
if (bleState.IsUpdated()) {
|
||||
lv_label_set_text(bleIcon, BleIcon::GetIcon(bleState.Get()));
|
||||
lv_obj_realign(bleIcon);
|
||||
AlignIcons();
|
||||
}
|
||||
|
||||
notificationState = notificatioManager.AreNewNotificationsAvailable();
|
||||
if (notificationState.IsUpdated()) {
|
||||
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(notificationState.Get()));
|
||||
lv_obj_realign(notificationIcon);
|
||||
AlignIcons();
|
||||
}
|
||||
|
||||
currentDateTime = dateTimeController.CurrentDateTime();
|
||||
@@ -257,7 +403,7 @@ void PineTimeStyle::Refresh() {
|
||||
char hoursChar[3];
|
||||
char ampmChar[5];
|
||||
if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) {
|
||||
sprintf(hoursChar, "%02d", hour);
|
||||
sprintf(hoursChar, "%02d", hour);
|
||||
} else {
|
||||
if (hour == 0 && hour != 12) {
|
||||
hour = 12;
|
||||
@@ -312,4 +458,154 @@ void PineTimeStyle::Refresh() {
|
||||
lv_obj_set_style_local_scale_grad_color(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
|
||||
}
|
||||
}
|
||||
if (!lv_obj_get_hidden(btnSet)) {
|
||||
if ((savedTick > 0) && (lv_tick_get() - savedTick > 3000)) {
|
||||
lv_obj_set_hidden(btnSet, true);
|
||||
savedTick = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) {
|
||||
auto valueTime = settingsController.GetPTSColorTime();
|
||||
auto valueBar = settingsController.GetPTSColorBar();
|
||||
auto valueBG = settingsController.GetPTSColorBG();
|
||||
|
||||
if (event == LV_EVENT_CLICKED) {
|
||||
if (object == btnNextTime) {
|
||||
valueTime = GetNext(valueTime);
|
||||
if (valueTime == valueBG) {
|
||||
valueTime = GetNext(valueTime);
|
||||
}
|
||||
settingsController.SetPTSColorTime(valueTime);
|
||||
lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
|
||||
lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
|
||||
lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
|
||||
}
|
||||
if (object == btnPrevTime) {
|
||||
valueTime = GetPrevious(valueTime);
|
||||
if (valueTime == valueBG) {
|
||||
valueTime = GetPrevious(valueTime);
|
||||
}
|
||||
settingsController.SetPTSColorTime(valueTime);
|
||||
lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
|
||||
lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
|
||||
lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
|
||||
}
|
||||
if (object == btnNextBar) {
|
||||
valueBar = GetNext(valueBar);
|
||||
if (valueBar == Controllers::Settings::Colors::Black) {
|
||||
valueBar = GetNext(valueBar);
|
||||
}
|
||||
if (valueBar == Controllers::Settings::Colors::White) {
|
||||
needle_colors[0] = LV_COLOR_BLACK;
|
||||
} else {
|
||||
needle_colors[0] = LV_COLOR_WHITE;
|
||||
}
|
||||
settingsController.SetPTSColorBar(valueBar);
|
||||
lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBar));
|
||||
}
|
||||
if (object == btnPrevBar) {
|
||||
valueBar = GetPrevious(valueBar);
|
||||
if (valueBar == Controllers::Settings::Colors::Black) {
|
||||
valueBar = GetPrevious(valueBar);
|
||||
}
|
||||
if (valueBar == Controllers::Settings::Colors::White) {
|
||||
needle_colors[0] = LV_COLOR_BLACK;
|
||||
} else {
|
||||
needle_colors[0] = LV_COLOR_WHITE;
|
||||
}
|
||||
settingsController.SetPTSColorBar(valueBar);
|
||||
lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBar));
|
||||
}
|
||||
if (object == btnNextBG) {
|
||||
valueBG = GetNext(valueBG);
|
||||
if (valueBG == valueTime) {
|
||||
valueBG = GetNext(valueBG);
|
||||
}
|
||||
settingsController.SetPTSColorBG(valueBG);
|
||||
lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBG));
|
||||
}
|
||||
if (object == btnPrevBG) {
|
||||
valueBG = GetPrevious(valueBG);
|
||||
if (valueBG == valueTime) {
|
||||
valueBG = GetPrevious(valueBG);
|
||||
}
|
||||
settingsController.SetPTSColorBG(valueBG);
|
||||
lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBG));
|
||||
}
|
||||
if (object == btnReset) {
|
||||
needle_colors[0] = LV_COLOR_WHITE;
|
||||
settingsController.SetPTSColorTime(Controllers::Settings::Colors::Teal);
|
||||
lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Teal));
|
||||
lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Teal));
|
||||
lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Teal));
|
||||
settingsController.SetPTSColorBar(Controllers::Settings::Colors::Teal);
|
||||
lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Teal));
|
||||
settingsController.SetPTSColorBG(Controllers::Settings::Colors::Black);
|
||||
lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Black));
|
||||
}
|
||||
if (object == btnRandom) {
|
||||
valueTime = static_cast<Controllers::Settings::Colors>(rand() % 17);
|
||||
valueBar = static_cast<Controllers::Settings::Colors>(rand() % 17);
|
||||
valueBG = static_cast<Controllers::Settings::Colors>(rand() % 17);
|
||||
if (valueTime == valueBG) {
|
||||
valueBG = GetNext(valueBG);
|
||||
}
|
||||
if (valueBar == Controllers::Settings::Colors::Black) {
|
||||
valueBar = GetPrevious(valueBar);
|
||||
}
|
||||
if (valueBar == Controllers::Settings::Colors::White) {
|
||||
needle_colors[0] = LV_COLOR_BLACK;
|
||||
} else {
|
||||
needle_colors[0] = LV_COLOR_WHITE;
|
||||
}
|
||||
settingsController.SetPTSColorTime(static_cast<Controllers::Settings::Colors>(valueTime));
|
||||
lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
|
||||
lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
|
||||
lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
|
||||
settingsController.SetPTSColorBar(static_cast<Controllers::Settings::Colors>(valueBar));
|
||||
lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBar));
|
||||
settingsController.SetPTSColorBG(static_cast<Controllers::Settings::Colors>(valueBG));
|
||||
lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBG));
|
||||
}
|
||||
if (object == btnClose) {
|
||||
CloseMenu();
|
||||
}
|
||||
if (object == btnSet) {
|
||||
lv_obj_set_hidden(btnSet, true);
|
||||
lv_obj_set_hidden(btnNextTime, false);
|
||||
lv_obj_set_hidden(btnPrevTime, false);
|
||||
lv_obj_set_hidden(btnNextBar, false);
|
||||
lv_obj_set_hidden(btnPrevBar, false);
|
||||
lv_obj_set_hidden(btnNextBG, false);
|
||||
lv_obj_set_hidden(btnPrevBG, false);
|
||||
lv_obj_set_hidden(btnReset, false);
|
||||
lv_obj_set_hidden(btnRandom, false);
|
||||
lv_obj_set_hidden(btnClose, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Pinetime::Controllers::Settings::Colors PineTimeStyle::GetNext(Pinetime::Controllers::Settings::Colors color) {
|
||||
auto colorAsInt = static_cast<uint8_t>(color);
|
||||
Pinetime::Controllers::Settings::Colors nextColor;
|
||||
if (colorAsInt < 16) {
|
||||
nextColor = static_cast<Controllers::Settings::Colors>(colorAsInt + 1);
|
||||
} else {
|
||||
nextColor = static_cast<Controllers::Settings::Colors>(0);
|
||||
}
|
||||
return nextColor;
|
||||
}
|
||||
|
||||
Pinetime::Controllers::Settings::Colors PineTimeStyle::GetPrevious(Pinetime::Controllers::Settings::Colors color) {
|
||||
auto colorAsInt = static_cast<uint8_t>(color);
|
||||
Pinetime::Controllers::Settings::Colors prevColor;
|
||||
|
||||
if (colorAsInt > 0) {
|
||||
prevColor = static_cast<Controllers::Settings::Colors>(colorAsInt - 1);
|
||||
} else {
|
||||
prevColor = static_cast<Controllers::Settings::Colors>(16);
|
||||
}
|
||||
return prevColor;
|
||||
}
|
||||
|
@@ -4,8 +4,8 @@
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include "Screen.h"
|
||||
#include "ScreenList.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "displayapp/Colors.h"
|
||||
#include "components/datetime/DateTimeController.h"
|
||||
|
||||
namespace Pinetime {
|
||||
@@ -15,6 +15,7 @@ namespace Pinetime {
|
||||
class Ble;
|
||||
class NotificationManager;
|
||||
class HeartRateController;
|
||||
class MotionController;
|
||||
}
|
||||
|
||||
namespace Applications {
|
||||
@@ -30,8 +31,13 @@ namespace Pinetime {
|
||||
Controllers::MotionController& motionController);
|
||||
~PineTimeStyle() override;
|
||||
|
||||
bool OnTouchEvent(TouchEvents event) override;
|
||||
bool OnButtonPushed() override;
|
||||
|
||||
void Refresh() override;
|
||||
|
||||
void UpdateSelected(lv_obj_t *object, lv_event_t event);
|
||||
|
||||
private:
|
||||
char displayedChar[5];
|
||||
|
||||
@@ -39,6 +45,7 @@ namespace Pinetime {
|
||||
Pinetime::Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown;
|
||||
Pinetime::Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown;
|
||||
uint8_t currentDay = 0;
|
||||
uint32_t savedTick = 0;
|
||||
|
||||
DirtyValue<uint8_t> batteryPercentRemaining {};
|
||||
DirtyValue<bool> isCharging {};
|
||||
@@ -48,6 +55,18 @@ namespace Pinetime {
|
||||
DirtyValue<uint32_t> stepCount {};
|
||||
DirtyValue<bool> notificationState {};
|
||||
|
||||
static Pinetime::Controllers::Settings::Colors GetNext(Controllers::Settings::Colors color);
|
||||
static Pinetime::Controllers::Settings::Colors GetPrevious(Controllers::Settings::Colors color);
|
||||
|
||||
lv_obj_t* btnNextTime;
|
||||
lv_obj_t* btnPrevTime;
|
||||
lv_obj_t* btnNextBar;
|
||||
lv_obj_t* btnPrevBar;
|
||||
lv_obj_t* btnNextBG;
|
||||
lv_obj_t* btnPrevBG;
|
||||
lv_obj_t* btnReset;
|
||||
lv_obj_t* btnRandom;
|
||||
lv_obj_t* btnClose;
|
||||
lv_obj_t* timebar;
|
||||
lv_obj_t* sidebar;
|
||||
lv_obj_t* timeDD1;
|
||||
@@ -67,6 +86,8 @@ namespace Pinetime {
|
||||
lv_obj_t* calendarCrossBar2;
|
||||
lv_obj_t* notificationIcon;
|
||||
lv_obj_t* stepGauge;
|
||||
lv_obj_t* btnSet;
|
||||
lv_obj_t* lbl_btnSet;
|
||||
lv_color_t needle_colors[1];
|
||||
|
||||
Controllers::DateTime& dateTimeController;
|
||||
@@ -77,6 +98,8 @@ namespace Pinetime {
|
||||
Controllers::MotionController& motionController;
|
||||
|
||||
void SetBatteryIcon();
|
||||
void CloseMenu();
|
||||
void AlignIcons();
|
||||
|
||||
lv_task_t* taskRefresh;
|
||||
};
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include "Screen.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
void Screen::RefreshTaskCallback(lv_task_t* task) {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include "../TouchEvents.h"
|
||||
#include "displayapp/TouchEvents.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
namespace Pinetime {
|
||||
|
@@ -3,8 +3,8 @@
|
||||
#include <array>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include "Screen.h"
|
||||
#include "../DisplayApp.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Applications {
|
||||
|
@@ -1,10 +1,15 @@
|
||||
#include "Steps.h"
|
||||
#include "displayapp/screens/Steps.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
#include "../DisplayApp.h"
|
||||
#include "Symbols.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
#include "displayapp/screens/Symbols.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
static void lap_event_handler(lv_obj_t* obj, lv_event_t event) {
|
||||
auto* steps = static_cast<Steps*>(obj->user_data);
|
||||
steps->lapBtnEventHandler(event);
|
||||
}
|
||||
|
||||
Steps::Steps(Pinetime::Applications::DisplayApp* app,
|
||||
Controllers::MotionController& motionController,
|
||||
Controllers::Settings& settingsController)
|
||||
@@ -17,11 +22,12 @@ Steps::Steps(Pinetime::Applications::DisplayApp* app,
|
||||
lv_obj_set_style_local_radius(stepsArc, LV_ARC_PART_BG, LV_STATE_DEFAULT, 0);
|
||||
lv_obj_set_style_local_line_color(stepsArc, LV_ARC_PART_INDIC, LV_STATE_DEFAULT, lv_color_hex(0x0000FF));
|
||||
lv_arc_set_end_angle(stepsArc, 200);
|
||||
lv_obj_set_size(stepsArc, 220, 220);
|
||||
lv_obj_set_size(stepsArc, 240, 240);
|
||||
lv_arc_set_range(stepsArc, 0, 500);
|
||||
lv_obj_align(stepsArc, nullptr, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
stepsCount = motionController.NbSteps();
|
||||
currentTripSteps = stepsCount - motionController.GetTripSteps();
|
||||
|
||||
lv_arc_set_value(stepsArc, int16_t(500 * stepsCount / settingsController.GetStepsGoal()));
|
||||
|
||||
@@ -29,18 +35,18 @@ Steps::Steps(Pinetime::Applications::DisplayApp* app,
|
||||
lv_obj_set_style_local_text_color(lSteps, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00));
|
||||
lv_obj_set_style_local_text_font(lSteps, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42);
|
||||
lv_label_set_text_fmt(lSteps, "%li", stepsCount);
|
||||
lv_obj_align(lSteps, nullptr, LV_ALIGN_CENTER, 0, -20);
|
||||
lv_obj_align(lSteps, nullptr, LV_ALIGN_CENTER, 0, -40);
|
||||
|
||||
lv_obj_t* lstepsL = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_set_style_local_text_color(lstepsL, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
|
||||
lv_label_set_text_static(lstepsL, "Steps");
|
||||
lv_obj_align(lstepsL, lSteps, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
|
||||
lv_obj_align(lstepsL, lSteps, LV_ALIGN_OUT_BOTTOM_MID, 0, 5);
|
||||
|
||||
lv_obj_t* lstepsGoal = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_set_style_local_text_color(lstepsGoal, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_CYAN);
|
||||
lv_label_set_text_fmt(lstepsGoal, "Goal\n%lu", settingsController.GetStepsGoal());
|
||||
lv_label_set_text_fmt(lstepsGoal, "Goal: %5lu", settingsController.GetStepsGoal());
|
||||
lv_label_set_align(lstepsGoal, LV_LABEL_ALIGN_CENTER);
|
||||
lv_obj_align(lstepsGoal, lSteps, LV_ALIGN_OUT_BOTTOM_MID, 0, 60);
|
||||
lv_obj_align(lstepsGoal, lSteps, LV_ALIGN_OUT_BOTTOM_MID, 0, 40);
|
||||
|
||||
lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
|
||||
@@ -48,6 +54,22 @@ Steps::Steps(Pinetime::Applications::DisplayApp* app,
|
||||
lv_obj_set_pos(backgroundLabel, 0, 0);
|
||||
lv_label_set_text_static(backgroundLabel, "");
|
||||
|
||||
resetBtn = lv_btn_create(lv_scr_act(), nullptr);
|
||||
resetBtn->user_data = this;
|
||||
lv_obj_set_event_cb(resetBtn, lap_event_handler);
|
||||
lv_obj_set_height(resetBtn, 50);
|
||||
lv_obj_set_width(resetBtn, 115);
|
||||
lv_obj_align(resetBtn, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, 0);
|
||||
resetButtonLabel = lv_label_create(resetBtn, nullptr);
|
||||
lv_label_set_text(resetButtonLabel, "Reset");
|
||||
|
||||
currentTripSteps = motionController.GetTripSteps();
|
||||
|
||||
tripLabel = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_set_style_local_text_color(tripLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW);
|
||||
lv_label_set_text_fmt(tripLabel, "Trip: %5li", currentTripSteps);
|
||||
lv_obj_align(tripLabel, lstepsGoal, LV_ALIGN_IN_LEFT_MID, 0, 20);
|
||||
|
||||
taskRefresh = lv_task_create(RefreshTaskCallback, 100, LV_TASK_PRIO_MID, this);
|
||||
}
|
||||
|
||||
@@ -58,9 +80,24 @@ Steps::~Steps() {
|
||||
|
||||
void Steps::Refresh() {
|
||||
stepsCount = motionController.NbSteps();
|
||||
currentTripSteps = motionController.GetTripSteps();
|
||||
|
||||
lv_label_set_text_fmt(lSteps, "%li", stepsCount);
|
||||
lv_obj_align(lSteps, nullptr, LV_ALIGN_CENTER, 0, -20);
|
||||
lv_obj_align(lSteps, nullptr, LV_ALIGN_CENTER, 0, -40);
|
||||
|
||||
if (currentTripSteps < 100000) {
|
||||
lv_label_set_text_fmt(tripLabel, "Trip: %5li", currentTripSteps);
|
||||
} else {
|
||||
lv_label_set_text_fmt(tripLabel, "Trip: 99999+");
|
||||
}
|
||||
lv_arc_set_value(stepsArc, int16_t(500 * stepsCount / settingsController.GetStepsGoal()));
|
||||
}
|
||||
|
||||
void Steps::lapBtnEventHandler(lv_event_t event) {
|
||||
if (event != LV_EVENT_CLICKED) {
|
||||
return;
|
||||
}
|
||||
stepsCount = motionController.NbSteps();
|
||||
motionController.ResetTrip();
|
||||
Refresh();
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include <lvgl/lvgl.h>
|
||||
#include "Screen.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include <components/motion/MotionController.h>
|
||||
|
||||
namespace Pinetime {
|
||||
@@ -20,14 +20,20 @@ namespace Pinetime {
|
||||
~Steps() override;
|
||||
|
||||
void Refresh() override;
|
||||
void lapBtnEventHandler(lv_event_t event);
|
||||
|
||||
private:
|
||||
Controllers::MotionController& motionController;
|
||||
Controllers::Settings& settingsController;
|
||||
|
||||
uint32_t currentTripSteps = 0;
|
||||
|
||||
lv_obj_t* lSteps;
|
||||
lv_obj_t* lStepsIcon;
|
||||
lv_obj_t* stepsArc;
|
||||
lv_obj_t* resetBtn;
|
||||
lv_obj_t* resetButtonLabel;
|
||||
lv_obj_t* tripLabel;
|
||||
|
||||
uint32_t stepsCount;
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#include "StopWatch.h"
|
||||
|
||||
#include "Screen.h"
|
||||
#include "Symbols.h"
|
||||
#include "lvgl/lvgl.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "displayapp/screens/Symbols.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
#include "projdefs.h"
|
||||
#include "FreeRTOSConfig.h"
|
||||
#include "task.h"
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "Screen.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "components/datetime/DateTimeController.h"
|
||||
#include "../LittleVgl.h"
|
||||
#include "displayapp/LittleVgl.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "portmacro_cmsis.h"
|
||||
|
8
src/displayapp/screens/Styles.cpp
Normal file
8
src/displayapp/screens/Styles.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
#include "Styles.h"
|
||||
|
||||
void Pinetime::Applications::Screens::SetRadioButtonStyle(lv_obj_t* checkbox) {
|
||||
lv_obj_set_style_local_radius(checkbox, LV_CHECKBOX_PART_BULLET, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
|
||||
lv_obj_set_style_local_border_width(checkbox, LV_CHECKBOX_PART_BULLET, LV_STATE_CHECKED, 9);
|
||||
lv_obj_set_style_local_border_color(checkbox, LV_CHECKBOX_PART_BULLET, LV_STATE_CHECKED, LV_COLOR_GREEN);
|
||||
lv_obj_set_style_local_bg_color(checkbox, LV_CHECKBOX_PART_BULLET, LV_STATE_CHECKED, LV_COLOR_WHITE);
|
||||
}
|
9
src/displayapp/screens/Styles.h
Normal file
9
src/displayapp/screens/Styles.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Applications {
|
||||
namespace Screens {
|
||||
void SetRadioButtonStyle(lv_obj_t* checkbox);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,7 +1,9 @@
|
||||
#include "SystemInfo.h"
|
||||
#include <FreeRTOS.h>
|
||||
#include <task.h>
|
||||
#include "displayapp/screens/SystemInfo.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
#include "../DisplayApp.h"
|
||||
#include "Label.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
#include "displayapp/screens/Label.h"
|
||||
#include "Version.h"
|
||||
#include "BootloaderVersion.h"
|
||||
#include "components/battery/BatteryController.h"
|
||||
@@ -41,8 +43,8 @@ SystemInfo::SystemInfo(Pinetime::Applications::DisplayApp* app,
|
||||
brightnessController {brightnessController},
|
||||
bleController {bleController},
|
||||
watchdog {watchdog},
|
||||
motionController{motionController},
|
||||
touchPanel{touchPanel},
|
||||
motionController {motionController},
|
||||
touchPanel {touchPanel},
|
||||
screens {app,
|
||||
0,
|
||||
{[this]() -> std::unique_ptr<Screen> {
|
||||
@@ -182,9 +184,7 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen3() {
|
||||
" #444444 used# %d (%d%%)\n"
|
||||
" #444444 max used# %lu\n"
|
||||
" #444444 frag# %d%%\n"
|
||||
" #444444 free# %d"
|
||||
"\n"
|
||||
"#444444 Steps# %i",
|
||||
" #444444 free# %d",
|
||||
bleAddr[5],
|
||||
bleAddr[4],
|
||||
bleAddr[3],
|
||||
@@ -195,8 +195,7 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen3() {
|
||||
mon.used_pct,
|
||||
mon.max_used,
|
||||
mon.frag_pct,
|
||||
static_cast<int>(mon.free_biggest_size),
|
||||
0);
|
||||
static_cast<int>(mon.free_biggest_size));
|
||||
lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
|
||||
return std::make_unique<Screens::Label>(2, 5, app, label);
|
||||
}
|
||||
@@ -209,7 +208,7 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen4() {
|
||||
static constexpr uint8_t maxTaskCount = 9;
|
||||
TaskStatus_t tasksStatus[maxTaskCount];
|
||||
|
||||
lv_obj_t* infoTask = lv_table_create(lv_scr_act(), NULL);
|
||||
lv_obj_t* infoTask = lv_table_create(lv_scr_act(), nullptr);
|
||||
lv_table_set_col_cnt(infoTask, 4);
|
||||
lv_table_set_row_cnt(infoTask, maxTaskCount + 1);
|
||||
lv_obj_set_style_local_pad_all(infoTask, LV_TABLE_PART_CELL1, LV_STATE_DEFAULT, 0);
|
||||
@@ -227,35 +226,37 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen4() {
|
||||
auto nb = uxTaskGetSystemState(tasksStatus, maxTaskCount, nullptr);
|
||||
std::sort(tasksStatus, tasksStatus + nb, sortById);
|
||||
for (uint8_t i = 0; i < nb && i < maxTaskCount; i++) {
|
||||
char buffer[7] = {0};
|
||||
|
||||
lv_table_set_cell_value(infoTask, i + 1, 0, std::to_string(tasksStatus[i].xTaskNumber).c_str());
|
||||
char state[2] = {0};
|
||||
sprintf(buffer, "%lu", tasksStatus[i].xTaskNumber);
|
||||
lv_table_set_cell_value(infoTask, i + 1, 0, buffer);
|
||||
switch (tasksStatus[i].eCurrentState) {
|
||||
case eReady:
|
||||
case eRunning:
|
||||
state[0] = 'R';
|
||||
buffer[0] = 'R';
|
||||
break;
|
||||
case eBlocked:
|
||||
state[0] = 'B';
|
||||
buffer[0] = 'B';
|
||||
break;
|
||||
case eSuspended:
|
||||
state[0] = 'S';
|
||||
buffer[0] = 'S';
|
||||
break;
|
||||
case eDeleted:
|
||||
state[0] = 'D';
|
||||
buffer[0] = 'D';
|
||||
break;
|
||||
default:
|
||||
state[0] = 'I'; // Invalid
|
||||
buffer[0] = 'I'; // Invalid
|
||||
break;
|
||||
}
|
||||
lv_table_set_cell_value(infoTask, i + 1, 1, state);
|
||||
buffer[1] = '\0';
|
||||
lv_table_set_cell_value(infoTask, i + 1, 1, buffer);
|
||||
lv_table_set_cell_value(infoTask, i + 1, 2, tasksStatus[i].pcTaskName);
|
||||
if (tasksStatus[i].usStackHighWaterMark < 20) {
|
||||
std::string str1 = std::to_string(tasksStatus[i].usStackHighWaterMark) + " low";
|
||||
lv_table_set_cell_value(infoTask, i + 1, 3, str1.c_str());
|
||||
sprintf(buffer, "%d low", tasksStatus[i].usStackHighWaterMark);
|
||||
} else {
|
||||
lv_table_set_cell_value(infoTask, i + 1, 3, std::to_string(tasksStatus[i].usStackHighWaterMark).c_str());
|
||||
sprintf(buffer, "%d", tasksStatus[i].usStackHighWaterMark);
|
||||
}
|
||||
lv_table_set_cell_value(infoTask, i + 1, 3, buffer);
|
||||
}
|
||||
return std::make_unique<Screens::Label>(3, 5, app, infoTask);
|
||||
}
|
||||
@@ -275,4 +276,4 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen5() {
|
||||
lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
|
||||
lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
|
||||
return std::make_unique<Screens::Label>(4, 5, app, label);
|
||||
}
|
||||
}
|
@@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include "Screen.h"
|
||||
#include "ScreenList.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "displayapp/screens/ScreenList.h"
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Controllers {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "Tile.h"
|
||||
#include "../DisplayApp.h"
|
||||
#include "BatteryIcon.h"
|
||||
#include "displayapp/screens/Tile.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
#include "displayapp/screens/BatteryIcon.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include "Screen.h"
|
||||
#include "../Apps.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "displayapp/Apps.h"
|
||||
#include "components/datetime/DateTimeController.h"
|
||||
#include "components/settings/Settings.h"
|
||||
#include "components/datetime/DateTimeController.h"
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#include "Timer.h"
|
||||
#include "displayapp/screens/Timer.h"
|
||||
|
||||
#include "Screen.h"
|
||||
#include "Symbols.h"
|
||||
#include "lvgl/lvgl.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "displayapp/screens/Symbols.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "Screen.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "components/datetime/DateTimeController.h"
|
||||
#include "systemtask/SystemTask.h"
|
||||
#include "../LittleVgl.h"
|
||||
#include "displayapp/LittleVgl.h"
|
||||
|
||||
#include "components/timer/TimerController.h"
|
||||
|
||||
|
@@ -1,10 +1,10 @@
|
||||
#include "Twos.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <string>
|
||||
#include <charconv>
|
||||
#include "displayapp/screens/Twos.h"
|
||||
#include <array>
|
||||
#include <vector>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
@@ -129,7 +129,7 @@ bool Twos::placeNewTile() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Twos::tryMerge(Tile grid[][4], int& newRow, int& newCol, int oldRow, int oldCol) {
|
||||
bool Twos::tryMerge(TwosTile grid[][4], int& newRow, int& newCol, int oldRow, int oldCol) {
|
||||
if ((grid[newRow][newCol].value == grid[oldRow][oldCol].value)) {
|
||||
if ((newCol != oldCol) || (newRow != oldRow)) {
|
||||
if (!grid[newRow][newCol].merged) {
|
||||
@@ -146,7 +146,7 @@ bool Twos::tryMerge(Tile grid[][4], int& newRow, int& newCol, int oldRow, int ol
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Twos::tryMove(Tile grid[][4], int newRow, int newCol, int oldRow, int oldCol) {
|
||||
bool Twos::tryMove(TwosTile grid[][4], int newRow, int newCol, int oldRow, int oldCol) {
|
||||
if (((newCol >= 0) && (newCol != oldCol)) || ((newRow >= 0) && (newRow != oldRow))) {
|
||||
grid[newRow][newCol].value = grid[oldRow][oldCol].value;
|
||||
grid[oldRow][oldCol].value = 0;
|
||||
@@ -261,11 +261,13 @@ bool Twos::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void Twos::updateGridDisplay(Tile grid[][4]) {
|
||||
void Twos::updateGridDisplay(TwosTile grid[][4]) {
|
||||
for (int row = 0; row < 4; row++) {
|
||||
for (int col = 0; col < 4; col++) {
|
||||
if (grid[row][col].value) {
|
||||
lv_table_set_cell_value(gridDisplay, row, col, (std::to_string(grid[row][col].value)).c_str());
|
||||
char buffer[7];
|
||||
sprintf(buffer, "%d", grid[row][col].value);
|
||||
lv_table_set_cell_value(gridDisplay, row, col, buffer);
|
||||
} else {
|
||||
lv_table_set_cell_value(gridDisplay, row, col, "");
|
||||
}
|
||||
|
@@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <lvgl/src/lv_core/lv_obj.h>
|
||||
#include "Screen.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Applications {
|
||||
struct Tile {
|
||||
struct TwosTile {
|
||||
bool merged = false;
|
||||
unsigned int value = 0;
|
||||
};
|
||||
@@ -26,11 +26,11 @@ namespace Pinetime {
|
||||
|
||||
lv_obj_t* scoreText;
|
||||
lv_obj_t* gridDisplay;
|
||||
Tile grid[4][4];
|
||||
TwosTile grid[4][4];
|
||||
unsigned int score = 0;
|
||||
void updateGridDisplay(Tile grid[][4]);
|
||||
bool tryMerge(Tile grid[][4], int& newRow, int& newCol, int oldRow, int oldCol);
|
||||
bool tryMove(Tile grid[][4], int newRow, int newCol, int oldRow, int oldCol);
|
||||
void updateGridDisplay(TwosTile grid[][4]);
|
||||
bool tryMerge(TwosTile grid[][4], int& newRow, int& newCol, int oldRow, int oldCol);
|
||||
bool tryMove(TwosTile grid[][4], int newRow, int newCol, int oldRow, int oldCol);
|
||||
bool placeNewTile();
|
||||
};
|
||||
}
|
||||
|
@@ -1,9 +1,11 @@
|
||||
#include <libs/lvgl/lvgl.h>
|
||||
#include "WatchFaceAnalog.h"
|
||||
#include "BatteryIcon.h"
|
||||
#include "BleIcon.h"
|
||||
#include "Symbols.h"
|
||||
#include "NotificationIcon.h"
|
||||
#include "displayapp/screens/WatchFaceAnalog.h"
|
||||
#include <cmath>
|
||||
#include <lvgl/lvgl.h>
|
||||
#include "displayapp/screens/BatteryIcon.h"
|
||||
#include "displayapp/screens/BleIcon.h"
|
||||
#include "displayapp/screens/Symbols.h"
|
||||
#include "displayapp/screens/NotificationIcon.h"
|
||||
#include "components/settings/Settings.h"
|
||||
|
||||
LV_IMG_DECLARE(bg_clock);
|
||||
|
||||
@@ -73,7 +75,7 @@ WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp* app,
|
||||
notificationIcon = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00));
|
||||
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false));
|
||||
lv_obj_align(notificationIcon, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
|
||||
lv_obj_align(notificationIcon, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
|
||||
|
||||
// Date - Day / Week day
|
||||
|
||||
|
@@ -4,8 +4,7 @@
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include "Screen.h"
|
||||
#include "ScreenList.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "components/datetime/DateTimeController.h"
|
||||
#include "components/battery/BatteryController.h"
|
||||
#include "components/ble/BleController.h"
|
||||
|
@@ -1,17 +1,18 @@
|
||||
#include "WatchFaceDigital.h"
|
||||
#include "displayapp/screens/WatchFaceDigital.h"
|
||||
|
||||
#include <date/date.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <cstdio>
|
||||
#include "BatteryIcon.h"
|
||||
#include "BleIcon.h"
|
||||
#include "NotificationIcon.h"
|
||||
#include "Symbols.h"
|
||||
#include "displayapp/screens/BatteryIcon.h"
|
||||
#include "displayapp/screens/BleIcon.h"
|
||||
#include "displayapp/screens/NotificationIcon.h"
|
||||
#include "displayapp/screens/Symbols.h"
|
||||
#include "components/battery/BatteryController.h"
|
||||
#include "components/ble/BleController.h"
|
||||
#include "components/ble/NotificationManager.h"
|
||||
#include "components/heartrate/HeartRateController.h"
|
||||
#include "components/motion/MotionController.h"
|
||||
#include "components/settings/Settings.h"
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
WatchFaceDigital::WatchFaceDigital(DisplayApp* app,
|
||||
@@ -43,7 +44,7 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app,
|
||||
lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0);
|
||||
|
||||
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(0x0000FF));
|
||||
lv_obj_set_style_local_text_color(bleIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x0082FC));
|
||||
lv_label_set_text(bleIcon, Symbols::bluetooth);
|
||||
lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0);
|
||||
|
||||
|
@@ -4,8 +4,7 @@
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include "Screen.h"
|
||||
#include "ScreenList.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "components/datetime/DateTimeController.h"
|
||||
|
||||
namespace Pinetime {
|
||||
|
222
src/displayapp/screens/Weather.cpp
Normal file
222
src/displayapp/screens/Weather.cpp
Normal file
@@ -0,0 +1,222 @@
|
||||
/* Copyright (C) 2021 Avamander
|
||||
|
||||
This file is part of InfiniTime.
|
||||
|
||||
InfiniTime is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
InfiniTime is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "Weather.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <components/ble/weather/WeatherService.h>
|
||||
#include "Label.h"
|
||||
#include "components/battery/BatteryController.h"
|
||||
#include "components/ble/BleController.h"
|
||||
#include "components/ble/weather/WeatherData.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
Weather::Weather(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::WeatherService& weather)
|
||||
: Screen(app),
|
||||
dateTimeController {dateTimeController},
|
||||
weatherService(weather),
|
||||
screens {app,
|
||||
0,
|
||||
{[this]() -> std::unique_ptr<Screen> {
|
||||
return CreateScreenTemperature();
|
||||
},
|
||||
[this]() -> std::unique_ptr<Screen> {
|
||||
return CreateScreenAir();
|
||||
},
|
||||
[this]() -> std::unique_ptr<Screen> {
|
||||
return CreateScreenClouds();
|
||||
},
|
||||
[this]() -> std::unique_ptr<Screen> {
|
||||
return CreateScreenPrecipitation();
|
||||
},
|
||||
[this]() -> std::unique_ptr<Screen> {
|
||||
return CreateScreenHumidity();
|
||||
}},
|
||||
Screens::ScreenListModes::UpDown} {
|
||||
}
|
||||
|
||||
Weather::~Weather() {
|
||||
lv_obj_clean(lv_scr_act());
|
||||
}
|
||||
|
||||
void Weather::Refresh() {
|
||||
if (running) {
|
||||
// screens.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
bool Weather::OnButtonPushed() {
|
||||
running = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Weather::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
||||
return screens.OnTouchEvent(event);
|
||||
}
|
||||
|
||||
std::unique_ptr<Screen> Weather::CreateScreenTemperature() {
|
||||
lv_obj_t* label = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_recolor(label, true);
|
||||
std::unique_ptr<Controllers::WeatherData::Temperature>& current = weatherService.GetCurrentTemperature();
|
||||
if (current->timestamp == 0) {
|
||||
// Do not use the data, it's invalid
|
||||
lv_label_set_text_fmt(label,
|
||||
"#FFFF00 Temperature#\n\n"
|
||||
"#444444 %d#°C \n\n"
|
||||
"#444444 %d#\n\n"
|
||||
"%d\n"
|
||||
"%d\n",
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
} else {
|
||||
lv_label_set_text_fmt(label,
|
||||
"#FFFF00 Temperature#\n\n"
|
||||
"#444444 %d#°C \n\n"
|
||||
"#444444 %hd#\n\n"
|
||||
"%llu\n"
|
||||
"%lu\n",
|
||||
current->temperature / 100,
|
||||
current->dewPoint,
|
||||
current->timestamp,
|
||||
current->expires);
|
||||
}
|
||||
lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
|
||||
lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
|
||||
return std::unique_ptr<Screen>(new Screens::Label(0, 5, app, label));
|
||||
}
|
||||
|
||||
std::unique_ptr<Screen> Weather::CreateScreenAir() {
|
||||
lv_obj_t* label = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_recolor(label, true);
|
||||
std::unique_ptr<Controllers::WeatherData::AirQuality>& current = weatherService.GetCurrentQuality();
|
||||
if (current->timestamp == 0) {
|
||||
// Do not use the data, it's invalid
|
||||
lv_label_set_text_fmt(label,
|
||||
"#FFFF00 Air quality#\n\n"
|
||||
"#444444 %s#\n"
|
||||
"#444444 %d#\n\n"
|
||||
"%d\n"
|
||||
"%d\n",
|
||||
"",
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
} else {
|
||||
lv_label_set_text_fmt(label,
|
||||
"#FFFF00 Air quality#\n\n"
|
||||
"#444444 %s#\n"
|
||||
"#444444 %lu#\n\n"
|
||||
"%llu\n"
|
||||
"%lu\n",
|
||||
current->polluter.c_str(),
|
||||
(current->amount / 100),
|
||||
current->timestamp,
|
||||
current->expires);
|
||||
}
|
||||
lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
|
||||
lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
|
||||
return std::unique_ptr<Screen>(new Screens::Label(0, 5, app, label));
|
||||
}
|
||||
|
||||
std::unique_ptr<Screen> Weather::CreateScreenClouds() {
|
||||
lv_obj_t* label = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_recolor(label, true);
|
||||
std::unique_ptr<Controllers::WeatherData::Clouds>& current = weatherService.GetCurrentClouds();
|
||||
if (current->timestamp == 0) {
|
||||
// Do not use the data, it's invalid
|
||||
lv_label_set_text_fmt(label,
|
||||
"#FFFF00 Clouds#\n\n"
|
||||
"#444444 %d%%#\n\n"
|
||||
"%d\n"
|
||||
"%d\n",
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
} else {
|
||||
lv_label_set_text_fmt(label,
|
||||
"#FFFF00 Clouds#\n\n"
|
||||
"#444444 %hhu%%#\n\n"
|
||||
"%llu\n"
|
||||
"%lu\n",
|
||||
current->amount,
|
||||
current->timestamp,
|
||||
current->expires);
|
||||
}
|
||||
lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
|
||||
lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
|
||||
return std::unique_ptr<Screen>(new Screens::Label(0, 5, app, label));
|
||||
}
|
||||
|
||||
std::unique_ptr<Screen> Weather::CreateScreenPrecipitation() {
|
||||
lv_obj_t* label = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_recolor(label, true);
|
||||
std::unique_ptr<Controllers::WeatherData::Precipitation>& current = weatherService.GetCurrentPrecipitation();
|
||||
if (current->timestamp == 0) {
|
||||
// Do not use the data, it's invalid
|
||||
lv_label_set_text_fmt(label,
|
||||
"#FFFF00 Precipitation#\n\n"
|
||||
"#444444 %d%%#\n\n"
|
||||
"%d\n"
|
||||
"%d\n",
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
} else {
|
||||
lv_label_set_text_fmt(label,
|
||||
"#FFFF00 Precipitation#\n\n"
|
||||
"#444444 %hhu%%#\n\n"
|
||||
"%llu\n"
|
||||
"%lu\n",
|
||||
current->amount,
|
||||
current->timestamp,
|
||||
current->expires);
|
||||
}
|
||||
lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
|
||||
lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
|
||||
return std::unique_ptr<Screen>(new Screens::Label(0, 5, app, label));
|
||||
}
|
||||
|
||||
std::unique_ptr<Screen> Weather::CreateScreenHumidity() {
|
||||
lv_obj_t* label = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_recolor(label, true);
|
||||
std::unique_ptr<Controllers::WeatherData::Humidity>& current = weatherService.GetCurrentHumidity();
|
||||
if (current->timestamp == 0) {
|
||||
// Do not use the data, it's invalid
|
||||
lv_label_set_text_fmt(label,
|
||||
"#FFFF00 Humidity#\n\n"
|
||||
"#444444 %d%%#\n\n"
|
||||
"%d\n"
|
||||
"%d\n",
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
} else {
|
||||
lv_label_set_text_fmt(label,
|
||||
"#FFFF00 Humidity#\n\n"
|
||||
"#444444 %hhu%%#\n\n"
|
||||
"%llu\n"
|
||||
"%lu\n",
|
||||
current->humidity,
|
||||
current->timestamp,
|
||||
current->expires);
|
||||
}
|
||||
lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
|
||||
lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
|
||||
return std::unique_ptr<Screen>(new Screens::Label(0, 5, app, label));
|
||||
}
|
45
src/displayapp/screens/Weather.h
Normal file
45
src/displayapp/screens/Weather.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <components/ble/weather/WeatherService.h>
|
||||
#include "Screen.h"
|
||||
#include "ScreenList.h"
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Applications {
|
||||
class DisplayApp;
|
||||
|
||||
namespace Screens {
|
||||
class Weather : public Screen {
|
||||
public:
|
||||
explicit Weather(DisplayApp* app, Pinetime::Controllers::WeatherService& weather);
|
||||
|
||||
~Weather() override;
|
||||
|
||||
void Refresh() override;
|
||||
|
||||
bool OnButtonPushed() override;
|
||||
|
||||
bool OnTouchEvent(TouchEvents event) override;
|
||||
|
||||
private:
|
||||
bool running = true;
|
||||
|
||||
Pinetime::Controllers::DateTime& dateTimeController;
|
||||
Controllers::WeatherService& weatherService;
|
||||
|
||||
ScreenList<5> screens;
|
||||
|
||||
std::unique_ptr<Screen> CreateScreenTemperature();
|
||||
|
||||
std::unique_ptr<Screen> CreateScreenAir();
|
||||
|
||||
std::unique_ptr<Screen> CreateScreenClouds();
|
||||
|
||||
std::unique_ptr<Screen> CreateScreenPrecipitation();
|
||||
|
||||
std::unique_ptr<Screen> CreateScreenHumidity();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
#include "QuickSettings.h"
|
||||
#include "displayapp/screens/settings/QuickSettings.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
#include "displayapp/screens/Symbols.h"
|
||||
#include "displayapp/screens/BatteryIcon.h"
|
||||
|
@@ -1,8 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <FreeRTOS.h>
|
||||
#include <timers.h>
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
#include "components/datetime/DateTimeController.h"
|
||||
|
@@ -1,7 +1,8 @@
|
||||
#include "SettingDisplay.h"
|
||||
#include "displayapp/screens/settings/SettingDisplay.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
#include "displayapp/DisplayApp.h"
|
||||
#include "displayapp/Messages.h"
|
||||
#include "displayapp/screens/Styles.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "displayapp/screens/Symbols.h"
|
||||
|
||||
@@ -14,6 +15,8 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
constexpr std::array<uint16_t, 4> SettingDisplay::options;
|
||||
|
||||
SettingDisplay::SettingDisplay(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
|
||||
: Screen(app), settingsController {settingsController} {
|
||||
|
||||
@@ -40,39 +43,19 @@ SettingDisplay::SettingDisplay(Pinetime::Applications::DisplayApp* app, Pinetime
|
||||
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_checkbox_set_checked(cbOption[optionsTotal], true);
|
||||
char buffer[12];
|
||||
for (unsigned int i = 0; i < options.size(); i++) {
|
||||
cbOption[i] = lv_checkbox_create(container1, nullptr);
|
||||
sprintf(buffer, "%3d seconds", options[i] / 1000);
|
||||
lv_checkbox_set_text(cbOption[i], buffer);
|
||||
cbOption[i]->user_data = this;
|
||||
lv_obj_set_event_cb(cbOption[i], event_handler);
|
||||
SetRadioButtonStyle(cbOption[i]);
|
||||
|
||||
if (settingsController.GetScreenTimeOut() == options[i]) {
|
||||
lv_checkbox_set_checked(cbOption[i], 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_checkbox_set_checked(cbOption[optionsTotal], true);
|
||||
}
|
||||
optionsTotal++;
|
||||
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
|
||||
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) {
|
||||
lv_checkbox_set_checked(cbOption[optionsTotal], true);
|
||||
}
|
||||
optionsTotal++;
|
||||
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
|
||||
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) {
|
||||
lv_checkbox_set_checked(cbOption[optionsTotal], true);
|
||||
}
|
||||
optionsTotal++;
|
||||
}
|
||||
|
||||
SettingDisplay::~SettingDisplay() {
|
||||
@@ -82,25 +65,11 @@ SettingDisplay::~SettingDisplay() {
|
||||
|
||||
void SettingDisplay::UpdateSelected(lv_obj_t* object, lv_event_t event) {
|
||||
if (event == LV_EVENT_CLICKED) {
|
||||
for (int i = 0; i < optionsTotal; i++) {
|
||||
for (unsigned int i = 0; i < options.size(); 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);
|
||||
};
|
||||
|
||||
settingsController.SetScreenTimeOut(options[i]);
|
||||
app->PushMessage(Applications::Display::Messages::UpdateTimeOut);
|
||||
|
||||
} else {
|
||||
lv_checkbox_set_checked(cbOption[i], false);
|
||||
}
|
||||
|
@@ -1,7 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
#include "components/settings/Settings.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
|
||||
@@ -18,9 +20,10 @@ namespace Pinetime {
|
||||
void UpdateSelected(lv_obj_t* object, lv_event_t event);
|
||||
|
||||
private:
|
||||
static constexpr std::array<uint16_t, 4> options = {5000, 15000, 20000, 30000};
|
||||
|
||||
Controllers::Settings& settingsController;
|
||||
uint8_t optionsTotal;
|
||||
lv_obj_t* cbOption[4];
|
||||
lv_obj_t* cbOption[options.size()];
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -1,318 +0,0 @@
|
||||
#include "SettingPineTimeStyle.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <displayapp/Colors.h>
|
||||
#include "displayapp/DisplayApp.h"
|
||||
#include "displayapp/screens/Symbols.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
namespace {
|
||||
static void event_handler(lv_obj_t* obj, lv_event_t event) {
|
||||
SettingPineTimeStyle* screen = static_cast<SettingPineTimeStyle*>(obj->user_data);
|
||||
screen->UpdateSelected(obj, event);
|
||||
}
|
||||
}
|
||||
|
||||
SettingPineTimeStyle::SettingPineTimeStyle(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
|
||||
: Screen(app), settingsController {settingsController} {
|
||||
timebar = lv_obj_create(lv_scr_act(), nullptr);
|
||||
lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorBG()));
|
||||
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, Convert(settingsController.GetPTSColorTime()));
|
||||
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, Convert(settingsController.GetPTSColorTime()));
|
||||
lv_label_set_text(timeDD2, "34");
|
||||
lv_obj_align(timeDD2, timebar, LV_ALIGN_IN_BOTTOM_MID, 5, -5);
|
||||
|
||||
timeAMPM = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorTime()));
|
||||
lv_obj_set_style_local_text_line_space(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, -3);
|
||||
lv_label_set_text(timeAMPM, "A\nM");
|
||||
lv_obj_align(timeAMPM, timebar, LV_ALIGN_IN_BOTTOM_LEFT, 2, -20);
|
||||
|
||||
// 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, Convert(settingsController.GetPTSColorBar()));
|
||||
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);
|
||||
|
||||
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, Symbols::bluetooth);
|
||||
lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25);
|
||||
|
||||
// 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);
|
||||
|
||||
// Step count gauge
|
||||
needle_colors[0] = LV_COLOR_WHITE;
|
||||
stepGauge = lv_gauge_create(lv_scr_act(), nullptr);
|
||||
lv_gauge_set_needle_count(stepGauge, 1, needle_colors);
|
||||
lv_obj_set_size(stepGauge, 40, 40);
|
||||
lv_obj_align(stepGauge, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
|
||||
lv_gauge_set_scale(stepGauge, 360, 11, 0);
|
||||
lv_gauge_set_angle_offset(stepGauge, 180);
|
||||
lv_gauge_set_critical_value(stepGauge, (100));
|
||||
lv_gauge_set_range(stepGauge, 0, (100));
|
||||
lv_gauge_set_value(stepGauge, 0, 0);
|
||||
|
||||
lv_obj_set_style_local_pad_right(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 3);
|
||||
lv_obj_set_style_local_pad_left(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 3);
|
||||
lv_obj_set_style_local_pad_bottom(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 3);
|
||||
lv_obj_set_style_local_line_opa(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
lv_obj_set_style_local_scale_width(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 4);
|
||||
lv_obj_set_style_local_line_width(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 4);
|
||||
lv_obj_set_style_local_line_color(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
|
||||
lv_obj_set_style_local_line_opa(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
lv_obj_set_style_local_line_width(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 3);
|
||||
lv_obj_set_style_local_pad_inner(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 4);
|
||||
|
||||
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, "");
|
||||
|
||||
btnNextTime = lv_btn_create(lv_scr_act(), nullptr);
|
||||
btnNextTime->user_data = this;
|
||||
lv_obj_set_size(btnNextTime, 60, 60);
|
||||
lv_obj_align(btnNextTime, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -15, -80);
|
||||
lv_obj_set_style_local_bg_opa(btnNextTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_30);
|
||||
lv_obj_set_style_local_value_str(btnNextTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, ">");
|
||||
lv_obj_set_event_cb(btnNextTime, event_handler);
|
||||
|
||||
btnPrevTime = lv_btn_create(lv_scr_act(), nullptr);
|
||||
btnPrevTime->user_data = this;
|
||||
lv_obj_set_size(btnPrevTime, 60, 60);
|
||||
lv_obj_align(btnPrevTime, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 15, -80);
|
||||
lv_obj_set_style_local_bg_opa(btnPrevTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_30);
|
||||
lv_obj_set_style_local_value_str(btnPrevTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "<");
|
||||
lv_obj_set_event_cb(btnPrevTime, event_handler);
|
||||
|
||||
btnNextBar = lv_btn_create(lv_scr_act(), nullptr);
|
||||
btnNextBar->user_data = this;
|
||||
lv_obj_set_size(btnNextBar, 60, 60);
|
||||
lv_obj_align(btnNextBar, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -15, 0);
|
||||
lv_obj_set_style_local_bg_opa(btnNextBar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_30);
|
||||
lv_obj_set_style_local_value_str(btnNextBar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, ">");
|
||||
lv_obj_set_event_cb(btnNextBar, event_handler);
|
||||
|
||||
btnPrevBar = lv_btn_create(lv_scr_act(), nullptr);
|
||||
btnPrevBar->user_data = this;
|
||||
lv_obj_set_size(btnPrevBar, 60, 60);
|
||||
lv_obj_align(btnPrevBar, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 15, 0);
|
||||
lv_obj_set_style_local_bg_opa(btnPrevBar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_30);
|
||||
lv_obj_set_style_local_value_str(btnPrevBar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "<");
|
||||
lv_obj_set_event_cb(btnPrevBar, event_handler);
|
||||
|
||||
btnNextBG = lv_btn_create(lv_scr_act(), nullptr);
|
||||
btnNextBG->user_data = this;
|
||||
lv_obj_set_size(btnNextBG, 60, 60);
|
||||
lv_obj_align(btnNextBG, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -15, 80);
|
||||
lv_obj_set_style_local_bg_opa(btnNextBG, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_30);
|
||||
lv_obj_set_style_local_value_str(btnNextBG, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, ">");
|
||||
lv_obj_set_event_cb(btnNextBG, event_handler);
|
||||
|
||||
btnPrevBG = lv_btn_create(lv_scr_act(), nullptr);
|
||||
btnPrevBG->user_data = this;
|
||||
lv_obj_set_size(btnPrevBG, 60, 60);
|
||||
lv_obj_align(btnPrevBG, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 15, 80);
|
||||
lv_obj_set_style_local_bg_opa(btnPrevBG, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_30);
|
||||
lv_obj_set_style_local_value_str(btnPrevBG, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "<");
|
||||
lv_obj_set_event_cb(btnPrevBG, event_handler);
|
||||
|
||||
btnReset = lv_btn_create(lv_scr_act(), nullptr);
|
||||
btnReset->user_data = this;
|
||||
lv_obj_set_size(btnReset, 60, 60);
|
||||
lv_obj_align(btnReset, lv_scr_act(), LV_ALIGN_CENTER, 0, 80);
|
||||
lv_obj_set_style_local_bg_opa(btnReset, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_30);
|
||||
lv_obj_set_style_local_value_str(btnReset, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "Rst");
|
||||
lv_obj_set_event_cb(btnReset, event_handler);
|
||||
|
||||
btnRandom = lv_btn_create(lv_scr_act(), nullptr);
|
||||
btnRandom->user_data = this;
|
||||
lv_obj_set_size(btnRandom, 60, 60);
|
||||
lv_obj_align(btnRandom, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
|
||||
lv_obj_set_style_local_bg_opa(btnRandom, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_30);
|
||||
lv_obj_set_style_local_value_str(btnRandom, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "Rnd");
|
||||
lv_obj_set_event_cb(btnRandom, event_handler);
|
||||
}
|
||||
|
||||
SettingPineTimeStyle::~SettingPineTimeStyle() {
|
||||
lv_obj_clean(lv_scr_act());
|
||||
settingsController.SaveSettings();
|
||||
}
|
||||
|
||||
void SettingPineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) {
|
||||
auto valueTime = settingsController.GetPTSColorTime();
|
||||
auto valueBar = settingsController.GetPTSColorBar();
|
||||
auto valueBG = settingsController.GetPTSColorBG();
|
||||
|
||||
if (event == LV_EVENT_CLICKED) {
|
||||
if (object == btnNextTime) {
|
||||
valueTime = GetNext(valueTime);
|
||||
|
||||
settingsController.SetPTSColorTime(valueTime);
|
||||
lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
|
||||
lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
|
||||
lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
|
||||
}
|
||||
if (object == btnPrevTime) {
|
||||
valueTime = GetPrevious(valueTime);
|
||||
settingsController.SetPTSColorTime(valueTime);
|
||||
lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
|
||||
lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
|
||||
lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
|
||||
}
|
||||
if (object == btnNextBar) {
|
||||
valueBar = GetNext(valueBar);
|
||||
if(valueBar == Controllers::Settings::Colors::Black)
|
||||
valueBar = GetNext(valueBar);
|
||||
settingsController.SetPTSColorBar(valueBar);
|
||||
lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBar));
|
||||
}
|
||||
if (object == btnPrevBar) {
|
||||
valueBar = GetPrevious(valueBar);
|
||||
if(valueBar == Controllers::Settings::Colors::Black)
|
||||
valueBar = GetPrevious(valueBar);
|
||||
settingsController.SetPTSColorBar(valueBar);
|
||||
lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBar));
|
||||
}
|
||||
if (object == btnNextBG) {
|
||||
valueBG = GetNext(valueBG);
|
||||
settingsController.SetPTSColorBG(valueBG);
|
||||
lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBG));
|
||||
}
|
||||
if (object == btnPrevBG) {
|
||||
valueBG = GetPrevious(valueBG);
|
||||
settingsController.SetPTSColorBG(valueBG);
|
||||
lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBG));
|
||||
}
|
||||
if (object == btnReset) {
|
||||
settingsController.SetPTSColorTime(Controllers::Settings::Colors::Teal);
|
||||
lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Teal));
|
||||
lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Teal));
|
||||
lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Teal));
|
||||
settingsController.SetPTSColorBar(Controllers::Settings::Colors::Teal);
|
||||
lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Teal));
|
||||
settingsController.SetPTSColorBG(Controllers::Settings::Colors::Black);
|
||||
lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Black));
|
||||
}
|
||||
if (object == btnRandom) {
|
||||
uint8_t randTime = rand() % 17;
|
||||
uint8_t randBar = rand() % 17;
|
||||
uint8_t randBG = rand() % 17;
|
||||
// Check if the time color is the same as its background, or if the sidebar is black. If so, change them to more useful values.
|
||||
if (randTime == randBG) {
|
||||
randBG += 1;
|
||||
}
|
||||
if (randBar == 3) {
|
||||
randBar -= 1;
|
||||
}
|
||||
settingsController.SetPTSColorTime(static_cast<Controllers::Settings::Colors>(randTime));
|
||||
lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(static_cast<Controllers::Settings::Colors>(randTime)));
|
||||
lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(static_cast<Controllers::Settings::Colors>(randTime)));
|
||||
lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(static_cast<Controllers::Settings::Colors>(randTime)));
|
||||
settingsController.SetPTSColorBar(static_cast<Controllers::Settings::Colors>(randBar));
|
||||
lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(static_cast<Controllers::Settings::Colors>(randBar)));
|
||||
settingsController.SetPTSColorBG(static_cast<Controllers::Settings::Colors>(randBG));
|
||||
lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(static_cast<Controllers::Settings::Colors>(randBG)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Pinetime::Controllers::Settings::Colors SettingPineTimeStyle::GetNext(Pinetime::Controllers::Settings::Colors color) {
|
||||
auto colorAsInt = static_cast<uint8_t>(color);
|
||||
Pinetime::Controllers::Settings::Colors nextColor;
|
||||
if (colorAsInt < 16) {
|
||||
nextColor = static_cast<Controllers::Settings::Colors>(colorAsInt + 1);
|
||||
} else {
|
||||
nextColor = static_cast<Controllers::Settings::Colors>(0);
|
||||
}
|
||||
return nextColor;
|
||||
}
|
||||
|
||||
Pinetime::Controllers::Settings::Colors SettingPineTimeStyle::GetPrevious(Pinetime::Controllers::Settings::Colors color) {
|
||||
auto colorAsInt = static_cast<uint8_t>(color);
|
||||
Pinetime::Controllers::Settings::Colors prevColor;
|
||||
|
||||
if (colorAsInt > 0) {
|
||||
prevColor = static_cast<Controllers::Settings::Colors>(colorAsInt - 1);
|
||||
} else {
|
||||
prevColor = static_cast<Controllers::Settings::Colors>(16);
|
||||
}
|
||||
return prevColor;
|
||||
}
|
@@ -1,56 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <lvgl/lvgl.h>
|
||||
#include "components/settings/Settings.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
|
||||
namespace Pinetime {
|
||||
|
||||
namespace Applications {
|
||||
namespace Screens {
|
||||
|
||||
class SettingPineTimeStyle : public Screen{
|
||||
public:
|
||||
SettingPineTimeStyle(DisplayApp* app, Pinetime::Controllers::Settings &settingsController);
|
||||
~SettingPineTimeStyle() override;
|
||||
|
||||
void UpdateSelected(lv_obj_t *object, lv_event_t event);
|
||||
|
||||
private:
|
||||
Controllers::Settings& settingsController;
|
||||
|
||||
Pinetime::Controllers::Settings::Colors GetNext(Controllers::Settings::Colors color);
|
||||
Pinetime::Controllers::Settings::Colors GetPrevious(Controllers::Settings::Colors color);
|
||||
|
||||
lv_obj_t * btnNextTime;
|
||||
lv_obj_t * btnPrevTime;
|
||||
lv_obj_t * btnNextBar;
|
||||
lv_obj_t * btnPrevBar;
|
||||
lv_obj_t * btnNextBG;
|
||||
lv_obj_t * btnPrevBG;
|
||||
lv_obj_t * btnReset;
|
||||
lv_obj_t * btnRandom;
|
||||
lv_obj_t * timebar;
|
||||
lv_obj_t * sidebar;
|
||||
lv_obj_t * timeDD1;
|
||||
lv_obj_t * timeDD2;
|
||||
lv_obj_t * timeAMPM;
|
||||
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 * calendarOuter;
|
||||
lv_obj_t * calendarInner;
|
||||
lv_obj_t * calendarBar1;
|
||||
lv_obj_t * calendarBar2;
|
||||
lv_obj_t * calendarCrossBar1;
|
||||
lv_obj_t * calendarCrossBar2;
|
||||
lv_obj_t * stepGauge;
|
||||
lv_color_t needle_colors[1];
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
#include "SettingSetDate.h"
|
||||
#include "displayapp/screens/settings/SettingSetDate.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <hal/nrf_rtc.h>
|
||||
#include <nrf_log.h>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include "SettingSetTime.h"
|
||||
#include "displayapp/screens/settings/SettingSetTime.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <hal/nrf_rtc.h>
|
||||
#include <nrf_log.h>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include "SettingSteps.h"
|
||||
#include "displayapp/screens/settings/SettingSteps.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
#include "displayapp/DisplayApp.h"
|
||||
#include "displayapp/screens/Symbols.h"
|
||||
@@ -6,8 +6,8 @@
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
namespace {
|
||||
static void event_handler(lv_obj_t * obj, lv_event_t event) {
|
||||
SettingSteps* screen = static_cast<SettingSteps *>(obj->user_data);
|
||||
void event_handler(lv_obj_t* obj, lv_event_t event) {
|
||||
SettingSteps* screen = static_cast<SettingSteps*>(obj->user_data);
|
||||
screen->UpdateSelected(obj, event);
|
||||
}
|
||||
}
|
||||
@@ -30,33 +30,32 @@ SettingSteps::SettingSteps(
|
||||
lv_obj_set_height(container1, LV_VER_RES - 60);
|
||||
lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT);
|
||||
|
||||
lv_obj_t * title = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text_static(title,"Daily steps goal");
|
||||
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(), NULL);
|
||||
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::shoe);
|
||||
lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER);
|
||||
lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0);
|
||||
|
||||
|
||||
stepValue = lv_label_create(lv_scr_act(), NULL);
|
||||
stepValue = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_set_style_local_text_font(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42);
|
||||
lv_label_set_text_fmt(stepValue, "%lu", settingsController.GetStepsGoal());
|
||||
lv_label_set_align(stepValue, LV_LABEL_ALIGN_CENTER);
|
||||
lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_CENTER, 0, -10);
|
||||
|
||||
btnPlus = lv_btn_create(lv_scr_act(), NULL);
|
||||
btnPlus = lv_btn_create(lv_scr_act(), nullptr);
|
||||
btnPlus->user_data = this;
|
||||
lv_obj_set_size(btnPlus, 80, 50);
|
||||
lv_obj_align(btnPlus, lv_scr_act(), LV_ALIGN_CENTER, 55, 80);
|
||||
lv_obj_set_style_local_value_str(btnPlus, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "+");
|
||||
lv_obj_set_event_cb(btnPlus, event_handler);
|
||||
|
||||
btnMinus = lv_btn_create(lv_scr_act(), NULL);
|
||||
btnMinus = lv_btn_create(lv_scr_act(), nullptr);
|
||||
btnMinus->user_data = this;
|
||||
lv_obj_set_size(btnMinus, 80, 50);
|
||||
lv_obj_set_event_cb(btnMinus, event_handler);
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include "SettingTimeFormat.h"
|
||||
#include "displayapp/screens/settings/SettingTimeFormat.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
#include "displayapp/DisplayApp.h"
|
||||
#include "displayapp/screens/Styles.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "displayapp/screens/Symbols.h"
|
||||
|
||||
@@ -13,6 +14,8 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
constexpr std::array<const char*, 2> SettingTimeFormat::options;
|
||||
|
||||
SettingTimeFormat::SettingTimeFormat(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
|
||||
: Screen(app), settingsController {settingsController} {
|
||||
|
||||
@@ -39,24 +42,19 @@ SettingTimeFormat::SettingTimeFormat(Pinetime::Applications::DisplayApp* app, Pi
|
||||
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], " 12-hour");
|
||||
cbOption[optionsTotal]->user_data = this;
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) {
|
||||
lv_checkbox_set_checked(cbOption[optionsTotal], true);
|
||||
for (unsigned int i = 0; i < options.size(); i++) {
|
||||
cbOption[i] = lv_checkbox_create(container1, nullptr);
|
||||
lv_checkbox_set_text(cbOption[i], options[i]);
|
||||
cbOption[i]->user_data = this;
|
||||
lv_obj_set_event_cb(cbOption[i], event_handler);
|
||||
SetRadioButtonStyle(cbOption[i]);
|
||||
}
|
||||
|
||||
optionsTotal++;
|
||||
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_checkbox_set_checked(cbOption[optionsTotal], true);
|
||||
if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) {
|
||||
lv_checkbox_set_checked(cbOption[0], true);
|
||||
} else if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) {
|
||||
lv_checkbox_set_checked(cbOption[1], true);
|
||||
}
|
||||
optionsTotal++;
|
||||
}
|
||||
|
||||
SettingTimeFormat::~SettingTimeFormat() {
|
||||
@@ -66,7 +64,7 @@ SettingTimeFormat::~SettingTimeFormat() {
|
||||
|
||||
void SettingTimeFormat::UpdateSelected(lv_obj_t* object, lv_event_t event) {
|
||||
if (event == LV_EVENT_VALUE_CHANGED) {
|
||||
for (int i = 0; i < optionsTotal; i++) {
|
||||
for (unsigned int i = 0; i < options.size(); i++) {
|
||||
if (object == cbOption[i]) {
|
||||
lv_checkbox_set_checked(cbOption[i], true);
|
||||
|
||||
|
@@ -1,7 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
#include "components/settings/Settings.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
|
||||
@@ -18,9 +20,9 @@ namespace Pinetime {
|
||||
void UpdateSelected(lv_obj_t* object, lv_event_t event);
|
||||
|
||||
private:
|
||||
static constexpr std::array<const char*, 2> options = {" 12-hour", " 24-hour"};
|
||||
Controllers::Settings& settingsController;
|
||||
uint8_t optionsTotal;
|
||||
lv_obj_t* cbOption[2];
|
||||
lv_obj_t* cbOption[options.size()];
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include "SettingWakeUp.h"
|
||||
#include "displayapp/screens/settings/SettingWakeUp.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
#include "displayapp/DisplayApp.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
|
@@ -1,7 +1,8 @@
|
||||
#include "SettingWatchFace.h"
|
||||
#include "displayapp/screens/settings/SettingWatchFace.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
#include "displayapp/DisplayApp.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "displayapp/screens/Styles.h"
|
||||
#include "displayapp/screens/Symbols.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
@@ -13,6 +14,8 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
constexpr std::array<const char*, 3> SettingWatchFace::options;
|
||||
|
||||
SettingWatchFace::SettingWatchFace(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
|
||||
: Screen(app), settingsController {settingsController} {
|
||||
|
||||
@@ -40,34 +43,17 @@ SettingWatchFace::SettingWatchFace(Pinetime::Applications::DisplayApp* app, Pine
|
||||
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], " Digital face");
|
||||
cbOption[optionsTotal]->user_data = this;
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.GetClockFace() == 0) {
|
||||
lv_checkbox_set_checked(cbOption[optionsTotal], true);
|
||||
}
|
||||
for (unsigned int i = 0; i < options.size(); i++) {
|
||||
cbOption[i] = lv_checkbox_create(container1, nullptr);
|
||||
lv_checkbox_set_text(cbOption[i], options[i]);
|
||||
cbOption[i]->user_data = this;
|
||||
lv_obj_set_event_cb(cbOption[i], event_handler);
|
||||
SetRadioButtonStyle(cbOption[i]);
|
||||
|
||||
optionsTotal++;
|
||||
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_checkbox_set_checked(cbOption[optionsTotal], true);
|
||||
if (settingsController.GetClockFace() == i) {
|
||||
lv_checkbox_set_checked(cbOption[i], true);
|
||||
}
|
||||
}
|
||||
|
||||
optionsTotal++;
|
||||
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
|
||||
lv_checkbox_set_text_static(cbOption[optionsTotal], " PineTimeStyle");
|
||||
cbOption[optionsTotal]->user_data = this;
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.GetClockFace() == 2) {
|
||||
lv_checkbox_set_checked(cbOption[optionsTotal], true);
|
||||
}
|
||||
|
||||
optionsTotal++;
|
||||
}
|
||||
|
||||
SettingWatchFace::~SettingWatchFace() {
|
||||
@@ -77,7 +63,7 @@ SettingWatchFace::~SettingWatchFace() {
|
||||
|
||||
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++) {
|
||||
for (unsigned int i = 0; i < options.size(); i++) {
|
||||
if (object == cbOption[i]) {
|
||||
lv_checkbox_set_checked(cbOption[i], true);
|
||||
settingsController.SetClockFace(i);
|
||||
|
@@ -1,7 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
#include "components/settings/Settings.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
|
||||
@@ -18,9 +20,10 @@ namespace Pinetime {
|
||||
void UpdateSelected(lv_obj_t* object, lv_event_t event);
|
||||
|
||||
private:
|
||||
static constexpr std::array<const char*, 3> options = {" Digital face", " Analog face", " PineTimeStyle"};
|
||||
Controllers::Settings& settingsController;
|
||||
uint8_t optionsTotal;
|
||||
lv_obj_t* cbOption[2];
|
||||
|
||||
lv_obj_t* cbOption[options.size()];
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include "Settings.h"
|
||||
#include "displayapp/screens/settings/Settings.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <array>
|
||||
#include "displayapp/screens/List.h"
|
||||
@@ -60,6 +60,7 @@ std::unique_ptr<Screen> Settings::CreateScreen2() {
|
||||
std::unique_ptr<Screen> Settings::CreateScreen3() {
|
||||
|
||||
std::array<Screens::List::Applications, 4> applications {{
|
||||
|
||||
{Symbols::clock, "Chimes", Apps::SettingChimes},
|
||||
{Symbols::check, "Firmware", Apps::FirmwareValidation},
|
||||
{Symbols::list, "About", Apps::SysInfo},
|
||||
|
Reference in New Issue
Block a user