Skip to content
Closed
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
15 changes: 15 additions & 0 deletions app/src/main/java/org/schabi/newpipe/player/ui/MainPlayerUi.java
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ protected void setupElementsVisibility() {
binding.metadataView.setVisibility(isFullscreen ? View.VISIBLE : View.GONE);
binding.titleTextView.setVisibility(isFullscreen ? View.VISIBLE : View.GONE);
binding.channelTextView.setVisibility(isFullscreen ? View.VISIBLE : View.GONE);
updateRightSpacerVisibility();
}

@Override
Expand Down Expand Up @@ -512,6 +513,19 @@ private void showHideKodiButton() {
&& KoreUtils.shouldShowPlayWithKodi(context, playQueue.getItem().getServiceId())
? View.VISIBLE : View.GONE);
}

private void updateRightSpacerVisibility() {
final boolean hasAudio = binding.audioTrackTextView.getVisibility() != View.GONE;
final boolean hasMeta = binding.metadataView.getVisibility() != View.GONE;
binding.rightSpacer.setVisibility(!hasAudio && !hasMeta
? View.VISIBLE : View.GONE);
}

@Override
protected void onTopBarContentChanged() {
updateRightSpacerVisibility();
}

//endregion


Expand Down Expand Up @@ -939,6 +953,7 @@ public void toggleFullscreen() {
binding.titleTextView.setVisibility(isFullscreen ? View.VISIBLE : View.GONE);
binding.channelTextView.setVisibility(isFullscreen ? View.VISIBLE : View.GONE);
binding.playerCloseButton.setVisibility(isFullscreen ? View.GONE : View.VISIBLE);
updateRightSpacerVisibility();
setupScreenRotationButton();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,8 @@ private void updateStreamRelatedViews() {
binding.audioTrackTextView.setVisibility(View.GONE);
binding.playbackSpeed.setVisibility(View.GONE);

onTopBarContentChanged();

binding.playbackEndTime.setVisibility(View.GONE);
binding.playbackLiveSync.setVisibility(View.GONE);

Expand Down Expand Up @@ -1135,6 +1137,7 @@ private void buildAudioTrackMenu() {
.ifPresent(s -> binding.audioTrackTextView.setText(
Localization.audioTrackName(context, s)));
binding.audioTrackTextView.setVisibility(View.VISIBLE);
onTopBarContentChanged();
audioTrackPopupMenu.setOnMenuItemClickListener(this);
audioTrackPopupMenu.setOnDismissListener(this);
}
Expand Down Expand Up @@ -1238,6 +1241,9 @@ private void buildCaptionMenu(@NonNull final List<String> availableLanguages) {

protected abstract void onPlaybackSpeedClicked();

protected void onTopBarContentChanged() {
}

private void onQualityClicked() {
qualityPopupMenu.show();
isSomePopupMenuVisible = true;
Expand Down
9 changes: 8 additions & 1 deletion app/src/main/res/layout/player.xml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_marginEnd="8dp"
android:layout_weight="1"
android:layout_weight="2"
android:background="?attr/selectableItemBackground"
android:gravity="center"
android:minWidth="0dp"
Expand All @@ -177,6 +177,13 @@
tools:visibility="visible"
tools:text="English (Original)" />

<View
android:id="@+id/rightSpacer"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"
android:visibility="gone"/>

<org.schabi.newpipe.views.NewPipeTextView
android:id="@+id/qualityTextView"
android:layout_width="wrap_content"
Expand Down