Profile

Cover photo
Verified name
Ian Lake
Works at Google
Attended University of Southern California
Lives in Palo Alto, CA
4,689 followers|5,201,976 views
AboutPostsCollectionsPhotosVideos+1'sReviews

Stream

Ian Lake

Shared publicly  - 
 
Being able to pull colors out of your theme is so much easier than remembering what the correct styles were, particularly when many components can do this by default.
 
Use colorPrimary to colorize your App Bar
Pro-tip by +Ian Lake 

The app bar [1], or action bar, is an iconic part of many Android apps, providing a consistent place for navigation affordances and frequent, important actions. But it can also be a great opportunity to bring some personality to your app. An easy way to do that is by using your branding color as the background of the app bar.

In fact, AppCompat makes this very straightforward using a technique of providing a color palette [2] for your app. While introduced in the Material themes added in Android 5.0, AppCompat makes this technique available to all Android 2.1+ devices.

If you’re using a theme such as Theme.AppCompat, you’d only need to add a colorPrimary attribute:
<style name="AppTheme" parent="@style/Theme.AppCompat">
<item name="colorPrimary">@color/primary</item>
</style>

And your App Bar will automatically be colored appropriately. You’ll note we’re using just colorPrimary and not android:colorPrimary as android:colorPrimary only works on Android 5.0 devices unlike the AppCompat provided colorPrimary. Just make sure you’re using the right theme so that the text and icons have enough contrast:
- Theme.AppCompat -> dark activity, dark app bar
- Theme.AppCompat.Light -> light activity, light app bar
- Theme.AppCompat.Light.DarkActionBar -> light activity, dark action bar

But perhaps you’ve already moved over to Toolbars (perhaps wrapped in the Design Library’s AppBarLayout [3])? In those cases, you’re probably using a Theme.AppCompat.NoActionBar or Theme.AppCompat.Light.NoActionBar theme and including those elements in your layout XML files. Thankfully, you can still take advantage of your colorPrimary using the format ?attr/colorPrimary:
<android.support.v7.widget.Toolbar
android:background="?attr/colorPrimary" />

This ?attr/ format allows you to pull any attribute out of your theme, making it easy to consolidate your theming into a single place and avoid finding/replacing across many files.

The other thing we’ve lost is our text coloring though - there’s no Theme.AppCompat.Light.DarkActionBar.NoActionBar. Here’s where a ThemeOverlay can prove incredibly helpful. ThemeOverlays, unlike a full theme, only seek to overlay the current theme, changing the few things they need to. For example, if we had a light theme but wanted a dark Toolbar, we could use:
<android.support.v7.widget.Toolbar
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
With just that change, our text and icons are now back to a white color - perfect for a dark Toolbar.

You’ll find a number of other colors you can and should add to your theme such as colorPrimaryDark for changing the status bar on 5.0+ devices to a darker branding color and colorAccent for a contrasting accent color designed to make elements such as a FloatingActionButton really pop out. If you’d want to learn more about AppCompat, check out our video on Consistent Design with AppCompat [4].

For now, bring some personality to your app by using colorPrimary to color your App Bar or Toolbar!

#BuildBetterApps

[1] - http://goo.gl/Meu1sE
[2] - https://goo.gl/EHaUMj
[3] - https://goo.gl/Wo1IBv
[4] - https://goo.gl/O1iVPB
17 comments on original post
35
11
ryan cheng's profile photoJosé M. Rodríguez's profile photoPP BB's profile photoMarius Greve Hagen's profile photo
7 comments
 
+Ali Muzaffar - ah, well I wrote this about two weeks ago :) More information on a topic isn't a bad thing of course - it may pick up a very different audience and spread the correct way of doing things even farther!
Add a comment...

Ian Lake

Shared publicly  - 
 
Last 20 mile run before the SF Marathon!
Finished my last ridiculously long run before the SF marathon here in 3 weeks - 20 miles in just over 2 hours and 39 minutes! Definitely the best I've ever felt running 20 miles, completing the first 12 miles right on my target training pace of 7:59/mile and then kicking it up to 7:21/mile for the next 6 miles.

