-
-
Notifications
You must be signed in to change notification settings - Fork 954
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show alarm controller state in status icon
- Loading branch information
Showing
14 changed files
with
243 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
#include "displayapp/screens/Clock.h" | ||
|
||
#include <lvgl/lvgl.h> | ||
#include "components/battery/BatteryController.h" | ||
#include "components/motion/MotionController.h" | ||
#include "components/ble/BleController.h" | ||
#include "components/ble/NotificationManager.h" | ||
#include "components/settings/Settings.h" | ||
#include "displayapp/DisplayApp.h" | ||
#include "displayapp/screens/WatchFaceDigital.h" | ||
#include "displayapp/screens/WatchFaceTerminal.h" | ||
#include "displayapp/screens/WatchFaceInfineat.h" | ||
#include "displayapp/screens/WatchFaceAnalog.h" | ||
#include "displayapp/screens/WatchFacePineTimeStyle.h" | ||
#include "displayapp/screens/WatchFaceCasioStyleG7710.h" | ||
|
||
using namespace Pinetime::Applications::Screens; | ||
using namespace Pinetime::Applications; | ||
|
||
Clock::Clock(Controllers::DateTime& dateTimeController, | ||
const Controllers::Battery& batteryController, | ||
const Controllers::Ble& bleController, | ||
const Controllers::AlarmController& alarmController, | ||
Controllers::NotificationManager& notificationManager, | ||
Controllers::Settings& settingsController, | ||
Controllers::HeartRateController& heartRateController, | ||
Controllers::MotionController& motionController, | ||
Controllers::WeatherService& weatherService, | ||
Controllers::FS& filesystem) | ||
: dateTimeController {dateTimeController}, | ||
batteryController {batteryController}, | ||
bleController {bleController}, | ||
alarmController {alarmController}, | ||
notificationManager {notificationManager}, | ||
settingsController {settingsController}, | ||
heartRateController {heartRateController}, | ||
motionController {motionController}, | ||
weatherService {weatherService}, | ||
filesystem {filesystem}, | ||
screen {[this, &settingsController]() { | ||
switch (settingsController.GetWatchFace()) { | ||
case WatchFace::Digital: | ||
return WatchFaceDigitalScreen(); | ||
break; | ||
case WatchFace::Analog: | ||
return WatchFaceAnalogScreen(); | ||
break; | ||
case WatchFace::PineTimeStyle: | ||
return WatchFacePineTimeStyleScreen(); | ||
break; | ||
case WatchFace::Terminal: | ||
return WatchFaceTerminalScreen(); | ||
break; | ||
case WatchFace::Infineat: | ||
return WatchFaceInfineatScreen(); | ||
break; | ||
case WatchFace::CasioStyleG7710: | ||
return WatchFaceCasioStyleG7710(); | ||
break; | ||
} | ||
return WatchFaceDigitalScreen(); | ||
}()} { | ||
settingsController.SetAppMenu(0); | ||
} | ||
|
||
Clock::~Clock() { | ||
lv_obj_clean(lv_scr_act()); | ||
} | ||
|
||
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>(dateTimeController, | ||
batteryController, | ||
bleController, | ||
alarmController, | ||
notificationManager, | ||
settingsController, | ||
heartRateController, | ||
motionController); | ||
} | ||
|
||
std::unique_ptr<Screen> Clock::WatchFaceAnalogScreen() { | ||
return std::make_unique<Screens::WatchFaceAnalog>(dateTimeController, | ||
batteryController, | ||
bleController, | ||
notificationManager, | ||
settingsController); | ||
} | ||
|
||
std::unique_ptr<Screen> Clock::WatchFacePineTimeStyleScreen() { | ||
return std::make_unique<Screens::WatchFacePineTimeStyle>(dateTimeController, | ||
batteryController, | ||
bleController, | ||
notificationManager, | ||
settingsController, | ||
motionController, | ||
weatherService); | ||
} | ||
|
||
std::unique_ptr<Screen> Clock::WatchFaceTerminalScreen() { | ||
return std::make_unique<Screens::WatchFaceTerminal>(dateTimeController, | ||
batteryController, | ||
bleController, | ||
notificationManager, | ||
settingsController, | ||
heartRateController, | ||
motionController); | ||
} | ||
|
||
std::unique_ptr<Screen> Clock::WatchFaceInfineatScreen() { | ||
return std::make_unique<Screens::WatchFaceInfineat>(dateTimeController, | ||
batteryController, | ||
bleController, | ||
notificationManager, | ||
settingsController, | ||
motionController, | ||
filesystem); | ||
} | ||
|
||
std::unique_ptr<Screen> Clock::WatchFaceCasioStyleG7710() { | ||
return std::make_unique<Screens::WatchFaceCasioStyleG7710>(dateTimeController, | ||
batteryController, | ||
bleController, | ||
notificationManager, | ||
settingsController, | ||
heartRateController, | ||
motionController, | ||
filesystem); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#pragma once | ||
|
||
#include <chrono> | ||
#include <cstdint> | ||
#include <memory> | ||
#include "displayapp/Controllers.h" | ||
#include "displayapp/screens/Screen.h" | ||
#include "displayapp/Apps.h" | ||
#include "Symbols.h" | ||
|
||
namespace Pinetime { | ||
namespace Controllers { | ||
class Settings; | ||
class Battery; | ||
class Ble; | ||
class AlarmController; | ||
class NotificationManager; | ||
class MotionController; | ||
class DateTime; | ||
class HeartRateController; | ||
class WeatherService; | ||
class FS; | ||
} | ||
|
||
namespace Applications { | ||
namespace Screens { | ||
class Clock : public Screen { | ||
public: | ||
Clock(Controllers::DateTime& dateTimeController, | ||
const Controllers::Battery& batteryController, | ||
const Controllers::Ble& bleController, | ||
const Controllers::AlarmController& alarmController, | ||
Controllers::NotificationManager& notificationManager, | ||
Controllers::Settings& settingsController, | ||
Controllers::HeartRateController& heartRateController, | ||
Controllers::MotionController& motionController, | ||
Controllers::WeatherService& weatherService, | ||
Controllers::FS& filesystem); | ||
~Clock() override; | ||
|
||
bool OnTouchEvent(TouchEvents event) override; | ||
bool OnButtonPushed() override; | ||
|
||
private: | ||
Controllers::DateTime& dateTimeController; | ||
const Controllers::Battery& batteryController; | ||
const Controllers::Ble& bleController; | ||
const Controllers::AlarmController& alarmController; | ||
Controllers::NotificationManager& notificationManager; | ||
Controllers::Settings& settingsController; | ||
Controllers::HeartRateController& heartRateController; | ||
Controllers::MotionController& motionController; | ||
Controllers::WeatherService& weatherService; | ||
Controllers::FS& filesystem; | ||
|
||
std::unique_ptr<Screen> screen; | ||
std::unique_ptr<Screen> WatchFaceDigitalScreen(); | ||
std::unique_ptr<Screen> WatchFaceAnalogScreen(); | ||
std::unique_ptr<Screen> WatchFacePineTimeStyleScreen(); | ||
std::unique_ptr<Screen> WatchFaceTerminalScreen(); | ||
std::unique_ptr<Screen> WatchFaceInfineatScreen(); | ||
std::unique_ptr<Screen> WatchFaceCasioStyleG7710(); | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.