no-translate

Change the color scheme of your chat widget

You can use one of our predefined themes or configure your chat appearance by yourself!
Napisany przez Alex
Zaktualizowano 6 miesięcy temu

HCTheme.Builder is pretty self-explanatory. To change how a chat screen looks like, you can use one of the three methods. They will return the instance of HCTheme, which you can configure in any way you want.

Default theme

HCTheme.Builder(HCTheme.Type.DEFAULT)

Dark theme

HCTheme.Builder(HCTheme.Type.DARK)

Custom main color theme

HCTheme.Builder(R.color.main_color, shouldPaintIconsAutomatically: true)

Example

Attach a theme during initialization:

Java:

HCTheme theme = new HCTheme.Builder(HCTheme.Type.DEFAULT).build()

HCOptions options = new HCOptions.Builder()
        .setTheme(theme)
        .build();

HelpCrunch.initialize(this, ORGANISATION, APP_ID, SECRET, (HCUser) null, options);

Kotlin:

val theme = HCTheme.Builder(HCTheme.Type.DEFAULT).build()

val options = HCOptions.Builder()
        .setTheme(theme)
        .build()

HelpCrunch.initialize(this, ORGANISATION, APP_ID, SECRET, options = options)

Attach a theme when starting a chat screen:

Java:

HCTheme theme = new HCTheme.Builder(HCTheme.Type.DEFAULT).build()

HCOptions options = new HCOptions.Builder()
        .setTheme(theme)
        .build();

HelpCrunch.showChatScreen(context, options);

Kotlin:

val theme = HCTheme.Builder(HCTheme.Type.DEFAULT).build()

val options = HCOptions.Builder()
        .setTheme(theme)
        .build()

HelpCrunch.showChatScreen(context, options)

Czy odpowiedzieliśmy na Twoje pytanie?