Given my marathon target of 3:20 or 7:38/mile and that in previous training I've generally been about a minute/mile slower vs my target pace, being able to run faster than that pace even in training and while tired is a really good sign that I might actually be able to hit my goal!

Even though I've done multiple marathons now, I still haven't completed one without having to stop due to cramping - last time I made it to mile 25 - maybe this time I'll make it the whole way!
35
1
Tuvizo Gear Official's profile photoIan Lake's profile photoJonny C's profile photoIvo Encarnação's profile photo
6 comments
Jonny C
 
Yup. Your right. Am working on half so i keep thinking that marathon is 13 mile. Nice work great time
Add a comment...

Ian Lake

Shared publicly  - 
 
I think this is a really fair article about Android Auto. You get the best Maps, best voice recognition, a (currently smaller) choice of music app, integration with a set of messaging apps, and Google Now cards. And that's it.

Personally, I like the small, very polished set of car specific things rather than a more chaotic approach, both from a safety and development experience. While the v1 functionality is basically a perfect match with how I use my phone in the car, I'm looking forward to seeing Auto grow!
 
Want to read more about using Android Auto? Click the link-thingy.
When Google announced Android Auto at Google I/O 2014, I was already sold. And by "sold," I mean I fully expected it to be something I'd want . And while I... by David Ruddock in Android Auto, Editorials, Other Reviews
4 comments on original post
33
3
Ian Lake's profile photoAlex M's profile photokiddo possible's profile photohln keel's profile photo
9 comments
 
+James Mason - I've done the car mounted phone for years, bluetooth paired to my car, for almost 4 years now and it is a pretty huge quality difference once you actually try it out.

Whether that is a huge positive difference (as it was for me) or negative (too restrictive/limited) is probably more of an individual thing, but I'd definitely try an Auto equipped car in person before passing judgement, even if it only when you are already shopping for a car (be it now or in a few years time).
Add a comment...

Ian Lake

Shared publicly  - 
 
A great introduction to Android M's new permission model. Make sure to watch the I/O talk for all the details: https://www.youtube.com/watch?v=f17qe9vZ8RM
 
I wrote a thing! #androiddev  

Picture this: you go to the grocery store to grab some items for dinner. At the entrance to the grocery store, you’re stopped by a security guard who asks you to hand over your keys, wallet, phone, Social Security number and personal contact information. “We just need to hang on to this stuff while you’re in the store, sir/ma’am. We’ll be careful with it, I promise. Enjoy your shopping trip.”
Even the most innocuous-seeming details can make a big difference in how users experience your app . Read more about permissions in Android Mobile.
5 comments on original post
35
12
Ankur Nigam's profile photoSalvador Gómez's profile photoryan cheng's profile photoAlexandre Koffi's profile photo
6 comments
 
+Wolfram Rittmeyer - The nice part about doing a Developer Preview is that the framework team has really taken feedback into account in a number of areas. I'd definitely leave some time to update your blog post after the next preview comes out or hold it until after Preview 2 has been made available.
Add a comment...

Ian Lake

Shared publicly  - 
 
Nice pro-tip from +Joanna Smith - you really don't want to have your app delay an important notification because the device falls back asleep.
 
Reliable message processing with WakefulBroadcastReceivers
Pro-tip by +Joanna Smith

A common pattern used to process an incoming broadcast is for your BroadcastReceiver to start a service, often times an IntentService, to process the message. But what if that processing never happened?

I ran into this when I was using Google Cloud Messaging to deliver severe weather alerts to affected devices in a weather app: the message would be received and yet the notification wouldn’t fire. Tracing the bug led me to the following scenario:

The device would be idle, just chilling, doing it’s thing on the tabletop, while the screen was off. Then I would send the weather message to the GCM servers, which would pass it along to my device. This causes the device CPU to wake up and trigger onReceive().

The onReceive() method would then get excited to be called up to do its job, and so it would call startService() to trigger my IntentService. But in that moment between onReceive() finishing its work and the IntentService beginning, the CPU was being super protective of my device battery and was going back to sleep. This didn’t happen every time, but only occasionally. And it left me sitting there, staring at my device and wondering where my alert was!

