{"id":17138056,"url":"https://github.com/moagrius/spatula","last_synced_at":"2025-03-24T07:17:58.740Z","repository":{"id":141864395,"uuid":"63725202","full_name":"moagrius/Spatula","owner":"moagrius","description":"View and Click Binder via Runtime Annotation Processing (blunter version of ButterKnife, after it started taking itself too seriously)","archived":false,"fork":false,"pushed_at":"2016-09-12T19:15:33.000Z","size":106,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-29T12:47:05.566Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moagrius.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-19T20:17:13.000Z","updated_at":"2017-05-18T00:29:35.000Z","dependencies_parsed_at":"2023-07-13T11:45:48.261Z","dependency_job_id":null,"html_url":"https://github.com/moagrius/Spatula","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moagrius%2FSpatula","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moagrius%2FSpatula/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moagrius%2FSpatula/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moagrius%2FSpatula/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moagrius","download_url":"https://codeload.github.com/moagrius/Spatula/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245224599,"owners_count":20580370,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T20:08:38.869Z","updated_at":"2025-03-24T07:17:58.729Z","avatar_url":"https://github.com/moagrius.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spatula\nSpatula is a very simple View and Click binder using Java annotations.\n\n\u003e ButterKnives are infinitely sharper than Spatulas...\n\nWe all love Square's stuff, but ButterKnife started taking itself too seriously when it demanded 4 lines and a plugin in my module's gradle.  Thus, Spatula - a super simple runtime annotation processor for binding Views, OnClickListeners, and click methods.  Spatula is intended to be super simple, super lightweight, super easy to use or modify, and super easy to read.  It's not trying to solve the most important problems, and it's not the most performant version of this functionality.\n\nUnlike ButterKnife, Spatula is able to decorate `private` fields.\n\n## Usage\nThere are 2 binding annoations, both take a resource ID:\n```\n@BindView(R.id.whatever)\n@OnClick(R.id.whatever)\n```\nThe first works on any `View` reference, the second works on a `View.OnClickListener` or a method that takes a single `View` parameter.\n\nTo process, use any of the static `bind` methods.\n```\nSpatula.bind(someActivityOrViewGroup);\n```\n\n## Example\nIt might look like this in an application:\n```\npublic class MyActivity extends Activity {\n  \n  // bind a view\n  @BindView(R.id.button_go)\n  private Button mButtonGo;\n  \n  public void onCreate(Bundle b){\n    super.onCreate(b);\n    Spatula.bind(this);\n    mButtonGo.setText(\"Works!\");\n  }\n  \n  // bind a listener\n  @OnClick(R.id.button_listener)\n  private View.OnClickListener mOnClickListener = new View.OnClickListener() {\n    @Override\n    public void onClick(View view) {\n      Log.d(getClass().getSimpleName(), \"mOnClickListener\");\n    }\n  }\n  \n  // bind a method\n  @OnClick(R.id.button_method)\n  private void onClickMethod(View view) {\n    Log.d(getClass().getSimpleName(), \"onClickMethod\");\n  }\n  \n}\n```\n\n##Installation\nAdd it to your gradle:\n```\ncompile 'com.qozix:spatula:1.3'\n```\n\nIf you're minifying, add these rules to `proguard-rules.pro`\n```\n-keep class com.qozix.spatula.** { *; }\n-keep interface com.qozix.spatula.** { *; }\n-dontwarn com.qozix.spatula.**\n-keepclassmembers class * {\n    @com.qozix.spatula.OnClick *;\n}\n```\n\n## Caveats\n- Yep, this this uses _runtime_ annotation processing, which is going to be technically much slower than compile time using the APT plugin.  That said, you're still probably looking at an average of 0 to 1 milliseconds for a medium-sized instance with several bindings.\n- Yep, ~~all~~ most of the restrictions of ButterKnife apply (and probably more).\n- We get around restricted access members by temporarily setting them accessible, updating, then setting them back (yep, ick!)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoagrius%2Fspatula","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoagrius%2Fspatula","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoagrius%2Fspatula/lists"}