Skip to content

Launch Screen

Launch screen handles the launcher activity of your mobile application. It has a logo and a title at the top, and buttons and a footer at the bottom. In the middle of the screen, one or more views can be added into a view flipper.

Launch Screen

Screen Class

The screen class provides functionality allowing the client code to change the button label, hook click listeners on the button, and add views into the view flipper, etc.

...
public Button getPrimaryButton() { ... }
public void setPrimaryButtonOnClickListener(OnClickListener listener) { ... }
public void addLaunchInfoView(@NonNull LaunchInfoView view) { ... }
...

Screen Settings Class

The corresponding ScreenSettings class of this screen allows the client code to provide customization information for this screen. It also provides a Builder that allows client code to build an instance.

public Builder setHeaderLineLabel(String headerLineLabel) { ... }
public Builder setPrimaryButtonText(String primaryButtonText) { ... }
public Builder setDemoButtonText(String demoButtonText) { ... }
public Builder setUrlTermsOfService(String urlTermsOfService) { ... }
public Builder setFlipIntervalInMilliseconds(int flipIntervalInMilliseconds) { ... }
public Builder setDemoButtonVisible(boolean demoButtonVisible) { ... }
public Builder setFooterVisible(boolean footerVisible) { ... }
public Builder addInfoViewSettings(LaunchScreenInfoViewSettings infoViewSettings) { ... }
public Builder setUrlEula(String urlEula) { ... }
public Builder setUrlAgreePrivacy(String urlAgreePrivacy) { ... }

After an instance of ScreenSettings is built, it can be passed to the initialize function of the screen to display these customizations.

Example

val welcomeLaunchScreen = LaunchScreen(this)
welcomeLaunchScreen.initialize(
    LaunchScreenSettings.Builder()
        .setDemoButtonVisible(false)
        .setHeaderLineLabel(getString(R.string.welcome_screen_headline_label))
        .setPrimaryButtonText(getString(R.string.welcome_screen_primary_button_label))
        .setFooterVisible(true)
        .setUrlTermsOfService("http://www.sap.com")
        .setEulaAgreeVisibile(true)
        .setUrlEula(("http://www.sap.com")
        .setUrlAgreePrivacy(("http://www.sap.com")
        .addInfoViewSettings(
            LaunchScreenSettings.LaunchScreenInfoViewSettings(
                R.drawable.ic_android_white_circle_24dp,
                getString(R.string.application_name),
                getString(R.string.welcome_screen_detail_label)
            )
        )
        .build()
)
welcomeLaunchScreen.setPrimaryButtonOnClickListener {
    startFlow(this)
}
welcomeLaunchScreen.setAgreeButtonOnClickListener {
    welcomeLaunchScreen.setPrimaryActionEnabled(welcomeLaunchScreen.agreeCheckBox.isChecked)
}
setContentView(welcomeLaunchScreen)
LaunchScreen welcome = new LaunchScreen(this);
welcome.initialize(new LaunchScreenSettings.Builder()
        .setDemoButtonVisible(false)
        .setHeaderLineLabel(getString(R.string.welcome_screen_headline_label))
        .setPrimaryButtonText(getString(R.string.welcome_screen_primary_button_label))
        .setFooterVisible(true)
        .setUrlTermsOfService("http://www.sap.com")
        .setEulaAgreeVisibile(true)
        .setUrlEula(("http://www.sap.com")
        .setUrlAgreePrivacy(("http://www.sap.com")
        .addInfoViewSettings(
                new LaunchScreenSettings.LaunchScreenInfoViewSettings(
                        R.drawable.ic_android_white_circle_24dp,
                        getString(R.string.application_name),
                        getString(R.string.welcome_screen_detail_label)
                )
        ).build());
welcome.setPrimaryButtonOnClickListener(v -> {
        startFlow(this, FlowType.ONBOARDING);
});
welcome.setAgreeButtonOnClickListener(v -> {
        welcome.getPrimaryButton().setEnabled(welcome.getAgreeCheckBox().isChecked());
});
setContentView(welcome);

Last update: June 23, 2023