mirror of
https://github.com/chuot/rdio-scanner.git
synced 2026-08-15 17:33:01 -06:00
Better handling of backlight dimming (useDimmer=true)
This commit is contained in:
parent
3670f4bc0a
commit
b1871695fb
|
|
@ -216,7 +216,7 @@
|
||||||
<div *ngIf="config?.useLed" class="rdio-status" fxLayout="row" fxLayoutAlign="end">
|
<div *ngIf="config?.useLed" class="rdio-status" fxLayout="row" fxLayoutAlign="end">
|
||||||
<span class="rdio-led" [ngClass]="ledClass"></span>
|
<span class="rdio-led" [ngClass]="ledClass"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="rdio-display" [ngClass]="{ idle: config?.useDimmer && !dimmerDelay }" (dblclick)="toggleFullscreen()">
|
<div class="rdio-display" [ngClass]="{ idle: !config || (config?.useDimmer && !dimmerDelay) }" (dblclick)="toggleFullscreen()">
|
||||||
<div class="rdio-display-row margin" fxLayout="row" fxLayoutAlign="space-between">
|
<div class="rdio-display-row margin" fxLayout="row" fxLayoutAlign="space-between">
|
||||||
<div>
|
<div>
|
||||||
<span>
|
<span>
|
||||||
|
|
|
||||||
|
|
@ -150,6 +150,8 @@ export class AppRdioScannerComponent implements OnDestroy, OnInit {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.appRdioScannerService.avoid(options);
|
this.appRdioScannerService.avoid(options);
|
||||||
|
|
||||||
|
this.updateDimmer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -178,6 +180,8 @@ export class AppRdioScannerComponent implements OnDestroy, OnInit {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.appRdioScannerService.holdSystem();
|
this.appRdioScannerService.holdSystem();
|
||||||
|
|
||||||
|
this.updateDimmer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -187,6 +191,8 @@ export class AppRdioScannerComponent implements OnDestroy, OnInit {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.appRdioScannerService.holdTalkgroup();
|
this.appRdioScannerService.holdTalkgroup();
|
||||||
|
|
||||||
|
this.updateDimmer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -196,6 +202,8 @@ export class AppRdioScannerComponent implements OnDestroy, OnInit {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.appRdioScannerService.liveFeed();
|
this.appRdioScannerService.liveFeed();
|
||||||
|
|
||||||
|
this.updateDimmer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -359,6 +367,8 @@ export class AppRdioScannerComponent implements OnDestroy, OnInit {
|
||||||
|
|
||||||
if ('time' in event) {
|
if ('time' in event) {
|
||||||
this.callTime = event.time;
|
this.callTime = event.time;
|
||||||
|
|
||||||
|
this.updateDimmer();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.updateDisplay();
|
this.updateDisplay();
|
||||||
|
|
@ -395,6 +405,8 @@ export class AppRdioScannerComponent implements OnDestroy, OnInit {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.appRdioScannerService.pause();
|
this.appRdioScannerService.pause();
|
||||||
|
|
||||||
|
this.updateDimmer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -408,6 +420,8 @@ export class AppRdioScannerComponent implements OnDestroy, OnInit {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.appRdioScannerService.replay();
|
this.appRdioScannerService.replay();
|
||||||
|
|
||||||
|
this.updateDimmer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -492,6 +506,8 @@ export class AppRdioScannerComponent implements OnDestroy, OnInit {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.appRdioScannerService.skip(nodelay);
|
this.appRdioScannerService.skip(nodelay);
|
||||||
|
|
||||||
|
this.updateDimmer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -574,6 +590,22 @@ export class AppRdioScannerComponent implements OnDestroy, OnInit {
|
||||||
return call;
|
return call;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private updateDimmer(): void {
|
||||||
|
if (this.config?.useDimmer) {
|
||||||
|
if (this.dimmerDelay) {
|
||||||
|
clearTimeout(this.dimmerDelay);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.dimmerDelay = setTimeout(() => {
|
||||||
|
this.dimmerDelay = undefined;
|
||||||
|
|
||||||
|
this.ngChangeDetectorRef.detectChanges();
|
||||||
|
}, 4000);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.ngChangeDetectorRef.detectChanges();
|
||||||
|
}
|
||||||
|
|
||||||
private updateDisplay(time = this.callTime): void {
|
private updateDisplay(time = this.callTime): void {
|
||||||
if (this.call) {
|
if (this.call) {
|
||||||
this.callProgress = new Date(this.call.dateTime);
|
this.callProgress = new Date(this.call.dateTime);
|
||||||
|
|
@ -645,22 +677,6 @@ export class AppRdioScannerComponent implements OnDestroy, OnInit {
|
||||||
this.ledClass = `${this.ledClass} ${this.call.systemData.led}`;
|
this.ledClass = `${this.ledClass} ${this.call.systemData.led}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const setDimmer = () => {
|
|
||||||
if (this.config?.useDimmer) {
|
|
||||||
if (this.dimmerDelay) {
|
|
||||||
clearTimeout(this.dimmerDelay);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.dimmerDelay = setTimeout(() => {
|
|
||||||
this.dimmerDelay = undefined;
|
|
||||||
|
|
||||||
this.ngChangeDetectorRef.detectChanges();
|
|
||||||
}, 3000);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
setDimmer();
|
|
||||||
|
|
||||||
this.ngChangeDetectorRef.detectChanges();
|
this.ngChangeDetectorRef.detectChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue