Profile

Cover photo
Jake Wharton
Works at Square, Inc.
Lives in San Francisco, CA
11,196 followers|3,950,057 views
AboutPostsPhotosVideos+1's

Stream

 
Fans of lipids and cutlery rejoice, Butter Knife v5.0 has been released! Read on and learn about what's new:

@InjectViews
Views are frequently operated on in groups as a result of some event. Text views animate in on new screens, input fields are enabled and disabled for network calls, etc. Group multiple views together using the @InjectViews annotation into a List or array for easy operation.

  @InjectViews({ R.id.first_name, R.id.last_name })
  List<TextView> nameViews;

ButterKnife.apply
Coupled with the aforementioned annotation to aggregate views, apply provides a concise way to operate on those groups of views at once.

  ButterKnife.apply(nameViews, DISABLE);
  ButterKnife.apply(nameViews, ENABLED, false)

The Action[1] and Setter[2] interfaces provide easy ways to define operations.

  static final Action<View> DISABLE = new Action<>() {
    @Override public void apply(View view, int index) {
      view.setEnabled(false);
    }
  }
  static final Setter<View, Boolean> ENABLED = new Setter<>() {
    @Override public void set(View view, Boolean value, int index) {
      view.setEnabled(value);
    }
  }

You can use Android's Property[3] with apply as well.

  ButterKnife.apply(nameViews, View.ALPHA, 0);

New multi-callback listeners
* @OnItemSelected for AdapterView.OnItemSelectedListener's onItemSelected callback.
* @OnPageChange for ViewPager.OnPageChangeListener's onPageChange callback.
* @OnTextChange for TextWatcher's onTextChange callback.

Each of these new listeners have multiple callback methods. Change which callback your method is being bound to by supplying a callback argument.

  @OnItemSelected(R.id.list)
  void onItemSelected(long id) {
    // ...
  }

  @OnItemSelected(value= R.id.list, callback = NOTHING_SELECTED)
  void onNothingSelected() {
    // ...
  }

Enjoy! And #DeathToBoilerplate !

* Website: http://jakewharton.github.io/butterknife/
* Changelog: https://github.com/JakeWharton/butterknife/blob/master/CHANGELOG.md
* Javadoc: http://jakewharton.github.io/butterknife/javadoc/


[1]: http://jakewharton.github.io/butterknife/javadoc/butterknife/ButterKnife.Action.html
[2]: http://jakewharton.github.io/butterknife/javadoc/butterknife/ButterKnife.Setter.html
[3]: https://developer.android.com/reference/android/util/Property.html
220
84
Wei-Zhi Liao's profile photoMarty Glaubitz's profile photoDustin Steiner's profile photoWade Reweti's profile photo
16 comments
 
+Jake Wharton great library. An annotation similar to OnCheckedChanged but for RadioGroups would be nice :)
Add a comment...
 
Announcing the SDK Manager plugin for Gradle Android builds.

Local SDK missing? API level not downloaded? Support library repository out-of-date?

These are all typical problems which you shouldn't have to deal with. This is especially painful when you have multiple developers on a project or a CI machine that you have to keep up-to-date.

This Gradle plugin will manage these SDK dependencies for you automatically. Simply apply the plugin before the normal 'android' plugin:

  apply plugin: 'android-sdk-manager'
  apply plugin: 'android'

Supported functionality:

* local.properties will be created if missing. The ANDROID_HOME environment variable will be used if present. Otherwise ~/.android-sdk will be used.
* The platform-specific SDK will be downloaded if missing.
* Compilation API declared in compileSdkVersion will be downloaded if missing.
* If any dependencies are declared on support libraries, the support repository will be downloaded if missing. If the revision of the support repository does not contain the version declared it will be updated.
* If any dependencies are declared on Google Play Services, the Google repository will be downloaded if missing. If the revision of the Google repository does not contain the version declared it will be updated.

See more info on how to include in your project by following the link below.

#AndroidDev
338
141
Jeff Shadap's profile photoMichael Panzer's profile photoLudovic Valente's profile photoSavvas Dalkitsis's profile photo
29 comments
 
+Jake Wharton Android Rockstar and my inspiration ! 
Add a comment...

Jake Wharton
owner

Discussion  - 
 
Transitioning to StackOverflow for questions and answers.

This community has grown beyond anything we expected when it was initially created. We are happy to see so many people using and enjoying our open source libraries. It makes us even more happy to see users of these projects come together to help each other resolve problems. One thing we have noticed in moderating this community is that it is not the best medium for asking questions and archiving their solutions.

To ensure your questions and their answers are appropriately archived and searchable we are transitioning them to StackOverflow. A website that needs no introduction to a modern-day programmer, StackOverflow is a much better platform for community-driven problem resolution.

Individual tags for our respective projects have been set up and will be maintained by the individual project owners. Projects with websites have been updated to link to their respective tag directly.

StackOverflow offers some unique features which Google+ does not provide that may be of interest to you. The most notable is the ability to subscribe to tags which will email digests at 15 minute, 3 hour, or daily intervals. You can see my subscriptions[1] for an example.

This community will continue to exist for discussion which doesn't belong on StackOverflow or on a project's GitHub issues. We will be politely pushing any questions that are asked towards StackOverflow.

Thanks for all your support thus far and we look forward to seeing you all on StackOverflow!


[1]: http://stackexchange.com/users/44914?tab=subscriptions
53
2
Christian Gruber's profile photoJames Power's profile photoMarcin Gil's profile photoRay Ryan's profile photo
8 comments
 
+Ray Ryan Done.
Add a comment...

Jake Wharton

Shared publicly  - 
 
A few of us at Square have the pleasure of working with these folks. You can learn a lot from the code they contribute to open source. This is a great opportunity to learn even more.
 
The Guava team is trying a little social experiment and hosting a Reddit "AMA" (ask me/us anything) tomorrow. We'll devote some serious time toward answering these questions deeply and soul-searchingly. :-)

Go post your questions and upvote the questions you like!
60
11
Tarakeshwar M Sriram's profile photoRichard Wooding's profile photo
Add a comment...
 
Pull requests welcome! (And not in the usual snarky way)

Please comment on the original.
 
+Bob Lee: “Now Google contributes to Dagger more than we do, so it’s like getting free software.

Yep. In particular, Googlers +Christian Gruber and +Gregory Kick do good work.
89
18
Fahad Ayaz's profile photoRichard Wooding's profile photo
In their circles
127 people
Have them in circles
11,196 people
Jeff Gilfelt's profile photo

Jake Wharton

Shared publicly  - 
 
Please comment on the original.
 
“The most satisfying improvements are the ones that simultaneously speed up the code, simplify the implementation, and improve the API. In this post I'll describe an ugly situation that led to one of these solutions.”
57
16
Simone Casagranda's profile photoWade Reweti's profile photo

Jake Wharton

Shared publicly  - 
 
Who has been enjoying Java 8 since its GA release?

I took the opportunity to revise some collectors for Guava types I had written a few months back with some new things I have learned: https://gist.github.com/JakeWharton/9734167

These are used with streams to collect the values into an ImmutableList or ImmutableSet.

Here's a random (and particularly terrible) example use:

ImmutableSet<String> items = IntStream.rangeClosed(1, 10)
    .mapToObj(x -> "Item " + x)
    .collect(GuavaCollectors.immutableSet());

For comparison, if the streams API existed without method references or lambda expressions these utilities would look quite different: https://gist.github.com/JakeWharton/136a9b3cd09d21938d3e. Gross!

(And for you commenters: I don't care that we can't use Java 8 on Android. I don't care when Java 8 will be coming to Android.)
41
4
Martin Krischik's profile photoJiří Machart's profile photoGovorovsky Alexey's profile photoKapil Sharma's profile photo
22 comments
 
Has anyone tried Retrolamda with the latest build tools on Android? I have a pure java library which works OK but dexing fails for me with Retrolamda Gradle plugin.
 
Haven't tried pidcat yet? Now it's even easier to install, update, and run on OS X with Homebrew:

    $ brew install pidcat

Try it out today! #AndroidDev
114
39
Andrea Richiardi's profile photoGreg Loesch's profile photoTobias Bieniek's profile photoRichard Wooding's profile photo
15 comments
 
yes this awesome working perfectly on ubuntu, I'm updating such a tolls here  http://androidlibs.org/androidtools , Thank you +Jake Wharton  
Add a comment...

Jake Wharton

Shared publicly  - 
 
I spent an hour today replacing a failed hard drive in my file server. I'm not quite sure when the drive actually failed as I hadn't logged into the box in over 9 months. The redundancy provided by ZFS kept receiving and serving files as if nothing was wrong. I also took this opportunity to upgrade the fans which cool the primary 10 drives to models which are more quiet.

Currently the pool is resilvering (synchronizing data onto the new disk) which should take about 12 hours. Owners of redundant storage arrays know that this is scary since it is an atypical, high-stress operation on an already degraded array. Years ago when I expanded the array I made the mistake of purchasing drives from the same batch. This is discouraged since studies show that drives from the same batch have similar MTTF (mean time to failure). This means that the resilvering could potentially trigger a failure in another drive. Since this array can only tolerate a single drive failing (raidz1) it would result in data loss of the entire pool.

I've had this box for almost 5 years and it's managed to grow with my storage needs. While it has room for 5 more drives (and 5 * 4TB is a drool-worthy expansion), I'd much rather have a smaller form factor with less drives and just do pool expansion (replace small drives with larger ones incrementally). Something like the Drobo B800 in form factor but without the lame proprietary technology. I'd also love to abandon ZFS on Solaris for brtfs on Linux, but I'm still wary of it's stability. The various ZFS on Linux ports don't sit too well with me either. Maybe next year.
45
1
Philip Schiffer's profile photoTerry Poulin's profile photoNeal Sanche's profile photoDavid McCullough's profile photo
15 comments
 
+David McCullough the typical / widely supported solution for Linux is called "Logical Volume Manager" or lvm2. http://en.wikipedia.org/wiki/LVM2 and there are other options but I've only dealt with lvm2 and mdadm. I'm particularly fond of the support for snapshotting in lvm2.

It's also possible to deal with it from a GUI (including most installers) and to my joy, not a pain to use from the command line.

At home, I mainly use it for a RAID0 style storage pool that stores my movie rips and copies of my offsite backups. Thus space is more important than redundancy. But it is capable of a lot more advanced configurations.
Add a comment...
 
Double Espresso: A (temporary) pure Gradle port of the Espresso testing utility for Android!

If you have instrumentation tests or are looking to add them you need to be using this library. Unfortunately it's currently distributed quite awkwardly and can be a hassle to get a Gradle project bootstrapped.

Now there's no more fumbling with local jars or dependency conflicts. Pull it in with one line:

instrumentTestCompile 'com.jakewharton.espresso:espresso:1.1-r1'

Espresso also has an add-on module which provides helpers for the support-v4 library:

instrumentTestCompile 'com.jakewharton.espresso:espresso-support-v4:1.1-r1'

#AndroidDev  
103
44
Wei-Zhi Liao's profile photoMehrzad Karami's profile photoGreg Loesch's profile photoTed Chien's profile photo
10 comments
 
Thanks, but the note was added later, I already proceeded with faith :)
Add a comment...
People
In their circles
127 people
Have them in circles
11,196 people
Jeff Gilfelt's profile photo
Work
Employment
  • Square, Inc.
    Android Engineer, 2012 - present
  • Champion International Moving, Ltd.
    Java Developer, 2009 - 2012
