Mar GDG Meetup: #ServiceWorkers, Advanced #TextViews and ng-conf Recap
Posted on March 19th, 2015
03/18/2015 @Google, Chelsea Market, NY, 75 Ninth Ave, NY
Presentations on #TextView and #ServiceWorkers were supplemented by four shorter presentations.
Chiu-Ki Chen spoke about how Android TextView in the UI can be used to create a wide variety of exciting visual effects.
She first concentrated on how the contents of a TextView can create text shadows, glowing text, custom fonts, color gradients fonts and text pattern coloring
She next showed how spannable strings can be used to create strings of characters with variety of adjustments in font height, color, clickability etc. within a single TextView. A single TextView can therefore create the look and feel of tagged segments in an Html document.
As a final touch, Chiu-Ki showed how to create text on a lined page by combining text and graphics on a canvas. She also showed how emoji unicodes can be remapped to images which can be resized and positioned like characters.
- Responds to events
- Applies to all pages under a scope and persists when tabs are closed
- A cache is exposed to the service worker, so pages can be used off-line.
- Can modify CSS.
- For security reasons, it only runs on https locations
Programming. Service workers are based on Promises (a syntax which is an alternative to callbacks for asynchronous code.) In the code, an asynchronous process is called and returns immediately with a promise that will eventually be fulfilled. Once the promise is fulfilled, the code starts the next process. Debugging can be done in Chrome using the web page: chrome://serviceworker-internals
if (‘serviceWorker’ in navigator) …
so the Service Worker only runs when the browser can handle it.
Service worker should live at the root of your domain since it only has control over network requests that are within that part of the tree.
Things you can do. If you are offline and the video you requested is not available, it will return the previous video you downloaded. It can write a custom off-line page. It can trigger a push notification so long as Chrome is running, even if the page is not active. It can send notifications to a wearable watch.
In the shorter presentations
- Alex Qin – @CoalitionForQueens – www.c4q.nyc talked about their program to teach adults to code. They are looking for instructors.
- Elcin Erkin – updated the audience on the latest developments in AngularJS from the ng-conf 2015 in Salt Lake City Utah. The main discussion was about migrating to Angular 2.0. The upgrade will feature
- Better performance and design.
- New TypeScript created jointly by Microsoft and Angular
- Speed up using unidirectional bindings.
- Changes in syntax and semantics.
- A new router to better serve complex applications.
- The Angular team has taken over the Material Design component.
- Incorporate web components.
- Ray Tsang – In honor of pi day (3/14) he calculated pi to 100B digits in 5 ½ hours on a multicore processor.(I wonder what the distribution of digits looks like)
- Dario Laverde– showed how easy it is to create Wearable watch faces using Android Studio. In less than a minute he created a face without writing a single line of code.