@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,105 @@
1
+ package com.tencent.extend.views.fastlist;
2
+
3
+ import android.content.Context;
4
+ import android.util.Log;
5
+ import android.view.View;
6
+
7
+ import com.tencent.mtt.hippy.annotation.HippyController;
8
+ import com.tencent.mtt.hippy.annotation.HippyControllerProps;
9
+ import com.tencent.mtt.hippy.common.HippyArray;
10
+ import com.tencent.mtt.hippy.common.HippyMap;
11
+ import com.tencent.mtt.hippy.modules.Promise;
12
+ import com.tencent.mtt.hippy.utils.LogUtils;
13
+ import com.tencent.mtt.hippy.views.view.HippyViewGroup;
14
+ import com.tencent.mtt.hippy.views.view.HippyViewGroupController;
15
+
16
+
17
+ @HippyController(
18
+ name = ReplaceChildController.CLASS_NAME
19
+ )
20
+ public class ReplaceChildController extends HippyViewGroupController {
21
+
22
+ public static final String CLASS_NAME = "ReplaceChildView";
23
+ public static final String TAG = ReplaceChildView.TAG;
24
+
25
+
26
+ public ReplaceChildController() {
27
+
28
+ }
29
+
30
+ @HippyControllerProps(name = "childSID", defaultType = HippyControllerProps.STRING)
31
+ public void setBoundTag(final View lv, String idTag){
32
+ //Log.i(TAG," setBoundTag setBoundID :"+idTag);
33
+ if(lv instanceof ReplaceChildView){
34
+ ((ReplaceChildView) lv).setBoundID(idTag);
35
+ }
36
+ }
37
+
38
+ @HippyControllerProps(name = "markChildSID", defaultType = HippyControllerProps.STRING)
39
+ public void setMarkChildSID(final View lv, String idTag){
40
+ if(lv instanceof ReplaceChildView){
41
+ ((ReplaceChildView) lv).markChildSID(idTag);
42
+ }
43
+ }
44
+
45
+ @HippyControllerProps(name = "eventReceiverSID", defaultType = HippyControllerProps.STRING)
46
+ public void setEventReceiverSID(final View lv, String sid){
47
+ //Log.i(TAG," setBoundTag setBoundID :"+idTag);
48
+ if(lv instanceof ReplaceChildView){
49
+ ((ReplaceChildView) lv).setEventReceiverSID(sid);
50
+ }
51
+ }
52
+
53
+ @HippyControllerProps(name = "replaceOnVisibilityChanged", defaultType = HippyControllerProps.BOOLEAN)
54
+ public void setReplaceOnVisibilityChanged(final View lv, Boolean b){
55
+ if(lv instanceof ReplaceChildView){
56
+ ((ReplaceChildView) lv).setReplaceOnVisibilityChanged(b);
57
+ }
58
+ }
59
+
60
+
61
+ protected View createViewImpl(Context context) {
62
+ //return new SurfaceViewContainer(context);
63
+ return null;
64
+ }
65
+
66
+ @Override
67
+ protected View createViewImpl(Context context, HippyMap iniProps) {
68
+ ReplaceChildView ReplaceChildView = new ReplaceChildView(context);
69
+ //Log.i(TAG,"createViewImpl IndieViewContainer:"+ ReplaceChildView);
70
+ return ReplaceChildView;
71
+ }
72
+
73
+
74
+ @Override
75
+ public void dispatchFunction(HippyViewGroup view, String functionName, HippyArray var) {
76
+ super.dispatchFunction(view, functionName, var);
77
+ if (view instanceof ReplaceChildView) {
78
+ switch (functionName){
79
+ case "setChildSID":
80
+ if(LogUtils.isDebug()) {
81
+ Log.i(TAG, "dispatchFunctionBySid 1 setBoundID:" + var.getString(0));
82
+ }
83
+ ((ReplaceChildView) view).exeReplaceChild(var.getString(0));
84
+ break;
85
+ }
86
+ }
87
+ }
88
+
89
+
90
+ @Override
91
+ public void dispatchFunction(HippyViewGroup view, String functionName, HippyArray var, Promise promise) {
92
+ super.dispatchFunction(view, functionName, var, promise);
93
+ if (view instanceof ReplaceChildView) {
94
+ switch (functionName){
95
+ case "setChildSID":
96
+ if(LogUtils.isDebug()) {
97
+ Log.i(TAG, "dispatchFunctionBySid 2 setBoundID:" + var.getString(0));
98
+ }
99
+ ((ReplaceChildView) view).setBoundID(var.getString(0));
100
+ break;
101
+ }
102
+ }
103
+
104
+ }
105
+ }
@@ -0,0 +1,312 @@
1
+ package com.tencent.extend.views.fastlist;
2
+
3
+ import android.content.Context;
4
+ import android.text.TextUtils;
5
+ import android.util.Log;
6
+ import android.view.View;
7
+
8
+ import com.tencent.extend.RenderUtil;
9
+ import com.tencent.extend.views.JSEventHandleView;
10
+ import com.tencent.extend.views.waterfall.Chunk;
11
+ import com.tencent.extend.views.waterfall.Tabs;
12
+ import com.tencent.mtt.hippy.common.HippyMap;
13
+ import com.tencent.mtt.hippy.uimanager.HippyViewEvent;
14
+ import com.tencent.mtt.hippy.uimanager.RenderNode;
15
+ import com.tencent.mtt.hippy.utils.ExtendUtil;
16
+ import com.tencent.mtt.hippy.utils.LogUtils;
17
+ import com.tencent.mtt.hippy.views.view.HippyViewGroup;
18
+
19
+ public class ReplaceChildView extends HippyViewGroup implements JSEventHandleView, Chunk {
20
+
21
+ public static final String TAG = "DebugReplaceChild";
22
+ private View boundView;
23
+ boolean isContentSurfaceView;
24
+ private int sendEventViewID = -1;
25
+ private String boundSID = null;
26
+ private static final boolean DEBUG = LogUtils.isDebug();
27
+
28
+ private String eventReceiverSID = null;
29
+
30
+ private boolean notifyAttachDirty = true;
31
+
32
+ public void setEventReceiverSID(String eventReceiverSID) {
33
+ this.eventReceiverSID = eventReceiverSID;
34
+ }
35
+
36
+ private boolean replaceOnVisibilityChanged = true;
37
+
38
+ public ReplaceChildView(Context context) {
39
+ super(context);
40
+ // setBackgroundColor(Color.GREEN);
41
+ }
42
+
43
+ public void setContentSurfaceView(boolean contentSurfaceView) {
44
+ isContentSurfaceView = contentSurfaceView;
45
+ }
46
+
47
+ public void replaceChildIfNeed(){
48
+ if(boundSID != null && replaceOnVisibilityChanged){
49
+ exeReplaceChild(boundSID);
50
+ }
51
+ }
52
+
53
+ @Override
54
+ public void notifyBringToFront(boolean b){
55
+ super.notifyBringToFront(b);
56
+
57
+ if(b) {
58
+ if(boundSID != null && ExtendUtil.getViewSID(this) != null){
59
+ //Log.e(TAG,"exeReplaceChild on notifyBringToFront");
60
+ exeReplaceChild(boundSID);
61
+ }
62
+ }else{
63
+ if (boundView != null) {
64
+ removeAllViews();
65
+ boundView = null;
66
+ }
67
+ }
68
+ }
69
+
70
+ @Override
71
+ protected void onWindowVisibilityChanged(int visibility) {
72
+ super.onWindowVisibilityChanged(visibility);
73
+ if(visibility == View.VISIBLE){
74
+ if(DEBUG) {
75
+ Log.i(TAG, "-----onWindowVisibilityChanged true boundView :" + boundView + ",boundSID :" + boundView + ",width:" + getWidth() + ",height:" + getHeight() + ",childCount:" + getChildCount());
76
+ }
77
+ if(boundSID != null && replaceOnVisibilityChanged){
78
+ //Log.e(TAG,"exeReplaceChild onWindowVisibilityChanged boundSID:"+boundSID);
79
+ exeReplaceChild(boundSID);
80
+ }
81
+ }else{
82
+ if(DEBUG) {
83
+ // Log.e(TAG, "-----onWindowVisibilityChanged invisible");
84
+ }
85
+ }
86
+ final HippyMap mp = newEventMap();
87
+ mp.pushString("childSID",boundSID);
88
+ mp.pushBoolean("visible",visibility == VISIBLE);
89
+ sendJSEvent("onWindowVisibilityChanged",mp);
90
+ }
91
+
92
+ @Override
93
+ protected void onSizeChanged(int w, int h, int oldw, int oldh) {
94
+ super.onSizeChanged(w, h, oldw, oldh);
95
+ if(DEBUG) {
96
+ Log.i(TAG, "onSizeChanged w :" + w + ",h :" + h);
97
+ }
98
+ if(boundView != null){
99
+ //boundView.layout(0,0,w,h);
100
+ layoutIndieView(boundView,0,0,getWidth(),getHeight());
101
+ }
102
+ final HippyMap mp = newEventMap();
103
+ mp.pushString("childSID",boundSID);
104
+ mp.pushInt("width",w);
105
+ mp.pushInt("height",h);
106
+ sendJSEvent("onSizeChanged",mp);
107
+ }
108
+
109
+
110
+ @Override
111
+ protected void onLayout(boolean changed, int l, int t, int r, int b) {
112
+ super.onLayout(changed, l, t, r, b);
113
+ if(DEBUG) {
114
+ Log.i(TAG, "onLayout r :" + r + ",b :" + b+",this:"+ExtendUtil.debugView(this));
115
+ // ExtendUtil.logView(TAG,this);
116
+ }
117
+ if(boundView != null){
118
+ boundView.layout(0,0,r - l,b - t);
119
+ }
120
+ }
121
+
122
+ protected void exeReplaceChild(String childSID){
123
+ if(DEBUG) {
124
+ Log.i(TAG, "exeReplaceChild ----> this :" + this);
125
+ Log.i(TAG, "exeReplaceChild ----> sid :" + childSID + ",currentChildrenCount:" + getChildCount() + ",boundView:" + boundView);
126
+ }
127
+ boolean changed = childSID != null && !childSID.equals(this.boundSID);
128
+ this.boundSID = childSID;
129
+ if(TextUtils.isEmpty(childSID)){
130
+ if (getChildCount() > 0 && getChildAt(0) != null) {
131
+ // Log.e(TAG,"------remove indieView on childSID empty view:"+getChildAt(0));
132
+ removeViewAt(0);
133
+ boundView = null;
134
+ }
135
+ }else {
136
+ final View indieView = findChildViewBySID(childSID);
137
+ if(DEBUG) {
138
+ Log.i(TAG, "exeReplaceChild sid:" + childSID + ",find indieView : " + indieView);
139
+ }
140
+ boundView = indieView;
141
+ if (indieView != null) {
142
+ if (getChildCount() > 0 && getChildAt(0) == indieView) {
143
+ // Log.e(TAG,"exeReplaceChild return on child == indieView");
144
+ layoutIndieView(indieView,0,0,getWidth(),getHeight());
145
+ return;
146
+ }
147
+ boolean sameView = getChildCount() > 0 && getChildAt(0) == indieView;
148
+ boolean requestFocus = indieView.hasFocus() && sameView;
149
+ try {
150
+ View focused = null;
151
+ if (requestFocus) {
152
+ focused = indieView.findFocus();
153
+ this.requestFocus();
154
+ }
155
+ FastAdapterUtil.removeFromParentIfNeed(indieView);
156
+ removeAllViews();
157
+ this.addView(indieView, getWidth(), getHeight());
158
+ // layoutIndieView(indieView,0,0,getWidth(),getHeight());
159
+ if (requestFocus) {
160
+ if (focused != null) {
161
+ focused.requestFocus();
162
+ }else {
163
+ indieView.requestFocus();
164
+ }
165
+ }
166
+ }catch (Exception e){
167
+ Log.e(TAG, "exeReplaceChild error "+e.toString());
168
+ e.printStackTrace();
169
+ }
170
+ if(changed){
171
+ final HippyMap mp = newEventMap();
172
+ mp.pushString("childSID",childSID);
173
+ sendJSEvent("onChildChanged",mp);
174
+ }
175
+ if(DEBUG) {
176
+ Log.i(TAG, "exeReplaceChild addView indieView this" + ExtendUtil.debugView(this));
177
+ }
178
+ //indieView.layout(0,0,getWidth(),getHeight());
179
+ layoutIndieView(indieView,0,0,getWidth(),getHeight());
180
+ }else{
181
+ Log.e(TAG, "!!!!exeReplaceChild on indieView null this" + this);
182
+ }
183
+ }
184
+ }
185
+
186
+ void layoutIndieView(View view,int x,int y,int w,int h){
187
+ // view.layout(0,0,getWidth(),getHeight());
188
+ if(LogUtils.isDebug()) {
189
+ Log.e(TAG, "!!!!layoutIndieView on indieView null this" + ExtendUtil.debugViewLite(view) + ",x:" + x + ",y:" + y + ",w:" + w + ",h:" + h);
190
+ }
191
+ RenderUtil.updateDomLayout(x,y,w,h,view);
192
+ }
193
+
194
+ public void setBoundID(String childSID){
195
+ exeReplaceChild(childSID);
196
+ }
197
+
198
+ public void markChildSID(String childSID){
199
+ this.boundSID = childSID;
200
+ }
201
+
202
+
203
+
204
+ public View findChildViewBySID(String id){
205
+ final View root = HippyViewGroup.findPageRootView(this);
206
+ View result = null;
207
+ if (root != null) {
208
+ final RenderNode rootNode = Utils.getRenderNode(root);
209
+ if (rootNode != null) {
210
+ result = ExtendUtil.findViewFromRenderNodeBySid(getHippyContext(),id,rootNode);
211
+ }
212
+ if (result == null) {
213
+ result = ExtendUtil.findViewBySID(id,root);
214
+ }
215
+ }
216
+ return result;
217
+ }
218
+
219
+ @Override
220
+ public void setJSEventViewID(int eventViewID) {
221
+ sendEventViewID = eventViewID;
222
+ }
223
+
224
+ void sendJSEvent(String name,HippyMap param){
225
+ HippyViewEvent event = new HippyViewEvent(name);
226
+ if(sendEventViewID > -1) {
227
+ event.send(sendEventViewID,getHippyContext(),param);
228
+ }else if(getId() != -1){
229
+ event.send(this,param);
230
+ }else{
231
+ Log.e(TAG,"sendJSEvent error name :"+name+",view id invalid,view:"+this);
232
+ }
233
+ if(boundView != null && boundView.getId() != -1){
234
+ event.send(boundView.getId(),getHippyContext(),param);
235
+ }
236
+ }
237
+
238
+ protected HippyMap newEventMap(){
239
+ HippyMap hm = new HippyMap();
240
+ hm.pushString("sid",ExtendUtil.getViewSID(this));
241
+ return hm;
242
+ }
243
+
244
+ @Override
245
+ protected void onAttachedToWindow() {
246
+ super.onAttachedToWindow();
247
+
248
+ // Log.i(TAG,"onAttachedToWindow this:"+ExtendUtil.debugView(this)+",childSID:"+boundSID);
249
+ notifyItemAttached();
250
+ }
251
+
252
+ protected void notifyItemAttached(){
253
+ // if (getParent() instanceof ChunkGroup) {
254
+ // ((ChunkGroup) getParent()).onChildAttachedToWindow(this);
255
+ // }
256
+ String sid = ExtendUtil.getViewSID(this);
257
+
258
+ if (sid != null) {
259
+ final HippyMap mp = newEventMap();
260
+ sendJSEvent("onReplaceChildAttach",mp);
261
+ notifyAttachDirty = false;
262
+ if (eventReceiverSID != null) {
263
+ View target = ExtendUtil.findViewFromRootBySID(eventReceiverSID,this);
264
+ if (target instanceof Tabs) {
265
+ ((Tabs) target).onChunkAttachedToWindow(this);
266
+ }
267
+ if (target != null) {
268
+ HippyMap params = new HippyMap();
269
+ params.pushString("eventName", "onReplaceChildAttach");
270
+ params.pushMap("params", mp);
271
+ new HippyViewEvent("onTabsEvent").send(target.getId(),getHippyContext(),params);
272
+ }else{
273
+ Log.e(TAG,"notifyItemAttached return on target is null");
274
+ }
275
+ }else{
276
+ Log.e(TAG,"notifyItemAttached eventReceiverSID is null");
277
+ }
278
+ }else{
279
+ notifyAttachDirty = true;
280
+ }
281
+
282
+ }
283
+
284
+ @Override
285
+ public void onSetSid(String sid) {
286
+ super.onSetSid(sid);
287
+ notifyItemAttached();
288
+ // Log.i(TAG,"onSetSid sid:"+sid+",this:"+ExtendUtil.debugView(this));
289
+ }
290
+
291
+ @Override
292
+ public void onResetBeforeCache() {
293
+ super.onResetBeforeCache();
294
+
295
+ }
296
+
297
+ @Override
298
+ protected void onDetachedFromWindow() {
299
+ super.onDetachedFromWindow();
300
+ notifyAttachDirty = true;
301
+ }
302
+
303
+
304
+ public void setReplaceOnVisibilityChanged(Boolean b) {
305
+ this.replaceOnVisibilityChanged = b;
306
+ }
307
+
308
+ @Override
309
+ public void onItemBind() {
310
+ super.onItemBind();
311
+ }
312
+ }