{"id":13537779,"url":"https://github.com/adennie/fb-android-dagger","last_synced_at":"2025-04-02T04:31:29.398Z","repository":{"id":144504420,"uuid":"10270283","full_name":"adennie/fb-android-dagger","owner":"adennie","description":"A set of helper classes for using dagger 1 with Android components such as Applications, Activities, Fragments, BroadcastReceivers, and Services.","archived":false,"fork":false,"pushed_at":"2015-10-06T12:44:56.000Z","size":465,"stargazers_count":282,"open_issues_count":6,"forks_count":24,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-11-03T02:33:10.442Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adennie.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}},"created_at":"2013-05-24T16:17:26.000Z","updated_at":"2023-09-08T16:39:38.000Z","dependencies_parsed_at":"2023-03-21T22:40:49.006Z","dependency_job_id":null,"html_url":"https://github.com/adennie/fb-android-dagger","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adennie%2Ffb-android-dagger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adennie%2Ffb-android-dagger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adennie%2Ffb-android-dagger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adennie%2Ffb-android-dagger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adennie","download_url":"https://codeload.github.com/adennie/fb-android-dagger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246757330,"owners_count":20828883,"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-01T09:01:03.589Z","updated_at":"2025-04-02T04:31:24.383Z","avatar_url":"https://github.com/adennie.png","language":"Java","readme":"##fb-android-dagger\n\nA set of helper classes for using [dagger](https://github.com/square/dagger) with Android components such as \nApplications, Activities, Fragments, BroadcastReceivers, and Services.\n  \nMaven users: \n\n```xml\n\u003cdependency\u003e\n   \u003cgroupId\u003ecom.fizz-buzz\u003c/groupId\u003e\n   \u003cartifactId\u003efb-android-dagger\u003c/artifactId\u003e\n   \u003cversion\u003e1.0.6\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nNote: this project's POM specifies dependencies for the Android SDK and the support v4 library using the \ngroup IDs, artifact IDs, and version numbers created by the [Maven Android SDK Deployer]\n(https://github.com/mosabua/maven-android-sdk-deployer), as opposed to the ones in Maven Central, which contains \nartifacts that are unofficial and out of date.  If you want to use the ones in Maven Central anyway, just update \nthose dependencies in the POM.\n\n\n####Overview\n\nfb-android-dagger provides a set of base classes for using dagger in Android applications.  It follows a convention exemplified by Square's sample application, whereby a base class calls getModules() to gather the set of modules that its subclass(es) need to be part of the graph, then creates an object graph from those modules and injects itself.\n\nThe following classes are provided, each implementing this technique in the method indicated in parentheses:\n\n - `InjectingApplication` (onCreate)\n - `InjectingBroadcastReceiver` (onReceive)\n - `InjectingAppWidgetProvider` (onReceive)\n - `InjectingService` (onCreate)\n - `InjectingActivity` (onCreate)\n - `InjectingActionBarActivity` (onCreate)\n - `InjectingFragmentActivity` (onCreate)\n - `InjectingPreferenceActivity` (onCreate)\n - `InjectingFragment` (onAttach)\n - `InjectingListFragment` (onAttach)\n - `InjectingDialogFragment` (onAttach)\n\n####The graphs\n\n`InjectingApplication` creates an application-scope graph.  \n\n`InjectingBroadcastReciever`, `InjectingAppWidgetProvider`, `InjectingService`, and the various `Injecting...Activity` classes each extend the application-scope graph with their own module(s), resulting in a graph scoped to their own component.\n\nThe various `Injecting...Fragment` classes extend their corresponding activity's graph.\n\n####Modules\n\nEach component type has an associated module:\n - `InjectingActivityModule`\n - `InjectingServiceModule`\n - `InjectingBroadcastRecieverModule`\n - `InjectingActivityModule`\n - `InjectingFragmentModule`\n\nThe last two are shared by the `Injecting...Activity` classes and the `Injecting...Fragment` classes, respectively.  These modules define provider methods which enable injection of objects relevant to their component type.  They all have a provider that returns the component itself in the form of an Injector interface:\n\n```java\npublic interface Injector {\n    public ObjectGraph getObjectGraph();\n    public void inject(Object target);\n}\n```\n\nQualifier annotations defined in the various modules allow for specific components' injectors to be accessed:\n\n```java\nclass Foo1 {\n    @Inject @Application Injector appInjector;\n    @Inject @Activity Injector activityInjector;\n    @Inject @Fragment Injector fragInjector;\n    //...\n}\n```\n\nApplication and Activity Contexts are similarly accessible:\n\n```java\nclass Foo2 {\n    @Inject @Application Context appContext;\n    @Inject @Activity Context activityContext;\n    // ...\n}\n```\n    \n...as are the typed components themselves:\n\n```java\nclass Foo3 {\n    @Inject Application theApp;\n    @Inject Activity myActivity;\n    @Inject Fragment myFragment;\n    // ...\n}\n```\n    \n\n\n####Developed by\n\nAndy Dennie - andy@fizz-buzz.com\n\n####License\n\nCopyright 2014 Fizz Buzz LLC\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","funding_links":[],"categories":["Java","Libs"],"sub_categories":["\u003cA NAME=\"Utility\"\u003e\u003c/A\u003eUtility"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadennie%2Ffb-android-dagger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadennie%2Ffb-android-dagger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadennie%2Ffb-android-dagger/lists"}