@quicktvui/ai 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/package.json +1 -1
  2. package/rules/.clinerules +27 -4
  3. package/rules/.cursorrules +27 -4
  4. package/rules/.github/copilot-instructions.md +27 -4
  5. package/rules/.source/hippy/extend_views/CoverFlowHorizontalView.java +203 -0
  6. package/rules/.source/hippy/extend_views/CoverFlowVerticalView.java +203 -0
  7. package/rules/.source/hippy/extend_views/CoverFlowViewController.java +195 -0
  8. package/rules/.source/hippy/extend_views/EngineRootView.java +125 -0
  9. package/rules/.source/hippy/extend_views/ExtendTag.java +83 -0
  10. package/rules/.source/hippy/extend_views/FocusSearchHelper.java +124 -0
  11. package/rules/.source/hippy/extend_views/IRecyclerItemView.java +12 -0
  12. package/rules/.source/hippy/extend_views/JSEventHandleView.java +5 -0
  13. package/rules/.source/hippy/extend_views/MarqueeRelayManager.java +133 -0
  14. package/rules/.source/hippy/extend_views/MarqueeRelayTextView.java +211 -0
  15. package/rules/.source/hippy/extend_views/ProgressBarView.java +83 -0
  16. package/rules/.source/hippy/extend_views/ProgressBarViewController.java +145 -0
  17. package/rules/.source/hippy/extend_views/SeekBarView.java +104 -0
  18. package/rules/.source/hippy/extend_views/SeekBarViewController.java +218 -0
  19. package/rules/.source/hippy/extend_views/StateImageView.java +149 -0
  20. package/rules/.source/hippy/extend_views/StateImageViewController.java +34 -0
  21. package/rules/.source/hippy/extend_views/TVButtonView.java +314 -0
  22. package/rules/.source/hippy/extend_views/TVButtonViewController.java +89 -0
  23. package/rules/.source/hippy/extend_views/TVTextView.java +684 -0
  24. package/rules/.source/hippy/extend_views/TVViewActor.java +811 -0
  25. package/rules/.source/hippy/extend_views/TVViewActorHost.java +6 -0
  26. package/rules/.source/hippy/extend_views/TVViewActor/346/216/245/345/205/245.md +66 -0
  27. package/rules/.source/hippy/extend_views/TemplateUtil.java +336 -0
  28. package/rules/.source/hippy/extend_views/TextButtonNode.java +47 -0
  29. package/rules/.source/hippy/extend_views/TextViewController.java +377 -0
  30. package/rules/.source/hippy/extend_views/fastlist/CenterFlyInAnimator.java +96 -0
  31. package/rules/.source/hippy/extend_views/fastlist/ChildOnScreenScroller.java +548 -0
  32. package/rules/.source/hippy/extend_views/fastlist/ClonedViewTag.java +17 -0
  33. package/rules/.source/hippy/extend_views/fastlist/EventDeliverer.java +55 -0
  34. package/rules/.source/hippy/extend_views/fastlist/FastAdapter.java +4683 -0
  35. package/rules/.source/hippy/extend_views/fastlist/FastAdapterUtil.java +982 -0
  36. package/rules/.source/hippy/extend_views/fastlist/FastFlexNode.java +48 -0
  37. package/rules/.source/hippy/extend_views/fastlist/FastFlexView.java +873 -0
  38. package/rules/.source/hippy/extend_views/fastlist/FastFlexViewController.java +130 -0
  39. package/rules/.source/hippy/extend_views/fastlist/FastItemNode.java +67 -0
  40. package/rules/.source/hippy/extend_views/fastlist/FastItemView.java +306 -0
  41. package/rules/.source/hippy/extend_views/fastlist/FastItemViewController.java +106 -0
  42. package/rules/.source/hippy/extend_views/fastlist/FastListModule.java +95 -0
  43. package/rules/.source/hippy/extend_views/fastlist/FastListNode.java +90 -0
  44. package/rules/.source/hippy/extend_views/fastlist/FastListView.java +2466 -0
  45. package/rules/.source/hippy/extend_views/fastlist/FastListViewController.java +1038 -0
  46. package/rules/.source/hippy/extend_views/fastlist/FastListView/346/270/262/346/237/223/346/265/201/347/250/213/345/233/276.graffle +0 -0
  47. package/rules/.source/hippy/extend_views/fastlist/FastPendingView.java +47 -0
  48. package/rules/.source/hippy/extend_views/fastlist/ItemDecorations.java +71 -0
  49. package/rules/.source/hippy/extend_views/fastlist/ItemStoreNode.java +64 -0
  50. package/rules/.source/hippy/extend_views/fastlist/ItemStoreView.java +13 -0
  51. package/rules/.source/hippy/extend_views/fastlist/ItemStoreViewController.java +45 -0
  52. package/rules/.source/hippy/extend_views/fastlist/ListItemHolder.java +7 -0
  53. package/rules/.source/hippy/extend_views/fastlist/ListViewControlProp.java +41 -0
  54. package/rules/.source/hippy/extend_views/fastlist/MouseRecycleView.java +509 -0
  55. package/rules/.source/hippy/extend_views/fastlist/OnFastItemClickListener.java +12 -0
  56. package/rules/.source/hippy/extend_views/fastlist/OnFastItemFocusChangeListener.java +9 -0
  57. package/rules/.source/hippy/extend_views/fastlist/OnFastScrollStateChangedListener.java +7 -0
  58. package/rules/.source/hippy/extend_views/fastlist/PendingListNode.java +18 -0
  59. package/rules/.source/hippy/extend_views/fastlist/PendingViewController.java +13 -0
  60. package/rules/.source/hippy/extend_views/fastlist/PostHandlerView.java +6 -0
  61. package/rules/.source/hippy/extend_views/fastlist/PostTaskHolder.java +20 -0
  62. package/rules/.source/hippy/extend_views/fastlist/ReplaceChildController.java +105 -0
  63. package/rules/.source/hippy/extend_views/fastlist/ReplaceChildView.java +312 -0
  64. package/rules/.source/hippy/extend_views/fastlist/TVListView.java +3692 -0
  65. package/rules/.source/hippy/extend_views/fastlist/TemplateCodeParser.java +247 -0
  66. package/rules/.source/hippy/extend_views/fastlist/Utils.java +572 -0
  67. package/rules/.source/hippy/extend_views/fastlist/ViewTag.java +317 -0
  68. package/rules/.source/hippy/extend_views/fastlist/VirtualListView.java +8 -0
  69. package/rules/.source/hippy/extend_views/fastlist/diff/FastListDataBindingHelper.java +320 -0
  70. package/rules/.source/hippy/extend_views/fastlist/diff/KeyDiffHelper.java +289 -0
  71. package/rules/.source/hippy/extend_views/fastlist/diff/NoKeyDiffHelper.java +278 -0
  72. package/rules/.source/hippy/extend_views/tag/FontTag.java +53 -0
  73. package/rules/.source/hippy/extend_views/tag/HtmlTag.java +191 -0
  74. package/rules/.source/hippy/extend_views/tag/HtmlTagHandler.java +185 -0
  75. package/rules/.source/hippy/extend_views/tag/SpanTag.java +160 -0
  76. package/rules/.source/hippy/extend_views/tag/TextFontSpan.java +102 -0
  77. package/rules/.source/hippy/extend_views/waterfall/Chunk.java +10 -0
  78. package/rules/.source/hippy/extend_views/waterfall/ChunkGroup.java +5 -0
  79. package/rules/.source/hippy/extend_views/waterfall/Section.java +4 -0
  80. package/rules/.source/hippy/extend_views/waterfall/Tabs.java +5 -0
  81. package/rules/.source/hippy/extend_views/waterfall/WaterfallUtils.java +26 -0
  82. package/rules/.source/hippy/hippy_uimanager/ControllerHolder.java +30 -0
  83. package/rules/.source/hippy/hippy_uimanager/ControllerManager.java +651 -0
  84. package/rules/.source/hippy/hippy_uimanager/ControllerRegistry.java +102 -0
  85. package/rules/.source/hippy/hippy_uimanager/ControllerUpdateManger.java +252 -0
  86. package/rules/.source/hippy/hippy_uimanager/CustomControllerHelper.java +425 -0
  87. package/rules/.source/hippy/hippy_uimanager/DiffUtils.java +526 -0
  88. package/rules/.source/hippy/hippy_uimanager/ExtendViewGroup.java +36 -0
  89. package/rules/.source/hippy/hippy_uimanager/HippyCustomViewCreator.java +29 -0
  90. package/rules/.source/hippy/hippy_uimanager/HippyGroupController.java +83 -0
  91. package/rules/.source/hippy/hippy_uimanager/HippyViewBase.java +27 -0
  92. package/rules/.source/hippy/hippy_uimanager/HippyViewController.java +2189 -0
  93. package/rules/.source/hippy/hippy_uimanager/HippyViewEvent.java +52 -0
  94. package/rules/.source/hippy/hippy_uimanager/IHippyZIndexViewGroup.java +24 -0
  95. package/rules/.source/hippy/hippy_uimanager/InternalExtendViewUtil.java +395 -0
  96. package/rules/.source/hippy/hippy_uimanager/ListItemRenderNode.java +143 -0
  97. package/rules/.source/hippy/hippy_uimanager/ListViewRenderNode.java +44 -0
  98. package/rules/.source/hippy/hippy_uimanager/MatrixUtil.java +470 -0
  99. package/rules/.source/hippy/hippy_uimanager/NativeGestureDispatcher.java +349 -0
  100. package/rules/.source/hippy/hippy_uimanager/NativeGestureProcessor.java +188 -0
  101. package/rules/.source/hippy/hippy_uimanager/PullFooterRenderNode.java +43 -0
  102. package/rules/.source/hippy/hippy_uimanager/PullHeaderRenderNode.java +43 -0
  103. package/rules/.source/hippy/hippy_uimanager/RenderManager.java +304 -0
  104. package/rules/.source/hippy/hippy_uimanager/RenderNode.java +533 -0
  105. package/rules/.source/hippy/hippy_uimanager/StateView.java +17 -0
  106. package/rules/.source/hippy/hippy_uimanager/TransformUtil.java +125 -0
  107. package/rules/.source/hippy/hippy_uimanager/ViewGroupDrawingOrderHelper.java +108 -0
  108. package/rules/.source/hippy/hippy_uimanager/ViewStateProvider.java +10 -0
  109. package/rules/.source/hippy/hippy_views/audioview/AudioPlayManager.java +457 -0
  110. package/rules/.source/hippy/hippy_views/audioview/AudioView.java +225 -0
  111. package/rules/.source/hippy/hippy_views/audioview/AudioViewController.java +135 -0
  112. package/rules/.source/hippy/hippy_views/common/CommonBackgroundDrawable.java +58 -0
  113. package/rules/.source/hippy/hippy_views/common/CommonBorder.java +37 -0
  114. package/rules/.source/hippy/hippy_views/custom/HippyCustomPropsController.java +61 -0
  115. package/rules/.source/hippy/hippy_views/hippylist/HippyRecyclerListAdapter.java +399 -0
  116. package/rules/.source/hippy/hippy_views/hippylist/HippyRecyclerView.java +378 -0
  117. package/rules/.source/hippy/hippy_views/hippylist/HippyRecyclerViewController.java +187 -0
  118. package/rules/.source/hippy/hippy_views/hippylist/HippyRecyclerViewHolder.java +39 -0
  119. package/rules/.source/hippy/hippy_views/hippylist/HippyRecyclerViewWrapper.java +134 -0
  120. package/rules/.source/hippy/hippy_views/hippylist/NodePositionHelper.java +55 -0
  121. package/rules/.source/hippy/hippy_views/hippylist/PreloadHelper.java +54 -0
  122. package/rules/.source/hippy/hippy_views/hippylist/PullFooterEventHelper.java +61 -0
  123. package/rules/.source/hippy/hippy_views/hippylist/PullHeaderEventHelper.java +127 -0
  124. package/rules/.source/hippy/hippy_views/hippylist/RecyclerViewEventHelper.java +394 -0
  125. package/rules/.source/hippy/hippy_views/image/HippyContentDrawable.java +113 -0
  126. package/rules/.source/hippy/hippy_views/image/HippyImageView.java +1608 -0
  127. package/rules/.source/hippy/hippy_views/image/HippyImageViewController.java +382 -0
  128. package/rules/.source/hippy/hippy_views/image/IImageStateListener.java +7 -0
  129. package/rules/.source/hippy/hippy_views/list/ChildOnScreenScroller.java +255 -0
  130. package/rules/.source/hippy/hippy_views/list/HippyListAdapter.java +647 -0
  131. package/rules/.source/hippy/hippy_views/list/HippyListItemView.java +162 -0
  132. package/rules/.source/hippy/hippy_views/list/HippyListItemViewController.java +45 -0
  133. package/rules/.source/hippy/hippy_views/list/HippyListView.java +915 -0
  134. package/rules/.source/hippy/hippy_views/list/HippyListViewController.java +622 -0
  135. package/rules/.source/hippy/hippy_views/list/HippyRecycler.java +31 -0
  136. package/rules/.source/hippy/hippy_views/list/IRecycleItemTypeChange.java +23 -0
  137. package/rules/.source/hippy/hippy_views/list/ItemDecorations.java +70 -0
  138. package/rules/.source/hippy/hippy_views/list/NegativeLongKeyFlinger.java +156 -0
  139. package/rules/.source/hippy/hippy_views/list/NodeHolder.java +34 -0
  140. package/rules/.source/hippy/hippy_views/list/RecycleViewFlinger.java +126 -0
  141. package/rules/.source/hippy/hippy_views/list/TVRecyclerView.java +2070 -0
  142. package/rules/.source/hippy/hippy_views/list/TVSingleLineListView.java +15 -0
  143. package/rules/.source/hippy/hippy_views/modal/HippyModalHostManager.java +102 -0
  144. package/rules/.source/hippy/hippy_views/modal/HippyModalHostView.java +597 -0
  145. package/rules/.source/hippy/hippy_views/modal/ModalHostHelper.java +46 -0
  146. package/rules/.source/hippy/hippy_views/modal/ModalStyleNode.java +34 -0
  147. package/rules/.source/hippy/hippy_views/modal/RequestCloseEvent.java +32 -0
  148. package/rules/.source/hippy/hippy_views/modal/ShowEvent.java +31 -0
  149. package/rules/.source/hippy/hippy_views/navigator/Navigator.java +126 -0
  150. package/rules/.source/hippy/hippy_views/navigator/NavigatorController.java +120 -0
  151. package/rules/.source/hippy/hippy_views/refresh/HippyPullFooterView.java +47 -0
  152. package/rules/.source/hippy/hippy_views/refresh/HippyPullFooterViewController.java +65 -0
  153. package/rules/.source/hippy/hippy_views/refresh/HippyPullHeaderView.java +39 -0
  154. package/rules/.source/hippy/hippy_views/refresh/HippyPullHeaderViewController.java +104 -0
  155. package/rules/.source/hippy/hippy_views/refresh/RefreshWrapper.java +237 -0
  156. package/rules/.source/hippy/hippy_views/refresh/RefreshWrapperController.java +62 -0
  157. package/rules/.source/hippy/hippy_views/refresh/RefreshWrapperItemController.java +39 -0
  158. package/rules/.source/hippy/hippy_views/refresh/RefreshWrapperItemView.java +26 -0
  159. package/rules/.source/hippy/hippy_views/scroll/HippyHorizontalScrollView.java +500 -0
  160. package/rules/.source/hippy/hippy_views/scroll/HippyOnScrollHelper.java +39 -0
  161. package/rules/.source/hippy/hippy_views/scroll/HippyScrollView.java +46 -0
  162. package/rules/.source/hippy/hippy_views/scroll/HippyScrollViewController.java +178 -0
  163. package/rules/.source/hippy/hippy_views/scroll/HippyScrollViewEventHelper.java +92 -0
  164. package/rules/.source/hippy/hippy_views/scroll/HippyVerticalScrollView.java +522 -0
  165. package/rules/.source/hippy/hippy_views/text/HippyTextView.java +512 -0
  166. package/rules/.source/hippy/hippy_views/text/HippyTextViewController.java +77 -0
  167. package/rules/.source/hippy/hippy_views/textinput/HippyTextInput.java +668 -0
  168. package/rules/.source/hippy/hippy_views/textinput/HippyTextInputController.java +528 -0
  169. package/rules/.source/hippy/hippy_views/textinput/TextInputNode.java +115 -0
  170. package/rules/.source/hippy/hippy_views/videoview/APEZProvider.java +287 -0
  171. package/rules/.source/hippy/hippy_views/videoview/APKExpansionSupport.java +82 -0
  172. package/rules/.source/hippy/hippy_views/videoview/PivotPoint.java +13 -0
  173. package/rules/.source/hippy/hippy_views/videoview/ScalableType.java +34 -0
  174. package/rules/.source/hippy/hippy_views/videoview/ScalableVideoView.java +265 -0
  175. package/rules/.source/hippy/hippy_views/videoview/ScaleManager.java +191 -0
  176. package/rules/.source/hippy/hippy_views/videoview/Size.java +19 -0
  177. package/rules/.source/hippy/hippy_views/videoview/VideoHippyView.java +917 -0
  178. package/rules/.source/hippy/hippy_views/videoview/VideoHippyViewController.java +236 -0
  179. package/rules/.source/hippy/hippy_views/videoview/ZipResourceFile.java +427 -0
  180. package/rules/.source/hippy/hippy_views/view/CardRootView.java +28 -0
  181. package/rules/.source/hippy/hippy_views/view/CustomLayoutView.java +10 -0
  182. package/rules/.source/hippy/hippy_views/view/CustomNodeView.java +5 -0
  183. package/rules/.source/hippy/hippy_views/view/DialogViewGroup.java +113 -0
  184. package/rules/.source/hippy/hippy_views/view/HippyViewGroup.java +2042 -0
  185. package/rules/.source/hippy/hippy_views/view/HippyViewGroupController.java +583 -0
  186. package/rules/.source/hippy/hippy_views/view/WindowRoot.java +5 -0
  187. package/rules/.source/hippy/hippy_views/viewpager/HippyViewPager.java +308 -0
  188. package/rules/.source/hippy/hippy_views/viewpager/HippyViewPagerAdapter.java +148 -0
  189. package/rules/.source/hippy/hippy_views/viewpager/HippyViewPagerController.java +246 -0
  190. package/rules/.source/hippy/hippy_views/viewpager/HippyViewPagerItem.java +27 -0
  191. package/rules/.source/hippy/hippy_views/viewpager/HippyViewPagerItemController.java +42 -0
  192. package/rules/.source/hippy/hippy_views/viewpager/ViewPagerPageChangeListener.java +114 -0
  193. package/rules/.source/hippy/hippy_views/viewpager/event/HippyPageItemExposureEvent.java +40 -0
  194. package/rules/.source/hippy/hippy_views/viewpager/event/HippyPageScrollEvent.java +43 -0
  195. package/rules/.source/hippy/hippy_views/viewpager/event/HippyPageScrollStateChangedEvent.java +42 -0
  196. package/rules/.source/hippy/hippy_views/viewpager/event/HippyPageSelectedEvent.java +42 -0
  197. package/rules/.source/hippy/hippy_views/webview/HippyWebView.java +160 -0
  198. package/rules/.source/hippy/hippy_views/webview/HippyWebViewBridge.java +20 -0
  199. package/rules/.source/hippy/hippy_views/webview/HippyWebViewController.java +103 -0
  200. package/rules/.source/hippy/hippy_views/webview/HippyWebViewInner.java +77 -0
  201. package/rules/.windsurfrules +27 -4
  202. package/rules/AGENTS.md +27 -4
  203. package/rules/CLAUDE.md +27 -3
  204. package/rules/GEMINI.md +25 -3
