| 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(); |
no test coverage detected