@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,52 @@
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 android.util.Log;
19
+ import android.view.View;
20
+
21
+ import com.tencent.mtt.hippy.HippyEngineContext;
22
+ import com.tencent.mtt.hippy.HippyInstanceContext;
23
+ import com.tencent.mtt.hippy.modules.HippyModuleManager;
24
+ import com.tencent.mtt.hippy.modules.javascriptmodules.EventDispatcher;
25
+
26
+ public class HippyViewEvent {
27
+
28
+ private final String mEventName;
29
+
30
+ public HippyViewEvent(String eventName) {
31
+ this.mEventName = eventName;
32
+ }
33
+
34
+ public void send(View view, Object param) {
35
+ if (view != null && view.getContext() instanceof HippyInstanceContext) {
36
+ HippyEngineContext context = ((HippyInstanceContext) view.getContext()).getEngineContext();
37
+ send(view.getId(), context, param);
38
+ }
39
+ }
40
+
41
+ public void send(int id, HippyEngineContext context, Object param) {
42
+ if (context == null) {
43
+ return;
44
+ }
45
+
46
+ HippyModuleManager hmm = context.getModuleManager();
47
+ if (hmm != null) {
48
+ hmm.getJavaScriptModule(EventDispatcher.class).receiveUIComponentEvent(id, mEventName, param);
49
+ // Log.w("hippy","receiveUIComponentEvent id:"+id+",mEventName:"+mEventName+",param:"+param);
50
+ }
51
+ }
52
+ }
@@ -0,0 +1,24 @@
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
+ @SuppressWarnings({"unused"})
19
+ public interface IHippyZIndexViewGroup {
20
+
21
+ int getZIndexMappedChildIndex(int index);
22
+
23
+ void updateDrawingOrder();
24
+ }
@@ -0,0 +1,395 @@
1
+ package com.tencent.mtt.hippy.uimanager;
2
+
3
+ import android.app.Activity;
4
+ import android.content.Context;
5
+ import android.util.Log;
6
+ import android.view.View;
7
+ import android.view.ViewGroup;
8
+
9
+ import android.support.annotation.NonNull;
10
+
11
+ import com.tencent.mtt.hippy.FocusDispatchView;
12
+ import com.tencent.mtt.hippy.HippyInstanceContext;
13
+ import com.tencent.mtt.hippy.common.HippyArray;
14
+ import com.tencent.mtt.hippy.common.HippyMap;
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
+ import com.tencent.mtt.supportui.views.recyclerview.RecyclerViewBase;
19
+ import com.tencent.mtt.supportui.views.viewpager.ViewPager;
20
+
21
+ import java.util.Arrays;
22
+ import java.util.concurrent.Executors;
23
+
24
+ /**
25
+ * create by zhaopeng 2020
26
+ */
27
+ public class InternalExtendViewUtil {
28
+
29
+
30
+ public static final String CHILD_FOCUS_EVENT_NAME = "onChildFocus";
31
+ public static final String CHILD_SELECT_EVENT_NAME = "onChildSelect";
32
+ public static final String LIST_FOCUS_SEARCH_FAIL_EVENT_NAME = "onFocusSearchFailed";
33
+
34
+ public static void sendEventOnRequestChildFocus(ViewGroup parent,View child, View focused,@NonNull HippyViewEvent event){
35
+
36
+ HippyMap map = new HippyMap();
37
+
38
+
39
+
40
+ HippyMap cm = new HippyMap();
41
+ cm.pushInt("index",parent.indexOfChild(child));
42
+ cm.pushInt("id",child.getId());
43
+ cm.pushString("sid", ExtendUtil.getViewSID(child));
44
+ final String cname = ControllerManager.findName(child);
45
+ if(cname != null){
46
+ cm.pushString("name",cname);
47
+ }
48
+ if(parent instanceof RecyclerViewBase){
49
+ final int position = ((RecyclerViewBase) parent).getChildPosition(child);
50
+ cm.pushInt("position",position);
51
+ }
52
+
53
+ map.pushMap("child",cm);
54
+ if(focused != null) {
55
+ HippyMap fm = new HippyMap();
56
+ fm.pushInt("id", focused.getId());
57
+ fm.pushString("sid", ExtendUtil.getViewSID(focused));
58
+ final String fName = ControllerManager.findName(focused);
59
+ if (fName != null) {
60
+ fm.pushString("name", fName);
61
+ }
62
+ map.pushMap("focused",fm);
63
+ }
64
+
65
+ event.send(parent,map);
66
+
67
+
68
+ }
69
+
70
+ public static void postTaskByRootView(View v,Runnable task ,int delay){
71
+ final View root = getRootViewFromContext(v);
72
+ if(root != null){
73
+ root.postDelayed(task,delay);
74
+ }
75
+ }
76
+
77
+ public static void sendEventOnRequestListChildSelect(ViewGroup parent,View child){
78
+
79
+ HippyMap map = new HippyMap();
80
+
81
+ HippyMap cm = new HippyMap();
82
+ cm.pushInt("index",parent.indexOfChild(child));
83
+ cm.pushInt("id",child.getId());
84
+ cm.pushString("sid", ExtendUtil.getViewSID(child));
85
+ final String cname = ControllerManager.findName(child);
86
+ if(cname != null){
87
+ cm.pushString("name",cname);
88
+ }
89
+ if(parent instanceof RecyclerViewBase){
90
+ final int position = ((RecyclerViewBase) parent).getChildPosition(child);
91
+ cm.pushInt("position",position);
92
+ }
93
+
94
+ map.pushMap("child",cm);
95
+
96
+ new HippyViewEvent(CHILD_SELECT_EVENT_NAME).send(parent,map);
97
+
98
+ }
99
+
100
+ public static void sendEventOnListFocusSearchFailed(ViewGroup parent,View child,View focused,int direction,HippyViewEvent event){
101
+
102
+ HippyMap map = new HippyMap();
103
+ if(child != null) {
104
+ HippyMap cm = new HippyMap();
105
+ cm.pushInt("index", parent.indexOfChild(child));
106
+ cm.pushInt("id", child.getId());
107
+ cm.pushString("sid", ExtendUtil.getViewSID(child));
108
+ final String cname = ControllerManager.findName(child);
109
+ if (cname != null) {
110
+ cm.pushString("name", cname);
111
+ }
112
+ if (parent instanceof RecyclerViewBase) {
113
+ final int position = ((RecyclerViewBase) parent).getChildPosition(child);
114
+ cm.pushInt("position", position);
115
+ }
116
+
117
+ map.pushMap("child", cm);
118
+ }
119
+ if(focused != null) {
120
+ HippyMap fm = new HippyMap();
121
+ fm.pushInt("id", focused.getId());
122
+ fm.pushString("sid", ExtendUtil.getViewSID(focused));
123
+ final String fName = ControllerManager.findName(focused);
124
+ if (fName != null) {
125
+ fm.pushString("name", fName);
126
+ }
127
+ map.pushMap("focused",fm);
128
+ }
129
+
130
+ map.pushInt("direction",direction);
131
+
132
+ event.send(parent,map);
133
+
134
+ }
135
+
136
+ public static void sendEventOnFocusViewPagerSearchFail(ViewPager parent, View child,View focused,int direction){
137
+
138
+ HippyMap map = new HippyMap();
139
+
140
+ if(child != null) {
141
+ HippyMap cm = new HippyMap();
142
+ cm.pushInt("index", parent.indexOfChild(child));
143
+ cm.pushInt("id", child.getId());
144
+ cm.pushString("sid", ExtendUtil.getViewSID(child));
145
+ final String cname = ControllerManager.findName(child);
146
+ if (cname != null) {
147
+ cm.pushString("name", cname);
148
+ }
149
+ map.pushMap("child", cm);
150
+ }
151
+
152
+ if(focused != null) {
153
+ HippyMap fm = new HippyMap();
154
+ fm.pushInt("id", focused.getId());
155
+ fm.pushString("sid", ExtendUtil.getViewSID(focused));
156
+ final String fName = ControllerManager.findName(focused);
157
+ if (fName != null) {
158
+ fm.pushString("name", fName);
159
+ }
160
+ map.pushMap("focused",fm);
161
+ }
162
+
163
+ if(parent instanceof ViewPager){
164
+ final int page = ((ViewPager) parent).getCurrentPage();
165
+ map.pushInt("page",page);
166
+ }
167
+ map.pushInt("direction",direction);
168
+ new HippyViewEvent(LIST_FOCUS_SEARCH_FAIL_EVENT_NAME).send(parent,map);
169
+ }
170
+
171
+ public static final int FOCUS_BLOCK_DIRECTION_ALL = 1;
172
+
173
+ public static boolean isContainBlockDirection(final int direction,final int[] directions){
174
+ if(directions != null){
175
+ if(Arrays.binarySearch(directions,FOCUS_BLOCK_DIRECTION_ALL) > -1){
176
+ return true;
177
+ }
178
+ if(Arrays.binarySearch(directions,direction) > -1){
179
+ return true;
180
+ }
181
+ }
182
+ return false;
183
+ }
184
+
185
+ public static boolean testFocusable(View view) {
186
+ if (view == null) {
187
+ return false;
188
+ }
189
+ if (view.isFocusable()) {
190
+ return true;
191
+ }
192
+ if (view instanceof ViewGroup) {
193
+ for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
194
+ if (testFocusable(((ViewGroup) view).getChildAt(i))) {
195
+ return true;
196
+ }
197
+ }
198
+ }
199
+ return false;
200
+ }
201
+
202
+ public static void blockFocus(ViewGroup group) {
203
+ if(group != null) {
204
+ group.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
205
+ }
206
+ }
207
+
208
+ public static void unBlockFocus(ViewGroup group) {
209
+ if(group != null) {
210
+ group.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
211
+ }
212
+ }
213
+ public static void clearFocus(View v){
214
+ if(v instanceof ViewGroup){
215
+ if(v.findFocus() != null) {
216
+ v.findFocus().clearFocus();
217
+ }
218
+ }else if(v != null){
219
+ v.clearFocus();
220
+ }
221
+ }
222
+ public static void blockRootFocus(View v) {
223
+ // final View rootFromWindow = getRootViewFromContext(v);
224
+ // if(rootFromWindow instanceof ViewGroup){
225
+ // blockFocus((ViewGroup) rootFromWindow);
226
+ // LogUtils.e(FocusDispatchView.TAG,"+++blockRootFocus on Window :"+rootFromWindow);
227
+ // LogUtils.e("RootFocusManager","+++blockRootFocus on Window :"+rootFromWindow);
228
+ // return;
229
+ // }
230
+ final View root = getRootView(v);
231
+ if (root instanceof ViewGroup ) {
232
+ if(LogUtils.isDebug()) {
233
+ LogUtils.i(FocusDispatchView.TAG, "+++blockRootFocus on Root :" + root);
234
+ }
235
+ blockFocus((ViewGroup) root);
236
+ }
237
+ }
238
+
239
+ public static void logMap(HippyMap map,String tag){
240
+ if(map == null || map.size() < 1){
241
+ Log.e(tag,"map is null or empty");
242
+ return;
243
+ }
244
+ for(String key : map.keySet()){
245
+ Log.d(tag,"key:"+key+",value:"+map.get(key));
246
+ }
247
+ }
248
+
249
+ public static void unBlockRootFocus(View v) {
250
+ // final View rootFromWindow = getRootViewFromContext(v);
251
+ // if(rootFromWindow instanceof ViewGroup){
252
+ // unBlockFocus((ViewGroup) rootFromWindow);
253
+ // if(LogUtils.isDebug()) {
254
+ // LogUtils.e(FocusDispatchView.TAG, "---unBlockRootFocus on Window :" + rootFromWindow);
255
+ // LogUtils.e("RootFocusManager", "---unBlockRootFocus on Window :" + rootFromWindow);
256
+ // }
257
+ // return;
258
+ // }
259
+ final View root = getRootView(v);
260
+ if (root instanceof ViewGroup ) {
261
+ unBlockFocus((ViewGroup) root);
262
+ if(LogUtils.isDebug()) {
263
+ LogUtils.e(FocusDispatchView.TAG, "---unBlockRootFocus on Root :" + root);
264
+ LogUtils.e("RootFocusManager", "---unBlockRootFocus on Root :" + root);
265
+ }
266
+ }
267
+ }
268
+
269
+ @Deprecated
270
+ public static View findRootView(View view){
271
+ View rootView;
272
+ rootView = FocusDispatchView.findRootFromContext(view);
273
+ if(rootView == null) {
274
+ // View parentView = templateItemView.getParentListView();
275
+ // if (parentView == null) {
276
+ // parentView = templateItemView.getParentFlexView();
277
+ // }
278
+ rootView = HippyViewGroup.findPageRootView(view);
279
+ if (rootView == null) {
280
+ rootView = FocusDispatchView.findRootView(view);
281
+ }
282
+ }
283
+ return rootView;
284
+ }
285
+
286
+ public static View findRootViewConsiderOrder(View view){
287
+ View rootView = null;
288
+ //1.先从以rootTag标记的view优先
289
+ rootView = HippyViewGroup.findPageRootView(view);
290
+ if (rootView == null) {
291
+ //2. 找hippyRootView
292
+ rootView = FocusDispatchView.findRootView(view);
293
+ }
294
+ return rootView;
295
+ }
296
+
297
+ public static View getRootViewFromContext(View view) {
298
+ final Context context = view.getContext();
299
+ if(context instanceof Activity){
300
+ return getRootViewFromContext(context);
301
+ }
302
+ if(context instanceof HippyInstanceContext){
303
+ return getRootViewFromContext(((HippyInstanceContext) context).getBaseContext());
304
+ }
305
+ return null;
306
+ }
307
+
308
+ public static View getRootViewFromContext(Context context){
309
+ if(context instanceof Activity){
310
+ final Activity activity = (Activity) context;
311
+ return activity.getWindow().getDecorView();
312
+ }
313
+ return null;
314
+ }
315
+
316
+ /**
317
+ * <p>Finds the topmost view in the current view hierarchy.</p>
318
+ *
319
+ * @return the topmost view containing this view
320
+ */
321
+ public static View getRootView(View view) {
322
+
323
+ View parent = view;
324
+
325
+ while (parent.getParent() != null && parent.getParent() instanceof View) {
326
+ parent = (View) parent.getParent();
327
+ }
328
+
329
+ return parent;
330
+ }
331
+
332
+ public static View interceptViewGroupIfNeed(View parent,int id,View focused,View searchResult){
333
+ if(id > -1){
334
+ LogUtils.e(FocusDispatchView.TAG,"div: intercept group focus by blockFocusDirections next id:"+id+",parent:"+ExtendUtil.debugFocusInfo(parent));
335
+ return focused;
336
+ }
337
+ return searchResult;
338
+ }
339
+
340
+ public static int findInterceptViewID(HippyViewGroup group,int direction){
341
+ int id = -1;
342
+ switch (direction){
343
+ case View.FOCUS_UP:
344
+ id = group.getNextFocusUpId();
345
+ break;
346
+ case View.FOCUS_DOWN:
347
+ id = group.getNextFocusDownId();
348
+ break;
349
+ case View.FOCUS_LEFT:
350
+ id = group.getNextFocusLeftId();
351
+ break;
352
+ case View.FOCUS_RIGHT:
353
+ id = group.getNextFocusRightId();
354
+ break;
355
+ }
356
+ return id;
357
+ }
358
+
359
+
360
+ public static void notifyViewInReFocus(View view,boolean isIn) {
361
+
362
+ }
363
+
364
+ public static boolean containValue(HippyArray array,Object obj){
365
+ if(array == null || obj == null){
366
+ return false;
367
+ }
368
+ for(int i = 0;i < array.size(); i ++){
369
+ Object a = array.get(i);
370
+ if(obj.equals(a)){
371
+ return true;
372
+ }
373
+ }
374
+ return false;
375
+ }
376
+
377
+ public static boolean containValue(HippyArray source,HippyArray target){
378
+ if(source == null || target == null){
379
+ return false;
380
+ }
381
+ for(int i = 0;i < source.size(); i ++){
382
+ final Object a = source.get(i);
383
+ for(int j = 0; j < target.size(); j++){
384
+ final Object b = target.get(j);
385
+ if(a.equals(b)){
386
+ return true;
387
+ }
388
+ }
389
+ }
390
+ return false;
391
+ }
392
+
393
+
394
+
395
+ }
@@ -0,0 +1,143 @@
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 android.view.View;
19
+ import com.tencent.mtt.hippy.HippyRootView;
20
+ import com.tencent.mtt.hippy.common.HippyMap;
21
+ import com.tencent.mtt.hippy.views.list.IRecycleItemTypeChange;
22
+
23
+ @SuppressWarnings({"deprecation", "unused"})
24
+ public class ListItemRenderNode extends RenderNode {
25
+
26
+ public static final String ITEM_VIEW_TYPE = "type";
27
+ public static final String ITEM_STICKY = "sticky";
28
+ public static final String ITEM_VIEW_TYPE_NEW = "itemViewType";
29
+
30
+ private boolean mShouldSticky;
31
+ private IRecycleItemTypeChange mRecycleItemTypeChangeListener;
32
+
33
+ public ListItemRenderNode(int mId, HippyMap mPropsToUpdate, String className,
34
+ HippyRootView mRootView, ControllerManager componentManager,
35
+ boolean isLazyLoad) {
36
+ super(mId, mPropsToUpdate, className, mRootView, componentManager, isLazyLoad);
37
+ if (mProps.get(ITEM_STICKY) != null) {
38
+ mShouldSticky = mProps.getBoolean(ITEM_STICKY);
39
+ }
40
+ }
41
+
42
+ /**
43
+ * y值是前端传入的,前端没有复用的概念,所有y是整个list长度的y值,并不是recyclerView的排版的y。 真正意义上面的y是排版到屏幕范围以内的y,也是子view相对于recyclerView的起始位置的y,也就是子view的top
44
+ * 系统的recyclerView在刷新list前,layoutManager会调用anchorInfo.assignFromView,取第一个view计算当前的
45
+ * anchorInfo,如果整个地方把y值修改了,导致anchorInfo会取不对. 这里保证updateLayout不要改变已经挂在到RecyclerView的view的top
46
+ */
47
+ @Override
48
+ public void updateLayout(int x, int y, int w, int h) {
49
+ super.updateLayout(x, y, w, h);
50
+ View renderView = mComponentManager.mControllerRegistry.getView(mId);
51
+ mY = renderView != null ? renderView.getTop() : 0;
52
+ if (getParent() != null && mComponentManager != null && mComponentManager.mContext
53
+ != null) { // 若屏幕内node更新引起了item整体变化,需要通知ListView发起dispatchLayout重排版
54
+ RenderManager renderManager = mComponentManager.mContext.getRenderManager();
55
+ if (renderManager != null) {
56
+ renderManager.addUpdateNodeIfNeeded(getParent());
57
+ }
58
+ }
59
+ }
60
+
61
+ @Override
62
+ public void updateNode(HippyMap map) {
63
+ int oldType = getTypeFromMap(mProps);
64
+ int newType = getTypeFromMap(map);
65
+ if (mRecycleItemTypeChangeListener != null && oldType != newType) {
66
+ mRecycleItemTypeChangeListener.onRecycleItemTypeChanged(oldType, newType, this);
67
+ }
68
+ super.updateNode(map);
69
+ if (mProps.get(ITEM_STICKY) != null) {
70
+ mShouldSticky = mProps.getBoolean(ITEM_STICKY);
71
+ }
72
+ }
73
+
74
+ /**
75
+ * 获取item的Type,用于recyclerView的缓存复用
76
+ *
77
+ * @return
78
+ */
79
+ public int getItemViewType() {
80
+ return getTypeFromMap(mProps);
81
+ }
82
+
83
+ /**
84
+ * 兼容各种版本的itemType
85
+ */
86
+ private int getTypeFromMap(HippyMap hippyMap) {
87
+ int viewType = hippyMap.getInt(ITEM_VIEW_TYPE);
88
+ if (viewType <= 0 && hippyMap.getString(ITEM_VIEW_TYPE) != null) {
89
+ try {
90
+ viewType = Integer.parseInt(hippyMap.getString(ITEM_VIEW_TYPE));
91
+ } catch (NumberFormatException e) {
92
+ //do nothing
93
+ }
94
+ }
95
+ if (viewType <= 0) {
96
+ viewType = hippyMap.getInt(ListItemRenderNode.ITEM_VIEW_TYPE_NEW);
97
+ }
98
+ return viewType;
99
+ }
100
+
101
+ @Override
102
+ public int indexFromParent() {
103
+ return super.indexFromParent();
104
+ }
105
+
106
+ public void setRecycleItemTypeChangeListener(
107
+ IRecycleItemTypeChange recycleItemTypeChangeListener) {
108
+ mRecycleItemTypeChangeListener = recycleItemTypeChangeListener;
109
+ }
110
+
111
+ public boolean isPullFooter() {
112
+ return false;
113
+ }
114
+
115
+ public boolean isPullHeader() {
116
+ return false;
117
+ }
118
+
119
+ public boolean shouldSticky() {
120
+ return mShouldSticky;
121
+ }
122
+
123
+ /**
124
+ * 异常情况下,如果view已经存在,需要删除它,前提是view没有parent的情况, 有parent的情况出现在sticky属性的view,当前可能是正在置顶的view,这种是不能调用删除的,是正常情况,
125
+ * hasView为true,通过createView是拿到已经存在的view。
126
+ *
127
+ * @return 是否需要删除view
128
+ */
129
+ public boolean needDeleteExistRenderView() {
130
+ if (mComponentManager.hasView(mId)) {
131
+ return mComponentManager.createView(mRootView, mId, mClassName, mProps).getParent() == null;
132
+ }
133
+ return false;
134
+ }
135
+
136
+ public boolean isViewExist() {
137
+ return mComponentManager.hasView(mId);
138
+ }
139
+
140
+ public boolean hasRootView() {
141
+ return mRootView != null;
142
+ }
143
+ }
@@ -0,0 +1,44 @@
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.HippyRootView;
19
+ import com.tencent.mtt.hippy.common.HippyMap;
20
+
21
+ @SuppressWarnings({"deprecation", "unused"})
22
+ public class ListViewRenderNode extends RenderNode {
23
+
24
+ public ListViewRenderNode(int mId, HippyMap mPropsToUpdate, String className,
25
+ HippyRootView mRootView, ControllerManager componentManager,
26
+ boolean isLazyLoad) {
27
+ super(mId, mPropsToUpdate, className, mRootView, componentManager, isLazyLoad);
28
+ }
29
+
30
+
31
+ @Override
32
+ protected void addChildToPendingList(RenderNode renderNode) {
33
+ // super.addPendChild(renderNode);
34
+ }
35
+
36
+ @Override
37
+ public boolean removeChild(RenderNode uiNode) {
38
+ if (uiNode instanceof ListItemRenderNode) {
39
+ ListItemRenderNode listItemRenderNode = (ListItemRenderNode) uiNode;
40
+ listItemRenderNode.setRecycleItemTypeChangeListener(null);
41
+ }
42
+ return super.removeChild(uiNode);
43
+ }
44
+ }