@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,526 @@
|
|
|
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.uimanager;
|
|
17
|
+
|
|
18
|
+
import android.text.TextUtils;
|
|
19
|
+
import android.util.Log;
|
|
20
|
+
|
|
21
|
+
import com.tencent.mtt.hippy.HippyEngineContext;
|
|
22
|
+
import com.tencent.mtt.hippy.common.HippyArray;
|
|
23
|
+
import com.tencent.mtt.hippy.common.HippyMap;
|
|
24
|
+
import com.tencent.mtt.hippy.dom.node.NodeProps;
|
|
25
|
+
|
|
26
|
+
import com.tencent.mtt.hippy.utils.LogUtils;
|
|
27
|
+
import java.util.ArrayList;
|
|
28
|
+
import java.util.List;
|
|
29
|
+
import java.util.Set;
|
|
30
|
+
|
|
31
|
+
import static com.tencent.mtt.hippy.views.custom.HippyCustomPropsController.DT_EBLID;
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@SuppressWarnings("deprecation")
|
|
35
|
+
public class DiffUtils {
|
|
36
|
+
|
|
37
|
+
public static ArrayList<PatchType> diff(RenderNode from, RenderNode toNoe) {
|
|
38
|
+
ArrayList<PatchType> patchTypes = new ArrayList<>();
|
|
39
|
+
if (from.getId() == toNoe.getId()) {
|
|
40
|
+
//when first create view form eq toNode
|
|
41
|
+
return patchTypes;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
diffFromNode(from, toNoe, patchTypes);
|
|
46
|
+
diffToNode(from, toNoe, patchTypes);
|
|
47
|
+
} catch (Throwable e) {
|
|
48
|
+
LogUtils.d("DiffUtils", "diff: " + e.getMessage());
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return patchTypes;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
private static void diffToNode(RenderNode from, RenderNode toNoe,
|
|
55
|
+
ArrayList<PatchType> patchTypes) {
|
|
56
|
+
if (from == null || toNoe == null) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
for (int i = 0; i < toNoe.getChildCount(); i++) {
|
|
61
|
+
if (i >= from.getChildCount()) {
|
|
62
|
+
RenderNode toNoeChild = toNoe.getChildAt(i);
|
|
63
|
+
patchTypes.add(new PatchType(Patch.TYPE_CREATE, new CreatePatch(toNoeChild)));
|
|
64
|
+
if (TextUtils.equals(toNoeChild.getClassName(), NodeProps.TEXT_CLASS_NAME)) {
|
|
65
|
+
patchTypes.add(new PatchType(Patch.TYPE_EXTRA,
|
|
66
|
+
new ExtraPatch(toNoeChild.mId, toNoeChild.mTextExtra, toNoeChild.getClassName())));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
patchTypes.add(new PatchType(Patch.TYPE_LAYOUT,
|
|
70
|
+
new LayoutPatch(toNoeChild.mX, toNoeChild.mY, toNoeChild.mHeight, toNoeChild
|
|
71
|
+
.getWidth(), toNoeChild.mId, toNoeChild.mParent.mId, toNoeChild.mClassName)));
|
|
72
|
+
} else {
|
|
73
|
+
diffToNode(from.getChildAt(i), toNoe.getChildAt(i), patchTypes);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
private static void diffFromNode(RenderNode from, RenderNode toNode,
|
|
81
|
+
ArrayList<PatchType> patchTypes) {
|
|
82
|
+
if (TextUtils.equals(from.getClassName(), toNode.getClassName())) {
|
|
83
|
+
patchTypes.add(
|
|
84
|
+
new PatchType(Patch.TYPE_REPLACE_ID, new ReplacePatch(from.getId(), toNode.getId())));
|
|
85
|
+
|
|
86
|
+
HippyMap updateProps = diffProps(from.getProps(), toNode.getProps(), 0);
|
|
87
|
+
if (updateProps != null && updateProps.size() >= 1) {
|
|
88
|
+
patchTypes.add(new PatchType(Patch.TYPE_PROPS,
|
|
89
|
+
new PropsPatch(updateProps, toNode.getId(), toNode.getClassName())));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
LayoutPatch lp = diffLayout(from, toNode);
|
|
93
|
+
if (lp != null) {
|
|
94
|
+
patchTypes.add(new PatchType(Patch.TYPE_LAYOUT, lp));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
ExtraPatch extraPatch = diffExtra(from, toNode);
|
|
98
|
+
if (extraPatch != null) {
|
|
99
|
+
patchTypes.add(new PatchType(Patch.TYPE_EXTRA, extraPatch));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
for (int i = 0; i < from.getChildCount(); i++) {
|
|
104
|
+
RenderNode fromChild = from.getChildAt(i);
|
|
105
|
+
RenderNode toChild = null;
|
|
106
|
+
if (i < toNode.getChildCount()) {
|
|
107
|
+
toChild = toNode.getChildAt(i);
|
|
108
|
+
}
|
|
109
|
+
if (toChild != null && TextUtils.equals(fromChild.getClassName(), toChild.getClassName())) {
|
|
110
|
+
diffFromNode(fromChild, toChild, patchTypes);
|
|
111
|
+
} else {
|
|
112
|
+
if (toChild != null) {
|
|
113
|
+
patchTypes.add(new PatchType(Patch.TYPE_CREATE, new CreatePatch(toChild)));
|
|
114
|
+
if (TextUtils.equals(toChild.getClassName(), NodeProps.TEXT_CLASS_NAME)) {
|
|
115
|
+
patchTypes.add(new PatchType(Patch.TYPE_EXTRA,
|
|
116
|
+
new ExtraPatch(toChild.mId, toChild.mTextExtra, toChild.getClassName())));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
patchTypes.add(new PatchType(Patch.TYPE_LAYOUT,
|
|
120
|
+
new LayoutPatch(toChild.mX, toChild.mY, toChild.mHeight, toChild.getWidth(),
|
|
121
|
+
toChild.mId, toChild.mParent.mId, toChild.mClassName)));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
patchTypes.add(new PatchType(Patch.TYPE_DELETE_CHILDREN,
|
|
125
|
+
new DeletePatch(fromChild.getId(), fromChild.getParent().getId(), fromChild
|
|
126
|
+
.getParent().getClassName())));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
private static ExtraPatch diffExtra(RenderNode from, RenderNode toNode) {
|
|
134
|
+
if (from.mTextExtra != null && toNode.mTextExtra != null && !TextUtils
|
|
135
|
+
.equals(from.mTextExtra.toString(), toNode.mTextExtra.toString())) {
|
|
136
|
+
return new ExtraPatch(toNode.getId(), toNode.mTextExtra, toNode.getClassName());
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
private static LayoutPatch diffLayout(RenderNode fromNode, RenderNode toNode) {
|
|
143
|
+
if (fromNode == null || fromNode.getX() != toNode.getX() || fromNode.getY() != toNode.getY()
|
|
144
|
+
|| fromNode.getWidth() != toNode.getWidth()
|
|
145
|
+
|| fromNode.getHeight() != toNode.getHeight()) {
|
|
146
|
+
return new LayoutPatch(toNode.getX(), toNode.getY(), toNode.getHeight(), toNode.getWidth(),
|
|
147
|
+
toNode.getId(), toNode.mParent.getId(),
|
|
148
|
+
toNode.getClassName());
|
|
149
|
+
}
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
public static HippyMap diffProps(HippyMap from, HippyMap to, int diffLevel) {
|
|
155
|
+
if (from == null) {
|
|
156
|
+
return to;
|
|
157
|
+
}
|
|
158
|
+
HippyMap updateProps = new HippyMap();
|
|
159
|
+
Set<String> fromKeys = from.keySet();
|
|
160
|
+
for (String fromKey : fromKeys) {
|
|
161
|
+
try {
|
|
162
|
+
if (fromKey.equals(DT_EBLID)) {
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
Object fromValue = from.get(fromKey);
|
|
167
|
+
Object toValue = to.get(fromKey);
|
|
168
|
+
if (fromValue instanceof Boolean) {
|
|
169
|
+
boolean fromBool = (boolean) fromValue;
|
|
170
|
+
if (toValue instanceof Boolean && fromBool == (boolean) toValue) {
|
|
171
|
+
LogUtils.d("DiffUtils", "don't do anything for bool value");
|
|
172
|
+
} else {
|
|
173
|
+
updateProps.pushObject(fromKey, toValue);
|
|
174
|
+
}
|
|
175
|
+
} else if (fromValue instanceof Number) {
|
|
176
|
+
boolean isSame = false;
|
|
177
|
+
double fromDoubleValue = ((Number) fromValue).doubleValue();
|
|
178
|
+
if (toValue instanceof Number) {
|
|
179
|
+
double toDoubleValue = ((Number) toValue).doubleValue();
|
|
180
|
+
isSame = (fromDoubleValue == toDoubleValue);
|
|
181
|
+
}
|
|
182
|
+
// if toValue is null, push null to trigger default value
|
|
183
|
+
if (!isSame) {
|
|
184
|
+
updateProps.pushObject(fromKey, toValue);
|
|
185
|
+
}
|
|
186
|
+
} else if (fromValue instanceof String) {
|
|
187
|
+
if (toValue != null && TextUtils.equals(fromValue.toString(), toValue.toString())) {
|
|
188
|
+
LogUtils.d("DiffUtils", "don't do anything for same value");
|
|
189
|
+
} else {
|
|
190
|
+
updateProps.pushObject(fromKey, toValue);
|
|
191
|
+
}
|
|
192
|
+
} else if (fromValue instanceof HippyArray) {
|
|
193
|
+
if (toValue instanceof HippyArray) {
|
|
194
|
+
HippyArray diffResult = diffArray((HippyArray) fromValue, (HippyArray) toValue,
|
|
195
|
+
diffLevel + 1);
|
|
196
|
+
//tintColor复用的时候必须要强制更新
|
|
197
|
+
if (fromKey.equals("tintColors") || fromKey.equals("tintColor")) {
|
|
198
|
+
diffResult = (HippyArray) toValue;
|
|
199
|
+
}
|
|
200
|
+
//这里diffResult == null标识属性没有更新
|
|
201
|
+
if (diffResult != null /* && diffResult.size() > 0*/) {
|
|
202
|
+
updateProps.pushObject(fromKey, toValue);
|
|
203
|
+
}
|
|
204
|
+
} else { // toValue(Array)没有的时候,要给个默认值
|
|
205
|
+
updateProps.pushObject(fromKey, null);
|
|
206
|
+
}
|
|
207
|
+
} else if (fromValue instanceof HippyMap) {
|
|
208
|
+
if (toValue instanceof HippyMap) {
|
|
209
|
+
|
|
210
|
+
HippyMap diffResult = diffProps((HippyMap) fromValue, (HippyMap) toValue, diffLevel + 1);
|
|
211
|
+
if (diffResult != null && diffResult.size() > 0) {
|
|
212
|
+
if (diffLevel == 0 && fromKey.equals(NodeProps.STYLE)) {
|
|
213
|
+
updateProps.pushObject(fromKey, diffResult);
|
|
214
|
+
} else {
|
|
215
|
+
updateProps.pushObject(fromKey, toValue);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
} else if (diffLevel == 0 && fromKey.equals(NodeProps.STYLE)) {
|
|
219
|
+
//style is null
|
|
220
|
+
HippyMap diffResult = diffProps((HippyMap) fromValue, new HippyMap(), diffLevel + 1);
|
|
221
|
+
updateProps.pushMap(fromKey, diffResult);
|
|
222
|
+
} else { // toValue没有的时候,要给个默认值
|
|
223
|
+
updateProps.pushObject(fromKey, null);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}catch (Exception e){
|
|
227
|
+
if(LogUtils.isDebug()){
|
|
228
|
+
Log.e("DiffUtils","diffProps error fromKey:"+fromKey+",msg:"+e.getMessage());
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// new has prop, but old doesn't
|
|
234
|
+
// so we push these props directly
|
|
235
|
+
|
|
236
|
+
Set<String> tos = to.keySet();
|
|
237
|
+
|
|
238
|
+
for (String toKey : tos) {
|
|
239
|
+
|
|
240
|
+
if (from.get(toKey) != null || toKey.equals(DT_EBLID)) {
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
Object toValue = to.get(toKey);
|
|
244
|
+
updateProps.pushObject(toKey, toValue);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return updateProps;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
private static HippyArray diffArray(HippyArray fromValue, HippyArray toValue, int diffLevel) {
|
|
252
|
+
|
|
253
|
+
if (fromValue.size() != toValue.size()) {
|
|
254
|
+
return toValue;
|
|
255
|
+
}
|
|
256
|
+
int size = fromValue.size();
|
|
257
|
+
|
|
258
|
+
for (int i = 0; i < size; i++) {
|
|
259
|
+
Object from = fromValue.getObject(i);
|
|
260
|
+
Object to = toValue.getObject(i);
|
|
261
|
+
// 这里默认from & to的类型相同
|
|
262
|
+
if (from instanceof Boolean) {
|
|
263
|
+
if ((boolean) from != (boolean) to) {
|
|
264
|
+
return toValue;
|
|
265
|
+
}
|
|
266
|
+
} else if (from instanceof Number) {
|
|
267
|
+
|
|
268
|
+
boolean isSame = false;
|
|
269
|
+
|
|
270
|
+
double fromDoubleValue = ((Number) from).doubleValue();
|
|
271
|
+
if (to instanceof Number) {
|
|
272
|
+
double toDoubleValue = ((Number) to).doubleValue();
|
|
273
|
+
isSame = (fromDoubleValue == toDoubleValue);
|
|
274
|
+
}
|
|
275
|
+
// if to is null, push null to trigger default value
|
|
276
|
+
|
|
277
|
+
if (!isSame) {
|
|
278
|
+
return toValue;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
} else if (from instanceof String) {
|
|
282
|
+
if (!TextUtils.equals((String) from, (String) to)) {
|
|
283
|
+
return toValue;
|
|
284
|
+
}
|
|
285
|
+
} else if (from instanceof HippyArray) {
|
|
286
|
+
if (to instanceof HippyArray) {
|
|
287
|
+
HippyArray diffResult = diffArray((HippyArray) from, (HippyArray) to, diffLevel);
|
|
288
|
+
if (diffResult != null) {
|
|
289
|
+
return toValue;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
} else if (from instanceof HippyMap) {
|
|
293
|
+
if (to instanceof HippyMap) {
|
|
294
|
+
HippyMap diffResult = diffProps((HippyMap) from, (HippyMap) to, diffLevel);
|
|
295
|
+
if (diffResult != null) {
|
|
296
|
+
return toValue;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return null;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
public static class CreatePatch extends Patch {
|
|
306
|
+
|
|
307
|
+
@Override
|
|
308
|
+
public String toString() {
|
|
309
|
+
// return "CreatePatch";
|
|
310
|
+
return "CreatePatch id :" + renderNode.mId;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
public CreatePatch(RenderNode renderNode) {
|
|
314
|
+
this.renderNode = renderNode;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
final RenderNode renderNode;
|
|
318
|
+
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
public static class ReplacePatch extends Patch {
|
|
322
|
+
|
|
323
|
+
@Override
|
|
324
|
+
public String toString() {
|
|
325
|
+
return "ReplacePatch oldId:" + oldId + " newId:" + newId;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
public ReplacePatch(int oldId, int newId) {
|
|
329
|
+
this.oldId = oldId;
|
|
330
|
+
this.newId = newId;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
final int oldId;
|
|
334
|
+
final int newId;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
public static class PropsPatch extends Patch {
|
|
338
|
+
|
|
339
|
+
final HippyMap mPropsToUpdate;
|
|
340
|
+
final int mId;
|
|
341
|
+
final String mClassName;
|
|
342
|
+
|
|
343
|
+
public PropsPatch(HippyMap array, int tag, String className) {
|
|
344
|
+
this.mPropsToUpdate = array;
|
|
345
|
+
this.mId = tag;
|
|
346
|
+
this.mClassName = className;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
@Override
|
|
350
|
+
public String toString() {
|
|
351
|
+
return "PropsPatch";
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
public static class ExtraPatch extends Patch {
|
|
356
|
+
|
|
357
|
+
public ExtraPatch(int mID, Object mText, String className) {
|
|
358
|
+
this.mID = mID;
|
|
359
|
+
this.mText = mText;
|
|
360
|
+
this.mClassName = className;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
@Override
|
|
364
|
+
public String toString() {
|
|
365
|
+
return "ExtraPatch";
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
final String mClassName;
|
|
369
|
+
final int mID;
|
|
370
|
+
final Object mText;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
@SuppressWarnings("unused")
|
|
374
|
+
public static class DeletePatch extends Patch {
|
|
375
|
+
|
|
376
|
+
final int mId;
|
|
377
|
+
final int mPid;
|
|
378
|
+
final String mPClassName;
|
|
379
|
+
|
|
380
|
+
@Override
|
|
381
|
+
public String toString() {
|
|
382
|
+
// return "DeletePatch";
|
|
383
|
+
return "DeletePatch Id " + mId;
|
|
384
|
+
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
public DeletePatch(int id, int pId, String className) {
|
|
388
|
+
this.mId = id;
|
|
389
|
+
this.mPid = pId;
|
|
390
|
+
this.mPClassName = className;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
@SuppressWarnings("unused")
|
|
395
|
+
public static class LayoutPatch extends Patch {
|
|
396
|
+
|
|
397
|
+
final int mX;
|
|
398
|
+
final int mY;
|
|
399
|
+
final int mHeight;
|
|
400
|
+
final int mWidth;
|
|
401
|
+
final int mId;
|
|
402
|
+
final int mParentId;
|
|
403
|
+
final String mClassName;
|
|
404
|
+
|
|
405
|
+
@Override
|
|
406
|
+
public String toString() {
|
|
407
|
+
return "LayoutPatch";
|
|
408
|
+
// return "mid" + mId + " x " + mX + " y " + mY + " width " + mWidth + " height " + mHeight;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
public LayoutPatch(int mX, int mY, int mHeight, int mWidth, int mID, int mParentId,
|
|
412
|
+
String mClassName) {
|
|
413
|
+
|
|
414
|
+
this.mX = mX;
|
|
415
|
+
this.mY = mY;
|
|
416
|
+
this.mHeight = mHeight;
|
|
417
|
+
this.mWidth = mWidth;
|
|
418
|
+
this.mId = mID;
|
|
419
|
+
this.mParentId = mParentId;
|
|
420
|
+
this.mClassName = mClassName;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
public static class PatchType {
|
|
425
|
+
|
|
426
|
+
public final int mType;
|
|
427
|
+
public final Patch mPatch;
|
|
428
|
+
|
|
429
|
+
public PatchType(int type, Patch p) {
|
|
430
|
+
mPatch = p;
|
|
431
|
+
mType = type;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
public static class Patch {
|
|
436
|
+
|
|
437
|
+
public static final int TYPE_DELETE_CHILDREN = 0;
|
|
438
|
+
public static final int TYPE_PROPS = 1;
|
|
439
|
+
public static final int TYPE_LAYOUT = 2;
|
|
440
|
+
public static final int TYPE_EXTRA = 3;
|
|
441
|
+
public static final int TYPE_REPLACE_ID = 4;
|
|
442
|
+
public static final int TYPE_CREATE = 5;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
public static void deleteViews(ControllerManager controllerManager, List<PatchType> patchTypes) {
|
|
446
|
+
|
|
447
|
+
for (int i = patchTypes.size() - 1; i >= 0; i--) {
|
|
448
|
+
PatchType patchType = patchTypes.get(i);
|
|
449
|
+
if (patchType.mType == Patch.TYPE_DELETE_CHILDREN) {
|
|
450
|
+
DeletePatch deletePatch = (DeletePatch) patchType.mPatch;
|
|
451
|
+
controllerManager.deleteChild(deletePatch.mPid, deletePatch.mId);
|
|
452
|
+
patchTypes.remove(patchType);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
public static void replaceIds(ControllerManager controllerManager, List<PatchType> patchTypes) {
|
|
458
|
+
|
|
459
|
+
for (int i = patchTypes.size() - 1; i >= 0; i--) {
|
|
460
|
+
PatchType patchType = patchTypes.get(i);
|
|
461
|
+
if (patchType.mType == Patch.TYPE_REPLACE_ID) {
|
|
462
|
+
ReplacePatch replacePatch = (ReplacePatch) patchType.mPatch;
|
|
463
|
+
controllerManager.replaceID(replacePatch.oldId, replacePatch.newId);
|
|
464
|
+
patchTypes.remove(patchType);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
public static void createView(List<PatchType> patchTypes) {
|
|
472
|
+
for (int i = 0; i < patchTypes.size(); i++) {
|
|
473
|
+
PatchType patchType = patchTypes.get(i);
|
|
474
|
+
if (patchType.mType == Patch.TYPE_CREATE) {
|
|
475
|
+
CreatePatch createPatch = (CreatePatch) patchType.mPatch;
|
|
476
|
+
createPatch.renderNode.createViewRecursive();
|
|
477
|
+
if (createPatch.renderNode.mParent != null) {
|
|
478
|
+
createPatch.renderNode.mParent.update();
|
|
479
|
+
}
|
|
480
|
+
createPatch.renderNode.updateViewRecursive();
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
public static void doPatch(ControllerManager controllerManager, List<PatchType> patches) {
|
|
486
|
+
HippyEngineContext hippyContext = controllerManager.mContext;
|
|
487
|
+
|
|
488
|
+
for (PatchType pt : patches) {
|
|
489
|
+
if (pt.mType == Patch.TYPE_PROPS) {
|
|
490
|
+
PropsPatch propsPatch = (PropsPatch) pt.mPatch;
|
|
491
|
+
HippyMap propsToUpdate = propsPatch.mPropsToUpdate;
|
|
492
|
+
RenderNode node = hippyContext.getRenderManager().getRenderNode(propsPatch.mId);
|
|
493
|
+
if (node != null) {
|
|
494
|
+
HippyMap props = node.getProps();
|
|
495
|
+
if (node.mHasSetDteblId) {
|
|
496
|
+
if (propsToUpdate.containsKey(DT_EBLID)) {
|
|
497
|
+
propsToUpdate.remove(DT_EBLID);
|
|
498
|
+
}
|
|
499
|
+
} else if (props != null && props.containsKey(DT_EBLID)) {
|
|
500
|
+
propsToUpdate.pushString(DT_EBLID, props.getString(DT_EBLID));
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
controllerManager.updateView(propsPatch.mId, propsPatch.mClassName, propsToUpdate);
|
|
505
|
+
} else if (pt.mType == Patch.TYPE_LAYOUT) {
|
|
506
|
+
LayoutPatch layoutPatch = (LayoutPatch) pt.mPatch;
|
|
507
|
+
|
|
508
|
+
controllerManager
|
|
509
|
+
.updateLayout(layoutPatch.mClassName, layoutPatch.mId, layoutPatch.mX, layoutPatch.mY,
|
|
510
|
+
layoutPatch.mWidth,
|
|
511
|
+
layoutPatch.mHeight);
|
|
512
|
+
} else if (pt.mType == Patch.TYPE_EXTRA) {
|
|
513
|
+
ExtraPatch extraPatch = (ExtraPatch) pt.mPatch;
|
|
514
|
+
|
|
515
|
+
controllerManager.updateExtra(extraPatch.mID, extraPatch.mClassName, extraPatch.mText);
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
// else if (pt.mType == Patch.TYPE_CREATE)
|
|
519
|
+
// {
|
|
520
|
+
// CreatePatch createPatch = (CreatePatch) pt.mPatch;
|
|
521
|
+
// controllerManager.createView(createPatch.renderNode.mRootView, createPatch.renderNode.mId, createPatch.renderNode.mPid,
|
|
522
|
+
// createPatch.renderNode.mIndex, createPatch.renderNode.mClassName, createPatch.renderNode.mPropsToUpdate);
|
|
523
|
+
// }
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
package com.tencent.mtt.hippy.uimanager;
|
|
2
|
+
|
|
3
|
+
import android.view.View;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* add by zhaopeng 20201227
|
|
7
|
+
*/
|
|
8
|
+
public interface ExtendViewGroup {
|
|
9
|
+
int AUTOFOCUS_TYPE_VISIBILITY = 0;
|
|
10
|
+
int AUTOFOCUS_TYPE_SIZE_VALID = 1;
|
|
11
|
+
int AUTOFOCUS_TYPE_ATTACH = 2;
|
|
12
|
+
int AUTOFOCUS_TYPE_FORCE = 3;
|
|
13
|
+
|
|
14
|
+
void setDispatchChildFocusEvent(boolean enable);
|
|
15
|
+
void changePageHidden(boolean hidden);
|
|
16
|
+
boolean isPageHidden();
|
|
17
|
+
void onRequestAutofocus(View child, View target, int type);
|
|
18
|
+
void setSkipRequestFocus(boolean b);
|
|
19
|
+
String ROOT_TAG = "ESRoot";
|
|
20
|
+
|
|
21
|
+
static String getAutofocusTypeString(int type){
|
|
22
|
+
switch (type){
|
|
23
|
+
case AUTOFOCUS_TYPE_VISIBILITY:
|
|
24
|
+
return "AUTOFOCUS_TYPE_VISIBILITY";
|
|
25
|
+
case AUTOFOCUS_TYPE_SIZE_VALID:
|
|
26
|
+
return "AUTOFOCUS_TYPE_SIZE_VALID";
|
|
27
|
+
case AUTOFOCUS_TYPE_ATTACH:
|
|
28
|
+
return "AUTOFOCUS_TYPE_ATTACH";
|
|
29
|
+
case AUTOFOCUS_TYPE_FORCE:
|
|
30
|
+
return "AUTOFOCUS_TYPE_FORCE";
|
|
31
|
+
default:
|
|
32
|
+
return "UNKNOWN";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
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.uimanager;
|
|
17
|
+
|
|
18
|
+
import android.content.Context;
|
|
19
|
+
import android.view.View;
|
|
20
|
+
|
|
21
|
+
import com.tencent.mtt.hippy.common.HippyMap;
|
|
22
|
+
|
|
23
|
+
public interface HippyCustomViewCreator {
|
|
24
|
+
|
|
25
|
+
String HIPPY_CUSTOM_VIEW_CREATOR = "CustomViewCreator";
|
|
26
|
+
|
|
27
|
+
@SuppressWarnings("deprecation")
|
|
28
|
+
View createCustomView(String className, Context context, HippyMap initialProps);
|
|
29
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
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.uimanager;
|
|
17
|
+
|
|
18
|
+
import android.util.Log;
|
|
19
|
+
import android.view.View;
|
|
20
|
+
import android.view.ViewGroup;
|
|
21
|
+
|
|
22
|
+
import com.tencent.mtt.hippy.annotation.HippyControllerProps;
|
|
23
|
+
import com.tencent.mtt.hippy.common.HippyArray;
|
|
24
|
+
import com.tencent.mtt.hippy.dom.node.NodeProps;
|
|
25
|
+
import com.tencent.mtt.hippy.views.list.HippyListView;
|
|
26
|
+
import com.tencent.mtt.hippy.views.list.TVRecyclerView;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Created by leonardgong on 2017/11/29 0029.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
public abstract class HippyGroupController<T extends ViewGroup & HippyViewBase> extends HippyViewController<T>
|
|
33
|
+
{
|
|
34
|
+
/** touch/click intercept **/
|
|
35
|
+
@HippyControllerProps(name = NodeProps.ON_INTERCEPT_TOUCH_EVENT, defaultType = HippyControllerProps.BOOLEAN, defaultBoolean = false)
|
|
36
|
+
public void setInterceptTouch(T viewGroup, boolean flag)
|
|
37
|
+
{
|
|
38
|
+
if (!handleGestureBySelf())
|
|
39
|
+
{
|
|
40
|
+
setGestureType(viewGroup, NodeProps.ON_INTERCEPT_TOUCH_EVENT, flag);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
/** touch/click intercept **/
|
|
49
|
+
@HippyControllerProps(name = NodeProps.ON_INTERCEPT_PULL_UP_EVENT, defaultType = HippyControllerProps.BOOLEAN, defaultBoolean = false)
|
|
50
|
+
public void setInterceptPullUp(T viewGroup, boolean flag)
|
|
51
|
+
{
|
|
52
|
+
if (!handleGestureBySelf())
|
|
53
|
+
{
|
|
54
|
+
setGestureType(viewGroup, NodeProps.ON_INTERCEPT_PULL_UP_EVENT, flag);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@Override
|
|
59
|
+
public void dispatchFunction(T view, String functionName, HippyArray dataArray)
|
|
60
|
+
{
|
|
61
|
+
super.dispatchFunction(view, functionName, dataArray);
|
|
62
|
+
switch (functionName)
|
|
63
|
+
{
|
|
64
|
+
case "requestChildFocus":
|
|
65
|
+
int p = dataArray.getInt(0);
|
|
66
|
+
if(view instanceof ViewGroup){
|
|
67
|
+
if(p > -1 && view.getChildCount() > p){
|
|
68
|
+
final View v = view.getChildAt(p);
|
|
69
|
+
if(v != null){
|
|
70
|
+
v.requestFocus();
|
|
71
|
+
Log.d("hippy","requestChildFocus index:"+p);
|
|
72
|
+
}else{
|
|
73
|
+
Log.e("hippy","requestChildFocus error invalid index:"+p);
|
|
74
|
+
}
|
|
75
|
+
}else{
|
|
76
|
+
Log.e("hippy","requestChildFocus error invalid index:"+p);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
break;
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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.uimanager;
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* FileName: HippyViewBase Description: History:
|
|
21
|
+
*/
|
|
22
|
+
public interface HippyViewBase {
|
|
23
|
+
|
|
24
|
+
NativeGestureDispatcher getGestureDispatcher();
|
|
25
|
+
|
|
26
|
+
void setGestureDispatcher(NativeGestureDispatcher dispatcher);
|
|
27
|
+
}
|