Skip to content

Commit

Permalink
Sync custom controls with built-in controls in leanback overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsvanvelzen committed Oct 29, 2024
1 parent e44b36e commit e7738c7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public class CustomPlaybackOverlayFragment extends Fragment implements LiveTvGui
private AudioManager mAudioManager;

private boolean mFadeEnabled = false;
private boolean mIsVisible = false;
private boolean mIsVisible = true;
private boolean mPopupPanelVisible = false;
private boolean navigating = false;

Expand Down Expand Up @@ -168,7 +168,6 @@ public void onCreate(Bundle savedInstanceState) {
// setup fade task
mHideTask = () -> {
if (mIsVisible) {
hide();
leanbackOverlayFragment.hideOverlay();
}
};
Expand Down Expand Up @@ -203,9 +202,6 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
tvGuideBinding.getRoot().setVisibility(View.GONE);

binding.getRoot().setOnTouchListener((v, event) -> {
//if we're not visible, show us
if (!mIsVisible) show();

//and then manage our fade timer
if (mFadeEnabled) startFadeTimer();

Expand Down Expand Up @@ -298,7 +294,6 @@ public void onScrollChanged(ObservableHorizontalScrollView scrollView, int x, in
// start playing
playbackControllerContainer.getValue().getPlaybackController().play(startPos);
leanbackOverlayFragment.updatePlayState();

}

@Override
Expand Down Expand Up @@ -600,9 +595,6 @@ public boolean onKey(View v, int keyCode, KeyEvent event) {
playbackControllerContainer.getValue().getPlaybackController().playPause();
return true;
}

//if we're not visible, show us
show();
}

//and then manage our fade timer
Expand Down Expand Up @@ -704,12 +696,18 @@ public void onStop() {
}

public void show() {
// Already showing!
if (mIsVisible) return;

binding.topPanel.startAnimation(slideDown);
mIsVisible = true;
binding.skipOverlay.setSkipUiEnabled(!mIsVisible && !mGuideVisible && !mPopupPanelVisible);
}

public void hide() {
// Can't hide what's already hidden
if (!mIsVisible) return;

mIsVisible = false;
binding.topPanel.startAnimation(fadeOut);
binding.skipOverlay.setSkipUiEnabled(!mIsVisible && !mGuideVisible && !mPopupPanelVisible);
Expand Down Expand Up @@ -1211,7 +1209,7 @@ public void setSecondaryTime(long time) {

public void setFadingEnabled(boolean value) {
mFadeEnabled = value;
if (!mIsVisible) requireActivity().runOnUiThread(this::show);
// if (!mIsVisible) requireActivity().runOnUiThread(this::show);
if (mFadeEnabled) {
startFadeTimer();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,16 @@ public void initFromView(CustomPlaybackOverlayFragment customPlaybackOverlayFrag
public void showControlsOverlay(boolean runAnimation) {
if (shouldShowOverlay) {
super.showControlsOverlay(runAnimation);
playerAdapter.getMasterOverlayFragment().show();
}
}

@Override
public void hideControlsOverlay(boolean runAnimation) {
super.hideControlsOverlay(runAnimation);
playerAdapter.getMasterOverlayFragment().hide();
}

public void updateCurrentPosition() {
playerAdapter.updateCurrentPosition();
updatePlayState();
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/layout/vlc_player_interface.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@
android:layout_gravity="center_horizontal|top"
android:layout_marginHorizontal="40dp"
android:layout_marginTop="20dp"
android:clickable="false"
android:visibility="invisible">
android:clickable="false">

<org.jellyfin.androidtv.ui.AsyncImageView
android:id="@+id/item_logo"
Expand Down

0 comments on commit e7738c7

Please sign in to comment.