|
8 | 8 | #include <eom.h> |
9 | 9 | #include <ui/efl_util.h> |
10 | 10 |
|
| 11 | +#include <memory> |
| 12 | + |
11 | 13 | #include "flutter/shell/platform/tizen/logger.h" |
12 | 14 | #include "flutter/shell/platform/tizen/tizen_view_event_handler_delegate.h" |
13 | 15 |
|
@@ -426,6 +428,35 @@ void TizenWindowElementary::PrepareInputMethod() { |
426 | 428 | [this]() { view_delegate_->OnComposeEnd(); }); |
427 | 429 | input_method_context_->SetOnCommit( |
428 | 430 | [this](std::string str) { view_delegate_->OnCommit(str); }); |
| 431 | + |
| 432 | +#ifdef AUTOFILL_SUPPORT |
| 433 | + ctxpopup_ = elm_ctxpopup_add(elm_win_); |
| 434 | + |
| 435 | + input_method_context_->SetOnPopupAutofillContext([this]() { |
| 436 | + if (TizenAutofill::GetInstance().GetAutofillItems().size() > 0) { |
| 437 | + for (auto& item : TizenAutofill::GetInstance().GetAutofillItems()) { |
| 438 | + elm_ctxpopup_item_append( |
| 439 | + ctxpopup_, item->label_.c_str(), nullptr, |
| 440 | + [](void* data, Evas_Object* obj, void* event_info) { |
| 441 | + AutofillItem* item = static_cast<AutofillItem*>(data); |
| 442 | + TizenAutofill::GetInstance().OnCommit(item->value_); |
| 443 | + evas_object_hide(obj); |
| 444 | + }, |
| 445 | + item.get()); |
| 446 | + } |
| 447 | + } |
| 448 | + // TODO : Change ctxpopup's position to focused input field. |
| 449 | + evas_object_move(ctxpopup_, initial_geometry_.left, initial_geometry_.top); |
| 450 | + evas_object_show(ctxpopup_); |
| 451 | + }); |
| 452 | + |
| 453 | + evas_object_event_callback_add( |
| 454 | + ctxpopup_, EVAS_CALLBACK_HIDE, |
| 455 | + [](void* data, Evas* e, Evas_Object* obj, void* event_info) { |
| 456 | + elm_ctxpopup_clear(obj); |
| 457 | + }, |
| 458 | + nullptr); |
| 459 | +#endif |
429 | 460 | } |
430 | 461 |
|
431 | 462 | int32_t TizenWindowElementary::GetExternalOutputId() { |
|
0 commit comments