And this, my friends, is the exact reason we created the WakefulBroadcastReceiver [1], a BroadcastReceiver that automatically creates a partial wakelock. So in onReceive(), instead of calling startService(), now I call startWakefulService(), and the system will take care of acquiring and holding the wakelock for me while my IntentService does its job, preventing the device from falling back asleep. Then, when the service is finished, I call completeWakefulIntent() to let the system know that it can release the wakelock because I’m done building my notification.

So, you may be wondering why would anyone ever use a BroadcastReceiver if the super cool WakefulBroadcastReceiver exists. And honestly, it comes down to your use case. How critical is your response to a message? If you are expecting immediate action, like a severe weather notification so that your users are informed of potential danger, you want to depend on that wakelock. But if your response is only relevant while the user is active on their device, you don’t need to worry, and you can stick with the classic BroadcastReceiver.

For more information on receivers, you can check out Managing Device Awake State: https://goo.gl/hU5tiR

[1] - https://goo.gl/GIjGvH

#BuildBetterApps
9 comments on original post
17
9
Leonardo Santos's profile photoSrikanth Reddy's profile photo
Add a comment...

Ian Lake
moderator

Development Patterns  - 
 
Adding basic drag and swipe functionality to a RecyclerView is so much more straightforward with the addition of ItemTouchHelper - particularly compared to what you had to do before!
 
Drag and Swipe with RecyclerView

Just published an article about adding drag & drop and swipe-to-dismiss to RecyclerView without using a third-party library. It's a basic introduction to ItemTouchHelper and has a corresponding example project on Github:

https://github.com/iPaulPro/Android-ItemTouchHelper-Demo

#androiddev  
Part One: Basic ItemTouchHelper Example
12 comments on original post
23
7
Emrah Kahraman's profile photoSashi Kolli's profile photoBaltazar Arellano's profile photoСанек просто's profile photo
3 comments
Alex M
 
+Ian Lake​ Thanks Ian. Another Developer also confirmed this. I appreciate your kind information. I wonder how difficult it might be to convert Listview to RecyclerView? 
Add a comment...
In his circles
482 people
Have him in circles
4,689 people
Jason Howell (raygun01)'s profile photo
Miguel Aragues's profile photo
George Venios's profile photo
Tossa Darex's profile photo
Javier Wilis's profile photo
Achim Fischer's profile photo
Billy S's profile photo
Christopher “QuVe” Edge's profile photo
Michael Cole's profile photo

Ian Lake

Shared publicly  - 
 
I like how varied Chromebooks are getting - this time being able to flip over and run as a full touch experience. Really good to see all of the little improvements they've put into Chrome OS become an actually decent tablet setup! Shame about the proprietary charging cable though - USB Type-C cannot become a thing soon enough.

As always +JR Raphael's reviews are on point, real world, and extremely useful.
 
The Chromebook Flip is a neat little device with a lot of compelling qualities -- and a lot of bang for the buck. The thing you have to ask yourself is if a device like this makes sense for your needs.

My full real-world review of the convertible Chromebook Flip:
The Asus Chromebook Flip is surprisingly nice and immensely affordable, but a laptop this small isn't going to make sense for everyone.
12 comments on original post
16
Melina M's profile photo
 
I want to buy one of these for my mom, but I can't find any place that will let me pre-order yet!  I thought they were supposed to be available at the end of June, but clearly that didn't happen.
Add a comment...

Ian Lake
moderator

Development Patterns  - 
 
Being able to pull colors out of your theme is so much easier than remembering what the correct styles were.
 
Use colorPrimary to colorize your App Bar
Pro-tip by +Ian Lake 

The app bar [1], or action bar, is an iconic part of many Android apps, providing a consistent place for navigation affordances and frequent, important actions. But it can also be a great opportunity to bring some personality to your app. An easy way to do that is by using your branding color as the background of the app bar.

In fact, AppCompat makes this very straightforward using a technique of providing a color palette [2] for your app. While introduced in the Material themes added in Android 5.0, AppCompat makes this technique available to all Android 2.1+ devices.

If you’re using a theme such as Theme.AppCompat, you’d only need to add a colorPrimary attribute:
<style name="AppTheme" parent="@style/Theme.AppCompat">
<item name="colorPrimary">@color/primary</item>
</style>

