@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,15 @@
|
|
|
1
|
+
package com.tencent.mtt.hippy.views.list;
|
|
2
|
+
|
|
3
|
+
import com.tencent.extend.views.fastlist.ListViewControlProp;
|
|
4
|
+
|
|
5
|
+
public interface TVSingleLineListView {
|
|
6
|
+
|
|
7
|
+
void setBlockFocusOn(int[] focus);
|
|
8
|
+
|
|
9
|
+
void setBlockFocusOnFail(int[] directions);
|
|
10
|
+
|
|
11
|
+
ListViewControlProp getControlProps();
|
|
12
|
+
|
|
13
|
+
void diffSetScrollToPosition(int position, int offset);
|
|
14
|
+
|
|
15
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/* Tencent is pleased to support the open source community by making Hippy available.
|
|
2
|
+
* Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
package com.tencent.mtt.hippy.views.modal;
|
|
17
|
+
|
|
18
|
+
import android.content.Context;
|
|
19
|
+
import android.content.DialogInterface;
|
|
20
|
+
import android.view.View;
|
|
21
|
+
|
|
22
|
+
import com.tencent.mtt.hippy.annotation.HippyController;
|
|
23
|
+
import com.tencent.mtt.hippy.annotation.HippyControllerProps;
|
|
24
|
+
import com.tencent.mtt.hippy.dom.node.StyleNode;
|
|
25
|
+
import com.tencent.mtt.hippy.uimanager.HippyGroupController;
|
|
26
|
+
|
|
27
|
+
@SuppressWarnings("unused")
|
|
28
|
+
@HippyController(name = HippyModalHostManager.HIPPY_CLASS)
|
|
29
|
+
public class HippyModalHostManager extends HippyGroupController<HippyModalHostView> {
|
|
30
|
+
|
|
31
|
+
public static final String HIPPY_CLASS = "Modal";
|
|
32
|
+
|
|
33
|
+
@Override
|
|
34
|
+
protected View createViewImpl(Context context) {
|
|
35
|
+
final HippyModalHostView hippyModalHostView = createModalHostView(context);
|
|
36
|
+
|
|
37
|
+
hippyModalHostView.setOnRequestCloseListener(new HippyModalHostView.OnRequestCloseListener() {
|
|
38
|
+
@Override
|
|
39
|
+
public void onRequestClose(DialogInterface dialog) {
|
|
40
|
+
new RequestCloseEvent().send(hippyModalHostView, null);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
hippyModalHostView.setOnShowListener(new DialogInterface.OnShowListener() {
|
|
44
|
+
@Override
|
|
45
|
+
public void onShow(DialogInterface dialog) {
|
|
46
|
+
new ShowEvent().send(hippyModalHostView, null);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return hippyModalHostView;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
protected HippyModalHostView createModalHostView(Context context) {
|
|
53
|
+
return new HippyModalHostView(context);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@Override
|
|
57
|
+
protected StyleNode createNode(boolean isVirtual) {
|
|
58
|
+
return new ModalStyleNode();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@Override
|
|
62
|
+
public void onViewDestroy(HippyModalHostView hippyModalHostView) {
|
|
63
|
+
super.onViewDestroy(hippyModalHostView);
|
|
64
|
+
hippyModalHostView.onInstanceDestroy(hippyModalHostView.getId());
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@HippyControllerProps(name = "animationType", defaultType = HippyControllerProps.STRING, defaultString = "none")
|
|
68
|
+
public void setAnimationType(HippyModalHostView view, String animationType) {
|
|
69
|
+
view.setAnimationType(animationType);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@HippyControllerProps(name = "immersionStatusBar", defaultType = HippyControllerProps.BOOLEAN)
|
|
73
|
+
public void setEnterImmersionStatusBar(HippyModalHostView view, boolean fullScreen) {
|
|
74
|
+
view.setEnterImmersionStatusBar(fullScreen);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@HippyControllerProps(name = "darkStatusBarText", defaultType = HippyControllerProps.BOOLEAN)
|
|
78
|
+
public void setImmersionStatusBarTextDarkColor(HippyModalHostView view, boolean fullScreen) {
|
|
79
|
+
view.setImmersionStatusBarTextDarkColor(fullScreen);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@HippyControllerProps(name = "transparent", defaultType = HippyControllerProps.BOOLEAN)
|
|
83
|
+
public void setTransparent(HippyModalHostView view, boolean transparent) {
|
|
84
|
+
view.setTransparent(transparent);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@HippyControllerProps(name = "listenKeyEvent", defaultType = HippyControllerProps.BOOLEAN)
|
|
88
|
+
public void setListenKeyEvent(HippyModalHostView view, boolean listen)
|
|
89
|
+
{
|
|
90
|
+
view.setListenKeyEvent(listen);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@Override
|
|
94
|
+
public void onAfterUpdateProps(HippyModalHostView v) {
|
|
95
|
+
super.onAfterUpdateProps(v);
|
|
96
|
+
try {
|
|
97
|
+
v.showOrUpdate();
|
|
98
|
+
} catch (Exception ignored) {
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
}
|
|
@@ -0,0 +1,597 @@
|
|
|
1
|
+
/* Tencent is pleased to support the open source community by making Hippy available.
|
|
2
|
+
* Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
package com.tencent.mtt.hippy.views.modal;
|
|
17
|
+
|
|
18
|
+
import android.animation.ObjectAnimator;
|
|
19
|
+
import android.animation.PropertyValuesHolder;
|
|
20
|
+
import android.app.Activity;
|
|
21
|
+
import android.app.Dialog;
|
|
22
|
+
import android.content.Context;
|
|
23
|
+
import android.content.DialogInterface;
|
|
24
|
+
import android.content.res.Resources;
|
|
25
|
+
import android.content.res.Resources.NotFoundException;
|
|
26
|
+
import android.graphics.Canvas;
|
|
27
|
+
import android.graphics.Color;
|
|
28
|
+
import android.os.Build;
|
|
29
|
+
import android.text.TextUtils;
|
|
30
|
+
import android.util.Log;
|
|
31
|
+
import android.view.Display;
|
|
32
|
+
import android.view.KeyEvent;
|
|
33
|
+
import android.view.View;
|
|
34
|
+
import android.view.ViewGroup;
|
|
35
|
+
import android.view.Window;
|
|
36
|
+
import android.view.WindowManager;
|
|
37
|
+
import android.view.accessibility.AccessibilityEvent;
|
|
38
|
+
import android.widget.FrameLayout;
|
|
39
|
+
|
|
40
|
+
import com.tencent.mtt.hippy.HippyEngineContext;
|
|
41
|
+
import com.tencent.mtt.hippy.HippyInstanceContext;
|
|
42
|
+
import com.tencent.mtt.hippy.HippyInstanceLifecycleEventListener;
|
|
43
|
+
import com.tencent.mtt.hippy.R;
|
|
44
|
+
import com.tencent.mtt.hippy.utils.ContextHolder;
|
|
45
|
+
import com.tencent.mtt.hippy.utils.LogUtils;
|
|
46
|
+
import com.tencent.mtt.hippy.views.view.HippyViewGroup;
|
|
47
|
+
|
|
48
|
+
import java.lang.reflect.Field;
|
|
49
|
+
import java.util.ArrayList;
|
|
50
|
+
|
|
51
|
+
@SuppressWarnings({"unused"})
|
|
52
|
+
public class HippyModalHostView extends HippyViewGroup implements
|
|
53
|
+
HippyInstanceLifecycleEventListener {
|
|
54
|
+
|
|
55
|
+
@Override
|
|
56
|
+
public void onInstanceLoad(int instanceId) {
|
|
57
|
+
try {
|
|
58
|
+
showOrUpdate();
|
|
59
|
+
} catch (Exception ignored) {
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@Override
|
|
64
|
+
public void onInstanceResume(int instanceId) {
|
|
65
|
+
// showOrUpdate();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@Override
|
|
69
|
+
public void onInstancePause(int instanceId) {
|
|
70
|
+
// dismiss();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@Override
|
|
74
|
+
public void onInstanceDestroy(int instanceId) {
|
|
75
|
+
try {
|
|
76
|
+
HippyInstanceContext hippyInstanceContext = (HippyInstanceContext) getContext();
|
|
77
|
+
hippyInstanceContext.getEngineContext().removeInstanceLifecycleEventListener(this);
|
|
78
|
+
} catch (Exception ignored) {
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
dismiss();
|
|
82
|
+
} catch (Exception ignored) {
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@Override
|
|
87
|
+
protected void onDetachedFromWindow() {
|
|
88
|
+
Log.i(TAG, "dialog dismiss onDetachedFromWindow");
|
|
89
|
+
onInstanceDestroy(0);
|
|
90
|
+
super.onDetachedFromWindow();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public interface OnRequestCloseListener {
|
|
94
|
+
|
|
95
|
+
void onRequestClose(DialogInterface dialog);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private final int STYLE_THEME_FULL_SCREEN_DIALOG = 0;
|
|
99
|
+
private final int STYLE_THEME_ANIMATED_FADE_DIALOG = 1;
|
|
100
|
+
private final int STYLE_THEME_ANIMATED_SLIDE_DIALOG = 2;
|
|
101
|
+
private final int STYLE_THEME_ANIMATED_SLIDE_FADE_DIALOG = 3;
|
|
102
|
+
|
|
103
|
+
private final DialogRootViewGroup mHostView;
|
|
104
|
+
private Dialog mDialog;
|
|
105
|
+
private View mContentView;
|
|
106
|
+
private boolean mTransparent = true;
|
|
107
|
+
private boolean mPropertyRequiresNewDialog;
|
|
108
|
+
private DialogInterface.OnShowListener mOnShowListener;
|
|
109
|
+
OnRequestCloseListener mOnRequestCloseListener;
|
|
110
|
+
private String mAnimationType;
|
|
111
|
+
private int mAniType;
|
|
112
|
+
private boolean mEnterImmersionStatusBar = false;
|
|
113
|
+
private boolean mStatusBarTextDarkColor = false;
|
|
114
|
+
private boolean mListenKeyEvent = false;
|
|
115
|
+
|
|
116
|
+
public HippyModalHostView(Context context) {
|
|
117
|
+
super(context);
|
|
118
|
+
mAniType = STYLE_THEME_FULL_SCREEN_DIALOG;
|
|
119
|
+
HippyInstanceContext hippyInstanceContext = (HippyInstanceContext) context;
|
|
120
|
+
hippyInstanceContext.getEngineContext().addInstanceLifecycleEventListener(this);
|
|
121
|
+
mHostView = new DialogRootViewGroup(context);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
@Override
|
|
125
|
+
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
|
126
|
+
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@Override
|
|
130
|
+
public void addView(View child, int index) {
|
|
131
|
+
mHostView.addView(child, index);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@Override
|
|
135
|
+
public int getChildCount() {
|
|
136
|
+
return mHostView == null ? 0 : mHostView.getChildCount();
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@Override
|
|
140
|
+
public View getChildAt(int index) {
|
|
141
|
+
return mHostView.getChildAt(index);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
@Override
|
|
145
|
+
public void removeView(View child) {
|
|
146
|
+
mHostView.removeView(child);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@Override
|
|
150
|
+
public void removeViewAt(int index) {
|
|
151
|
+
View child = getChildAt(index);
|
|
152
|
+
mHostView.removeView(child);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
public void addChildrenForAccessibility(ArrayList<View> outChildren) {
|
|
156
|
+
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@Override
|
|
160
|
+
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
private void dismiss() throws Exception {
|
|
165
|
+
// if (isActivityFinishing()) {
|
|
166
|
+
// return;
|
|
167
|
+
// }
|
|
168
|
+
//
|
|
169
|
+
// if (mDialog != null) {
|
|
170
|
+
// mDialog.dismiss();
|
|
171
|
+
// mDialog = null;
|
|
172
|
+
// ViewGroup parent = (ViewGroup) mHostView.getParent();
|
|
173
|
+
// parent.removeViewAt(0);
|
|
174
|
+
// }
|
|
175
|
+
|
|
176
|
+
Log.i(TAG, "dialog dismiss activity finish " + isActivityFinishing());
|
|
177
|
+
|
|
178
|
+
if (mDialog != null) {
|
|
179
|
+
try {
|
|
180
|
+
ViewGroup parent = (ViewGroup) mHostView.getParent();
|
|
181
|
+
parent.removeViewAt(0);
|
|
182
|
+
} catch (Exception e) {
|
|
183
|
+
e.printStackTrace();
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
try {
|
|
187
|
+
mDialog.dismiss();
|
|
188
|
+
} catch (Exception e) {
|
|
189
|
+
e.printStackTrace();
|
|
190
|
+
}
|
|
191
|
+
mDialog = null;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
public void setOnRequestCloseListener(OnRequestCloseListener listener) {
|
|
197
|
+
mOnRequestCloseListener = listener;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
public void requestClose() {
|
|
201
|
+
if (mOnRequestCloseListener != null) {
|
|
202
|
+
mOnRequestCloseListener.onRequestClose(mDialog);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
public void setOnShowListener(DialogInterface.OnShowListener listener) {
|
|
207
|
+
mOnShowListener = listener;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
protected void setTransparent(boolean transparent) {
|
|
211
|
+
mTransparent = transparent;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
protected void setAnimationType(String animationType) {
|
|
215
|
+
if (!TextUtils.isEmpty(animationType)) {
|
|
216
|
+
switch (animationType) {
|
|
217
|
+
case "fade":
|
|
218
|
+
mAniType = STYLE_THEME_ANIMATED_FADE_DIALOG;
|
|
219
|
+
break;
|
|
220
|
+
case "slide":
|
|
221
|
+
mAniType = STYLE_THEME_ANIMATED_SLIDE_DIALOG;
|
|
222
|
+
break;
|
|
223
|
+
case "slide_fade":
|
|
224
|
+
mAniType = STYLE_THEME_ANIMATED_SLIDE_FADE_DIALOG;
|
|
225
|
+
break;
|
|
226
|
+
default:
|
|
227
|
+
mAniType = STYLE_THEME_FULL_SCREEN_DIALOG;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
mAnimationType = animationType;
|
|
232
|
+
mPropertyRequiresNewDialog = true;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
protected String getAnimationType() {
|
|
236
|
+
return mAnimationType;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
protected void setEnterImmersionStatusBar(boolean fullScreen) {
|
|
240
|
+
mEnterImmersionStatusBar = fullScreen;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
protected void setImmersionStatusBarTextDarkColor(boolean darkColor) {
|
|
244
|
+
mStatusBarTextDarkColor = darkColor;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
public void setListenKeyEvent(boolean listen) {
|
|
248
|
+
mListenKeyEvent = listen;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
public Dialog getDialog() {
|
|
252
|
+
return mDialog;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
static int mStatusBarHeight = -1;
|
|
256
|
+
static boolean hasCheckStatusBarHeight = false;
|
|
257
|
+
|
|
258
|
+
public int getStatusBarHeightFixed() {
|
|
259
|
+
if (mStatusBarHeight == -1) {
|
|
260
|
+
mStatusBarHeight = getStatusBarHeightFromSystem();
|
|
261
|
+
|
|
262
|
+
hasCheckStatusBarHeight = true;
|
|
263
|
+
}
|
|
264
|
+
return mStatusBarHeight;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
private static int statusBarHeight = -1;
|
|
268
|
+
|
|
269
|
+
@SuppressWarnings("ConstantConditions")
|
|
270
|
+
public static int getStatusBarHeightFromSystem() {
|
|
271
|
+
if (statusBarHeight > 0) {
|
|
272
|
+
return statusBarHeight;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
Class<?> c;
|
|
276
|
+
Object obj;
|
|
277
|
+
Field field;
|
|
278
|
+
int x;
|
|
279
|
+
try {
|
|
280
|
+
c = Class.forName("com.android.internal.R$dimen");
|
|
281
|
+
obj = c.newInstance();
|
|
282
|
+
field = c.getField("status_bar_height");
|
|
283
|
+
x = Integer.parseInt(field.get(obj).toString());
|
|
284
|
+
statusBarHeight = ContextHolder.getAppContext().getResources().getDimensionPixelSize(x);
|
|
285
|
+
} catch (Exception e1) {
|
|
286
|
+
statusBarHeight = -1;
|
|
287
|
+
e1.printStackTrace();
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
if (statusBarHeight < 1) {
|
|
291
|
+
try {
|
|
292
|
+
int statebarH_id = ContextHolder.getAppContext().getResources()
|
|
293
|
+
.getIdentifier("statebar_height", "dimen",
|
|
294
|
+
ContextHolder.getAppContext().getPackageName());
|
|
295
|
+
statusBarHeight = Math
|
|
296
|
+
.round(ContextHolder.getAppContext().getResources().getDimension(statebarH_id));
|
|
297
|
+
} catch (NotFoundException e) {
|
|
298
|
+
LogUtils.d("HippyModalHostView", "getStatusBarHeightFromSystem: " + e.getMessage());
|
|
299
|
+
statusBarHeight = 0;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
return statusBarHeight;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
public void setDialogBar(boolean isDarkIcon) {
|
|
306
|
+
try {
|
|
307
|
+
Window window = mDialog.getWindow();
|
|
308
|
+
int sysUI = window.getDecorView().getSystemUiVisibility();
|
|
309
|
+
sysUI = sysUI & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
|
|
310
|
+
sysUI = sysUI & ~View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
|
|
311
|
+
int extra;
|
|
312
|
+
if (isDarkIcon) {
|
|
313
|
+
extra = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
|
|
314
|
+
} else {
|
|
315
|
+
extra = View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
|
|
316
|
+
}
|
|
317
|
+
window.getDecorView().setSystemUiVisibility(sysUI | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
|
318
|
+
| extra);
|
|
319
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
320
|
+
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
|
321
|
+
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
|
322
|
+
window.setStatusBarColor(Color.TRANSPARENT);
|
|
323
|
+
} else {
|
|
324
|
+
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
|
325
|
+
window.clearFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
|
326
|
+
}
|
|
327
|
+
} catch (Throwable throwable) {
|
|
328
|
+
throwable.printStackTrace();
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
private boolean isActivityFinishing() {
|
|
333
|
+
HippyInstanceContext hippyInstanceContext = (HippyInstanceContext) getContext();
|
|
334
|
+
if (hippyInstanceContext == null) {
|
|
335
|
+
return true;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
Context context = hippyInstanceContext.getActivityContext();
|
|
339
|
+
if (context == null) {
|
|
340
|
+
context = hippyInstanceContext.getBaseContext();
|
|
341
|
+
}
|
|
342
|
+
if (!(context instanceof Activity)) {
|
|
343
|
+
return true;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
Activity currentActivity = (Activity) context;
|
|
347
|
+
return currentActivity.isFinishing();
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
protected void showOrUpdate() throws Exception {
|
|
351
|
+
if (isActivityFinishing()) {
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
if (mDialog != null) {
|
|
356
|
+
if (mPropertyRequiresNewDialog) {
|
|
357
|
+
dismiss();
|
|
358
|
+
} else {
|
|
359
|
+
updateProperties();
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
mPropertyRequiresNewDialog = false;
|
|
365
|
+
Context currentContext = getContext();
|
|
366
|
+
mDialog = createDialog(currentContext);
|
|
367
|
+
mContentView = createContentView(mHostView);
|
|
368
|
+
mDialog.setContentView(mContentView);
|
|
369
|
+
updateProperties();
|
|
370
|
+
if (mDialog != null && mDialog.getWindow() != null && mEnterImmersionStatusBar) {
|
|
371
|
+
setDialogBar(mStatusBarTextDarkColor);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
assert mDialog != null;
|
|
375
|
+
mDialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
|
376
|
+
@Override
|
|
377
|
+
public void onShow(DialogInterface dialogInterface) {
|
|
378
|
+
mOnShowListener.onShow(dialogInterface);
|
|
379
|
+
ObjectAnimator alphaAnimation = null;
|
|
380
|
+
switch (mAniType) {
|
|
381
|
+
case STYLE_THEME_ANIMATED_FADE_DIALOG:
|
|
382
|
+
alphaAnimation = ObjectAnimator.ofFloat(mContentView, "alpha", 0.0f, 1.0f);
|
|
383
|
+
break;
|
|
384
|
+
case STYLE_THEME_ANIMATED_SLIDE_DIALOG:
|
|
385
|
+
alphaAnimation = ObjectAnimator.ofFloat(mContentView, "translationY", 0);
|
|
386
|
+
break;
|
|
387
|
+
case STYLE_THEME_ANIMATED_SLIDE_FADE_DIALOG:
|
|
388
|
+
PropertyValuesHolder fadeValuesHolder = PropertyValuesHolder
|
|
389
|
+
.ofFloat("alpha", 0.0f, 1.0f);
|
|
390
|
+
PropertyValuesHolder slideValuesHolder = PropertyValuesHolder
|
|
391
|
+
.ofFloat("translationY", 0);
|
|
392
|
+
alphaAnimation = ObjectAnimator
|
|
393
|
+
.ofPropertyValuesHolder(mContentView, fadeValuesHolder, slideValuesHolder);
|
|
394
|
+
break;
|
|
395
|
+
default:
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
if (alphaAnimation != null) {
|
|
399
|
+
alphaAnimation.setDuration(200);
|
|
400
|
+
alphaAnimation.start();
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
mDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
|
405
|
+
@Override
|
|
406
|
+
public void onDismiss(DialogInterface dialogInterface) {
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
mDialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
|
|
410
|
+
@Override
|
|
411
|
+
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
|
|
412
|
+
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
|
413
|
+
|
|
414
|
+
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
|
415
|
+
mOnRequestCloseListener.onRequestClose(dialog);
|
|
416
|
+
return true;
|
|
417
|
+
} else if (mListenKeyEvent) {
|
|
418
|
+
if (((HippyInstanceContext) getContext()).getBaseContext() instanceof Activity) {
|
|
419
|
+
Activity currentActivity = (Activity) ((HippyInstanceContext) getContext())
|
|
420
|
+
.getBaseContext();
|
|
421
|
+
if (currentActivity != null) {
|
|
422
|
+
return currentActivity.onKeyDown(keyCode, event);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
return false;
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
|
|
431
|
+
mDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
|
432
|
+
mDialog.show();
|
|
433
|
+
|
|
434
|
+
int nScreenHeight = getScreenHeight();
|
|
435
|
+
switch (mAniType) {
|
|
436
|
+
case STYLE_THEME_ANIMATED_FADE_DIALOG:
|
|
437
|
+
mContentView.setAlpha(0);
|
|
438
|
+
break;
|
|
439
|
+
case STYLE_THEME_ANIMATED_SLIDE_DIALOG:
|
|
440
|
+
if (nScreenHeight != -1) {
|
|
441
|
+
mContentView.setTranslationY(nScreenHeight);
|
|
442
|
+
}
|
|
443
|
+
break;
|
|
444
|
+
case STYLE_THEME_ANIMATED_SLIDE_FADE_DIALOG:
|
|
445
|
+
mContentView.setAlpha(0);
|
|
446
|
+
if (nScreenHeight != -1) {
|
|
447
|
+
mContentView.setTranslationY(nScreenHeight);
|
|
448
|
+
}
|
|
449
|
+
break;
|
|
450
|
+
default:
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
private int getScreenHeight() {
|
|
455
|
+
try {
|
|
456
|
+
Context context = ContextHolder.getAppContext();
|
|
457
|
+
android.view.WindowManager manager = (android.view.WindowManager) context
|
|
458
|
+
.getSystemService(Context.WINDOW_SERVICE);
|
|
459
|
+
Display display = manager.getDefaultDisplay();
|
|
460
|
+
if (display != null) {
|
|
461
|
+
//noinspection deprecation
|
|
462
|
+
return manager.getDefaultDisplay().getHeight();
|
|
463
|
+
}
|
|
464
|
+
} catch (SecurityException e) {
|
|
465
|
+
LogUtils.d("HippyModalHostView", "getScreenHeight: " + e.getMessage());
|
|
466
|
+
}
|
|
467
|
+
return -1;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
@SuppressWarnings("SameReturnValue")
|
|
471
|
+
protected int getThemeResId() {
|
|
472
|
+
return 0;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
protected Dialog createDialog(Context context) {
|
|
476
|
+
if (context instanceof HippyInstanceContext) {
|
|
477
|
+
Context activityContext = ((HippyInstanceContext) context).getActivityContext();
|
|
478
|
+
if (activityContext != null) {
|
|
479
|
+
context = activityContext;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
int themeResId = getThemeResId();
|
|
483
|
+
if (context != null) {
|
|
484
|
+
Resources res = context.getResources();
|
|
485
|
+
themeResId = res.getIdentifier("HippyFullScreenDialog", "style", context.getPackageName());
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
assert context != null;
|
|
489
|
+
Dialog dialog = new Dialog(context, themeResId);
|
|
490
|
+
if (themeResId == 0) {
|
|
491
|
+
Window window = dialog.getWindow();
|
|
492
|
+
if (window != null) {
|
|
493
|
+
window.requestFeature(Window.FEATURE_NO_TITLE);
|
|
494
|
+
window.setBackgroundDrawableResource(android.R.color.transparent);
|
|
495
|
+
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams
|
|
496
|
+
.MATCH_PARENT);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
// add by weipeng
|
|
501
|
+
// 标记dialog属于哪个Activity
|
|
502
|
+
attachActivityHashCode(dialog, context);
|
|
503
|
+
|
|
504
|
+
return dialog;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
private void attachActivityHashCode(Dialog dialog, Context context) {
|
|
508
|
+
if (context instanceof HippyInstanceContext) {
|
|
509
|
+
context = ((HippyInstanceContext) context).getBaseContext();
|
|
510
|
+
}
|
|
511
|
+
if (context == null) return;
|
|
512
|
+
View decorView = dialog.getWindow().getDecorView();
|
|
513
|
+
decorView.setTag(R.id.tag_dialog_owner_hash, context.hashCode());
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
protected View createContentView(View hostView) {
|
|
517
|
+
FrameLayout frameLayout = new FrameLayout(getContext()) {
|
|
518
|
+
@Override
|
|
519
|
+
protected void dispatchDraw(Canvas canvas) {
|
|
520
|
+
super.dispatchDraw(canvas);
|
|
521
|
+
if (mEnterImmersionStatusBar && mStatusBarHeight != -1
|
|
522
|
+
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT
|
|
523
|
+
&& Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
|
524
|
+
canvas.save();
|
|
525
|
+
canvas.clipRect(0, 0, getMeasuredWidth(), mStatusBarHeight);
|
|
526
|
+
canvas.drawColor(0x40000000);
|
|
527
|
+
canvas.restore();
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
};
|
|
531
|
+
if (mEnterImmersionStatusBar && Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
|
|
532
|
+
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
|
|
533
|
+
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
|
534
|
+
params.topMargin = -1 * getStatusBarHeightFixed();
|
|
535
|
+
frameLayout.addView(hostView, params);
|
|
536
|
+
} else {
|
|
537
|
+
frameLayout.addView(hostView);
|
|
538
|
+
}
|
|
539
|
+
frameLayout.setFitsSystemWindows(false);
|
|
540
|
+
return frameLayout;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
private void updateProperties() {
|
|
544
|
+
if (mTransparent) {
|
|
545
|
+
mDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
|
|
546
|
+
} else {
|
|
547
|
+
mDialog.getWindow().setDimAmount(0.5f);
|
|
548
|
+
mDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND,
|
|
549
|
+
WindowManager.LayoutParams.FLAG_DIM_BEHIND);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
public static class DialogRootViewGroup extends HippyViewGroup {
|
|
554
|
+
|
|
555
|
+
public DialogRootViewGroup(Context context) {
|
|
556
|
+
super(context);
|
|
557
|
+
setFitsSystemWindows(false);
|
|
558
|
+
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
@Override
|
|
563
|
+
protected void onSizeChanged(final int w, final int h, int oldw, int oldh) {
|
|
564
|
+
super.onSizeChanged(w, h, oldw, oldh);
|
|
565
|
+
if (getChildCount() > 0) {
|
|
566
|
+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
|
567
|
+
getChildAt(0)
|
|
568
|
+
.layout(getChildAt(0).getLeft(), getChildAt(0).getTop(), getChildAt(0).getLeft() + w,
|
|
569
|
+
getChildAt(0).getTop() + h);
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
HippyInstanceContext hippyInstanceContext = (HippyInstanceContext) getContext();
|
|
573
|
+
if (hippyInstanceContext != null && hippyInstanceContext.getEngineContext() != null) {
|
|
574
|
+
final HippyEngineContext engineContext = hippyInstanceContext.getEngineContext();
|
|
575
|
+
if (engineContext.getThreadExecutor() != null) {
|
|
576
|
+
final int id = getChildAt(0).getId();
|
|
577
|
+
engineContext.getThreadExecutor().postOnDomThread(new Runnable() {
|
|
578
|
+
@Override
|
|
579
|
+
public void run() {
|
|
580
|
+
if (engineContext.getDomManager() != null) {
|
|
581
|
+
engineContext.getDomManager().updateNodeSize(id, w, h);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
});
|
|
585
|
+
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
@Override
|
|
593
|
+
public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) {
|
|
594
|
+
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
}
|