Skip to content

Commit

Permalink
修复了可能出现的判空问题,修复了ListGSYVideoPlayer的同步问题 (2017-04-20)
Browse files Browse the repository at this point in the history
  • Loading branch information
CarGuo committed Apr 20, 2017
1 parent c2ee717 commit 63857b8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ public boolean onTouch(View v, MotionEvent event) {
dismissProgressDialog();
dismissVolumeDialog();
dismissBrightnessDialog();
if (mChangePosition) {
if (mChangePosition && GSYVideoManager.instance().getMediaPlayer() != null) {
GSYVideoManager.instance().getMediaPlayer().seekTo(mSeekTimePosition);
int duration = getDuration();
int progress = mSeekTimePosition * 100 / (duration == 0 ? 1 : duration);
Expand Down Expand Up @@ -1212,6 +1212,7 @@ public void setSmallCloseHide() {
*
* @return 返回是否全屏
*/
@SuppressWarnings("ResourceType")
public static boolean backFromWindowFull(Context context) {
boolean backFrom = false;
ViewGroup vp = (ViewGroup) (CommonUtil.scanForActivity(context)).findViewById(Window.ID_ANDROID_CONTENT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ protected void resolveNormalVideoShow(View oldF, ViewGroup vp, GSYVideoPlayer gs
* @param actionBar 是否有actionBar,有的话需要隐藏
* @param statusBar 是否有状态bar,有的话需要隐藏
*/
@SuppressWarnings("ResourceType")
public GSYBaseVideoPlayer startWindowFullscreen(final Context context, final boolean actionBar, final boolean statusBar) {

mSystemUiVisibility = ((Activity) context).getWindow().getDecorView().getSystemUiVisibility();
Expand Down Expand Up @@ -418,6 +419,7 @@ public void run() {
/**
* 回到正常效果
*/
@SuppressWarnings("ResourceType")
private void backToNormal() {

final ViewGroup vp = getViewGroup();
Expand Down Expand Up @@ -496,6 +498,7 @@ private void pauseFullBackCoverLogic(GSYBaseVideoPlayer gsyVideoPlayer) {
/**
* 显示小窗口
*/
@SuppressWarnings("ResourceType")
public GSYBaseVideoPlayer showSmallVideo(Point size, final boolean actionBar, final boolean statusBar) {

final ViewGroup vp = getViewGroup();
Expand Down Expand Up @@ -559,6 +562,7 @@ public GSYBaseVideoPlayer showSmallVideo(Point size, final boolean actionBar, fi
/**
* 隐藏小窗口
*/
@SuppressWarnings("ResourceType")
public void hideSmallVideo() {
final ViewGroup vp = getViewGroup();
GSYVideoPlayer gsyVideoPlayer = (GSYVideoPlayer) vp.findViewById(SMALL_ID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;

import com.shuyu.gsyvideoplayer.GSYVideoPlayer;
import com.shuyu.gsyvideoplayer.model.GSYVideoModel;

import java.io.File;
Expand Down Expand Up @@ -89,6 +92,20 @@ public GSYBaseVideoPlayer startWindowFullscreen(Context context, boolean actionB
return gsyBaseVideoPlayer;
}

@Override
protected void resolveNormalVideoShow(View oldF, ViewGroup vp, GSYVideoPlayer gsyVideoPlayer) {
if (gsyVideoPlayer != null) {
ListGSYVideoPlayer listGSYVideoPlayer = (ListGSYVideoPlayer) gsyVideoPlayer;
mPlayPosition = listGSYVideoPlayer.mPlayPosition;
mUriList = listGSYVideoPlayer.mUriList;
GSYVideoModel gsyVideoModel = mUriList.get(mPlayPosition);
if (!TextUtils.isEmpty(gsyVideoModel.getTitle())) {
mTitleTextView.setText(gsyVideoModel.getTitle());
}
}
super.resolveNormalVideoShow(oldF, vp, gsyVideoPlayer);
}

@Override
public void onCompletion() {
if (mPlayPosition < (mUriList.size() - 1)) {
Expand Down

0 comments on commit 63857b8

Please sign in to comment.