App and Service improvements (#106)
This commit is contained in:
committed by
GitHub
parent
e86a11b7e2
commit
50ee77d572
@@ -1,29 +1,24 @@
|
||||
#include "ScreenshotUi.h"
|
||||
#include <memory>
|
||||
|
||||
namespace tt::app::screenshot {
|
||||
|
||||
static void onShow(App& app, lv_obj_t* parent) {
|
||||
auto* ui = static_cast<ScreenshotUi*>(app.getData());
|
||||
static void onShow(AppContext& app, lv_obj_t* parent) {
|
||||
auto ui = std::static_pointer_cast<ScreenshotUi>(app.getData());
|
||||
create_ui(app, ui, parent);
|
||||
}
|
||||
|
||||
static void onStart(App& app) {
|
||||
auto* ui = static_cast<ScreenshotUi*>(malloc(sizeof(ScreenshotUi)));
|
||||
app.setData(ui);
|
||||
static void onStart(AppContext& app) {
|
||||
auto ui = std::shared_ptr<ScreenshotUi>(new ScreenshotUi());
|
||||
app.setData(ui); // Ensure data gets deleted when no more in use
|
||||
}
|
||||
|
||||
static void onStop(App& app) {
|
||||
auto* ui = static_cast<ScreenshotUi*>(app.getData());
|
||||
free(ui);
|
||||
}
|
||||
|
||||
extern const Manifest manifest = {
|
||||
extern const AppManifest manifest = {
|
||||
.id = "Screenshot",
|
||||
.name = "_Screenshot", // So it gets put at the bottom of the desktop and becomes less visible on small screen devices
|
||||
.icon = LV_SYMBOL_IMAGE,
|
||||
.type = TypeSystem,
|
||||
.onStart = onStart,
|
||||
.onStop = onStop,
|
||||
.onShow = onShow,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user