mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 15:23:00 +00:00 
			
		
		
		
	Fix restoring orientation in onBack
This commit is contained in:
		| @@ -742,20 +742,19 @@ public final class VideoDetailFragment | |||||||
|                 && player.getPlayQueue() != null |                 && player.getPlayQueue() != null | ||||||
|                 && player.videoPlayerSelected() |                 && player.videoPlayerSelected() | ||||||
|                 && player.getPlayQueue().previous()) { |                 && player.getPlayQueue().previous()) { | ||||||
|             return true; |             return true; // no code here, as previous() was used in the if | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         // That means that we are on the start of the stack, |         // That means that we are on the start of the stack, | ||||||
|         // return false to let the MainActivity handle the onBack |  | ||||||
|         if (stack.size() <= 1) { |         if (stack.size() <= 1) { | ||||||
|             restoreDefaultOrientation(); |             restoreDefaultOrientation(); | ||||||
|  |             return false; // let MainActivity handle the onBack (e.g. to minimize the mini player) | ||||||
|             return false; |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         // Remove top |         // Remove top | ||||||
|         stack.pop(); |         stack.pop(); | ||||||
|         // Get stack item from the new top |         // Get stack item from the new top | ||||||
|         assert stack.peek() != null; |         setupFromHistoryItem(Objects.requireNonNull(stack.peek())); | ||||||
|         setupFromHistoryItem(stack.peek()); |  | ||||||
|  |  | ||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
| @@ -1432,17 +1431,15 @@ public final class VideoDetailFragment | |||||||
|     //////////////////////////////////////////////////////////////////////////*/ |     //////////////////////////////////////////////////////////////////////////*/ | ||||||
|  |  | ||||||
|     private void restoreDefaultOrientation() { |     private void restoreDefaultOrientation() { | ||||||
|         if (!isPlayerAvailable() || !player.videoPlayerSelected() || activity == null) { |         if (isPlayerAvailable() && player.videoPlayerSelected()) { | ||||||
|             return; |             toggleFullscreenIfInFullscreenMode(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         toggleFullscreenIfInFullscreenMode(); |  | ||||||
|  |  | ||||||
|         // This will show systemUI and pause the player. |         // This will show systemUI and pause the player. | ||||||
|         // User can tap on Play button and video will be in fullscreen mode again |         // User can tap on Play button and video will be in fullscreen mode again | ||||||
|         // Note for tablet: trying to avoid orientation changes since it's not easy |         // Note for tablet: trying to avoid orientation changes since it's not easy | ||||||
|         // to physically rotate the tablet every time |         // to physically rotate the tablet every time | ||||||
|         if (!DeviceUtils.isTablet(activity)) { |         if (activity != null && !DeviceUtils.isTablet(activity)) { | ||||||
|             activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); |             activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Stypox
					Stypox