Commit 1c26cd86 authored by jyx's avatar jyx

优化umeng崩溃问题

parent 6bdf15d0
...@@ -19,7 +19,7 @@ import com.duben.xixiplaylet.ui.widgets.countdowntimer.CountDownTimerSupport ...@@ -19,7 +19,7 @@ import com.duben.xixiplaylet.ui.widgets.countdowntimer.CountDownTimerSupport
import com.duben.xixiplaylet.ui.widgets.countdowntimer.OnCountDownTimerListener import com.duben.xixiplaylet.ui.widgets.countdowntimer.OnCountDownTimerListener
import com.duben.xixiplaylet.utils.UIUtils import com.duben.xixiplaylet.utils.UIUtils
class VipCountDialog(activity: Activity, vedioBean: VedioBean, tipList: ArrayList<String>?) : class VipCountDialog(val activity: Activity, vedioBean: VedioBean, tipList: ArrayList<String>?) :
Dialog(activity, R.style.dialog) { Dialog(activity, R.style.dialog) {
private val lp: WindowManager.LayoutParams private val lp: WindowManager.LayoutParams
...@@ -81,6 +81,7 @@ class VipCountDialog(activity: Activity, vedioBean: VedioBean, tipList: ArrayLis ...@@ -81,6 +81,7 @@ class VipCountDialog(activity: Activity, vedioBean: VedioBean, tipList: ArrayLis
} }
override fun dismiss() { override fun dismiss() {
if (activity.isFinishing) return
super.dismiss() super.dismiss()
this.mOnDialogDismiss?.onDialogDismiss() this.mOnDialogDismiss?.onDialogDismiss()
} }
......
...@@ -44,7 +44,7 @@ public class RecommendVideoView extends RelativeLayout { ...@@ -44,7 +44,7 @@ public class RecommendVideoView extends RelativeLayout {
private int mCurrentPosition = 0; private int mCurrentPosition = 0;
private List<VideoMultiItemEntity2> mList; private List<VideoMultiItemEntity2> mList = new ArrayList<>();
public RecommendVideoView(Context context) { public RecommendVideoView(Context context) {
this(context, null); this(context, null);
...@@ -133,7 +133,7 @@ public class RecommendVideoView extends RelativeLayout { ...@@ -133,7 +133,7 @@ public class RecommendVideoView extends RelativeLayout {
private void onPageSelectedMethod(int position) { private void onPageSelectedMethod(int position) {
if (mOnPageChangeListener != null) mOnPageChangeListener.onPageChange(position); if (mOnPageChangeListener != null) mOnPageChangeListener.onPageChange(position);
if (position >= mList.size() || this.mList.get(position).getItemType() != MULTI_ITEM_1) { if (mList == null || position >= mList.size() || this.mList.get(position).getItemType() != MULTI_ITEM_1) {
mBaseItemView.stopForPlaying(); mBaseItemView.stopForPlaying();
return; return;
} }
......
...@@ -65,6 +65,7 @@ public class SuperShortVideoView extends RelativeLayout { ...@@ -65,6 +65,7 @@ public class SuperShortVideoView extends RelativeLayout {
} }
public void loadData(VedioBean vedioBean, List<VideoMultiItemEntity> list, int currentPosition) { public void loadData(VedioBean vedioBean, List<VideoMultiItemEntity> list, int currentPosition) {
this.mList.clear();
this.mList = list; this.mList = list;
this.mCurrentPosition = currentPosition; this.mCurrentPosition = currentPosition;
mAdapter.setVedioBean(vedioBean); mAdapter.setVedioBean(vedioBean);
...@@ -113,7 +114,8 @@ public class SuperShortVideoView extends RelativeLayout { ...@@ -113,7 +114,8 @@ public class SuperShortVideoView extends RelativeLayout {
case RecyclerView.SCROLL_STATE_IDLE://停止滚动 case RecyclerView.SCROLL_STATE_IDLE://停止滚动
View view = mSnapHelper.findSnapView(mLayoutManager); View view = mSnapHelper.findSnapView(mLayoutManager);
int position = recyclerView.getChildAdapterPosition(view); int position = recyclerView.getChildAdapterPosition(view);
if (position == mCurrentPosition) return; if (position == mCurrentPosition || position == RecyclerView.NO_POSITION)
return;
Log.i(TAG, "[SCROLL_STATE_IDLE] mLastPositionInIDLE " + mLastPositionInIDLE + " position " + position); Log.i(TAG, "[SCROLL_STATE_IDLE] mLastPositionInIDLE " + mLastPositionInIDLE + " position " + position);
mCurrentPosition = position; mCurrentPosition = position;
addAdView(position); addAdView(position);
...@@ -218,7 +220,7 @@ public class SuperShortVideoView extends RelativeLayout { ...@@ -218,7 +220,7 @@ public class SuperShortVideoView extends RelativeLayout {
} }
public void onItemClick(final int position) { public void onItemClick(final int position) {
if (position >= mList.size()) return; if (mList == null || position >= mList.size()) return;
mRecyclerView.scrollToPosition(position); mRecyclerView.scrollToPosition(position);
mRecyclerView.post(() -> { mRecyclerView.post(() -> {
...@@ -231,6 +233,7 @@ public class SuperShortVideoView extends RelativeLayout { ...@@ -231,6 +233,7 @@ public class SuperShortVideoView extends RelativeLayout {
} }
public List<VideoMultiItemEntity> getData() { public List<VideoMultiItemEntity> getData() {
if (mList == null) return new ArrayList<>();
return mList; return mList;
} }
...@@ -267,14 +270,14 @@ public class SuperShortVideoView extends RelativeLayout { ...@@ -267,14 +270,14 @@ public class SuperShortVideoView extends RelativeLayout {
} }
public boolean isAdPosition(int position) { public boolean isAdPosition(int position) {
if (mList != null && mList.size() > 0) { if (mList != null && mList.size() > 0 && position < mList.size()) {
return mList.get(position).getItemType() == MULTI_ITEM_3; return mList.get(position).getItemType() == MULTI_ITEM_3;
} }
return false; return false;
} }
public boolean isLuckPosition(int position) { public boolean isLuckPosition(int position) {
if (mList != null && mList.size() > 0) { if (mList != null && mList.size() > 0 && position < mList.size()) {
return mList.get(position).getItemType() == MULTI_ITEM_2; return mList.get(position).getItemType() == MULTI_ITEM_2;
} }
return false; return false;
......
...@@ -103,7 +103,7 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe ...@@ -103,7 +103,7 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe
setSeekBarStyle(true); setSeekBarStyle(true);
break; break;
case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP:
if (mTXVodPlayerWrapper.isPlaying()) { if (mTXVodPlayerWrapper != null && mTXVodPlayerWrapper.isPlaying()) {
setSeekBarStyle(false); setSeekBarStyle(false);
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment