From a536311d56c95af25e527bec0404ddf7b828dfcb Mon Sep 17 00:00:00 2001 From: evermind-zz Date: Wed, 11 Aug 2021 00:38:23 +0200 Subject: [PATCH] name the regions according to the comments (#6854) if a region is named android studio will show its name in the structure view. --- .../org/schabi/newpipe/player/Player.java | 61 ++++++++++--------- 1 file changed, 31 insertions(+), 30 deletions(-) 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 935dcca35..d8d8ac14b 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -390,7 +390,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Constructor //////////////////////////////////////////////////////////////////////////*/ - //region + //region Constructor public Player(@NonNull final MainPlayer service) { this.service = service; @@ -437,7 +437,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Setup and initialization //////////////////////////////////////////////////////////////////////////*/ - //region + //region Setup and initialization public void setupFromView(@NonNull final PlayerBinding playerBinding) { initViews(playerBinding); @@ -585,7 +585,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Playback initialization via intent //////////////////////////////////////////////////////////////////////////*/ - //region + //region Playback initialization via intent public void handleIntent(@NonNull final Intent intent) { // fail fast if no play queue was provided @@ -774,7 +774,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Destroy and recovery //////////////////////////////////////////////////////////////////////////*/ - //region + //region Destroy and recovery private void destroyPlayer() { if (DEBUG) { @@ -883,7 +883,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Player type specific setup //////////////////////////////////////////////////////////////////////////*/ - //region + //region Player type specific setup private void initVideoPlayer() { // restore last resize mode @@ -945,7 +945,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Elements visibility and size: popup and main players have different look //////////////////////////////////////////////////////////////////////////*/ - //region + //region Elements visibility and size: popup and main players have different look /** * This method ensures that popup and main players have different look. @@ -1059,7 +1059,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Broadcast receiver //////////////////////////////////////////////////////////////////////////*/ - //region + //region Broadcast receiver private void setupBroadcastReceiver() { if (DEBUG) { @@ -1211,7 +1211,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Thumbnail loading //////////////////////////////////////////////////////////////////////////*/ - //region + //region Thumbnail loading private void initThumbnail(final String url) { if (DEBUG) { @@ -1358,7 +1358,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Popup player utils //////////////////////////////////////////////////////////////////////////*/ - //region + //region Popup player utils /** * Check if {@link #popupLayoutParams}' position is within a arbitrary boundary @@ -1533,7 +1533,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Playback parameters //////////////////////////////////////////////////////////////////////////*/ - //region + //region Playback parameters public float getPlaybackSpeed() { return getPlaybackParameters().speed; @@ -1586,7 +1586,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Progress loop and updates //////////////////////////////////////////////////////////////////////////*/ - //region + //region Progress loop and updates private void onUpdateProgress(final int currentProgress, final int duration, @@ -1802,7 +1802,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Controls showing / hiding //////////////////////////////////////////////////////////////////////////*/ - //region + //region Controls showing / hiding public boolean isControlsVisible() { return binding != null && binding.playbackControlRoot.getVisibility() == View.VISIBLE; @@ -1972,7 +1972,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Playback states //////////////////////////////////////////////////////////////////////////*/ - //region + //region Playback states @Override // exoplayer listener public void onPlayerStateChanged(final boolean playWhenReady, final int playbackState) { @@ -2293,7 +2293,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Repeat and shuffle //////////////////////////////////////////////////////////////////////////*/ - //region + //region Repeat and shuffle public void onRepeatClicked() { if (DEBUG) { @@ -2382,7 +2382,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Mute / Unmute //////////////////////////////////////////////////////////////////////////*/ - //region + //region Mute / Unmute public void onMuteUnmuteButtonClicked() { if (DEBUG) { @@ -2408,7 +2408,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // ExoPlayer listeners (that didn't fit in other categories) //////////////////////////////////////////////////////////////////////////*/ - //region + //region ExoPlayer listeners (that didn't fit in other categories) @Override public void onTimelineChanged(@NonNull final Timeline timeline, final int reason) { @@ -2496,7 +2496,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Errors //////////////////////////////////////////////////////////////////////////*/ - //region + //region Errors /** * Process exceptions produced by {@link com.google.android.exoplayer2.ExoPlayer ExoPlayer}. *

There are multiple types of errors:

@@ -2597,7 +2597,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Playback position and seek //////////////////////////////////////////////////////////////////////////*/ - //region + //region Playback position and seek @Override // own playback listener (this is a getter) public boolean isApproachingPlaybackEdge(final long timeToEndMillis) { @@ -2747,7 +2747,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Player actions (play, pause, previous, fast-forward, ...) //////////////////////////////////////////////////////////////////////////*/ - //region + //region Player actions (play, pause, previous, fast-forward, ...) public void play() { if (DEBUG) { @@ -2855,7 +2855,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // StreamInfo history: views and progress //////////////////////////////////////////////////////////////////////////*/ - //region + //region StreamInfo history: views and progress private void registerStreamViewed() { if (currentMetadata != null) { @@ -2913,7 +2913,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Metadata //////////////////////////////////////////////////////////////////////////*/ - //region + //region Metadata private void onMetadataChanged(@NonNull final MediaSourceTag tag) { final StreamInfo info = tag.getMetadata(); @@ -3022,7 +3022,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Play queue, segments and streams //////////////////////////////////////////////////////////////////////////*/ - //region + //region Play queue, segments and streams private void maybeAutoQueueNextStream(@NonNull final MediaSourceTag metadata) { if (playQueue == null || playQueue.getIndex() != playQueue.size() - 1 @@ -3338,7 +3338,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Popup menus ("popup" means that they pop up, not that they belong to the popup player) //////////////////////////////////////////////////////////////////////////*/ - //region + //region Popup menus ("popup" means that they pop up, not that they belong to the popup player) private void buildQualityMenu() { if (qualityPopupMenu == null) { @@ -3541,7 +3541,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Captions (text tracks) //////////////////////////////////////////////////////////////////////////*/ - //region + //region Captions (text tracks) private void setupSubtitleView() { final float captionScale = PlayerHelper.getCaptionScale(context); @@ -3620,7 +3620,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Click listeners //////////////////////////////////////////////////////////////////////////*/ - //region + //region Click listeners @Override public void onClick(final View v) { @@ -3808,7 +3808,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Video size, resize, orientation, fullscreen //////////////////////////////////////////////////////////////////////////*/ - //region + //region Video size, resize, orientation, fullscreen private void setupScreenRotationButton() { binding.screenRotationButton.setVisibility(videoPlayerSelected() @@ -3915,7 +3915,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Gestures //////////////////////////////////////////////////////////////////////////*/ - //region + //region Gestures @SuppressWarnings("checkstyle:ParameterNumber") private void onLayoutChange(final View view, final int l, final int t, final int r, final int b, @@ -3979,7 +3979,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Activity / fragment binding //////////////////////////////////////////////////////////////////////////*/ - //region + //region Activity / fragment binding public void setFragmentListener(final PlayerServiceEventListener listener) { fragmentListener = listener; @@ -4118,7 +4118,7 @@ public final class Player implements /*////////////////////////////////////////////////////////////////////////// // Getters //////////////////////////////////////////////////////////////////////////*/ - //region + //region Getters public int getCurrentState() { return currentState; @@ -4304,6 +4304,7 @@ public final class Player implements // SurfaceHolderCallback helpers //////////////////////////////////////////////////////////////////////////*/ //region SurfaceHolderCallback helpers + private void setupVideoSurface() { // make sure there is nothing left over from previous calls cleanupVideoSurface(); @@ -4331,5 +4332,5 @@ public final class Player implements } } } - //endregion SurfaceHolderCallback helpers + //endregion }