@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,512 @@
|
|
|
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.text;
|
|
17
|
+
|
|
18
|
+
import android.content.Context;
|
|
19
|
+
import android.graphics.Canvas;
|
|
20
|
+
import android.graphics.Color;
|
|
21
|
+
import android.graphics.Paint;
|
|
22
|
+
import android.graphics.drawable.Drawable;
|
|
23
|
+
import android.graphics.drawable.LayerDrawable;
|
|
24
|
+
import android.os.Build;
|
|
25
|
+
import android.text.Layout;
|
|
26
|
+
import android.text.Spannable;
|
|
27
|
+
import android.text.SpannableStringBuilder;
|
|
28
|
+
import android.text.Spanned;
|
|
29
|
+
import android.text.style.AbsoluteSizeSpan;
|
|
30
|
+
import android.text.style.ForegroundColorSpan;
|
|
31
|
+
import android.util.Log;
|
|
32
|
+
import android.view.MotionEvent;
|
|
33
|
+
import android.view.View;
|
|
34
|
+
|
|
35
|
+
import com.tencent.mtt.hippy.HippyEngineContext;
|
|
36
|
+
import com.tencent.mtt.hippy.HippyInstanceContext;
|
|
37
|
+
import com.tencent.mtt.hippy.adapter.exception.HippyExceptionHandlerAdapter;
|
|
38
|
+
import com.tencent.mtt.hippy.dom.node.DomNode;
|
|
39
|
+
import com.tencent.mtt.hippy.dom.node.HippyNativeGestureSpan;
|
|
40
|
+
import com.tencent.mtt.hippy.dom.node.TextNode;
|
|
41
|
+
import com.tencent.mtt.hippy.uimanager.HippyViewBase;
|
|
42
|
+
import com.tencent.mtt.hippy.uimanager.NativeGestureDispatcher;
|
|
43
|
+
import com.tencent.mtt.hippy.utils.ExtendUtil;
|
|
44
|
+
import com.tencent.mtt.hippy.utils.LogUtils;
|
|
45
|
+
import com.tencent.mtt.hippy.views.common.CommonBackgroundDrawable;
|
|
46
|
+
import com.tencent.mtt.hippy.views.common.CommonBorder;
|
|
47
|
+
import com.tencent.mtt.hippy.views.list.HippyRecycler;
|
|
48
|
+
import com.tencent.mtt.supportui.views.IShadow;
|
|
49
|
+
|
|
50
|
+
@SuppressWarnings({"unused"})
|
|
51
|
+
public class HippyTextView extends View implements CommonBorder, HippyViewBase, HippyRecycler, IShadow {
|
|
52
|
+
|
|
53
|
+
private CommonBackgroundDrawable mBGDrawable;
|
|
54
|
+
|
|
55
|
+
private boolean mNativeGestureEnable = false;
|
|
56
|
+
|
|
57
|
+
private HippyNativeGestureSpan mNativeGestureSpan;
|
|
58
|
+
|
|
59
|
+
private NativeGestureDispatcher mGestureDispatcher;
|
|
60
|
+
|
|
61
|
+
protected Layout mLayout = null;
|
|
62
|
+
|
|
63
|
+
private boolean mTextBold = false;
|
|
64
|
+
|
|
65
|
+
private int mNativeTextColor = 0;
|
|
66
|
+
private boolean mHasSetNativeTextColor = false;
|
|
67
|
+
|
|
68
|
+
//zhaopeng add
|
|
69
|
+
private int mFocusColor = Color.TRANSPARENT;
|
|
70
|
+
private int mSelectColor = Color.TRANSPARENT;
|
|
71
|
+
private boolean selectState = false;
|
|
72
|
+
|
|
73
|
+
// add by WP
|
|
74
|
+
private int mShadowColor;
|
|
75
|
+
private float mShadowOffsetX;
|
|
76
|
+
private float mShadowOffsetY;
|
|
77
|
+
private float mShadowOpacity;
|
|
78
|
+
private float mShadowRadius;
|
|
79
|
+
private float mShadowSpread;
|
|
80
|
+
|
|
81
|
+
@Override
|
|
82
|
+
public void resetProps() {
|
|
83
|
+
setPadding(0, 0, 0, 0);
|
|
84
|
+
mNativeGestureEnable = false;
|
|
85
|
+
mBGDrawable = null;
|
|
86
|
+
//noinspection deprecation
|
|
87
|
+
setBackgroundDrawable(null);
|
|
88
|
+
mTextBold = false;
|
|
89
|
+
mGestureDispatcher = null;
|
|
90
|
+
mNativeGestureSpan = null;
|
|
91
|
+
mNativeTextColor = 0;
|
|
92
|
+
mHasSetNativeTextColor = false;
|
|
93
|
+
mLayout = null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@Override
|
|
97
|
+
public void clear() {
|
|
98
|
+
mLayout = null;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@Override
|
|
102
|
+
public void onResetBeforeCache() {
|
|
103
|
+
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@Override
|
|
107
|
+
public void notifySaveState() {
|
|
108
|
+
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
@Override
|
|
112
|
+
public void notifyRestoreState() {
|
|
113
|
+
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@Override
|
|
117
|
+
public void setId(int id) {
|
|
118
|
+
super.setId(id);
|
|
119
|
+
|
|
120
|
+
Context context = getContext();
|
|
121
|
+
if (context instanceof HippyInstanceContext) {
|
|
122
|
+
HippyEngineContext engineContext = ((HippyInstanceContext) context).getEngineContext();
|
|
123
|
+
if (engineContext != null) {
|
|
124
|
+
DomNode node = engineContext.getDomManager().getNode(id);
|
|
125
|
+
if (node instanceof TextNode) {
|
|
126
|
+
((TextNode) node).setTextView(this);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
public HippyTextView(Context context) {
|
|
133
|
+
super(context);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
public void setTextBold(boolean bold) {
|
|
137
|
+
mTextBold = bold;
|
|
138
|
+
postInvalidate();
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
public void setLayout(Layout layout) {
|
|
143
|
+
if (mLayout != null) {
|
|
144
|
+
invalidate();
|
|
145
|
+
}
|
|
146
|
+
mLayout = layout;
|
|
147
|
+
if (mHasSetNativeTextColor && mNativeTextColor != 0) {
|
|
148
|
+
// setTextColor(mNativeTextColor);
|
|
149
|
+
drawableStateChanged();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
//user in tabHost
|
|
155
|
+
public void setCustomColor(int color) {
|
|
156
|
+
mHasSetNativeTextColor = true;
|
|
157
|
+
mNativeTextColor = color;
|
|
158
|
+
setTextColor(color);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
@Override
|
|
162
|
+
protected void onDraw(Canvas canvas) {
|
|
163
|
+
try {
|
|
164
|
+
super.onDraw(canvas);
|
|
165
|
+
if (mLayout != null) {
|
|
166
|
+
if(LogUtils.isDebug()) {
|
|
167
|
+
LogUtils.d("HippyText",
|
|
168
|
+
"id: " + getId() + " mExtra : " + mLayout.getText() + "layout : w:" + mLayout.getWidth()
|
|
169
|
+
+ " h:" + mLayout.getHeight()
|
|
170
|
+
+ " view : w:" + getWidth() + " h:" + getHeight() + " textColor:" + mLayout
|
|
171
|
+
.getPaint().getColor());
|
|
172
|
+
}
|
|
173
|
+
canvas.save();
|
|
174
|
+
switch (mLayout.getAlignment()) {
|
|
175
|
+
case ALIGN_CENTER:
|
|
176
|
+
int totalHeight =
|
|
177
|
+
getHeight() + getPaddingTop() + getPaddingBottom() - mLayout.getHeight();
|
|
178
|
+
int width = (getWidth() - mLayout.getWidth()) / 2;
|
|
179
|
+
canvas.translate((float) width, totalHeight / 2.0f);
|
|
180
|
+
break;
|
|
181
|
+
case ALIGN_OPPOSITE:
|
|
182
|
+
int x = getWidth() - getPaddingRight() - mLayout.getWidth();
|
|
183
|
+
canvas.translate(x, 0);
|
|
184
|
+
break;
|
|
185
|
+
default:
|
|
186
|
+
canvas.translate(getPaddingLeft(), getPaddingTop());
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
Paint paint = mLayout.getPaint();
|
|
190
|
+
if (paint != null) {
|
|
191
|
+
paint.setFakeBoldText(mTextBold);
|
|
192
|
+
if(mShadowColor != Color.TRANSPARENT && (mShadowOffsetX != 0 || mShadowOffsetY != 0)) {
|
|
193
|
+
paint.setShadowLayer(mShadowRadius, mShadowOffsetX, mShadowOffsetY, mShadowColor);
|
|
194
|
+
// paint.setShadowLayer(mShadowRadius, mShadowOffsetX, mShadowOffsetY, ((mShadowColor & 0x00FFFFFF) | (0x40 << 24)));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
mLayout.draw(canvas);
|
|
199
|
+
|
|
200
|
+
canvas.restore();
|
|
201
|
+
} else {
|
|
202
|
+
if(LogUtils.isDebug()) {
|
|
203
|
+
LogUtils.d("HippyText", "id: " + getId() + " mExtra : is null ");
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
} catch (Throwable e) {
|
|
207
|
+
Context context = getContext();
|
|
208
|
+
if (context instanceof HippyInstanceContext) {
|
|
209
|
+
HippyInstanceContext hippyInstanceContext = (HippyInstanceContext) context;
|
|
210
|
+
HippyExceptionHandlerAdapter defaultExceptionHandler = hippyInstanceContext
|
|
211
|
+
.getEngineContext().getGlobalConfigs()
|
|
212
|
+
.getExceptionHandler();
|
|
213
|
+
if (defaultExceptionHandler != null) {
|
|
214
|
+
defaultExceptionHandler
|
|
215
|
+
.handleNativeException(new RuntimeException("hippyTextView onDraw" + e.getMessage()),
|
|
216
|
+
true);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
@Override
|
|
223
|
+
public void setSelected(boolean selected) {
|
|
224
|
+
super.setSelected(selected);
|
|
225
|
+
if(LogUtils.isDebug()) {
|
|
226
|
+
LogUtils.d("HippyTextViewLog", "setSelected :" + selected + "," + this);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
@Override
|
|
232
|
+
protected void onAttachedToWindow() {
|
|
233
|
+
super.onAttachedToWindow();
|
|
234
|
+
refreshDrawableState();
|
|
235
|
+
if(selectState){
|
|
236
|
+
setSelected(true);
|
|
237
|
+
}
|
|
238
|
+
if(LogUtils.isDebug()) {
|
|
239
|
+
LogUtils.d("HippyTextViewLog", "isSelected :" + isSelected() + ",selectState " + selectState + "," + this);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
@Override
|
|
244
|
+
protected void onDetachedFromWindow() {
|
|
245
|
+
super.onDetachedFromWindow();
|
|
246
|
+
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
@Override
|
|
250
|
+
protected void dispatchDraw(Canvas canvas) {
|
|
251
|
+
super.dispatchDraw(canvas);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
public void setBorderRadius(float radius, int position) {
|
|
255
|
+
getBackGround().setBorderRadius(radius, position);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
public void setBorderWidth(float width, int position) {
|
|
259
|
+
getBackGround().setBorderWidth(width, position);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
public void setBorderColor(int color, int position) {
|
|
263
|
+
getBackGround().setBorderColor(color, position);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
@Override
|
|
267
|
+
public void setBorderStyle(int borderStyle) {
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
@Override
|
|
271
|
+
public void setBackgroundColor(int color) {
|
|
272
|
+
getBackGround().setBackgroundColor(color);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
private CommonBackgroundDrawable getBackGround() {
|
|
276
|
+
if (mBGDrawable == null) {
|
|
277
|
+
mBGDrawable = new CommonBackgroundDrawable();
|
|
278
|
+
Drawable currBGDrawable = getBackground();
|
|
279
|
+
//noinspection deprecation
|
|
280
|
+
super.setBackgroundDrawable(null);
|
|
281
|
+
if (currBGDrawable == null) {
|
|
282
|
+
//noinspection deprecation
|
|
283
|
+
super.setBackgroundDrawable(mBGDrawable);
|
|
284
|
+
} else {
|
|
285
|
+
LayerDrawable layerDrawable = new LayerDrawable(
|
|
286
|
+
new Drawable[]{mBGDrawable, currBGDrawable});
|
|
287
|
+
//noinspection deprecation
|
|
288
|
+
super.setBackgroundDrawable(layerDrawable);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
return mBGDrawable;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
protected void setTextColor(int textColor) {
|
|
297
|
+
if (mLayout != null && mLayout.getText() instanceof SpannableStringBuilder) {
|
|
298
|
+
SpannableStringBuilder textSpan = (SpannableStringBuilder) mLayout.getText();
|
|
299
|
+
ForegroundColorSpan[] spans = textSpan
|
|
300
|
+
.getSpans(0, mLayout.getText().length(), ForegroundColorSpan.class);
|
|
301
|
+
boolean hasSpans = false;
|
|
302
|
+
if (spans != null) {
|
|
303
|
+
for (ForegroundColorSpan span : spans) {
|
|
304
|
+
int start = textSpan.getSpanStart(span);
|
|
305
|
+
int end = textSpan.getSpanEnd(span);
|
|
306
|
+
textSpan.removeSpan(span);
|
|
307
|
+
int spanFlags = Spannable.SPAN_EXCLUSIVE_INCLUSIVE;
|
|
308
|
+
if (start == 0) {
|
|
309
|
+
spanFlags = Spannable.SPAN_INCLUSIVE_INCLUSIVE;
|
|
310
|
+
}
|
|
311
|
+
textSpan.setSpan(new ForegroundColorSpan(textColor), start, end, spanFlags);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
if (spans == null || spans.length == 0) {
|
|
315
|
+
textSpan.setSpan(new ForegroundColorSpan(textColor), 0, textSpan.toString().length(),
|
|
316
|
+
Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
@Override
|
|
322
|
+
public NativeGestureDispatcher getGestureDispatcher() {
|
|
323
|
+
return mGestureDispatcher;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
@Override
|
|
327
|
+
public void setGestureDispatcher(NativeGestureDispatcher dispatcher) {
|
|
328
|
+
mGestureDispatcher = dispatcher;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
@Override
|
|
332
|
+
public boolean dispatchTouchEvent(MotionEvent event) {
|
|
333
|
+
|
|
334
|
+
if (!mNativeGestureEnable) {
|
|
335
|
+
return super.dispatchTouchEvent(event);
|
|
336
|
+
}
|
|
337
|
+
int action = event.getAction();
|
|
338
|
+
|
|
339
|
+
if (action == MotionEvent.ACTION_DOWN) {
|
|
340
|
+
mNativeGestureSpan = findNativeGestureSpanForTouch(event);
|
|
341
|
+
}
|
|
342
|
+
if (mNativeGestureSpan != null) {
|
|
343
|
+
boolean flag = mNativeGestureSpan.handleDispatchTouchEvent(this, event);
|
|
344
|
+
if (flag) {
|
|
345
|
+
super.dispatchTouchEvent(event);
|
|
346
|
+
return true;
|
|
347
|
+
} else {
|
|
348
|
+
return super.dispatchTouchEvent(event);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
return super.dispatchTouchEvent(event);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
@Override
|
|
355
|
+
public boolean onTouchEvent(MotionEvent event) {
|
|
356
|
+
boolean result = super.onTouchEvent(event);
|
|
357
|
+
if (mNativeGestureSpan != null) {
|
|
358
|
+
result |= mNativeGestureSpan.handleTouchEvent(this, event);
|
|
359
|
+
}
|
|
360
|
+
return result;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
public void setNativeGestureEnable(boolean nativeGestureEnable) {
|
|
364
|
+
this.mNativeGestureEnable = nativeGestureEnable;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
private HippyNativeGestureSpan findNativeGestureSpanForTouch(MotionEvent event) {
|
|
369
|
+
HippyNativeGestureSpan span = null;
|
|
370
|
+
if (mLayout == null) {
|
|
371
|
+
return null;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
int x = (int) event.getX();
|
|
375
|
+
int y = (int) event.getY();
|
|
376
|
+
|
|
377
|
+
switch (mLayout.getAlignment()) {
|
|
378
|
+
case ALIGN_CENTER: {
|
|
379
|
+
int totalHeight = getHeight() + getPaddingTop() + getPaddingBottom() - mLayout.getHeight();
|
|
380
|
+
int width = (getWidth() - mLayout.getWidth()) / 2;
|
|
381
|
+
x -= width;
|
|
382
|
+
y -= totalHeight / 2;
|
|
383
|
+
}
|
|
384
|
+
break;
|
|
385
|
+
case ALIGN_OPPOSITE: {
|
|
386
|
+
int width = getWidth() - getPaddingRight() - mLayout.getWidth();
|
|
387
|
+
x -= width;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
}
|
|
391
|
+
Layout layout = mLayout;
|
|
392
|
+
int line = layout.getLineForVertical(y);
|
|
393
|
+
|
|
394
|
+
int lineStartX = (int) layout.getLineLeft(line);
|
|
395
|
+
int lineEndX = (int) layout.getLineRight(line);
|
|
396
|
+
|
|
397
|
+
CharSequence charSequence = layout.getText();
|
|
398
|
+
if (charSequence instanceof Spanned && x >= lineStartX && x <= lineEndX) {
|
|
399
|
+
Spanned spannedText = (Spanned) charSequence;
|
|
400
|
+
int index = mLayout.getOffsetForHorizontal(line, x);
|
|
401
|
+
|
|
402
|
+
HippyNativeGestureSpan[] spans = spannedText
|
|
403
|
+
.getSpans(index, index, HippyNativeGestureSpan.class);
|
|
404
|
+
|
|
405
|
+
if (spans != null && spans.length > 0) {
|
|
406
|
+
int targetSpanTextLength = charSequence.length();
|
|
407
|
+
for (HippyNativeGestureSpan hippyNativeGestureSpan : spans) {
|
|
408
|
+
int spanStart = spannedText.getSpanStart(hippyNativeGestureSpan);
|
|
409
|
+
int spanEnd = spannedText.getSpanEnd(hippyNativeGestureSpan);
|
|
410
|
+
if (spanEnd > index && (spanEnd - spanStart) <= targetSpanTextLength) {
|
|
411
|
+
span = hippyNativeGestureSpan;
|
|
412
|
+
targetSpanTextLength = (spanEnd - spanStart);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
//extend touch area ,if there is no touch event on the text ,use the first node ,it must be the real node
|
|
418
|
+
if (span == null && charSequence instanceof Spanned) {
|
|
419
|
+
Spanned spanned = (Spanned) charSequence;
|
|
420
|
+
HippyNativeGestureSpan[] spans = spanned
|
|
421
|
+
.getSpans(0, spanned.length(), HippyNativeGestureSpan.class);
|
|
422
|
+
if (spans.length == 1) //only support one text node
|
|
423
|
+
{
|
|
424
|
+
AbsoluteSizeSpan[] absoluteSizeSpan = spanned
|
|
425
|
+
.getSpans(0, spanned.length(), AbsoluteSizeSpan.class);
|
|
426
|
+
if (!spans[0].isVirtual() && absoluteSizeSpan.length == 1) {
|
|
427
|
+
span = spans[0];
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
return span;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
private Runnable updateTextTask;
|
|
435
|
+
private void postSetTextColor(final int textColor){
|
|
436
|
+
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT_WATCH){
|
|
437
|
+
//zhaopeng 2023 19以下设备存在文本颜色不能正常变化的问题,所以这里兼容一下
|
|
438
|
+
setTextColor(textColor);
|
|
439
|
+
postInvalidateDelayed(16);
|
|
440
|
+
}else{
|
|
441
|
+
if(updateTextTask != null){
|
|
442
|
+
removeCallbacks(updateTextTask);
|
|
443
|
+
}
|
|
444
|
+
updateTextTask = () -> {
|
|
445
|
+
setTextColor(textColor);
|
|
446
|
+
invalidate();
|
|
447
|
+
};
|
|
448
|
+
postDelayed(updateTextTask,16);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
//zhaopeng add
|
|
453
|
+
@Override
|
|
454
|
+
protected void drawableStateChanged() {
|
|
455
|
+
super.drawableStateChanged();
|
|
456
|
+
//
|
|
457
|
+
if(isFocusable() || isDuplicateParentStateEnabled() ) {
|
|
458
|
+
if(mFocusColor != 0){
|
|
459
|
+
final boolean focused = ExtendUtil.stateContainsAttribute(getDrawableState(), android.R.attr.state_focused);
|
|
460
|
+
// if(LogUtils.isDebug()) {
|
|
461
|
+
// Log.d("DrawableStateTAG", "text drawableStateChanged:this:" + getId() + ",color:" + mFocusColor + ",focusedState:" + focused + ",isFocused:" + isFocused());
|
|
462
|
+
// }
|
|
463
|
+
if(focused || isFocused()){
|
|
464
|
+
postSetTextColor(mFocusColor);
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
if(mSelectColor != 0){
|
|
469
|
+
final boolean selected = ExtendUtil.stateContainsAttribute(getDrawableState(), android.R.attr.state_selected);
|
|
470
|
+
// if(LogUtils.isDebug()) {
|
|
471
|
+
// LogUtils.d("HippyTextViewLog", "drawableStateChanged selected:" + (selected || isSelected()) + "," + this);
|
|
472
|
+
// }
|
|
473
|
+
if(selected || isSelected()){
|
|
474
|
+
postSetTextColor(mSelectColor);
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
postSetTextColor(mNativeTextColor);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
public void setFocusColor(int color) {
|
|
484
|
+
this.mFocusColor = color;
|
|
485
|
+
invalidate();
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
public void setSelectColor(int color) {
|
|
489
|
+
this.mSelectColor = color;
|
|
490
|
+
invalidate();
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
public void setSelectState(boolean selectState) {
|
|
494
|
+
this.selectState = selectState;
|
|
495
|
+
setSelected(selectState);
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
public void setShadowOffsetY(float y){
|
|
500
|
+
mShadowOffsetY = y;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
public void setShadowOffsetX(float x){ mShadowOffsetX = x;}
|
|
504
|
+
|
|
505
|
+
public void setShadowOpacity(float opacity){ mShadowOpacity = opacity;}
|
|
506
|
+
|
|
507
|
+
public void setShadowRadius(float radius){ mShadowRadius = radius;}
|
|
508
|
+
|
|
509
|
+
public void setShadowSpread(float spread){mShadowSpread = spread;}
|
|
510
|
+
|
|
511
|
+
public void setShadowColor(int color){ mShadowColor = color;}
|
|
512
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
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.text;
|
|
17
|
+
|
|
18
|
+
import android.content.Context;
|
|
19
|
+
import android.text.Layout;
|
|
20
|
+
import android.text.Spannable;
|
|
21
|
+
import android.view.View;
|
|
22
|
+
import com.tencent.mtt.hippy.annotation.HippyController;
|
|
23
|
+
import com.tencent.mtt.hippy.annotation.HippyControllerProps;
|
|
24
|
+
import com.tencent.mtt.hippy.dom.node.HippyNativeGestureSpan;
|
|
25
|
+
import com.tencent.mtt.hippy.dom.node.NodeProps;
|
|
26
|
+
import com.tencent.mtt.hippy.dom.node.StyleNode;
|
|
27
|
+
import com.tencent.mtt.hippy.dom.node.TextExtra;
|
|
28
|
+
import com.tencent.mtt.hippy.dom.node.TextNode;
|
|
29
|
+
import com.tencent.mtt.hippy.uimanager.HippyViewController;
|
|
30
|
+
|
|
31
|
+
@SuppressWarnings({"unused"})
|
|
32
|
+
@HippyController(name = HippyTextViewController.CLASS_NAME)
|
|
33
|
+
public class HippyTextViewController extends HippyViewController<HippyTextView> {
|
|
34
|
+
|
|
35
|
+
public static final String CLASS_NAME = "Text";
|
|
36
|
+
|
|
37
|
+
@Override
|
|
38
|
+
protected View createViewImpl(Context context) {
|
|
39
|
+
return new HippyTextView(context);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@Override
|
|
43
|
+
protected void updateExtra(View view, Object object) {
|
|
44
|
+
TextExtra textExtra = (TextExtra) object;
|
|
45
|
+
if (textExtra != null && textExtra.mExtra instanceof Layout && view instanceof HippyTextView) {
|
|
46
|
+
HippyTextView hippyTextView = (HippyTextView) view;
|
|
47
|
+
Layout layout = (Layout) textExtra.mExtra;
|
|
48
|
+
CharSequence textSequence = layout.getText();
|
|
49
|
+
if (textSequence instanceof Spannable) {
|
|
50
|
+
Spannable spannable = (Spannable) textSequence;
|
|
51
|
+
HippyNativeGestureSpan[] spans = spannable
|
|
52
|
+
.getSpans(0, spannable.length(), HippyNativeGestureSpan.class);
|
|
53
|
+
hippyTextView.setNativeGestureEnable(spans != null && spans.length > 0);
|
|
54
|
+
}
|
|
55
|
+
hippyTextView.setPadding((int) Math.floor(textExtra.mLeftPadding),
|
|
56
|
+
(int) Math.floor(textExtra.mTopPadding),
|
|
57
|
+
(int) Math.floor(textExtra.mRightPadding), (int) Math.floor(textExtra.mBottomPadding));
|
|
58
|
+
|
|
59
|
+
hippyTextView.setLayout(layout);
|
|
60
|
+
hippyTextView.postInvalidate();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
@Override
|
|
69
|
+
protected StyleNode createNode(boolean virtual) {
|
|
70
|
+
return new TextNode(virtual);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@Override
|
|
74
|
+
protected boolean handleGestureBySelf() {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
}
|