@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,509 @@
1
+ package com.tencent.extend.views.fastlist;
2
+
3
+ import android.content.BroadcastReceiver;
4
+ import android.content.Context;
5
+ import android.content.Intent;
6
+ import android.content.IntentFilter;
7
+ import android.os.Handler;
8
+ import android.os.Looper;
9
+ import android.os.Message;
10
+ import android.support.v7.widget.LinearLayoutManager;
11
+ import android.support.v7.widget.RecyclerView;
12
+ import android.util.AttributeSet;
13
+ import android.util.Log;
14
+ import android.view.KeyEvent;
15
+ import android.view.MotionEvent;
16
+ import android.view.View;
17
+ import android.view.ViewGroup;
18
+
19
+ import com.tencent.mtt.hippy.utils.ExtendUtil;
20
+ import com.tencent.mtt.hippy.utils.mouse.HoverManager;
21
+
22
+
23
+ /**
24
+ * 实现了空鼠边缘响应滚动的 RecyclerView
25
+ *
26
+ * @author zy
27
+ */
28
+ public class MouseRecycleView extends RecyclerView {
29
+ private static final String TAG = "MouseRecycleView";
30
+
31
+ public static final String MOUSE_ACTION = "changhong.remotecontrol.mouse.status";
32
+ public static final String MOUSE_SHOW = "show";
33
+
34
+ public static final int MSG_STOP_SCROLL = 0x00;
35
+ public static final int MSG_SCROLL_TO_TOP = 0x01;
36
+ public static final int MSG_SCROLL_TO_BOTTOM = 0x02;
37
+ public static final int MSG_SCROLL_TO_LEFT = 0x03;
38
+ public static final int MSG_SCROLL_TO_RIGHT = 0x04;
39
+ public static final long MSG_STAY_TIME = 1500;
40
+ public static final long MSG_SCROLL_DELAY = 500;
41
+
42
+ public static final int SCROLL_DEFAULT_DISTANCE = 50;
43
+ public static final int DEFAULT_DISTANCE = 150;
44
+ public static final float FLOAT_ZERO = 0.0f;
45
+ public static final int INT_ZERO = 0;
46
+
47
+ public boolean isScrolling = false;
48
+ public int mDistanceTop = DEFAULT_DISTANCE;
49
+ public int mDistanceBottom = DEFAULT_DISTANCE;
50
+ public int mDistanceLeft = DEFAULT_DISTANCE;
51
+ public int mDistanceRight = DEFAULT_DISTANCE;
52
+ public long mStayTime = MSG_STAY_TIME;
53
+ public long mScrollDelay = MSG_SCROLL_DELAY;
54
+ public int mScrollDistance = SCROLL_DEFAULT_DISTANCE;
55
+
56
+ long requestFocusDelay = 10;
57
+ private Runnable requestFocusRunnable = null;
58
+
59
+ private float startX, startY;
60
+
61
+ public final Handler mMainHandler = new Handler(Looper.getMainLooper()) {
62
+ @Override
63
+ public void handleMessage(Message msg) {
64
+
65
+ switch (msg.what) {
66
+ case MSG_SCROLL_TO_TOP:
67
+ changeFocus(FOCUS_UP);
68
+ removeMessages(MSG_SCROLL_TO_TOP);
69
+ sendEmptyMessageDelayed(MSG_SCROLL_TO_TOP, mScrollDelay);
70
+ break;
71
+
72
+ case MSG_SCROLL_TO_BOTTOM:
73
+ changeFocus(FOCUS_DOWN);
74
+ removeMessages(MSG_SCROLL_TO_BOTTOM);
75
+ sendEmptyMessageDelayed(MSG_SCROLL_TO_BOTTOM, mScrollDelay);
76
+ break;
77
+
78
+ case MSG_SCROLL_TO_LEFT:
79
+ changeFocus(FOCUS_LEFT);
80
+ removeMessages(MSG_SCROLL_TO_LEFT);
81
+ sendEmptyMessageDelayed(MSG_SCROLL_TO_LEFT, mScrollDelay);
82
+ break;
83
+
84
+ case MSG_SCROLL_TO_RIGHT:
85
+ changeFocus(FOCUS_RIGHT);
86
+ removeMessages(MSG_SCROLL_TO_RIGHT);
87
+ sendEmptyMessageDelayed(MSG_SCROLL_TO_RIGHT, mScrollDelay);
88
+ break;
89
+
90
+ case MSG_STOP_SCROLL:
91
+ removeMessages(MSG_STOP_SCROLL);
92
+ removeMessages(MSG_SCROLL_TO_TOP);
93
+ removeMessages(MSG_SCROLL_TO_BOTTOM);
94
+ removeMessages(MSG_SCROLL_TO_LEFT);
95
+ removeMessages(MSG_SCROLL_TO_RIGHT);
96
+ isScrolling = false;
97
+ break;
98
+
99
+ default:
100
+ break;
101
+ }
102
+ super.handleMessage(msg);
103
+ }
104
+ };
105
+
106
+ public BroadcastReceiver mMouseReceiver = new BroadcastReceiver() {
107
+ @Override
108
+ public void onReceive(Context context, Intent intent) {
109
+ //空鼠退出时停止滚动
110
+ if (intent != null && MOUSE_ACTION.equals(intent.getAction()) && !intent.getBooleanExtra(MOUSE_SHOW, true)) {
111
+ mMainHandler.removeMessages(MSG_STOP_SCROLL);
112
+ mMainHandler.sendEmptyMessage(MSG_STOP_SCROLL);
113
+ HoverManager.getInstance().setMouseEnter(false);
114
+ }
115
+ }
116
+ };
117
+
118
+ public IntentFilter mMouseIntentFilter = new IntentFilter(MOUSE_ACTION);
119
+
120
+ public MouseRecycleView(Context context) {
121
+ super(context);
122
+ //setOnGenericMotionListener(this);
123
+ }
124
+
125
+ public MouseRecycleView(Context context, AttributeSet attrs) {
126
+ super(context, attrs);
127
+ //setOnGenericMotionListener(this);
128
+ }
129
+
130
+ public MouseRecycleView(Context context, AttributeSet attrs, int defStyle) {
131
+ super(context, attrs, defStyle);
132
+ //setOnGenericMotionListener(this);
133
+ }
134
+
135
+ @Override
136
+ public boolean onInterceptTouchEvent(MotionEvent e) {
137
+ switch (e.getAction()) {
138
+ case MotionEvent.ACTION_DOWN:
139
+ startX = e.getX();
140
+ startY = e.getY();
141
+ break;
142
+ case MotionEvent.ACTION_MOVE:
143
+ float dx = e.getX() - startX;
144
+ float dy = e.getY() - startY;
145
+ // 判断是否是左右滑动
146
+ if (Math.abs(dx) > Math.abs(dy)) {
147
+ // 处理边界情况
148
+ if ((dx > 0 && !canScrollHorizontally(-1)) || (dx < 0 && !canScrollHorizontally(1))) {
149
+ // 滚动到最左/右边时,交给父 View 处理
150
+ getParent().requestDisallowInterceptTouchEvent(false);
151
+ } else {
152
+ // 让 RecyclerView 处理滑动 不能放到ACTION_DOWN中会影响纵向view滚动
153
+ getParent().requestDisallowInterceptTouchEvent(true);
154
+ }
155
+ } else {
156
+ //垂直滑动,交给父 View
157
+ getParent().requestDisallowInterceptTouchEvent(false);
158
+ }
159
+ break;
160
+ case MotionEvent.ACTION_UP:
161
+ case MotionEvent.ACTION_CANCEL:
162
+ getParent().requestDisallowInterceptTouchEvent(false);
163
+ break;
164
+ }
165
+ return super.onInterceptTouchEvent(e);
166
+ }
167
+
168
+ @Override
169
+ protected void onAttachedToWindow() {
170
+ super.onAttachedToWindow();
171
+ try {
172
+ getContext().registerReceiver(mMouseReceiver, mMouseIntentFilter);
173
+ } catch (Throwable t) {
174
+ t.printStackTrace();
175
+ }
176
+ }
177
+
178
+ @Override
179
+ protected void onDetachedFromWindow() {
180
+ super.onDetachedFromWindow();
181
+ try {
182
+ getContext().unregisterReceiver(mMouseReceiver);
183
+ } catch (Throwable t) {
184
+ t.printStackTrace();
185
+ }
186
+ }
187
+
188
+ @Override
189
+ public boolean dispatchKeyEvent(KeyEvent event) {
190
+ if (event != null && event.getAction() == KeyEvent.ACTION_DOWN) {
191
+ //按键时停止空鼠滚动
192
+ mMainHandler.removeMessages(MSG_STOP_SCROLL);
193
+ mMainHandler.sendEmptyMessage(MSG_STOP_SCROLL);
194
+ HoverManager.getInstance().setMouseEnter(false);
195
+ }
196
+ return super.dispatchKeyEvent(event);
197
+ }
198
+
199
+ /**
200
+ * 在此处出来空鼠相关事件,用于计算向哪个方向滚动
201
+ *
202
+ * @param event
203
+ * @return
204
+ */
205
+ @Override
206
+ public boolean dispatchGenericMotionEvent(MotionEvent event) {
207
+ HoverManager.getInstance().dispatchGenericMotionEvent(event);
208
+
209
+ float x = event.getX();
210
+ float y = event.getY();
211
+
212
+ switch (event.getAction()) {
213
+ // case MotionEvent.ACTION_HOVER_ENTER:
214
+ case MotionEvent.ACTION_HOVER_MOVE:
215
+ //竖向滚动
216
+ if (isScrollVertically()) {
217
+
218
+ if (y >= FLOAT_ZERO && y <= mDistanceTop) {
219
+ //上方响应区
220
+ if (!isScrolling) {
221
+ isScrolling = true;
222
+ mMainHandler.removeMessages(MSG_SCROLL_TO_TOP);
223
+ mMainHandler.sendEmptyMessageDelayed(MSG_SCROLL_TO_TOP, mStayTime);
224
+ }
225
+ } else if (y <= getHeight() && y >= (getHeight() - mDistanceBottom)) {
226
+ //下方响应区
227
+ if (!isScrolling) {
228
+ isScrolling = true;
229
+ mMainHandler.removeMessages(MSG_SCROLL_TO_BOTTOM);
230
+ mMainHandler.sendEmptyMessageDelayed(MSG_SCROLL_TO_BOTTOM, mStayTime);
231
+ }
232
+
233
+ } else {
234
+ //未在响应区
235
+ isScrolling = false;
236
+ mMainHandler.removeMessages(MSG_STOP_SCROLL);
237
+ mMainHandler.sendEmptyMessage(MSG_STOP_SCROLL);
238
+ }
239
+ } else {
240
+ if (x >= FLOAT_ZERO && x <= mDistanceLeft) {
241
+ //左侧响应区
242
+ if (!isScrolling) {
243
+ isScrolling = true;
244
+ mMainHandler.removeMessages(MSG_SCROLL_TO_LEFT);
245
+ mMainHandler.sendEmptyMessageDelayed(MSG_SCROLL_TO_LEFT, mStayTime);
246
+ }
247
+
248
+ } else if (x <= getWidth() && x >= (getWidth() - mDistanceRight)) {
249
+ //右侧响应区
250
+ if (!isScrolling) {
251
+ isScrolling = true;
252
+ mMainHandler.removeMessages(MSG_SCROLL_TO_RIGHT);
253
+ mMainHandler.sendEmptyMessageDelayed(MSG_SCROLL_TO_RIGHT, mStayTime);
254
+ }
255
+
256
+ } else {
257
+ //未在响应区
258
+ isScrolling = false;
259
+ mMainHandler.removeMessages(MSG_STOP_SCROLL);
260
+ mMainHandler.sendEmptyMessage(MSG_STOP_SCROLL);
261
+ }
262
+ }
263
+ break;
264
+ case MotionEvent.ACTION_HOVER_EXIT:
265
+ case MotionEvent.ACTION_BUTTON_PRESS: {
266
+ // ACTION_HOVER_EXIT -> ACTION_BUTTON_PRESS -> ACTION_BUTTON_RELEASE -> ACTION_HOVER_ENTER
267
+ mMainHandler.removeMessages(MSG_STOP_SCROLL);
268
+ mMainHandler.sendEmptyMessage(MSG_STOP_SCROLL);
269
+ }
270
+ break;
271
+
272
+ default:
273
+ break;
274
+ }
275
+
276
+ return super.dispatchGenericMotionEvent(event);
277
+ }
278
+
279
+
280
+ /**
281
+ * 设置各个方向响应空鼠滚动的距离区域
282
+ *
283
+ * @param distanceTop 上方
284
+ * @param distanceBottom 下方
285
+ * @param distanceLeft 左侧
286
+ * @param distanceRight 右侧
287
+ */
288
+ public void setDistance(int distanceTop, int distanceBottom, int distanceLeft, int distanceRight) {
289
+ this.mDistanceTop = distanceTop;
290
+ this.mDistanceBottom = distanceBottom;
291
+ this.mDistanceLeft = distanceLeft;
292
+ this.mDistanceRight = distanceRight;
293
+ }
294
+
295
+ /**
296
+ * 设置停留响应时间
297
+ *
298
+ * @param time 毫秒
299
+ */
300
+ public void setStayTime(long time) {
301
+ this.mStayTime = time;
302
+ }
303
+
304
+ /**
305
+ * 设置滚动时间隔时间
306
+ *
307
+ * @param time 毫秒
308
+ */
309
+ public void setScrollDelay(long time) {
310
+ this.mScrollDelay = time;
311
+ }
312
+
313
+ /**
314
+ * 设置找焦点时偏移的距离,避免 view 不在界面内而无法找到
315
+ *
316
+ * @param distance 像素
317
+ */
318
+ public void setScrollDistance(int distance) {
319
+ this.mScrollDistance = distance;
320
+ }
321
+
322
+ /**
323
+ * 进行空鼠边缘滚动时,向对应方向进行寻找焦点需要排除上焦的视图
324
+ * 例:按理来说只
325
+ *
326
+ * @param view view
327
+ * @return
328
+ */
329
+ public boolean isExcludeView(View view) {
330
+ return false;
331
+ }
332
+
333
+ /**
334
+ * 向对应方向寻找下一个焦点
335
+ *
336
+ * @param focusDirection 寻找焦点方向
337
+ * @return
338
+ */
339
+ public boolean changeFocus(int focusDirection) {
340
+ View focusView = findFocus();
341
+ if (focusView != null) {
342
+ View nextView = null;
343
+ if (focusDirection == View.FOCUS_UP) {
344
+ scrollBy(INT_ZERO, -mScrollDistance);
345
+ nextView = focusView.focusSearch(View.FOCUS_UP);
346
+ } else if (focusDirection == View.FOCUS_DOWN) {
347
+ scrollBy(INT_ZERO, mScrollDistance);
348
+ nextView = focusView.focusSearch(View.FOCUS_DOWN);
349
+ } else if (focusDirection == View.FOCUS_LEFT) {
350
+ scrollBy(-mScrollDistance, INT_ZERO);
351
+ nextView = focusView.focusSearch(View.FOCUS_LEFT);
352
+ } else if (focusDirection == View.FOCUS_RIGHT) {
353
+ scrollBy(mScrollDistance, INT_ZERO);
354
+ nextView = focusView.focusSearch(View.FOCUS_RIGHT);
355
+ }
356
+ if (nextView != null) {
357
+ Log.d("mouseRecycleView", "nextView----->" + nextView + "nextView id" + nextView.getId() + "nextView tag--->" + nextView.getTag());
358
+ }
359
+ if (nextView != null && !isExcludeView(nextView)) {
360
+ return nextView.requestFocus();
361
+ }
362
+ } else {
363
+ Log.e("mouseRecycleView", " no focus find, cant scroll");
364
+ }
365
+ return false;
366
+ }
367
+
368
+ /**
369
+ * 是否竖向滚动
370
+ *
371
+ * @return true-竖向,false-横向
372
+ */
373
+ public boolean isScrollVertically() {
374
+ if (getLayoutManager() != null && getLayoutManager() instanceof LinearLayoutManager) {
375
+ return getLayoutManager().canScrollVertically();
376
+ }
377
+ return true;
378
+ }
379
+
380
+ View findFocusableViewUnder(float x, float y) {
381
+ View child = findChildViewUnder(x, y);
382
+ if (child == null) {
383
+ return null;
384
+ }
385
+ if (child.isFocusable()) {
386
+ return child;
387
+ } else if (child instanceof ViewGroup) {
388
+ return findChildViewUnder((ViewGroup) child, x, y);
389
+ }
390
+ return null;
391
+
392
+ }
393
+
394
+ int[] temp = new int[2];
395
+
396
+ public View findChildViewUnder(ViewGroup parent, float x, float y) {
397
+ int count = parent != null && parent.getChildCount() > 0 ? parent.getChildCount() : 0;
398
+ for (int i = count - 1; i >= 0; --i) {
399
+ View child = parent.getChildAt(i);
400
+ float translationX = child.getTranslationX();
401
+ float translationY = child.getTranslationY();
402
+ boolean contain = false;
403
+ if (child.isFocusable()) {
404
+ child.getLocationOnScreen(temp);
405
+ int left = temp[0];
406
+ int top = temp[1];
407
+ int right = left + child.getWidth();
408
+ int bottom = top + child.getHeight();
409
+ contain = x >= (float) left + translationX && x <= (float) right + translationX && y >= (float) top + translationY && y <= bottom + translationY;
410
+
411
+ // Log.i("mouseRecycleView", "findChildViewUnder: "+child+" x: "+x+" y: "+y+" left: "+left+" top: "+top+" right: "+right+" bottom: "+bottom+" contain: "+contain);
412
+ }
413
+ if (contain && child.isFocusable()) {
414
+ return child;
415
+ } else if (child instanceof ViewGroup) {
416
+ View view = findChildViewUnder((ViewGroup) child, x, y);
417
+ if (view != null) {
418
+ return view;
419
+ }
420
+ }
421
+ }
422
+ return null;
423
+ }
424
+
425
+ // @Override
426
+ // protected boolean dispatchHoverEvent(MotionEvent event) {
427
+ // return super.dispatchHoverEvent(event);
428
+ // }
429
+
430
+ void clearRequestFocusRunnable() {
431
+ if (requestFocusRunnable != null) {
432
+ removeCallbacks(requestFocusRunnable);
433
+ requestFocusRunnable = null;
434
+ }
435
+ }
436
+
437
+
438
+ boolean mouseRequestFocus(float x, float y, View view) {
439
+ // 获取悬停位置
440
+
441
+ // Log.d("mouseRecycleView", "->>>> x " + event.getX()+", y "+event.getY());
442
+ // if (LogUtils.isDebug()) {
443
+ Log.d("mouseRecycleView", "悬停 : " + ExtendUtil.debugViewLite(view));
444
+ // }
445
+ if (view != null && !view.hasFocus()) {
446
+ Log.i("mouseRecycleView", "childView.requestFocus()");
447
+ view.requestFocus();
448
+ return true;
449
+ }
450
+ // if (childView == null) {
451
+ // return false;
452
+ // }else{
453
+ // if(!childView.hasFocus()){
454
+ // Log.i("mouseRecycleView", "childView.requestFocus()");
455
+ // childView.requestFocus();
456
+ // return true;
457
+ // }
458
+ // }
459
+ return false;
460
+ }
461
+
462
+ @Override
463
+ public boolean dispatchHoverEvent(MotionEvent event) {
464
+ switch (event.getAction()) {
465
+ case MotionEvent.ACTION_HOVER_ENTER:
466
+ case MotionEvent.ACTION_HOVER_MOVE:
467
+
468
+ clearRequestFocusRunnable();
469
+ final int x = (int) event.getX();
470
+ final int y = (int) event.getY();
471
+ final View childView = findFocusableViewUnder(x, y);
472
+ requestFocusRunnable = new Runnable() {
473
+ @Override
474
+ public void run() {
475
+ mouseRequestFocus(x, y, childView);
476
+ }
477
+ };
478
+ postDelayed(requestFocusRunnable, requestFocusDelay);
479
+ return super.dispatchHoverEvent(event);
480
+
481
+ // int position = getChildAdapterPosition(childView);
482
+ // if (position != RecyclerView.NO_POSITION) {
483
+ // // 找到悬停的项目并请求焦点
484
+ // View view = Objects.requireNonNull(getLayoutManager()).findViewByPosition(position);
485
+ // Log.d("mouseRecycleView", "悬停位置view: " + view + "当前view焦点状态-->" + view.hasFocus());
486
+ // if (view != null && !view.hasFocus()) {
487
+ // view.requestFocus();
488
+ // }
489
+ // }
490
+ case MotionEvent.ACTION_HOVER_EXIT:
491
+ // 鼠标移出 RecyclerView 时处理,例如清除焦点
492
+ break;
493
+ }
494
+ return super.dispatchHoverEvent(event);
495
+ }
496
+
497
+ /*@Override
498
+ public boolean onGenericMotion(View v, MotionEvent event) {
499
+ Log.d("debugFocus", "hippy onGenericMotion: "+v + " v id---->"+v.getId() + " v id---->"+v.getTag());
500
+ if (event.getAction() == MotionEvent.ACTION_SCROLL){
501
+ return super.onGenericMotionEvent(event);
502
+ }
503
+ if (v!=null && event.getActionMasked() == MotionEvent.ACTION_HOVER_ENTER) {
504
+ Log.d("debugFocus", "hippy onGenericMotion: ACTION_HOVER_ENTER "+v + " v id---->"+v.getId() + " v id---->"+v.getTag());
505
+ v.requestFocus();
506
+ }
507
+ return super.onGenericMotionEvent(event);
508
+ }*/
509
+ }
@@ -0,0 +1,12 @@
1
+ package com.tencent.extend.views.fastlist;
2
+
3
+ import android.view.View;
4
+
5
+ /**
6
+ * 点击、长按事件
7
+ */
8
+ public interface OnFastItemClickListener {
9
+ void onItemClickListener(View view, int position);
10
+
11
+ boolean onItemLongClickListener(View view, int position);
12
+ }
@@ -0,0 +1,9 @@
1
+ package com.tencent.extend.views.fastlist;
2
+
3
+ import android.view.View;
4
+ /**
5
+ * 焦点事件
6
+ */
7
+ public interface OnFastItemFocusChangeListener {
8
+ void onFocusChange(View view, boolean hasFocus, int position);
9
+ }
@@ -0,0 +1,7 @@
1
+ package com.tencent.extend.views.fastlist;
2
+
3
+ public interface OnFastScrollStateChangedListener {
4
+ void onScrollStateChanged(int lastState, int state,int deltaX,int deltaY);
5
+ void onTriggerScrollYGreater();
6
+ void onTriggerScrollYLesser();
7
+ }
@@ -0,0 +1,18 @@
1
+ package com.tencent.extend.views.fastlist;
2
+
3
+ import com.tencent.mtt.hippy.HippyRootView;
4
+ import com.tencent.mtt.hippy.common.HippyMap;
5
+ import com.tencent.mtt.hippy.uimanager.ControllerManager;
6
+ import com.tencent.mtt.hippy.uimanager.RenderNode;
7
+
8
+ public class PendingListNode extends RenderNode {
9
+ public PendingListNode(int mId, HippyMap mPropsToUpdate, String className, HippyRootView rootView, ControllerManager componentManager, boolean isLazyLoad) {
10
+ super(mId, mPropsToUpdate, className, rootView, componentManager, isLazyLoad);
11
+ }
12
+
13
+ public PendingListNode(int id, String className, ControllerManager componentManager) {
14
+ super(id, className, componentManager);
15
+ }
16
+
17
+
18
+ }
@@ -0,0 +1,13 @@
1
+ package com.tencent.extend.views.fastlist;
2
+
3
+ import android.view.View;
4
+
5
+ import com.tencent.mtt.hippy.uimanager.RenderNode;
6
+
7
+
8
+ public interface PendingViewController {
9
+ String PROP_LIST = "list";
10
+ String PROP_UPDATE_NESTED = "updateNested";
11
+ void setPendingData(View view, Object data, RenderNode templateNode);
12
+ void setPendingData(View view, Object data, RenderNode templateNode,boolean useDiff);
13
+ }
@@ -0,0 +1,6 @@
1
+ package com.tencent.extend.views.fastlist;
2
+
3
+ public interface PostHandlerView {
4
+ void postTask(int category,int type,Runnable r,int delay);
5
+ void clearTask(int cate,int type);
6
+ }
@@ -0,0 +1,20 @@
1
+ package com.tencent.extend.views.fastlist;
2
+
3
+ public interface PostTaskHolder {
4
+ int POST_TASK_CATEGORY_IMG = -2;
5
+ int POST_TASK_CATEGORY_TEXT = -1;
6
+ int POST_TASK_CATEGORY_DELAY_LOAD = -101;
7
+ int POST_TASK_CATEGORY_UPDATE_LAYOUT = -102;
8
+ int POST_TASK_CATEGORY_PLACEHOLDER_TO_CONTENT = -103;
9
+ int POST_TASK_CATEGORY_UPDATE_ITEM = -104;
10
+ int[] POST_UI_TASK_FOR_VIEW = new int[]{
11
+ POST_TASK_CATEGORY_IMG,
12
+ POST_TASK_CATEGORY_TEXT,
13
+ POST_TASK_CATEGORY_DELAY_LOAD,
14
+ POST_TASK_CATEGORY_UPDATE_LAYOUT,
15
+ POST_TASK_CATEGORY_PLACEHOLDER_TO_CONTENT
16
+ };
17
+ void setRootPostHandlerView(PostHandlerView pv);
18
+
19
+
20
+ }