MCPcopy Create free account
hub / github.com/bytedance/Fastbot_Android / initFormElement

Method initFormElement

native/desc/Widget.cpp:58–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56 }
57
58 void Widget::initFormElement(const ElementPtr &element) {
59 if (element->getCheckable())
60 enableOperate(OperateType::Checkable);
61 if (element->getEnable())
62 enableOperate(OperateType::Enable);
63 if (element->getClickable())
64 enableOperate(OperateType::Clickable);
65 if (element->getScrollable())
66 enableOperate(OperateType::Scrollable);
67 if (element->getLongClickable()) {
68 enableOperate(OperateType::LongClickable);
69 this->_actions.insert(ActionType::LONG_CLICK);
70 }
71 if (this->hasOperate(OperateType::Checkable) ||
72 this->hasOperate(OperateType::Clickable)) {
73 this->_actions.insert(ActionType::CLICK);
74 }
75
76 ScrollType scrollType = element->getScrollType();
77 switch (scrollType) {
78 case ScrollType::NONE:
79 break;
80 case ScrollType::ALL:
81 this->_actions.insert(ActionType::SCROLL_BOTTOM_UP);
82 this->_actions.insert(ActionType::SCROLL_TOP_DOWN);
83 this->_actions.insert(ActionType::SCROLL_LEFT_RIGHT);
84 this->_actions.insert(ActionType::SCROLL_RIGHT_LEFT);
85 break;
86 case ScrollType::Horizontal:
87 this->_actions.insert(ActionType::SCROLL_LEFT_RIGHT);
88 this->_actions.insert(ActionType::SCROLL_RIGHT_LEFT);
89 break;
90 case ScrollType::Vertical:
91 this->_actions.insert(ActionType::SCROLL_BOTTOM_UP);
92 this->_actions.insert(ActionType::SCROLL_TOP_DOWN);
93 break;
94 default:
95 break;
96 }
97
98 if (this->hasAction()) {
99 this->_clazz = (element->getClassname());
100 this->_isEditable = ("android.widget.EditText" == this->_clazz
101 || "android.inputmethodservice.ExtractEditText" == this->_clazz
102 || "android.widget.AutoCompleteTextView" == this->_clazz
103 || "android.widget.MultiAutoCompleteTextView" == this->_clazz);
104
105 if (SCROLL_BOTTOM_UP_N_ENABLE && (0 == this->_clazz.compare("android.widget.ListView")
106 || 0 == this->_clazz.compare(
107 "android.support.v7.widget.RecyclerView")
108 || 0 == this->_clazz.compare(
109 "androidx.recyclerview.widget.RecyclerView"))) {
110 this->_actions.insert(ActionType::SCROLL_BOTTOM_UP_N);
111 }
112 this->_resourceID = (element->getResourceID());
113 }
114 if (element->getBounds())
115 this->_bounds = element->getBounds();

Callers 1

WidgetMethod · 0.95

Calls 11

hasOperateMethod · 0.95
hasActionMethod · 0.95
getCheckableMethod · 0.80
getEnableMethod · 0.80
getClickableMethod · 0.80
getScrollableMethod · 0.80
getLongClickableMethod · 0.80
getScrollTypeMethod · 0.80
getIndexMethod · 0.80
getTextMethod · 0.80
getBoundsMethod · 0.45

Tested by

no test coverage detected