@@ -0,0 +1,1872 @@
+package com.tobi.movies.posterdetails;%0A%0Aimport android.support.annotation.Nullable;%0A%0Aimport rx.Observer;%0Aimport rx.Subscription;%0A%0Apublic class MovieDetailsUseCase implements MovieDetailsMVP.Model %7B%0A%0A    private static final Listener NO_OP_LISTENER = new Listener() %7B%0A%0A        @Override%0A        public void onMovieDetails(MovieDetails movieDetails) %7B%0A            //no op%0A        %7D%0A%0A        @Override%0A        public void onError(Throwable throwable) %7B%0A            // nop op%0A        %7D%0A    %7D;%0A%0A    interface Listener %7B%0A        void onMovieDetails(MovieDetails movieDetails);%0A%0A        void onError(Throwable throwable);%0A    %7D%0A%0A    private final MovieDetailsRepository repository;%0A%0A    @Nullable%0A    private Subscription subscription;%0A    private Listener listener = NO_OP_LISTENER;%0A%0A    public MovieDetailsUseCase(MovieDetailsRepository repository) %7B%0A        this.repository = repository;%0A    %7D%0A%0A    @Nullable%0A    private MovieDetails movieDetails;%0A%0A    @Override%0A    @Nullable%0A    public MovieDetails getMovieDetails() %7B%0A        return movieDetails;%0A    %7D%0A%0A    @Override%0A    public void loadMovieDetails(long movieId) %7B%0A        if (subscription != null) %7B%0A            subscription.unsubscribe();%0A        %7D%0A%0A        subscription = repository.getMovieDetails(movieId).subscribe(new Observer%3CMovieDetails%3E() %7B%0A            @Override%0A            public void onCompleted() %7B%0A%0A            %7D%0A%0A            @Override%0A            public void onError(Throwable e) %7B%0A                listener.onError(e);%0A            %7D%0A%0A            @Override%0A            public void onNext(MovieDetails movieDetails) %7B%0A                MovieDetailsUseCase.this.movieDetails = movieDetails;%0A                listener.onMovieDetails(movieDetails);%0A            %7D%0A        %7D);%0A    %7D%0A%0A    void setListener(@Nullable Listener listener) %7B%0A        this.listener = listener == null ? NO_OP_LISTENER : listener;%0A    %7D%0A%7D%0A

Introduce MovieDetailsUseCase