@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,572 @@
|
|
|
1
|
+
package com.tencent.extend.views.fastlist;
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import android.app.ActivityManager;
|
|
5
|
+
import android.content.Context;
|
|
6
|
+
import android.graphics.Rect;
|
|
7
|
+
import android.os.Build;
|
|
8
|
+
import android.support.annotation.NonNull;
|
|
9
|
+
import android.text.TextUtils;
|
|
10
|
+
import android.util.Log;
|
|
11
|
+
import android.view.View;
|
|
12
|
+
import android.view.ViewGroup;
|
|
13
|
+
import android.view.ViewParent;
|
|
14
|
+
|
|
15
|
+
import com.tencent.extend.views.TextViewController;
|
|
16
|
+
import com.tencent.mtt.hippy.HippyEngineContext;
|
|
17
|
+
import com.tencent.mtt.hippy.HippyInstanceContext;
|
|
18
|
+
import com.tencent.mtt.hippy.R;
|
|
19
|
+
import com.tencent.mtt.hippy.common.HippyArray;
|
|
20
|
+
import com.tencent.mtt.hippy.common.HippyMap;
|
|
21
|
+
import com.tencent.mtt.hippy.dom.DomUpdateManager;
|
|
22
|
+
import com.tencent.mtt.hippy.dom.flex.FlexSpacing;
|
|
23
|
+
import com.tencent.mtt.hippy.dom.node.DomNode;
|
|
24
|
+
import com.tencent.mtt.hippy.modules.Promise;
|
|
25
|
+
import com.tencent.mtt.hippy.uimanager.ControllerManager;
|
|
26
|
+
import com.tencent.mtt.hippy.uimanager.CustomControllerHelper;
|
|
27
|
+
import com.tencent.mtt.hippy.uimanager.HippyViewController;
|
|
28
|
+
import com.tencent.mtt.hippy.uimanager.RenderNode;
|
|
29
|
+
import com.tencent.mtt.hippy.utils.ExtendUtil;
|
|
30
|
+
import com.tencent.mtt.hippy.utils.LogUtils;
|
|
31
|
+
import com.tencent.mtt.hippy.utils.PixelUtil;
|
|
32
|
+
|
|
33
|
+
import java.util.ArrayList;
|
|
34
|
+
|
|
35
|
+
public class Utils {
|
|
36
|
+
|
|
37
|
+
static final String KEY_SINGLETON = "singleton";
|
|
38
|
+
static final String KEY_CONTENT_DELAY = "delayLoad";
|
|
39
|
+
static final String KEY_PLACEHOLDER_VIEW = "placeholderView";
|
|
40
|
+
|
|
41
|
+
public static final String HASFOCUS = "hasFocus";//是否含有焦点
|
|
42
|
+
public static final String ORIENTATION = "orientation";//方向
|
|
43
|
+
public static final String ITEMCOUNT = "itemCount";//item数量
|
|
44
|
+
public static final String FOCUS_POSITION = "focusPosition";//当前焦点position
|
|
45
|
+
public static final String SELECT_POSITION = "selectPosition";//当前选择position
|
|
46
|
+
public static final String OFFSETX = "offsetX";//x轴移动距离
|
|
47
|
+
public static final String OFFSETY = "offsetY";//y轴移动距离
|
|
48
|
+
public static final String WIDTH = "width";//宽度
|
|
49
|
+
public static final String HEIGHT = "height";//高度
|
|
50
|
+
public static final String SCROLLSTATE = "scrollState";//滑动状态 0:SCROLL_STATE_IDLE 1:SCROLL_STATE_DRAGGING 2:SCROLL_STATE_SETTLING
|
|
51
|
+
public static final String IS_SCROLL_UP = "isScrollUp";//是否向上滚动
|
|
52
|
+
public static final String IS_SCROLL_LEFT = "isScrollLeft";//是否向左滚动
|
|
53
|
+
|
|
54
|
+
static View createViewByNode(RenderNode node) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
static void copyNodeTree(FastAdapter.ElementNode target, DomNode source) {
|
|
59
|
+
cloneNode(target, source);
|
|
60
|
+
for (int i = 0; i < source.getChildCount(); i++) {
|
|
61
|
+
final DomNode sc = source.getChildAt(i);
|
|
62
|
+
FastAdapter.ElementNode tc = new FastAdapter.ElementNode();
|
|
63
|
+
target.addChildAt(tc, i);
|
|
64
|
+
copyNodeTree(tc, sc);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static void updateStyleSlot(FastAdapter.ElementNode node, HippyMap style, DomUpdateManager domUpdateManager) {
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
static HippyEngineContext getHippyContext(Context context) {
|
|
74
|
+
HippyEngineContext engineContext = ((HippyInstanceContext) context).getEngineContext();
|
|
75
|
+
return engineContext;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
static void buildEventBasic(HippyMap m, View view, FastAdapter.ElementNode node, int itemPosition) {
|
|
80
|
+
if (view.getParent() instanceof ViewGroup) {
|
|
81
|
+
ViewGroup p = (ViewGroup) view.getParent();
|
|
82
|
+
m.pushInt("index", p.indexOfChild(view));
|
|
83
|
+
}
|
|
84
|
+
// if(LogUtils.isDebug()) {
|
|
85
|
+
// Log.i("DebugEvent", "buildEventBasic itemPosition: " + itemPosition
|
|
86
|
+
// + ",elementNode adapterPosition:" + node.rootNode.adapterPosition);
|
|
87
|
+
// }
|
|
88
|
+
// int position = itemPosition;
|
|
89
|
+
// if(node.rootNode != null && node.rootNode.adapterPosition > -1){
|
|
90
|
+
// if(position != node.rootNode.adapterPosition){
|
|
91
|
+
// Log.w("DebugEvent","fix from position:"+position+" to "+node.rootNode.adapterPosition);
|
|
92
|
+
// }
|
|
93
|
+
// position = node.rootNode.adapterPosition;
|
|
94
|
+
// }
|
|
95
|
+
m.pushString("sid",ExtendUtil.getViewSID(view));
|
|
96
|
+
m.pushInt("position", itemPosition);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
static void setNode(View view, FastAdapter.ElementNode node) {
|
|
100
|
+
view.setTag(R.id.tag_view_node, node);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
static FastAdapter.ElementNode getNode(View view) {
|
|
104
|
+
final Object tag = view.getTag(R.id.tag_view_node);
|
|
105
|
+
if (tag != null) {
|
|
106
|
+
return (FastAdapter.ElementNode) tag;
|
|
107
|
+
}
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
static String getNameFromProps(HippyMap map) {
|
|
113
|
+
if (map != null) {
|
|
114
|
+
return map.getString("name");
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
static boolean containKey(HippyMap map, String key) {
|
|
120
|
+
return map != null && map.containsKey(key);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
static boolean containKey(RenderNode node, String key) {
|
|
124
|
+
return node != null && containKey(node.getProps(), key);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
static Object getPropFromProps(RenderNode node, String prop) {
|
|
129
|
+
if (node.getProps() != null && node.getProps().containsKey(prop)) {
|
|
130
|
+
return node.getProps().get(prop);
|
|
131
|
+
}
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
public static View findBoundView(HippyEngineContext context, RenderNode node) {
|
|
136
|
+
if (node == null) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
if (context != null && context.getRenderManager() != null && context.getRenderManager().getControllerManager() != null) {
|
|
140
|
+
return context.getRenderManager().getControllerManager().findView(node.getId());
|
|
141
|
+
}
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
public static View findBoundViewByNodeID(HippyEngineContext context, int nodeID) {
|
|
146
|
+
if (context != null && context.getRenderManager() != null && context.getRenderManager().getControllerManager() != null) {
|
|
147
|
+
return context.getRenderManager().getControllerManager().findView(nodeID);
|
|
148
|
+
}
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
public final static int ROUGH_PERFORMANCE_LOW = 0;
|
|
153
|
+
public final static int ROUGH_PERFORMANCE_MEDIUM = 1;
|
|
154
|
+
public final static int ROUGH_PERFORMANCE_HIGH = 2;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* 使用内存来粗略估算机器配置
|
|
158
|
+
* @param context
|
|
159
|
+
* @return
|
|
160
|
+
*/
|
|
161
|
+
public static int getRoughPerformance(Context context){
|
|
162
|
+
int level = ROUGH_PERFORMANCE_MEDIUM;
|
|
163
|
+
try {
|
|
164
|
+
// 2083119104
|
|
165
|
+
ActivityManager.MemoryInfo memInfo = getMemoryInfo(context);
|
|
166
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
|
167
|
+
Log.e("FAST_UTILS","memInfo total :"+memInfo.totalMem);
|
|
168
|
+
if(memInfo.totalMem > 2300000000L){//2G
|
|
169
|
+
level = ROUGH_PERFORMANCE_HIGH;
|
|
170
|
+
}else if(memInfo.totalMem < 800000000L){ // < 800M
|
|
171
|
+
level = ROUGH_PERFORMANCE_LOW;
|
|
172
|
+
}
|
|
173
|
+
}else{
|
|
174
|
+
//小于等于4.2直接设置为低端版本
|
|
175
|
+
level = ROUGH_PERFORMANCE_LOW;
|
|
176
|
+
}
|
|
177
|
+
}catch (Throwable t){}
|
|
178
|
+
return level;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
public static ActivityManager.MemoryInfo getMemoryInfo(Context context) {
|
|
182
|
+
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
|
183
|
+
ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
|
|
184
|
+
am.getMemoryInfo(mi);
|
|
185
|
+
return mi;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
static void cloneNodeLayout(DomNode c, DomNode o) {
|
|
189
|
+
if (o == null || c == null) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
c.setViewClassName(o.getViewClass());
|
|
193
|
+
|
|
194
|
+
if (o.getStyleWidth() > 0) {
|
|
195
|
+
c.setStyleWidth(o.getStyleWidth());
|
|
196
|
+
}
|
|
197
|
+
if (o.getStyleHeight() > 0) {
|
|
198
|
+
c.setStyleHeight(o.getStyleHeight());
|
|
199
|
+
}
|
|
200
|
+
for (int i = 0; i < 4; i++) {
|
|
201
|
+
c.setMargin(i, o.getMargin(i));
|
|
202
|
+
c.setPadding(i, o.getPadding(i));
|
|
203
|
+
c.setBorder(i, o.getBorder(i));
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
public static void resetNode(DomNode c, DomNode o) {
|
|
210
|
+
if (o == null || c == null) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
if (o.getStyleWidth() < 1) {
|
|
214
|
+
c.setStyleWidth(Float.NaN);
|
|
215
|
+
}
|
|
216
|
+
if (o.getStyleHeight() < 1) {
|
|
217
|
+
c.setStyleHeight(Float.NaN);
|
|
218
|
+
}
|
|
219
|
+
for (int i = 0; i < 4; i++) {
|
|
220
|
+
c.setMargin(i, o.getMargin(i));
|
|
221
|
+
c.setPadding(i, o.getPadding(i));
|
|
222
|
+
c.setBorder(i, o.getBorder(i));
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
static void cloneNode(DomNode c, DomNode o) {
|
|
227
|
+
if (o == null || c == null) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
c.setViewClassName(o.getViewClass());
|
|
231
|
+
c.setDirection(o.getDirection());
|
|
232
|
+
c.setFlexDirection(o.getFlexDirection());
|
|
233
|
+
c.setJustifyContent(o.getJustifyContent());
|
|
234
|
+
c.setAlignContent(o.getAlignContent());
|
|
235
|
+
c.setAlignItems(o.getAlignItems());
|
|
236
|
+
c.setAlignSelf(o.getAlignSelf());
|
|
237
|
+
c.setPositionType(o.getPositionType());
|
|
238
|
+
if (o.getPosition(FlexSpacing.TOP) != 0) {
|
|
239
|
+
c.setPosition(FlexSpacing.TOP, o.getPosition(FlexSpacing.TOP));
|
|
240
|
+
}
|
|
241
|
+
if (o.getPosition(FlexSpacing.LEFT) != 0) {
|
|
242
|
+
c.setPosition(FlexSpacing.LEFT, o.getPosition(FlexSpacing.LEFT));
|
|
243
|
+
}
|
|
244
|
+
if (o.getPosition(FlexSpacing.RIGHT) != 0) {
|
|
245
|
+
c.setPosition(FlexSpacing.RIGHT, o.getPosition(FlexSpacing.RIGHT));
|
|
246
|
+
}
|
|
247
|
+
if (o.getPosition(FlexSpacing.BOTTOM) != 0) {
|
|
248
|
+
c.setPosition(FlexSpacing.BOTTOM, o.getPosition(FlexSpacing.BOTTOM));
|
|
249
|
+
}
|
|
250
|
+
c.setWrap(o.Style().getWrap());
|
|
251
|
+
c.setOverflow(o.getOverflow());
|
|
252
|
+
c.setFlexGrow(o.getFlexGrow());
|
|
253
|
+
c.setFlexShrink(o.getFlexShrink());
|
|
254
|
+
c.setFlexBasis(o.getFlexBasis());
|
|
255
|
+
if (o.getStyleWidth() > 0) {
|
|
256
|
+
c.setStyleWidth(o.getStyleWidth());
|
|
257
|
+
}
|
|
258
|
+
if (o.getStyleHeight() > 0) {
|
|
259
|
+
c.setStyleHeight(o.getStyleHeight());
|
|
260
|
+
}
|
|
261
|
+
for (int i = 0; i < 4; i++) {
|
|
262
|
+
c.setMargin(i, o.getMargin(i));
|
|
263
|
+
c.setPadding(i, o.getPadding(i));
|
|
264
|
+
c.setBorder(i, o.getBorder(i));
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
public static int toPX(int value) {
|
|
269
|
+
return (int) PixelUtil.dp2px(value);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
public static RenderNode getRenderNode(View view) {
|
|
274
|
+
return getHippyContext(view).getRenderManager().getRenderNode(view.getId());
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
public static HippyEngineContext getHippyContext(View view) {
|
|
278
|
+
return ((HippyInstanceContext) view.getContext()).getEngineContext();
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
public static void updateProps(View view, RenderNode templateNode, HippyMap props) {
|
|
283
|
+
//根据模版和view更新属性
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
static boolean isPendingListNode(RenderNode node) {
|
|
288
|
+
return (node instanceof FastAdapter.ListNode);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
static boolean isPendingItemNode(RenderNode node) {
|
|
292
|
+
return (node instanceof FastItemNode);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
static String hashCode(Object object) {
|
|
296
|
+
if (object == null) {
|
|
297
|
+
return null;
|
|
298
|
+
}
|
|
299
|
+
return Integer.toHexString(object.hashCode());
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
public static void clearLayout(FastAdapter.ElementNode c) {
|
|
303
|
+
if (c == null) {
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
c.setStyleWidth(0);
|
|
307
|
+
c.setStyleHeight(0);
|
|
308
|
+
for (int i = 0; i < 4; i++) {
|
|
309
|
+
c.setMargin(i, 0);
|
|
310
|
+
c.setPadding(i, 0);
|
|
311
|
+
c.setBorder(i, 0);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
public static void updatePendingPropData(HippyMap itemToUpdate, HippyMap rawPendingPropsReverse, HippyMap propsToUpdate) {
|
|
317
|
+
if (rawPendingPropsReverse != null && itemToUpdate != null && propsToUpdate != null) {
|
|
318
|
+
for (String pendingProp : propsToUpdate.keySet()) {
|
|
319
|
+
TemplateCodeParser.setValueFromCode(itemToUpdate, pendingProp, propsToUpdate.get(pendingProp));
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
public static FastAdapter.ElementNode findElementNodeByName(String name, FastAdapter.ElementNode node) {
|
|
325
|
+
if (node.name != null && node.name.equals(name)) {
|
|
326
|
+
return node;
|
|
327
|
+
}
|
|
328
|
+
for (int i = 0; i < node.getChildCount(); i++) {
|
|
329
|
+
final FastAdapter.ElementNode child = (FastAdapter.ElementNode) node.getChildAt(i);
|
|
330
|
+
final FastAdapter.ElementNode target = findElementNodeByName(name, child);
|
|
331
|
+
if (target != null) {
|
|
332
|
+
return target;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
return null;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
public static FastAdapter.ElementNode findElementNodeBySID(String sid, FastAdapter.ElementNode node) {
|
|
339
|
+
// if (node.name != null && node.name.equals(name)) {
|
|
340
|
+
// return node;
|
|
341
|
+
// }
|
|
342
|
+
// for (int i = 0; i < node.getChildCount(); i++) {
|
|
343
|
+
// final FastAdapter.ElementNode child = (FastAdapter.ElementNode) node.getChildAt(i);
|
|
344
|
+
// final FastAdapter.ElementNode target = findElementNodeByName(name, child);
|
|
345
|
+
// if (target != null) {
|
|
346
|
+
// return target;
|
|
347
|
+
// }
|
|
348
|
+
// }
|
|
349
|
+
// return null;
|
|
350
|
+
//TODO
|
|
351
|
+
return null;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* 判断一个view是不是placeholderView
|
|
356
|
+
* @param view
|
|
357
|
+
* @return
|
|
358
|
+
*/
|
|
359
|
+
public static boolean isPlaceholderContainerView(View view){
|
|
360
|
+
return view instanceof FastAdapter.ItemRootView;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* 判断一个view的parent是不是tvList中的一个ItemRootView
|
|
365
|
+
* @param view
|
|
366
|
+
* @return
|
|
367
|
+
*/
|
|
368
|
+
public static boolean isParentItemRootView(View view){
|
|
369
|
+
if(view != null && view.getParent() instanceof FastAdapter.ItemRootView){
|
|
370
|
+
return true;
|
|
371
|
+
}
|
|
372
|
+
return false;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* 通过一个view获取他的placeholderView
|
|
377
|
+
* @param contentView
|
|
378
|
+
* @return
|
|
379
|
+
*/
|
|
380
|
+
public static View getPlaceholderContainer(View contentView){
|
|
381
|
+
if (contentView != null && contentView.getParent() instanceof FastAdapter.ItemRootView) {
|
|
382
|
+
return (View) contentView.getParent();
|
|
383
|
+
}
|
|
384
|
+
return null;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
*
|
|
389
|
+
* @param view
|
|
390
|
+
* @param id
|
|
391
|
+
* @return
|
|
392
|
+
*/
|
|
393
|
+
public static View findItemViewByID(View view,String id){
|
|
394
|
+
if (TextUtils.isEmpty(id)) {
|
|
395
|
+
return null;
|
|
396
|
+
}
|
|
397
|
+
if(id.equals(ExtendUtil.getViewSID(view))){
|
|
398
|
+
return view;
|
|
399
|
+
}
|
|
400
|
+
if(view instanceof ViewGroup){
|
|
401
|
+
for(int i =0 ; i < ((ViewGroup) view).getChildCount(); i ++){
|
|
402
|
+
View v = findItemViewByID(((ViewGroup) view).getChildAt(i),id);
|
|
403
|
+
if (v != null) {
|
|
404
|
+
return v;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
return null;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
public static String findPropByPendingProp(String pendingProp, FastAdapter.ElementNode node) {
|
|
412
|
+
if (node != null && pendingProp != null) {
|
|
413
|
+
final RenderNode templateNode = node.templateNode;
|
|
414
|
+
if (templateNode != null && templateNode.getProps() != null) {
|
|
415
|
+
for (String key : templateNode.getProps().keySet()) {
|
|
416
|
+
final String valueKey = TemplateCodeParser.parsePendingProp(templateNode.getProps().get(key));
|
|
417
|
+
if (pendingProp.equals(valueKey)) {
|
|
418
|
+
return key;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
return null;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
public static int searchFastAdapterData(HippyArray array,Object id,String key){
|
|
427
|
+
int index = -1;
|
|
428
|
+
if (array == null || id == null || TextUtils.isEmpty(key)) {
|
|
429
|
+
return -1;
|
|
430
|
+
}
|
|
431
|
+
for(int i = 0 ; i < array.size(); i ++){
|
|
432
|
+
final FastAdapter.ItemEntity ie = (FastAdapter.ItemEntity) array.get(i);
|
|
433
|
+
if (ie.raw instanceof HippyMap) {
|
|
434
|
+
final HippyMap item = (HippyMap) ie.raw;
|
|
435
|
+
if(item.get(key) != null && item.get(key).equals(id)){
|
|
436
|
+
index = i;
|
|
437
|
+
break;
|
|
438
|
+
}else{
|
|
439
|
+
// Log.i("RenderUtil","searchFastAdapterData 1 skip!!! i:"+i+",item:"+item.get(key)+",item:"+item+",key:"+key);
|
|
440
|
+
}
|
|
441
|
+
}else{
|
|
442
|
+
// Log.e("RenderUtil","searchFastAdapterData error raw is not hippyMap:"+ie.raw);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
return index;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
public static boolean isWrapContent(FastAdapter.ElementNode node) {
|
|
452
|
+
return node.templateNode.getProps() != null && node.templateNode.getProps().containsKey("wrapContent");
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
public static boolean isWrapWidth(FastAdapter.ElementNode node) {
|
|
456
|
+
return node.templateNode.getProps() != null && node.templateNode.getProps().containsKey("autoWidth");
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
public static boolean isWrapHeight(FastAdapter.ElementNode node) {
|
|
460
|
+
return node.templateNode.getProps() != null && node.templateNode.getProps().containsKey("autoHeight");
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
public static View createViewImpl4FastList(Context context, HippyMap iniProps, HippyViewController controller) {
|
|
465
|
+
if (controller instanceof TextViewController) {
|
|
466
|
+
return ((TextViewController) controller).createViewImpl(context, iniProps, true);
|
|
467
|
+
}
|
|
468
|
+
return CustomControllerHelper.createViewImpl(context, iniProps, controller);
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
public static void dispatchFunction(ControllerManager cm, FastAdapter.ElementNode targetNode, String functionTargetName, HippyArray array, Promise promise) {
|
|
473
|
+
HippyViewController hippyViewController = CustomControllerHelper.getViewController(cm, targetNode.templateNode);
|
|
474
|
+
final View view = targetNode.boundView;
|
|
475
|
+
if (hippyViewController != null && view != null) {
|
|
476
|
+
if (promise == null || !promise.isCallback()) {
|
|
477
|
+
hippyViewController.dispatchFunction(view, functionTargetName, array);
|
|
478
|
+
} else {
|
|
479
|
+
hippyViewController.dispatchFunction(view, functionTargetName, array, promise);
|
|
480
|
+
}
|
|
481
|
+
} else {
|
|
482
|
+
Log.e("Utils", "dispatchFunction error, view:" + view + ",controller:" + hippyViewController + ",functionTargetName:" + functionTargetName);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
public static int findParentPositionByView(View v, int level) {
|
|
487
|
+
if(LogUtils.isDebug()) {
|
|
488
|
+
Log.i("ElementCallback", "findParentPositionByView " + level + ",view :" + ExtendUtil.debugView(v));
|
|
489
|
+
}
|
|
490
|
+
final ViewParent parent = v.getParent();
|
|
491
|
+
if (parent instanceof FastPendingView) {
|
|
492
|
+
if (level == 1) {
|
|
493
|
+
//找到对应view
|
|
494
|
+
return ((FastPendingView) parent).findPositionByChild(v);
|
|
495
|
+
}
|
|
496
|
+
if (level == 0) {
|
|
497
|
+
return findParentPositionByView((View) parent, level + 1);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
if (parent instanceof ViewGroup) {
|
|
501
|
+
return findParentPositionByView((View) parent, level);
|
|
502
|
+
}
|
|
503
|
+
return -1;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
//获取fastlist状态
|
|
507
|
+
public static HippyMap getFastListState(FastListView fastListView) {
|
|
508
|
+
HippyMap hippyMap = new HippyMap();
|
|
509
|
+
if (fastListView != null) {
|
|
510
|
+
hippyMap.pushBoolean(HASFOCUS, fastListView.hasFocus());
|
|
511
|
+
hippyMap.pushInt(ORIENTATION, fastListView.getLayoutManagerCompat().getOrientation());
|
|
512
|
+
hippyMap.pushInt(ITEMCOUNT, fastListView.getFastAdapter() != null ? fastListView.getFastAdapter().getItemCount() : 0);
|
|
513
|
+
hippyMap.pushInt(FOCUS_POSITION,fastListView.getFocusedChild() != null ?
|
|
514
|
+
fastListView.getChildAdapterPosition(fastListView.getFocusedChild()) : -1);
|
|
515
|
+
hippyMap.pushInt(SELECT_POSITION, fastListView.getSelectChildPosition());
|
|
516
|
+
hippyMap.pushInt(OFFSETX, fastListView.getOffsetX());
|
|
517
|
+
hippyMap.pushInt(OFFSETY, fastListView.getOffsetY());
|
|
518
|
+
hippyMap.pushInt(WIDTH, fastListView.getMeasuredWidth());
|
|
519
|
+
hippyMap.pushInt(HEIGHT, fastListView.getMeasuredHeight());
|
|
520
|
+
hippyMap.pushInt(SCROLLSTATE, fastListView.getScrollState());
|
|
521
|
+
hippyMap.pushBoolean(IS_SCROLL_UP, fastListView.getLayoutManagerCompat().getExecutor().isScrollUp());
|
|
522
|
+
hippyMap.pushBoolean(IS_SCROLL_LEFT, fastListView.getLayoutManagerCompat().getExecutor().isScrollLeft());
|
|
523
|
+
}
|
|
524
|
+
return hippyMap;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
//获取fastlist状态
|
|
528
|
+
public static void getFastListState(FastListView fastListView,HippyMap hippyMap) {
|
|
529
|
+
if (fastListView != null) {
|
|
530
|
+
hippyMap.pushInt(ORIENTATION, fastListView.getLayoutManagerCompat().getOrientation());
|
|
531
|
+
hippyMap.pushInt(ITEMCOUNT, fastListView.getFastAdapter() != null ? fastListView.getFastAdapter().getItemCount() : 0);
|
|
532
|
+
hippyMap.pushInt(FOCUS_POSITION,fastListView.getFocusedChild() != null ?
|
|
533
|
+
fastListView.getChildAdapterPosition(fastListView.getFocusedChild()) : -1);
|
|
534
|
+
hippyMap.pushInt(SELECT_POSITION, fastListView.getSelectChildPosition());
|
|
535
|
+
hippyMap.pushInt(OFFSETX, fastListView.getOffsetX());
|
|
536
|
+
hippyMap.pushInt(OFFSETY, fastListView.getOffsetY());
|
|
537
|
+
hippyMap.pushInt(SCROLLSTATE, fastListView.getScrollState());
|
|
538
|
+
hippyMap.pushBoolean(IS_SCROLL_UP, fastListView.getLayoutManagerCompat().getExecutor().isScrollUp());
|
|
539
|
+
hippyMap.pushBoolean(IS_SCROLL_LEFT, fastListView.getLayoutManagerCompat().getExecutor().isScrollLeft());
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
public static void findSameRowChildrenInGridLayout(View[] views, View targetView, @NonNull ArrayList<View> resultList, int tolerance, boolean horizontal){
|
|
544
|
+
|
|
545
|
+
// Log.i("ZHAOPENG","findSameRowViewsInGridLayout tolerance:" + tolerance + ",horizontal:" + horizontal+",targetView:"+targetView);
|
|
546
|
+
if ( views == null || targetView == null) {
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
for (View view : views) {
|
|
550
|
+
if(view == targetView){
|
|
551
|
+
continue;
|
|
552
|
+
}
|
|
553
|
+
if (view != null && view.getVisibility() == View.VISIBLE) {
|
|
554
|
+
Rect rect = new Rect();
|
|
555
|
+
rect.set(view.getLeft(), view.getTop(), view.getRight(), view.getBottom());
|
|
556
|
+
//简单的判断,只要俩个view的边界和目标view的边界相差在tolerance范围内,就认为是同一行
|
|
557
|
+
if (horizontal) {
|
|
558
|
+
if (Math.abs(targetView.getLeft() - rect.left) <= tolerance && Math.abs(targetView.getRight() - rect.right) <= tolerance) {
|
|
559
|
+
resultList.add(view);
|
|
560
|
+
}
|
|
561
|
+
} else {
|
|
562
|
+
if (Math.abs(targetView.getTop() - rect.top) <= tolerance && Math.abs(targetView.getBottom() - rect.bottom) <= tolerance) {
|
|
563
|
+
resultList.add(view);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
}
|