First block of fixes for review

- popup player click event changed to show/hide buttons
- queue panel WORKS. Finally
- removed theme overriding in fragment
- added scroll to top after stream selection
- adjusted padding/margin of buttons in player
- player will itself in fullscreen after user hides it in fullscreen mode and then expands it again while video still playing
This commit is contained in:
Avently 2019-12-31 19:06:39 +03:00
parent fc9b63298c
commit bc2dc8d933
7 changed files with 109 additions and 84 deletions

View file

@ -311,7 +311,6 @@ public class VideoDetailFragment
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
ThemeHelper.setTheme(getContext());
// Let's play all streams automatically
setAutoplay(true);
@ -953,14 +952,14 @@ public class VideoDetailFragment
showLoading();
initTabs();
if (scrollToTop) appBarLayout.setExpanded(true, true);
if (scrollToTop) scrollToTop();
handleResult(info);
showContent();
}
protected void prepareAndLoadInfo() {
appBarLayout.setExpanded(true, true);
scrollToTop();
startLoading(false);
}
@ -1029,6 +1028,10 @@ public class VideoDetailFragment
}
}
public void scrollToTop() {
appBarLayout.setExpanded(true, true);
}
/*//////////////////////////////////////////////////////////////////////////
// Play Utils
//////////////////////////////////////////////////////////////////////////*/
@ -1862,6 +1865,8 @@ public class VideoDetailFragment
// Disable click because overlay buttons located on top of buttons from the player
setOverlayElementsClickable(false);
hideSystemUIIfNeeded();
if (isLandscape() && player != null && player.isPlaying() && !player.isInFullscreen())
player.toggleFullscreen();
break;
case BottomSheetBehavior.STATE_COLLAPSED:
// Re-enable clicks

View file

@ -346,7 +346,8 @@ public class VideoPlayerImpl extends VideoPlayer
// Use smaller value to be consistent between screen orientations
// (and to make usage easier)
int width = r - l, height = b - t;
maxGestureLength = (int) (Math.min(width, height) * MAX_GESTURE_LENGTH);
int min = Math.min(width, height);
maxGestureLength = (int) (min * MAX_GESTURE_LENGTH);
if (DEBUG) Log.d(TAG, "maxGestureLength = " + maxGestureLength);
@ -354,6 +355,7 @@ public class VideoPlayerImpl extends VideoPlayer
brightnessProgressBar.setMax(maxGestureLength);
setInitialGestureValues();
queueLayout.getLayoutParams().height = min - queueLayout.getTop();
}
});
}
@ -620,8 +622,6 @@ public class VideoPlayerImpl extends VideoPlayer
DEFAULT_CONTROLS_DURATION);
itemsList.scrollToPosition(playQueue.getIndex());
if (playQueue.getStreams().size() > 4 && !isInFullscreen()) toggleFullscreen();
}
private void onQueueClosed() {

View file

@ -292,7 +292,6 @@ public class PlayerGestureListener extends GestureDetector.SimpleOnGestureListen
playerImpl.showControlsThenHide();
}
playerImpl.onPlayPause();
return true;
}

View file

@ -301,6 +301,7 @@ public class NavigationHelper {
VideoDetailFragment detailFragment = (VideoDetailFragment) fragment;
detailFragment.setAutoplay(autoPlay);
detailFragment.selectAndLoadVideo(serviceId, url, title, playQueue);
detailFragment.scrollToTop();
return;
}