And your App Bar will automatically be colored appropriately. You’ll note we’re using just colorPrimary and not android:colorPrimary as android:colorPrimary only works on Android 5.0 devices unlike the AppCompat provided colorPrimary. Just make sure you’re using the right theme so that the text and icons have enough contrast:
- Theme.AppCompat -> dark activity, dark app bar
- Theme.AppCompat.Light -> light activity, light app bar
- Theme.AppCompat.Light.DarkActionBar -> light activity, dark action bar

But perhaps you’ve already moved over to Toolbars (perhaps wrapped in the Design Library’s AppBarLayout [3])? In those cases, you’re probably using a Theme.AppCompat.NoActionBar or Theme.AppCompat.Light.NoActionBar theme and including those elements in your layout XML files. Thankfully, you can still take advantage of your colorPrimary using the format ?attr/colorPrimary:
<android.support.v7.widget.Toolbar
android:background="?attr/colorPrimary" />

This ?attr/ format allows you to pull any attribute out of your theme, making it easy to consolidate your theming into a single place and avoid finding/replacing across many files.

The other thing we’ve lost is our text coloring though - there’s no Theme.AppCompat.Light.DarkActionBar.NoActionBar. Here’s where a ThemeOverlay can prove incredibly helpful. ThemeOverlays, unlike a full theme, only seek to overlay the current theme, changing the few things they need to. For example, if we had a light theme but wanted a dark Toolbar, we could use:
<android.support.v7.widget.Toolbar
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
With just that change, our text and icons are now back to a white color - perfect for a dark Toolbar.

You’ll find a number of other colors you can and should add to your theme such as colorPrimaryDark for changing the status bar on 5.0+ devices to a darker branding color and colorAccent for a contrasting accent color designed to make elements such as a FloatingActionButton really pop out. If you’d want to learn more about AppCompat, check out our video on Consistent Design with AppCompat [4].

For now, bring some personality to your app by using colorPrimary to color your App Bar or Toolbar!

#BuildBetterApps

[1] - http://goo.gl/Meu1sE
[2] - https://goo.gl/EHaUMj
[3] - https://goo.gl/Wo1IBv
[4] - https://goo.gl/O1iVPB
17 comments on original post
15
2
Ian Lake's profile photoChandrasekhar Allam's profile photoJean Bernard Breu (jeanjean)'s profile photo
2 comments
 
Thanks +Chandrasekhar Allam - the link should be https://www.youtube.com/watch?v=5Be2mJzP-Uw - it has been fixed in the original post as well.
Add a comment...

Ian Lake

Shared publicly  - 
 
Learning systems and unintentional humor
Most learning systems, if not given the correct training and validation data sets, tend to over fit their training data. Training a computer only using the King James Bible, Structure and Interpretation of Computer Programs, and Why's Poignant Guide to Ruby leads to some wonderful quotes, collected nicely in this tumblr blog which made me laugh more than a few times.

For example: "Why does the method hang? Well, the while loop waits until all the processes have reached the end of the world; and the reapers are the angels."
Posts generated by a Markov chain trained on the King James Bible, Structure and Interpretation of...
12
4
Carlos Urrutia's profile photoMorgan Lake's profile photoRakeeb Rajbhandari's profile photoAlexandre Koffi's profile photo
 
Good God.
Add a comment...

Ian Lake

Shared publicly  - 
 
Long intervals today: two 5 mile intervals. While I was not feeling the best at the start (hence the unusually slow warm up pace), I just continued to push my way through and had just enough to make it through both intervals under my target pace of 7:30/mile.

Given my target pace for my marathon is 7:38/mile (a 3:20 marathon!), being able to run 10 miles at 15 seconds faster per mile while not feeling the best lends me some hope that I'll hit that goal. Just a few more weeks of training!

2 miles at 8:46/mile
5 miles at 7:23/mile
4 minutes recovery
5 miles at 7:24/mile
1 mile at 9:33/mile
10
Add a comment...

Ian Lake

Shared publicly  - 
 
First day biking to work!
Got a Novara Buzz [1] steel frame hybrid bike for Father's Day and it is definitely a nice, smooth ~15 minute ride to work. Definitely going to be doing this a few times a week.

