// Path: app/src/main/java/com/tobi/movies/ImageLoader.java
// public class ImageLoader {
// 
//     public void loadWebImageInto(Uri imageUrl, ImageView imageView) {
//         Glide
//                 .with(imageView.getContext())
//                 .load(imageUrl)
//                 .crossFade()
//                 .into(imageView);
//     }
// }
// 
// Path: app/src/main/java/com/tobi/movies/MovieApplication.java
// public class MovieApplication extends Application {
// 
//     private PopularMoviesComponent popularMoviesComponent;
//     private MovieDetailsComponent movieDetailsComponent;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         ApplicationComponent applicationComponent = applicationComponent();
//         popularMoviesComponent = popularMoviesComponent(applicationComponent);
//         movieDetailsComponent = movieDetailsComponent(applicationComponent);
//     }
// 
//     protected ApplicationComponent applicationComponent() {
//         return DaggerApplicationComponent.create();
//     }
// 
//     protected MovieDetailsComponent movieDetailsComponent(ApplicationComponent applicationComponent) {
//         return DaggerMovieDetailsComponent.builder()
//                 .applicationComponent(applicationComponent)
//                 .build();
//     }
// 
//     protected PopularMoviesComponent popularMoviesComponent(ApplicationComponent applicationComponent) {
//         return DaggerPopularMoviesComponent.builder()
//                 .applicationComponent(applicationComponent)
//                 .build();
//     }
// 
//     public PopularMoviesComponent getPopularMoviesComponent() {
//         return popularMoviesComponent;
//     }
// 
//     public MovieDetailsComponent getMovieDetailsComponent() {
//         return movieDetailsComponent;
//     }
// }
// 
// Path: app/src/main/java/com/tobi/movies/misc/AbstractObserver.java
// public abstract class AbstractObserver<T> implements Observer<T> {
//     @Override
//     public void onCompleted() {
//         //no-op
//     }
// 
//     @Override
//     public void onError(Throwable e) {
//         //no-op
//     }
// 
//     @Override
//     public void onNext(T t) {
//         //no-op
//     }
// }


import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import com.tobi.movies.ImageLoader;
import com.tobi.movies.MovieApplication;
import com.tobi.movies.R;
import com.tobi.movies.backend.Backend;
import com.tobi.movies.misc.AbstractObserver;
import javax.inject.Inject;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
package com.tobi.movies.popularstream;





public class PopularMoviesActivity extends AppCompatActivity {

    private static final String TAG = PopularMoviesActivity.class.getSimpleName();
    private static final int POSTER_COL_COUNT = 3;

    @BindView(R.id.popularMovies_recycler)
    RecyclerView popularMoviesRecycler;

    @Inject
    Backend backend;

    @Inject
    ImageLoader imageLoader;

    @Inject
    PopularStreamRepository streamRepository;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_popular_movies);
        ButterKnife.bind(this);
        final MovieApplication movieApplication = (MovieApplication) getApplicationContext();
        movieApplication.getPopularMoviesComponent().inject(this);

        popularMoviesRecycler.setLayoutManager(new GridLayoutManager(this, POSTER_COL_COUNT));
        popularMoviesRecycler.setHasFixedSize(true);

        final Navigator navigator = new Navigator(this);

// Path: app/src/main/java/com/tobi/movies/ImageLoader.java
// public class ImageLoader {
// 
//     public void loadWebImageInto(Uri imageUrl, ImageView imageView) {
//         Glide
//                 .with(imageView.getContext())
//                 .load(imageUrl)
//                 .crossFade()
//                 .into(imageView);
//     }
// }
// 
// Path: app/src/main/java/com/tobi/movies/MovieApplication.java
// public class MovieApplication extends Application {
// 
//     private PopularMoviesComponent popularMoviesComponent;
//     private MovieDetailsComponent movieDetailsComponent;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         ApplicationComponent applicationComponent = applicationComponent();
//         popularMoviesComponent = popularMoviesComponent(applicationComponent);
//         movieDetailsComponent = movieDetailsComponent(applicationComponent);
//     }
// 
//     protected ApplicationComponent applicationComponent() {
//         return DaggerApplicationComponent.create();
//     }
// 
//     protected MovieDetailsComponent movieDetailsComponent(ApplicationComponent applicationComponent) {
//         return DaggerMovieDetailsComponent.builder()
//                 .applicationComponent(applicationComponent)
//                 .build();
//     }
// 
//     protected PopularMoviesComponent popularMoviesComponent(ApplicationComponent applicationComponent) {
//         return DaggerPopularMoviesComponent.builder()
//                 .applicationComponent(applicationComponent)
//                 .build();
//     }
// 
//     public PopularMoviesComponent getPopularMoviesComponent() {
//         return popularMoviesComponent;
//     }
// 
//     public MovieDetailsComponent getMovieDetailsComponent() {
//         return movieDetailsComponent;
//     }
// }
// 
// Path: app/src/main/java/com/tobi/movies/misc/AbstractObserver.java
// public abstract class AbstractObserver<T> implements Observer<T> {
//     @Override
//     public void onCompleted() {
//         //no-op
//     }
// 
//     @Override
//     public void onError(Throwable e) {
//         //no-op
//     }
// 
//     @Override
//     public void onNext(T t) {
//         //no-op
//     }
// }


// Path: app/src/main/java/com/tobi/movies/popularstream/PopularMoviesActivity.java
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import com.tobi.movies.ImageLoader;
import com.tobi.movies.MovieApplication;
import com.tobi.movies.R;
import com.tobi.movies.backend.Backend;
import com.tobi.movies.misc.AbstractObserver;
import javax.inject.Inject;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;

package com.tobi.movies.popularstream;





public class PopularMoviesActivity extends AppCompatActivity {

    private static final String TAG = PopularMoviesActivity.class.getSimpleName();
    private static final int POSTER_COL_COUNT = 3;

    @BindView(R.id.popularMovies_recycler)
    RecyclerView popularMoviesRecycler;

    @Inject
    Backend backend;

    @Inject
    ImageLoader imageLoader;

    @Inject
    PopularStreamRepository streamRepository;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_popular_movies);
        ButterKnife.bind(this);
        final MovieApplication movieApplication = (MovieApplication) getApplicationContext();
        movieApplication.getPopularMoviesComponent().inject(this);

        popularMoviesRecycler.setLayoutManager(new GridLayoutManager(this, POSTER_COL_COUNT));
        popularMoviesRecycler.setHasFixedSize(true);

        final Navigator navigator = new Navigator(this);

        streamRepository.getPopularPosters().subscribe(new AbstractObserver<List<MoviePoster>>() {