// Path: app/src/main/java/leonardo2204/com/br/flowtests/di/component/DetailScreenComponent.java
// @DaggerScope(DetailScreenComponent.class)
// @Component(dependencies = ActivityComponent.class, modules = DetailScreenModule.class)
// public interface DetailScreenComponent extends AppComponent {
//     void inject(DetailsView detailsView);
// }
// 
// Path: app/src/main/java/leonardo2204/com/br/flowtests/presenter/ActionBarOwner.java
// @DaggerScope(ActivityComponent.class)
// public class ActionBarOwner extends Presenter<ActionBarOwner.Activity> {
// 
//     private Config config;
// 
//     @Override
//     protected BundleService extractBundleService(Activity view) {
//         return BundleService.getBundleService(view.getContext());
//     }
// 
//     @Override
//     protected void onLoad(Bundle savedInstanceState) {
//         if (config != null) update();
//     }
// 
//     private void update() {
//         if (!hasView()) return;
// 
//         Activity activity = getView();
//         activity.setMenu(config.menuActionList);
//         activity.setShowHomeEnabled(config.showHomeEnabled);
//         activity.setUpButtonEnabled(config.upButtonEnabled);
//         activity.setToolbarTitle(config.title);
//     }
// 
//     public Config getConfig() {
//         return config;
//     }
// 
//     public void setConfig(Config config) {
//         this.config = config;
//         this.update();
//     }
// 
//     public interface Activity {
//         void setMenu(List<MenuAction> menuActionList);
// 
//         void setToolbarTitle(CharSequence title);
// 
//         void setShowHomeEnabled(boolean enabled);
// 
//         void setUpButtonEnabled(boolean enabled);
// 
//         Context getContext();
//     }
// 
//     public static class Config {
//         public final List<MenuAction> menuActionList;
//         public final CharSequence title;
//         public final boolean showHomeEnabled;
//         public final boolean upButtonEnabled;
// 
// 
//         public Config(List<MenuAction> menuActionList, CharSequence title, boolean showHomeEnabled, boolean upButtonEnabled) {
//             this.menuActionList = menuActionList;
//             this.title = title;
//             this.showHomeEnabled = showHomeEnabled;
//             this.upButtonEnabled = upButtonEnabled;
//         }
// 
//         public Config withAction(List<MenuAction> menuActionList) {
//             return new Config(menuActionList, title, showHomeEnabled, upButtonEnabled);
//         }
//     }
// 
//     public static class MenuAction {
//         public final CharSequence title;
//         public final Action0 action;
//         public final int icon;
// 
//         public MenuAction(CharSequence title, Action0 action, int icon) {
//             this.title = title;
//             this.action = action;
//             this.icon = icon;
//         }
//     }
// 
// }
// 
// Path: app/src/main/java/leonardo2204/com/br/flowtests/presenter/DetailsScreenPresenter.java
// @DaggerScope(DetailScreenComponent.class)
// public class DetailsScreenPresenter extends ViewPresenter<DetailsView> {
// 
//     private final GetDetailedContact getDetailedContact;
//     private final ActionBarOwner actionBarOwner;
//     private Contact contact;
// 
//     @Inject
//     public DetailsScreenPresenter(GetDetailedContact getDetailedContact, ActionBarOwner actionBarOwner) {
//         this.getDetailedContact = getDetailedContact;
//         this.actionBarOwner = actionBarOwner;
//     }
// 
//     @Override
//     protected void onLoad(Bundle savedInstanceState) {
//         super.onLoad(savedInstanceState);
//         this.contact = ((DetailsScreen) Flow.getKey(getView())).getContact();
//         Bundle bundle = new Bundle(1);
//         bundle.putParcelable("contact", Parcels.wrap(contact));
//         this.getDetailedContact.execute(new DetailedSubscriber(), bundle);
// 
//         ActionBarOwner.MenuAction menuAction = new ActionBarOwner.MenuAction(contact.getName(), new Action0() {
//             @Override
//             public void call() {
//                 Toast.makeText(getView().getContext(), "Call", Toast.LENGTH_SHORT).show();
//             }
//         }, R.drawable.ic_call_black_24dp);
// 
//         ActionBarOwner.MenuAction menuAction2 = new ActionBarOwner.MenuAction(contact.getName(), new Action0() {
//             @Override
//             public void call() {
//                 Toast.makeText(getView().getContext(), "Call 2", Toast.LENGTH_SHORT).show();
//             }
//         }, R.drawable.ic_call_black_24dp);
// 
//         ActionBarOwner.Config config = new ActionBarOwner.Config(Arrays.asList(menuAction, menuAction2), contact.getName(), false, true);
//         this.actionBarOwner.setConfig(config);
// 
// //        this.toolbarPresenter.setNavigationIcon(R.drawable.ic_arrow_back_black_24dp);
// //        this.toolbarPresenter.setNavigationAction(new View.OnClickListener() {
// //            @Override
// //            public void onClick(View v) {
// //                //noinspection CheckResult
// //                Flow.get(getView()).goBack();
// //            }
// //        });
//     }
// 
//     @Override
//     protected void onExitScope() {
//         super.onExitScope();
//         this.getDetailedContact.unsubscribe();
//     }
// 
//     class DetailedSubscriber extends DefaultSubscriber<Contact> {
// 
//         @Override
//         public void onNext(Contact contact) {
//             if (getView() != null) {
//                 getView().setTelephoneField(contact.getTelephone());
//             }
//         }
// 
//         @Override
//         public void onError(Throwable e) {
//             if(getView() != null)
//                 Toast.makeText(getView().getContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
//         }
//     }
// }