[1] - http://www.rei.com/product/875010/novara-buzz-bike-2015#tab-specs
31
Jon F Hancock's profile photoIan Lake's profile photoHuyen Tue Dao's profile photo
3 comments
 
Novara love! Got mine last year with the REI member coupon as well. Good riding to ya. :)
Add a comment...

Ian Lake

Shared publicly  - 
 
+yiğit boyar is doing some awesome work on RecyclerView: really great that adding basic drag and swipe functionality is this straightforward (particularly compared to what you had to do before!). Looking forward to the rest of this series!
 
Drag and Swipe with RecyclerView

Just published an article about adding drag & drop and swipe-to-dismiss to RecyclerView without using a third-party library. It's a basic introduction to ItemTouchHelper and has a corresponding example project on Github:

https://github.com/iPaulPro/Android-ItemTouchHelper-Demo

#androiddev  
Part One: Basic ItemTouchHelper Example
12 comments on original post
36
17
Vinay Shenoy's profile photoDiego Vizcarra's profile photoAlexandra Ionașc's profile photow kevin's profile photo
 
Thank you for this. Its exactly what i'm looking for.
Add a comment...
Ian's Collections
People
In his circles
482 people
Have him in circles
4,689 people
Jason Howell (raygun01)'s profile photo
Miguel Aragues's profile photo
George Venios's profile photo
Tossa Darex's profile photo
Javier Wilis's profile photo
Achim Fischer's profile photo
Billy S's profile photo
Christopher “QuVe” Edge's profile photo
Michael Cole's profile photo
Work
Occupation
Android Developer Advocate
Employment
  • Google
    Android Developer Advocate, 2014 - present
  • Facebook, Inc.
    Android Software Engineer, 2013 - 2014
  • Phunware
    Senior Android Software Engineer, 2013 - 2013
  • Boeing
    IT Finance Software Developer, 2011 - 2013
  • Boeing
    IT Finance Project Manager, 2010 - 2011
  • Boeing
    IT Rotation Program Participant, 2008 - 2010
  • Lockheed Martin
    Software Development Summer Intern, 2005 - 2007
  • Golden Helix
    Software Development Intern, 2008 - 2008
  • RightNow Technologies
    Software QA Intern, 2007 - 2008
  • Montana State University ResLife
    Resident Advisor, 2005 - 2007
Places
Map of the places this user has livedMap of the places this user has livedMap of the places this user has lived
Currently
Palo Alto, CA
Previously
Irvine, CA - Orange, CA - Alexandria, VA - Huntington Beach, CA - Vancouver, WA - Aurora, CO - Bozeman, MT - Superior, MT - Gresham, OR - Charlotte, NC - Kenosha, WI - Park City, IL
Story
Tagline
Android Dev Advocate and Runner
Introduction
Android Developer Advocate at work, Android Developer at home, and Runner everywhere else.

By day, I work at Google as an Android Developer Advocate, serving as the technical bridge between the Android engineering team and the greater community.

By night, I am an Android developer, having published three applications to the Google Play Store and working on many more.

In between, I spend the majority of time running with my Vibram Five Fingers and completed my first marathon in 3 hours, 45 minutes in February 2013 and recently completed my second marathon in 3 hours and 30 minutes in October 2013.

I am also a huge fan of Guild Wars and Guild Wars 2 and play the later whenever I have the opportunity.

Note: the views expressed in my posts are mine alone, not necessarily those of my company.
Bragging rights
Completed Masters in Computer Science while working full time
Collections Ian is following
View all
Education
  • University of Southern California
    Masters in Computer Science, 2009 - 2011
  • Montana State University - Bozeman
    BS Computer Science, BS Physics, 2004 - 2008
  • Mount Hood Community College
    2004 - 2004
  • Sam Barlow High School
    2000 - 2004
Basic Information
Gender
Male
Looking for
Friends, Networking
Relationship
Married
Apps with Google+ Sign-in
  • RunKeeper
  • GYRO
  • Sunburn!
  • Star Wars™:KOTOR
  • allthecooks.com
Ian Lake's +1's are the things they like, agree with, or want to recommend.
Aladdin - Movies &amp; TV on Google Play
market.android.com

