@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,6 @@
1
+ package com.tencent.extend.views;
2
+
3
+ public interface TVViewActorHost {
4
+ // void setTVActor(TVViewActor actor);
5
+ TVViewActor getTVActor();
6
+ }
@@ -0,0 +1,66 @@
1
+
2
+ ## view添加焦点等TVView的方法
3
+ 按需接管view中的以下方法
4
+ ```
5
+ //通知尺寸变化 必须
6
+ onSizeChanged
7
+ //通知焦点变化 必须
8
+ onFocusChanged
9
+ //通知view被移除
10
+ onDetachedFromWindow
11
+ //通知view被添加
12
+ onAttachedToWindow
13
+ //添加焦点
14
+ addFocusables
15
+ //寻焦
16
+ focusSearch
17
+ //绘制焦点框、背景
18
+ draw
19
+ setFocusBorderType
20
+ drawableStateChanged
21
+ ```
22
+
23
+ 示例:
24
+
25
+ ```java
26
+ public class TestView extends View implements TVViewActorHost{
27
+
28
+ TVViewActor mTVActor;
29
+
30
+ public TestView(Context context) {
31
+ super(context);
32
+ mTVActor = new TVViewActor(this);
33
+ }
34
+
35
+ @Override
36
+ public TVViewActor getTVActor() {
37
+ return mTVActor;
38
+ }
39
+
40
+ @Override
41
+ protected void onSizeChanged(int w, int h, int oldw, int oldh) {
42
+ super.onSizeChanged(w, h, oldw, oldh);
43
+ mTVActor.onSizeChanged(w, h, oldw, oldh);
44
+ }
45
+
46
+ @Override
47
+ protected void onFocusChanged(boolean gainFocus, int direction, @Nullable Rect previouslyFocusedRect) {
48
+ super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
49
+ mTVActor.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
50
+ }
51
+
52
+ @Override
53
+ public void draw(Canvas canvas) {
54
+ super.draw(canvas);
55
+ mTVActor.draw(canvas);
56
+ }
57
+
58
+ @Override
59
+ protected void drawableStateChanged() {
60
+ super.drawableStateChanged();
61
+ mTVActor.drawableStateChanged();
62
+ }
63
+ }
64
+ ```
65
+
66
+
@@ -0,0 +1,336 @@
1
+ package com.tencent.extend.views;
2
+
3
+ import android.content.res.ColorStateList;
4
+ import android.graphics.Color;
5
+ import android.graphics.drawable.Drawable;
6
+ import android.graphics.drawable.GradientDrawable;
7
+
8
+ import com.tencent.mtt.hippy.common.HippyArray;
9
+ import com.tencent.mtt.hippy.common.HippyMap;
10
+
11
+ import java.util.ArrayList;
12
+ import java.util.List;
13
+
14
+
15
+ public class TemplateUtil {
16
+
17
+ public static ColorStateList createColorStateList(HippyMap map,String mapName){
18
+
19
+
20
+ // val mNormalState = intArrayOf()
21
+ // val mFocusedSate = intArrayOf(R.attr.state_focused, R.attr.state_enabled)
22
+ // val [0][R.attr.state_focused, R.attr.state_enabled] : Color.RED
23
+ // val [1][R.attr.state_selected, R.attr.state_enabled] : Color.GREEN
24
+ // val [1][R.attr.state_selected, R.attr.state_enabled] : Color.GREEN
25
+ if(map != null && map.containsKey(mapName)){
26
+ final HippyMap cm = map.getMap(mapName);
27
+
28
+ final int size = 5;
29
+ int[][] states = new int[size][];
30
+ int[] colors = new int[size];
31
+
32
+ if(cm.containsKey("selected")){
33
+ colors[2] = Color.parseColor(cm.getString("selected"));
34
+ states[2] = new int[]{android.R.attr.state_selected, android.R.attr.state_enabled};
35
+ }
36
+
37
+ if(cm.containsKey("focused")){
38
+ states[0] = new int[]{android.R.attr.state_focused};
39
+ states[1] = new int[]{android.R.attr.state_focused,android.R.attr.state_enabled};
40
+
41
+ final int colorFocused = Color.parseColor(cm.getString("focused"));
42
+ colors[0] = colorFocused;
43
+ colors[1] = colorFocused;
44
+ }
45
+
46
+ if(cm.containsKey("normal")){
47
+ states[3] = new int[]{android.R.attr.state_window_focused};
48
+ states[4] = new int[]{};
49
+ final int colorNormal = Color.parseColor(cm.getString("normal"));
50
+ colors[3] = colorNormal;
51
+ colors[4] = colorNormal;
52
+ }
53
+ return new ColorStateList(states,colors);
54
+ }
55
+ return null;
56
+ }
57
+
58
+ public static ColorStateList createColorStateListByMap(HippyMap cm){
59
+ if(cm == null){
60
+ return null;
61
+ }
62
+ final int size = 5;
63
+ int[][] states = new int[size][];
64
+ int[] colors = new int[size];
65
+
66
+ if(cm.containsKey("selected")){
67
+ colors[2] = Color.parseColor(cm.getString("selected"));
68
+ states[2] = new int[]{android.R.attr.state_selected, android.R.attr.state_enabled};
69
+ }
70
+
71
+ if(cm.containsKey("focused")){
72
+ states[0] = new int[]{android.R.attr.state_focused};
73
+ states[1] = new int[]{android.R.attr.state_focused,android.R.attr.state_enabled};
74
+
75
+ final int colorFocused = Color.parseColor(cm.getString("focused"));
76
+ colors[0] = colorFocused;
77
+ colors[1] = colorFocused;
78
+ }
79
+
80
+ if(cm.containsKey("normal")){
81
+ states[3] = new int[]{android.R.attr.state_window_focused};
82
+ states[4] = new int[]{};
83
+ final int colorNormal = Color.parseColor(cm.getString("normal"));
84
+ colors[3] = colorNormal;
85
+ colors[4] = colorNormal;
86
+ }
87
+ return new ColorStateList(states,colors);
88
+ }
89
+
90
+ public static List<GradientDrawable> createStateListDrawableByMap(HippyMap cm){
91
+ if(cm == null){
92
+ return null;
93
+ }
94
+ List<GradientDrawable> list = new ArrayList<>(2);
95
+ GradientDrawable.Orientation ot = GradientDrawable.Orientation.LEFT_RIGHT;
96
+ if (cm.containsKey("orientation")){
97
+ String orientation = cm.getString("orientation");
98
+ switch (orientation){
99
+ case "TOP_BOTTOM":
100
+ ot = GradientDrawable.Orientation.TOP_BOTTOM;
101
+ break;
102
+ case "TR_BL":
103
+ ot = GradientDrawable.Orientation.TR_BL;
104
+ break;
105
+ case "RIGHT_LEFT":
106
+ ot = GradientDrawable.Orientation.RIGHT_LEFT;
107
+ break;
108
+ case "BR_TL":
109
+ ot = GradientDrawable.Orientation.BR_TL;
110
+ break;case "BOTTOM_TOP":
111
+ ot = GradientDrawable.Orientation.BOTTOM_TOP;
112
+ break;
113
+ case "BL_TR":
114
+ ot = GradientDrawable.Orientation.BL_TR;
115
+ break;
116
+ case "LEFT_RIGHT":
117
+ ot = GradientDrawable.Orientation.LEFT_RIGHT;
118
+ break;
119
+ case "TL_BR":
120
+ ot = GradientDrawable.Orientation.TL_BR;
121
+ break;
122
+ }
123
+ }
124
+
125
+ float[] radius = new float[4];
126
+ if(cm.containsKey("cornerRadius")){
127
+ HippyArray ha = cm.getArray("cornerRadius");
128
+ if (ha != null && ha.size() == 4){
129
+
130
+ for (int i = 0; i < ha.size(); i++) {
131
+ radius[i] = ha.getInt(i);
132
+ }
133
+ }
134
+ }
135
+ int[] colorsNormal = new int[2];
136
+ int[] colorsFocus = new int[2];
137
+ if(cm.containsKey("normal")){
138
+ HippyArray ha = cm.getArray("normal");
139
+ if (ha != null && ha.size()==2){
140
+ for (int i = 0; i < ha.size(); i++) {
141
+ colorsNormal[i] = Color.parseColor(ha.getString(i));
142
+ }
143
+ }
144
+
145
+ }
146
+ if(cm.containsKey("focused")){
147
+ HippyArray ha = cm.getArray("focused");
148
+ if (ha != null && ha.size()==2){
149
+ for (int i = 0; i < ha.size(); i++) {
150
+ colorsFocus[i] = Color.parseColor(ha.getString(i));
151
+ }
152
+ }
153
+ }
154
+
155
+ GradientDrawable gdNormal = new GradientDrawable(ot,colorsNormal);
156
+ GradientDrawable gdFocus = new GradientDrawable(ot,colorsFocus);
157
+
158
+ final float[] radii = new float[]{radius[0],radius[0],radius[1],radius[1],radius[2],radius[2],radius[3],radius[3]};
159
+ gdNormal.setShape(GradientDrawable.RECTANGLE);
160
+ gdNormal.setCornerRadii(radii);
161
+
162
+ gdFocus.setShape(GradientDrawable.RECTANGLE);
163
+ gdFocus.setCornerRadii(radii);
164
+
165
+ list.add(gdNormal);
166
+ list.add(gdFocus);
167
+
168
+ return list;
169
+ }
170
+
171
+ public static List<GradientDrawable> createStateListDrawable(HippyMap map, String mapName){
172
+ if(map != null && map.containsKey(mapName)) {
173
+ final HippyMap cm = map.getMap(mapName);
174
+ List<GradientDrawable> list = new ArrayList<>(2);
175
+ GradientDrawable.Orientation ot = GradientDrawable.Orientation.LEFT_RIGHT;
176
+ if (cm.containsKey("orientation")){
177
+ String orientation = cm.getString("orientation");
178
+ switch (orientation){
179
+ case "TOP_BOTTOM":
180
+ ot = GradientDrawable.Orientation.TOP_BOTTOM;
181
+ break;
182
+ case "TR_BL":
183
+ ot = GradientDrawable.Orientation.TR_BL;
184
+ break;
185
+ case "RIGHT_LEFT":
186
+ ot = GradientDrawable.Orientation.RIGHT_LEFT;
187
+ break;
188
+ case "BR_TL":
189
+ ot = GradientDrawable.Orientation.BR_TL;
190
+ break;case "BOTTOM_TOP":
191
+ ot = GradientDrawable.Orientation.BOTTOM_TOP;
192
+ break;
193
+ case "BL_TR":
194
+ ot = GradientDrawable.Orientation.BL_TR;
195
+ break;
196
+ case "LEFT_RIGHT":
197
+ ot = GradientDrawable.Orientation.LEFT_RIGHT;
198
+ break;
199
+ case "TL_BR":
200
+ ot = GradientDrawable.Orientation.TL_BR;
201
+ break;
202
+ }
203
+ }
204
+
205
+ float[] radius = new float[4];
206
+ if(cm.containsKey("cornerRadius")){
207
+ HippyArray ha = cm.getArray("cornerRadius");
208
+ if (ha != null && ha.size() == 4){
209
+
210
+ for (int i = 0; i < ha.size(); i++) {
211
+ radius[i] = ha.getInt(i);
212
+ }
213
+ }
214
+ }
215
+ int[] colorsNormal = new int[2];
216
+ int[] colorsFocus = new int[2];
217
+ if(cm.containsKey("normal")){
218
+ HippyArray ha = cm.getArray("normal");
219
+ if (ha != null && ha.size()==2){
220
+ for (int i = 0; i < ha.size(); i++) {
221
+ colorsNormal[i] = Color.parseColor(ha.getString(i));
222
+ }
223
+ }
224
+
225
+ }
226
+ if(cm.containsKey("focused")){
227
+ HippyArray ha = cm.getArray("focused");
228
+ if (ha != null && ha.size()==2){
229
+ for (int i = 0; i < ha.size(); i++) {
230
+ colorsFocus[i] = Color.parseColor(ha.getString(i));
231
+ }
232
+ }
233
+ }
234
+
235
+ GradientDrawable gdNormal = new GradientDrawable(ot,colorsNormal);
236
+ GradientDrawable gdFocus = new GradientDrawable(ot,colorsFocus);
237
+
238
+ final float[] radii = new float[]{radius[0],radius[0],radius[1],radius[1],radius[2],radius[2],radius[3],radius[3]};
239
+ gdNormal.setShape(GradientDrawable.RECTANGLE);
240
+ gdNormal.setCornerRadii(radii);
241
+
242
+ gdFocus.setShape(GradientDrawable.RECTANGLE);
243
+ gdFocus.setCornerRadii(radii);
244
+
245
+ list.add(gdNormal);
246
+ list.add(gdFocus);
247
+
248
+ return list;
249
+ }
250
+ return null;
251
+ }
252
+
253
+ public static Drawable createGradientDrawableDrawable(HippyMap map, String mapName){
254
+ if(map != null && map.containsKey(mapName)) {
255
+ final HippyMap cm = map.getMap(mapName);
256
+
257
+ GradientDrawable.Orientation ot = GradientDrawable.Orientation.LEFT_RIGHT;
258
+ if (cm.containsKey("orientation")){
259
+ String orientation = cm.getString("orientation");
260
+ switch (orientation){
261
+ case "TOP_BOTTOM":
262
+ ot = GradientDrawable.Orientation.TOP_BOTTOM;
263
+ break;
264
+ case "TR_BL":
265
+ ot = GradientDrawable.Orientation.TR_BL;
266
+ break;
267
+ case "RIGHT_LEFT":
268
+ ot = GradientDrawable.Orientation.RIGHT_LEFT;
269
+ break;
270
+ case "BR_TL":
271
+ ot = GradientDrawable.Orientation.BR_TL;
272
+ break;case "BOTTOM_TOP":
273
+ ot = GradientDrawable.Orientation.BOTTOM_TOP;
274
+ break;
275
+ case "BL_TR":
276
+ ot = GradientDrawable.Orientation.BL_TR;
277
+ break;
278
+ case "LEFT_RIGHT":
279
+ ot = GradientDrawable.Orientation.LEFT_RIGHT;
280
+ break;
281
+ case "TL_BR":
282
+ ot = GradientDrawable.Orientation.TL_BR;
283
+ break;
284
+ }
285
+ }
286
+
287
+ float[] radius = new float[4];
288
+ if(cm.containsKey("cornerRadius")){
289
+ HippyArray ha = cm.getArray("cornerRadius");
290
+ if (ha != null && ha.size() == 4){
291
+ for (int i = 0; i < ha.size(); i++) {
292
+ radius[i] = ha.getInt(i);
293
+ }
294
+ }
295
+ }
296
+ int[] colorsFocus = new int[2];
297
+
298
+ if(cm.containsKey("color")){
299
+ HippyArray ha = cm.getArray("color");
300
+ if (ha != null && ha.size()==2){
301
+ for (int i = 0; i < ha.size(); i++) {
302
+ colorsFocus[i] = Color.parseColor(ha.getString(i));
303
+ }
304
+ }
305
+ }
306
+ GradientDrawable gdFocus = new GradientDrawable(ot,colorsFocus);
307
+ gdFocus.setShape(GradientDrawable.RECTANGLE);
308
+ gdFocus.setCornerRadii(new float[]{radius[0],radius[0],radius[1],radius[1],radius[2],radius[2],radius[3],radius[3]});
309
+ return gdFocus;
310
+ }
311
+ return null;
312
+ }
313
+
314
+ public static int[] createStateColor(HippyMap map,String name){
315
+ final HippyMap cm = map.getMap(name);
316
+ if(cm != null && cm.size() > 0) {
317
+ int size = 1;
318
+ if(cm.containsKey("focusedColor")){
319
+ size = 2;
320
+ }
321
+ int[] colors = new int[size];
322
+ if(cm.containsKey("normalColor")){
323
+ colors[0] = Color.parseColor(cm.getString("normalColor"));
324
+ }
325
+ if(size == 2){
326
+ colors[1] = Color.parseColor(cm.getString("focusedColor"));
327
+ }
328
+ return colors;
329
+ }else{
330
+ return null;
331
+ }
332
+ }
333
+
334
+
335
+
336
+ }
@@ -0,0 +1,47 @@
1
+ package com.tencent.extend.views;
2
+
3
+ import android.util.Log;
4
+
5
+ import com.tencent.mtt.hippy.common.HippyMap;
6
+ import com.tencent.mtt.hippy.dom.node.StyleNode;
7
+ import com.tencent.mtt.hippy.utils.LogUtils;
8
+
9
+ public class TextButtonNode extends StyleNode {
10
+
11
+ public static final String TAG = "TVButtonTest";
12
+ public TextButtonNode() {
13
+ super();
14
+ }
15
+
16
+ @Override
17
+ public void updateProps(HippyMap props) {
18
+ if(LogUtils.isDebug() && props != null) {
19
+ Log.d(TAG, "updateProps props");
20
+ for(String s : props.keySet()){
21
+ Log.d(TAG, "updateProps prop:"+s+",value:"+props.get(s));
22
+ }
23
+ }
24
+ super.updateProps(props);
25
+ }
26
+
27
+
28
+ @Override
29
+ public boolean shouldUpdateLayout(float x, float y) {
30
+ return super.shouldUpdateLayout(x, y);
31
+ }
32
+
33
+ public int getTextWidth() {
34
+ return (int) (getStyleWidth() - getPadding(0) - getPadding(2));
35
+ }
36
+
37
+ public void setTextWidth(int width) {
38
+ if(LogUtils.isDebug()){
39
+ Log.e(TAG,"setTextWidth width:+"+width+", total width :"+(width + getPadding(0) + getPadding(2)));
40
+ }
41
+ setStyleWidth(width + getPadding(0) + getPadding(2));
42
+ }
43
+
44
+ public int getPaddingWidth() {
45
+ return (int) (getPadding(0) + getPadding(2));
46
+ }
47
+ }