Skip to content

Commit

Permalink
Merge pull request #104 from jcdee/master
Browse files Browse the repository at this point in the history
修复抖音demo刷新数据崩溃问题
  • Loading branch information
Doikki authored Sep 12, 2018
2 parents bb836cc + 25e80d8 commit aa48205
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ public void onPageRelease(boolean isNext, int position) {
@Override
public void onPageSelected(int position, boolean isBottom) {
if (mCurrentPosition == position) return;
ViewParent parent = mIjkVideoView.getParent();
if (parent != null && parent instanceof FrameLayout) {
((FrameLayout) parent).removeView(mIjkVideoView);
}
startPlay(position);
mCurrentPosition = position;
}
Expand All @@ -99,6 +95,10 @@ private void startPlay(int position) {
.load(mVideoList.get(position).getThumb())
.placeholder(android.R.color.white)
.into(mTikTokController.getThumb());
ViewParent parent = mIjkVideoView.getParent();
if (parent != null && parent instanceof FrameLayout) {
((FrameLayout) parent).removeView(mIjkVideoView);
}
frameLayout.addView(mIjkVideoView);
mIjkVideoView.setUrl(mVideoList.get(position).getUrl());
mIjkVideoView.setScreenScale(IjkVideoView.SCREEN_SCALE_CENTER_CROP);
Expand Down

0 comments on commit aa48205

Please sign in to comment.