[go: nahoru, domu]

Skip to content

Commit

Permalink
Fix display settings window UI bug for foldable devices.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 481215581
  • Loading branch information
Googler authored and marcbaechinger committed Oct 20, 2022
1 parent 871a5e6 commit 6cdaf2c
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1298,7 +1298,7 @@ private void updateSettingsWindowSize() {
settingsWindow.setHeight(height);
}

private void displaySettingsWindow(RecyclerView.Adapter<?> adapter) {
private void displaySettingsWindow(RecyclerView.Adapter<?> adapter, View anchorView) {
settingsView.setAdapter(adapter);

updateSettingsWindowSize();
Expand All @@ -1310,7 +1310,7 @@ private void displaySettingsWindow(RecyclerView.Adapter<?> adapter) {
int xoff = getWidth() - settingsWindow.getWidth() - settingsWindowMargin;
int yoff = -settingsWindow.getHeight() - settingsWindowMargin;

settingsWindow.showAsDropDown(this, xoff, yoff);
settingsWindow.showAsDropDown(anchorView, xoff, yoff);
}

private void setPlaybackSpeed(float speed) {
Expand Down Expand Up @@ -1392,9 +1392,9 @@ private void updateFullScreenButtonForState(

private void onSettingViewClicked(int position) {
if (position == SETTINGS_PLAYBACK_SPEED_POSITION) {
displaySettingsWindow(playbackSpeedAdapter);
displaySettingsWindow(playbackSpeedAdapter, checkNotNull(settingsButton));
} else if (position == SETTINGS_AUDIO_TRACK_SELECTION_POSITION) {
displaySettingsWindow(audioTrackSelectionAdapter);
displaySettingsWindow(audioTrackSelectionAdapter, checkNotNull(settingsButton));
} else {
settingsWindow.dismiss();
}
Expand Down Expand Up @@ -1688,16 +1688,16 @@ public void onClick(View view) {
player.setShuffleModeEnabled(!player.getShuffleModeEnabled());
} else if (settingsButton == view) {
controlViewLayoutManager.removeHideCallbacks();
displaySettingsWindow(settingsAdapter);
displaySettingsWindow(settingsAdapter, settingsButton);
} else if (playbackSpeedButton == view) {
controlViewLayoutManager.removeHideCallbacks();
displaySettingsWindow(playbackSpeedAdapter);
displaySettingsWindow(playbackSpeedAdapter, playbackSpeedButton);
} else if (audioTrackButton == view) {
controlViewLayoutManager.removeHideCallbacks();
displaySettingsWindow(audioTrackSelectionAdapter);
displaySettingsWindow(audioTrackSelectionAdapter, audioTrackButton);
} else if (subtitleButton == view) {
controlViewLayoutManager.removeHideCallbacks();
displaySettingsWindow(textTrackSelectionAdapter);
displaySettingsWindow(textTrackSelectionAdapter, subtitleButton);
}
}
}
Expand Down

0 comments on commit 6cdaf2c

Please sign in to comment.