# Customization

# Support Items

Support items define the ways in which your users will be prompted to contact you on the Support screen. By default the SDK uses the following item:

private val DEFAULT_SUPPORT_ITEM = SNSSupportItem(
    R.string.sns_support_EMAIL_title,
    R.string.sns_support_EMAIL_description,
    R.drawable.sns_ic_email,
    SNSSupportItem.Type.Email,
    "[email protected]")

if you want to change the support items you should create a new list:

val supportItems = listOf(SNSSupportItem(
    R.string.google_title,
    R.string.google_subtitle,
    R.drawable.ic_google,
    SNSSupportItem.Type.Email,
    "[email protected]")
)
val snsSdkBuilder = SNSMobileSDK.Builder(this, apiUrl).withSupportItems(supportItems)

Each item must have a mandatory title, icon, subtitle, type and value. onClick listener is optional. By default the SDK handles clicks if a support item were an email or a url, but if you want to change this behavior you can implement your own onClick listener and handle it by yourself. For example:

val supportItems = listOf(SNSSupportItem(
    R.string.google_title,
    R.string.google_subtitle,
    R.drawable.ic_google,
    SNSSupportItem.Type.Email,
    "[email protected]", onClick = { item ->
        // to do something
    })
)

val snsSdkBuilder = SNSMobileSDK.Builder(this, apiUrl).withSupportItems(supportItems)

The support item can be one of three types:

enum class Type {
  Url,
  Email,
  Custom
}

If, for some reason, you wish to use Type.Custom, please make sure that you have implemented the onClick listener.

# Theme

The SDK uses material components theme for the widgets. If you want to change a color, typeface, etc., you should override the following theme:

# Base Theme

<style name="Theme.SNSCore" parent="Theme.MaterialComponents.DayNight.NoActionBar">
 <item name="colorAccent">@color/sns_blue</item>
 <item name="android:windowBackground">@color/sns_white</item>
 <item name="android:colorBackground">@color/sns_white</item>
 <item name="android:textViewStyle">@style/Widget.SNSTextView</item>
 <item name="materialButtonStyle">@style/Widget.SNSButton</item>
 <item name="materialAlertDialogTheme">@style/Widget.SNSMaterialDialogAlert</item>
</style>

# Base Widgets

# TextView

<style name="Widget.SNSTextView" parent="@style/Widget.MaterialComponents.TextView">
 <item name="android:textColorLink">@color/sns_blue</item>
</style>

# Button

# Filled
<style name="Widget.SNSButton" parent="Widget.MaterialComponents.Button.UnelevatedButton">
 <item name="android:fontFamily">sans-serif-light</item>
 <item name="android:textSize">16sp</item>
 <item name="android:textColor">@color/sns_white</item>
 <item name="android:textAllCaps">false</item>
 <item name="cornerRadius">8dp</item>
 <item name="backgroundTint">@color/sns_blue</item>
</style>
# Outlined
<style name="Widget.SNSButton.Outlined" parent="Widget.MaterialComponents.Button.OutlinedButton">
 <item name="android:fontFamily">sans-serif-light</item>
 <item name="android:textSize">16sp</item>
 <item name="android:textColor">@color/sns_blue</item>
 <item name="android:textAllCaps">false</item>
 <item name="cornerRadius">8dp</item>
 <item name="strokeColor">@color/sns_blue</item>
</style>
# Text
<style name="Widget.SNSButton.Text" parent="Widget.MaterialComponents.Button.TextButton">
 <item name="android:fontFamily">sans-serif-light</item>
 <item name="android:textSize">16sp</item>
 <item name="android:textColor">@color/sns_blue</item>
 <item name="android:textAllCaps">false</item>
</style>

# Alert Dialog

<style name="Widget.SNSMaterialDialogAlert" parent="ThemeOverlay.MaterialComponents.Dialog.Alert">
 <item name="materialAlertDialogBodyTextStyle">@style/TextAppearance.SNSMaterialDialogAlert.Body</item>
 <item name="buttonBarPositiveButtonStyle">@style/Widget.SNSMaterialDialogAlert.Button.Positive</item>
 <item name="buttonBarNegativeButtonStyle">@style/Widget.SNSMaterialDialogAlert.Button.Negative</item>
</style>

<style name="Widget.SNSMaterialDialogAlert.Button.Positive" parent="@style/Widget.MaterialComponents.Button.TextButton.Dialog">
 <item name="android:textColor">@color/sns_blue</item>
 <item name="android:fontFamily">sans-serif-light</item>
 <item name="fontFamily">sans-serif-light</item>
</style>

<style name="Widget.SNSMaterialDialogAlert.Button.Negative" parent="@style/Widget.MaterialComponents.Button.TextButton.Dialog">
 <item name="android:textColor">@color/sns_blue</item>
 <item name="android:fontFamily">sans-serif-light</item>
 <item name="fontFamily">sans-serif-light</item>
</style>

<style name="TextAppearance.SNSMaterialDialogAlert.Body" parent="@style/TextAppearance.MaterialComponents.Body2">
 <item name="android:textColor">@color/sns_black</item>
 <item name="android:textSize">16sp</item>
 <item name="android:fontFamily">sans-serif-light</item>
 <item name="fontFamily">sans-serif-light</item>
</style>

# BottomSheet Dialog

<style name="Widget.SNSBottomSheet.Modal" parent="@style/Widget.Design.BottomSheet.Modal">
 <item name="android:background">@drawable/sns_bg_bottom_sheet_dialog_fragment</item>
</style>

<style name="Widget.SNSBottomSheetDialog" parent="@style/Theme.Design.Light.BottomSheetDialog">
 <item name="android:windowIsFloating">false</item>
 <item name="bottomSheetStyle">@style/Widget.SNSBottomSheet.Modal</item>
</style>
Last Updated: 7/7/2020, 1:32:24 PM