Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync custom controls with built-in controls in leanback overlay #4118

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading