Sunday, May 31, 2015

Google I/O 2015

Lines, Lines, Lines

Just got back from Google I/O, and as always, there was so much happening that I constantly felt that I was missing something awesome. This year the lines were particularly bad though. Not only there were long lines for the keynote, but most of the sessions filled up very very quickly, big or small.

Big room for What's New in Android? Full.

Small sandbox for Espresso? 4 walls of people all around. The sandbox talks were run twice, so for the second run I sat through the previous talk just to make sure I had a seat. It was ridiculous.

Sketchnotes

For the talks I managed to get in, I took sketchnotes.

Keynote

See the background of the photo? It was a chair in the playground area, which looked like a circular accordion made from cardboard. I loved it.

What's new in Android Developer Tools

I stood in line 20 minutes early to make sure I get into What's new in Android Developer Tools. I was taking notes furiously, but there was no way I could keep up with Tor demoing at machine gun speed. Gotta download Android Studio 1.3, pause the video as each new feature is mentioned, and try it out:

Building Fitness Apps on Wear

I just made an Android Wear watch face, Fit Cat, that integrates with Google Fit so the cat gets fitter as you walk more. I had some trouble with the Google API Client, and it was super useful to talk to the engineers on the team.

ATAP

This was an amazing presentation. Really creative technology!

Espresso

I have been writing many blog posts on Espresso, and really wanted to meet the team. To make sure I did not repeat my mistake of not getting a space at the first run of the sandbox talk, I got to the second run super early. Like, a session early. Result? Front row seat (actually, bean bag), and a great conversation with Valera. Yay!

I want more!

I really enjoyed the sessions I went to, but I missed so many. I would love to see Colt live, but alas, so did many others, and I didn't manage to even get close to the sandbox.

The open playground area was really fun, but I am ready to sacrifice it if that translates into more room for talks and thus, more chance to see our awesome Google presenters in real life.

Further reading

Thursday, May 21, 2015

Public speaking and leadership

When I was looking to advance my career a few years ago, I was told I need to demonstrate leadership. I had no idea what that means. Do I go look for some underlings so I can lead them? How does one become a leader?

Surprisingly, I found my answer in public speaking.

When I became independent, I decided to be more visible by sharing my knowledge on stage. I applied to many CFPs, and get accepted to quite a few conferences. However, without a corporate budget, getting to the event is often a challenge. I really appreciate conferences that state upfront that they are covering travel expenses, but most don’t.

Since I really wanted to speak, I forced myself to ask for help. I explain my situation to the conference organizers, and they often have a limited budget to help those who ask. I have also approached individual companies for sponsorship, and surprised myself when they said yes.

That is when I realized what leadership means: To make things happen.

Public speaking pushed me to be creative and look for a solution when there is none on the surface. While I am no longer seeking that elusive promotion in a corporation environment, I am applying this skill everywhere. “Make things happen” has become my motto, enriching my life and those around me.

This is leadership.

Monday, May 18, 2015

Fancy titles considered harmful

Do you agonize over your title when you write a talk proposal? I know I do. I want something catchy and clever, I want the organizers to like it, and I want the attendees to come.

I have come to realize that obvious titles are often the best. I gave a talk at OSCON called Bust the Android Fragmentation Myth. Catchy isn't it? I was so proud of myself, coming up with that title.

However, after I gave the talk, an attendee came up to me and said, "I am so glad I came. I have always wanted to learn how to write apps that works for both phones and tablets, and I would have never guessed from the title that you would be covering that in this talk."

That made me wonder: How many people went to other talks because they couldn't tell the content of my talk from the title? A lot of people just glance at the conference schedule, and if the title is not obvious, they probably won't bother looking at the description. Besides, it's not easy to come up with clever titles, so nowadays I just stick with descriptive ones:

Yup, my talk will just be "Advanced Espresso", no clever coffee puns or anything :)

Monday, May 11, 2015

Non-breaking space

You just finished implementing the UI and sent the screenshot to your designer for review. This is the feedback: "Can we make sure we don't have a dangling last word? Like what I photoshopped in the second box?"

You scratched your head and thought, how do I do that? And then you remember your best friend from HTML:  . Futhermore, you remember a post from a while ago:

  stands for non-breaking space, and you can insert that into your Android XML by \u00A0 or  . I prefer   because Android Studio highlights it with blue:

This way Android will make sure the last two words are always on the same line.

Source code

https://github.com/chiuki/advanced-textview under NonBreakingSpaceActivity.

Sunday, May 10, 2015

Sketchnoting: Fast-motion video

As I was sketchnoting Tweeting about Speaking, a thought occured to me: it'll be so cool if I can make a video like the doodling tutorial from PicCandle! At that point I have already drawn the title, but I put down my pen to figure out how to record it.

Overhead camera

I set up the webcam mount that I use to record app demos. It almost worked: I could not capture the whole page because the rod was too short. So I propped it up with a box and put some weight on the clipboard to balance the mount.

I was worried that the mount would bother me when I was drawing, or my head would get in the way in the video. Turns out the problem was that the mount would bounce when I leaned my weight on the table, making the video shaky. Fortunately the bouncing got smoothed out when I increased the speed of the video. In fact the jerky jumps made it look retro and cool.

Audio

I wanted some cute background music, so I searched for podcast-safe music, and found this awesome track called Ice Cream Sandwich. I love the tune, and I love the name! But it was marked for non-commercial use, and I'm not sure if I can use it in a YouTube video. So I picked Dancing on Green Grass by The Green Orbs from the YouTube Audio Library instead.

Result

The fast-motion makes it look like words and pictures just magically appear on the page :)

Saturday, May 9, 2015

