Skip to content

Commit

Permalink
fix focusing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
zxkmm committed Jan 19, 2025
1 parent cbeba9f commit 6c161ea
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
23 changes: 16 additions & 7 deletions firmware/application/external/hopper/ui_hopper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include "baseband_api.hpp"
#include "string_format.hpp"


using namespace portapack;

namespace ui::external_app::hopper {
Expand All @@ -47,7 +46,7 @@ HopperView::~HopperView() {
baseband::shutdown();
}

void HopperView::update_freq_list_menu_view() {
void HopperView::update_freq_list_menu_view() {
menu_freq_list.clear();
uint8_t list_count = freq_list.size();

Expand All @@ -66,7 +65,6 @@ void HopperView::update_freq_list_menu_view() {
}

set_dirty();

}

void HopperView::on_retune(const rf::Frequency freq, const uint32_t range) {
Expand Down Expand Up @@ -96,10 +94,7 @@ void HopperView::start_tx() {
if (true) {
uint8_t channel_count = freq_list.size();


if (channel_count <= JAMMER_MAX_CH) {


for (c = 0; c < channel_count; c++) {
if (i >= JAMMER_MAX_CH) {
out_of_ranges = true;
Expand Down Expand Up @@ -266,6 +261,7 @@ HopperView::HopperView(
&button_add_freq,
&button_delete_freq,
&button_save_list,
&button_add_freq_from_freqman,
&button_clear,
&labels,
&options_type,
Expand Down Expand Up @@ -323,7 +319,12 @@ HopperView::HopperView(
};

button_clear.on_select = [this]() {
freq_list.clear();
nav_.display_modal("Del:", "Clean all?\n", YESNO, [this](bool choice) {
if (choice){
freq_list.clear();
update_freq_list_menu_view();
} }, TRUE);

update_freq_list_menu_view();
};

Expand All @@ -334,6 +335,14 @@ HopperView::HopperView(
start_tx();
};

menu_freq_list.on_left = [this]() {
button_load_list.focus();
};

menu_freq_list.on_right = [this]() {
button_load_list.focus();
};

update_freq_list_menu_view();
}

Expand Down
13 changes: 10 additions & 3 deletions firmware/application/external/hopper/ui_hopper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class HopperView : public View {
const Style& style_cancel = *Theme::getInstance()->fg_red;

MenuView menu_freq_list{
{0, 0, screen_width, 9 * 16},
{0, 0, screen_width, 8 * 16},
false};

NewButton button_load_list{
Expand All @@ -108,15 +108,22 @@ class HopperView : public View {
Color::dark_green(),
/*vcenter*/ true};

NewButton button_delete_freq{
NewButton button_add_freq_from_freqman{
{12 * 8 + 4, 9 * 16 + 4, 4 * 8, 32},
{},
&bitmap_icon_add,
Color::dark_green(),
/*vcenter*/ true};

NewButton button_delete_freq{
{16 * 8 + 4, 9 * 16 + 4, 4 * 8, 32},
{},
&bitmap_icon_trash,
Color::dark_red(),
/*vcenter*/ true};

NewButton button_clear{
{16 * 8 + 8, 9 * 16 + 4, 4 * 8, 32},
{screen_width - 4 * 8, 9 * 16 + 4, 4 * 8, 32},
{},
&bitmap_icon_tools_wipesd,
Color::red(),
Expand Down

0 comments on commit 6c161ea

Please sign in to comment.