From 626cb0de027ab64a33ad19555633d2604eb15f1e Mon Sep 17 00:00:00 2001 From: maxli Date: Wed, 24 Nov 2021 23:21:32 +0800 Subject: [PATCH] fix(android): resolve #1104 commit crash --- .../tencent/mtt/hippy/views/list/HippyListView.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/android/sdk/src/main/java/com/tencent/mtt/hippy/views/list/HippyListView.java b/android/sdk/src/main/java/com/tencent/mtt/hippy/views/list/HippyListView.java index b888001e64f..c63031bad6a 100644 --- a/android/sdk/src/main/java/com/tencent/mtt/hippy/views/list/HippyListView.java +++ b/android/sdk/src/main/java/com/tencent/mtt/hippy/views/list/HippyListView.java @@ -179,6 +179,10 @@ public void setListData() { scrollToInitContentOffset(); } + if (mExposureEventEnable) { + dispatchExposureEvent(); + } + hasCompleteFirstBatch = true; } } @@ -488,9 +492,6 @@ protected void onScrollFlingEnded() { @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { super.onLayout(changed, l, t, r, b); - if (changed && mExposureEventEnable) { - dispatchExposureEvent(); - } } @Override @@ -574,6 +575,10 @@ protected void checkExposureView(View view, int visibleStart, int visibleEnd, in private void dispatchExposureEvent() { if (mLayout instanceof BaseLayoutManager) { BaseLayoutManager.OrientationHelper layoutHelper = ((BaseLayoutManager) mLayout).mOrientationHelper; + if (layoutHelper == null) { + return; + } + int count = getChildCount(); int fixOffset = (mLayout.canScrollHorizontally()) ? mState.mCustomHeaderWidth : mState.mCustomHeaderHeight;