Wiki

Clone wiki

butterknifesharper / Home

Welcome

This is ButterknifeSharper tool Wiki!

What is ButterknifeSharper?

ButterknifeSharper is a simply tool allow Android developer to save time when bind layout elements with Java code! (Even if you didnt use Butterknife for your project)

Why do I need this?

It will save you time by generate boilerplate code ;)

Installation

You may install it from official JetBrains plugin repo or download from this repo .jar file and install plugin from local disk.

How to use it?

After successful plugin installation open .java file in which you want to put generated code, move cursor into position you want to see bound elements and use

  • [CMD+ALT+SHIFT+B]

  • [Mouse right click->Bind layout elements.]

  • [Menu 'Code'->Bind layout elements.]

  • [Generate->Bind layout item].

Plugin automatically will search all layout mention in open source file and if there are more than one it will show selecting dialog.

Screen Shot 2017-07-19 at 10.00.38.png

When you select layout(or when opened source file have only one layout mention) plugin parse given layout for elements with ids and ask for which one should be bounds created.

Screen Shot 2017-07-19 at 10.04.13.png

Bottom checkbox allow either to add generated 'findViewById' source lines in existing private method either to new one even if it exist.

After you choose ids of elements to bind, press ok and you will see generated class members :)

Screen Shot 2017-07-19 at 10.08.33.png

I found bug, have a preposition for improvement, what should I do?

Well I will be grateful if you create ticket in issue tracker

I have another question who can I talk to ?

For any question write me on my email

Hope you find this simply tool useful.

Updated