Tweeting about speaking

As I mentioned earlier, blogging, public speaking and social media are very intertwined. There are many opportunities to tweet before, during and after a conference:

Sketchnoting has been an amazing way to engage people on twitter, both at the conference and beyond. If you want to try it, check out my blog post on Sketchnoting: An Engineer's Approach. Also take a look at the fast-motion video of the sketchnote being drawn.

I included some fictional tweets in my sketchnote, but here are some real ones:

Topic ideas

Submitted

Accepted

Show time

Live tweet

Share slides

Post video

Retweet comments

Trip report

This post is written to celebrate the sixmonthiversary of Technically Speaking. Subscribe for more public speaking tips.

Friday, May 8, 2015

Espresso: Match Toolbar Title

How do check the value of the title bar in Espresso?

Let's take a look with Hierarchy Viewer. Remember to run it with ANDROID_HVPROTO=ddm if your device is not rooted.

First attempt: Match the TextView

We found our TextView in the hierarchy, but it does not have an id. However, we notice that it is a child of the Toolbar, so we can match it using withParent.

@Test
public void toolbarTitle() {
  CharSequence title = InstrumentationRegistry.getTargetContext()
    .getString(R.string.my_title);
  matchToolbarTitle(title);
}

private static ViewInteraction matchToolbarTitle(
    CharSequence title) {
  return onView(
      allOf(
          isAssignableFrom(TextView.class),
          withParent(isAssignableFrom(Toolbar.class))))
      .check(matches(withText(title.toString())));
}

This is how we look for the view to verify the title:

  • It is a TextView
  • It has a parent that is a Toolbar

This works, but it depends on the inner structure of Toolbar, which is not a part of the public API and may change in future versions. Let's make it better.

Second attempt: Custom matcher with Toolbar.getTitle()

private static ViewInteraction matchToolbarTitle(
    CharSequence title) {
  return onView(isAssignableFrom(Toolbar.class))
      .check(matches(withToolbarTitle(is(title))));
}

private static Matcher<Object> withToolbarTitle(
    final Matcher<CharSequence> textMatcher) {
  return new BoundedMatcher<Object, Toolbar>(Toolbar.class) {
    @Override public boolean matchesSafely(Toolbar toolbar) {
      return textMatcher.matches(toolbar.getTitle());
    }
    @Override public void describeTo(Description description) {
      description.appendText("with toolbar title: ");
      textMatcher.describeTo(description);
    }
  };
}

withToolbarTitle() returns a custom BoundedMatcher, which gives us type safety. In matchesSafely(), we call Toolbar.getTitle() to check its value.

To use this custom matcher, we change our helper function to look for the Toolbar itself, and check that it has the expected title. Notice that we pass is(title) to withToolbarTitle, which takes a text matcher rather than a string. That way we can use other matchers such as startsWith and endsWith.

Source code and notes

https://github.com/chiuki/espresso-samples/ under toolbar-title

  • The Toolbar is actually android.support.v7.widget.Toolbar because we are using AppCompat in the sample.
  • In both attempts, we assume that there is only one Toolbar. If you have more than one, you will need to have some extra matchers to pinpoint the one you want to match.
  • We use a helper function matchToolbarTitle() to hide the implementation details of how we match the toolbar title. That way, if the underlying code changes, we only need to update one place for all our tests that wants to match the toolbar title.
  • The helper function matchToolbarTitle() returns a ViewInteraction. This allows us to chain this call to verify other properties of the Toolbar. i.e. you can do something like this:
    matchToolbarTitle(title)
      .check(matches(isDisplayed()));
    

Article inspired by discussion with Danny Roa, Jacob Tabak and Jake Wharton.

Like this article? Take a look at the outline of my Espresso book and fill in this form to push me to write it! Also check out the published courses: https://gumroad.com/chiuki

Saturday, May 2, 2015

Writing about speaking

I decided that I need to be more visible when I became an independent developer a few years ago. I came up with three ways to increase visibility:

  1. Blogging
  2. Public speaking
  3. Social media

Turns out they are not three separate things, but very intertwined. Blogging allows me to showcase my technical expertise, helping me get my first speaking opportunities. As I gained more experience I started blogging about speaking as well, which is a great way to establish yourself as a speaker who cares about giving good talks.

There are a few ways you can write about speaking:

Topic list

To get started, write about the topics that you would like to speak on. It gives you a chance to take inventory of your interests, and it signals to others that you want to speak so they can connect you with meetups and conferences.

Some examples:

War stories

We are all nervous about speaking, and it really helps to know other people have the same problems too. Share how you feel before, during and after you speak, and how you cope with your anxiety.

Some examples:

Conference report

Talk about what you saw at a conference. What talks did you see? Did you pick up any new speaking techniques? How did your talk go?

You can try my blogging formula for conference reports. Key points: Embed photos and tweets!

Transform your talk into written form

Whether it is a 5-minute lightning talk or 50-minute lecture, you have taken out a lot of material to form a good narrative and maintain a good pace (You have, right?). You can turn those additional material into blog posts.

Kate Heddleston did a phenomenal job with her diversity talk at Pycon. She wrote 5 blog posts expanding on the points she made on her talk, and posted them before the conference to garner interest.

Another way to expand your talk into a blog post annotated slides. Here are some examples:

Do it

There you go, I have written about speaking (actually, I have written about writing about speaking. I know, so meta). Your turn now. If you are an aspiring speaker, go write your topic list. And if you have given a few talks already, write a summary post of your journey. How did you start? What have you learned since then? What are your next goals?

This post is written to celebrate the sixmonthiversary of Technically Speaking. Subscribe for more public speaking tips.