forked from recloudstream/cloudstream
		
	fixed pip exit
This commit is contained in:
		
							parent
							
								
									aae4ed555b
								
							
						
					
					
						commit
						641025fa2d
					
				
					 2 changed files with 11 additions and 2 deletions
				
			
		|  | @ -92,6 +92,10 @@ abstract class AbstractPlayerFragment( | ||||||
|         throw NotImplementedError() |         throw NotImplementedError() | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     open fun exitedPipMode() { | ||||||
|  |         throw NotImplementedError() | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     private fun keepScreenOn(on: Boolean) { |     private fun keepScreenOn(on: Boolean) { | ||||||
|         if (on) { |         if (on) { | ||||||
|             activity?.window?.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) |             activity?.window?.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) | ||||||
|  | @ -160,7 +164,7 @@ abstract class AbstractPlayerFragment( | ||||||
|             isInPIPMode = isInPictureInPictureMode |             isInPIPMode = isInPictureInPictureMode | ||||||
|             if (isInPictureInPictureMode) { |             if (isInPictureInPictureMode) { | ||||||
|                 // Hide the full-screen UI (controls, etc.) while in picture-in-picture mode. |                 // Hide the full-screen UI (controls, etc.) while in picture-in-picture mode. | ||||||
|                 player_holder.alpha = 0f |                 player_holder?.alpha = 0f | ||||||
|                 pipReceiver = object : BroadcastReceiver() { |                 pipReceiver = object : BroadcastReceiver() { | ||||||
|                     override fun onReceive( |                     override fun onReceive( | ||||||
|                         context: Context, |                         context: Context, | ||||||
|  | @ -188,7 +192,8 @@ abstract class AbstractPlayerFragment( | ||||||
|                 updateIsPlaying(Pair(isPlayingValue, isPlayingValue)) |                 updateIsPlaying(Pair(isPlayingValue, isPlayingValue)) | ||||||
|             } else { |             } else { | ||||||
|                 // Restore the full-screen UI. |                 // Restore the full-screen UI. | ||||||
|                 player_holder.alpha = 1f |                 player_holder?.alpha = 1f | ||||||
|  |                 exitedPipMode() | ||||||
|                 pipReceiver?.let { |                 pipReceiver?.let { | ||||||
|                     activity?.unregisterReceiver(it) |                     activity?.unregisterReceiver(it) | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|  | @ -146,6 +146,10 @@ open class FullScreenPlayer : AbstractPlayerFragment() { | ||||||
|         return rawY > statusHeight && rawX < screenWidth //- navHeight |         return rawY > statusHeight && rawX < screenWidth //- navHeight | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     override fun exitedPipMode() { | ||||||
|  |         animateLayoutChanges() | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     private fun animateLayoutChanges() { |     private fun animateLayoutChanges() { | ||||||
|         if (isShowing) { |         if (isShowing) { | ||||||
|             updateUIVisibility() |             updateUIVisibility() | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue