-
Notifications
You must be signed in to change notification settings - Fork 9
Advanced text input options #25
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
Open
Swanseo0
wants to merge
17
commits into
flutter-tizen:master
Choose a base branch
from
Swanseo0:advanced
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
eb1278f
Support TextInputAction
Swanseo0 116154b
Support TextEnableSuggestions
Swanseo0 c959aa0
Add packages related to autofill
Swanseo0 ff9486d
Implement TizenAutofill
Swanseo0 aa6623b
Modify BUILD.gn for TizenAutofill
Swanseo0 5566608
Implement tizen window elementary's ctxpopup_ for autofill
Swanseo0 5d3d4b3
Implement tizen view elementary's ctxpopup_ for autofill
Swanseo0 0f5a10e
Implement tizen view nui's popup_ for autofill
Swanseo0 aa1c87d
Minor clean up
Swanseo0 6b0a2d8
Delete unnecessary condition of generate_root.py, BUILD.gn
Swanseo0 5821267
Fix bug when ecore wl2 call autofill
Swanseo0 7978db9
Apply reviewer's comment
Swanseo0 9f93270
Apply reviewer's comments
Swanseo0 5aca9c2
Add initailized, connected to TizenAutofill
Swanseo0 f37e3fd
Apply reviewer's comment
Swanseo0 9f3b843
Apply reviewer's comment.
Swanseo0 704c6b1
Move popup to above input field
Swanseo0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
// Copyright 2023 Samsung Electronics Co., Ltd. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "flutter/shell/platform/tizen/nui_autofill_popup.h" | ||
|
||
#include <dali-toolkit/dali-toolkit.h> | ||
#include <dali-toolkit/public-api/controls/text-controls/text-label.h> | ||
|
||
namespace flutter { | ||
swift-kim marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
bool NuiAutofillPopup::Touched(Dali::Actor actor, | ||
const Dali::TouchEvent& event) { | ||
const Dali::PointState::Type state = event.GetState(0); | ||
if (Dali::PointState::DOWN == state) { | ||
std::string text = | ||
actor.GetProperty(Dali::Actor::Property::NAME).Get<std::string>(); | ||
on_commit_(text); | ||
popup_.SetDisplayState(Dali::Toolkit::Popup::HIDDEN); | ||
} | ||
return true; | ||
} | ||
|
||
void NuiAutofillPopup::Hidden() { | ||
// TODO(Swanseo0): There is a phenomenon where white traces remain for a | ||
// while when popup disappears. | ||
popup_.Unparent(); | ||
popup_.Reset(); | ||
} | ||
|
||
void NuiAutofillPopup::OutsideTouched() { | ||
popup_.SetDisplayState(Dali::Toolkit::Popup::HIDDEN); | ||
} | ||
|
||
Dali::Toolkit::TableView NuiAutofillPopup::MakeContent( | ||
const std::vector<std::unique_ptr<AutofillItem>>& items) { | ||
Dali::Toolkit::TableView content = | ||
Dali::Toolkit::TableView::New(items.size(), 1); | ||
content.SetResizePolicy(Dali::ResizePolicy::FILL_TO_PARENT, | ||
Dali::Dimension::ALL_DIMENSIONS); | ||
content.SetProperty(Dali::Actor::Property::PADDING, | ||
Dali::Vector4(10, 10, 0, 0)); | ||
for (uint32_t i = 0; i < items.size(); ++i) { | ||
Dali::Toolkit::TextLabel label = | ||
Dali::Toolkit::TextLabel::New(items[i]->label); | ||
label.SetProperty(Dali::Actor::Property::NAME, items[i]->value); | ||
label.SetResizePolicy(Dali::ResizePolicy::DIMENSION_DEPENDENCY, | ||
Dali::Dimension::HEIGHT); | ||
label.SetProperty(Dali::Toolkit::TextLabel::Property::TEXT_COLOR, | ||
Dali::Color::WHITE_SMOKE); | ||
label.SetProperty(Dali::Toolkit::TextLabel::Property::POINT_SIZE, 7.0f); | ||
label.TouchedSignal().Connect(this, &NuiAutofillPopup::Touched); | ||
content.AddChild(label, Dali::Toolkit::TableView::CellPosition(i, 0)); | ||
content.SetFitHeight(i); | ||
} | ||
return content; | ||
} | ||
|
||
void NuiAutofillPopup::Prepare( | ||
const std::vector<std::unique_ptr<AutofillItem>>& items) { | ||
popup_ = Dali::Toolkit::Popup::New(); | ||
popup_.SetProperty(Dali::Actor::Property::NAME, "popup"); | ||
popup_.SetProperty(Dali::Actor::Property::PARENT_ORIGIN, | ||
Dali::ParentOrigin::TOP_LEFT); | ||
popup_.SetProperty(Dali::Actor::Property::ANCHOR_POINT, | ||
Dali::AnchorPoint::TOP_LEFT); | ||
popup_.SetProperty(Dali::Toolkit::Popup::Property::TAIL_VISIBILITY, false); | ||
popup_.SetBackgroundColor(Dali::Color::WHITE_SMOKE); | ||
popup_.OutsideTouchedSignal().Connect(this, | ||
&NuiAutofillPopup::OutsideTouched); | ||
popup_.HiddenSignal().Connect(this, &NuiAutofillPopup::Hidden); | ||
swift-kim marked this conversation as resolved.
Show resolved
Hide resolved
|
||
popup_.SetProperty(Dali::Toolkit::Popup::Property::BACKING_ENABLED, false); | ||
popup_.SetProperty(Dali::Toolkit::Popup::Property::AUTO_HIDE_DELAY, 2500); | ||
JSUYA marked this conversation as resolved.
Show resolved
Hide resolved
|
||
popup_.SetProperty(Dali::Actor::Property::SIZE, | ||
Dali::Vector2(140.0f, 35.0f * items.size())); | ||
|
||
Dali::Toolkit::TableView content = MakeContent(items); | ||
popup_.SetContent(content); | ||
} | ||
|
||
void NuiAutofillPopup::Show(Dali::Actor* actor, double_t x, double_t y) { | ||
const std::vector<std::unique_ptr<AutofillItem>>& items = | ||
TizenAutofill::GetInstance().GetResponseItems(); | ||
if (items.empty()) { | ||
return; | ||
} | ||
|
||
Prepare(items); | ||
|
||
popup_.SetProperty(Dali::Actor::Property::POSITION, | ||
Dali::Vector3(x, y, 0.5f)); | ||
popup_.SetDisplayState(Dali::Toolkit::Popup::SHOWN); | ||
actor->Add(popup_); | ||
} | ||
|
||
} // namespace flutter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright 2023 Samsung Electronics Co., Ltd. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef EMBEDDER_NUI_AUTOFILL_POPUP_H_ | ||
#define EMBEDDER_NUI_AUTOFILL_POPUP_H_ | ||
|
||
#include <dali-toolkit/devel-api/controls/popup/popup.h> | ||
#include <dali-toolkit/devel-api/controls/table-view/table-view.h> | ||
|
||
#include <functional> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing includes? #include <dali/public-api/dali-core.h>
#include <string> Please consult me or @bbrto21 on how to organize includes in the implementation file ( |
||
|
||
#include "flutter/shell/platform/tizen/tizen_autofill.h" | ||
|
||
using OnCommit = std::function<void(const std::string& str)>; | ||
|
||
namespace flutter { | ||
|
||
class NuiAutofillPopup : public Dali::ConnectionTracker { | ||
swift-kim marked this conversation as resolved.
Show resolved
Hide resolved
|
||
public: | ||
void Show(Dali::Actor* actor, double_t x, double_t y); | ||
|
||
void SetOnCommit(OnCommit callback) { on_commit_ = callback; } | ||
|
||
private: | ||
void Prepare(const std::vector<std::unique_ptr<AutofillItem>>& items); | ||
|
||
void Hidden(); | ||
|
||
void OutsideTouched(); | ||
|
||
bool Touched(Dali::Actor actor, const Dali::TouchEvent& event); | ||
swift-kim marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Dali::Toolkit::TableView MakeContent( | ||
const std::vector<std::unique_ptr<AutofillItem>>& items); | ||
|
||
Dali::Toolkit::Popup popup_; | ||
OnCommit on_commit_; | ||
}; | ||
|
||
} // namespace flutter | ||
|
||
#endif // EMBEDDER_NUI_AUTOFILL_POPUP_H_ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.