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

Add menu captions to the TV UI #459

Open
wants to merge 29 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
70d45f8
Add menu captions to the TV UI
kishorens Jun 28, 2022
ed0bb81
fix the merge conflicts
kishorens Jun 28, 2022
a6ac6a1
Update src/ts/components/settingstogglebutton.ts
kishorens Jul 8, 2022
861cb28
Update src/ts/components/menucaption.ts
kishorens Jul 8, 2022
3c04fad
Update src/ts/uifactory.ts
kishorens Jul 8, 2022
098a82d
Update src/ts/uifactory.ts
kishorens Jul 8, 2022
299dbb0
Merge branch 'develop' into feature/SOL_3687
dweinber Jun 28, 2024
f1f9688
Rename MenuCaption component (camel-case)
dweinber Jun 28, 2024
9c1f3b6
Export component
dweinber Jun 28, 2024
13a84d6
Change positioning of the MenuCaption components in the TV UI
dweinber Jun 28, 2024
a05a2e5
Change MenuCaption to show when the button is focused, e.g. it is hov…
dweinber Jun 28, 2024
7f5c3da
Use the UI's standard Label component instead of the new menuCaption …
dweinber Jun 28, 2024
01cf093
Remove menuCaption component as it's not needed
dweinber Jun 28, 2024
2c57d86
Fix lint-sass warnings in TV UI SCSS
dweinber Jul 1, 2024
90857e5
Merge branch 'develop' into feature/SOL_3687
dweinber Jul 1, 2024
cea5b6c
Fix tslint errors
dweinber Jul 1, 2024
9f277e7
Add changelog entry
dweinber Jul 1, 2024
10a6ba0
Remove menuLabel code from settingstogglebutton
dweinber Jul 10, 2024
44ae9ce
Use the Label component instead of creating a label/span HTML element…
dweinber Jul 10, 2024
cb3c3c4
Add a new option for all buttons to show the associated label(/span) …
dweinber Jul 10, 2024
363c53b
Use different offsets from the button depending on whether the button…
dweinber Jul 10, 2024
7e80e27
Merge branch 'develop' into feature/SOL_3687
dweinber Jul 10, 2024
604c91f
Add documentation for new config option
dweinber Jul 10, 2024
eb04be3
Use component's setText method
dweinber Jul 10, 2024
99ff56a
Initialize and release the super class as well
dweinber Jul 10, 2024
f5b814c
Mock the textLabel property
dweinber Jul 10, 2024
67482e0
Move label creation to the toDomElement method to be inline with othe…
dweinber Jul 10, 2024
5efe823
Remove outdated CSS class
dweinber Jul 10, 2024
f185b58
Satisfy the linter
dweinber Jul 10, 2024
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
2 changes: 1 addition & 1 deletion src/scss/skin-modern/_skin-tv.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}
}

.#{$prefix}-ui-titlebar-top {
.#{$prefix}-ui-titlebar-top,.#{$prefix}-ui-menucaption {
margin-bottom: $medium-size;

> .#{$prefix}-container-wrapper {
Expand Down
26 changes: 26 additions & 0 deletions src/ts/components/menucaption.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import {Label, LabelConfig} from './label';
import {UIInstanceManager} from '../uimanager';
kishorens marked this conversation as resolved.
Show resolved Hide resolved
import { PlayerAPI } from 'bitmovin-player';

/**
* A label that displays a caption about the menu.
*/
export class Menucaption extends Label<LabelConfig> {

constructor(config: LabelConfig = {}) {
super(config);
this.config = this.mergeConfig(config, {
hidden: true,
}, this.config);
}

configure(player: PlayerAPI, uimanager: UIInstanceManager): void {
super.configure(player, uimanager);
let config = this.getConfig();
let text = config.text;

this.onShow.subscribe(() => {
this.setText(text);
});
}
}
10 changes: 10 additions & 0 deletions src/ts/components/settingstogglebutton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {Component, ComponentConfig} from './component';
import {ArrayUtils} from '../arrayutils';
import { PlayerAPI } from 'bitmovin-player';
import { i18n } from '../localization/i18n';
import {Menucaption} from './menucaption';
kishorens marked this conversation as resolved.
Show resolved Hide resolved

