diff --git a/tools/winscope-ng/src/app/components/app.component.ts b/tools/winscope-ng/src/app/components/app.component.ts index 64436cc0f..80ce1827d 100644 --- a/tools/winscope-ng/src/app/components/app.component.ts +++ b/tools/winscope-ng/src/app/components/app.component.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { Component, Injector, Inject, ViewEncapsulation, Input } from "@angular/core"; +import {Component, Injector, Inject, ViewEncapsulation, Input, ChangeDetectorRef} from "@angular/core"; import { createCustomElement } from "@angular/elements"; import { MatSliderChange } from "@angular/material/slider"; import { TraceCoordinator } from "app/trace_coordinator"; @@ -36,7 +36,7 @@ import { ViewerScreenRecordingComponent } from "viewers/viewer_screen_recording/
Winscope
@@ -127,6 +127,7 @@ import { ViewerScreenRecordingComponent } from "viewers/viewer_screen_recording/ }) export class AppComponent { title = "winscope-ng"; + changeDetectorRef: ChangeDetectorRef; traceCoordinator: TraceCoordinator; states = ProxyState; store: PersistentStore = new PersistentStore(); @@ -137,8 +138,10 @@ export class AppComponent { @Input() dataLoaded = false; constructor( - @Inject(Injector) injector: Injector + @Inject(Injector) injector: Injector, + @Inject(ChangeDetectorRef) changeDetectorRef: ChangeDetectorRef ) { + this.changeDetectorRef = changeDetectorRef; this.traceCoordinator = new TraceCoordinator(); if (!customElements.get("viewer-input-method")) { @@ -183,10 +186,11 @@ export class AppComponent { this.notifyCurrentTimestamp(); } - public clearData() { + public onUploadNewClick() { this.dataLoaded = false; this.traceCoordinator.clearData(); proxyClient.adbData = []; + this.changeDetectorRef.detectChanges(); } public onDataLoadedChange(dataLoaded: boolean) { @@ -197,6 +201,7 @@ export class AppComponent { this.currentTimestampIndex = 0; this.notifyCurrentTimestamp(); this.dataLoaded = dataLoaded; + this.changeDetectorRef.detectChanges(); } }