Merge pull request #898 from dmitrylyzo/fix_recording_icon

Fix icon doubling
This commit is contained in:
dkanada 2020-03-08 03:02:49 +09:00 committed by GitHub
commit 2a99df8365
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 7 deletions

View file

@ -98,15 +98,22 @@ define(['events', 'playbackManager', 'dom', 'browser', 'css!./iconosd', 'materia
} }
} }
function setIcon(iconElement, icon) {
iconElement.classList.remove('brightness_high');
iconElement.classList.remove('brightness_medium');
iconElement.classList.remove('brightness_low');
iconElement.classList.add(icon);
}
function updateElementsFromPlayer(brightness) { function updateElementsFromPlayer(brightness) {
if (iconElement) { if (iconElement) {
if (brightness >= 80) { if (brightness >= 80) {
iconElement.innerHTML = ''; setIcon(iconElement, 'brightness_high');
} else if (brightness >= 20) { } else if (brightness >= 20) {
iconElement.innerHTML = ''; setIcon(iconElement, 'brightness_medium');
} else { } else {
iconElement.innerHTML = ''; setIcon(iconElement, 'brightness_low');
} }
} }
if (progressElement) { if (progressElement) {

View file

@ -21,16 +21,25 @@ define(['globalize', 'connectionManager', 'require', 'loading', 'apphost', 'dom'
} }
} }
function setButtonIcon(button, icon) {
var inner = button.querySelector('i');
inner.classList.remove('fiber_smart_record');
inner.classList.remove('fiber_manual_record');
inner.classList.add(icon);
}
function RecordingButton(options) { function RecordingButton(options) {
this.options = options; this.options = options;
var button = options.button;
setButtonIcon(button, 'fiber_manual_record');
if (options.item) { if (options.item) {
this.refreshItem(options.item); this.refreshItem(options.item);
} else if (options.itemId && options.serverId) { } else if (options.itemId && options.serverId) {
this.refresh(options.itemId, options.serverId); this.refresh(options.itemId, options.serverId);
} }
var button = options.button;
button.querySelector('i').innerHTML = 'fiber_manual_record';
var clickFn = onRecordingButtonClick.bind(this); var clickFn = onRecordingButtonClick.bind(this);
this.clickFn = clickFn; this.clickFn = clickFn;
@ -80,7 +89,7 @@ define(['globalize', 'connectionManager', 'require', 'loading', 'apphost', 'dom'
var options = this.options; var options = this.options;
var button = options.button; var button = options.button;
this.item = item; this.item = item;
button.querySelector('i').innerHTML = getIndicatorIcon(item); setButtonIcon(button, getIndicatorIcon(item));
if (item.TimerId && (item.Status || 'Cancelled') !== 'Cancelled') { if (item.TimerId && (item.Status || 'Cancelled') !== 'Cancelled') {
button.classList.add('recordingIcon-active'); button.classList.add('recordingIcon-active');

View file

@ -157,6 +157,12 @@ define(["globalize", "listView", "layoutManager", "userSettings", "focusManager"
return query; return query;
} }
function setSortButtonIcon(btnSortIcon, icon) {
btnSortIcon.classList.remove("arrow_downward");
btnSortIcon.classList.remove("arrow_upward");
btnSortIcon.classList.add(icon);
}
function updateSortText(instance) { function updateSortText(instance) {
var btnSortText = instance.btnSortText; var btnSortText = instance.btnSortText;
@ -175,7 +181,7 @@ define(["globalize", "listView", "layoutManager", "userSettings", "focusManager"
var btnSortIcon = instance.btnSortIcon; var btnSortIcon = instance.btnSortIcon;
if (btnSortIcon) { if (btnSortIcon) {
btnSortIcon.innerHTML = "Descending" === values.sortOrder ? "" : ""; setSortButtonIcon(btnSortIcon, "Descending" === values.sortOrder ? "arrow_downward" : "arrow_upward");
} }
} }
} }