2020-08-14 03:46:37 -04:00
|
|
|
#include "ApplicationList.h"
|
2020-11-15 10:49:36 -05:00
|
|
|
#include <lvgl/lvgl.h>
|
|
|
|
#include <array>
|
2020-08-14 03:46:37 -04:00
|
|
|
#include "Symbols.h"
|
2020-11-15 10:49:36 -05:00
|
|
|
#include "Tile.h"
|
|
|
|
#include "displayapp/Apps.h"
|
|
|
|
#include "../DisplayApp.h"
|
2020-08-14 03:46:37 -04:00
|
|
|
|
|
|
|
using namespace Pinetime::Applications::Screens;
|
|
|
|
|
|
|
|
ApplicationList::ApplicationList(Pinetime::Applications::DisplayApp *app) :
|
|
|
|
Screen(app),
|
|
|
|
screens{app, {
|
|
|
|
[this]() -> std::unique_ptr<Screen> { return CreateScreen1(); },
|
2020-08-14 14:47:21 -04:00
|
|
|
[this]() -> std::unique_ptr<Screen> { return CreateScreen2(); },
|
2020-08-14 03:46:37 -04:00
|
|
|
//[this]() -> std::unique_ptr<Screen> { return CreateScreen3(); }
|
|
|
|
}
|
|
|
|
} {}
|
|
|
|
|
|
|
|
|
|
|
|
ApplicationList::~ApplicationList() {
|
|
|
|
lv_obj_clean(lv_scr_act());
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ApplicationList::Refresh() {
|
|
|
|
if(running)
|
|
|
|
running = screens.Refresh();
|
|
|
|
return running;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ApplicationList::OnButtonPushed() {
|
|
|
|
running = false;
|
|
|
|
app->StartApp(Apps::Clock);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ApplicationList::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
|
|
|
return screens.OnTouchEvent(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<Screen> ApplicationList::CreateScreen1() {
|
|
|
|
std::array<Screens::Tile::Applications, 6> applications {
|
2020-08-14 14:47:21 -04:00
|
|
|
{{Symbols::clock, Apps::Clock},
|
|
|
|
{Symbols::music, Apps::Music},
|
|
|
|
{Symbols::sun, Apps::Brightness},
|
|
|
|
{Symbols::list, Apps::SysInfo},
|
|
|
|
{Symbols::check, Apps::FirmwareValidation},
|
|
|
|
{Symbols::none, Apps::None}
|
2020-08-14 03:46:37 -04:00
|
|
|
}
|
2020-08-14 14:47:21 -04:00
|
|
|
|
|
|
|
|
2020-08-14 03:46:37 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
return std::unique_ptr<Screen>(new Screens::Tile(app, applications));
|
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<Screen> ApplicationList::CreateScreen2() {
|
|
|
|
std::array<Screens::Tile::Applications, 6> applications {
|
2020-08-14 14:47:21 -04:00
|
|
|
{{Symbols::tachometer, Apps::Gauge},
|
|
|
|
{Symbols::asterisk, Apps::Meter},
|
2020-08-21 05:55:59 -04:00
|
|
|
{Symbols::paintbrush, Apps::Paint},
|
2020-10-20 14:57:39 -04:00
|
|
|
{Symbols::info, Apps::Notifications},
|
|
|
|
{Symbols::none, Apps::None},
|
|
|
|
{Symbols::none, Apps::None}
|
2020-08-14 03:46:37 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
return std::unique_ptr<Screen>(new Screens::Tile(app, applications));
|
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<Screen> ApplicationList::CreateScreen3() {
|
|
|
|
std::array<Screens::Tile::Applications, 6> applications {
|
|
|
|
{{"A", Apps::Meter},
|
|
|
|
{"B", Apps::Gauge},
|
|
|
|
{"C", Apps::Clock},
|
|
|
|
{"D", Apps::Music},
|
|
|
|
{"E", Apps::SysInfo},
|
|
|
|
{"F", Apps::Brightness}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
return std::unique_ptr<Screen>(new Screens::Tile(app, applications));
|
|
|
|
}
|