Configuring the SDK activities

Start each of the SDK's Activity classes using its builder. The builders provide handy methods for configuring different aspects of how the activity looks and behaves. Each activity can start at least one other activity, and multi-activity flows are possible. For example, the HelpCenterActivity can start ViewArticleActivity, RequestListActivity, and RequestActivity - and each of these can in turn start instances of each other. You can provide your configurations upfront to ensure that the SDK looks and behaves the way you want it to, regardless of which activity you started or where the user went from there.

Creating a UiConfig

Each activity builder has a config() method which returns an instance of that activity's UiConfig, which contains all the options you've set on the builder:

UiConfig helpCenterConfig = HelpCenterActivity.builder()
        .withContactUsButtonVisible(false)
        .withLabelNames("my", "labels")
        .config();

Starting an Activity with UiConfigs

You can use these UiConfig objects when calling the show or intent methods of any builder. These take a Context and optional UiConfigs (as a List or as varargs). This allows you to start one Support SDK activity and include a configuration for any number of other Support SDK activity classes. All of the following are valid:

UiConfig config1 = ...;

UiConfig config2 = ...;

UiConfig config3 = ...;

List<UiConfig> configList = Arrays.asList(config1, config2, config3);

HelpCenterActivity.builder()
        .show(context);

HelpCenterActivity.builder()
        .show(context, config1, config3);

HelpCenterActivity.builder()
        .show(context, configList);

Creating an Activity Intent

If you want to configure an activity, but don't want to start it straight away, you can use the builder's intent method. This returns a regular Android Intent, which you can start in the usual way whenever you like.

Intent intent = HelpCenterActivity.builder()
        .intent(context, configList);

startActivity(intent);

Using multiple UiConfigs

The SDK supports configuring each activity once for each "entry-point" to the SDK. Each call to show on a builder, or starting a builder's Intent, can be considered an entry-point. For example, you can configure RequestActivity and pass its UiConfig when starting HelpCenterActivity. That configuration will be used for any instance of RequestActivity started subsequently, regardless of whether it is started by HelpCenterActivity, ViewArticleActivity or RequestListActivity.

It's not possible to configure multiple versions of UiConfig for the same activity, to be used depending on how the user got there. The SDK will iterate through the collection and use the first appropriate UiConfig that it finds.

 UiConfig config1 = ...; // Instance of RequestUiConfig

 UiConfig config2 = ...; // Instance of RequestUiConfig

 UiConfig config3 = ...; // Instance of RequestUiConfig

 HelpCenterActivity.builder()
         .show(context, config1, config2, config3); // This is effectively the same as the line below.

 HelpCenterActivity.builder()
          .show(context, config1);

It is possible to configure multiple versions of UiConfig for the same activity if you are using them for different entry-points to the SDK.

UiConfig config1 = ...; // Instance of RequestUiConfig

UiConfig config2 = ...; // Instance of RequestUiConfig

UiConfig config3 = ...; // Instance of RequestUiConfig

HelpCenterActivity.builder()
        .show(context, config1);

RequestListActivity.builder()
        .show(context, config2);

ViewArticleActivity.builder()
        .show(context, config3);

For more details, see the the Activity builders reference.