@Test public void bindExpansionDisplaysTitleTextViewsProperly() throws Exception { final Expansion testExpansion = Expansion.generateTemperatureTestCase(State.NOT_CONFIGURED); configSelectionFragment.bindExpansion(testExpansion); assertEquals("Connected to " + testExpansion.getCompanyName(), configSelectionFragment.presenterView.getTitleText()); assertEquals("Select the " + testExpansion.getConfigurationType() + " that Sense will control.", configSelectionFragment.presenterView.getSubtitleText()); }
@VisibleForTesting public void bindExpansion(@Nullable final Expansion expansion) { if (expansion != null) { this.expansion = expansion; presenterView.setTitle(getString(R.string.expansions_configuration_selection_title_format, expansion.getCompanyName())); presenterView.setSubtitle(getString(R.string.expansions_configuration_selection_subtitle_format, expansion.getConfigurationType())); configurationsInteractor.setExpansionId(expansion.getId()); if (expansion.requiresConfiguration() || expansion.isConnected()) { configurationsInteractor.update(); } else { bindConfigurations(null); } }else { cancelFlow(); } }
ConfigSelectionFragment extends PresenterFragment<ConfigSelectionView> implements ArrayRecyclerAdapter.OnItemClickedListener<Configuration>,
        OnBackPressedInterceptor { @VisibleForTesting public void bindExpansion(@Nullable final Expansion expansion) { if (expansion != null) { this.expansion = expansion; presenterView.setTitle(getString(R.string.expansions_configuration_selection_title_format, expansion.getCompanyName())); presenterView.setSubtitle(getString(R.string.expansions_configuration_selection_subtitle_format, expansion.getConfigurationType())); configurationsInteractor.setExpansionId(expansion.getId()); if (expansion.requiresConfiguration() || expansion.isConnected()) { configurationsInteractor.update(); } else { bindConfigurations(null); } }else { cancelFlow(); } } }
ConfigSelectionFragment extends PresenterFragment<ConfigSelectionView> implements ArrayRecyclerAdapter.OnItemClickedListener<Configuration>,
        OnBackPressedInterceptor { @VisibleForTesting public void bindExpansion(@Nullable final Expansion expansion) { if (expansion != null) { this.expansion = expansion; presenterView.setTitle(getString(R.string.expansions_configuration_selection_title_format, expansion.getCompanyName())); presenterView.setSubtitle(getString(R.string.expansions_configuration_selection_subtitle_format, expansion.getConfigurationType())); configurationsInteractor.setExpansionId(expansion.getId()); if (expansion.requiresConfiguration() || expansion.isConnected()) { configurationsInteractor.update(); } else { bindConfigurations(null); } }else { cancelFlow(); } }  }
ConfigSelectionFragment extends PresenterFragment<ConfigSelectionView> implements ArrayRecyclerAdapter.OnItemClickedListener<Configuration>,
        OnBackPressedInterceptor { @VisibleForTesting public void bindExpansion(@Nullable final Expansion expansion) { if (expansion != null) { this.expansion = expansion; presenterView.setTitle(getString(R.string.expansions_configuration_selection_title_format, expansion.getCompanyName())); presenterView.setSubtitle(getString(R.string.expansions_configuration_selection_subtitle_format, expansion.getConfigurationType())); configurationsInteractor.setExpansionId(expansion.getId()); if (expansion.requiresConfiguration() || expansion.isConnected()) { configurationsInteractor.update(); } else { bindConfigurations(null); } }else { cancelFlow(); } }  @Override void onAttach(@NonNull final Activity activity); @Override void onCreate(final Bundle savedInstanceState); @Override void initializePresenterView(); @Override void onViewCreated(final View view, final Bundle savedInstanceState); @Override void onDestroyView(); @Override void onResume(); @Override void onItemClicked(final int position, @NonNull final Configuration item); @Override boolean onInterceptBackPressed(@NonNull final Runnable defaultBehavior); @VisibleForTesting void bindExpansion(@Nullable final Expansion expansion); @VisibleForTesting void bindConfigurations(@Nullable final List<Configuration> configurations); @VisibleForTesting void bindConfigurationPostResponse(@NonNull final Configuration configuration); @VisibleForTesting void presentError(@NonNull final Throwable e); }
ConfigSelectionFragment extends PresenterFragment<ConfigSelectionView> implements ArrayRecyclerAdapter.OnItemClickedListener<Configuration>,
        OnBackPressedInterceptor { @VisibleForTesting public void bindExpansion(@Nullable final Expansion expansion) { if (expansion != null) { this.expansion = expansion; presenterView.setTitle(getString(R.string.expansions_configuration_selection_title_format, expansion.getCompanyName())); presenterView.setSubtitle(getString(R.string.expansions_configuration_selection_subtitle_format, expansion.getConfigurationType())); configurationsInteractor.setExpansionId(expansion.getId()); if (expansion.requiresConfiguration() || expansion.isConnected()) { configurationsInteractor.update(); } else { bindConfigurations(null); } }else { cancelFlow(); } }  @Override void onAttach(@NonNull final Activity activity); @Override void onCreate(final Bundle savedInstanceState); @Override void initializePresenterView(); @Override void onViewCreated(final View view, final Bundle savedInstanceState); @Override void onDestroyView(); @Override void onResume(); @Override void onItemClicked(final int position, @NonNull final Configuration item); @Override boolean onInterceptBackPressed(@NonNull final Runnable defaultBehavior); @VisibleForTesting void bindExpansion(@Nullable final Expansion expansion); @VisibleForTesting void bindConfigurations(@Nullable final List<Configuration> configurations); @VisibleForTesting void bindConfigurationPostResponse(@NonNull final Configuration configuration); @VisibleForTesting void presentError(@NonNull final Throwable e); static final String EXPANSION_ID_KEY; static final String EXPANSION_CATEGORY; static final int RESULT_CONFIG_SELECTED; }