Commit 882bdd8c authored by jyx's avatar jyx

修复友盟崩溃问题

parent 338b1c8e
......@@ -19,7 +19,7 @@ import com.mints.helivideo.ui.widgets.countdowntimer.CountDownTimerSupport
import com.mints.helivideo.ui.widgets.countdowntimer.OnCountDownTimerListener
import com.mints.helivideo.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) {
private val lp: WindowManager.LayoutParams
......@@ -81,6 +81,7 @@ class VipCountDialog(activity: Activity, vedioBean: VedioBean, tipList: ArrayLis
}
override fun dismiss() {
if (activity.isFinishing) return
super.dismiss()
this.mOnDialogDismiss?.onDialogDismiss()
}
......
......@@ -44,7 +44,7 @@ public class RecommendVideoView extends RelativeLayout {
private int mCurrentPosition = 0;
private List<VideoMultiItemEntity2> mList;
private List<VideoMultiItemEntity2> mList = new ArrayList<>();
public RecommendVideoView(Context context) {
this(context, null);
......@@ -133,7 +133,7 @@ public class RecommendVideoView extends RelativeLayout {
private void onPageSelectedMethod(int 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();
return;
}
......
......@@ -65,6 +65,7 @@ public class SuperShortVideoView extends RelativeLayout {
}
public void loadData(VedioBean vedioBean, List<VideoMultiItemEntity> list, int currentPosition) {
this.mList.clear();
this.mList = list;
this.mCurrentPosition = currentPosition;
mAdapter.setVedioBean(vedioBean);
......@@ -113,7 +114,8 @@ public class SuperShortVideoView extends RelativeLayout {
case RecyclerView.SCROLL_STATE_IDLE://停止滚动
View view = mSnapHelper.findSnapView(mLayoutManager);
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);
mCurrentPosition = position;
addAdView(position);
......@@ -218,7 +220,7 @@ public class SuperShortVideoView extends RelativeLayout {
}
public void onItemClick(final int position) {
if (position >= mList.size()) return;
if (mList == null || position >= mList.size()) return;
mRecyclerView.scrollToPosition(position);
mRecyclerView.post(() -> {
......@@ -231,6 +233,7 @@ public class SuperShortVideoView extends RelativeLayout {
}
public List<VideoMultiItemEntity> getData() {
if (mList == null) return new ArrayList<>();
return mList;
}
......@@ -267,14 +270,14 @@ public class SuperShortVideoView extends RelativeLayout {
}
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 false;
}
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 false;
......
......@@ -103,7 +103,7 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe
setSeekBarStyle(true);
break;
case MotionEvent.ACTION_UP:
if (mTXVodPlayerWrapper.isPlaying()) {
if (mTXVodPlayerWrapper != null && mTXVodPlayerWrapper.isPlaying()) {
setSeekBarStyle(false);
}
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