{"id":25396167,"url":"https://github.com/dilpreet2028/fragmenter","last_synced_at":"2025-06-23T20:03:27.818Z","repository":{"id":96950405,"uuid":"84712862","full_name":"dilpreet2028/fragmenter","owner":"dilpreet2028","description":" [Android Library]  Remove Boilerplate code for initializing fragments","archived":false,"fork":false,"pushed_at":"2017-03-15T10:20:38.000Z","size":112,"stargazers_count":62,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-23T20:02:36.432Z","etag":null,"topics":["android","android-library","annotation-processing","argument-binding","fragments","initializing-fragments"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dilpreet2028.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2017-03-12T08:58:07.000Z","updated_at":"2023-09-08T17:22:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"466b360d-bc11-4eb5-a690-535a44f0eece","html_url":"https://github.com/dilpreet2028/fragmenter","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/dilpreet2028/fragmenter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dilpreet2028%2Ffragmenter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dilpreet2028%2Ffragmenter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dilpreet2028%2Ffragmenter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dilpreet2028%2Ffragmenter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dilpreet2028","download_url":"https://codeload.github.com/dilpreet2028/fragmenter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dilpreet2028%2Ffragmenter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261548714,"owners_count":23175490,"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":["android","android-library","annotation-processing","argument-binding","fragments","initializing-fragments"],"created_at":"2025-02-15T20:57:15.858Z","updated_at":"2025-06-23T20:03:27.807Z","avatar_url":"https://github.com/dilpreet2028.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fragmenter\nGenerates boilerplate code for initializing fragment using annotation processing and performs argument binding while following best practices for initializing a fragment.\n+ Eliminates need to create a static function to initialize a fragment\n+ Eliminates need to bind the arguments manually\n\n### Example\n\n\u003ch4\u003eFragment Class\u003c/h4\u003e\n\n```java\nimport com.dilpreet2028.fragmenter_annotations.Fragmenter;\nimport com.dilpreet2028.fragmenter_annotations.annotations.Arg;\nimport com.dilpreet2028.fragmenter_annotations.annotations.FragModule;\n\n@FragModule//Need to annotate fragment with @FragModule\npublic class DemoFragment extends Fragment {\n    \n    @Arg\n    String data; //Annotate variables needed to be initialised with @Arg\n\n    @Override\n    public View onCreateView(LayoutInflater inflater, ViewGroup container,\n                             Bundle savedInstanceState) {\n        View view=inflater.inflate(R.layout.fragment_demo, container, false);\n        \n        Fragmenter.inject(this);//arguments gets injected automically\n\n        ((TextView) view.findViewById(R.id.tv_text)).setText(data);\n\n        return view;\n    }\n\n}\n```\n**Note: After creating a fragment build the project to allow fragmenter to generate the classes for you.**\n\nFragmenter generates a Builder class i.e. the name of your Fragment with \"Builder\" as suffix .\u003cbr\u003e\nIn this example Fragmenter creates a `DemoFragmentBuilder` for `DemoFragment`\n\n\u003ch4\u003eActivity Class\u003c/h4\u003e\n\n```java\npublic class MainActivity extends AppCompatActivity {\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n        \n        String data = \"Hello world\";\n         \n        //using the builder class and passing the required variables.\n        DemoFragment fragment = DemoFragmentBuilder.newInstance(data);\n        \n        getSupportFragmentManager()\n                .beginTransaction()\n                .replace(R.id.content , fragment) \n                .commit();\n\n\n    }\n}\n```\n\n\u003ch3\u003eDownload\u003c/h3\u003e\n\nIn the root build.gradle file add : \n```\nallprojects {\n        repositories {\n            ...\n            maven { url \"https://jitpack.io\" }\n        }\n    }\n```\nIn your app build.gradle file add:\n\n```\ndependencies {\n    compile 'com.github.dilpreet96.fragmenter:fragmenter-annotations:1.0.2'\n    annotationProcessor 'com.github.dilpreet96.fragmenter:fragmenter-compiler:1.0.2'\n    }\n```\n\n\n\u003ch3\u003e License\u003c/h3\u003e \n\n```\nCopyright (C) 2017 Dilpreet Singh\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```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdilpreet2028%2Ffragmenter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdilpreet2028%2Ffragmenter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdilpreet2028%2Ffragmenter/lists"}