Customization

Introduction

Our library allows customizing the graphical interface.

The Chat and the Knowledge Base are customized differently:


Chat customization

To change a style you need to:

  1. Create a style in your application, inheriting it from the style you want to change;
  2. Change the values of the required attributes;
  3. Use the replaceResourceId method of the UsedeskResourceManager class to tell the SDK which style should replace the default one. Example:
UsedeskResourceManager.replaceResourceId(ru.usedesk.chat_gui.R.style.
Usedesk_Chat_Screen, R.style.Usedesk_Chat_Screen_Custom)

Concept

The library contains many styles that can be replaced with UsedeskResourceManager, as shown above.
Each of these styles applies to a specific interface object created with LayoutInflater, such as pages or list items. Such a style contains attributes whose values may hold various values or other styles.
Nested styles do not need to be overridden with UsedeskResourceManager, but they can be replaced in the parent style.

Styles that can be overridden through UsedeskResourceManager:



Common style types

Since many styles apply to interface elements of the same type, there are several common style types that share similar attributes, both standard Android ones and our own.
In such styles you can override every attribute the element has, for example:

  • layout_width
  • layout_height
  • margin
  • padding
  • and others.

However, some of these styles have peculiarities related to standard attributes, as well as non-standard attributes.

Text styles

Styles ending with Text apply to elements of type TextView, for example:

Usedesk.Chat.Attachment.Dialog.Storage.Text

In such a style the text is overridden by the following arguments:

  • android:text
  • usedesk_text_1
  • usedesk_text_2
  • usedesk_text_3

And only if they are defined in the style in the first place.

Image styles

Styles ending with Image apply to elements of type ImageView, for example:

Usedesk.Chat.Attachment.Dialog.Storage.Image

In such a style the image is overridden by the following arguments:

  • srcCompat
  • usedesk_drawable_1
  • usedesk_drawable_2

And only if they are defined in the style in the first place.

InputLayout styles

Styles ending with InputLayout apply to elements of type InputLayout and have no non-standard arguments, for example:

Usedesk.Common.Field.Text.InputLayout
EditText styles

Styles ending with EditText apply to elements of type EditText and have no non-standard arguments, for example:

Usedesk.Common.Field.Text.EditText