@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
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
package com.tencent.mtt.hippy.views.videoview;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.view.View;
|
|
5
|
+
|
|
6
|
+
import com.tencent.mtt.hippy.annotation.HippyController;
|
|
7
|
+
import com.tencent.mtt.hippy.annotation.HippyControllerProps;
|
|
8
|
+
import com.tencent.mtt.hippy.common.HippyArray;
|
|
9
|
+
import com.tencent.mtt.hippy.common.HippyMap;
|
|
10
|
+
import com.tencent.mtt.hippy.modules.Promise;
|
|
11
|
+
import com.tencent.mtt.hippy.uimanager.HippyViewController;
|
|
12
|
+
|
|
13
|
+
@HippyController(name = VideoHippyViewController.CLASS_NAME)
|
|
14
|
+
public class VideoHippyViewController extends HippyViewController<VideoHippyView> {
|
|
15
|
+
|
|
16
|
+
public static final String CLASS_NAME = "VideoView_";
|
|
17
|
+
public static final String PROP_SRC = "src";
|
|
18
|
+
public static final String PROP_SRC_URI = "uri";
|
|
19
|
+
public static final String PROP_SRC_TYPE = "type";
|
|
20
|
+
public static final String PROP_SRC_HEADERS = "requestHeaders";
|
|
21
|
+
public static final String PROP_SRC_IS_NETWORK = "isNetwork";
|
|
22
|
+
public static final String PROP_SRC_MAINVER = "mainVer";
|
|
23
|
+
public static final String PROP_SRC_PATCHVER = "patchVer";
|
|
24
|
+
public static final String PROP_SRC_IS_ASSET = "isAsset";
|
|
25
|
+
public static final String PROP_RESIZE_MODE = "resizeMode";
|
|
26
|
+
public static final String PROP_REPEAT = "loop";
|
|
27
|
+
public static final String PROP_PAUSED = "paused";
|
|
28
|
+
public static final String PROP_POSTER = "poster";
|
|
29
|
+
public static final String PROP_AUTOPLAY = "autoPlay";
|
|
30
|
+
public static final String PROP_MUTED = "muted";
|
|
31
|
+
public static final String PROP_VOLUME = "volume";
|
|
32
|
+
public static final String PROP_STEREO_PAN = "stereoPan";
|
|
33
|
+
public static final String PROP_PROGRESS_UPDATE_INTERVAL = "progressUpdateInterval";
|
|
34
|
+
public static final String PROP_SEEK = "seek";
|
|
35
|
+
public static final String PROP_RATE = "rate";
|
|
36
|
+
public static final String PROP_FULLSCREEN = "fullscreen";
|
|
37
|
+
public static final String PROP_PLAY_IN_BACKGROUND = "playInBackground";
|
|
38
|
+
public static final String PROP_CONTROLS = "controls";
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
public static final String OP_PLAY = "play";
|
|
43
|
+
public static final String OP_PAUSE = "pause";
|
|
44
|
+
public static final String OP_RESUME = "resume";
|
|
45
|
+
public static final String OP_SEEKTO = "seek";
|
|
46
|
+
public static final String OP_RESET ="reset";
|
|
47
|
+
public static final String OP_STOP = "stop";
|
|
48
|
+
public static final String OP_RELEASE = "release";
|
|
49
|
+
public static final String OP_PLAY_DELAY = "playDelay";
|
|
50
|
+
public static final String OP_IS_PLAY = "isPlay";
|
|
51
|
+
public static final String OP_PLAY_PAUSE = "playOrPause";
|
|
52
|
+
public static final String OP_SHOW_CONTROLLER = "showController";
|
|
53
|
+
public static final String OP_HIDE_CONTROLLER = "hideController";
|
|
54
|
+
|
|
55
|
+
private int playDelayed = 50;
|
|
56
|
+
|
|
57
|
+
@Override
|
|
58
|
+
protected View createViewImpl(Context context, HippyMap iniProps)
|
|
59
|
+
{
|
|
60
|
+
VideoHippyView view = new VideoHippyView(context);
|
|
61
|
+
return view;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@Override
|
|
65
|
+
protected View createViewImpl(Context context)
|
|
66
|
+
{
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@HippyControllerProps(name = PROP_POSTER)
|
|
71
|
+
public void setPoster(final VideoHippyView videoView, String source){
|
|
72
|
+
videoView.setPoster(source);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@HippyControllerProps(name = PROP_SRC)
|
|
76
|
+
public void setSrc(final VideoHippyView videoView, String source) {
|
|
77
|
+
// int mainVer = 0;
|
|
78
|
+
// int patchVer = 0;
|
|
79
|
+
// if(mainVer<0) { mainVer = 0; }
|
|
80
|
+
// if(patchVer<0) { patchVer = 0; }
|
|
81
|
+
|
|
82
|
+
if(playTask != null){
|
|
83
|
+
videoView.removeCallbacks(playTask);
|
|
84
|
+
}
|
|
85
|
+
playTask = new PlayTask(videoView,source);
|
|
86
|
+
|
|
87
|
+
videoView.postDelayed(playTask,playDelayed);
|
|
88
|
+
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@HippyControllerProps(name = PROP_RESIZE_MODE)
|
|
92
|
+
public void setResizeMode(final VideoHippyView videoView, final String resizeModeOrdinalString) {
|
|
93
|
+
videoView.setResizeModeModifier(ScalableType.values()[Integer.parseInt(resizeModeOrdinalString)]);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@HippyControllerProps(name = PROP_REPEAT,defaultType = HippyControllerProps.BOOLEAN, defaultBoolean = false)
|
|
97
|
+
public void setRepeat(final VideoHippyView videoView, final boolean repeat) {
|
|
98
|
+
videoView.setRepeatModifier(repeat);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@HippyControllerProps(name = PROP_PAUSED,defaultType = HippyControllerProps.BOOLEAN, defaultBoolean = false)
|
|
102
|
+
public void setPaused(final VideoHippyView videoView, final boolean paused) {
|
|
103
|
+
videoView.setPausedModifier(paused);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@HippyControllerProps(name = PROP_MUTED,defaultType = HippyControllerProps.BOOLEAN, defaultBoolean = false)
|
|
107
|
+
public void setMuted(final VideoHippyView videoView, final boolean muted) {
|
|
108
|
+
videoView.setMutedModifier(muted);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
@HippyControllerProps(name = PROP_VOLUME,defaultType = HippyControllerProps.NUMBER,defaultNumber = 1.0f)
|
|
112
|
+
public void setVolume(final VideoHippyView videoView, final float volume) {
|
|
113
|
+
videoView.setVolumeModifier(volume);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@HippyControllerProps(name = PROP_STEREO_PAN)
|
|
117
|
+
public void setStereoPan(final VideoHippyView videoView, final float stereoPan) {
|
|
118
|
+
videoView.setStereoPan(stereoPan);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
@HippyControllerProps(name = PROP_PROGRESS_UPDATE_INTERVAL,defaultType = HippyControllerProps.NUMBER, defaultNumber = 250.0f)
|
|
122
|
+
public void setProgressUpdateInterval(final VideoHippyView videoView, final float progressUpdateInterval) {
|
|
123
|
+
videoView.setProgressUpdateInterval(progressUpdateInterval);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@HippyControllerProps(name = PROP_SEEK)
|
|
127
|
+
public void setSeek(final VideoHippyView videoView, final float seek) {
|
|
128
|
+
videoView.seekTo(Math.round(seek * 1000.0f));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
@HippyControllerProps(name = PROP_RATE,defaultType = HippyControllerProps.NUMBER,defaultNumber = 0.0f)
|
|
132
|
+
public void setRate(final VideoHippyView videoView, final float rate) {
|
|
133
|
+
videoView.setRateModifier(rate);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
@HippyControllerProps(name = PROP_FULLSCREEN,defaultType = HippyControllerProps.BOOLEAN, defaultBoolean = false)
|
|
137
|
+
public void setFullscreen(final VideoHippyView videoView, final boolean fullscreen) {
|
|
138
|
+
videoView.setFullscreen(fullscreen);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
@HippyControllerProps(name = PROP_PLAY_IN_BACKGROUND,defaultType = HippyControllerProps.BOOLEAN, defaultBoolean = false)
|
|
142
|
+
public void setPlayInBackground(final VideoHippyView videoView, final boolean playInBackground) {
|
|
143
|
+
videoView.setPlayInBackground(playInBackground);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@HippyControllerProps(name = PROP_CONTROLS,defaultType = HippyControllerProps.BOOLEAN, defaultBoolean = false)
|
|
147
|
+
public void setControls(final VideoHippyView videoView, final boolean controls) {
|
|
148
|
+
// NOT SUPPORT Yet
|
|
149
|
+
videoView.setControls(controls);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@HippyControllerProps(name = PROP_AUTOPLAY,defaultType = HippyControllerProps.BOOLEAN, defaultBoolean = false)
|
|
153
|
+
public void setAutoPlay(final VideoHippyView videoView, final boolean autoPlay) {
|
|
154
|
+
videoView.setAutoPlay(autoPlay);
|
|
155
|
+
}
|
|
156
|
+
@Override
|
|
157
|
+
public void dispatchFunction(final VideoHippyView view, String functionName, HippyArray var, Promise promise)
|
|
158
|
+
{
|
|
159
|
+
switch (functionName)
|
|
160
|
+
{
|
|
161
|
+
case OP_PLAY:
|
|
162
|
+
view.applyModifiers(false);
|
|
163
|
+
break;
|
|
164
|
+
case OP_PAUSE:
|
|
165
|
+
view.pause();
|
|
166
|
+
break;
|
|
167
|
+
case OP_RESUME:
|
|
168
|
+
view.start();
|
|
169
|
+
break;
|
|
170
|
+
case OP_STOP:
|
|
171
|
+
view.stop();
|
|
172
|
+
break;
|
|
173
|
+
case OP_RELEASE:
|
|
174
|
+
view.release();
|
|
175
|
+
break;
|
|
176
|
+
case OP_SEEKTO:
|
|
177
|
+
view.seekTo(var.getInt(0));
|
|
178
|
+
break;
|
|
179
|
+
case OP_RESET:
|
|
180
|
+
view.reset();
|
|
181
|
+
break;
|
|
182
|
+
case OP_IS_PLAY:
|
|
183
|
+
if(promise != null) {
|
|
184
|
+
promise.resolve(view.isPlaying());
|
|
185
|
+
}
|
|
186
|
+
break;
|
|
187
|
+
case OP_PLAY_PAUSE:
|
|
188
|
+
if (view.isPlaying()) {
|
|
189
|
+
view.pause();
|
|
190
|
+
}else{
|
|
191
|
+
view.start();
|
|
192
|
+
}
|
|
193
|
+
break;
|
|
194
|
+
case OP_SHOW_CONTROLLER:
|
|
195
|
+
view.setControlVisible(true);
|
|
196
|
+
break;
|
|
197
|
+
case OP_HIDE_CONTROLLER:
|
|
198
|
+
view.setControlVisible(false);
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/***zhaopeng add*/
|
|
204
|
+
private static class PlayTask implements Runnable{
|
|
205
|
+
|
|
206
|
+
final VideoHippyView videoView;
|
|
207
|
+
final String source ;
|
|
208
|
+
|
|
209
|
+
private PlayTask(VideoHippyView videoView, String source) {
|
|
210
|
+
this.videoView = videoView;
|
|
211
|
+
this.source = source;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
@Override
|
|
215
|
+
public void run() {
|
|
216
|
+
videoView.setSrc(
|
|
217
|
+
source,
|
|
218
|
+
"mp4",
|
|
219
|
+
true,
|
|
220
|
+
false,
|
|
221
|
+
new HippyMap(),
|
|
222
|
+
0,
|
|
223
|
+
0
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
private Runnable playTask;
|
|
229
|
+
|
|
230
|
+
@HippyControllerProps(name = OP_PLAY_DELAY,defaultType = HippyControllerProps.NUMBER, defaultNumber = 300)
|
|
231
|
+
public void setPlayDelay(final VideoHippyView videoView, final int delay) {
|
|
232
|
+
this.playDelayed = delay;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
}
|
|
236
|
+
|
|
@@ -0,0 +1,427 @@
|
|
|
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
|
+
|
|
19
|
+
import android.content.res.AssetFileDescriptor;
|
|
20
|
+
import android.os.ParcelFileDescriptor;
|
|
21
|
+
import android.util.Log;
|
|
22
|
+
|
|
23
|
+
import java.io.File;
|
|
24
|
+
import java.io.FileNotFoundException;
|
|
25
|
+
import java.io.IOException;
|
|
26
|
+
import java.io.InputStream;
|
|
27
|
+
import java.io.RandomAccessFile;
|
|
28
|
+
import java.nio.ByteBuffer;
|
|
29
|
+
import java.nio.ByteOrder;
|
|
30
|
+
import java.nio.MappedByteBuffer;
|
|
31
|
+
import java.nio.channels.FileChannel;
|
|
32
|
+
import java.util.Collection;
|
|
33
|
+
import java.util.HashMap;
|
|
34
|
+
import java.util.Vector;
|
|
35
|
+
import java.util.zip.ZipEntry;
|
|
36
|
+
import java.util.zip.ZipFile;
|
|
37
|
+
|
|
38
|
+
public class ZipResourceFile {
|
|
39
|
+
|
|
40
|
+
//
|
|
41
|
+
// Read-only access to Zip archives, with minimal heap allocation.
|
|
42
|
+
//
|
|
43
|
+
static final String LOG_TAG = "zipro";
|
|
44
|
+
static final boolean LOGV = false;
|
|
45
|
+
|
|
46
|
+
// 4-byte number
|
|
47
|
+
static private int swapEndian(int i)
|
|
48
|
+
{
|
|
49
|
+
return ((i & 0xff) << 24) + ((i & 0xff00) << 8) + ((i & 0xff0000) >>> 8)
|
|
50
|
+
+ ((i >>> 24) & 0xff);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// 2-byte number
|
|
54
|
+
static private int swapEndian(short i)
|
|
55
|
+
{
|
|
56
|
+
return ((i & 0x00FF) << 8 | (i & 0xFF00) >>> 8);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/*
|
|
60
|
+
* Zip file constants.
|
|
61
|
+
*/
|
|
62
|
+
static final int kEOCDSignature = 0x06054b50;
|
|
63
|
+
static final int kEOCDLen = 22;
|
|
64
|
+
static final int kEOCDNumEntries = 8; // offset to #of entries in file
|
|
65
|
+
static final int kEOCDSize = 12; // size of the central directory
|
|
66
|
+
static final int kEOCDFileOffset = 16; // offset to central directory
|
|
67
|
+
|
|
68
|
+
static final int kMaxCommentLen = 65535; // longest possible in ushort
|
|
69
|
+
static final int kMaxEOCDSearch = (kMaxCommentLen + kEOCDLen);
|
|
70
|
+
|
|
71
|
+
static final int kLFHSignature = 0x04034b50;
|
|
72
|
+
static final int kLFHLen = 30; // excluding variable-len fields
|
|
73
|
+
static final int kLFHNameLen = 26; // offset to filename length
|
|
74
|
+
static final int kLFHExtraLen = 28; // offset to extra length
|
|
75
|
+
|
|
76
|
+
static final int kCDESignature = 0x02014b50;
|
|
77
|
+
static final int kCDELen = 46; // excluding variable-len fields
|
|
78
|
+
static final int kCDEMethod = 10; // offset to compression method
|
|
79
|
+
static final int kCDEModWhen = 12; // offset to modification timestamp
|
|
80
|
+
static final int kCDECRC = 16; // offset to entry CRC
|
|
81
|
+
static final int kCDECompLen = 20; // offset to compressed length
|
|
82
|
+
static final int kCDEUncompLen = 24; // offset to uncompressed length
|
|
83
|
+
static final int kCDENameLen = 28; // offset to filename length
|
|
84
|
+
static final int kCDEExtraLen = 30; // offset to extra length
|
|
85
|
+
static final int kCDECommentLen = 32; // offset to comment length
|
|
86
|
+
static final int kCDELocalOffset = 42; // offset to local hdr
|
|
87
|
+
|
|
88
|
+
static final int kCompressStored = 0; // no compression
|
|
89
|
+
static final int kCompressDeflated = 8; // standard deflate
|
|
90
|
+
|
|
91
|
+
/*
|
|
92
|
+
* The values we return for ZipEntryRO use 0 as an invalid value, so we want
|
|
93
|
+
* to adjust the hash table index by a fixed amount. Using a large value
|
|
94
|
+
* helps insure that people don't mix & match arguments, e.g. to
|
|
95
|
+
* findEntryByIndex().
|
|
96
|
+
*/
|
|
97
|
+
static final int kZipEntryAdj = 10000;
|
|
98
|
+
|
|
99
|
+
static public final class ZipEntryRO {
|
|
100
|
+
public ZipEntryRO(final String zipFileName, final File file, final String fileName) {
|
|
101
|
+
mFileName = fileName;
|
|
102
|
+
mZipFileName = zipFileName;
|
|
103
|
+
mFile = file;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
public final File mFile;
|
|
107
|
+
public final String mFileName;
|
|
108
|
+
public final String mZipFileName;
|
|
109
|
+
public long mLocalHdrOffset; // offset of local file header
|
|
110
|
+
|
|
111
|
+
/* useful stuff from the directory entry */
|
|
112
|
+
public int mMethod;
|
|
113
|
+
public long mWhenModified;
|
|
114
|
+
public long mCRC32;
|
|
115
|
+
public long mCompressedLength;
|
|
116
|
+
public long mUncompressedLength;
|
|
117
|
+
|
|
118
|
+
public long mOffset = -1;
|
|
119
|
+
|
|
120
|
+
public void setOffsetFromFile(RandomAccessFile f, ByteBuffer buf) throws IOException {
|
|
121
|
+
long localHdrOffset = mLocalHdrOffset;
|
|
122
|
+
try {
|
|
123
|
+
f.seek(localHdrOffset);
|
|
124
|
+
f.readFully(buf.array());
|
|
125
|
+
if (buf.getInt(0) != kLFHSignature) {
|
|
126
|
+
Log.w(LOG_TAG, "didn't find signature at start of lfh");
|
|
127
|
+
throw new IOException();
|
|
128
|
+
}
|
|
129
|
+
int nameLen = buf.getShort(kLFHNameLen) & 0xFFFF;
|
|
130
|
+
int extraLen = buf.getShort(kLFHExtraLen) & 0xFFFF;
|
|
131
|
+
mOffset = localHdrOffset + kLFHLen + nameLen + extraLen;
|
|
132
|
+
} catch (FileNotFoundException e) {
|
|
133
|
+
e.printStackTrace();
|
|
134
|
+
} catch (IOException ioe) {
|
|
135
|
+
ioe.printStackTrace();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Calculates the offset of the start of the Zip file entry within the
|
|
141
|
+
* Zip file.
|
|
142
|
+
*
|
|
143
|
+
* @return the offset, in bytes from the start of the file of the entry
|
|
144
|
+
*/
|
|
145
|
+
public long getOffset() {
|
|
146
|
+
return mOffset;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* isUncompressed
|
|
151
|
+
*
|
|
152
|
+
* @return true if the file is stored in uncompressed form
|
|
153
|
+
*/
|
|
154
|
+
public boolean isUncompressed() {
|
|
155
|
+
return mMethod == kCompressStored;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
public AssetFileDescriptor getAssetFileDescriptor() {
|
|
159
|
+
if (mMethod == kCompressStored) {
|
|
160
|
+
ParcelFileDescriptor pfd;
|
|
161
|
+
try {
|
|
162
|
+
pfd = ParcelFileDescriptor.open(mFile, ParcelFileDescriptor.MODE_READ_ONLY);
|
|
163
|
+
return new AssetFileDescriptor(pfd, getOffset(), mUncompressedLength);
|
|
164
|
+
} catch (FileNotFoundException e) {
|
|
165
|
+
// TODO Auto-generated catch block
|
|
166
|
+
e.printStackTrace();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
public String getZipFileName() {
|
|
173
|
+
return mZipFileName;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
public File getZipFile() {
|
|
177
|
+
return mFile;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
private final HashMap<String, ZipEntryRO> mHashMap = new HashMap<String, ZipEntryRO>();
|
|
183
|
+
|
|
184
|
+
/* for reading compressed files */
|
|
185
|
+
public HashMap<File, ZipFile> mZipFiles = new HashMap<File, ZipFile>();
|
|
186
|
+
|
|
187
|
+
public ZipResourceFile(String zipFileName) throws IOException {
|
|
188
|
+
addPatchFile(zipFileName);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
ZipEntryRO[] getEntriesAt(String path) {
|
|
192
|
+
Vector<ZipEntryRO> zev = new Vector<ZipEntryRO>();
|
|
193
|
+
Collection<ZipEntryRO> values = mHashMap.values();
|
|
194
|
+
if (null == path)
|
|
195
|
+
path = "";
|
|
196
|
+
int length = path.length();
|
|
197
|
+
for (ZipEntryRO ze : values) {
|
|
198
|
+
if (ze.mFileName.startsWith(path)) {
|
|
199
|
+
if (-1 == ze.mFileName.indexOf('/', length)) {
|
|
200
|
+
zev.add(ze);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
ZipEntryRO[] entries = new ZipEntryRO[zev.size()];
|
|
205
|
+
return zev.toArray(entries);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
public ZipEntryRO[] getAllEntries() {
|
|
209
|
+
Collection<ZipEntryRO> values = mHashMap.values();
|
|
210
|
+
return values.toArray(new ZipEntryRO[values.size()]);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* getAssetFileDescriptor allows for ZipResourceFile to directly feed
|
|
215
|
+
* Android API's that want an fd, offset, and length such as the
|
|
216
|
+
* MediaPlayer. It also allows for the class to be used in a content
|
|
217
|
+
* provider that can feed video players. The file must be stored
|
|
218
|
+
* (non-compressed) in the Zip file for this to work.
|
|
219
|
+
*
|
|
220
|
+
* @param assetPath
|
|
221
|
+
* @return the asset file descriptor for the file, or null if the file isn't
|
|
222
|
+
* present or is stored compressed
|
|
223
|
+
*/
|
|
224
|
+
public AssetFileDescriptor getAssetFileDescriptor(String assetPath) {
|
|
225
|
+
ZipEntryRO entry = mHashMap.get(assetPath);
|
|
226
|
+
if (null != entry) {
|
|
227
|
+
return entry.getAssetFileDescriptor();
|
|
228
|
+
}
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* getInputStream returns an AssetFileDescriptor.AutoCloseInputStream
|
|
234
|
+
* associated with the asset that is contained in the Zip file, or a
|
|
235
|
+
* standard ZipInputStream if necessary to uncompress the file
|
|
236
|
+
*
|
|
237
|
+
* @param assetPath
|
|
238
|
+
* @return an input stream for the named asset path, or null if not found
|
|
239
|
+
* @throws IOException
|
|
240
|
+
*/
|
|
241
|
+
public InputStream getInputStream(String assetPath) throws IOException {
|
|
242
|
+
ZipEntryRO entry = mHashMap.get(assetPath);
|
|
243
|
+
if (null != entry) {
|
|
244
|
+
if (entry.isUncompressed()) {
|
|
245
|
+
return entry.getAssetFileDescriptor().createInputStream();
|
|
246
|
+
} else {
|
|
247
|
+
ZipFile zf = mZipFiles.get(entry.getZipFile());
|
|
248
|
+
/** read compressed files **/
|
|
249
|
+
if (null == zf) {
|
|
250
|
+
zf = new ZipFile(entry.getZipFile(), ZipFile.OPEN_READ);
|
|
251
|
+
mZipFiles.put(entry.getZipFile(), zf);
|
|
252
|
+
}
|
|
253
|
+
ZipEntry zi = zf.getEntry(assetPath);
|
|
254
|
+
if (null != zi)
|
|
255
|
+
return zf.getInputStream(zi);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return null;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
ByteBuffer mLEByteBuffer = ByteBuffer.allocate(4);
|
|
262
|
+
|
|
263
|
+
static private int read4LE(RandomAccessFile f) throws IOException {
|
|
264
|
+
return swapEndian(f.readInt());
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/*
|
|
268
|
+
* Opens the specified file read-only. We memory-map the entire thing and
|
|
269
|
+
* close the file before returning.
|
|
270
|
+
*/
|
|
271
|
+
void addPatchFile(String zipFileName) throws IOException
|
|
272
|
+
{
|
|
273
|
+
File file = new File(zipFileName);
|
|
274
|
+
RandomAccessFile f = new RandomAccessFile(file, "r");
|
|
275
|
+
long fileLength = f.length();
|
|
276
|
+
|
|
277
|
+
if (fileLength < kEOCDLen) {
|
|
278
|
+
throw new java.io.IOException();
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
long readAmount = kMaxEOCDSearch;
|
|
282
|
+
if (readAmount > fileLength)
|
|
283
|
+
readAmount = fileLength;
|
|
284
|
+
|
|
285
|
+
/*
|
|
286
|
+
* Make sure this is a Zip archive.
|
|
287
|
+
*/
|
|
288
|
+
f.seek(0);
|
|
289
|
+
|
|
290
|
+
int header = read4LE(f);
|
|
291
|
+
if (header == kEOCDSignature) {
|
|
292
|
+
Log.i(LOG_TAG, "Found Zip archive, but it looks empty");
|
|
293
|
+
throw new IOException();
|
|
294
|
+
} else if (header != kLFHSignature) {
|
|
295
|
+
Log.v(LOG_TAG, "Not a Zip archive");
|
|
296
|
+
throw new IOException();
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/*
|
|
300
|
+
* Perform the traditional EOCD snipe hunt. We're searching for the End
|
|
301
|
+
* of Central Directory magic number, which appears at the start of the
|
|
302
|
+
* EOCD block. It's followed by 18 bytes of EOCD stuff and up to 64KB of
|
|
303
|
+
* archive comment. We need to read the last part of the file into a
|
|
304
|
+
* buffer, dig through it to find the magic number, parse some values
|
|
305
|
+
* out, and use those to determine the extent of the CD. We start by
|
|
306
|
+
* pulling in the last part of the file.
|
|
307
|
+
*/
|
|
308
|
+
long searchStart = fileLength - readAmount;
|
|
309
|
+
|
|
310
|
+
f.seek(searchStart);
|
|
311
|
+
ByteBuffer bbuf = ByteBuffer.allocate((int) readAmount);
|
|
312
|
+
byte[] buffer = bbuf.array();
|
|
313
|
+
f.readFully(buffer);
|
|
314
|
+
bbuf.order(ByteOrder.LITTLE_ENDIAN);
|
|
315
|
+
|
|
316
|
+
/*
|
|
317
|
+
* Scan backward for the EOCD magic. In an archive without a trailing
|
|
318
|
+
* comment, we'll find it on the first try. (We may want to consider
|
|
319
|
+
* doing an initial minimal read; if we don't find it, retry with a
|
|
320
|
+
* second read as above.)
|
|
321
|
+
*/
|
|
322
|
+
|
|
323
|
+
// EOCD == 0x50, 0x4b, 0x05, 0x06
|
|
324
|
+
int eocdIdx;
|
|
325
|
+
for (eocdIdx = buffer.length - kEOCDLen; eocdIdx >= 0; eocdIdx--) {
|
|
326
|
+
if (buffer[eocdIdx] == 0x50 && bbuf.getInt(eocdIdx) == kEOCDSignature)
|
|
327
|
+
{
|
|
328
|
+
if (LOGV) {
|
|
329
|
+
Log.v(LOG_TAG, "+++ Found EOCD at index: " + eocdIdx);
|
|
330
|
+
}
|
|
331
|
+
break;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
if (eocdIdx < 0) {
|
|
336
|
+
Log.d(LOG_TAG, "Zip: EOCD not found, " + zipFileName + " is not zip");
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/*
|
|
340
|
+
* Grab the CD offset and size, and the number of entries in the
|
|
341
|
+
* archive. After that, we can release our EOCD hunt buffer.
|
|
342
|
+
*/
|
|
343
|
+
|
|
344
|
+
int numEntries = bbuf.getShort(eocdIdx + kEOCDNumEntries);
|
|
345
|
+
long dirSize = bbuf.getInt(eocdIdx + kEOCDSize) & 0xffffffffL;
|
|
346
|
+
long dirOffset = bbuf.getInt(eocdIdx + kEOCDFileOffset) & 0xffffffffL;
|
|
347
|
+
|
|
348
|
+
// Verify that they look reasonable.
|
|
349
|
+
if (dirOffset + dirSize > fileLength) {
|
|
350
|
+
Log.w(LOG_TAG, "bad offsets (dir " + dirOffset + ", size " + dirSize + ", eocd "
|
|
351
|
+
+ eocdIdx + ")");
|
|
352
|
+
throw new IOException();
|
|
353
|
+
}
|
|
354
|
+
if (numEntries == 0) {
|
|
355
|
+
Log.w(LOG_TAG, "empty archive?");
|
|
356
|
+
throw new IOException();
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
if (LOGV) {
|
|
360
|
+
Log.v(LOG_TAG, "+++ numEntries=" + numEntries + " dirSize=" + dirSize + " dirOffset="
|
|
361
|
+
+ dirOffset);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
MappedByteBuffer directoryMap = f.getChannel()
|
|
365
|
+
.map(FileChannel.MapMode.READ_ONLY, dirOffset, dirSize);
|
|
366
|
+
directoryMap.order(ByteOrder.LITTLE_ENDIAN);
|
|
367
|
+
|
|
368
|
+
byte[] tempBuf = new byte[0xffff];
|
|
369
|
+
|
|
370
|
+
/*
|
|
371
|
+
* Walk through the central directory, adding entries to the hash table.
|
|
372
|
+
*/
|
|
373
|
+
|
|
374
|
+
int currentOffset = 0;
|
|
375
|
+
|
|
376
|
+
/*
|
|
377
|
+
* Allocate the local directory information
|
|
378
|
+
*/
|
|
379
|
+
ByteBuffer buf = ByteBuffer.allocate(kLFHLen);
|
|
380
|
+
buf.order(ByteOrder.LITTLE_ENDIAN);
|
|
381
|
+
|
|
382
|
+
for (int i = 0; i < numEntries; i++) {
|
|
383
|
+
if (directoryMap.getInt(currentOffset) != kCDESignature) {
|
|
384
|
+
Log.w(LOG_TAG, "Missed a central dir sig (at " + currentOffset + ")");
|
|
385
|
+
throw new IOException();
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/* useful stuff from the directory entry */
|
|
389
|
+
int fileNameLen = directoryMap.getShort(currentOffset + kCDENameLen) & 0xffff;
|
|
390
|
+
int extraLen = directoryMap.getShort(currentOffset + kCDEExtraLen) & 0xffff;
|
|
391
|
+
int commentLen = directoryMap.getShort(currentOffset + kCDECommentLen) & 0xffff;
|
|
392
|
+
|
|
393
|
+
/* get the CDE filename */
|
|
394
|
+
|
|
395
|
+
directoryMap.position(currentOffset + kCDELen);
|
|
396
|
+
directoryMap.get(tempBuf, 0, fileNameLen);
|
|
397
|
+
directoryMap.position(0);
|
|
398
|
+
|
|
399
|
+
/* UTF-8 on Android */
|
|
400
|
+
String str = new String(tempBuf, 0, fileNameLen);
|
|
401
|
+
if (LOGV) {
|
|
402
|
+
Log.v(LOG_TAG, "Filename: " + str);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
ZipEntryRO ze = new ZipEntryRO(zipFileName, file, str);
|
|
406
|
+
ze.mMethod = directoryMap.getShort(currentOffset + kCDEMethod) & 0xffff;
|
|
407
|
+
ze.mWhenModified = directoryMap.getInt(currentOffset + kCDEModWhen) & 0xffffffffL;
|
|
408
|
+
ze.mCRC32 = directoryMap.getLong(currentOffset + kCDECRC) & 0xffffffffL;
|
|
409
|
+
ze.mCompressedLength = directoryMap.getLong(currentOffset + kCDECompLen) & 0xffffffffL;
|
|
410
|
+
ze.mUncompressedLength = directoryMap.getLong(currentOffset + kCDEUncompLen) & 0xffffffffL;
|
|
411
|
+
ze.mLocalHdrOffset = directoryMap.getInt(currentOffset + kCDELocalOffset) & 0xffffffffL;
|
|
412
|
+
|
|
413
|
+
// set the offsets
|
|
414
|
+
buf.clear();
|
|
415
|
+
ze.setOffsetFromFile(f, buf);
|
|
416
|
+
|
|
417
|
+
// put file into hash
|
|
418
|
+
mHashMap.put(str, ze);
|
|
419
|
+
|
|
420
|
+
// go to next directory entry
|
|
421
|
+
currentOffset += kCDELen + fileNameLen + extraLen + commentLen;
|
|
422
|
+
}
|
|
423
|
+
if (LOGV) {
|
|
424
|
+
Log.v(LOG_TAG, "+++ zip good scan " + numEntries + " entries");
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
package com.tencent.mtt.hippy.views.view;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.util.Log;
|
|
5
|
+
|
|
6
|
+
import com.tencent.extend.pm.WindowNode;
|
|
7
|
+
import com.tencent.mtt.hippy.R;
|
|
8
|
+
import com.tencent.mtt.hippy.uimanager.ExtendViewGroup;
|
|
9
|
+
import com.tencent.mtt.hippy.utils.ExtendUtil;
|
|
10
|
+
import com.tencent.mtt.hippy.utils.LogUtils;
|
|
11
|
+
|
|
12
|
+
public class CardRootView extends HippyViewGroup{
|
|
13
|
+
|
|
14
|
+
public CardRootView(Context context) {
|
|
15
|
+
super(context);
|
|
16
|
+
|
|
17
|
+
if(LogUtils.isDebug()) {
|
|
18
|
+
Log.i(WindowNode.TAG, "CardRootView crate:"+ ExtendUtil.debugViewLite(this));
|
|
19
|
+
}
|
|
20
|
+
//setAsRootView();
|
|
21
|
+
// setAsRootView();
|
|
22
|
+
|
|
23
|
+
setTag(R.id.card_root_view, ExtendViewGroup.ROOT_TAG);
|
|
24
|
+
setUseAdvancedFocusSearch(true);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
}
|