@Test public void onViewCreated() { spyOnPresenterView(); callOnViewCreated(); verify(fragment.presenterView).setTabListener(fragment); verify(fragment.presenterView).setCurrentItem(STARTING_FRAGMENT_POSITION); verify(fragment).addInteractor(fragment.deviceIssuesInteractor); verify(fragment).addInteractor(fragment.alertsInteractor); verify(fragment).addInteractor(fragment.lastNightInteractor); verify(fragment).addInteractor(fragment.unreadStateInteractor); verify(fragment).bindAndSubscribe(eq(fragment.alertsInteractor.alert), any(), any()); verify(fragment).bindAndSubscribe(eq(fragment.lastNightInteractor.timeline), any(), any()); verify(fragment).bindAndSubscribe(eq(fragment.unreadStateInteractor.hasUnreadItems), any(), any()); verify(fragment).checkInForUpdates(); }
@Override public void onViewCreated(final View view, final Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (!(getActivity() instanceof Scope)) { throw new IllegalStateException("Activity must implement Scope"); } if (!(getActivity() instanceof OnboardingFlowProvider)) { throw new IllegalStateException("Activity must implement OnboardingFlowProvider"); } this.deviceIssuesInteractor.bindScope((Scope) getActivity()); addInteractor(this.deviceIssuesInteractor); addInteractor(this.alertsInteractor); addInteractor(this.lastNightInteractor); addInteractor(this.unreadStateInteractor); addInteractor(this.nightModeInteractor); if (savedInstanceState == null) { final Bundle args = getArguments(); if (args != null) { this.shouldShowAlerts = args.getBoolean(EXTRA_HOME_SHOW_ALERTS, true); this.presenterView.setCurrentItem(args.getInt(EXTRA_HOME_NAV_INDEX, this.viewPagerDelegate.getStartingItemPosition())); } else { this.shouldShowAlerts = true; this.presenterView.setCurrentItem(this.viewPagerDelegate.getStartingItemPosition()); } } else { this.shouldShowAlerts = false; } this.presenterView.setTabListener(this); if (shouldUpdateDeviceIssues()) { bindAndSubscribe(this.deviceIssuesInteractor.topIssue, this::bindDeviceIssue, Functions.LOG_ERROR); } this.alertsInteractor.alert.forget(); bindAndSubscribe(this.alertsInteractor.alert, this::bindAlert, Functions.LOG_ERROR); bindAndSubscribe(this.lastNightInteractor.timeline, this::bindLastNightTimeline, Functions.LOG_ERROR); bindAndSubscribe(this.unreadStateInteractor.hasUnreadItems, this::bindUnreadItems, Functions.LOG_ERROR); this.lastNightInteractor.update(); this.unreadStateInteractor.update(); checkInForUpdates(); }
HomePresenterFragment extends PresenterFragment<HomeView> implements
        OnBackPressedInterceptor,
        HomeTabLayout.Listener,
        TimelineFragment.ParentProvider,
        InsightInfoFragment.ParentProvider,
        Alert.ActionHandler { @Override public void onViewCreated(final View view, final Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (!(getActivity() instanceof Scope)) { throw new IllegalStateException("Activity must implement Scope"); } if (!(getActivity() instanceof OnboardingFlowProvider)) { throw new IllegalStateException("Activity must implement OnboardingFlowProvider"); } this.deviceIssuesInteractor.bindScope((Scope) getActivity()); addInteractor(this.deviceIssuesInteractor); addInteractor(this.alertsInteractor); addInteractor(this.lastNightInteractor); addInteractor(this.unreadStateInteractor); addInteractor(this.nightModeInteractor); if (savedInstanceState == null) { final Bundle args = getArguments(); if (args != null) { this.shouldShowAlerts = args.getBoolean(EXTRA_HOME_SHOW_ALERTS, true); this.presenterView.setCurrentItem(args.getInt(EXTRA_HOME_NAV_INDEX, this.viewPagerDelegate.getStartingItemPosition())); } else { this.shouldShowAlerts = true; this.presenterView.setCurrentItem(this.viewPagerDelegate.getStartingItemPosition()); } } else { this.shouldShowAlerts = false; } this.presenterView.setTabListener(this); if (shouldUpdateDeviceIssues()) { bindAndSubscribe(this.deviceIssuesInteractor.topIssue, this::bindDeviceIssue, Functions.LOG_ERROR); } this.alertsInteractor.alert.forget(); bindAndSubscribe(this.alertsInteractor.alert, this::bindAlert, Functions.LOG_ERROR); bindAndSubscribe(this.lastNightInteractor.timeline, this::bindLastNightTimeline, Functions.LOG_ERROR); bindAndSubscribe(this.unreadStateInteractor.hasUnreadItems, this::bindUnreadItems, Functions.LOG_ERROR); this.lastNightInteractor.update(); this.unreadStateInteractor.update(); checkInForUpdates(); } }
