@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.
- package/package.json +1 -1
- package/rules/.clinerules +27 -4
- package/rules/.cursorrules +27 -4
- package/rules/.github/copilot-instructions.md +27 -4
- package/rules/.source/hippy/extend_views/CoverFlowHorizontalView.java +203 -0
- package/rules/.source/hippy/extend_views/CoverFlowVerticalView.java +203 -0
- package/rules/.source/hippy/extend_views/CoverFlowViewController.java +195 -0
- package/rules/.source/hippy/extend_views/EngineRootView.java +125 -0
- package/rules/.source/hippy/extend_views/ExtendTag.java +83 -0
- package/rules/.source/hippy/extend_views/FocusSearchHelper.java +124 -0
- package/rules/.source/hippy/extend_views/IRecyclerItemView.java +12 -0
- package/rules/.source/hippy/extend_views/JSEventHandleView.java +5 -0
- package/rules/.source/hippy/extend_views/MarqueeRelayManager.java +133 -0
- package/rules/.source/hippy/extend_views/MarqueeRelayTextView.java +211 -0
- package/rules/.source/hippy/extend_views/ProgressBarView.java +83 -0
- package/rules/.source/hippy/extend_views/ProgressBarViewController.java +145 -0
- package/rules/.source/hippy/extend_views/SeekBarView.java +104 -0
- package/rules/.source/hippy/extend_views/SeekBarViewController.java +218 -0
- package/rules/.source/hippy/extend_views/StateImageView.java +149 -0
- package/rules/.source/hippy/extend_views/StateImageViewController.java +34 -0
- package/rules/.source/hippy/extend_views/TVButtonView.java +314 -0
- package/rules/.source/hippy/extend_views/TVButtonViewController.java +89 -0
- package/rules/.source/hippy/extend_views/TVTextView.java +684 -0
- package/rules/.source/hippy/extend_views/TVViewActor.java +811 -0
- package/rules/.source/hippy/extend_views/TVViewActorHost.java +6 -0
- package/rules/.source/hippy/extend_views/TVViewActor/346/216/245/345/205/245.md +66 -0
- package/rules/.source/hippy/extend_views/TemplateUtil.java +336 -0
- package/rules/.source/hippy/extend_views/TextButtonNode.java +47 -0
- package/rules/.source/hippy/extend_views/TextViewController.java +377 -0
- package/rules/.source/hippy/extend_views/fastlist/CenterFlyInAnimator.java +96 -0
- package/rules/.source/hippy/extend_views/fastlist/ChildOnScreenScroller.java +548 -0
- package/rules/.source/hippy/extend_views/fastlist/ClonedViewTag.java +17 -0
- package/rules/.source/hippy/extend_views/fastlist/EventDeliverer.java +55 -0
- package/rules/.source/hippy/extend_views/fastlist/FastAdapter.java +4683 -0
- package/rules/.source/hippy/extend_views/fastlist/FastAdapterUtil.java +982 -0
- package/rules/.source/hippy/extend_views/fastlist/FastFlexNode.java +48 -0
- package/rules/.source/hippy/extend_views/fastlist/FastFlexView.java +873 -0
- package/rules/.source/hippy/extend_views/fastlist/FastFlexViewController.java +130 -0
- package/rules/.source/hippy/extend_views/fastlist/FastItemNode.java +67 -0
- package/rules/.source/hippy/extend_views/fastlist/FastItemView.java +306 -0
- package/rules/.source/hippy/extend_views/fastlist/FastItemViewController.java +106 -0
- package/rules/.source/hippy/extend_views/fastlist/FastListModule.java +95 -0
- package/rules/.source/hippy/extend_views/fastlist/FastListNode.java +90 -0
- package/rules/.source/hippy/extend_views/fastlist/FastListView.java +2466 -0
- package/rules/.source/hippy/extend_views/fastlist/FastListViewController.java +1038 -0
- 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
- package/rules/.source/hippy/extend_views/fastlist/FastPendingView.java +47 -0
- package/rules/.source/hippy/extend_views/fastlist/ItemDecorations.java +71 -0
- package/rules/.source/hippy/extend_views/fastlist/ItemStoreNode.java +64 -0
- package/rules/.source/hippy/extend_views/fastlist/ItemStoreView.java +13 -0
- package/rules/.source/hippy/extend_views/fastlist/ItemStoreViewController.java +45 -0
- package/rules/.source/hippy/extend_views/fastlist/ListItemHolder.java +7 -0
- package/rules/.source/hippy/extend_views/fastlist/ListViewControlProp.java +41 -0
- package/rules/.source/hippy/extend_views/fastlist/MouseRecycleView.java +509 -0
- package/rules/.source/hippy/extend_views/fastlist/OnFastItemClickListener.java +12 -0
- package/rules/.source/hippy/extend_views/fastlist/OnFastItemFocusChangeListener.java +9 -0
- package/rules/.source/hippy/extend_views/fastlist/OnFastScrollStateChangedListener.java +7 -0
- package/rules/.source/hippy/extend_views/fastlist/PendingListNode.java +18 -0
- package/rules/.source/hippy/extend_views/fastlist/PendingViewController.java +13 -0
- package/rules/.source/hippy/extend_views/fastlist/PostHandlerView.java +6 -0
- package/rules/.source/hippy/extend_views/fastlist/PostTaskHolder.java +20 -0
- package/rules/.source/hippy/extend_views/fastlist/ReplaceChildController.java +105 -0
- package/rules/.source/hippy/extend_views/fastlist/ReplaceChildView.java +312 -0
- package/rules/.source/hippy/extend_views/fastlist/TVListView.java +3692 -0
- package/rules/.source/hippy/extend_views/fastlist/TemplateCodeParser.java +247 -0
- package/rules/.source/hippy/extend_views/fastlist/Utils.java +572 -0
- package/rules/.source/hippy/extend_views/fastlist/ViewTag.java +317 -0
- package/rules/.source/hippy/extend_views/fastlist/VirtualListView.java +8 -0
- package/rules/.source/hippy/extend_views/fastlist/diff/FastListDataBindingHelper.java +320 -0
- package/rules/.source/hippy/extend_views/fastlist/diff/KeyDiffHelper.java +289 -0
- package/rules/.source/hippy/extend_views/fastlist/diff/NoKeyDiffHelper.java +278 -0
- package/rules/.source/hippy/extend_views/tag/FontTag.java +53 -0
- package/rules/.source/hippy/extend_views/tag/HtmlTag.java +191 -0
- package/rules/.source/hippy/extend_views/tag/HtmlTagHandler.java +185 -0
- package/rules/.source/hippy/extend_views/tag/SpanTag.java +160 -0
- package/rules/.source/hippy/extend_views/tag/TextFontSpan.java +102 -0
- package/rules/.source/hippy/extend_views/waterfall/Chunk.java +10 -0
- package/rules/.source/hippy/extend_views/waterfall/ChunkGroup.java +5 -0
- package/rules/.source/hippy/extend_views/waterfall/Section.java +4 -0
- package/rules/.source/hippy/extend_views/waterfall/Tabs.java +5 -0
- package/rules/.source/hippy/extend_views/waterfall/WaterfallUtils.java +26 -0
- package/rules/.source/hippy/hippy_uimanager/ControllerHolder.java +30 -0
- package/rules/.source/hippy/hippy_uimanager/ControllerManager.java +651 -0
- package/rules/.source/hippy/hippy_uimanager/ControllerRegistry.java +102 -0
- package/rules/.source/hippy/hippy_uimanager/ControllerUpdateManger.java +252 -0
- package/rules/.source/hippy/hippy_uimanager/CustomControllerHelper.java +425 -0
- package/rules/.source/hippy/hippy_uimanager/DiffUtils.java +526 -0
- package/rules/.source/hippy/hippy_uimanager/ExtendViewGroup.java +36 -0
- package/rules/.source/hippy/hippy_uimanager/HippyCustomViewCreator.java +29 -0
- package/rules/.source/hippy/hippy_uimanager/HippyGroupController.java +83 -0
- package/rules/.source/hippy/hippy_uimanager/HippyViewBase.java +27 -0
- package/rules/.source/hippy/hippy_uimanager/HippyViewController.java +2189 -0
- package/rules/.source/hippy/hippy_uimanager/HippyViewEvent.java +52 -0
- package/rules/.source/hippy/hippy_uimanager/IHippyZIndexViewGroup.java +24 -0
- package/rules/.source/hippy/hippy_uimanager/InternalExtendViewUtil.java +395 -0
- package/rules/.source/hippy/hippy_uimanager/ListItemRenderNode.java +143 -0
- package/rules/.source/hippy/hippy_uimanager/ListViewRenderNode.java +44 -0
- package/rules/.source/hippy/hippy_uimanager/MatrixUtil.java +470 -0
- package/rules/.source/hippy/hippy_uimanager/NativeGestureDispatcher.java +349 -0
- package/rules/.source/hippy/hippy_uimanager/NativeGestureProcessor.java +188 -0
- package/rules/.source/hippy/hippy_uimanager/PullFooterRenderNode.java +43 -0
- package/rules/.source/hippy/hippy_uimanager/PullHeaderRenderNode.java +43 -0
- package/rules/.source/hippy/hippy_uimanager/RenderManager.java +304 -0
- package/rules/.source/hippy/hippy_uimanager/RenderNode.java +533 -0
- package/rules/.source/hippy/hippy_uimanager/StateView.java +17 -0
- package/rules/.source/hippy/hippy_uimanager/TransformUtil.java +125 -0
- package/rules/.source/hippy/hippy_uimanager/ViewGroupDrawingOrderHelper.java +108 -0
- package/rules/.source/hippy/hippy_uimanager/ViewStateProvider.java +10 -0
- package/rules/.source/hippy/hippy_views/audioview/AudioPlayManager.java +457 -0
- package/rules/.source/hippy/hippy_views/audioview/AudioView.java +225 -0
- package/rules/.source/hippy/hippy_views/audioview/AudioViewController.java +135 -0
- package/rules/.source/hippy/hippy_views/common/CommonBackgroundDrawable.java +58 -0
- package/rules/.source/hippy/hippy_views/common/CommonBorder.java +37 -0
- package/rules/.source/hippy/hippy_views/custom/HippyCustomPropsController.java +61 -0
- package/rules/.source/hippy/hippy_views/hippylist/HippyRecyclerListAdapter.java +399 -0
- package/rules/.source/hippy/hippy_views/hippylist/HippyRecyclerView.java +378 -0
- package/rules/.source/hippy/hippy_views/hippylist/HippyRecyclerViewController.java +187 -0
- package/rules/.source/hippy/hippy_views/hippylist/HippyRecyclerViewHolder.java +39 -0
- package/rules/.source/hippy/hippy_views/hippylist/HippyRecyclerViewWrapper.java +134 -0
- package/rules/.source/hippy/hippy_views/hippylist/NodePositionHelper.java +55 -0
- package/rules/.source/hippy/hippy_views/hippylist/PreloadHelper.java +54 -0
- package/rules/.source/hippy/hippy_views/hippylist/PullFooterEventHelper.java +61 -0
- package/rules/.source/hippy/hippy_views/hippylist/PullHeaderEventHelper.java +127 -0
- package/rules/.source/hippy/hippy_views/hippylist/RecyclerViewEventHelper.java +394 -0
- package/rules/.source/hippy/hippy_views/image/HippyContentDrawable.java +113 -0
- package/rules/.source/hippy/hippy_views/image/HippyImageView.java +1608 -0
- package/rules/.source/hippy/hippy_views/image/HippyImageViewController.java +382 -0
- package/rules/.source/hippy/hippy_views/image/IImageStateListener.java +7 -0
- package/rules/.source/hippy/hippy_views/list/ChildOnScreenScroller.java +255 -0
- package/rules/.source/hippy/hippy_views/list/HippyListAdapter.java +647 -0
- package/rules/.source/hippy/hippy_views/list/HippyListItemView.java +162 -0
- package/rules/.source/hippy/hippy_views/list/HippyListItemViewController.java +45 -0
- package/rules/.source/hippy/hippy_views/list/HippyListView.java +915 -0
- package/rules/.source/hippy/hippy_views/list/HippyListViewController.java +622 -0
- package/rules/.source/hippy/hippy_views/list/HippyRecycler.java +31 -0
- package/rules/.source/hippy/hippy_views/list/IRecycleItemTypeChange.java +23 -0
- package/rules/.source/hippy/hippy_views/list/ItemDecorations.java +70 -0
- package/rules/.source/hippy/hippy_views/list/NegativeLongKeyFlinger.java +156 -0
- package/rules/.source/hippy/hippy_views/list/NodeHolder.java +34 -0
- package/rules/.source/hippy/hippy_views/list/RecycleViewFlinger.java +126 -0
- package/rules/.source/hippy/hippy_views/list/TVRecyclerView.java +2070 -0
- package/rules/.source/hippy/hippy_views/list/TVSingleLineListView.java +15 -0
- package/rules/.source/hippy/hippy_views/modal/HippyModalHostManager.java +102 -0
- package/rules/.source/hippy/hippy_views/modal/HippyModalHostView.java +597 -0
- package/rules/.source/hippy/hippy_views/modal/ModalHostHelper.java +46 -0
- package/rules/.source/hippy/hippy_views/modal/ModalStyleNode.java +34 -0
- package/rules/.source/hippy/hippy_views/modal/RequestCloseEvent.java +32 -0
- package/rules/.source/hippy/hippy_views/modal/ShowEvent.java +31 -0
- package/rules/.source/hippy/hippy_views/navigator/Navigator.java +126 -0
- package/rules/.source/hippy/hippy_views/navigator/NavigatorController.java +120 -0
- package/rules/.source/hippy/hippy_views/refresh/HippyPullFooterView.java +47 -0
- package/rules/.source/hippy/hippy_views/refresh/HippyPullFooterViewController.java +65 -0
- package/rules/.source/hippy/hippy_views/refresh/HippyPullHeaderView.java +39 -0
- package/rules/.source/hippy/hippy_views/refresh/HippyPullHeaderViewController.java +104 -0
- package/rules/.source/hippy/hippy_views/refresh/RefreshWrapper.java +237 -0
- package/rules/.source/hippy/hippy_views/refresh/RefreshWrapperController.java +62 -0
- package/rules/.source/hippy/hippy_views/refresh/RefreshWrapperItemController.java +39 -0
- package/rules/.source/hippy/hippy_views/refresh/RefreshWrapperItemView.java +26 -0
- package/rules/.source/hippy/hippy_views/scroll/HippyHorizontalScrollView.java +500 -0
- package/rules/.source/hippy/hippy_views/scroll/HippyOnScrollHelper.java +39 -0
- package/rules/.source/hippy/hippy_views/scroll/HippyScrollView.java +46 -0
- package/rules/.source/hippy/hippy_views/scroll/HippyScrollViewController.java +178 -0
- package/rules/.source/hippy/hippy_views/scroll/HippyScrollViewEventHelper.java +92 -0
- package/rules/.source/hippy/hippy_views/scroll/HippyVerticalScrollView.java +522 -0
- package/rules/.source/hippy/hippy_views/text/HippyTextView.java +512 -0
- package/rules/.source/hippy/hippy_views/text/HippyTextViewController.java +77 -0
- package/rules/.source/hippy/hippy_views/textinput/HippyTextInput.java +668 -0
- package/rules/.source/hippy/hippy_views/textinput/HippyTextInputController.java +528 -0
- package/rules/.source/hippy/hippy_views/textinput/TextInputNode.java +115 -0
- package/rules/.source/hippy/hippy_views/videoview/APEZProvider.java +287 -0
- package/rules/.source/hippy/hippy_views/videoview/APKExpansionSupport.java +82 -0
- package/rules/.source/hippy/hippy_views/videoview/PivotPoint.java +13 -0
- package/rules/.source/hippy/hippy_views/videoview/ScalableType.java +34 -0
- package/rules/.source/hippy/hippy_views/videoview/ScalableVideoView.java +265 -0
- package/rules/.source/hippy/hippy_views/videoview/ScaleManager.java +191 -0
- package/rules/.source/hippy/hippy_views/videoview/Size.java +19 -0
- package/rules/.source/hippy/hippy_views/videoview/VideoHippyView.java +917 -0
- package/rules/.source/hippy/hippy_views/videoview/VideoHippyViewController.java +236 -0
- package/rules/.source/hippy/hippy_views/videoview/ZipResourceFile.java +427 -0
- package/rules/.source/hippy/hippy_views/view/CardRootView.java +28 -0
- package/rules/.source/hippy/hippy_views/view/CustomLayoutView.java +10 -0
- package/rules/.source/hippy/hippy_views/view/CustomNodeView.java +5 -0
- package/rules/.source/hippy/hippy_views/view/DialogViewGroup.java +113 -0
- package/rules/.source/hippy/hippy_views/view/HippyViewGroup.java +2042 -0
- package/rules/.source/hippy/hippy_views/view/HippyViewGroupController.java +583 -0
- package/rules/.source/hippy/hippy_views/view/WindowRoot.java +5 -0
- package/rules/.source/hippy/hippy_views/viewpager/HippyViewPager.java +308 -0
- package/rules/.source/hippy/hippy_views/viewpager/HippyViewPagerAdapter.java +148 -0
- package/rules/.source/hippy/hippy_views/viewpager/HippyViewPagerController.java +246 -0
- package/rules/.source/hippy/hippy_views/viewpager/HippyViewPagerItem.java +27 -0
- package/rules/.source/hippy/hippy_views/viewpager/HippyViewPagerItemController.java +42 -0
- package/rules/.source/hippy/hippy_views/viewpager/ViewPagerPageChangeListener.java +114 -0
- package/rules/.source/hippy/hippy_views/viewpager/event/HippyPageItemExposureEvent.java +40 -0
- package/rules/.source/hippy/hippy_views/viewpager/event/HippyPageScrollEvent.java +43 -0
- package/rules/.source/hippy/hippy_views/viewpager/event/HippyPageScrollStateChangedEvent.java +42 -0
- package/rules/.source/hippy/hippy_views/viewpager/event/HippyPageSelectedEvent.java +42 -0
- package/rules/.source/hippy/hippy_views/webview/HippyWebView.java +160 -0
- package/rules/.source/hippy/hippy_views/webview/HippyWebViewBridge.java +20 -0
- package/rules/.source/hippy/hippy_views/webview/HippyWebViewController.java +103 -0
- package/rules/.source/hippy/hippy_views/webview/HippyWebViewInner.java +77 -0
- package/rules/.windsurfrules +27 -4
- package/rules/AGENTS.md +27 -4
- package/rules/CLAUDE.md +27 -3
- package/rules/GEMINI.md +25 -3
package/package.json
CHANGED
package/rules/.clinerules
CHANGED
|
@@ -7,9 +7,18 @@
|
|
|
7
7
|
**AI MUST refer to the official documentation and source code below BEFORE generating any code. NEVER hallucinate component names, attribute names, or APIs. These are the ONLY authorities.**
|
|
8
8
|
|
|
9
9
|
1. **Local Docs, Examples & Source (PRIMARY)**: `node_modules/@quicktvui/ai/rules/.docs/` and `node_modules/@quicktvui/ai/rules/.source/` directories.
|
|
10
|
-
* **Component Docs**:
|
|
11
|
-
* **Example Code**: `.docs/examples/`
|
|
12
|
-
* **Framework Source
|
|
10
|
+
* **Component Docs**: `.docs/` for component, API, and CSS definitions.
|
|
11
|
+
* **Example Code**: `.docs/examples/` for verified best practices (pagination, focus, etc.).
|
|
12
|
+
* **Framework Source Map**: `.source/` contains the full-stack implementation. AI MUST locate source based on module:
|
|
13
|
+
* `quicktvui/`: Core Vue 3 UI component library implementation.
|
|
14
|
+
* `hippy/`: Android Native implementation (ViewController, UIManager).
|
|
15
|
+
* `ESPlayer*/ESVideoPlayer`: Media playback engines (Video, Audio, ADs).
|
|
16
|
+
* `ESPlayerManager`: High-level player window and playlist management.
|
|
17
|
+
* `ESRouter`: TV-optimized routing and navigation system.
|
|
18
|
+
* `ESCore`: Native module bridge, Storage, Toast, and System APIs.
|
|
19
|
+
* `ESVue*/ESVueStyleParser`: Custom Vue renderer and Style parser logic.
|
|
20
|
+
* `ESAxios`: Platform-optimized network library.
|
|
21
|
+
* `web/`: Polyfills for standard web tags.
|
|
13
22
|
|
|
14
23
|
2. **Official Docs**: https://quicktvui.com
|
|
15
24
|
3. **Core Library Samples**: https://github.com/quicktvui/quicktvui.git
|
|
@@ -403,4 +412,18 @@ export default defineComponent({
|
|
|
403
412
|
5. **Pagination & Load More Rules (CRITICAL)**:
|
|
404
413
|
* **`qt-tabs` (Tabs Waterfall)**: **MUST** use **`@onTabPageLoadData="onTabPageLoadData"`**. Append data via `addPageData`.
|
|
405
414
|
* **`qt-waterfall` (Single Waterfall)**: **NO native `loadMore` event**. Usually triggered via **`@onItemBind`** on the last section (e.g., a Loading Section) or by listening to **`@onScrollToBottom`** (if supported by parent).
|
|
406
|
-
* **`qt-list-view` / `qt-grid-view`**: Support native `@loadMore="loadMoreFn"` with `pageNo` parameter.
|
|
415
|
+
* **`qt-list-view` / `qt-grid-view`**: Support native `@loadMore="loadMoreFn"` with `pageNo` parameter.
|
|
416
|
+
|
|
417
|
+
### 7. Native Component Mapping & Deprecations
|
|
418
|
+
AI MUST understand the mapping between Vue components and Java Native controllers to avoid using deprecated logic:
|
|
419
|
+
|
|
420
|
+
| Vue Component | Native Name (Hippy) | Java Class (PRIMARY) | Status |
|
|
421
|
+
| :--- | :--- | :--- | :--- |
|
|
422
|
+
| `qt-text` | `TextView` | `com.tencent.extend.views.TextViewController` | **Recommended** |
|
|
423
|
+
| `qt-list-view` | `FastListView` | `com.tencent.extend.views.fastlist.FastListViewController` | **Recommended** |
|
|
424
|
+
| `qt-waterfall` | `FastListView` | `com.tencent.extend.views.fastlist.FastListViewController` | **Recommended** |
|
|
425
|
+
| `qt-image` | `Image` | `com.tencent.mtt.hippy.views.image.HippyImageViewController` | **Active** |
|
|
426
|
+
| **(Deprecated)** | `Text` | `com.tencent.mtt.hippy.views.text.HippyTextViewController` | **DEPRECATED** |
|
|
427
|
+
| **(Deprecated)** | `ListView` | `com.tencent.mtt.hippy.views.list.HippyListViewController` | **DEPRECATED** |
|
|
428
|
+
|
|
429
|
+
**Rule**: Always prefer source code in `.source/hippy/extend_views/`. Use `.source/hippy/hippy_views/` only as a secondary fallback.
|
package/rules/.cursorrules
CHANGED
|
@@ -7,9 +7,18 @@
|
|
|
7
7
|
**AI MUST refer to the official documentation and source code below BEFORE generating any code. NEVER hallucinate component names, attribute names, or APIs. These are the ONLY authorities.**
|
|
8
8
|
|
|
9
9
|
1. **Local Docs, Examples & Source (PRIMARY)**: `node_modules/@quicktvui/ai/rules/.docs/` and `node_modules/@quicktvui/ai/rules/.source/` directories.
|
|
10
|
-
* **Component Docs**:
|
|
11
|
-
* **Example Code**: `.docs/examples/`
|
|
12
|
-
* **Framework Source
|
|
10
|
+
* **Component Docs**: `.docs/` for component, API, and CSS definitions.
|
|
11
|
+
* **Example Code**: `.docs/examples/` for verified best practices (pagination, focus, etc.).
|
|
12
|
+
* **Framework Source Map**: `.source/` contains the full-stack implementation. AI MUST locate source based on module:
|
|
13
|
+
* `quicktvui/`: Core Vue 3 UI component library implementation.
|
|
14
|
+
* `hippy/`: Android Native implementation (ViewController, UIManager).
|
|
15
|
+
* `ESPlayer*/ESVideoPlayer`: Media playback engines (Video, Audio, ADs).
|
|
16
|
+
* `ESPlayerManager`: High-level player window and playlist management.
|
|
17
|
+
* `ESRouter`: TV-optimized routing and navigation system.
|
|
18
|
+
* `ESCore`: Native module bridge, Storage, Toast, and System APIs.
|
|
19
|
+
* `ESVue*/ESVueStyleParser`: Custom Vue renderer and Style parser logic.
|
|
20
|
+
* `ESAxios`: Platform-optimized network library.
|
|
21
|
+
* `web/`: Polyfills for standard web tags.
|
|
13
22
|
|
|
14
23
|
2. **Official Docs**: https://quicktvui.com
|
|
15
24
|
3. **Core Library Samples**: https://github.com/quicktvui/quicktvui.git
|
|
@@ -404,4 +413,18 @@ export default defineComponent({
|
|
|
404
413
|
5. **Pagination & Load More Rules (CRITICAL)**:
|
|
405
414
|
* **`qt-tabs` (Tabs Waterfall)**: **MUST** use **`@onTabPageLoadData="onTabPageLoadData"`**. Append data via `addPageData`.
|
|
406
415
|
* **`qt-waterfall` (Single Waterfall)**: **NO native `loadMore` event**. Usually triggered via **`@onItemBind`** on the last section (e.g., a Loading Section) or by listening to **`@onScrollToBottom`** (if supported by parent).
|
|
407
|
-
* **`qt-list-view` / `qt-grid-view`**: Support native `@loadMore="loadMoreFn"` with `pageNo` parameter.
|
|
416
|
+
* **`qt-list-view` / `qt-grid-view`**: Support native `@loadMore="loadMoreFn"` with `pageNo` parameter.
|
|
417
|
+
|
|
418
|
+
### 7. Native Component Mapping & Deprecations
|
|
419
|
+
AI MUST understand the mapping between Vue components and Java Native controllers to avoid using deprecated logic:
|
|
420
|
+
|
|
421
|
+
| Vue Component | Native Name (Hippy) | Java Class (PRIMARY) | Status |
|
|
422
|
+
| :--- | :--- | :--- | :--- |
|
|
423
|
+
| `qt-text` | `TextView` | `com.tencent.extend.views.TextViewController` | **Recommended** |
|
|
424
|
+
| `qt-list-view` | `FastListView` | `com.tencent.extend.views.fastlist.FastListViewController` | **Recommended** |
|
|
425
|
+
| `qt-waterfall` | `FastListView` | `com.tencent.extend.views.fastlist.FastListViewController` | **Recommended** |
|
|
426
|
+
| `qt-image` | `Image` | `com.tencent.mtt.hippy.views.image.HippyImageViewController` | **Active** |
|
|
427
|
+
| **(Deprecated)** | `Text` | `com.tencent.mtt.hippy.views.text.HippyTextViewController` | **DEPRECATED** |
|
|
428
|
+
| **(Deprecated)** | `ListView` | `com.tencent.mtt.hippy.views.list.HippyListViewController` | **DEPRECATED** |
|
|
429
|
+
|
|
430
|
+
**Rule**: Always prefer source code in `.source/hippy/extend_views/`. Use `.source/hippy/hippy_views/` only as a secondary fallback.
|
|
@@ -7,9 +7,18 @@
|
|
|
7
7
|
**AI MUST refer to the official documentation and source code below BEFORE generating any code. NEVER hallucinate component names, attribute names, or APIs. These are the ONLY authorities.**
|
|
8
8
|
|
|
9
9
|
1. **Local Docs, Examples & Source (PRIMARY)**: `node_modules/@quicktvui/ai/rules/.docs/` and `node_modules/@quicktvui/ai/rules/.source/` directories.
|
|
10
|
-
* **Component Docs**:
|
|
11
|
-
* **Example Code**: `.docs/examples/`
|
|
12
|
-
* **Framework Source
|
|
10
|
+
* **Component Docs**: `.docs/` for component, API, and CSS definitions.
|
|
11
|
+
* **Example Code**: `.docs/examples/` for verified best practices (pagination, focus, etc.).
|
|
12
|
+
* **Framework Source Map**: `.source/` contains the full-stack implementation. AI MUST locate source based on module:
|
|
13
|
+
* `quicktvui/`: Core Vue 3 UI component library implementation.
|
|
14
|
+
* `hippy/`: Android Native implementation (ViewController, UIManager).
|
|
15
|
+
* `ESPlayer*/ESVideoPlayer`: Media playback engines (Video, Audio, ADs).
|
|
16
|
+
* `ESPlayerManager`: High-level player window and playlist management.
|
|
17
|
+
* `ESRouter`: TV-optimized routing and navigation system.
|
|
18
|
+
* `ESCore`: Native module bridge, Storage, Toast, and System APIs.
|
|
19
|
+
* `ESVue*/ESVueStyleParser`: Custom Vue renderer and Style parser logic.
|
|
20
|
+
* `ESAxios`: Platform-optimized network library.
|
|
21
|
+
* `web/`: Polyfills for standard web tags.
|
|
13
22
|
|
|
14
23
|
2. **Official Docs**: https://quicktvui.com
|
|
15
24
|
3. **Core Library Samples**: https://github.com/quicktvui/quicktvui.git
|
|
@@ -472,4 +481,18 @@ export default defineComponent({
|
|
|
472
481
|
5. **Pagination & Load More Rules (CRITICAL)**:
|
|
473
482
|
* **`qt-tabs` (Tabs Waterfall)**: **MUST** use **`@onTabPageLoadData="onTabPageLoadData"`**. Append data via `addPageData`.
|
|
474
483
|
* **`qt-waterfall` (Single Waterfall)**: **NO native `loadMore` event**. Usually triggered via **`@onItemBind`** on the last section (e.g., a Loading Section) or by listening to **`@onScrollToBottom`** (if supported by parent).
|
|
475
|
-
* **`qt-list-view` / `qt-grid-view`**: Support native `@loadMore="loadMoreFn"` with `pageNo` parameter.
|
|
484
|
+
* **`qt-list-view` / `qt-grid-view`**: Support native `@loadMore="loadMoreFn"` with `pageNo` parameter.
|
|
485
|
+
|
|
486
|
+
### 7. Native Component Mapping & Deprecations
|
|
487
|
+
AI MUST understand the mapping between Vue components and Java Native controllers to avoid using deprecated logic:
|
|
488
|
+
|
|
489
|
+
| Vue Component | Native Name (Hippy) | Java Class (PRIMARY) | Status |
|
|
490
|
+
| :--- | :--- | :--- | :--- |
|
|
491
|
+
| `qt-text` | `TextView` | `com.tencent.extend.views.TextViewController` | **Recommended** |
|
|
492
|
+
| `qt-list-view` | `FastListView` | `com.tencent.extend.views.fastlist.FastListViewController` | **Recommended** |
|
|
493
|
+
| `qt-waterfall` | `FastListView` | `com.tencent.extend.views.fastlist.FastListViewController` | **Recommended** |
|
|
494
|
+
| `qt-image` | `Image` | `com.tencent.mtt.hippy.views.image.HippyImageViewController` | **Active** |
|
|
495
|
+
| **(Deprecated)** | `Text` | `com.tencent.mtt.hippy.views.text.HippyTextViewController` | **DEPRECATED** |
|
|
496
|
+
| **(Deprecated)** | `ListView` | `com.tencent.mtt.hippy.views.list.HippyListViewController` | **DEPRECATED** |
|
|
497
|
+
|
|
498
|
+
**Rule**: Always prefer source code in `.source/hippy/extend_views/`. Use `.source/hippy/hippy_views/` only as a secondary fallback.
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
package com.tencent.extend.views;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.graphics.Canvas;
|
|
5
|
+
import android.graphics.Rect;
|
|
6
|
+
import android.util.Log;
|
|
7
|
+
import android.view.MotionEvent;
|
|
8
|
+
import android.view.View;
|
|
9
|
+
import android.view.ViewGroup;
|
|
10
|
+
|
|
11
|
+
import com.tencent.extend.ICoverFlow;
|
|
12
|
+
import com.tencent.extend.TVFocusScaleExcuter;
|
|
13
|
+
import com.tencent.mtt.hippy.R;
|
|
14
|
+
import com.tencent.mtt.hippy.views.scroll.HippyHorizontalScrollView;
|
|
15
|
+
import com.tencent.mtt.hippy.views.view.HippyViewGroup;
|
|
16
|
+
|
|
17
|
+
public class CoverFlowHorizontalView extends HippyHorizontalScrollView implements ICoverFlow {
|
|
18
|
+
|
|
19
|
+
public CoverFlowHorizontalView(Context context) {
|
|
20
|
+
super(context);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
private int mDefaultScrollDuration = 300;
|
|
24
|
+
private int mDefaultAutoScrollInterval = 2000;
|
|
25
|
+
public float mDefaultZoomInValue = 1.5f;
|
|
26
|
+
|
|
27
|
+
private int mCurrentPosition = 0;
|
|
28
|
+
private AutoScroll mAutoScroll;
|
|
29
|
+
|
|
30
|
+
@Override
|
|
31
|
+
public void setAutoScrollInterval(int autoScrollInterval) {
|
|
32
|
+
this.mDefaultAutoScrollInterval = autoScrollInterval;
|
|
33
|
+
removeCallbacks(mAutoScroll);
|
|
34
|
+
scrollToPosition(mCurrentPosition, 100, mDefaultScrollDuration);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@Override
|
|
38
|
+
public void setZoomInValue(float zoomInValue) {
|
|
39
|
+
this.mDefaultZoomInValue = zoomInValue;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@Override
|
|
43
|
+
public int getCurrentIndex() {
|
|
44
|
+
return mCurrentPosition;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@Override
|
|
48
|
+
public void scrollToIndex(int index, int duration) {
|
|
49
|
+
scrollToPosition(index, 0, duration);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private class AutoScroll implements Runnable{
|
|
53
|
+
|
|
54
|
+
final int position;
|
|
55
|
+
final int duration;
|
|
56
|
+
|
|
57
|
+
private AutoScroll(int position, int duration) {
|
|
58
|
+
this.position = position;
|
|
59
|
+
this.duration = duration;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@Override
|
|
63
|
+
public void run() {
|
|
64
|
+
if(!hasFocus()){
|
|
65
|
+
smoothScrollToPosition(position, duration);
|
|
66
|
+
postInvalidateDelayed(16);
|
|
67
|
+
mCurrentPosition = position;
|
|
68
|
+
if(mDefaultAutoScrollInterval > 0){
|
|
69
|
+
scrollToPosition(mCurrentPosition + 1, mDefaultAutoScrollInterval, mDefaultScrollDuration);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
Rect mTempRect = new Rect();
|
|
76
|
+
|
|
77
|
+
View mCurrentChild = null;
|
|
78
|
+
|
|
79
|
+
private void smoothScrollToPosition(int position,int duration){
|
|
80
|
+
final View firstChild = getItemViewAt(0);
|
|
81
|
+
if(firstChild == null){
|
|
82
|
+
Log.e("ScrollView","smoothScrollToPosition error firstChild is null");
|
|
83
|
+
return ;
|
|
84
|
+
}
|
|
85
|
+
if(mCurrentChild != null){
|
|
86
|
+
TVFocusScaleExcuter.handleOnFocusChange(mCurrentChild,false,1f,1f,300, R.id.tag_cover_flow_animation);
|
|
87
|
+
}
|
|
88
|
+
final View target = getItemViewAt(position);
|
|
89
|
+
mCurrentChild = target;
|
|
90
|
+
TVFocusScaleExcuter.handleOnFocusChange(target,true, mDefaultZoomInValue, mDefaultZoomInValue,300, R.id.tag_cover_flow_animation);
|
|
91
|
+
if(target != null){
|
|
92
|
+
|
|
93
|
+
if(getContainer() instanceof HippyViewGroup){
|
|
94
|
+
((HippyViewGroup)getContainer()).setOverFlowViewIndex(position);
|
|
95
|
+
}
|
|
96
|
+
mTempRect.setEmpty();
|
|
97
|
+
offsetDescendantRectToMyCoords(target,mTempRect);
|
|
98
|
+
int parentCenter = (int) (getWidth() * 0.5f);
|
|
99
|
+
final int targetX = (int) (mTempRect.left + target.getWidth() * 0.5f) - parentCenter;
|
|
100
|
+
if(duration > 0) {
|
|
101
|
+
callSmoothScrollTo(targetX, 0,duration);
|
|
102
|
+
}else{
|
|
103
|
+
scrollTo(targetX,0);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@Override
|
|
109
|
+
public boolean requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate) {
|
|
110
|
+
return super.requestChildRectangleOnScreen(child, rectangle, immediate);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@Override
|
|
114
|
+
public void requestChildFocus(View child, View focused) {
|
|
115
|
+
super.requestChildFocus(child, focused);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
private int getItemCount(){
|
|
119
|
+
if(getChildCount() < 1){
|
|
120
|
+
return 0;
|
|
121
|
+
}
|
|
122
|
+
return ((ViewGroup)getChildAt(0)).getChildCount();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
private ViewGroup getContainer(){
|
|
126
|
+
if(getChildCount() < 1){
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
return (ViewGroup) getChildAt(0);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
private View getItemViewAt(int index){
|
|
133
|
+
if(getItemCount() > index && index > -1){
|
|
134
|
+
return getContainer().getChildAt(index);
|
|
135
|
+
}
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
private void stopAutoScroll(){
|
|
140
|
+
if(mAutoScroll != null){
|
|
141
|
+
removeCallbacks(mAutoScroll);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@Override
|
|
146
|
+
protected void dispatchDraw(Canvas canvas) {
|
|
147
|
+
super.dispatchDraw(canvas);
|
|
148
|
+
// if( autoScrollInterval > 0 ) {
|
|
149
|
+
// if( getFocusedChild() != null) {
|
|
150
|
+
// super.drawChild(canvas, getFocusedChild(), getDrawingTime());
|
|
151
|
+
// }else if(mCurrentChild != null){
|
|
152
|
+
// super.drawChild(canvas, mCurrentChild, getDrawingTime());
|
|
153
|
+
// }
|
|
154
|
+
// }
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@Override
|
|
158
|
+
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
|
|
159
|
+
if(getFocusedChild() == child || child == mCurrentChild){
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
return super.drawChild(canvas, child, drawingTime);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
@Override
|
|
166
|
+
protected void onAttachedToWindow() {
|
|
167
|
+
super.onAttachedToWindow();
|
|
168
|
+
scrollToPosition(mCurrentPosition, 100, 0);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
@Override
|
|
172
|
+
protected void onDetachedFromWindow() {
|
|
173
|
+
super.onDetachedFromWindow();
|
|
174
|
+
stopAutoScroll();
|
|
175
|
+
mCurrentChild = null;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
private void scrollToPosition(int position, int delay, int duration){
|
|
179
|
+
stopAutoScroll();
|
|
180
|
+
if(position < 0) position = getItemCount() - 1;
|
|
181
|
+
else if(position > getItemCount() - 1) position = 0;
|
|
182
|
+
mAutoScroll = new AutoScroll(position, duration);
|
|
183
|
+
postDelayed(mAutoScroll, delay);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
private float mLastTouchPos;
|
|
187
|
+
|
|
188
|
+
@Override
|
|
189
|
+
public boolean dispatchTouchEvent(MotionEvent e) {
|
|
190
|
+
int action = e.getAction() & MotionEvent.ACTION_MASK;
|
|
191
|
+
if(action == MotionEvent.ACTION_DOWN){
|
|
192
|
+
mLastTouchPos = e.getX();
|
|
193
|
+
}else if(action == MotionEvent.ACTION_UP){
|
|
194
|
+
float delta = e.getX() - mLastTouchPos;
|
|
195
|
+
if(delta > 0){
|
|
196
|
+
scrollToPosition(mCurrentPosition - 1, 0, mDefaultScrollDuration);
|
|
197
|
+
}else if(delta < 0){
|
|
198
|
+
scrollToPosition(mCurrentPosition + 1, 0, mDefaultScrollDuration);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
package com.tencent.extend.views;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.graphics.Canvas;
|
|
5
|
+
import android.graphics.Rect;
|
|
6
|
+
import android.util.Log;
|
|
7
|
+
import android.view.MotionEvent;
|
|
8
|
+
import android.view.View;
|
|
9
|
+
import android.view.ViewGroup;
|
|
10
|
+
|
|
11
|
+
import com.tencent.extend.ICoverFlow;
|
|
12
|
+
import com.tencent.extend.TVFocusScaleExcuter;
|
|
13
|
+
import com.tencent.mtt.hippy.R;
|
|
14
|
+
import com.tencent.mtt.hippy.views.scroll.HippyVerticalScrollView;
|
|
15
|
+
import com.tencent.mtt.hippy.views.view.HippyViewGroup;
|
|
16
|
+
|
|
17
|
+
public class CoverFlowVerticalView extends HippyVerticalScrollView implements ICoverFlow {
|
|
18
|
+
|
|
19
|
+
public CoverFlowVerticalView(Context context) {
|
|
20
|
+
super(context);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
private int mDefaultScrollDuration = 300;
|
|
24
|
+
private int mDefaultAutoScrollInterval = 2000;
|
|
25
|
+
public float mDefaultZoomInValue = 1.5f;
|
|
26
|
+
|
|
27
|
+
private int mCurrentPosition = 0;
|
|
28
|
+
private AutoScroll mAutoScroll;
|
|
29
|
+
|
|
30
|
+
@Override
|
|
31
|
+
public void setAutoScrollInterval(int autoScrollInterval) {
|
|
32
|
+
this.mDefaultAutoScrollInterval = autoScrollInterval;
|
|
33
|
+
removeCallbacks(mAutoScroll);
|
|
34
|
+
scrollToPosition(mCurrentPosition, 100, mDefaultScrollDuration);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@Override
|
|
38
|
+
public void setZoomInValue(float zoomInValue) {
|
|
39
|
+
this.mDefaultZoomInValue = zoomInValue;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@Override
|
|
43
|
+
public int getCurrentIndex() {
|
|
44
|
+
return mCurrentPosition;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@Override
|
|
48
|
+
public void scrollToIndex(int index, int duration) {
|
|
49
|
+
scrollToPosition(index, 0, duration);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private class AutoScroll implements Runnable{
|
|
53
|
+
|
|
54
|
+
final int position;
|
|
55
|
+
final int duration;
|
|
56
|
+
|
|
57
|
+
private AutoScroll(int position, int duration) {
|
|
58
|
+
this.position = position;
|
|
59
|
+
this.duration = duration;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@Override
|
|
63
|
+
public void run() {
|
|
64
|
+
if(!hasFocus()){
|
|
65
|
+
smoothScrollToPosition(position, duration);
|
|
66
|
+
postInvalidateDelayed(16);
|
|
67
|
+
mCurrentPosition = position;
|
|
68
|
+
if(mDefaultAutoScrollInterval > 0){
|
|
69
|
+
scrollToPosition(mCurrentPosition + 1, mDefaultAutoScrollInterval, mDefaultScrollDuration);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
Rect mTempRect = new Rect();
|
|
76
|
+
|
|
77
|
+
View mCurrentChild = null;
|
|
78
|
+
|
|
79
|
+
private void smoothScrollToPosition(int position,int duration){
|
|
80
|
+
final View firstChild = getItemViewAt(0);
|
|
81
|
+
if(firstChild == null){
|
|
82
|
+
Log.e("ScrollView","smoothScrollToPosition error firstChild is null");
|
|
83
|
+
return ;
|
|
84
|
+
}
|
|
85
|
+
if(mCurrentChild != null){
|
|
86
|
+
TVFocusScaleExcuter.handleOnFocusChange(mCurrentChild,false,1f,1f,300, R.id.tag_cover_flow_animation);
|
|
87
|
+
}
|
|
88
|
+
final View target = getItemViewAt(position);
|
|
89
|
+
mCurrentChild = target;
|
|
90
|
+
TVFocusScaleExcuter.handleOnFocusChange(target,true,mDefaultZoomInValue,mDefaultZoomInValue,300, R.id.tag_cover_flow_animation);
|
|
91
|
+
if(target != null){
|
|
92
|
+
|
|
93
|
+
if(getContainer() instanceof HippyViewGroup){
|
|
94
|
+
((HippyViewGroup)getContainer()).setOverFlowViewIndex(position);
|
|
95
|
+
}
|
|
96
|
+
mTempRect.setEmpty();
|
|
97
|
+
offsetDescendantRectToMyCoords(target,mTempRect);
|
|
98
|
+
int parentCenter = (int) (getHeight() * 0.5f);
|
|
99
|
+
final int targetY = (int) (mTempRect.top + target.getHeight() * 0.5f) - parentCenter;
|
|
100
|
+
if(duration > 0) {
|
|
101
|
+
callSmoothScrollTo(0, targetY,duration);
|
|
102
|
+
}else{
|
|
103
|
+
scrollTo(0,targetY);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@Override
|
|
109
|
+
public boolean requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate) {
|
|
110
|
+
return super.requestChildRectangleOnScreen(child, rectangle, immediate);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@Override
|
|
114
|
+
public void requestChildFocus(View child, View focused) {
|
|
115
|
+
super.requestChildFocus(child, focused);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
private int getItemCount(){
|
|
119
|
+
if(getChildCount() < 1){
|
|
120
|
+
return 0;
|
|
121
|
+
}
|
|
122
|
+
return ((ViewGroup)getChildAt(0)).getChildCount();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
private ViewGroup getContainer(){
|
|
126
|
+
if(getChildCount() < 1){
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
return (ViewGroup) getChildAt(0);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
private View getItemViewAt(int index){
|
|
133
|
+
if(getItemCount() > index && index > -1){
|
|
134
|
+
return getContainer().getChildAt(index);
|
|
135
|
+
}
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
private void stopAutoScroll(){
|
|
140
|
+
if(mAutoScroll != null){
|
|
141
|
+
removeCallbacks(mAutoScroll);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@Override
|
|
146
|
+
protected void dispatchDraw(Canvas canvas) {
|
|
147
|
+
super.dispatchDraw(canvas);
|
|
148
|
+
// if( autoScrollInterval > 0 ) {
|
|
149
|
+
// if( getFocusedChild() != null) {
|
|
150
|
+
// super.drawChild(canvas, getFocusedChild(), getDrawingTime());
|
|
151
|
+
// }else if(mCurrentChild != null){
|
|
152
|
+
// super.drawChild(canvas, mCurrentChild, getDrawingTime());
|
|
153
|
+
// }
|
|
154
|
+
// }
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@Override
|
|
158
|
+
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
|
|
159
|
+
if(getFocusedChild() == child || child == mCurrentChild){
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
return super.drawChild(canvas, child, drawingTime);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
@Override
|
|
166
|
+
protected void onAttachedToWindow() {
|
|
167
|
+
super.onAttachedToWindow();
|
|
168
|
+
scrollToPosition(mCurrentPosition, 100, 0);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
@Override
|
|
172
|
+
protected void onDetachedFromWindow() {
|
|
173
|
+
super.onDetachedFromWindow();
|
|
174
|
+
stopAutoScroll();
|
|
175
|
+
mCurrentChild = null;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
private void scrollToPosition(int position, int delay, int duration){
|
|
179
|
+
stopAutoScroll();
|
|
180
|
+
if(position < 0) position = getItemCount() - 1;
|
|
181
|
+
else if(position > getItemCount() - 1) position = 0;
|
|
182
|
+
mAutoScroll = new AutoScroll(position, duration);
|
|
183
|
+
postDelayed(mAutoScroll, delay);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
private float mLastTouchPos;
|
|
187
|
+
|
|
188
|
+
@Override
|
|
189
|
+
public boolean dispatchTouchEvent(MotionEvent e) {
|
|
190
|
+
int action = e.getAction() & MotionEvent.ACTION_MASK;
|
|
191
|
+
if(action == MotionEvent.ACTION_DOWN){
|
|
192
|
+
mLastTouchPos = e.getY();
|
|
193
|
+
}else if(action == MotionEvent.ACTION_UP){
|
|
194
|
+
float delta = e.getY() - mLastTouchPos;
|
|
195
|
+
if(delta > 0){
|
|
196
|
+
scrollToPosition(mCurrentPosition - 1, 0, mDefaultScrollDuration);
|
|
197
|
+
}else if(delta < 0){
|
|
198
|
+
scrollToPosition(mCurrentPosition + 1, 0, mDefaultScrollDuration);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
}
|