Clean Up text showing in wifi Settings

This commit is contained in:
MatthewColvin 2023-10-18 20:27:29 -05:00
parent c7a8987d3b
commit cf19cfd1c1
3 changed files with 10 additions and 1 deletions

View file

@ -16,6 +16,7 @@ WifiSettings::WifiSettings(std::shared_ptr<wifiHandlerInterface> aWifi)
std::make_unique<Widget::Label>("Scanning..."))), std::make_unique<Widget::Label>("Scanning..."))),
mWifiNetworks(AddElement<Widget::List>(std::make_unique<Widget::List>())), mWifiNetworks(AddElement<Widget::List>(std::make_unique<Widget::List>())),
mPasswordGetter(nullptr) { mPasswordGetter(nullptr) {
// Set Handler for when the wifi scan is done // Set Handler for when the wifi scan is done
mScanCompleteHandler = [this](auto aWifiInfos) { mScanCompleteHandler = [this](auto aWifiInfos) {
mScanningText->SetText("Networks Found"); mScanningText->SetText("Networks Found");
@ -59,7 +60,7 @@ WifiSettings::WifiSettings(std::shared_ptr<wifiHandlerInterface> aWifi)
void WifiSettings::SetHeight(lv_coord_t aHeight) { void WifiSettings::SetHeight(lv_coord_t aHeight) {
Base::SetHeight(aHeight); Base::SetHeight(aHeight);
mScanningText->AlignTo(this, LV_ALIGN_TOP_MID); mScanningText->AlignTo(this, LV_ALIGN_TOP_MID);
mScanningText->SetHeight(15); mScanningText->SetHeight(20);
const auto padding = 10; const auto padding = 10;
mWifiNetworks->AlignTo(mScanningText, LV_ALIGN_OUT_BOTTOM_MID, 0, padding); mWifiNetworks->AlignTo(mScanningText, LV_ALIGN_OUT_BOTTOM_MID, 0, padding);
mWifiNetworks->SetHeight(GetContentHeight() - mScanningText->GetBottom() - mWifiNetworks->SetHeight(GetContentHeight() - mScanningText->GetBottom() -

View file

@ -14,4 +14,10 @@ Label::Label(std::string aText)
void Label::SetText(std::string aText) { void Label::SetText(std::string aText) {
auto lock = LvglResourceManager::GetInstance().scopeLock(); auto lock = LvglResourceManager::GetInstance().scopeLock();
lv_label_set_text(LvglSelf(), aText.c_str()); lv_label_set_text(LvglSelf(), aText.c_str());
SetLongMode(LV_LABEL_LONG_SCROLL);
}
void Label::SetLongMode(lv_label_long_mode_t aLongMode) {
auto lock = LvglResourceManager::GetInstance().scopeLock();
lv_label_set_long_mode(LvglSelf(), aLongMode);
} }

View file

@ -9,6 +9,8 @@ public:
Label(std::string aText); Label(std::string aText);
void SetText(std::string aText); void SetText(std::string aText);
void SetLongMode(lv_label_long_mode_t aLongMode);
}; };
} // namespace UI::Widget } // namespace UI::Widget