{"id":17679428,"url":"https://github.com/florent37/newandroidarchitecture-component-github","last_synced_at":"2025-10-04T01:47:16.146Z","repository":{"id":91120198,"uuid":"91694636","full_name":"florent37/NewAndroidArchitecture-Component-Github","owner":"florent37","description":"Sample project based on the new Android Component Architecture ","archived":false,"fork":false,"pushed_at":"2018-10-01T09:07:17.000Z","size":1187,"stargazers_count":223,"open_issues_count":0,"forks_count":40,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-08-20T08:43:19.354Z","etag":null,"topics":["2017","android","architecture","dagger","google","inject","io","livedata","mvvm","observable","retrofit","rx"],"latest_commit_sha":null,"homepage":"https://developer.android.com/topic/libraries/architecture/guide.html","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/florent37.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}},"created_at":"2017-05-18T13:11:19.000Z","updated_at":"2025-02-01T05:11:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"0a279f3c-0ff3-4685-b127-430d80b78e38","html_url":"https://github.com/florent37/NewAndroidArchitecture-Component-Github","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/florent37/NewAndroidArchitecture-Component-Github","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florent37%2FNewAndroidArchitecture-Component-Github","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florent37%2FNewAndroidArchitecture-Component-Github/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florent37%2FNewAndroidArchitecture-Component-Github/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florent37%2FNewAndroidArchitecture-Component-Github/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/florent37","download_url":"https://codeload.github.com/florent37/NewAndroidArchitecture-Component-Github/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florent37%2FNewAndroidArchitecture-Component-Github/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278254467,"owners_count":25956598,"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","status":"online","status_checked_at":"2025-10-03T02:00:06.070Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["2017","android","architecture","dagger","google","inject","io","livedata","mvvm","observable","retrofit","rx"],"created_at":"2024-10-24T08:41:57.524Z","updated_at":"2025-10-04T01:47:16.129Z","avatar_url":"https://github.com/florent37.png","language":"Java","readme":"# NewAndroidArchitecture-Github\n\n\n\u003ca href=\"https://goo.gl/WXW8Dc\"\u003e\n  \u003cimg alt=\"Android app on Google Play\" src=\"https://developer.android.com/images/brand/en_app_rgb_wo_45.png\" /\u003e\n\u003c/a\u003e\n\n\nSample project based on the new Android Component Architecture \n\nLifecycle, LiveData, MVVM, ViewModels, DataBinding, Dagger, Retrofit\n\nhttps://developer.android.com/topic/libraries/architecture/guide.html\n\n![Alt sample](https://raw.githubusercontent.com/florent37/NewAndroidArchitecture-Github/master/media/screen_small.png)\n\n# LiveData as Observables !\n\nLiveDatas works like RxJava's Observables,\nthey will notify the observer when the data is Available\n\n```java\n@Override\npublic LiveData\u003cUser\u003e getUser(String userName){\n    final MutableLiveData\u003cUser\u003e liveData = new MutableLiveData\u003c\u003e();\n\n    githubAPI.user(userName).enqueue(new Callback\u003cUser\u003e() {\n            @Override\n            public void onResponse(Call\u003cUser\u003e call, Response\u003cUser\u003e response) {\n                if(response.isSuccessful()) {\n                    liveData.setValue(response.body());\n                }\n            }\n\n            @Override\n            public void onFailure(Call\u003cUser\u003e call, Throwable t) {\n\n            }\n        });\n\n    return liveData;\n}\n```\n\n# LifeCycle Owner\n\nUse Support Fragment and AppCompatActivity to be attached to the application's state\n\n```java\npublic class MainFragment extends Fragment {\n```\n\n# DataBinding and ViewHolders\n\n\u003cb\u003eMainFragment.java\u003c/b\u003e\n```java\nreposAdapter = new ReposAdapter();\nviewDataBinding.recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));\nviewDataBinding.recyclerView.setAdapter(reposAdapter);\n\nAppComponent.from(getContext()).inject(this);\n//inject the viewmodel responding to User\n//inject the viewmodel responding to List\u003cRepo\u003e\n\n//fetch the user from the datasource\nuserViewModel.getUser(\"florent37\")\n                .observe(this, new Observer\u003cUser\u003e() {\n                    @Override\n                    public void onChanged(@Nullable User user) {\n                        viewDataBinding.setUser(user);\n                    }\n                });\n\n//fetch the repos from the datasource\nreposListViewModel.getRepos(\"florent37\")\n                .observe(this, new Observer\u003cList\u003cRepo\u003e\u003e() {\n                    @Override\n                    public void onChanged(@Nullable List\u003cRepo\u003e repos) {\n                        //when available, send it to the recyclerview\n                        reposAdapter.setRepos(repos);\n                    }\n                });\n```\n\n# Dagger and Repository\n\n```java\npublic class UserViewModel extends ViewModel {\n\n    private final GithubRepository githubRepository;\n\n    @Inject\n    public UserViewModel(GithubRepository githubRepository) {\n        this.githubRepository = githubRepository;\n    }\n\n    public LiveData\u003cUser\u003e getUser(String userName) {\n        //userLiveData will be notified when the user is fetched\n        return githubRepository.getUser(userName);\n    }\n}\n```\n\n\n\u003ca href=\"https://goo.gl/WXW8Dc\"\u003e\n  \u003cimg alt=\"Android app on Google Play\" src=\"https://developer.android.com/images/brand/en_app_rgb_wo_45.png\" /\u003e\n\u003c/a\u003e\n\nFiches Plateau Moto : [https://www.fiches-plateau-moto.fr/](https://www.fiches-plateau-moto.fr/)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflorent37%2Fnewandroidarchitecture-component-github","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflorent37%2Fnewandroidarchitecture-component-github","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflorent37%2Fnewandroidarchitecture-component-github/lists"}