From 015183bba96a63071ce631b55f7f5932824a805c Mon Sep 17 00:00:00 2001 From: TobiGr Date: Wed, 21 Oct 2026 02:30:13 +0200 Subject: [PATCH] Improve docs and fix typos --- .../newpipe/download/DownloadDialog.java | 2 +- .../org/schabi/newpipe/player/Player.java | 20 +++++++++++-------- .../NonUriHlsDataSourceFactory.java | 2 +- .../gesture/PopupPlayerGestureListener.kt | 2 +- .../player/mediasource/FailedMediaSource.java | 2 +- .../mediasource/ManagedMediaSource.java | 2 +- .../player/playback/PlaybackListener.java | 2 +- .../playback/SurfaceHolderCallback.java | 6 +++--- .../newpipe/player/playqueue/PlayQueue.java | 2 +- .../newpipe/player/ui/PopupPlayerUi.java | 2 +- .../newpipe/player/ui/VideoPlayerUi.java | 2 +- 11 files changed, 24 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java b/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java index 178fcefe16f..627e85fe130 100644 --- a/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java +++ b/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java @@ -924,7 +924,7 @@ private void checkSelectedDownload(final StoredDirectoryHelper mainStorage, } else if (targetFile == null) { // This part is called if: // * the filename is not used in a pending/finished download - // * the file does not exists, create + // * the file does not exist, create if (!mainStorage.mkdirs()) { showFailedDialog(R.string.error_path_creation); diff --git a/app/src/main/java/org/schabi/newpipe/player/Player.java b/app/src/main/java/org/schabi/newpipe/player/Player.java index b5b2228ca9a..39bdb7fb193 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -186,7 +186,9 @@ public final class Player implements PlaybackListener, Listener { // Playback //////////////////////////////////////////////////////////////////////////*/ - // play queue might be null e.g. while player is starting + /** + * The play queue might be {@code null} e.g. while player is starting + */ @Nullable private PlayQueue playQueue; @@ -230,8 +232,10 @@ public final class Player implements PlaybackListener, Listener { private PlayerType playerType = PlayerType.MAIN; private int currentState = STATE_PREFLIGHT; - // audio only mode does not mean that player type is background, but that the player was - // minimized to background but will resume automatically to the original player type + /** + * Audio-only mode does not mean that player type is background, but that the player was + * minimized to background and will change to the original player type automatically. + */ private boolean isAudioOnly = false; private boolean isPrepared = false; @@ -934,7 +938,7 @@ public void onSuccess(@NonNull final coil3.Image result) { private void onThumbnailLoaded(@Nullable final Bitmap bitmap) { // Avoid useless thumbnail updates, if the thumbnail has not actually changed. Based on the - // thumbnail loading code, this if would be skipped only when both bitmaps are `null`, since + // thumbnail loading code, this would be skipped only when both bitmaps are `null`, since // onThumbnailLoaded won't be called twice with the same nonnull bitmap by Coil's target. if (currentThumbnail != bitmap) { currentThumbnail = bitmap; @@ -1522,7 +1526,7 @@ public void onPrepare() { *
  • From {@link PlaybackException#ERROR_CODE_IO_INVALID_HTTP_CONTENT_TYPE BAD_IO} to * {@link PlaybackException#ERROR_CODE_PARSING_MANIFEST_UNSUPPORTED UNSUPPORTED_FORMATS}: * If the stream source is validated by the extractor but not recognized by the player, - * then we can try to recover playback by signalling an error on the {@link PlayQueue}.
  • + * then we can try to recover playback by signaling an error on the {@link PlayQueue}. *
  • For {@link PlaybackException#ERROR_CODE_TIMEOUT PLAYER_TIMEOUT}, * {@link PlaybackException#ERROR_CODE_IO_UNSPECIFIED MEDIA_SOURCE_RESOLVER_TIMEOUT} and * {@link PlaybackException#ERROR_CODE_IO_NETWORK_CONNECTION_FAILED NO_NETWORK}: @@ -1541,7 +1545,7 @@ public void onPrepare() { */ // Any error code not explicitly covered here are either unrelated to NewPipe use case // (e.g. DRM) or not recoverable (e.g. Decoder error). In both cases, the player should - // shutdown. + // shut down. @SuppressWarnings("SwitchIntDef") @Override public void onPlayerError(@NonNull final PlaybackException error) { @@ -2241,7 +2245,7 @@ The current metadata may be null sometimes (for e.g. when using an unstable conn reloadPlayQueueManager(); }); - // Disable or enable video and subtitles renderers depending of the + // Disable or enable video and subtitles renderers depending on the // videoAndSubtitlesEnabled value trackSelector.setParameters(trackSelector.buildUponParameters() .setTrackTypeDisabled(C.TRACK_TYPE_TEXT, !videoAndSubtitlesEnabled) @@ -2354,7 +2358,7 @@ private boolean isLive() { try { return !exoPlayerIsNull() && simpleExoPlayer.isCurrentMediaItemDynamic(); } catch (final IndexOutOfBoundsException e) { - // Why would this even happen =(... but lets log it anyway, better safe than sorry + // Why would this even happen =(... but let's log it anyway, better safe than sorry if (DEBUG) { Log.d(TAG, "player.isCurrentWindowDynamic() failed: ", e); } diff --git a/app/src/main/java/org/schabi/newpipe/player/datasource/NonUriHlsDataSourceFactory.java b/app/src/main/java/org/schabi/newpipe/player/datasource/NonUriHlsDataSourceFactory.java index 676443a9c78..0c9b631bfdc 100644 --- a/app/src/main/java/org/schabi/newpipe/player/datasource/NonUriHlsDataSourceFactory.java +++ b/app/src/main/java/org/schabi/newpipe/player/datasource/NonUriHlsDataSourceFactory.java @@ -18,7 +18,7 @@ *

    * If media requests are relative, the URI from which the manifest comes from (either the * manifest URI (preferred) or the master URI (if applicable)) must be returned, otherwise the - * content will be not playable, as it will be an invalid URL, or it may be treat as something + * content will be not playable, as it will be an invalid URL, or it may be treated as something * unexpected, for instance as a file for * {@link com.google.android.exoplayer2.upstream.DefaultDataSource DefaultDataSource}s. *

    diff --git a/app/src/main/java/org/schabi/newpipe/player/gesture/PopupPlayerGestureListener.kt b/app/src/main/java/org/schabi/newpipe/player/gesture/PopupPlayerGestureListener.kt index 60752652ea9..ea74f4c7f0c 100644 --- a/app/src/main/java/org/schabi/newpipe/player/gesture/PopupPlayerGestureListener.kt +++ b/app/src/main/java/org/schabi/newpipe/player/gesture/PopupPlayerGestureListener.kt @@ -258,7 +258,7 @@ class PopupPlayerGestureListener( // -- Determine if the ClosingOverlayView (red X) has to be shown or hidden -- val showClosingOverlayView: Boolean = playerUi.isInsideClosingRadius(movingEvent) - // Check if an view is in expected state and if not animate it into the correct state + // Check if a view is in expected state and if not animate it into the correct state if (binding.closingOverlay.isVisible != showClosingOverlayView) { binding.closingOverlay.animate(showClosingOverlayView, 200) } diff --git a/app/src/main/java/org/schabi/newpipe/player/mediasource/FailedMediaSource.java b/app/src/main/java/org/schabi/newpipe/player/mediasource/FailedMediaSource.java index b9ca90d89fa..e0b32b73c1f 100644 --- a/app/src/main/java/org/schabi/newpipe/player/mediasource/FailedMediaSource.java +++ b/app/src/main/java/org/schabi/newpipe/player/mediasource/FailedMediaSource.java @@ -98,7 +98,7 @@ public MediaItem getMediaItem() { *

    * If the exception is not known, e.g. {@link java.net.UnknownHostException} or some * other network issue, then no source info is refreshed and - * {@link #maybeThrowSourceInfoRefreshError()} be will triggered. + * {@link #maybeThrowSourceInfoRefreshError()} will be triggered. *

    * Note that this method is called only once until {@link #releaseSourceInternal()} is called, * so if no action is done in here, playback will stall unless diff --git a/app/src/main/java/org/schabi/newpipe/player/mediasource/ManagedMediaSource.java b/app/src/main/java/org/schabi/newpipe/player/mediasource/ManagedMediaSource.java index 9d6b948937b..3994c2ecf8b 100644 --- a/app/src/main/java/org/schabi/newpipe/player/mediasource/ManagedMediaSource.java +++ b/app/src/main/java/org/schabi/newpipe/player/mediasource/ManagedMediaSource.java @@ -15,7 +15,7 @@ public interface ManagedMediaSource extends MediaSource { * {@link ManagedMediaSource}, then it should be replaced. * @param isInterruptable specifies if this {@link ManagedMediaSource} potentially * being played. - * @return whether this could be replaces + * @return whether this could be replaced */ boolean shouldBeReplacedWith(@NonNull PlayQueueItem newIdentity, boolean isInterruptable); diff --git a/app/src/main/java/org/schabi/newpipe/player/playback/PlaybackListener.java b/app/src/main/java/org/schabi/newpipe/player/playback/PlaybackListener.java index 73760700155..03fdaa9b1d4 100644 --- a/app/src/main/java/org/schabi/newpipe/player/playback/PlaybackListener.java +++ b/app/src/main/java/org/schabi/newpipe/player/playback/PlaybackListener.java @@ -72,7 +72,7 @@ public interface PlaybackListener { /** * Called when the play queue can no longer be played or used. * Currently, this means the play queue is empty and complete. - * Signals to the listener that it should shutdown. + * Signals to the listener that it should shut down. *

    * May be called at any time. *

    diff --git a/app/src/main/java/org/schabi/newpipe/player/playback/SurfaceHolderCallback.java b/app/src/main/java/org/schabi/newpipe/player/playback/SurfaceHolderCallback.java index da6cb36d4fb..4340d32bd1f 100644 --- a/app/src/main/java/org/schabi/newpipe/player/playback/SurfaceHolderCallback.java +++ b/app/src/main/java/org/schabi/newpipe/player/playback/SurfaceHolderCallback.java @@ -8,11 +8,11 @@ /** * Prevent error message: 'Unrecoverable player error occurred' - * In case of rotation some users see this kind of an error which is preventable + * In case of rotation some users see this kind of error which is preventable * having a Callback that handles the lifecycle of the surface. *

    - * How?: In case we are no longer able to write to the surface eg. through rotation/putting in - * background we set set a DummySurface. Although it it works on API >= 23 only. + * How?: In case we are no longer able to write to the surface e.g. through rotation/putting in + * background we set a DummySurface. Although it works on API >= 23 only. * Result: we get a little video interruption (audio is still fine) but we won't get the * 'Unrecoverable player error occurred' error message. *

    diff --git a/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueue.java b/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueue.java index 8a66dc2ffac..9c7d0e20fd7 100644 --- a/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueue.java +++ b/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueue.java @@ -373,7 +373,7 @@ private synchronized void removeInternal(final int removeIndex) { * to that of the target. * If the moved item is not the currently playing and moves to an index AFTER the * current playing index, then the current playing index is decremented. - * Vice versa if the an item after the currently playing is moved BEFORE. + * Vice versa if an item after the currently playing is moved BEFORE. *

    * * @param source the original index of the item diff --git a/app/src/main/java/org/schabi/newpipe/player/ui/PopupPlayerUi.java b/app/src/main/java/org/schabi/newpipe/player/ui/PopupPlayerUi.java index b9c29c00845..4dbbb471cca 100644 --- a/app/src/main/java/org/schabi/newpipe/player/ui/PopupPlayerUi.java +++ b/app/src/main/java/org/schabi/newpipe/player/ui/PopupPlayerUi.java @@ -243,7 +243,7 @@ public void onBroadcastReceived(final Intent intent) { //region Popup position and size /** - * Check if {@link #popupLayoutParams}' position is within a arbitrary boundary + * Check if {@link #popupLayoutParams}' position is within an arbitrary boundary * that goes from (0, 0) to (screenWidth, screenHeight). *

    * If it's out of these boundaries, {@link #popupLayoutParams}' position is changed diff --git a/app/src/main/java/org/schabi/newpipe/player/ui/VideoPlayerUi.java b/app/src/main/java/org/schabi/newpipe/player/ui/VideoPlayerUi.java index 563927e19f4..65af3c44ae7 100644 --- a/app/src/main/java/org/schabi/newpipe/player/ui/VideoPlayerUi.java +++ b/app/src/main/java/org/schabi/newpipe/player/ui/VideoPlayerUi.java @@ -810,7 +810,7 @@ public boolean isFullscreen() { /** * Update the play/pause button ({@link R.id.playPauseButton}) to reflect the action - * that will be performed when the button is clicked.. + * that will be performed when the button is clicked. * @param action the action that is performed when the play/pause button is clicked */ private void updatePlayPauseButton(final PlayButtonAction action) {