@@ -0,0 +1,533 @@
1
+ /* Tencent is pleased to support the open source community by making Hippy available.
2
+ * Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ package com.tencent.mtt.hippy.uimanager;
17
+
18
+
19
+ import android.text.TextUtils;
20
+ import android.util.Log;
21
+ import android.util.SparseArray;
22
+ import android.view.View;
23
+
24
+
25
+ import com.tencent.extend.pm.PageRootNode;
26
+ import com.tencent.extend.pm.WindowNode;
27
+ import com.tencent.mtt.hippy.HippyRootView;
28
+ import com.tencent.mtt.hippy.common.HippyArray;
29
+ import com.tencent.mtt.hippy.common.HippyMap;
30
+ import com.tencent.mtt.hippy.dom.node.NodeProps;
31
+ import com.tencent.mtt.hippy.modules.Promise;
32
+ import com.tencent.mtt.hippy.utils.LogUtils;
33
+ import com.tencent.mtt.hippy.views.list.HippyListItemViewController;
34
+
35
+ import java.util.*;
36
+
37
+ @SuppressWarnings({"deprecation", "unused"})
38
+ public class RenderNode {
39
+
40
+ final int mId;
41
+ int mX;
42
+ int mY;
43
+ int mWidth;
44
+ int mHeight;
45
+
46
+ boolean mHasUpdateLayout = false;
47
+ HippyMap mProps = null;
48
+ HippyMap mPropsToUpdate;
49
+ final String mClassName;
50
+ final List<RenderNode> mChildren = new ArrayList<>();
51
+
52
+ List<MoveHolder> mMoveHolders = null;
53
+
54
+ SparseArray<Integer> mDeletedIdIndexMap;
55
+
56
+ List<Promise> mMeasureInWindows = null;
57
+ Object mTextExtra;
58
+ Object mTextExtraUpdate;
59
+
60
+
61
+
62
+ protected HippyRootView mRootView;
63
+
64
+ final ControllerManager mComponentManager;
65
+
66
+
67
+ RenderNode mParent = null;
68
+ WindowNode mWindowRootNode = null;
69
+
70
+ boolean mIsDelete = false;
71
+ boolean mIsRootHasDelete = false;
72
+
73
+
74
+ boolean mIsLazyLoad = false;
75
+
76
+ boolean mNotifyManageChildren = false;
77
+
78
+ public boolean mHasSetDteblId = false;
79
+
80
+ List<UIFunction> mUIFunction = null;
81
+
82
+ public RenderNode getParent() {
83
+ return mParent;
84
+ }
85
+
86
+ int indexFromParent() {
87
+ if (mParent != null) {
88
+ return mParent.mChildren.indexOf(this);
89
+ }
90
+ return 0;
91
+ }
92
+
93
+ @Override
94
+ public String toString() {
95
+ StringBuilder stringBuilder = new StringBuilder();
96
+ printChild(this, stringBuilder);
97
+ return stringBuilder.toString();
98
+ }
99
+
100
+ void printChild(RenderNode renderNode, StringBuilder stringBuilder) {
101
+ stringBuilder.append(" [Id:").append(renderNode.getId()).append(renderNode.mClassName);
102
+ for (RenderNode child : renderNode.mChildren) {
103
+ printChild(child, stringBuilder);
104
+ }
105
+ stringBuilder.append("]");
106
+ }
107
+
108
+ public RenderNode(int mId, HippyMap mPropsToUpdate, String className, HippyRootView rootView,
109
+ ControllerManager componentManager,
110
+ boolean isLazyLoad) {
111
+ this.mId = mId;
112
+ this.mPropsToUpdate = mPropsToUpdate;
113
+ this.mClassName = className;
114
+ this.mRootView = rootView;
115
+ this.mComponentManager = componentManager;
116
+ this.mIsLazyLoad = isLazyLoad;
117
+ this.mProps = mPropsToUpdate;
118
+ }
119
+
120
+ public void addDeleteId(int id, RenderNode node) {
121
+ if (shouldUpdateView()) {
122
+ if (mDeletedIdIndexMap == null) {
123
+ mDeletedIdIndexMap = new SparseArray<>();
124
+ }
125
+ mDeletedIdIndexMap.put(id, mChildren.indexOf(node));
126
+ }
127
+ }
128
+
129
+ public int getId() {
130
+ return mId;
131
+ }
132
+
133
+
134
+ public View createViewRecursive() {
135
+ View view = createView();
136
+ mHasUpdateLayout = true;
137
+ mTextExtraUpdate = mTextExtra;
138
+ for (RenderNode renderNode : mChildren) {
139
+ renderNode.createViewRecursive();
140
+ }
141
+ return view;
142
+ }
143
+
144
+ public void updateViewRecursive() {
145
+ update();
146
+
147
+ for (RenderNode renderNode : mChildren) {
148
+ renderNode.updateViewRecursive();
149
+ }
150
+ }
151
+
152
+ public void forceLayout(){
153
+ this.mHasUpdateLayout = true;
154
+ }
155
+
156
+ public boolean removeChild(RenderNode uiNode) {
157
+ uiNode.mParent = null;
158
+ uiNode.mWindowRootNode = null;
159
+ return mChildren.remove(uiNode);
160
+ }
161
+
162
+ protected void addChild(RenderNode uiNode, int index) {
163
+ mChildren.add(index, uiNode);
164
+ uiNode.mParent = this;
165
+
166
+ if (getWindowRootNode() != null) {
167
+ // if (getWindowRootNode() != null) {
168
+ // Log.d(WindowNode.TAG, "addChild: " + uiNode + " getWindowRootNode != null " + this);
169
+ // }
170
+ uiNode.setWindowRoot(getWindowRootNode());
171
+ }else{
172
+ uiNode.setWindowRoot(mWindowRootNode == null && mParent != null ? mParent.getWindowRootNode() : getWindowRootNode());
173
+ if(LogUtils.isDebug() && uiNode.getWindowRootNode() == null) {
174
+ if (mParent != null && mParent.getWindowRootNode() == null) {
175
+ Log.e(WindowNode.TAG, "addChild error pageRoot is null node: " + this + ",parent:" + mParent);
176
+ }
177
+ }
178
+ }
179
+
180
+ }
181
+
182
+ public void setWindowRoot(WindowNode mPageRootNode) {
183
+ this.mWindowRootNode = mPageRootNode;
184
+ }
185
+ public WindowNode getWindowRootNode() {
186
+ return mWindowRootNode == null && mParent != null ? mParent.getWindowRootNode() : mWindowRootNode;
187
+ }
188
+
189
+ void setLazy(RenderNode node, boolean isLazy)
190
+ {
191
+ node.mIsLazyLoad = isLazy;
192
+ for (int i = 0; i < node.getChildCount(); i++)
193
+ {
194
+ final RenderNode cn = node.getChildAt(i);
195
+ if(HippyListItemViewController.CLASS_NAME.equals(cn.mClassName)){
196
+ //XXX add by zhaopeng 20201213
197
+ //这里如果不添加此判断,当ul嵌套时,父层级的List会将子List的view一起创建,导致子List创建失败。
198
+ //ListView
199
+ //ListViewItem
200
+ //ListView
201
+ //ListViewItem
202
+ //Image
203
+ continue;
204
+ }
205
+ setLazy(cn, isLazy);
206
+ }
207
+ }
208
+
209
+ public void setLazy(boolean isLazy) {
210
+ setLazy(this, isLazy);
211
+ }
212
+
213
+ public void remove(int index) {
214
+ RenderNode uiNode = mChildren.remove(index);
215
+ uiNode.mParent = null;
216
+ uiNode.mWindowRootNode = null;
217
+ }
218
+
219
+ public RenderNode getChildAt(int index) {
220
+ if (0 <= index && index < getChildCount()) {
221
+ return mChildren.get(index);
222
+ }
223
+ return null;
224
+ }
225
+
226
+ public int getChildCount() {
227
+ return mChildren.size();
228
+ }
229
+
230
+ public RenderNode(int id, String className, ControllerManager componentManager) {
231
+ this.mId = id;
232
+ this.mClassName = className;
233
+ this.mComponentManager = componentManager;
234
+ }
235
+
236
+ public void updateNode(HippyMap map) {
237
+ if (mPropsToUpdate != null) {
238
+ //mProps do not syc to UI
239
+ HippyMap hippyMap = DiffUtils.diffProps(mPropsToUpdate, map, 0);
240
+ if (hippyMap != null && hippyMap.size() > 0) {
241
+ Set<String> sets = hippyMap.keySet();
242
+ for (String key : sets) {
243
+ if (TextUtils.equals(NodeProps.STYLE, key)) {
244
+ HippyMap styles = hippyMap.getMap(key);
245
+ if (styles != null) {
246
+ HippyMap stylesToUpdate = mPropsToUpdate.getMap(key);
247
+ if (stylesToUpdate == null) {
248
+ stylesToUpdate = new HippyMap();
249
+ }
250
+ Set<String> styleKeys = styles.keySet();
251
+ for (String styleKey : styleKeys) {
252
+ stylesToUpdate.pushObject(styleKey, styles.get(styleKey));
253
+ }
254
+
255
+ mPropsToUpdate.pushObject(key, stylesToUpdate);
256
+ }
257
+ } else {
258
+ mPropsToUpdate.pushObject(key, hippyMap.get(key));
259
+ }
260
+
261
+ }
262
+ }
263
+ } else {
264
+ mPropsToUpdate = DiffUtils.diffProps(mProps, map, 0);
265
+ }
266
+
267
+ mProps = map;
268
+ }
269
+
270
+ public HippyMap getProps() {
271
+ return mProps;
272
+ }
273
+
274
+ private boolean shouldCreateView() {
275
+ return !mIsLazyLoad && !mComponentManager.hasView(mId);
276
+ }
277
+
278
+ public String getClassName() {
279
+ return mClassName;
280
+ }
281
+
282
+ public int getX() {
283
+ return mX;
284
+ }
285
+
286
+ public int getY() {
287
+ return mY;
288
+ }
289
+
290
+ public int getWidth() {
291
+ return mWidth;
292
+ }
293
+
294
+ public int getHeight() {
295
+ return mHeight;
296
+ }
297
+
298
+ final List<RenderNode> mChildPendingList = new ArrayList<>();
299
+
300
+ public View createView() {
301
+ //delete is first when js call delete and create the same node if delete is not call the ui cannot create
302
+ if (mDeletedIdIndexMap != null && mDeletedIdIndexMap.size() > 0) {
303
+ for (int i = 0; i < mDeletedIdIndexMap.size(); i++) {
304
+ int key = mDeletedIdIndexMap.keyAt(i);
305
+ mComponentManager
306
+ .deleteChild(mId, mDeletedIdIndexMap.keyAt(i), mDeletedIdIndexMap.get(key));
307
+ }
308
+ mDeletedIdIndexMap.clear();
309
+ mNotifyManageChildren = true;
310
+ }
311
+
312
+ if (mIsDelete && TextUtils.equals(NodeProps.ROOT_NODE, mClassName) && !mIsRootHasDelete) {
313
+ mIsRootHasDelete = true;
314
+ mComponentManager.deleteRootView(mId);
315
+ }
316
+ if (shouldCreateView() && !TextUtils.equals(NodeProps.ROOT_NODE, mClassName)
317
+ && mParent != null) {
318
+ mPropsToUpdate = null;
319
+ mParent.addChildToPendingList(this);
320
+ return mComponentManager.createView(mRootView, mId, mClassName, mProps);
321
+
322
+ }
323
+ return null;
324
+ }
325
+
326
+ private boolean shouldUpdateView() {
327
+ return mComponentManager.hasView(mId);
328
+ }
329
+
330
+ public void updateLayoutManual(){
331
+ if(mComponentManager != null ) {
332
+ mComponentManager.updateLayout(mClassName, mId, mX, mY, mWidth, mHeight);
333
+ }
334
+ }
335
+
336
+
337
+ protected void addChildToPendingList(RenderNode renderNode) {
338
+ mChildPendingList.add(renderNode);
339
+ }
340
+
341
+ public void update() {
342
+ LogUtils.d("UINode", "mId" + mId + " updateStyle");
343
+
344
+ // long time = System.currentTimeMillis();
345
+ if (shouldUpdateView()) {
346
+ if (mChildPendingList.size() > 0) {
347
+ Collections.sort(mChildPendingList, new Comparator<RenderNode>() {
348
+ @Override
349
+ public int compare(RenderNode o1, RenderNode o2) {
350
+ return o1.indexFromParent() < o2.indexFromParent() ? -1 : 0;
351
+ }
352
+ });
353
+ for (int i = 0; i < mChildPendingList.size(); i++) {
354
+ RenderNode renderNode = mChildPendingList.get(i);
355
+ mComponentManager.addChild(mId, renderNode.getId(), renderNode.indexFromParent());
356
+ }
357
+ mChildPendingList.clear();
358
+ mNotifyManageChildren = true;
359
+ }
360
+ if (mPropsToUpdate != null) {
361
+ mComponentManager.updateView(mId, mClassName, mPropsToUpdate);
362
+ mPropsToUpdate = null;
363
+ }
364
+ if (mMoveHolders != null) {
365
+ for (MoveHolder moveHolder : mMoveHolders) {
366
+ Collections.sort(moveHolder.mMoveIds, new Comparator<RenderNode>() {
367
+ @Override
368
+ public int compare(RenderNode o1, RenderNode o2) {
369
+ return o1.indexFromParent() < o2.indexFromParent() ? -1 : 0;
370
+ }
371
+ });
372
+
373
+ for (int j = 0; j < moveHolder.mMoveIds.size(); j++) {
374
+ RenderNode moveId = moveHolder.mMoveIds.get(j);
375
+ mComponentManager.move(moveId.getId(), moveHolder.mMove2Id, moveId.indexFromParent());
376
+ }
377
+ }
378
+ mMoveHolders = null;
379
+ }
380
+
381
+ if (mHasUpdateLayout && !TextUtils.equals(NodeProps.ROOT_NODE, mClassName)) {
382
+ mComponentManager.updateLayout(mClassName, mId, mX, mY, mWidth, mHeight);
383
+ // LogUtils.d("UINode", "mId" + mId + " updateLayout");
384
+ mHasUpdateLayout = false;
385
+ }
386
+ if (mTextExtraUpdate != null) {
387
+ mComponentManager.updateExtra(mId, mClassName, mTextExtraUpdate);
388
+ mTextExtraUpdate = null;
389
+ }
390
+
391
+ if (mUIFunction != null && mUIFunction.size() > 0) {
392
+ for (int i = 0; i < mUIFunction.size(); i++) {
393
+ UIFunction uiFunction = mUIFunction.get(i);
394
+ mComponentManager
395
+ .dispatchUIFunction(mId, mClassName, uiFunction.mFunctionName, uiFunction.mParameter,
396
+ uiFunction.mPromise);
397
+ }
398
+ mUIFunction.clear();
399
+ mUIFunction = null;
400
+ }
401
+ if (mMeasureInWindows != null && mMeasureInWindows.size() > 0) {
402
+ for (int i = 0; i < mMeasureInWindows.size(); i++) {
403
+ Promise promise = mMeasureInWindows.get(i);
404
+ mComponentManager.measureInWindow(mId, promise);
405
+ }
406
+ mMeasureInWindows.clear();
407
+ mMeasureInWindows = null;
408
+
409
+ }
410
+ if (mNotifyManageChildren) {
411
+ manageChildrenComplete();
412
+ mNotifyManageChildren = false;
413
+ }
414
+
415
+ }
416
+ // LogUtils.d("UINode", "mId" + mId + " end updateStyle");
417
+ }
418
+
419
+
420
+ public void updateLayout(int x, int y, int w, int h) {
421
+ this.mX = x;
422
+ this.mY = y;
423
+ this.mWidth = w;
424
+ this.mHeight = h;
425
+ mHasUpdateLayout = true;
426
+ }
427
+
428
+ public void measureInWindow(Promise promise) {
429
+ if (mMeasureInWindows == null) {
430
+ mMeasureInWindows = new ArrayList<>();
431
+ }
432
+ mMeasureInWindows.add(promise);
433
+ }
434
+
435
+ public void updateViewLayoutRecursive() {
436
+ }
437
+
438
+
439
+
440
+
441
+ static class MoveHolder {
442
+
443
+ public MoveHolder(List<RenderNode> moveRenders, int mMove2Id) {
444
+ this.mMoveIds = moveRenders;
445
+ this.mMove2Id = mMove2Id;
446
+ }
447
+
448
+ final List<RenderNode> mMoveIds;
449
+ final int mMove2Id;
450
+ }
451
+
452
+ public void move(List<RenderNode> moveIds, int move2Id) {
453
+ if (shouldUpdateView()) {
454
+ if (mMoveHolders == null) {
455
+ mMoveHolders = new ArrayList<>();
456
+ }
457
+ mMoveHolders.add(new MoveHolder(moveIds, move2Id));
458
+ }
459
+ }
460
+
461
+ public void updateExtra(Object object) {
462
+ mTextExtra = object;
463
+ mTextExtraUpdate = object;
464
+ }
465
+
466
+
467
+ public void setDelete(boolean b) {
468
+ mIsDelete = b;
469
+ }
470
+
471
+ public boolean isDelete() {
472
+ return mIsDelete;
473
+ }
474
+
475
+ public void batchComplete() {
476
+ if (!mIsLazyLoad && !mIsDelete) {
477
+ mComponentManager.onBatchComplete(mClassName, mId);
478
+ }
479
+ }
480
+
481
+ public void manageChildrenComplete() {
482
+ if (!mIsLazyLoad && !mIsDelete) {
483
+ mComponentManager.onManageChildComplete(mClassName, mId);
484
+ }
485
+ }
486
+
487
+ static class UIFunction {
488
+
489
+ public UIFunction(String functionName, HippyArray parameter, Promise promise) {
490
+ this.mFunctionName = functionName;
491
+ this.mParameter = parameter;
492
+ this.mPromise = promise;
493
+ }
494
+
495
+ final String mFunctionName;
496
+ final HippyArray mParameter;
497
+ final Promise mPromise;
498
+ }
499
+
500
+
501
+ public void dispatchUIFunction(String functionName, HippyArray parameter, Promise promise) {
502
+ if (mUIFunction == null) {
503
+ mUIFunction = new ArrayList<>();
504
+ }
505
+ mUIFunction.add(new UIFunction(functionName, parameter, promise));
506
+ }
507
+
508
+ public boolean isIsLazyLoad() {
509
+ return mIsLazyLoad;
510
+ }
511
+
512
+ public void nodeToMap(HippyMap map) {
513
+ map.pushInt("id", mId);
514
+ map.pushInt("x", mX);
515
+ map.pushInt("y", mY);
516
+ map.pushInt("width", mWidth);
517
+ map.pushInt("height", mHeight);
518
+ map.pushString("className", mClassName);
519
+ map.pushObject("textExtra", mTextExtra);
520
+ map.pushMap("props", mProps);
521
+ map.pushBoolean("isLazyLoad", mIsLazyLoad);
522
+ }
523
+
524
+ public void applyByMap(HippyMap map){
525
+ mX = map.getInt("x");
526
+ mY = map.getInt("y");
527
+ mWidth = map.getInt("width");
528
+ mHeight = map.getInt("height");
529
+ mTextExtra = map.get("textExtra");
530
+ mProps = map.getMap("props");
531
+ }
532
+
533
+ }
@@ -0,0 +1,17 @@
1
+ package com.tencent.mtt.hippy.uimanager;
2
+
3
+ import com.tencent.mtt.hippy.common.HippyArray;
4
+
5
+ public interface StateView {
6
+
7
+
8
+ void setShowOnState(int[] showOnState);
9
+ void setShowOnCustomState(String[] showOnState);
10
+
11
+ void setCustomState(String state,boolean on);
12
+
13
+ int STATE_FOCUS_AND_SELECT = 100;
14
+ int STATE_FOCUS_NO_SELECT = STATE_FOCUS_AND_SELECT + 1;
15
+ int STATE_SELECT_NO_FOCUS = STATE_FOCUS_AND_SELECT + 2;
16
+
17
+ }
@@ -0,0 +1,125 @@
1
+ /* Tencent is pleased to support the open source community by making Hippy available.
2
+ * Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ package com.tencent.mtt.hippy.uimanager;
17
+
18
+ import com.tencent.mtt.hippy.common.HippyArray;
19
+ import com.tencent.mtt.hippy.common.HippyMap;
20
+
21
+ @SuppressWarnings({"deprecation", "unused"})
22
+ public class TransformUtil {
23
+
24
+ private static final ThreadLocal<double[]> sHelperMatrix = new ThreadLocal<double[]>() {
25
+ @Override
26
+ protected double[] initialValue() {
27
+ return new double[16];
28
+ }
29
+ };
30
+
31
+ private static double convertToRadians(HippyMap transformMap, String key) {
32
+ double value = 0;
33
+ boolean inRadians = true;
34
+ if (transformMap.get(key) instanceof String) {
35
+ String stringValue = (String) transformMap.get(key);
36
+ if (stringValue.endsWith("deg")) {
37
+ inRadians = false;
38
+ }
39
+ if (stringValue.endsWith("rad") || stringValue.endsWith("deg")) {
40
+ stringValue = stringValue.substring(0, stringValue.length() - 3);
41
+ }
42
+ value = Float.parseFloat(stringValue);
43
+ } else if (transformMap.get(key) instanceof Number) {
44
+ value = ((Number) transformMap.get(key)).doubleValue();
45
+ }
46
+ return inRadians ? value : MatrixUtil.degreesToRadians(value);
47
+ }
48
+
49
+ public static void processTransform(HippyArray transforms, double[] result) {
50
+ double[] helperMatrix = sHelperMatrix.get();
51
+ MatrixUtil.resetIdentityMatrix(result);
52
+
53
+ for (int transformIdx = 0, size = transforms.size(); transformIdx < size; transformIdx++) {
54
+ HippyMap transform = transforms.getMap(transformIdx);
55
+ String transformType = transform.keySet().iterator().next();
56
+
57
+ assert helperMatrix != null;
58
+ MatrixUtil.resetIdentityMatrix(helperMatrix);
59
+ Object value = transform.get(transformType);
60
+ if ("matrix".equals(transformType) && value instanceof HippyArray) {
61
+ HippyArray matrix = (HippyArray) value;
62
+ for (int i = 0; i < 16; i++) {
63
+ Object matrixValue = matrix.getObject(i);
64
+ if (matrixValue instanceof Number) {
65
+ helperMatrix[i] = ((Number) matrixValue).doubleValue();
66
+ }
67
+ }
68
+ } else if ("perspective".equals(transformType) && value instanceof Number) {
69
+ MatrixUtil.applyPerspective(helperMatrix, ((Number) value).doubleValue());
70
+ } else if ("rotateX".equals(transformType)) {
71
+ MatrixUtil.applyRotateX(helperMatrix, convertToRadians(transform, transformType));
72
+ } else if ("rotateY".equals(transformType)) {
73
+ MatrixUtil.applyRotateY(helperMatrix, convertToRadians(transform, transformType));
74
+ } else if ("rotate".equals(transformType) || "rotateZ".equals(transformType)) {
75
+ MatrixUtil.applyRotateZ(helperMatrix, convertToRadians(transform, transformType));
76
+ } else if ("scale".equals(transformType) && value instanceof Number) {
77
+ double scale = ((Number) value).doubleValue();
78
+ MatrixUtil.applyScaleX(helperMatrix, scale);
79
+ MatrixUtil.applyScaleY(helperMatrix, scale);
80
+ } else if ("scaleX".equals(transformType) && value instanceof Number) {
81
+ MatrixUtil.applyScaleX(helperMatrix, ((Number) value).doubleValue());
82
+ } else if ("scaleY".equals(transformType)) {
83
+ MatrixUtil.applyScaleY(helperMatrix, ((Number) value).doubleValue());
84
+ } else if ("translate".equals(transformType) && value instanceof HippyArray) {
85
+ double x = 0d, y = 0d, z = 0d;
86
+
87
+ if (((HippyArray) value).size() > 0) {
88
+ Object tranX = ((HippyArray) value).getObject(0);
89
+ if (tranX instanceof Number) {
90
+ x = ((Number) tranX).doubleValue();
91
+ }
92
+ }
93
+
94
+ if (((HippyArray) value).size() > 1) {
95
+ Object tranY = ((HippyArray) value).getObject(1);
96
+ if (tranY instanceof Number) {
97
+ y = ((Number) tranY).doubleValue();
98
+ }
99
+ }
100
+
101
+ if (((HippyArray) value).size() > 2) {
102
+ Object tranZ = ((HippyArray) value).getObject(2);
103
+ if (tranZ instanceof Number) {
104
+ z = ((Number) tranZ).doubleValue();
105
+ }
106
+ }
107
+ MatrixUtil.applyTranslate3D(helperMatrix, x, y, z);
108
+ } else if ("translateX".equals(transformType) && value instanceof Number) {
109
+ MatrixUtil.applyTranslate2D(helperMatrix, ((Number) value).doubleValue(), 0d);
110
+ } else if ("translateY".equals(transformType) && value instanceof Number) {
111
+ MatrixUtil.applyTranslate2D(helperMatrix, 0d, ((Number) value).doubleValue());
112
+ } else if ("skewX".equals(transformType)) {
113
+ MatrixUtil.applySkewX(helperMatrix, convertToRadians(transform, transformType));
114
+ } else if ("skewY".equals(transformType)) {
115
+ MatrixUtil.applySkewY(helperMatrix, convertToRadians(transform, transformType));
116
+ } else {
117
+ RuntimeException runtimeException = new RuntimeException(
118
+ "Unsupported transform type: " + transformType);
119
+ runtimeException.printStackTrace();
120
+ }
121
+
122
+ MatrixUtil.multiplyInto(result, result, helperMatrix);
123
+ }
124
+ }
125
+ }