HomePresenterFragment extends PresenterFragment<HomeView> implements
        OnBackPressedInterceptor,
        HomeTabLayout.Listener,
        TimelineFragment.ParentProvider,
        InsightInfoFragment.ParentProvider,
        Alert.ActionHandler { @Override public void onViewCreated(final View view, final Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (!(getActivity() instanceof Scope)) { throw new IllegalStateException("Activity must implement Scope"); } if (!(getActivity() instanceof OnboardingFlowProvider)) { throw new IllegalStateException("Activity must implement OnboardingFlowProvider"); } this.deviceIssuesInteractor.bindScope((Scope) getActivity()); addInteractor(this.deviceIssuesInteractor); addInteractor(this.alertsInteractor); addInteractor(this.lastNightInteractor); addInteractor(this.unreadStateInteractor); addInteractor(this.nightModeInteractor); if (savedInstanceState == null) { final Bundle args = getArguments(); if (args != null) { this.shouldShowAlerts = args.getBoolean(EXTRA_HOME_SHOW_ALERTS, true); this.presenterView.setCurrentItem(args.getInt(EXTRA_HOME_NAV_INDEX, this.viewPagerDelegate.getStartingItemPosition())); } else { this.shouldShowAlerts = true; this.presenterView.setCurrentItem(this.viewPagerDelegate.getStartingItemPosition()); } } else { this.shouldShowAlerts = false; } this.presenterView.setTabListener(this); if (shouldUpdateDeviceIssues()) { bindAndSubscribe(this.deviceIssuesInteractor.topIssue, this::bindDeviceIssue, Functions.LOG_ERROR); } this.alertsInteractor.alert.forget(); bindAndSubscribe(this.alertsInteractor.alert, this::bindAlert, Functions.LOG_ERROR); bindAndSubscribe(this.lastNightInteractor.timeline, this::bindLastNightTimeline, Functions.LOG_ERROR); bindAndSubscribe(this.unreadStateInteractor.hasUnreadItems, this::bindUnreadItems, Functions.LOG_ERROR); this.lastNightInteractor.update(); this.unreadStateInteractor.update(); checkInForUpdates(); }  }
HomePresenterFragment extends PresenterFragment<HomeView> implements
        OnBackPressedInterceptor,
        HomeTabLayout.Listener,
        TimelineFragment.ParentProvider,
        InsightInfoFragment.ParentProvider,
        Alert.ActionHandler { @Override public void onViewCreated(final View view, final Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (!(getActivity() instanceof Scope)) { throw new IllegalStateException("Activity must implement Scope"); } if (!(getActivity() instanceof OnboardingFlowProvider)) { throw new IllegalStateException("Activity must implement OnboardingFlowProvider"); } this.deviceIssuesInteractor.bindScope((Scope) getActivity()); addInteractor(this.deviceIssuesInteractor); addInteractor(this.alertsInteractor); addInteractor(this.lastNightInteractor); addInteractor(this.unreadStateInteractor); addInteractor(this.nightModeInteractor); if (savedInstanceState == null) { final Bundle args = getArguments(); if (args != null) { this.shouldShowAlerts = args.getBoolean(EXTRA_HOME_SHOW_ALERTS, true); this.presenterView.setCurrentItem(args.getInt(EXTRA_HOME_NAV_INDEX, this.viewPagerDelegate.getStartingItemPosition())); } else { this.shouldShowAlerts = true; this.presenterView.setCurrentItem(this.viewPagerDelegate.getStartingItemPosition()); } } else { this.shouldShowAlerts = false; } this.presenterView.setTabListener(this); if (shouldUpdateDeviceIssues()) { bindAndSubscribe(this.deviceIssuesInteractor.topIssue, this::bindDeviceIssue, Functions.LOG_ERROR); } this.alertsInteractor.alert.forget(); bindAndSubscribe(this.alertsInteractor.alert, this::bindAlert, Functions.LOG_ERROR); bindAndSubscribe(this.lastNightInteractor.timeline, this::bindLastNightTimeline, Functions.LOG_ERROR); bindAndSubscribe(this.unreadStateInteractor.hasUnreadItems, this::bindUnreadItems, Functions.LOG_ERROR); this.lastNightInteractor.update(); this.unreadStateInteractor.update(); checkInForUpdates(); }  static HomePresenterFragment newInstance(@Nullable final Bundle args); @Override void initializePresenterView(); @Override void onViewCreated(final View view,
                              final Bundle savedInstanceState); @Override void onPause(); @Override void onResume(); @Override boolean onInterceptBackPressed(@NonNull final Runnable defaultBehavior); @Override void scrollUp(final int fragmentPosition); @Override void tabChanged(final int fragmentPosition); @Nullable @Override Timeline getCurrentTimeline(); @Nullable @Override TimelineFragment.Parent getTimelineParent(); @Nullable @Override InsightInfoFragment.Parent provideInsightInfoParent(); @Override void handleAlert(@NonNull final Category alertCategory); void forwardNotification(@NonNull final Notification notification); void showProgressOverlay(final boolean show); void jumpToLastNight(); void checkInForUpdates(); int getCurrentTabPosition(); void selectTimelineTab(); void selectTrendsTab(); void selectFeedTab(); void selectSoundTab(); void selectConditionsTab(); }
