1
0
Fork 0

replace ScreenList with a single screen in Clock. This removes the tap to switch feature

This commit is contained in:
Florian 2021-06-11 01:15:32 +02:00
parent 79f0fcb07a
commit 049174bd35
2 changed files with 23 additions and 20 deletions

View file

@ -32,22 +32,25 @@ Clock::Clock(DisplayApp* app,
notificatioManager {notificatioManager}, notificatioManager {notificatioManager},
settingsController {settingsController}, settingsController {settingsController},
heartRateController {heartRateController}, heartRateController {heartRateController},
motionController {motionController}, motionController {motionController} {
screens {app,
settingsController.GetClockFace(),
{
[this]() -> std::unique_ptr<Screen> {
return WatchFaceDigitalScreen();
},
[this]() -> std::unique_ptr<Screen> {
return WatchFaceAnalogScreen();
},
// Examples for more watch faces
//[this]() -> std::unique_ptr<Screen> { return WatchFaceMinimalScreen(); },
//[this]() -> std::unique_ptr<Screen> { return WatchFaceCustomScreen(); }
},
Screens::ScreenListModes::LongPress} {
switch (settingsController.GetClockFace()) {
case 0:
screen = WatchFaceDigitalScreen();
break;
case 1:
screen = WatchFaceAnalogScreen();
break;
/*
// Examples for more watch faces
case 2:
screen = WatchFaceMinimalScreen();
break;
case 3:
screen = WatchFaceCustomScreen();
break;
*/
}
settingsController.SetAppMenu(0); settingsController.SetAppMenu(0);
} }
@ -56,12 +59,12 @@ Clock::~Clock() {
} }
bool Clock::Refresh() { bool Clock::Refresh() {
screens.Refresh(); screen->Refresh();
return running; return running;
} }
bool Clock::OnTouchEvent(Pinetime::Applications::TouchEvents event) { bool Clock::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
return screens.OnTouchEvent(event); return screen->OnTouchEvent(event);
} }
std::unique_ptr<Screen> Clock::WatchFaceDigitalScreen() { std::unique_ptr<Screen> Clock::WatchFaceDigitalScreen() {

View file

@ -4,8 +4,8 @@
#include <chrono> #include <chrono>
#include <cstdint> #include <cstdint>
#include <memory> #include <memory>
#include <components/heartrate/HeartRateController.h>
#include "Screen.h" #include "Screen.h"
#include "ScreenList.h"
#include "components/datetime/DateTimeController.h" #include "components/datetime/DateTimeController.h"
namespace Pinetime { namespace Pinetime {
@ -47,7 +47,7 @@ namespace Pinetime {
Controllers::HeartRateController& heartRateController; Controllers::HeartRateController& heartRateController;
Controllers::MotionController& motionController; Controllers::MotionController& motionController;
ScreenList<2> screens; std::unique_ptr<Screen> screen;
std::unique_ptr<Screen> WatchFaceDigitalScreen(); std::unique_ptr<Screen> WatchFaceDigitalScreen();
std::unique_ptr<Screen> WatchFaceAnalogScreen(); std::unique_ptr<Screen> WatchFaceAnalogScreen();