MOBILE-2886 scorm: Hide bottom bar when showing as a popup

main
Pau Ferrer Ocaña 2019-02-22 11:35:33 +01:00
parent d129c23d54
commit 05960512d6
3 changed files with 23 additions and 2 deletions

View File

@ -19,6 +19,7 @@ import { CoreSitesProvider } from '@providers/sites';
import { CoreSyncProvider } from '@providers/sync'; import { CoreSyncProvider } from '@providers/sync';
import { CoreDomUtilsProvider } from '@providers/utils/dom'; import { CoreDomUtilsProvider } from '@providers/utils/dom';
import { CoreTimeUtilsProvider } from '@providers/utils/time'; import { CoreTimeUtilsProvider } from '@providers/utils/time';
import { CoreIonTabsComponent } from '@components/ion-tabs/ion-tabs';
import { AddonModScormProvider, AddonModScormAttemptCountResult } from '../../providers/scorm'; import { AddonModScormProvider, AddonModScormAttemptCountResult } from '../../providers/scorm';
import { AddonModScormHelperProvider } from '../../providers/helper'; import { AddonModScormHelperProvider } from '../../providers/helper';
import { AddonModScormSyncProvider } from '../../providers/scorm-sync'; import { AddonModScormSyncProvider } from '../../providers/scorm-sync';
@ -68,7 +69,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy {
protected sitesProvider: CoreSitesProvider, protected syncProvider: CoreSyncProvider, protected sitesProvider: CoreSitesProvider, protected syncProvider: CoreSyncProvider,
protected domUtils: CoreDomUtilsProvider, protected timeUtils: CoreTimeUtilsProvider, protected domUtils: CoreDomUtilsProvider, protected timeUtils: CoreTimeUtilsProvider,
protected scormProvider: AddonModScormProvider, protected scormHelper: AddonModScormHelperProvider, protected scormProvider: AddonModScormProvider, protected scormHelper: AddonModScormHelperProvider,
protected scormSyncProvider: AddonModScormSyncProvider) { protected scormSyncProvider: AddonModScormSyncProvider, protected tabs: CoreIonTabsComponent) {
this.scorm = navParams.get('scorm') || {}; this.scorm = navParams.get('scorm') || {};
this.mode = navParams.get('mode') || AddonModScormProvider.MODENORMAL; this.mode = navParams.get('mode') || AddonModScormProvider.MODENORMAL;
@ -92,6 +93,8 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy {
this.showToc = this.scormProvider.displayTocInPlayer(this.scorm); this.showToc = this.scormProvider.displayTocInPlayer(this.scorm);
if (this.scorm.popup) { if (this.scorm.popup) {
this.tabs.changeVisibility(false);
// If we receive a value <= 100 we need to assume it's a percentage. // If we receive a value <= 100 we need to assume it's a percentage.
if (this.scorm.width <= 100) { if (this.scorm.width <= 100) {
this.scorm.width = this.scorm.width + '%'; this.scorm.width = this.scorm.width + '%';
@ -448,5 +451,6 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy {
// Unblock the SCORM so it can be synced. // Unblock the SCORM so it can be synced.
this.syncProvider.unblockOperation(AddonModScormProvider.COMPONENT, this.scorm.id, 'player'); this.syncProvider.unblockOperation(AddonModScormProvider.COMPONENT, this.scorm.id, 'player');
this.tabs.changeVisibility(true);
} }
} }

View File

@ -1,4 +1,4 @@
<div class="tabbar" role="tablist" #tabbar> <div class="tabbar" role="tablist" #tabbar [hidden]="hidden">
<a [hidden]="_loaded === false" *ngFor="let t of _tabs" [tab]="t" class="tab-button" role="tab" href="#" (ionSelect)="select(t)"></a> <a [hidden]="_loaded === false" *ngFor="let t of _tabs" [tab]="t" class="tab-button" role="tab" href="#" (ionSelect)="select(t)"></a>
<div class="tab-highlight"></div> <div class="tab-highlight"></div>
<div *ngIf="_loaded === false" class="core-ion-tabs-loading"> <div *ngIf="_loaded === false" class="core-ion-tabs-loading">

View File

@ -53,6 +53,7 @@ export class CoreIonTabsComponent extends Tabs implements OnDestroy {
@ViewChild('originalTabs') originalTabsRef: ElementRef; @ViewChild('originalTabs') originalTabsRef: ElementRef;
_loaded: boolean; // Whether tabs have been loaded. _loaded: boolean; // Whether tabs have been loaded.
hidden = false; // Whether to show/hide tabs.
/** /**
* List of tabs that haven't been initialized yet. This is required because IonTab calls add() on the constructor, * List of tabs that haven't been initialized yet. This is required because IonTab calls add() on the constructor,
@ -325,6 +326,22 @@ export class CoreIonTabsComponent extends Tabs implements OnDestroy {
} }
} }
/**
* Change tabs visibility to show/hide them from the view.
*
* @param {boolean} visible If show or hide the tabs.
*/
changeVisibility(visible: boolean): void {
if (this.hidden == visible) {
// Change needed.
this.hidden = !visible;
setTimeout(() => {
this.viewCtrl.getContent().resize();
});
}
}
/** /**
* Component destroyed. * Component destroyed.
*/ */