@@ 474,7 474,7 @@
"app_music_player_music_empty_window_notification": "Press Music Library to choose\n a song from the library",
"app_special_input_window": "Special characters",
"app_emoji_input_window": "Emoji",
- "sms_add_rec_num": "Add contact",
+ "sms_add_rec_num": "Add recipient or type a number",
"sms_title_message": "New message",
"sms_call_text": "Call ",
"sms_resend_failed": "Send again",
@@ 7,7 7,6 @@
#include "application-messages/data/SMSdata.hpp"
#include "application-messages/data/MessagesStyle.hpp"
-#include <application-phonebook/ApplicationPhonebook.hpp>
#include <application-phonebook/windows/PhonebookSearchResults.hpp>
#include <service-appmgr/Controller.hpp>
#include <service-db/DBServiceAPI.hpp>
@@ 177,6 176,7 @@ namespace gui
bottomBar->setText(BottomBar::Side::CENTER, utils::localize.get(style::strings::common::select));
return;
}
+ bottomBar->setActive(BottomBar::Side::LEFT, false);
bottomBar->setActive(BottomBar::Side::CENTER, false);
}
}
@@ 185,8 185,6 @@ namespace gui
{
namespace msgStyle = style::messages::newMessage;
AppWindow::buildInterface();
- bottomBar->setText(BottomBar::Side::LEFT, utils::localize.get(style::strings::common::options));
- bottomBar->setText(BottomBar::Side::CENTER, utils::localize.get(style::strings::common::select));
bottomBar->setText(BottomBar::Side::RIGHT, utils::localize.get(style::strings::common::back));
setTitle(utils::localize.get("sms_title_message"));
@@ 202,19 200,14 @@ namespace gui
recipientLabel->setFont(style::window::font::small);
recipientLabel->setAlignment(Alignment(gui::Alignment::Horizontal::Left, gui::Alignment::Vertical::Bottom));
- auto reciepientHbox = new gui::HBox(body, 0, 0, body->getWidth(), msgStyle::text::h);
- reciepientHbox->setAlignment(gui::Alignment::Vertical::Center);
- reciepientHbox->setEdges(gui::RectangleEdge::Bottom);
- reciepientHbox->setPenFocusWidth(style::window::default_border_focus_w);
- reciepientHbox->setPenWidth(style::window::default_border_rect_no_focus);
-
- recipient = new gui::Text(reciepientHbox,
- 0,
- 0,
- body->getWidth() - msgStyle::recipientImg::w,
- msgStyle::text::h,
- "",
- ExpandMode::None);
+ auto recipientHBox = new gui::HBox(body, 0, 0, body->getWidth(), msgStyle::text::h);
+ recipientHBox->setAlignment(gui::Alignment::Vertical::Center);
+ recipientHBox->setEdges(gui::RectangleEdge::Bottom);
+ recipientHBox->setPenFocusWidth(style::window::default_border_focus_w);
+ recipientHBox->setPenWidth(style::window::default_border_rect_no_focus);
+
+ recipient = new gui::Text(
+ recipientHBox, 0, 0, body->getWidth() - msgStyle::recipientImg::w, msgStyle::text::h, "", ExpandMode::None);
recipient->setEdges(gui::RectangleEdge::None);
recipient->setInputMode(new InputMode({InputMode::phone}));
recipient->setFont(style::window::font::mediumbold);
@@ 222,16 215,29 @@ namespace gui
recipient->activatedCallback = [=](Item &) -> bool { return selectContact(); };
recipient->focusChangedCallback = [=](Item &) -> bool {
updateBottomBar();
- bottomBar->setActive(BottomBar::Side::LEFT, false);
return true;
};
+ recipient->inputCallback = [this]([[maybe_unused]] Item &, const InputEvent &inputEvent) -> bool {
+ if (contact != nullptr) {
+ if (inputEvent.isShortPress() && inputEvent.is(KeyCode::KEY_PND)) {
+ recipient->clear();
+ return true;
+ }
+ if (0 <= gui::toNumeric(inputEvent.keyCode) && gui::toNumeric(inputEvent.keyCode) <= 9) {
+ return true;
+ }
+ }
+ return false;
+ };
recipient->setTextChangedCallback([this]([[maybe_unused]] Item &item, const UTF8 &text) {
if (recipient->getText().empty()) {
contact = nullptr;
+ phoneNumber.clear();
}
+ updateBottomBar();
});
- auto img = new gui::Image(reciepientHbox, 0, 0, 0, 0, "phonebook_small");
+ auto img = new gui::Image(recipientHBox, 0, 0, 0, 0, "phonebook_small");
img->activeItem = false;
auto labelMessage = new Label(body, 0, 0, body->getWidth(), msgStyle::messageLabel::h);