HomePresenterFragment extends PresenterFragment<HomeView> implements
        OnBackPressedInterceptor,
        HomeTabLayout.Listener,
        TimelineFragment.ParentProvider,
        InsightInfoFragment.ParentProvider,
        Alert.ActionHandler { @Override public void onViewCreated(final View view, final Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (!(getActivity() instanceof Scope)) { throw new IllegalStateException("Activity must implement Scope"); } if (!(getActivity() instanceof OnboardingFlowProvider)) { throw new IllegalStateException("Activity must implement OnboardingFlowProvider"); } this.deviceIssuesInteractor.bindScope((Scope) getActivity()); addInteractor(this.deviceIssuesInteractor); addInteractor(this.alertsInteractor); addInteractor(this.lastNightInteractor); addInteractor(this.unreadStateInteractor); addInteractor(this.nightModeInteractor); if (savedInstanceState == null) { final Bundle args = getArguments(); if (args != null) { this.shouldShowAlerts = args.getBoolean(EXTRA_HOME_SHOW_ALERTS, true); this.presenterView.setCurrentItem(args.getInt(EXTRA_HOME_NAV_INDEX, this.viewPagerDelegate.getStartingItemPosition())); } else { this.shouldShowAlerts = true; this.presenterView.setCurrentItem(this.viewPagerDelegate.getStartingItemPosition()); } } else { this.shouldShowAlerts = false; } this.presenterView.setTabListener(this); if (shouldUpdateDeviceIssues()) { bindAndSubscribe(this.deviceIssuesInteractor.topIssue, this::bindDeviceIssue, Functions.LOG_ERROR); } this.alertsInteractor.alert.forget(); bindAndSubscribe(this.alertsInteractor.alert, this::bindAlert, Functions.LOG_ERROR); bindAndSubscribe(this.lastNightInteractor.timeline, this::bindLastNightTimeline, Functions.LOG_ERROR); bindAndSubscribe(this.unreadStateInteractor.hasUnreadItems, this::bindUnreadItems, Functions.LOG_ERROR); this.lastNightInteractor.update(); this.unreadStateInteractor.update(); checkInForUpdates(); }  static HomePresenterFragment newInstance(@Nullable final Bundle args); @Override void initializePresenterView(); @Override void onViewCreated(final View view,
                              final Bundle savedInstanceState); @Override void onPause(); @Override void onResume(); @Override boolean onInterceptBackPressed(@NonNull final Runnable defaultBehavior); @Override void scrollUp(final int fragmentPosition); @Override void tabChanged(final int fragmentPosition); @Nullable @Override Timeline getCurrentTimeline(); @Nullable @Override TimelineFragment.Parent getTimelineParent(); @Nullable @Override InsightInfoFragment.Parent provideInsightInfoParent(); @Override void handleAlert(@NonNull final Category alertCategory); void forwardNotification(@NonNull final Notification notification); void showProgressOverlay(final boolean show); void jumpToLastNight(); void checkInForUpdates(); int getCurrentTabPosition(); void selectTimelineTab(); void selectTrendsTab(); void selectFeedTab(); void selectSoundTab(); void selectConditionsTab(); static final String TAG; }