@@ -188,21 +188,21 @@ public final class VideoDetailFragment
188188 };
189189
190190 @ State
191- protected int serviceId = Constants .NO_SERVICE_ID ;
191+ int serviceId = Constants .NO_SERVICE_ID ;
192192 @ State
193193 @ NonNull
194- protected String title = "" ;
194+ String title = "" ;
195195 @ State
196196 @ Nullable
197- protected String url = null ;
197+ String url = null ;
198198 @ Nullable
199- protected PlayQueue playQueue = null ;
199+ private PlayQueue playQueue = null ;
200200 @ State
201201 int bottomSheetState = BottomSheetBehavior .STATE_EXPANDED ;
202202 @ State
203203 int lastStableBottomSheetState = BottomSheetBehavior .STATE_EXPANDED ;
204204 @ State
205- protected boolean autoPlayEnabled = true ;
205+ boolean autoPlayEnabled = true ;
206206
207207 @ Nullable
208208 private StreamInfo currentInfo = null ;
@@ -438,18 +438,15 @@ public void onDestroyView() {
438438 @ Override
439439 public void onActivityResult (final int requestCode , final int resultCode , final Intent data ) {
440440 super .onActivityResult (requestCode , resultCode , data );
441- switch (requestCode ) {
442- case ReCaptchaActivity .RECAPTCHA_REQUEST :
443- if (resultCode == Activity .RESULT_OK ) {
444- NavigationHelper .openVideoDetailFragment (requireContext (), getFM (),
445- serviceId , url , title , null , false );
446- } else {
447- Log .e (TAG , "ReCaptcha failed" );
448- }
449- break ;
450- default :
451- Log .e (TAG , "Request code from activity not supported [" + requestCode + "]" );
452- break ;
441+ if (requestCode == ReCaptchaActivity .RECAPTCHA_REQUEST ) {
442+ if (resultCode == Activity .RESULT_OK ) {
443+ NavigationHelper .openVideoDetailFragment (requireContext (), getFM (),
444+ serviceId , url , title , null , false );
445+ } else {
446+ Log .e (TAG , "ReCaptcha failed" );
447+ }
448+ } else {
449+ Log .e (TAG , "Request code from activity not supported [" + requestCode + "]" );
453450 }
454451 }
455452
@@ -815,25 +812,17 @@ private void prepareAndHandleInfo(final StreamInfo info, final boolean scrollToT
815812
816813 }
817814
818- protected void prepareAndLoadInfo () {
815+ private void prepareAndLoadInfo () {
819816 scrollToTop ();
820817 startLoading (false );
821818 }
822819
823820 @ Override
824821 public void startLoading (final boolean forceLoad ) {
825- super .startLoading (forceLoad );
826-
827- initTabs ();
828- currentInfo = null ;
829- if (currentWorker != null ) {
830- currentWorker .dispose ();
831- }
832-
833- runWorker (forceLoad , stack .isEmpty ());
822+ startLoading (forceLoad , null );
834823 }
835824
836- private void startLoading (final boolean forceLoad , final boolean addToBackStack ) {
825+ private void startLoading (final boolean forceLoad , final @ Nullable Boolean addToBackStack ) {
837826 super .startLoading (forceLoad );
838827
839828 initTabs ();
@@ -842,7 +831,7 @@ private void startLoading(final boolean forceLoad, final boolean addToBackStack)
842831 currentWorker .dispose ();
843832 }
844833
845- runWorker (forceLoad , addToBackStack );
834+ runWorker (forceLoad , addToBackStack != null ? addToBackStack : stack . isEmpty () );
846835 }
847836
848837 private void runWorker (final boolean forceLoad , final boolean addToBackStack ) {
@@ -1138,7 +1127,7 @@ private void openNormalBackgroundPlayer(final boolean append) {
11381127 }
11391128
11401129 private void openMainPlayer () {
1141- if (! isPlayerServiceAvailable ()) {
1130+ if (noPlayerServiceAvailable ()) {
11421131 playerHolder .startService (autoPlayEnabled , this );
11431132 return ;
11441133 }
@@ -1163,7 +1152,7 @@ private void openMainPlayer() {
11631152 */
11641153 private void hideMainPlayerOnLoadingNewStream () {
11651154 final var root = getRoot ();
1166- if (! isPlayerServiceAvailable () || root .isEmpty () || !player .videoPlayerSelected ()) {
1155+ if (noPlayerServiceAvailable () || root .isEmpty () || !player .videoPlayerSelected ()) {
11671156 return ;
11681157 }
11691158
@@ -1337,31 +1326,31 @@ private void showContent() {
13371326 binding .detailContentRootHiding .setVisibility (View .VISIBLE );
13381327 }
13391328
1340- protected void setInitialData (final int newServiceId ,
1341- @ Nullable final String newUrl ,
1342- @ NonNull final String newTitle ,
1343- @ Nullable final PlayQueue newPlayQueue ) {
1329+ private void setInitialData (final int newServiceId ,
1330+ @ Nullable final String newUrl ,
1331+ @ NonNull final String newTitle ,
1332+ @ Nullable final PlayQueue newPlayQueue ) {
13441333 this .serviceId = newServiceId ;
13451334 this .url = newUrl ;
13461335 this .title = newTitle ;
13471336 this .playQueue = newPlayQueue ;
13481337 }
13491338
1350- private void setErrorImage (final int imageResource ) {
1339+ private void setErrorImage () {
13511340 if (binding == null || activity == null ) {
13521341 return ;
13531342 }
13541343
13551344 binding .detailThumbnailImageView .setImageDrawable (
1356- AppCompatResources .getDrawable (requireContext (), imageResource ));
1345+ AppCompatResources .getDrawable (requireContext (), R . drawable . not_available_monkey ));
13571346 animate (binding .detailThumbnailImageView , false , 0 , AnimationType .ALPHA ,
13581347 0 , () -> animate (binding .detailThumbnailImageView , true , 500 ));
13591348 }
13601349
13611350 @ Override
13621351 public void handleError () {
13631352 super .handleError ();
1364- setErrorImage (R . drawable . not_available_monkey );
1353+ setErrorImage ();
13651354
13661355 if (binding .relatedItemsLayout != null ) { // hide related streams for tablets
13671356 binding .relatedItemsLayout .setVisibility (View .INVISIBLE );
@@ -1776,16 +1765,14 @@ public void onPlaybackUpdate(final int state,
17761765 final PlaybackParameters parameters ) {
17771766 setOverlayPlayPauseImage (player != null && player .isPlaying ());
17781767
1779- switch (state ) {
1780- case Player .STATE_PLAYING :
1781- if (binding .positionView .getAlpha () != 1.0f
1782- && player .getPlayQueue () != null
1783- && player .getPlayQueue ().getItem () != null
1784- && player .getPlayQueue ().getItem ().getUrl ().equals (url )) {
1785- animate (binding .positionView , true , 100 );
1786- animate (binding .detailPositionView , true , 100 );
1787- }
1788- break ;
1768+ if (state == Player .STATE_PLAYING ) {
1769+ if (binding .positionView .getAlpha () != 1.0f
1770+ && player .getPlayQueue () != null
1771+ && player .getPlayQueue ().getItem () != null
1772+ && player .getPlayQueue ().getItem ().getUrl ().equals (url )) {
1773+ animate (binding .positionView , true , 100 );
1774+ animate (binding .detailPositionView , true , 100 );
1775+ }
17891776 }
17901777 }
17911778
@@ -2444,8 +2431,8 @@ boolean isPlayerAvailable() {
24442431 return player != null ;
24452432 }
24462433
2447- boolean isPlayerServiceAvailable () {
2448- return playerService ! = null ;
2434+ boolean noPlayerServiceAvailable () {
2435+ return playerService = = null ;
24492436 }
24502437
24512438 boolean isPlayerAndPlayerServiceAvailable () {
0 commit comments