/**
* Configuration interface for the {@link SettingsToggleButton}.
Expand All @@ -20,6 +21,11 @@ export interface SettingsToggleButtonConfig extends ToggleButtonConfig {
* Default: true
*/
autoHideWhenNoActiveSettings?: boolean;

/**
* The Menu caption component whose visibility the button should toggle.
*/
menuCaption?: Menucaption;
}

/**
Expand All @@ -40,6 +46,7 @@ export class SettingsToggleButton extends ToggleButton<SettingsToggleButtonConfi
cssClass: 'ui-settingstogglebutton',
text: i18n.getLocalizer('settings'),
settingsPanel: null,
menuCaption: null,
autoHideWhenNoActiveSettings: true,
role: 'pop-up button',
}, <SettingsToggleButtonConfig>this.config);
Expand All @@ -61,6 +68,7 @@ export class SettingsToggleButton extends ToggleButton<SettingsToggleButtonConfi

let config = this.getConfig();
let settingsPanel = config.settingsPanel;
let menuCaption = config.menuCaption;

this.onClick.subscribe(() => {
// only hide other `SettingsPanel`s if a new one will be opened
Expand All @@ -75,10 +83,12 @@ export class SettingsToggleButton extends ToggleButton<SettingsToggleButtonConfi
settingsPanel.onShow.subscribe(() => {
// Set toggle status to on when the settings panel shows
this.on();
if (menuCaption) menuCaption.show();
});
settingsPanel.onHide.subscribe(() => {
// Set toggle status to off when the settings panel hides
this.off();
if (menuCaption) menuCaption.hide();
});

// Ensure that only one `SettingPanel` is visible at once
Expand Down
14 changes: 13 additions & 1 deletion src/ts/uifactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { PlayerAPI } from 'bitmovin-player';
import { i18n } from './localization/i18n';
import { SubtitleListBox } from './components/subtitlelistbox';
import { AudioTrackListBox } from './main';
import {Menucaption} from './components/menucaption';
kishorens marked this conversation as resolved.
Show resolved Hide resolved

export namespace UIFactory {

Expand Down Expand Up @@ -415,6 +416,8 @@ export namespace UIFactory {
}

export function modernTvUI() {
const subtitleMenuCaption = new Menucaption({text: i18n.getLocalizer('settings.subtitles')});
const audioMenuCaption = new Menucaption({text: i18n.getLocalizer('settings.audio.track')});
const subtitleListPanel = new SettingsPanel({
components: [
new SettingsPanelPage({
Expand Down Expand Up @@ -456,17 +459,26 @@ export namespace UIFactory {
}),
new TitleBar({
components: [
new Container({
components: [
subtitleMenuCaption,
audioMenuCaption,
],
cssClasses: ['ui-menucaption'],
}),
new Container({
components: [
new MetadataLabel({ content: MetadataLabelContent.Title }),
new SettingsToggleButton({
new SettingsToggleButton({
kishorens marked this conversation as resolved.
Show resolved Hide resolved
settingsPanel: subtitleListPanel,
menuCaption : subtitleMenuCaption,
autoHideWhenNoActiveSettings: true,
cssClass: 'ui-subtitlesettingstogglebutton',
text: i18n.getLocalizer('settings.subtitles'),
}),
new SettingsToggleButton({
settingsPanel: audioTrackListPanel,
menuCaption : audioMenuCaption,
autoHideWhenNoActiveSettings: true,
cssClass: 'ui-audiotracksettingstogglebutton',
ariaLabel: i18n.getLocalizer('settings.audio.track'),
Expand Down