Soar away on a magic carpet ride of nonstop laughs and thrills in one of the most spectacular adventures of all time! Now meticulously resto

Slack – Android Apps on Google Play
market.android.com

All your team communication in one place, instantly searchable, available wherever you go. That's Slack.* Real time messaging, file sharing,

Clock – Android Apps on Google Play
market.android.com

Enjoy Google’s material design clock experience on your Android device. • Set alarms, add timers, and run a stopwatch • Add your favorite ci

Fotos – Apps para Android no Google Play
market.android.com

O Google Fotos é o local ideal para suas fotos e vídeos, organizado e pesquisável de acordo com as pessoas, os lugares e as coisas que impor

FORM Watch Face - Android Apps on Google Play
market.android.com

This is an Android Wear watch face based on the typeface used for FORM, Google's first design conference. For more on FORM, see google.com/d

Muzei HD Landscapes – Android Apps on Google Play
market.android.com

Muzei HD Landscapes is an extension for the Muzei live-wallpaper app.Key features: - New beautiful full HD landscape wallpapers every day -

Endymion - Books on Google Play
market.android.com

The multiple-award-winning science fiction master returns to the universe that is his greatest triumph--the world of Hyperion and The Fall o

Rise of Endymion - Books on Google Play
market.android.com

The magnificent conclusion to one of the greatest science fiction sagas of our time The time of reckoning has arrived. As a final genocidal

Pocket Casts - Android Apps on Google Play
market.android.com

We love podcasts, so we made a podcast player that is full featured, beautiful and simple to use. We love you, our customers, so we've kept

Google Handwriting Input – Apps para Android no Google Play
market.android.com

O Google Handwriting Input permite que você escreva à mão no seu smartphone ou tablet em 82 idiomas. Ele é compatível com caligrafia cursiva

The Fall of Hyperion - Books on Google Play
market.android.com

In the stunning continuation of the epic adventure begun in Hyperion, Simmons returns us to a far future resplendent with drama and inventio

Hyperion - Books on Google Play
market.android.com

On the world called Hyperion, beyond the law of the Hegemony of Man, there waits the creature called the Shrike. There are those who worship

Android Auto - Google Play Android 應用程式
market.android.com

Android Auto brings familiar apps and services to the screen in your dash, making it safer and easier to get the information you need while

Kiwanuka
market.android.com

Kiwanuka! Only you can save the people of the crystal realm! Guide the lost citizens to freedom. Discover forgotten dreams. Use the magical

How to Train Your Dragon 2
market.android.com

From the Academy Award® nominated film How to Train Your Dragon comes the next chapter in the epic trilogy. When Hiccup and Toothless discov

Nest
market.android.com

Connect to your Nest Learning Thermostat and Nest Protect smoke and carbon monoxide alarm from one place - the Nest app on your Android devi

Lilo &amp; Stitch 2: Stitch Has a Glitch
market.android.com

Your favorite characters return in this heartwarming comedy about bringing friends and family together even when they seem worlds apart. Bef

The view out onto the ocean was great, but you really have to be really dedicated to make it all the way up to this lookout and I was hoping for just a bit more.
Public - a year ago
reviewed a year ago
Takes quite a while to get there, but on a nice day the view is spectacular. Get there early to beat the tour buses!
Public - a year ago
reviewed a year ago
Food was good if a bit forgettable. Barely saw our server at all the entire meal.
Public - a year ago
reviewed a year ago
I come here often for lunch during the weekdays for their very good craft beer, good food (surprisingly delicious sandwiches and made to order individual pizzas), and friendly service to boot. I can't think of anything I would improve upon.
Food: ExcellentDecor: Very GoodService: Excellent
Public - 2 years ago
reviewed 2 years ago
77 reviews
Map
Map
Map
Beer and drinks were great, but the food was just okay - needs more flavor!
Public - a year ago
reviewed a year ago
Slow getting carryout together (almost 30 minutes compared to their estimate of 12-20), but the pizza is tasty enough
Public - a year ago
reviewed a year ago
Extremely friendly staff - hot, fresh food delivered right to our table and everything. Food was the normal Burger King fare.
Food: GoodDecor: Very GoodService: Excellent
Public - 2 years ago
reviewed 2 years ago