Profile

Cover photo
Mobilevangelist
89 followers|7,839 views
AboutPostsPhotosVideos

Stream

Mobilevangelist

Shared publicly  - 
 
Brilliant way to dynamically color your assets to save app space and code complexity.  Nice work +Thomas Devaux.

h/t +Taylor Ling 
 
Android App Tricks: Runtime asset coloring

Soon after I released URL Shortener [0], few people asked me how I implemented certain features in the app. Following +Cyril Mottier's initiative when Capitaine Train [1] was launched, I thought it would be a good idea to humbly contribute to the Android community by sharing some tricks and things I've learned along the way.

Shortening URLs is a boring task. When I started working on URL Shortener, I scratched my head to make the experience visually more appealing. One thing was getting a thumbnail for every URL.

Still, the early version of the Analytics page wasn't great, showing lists of textual stats. My original idea was to match http://goo.gl as much as possible, so I started using charts with the same color palette for the top entries: blue, green, orange, yellow, purple.

I then tried adding icons for top Browsers and Referrers, but quickly realized 5 flavors of each icon would become a pain for multiple reasons:
Code complexity and robustness. That'd have required a bunch of ugly switches trying to find the correct drawable with the correct color. Another solution would have been to generate the resource name at runtime, but that's risky.
App size. It would mean a lot of drawables, x3 for H/X/XXHPI. 
Hard to maintain. What if I want to change one color? Dozens of assets to regenerate.

The "Browsers" card layout is very simple. The chart itself (lighter bars and thin lines) is a custom view, but the left part only contains regular views. Each row is made of:
• An ImageView for the icon background (legend_icon_background) which simulates padding around the real icon.
• An ImageView for the icon (legend_icon), the browser icon itself.
• A TextView with the click count (clicks). It uses an arrow shaped 9-patch that will stretch nicely with text. Because these guys are all in a TableRow, click counts will align vertically.

<?xml version="1.0" encoding="utf-8"?>
<TableRow xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:gravity="center_vertical" >

  <FrameLayout
    android:layout_width="wrap_content"
    android:layout_height="40dp" >

    <TextView
      android:id="@id/clicks"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="center_vertical"
      android:layout_marginLeft="24dp"
      android:gravity="center_vertical|right"
      android:paddingLeft="15dp"
      android:paddingRight="15dp" />

    <RelativeLayout
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="center_vertical" >

      <ImageView
        android:id="@id/legend_icon_background"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true" />

      <ImageView
        android:id="@id/legend_icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true" />
    </RelativeLayout>
  </FrameLayout>

</TableRow>

The trick is to use a white icon for the  legend_icon ImageView and color it at runtime.

First easy step is to determine the drawable resource IDs and color for a given row (Top 1: blue, Top 2: green, etc.). Then, the white drawable is colored with a LightingColorFilter [2]. As documentation states, LightingColorFilter "multiplies the RGB channels by one color, and then adds a second color". If the source drawable is pure white, multiplying by the target color and adding zero will give you a drawable with the exact color you passed!

Drawable coloredDrawable = Utils.getColoredDrawable(browserIcon.getContext(), R.drawable.ic_browser_chrome, SOME_COLOR);
browserIcon.setImageDrawable(coloredDrawable);

...

public static Drawable getColoredDrawable(Context context, int whiteDrawableResId, int targetColor) {
  Drawable drawable = context.getResources().getDrawable(whiteDrawableResId);
  ColorFilter filter = new LightingColorFilter(targetColor, 0);
  drawable.mutate().setColorFilter(filter);
  return drawable;
}

Same is done to the TextView 9-patch background - it's colored and set at runtime. Another benefit: white PNGs are very small in size when they get crunched.

#android #AndroidAppTricks  

[0] https://play.google.com/store/apps/details?id=com.tdevaux.googleurlshortener
[1] https://play.google.com/store/apps/details?id=com.capitainetrain.android
[2] http://developer.android.com/reference/android/graphics/LightingColorFilter.html
1
Add a comment...

Mobilevangelist

Shared publicly  - 
 
Candidate for Congress, +John Campbell, is using +Google Glass on the campaign trail.  It will be interesting seeing a political campaign from the candidate's point of view.

Follow the campaign on Google+ at +CandidCampbell.
1
Add a comment...

Mobilevangelist

Shared publicly  - 
 
Woot!  Looking forward to this update!
 
#GlassUpdates are back with KitKat for Glass, photo bundles & more  

You’ve been asking us when the next round of updates were coming. Well, they’re coming later this week! We know it’s been a little while, but this is a big one and we think it’s well worth the wait. Here’s what you’ll find in the new release:

KitKat for Glass – Our most exciting update is subtle, but big. We’ve been working on a significant upgrade to a new version of the Glass software. It’s not a change you can see, but it brings improved battery life and makes Glass more reliable and easier to update in the future. And now that Glass runs Android KitKat, developers can write Glassware using the latest Android SDK goodness, along with new features from our GDK.

Photo bundles – This one has been a long-standing request from our Explorers: now when you scroll through your timeline, your photos, videos and vignettes from each day will be organized in bundles so that you can swipe less and see more.

Photo replies in Hangouts – Photo sharing has been really popular amongst our Explorers, so we’ve added new ways to send photos in Hangout messages. The next time someone asks “what’s up,” tap “Reply” and then take a photo to show them. (If you already took the perfect photo, you can still tap to “Send” it in a Hangout message.)

Sending feedback – We always want to hear feedback from you on ways we can make Glass better so we’re making it even easier. Tap on the device info card in Settings and tell us what’s on your mind. If you need help, you can still send us an email, call us, or post in the Explorers Community.

Voice command sorting – With new features and Glassware, your voice command menu has grown pretty long. When you tap or say “ok glass,” voice commands are now sorted by recency and frequency, making it easier to see the commands you use most often and faster to access them from the touch menu. 

