My GSoC Project includes implementing media wall in loklak search . One part of the issue is to include customization options in media wall. I looked around for most important features that can be implemented in a media wall to give the user a more appealing and personalized view. One of the feature that can be implemented is enabling Full Screen Mode. This feature can help the user to display media wall on the projector or any big display screen without compromising with space available. In one part, I would be explaining how I implemented Full screen Mode in loklak media wall using fullscreen.js library.
Secondly, it is important to include a very reactive and user-friendly setting box. The setting box should be a central container in which all the customization options will be included.In loklak media wall, setting box is implemented as a dialog box with various classifications in form of tabs. I would also be explaining how I designed customization menu using Angular Material.
Full Screen Mode
Since loklak search is an Angular 2 application and all the code is written in typescript, we can’t simply use the fullscreen.js library. We have to import the library into our application and create a directive that can be applied to the element to use it in the application.
- Install fullscreen.js library in the application using Node Package Manager.
- Creating an attribute directive which uses Hostlistener to listen to click on the element. It uses screenfull.toggle() function to call FullScreen JS API whenever user clicks on the element.
- Import Directive into the module and add it to declaration. This allows directive to be used anywhere in the template.
- Now, the directive is ready to use on the template. We just have to add this attribute directive to an element.
Customization Menu is created using the idea of central container for customization. It is created using two components of Angular Material – Dialog Box and Tabs . We will now be looking how customization menu is implemented using these two components.
- Create a component with the pre-configured position, height and width of the dialog box. This can be done simply using updatePosition and updateSize property of the MdDialogRef class.
- Create a template for the Customization menu. We will be using md-tab and md-dialog to create a dialog box with options displayed using tabs. dynamicHeight should be set to true so that dialog box adjust according to the tabs. We can simply add an attribute md-dialog-close to the button which will close the dialog box. All the content should be added in the div with attribute md-dialog-content linked to it. Moreover, to make options look more user-friendly and adjustable on smaller screens, icons must be added with the Tab title.
The code currently shows up code for search customization. It basically, records to the input using [(ngModel)] for two-way binding and makes the call the search action whenever user clicks on Display button.
- Add a button which would open dialog box using open property of MdDialog class. This property would provide an instance for MediaWallCustomizationComponent and the component will show up dynamically.
- It is important to add MediaWallCustomizationComponent as an entry component in the module so that AOT compiler can create a ComponentFactory for it during initialization.
This creates an appealing and user-friendly customization menu which acts a central container for customization options.
- Fullscreen JS library: https://github.com/sindresorhus/screenfull.js
- Angular Material: https://material.angular.io/components
- Angular Dialog Example: https://github.com/angular/material2/blob/master/src/demo-app/dialog/dialog-demo.ts
- Using md-dialog in Angular Application: https://stackoverflow.com/questions/34205593/working-example-of-angular-2-0-material-mddialog-with-angular-2-0