@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,317 @@
1
+ package com.tencent.extend.views.fastlist;
2
+
3
+ import android.util.Log;
4
+ import android.view.View;
5
+
6
+ import com.tencent.extend.views.TVTextView;
7
+ import com.tencent.mtt.hippy.common.HippyMap;
8
+ import com.tencent.mtt.hippy.dom.flex.FlexAlign;
9
+ import com.tencent.mtt.hippy.dom.flex.FlexCSSDirection;
10
+ import com.tencent.mtt.hippy.dom.flex.FlexJustify;
11
+ import com.tencent.mtt.hippy.dom.node.DomNode;
12
+ import com.tencent.mtt.hippy.uimanager.RenderNode;
13
+ import com.tencent.mtt.hippy.utils.LogUtils;
14
+ import com.tencent.mtt.hippy.views.list.HippyRecycler;
15
+
16
+
17
+ import java.util.ArrayList;
18
+ import java.util.HashMap;
19
+ import java.util.List;
20
+
21
+ class ViewTag {
22
+ private HashMap<Integer,List<Patch>> pendingPatches;
23
+ FastAdapter.ElementNode domNode;
24
+ final RenderNode template;
25
+ Worker worker;
26
+
27
+ boolean enableLoadDelay = false;
28
+ // boolean viewCreated = false;
29
+ @Deprecated
30
+ FastAdapter.ElementNode placeHolderNode;
31
+ ArrayList<FastAdapter.ElementNode> mDelayLoadNodes;
32
+ // FastAdapter.ElementNode contentNode;
33
+
34
+ ViewTag(RenderNode template) {
35
+ this.template = template;
36
+ }
37
+
38
+ void addDelayLoad(FastAdapter.ElementNode node){
39
+ if(mDelayLoadNodes == null){
40
+ mDelayLoadNodes = new ArrayList<>();
41
+ }
42
+ if(!mDelayLoadNodes.contains(node)) {
43
+ mDelayLoadNodes.add(node);
44
+ }
45
+ }
46
+
47
+ List<FastAdapter.ElementNode> getDelayLoadNodes(){
48
+ return mDelayLoadNodes;
49
+ }
50
+
51
+
52
+ public FastAdapter.ElementNode getRootNode(){
53
+ if(domNode == null){
54
+ domNode = new FastAdapter.ElementNode();
55
+ domNode.setFlexDirection(FlexCSSDirection.COLUMN);
56
+ domNode.setAlignItems(FlexAlign.FLEX_START);
57
+ domNode.setJustifyContent(FlexJustify.FLEX_START);
58
+ domNode.rootNode = domNode;
59
+ domNode.isRootItem = true;
60
+ // domNode.setWrap(FlexWrap.NOWRAP);
61
+ }
62
+ return domNode;
63
+ }
64
+
65
+ void cancelWork(){
66
+ //Log.d("WorkLOG", "WorkLOG cancel this:" + Utils.hashCode(worker));
67
+ if(worker != null){
68
+ worker.cancel();
69
+ }
70
+ worker = null;
71
+ }
72
+
73
+
74
+ void work(Worker worker){
75
+ this.worker = worker;
76
+ //Log.d("WorkLOG", "WorkLOG work run :" + Utils.hashCode(worker));
77
+ worker.work();
78
+ //worker.batch();
79
+ }
80
+
81
+ public void preparePatch(Patch p){
82
+ if(pendingPatches == null){
83
+ pendingPatches = new HashMap<>();
84
+ }
85
+ final int type = p.type;
86
+ if(!pendingPatches.containsKey(type)){
87
+ pendingPatches.put(type,new ArrayList<>());
88
+ }
89
+ pendingPatches.get(type).add(p);
90
+ }
91
+
92
+ public List<Patch> getPatches(int type) {
93
+ return pendingPatches.get(type);
94
+ }
95
+
96
+ public int getPatchesSize(int type){
97
+ return pendingPatches.containsKey(type) ? pendingPatches.get(type).size() : 0;
98
+ }
99
+
100
+ public void clear() {
101
+ if(pendingPatches != null){
102
+ pendingPatches.clear();
103
+ }
104
+ }
105
+
106
+ public void reset() {
107
+ if(domNode != null){
108
+ for(int i = 0; i < domNode.getChildCount(); i ++){
109
+ final FastAdapter.ElementNode el = (FastAdapter.ElementNode) domNode.getChildAt(i);
110
+ if(el.boundView != null) {
111
+ if(LogUtils.isDebug()) {
112
+ Log.i("ViewTAG","ElementCallback clear callback"+"view:"+el.boundView);
113
+ }
114
+ el.boundView.setOnClickListener(null);
115
+ el.boundView.setOnFocusChangeListener(null);
116
+ // HippyEngineContext context = ((HippyInstanceContext)el.boundView.getContext()).getEngineContext();
117
+ // DomNode tDom = context.getDomManager().getNode(template.getId());
118
+ // Utils.resetNode(el,tDom);
119
+ }
120
+ resetElementNode(domNode);
121
+ //重置嵌套的子列表
122
+ resetAllView(domNode);
123
+ }
124
+ }
125
+ }
126
+
127
+ void resetAllView(DomNode node){
128
+ if(node instanceof FastAdapter.ElementNode) {
129
+ final FastAdapter.ElementNode en = (FastAdapter.ElementNode) node;
130
+ if(en.boundView instanceof FastPendingView){
131
+ ((FastPendingView) en.boundView).notifyRecycled();
132
+ }
133
+ //这里如果打开注释的话,会导致频繁切换tab时,点击事件无效,这里暂注掉
134
+ // if (en.boundView != null && en.boundView.isFocusable()) {
135
+ // en.boundView.setOnClickListener(null);
136
+ // en.boundView.setOnFocusChangeListener(null);
137
+ // }
138
+ for(int i = 0; i < node.getChildCount(); i ++){
139
+ resetAllView(node.getChildAt(i));
140
+ }
141
+ }
142
+ }
143
+
144
+
145
+ public void resetTextView(){
146
+ if(domNode != null){
147
+ for(int i = 0; i < domNode.getChildCount(); i ++){
148
+ resetTextElementNode(domNode);
149
+ }
150
+ }
151
+ }
152
+
153
+ void resetTextElementNode(DomNode node){
154
+ if(node instanceof FastAdapter.ElementNode) {
155
+ final FastAdapter.ElementNode en = (FastAdapter.ElementNode) node;
156
+ if(en.boundView instanceof TVTextView){
157
+ ((HippyRecycler) en.boundView).onResetBeforeCache();
158
+ }
159
+ for(int i = 0; i < node.getChildCount(); i ++){
160
+ resetTextElementNode(node.getChildAt(i));
161
+ }
162
+ }
163
+ }
164
+
165
+
166
+ void resetElementNode(DomNode node){
167
+ if(node instanceof FastAdapter.ElementNode) {
168
+ final FastAdapter.ElementNode en = (FastAdapter.ElementNode) node;
169
+ en.resetState();
170
+ if(en.boundView instanceof HippyRecycler){
171
+ ((HippyRecycler) en.boundView).onResetBeforeCache();
172
+ }
173
+ // for(int i = 0; i < node.getChildCount(); i ++){
174
+ // resetElementNode(node.getChildAt(i));
175
+ // }
176
+ }
177
+ }
178
+
179
+ static class Patch{
180
+ final int type;
181
+ View view;
182
+ RenderNode boundNode;
183
+ final static int TYPE_PENDING_CREATE =0;
184
+ final static int TYPE_PROP =1;
185
+ final static int TYPE_PENDING_PRO =2;
186
+ final static int TYPE_LAYOUT =3;
187
+ final static int TYPE_EXTRA =4;
188
+ final static int TYPE_PENDING_LIST =5;
189
+
190
+ Patch(int type) {
191
+ this.type = type;
192
+ }
193
+ }
194
+
195
+ static class PendingPropPatch extends Patch{
196
+ String valueKey;
197
+ String prop;
198
+ FastAdapter.ElementNode eNode;
199
+ public PendingPropPatch(RenderNode bindNode, String nodeProp, View view, String valueKey,FastAdapter.ElementNode en) {
200
+ super(TYPE_PENDING_PRO);
201
+ this.view = view;
202
+ this.prop = nodeProp;
203
+ this.valueKey = valueKey;
204
+ this.boundNode = bindNode;
205
+ this.eNode = en;
206
+ }
207
+ }
208
+
209
+ static class UpdatePropPatch extends Patch{
210
+ HippyMap data;
211
+ public UpdatePropPatch(RenderNode bindNode, View view, HippyMap data) {
212
+ super(TYPE_PROP);
213
+ this.view = view;
214
+ this.data = data;
215
+ this.boundNode = bindNode;
216
+ }
217
+ }
218
+
219
+ static class UpdateExtraPatch extends Patch{
220
+ public UpdateExtraPatch(RenderNode bindNode, View view) {
221
+ super(TYPE_EXTRA);
222
+ this.view = view;
223
+ this.boundNode = bindNode;
224
+ }
225
+ }
226
+
227
+ static class ListItemPatch extends Patch{
228
+ String prop;
229
+ public ListItemPatch(RenderNode bindNode, View view,String prop) {
230
+ super(TYPE_PENDING_LIST);
231
+ this.view = view;
232
+ this.boundNode = bindNode;
233
+ this.prop = prop;
234
+ }
235
+ }
236
+
237
+ static class UpdateLayoutPatch extends Patch{
238
+ final int[] layout;
239
+ FastAdapter.ElementNode eNode;
240
+ public UpdateLayoutPatch(RenderNode bindNode, View view, FastAdapter.ElementNode node) {
241
+ super(TYPE_LAYOUT);
242
+ this.view = view;
243
+ this.boundNode = bindNode;
244
+ this.layout = new int[]{bindNode.getX(),bindNode.getY(),bindNode.getWidth(),bindNode.getHeight()};
245
+ this.eNode = node;
246
+ }
247
+
248
+ public UpdateLayoutPatch(int x,int y,int width,int height, View view,RenderNode bindNode,FastAdapter.ElementNode node) {
249
+ super(TYPE_LAYOUT);
250
+ this.view = view;
251
+ this.boundNode = bindNode;
252
+ this.layout = new int[]{x,y,width,height};
253
+ this.eNode = node;
254
+ }
255
+
256
+ }
257
+
258
+ static abstract class Worker {
259
+ private boolean canceled = false;
260
+ ArrayList<Task> tasks;
261
+
262
+ public Worker() {
263
+ }
264
+
265
+ void cancel(){
266
+ this.canceled = true;
267
+ if(tasks != null) {
268
+ for (Task task : tasks) {
269
+ task.canceled = true;
270
+ }
271
+ if(isCanceled()){
272
+ Log.e("WorkLOG", "cancel workSize:" + tasks.size());
273
+ }
274
+ tasks.clear();
275
+ }
276
+ }
277
+
278
+ void addTask(Task task){
279
+ if(tasks == null){
280
+ tasks = new ArrayList<>();
281
+ }
282
+ tasks.add(task);
283
+ //rootView.postDelayed(task,16);
284
+ }
285
+
286
+ abstract void work();
287
+ void batch(){
288
+ if(tasks != null) {
289
+ for (Task task : tasks) {
290
+ if(isCanceled()){
291
+ Log.e("WorkLOG", "WorkLOG cancel work !!");
292
+ break;
293
+ }
294
+ if (!task.canceled) {
295
+ task.run();
296
+ }else{
297
+ Log.e("WorkLOG", "WorkLOG cancel work ");
298
+ }
299
+ }
300
+ tasks.clear();
301
+ }
302
+ }
303
+
304
+ boolean isCanceled(){
305
+ return canceled;
306
+ }
307
+
308
+ }
309
+
310
+ static abstract class Task implements Runnable{
311
+ boolean canceled = false;
312
+ int batch = 0;
313
+ }
314
+
315
+ }
316
+
317
+
@@ -0,0 +1,8 @@
1
+ package com.tencent.extend.views.fastlist;
2
+
3
+ import android.view.View;
4
+
5
+ public interface VirtualListView {
6
+ View getView();
7
+ void searchUpdateItemDataByItemID(String id, Object data, boolean traverse);
8
+ }
@@ -0,0 +1,320 @@
1
+ package com.tencent.extend.views.fastlist.diff;
2
+
3
+ import static com.tencent.extend.views.fastlist.diff.KeyDiffHelper.handleKeyDataDiff;
4
+ import static com.tencent.extend.views.fastlist.diff.NoKeyDiffHelper.handleNoKeyDataDiff;
5
+
6
+ import android.text.TextUtils;
7
+
8
+ import com.tencent.mtt.hippy.common.HippyArray;
9
+ import com.tencent.mtt.hippy.common.HippyMap;
10
+
11
+ import java.util.ArrayList;
12
+ import java.util.HashMap;
13
+ import java.util.List;
14
+ import java.util.Map;
15
+
16
+ /**
17
+ * tv-list 实现diff工具类
18
+ */
19
+ public class FastListDataBindingHelper {
20
+
21
+ public interface OnDataDiffListener2 {
22
+
23
+ void onMove(int position, int nextPosition);
24
+
25
+ void onRangeUpdate(int start, int count);
26
+
27
+ void onAllChange();
28
+ }
29
+
30
+ public interface OnDataDiffListener3 extends OnDataDiffListener2 {
31
+
32
+ void onRangeInsert(int position, int count);
33
+
34
+ void onRangeDelete(int position, int count);
35
+
36
+ void onUpdateViewData();
37
+ }
38
+
39
+ // 不需要转换旧数据,直接调用此方法
40
+ public static void handleDataDiffCallBack3(HippyArray beforeArray, HippyArray array,
41
+ String keyName, OnDataDiffListener3 listener) {
42
+ handleDataDiffCallBack3(beforeArray, array, keyName, listener, null, null);
43
+ }
44
+
45
+ /**
46
+ * 回调方式的diff方法
47
+ *
48
+ * @param beforeArray 旧数据
49
+ * @param array 新数据
50
+ * @param keyName 指定key的名字,String类型 数据没有key值的话,直接传空
51
+ * @param resultListener diff结果回调监听
52
+ * @param transFormListener 处理旧数据item转换
53
+ * @param tClass 旧数据的Class类型
54
+ * @param <T> 旧数据的类型
55
+ */
56
+ public static <T> void handleDataDiffCallBack3(HippyArray beforeArray, HippyArray array,
57
+ String keyName, OnDataDiffListener3 resultListener,
58
+ OnTransFormListener<T> transFormListener, Class<T> tClass) {
59
+ Map<Integer, List<DiffItem>> resultMap = handleDataDiff(beforeArray, array, keyName, transFormListener, tClass);
60
+
61
+ if (resultListener == null) {
62
+ return;
63
+ }
64
+
65
+ resultListener.onUpdateViewData();
66
+
67
+ if (resultMap.get(Patch.ALL_UPDATE) != null) {
68
+ resultListener.onAllChange();
69
+ return;
70
+ }
71
+
72
+ List<DiffItem> upList = resultMap.get(Patch.TYPE_UPDATE);
73
+ List<DiffItem> deList = resultMap.get(Patch.TYPE_DELETE);
74
+ List<DiffItem> insertList = resultMap.get(Patch.TYPE_INSERT);
75
+
76
+ if (!TextUtils.isEmpty(keyName)) {
77
+ List<DiffItem> moList = resultMap.get(Patch.TYPE_MOVE);
78
+ handleKeyCallBack(upList, deList, insertList, moList, resultListener, array.size());
79
+ } else {
80
+ handleNoKeyCallBack(upList, deList, insertList, resultListener);
81
+ }
82
+ }
83
+
84
+ private static void handleKeyCallBack(List<DiffItem> upList, List<DiffItem> deList,
85
+ List<DiffItem> insertList, List<DiffItem> moList,
86
+ OnDataDiffListener3 resultListener, int newSize) {
87
+ // update
88
+ commonNotify(upList, Patch.TYPE_UPDATE, resultListener);
89
+ int max = -1, min = -1;
90
+ // insert
91
+ if (insertList.size() > 0) {
92
+ int inMin = commonNotify(insertList, Patch.TYPE_INSERT, resultListener);
93
+ if (inMin != -1) {
94
+ min = inMin;
95
+ max = newSize - 1;
96
+ }
97
+ }
98
+ // move
99
+ if (moList.size() > 0) {
100
+ for (int i = 0; i < moList.size(); i++) {
101
+ if (moList.get(i) instanceof MoveDiffItem) {
102
+ MoveDiffItem moveDiffItem =
103
+ (MoveDiffItem) moList.get(i);
104
+ resultListener.onMove(moveDiffItem.position, moveDiffItem.nextPosition);
105
+ max = Math.max(max, Math.max(moveDiffItem.position, moveDiffItem.nextPosition));
106
+ if (min == -1) {
107
+ min = Math.min(moveDiffItem.position, moveDiffItem.nextPosition);
108
+ } else {
109
+ min = Math.min(min, Math.min(moveDiffItem.position, moveDiffItem.nextPosition));
110
+ }
111
+ }
112
+ }
113
+ }
114
+ // delete
115
+ if (deList.size() > 0) {
116
+
117
+ for (int i = deList.size() - 1; i >= 0; i--) {
118
+ RangeDiffItem item = (RangeDiffItem) deList.get(i);
119
+ resultListener.onRangeDelete(item.position, item.getListSize());
120
+ }
121
+
122
+ int deMin = deList.get(0).position;
123
+ min = min == -1 ? deMin : Math.min(min, deMin);
124
+ max = newSize - 1;
125
+ }
126
+ if (min != -1 && max != -1 && needRangUpdate(deList, insertList, moList, newSize)) {
127
+ max = Math.min(max, newSize - 1);
128
+
129
+ resultListener.onRangeUpdate(min, max - min + 1);
130
+ }
131
+ }
132
+
133
+ private static boolean needRangUpdate(List<DiffItem> deList, List<DiffItem> insertList,
134
+ List<DiffItem> moList, int newSize) {
135
+ if (moList.size() != 0) {
136
+ return true;
137
+ }
138
+ if (deList.size() == 1 && insertList.size() == 0) {
139
+ RangeDiffItem item = (RangeDiffItem) deList.get(0);
140
+ return (item.isReverse ? item.getListLast() : item.position) + item.getListSize() != newSize;
141
+ }
142
+ if (insertList.size() == 1 && deList.size() == 0) {
143
+ RangeDiffItem item = (RangeDiffItem) insertList.get(0);
144
+ return (item.isReverse ? item.getListLast() : item.position) + item.getListSize() != newSize;
145
+ }
146
+ return true;
147
+ }
148
+
149
+ private static void handleNoKeyCallBack(List<DiffItem> upList, List<DiffItem> deList,
150
+ List<DiffItem> insertList, OnDataDiffListener3 resultListener) {
151
+ // update
152
+ commonNotify(upList, Patch.TYPE_UPDATE, resultListener);
153
+ // delete
154
+ commonNotify(deList, Patch.TYPE_DELETE, resultListener);
155
+ // insert
156
+ commonNotify(insertList, Patch.TYPE_INSERT, resultListener);
157
+ }
158
+
159
+ private static int commonNotify(List<DiffItem> diffItems, int type, OnDataDiffListener3 resultListener) {
160
+ int min = -1;
161
+ if (diffItems.size() > 0) {
162
+ DiffItem item;
163
+ for (int i = 0; i < diffItems.size(); i++) {
164
+ item = diffItems.get(i);
165
+ if (item instanceof RangeDiffItem) {
166
+ int minPos = ((RangeDiffItem) item).notify(type, resultListener);
167
+ min = min == -1 ? minPos : Math.min(minPos, min);
168
+ }
169
+ }
170
+ }
171
+ return min;
172
+ }
173
+
174
+ // 不需要转换旧数据,直接调用此方法
175
+ public static Map<Integer, List<DiffItem>> handleDataDiff(HippyArray beforeArray, HippyArray array,
176
+ String keyName) {
177
+ return handleDataDiff(beforeArray, array, keyName, null, null);
178
+ }
179
+
180
+ /**
181
+ * 无回调形式的diff方法,结果直接返回
182
+ *
183
+ * @param beforeArray 旧数据
184
+ * @param array 新数据
185
+ * @param keyName 指定key的名字,String类型 数据没有key值的话,直接传空
186
+ * @param listener 处理旧数据item转换
187
+ * @param tClass 旧数据的Class类型
188
+ * @param <T> 旧数据的类型
189
+ * @return 包含list结果的Map
190
+ */
191
+ public static <T> Map<Integer, List<DiffItem>> handleDataDiff(HippyArray beforeArray, HippyArray array,
192
+ String keyName,
193
+ OnTransFormListener<T> listener, Class<T> tClass) {
194
+ if (beforeArray == null || array == null || beforeArray.size() < 1 || array.size() < 1) {
195
+ Map<Integer, List<DiffItem>> resultMap = new HashMap<>();
196
+ resultMap.put(Patch.ALL_UPDATE, new ArrayList<>());
197
+ return resultMap;
198
+ }
199
+ if (!TextUtils.isEmpty(keyName)) {
200
+ return handleKeyDataDiff(beforeArray, array, keyName, listener, tClass);
201
+ } else {
202
+ return handleNoKeyDataDiff(beforeArray, array, listener, tClass);
203
+ }
204
+ }
205
+
206
+ public static class MoveDiffItem extends DiffItem {
207
+ public final int nextPosition;
208
+ public final Object nextItem;
209
+
210
+ public MoveDiffItem(int position, int nextPosition, Object item, Object nextItem) {
211
+ super(position, item);
212
+ this.nextPosition = nextPosition;
213
+ this.nextItem = nextItem;
214
+ }
215
+ }
216
+
217
+ public static class RangeDiffItem extends DiffItem {
218
+
219
+ protected final List<Integer> posList = new ArrayList<>();
220
+
221
+ protected final boolean isReverse;
222
+
223
+ public static void handleRangeList(List<DiffItem> rangeList,
224
+ int position, Object item) {
225
+ handleRangeList(rangeList, position, item, false);
226
+ }
227
+
228
+ public static void handleRangeList(List<DiffItem> rangeList,
229
+ int position, Object item, boolean isReverse) {
230
+
231
+ if (rangeList.size() < 1) {
232
+ rangeList.add(RangeDiffItem.getInstance(null, position, item, isReverse));
233
+ } else {
234
+ // 获取最近添加的数据
235
+ RangeDiffItem diffItem = (RangeDiffItem) rangeList.get(rangeList.size() - 1);
236
+
237
+ RangeDiffItem instance = RangeDiffItem.getInstance(diffItem, position, item, isReverse);
238
+ if (instance != null) {
239
+ rangeList.add(instance);
240
+ }
241
+ }
242
+ }
243
+
244
+ public static RangeDiffItem getInstance(RangeDiffItem diffItem, int nowPosition,
245
+ Object nowItem, boolean isReverse) {
246
+ if (diffItem != null && nowPosition == diffItem.getListLast() + (isReverse ? -1 : 1)) {
247
+ diffItem.addPosition(nowPosition);
248
+ return null;
249
+ } else {
250
+ return new RangeDiffItem(nowPosition, nowItem, isReverse);
251
+ }
252
+ }
253
+
254
+ public RangeDiffItem(int position, Object item, boolean isReverse) {
255
+ super(position, item);
256
+ this.isReverse = isReverse;
257
+ posList.add(position);
258
+ }
259
+
260
+ public int notify(int type, OnDataDiffListener3 listener) {
261
+ int pos = isReverse ? getListLast() : position;
262
+ switch (type) {
263
+ case Patch.TYPE_UPDATE:
264
+ listener.onRangeUpdate(pos, getListSize());
265
+ break;
266
+ case Patch.TYPE_INSERT:
267
+ listener.onRangeInsert(pos, getListSize());
268
+ break;
269
+ case Patch.TYPE_DELETE:
270
+ listener.onRangeDelete(pos, getListSize());
271
+ break;
272
+ }
273
+ return pos;
274
+ }
275
+
276
+ public int getListSize() {
277
+ return posList.size();
278
+ }
279
+
280
+ private void addPosition(int nowPosition) {
281
+ posList.add(nowPosition);
282
+ }
283
+
284
+ private Integer getListLast() {
285
+ return posList.get(posList.size() - 1);
286
+ }
287
+ }
288
+
289
+ public static class DiffItem {
290
+
291
+ public final int position;
292
+ public final Object item;
293
+
294
+ public DiffItem(int position, Object item) {
295
+ this.position = position;
296
+ this.item = item;
297
+ }
298
+
299
+ @Override
300
+ public String toString() {
301
+ return "DiffItem{" +
302
+ "position=" + position +
303
+ ", item=" + item +
304
+ '}';
305
+ }
306
+ }
307
+
308
+ public static class Patch {
309
+
310
+ public static final int TYPE_UPDATE = 0; // 更新
311
+ public static final int TYPE_DELETE = 1; // 删除
312
+ public static final int TYPE_INSERT = 2; // 插入
313
+ public static final int TYPE_MOVE = 3; // 移动 目前移动的情况,没有判断该数据有没有update
314
+ public static final int ALL_UPDATE = 4; // 通知全部更新
315
+ }
316
+
317
+ public interface OnTransFormListener<T> {
318
+ HippyMap onTransForm(T item);
319
+ }
320
+ }