|
@@ -3,16 +3,22 @@ package com.sheep.gamegroup.view.customview;
|
|
|
import android.content.Context;
|
|
import android.content.Context;
|
|
|
import android.util.AttributeSet;
|
|
import android.util.AttributeSet;
|
|
|
import android.view.GestureDetector;
|
|
import android.view.GestureDetector;
|
|
|
|
|
+import android.view.View;
|
|
|
|
|
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
|
|
+import com.shuyu.gsyvideoplayer.utils.Debuger;
|
|
|
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer;
|
|
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer;
|
|
|
|
|
|
|
|
|
|
+import moe.codeest.enviews.ENDownloadView;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Created by realicing on 2019/1/4.
|
|
* Created by realicing on 2019/1/4.
|
|
|
* realicing@sina.com
|
|
* realicing@sina.com
|
|
|
*/
|
|
*/
|
|
|
public class SheepGSYVideoView extends StandardGSYVideoPlayer {
|
|
public class SheepGSYVideoView extends StandardGSYVideoPlayer {
|
|
|
|
|
|
|
|
|
|
+ private boolean showControlView = true;
|
|
|
|
|
+
|
|
|
public SheepGSYVideoView(Context context, Boolean fullFlag) {
|
|
public SheepGSYVideoView(Context context, Boolean fullFlag) {
|
|
|
super(context, fullFlag);
|
|
super(context, fullFlag);
|
|
|
}
|
|
}
|
|
@@ -52,4 +58,164 @@ public class SheepGSYVideoView extends StandardGSYVideoPlayer {
|
|
|
public void disableProgressDrag() {
|
|
public void disableProgressDrag() {
|
|
|
mProgressBar.setVisibility(INVISIBLE);
|
|
mProgressBar.setVisibility(INVISIBLE);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public View getBottomProgressBar() {
|
|
|
|
|
+ return mBottomProgressBar;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public View getProgressBar() {
|
|
|
|
|
+ return mProgressBar;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void setShowControlView(boolean flag) {
|
|
|
|
|
+ showControlView = flag;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ protected void changeUiToNormal() {
|
|
|
|
|
+ if (showControlView) {
|
|
|
|
|
+ super.changeUiToPlayingShow();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ Debuger.printfLog("changeUiToNormal");
|
|
|
|
|
+ setViewShowState(mTopContainer, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mBottomContainer, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mStartButton, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mLoadingProgressBar, VISIBLE);
|
|
|
|
|
+ setViewShowState(mThumbImageViewLayout, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mBottomProgressBar, VISIBLE);
|
|
|
|
|
+ setViewShowState(mLockScreen, (mIfCurrentIsFullscreen && mNeedLockFull) ? VISIBLE : GONE);
|
|
|
|
|
+
|
|
|
|
|
+ updateStartImage();
|
|
|
|
|
+ if (mLoadingProgressBar instanceof ENDownloadView) {
|
|
|
|
|
+ ((ENDownloadView) mLoadingProgressBar).reset();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ protected void changeUiToPreparingShow() {
|
|
|
|
|
+ if (showControlView) {
|
|
|
|
|
+ super.changeUiToPlayingShow();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ Debuger.printfLog("changeUiToPreparingShow");
|
|
|
|
|
+ setViewShowState(mTopContainer, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mBottomContainer, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mStartButton, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mLoadingProgressBar, VISIBLE);
|
|
|
|
|
+ setViewShowState(mThumbImageViewLayout, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mBottomProgressBar, VISIBLE);
|
|
|
|
|
+ setViewShowState(mLockScreen, GONE);
|
|
|
|
|
+ if (mLoadingProgressBar instanceof ENDownloadView) {
|
|
|
|
|
+ ENDownloadView enDownloadView = (ENDownloadView) mLoadingProgressBar;
|
|
|
|
|
+ if (enDownloadView.getCurrentState() == ENDownloadView.STATE_PRE) {
|
|
|
|
|
+ ((ENDownloadView) mLoadingProgressBar).start();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void changeUiToPlayingShow() {
|
|
|
|
|
+ if (showControlView) {
|
|
|
|
|
+ super.changeUiToPlayingShow();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ Debuger.printfLog("changeUiToPlayingShow");
|
|
|
|
|
+ setViewShowState(mTopContainer, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mBottomContainer, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mStartButton, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mLoadingProgressBar, VISIBLE);
|
|
|
|
|
+ setViewShowState(mThumbImageViewLayout, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mBottomProgressBar, VISIBLE);
|
|
|
|
|
+ setViewShowState(mLockScreen, GONE);
|
|
|
|
|
+
|
|
|
|
|
+ if (mLoadingProgressBar instanceof ENDownloadView) {
|
|
|
|
|
+ ((ENDownloadView) mLoadingProgressBar).reset();
|
|
|
|
|
+ }
|
|
|
|
|
+ updateStartImage();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ protected void changeUiToPauseShow() {
|
|
|
|
|
+ if (showControlView) {
|
|
|
|
|
+ super.changeUiToPlayingShow();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ Debuger.printfLog("changeUiToPauseShow");
|
|
|
|
|
+ setViewShowState(mTopContainer, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mBottomContainer, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mStartButton, VISIBLE);
|
|
|
|
|
+ setViewShowState(mLoadingProgressBar, VISIBLE);
|
|
|
|
|
+ setViewShowState(mThumbImageViewLayout, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mBottomProgressBar, VISIBLE);
|
|
|
|
|
+ setViewShowState(mLockScreen, GONE);
|
|
|
|
|
+
|
|
|
|
|
+ if (mLoadingProgressBar instanceof ENDownloadView) {
|
|
|
|
|
+ ((ENDownloadView) mLoadingProgressBar).reset();
|
|
|
|
|
+ }
|
|
|
|
|
+ updateStartImage();
|
|
|
|
|
+ updatePauseCover();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ protected void changeUiToPlayingBufferingShow() {
|
|
|
|
|
+ if (showControlView) {
|
|
|
|
|
+ super.changeUiToPlayingShow();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ Debuger.printfLog("changeUiToPlayingBufferingShow");
|
|
|
|
|
+ setViewShowState(mTopContainer, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mBottomContainer, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mStartButton, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mLoadingProgressBar, VISIBLE);
|
|
|
|
|
+ setViewShowState(mThumbImageViewLayout, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mBottomProgressBar, VISIBLE);
|
|
|
|
|
+ setViewShowState(mLockScreen, GONE);
|
|
|
|
|
+ if (mLoadingProgressBar instanceof ENDownloadView) {
|
|
|
|
|
+ ENDownloadView enDownloadView = (ENDownloadView) mLoadingProgressBar;
|
|
|
|
|
+ if (enDownloadView.getCurrentState() == ENDownloadView.STATE_PRE) {
|
|
|
|
|
+ ((ENDownloadView) mLoadingProgressBar).start();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ protected void changeUiToCompleteShow() {
|
|
|
|
|
+ if (showControlView) {
|
|
|
|
|
+ super.changeUiToPlayingShow();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ Debuger.printfLog("changeUiToCompleteShow");
|
|
|
|
|
+ setViewShowState(mTopContainer, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mBottomContainer, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mStartButton, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mLoadingProgressBar, VISIBLE);
|
|
|
|
|
+ setViewShowState(mThumbImageViewLayout, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mBottomProgressBar, VISIBLE);
|
|
|
|
|
+ setViewShowState(mLockScreen, GONE);
|
|
|
|
|
+ if (mLoadingProgressBar instanceof ENDownloadView) {
|
|
|
|
|
+ ((ENDownloadView) mLoadingProgressBar).reset();
|
|
|
|
|
+ }
|
|
|
|
|
+ updateStartImage();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ protected void changeUiToError() {
|
|
|
|
|
+ if (showControlView) {
|
|
|
|
|
+ super.changeUiToPlayingShow();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ Debuger.printfLog("changeUiToError");
|
|
|
|
|
+ setViewShowState(mTopContainer, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mBottomContainer, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mStartButton, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mLoadingProgressBar, VISIBLE);
|
|
|
|
|
+ setViewShowState(mThumbImageViewLayout, INVISIBLE);
|
|
|
|
|
+ setViewShowState(mBottomProgressBar, VISIBLE);
|
|
|
|
|
+ setViewShowState(mLockScreen, GONE);
|
|
|
|
|
+ if (mLoadingProgressBar instanceof ENDownloadView) {
|
|
|
|
|
+ ((ENDownloadView) mLoadingProgressBar).reset();
|
|
|
|
|
+ }
|
|
|
|
|
+ updateStartImage();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|