mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-05 23:27:38 +03:00
Also made the menu items dynamic and capital case. Looks better from a design perspective but I suppose this is an optional thing to accept
45 lines
1.5 KiB
C++
45 lines
1.5 KiB
C++
#pragma once
|
|
#include <freertos/FreeRTOS.h>
|
|
#include <freertos/semphr.h>
|
|
#include <freertos/task.h>
|
|
|
|
#include <functional>
|
|
|
|
#include "../Activity.h"
|
|
|
|
class HomeActivity final : public Activity {
|
|
TaskHandle_t displayTaskHandle = nullptr;
|
|
SemaphoreHandle_t renderingMutex = nullptr;
|
|
int selectorIndex = 0;
|
|
bool updateRequired = false;
|
|
bool hasContinueReading = false;
|
|
bool hasBrowserUrl = false;
|
|
std::string lastBookTitle;
|
|
std::string lastBookAuthor;
|
|
const std::function<void()> onContinueReading;
|
|
const std::function<void()> onReaderOpen;
|
|
const std::function<void()> onSettingsOpen;
|
|
const std::function<void()> onFileTransferOpen;
|
|
const std::function<void()> onBrowserOpen;
|
|
|
|
static void taskTrampoline(void* param);
|
|
[[noreturn]] void displayTaskLoop();
|
|
void render() const;
|
|
int getMenuItemCount() const;
|
|
|
|
public:
|
|
explicit HomeActivity(GfxRenderer& renderer, MappedInputManager& mappedInput,
|
|
const std::function<void()>& onContinueReading, const std::function<void()>& onReaderOpen,
|
|
const std::function<void()>& onSettingsOpen, const std::function<void()>& onFileTransferOpen,
|
|
const std::function<void()>& onBrowserOpen)
|
|
: Activity("Home", renderer, mappedInput),
|
|
onContinueReading(onContinueReading),
|
|
onReaderOpen(onReaderOpen),
|
|
onSettingsOpen(onSettingsOpen),
|
|
onFileTransferOpen(onFileTransferOpen),
|
|
onBrowserOpen(onBrowserOpen) {}
|
|
void onEnter() override;
|
|
void onExit() override;
|
|
void loop() override;
|
|
};
|