mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2024-12-04 23:45:26 +00:00
touch to pop splash (#2260)
* touch to pop * debug * have to add another var * works but since touch screen is laggy, it's tricky * tune to single touch * remove debug things * safer with sleep * textual * @HTotoo resolved the sleep issue * use pop handler in another place (button)
This commit is contained in:
parent
572776bb9e
commit
24ab2f29fa
@ -996,11 +996,12 @@ void BMPView::focus() {
|
||||
button_done.focus();
|
||||
}
|
||||
|
||||
BMPView::BMPView(NavigationView& nav) {
|
||||
BMPView::BMPView(NavigationView& nav)
|
||||
: nav_(nav) {
|
||||
add_children({&button_done});
|
||||
|
||||
button_done.on_select = [this, &nav](Button&) {
|
||||
nav.pop();
|
||||
button_done.on_select = [this](Button&) {
|
||||
handle_pop();
|
||||
};
|
||||
}
|
||||
|
||||
@ -1009,6 +1010,36 @@ void BMPView::paint(Painter&) {
|
||||
portapack::display.drawBMP({(240 - 230) / 2, (320 - 50) / 2 - 10}, splash_bmp, true);
|
||||
}
|
||||
|
||||
bool BMPView::on_touch(const TouchEvent event) {
|
||||
/* the event thing were resolved by HTotoo, talked here https://discord.com/channels/719669764804444213/956561375155589192/1287756910950486027
|
||||
* the touch screen policy can be better, talked here https://discord.com/channels/719669764804444213/956561375155589192/1198926225897443328
|
||||
*/
|
||||
|
||||
if (!nav_.is_valid()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (event.type) {
|
||||
case TouchEvent::Type::Start:
|
||||
return true;
|
||||
|
||||
case TouchEvent::Type::End:
|
||||
handle_pop();
|
||||
return true;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void BMPView::handle_pop() {
|
||||
if (nav_.is_valid()) {
|
||||
nav_.pop();
|
||||
}
|
||||
}
|
||||
|
||||
/* NotImplementedView ****************************************************/
|
||||
|
||||
/*NotImplementedView::NotImplementedView(NavigationView& nav) {
|
||||
|
@ -343,7 +343,11 @@ class BMPView : public View {
|
||||
void paint(Painter&) override;
|
||||
void focus() override;
|
||||
|
||||
bool on_touch(const TouchEvent event) override;
|
||||
void handle_pop();
|
||||
|
||||
private:
|
||||
NavigationView& nav_;
|
||||
Button button_done{
|
||||
{240, 0, 1, 1},
|
||||
""};
|
||||
|
Loading…
Reference in New Issue
Block a user