Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

touch to pop splash #2260

Merged
merged 10 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
touch to pop
  • Loading branch information
zxkmm committed Sep 23, 2024
commit 9170e5b44b7efc76b460407a241a8d4c8168f05f
37 changes: 34 additions & 3 deletions firmware/application/ui_navigation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@
#include "file_path.hpp"
#include "ff.h"

#include "usb_serial_asyncmsg.hpp"

#include <locale>
#include <codecvt>

Expand Down Expand Up @@ -996,11 +998,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&) {
nav_.pop();
};
}

Expand All @@ -1009,6 +1012,34 @@ void BMPView::paint(Painter&) {
portapack::display.drawBMP({(240 - 230) / 2, (320 - 50) / 2 - 10}, splash_bmp, true);
}

bool BMPView::on_touch(const TouchEvent event) {
if (!nav_.is_valid()) {
return false;
}

// switch(event.type) {
// case TouchEvent::Type::Start:
// touch_start_y = event.point.y();
// return true;

// case TouchEvent::Type::End:
// if (touch_start_y != 0 && event.point.y() < touch_start_y - 50) {
// touch_start_y = 0;
nav_.pop();
// return true;
// }
// touch_start_y = 0;
// break;

// case TouchEvent::Type::Move:
// break;

// default:
// break;
// }
return false;
}

/* NotImplementedView ****************************************************/

/*NotImplementedView::NotImplementedView(NavigationView& nav) {
Expand Down
8 changes: 6 additions & 2 deletions firmware/application/ui_navigation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,15 +338,19 @@ class InformationView : public View {
};

class BMPView : public View {
public:
public:
BMPView(NavigationView& nav);
void paint(Painter&) override;
void focus() override;

private:
bool on_touch(const TouchEvent event) override;

private:
NavigationView& nav_;
Button button_done{
{240, 0, 1, 1},
""};
Coord touch_start_y{0};
};

class ReceiversMenuView : public BtnGridView {
Expand Down
Loading