@@ -155,18 +155,11 @@ protected void init(Context context) {
155155 mLockScreen .setOnClickListener (new OnClickListener () {
156156 @ Override
157157 public void onClick (View v ) {
158- if (mLockCurScreen ) {
159- mLockScreen .setImageResource (R .drawable .unlock );
160- mLockCurScreen = false ;
161- if (mOrientationUtils != null )
162- mOrientationUtils .setEnable (mRotateViewAuto );
163- } else {
164- mLockScreen .setImageResource (R .drawable .lock );
165- mLockCurScreen = true ;
166- if (mOrientationUtils != null )
167- mOrientationUtils .setEnable (false );
168- hideAllWidget ();
158+ if (mCurrentState == CURRENT_STATE_AUTO_COMPLETE ||
159+ mCurrentState == CURRENT_STATE_ERROR ) {
160+ return ;
169161 }
162+ lockTouchLogic ();
170163 if (mLockClickListener != null ) {
171164 mLockClickListener .onClick (v , mLockCurScreen );
172165 }
@@ -423,7 +416,7 @@ private void changeUiToNormal() {
423416 mStartButton .setVisibility (View .VISIBLE );
424417 mLoadingProgressBar .setVisibility (View .INVISIBLE );
425418 if (mLoadingProgressBar instanceof ENDownloadView ) {
426- ((ENDownloadView )mLoadingProgressBar ).reset ();
419+ ((ENDownloadView ) mLoadingProgressBar ).reset ();
427420 }
428421 mThumbImageViewLayout .setVisibility (View .VISIBLE );
429422 mCoverImageView .setVisibility (View .VISIBLE );
@@ -439,7 +432,7 @@ private void changeUiToPrepareingShow() {
439432 mStartButton .setVisibility (View .INVISIBLE );
440433 mLoadingProgressBar .setVisibility (View .VISIBLE );
441434 if (mLoadingProgressBar instanceof ENDownloadView ) {
442- ENDownloadView enDownloadView = (ENDownloadView ) mLoadingProgressBar ;
435+ ENDownloadView enDownloadView = (ENDownloadView ) mLoadingProgressBar ;
443436 if (enDownloadView .getCurrentState () == ENDownloadView .STATE_PRE ) {
444437 ((ENDownloadView ) mLoadingProgressBar ).start ();
445438 }
@@ -468,7 +461,7 @@ private void changeUiToPlayingShow() {
468461 mStartButton .setVisibility (View .VISIBLE );
469462 mLoadingProgressBar .setVisibility (View .INVISIBLE );
470463 if (mLoadingProgressBar instanceof ENDownloadView ) {
471- ((ENDownloadView )mLoadingProgressBar ).reset ();
464+ ((ENDownloadView ) mLoadingProgressBar ).reset ();
472465 }
473466 mThumbImageViewLayout .setVisibility (View .INVISIBLE );
474467 mCoverImageView .setVisibility (View .INVISIBLE );
@@ -490,7 +483,7 @@ private void changeUiToPauseShow() {
490483 mStartButton .setVisibility (View .VISIBLE );
491484 mLoadingProgressBar .setVisibility (View .INVISIBLE );
492485 if (mLoadingProgressBar instanceof ENDownloadView ) {
493- ((ENDownloadView )mLoadingProgressBar ).reset ();
486+ ((ENDownloadView ) mLoadingProgressBar ).reset ();
494487 }
495488 mThumbImageViewLayout .setVisibility (View .INVISIBLE );
496489 //mCoverImageView.setVisibility(View.INVISIBLE);
@@ -514,7 +507,7 @@ private void changeUiToPlayingBufferingShow() {
514507 mStartButton .setVisibility (View .INVISIBLE );
515508 mLoadingProgressBar .setVisibility (View .VISIBLE );
516509 if (mLoadingProgressBar instanceof ENDownloadView ) {
517- ENDownloadView enDownloadView = (ENDownloadView ) mLoadingProgressBar ;
510+ ENDownloadView enDownloadView = (ENDownloadView ) mLoadingProgressBar ;
518511 if (enDownloadView .getCurrentState () == ENDownloadView .STATE_PRE ) {
519512 ((ENDownloadView ) mLoadingProgressBar ).start ();
520513 }
@@ -532,7 +525,7 @@ private void changeUiToPlayingBufferingClear() {
532525 mStartButton .setVisibility (View .INVISIBLE );
533526 mLoadingProgressBar .setVisibility (View .VISIBLE );
534527 if (mLoadingProgressBar instanceof ENDownloadView ) {
535- ENDownloadView enDownloadView = (ENDownloadView ) mLoadingProgressBar ;
528+ ENDownloadView enDownloadView = (ENDownloadView ) mLoadingProgressBar ;
536529 if (enDownloadView .getCurrentState () == ENDownloadView .STATE_PRE ) {
537530 ((ENDownloadView ) mLoadingProgressBar ).start ();
538531 }
@@ -551,7 +544,7 @@ private void changeUiToClear() {
551544 mStartButton .setVisibility (View .INVISIBLE );
552545 mLoadingProgressBar .setVisibility (View .INVISIBLE );
553546 if (mLoadingProgressBar instanceof ENDownloadView ) {
554- ((ENDownloadView )mLoadingProgressBar ).reset ();
547+ ((ENDownloadView ) mLoadingProgressBar ).reset ();
555548 }
556549 mThumbImageViewLayout .setVisibility (View .INVISIBLE );
557550 mCoverImageView .setVisibility (View .INVISIBLE );
@@ -566,7 +559,7 @@ private void changeUiToCompleteShow() {
566559 mStartButton .setVisibility (View .VISIBLE );
567560 mLoadingProgressBar .setVisibility (View .INVISIBLE );
568561 if (mLoadingProgressBar instanceof ENDownloadView ) {
569- ((ENDownloadView )mLoadingProgressBar ).reset ();
562+ ((ENDownloadView ) mLoadingProgressBar ).reset ();
570563 }
571564 mThumbImageViewLayout .setVisibility (View .VISIBLE );
572565 mCoverImageView .setVisibility (View .INVISIBLE );
@@ -582,7 +575,7 @@ private void changeUiToCompleteClear() {
582575 mStartButton .setVisibility (View .VISIBLE );
583576 mLoadingProgressBar .setVisibility (View .INVISIBLE );
584577 if (mLoadingProgressBar instanceof ENDownloadView ) {
585- ((ENDownloadView )mLoadingProgressBar ).reset ();
578+ ((ENDownloadView ) mLoadingProgressBar ).reset ();
586579 }
587580 mThumbImageViewLayout .setVisibility (View .VISIBLE );
588581 mCoverImageView .setVisibility (View .INVISIBLE );
@@ -598,7 +591,7 @@ private void changeUiToError() {
598591 mStartButton .setVisibility (View .VISIBLE );
599592 mLoadingProgressBar .setVisibility (View .INVISIBLE );
600593 if (mLoadingProgressBar instanceof ENDownloadView ) {
601- ((ENDownloadView )mLoadingProgressBar ).reset ();
594+ ((ENDownloadView ) mLoadingProgressBar ).reset ();
602595 }
603596 mThumbImageViewLayout .setVisibility (View .INVISIBLE );
604597 mCoverImageView .setVisibility (View .VISIBLE );
@@ -785,6 +778,24 @@ public void onBackFullscreen() {
785778 }
786779
787780
781+ @ Override
782+ public void onAutoCompletion () {
783+ super .onAutoCompletion ();
784+ if (mLockCurScreen ) {
785+ lockTouchLogic ();
786+ mLockScreen .setVisibility (GONE );
787+ }
788+ }
789+
790+ @ Override
791+ public void onError (int what , int extra ) {
792+ super .onError (what , extra );
793+ if (mLockCurScreen ) {
794+ lockTouchLogic ();
795+ mLockScreen .setVisibility (GONE );
796+ }
797+ }
798+
788799 @ Override
789800 public GSYBaseVideoPlayer startWindowFullscreen (Context context , boolean actionBar , boolean statusBar ) {
790801 GSYBaseVideoPlayer gsyBaseVideoPlayer = super .startWindowFullscreen (context , actionBar , statusBar );
@@ -810,6 +821,24 @@ public GSYBaseVideoPlayer showSmallVideo(Point size, boolean actionBar, boolean
810821 return gsyBaseVideoPlayer ;
811822 }
812823
824+ /**
825+ * 处理锁屏屏幕触摸逻辑
826+ */
827+ private void lockTouchLogic () {
828+ if (mLockCurScreen ) {
829+ mLockScreen .setImageResource (R .drawable .unlock );
830+ mLockCurScreen = false ;
831+ if (mOrientationUtils != null )
832+ mOrientationUtils .setEnable (mRotateViewAuto );
833+ } else {
834+ mLockScreen .setImageResource (R .drawable .lock );
835+ mLockCurScreen = true ;
836+ if (mOrientationUtils != null )
837+ mOrientationUtils .setEnable (false );
838+ hideAllWidget ();
839+ }
840+ }
841+
813842 /**
814843 * 初始化为正常状态
815844 */
0 commit comments