Jake Wharton's +1's are the things they like, agree with, or want to recommend.
Square Cash
market.android.com

Send money to anyone with an email address. It's fast, safe, and free!No account needed. Just securely link your debit card to start sending

Square OctoCash
chrome.google.com

Sponsor a beer to your oss devs.

Ball Maze Lite
market.android.com

Ball Maze is a fun and addicting puzzle game. You have to get the ball on a target field by rolling it through one of the 200 challenging le

Giganticon - Big Icons
market.android.com

Do you crave bigger icons on your home screen? Are your icons too small to see or touch? Giganticon allows you to have big huge gigantic gia

Beautiful Widgets
market.android.com

Beautiful set of widgets including clock+weather, with some toggles Beautiful set of Widgets containing clock widget, clock and weather widg

Google+
market.android.com

Real-life sharing rethought for the web, wherever you are. Google+ for mobile makes sharing the right things with the right people a lot sim

FriendCaster for Facebook
market.android.com

FriendCaster for Facebook - the best Facebook experience on Android devices! FriendCaster for Facebook gives you the best Facebook experienc

Google Voice
market.android.com

Make cheap international calls with your Google number. Send free text messages. Place calls and send text messages showing your Google numb

Do It (Tomorrow)
chrome.google.com

The todo App for procrastinators ;)

Foursquare
market.android.com

foursquare helps you and your friends make the most of where you are. Heading out? foursquare helps you and your friends make the most of wh

Google I/O 2012
market.android.com

The official Google I/O 2012 conference app. The official Google I/O 2012 conference companion app. Supports devices running Android 2.2+, a

Chrome Beta
market.android.com

Welcome to Chrome Beta for Android!- Preview the latest features: Try out the newest features. (Sometimes these may be a little rough around

Chrome Beta - Apps on Android Market
market.android.com

The speed and simplicity of Chrome, now on your Android phone and tablet. Browse fast on your Android smartphone or tablet, and bring your p

Glitch Skills
market.android.com

Learn your Glitch skills on the go! Keep learning until the cows come home. Hey, have you ever thought to yourself: 'Self, wouldn't it be ni

Self Serve for Koodo beta*
market.android.com

View your Koodo Mobile bill and usage securely anytime,anywhere. View your online bill, quota usage and other account information securely i

SeriesGuide
plus.google.com

Android app to manage (re)watching your TV shows

Jirafy
chrome.google.com

Linkifies JIRA ticket numbers on select pages. Click the 'Options' link to configure pages to parse and JIRA projects to link.

Google+ Styled UI Buttons, Icon Buttons &amp; Dropdown Menu Buttons
code.shrapp.nl

This is an easy to implement framework of Google+ styled buttons, icon buttons &amp; dropdown menu buttons that look and work great in web a

Bird Bar Premium Notifications
market.android.com

Check notifications while playing a game without losing your progress. Yes this app was featured on Lifehacker. http://lifehacker.com/583488