@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,287 @@
1
+ package com.tencent.mtt.hippy.views.videoview;
2
+
3
+
4
+ /*
5
+ * Copyright (C) 2012 The Android Open Source Project
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+
20
+ //To implement APEZProvider in your application, you'll want to change
21
+ //the AUTHORITY to match what you define in the manifest.
22
+
23
+
24
+ import android.content.ContentProvider;
25
+ import android.content.ContentProviderOperation;
26
+ import android.content.ContentProviderResult;
27
+ import android.content.ContentValues;
28
+ import android.content.Context;
29
+ import android.content.OperationApplicationException;
30
+ import android.content.pm.PackageInfo;
31
+ import android.content.pm.PackageManager;
32
+ import android.content.pm.PackageManager.NameNotFoundException;
33
+ import android.content.pm.ProviderInfo;
34
+ import android.content.res.AssetFileDescriptor;
35
+ import android.database.Cursor;
36
+ import android.database.MatrixCursor;
37
+ import android.net.Uri;
38
+ import android.os.ParcelFileDescriptor;
39
+ import android.provider.BaseColumns;
40
+
41
+ import java.io.FileNotFoundException;
42
+ import java.io.IOException;
43
+ import java.util.ArrayList;
44
+
45
+ /**
46
+ * This content provider is an optional part of the library.
47
+ *
48
+ * <p>Most apps don't need to use this class. This defines a
49
+ * ContentProvider that marshalls the data from the ZIP files through a
50
+ * content provider Uri in order to provide file access for certain Android APIs
51
+ * that expect Uri access to media files.
52
+ *
53
+ */
54
+ public abstract class APEZProvider extends ContentProvider {
55
+
56
+ private ZipResourceFile mAPKExtensionFile;
57
+ private boolean mInit;
58
+
59
+ public static final String FILEID = BaseColumns._ID;
60
+ public static final String FILENAME = "ZPFN";
61
+ public static final String ZIPFILE = "ZFIL";
62
+ public static final String MODIFICATION = "ZMOD";
63
+ public static final String CRC32 = "ZCRC";
64
+ public static final String COMPRESSEDLEN = "ZCOL";
65
+ public static final String UNCOMPRESSEDLEN = "ZUNL";
66
+ public static final String COMPRESSIONTYPE = "ZTYP";
67
+
68
+ public static final String[] ALL_FIELDS = {
69
+ FILEID,
70
+ FILENAME,
71
+ ZIPFILE,
72
+ MODIFICATION,
73
+ CRC32,
74
+ COMPRESSEDLEN,
75
+ UNCOMPRESSEDLEN,
76
+ COMPRESSIONTYPE
77
+ };
78
+
79
+ public static final int FILEID_IDX = 0;
80
+ public static final int FILENAME_IDX = 1;
81
+ public static final int ZIPFILE_IDX = 2;
82
+ public static final int MOD_IDX = 3;
83
+ public static final int CRC_IDX = 4;
84
+ public static final int COMPLEN_IDX = 5;
85
+ public static final int UNCOMPLEN_IDX = 6;
86
+ public static final int COMPTYPE_IDX = 7;
87
+
88
+ public static final int[] ALL_FIELDS_INT = {
89
+ FILEID_IDX,
90
+ FILENAME_IDX,
91
+ ZIPFILE_IDX,
92
+ MOD_IDX,
93
+ CRC_IDX,
94
+ COMPLEN_IDX,
95
+ UNCOMPLEN_IDX,
96
+ COMPTYPE_IDX
97
+ };
98
+
99
+ /**
100
+ * This needs to match the authority in your manifest
101
+ */
102
+ public abstract String getAuthority();
103
+
104
+ @Override
105
+ public int delete(Uri arg0, String arg1, String[] arg2) {
106
+ // TODO Auto-generated method stub
107
+ return 0;
108
+ }
109
+
110
+ @Override
111
+ public String getType(Uri uri) {
112
+ return "vnd.android.cursor.item/asset";
113
+ }
114
+
115
+ @Override
116
+ public Uri insert(Uri uri, ContentValues values) {
117
+ // TODO Auto-generated method stub
118
+ return null;
119
+ }
120
+
121
+ static private final String NO_FILE = "N";
122
+
123
+ private boolean initIfNecessary() {
124
+ if ( !mInit ) {
125
+ Context ctx = getContext();
126
+ PackageManager pm = ctx.getPackageManager();
127
+ ProviderInfo pi = pm.resolveContentProvider(getAuthority(), PackageManager.GET_META_DATA);
128
+ PackageInfo packInfo;
129
+ try {
130
+ packInfo = pm.getPackageInfo(ctx.getPackageName(), 0);
131
+ } catch (NameNotFoundException e1) {
132
+ e1.printStackTrace();
133
+ return false;
134
+ }
135
+ int patchFileVersion;
136
+ int mainFileVersion;
137
+ int appVersionCode = packInfo.versionCode;
138
+ String[] resourceFiles = null;
139
+ if ( null != pi.metaData ) {
140
+ mainFileVersion = pi.metaData.getInt("mainVersion", appVersionCode);
141
+ patchFileVersion = pi.metaData.getInt("patchVersion", appVersionCode);
142
+ String mainFileName = pi.metaData.getString("mainFilename", NO_FILE);
143
+ if ( NO_FILE != mainFileName ) {
144
+ String patchFileName = pi.metaData.getString("patchFilename", NO_FILE);
145
+ if ( NO_FILE != patchFileName ) {
146
+ resourceFiles = new String[] { mainFileName, patchFileName };
147
+ } else {
148
+ resourceFiles = new String[] { mainFileName };
149
+ }
150
+ }
151
+ } else {
152
+ mainFileVersion = patchFileVersion = appVersionCode;
153
+ }
154
+ try {
155
+ if ( null == resourceFiles ) {
156
+ mAPKExtensionFile = APKExpansionSupport.getAPKExpansionZipFile(ctx, mainFileVersion, patchFileVersion);
157
+ } else {
158
+ mAPKExtensionFile = APKExpansionSupport.getResourceZipFile(resourceFiles);
159
+ }
160
+ mInit = true;
161
+ return true;
162
+ } catch (IOException e) {
163
+ e.printStackTrace();
164
+ }
165
+ }
166
+ return false;
167
+ }
168
+
169
+ @Override
170
+ public boolean onCreate() {
171
+ return true;
172
+ }
173
+
174
+ @Override
175
+ public AssetFileDescriptor openAssetFile(Uri uri, String mode)
176
+ throws FileNotFoundException {
177
+ initIfNecessary();
178
+ String path = uri.getEncodedPath();
179
+ if ( path.startsWith("/") ) {
180
+ path = path.substring(1);
181
+ }
182
+ return mAPKExtensionFile.getAssetFileDescriptor(path);
183
+ }
184
+
185
+ @Override
186
+ public ContentProviderResult[] applyBatch(
187
+ ArrayList<ContentProviderOperation> operations)
188
+ throws OperationApplicationException {
189
+ initIfNecessary();
190
+ return super.applyBatch(operations);
191
+ }
192
+
193
+ @Override
194
+ public ParcelFileDescriptor openFile(Uri uri, String mode)
195
+ throws FileNotFoundException {
196
+ initIfNecessary();
197
+ AssetFileDescriptor af = openAssetFile(uri, mode);
198
+ if ( null != af ) {
199
+ return af.getParcelFileDescriptor();
200
+ }
201
+ return null;
202
+ }
203
+
204
+ @Override
205
+ public Cursor query(Uri uri, String[] projection, String selection,
206
+ String[] selectionArgs, String sortOrder) {
207
+ initIfNecessary();
208
+ // lists all of the items in the file that match
209
+ ZipResourceFile.ZipEntryRO[] zipEntries;
210
+ if ( null == mAPKExtensionFile ) {
211
+ zipEntries = new ZipResourceFile.ZipEntryRO[0];
212
+ } else {
213
+ zipEntries = mAPKExtensionFile.getAllEntries();
214
+ }
215
+ int[] intProjection;
216
+ if ( null == projection ) {
217
+ intProjection = ALL_FIELDS_INT;
218
+ projection = ALL_FIELDS;
219
+ } else {
220
+ int len = projection.length;
221
+ intProjection = new int[len];
222
+ for ( int i = 0; i < len; i++ ) {
223
+ if ( projection[i].equals(FILEID) ) {
224
+ intProjection[i] = FILEID_IDX;
225
+ } else if ( projection[i].equals(FILENAME) ) {
226
+ intProjection[i] = FILENAME_IDX;
227
+ } else if ( projection[i].equals(ZIPFILE) ) {
228
+ intProjection[i] = ZIPFILE_IDX;
229
+ } else if ( projection[i].equals(MODIFICATION) ) {
230
+ intProjection[i] = MOD_IDX;
231
+ } else if ( projection[i].equals(CRC32) ) {
232
+ intProjection[i] = CRC_IDX;
233
+ } else if ( projection[i].equals(COMPRESSEDLEN) ) {
234
+ intProjection[i] = COMPLEN_IDX;
235
+ } else if ( projection[i].equals(UNCOMPRESSEDLEN) ) {
236
+ intProjection[i] = UNCOMPLEN_IDX;
237
+ } else if ( projection[i].equals(COMPRESSIONTYPE) ) {
238
+ intProjection[i] = COMPTYPE_IDX;
239
+ } else {
240
+ throw new RuntimeException();
241
+ }
242
+ }
243
+ }
244
+ MatrixCursor mc = new MatrixCursor(projection, zipEntries.length);
245
+ int len = intProjection.length;
246
+ for ( ZipResourceFile.ZipEntryRO zer : zipEntries ) {
247
+ MatrixCursor.RowBuilder rb = mc.newRow();
248
+ for ( int i = 0; i < len; i++ ) {
249
+ switch (intProjection[i]) {
250
+ case FILEID_IDX:
251
+ rb.add(i);
252
+ break;
253
+ case FILENAME_IDX:
254
+ rb.add(zer.mFileName);
255
+ break;
256
+ case ZIPFILE_IDX:
257
+ rb.add(zer.getZipFileName());
258
+ break;
259
+ case MOD_IDX:
260
+ rb.add(zer.mWhenModified);
261
+ break;
262
+ case CRC_IDX:
263
+ rb.add(zer.mCRC32);
264
+ break;
265
+ case COMPLEN_IDX:
266
+ rb.add(zer.mCompressedLength);
267
+ break;
268
+ case UNCOMPLEN_IDX:
269
+ rb.add(zer.mUncompressedLength);
270
+ break;
271
+ case COMPTYPE_IDX:
272
+ rb.add(zer.mMethod);
273
+ break;
274
+ }
275
+ }
276
+ }
277
+ return mc;
278
+ }
279
+
280
+ @Override
281
+ public int update(Uri uri, ContentValues values, String selection,
282
+ String[] selectionArgs) {
283
+ // TODO Auto-generated method stub
284
+ return 0;
285
+ }
286
+
287
+ }
@@ -0,0 +1,82 @@
1
+ package com.tencent.mtt.hippy.views.videoview;
2
+
3
+ /*
4
+ * Copyright (C) 2012 The Android Open Source Project
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ import java.io.File;
19
+ import java.io.FileFilter;
20
+ import java.io.IOException;
21
+ import java.util.Vector;
22
+ import java.util.regex.Matcher;
23
+ import java.util.regex.Pattern;
24
+
25
+ import android.content.Context;
26
+ import android.os.Environment;
27
+ import android.util.Log;
28
+
29
+ public class APKExpansionSupport {
30
+ // The shared path to all app expansion files
31
+ private final static String EXP_PATH = "/Android/obb/";
32
+
33
+ static String[] getAPKExpansionFiles(Context ctx, int mainVersion, int patchVersion) {
34
+ String packageName = ctx.getPackageName();
35
+ Vector<String> ret = new Vector<String>();
36
+ if (Environment.getExternalStorageState().equals(
37
+ Environment.MEDIA_MOUNTED)) {
38
+ // Build the full path to the app's expansion files
39
+ File root = Environment.getExternalStorageDirectory();
40
+ File expPath = new File(root.toString() + EXP_PATH + packageName);
41
+
42
+ // Check that expansion file path exists
43
+ if (expPath.exists()) {
44
+ if ( mainVersion > 0 ) {
45
+ String strMainPath = expPath + File.separator + "main." + mainVersion + "." + packageName + ".obb";
46
+ // Log.d("APKEXPANSION", strMainPath);
47
+ File main = new File(strMainPath);
48
+ if ( main.isFile() ) {
49
+ ret.add(strMainPath);
50
+ }
51
+ }
52
+ if ( patchVersion > 0 ) {
53
+ String strPatchPath = expPath + File.separator + "patch." + patchVersion + "." + packageName + ".obb";
54
+ File main = new File(strPatchPath);
55
+ if ( main.isFile() ) {
56
+ ret.add(strPatchPath);
57
+ }
58
+ }
59
+ }
60
+ }
61
+ String[] retArray = new String[ret.size()];
62
+ ret.toArray(retArray);
63
+ return retArray;
64
+ }
65
+
66
+ static public ZipResourceFile getResourceZipFile(String[] expansionFiles) throws IOException {
67
+ ZipResourceFile apkExpansionFile = null;
68
+ for (String expansionFilePath : expansionFiles) {
69
+ if ( null == apkExpansionFile ) {
70
+ apkExpansionFile = new ZipResourceFile(expansionFilePath);
71
+ } else {
72
+ apkExpansionFile.addPatchFile(expansionFilePath);
73
+ }
74
+ }
75
+ return apkExpansionFile;
76
+ }
77
+
78
+ static public ZipResourceFile getAPKExpansionZipFile(Context ctx, int mainVersion, int patchVersion) throws IOException{
79
+ String[] expansionFiles = getAPKExpansionFiles(ctx, mainVersion, patchVersion);
80
+ return getResourceZipFile(expansionFiles);
81
+ }
82
+ }
@@ -0,0 +1,13 @@
1
+ package com.tencent.mtt.hippy.views.videoview;
2
+
3
+ public enum PivotPoint {
4
+ LEFT_TOP,
5
+ LEFT_CENTER,
6
+ LEFT_BOTTOM,
7
+ CENTER_TOP,
8
+ CENTER,
9
+ CENTER_BOTTOM,
10
+ RIGHT_TOP,
11
+ RIGHT_CENTER,
12
+ RIGHT_BOTTOM
13
+ }
@@ -0,0 +1,34 @@
1
+ package com.tencent.mtt.hippy.views.videoview;
2
+
3
+ public enum ScalableType {
4
+ NONE,
5
+
6
+ FIT_XY,
7
+ FIT_START,
8
+ FIT_CENTER,
9
+ FIT_END,
10
+
11
+ LEFT_TOP,
12
+ LEFT_CENTER,
13
+ LEFT_BOTTOM,
14
+ CENTER_TOP,
15
+ CENTER,
16
+ CENTER_BOTTOM,
17
+ RIGHT_TOP,
18
+ RIGHT_CENTER,
19
+ RIGHT_BOTTOM,
20
+
21
+ LEFT_TOP_CROP,
22
+ LEFT_CENTER_CROP,
23
+ LEFT_BOTTOM_CROP,
24
+ CENTER_TOP_CROP,
25
+ CENTER_CROP,
26
+ CENTER_BOTTOM_CROP,
27
+ RIGHT_TOP_CROP,
28
+ RIGHT_CENTER_CROP,
29
+ RIGHT_BOTTOM_CROP,
30
+
31
+ START_INSIDE,
32
+ CENTER_INSIDE,
33
+ END_INSIDE
34
+ }
@@ -0,0 +1,265 @@
1
+ package com.tencent.mtt.hippy.views.videoview;
2
+
3
+ import android.content.Context;
4
+ import android.content.res.AssetFileDescriptor;
5
+ import android.content.res.AssetManager;
6
+ import android.content.res.TypedArray;
7
+ import android.graphics.Matrix;
8
+ import android.graphics.SurfaceTexture;
9
+ import android.media.MediaPlayer;
10
+ import android.net.Uri;
11
+ import android.util.AttributeSet;
12
+ import android.view.Surface;
13
+ import android.view.TextureView;
14
+
15
+ import com.tencent.mtt.hippy.R;
16
+
17
+ import java.io.FileDescriptor;
18
+ import java.io.IOException;
19
+ import java.util.Map;
20
+
21
+ public class ScalableVideoView extends TextureView implements TextureView.SurfaceTextureListener,
22
+ MediaPlayer.OnVideoSizeChangedListener {
23
+
24
+ protected MediaPlayer mMediaPlayer;
25
+ protected ScalableType mScalableType = ScalableType.NONE;
26
+ private String mPosterUri;
27
+
28
+ public ScalableVideoView(Context context) {
29
+ this(context, null);
30
+ }
31
+
32
+ public ScalableVideoView(Context context, AttributeSet attrs) {
33
+ this(context, attrs, 0);
34
+ }
35
+
36
+ public ScalableVideoView(Context context, AttributeSet attrs, int defStyle) {
37
+ super(context, attrs, defStyle);
38
+
39
+ if (attrs == null) {
40
+ return;
41
+ }
42
+
43
+ TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.scaleStyle, 0, 0);
44
+ if (a == null) {
45
+ return;
46
+ }
47
+
48
+ int scaleType = a.getInt(R.styleable.scaleStyle_scalableType, ScalableType.NONE.ordinal());
49
+ a.recycle();
50
+ mScalableType = ScalableType.values()[scaleType];
51
+ }
52
+
53
+ @Override
54
+ public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int width, int height) {
55
+ Surface surface = new Surface(surfaceTexture);
56
+ if (mMediaPlayer != null) {
57
+ mMediaPlayer.setSurface(surface);
58
+ }
59
+
60
+ // if(!TextUtils.isEmpty(mPosterUri)){
61
+ // Canvas canvas = surface.lockHardwareCanvas();
62
+ // Paint paint = new Paint();
63
+ // paint.setColor(Color.RED);
64
+ // canvas.drawText(mPosterUri, 0, 0, paint);
65
+ // surface.unlockCanvasAndPost(canvas);
66
+ // }
67
+ }
68
+
69
+ @Override
70
+ public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
71
+ }
72
+
73
+ @Override
74
+ public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
75
+ return false;
76
+ }
77
+
78
+ @Override
79
+ public void onSurfaceTextureUpdated(SurfaceTexture surface) {
80
+ }
81
+
82
+ @Override
83
+ protected void onDetachedFromWindow() {
84
+ super.onDetachedFromWindow();
85
+ if (mMediaPlayer == null) {
86
+ return;
87
+ }
88
+
89
+ if (isPlaying()) {
90
+ stop();
91
+ }
92
+ release();
93
+ }
94
+
95
+ @Override
96
+ public void onVideoSizeChanged(MediaPlayer mp, int width, int height) {
97
+ scaleVideoSize(width, height);
98
+ }
99
+
100
+ private void scaleVideoSize(int videoWidth, int videoHeight) {
101
+ if (videoWidth == 0 || videoHeight == 0) {
102
+ return;
103
+ }
104
+
105
+ Size viewSize = new Size(getWidth(), getHeight());
106
+ Size videoSize = new Size(videoWidth, videoHeight);
107
+ ScaleManager scaleManager = new ScaleManager(viewSize, videoSize);
108
+ Matrix matrix = scaleManager.getScaleMatrix(mScalableType);
109
+ if (matrix != null) {
110
+ setTransform(matrix);
111
+ }
112
+ }
113
+
114
+ private void initializeMediaPlayer() {
115
+ if (mMediaPlayer == null) {
116
+ mMediaPlayer = new MediaPlayer();
117
+ mMediaPlayer.setOnVideoSizeChangedListener(this);
118
+ setSurfaceTextureListener(this);
119
+ } else {
120
+ reset();
121
+ }
122
+ }
123
+
124
+ public void setRawData( int id) throws IOException {
125
+ AssetFileDescriptor afd = getResources().openRawResourceFd(id);
126
+ setDataSource(afd);
127
+ }
128
+
129
+ public void setAssetData( String assetName) throws IOException {
130
+ AssetManager manager = getContext().getAssets();
131
+ AssetFileDescriptor afd = manager.openFd(assetName);
132
+ setDataSource(afd);
133
+ }
134
+
135
+ private void setDataSource( AssetFileDescriptor afd) throws IOException {
136
+ setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
137
+ afd.close();
138
+ }
139
+
140
+ public void setDataSource( String path) throws IOException {
141
+ initializeMediaPlayer();
142
+ mMediaPlayer.setDataSource(path);
143
+ }
144
+
145
+ public void setDataSource( Context context, Uri uri,
146
+ Map<String, String> headers) throws IOException {
147
+ initializeMediaPlayer();
148
+ mMediaPlayer.setDataSource(context, uri, headers);
149
+ }
150
+
151
+ public void setDataSource( Context context, Uri uri) throws IOException {
152
+ initializeMediaPlayer();
153
+ mMediaPlayer.setDataSource(context, uri);
154
+ }
155
+
156
+ public void setDataSource( FileDescriptor fd, long offset, long length)
157
+ throws IOException {
158
+ initializeMediaPlayer();
159
+ mMediaPlayer.setDataSource(fd, offset, length);
160
+ }
161
+
162
+ public void setDataSource( FileDescriptor fd) throws IOException {
163
+ initializeMediaPlayer();
164
+ mMediaPlayer.setDataSource(fd);
165
+ }
166
+
167
+ public void setScalableType(ScalableType scalableType) {
168
+ mScalableType = scalableType;
169
+ scaleVideoSize(getVideoWidth(), getVideoHeight());
170
+ }
171
+
172
+ public void prepare( MediaPlayer.OnPreparedListener listener)
173
+ throws IOException, IllegalStateException {
174
+ mMediaPlayer.setOnPreparedListener(listener);
175
+ mMediaPlayer.prepare();
176
+ }
177
+
178
+ public void prepareAsync( MediaPlayer.OnPreparedListener listener)
179
+ throws IllegalStateException {
180
+ mMediaPlayer.setOnPreparedListener(listener);
181
+ mMediaPlayer.prepareAsync();
182
+ }
183
+
184
+ public void prepare() throws IOException, IllegalStateException {
185
+ prepare(null);
186
+ }
187
+
188
+ public void prepareAsync() throws IllegalStateException {
189
+ prepareAsync(null);
190
+ }
191
+
192
+ public void setOnErrorListener( MediaPlayer.OnErrorListener listener) {
193
+ mMediaPlayer.setOnErrorListener(listener);
194
+ }
195
+
196
+ public void setOnCompletionListener( MediaPlayer.OnCompletionListener listener) {
197
+ mMediaPlayer.setOnCompletionListener(listener);
198
+ }
199
+
200
+ public void setOnInfoListener( MediaPlayer.OnInfoListener listener) {
201
+ mMediaPlayer.setOnInfoListener(listener);
202
+ }
203
+
204
+ public int getCurrentPosition() {
205
+ return mMediaPlayer.getCurrentPosition();
206
+ }
207
+
208
+ public int getDuration() {
209
+ return mMediaPlayer.getDuration();
210
+ }
211
+
212
+ public int getVideoHeight() {
213
+ return mMediaPlayer.getVideoHeight();
214
+ }
215
+
216
+ public int getVideoWidth() {
217
+ return mMediaPlayer.getVideoWidth();
218
+ }
219
+
220
+ public boolean isLooping() {
221
+ return mMediaPlayer.isLooping();
222
+ }
223
+
224
+ public boolean isPlaying() {
225
+ return mMediaPlayer.isPlaying();
226
+ }
227
+
228
+ public void pause() {
229
+ mMediaPlayer.pause();
230
+ }
231
+
232
+ public void seekTo(int msec) {
233
+ mMediaPlayer.seekTo(msec);
234
+ }
235
+
236
+ public void setLooping(boolean looping) {
237
+ mMediaPlayer.setLooping(looping);
238
+ }
239
+
240
+ public void setVolume(float leftVolume, float rightVolume) {
241
+ mMediaPlayer.setVolume(leftVolume, rightVolume);
242
+ }
243
+
244
+ public void start() {
245
+ mMediaPlayer.start();
246
+ }
247
+
248
+ public void stop() {
249
+ mMediaPlayer.stop();
250
+ }
251
+
252
+ public void reset() {
253
+ mMediaPlayer.reset();
254
+ }
255
+
256
+ public void release() {
257
+ reset();
258
+ mMediaPlayer.release();
259
+ mMediaPlayer = null;
260
+ }
261
+
262
+ public void setPoster(String source) {
263
+ mPosterUri = source;
264
+ }
265
+ }