{"id":13507732,"url":"https://github.com/emilsjolander/IntentBuilder","last_synced_at":"2025-03-30T09:33:01.226Z","repository":{"id":33779933,"uuid":"37438500","full_name":"emilsjolander/IntentBuilder","owner":"emilsjolander","description":"Type safe intent building for services and activities","archived":false,"fork":false,"pushed_at":"2017-04-18T03:58:25.000Z","size":632,"stargazers_count":342,"open_issues_count":13,"forks_count":21,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-11-01T07:33:13.594Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emilsjolander.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}},"created_at":"2015-06-15T02:09:55.000Z","updated_at":"2024-10-07T13:26:07.000Z","dependencies_parsed_at":"2022-09-08T18:01:21.895Z","dependency_job_id":null,"html_url":"https://github.com/emilsjolander/IntentBuilder","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/emilsjolander%2FIntentBuilder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emilsjolander%2FIntentBuilder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emilsjolander%2FIntentBuilder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emilsjolander%2FIntentBuilder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emilsjolander","download_url":"https://codeload.github.com/emilsjolander/IntentBuilder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246301963,"owners_count":20755512,"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-08-01T02:00:38.363Z","updated_at":"2025-03-30T09:33:00.752Z","avatar_url":"https://github.com/emilsjolander.png","language":"Java","funding_links":[],"categories":["CN","Libs","Annotation"],"sub_categories":["[Emil Sjölander](https://github.com/emilsjolander)","\u003cA NAME=\"Utility\"\u003e\u003c/A\u003eUtility"],"readme":"#IntentBuilder\nType safe intent building for services and activities.\n\nIntentBuilder is a type safe way of creating intents and populating them with extras. Intents were created to be very dynamic but often times the dynamic nature of intents is not needed and just gets in the way of writing safe code.\n\n##Installation\n```groovy\nbuildscript {\n    repositories {\n        jcenter()\n    }\n    dependencies {\n        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'\n    }\n}\n\napply plugin: 'com.neenbedankt.android-apt'\n\ndependencies {\n    compile 'se.emilsjolander:intentbuilder-api:0.14.0'\n    apt 'se.emilsjolander:intentbuilder-compiler:0.14.0'\n}\n```\n\n##Usage\nAnnotate your activities and services with an `@IntentBuilder` annotation so that they are picked up by the library. For every class with an `@IntentBuilder` annotation a class named `MyActivityIntentBuilder` will be generated (Replace 'MyActivity' in the class name whith whatever the name of your Activity or Service class is). If your activity or service takes in parameters via extras in the intent you can now mark field with the `@Extra` annotation and they can be injected with the static `inject` method on the generated intent builder class. Extras can be marked as optional with the `@Nullable` annotation.\n\nSample activity using IntentBuilder:\n```java\n@IntentBuilder\nclass DetailActivity extends Activity {\n\t\n\t@Extra\n\tString id;\n\n\t@Extra @Nullable\n\tString title;\n\n\t@Override\n\tpublic void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\tDetailActivityIntentBuilder.inject(getIntent(), this);\n\t\t// TODO use id and title\n\t}\n\nstartActivity(new DetailActivityIntentBuilder(\"12345\")\n\t.title(\"MyTitle\")\n\t.build(context))\n}\n```\n\nSample service using IntentBuilder:\n```java\n@IntentBuilder\nclass DownloadService extends IntentService {\n\n    @Extra\n    String downloadUrl;\n\t\n\t@Override\n    protected void onHandleIntent(Intent intent) {\n        MyServiceIntentBuilder.inject(intent, this);\n    }\n\n}\n\nstartService(new DownloadServiceIntentBuilder(\"http://google.com\").build(context))\n```\n\n##Contributing\nContributions are very welcome! Both bug fixes and additional features if they make sense. Open a pull request to discuss any changes :)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femilsjolander%2FIntentBuilder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femilsjolander%2FIntentBuilder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femilsjolander%2FIntentBuilder/lists"}