import dagger.Module;
import dagger.Provides;
import leonardo2204.com.br.flowtests.di.component.DetailScreenComponent;
import leonardo2204.com.br.flowtests.di.scope.DaggerScope;
import leonardo2204.com.br.flowtests.domain.executor.PostExecutionThread;
import leonardo2204.com.br.flowtests.domain.executor.ThreadExecutor;
import leonardo2204.com.br.flowtests.domain.interactor.GetDetailedContact;
import leonardo2204.com.br.flowtests.domain.repository.ContactsRepository;
import leonardo2204.com.br.flowtests.presenter.ActionBarOwner;
import leonardo2204.com.br.flowtests.presenter.DetailsScreenPresenter;
package leonardo2204.com.br.flowtests.di.module;


/**
 * Created by Leonardo on 05/03/2016.
 */
@Module
public class DetailScreenModule {

    @Provides
// Path: app/src/main/java/leonardo2204/com/br/flowtests/di/component/DetailScreenComponent.java
// @DaggerScope(DetailScreenComponent.class)
// @Component(dependencies = ActivityComponent.class, modules = DetailScreenModule.class)
// public interface DetailScreenComponent extends AppComponent {
//     void inject(DetailsView detailsView);
// }
// 
// Path: app/src/main/java/leonardo2204/com/br/flowtests/presenter/ActionBarOwner.java
// @DaggerScope(ActivityComponent.class)
// public class ActionBarOwner extends Presenter<ActionBarOwner.Activity> {
// 
//     private Config config;
// 
//     @Override
//     protected BundleService extractBundleService(Activity view) {
//         return BundleService.getBundleService(view.getContext());
//     }
// 
//     @Override
//     protected void onLoad(Bundle savedInstanceState) {
//         if (config != null) update();
//     }
// 
//     private void update() {
//         if (!hasView()) return;
// 
//         Activity activity = getView();
//         activity.setMenu(config.menuActionList);
//         activity.setShowHomeEnabled(config.showHomeEnabled);
//         activity.setUpButtonEnabled(config.upButtonEnabled);
//         activity.setToolbarTitle(config.title);
//     }
// 
//     public Config getConfig() {
//         return config;
//     }
// 
//     public void setConfig(Config config) {
//         this.config = config;
//         this.update();
//     }
// 
//     public interface Activity {
//         void setMenu(List<MenuAction> menuActionList);
// 
//         void setToolbarTitle(CharSequence title);
// 
//         void setShowHomeEnabled(boolean enabled);
// 
//         void setUpButtonEnabled(boolean enabled);
// 
//         Context getContext();
//     }
// 
//     public static class Config {
//         public final List<MenuAction> menuActionList;
//         public final CharSequence title;
//         public final boolean showHomeEnabled;
//         public final boolean upButtonEnabled;
// 
// 
//         public Config(List<MenuAction> menuActionList, CharSequence title, boolean showHomeEnabled, boolean upButtonEnabled) {
//             this.menuActionList = menuActionList;
//             this.title = title;
//             this.showHomeEnabled = showHomeEnabled;
//             this.upButtonEnabled = upButtonEnabled;
//         }
// 
//         public Config withAction(List<MenuAction> menuActionList) {
//             return new Config(menuActionList, title, showHomeEnabled, upButtonEnabled);
//         }
//     }
// 
//     public static class MenuAction {
//         public final CharSequence title;
//         public final Action0 action;
//         public final int icon;
// 
//         public MenuAction(CharSequence title, Action0 action, int icon) {
//             this.title = title;
//             this.action = action;
//             this.icon = icon;
//         }
//     }
// 
// }
// 
// Path: app/src/main/java/leonardo2204/com/br/flowtests/presenter/DetailsScreenPresenter.java
// @DaggerScope(DetailScreenComponent.class)
// public class DetailsScreenPresenter extends ViewPresenter<DetailsView> {
// 
//     private final GetDetailedContact getDetailedContact;
//     private final ActionBarOwner actionBarOwner;
//     private Contact contact;
// 
//     @Inject
//     public DetailsScreenPresenter(GetDetailedContact getDetailedContact, ActionBarOwner actionBarOwner) {
//         this.getDetailedContact = getDetailedContact;
//         this.actionBarOwner = actionBarOwner;
//     }
// 
//     @Override
//     protected void onLoad(Bundle savedInstanceState) {
//         super.onLoad(savedInstanceState);
//         this.contact = ((DetailsScreen) Flow.getKey(getView())).getContact();
//         Bundle bundle = new Bundle(1);
//         bundle.putParcelable("contact", Parcels.wrap(contact));
//         this.getDetailedContact.execute(new DetailedSubscriber(), bundle);
// 
//         ActionBarOwner.MenuAction menuAction = new ActionBarOwner.MenuAction(contact.getName(), new Action0() {
//             @Override
//             public void call() {
//                 Toast.makeText(getView().getContext(), "Call", Toast.LENGTH_SHORT).show();
//             }
//         }, R.drawable.ic_call_black_24dp);
// 
//         ActionBarOwner.MenuAction menuAction2 = new ActionBarOwner.MenuAction(contact.getName(), new Action0() {
//             @Override
//             public void call() {
//                 Toast.makeText(getView().getContext(), "Call 2", Toast.LENGTH_SHORT).show();
//             }
//         }, R.drawable.ic_call_black_24dp);
// 
//         ActionBarOwner.Config config = new ActionBarOwner.Config(Arrays.asList(menuAction, menuAction2), contact.getName(), false, true);
//         this.actionBarOwner.setConfig(config);
// 
// //        this.toolbarPresenter.setNavigationIcon(R.drawable.ic_arrow_back_black_24dp);
// //        this.toolbarPresenter.setNavigationAction(new View.OnClickListener() {
// //            @Override
// //            public void onClick(View v) {
// //                //noinspection CheckResult
// //                Flow.get(getView()).goBack();
// //            }
// //        });
//     }
// 
//     @Override
//     protected void onExitScope() {
//         super.onExitScope();
//         this.getDetailedContact.unsubscribe();
//     }
// 
//     class DetailedSubscriber extends DefaultSubscriber<Contact> {
// 
//         @Override
//         public void onNext(Contact contact) {
//             if (getView() != null) {
//                 getView().setTelephoneField(contact.getTelephone());
//             }
//         }
// 
//         @Override
//         public void onError(Throwable e) {
//             if(getView() != null)
//                 Toast.makeText(getView().getContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
//         }
//     }
// }


// Path: app/src/main/java/leonardo2204/com/br/flowtests/di/module/DetailScreenModule.java
import dagger.Module;
import dagger.Provides;
import leonardo2204.com.br.flowtests.di.component.DetailScreenComponent;
import leonardo2204.com.br.flowtests.di.scope.DaggerScope;
import leonardo2204.com.br.flowtests.domain.executor.PostExecutionThread;
import leonardo2204.com.br.flowtests.domain.executor.ThreadExecutor;
import leonardo2204.com.br.flowtests.domain.interactor.GetDetailedContact;
import leonardo2204.com.br.flowtests.domain.repository.ContactsRepository;
import leonardo2204.com.br.flowtests.presenter.ActionBarOwner;
import leonardo2204.com.br.flowtests.presenter.DetailsScreenPresenter;

package leonardo2204.com.br.flowtests.di.module;


/**
 * Created by Leonardo on 05/03/2016.
 */
@Module
public class DetailScreenModule {

    @Provides
    @DaggerScope(DetailScreenComponent.class)