@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,684 @@
|
|
|
1
|
+
package com.tencent.extend.views;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.graphics.Canvas;
|
|
5
|
+
import android.graphics.Color;
|
|
6
|
+
import android.graphics.Rect;
|
|
7
|
+
import android.graphics.Typeface;
|
|
8
|
+
import android.graphics.drawable.GradientDrawable;
|
|
9
|
+
import android.text.Layout;
|
|
10
|
+
import android.text.SpannableString;
|
|
11
|
+
import android.text.Spanned;
|
|
12
|
+
import android.text.TextUtils;
|
|
13
|
+
import android.text.style.AbsoluteSizeSpan;
|
|
14
|
+
import android.text.style.ForegroundColorSpan;
|
|
15
|
+
import android.util.Log;
|
|
16
|
+
import android.view.MotionEvent;
|
|
17
|
+
import android.widget.TextView;
|
|
18
|
+
|
|
19
|
+
import com.tencent.extend.RenderUtil;
|
|
20
|
+
import com.tencent.extend.views.fastlist.FastAdapter;
|
|
21
|
+
import com.tencent.extend.views.fastlist.ListItemHolder;
|
|
22
|
+
import com.tencent.extend.views.fastlist.PostHandlerView;
|
|
23
|
+
import com.tencent.mtt.hippy.common.HippyArray;
|
|
24
|
+
import com.tencent.mtt.hippy.common.HippyMap;
|
|
25
|
+
|
|
26
|
+
import com.tencent.mtt.hippy.dom.flex.FlexConstants;
|
|
27
|
+
import com.tencent.mtt.hippy.dom.node.TypeFaceUtil;
|
|
28
|
+
import com.tencent.mtt.hippy.uimanager.HippyViewBase;
|
|
29
|
+
import com.tencent.mtt.hippy.uimanager.NativeGestureDispatcher;
|
|
30
|
+
import com.tencent.mtt.hippy.uimanager.StateView;
|
|
31
|
+
import com.tencent.mtt.hippy.utils.ExtendUtil;
|
|
32
|
+
import com.tencent.mtt.hippy.utils.LogUtils;
|
|
33
|
+
import com.tencent.mtt.hippy.utils.PixelUtil;
|
|
34
|
+
import com.tencent.mtt.hippy.views.view.HippyViewGroup;
|
|
35
|
+
import com.tencent.mtt.supportui.utils.struct.ArrayMap;
|
|
36
|
+
|
|
37
|
+
public class TVTextView extends TextView implements HippyViewBase , StateView, ListItemHolder {
|
|
38
|
+
// private final boolean isAutoWidth;
|
|
39
|
+
// private final boolean isAutoHeight;
|
|
40
|
+
HippyMap iniProps;
|
|
41
|
+
private GradientDrawable mBackDrawable;
|
|
42
|
+
private boolean isMeasureDirty = false;
|
|
43
|
+
private FastAdapter.ElementNode mDomNode4FastList;
|
|
44
|
+
public boolean createFromNative = false;
|
|
45
|
+
private boolean useTextSpan = false;
|
|
46
|
+
|
|
47
|
+
private boolean setAutoMarqueOnFocus = false;
|
|
48
|
+
private boolean updateDirty = false;
|
|
49
|
+
private int currentEllipsize = -1;
|
|
50
|
+
private boolean boldOnFocus = false;
|
|
51
|
+
public TVTextView(Context context,HippyMap iniProps,boolean createFromNative) {
|
|
52
|
+
super(context);
|
|
53
|
+
this.createFromNative = createFromNative;
|
|
54
|
+
this.iniProps = iniProps;
|
|
55
|
+
// this.isAutoWidth = isAutoWidth();
|
|
56
|
+
// this.isAutoHeight = isAutoHeight();
|
|
57
|
+
this.useTextSpan = iniProps != null && iniProps.containsKey("textSpan");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public void setSetAutoMarqueOnFocus(boolean setAutoMarqueOnFocus) {
|
|
61
|
+
// Log.i("TVTextViewLog","setSetAutoMarqueOnFocus "+setAutoMarqueOnFocus+",this:"+this);
|
|
62
|
+
this.setAutoMarqueOnFocus = setAutoMarqueOnFocus;
|
|
63
|
+
updateDirty = true;
|
|
64
|
+
invalidate();
|
|
65
|
+
refreshDrawableState();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public void setBoldOnFocus(boolean boldOnFocus) {
|
|
69
|
+
this.boldOnFocus = boldOnFocus;
|
|
70
|
+
refreshDrawableState();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
public boolean useTextSpan(){
|
|
74
|
+
return useTextSpan;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
private NativeGestureDispatcher mGestureDispatcher;
|
|
78
|
+
|
|
79
|
+
private int mFocusColor = Color.TRANSPARENT;
|
|
80
|
+
private int mNormalColor = Color.WHITE;
|
|
81
|
+
private int mSelectColor = Color.TRANSPARENT;
|
|
82
|
+
private int maxWidth = 0;
|
|
83
|
+
private int maxHeight = 0;
|
|
84
|
+
|
|
85
|
+
@Override
|
|
86
|
+
public void setEllipsize(TextUtils.TruncateAt where) {
|
|
87
|
+
super.setEllipsize(where);
|
|
88
|
+
// currentEllipsize = where.ordinal();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
private boolean needMeasureHeight = true;
|
|
92
|
+
|
|
93
|
+
private boolean forceUpdate = false;
|
|
94
|
+
|
|
95
|
+
public void setFocusColor(int mFocusColor) {
|
|
96
|
+
this.mFocusColor = mFocusColor;
|
|
97
|
+
invalidate();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@Override
|
|
101
|
+
public int getMaxWidth() {
|
|
102
|
+
return maxWidth;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
public void setSelectColor(int selectColor) {
|
|
107
|
+
this.mSelectColor = selectColor;
|
|
108
|
+
invalidate();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
private void requestMeasureHeight(){
|
|
112
|
+
this.needMeasureHeight = true;
|
|
113
|
+
}
|
|
114
|
+
private void consumeMeasure(){
|
|
115
|
+
this.needMeasureHeight = false;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
public void bindNode(FastAdapter.ElementNode mDomNode4FastList) {
|
|
119
|
+
this.mDomNode4FastList = mDomNode4FastList;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@Override
|
|
123
|
+
public void setMaxWidth(int maxWidth) {
|
|
124
|
+
this.maxWidth = maxWidth;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
@Override
|
|
129
|
+
protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) {
|
|
130
|
+
super.onTextChanged(text, start, lengthBefore, lengthAfter);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@Override
|
|
134
|
+
public boolean onTouchEvent(MotionEvent event)
|
|
135
|
+
{
|
|
136
|
+
boolean result = super.onTouchEvent(event);
|
|
137
|
+
if (mGestureDispatcher != null)
|
|
138
|
+
{
|
|
139
|
+
result |= mGestureDispatcher.handleTouchEvent(event);
|
|
140
|
+
}
|
|
141
|
+
return result;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
@Override
|
|
146
|
+
public boolean isSelected() {
|
|
147
|
+
if(forceUpdate){
|
|
148
|
+
forceUpdate = false;
|
|
149
|
+
return !super.isSelected();
|
|
150
|
+
}
|
|
151
|
+
return super.isSelected();
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
@Override
|
|
155
|
+
protected void onDetachedFromWindow() {
|
|
156
|
+
super.onDetachedFromWindow();
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@Override
|
|
160
|
+
protected void onAttachedToWindow() {
|
|
161
|
+
super.onAttachedToWindow();
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
@Override
|
|
165
|
+
public void setTextColor(int color) {
|
|
166
|
+
this.mNormalColor = color;
|
|
167
|
+
super.setTextColor(color);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@Override
|
|
171
|
+
public void setSelected(boolean selected) {
|
|
172
|
+
super.setSelected(selected);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
private void forceSetSelect(boolean b){
|
|
176
|
+
forceUpdate = true;
|
|
177
|
+
super.setSelected(b);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
@Override
|
|
184
|
+
public NativeGestureDispatcher getGestureDispatcher()
|
|
185
|
+
{
|
|
186
|
+
return mGestureDispatcher;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
@Override
|
|
190
|
+
public void setGestureDispatcher(NativeGestureDispatcher dispatcher)
|
|
191
|
+
{
|
|
192
|
+
mGestureDispatcher = dispatcher;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
private void postSetColor(final int color){
|
|
196
|
+
super.setTextColor(color);
|
|
197
|
+
postInvalidateDelayed(16);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
@Override
|
|
201
|
+
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
|
202
|
+
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
|
203
|
+
|
|
204
|
+
if(mDomNode4FastList != null && mDomNode4FastList.isHeightWrapContent) {
|
|
205
|
+
if (LogUtils.isDebug()) {
|
|
206
|
+
Log.e("AutoMeasure", "FIX_ITEM_SIZE onMeasure title: " + getText() + ",getMeasuredHeight:" + getMeasuredHeight()+",getMeasuredWidth:"+getMeasuredWidth()+",this:"+hashCode());
|
|
207
|
+
}
|
|
208
|
+
measureTextHeight(mDomNode4FastList,getMeasuredHeight());
|
|
209
|
+
}
|
|
210
|
+
// if(mDomNode4FastList != null && mDomNode4FastList.isWidthWrapContent){
|
|
211
|
+
// //设置text时,由于不能及时测试量结果 ,所以这里需要重新layout一下。
|
|
212
|
+
// measureTextWidth(mDomNode4FastList,getMeasuredWidth());
|
|
213
|
+
// }
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
@Override
|
|
217
|
+
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
|
218
|
+
super.onSizeChanged(w, h, oldw, oldh);
|
|
219
|
+
if(mBackDrawable != null){
|
|
220
|
+
mBackDrawable.setBounds(0,0,w,h);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
public void setGradientDrawable(HippyMap map){
|
|
225
|
+
|
|
226
|
+
if(map == null){
|
|
227
|
+
mBackDrawable = null;
|
|
228
|
+
}else {
|
|
229
|
+
this.mBackDrawable = HippyViewGroup.createGradientDrawable(this,map);
|
|
230
|
+
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
invalidate();
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
@Override
|
|
238
|
+
public void draw(Canvas canvas) {
|
|
239
|
+
if(mBackDrawable != null){
|
|
240
|
+
if(mBackDrawable.getBounds().isEmpty()){
|
|
241
|
+
mBackDrawable.setBounds(new Rect(0,0,getWidth(),getHeight()));
|
|
242
|
+
}
|
|
243
|
+
mBackDrawable.draw(canvas);
|
|
244
|
+
}
|
|
245
|
+
try {
|
|
246
|
+
super.draw(canvas);
|
|
247
|
+
} catch (Throwable e) {
|
|
248
|
+
// fix JCAV-6063
|
|
249
|
+
// < 5.0的系统使用ellipsize在特定文本布局下会crash
|
|
250
|
+
// 处理方法是移除ellipsize
|
|
251
|
+
if (getEllipsize() != null) {
|
|
252
|
+
setEllipsize(null);
|
|
253
|
+
invalidate();
|
|
254
|
+
} else {
|
|
255
|
+
// 防止Crash,打印出堆栈
|
|
256
|
+
Log.e("TEXT", "unknown error", e);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
@Override
|
|
264
|
+
protected void drawableStateChanged() {
|
|
265
|
+
|
|
266
|
+
super.drawableStateChanged();
|
|
267
|
+
int[] states = getDrawableState();
|
|
268
|
+
|
|
269
|
+
ExtendUtil.handleShowOnState(this,states,showOnState);
|
|
270
|
+
ExtendUtil.handleCustomShowOnState(this, mCustomStateList,showOnStateCustom);
|
|
271
|
+
//
|
|
272
|
+
if(isFocusable() || isDuplicateParentStateEnabled() ) {
|
|
273
|
+
final boolean focused = ExtendUtil.stateContainsAttribute(states, android.R.attr.state_focused);
|
|
274
|
+
final boolean selected = ExtendUtil.stateContainsAttribute(states, android.R.attr.state_selected);
|
|
275
|
+
if(setAutoMarqueOnFocus) {
|
|
276
|
+
//Log.v("TVTextViewLog","drawableStateChanged focused:"+focused+",selected:"+selected+",currentEllipsize:"+currentEllipsize);
|
|
277
|
+
if (focused) {
|
|
278
|
+
//Log.i("TVTextViewLog","+++change MARQUEE on focused text:"+getText());
|
|
279
|
+
setEllipsize(TextUtils.TruncateAt.MARQUEE);
|
|
280
|
+
setSingleLine();
|
|
281
|
+
setMarqueeRepeatLimit(-1);
|
|
282
|
+
currentEllipsize = TextUtils.TruncateAt.MARQUEE.ordinal();
|
|
283
|
+
if(typeStyle != 0) {
|
|
284
|
+
hadSetType = false;
|
|
285
|
+
}
|
|
286
|
+
if(boldOnFocus){
|
|
287
|
+
hadSetType = false;
|
|
288
|
+
setTypeStyle("bold");
|
|
289
|
+
}
|
|
290
|
+
RenderUtil.reLayoutView(this);
|
|
291
|
+
postInvalidateDelayed(16);
|
|
292
|
+
}else{
|
|
293
|
+
setEllipsize(TextUtils.TruncateAt.END);
|
|
294
|
+
if(typeStyle != 0) {
|
|
295
|
+
hadSetType = false;
|
|
296
|
+
}
|
|
297
|
+
if(boldOnFocus){
|
|
298
|
+
hadSetType = false;
|
|
299
|
+
setTypeStyle("normal");
|
|
300
|
+
}
|
|
301
|
+
RenderUtil.reLayoutView(this);
|
|
302
|
+
postInvalidateDelayed(16);
|
|
303
|
+
currentEllipsize = TextUtils.TruncateAt.END.ordinal();
|
|
304
|
+
// }
|
|
305
|
+
}
|
|
306
|
+
updateDirty = false;
|
|
307
|
+
}
|
|
308
|
+
//fixme : 这里需要解决当ellipsize非4时不生效的问题
|
|
309
|
+
// else {
|
|
310
|
+
// if (boldOnFocus) {
|
|
311
|
+
// setSingleLine();
|
|
312
|
+
// hadSetType = false;
|
|
313
|
+
// if (focused) {
|
|
314
|
+
// setTypeStyle("bold");
|
|
315
|
+
// } else {
|
|
316
|
+
// setTypeStyle("normal");
|
|
317
|
+
// }
|
|
318
|
+
// RenderUtil.reLayoutView(this);
|
|
319
|
+
// postInvalidateDelayed(16);
|
|
320
|
+
// }
|
|
321
|
+
// }
|
|
322
|
+
if(focused && selected){
|
|
323
|
+
if(mFocusColor != 0){
|
|
324
|
+
forceSetSelect(true);
|
|
325
|
+
postSetColor(mFocusColor);
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
}else{
|
|
329
|
+
if(mFocusColor != 0){
|
|
330
|
+
if(focused){
|
|
331
|
+
forceSetSelect(true);
|
|
332
|
+
postSetColor(mFocusColor);
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
if(mSelectColor != 0){
|
|
337
|
+
if(selected){
|
|
338
|
+
postSetColor(mSelectColor);
|
|
339
|
+
forceSetSelect(false);
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
postSetColor(mNormalColor);
|
|
346
|
+
forceSetSelect(focused);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
private int showOnState[];
|
|
351
|
+
|
|
352
|
+
@Override
|
|
353
|
+
public void setShowOnState(int[] showOnState) {
|
|
354
|
+
this.showOnState = showOnState;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/** custom showOnState
|
|
358
|
+
* --------------------
|
|
359
|
+
*/
|
|
360
|
+
private String[] showOnStateCustom;
|
|
361
|
+
ArrayMap<String,Boolean> mCustomStateList = null;
|
|
362
|
+
@Override
|
|
363
|
+
public void setCustomState(String state, boolean on) {
|
|
364
|
+
if (mCustomStateList == null) {
|
|
365
|
+
mCustomStateList = new ArrayMap<>();
|
|
366
|
+
}
|
|
367
|
+
mCustomStateList.put(state,on);
|
|
368
|
+
refreshDrawableState();
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
@Override
|
|
372
|
+
public void setShowOnCustomState(String[] showOnState) {
|
|
373
|
+
this.showOnStateCustom = showOnState;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/**custom showOnState
|
|
377
|
+
* ----------------
|
|
378
|
+
*/
|
|
379
|
+
|
|
380
|
+
public boolean isAutoWidth() {
|
|
381
|
+
return iniProps != null && iniProps.containsKey("autoWidth");
|
|
382
|
+
}
|
|
383
|
+
public boolean isAutoHeight() {
|
|
384
|
+
return iniProps != null && iniProps.containsKey("autoHeight");
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
private int typeStyle = Typeface.NORMAL;
|
|
388
|
+
private String family = null;
|
|
389
|
+
private boolean hadSetType = false;
|
|
390
|
+
public void setTypeStyle(String type){
|
|
391
|
+
switch (type){
|
|
392
|
+
case "bold":
|
|
393
|
+
typeStyle = Typeface.BOLD;
|
|
394
|
+
break;
|
|
395
|
+
case "italic":
|
|
396
|
+
typeStyle = Typeface.ITALIC;
|
|
397
|
+
break;
|
|
398
|
+
case "bold_italic":
|
|
399
|
+
typeStyle = Typeface.BOLD_ITALIC;
|
|
400
|
+
break;
|
|
401
|
+
default:
|
|
402
|
+
typeStyle = Typeface.NORMAL;
|
|
403
|
+
break;
|
|
404
|
+
}
|
|
405
|
+
doTypeFace();
|
|
406
|
+
}
|
|
407
|
+
public void setFamily(String family){
|
|
408
|
+
if (TextUtils.isEmpty(family)) return;
|
|
409
|
+
|
|
410
|
+
this.family = family;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
@Override
|
|
414
|
+
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
|
415
|
+
if (!hadSetType){
|
|
416
|
+
hadSetType = true;
|
|
417
|
+
doTypeFace();
|
|
418
|
+
}
|
|
419
|
+
super.onLayout(changed, left, top, right, bottom);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
void doTypeFace(){
|
|
423
|
+
Typeface typeface;
|
|
424
|
+
if (!TextUtils.isEmpty(family)) {
|
|
425
|
+
typeface = TypeFaceUtil.getTypeface(family, typeStyle,null);
|
|
426
|
+
} else {
|
|
427
|
+
typeface = Typeface.defaultFromStyle(typeStyle);
|
|
428
|
+
}
|
|
429
|
+
if (typeface != null) {
|
|
430
|
+
setTypeface(typeface);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
public void setTextSpan(HippyMap spanMap){
|
|
435
|
+
if (LogUtils.isDebug() && mDomNode4FastList != null) {
|
|
436
|
+
Log.i("AutoMeasure", "FIX_ITEM_SIZE setTextSpan spanMap:"+spanMap+",bindNode:"+mDomNode4FastList.getTemplateNode());
|
|
437
|
+
}
|
|
438
|
+
if (spanMap != null){
|
|
439
|
+
//bugfix:这里使用textSpan设置过之后将useTextSpan设置成true,以防止出现使用TextSpan后,又被setText将文本置空
|
|
440
|
+
useTextSpan = true;
|
|
441
|
+
String title = "";
|
|
442
|
+
if (spanMap.containsKey("text")) {
|
|
443
|
+
title = spanMap.getString("text");
|
|
444
|
+
}
|
|
445
|
+
if (TextUtils.isEmpty(title))return;
|
|
446
|
+
SpannableString sStr = new SpannableString(title);
|
|
447
|
+
if (spanMap.containsKey("spanAttr")) {
|
|
448
|
+
HippyArray spanAttr = spanMap.getArray("spanAttr");
|
|
449
|
+
if (spanAttr != null && spanAttr.size() > 0){
|
|
450
|
+
for (int i = 0; i < spanAttr.size(); i++) {
|
|
451
|
+
HippyMap span = spanAttr.getMap(i);
|
|
452
|
+
String type = span.getString("type");
|
|
453
|
+
HippyArray array = span.getArray("value");
|
|
454
|
+
switch (type){
|
|
455
|
+
case "size":
|
|
456
|
+
sStr = parseSizeSpan(sStr,array);
|
|
457
|
+
break;
|
|
458
|
+
case "color":
|
|
459
|
+
sStr = parseColorSpan(sStr,array);
|
|
460
|
+
break;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
setText(sStr);
|
|
465
|
+
if (LogUtils.isDebug()) {
|
|
466
|
+
Log.e("AutoMeasure", "FIX_ITEM_SIZE setTextSpan title " + title + ",sStr:" + sStr+",isMeasureDirty:"+isMeasureDirty);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
@Override
|
|
474
|
+
public void setTextSize(int unit, float size) {
|
|
475
|
+
super.setTextSize(unit, size);
|
|
476
|
+
if (LogUtils.isDebug()) {
|
|
477
|
+
Log.i("AutoMeasure", "FIX_ITEM_SIZE setTextSize size " + size +",this:"+hashCode());
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
private SpannableString parseSizeSpan(SpannableString sStr, HippyArray sizeSpanArray){
|
|
483
|
+
if (sStr != null && sizeSpanArray != null && sizeSpanArray.size() > 0){
|
|
484
|
+
assert sizeSpanArray.size() > 2;
|
|
485
|
+
int size = sizeSpanArray.getInt(0);
|
|
486
|
+
int startPos = sizeSpanArray.getInt(1);
|
|
487
|
+
int endPos = sizeSpanArray.getInt(2);
|
|
488
|
+
sStr.setSpan(new AbsoluteSizeSpan((int) PixelUtil.dp2px(size)), startPos, endPos, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
489
|
+
}
|
|
490
|
+
return sStr;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
private SpannableString parseColorSpan(SpannableString sStr,HippyArray sizeSpanArray){
|
|
494
|
+
if (sStr != null && sizeSpanArray != null && sizeSpanArray.size() > 0){
|
|
495
|
+
assert sizeSpanArray.size() > 2;
|
|
496
|
+
String spanColor = sizeSpanArray.getString(0);
|
|
497
|
+
int color = Color.parseColor(spanColor);
|
|
498
|
+
int startPos = sizeSpanArray.getInt(1);
|
|
499
|
+
int endPos = sizeSpanArray.getInt(2);
|
|
500
|
+
sStr.setSpan(new ForegroundColorSpan(color), startPos, endPos, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
501
|
+
}
|
|
502
|
+
return sStr;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
protected PostHandlerView mPostView;
|
|
506
|
+
private boolean onBindNew = false;
|
|
507
|
+
private boolean enablePostTask = false;
|
|
508
|
+
public void setEnablePostTask(boolean enablePostTask) {
|
|
509
|
+
this.enablePostTask = enablePostTask;
|
|
510
|
+
}
|
|
511
|
+
int loadDelay = 20;
|
|
512
|
+
|
|
513
|
+
public void setDelayLoad(int delay) {
|
|
514
|
+
this.loadDelay = delay;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
@Override
|
|
518
|
+
public void onItemBind() {
|
|
519
|
+
// if(typeStyle == 1){
|
|
520
|
+
// hadSetType = false;
|
|
521
|
+
// setTypeStyle("bold");
|
|
522
|
+
// RenderUtil.reLayoutView(this);
|
|
523
|
+
// }
|
|
524
|
+
// onResetBeforeCache();
|
|
525
|
+
}
|
|
526
|
+
//
|
|
527
|
+
// @Override
|
|
528
|
+
// public void setRootPostHandlerView(PostHandlerView pv) {
|
|
529
|
+
// this.mPostView = pv;
|
|
530
|
+
// }
|
|
531
|
+
|
|
532
|
+
// @Override
|
|
533
|
+
// public void setText(CharSequence text, BufferType type) {
|
|
534
|
+
// if(TextUtils.isEmpty(text)){
|
|
535
|
+
// super.setText(text, type);
|
|
536
|
+
// }else {
|
|
537
|
+
// if(isPostTaskEnabled()){
|
|
538
|
+
// mPostView.postTask(POST_TASK_CATEGORY_TEXT, hashCode(), () -> {
|
|
539
|
+
// super.setText(text, type);
|
|
540
|
+
// },loadDelay);
|
|
541
|
+
// }else{
|
|
542
|
+
// super.setText(text, type);
|
|
543
|
+
// }
|
|
544
|
+
// }
|
|
545
|
+
// }
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
@Override
|
|
551
|
+
public void setText(CharSequence text, BufferType type) {
|
|
552
|
+
super.setText(text, type);
|
|
553
|
+
if (LogUtils.isDebug() && mDomNode4FastList != null) {
|
|
554
|
+
Log.e("AutoMeasure", "FIX_ITEM_SIZE setText with BufferType text:"+text+",this:"+hashCode()+",bindNode:"+mDomNode4FastList.getTemplateNode());
|
|
555
|
+
}
|
|
556
|
+
isMeasureDirty = true;
|
|
557
|
+
if(useTextSpan && mDomNode4FastList != null && mDomNode4FastList.isWidthWrapContent){
|
|
558
|
+
measureTextWidth(mDomNode4FastList);
|
|
559
|
+
}
|
|
560
|
+
if (mDomNode4FastList != null && mDomNode4FastList.isHeightWrapContent) {
|
|
561
|
+
//bugfix:存在因没requestLayout导致部分文本大小重新计算错误,特别在一行及俩行文本切换时
|
|
562
|
+
requestLayout();
|
|
563
|
+
}
|
|
564
|
+
// Log.i("TVTextViewLog","setText text:"+text);
|
|
565
|
+
// if(getEllipsize() == TextUtils.TruncateAt.MARQUEE || setAutoMarqueOnFocus) {
|
|
566
|
+
// RenderUtil.reLayoutView(this);
|
|
567
|
+
// postInvalidateDelayed(16);
|
|
568
|
+
// refreshDrawableState();
|
|
569
|
+
// }
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
@Override
|
|
576
|
+
public void resetProps() {
|
|
577
|
+
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
@Override
|
|
581
|
+
public void clear() {
|
|
582
|
+
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
protected boolean isPostTaskEnabled(){
|
|
586
|
+
return enablePostTask && mPostView != null;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
@Override
|
|
591
|
+
public void onResetBeforeCache() {
|
|
592
|
+
if(!TextUtils.isEmpty(getText())){
|
|
593
|
+
if(typeStyle != 0) {
|
|
594
|
+
hadSetType = false;
|
|
595
|
+
}
|
|
596
|
+
//zhaopeng 2022 7 13 TextView重用时,如果是marquee的状态,重新设置文本后,可能存在位置不正确的问题,需要手动layout一下
|
|
597
|
+
if(getEllipsize() == TextUtils.TruncateAt.MARQUEE || setAutoMarqueOnFocus || boldOnFocus || typeStyle != 0) {
|
|
598
|
+
// if (LogUtils.isDebug()) {
|
|
599
|
+
// Log.i("TVTextViewLog", "onResetBeforeCache MARQUEE tx:" + getText());
|
|
600
|
+
// }
|
|
601
|
+
RenderUtil.reLayoutView(this);
|
|
602
|
+
// refreshDrawableState();
|
|
603
|
+
// postInvalidateDelayed(16);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
@Override
|
|
611
|
+
public void notifySaveState() {
|
|
612
|
+
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
@Override
|
|
616
|
+
public void notifyRestoreState() {
|
|
617
|
+
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
public void measureTextHeight(FastAdapter.ElementNode node,int height){
|
|
622
|
+
final TVTextView tx = this;
|
|
623
|
+
if (LogUtils.isDebug()) {
|
|
624
|
+
Log.i("AutoMeasure", "####FIX_ITEM_SIZE measureTextHeight this:"+hashCode());
|
|
625
|
+
}
|
|
626
|
+
final CharSequence text = tx.getText();
|
|
627
|
+
if(!TextUtils.isEmpty(text)){
|
|
628
|
+
if (LogUtils.isDebug()) {
|
|
629
|
+
final float padding = node.getStylePadding(1) + node.getStylePadding(3);
|
|
630
|
+
Log.d("AutoMeasure", "####FIX_ITEM_SIZE measureTextHeight IN TVTextView padding:" + padding + ",textHeight:" + (float) height + ",width:" + ((float) height + padding) + ",text:" + tx.getText()+",this:"+hashCode());
|
|
631
|
+
}
|
|
632
|
+
if(height < 1){
|
|
633
|
+
//bugfix:当调试<1 时将尺寸标记为UNDEFINED
|
|
634
|
+
if(LogUtils.isDebug()) {
|
|
635
|
+
Log.e("AutoMeasure", "measureTextHeight error height == 0 tx : " + tx.getText() + ",getMeasuredWidth:" + getMeasuredWidth());
|
|
636
|
+
}
|
|
637
|
+
node.setStyleHeight(FlexConstants.UNDEFINED);
|
|
638
|
+
}else {
|
|
639
|
+
node.setStyleHeight(height);
|
|
640
|
+
}
|
|
641
|
+
//tx.setPadding((int) node.getStylePadding(0), (int) node.getStylePadding(1), (int) node.getStylePadding(2), (int) node.getStylePadding(3));
|
|
642
|
+
}else{
|
|
643
|
+
if (LogUtils.isDebug()) {
|
|
644
|
+
Log.e("AutoMeasure", "####FIX_ITEM_SIZE measureTextHeight return tx.getPaint() != null || TextUtils.isEmpty(text),text:" + text);
|
|
645
|
+
}
|
|
646
|
+
node.setStyleHeight(0);
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
public void measureTextWidth(FastAdapter.ElementNode node){
|
|
651
|
+
final TVTextView tx = this;
|
|
652
|
+
final CharSequence text = tx.getText();
|
|
653
|
+
if( tx.getPaint() != null || !TextUtils.isEmpty(text)){
|
|
654
|
+
//final int width = (int) Math.max(maxWidth, getPaint().measureText(text,0,text.length()));
|
|
655
|
+
if(node.getStyleWidth() < 1 || isMeasureDirty) {
|
|
656
|
+
final float padding = node.getStylePadding(0) + node.getStylePadding(2);
|
|
657
|
+
final float textWidth = Layout.getDesiredWidth(text, tx.getPaint());
|
|
658
|
+
if (LogUtils.isDebug()) {
|
|
659
|
+
Log.d("AutoMeasure", "FIX_ITEM_SIZE measureTextWidth IN TVTextView padding:" + padding + ",textWidth:" + textWidth + ",width:" + (textWidth + padding) + ",Node:" + node + ",text:" + tx.getText()+",this:"+hashCode());
|
|
660
|
+
}
|
|
661
|
+
final int totalWidth = (int) Math.max(tx.getMaxWidth(), textWidth + padding);
|
|
662
|
+
node.setStyleWidth(totalWidth);
|
|
663
|
+
tx.setPadding((int) node.getStylePadding(0), (int) node.getStylePadding(1), (int) node.getStylePadding(2), (int) node.getStylePadding(3));
|
|
664
|
+
// FastAdapter.updateLayoutF(this,node.getLayoutX(),node.getLayoutY(),totalWidth,node.getLayoutHeight());
|
|
665
|
+
// measureParentIfNeed(node);
|
|
666
|
+
}else{
|
|
667
|
+
if (LogUtils.isDebug()) {
|
|
668
|
+
Log.e("AutoMeasure", "FIX_ITEM_SIZE measureTextWidth return onStyleWidth > 1 Node:" + node + ",text:" + tx.getText()+",isMeasureDirty:"+isMeasureDirty);
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
}else{
|
|
672
|
+
if (LogUtils.isDebug()) {
|
|
673
|
+
Log.e("AutoMeasure", "FIX_ITEM_SIZE measureTextWidth return tx.getPaint() != null || TextUtils.isEmpty(text),text:" + text);
|
|
674
|
+
}
|
|
675
|
+
node.setStyleWidth(0);
|
|
676
|
+
// FastAdapter.updateLayoutF(this,node.getLayoutX(),node.getLayoutY(),0,node.getLayoutHeight());
|
|
677
|
+
// measureParentIfNeed(node);
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
}
|