mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 15:23:00 +00:00 
			
		
		
		
	VideoDetailFragment: apply more IDE suggestions
This commit is contained in:
		| @@ -438,18 +438,15 @@ public final class VideoDetailFragment | ||||
|     @Override | ||||
|     public void onActivityResult(final int requestCode, final int resultCode, final Intent data) { | ||||
|         super.onActivityResult(requestCode, resultCode, data); | ||||
|         switch (requestCode) { | ||||
|             case ReCaptchaActivity.RECAPTCHA_REQUEST: | ||||
|         if (requestCode == ReCaptchaActivity.RECAPTCHA_REQUEST) { | ||||
|             if (resultCode == Activity.RESULT_OK) { | ||||
|                 NavigationHelper.openVideoDetailFragment(requireContext(), getFM(), | ||||
|                         serviceId, url, title, null, false); | ||||
|             } else { | ||||
|                 Log.e(TAG, "ReCaptcha failed"); | ||||
|             } | ||||
|                 break; | ||||
|             default: | ||||
|         } else { | ||||
|             Log.e(TAG, "Request code from activity not supported [" + requestCode + "]"); | ||||
|                 break; | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -1138,7 +1135,7 @@ public final class VideoDetailFragment | ||||
|     } | ||||
|  | ||||
|     private void openMainPlayer() { | ||||
|         if (!isPlayerServiceAvailable()) { | ||||
|         if (noPlayerServiceAvailable()) { | ||||
|             playerHolder.startService(autoPlayEnabled, this); | ||||
|             return; | ||||
|         } | ||||
| @@ -1163,7 +1160,7 @@ public final class VideoDetailFragment | ||||
|      */ | ||||
|     private void hideMainPlayerOnLoadingNewStream() { | ||||
|         final var root = getRoot(); | ||||
|         if (!isPlayerServiceAvailable() || root.isEmpty() || !player.videoPlayerSelected()) { | ||||
|         if (noPlayerServiceAvailable() || root.isEmpty() || !player.videoPlayerSelected()) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
| @@ -1347,13 +1344,13 @@ public final class VideoDetailFragment | ||||
|         this.playQueue = newPlayQueue; | ||||
|     } | ||||
|  | ||||
|     private void setErrorImage(final int imageResource) { | ||||
|     private void setErrorImage() { | ||||
|         if (binding == null || activity == null) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         binding.detailThumbnailImageView.setImageDrawable( | ||||
|                 AppCompatResources.getDrawable(requireContext(), imageResource)); | ||||
|                 AppCompatResources.getDrawable(requireContext(), R.drawable.not_available_monkey)); | ||||
|         animate(binding.detailThumbnailImageView, false, 0, AnimationType.ALPHA, | ||||
|                 0, () -> animate(binding.detailThumbnailImageView, true, 500)); | ||||
|     } | ||||
| @@ -1361,7 +1358,7 @@ public final class VideoDetailFragment | ||||
|     @Override | ||||
|     public void handleError() { | ||||
|         super.handleError(); | ||||
|         setErrorImage(R.drawable.not_available_monkey); | ||||
|         setErrorImage(); | ||||
|  | ||||
|         if (binding.relatedItemsLayout != null) { // hide related streams for tablets | ||||
|             binding.relatedItemsLayout.setVisibility(View.INVISIBLE); | ||||
| @@ -1776,8 +1773,7 @@ public final class VideoDetailFragment | ||||
|                                  final PlaybackParameters parameters) { | ||||
|         setOverlayPlayPauseImage(player != null && player.isPlaying()); | ||||
|  | ||||
|         switch (state) { | ||||
|             case Player.STATE_PLAYING: | ||||
|         if (state == Player.STATE_PLAYING) { | ||||
|             if (binding.positionView.getAlpha() != 1.0f | ||||
|                     && player.getPlayQueue() != null | ||||
|                     && player.getPlayQueue().getItem() != null | ||||
| @@ -1785,7 +1781,6 @@ public final class VideoDetailFragment | ||||
|                 animate(binding.positionView, true, 100); | ||||
|                 animate(binding.detailPositionView, true, 100); | ||||
|             } | ||||
|                 break; | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -2444,8 +2439,8 @@ public final class VideoDetailFragment | ||||
|         return player != null; | ||||
|     } | ||||
|  | ||||
|     boolean isPlayerServiceAvailable() { | ||||
|         return playerService != null; | ||||
|     boolean noPlayerServiceAvailable() { | ||||
|         return playerService == null; | ||||
|     } | ||||
|  | ||||
|     boolean isPlayerAndPlayerServiceAvailable() { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Profpatsch
					Profpatsch