{"id":20400696,"url":"https://github.com/litesuits/android-lite-auto","last_synced_at":"2025-12-02T17:06:43.251Z","repository":{"id":78452388,"uuid":"49700296","full_name":"litesuits/android-lite-auto","owner":"litesuits","description":"lite your android ! the code is on the way~ ","archived":false,"fork":false,"pushed_at":"2016-04-10T13:23:09.000Z","size":7,"stargazers_count":33,"open_issues_count":4,"forks_count":6,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-01-15T11:50:21.584Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://lihttp://litesuits.com?from=auto","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/litesuits.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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-01-15T06:13:26.000Z","updated_at":"2023-06-26T06:46:05.000Z","dependencies_parsed_at":"2023-02-27T05:15:33.682Z","dependency_job_id":null,"html_url":"https://github.com/litesuits/android-lite-auto","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/litesuits%2Fandroid-lite-auto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litesuits%2Fandroid-lite-auto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litesuits%2Fandroid-lite-auto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litesuits%2Fandroid-lite-auto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/litesuits","download_url":"https://codeload.github.com/litesuits/android-lite-auto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241950081,"owners_count":20047587,"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-11-15T04:45:16.542Z","updated_at":"2025-12-02T17:06:38.214Z","avatar_url":"https://github.com/litesuits.png","language":null,"funding_links":[],"categories":["Libs"],"sub_categories":["\u003cA NAME=\"Injector\"\u003e\u003c/A\u003eInjector"],"readme":"# android-lite-auto\n\nlite your android, the code is on the way~ !\n\nLiteAuto是一个代码生成框架，思路参考 JakeWharton 的开源项目 ButterKnife，在它的思路基础添加了一些自己的想法，从0到1设计并实现的。\n\nLiteAuto设计思路的关键是约定大于配置，通过 **更简单的注解** 帮你自动生成 Android 中琐碎、冗长的功能代码。\n\n目前可以自动生成 View 和 Event 相关的重复代码，还可以生成常用操作代码，而这些都是在编译时期自动生成的代码，几乎不影响性能，而且使得项目非常清晰简单。\n\n和 ButterKnife 的不同点之一是 LiteAuto 只需要在 Activity 上添加一个 @LiteAuto 注解即可，框架自动分析 Activity 或者 Fragment 内部所有的 View 元素，判断是否在 layout 文件中有与之对应的 View 控件，比如一个 TextView 变量名为 “tvLabel”，框架会自动查找 layout 里面id 为 “tvLabel”的控件，并为之生成findViewById代码，如果查找不到那么探测下一个View，Event代码生成并关联的思路也是如此。\n\n关于 @LiteAuto 注解，如果你有 View 变量不需要和 layout 文件关联，只需为变量添加 @UnBind 注解即可。\n\n关于 @SemiAuto 注解，如果你需要向像 ButterKnife 一样，每个 View 或 Event 单独注解, 那么为Activity等添加 @SemiAuto 注解即可。\n\n比如，之前的代码是这样：\n\n```java\npublic class MainActivity extends Activity {\n\n    TextView tvLabel;\n    TextView tvLabel1;\n    TextView tvLabel2;\n    TextView tvLabel3;\n    Button button;\n    ImageView imageView;\n    ProgressBar progressBar;\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n\n        tvLabel = (TextView) findViewById(R.id.tvLabel);\n        tvLabel1 = (TextView) findViewById(R.id.tvLabel1);\n        tvLabel2 = (TextView) findViewById(R.id.tvLabel2);\n        tvLabel3 = (TextView) findViewById(R.id.tvLabel3);\n        button = (Button) findViewById(R.id.button);\n        imageView = (ImageView) findViewById(R.id.imageView);\n        progressBar = (ProgressBar) findViewById(R.id.progressBar);\n\n        tvLabel1.setOnClickListener(new View.OnClickListener() {\n\n            @Override \n            public void onClick(View v) {\n                tvLabel1.setText(\"TvLabel 1 Clicked!\");\n            }\n        });\n\n        tvLabel2.setOnClickListener(new View.OnClickListener() {\n\n            @Override \n            public void onClick(View v) {\n                tvLabel2.setText(\"TvLabel 2 Clicked!\");\n                tvLabel3.setText(\"show me, show me pls!\");\n            }\n        });\n    }\n\n}\n```\n\n那么，使用 LiteAuto 的代码是这样：\n\n```java\n// 无需findViewById，也不需要为单个变量添加注解，Activity级别添加一个注解即可。\n// 框架会分析类和成员变量，自动生成代码\n@AutoLite\npublic class LiteMainActivity extends Activity {\n\n    TextView tvLabel;\n    TextView tvLabel1;\n    TextView tvLabel2;\n    TextView tvLabel3;\n    Button button;\n    ImageView imageView;\n    ProgressBar progressBar;\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n        AutoMan.activateThis(this);\n    }\n\n    public void clickTvLabel1(View view) {\n        tvLabel1.setText(\"TvLabel Clicked!\");\n    }\n\n    public void clickTvLabel2(View view) {\n        tvLabel2.setText(\"TvLabel Clicked!\");\n        tvLabel3.setText(\"show me, show me pls!\");\n    }\n\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flitesuits%2Fandroid-lite-auto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flitesuits%2Fandroid-lite-auto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flitesuits%2Fandroid-lite-auto/lists"}