Awesome Open Source
Awesome Open Source


Android app on Google Play

Sample project based on the new Android Component Architecture

Lifecycle, LiveData, MVVM, ViewModels, DataBinding, Dagger, Retrofit

Alt sample

LiveData as Observables !

LiveDatas works like RxJava's Observables, they will notify the observer when the data is Available

public LiveData<User> getUser(String userName){
    final MutableLiveData<User> liveData = new MutableLiveData<>();

    githubAPI.user(userName).enqueue(new Callback<User>() {
            public void onResponse(Call<User> call, Response<User> response) {
                if(response.isSuccessful()) {

            public void onFailure(Call<User> call, Throwable t) {


    return liveData;

LifeCycle Owner

Use Support Fragment and AppCompatActivity to be attached to the application's state

public class MainFragment extends Fragment {

DataBinding and ViewHolders

reposAdapter = new ReposAdapter();
viewDataBinding.recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));

//inject the viewmodel responding to User
//inject the viewmodel responding to List<Repo>

//fetch the user from the datasource
                .observe(this, new Observer<User>() {
                    public void onChanged(@Nullable User user) {

//fetch the repos from the datasource
                .observe(this, new Observer<List<Repo>>() {
                    public void onChanged(@Nullable List<Repo> repos) {
                        //when available, send it to the recyclerview

Dagger and Repository

public class UserViewModel extends ViewModel {

    private final GithubRepository githubRepository;

    public UserViewModel(GithubRepository githubRepository) {
        this.githubRepository = githubRepository;

    public LiveData<User> getUser(String userName) {
        //userLiveData will be notified when the user is fetched
        return githubRepository.getUser(userName);
Android app on Google Play

Fiches Plateau Moto :

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
java (31,753
android (6,464
google (415
architecture (356
mvvm (343
livedata (121
retrofit (96
observable (62
io (59
dagger (54
rx (50
inject (16