Video calls – We hold ourselves to high standards for the features that we build, and video calls aren’t living up to these standards. Explorers have told us so directly, and fewer than 10% of them use video calls. For this reason, we’ve made the hard decision to remove video calls from Glass until the experience is better. We don’t know when that will be, but in the meantime, keep an eye on MyGlass as more Glassware is built and released – we’re already seeing the developer community work on other video streaming services. We’ve always said that feedback from Explorers shapes Glass, and this is no exception.

…and more – This is a massive update and we couldn’t fit all the changes into this post, so watch the Glass Journal in the Explorers Community to see the rest.
1
Add a comment...

Mobilevangelist

Shared publicly  - 
 
This is a great idea and interesting use case for Glass.  Independents don't traditionally do well in elections, but I look forward to the videos from the campaign trail.  It will give a whole new perspective to political campaigns.  

I look forward to following Mr. Campbell throughout his race.
 
I used Google Glass to announce my run for Congress on http://candidcampbell.com/ It was the second time I used it and I love it! Would like to hear suggestions of how I can increase transparency with them.  #throughglass   #nonpartisan   #transparent   #congress  
1
CandidCampbell's profile photo
 
Thanks. We are going to try and give a variety of perspectives from political conversations to life in our district. Feedback is welcome!
Add a comment...

Mobilevangelist

Shared publicly  - 
 
Now here is an idea that really takes advantage of the immediate notification features of Glass.  This could also work on a phone, but that would take you out of the game.  This really enhances the experience.
 
In the last year we've seen our Explorers use Glass in really inspiring and practical day-to-day ways. Something we've also noticed and are very excited about is how Explorers are using Glass to drive their businesses forward. A number of companies have already teamed up with enterprise software developers to create new ways to serve their customers and reach their business goals.

The Washington Capitals and Schlumberger are just two of the companies that are at the forefront of exploring new possibilities with Glass. The Washington Capitals partnered with APX Labs to create a fan experience where real time stats, instant replay and different camera angles are all brought directly to Capitals fans via Glass. Schlumberger, the world’s largest oilfield services company, partnered with Wearable Intelligence and is using Glass to increase safety and efficiency for their employees in the field. 

This is only the beginning of what’s possible for Glass and business. If you’re a developer who is creating software for U.S. based enterprises, we’d love your help in building the future of Glass at Work. Get in touch with us here:
https://developers.google.com/glass/distribute/glass-at-work
1
Add a comment...

Mobilevangelist

Shared publicly  - 
 
GDK Hello World

A basic GDK app that activates via voice command after "Ok, Glass," shows some text on the screen, and reads the text to you.

Feel free to use this project as a basis for your own GDK Glassware.

Disclaimer: This is not approved or sanctioned by Google.

#gdk   #helloworld  
Contribute to google-glass-hello-world development by creating an account on GitHub.
2
Add a comment...
Have them in circles
89 people
Mark Anderson's profile photo
Mike Kruzel's profile photo
Cooper Engineering's profile photo
Geza Frey's profile photo
PAC.IPNU-IPPNU Mejobo's profile photo
Karen Duchemin's profile photo
Mark Silverberg's profile photo
Scott Lawrence Lawson's profile photo
Jim Stewart's profile photo

Mobilevangelist

Shared publicly  - 
 
How to update Android Studio to use the GDK Preview released last week.
1
Add a comment...

Mobilevangelist

Shared publicly  - 
 
Wowzers!
 
Today we just launched the Google Camera and boosted #photosphere  to an amazing 50 megapixels! I've been blown away by the image quality and want to go re-shoot all the old locations I've gone. You're going to LOVE this.

If you have an Android device with KitKat, install it now: https://play.google.com/store/apps/details?id=com.google.android.GoogleCamera

Check out some high res photo spheres on my Views profile:
https://www.google.com/maps/views/profile/117971837164857644538?gl=us
1
Add a comment...

Mobilevangelist

Shared publicly  - 
 
Open letter to #Apple expressing my frustration with their #iTunesAppStore process.
1
Add a comment...

Mobilevangelist

Shared publicly  - 
 
Awesome.  This is exactly the kind of thing Glass should be used for.  It will revolutionize patient care.
1
Add a comment...

Mobilevangelist

Shared publicly  - 
 
Wow.  That was fast.
 
Working Project Ara prototype to be ready this month

Post by +Robert Triggs 
The first working Project Ara prototype is expected to show up this month, hopefully just in time for the first Project Ara developer conference.
1
Add a comment...

Mobilevangelist

Shared publicly  - 
 
Announcing the GDK Kitchen Sink

It is a collection of code that shows how to implement Glass features within the GDK.  It includes menus, voice input, text to speech, d-pad input, gesture input, camera preview and picture capture, accelerometer access, and GPS services.  Timeline insert of a static card and LiveCard examples also included.

Comments and requests for additional feature examples welcome.

Disclaimer: this is not approved or sanctioned by Google.

#gdk  
google-glass-kitchen-sink - Code examples for GDK development
1
1
Norton Lam's profile photo
Add a comment...
People
Have them in circles
89 people
Mark Anderson's profile photo
Mike Kruzel's profile photo
Cooper Engineering's profile photo
Geza Frey's profile photo
PAC.IPNU-IPPNU Mejobo's profile photo
Karen Duchemin's profile photo
Mark Silverberg's profile photo
Scott Lawrence Lawson's profile photo
Jim Stewart's profile photo
Contact Information
Contact info
Email
Story
Tagline
Android enthusiast, Apple admirer, mobile evangelist, Glass Explorer.
Introduction
Passionate about mobile technologies.  Love Google, appreciate Apple, monitoring Microsoft.