Conversations (Discontinued)

🚧

Note

Please note that we have announced end of sale for Android UI SDK. It is no longer offered as a standard Webex Connect capability.

com.imimobile.connect.ui.conversation

This package contains the following classes and interfaces.

Classes

Interfaces

Fragments

ICConversationActivity

This activity leverages the functionality of the lower-level components and provides the necessary wiring to combine them into a full-featured, in-app chat experience with minimal code.

The activity supports the display of the user conversation list and provides a means to open them or create new conversations. Selecting a conversation displays the conversation view and allows users to read, compose and send messages.

Prerequisites

This component requires that a valid ICMessageStore instance is set within the Core SDK by calling ICMessaging.setMessageStore.

Modes of operation

Depending on how the activity is started, there are two distinct modes of operation. Each provided to cover different scenarios. The standard mode of operation presents the conversation listing and allows the user to open an existing conversation or create a new one.

Alternatively, the activity may be started to display a specific conversation directly. This is useful when you need to take your user directly to a specific conversation. Perhaps they have navigated to another area within the application, or even to another application, starting with a conversation id allows you to take your user back to the conversation.

Adaptive Layout

The layout of the activity adapts to the device display, typically when running on a phone the activity will display the conversation list in full screen. When a conversation is displayed this replaces the conversation list display. Navigating back from the conversation will cause the conversation list to be re-displayed.

When running on a wide layout (greater than 700dp in landscape), the layout is split into two sections. The conversation list is shown on the left and the active conversation presented on the right.

Launching the activity

The activity provides two helper methods to start the activity in each of the supported modes of operation

start

It starts the activity to display a specific conversation.

  Syntax: void start(Context context, String conversationId, Bundle extArgs)

  Parameters:

ParameterTypeDescription
contextContextAndroid context
conversationIdStringconversation Id
extArgsBundleBundle with extra arguments

start

Starts the activity to display a list of conversations.

  Syntax: void start(Context context, ArrayList<ICConversationCategory> categories, ICCustomerDetails customerDetails, Bundle extArgs)
Parameters:

ParameterTypeDescription
contextContextAndroid context
categoriesICConversationCategoryconversation categories
customerDetailsICCustomerDetailscustomer details object
extArgsBundleBundle with extra arguments

Styling

The activity is customized to match the look and feel of your application, this is accomplished by setting styling attributes via XML.

To style the activity you must first declare styles that inherit from the default styles provided by the SDK and specify these custom styles within your app theme. Internally, the activity leverages the ICConversationsFragment and ICConversationFragment.

showConversations

Syntax : protected void showConversations(@Nullable final Bundle extArgs)

This method used to show conversations screen

Parameters : extArgs - extra bundle Args

getConversationsFragment

Syntax : protected ICConversationsFragment getConversationsFragment(@Nullable final Bundle extArgs)

This method used to get conversations fragment instance

Parameters: extArgs – extra bundle arguments

getConversationFragment

Syntax : protected ICConversationFragment getConversationFragment(@Nullable final ICThread thread, @Nullable final Bundle extArgs, @NonNull String composerFlavorId)

This method used to get conversation fragment instance

Parameters:

ParameterDescription
threadthread object
extArgsextra bundle arguments
composerFlavorIdcomposer flavour Id

showConversation

Syntax : protected void showConversation(@Nullable final ICThread thread, @Nullable final Bundle extArgs)

This method used to show conversation screen

Parameters:

ParameterDescription
threadthread object
extArgsextra bundle arguments

getCategoryDialogFragment

Syntax : protected ICConversationCategoryDialogFragment getCategoryDialogFragment(ArrayList categories)

This method used to get Category Dialog fragment instance

Returns: conversation category dialog instance

showCategories

Syntax : protected void showCategories(ArrayList categories)

This method used to show conversation Category screen

Parameters: categories – Array of conversation categories

showFragment

Syntax : protected void showFragment(Fragment fragment, String title, boolean isLeft, String tag)

Parameters:

ParameterDescription
fragmentfragment instance
titletitle for fragment
isLefttrue if fragment needs to show on left side ,false otherwise
tagtag name for the fragment

setActionBarTitle

Syntax : protected void setActionBarTitle(String title)

This method used to set the action bar's title

Parameters: title – actionBar title

getActionBarTitle

Syntax : protected String getActionBarTitle()

This method used to get the action bar's title

Returns : actionBar title

ICConversationCategory

Organizations typically have multiple contact points to which a customer may be directed depending on their query. Conversation categories provide the means to drive users to the correct contact point.

The information contained in ICConversationCategory instance is also used to establish the correct communication stream for a conversation. Within Webex Connect, real-time messages are sent over a stream, the stream is used to direct messages to the correct service to process the message.

Constructors

ICConversationCategory
public ICConversationCategory(java.lang.String title,
java.lang.String streamName, android.net.Uri imageUri)
public ICConversationCategory(java.lang.String title,
java.util.ArrayList subCategories,
android.net.Uri imageUri)

getImageUri

This method is used to get uri to an image representing the category, must be a local uri.

  Syntax: android.net.Uri getImageUri()

  Returns value: Returns a uri to an image representing the category, must be a local uri.

setImageUri

This method is used to set uri to an image representing the category, must be a local uri.

  Syntax: void setImageUri(Uri imageUri)

  Parameters:

ParametersTypeDescription
imageUriUriimage, local uri for representing the category

getTitle

This method is used to get Conversation Category Title.

  Syntax: jjava.lang.String getTitle()

  Returns value: Returns Conversation Category Title

setTitle

This method is used to set Conversation Category Title.

  Syntax: void setTitle(java.lang.String title)

  Parameters:

ParametersTypeDescription
titlejava.lang.StringConversation Category Title

getSubCategories

This method is used to get An array list of subcategories.

  Syntax: java.util.ArrayList<ICConversationCategory> getSubCategories()

  Returns value: Returns, an array list of sub categories.

setSubCategories

This method is used to set an array list of subcategories

  Syntax: void setSubCategories(java.util.ArrayList<ICConversationCategory> subcategories)

  Parameters

DescriptionTypeDescription
subcategoriesjava.util.ArrayListAn array list of sub categories

addSubCategory

This method is used to add Conversation category to SubCategories.

  Syntax: void addSubCategory(ICConversationCategory category)

  Parameters:

DescriptionTypeDescription
category(ICConversationCategoryConversation category

hasSubCategories

This method is used to verify subcategories size is >0 or not.

  Syntax: boolean hasSubCategories()

  Returns value: returns true if subcategories size is >0, false otherwise.

getContentDescription

Syntax : public String getContentDescription()

This method used to get content description for Conversation category

setContentDescription

Syntax : public void setContentDescription(String contentDescription)

This method used to set content description for Conversation category

Parameters: contentDescription – content Description

ICConversationRecyclerView

Concrete implementation of ICMessageRecyclerView that obtains i'ts data through ICMessageDataProvider and uses ICConversationMessageViewHolder instances to display.

registerOnRetryClickListener

This method registers a listener that will receive retry click events.

  Syntax: void registerOnRetryClickListener(ICRetryClickListener listener)

unregisterOnRetryClickListener

This method deregisters a previously registered listener.

  Syntax: void unregisterOnRetryClickListener(ICRetryClickListener listener)

registerOnMessageDisplayedListener

This method registers a listener that will receive message display events.

  Syntax: void registerOnMessageDisplayedListener(ICMessageDisplayedListener listener)

unregisterOnMessageDisplayedListener

This method Unregisters a previously registered listener.

  Syntax: void unregisterOnMessageDisplayedListener(ICMessageDisplayedListener listener)

ICMessageDisplayedListener

This interface is used to listen for message display events that are generated as a message is displayed to the user.

onMessageDisplayed

This method is invoked as a message is displayed to the user.

  Syntax: void onMessageDisplayed(ICMessageData messageData)

ICMessageComposerViewCallback

This interface represents call back methods implemented in message composer view to listen for message composed events, start Typing and stop typing events that occur while composing the message.

onMessageComposed

This method is invoked when a user composed message.

  Syntax: void onMessageComposed(com.imimobile.connect.core.messaging.ICMessage message, ICMessagePart[] messageParts)

  Parameters:

ParameterTypeDescription
messagecom.imimobile.connect.core.messaging.ICMessageICMessage instance
messagePartsICMessagePart[]An Array of ICMessage parts

onStartTyping

This method is invoked when the user starts typing on the message composer view.

  Syntax: void onStopTyping()

onStopTyping

This method is invoked when the user stops typing on the message composer view.

  Syntax: void onStopTyping()

ICRetryClickListener

This interface is used to listen for events that signal the retry message publication button has been pressed.

onRetry

This method is invoked when the retry message publication button is pressed by the user.

  Syntax: void onRetry(ICMessageData messageData)

ICMessageComposerView

This class handles the display of message composer view. register/Unregister message composer plugins for building message.

Constructors

ICMessageComposerVieww
public ICMessageComposerView(Context context)Simple constructor to use when creating a MessagecomposerView from code.
public ICMessageComposerView(Context context,
AttributeSet attrs)
Constructor that is called when inflating a MessagecomposerView from XML.
public ICMessageComposerView(Context context,
AttributeSet attrs,
int defStyleAttr)
Perform inflation from XML and apply a class-specific base style from a theme attribute.

setEnabled

This method used to enable/disable the Message composer view enabled by default.

  Syntax: void setEnabled(boolean enabled)

  Overrides:: setEnabled in class View

  Parameters:

ParameterTypeDescription
enabledbooleantrue for enable , false otherwise

registerPlugin

This method used to registers a Message composer plugin.

  Syntax: void registerPlugin(ICMessageComposerPlugin plugin)

  Parameters:

ParameterTypeDescription
pluginICMessageComposerPlugina plugin that will be registered

onActivityResult

This method must be called from Activity's onActivityResult to allow attachment senders to manage results from. (e.g. selecting a gallery photo or taking a camera image.)

  Syntax: void onActivityResult(int requestCode, int resultCode, android.content.Intent data)

  Parameters:

ParameterTypeDescription
requestCodeintRequest code from the Activity's onActivityResult.
resultCodeintResult code from the Activity's onActivityResult.
dataandroid.content.IntentIntent data from the Activity's onActivityResult.

buildMessage

This method builds a message based on a message instance from the attachment selected by the user and the input text.

  Syntax: com.imimobile.connect.core.messaging.ICMessage buildMessage()

  Returns value: Returns the composed message.

setCallBack

This method allows registering an object, which implements the ICMessageComposerViewCallback to listen for message composed events, start Typing and stop typing events that occur while composing a message.

  Syntax: void setCallBack(ICMessageComposerViewCallback callback)

  Parameters:

ParameterTypeDescription
callbackICMessageComposerViewCallbackmessage composer view callback

setContentDescForSendButton

Syntax : public void setContentDescForSendButton(String contentDesc)

This method used to set the content description for send button

Parameters : contentDesc -- content description for send button

com.imimobile.connect.ui.conversation. composer.plugins

ICMessageComposerPlugin

This abstract class represents all the methods needed to create the composer plugin. Creates a message instance from the message parts selected by the user and the input text also allows us to register an object which implements the ICMessageComposerPluginCallback interface to listen for message composer plugin created message part and associated thumbnail.

ICMessageComposerPlugin

This method is invoked when a user composed message.

  Syntax: ICMessageComposerPlugin(String displayName, @DrawableRes Integer iconResId)

  Parameters:

ParameterTypeDescription
displayNamestringmessage composer plugin display name
iconResIdintegermessage composer plugin icon resource Id

getDisplayName

This method is used to return the message composer plugin display name.

  Syntax: String getDisplayName()

  Returns value: Return message composer plugin display name

getIconResId

This method is used to return message composer plugin icon resource id

  Syntax: Integer getIconResId()

  Returns value: Return message composer plugin icon resource Id.

execute

This method is used to execute message composer plugin implementation. Also allows registering an object, which implements the ICMessageComposerPluginCallback interface to listen for message composer plugin created message part and associated thumbnail.

  Syntax: void execute(ICMessageComposerPluginCallback callback)

  Parameters:

ParameterTypeDescription
callback -ICMessageComposerPluginCallbackMessageComposerPlugin Callback

onActivityResult

This method is used to execute message composer plugin implementation. Also allows registering an object, which implements the ICMessageComposerPluginCallback interface to listen for message composer plugin created message part and associated thumbnail.

  Syntax: boolean onActivityResult(int requestCode, int resultCode, Intent data)

Override to handle results from onActivityResult

  Parameters:

ParameterTypeDescription
requestCodeintRequest code from the Activity's onActivityResult.
resultCodeintResult code from the Activity's onActivityResult.
dataintIntent data from the Activity's onActivityResult.

  Returns value: Returns 'true' if the result was handled, or 'false' otherwise.

composeMessage

Creates a message instance from the message parts selected by the user and the input text
Syntax: void composeMessage(ICMessage message, ICMessagePart[] messageParts) )

  Parameters:

ParameterTypeDescription
messageCMessageAn ICMessage instance
messagePartsICMessagePart[]An Array of ICMessage parts

ICMessageComposerAudioPlugin

This class implements the ICMessageComposerPlugin and is responsible for the creation of message instances from the audio attachment message parts selected/recorded by the user.

ICMessageComposerAudioPlugin

  Syntax: ICMessageComposerAudioPlugin(String displayName, @DrawableRes Integer iconResId, Activity activity)

  Parameters:

ParameterTypeDescription
displayNamestringMessage composer plugin display name
iconResIdintegerMessage composer plugin icon resource Id
activityactivityAndroid Activity

ICMessageComposerFilePlugin

This class implements the ICMessageComposerPlugin and is responsible for the creation of a message instance from the File document attachment message parts selected by the user.

ICMessageComposerFilePlugin

  Syntax: ICMessageComposerFilePlugin(String displayName, @DrawableRes Integer iconResId, Activity activity)

  Parameters:

ParameterTypeDescription
displayNamestringmessage composer plugin display name
iconResIdintegermessage composer plugin icon resource Id
activityactivityandroid Activity

ICMessageComposerGalleryPlugin

This class implements the ICMessageComposerPlugin and is responsible for the creation of message instance from the attachment message parts selected by the user in the gallery.

ICMessageComposerFilePlugin

  Syntax: ICMessageComposerGalleryPlugin(String displayName, @DrawableRes Integer iconResId, Activity activity)

  Parameters:

ParameterTypeDescription
displayNamestringmessage composer plugin display name
iconResIdintegermessage composer plugin icon resource Id
plugin icon resource Id
activity
activityandroid Activity

ICMessageComposerImageCameraPlugin

This class implements the ICMessageComposerPlugin and is responsible for the creation of message instance from the message image attachment parts captured by the user.

ICMessageComposerImageCameraPlugin

  Syntax: ICMessageComposerImageCameraPlugin(String displayName, @DrawableRes Integer iconResId, Activity activity)

  Parameters:

ParameterTypeDescription
displayNamestringmessage composer plugin display name
iconResIdintegermessage composer plugin icon resource Id
activityactivityandroid Activity

ICMessageComposerLocationPlugin

This class implements the ICMessageComposerPlugin and is responsible for the creation of message instance from the location message parts picked by the user.

ICMessageComposerLocationPlugin

  Syntax: ICMessageComposerLocationPlugin(String displayName, @DrawableRes Integer iconResId, Activity activity)
Parameters:

ParameterTypeDescription
displayNamestringmessage composer plugin display name
iconResIdintegermessage composer plugin icon resource Id
activityactivityandroid Activity

ICMessageComposerVideoCameraPlugin

This class implements the ICMessageComposerPlugin and is responsible for the creation of Creates a message instance from the video message parts captured/video message parts attached by the user.

ICMessageComposerVideoCameraPlugin

  Syntax: IICMessageComposerVideoCameraPlugin(String displayName, @DrawableRes Integer iconResId, Activity activity)
Parameters:

ParameterTypeDescription
displayNamestringmessage composer plugin display name
iconResId - message composer plugin icon resource Idintegermessage composer plugin icon resource Id
activityactiviryandroid Activity

ICMessageComposerPluginCallback

onPartCreated

This method is invoked when a message composer plugin created message part and associated thumbnail.

  Syntax: void onPartCreated(ICMessageComposerPlugin plugin, ICMessagePart part, Bitmap thumbnail)
Parameters:

ParameterTypeDescription
pluginICMessageComposerPluginThe plugin that created the message part and the thumbnail
partICMessagePartThe message part to be added
thumbnailBitmapThe thumbnail associated to the message part

com.imimobile.connect.ui.conversation.fragments

ICConversationsFragment

Displays a list of conversations of the current user and a floating action button for creating a new conversation, use this fragment when you wish to integrate a conversation list within your own layouts.

The fragment does not open or create new conversations directly, instead, events are raised through the ICConversationsFragmentListener interface and it is your responsibility to write the code in response to those events.

Message data is lazily loaded from a local ICMessageStore and remotely from the Webex Connect backend services. To achieve the best possible user experience it is recommended that you configure an appropriate message synchronization policy within the Core SDK in order to pre-fetch data.

Activities that contain this fragment must implement the ICConversationsFragmentListener interface to handle interaction events. Use the newInstance(boolean) factory method to create an instance of this fragment.

Prerequisites

This component loads data from ICMessageStore and therefore requires that a valid instance is set within the Core SDK, refer to ICMessaging.setMessageStore.

The activity that displays the fragment must implement the ICConversationsFragmentListener otherwise an exception will be thrown.

Instantiation

The fragment provides a helper method to instantiate the fragment with the correct arguments bundle.

newInstance

Makes use of this factory method to create a new instance of this fragment using the provided parameters and multi-selection disabled.

  Syntax: ICConversationsFragment newInstance(boolean canShowConnectionIndicator)

  Retutn value: Returns a new instance of fragment ICConversationsFragment.

newInstance

Use this factory method to create a new instance of this fragment using the provided parameters.

  Syntax: ICConversationsFragment newInstance(boolean canShowConnectionIndicator, boolean allowMultiSelect)

  Retutn value: Returns A new instance of fragment ICConversationsFragment.

newInstance

Use this factory method to create a new instance of this fragment with connection indicator and multi-select disabled.

  Syntax: ICConversationsFragment newInstance()

  Retutn value: A new instance of fragment ICConversationsFragment.

Responding to events

Whenever a user selects a conversation or taps the create conversation button, the appropriate event is raised through the ICConversationsFragmentListener interface. The activity that hosts the fragment must implement this interface in order to respond to those events.

Styling

The style of the fragment can be set by configuring the appropriate style attributes within your apps styles.xml.
Internally the fragment leverages the lower-level component ICInboxRecyclerView and it is this component that utilizes the style attributes. Therefore, the style is applied to that component rather than the fragment itself.

First, define styles which inherit from the defaults provided by the SDK and set the appropriate attributes:

<style name="ICInboxRecyclerViewChild" parent="@style/ICInboxRecyclerView">
    <item name="readTitleTextColor">@android:color/holo_orange_dark</item>
    <item name="readTextColor">@android:color/holo_blue_dark</item>
    <item name="readTextSize">16sp</item>
    <item name="unReadTitleTextColor">@android:color/holo_orange_dark</item>
    <item name="unReadTextStyle">bold</item>
    <item name="unReadTextTypeface">bold</item>
    <item name="unReadTextSize">20sp</item>
    <item name="unReadTextColor">@android:color/holo_purple</item>
</style>

Finally, apply the style within the app theme.

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">

<item name="ICInboxRecyclerView">@style/ICInboxRecyclerViewChild</item>

        …..
</style>

Style attributes

ICInboxRecyclerView

NameDescriptionExampleSupported Values
readTitleTextColorText color for the message title for read messagesEx: @color/default_text_colorA color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
readTitleTextSizeText size for the message title for read messagesEx : @dimen/default_title_text_sizeA dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
readTitleTextTypefaceTypeface for the message title for read messagesEx: normalMust be one of the following constant values monospace(3),normal(0),sans(1),serif (2)
readTitleTextStyleText style for the message title for read messagesEx: normalMust be one or more (separated by '|') of the following constant values bold(1),italic(2),normal(0).
readTextColorText color for the message body for read messagesEx: @color/befault_text_colorA color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
readTextSizeText size for the message body for read messagesEx: @dimen/default_text_sizeA dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
readTextTypefaceTypeface for the message body for read messagesEx: normalMust be one of the following constant values monospace(3),normal(0),sans(1),serif (2)
readTextStyleText style for the message body for read messagesEx: normalMust be one or more (separated by '|') of the following constant values bold(1),italic(2),normal(0).
readBgColorBackground colour for read messagesEx: @color/default_bg_colorMay be a reference to another resource, in the form "@ "h-1": "Destype/name" or a theme attribute in the form "?upported Vtype/name".

May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
readCornerRadiusCorner radius for read messagesEx: @dimen/default_corner_radiusMay be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
unReadTitleTextColorText color for the message title for unread messagesEx: @color/inbox_text_colorMay be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
unReadTitleTextSizeText size for the message title for unread messagesEx: @dimen/default_title_text_sizeMay be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
unReadTitleTextTypefaceTypeface for the message title for unread messagesEx: normalMust be one of the following constant values monospace(3),normal(0),sans(1),serif (2)
unReadTitleTextStyleText style for the message title for unread messagesEx:boldMust be one or more (separated by '|') of the following constant values bold(1),italic(2),normal(0).
unReadTextColorText color for the message body for unread messagesEx: @color/unread_text_colorMay be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
unReadTextSizeText size for the message body for unread messagesEx: @dimen/default_text_sizeMay be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
unReadTextTypefaceTypeface for the message body for unread messagesEx:normalMust be one of the following constant values monospace(3),normal(0),sans(1),serif (2)
unReadTextStyleText style for the message body for unread messagesEx:normalMust be one or more (separated by '|') of the following constant values bold(1),italic(2),normal(0).
unReadBgColorBackground colour for unread messagesEx: @color/inbox_bg_colorMay be a reference to another resource, in the form "@ "h-1": "Destype/name" or a theme attribute in the form "?upported Vtype/name".

May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
unReadCornerRadiusCorner radius for unread messagesEx: @dimen/default_corner_radiusMay be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
timeTextSizeSize of the text which displays the message timeEx: @dimen/default_text_sizeMay be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
timeTextColorColor of the text that displays the message timeEx: @color/inbox_text_colorMay be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
badgeBackgroundResourceBackground resource for the message badgeEx: @drawable/badgeReference to a draw-able resource to use for the Badge.
badgeTextSizeSize of the text for the message badgeEx: @dimen/default_text_sizeMay be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
badgeTextColorColor of the text for the message badgeEx: @color/connectui_whiteMay be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
badgeTextTypefaceTypeface of the text for the message badgeEx: normalMust be one of the following constant values monospace(3),normal(0),sans(1),serif (2)
badgeTextStyleStyle of the text for the message badgeEx: normalMust be one or more (separated by '|') of the following constant values bold(1),italic(2),normal(0).
avatarWidth The avatar widthEx: 38dpA dimension value
avatarHeight The avatar heightEx: 38dpA dimension value
avatarScaleType The avatar image scale typeEx: fitXYMust be one of the following constant values viewMatrix(0), fitXY(1), fitStart(2), fitCenter(3), fitEnd(4), center(5), centerCrop(6), centerInside(7)

getMessageViewFactory

Syntax : protected ICConversationMessageViewFactory getMessageViewFactory()

This method used to get message view factory

Returns : Message view factory

getContentDescNewConversationButton

Syntax : public String getContentDescNewConversationButton()

This method used to get the content description for new conversation button

Returns: content description for new conversation button

ICConversationFragment

Displays messages within a conversation and provides a message composer.

Messages are displayed to the user in chronological order and new messages can be composed and published directly from the fragment. Supports typing indicators, delivery and read receipts, message attachments, and connection indicator.

Message data is lazily loaded from a local ICMessageStore and remotely from the Webex Connect backend services. To achieve the best possible user experience, it is recommended that you configure an appropriate message synchronization policy within the Core SDK in order to pre-fetch data.

Prerequisites

This component loads data from ICMessageStore and therefore requires that a valid instance is set within the Core SDK, For more information, refer to ICMessaging.setMessageStore.

Instantiation

The fragment provides a helper method to instantiate the fragment with the correct arguments bundle.

newInstance

This factory method is used to create a new instance of this fragment using the provided parameters.

  Syntax: ICConversationFragment newInstance(String threadId)

  Parameters:

ParameterType
threadIdStringthreadId for conversation.

  Return value: A new instance of fragment ICConversationFragment.

Styling

The style of the fragment is set by configuring the appropriate style attributes within your apps styles.xml.

Internally, the fragment leverages the lower-level component ICConversationRecyclerView and it is this component that utilizes the style attributes. Therefore, the style is applied to that component rather than the fragment itself.

At first, define styles which inherit from the defaults provided by the SDK and set the appropriate attributes:

<style name="ICConversationRecyclerViewChild" parent="@style/ICConversationRecyclerView">
    <item name="myBackgroundResource">@drawable/my_message_bubble</item>
    <item name="myBubbleColor">@android:color/holo_blue_light</item>
    <item name="myCornerRadius">@dimen/default_corner_radius</item>
    <item name="myTimeTextSize">@dimen/default_text_size</item>
    <item name="myTimeTextColor">@android:color/darker_gray</item>
    <item name="myTextColor">@android:color/white</item>
    <item name="myTextLinkColor">@android:color/white</item>
    <item name="myTextSize">@dimen/default_text_size</item>
    <item name="myTextTypeface">normal</item>
    <item name="myTextStyle">normal</item>

    <item name="theirBackgroundResource">@drawable/their_message_bubble</item>
    <item name="theirBubbleColor">@android:color/white</item>
    <item name="theirCornerRadius">@dimen/default_corner_radius</item>
    <item name="theirTimeTextSize">@dimen/default_text_size</item>
    <item name="theirTimeTextColor">@android:color/darker_gray</item>
    <item name="theirTextColor">@android:color/white</item>
    <item name="theirTextLinkColor">@android:color/holo_blue_dark</item>
    <item name="theirTextSize">@dimen/default_text_size</item>
    <item name="theirTextTypeface">normal</item>
    <item name="theirTextStyle">normal</item>
</style>

Finally, apply the style within the app theme:

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">

<item name="ICConversationRecyclerView">@style/ICConversationRecyclerViewChild</item>

        …..
</style>

Style attributes

Attributes are based on a ‘my’ and ‘their’ system, any messages which originate from the user will have ‘my’ style attributes applied, other messages will have ‘their’ style applied. The exception is for ‘alert’ type messages which have their own style.

Additionally, a ‘myUnread’ style variant exists which allows a separate style to be applied when an outgoing message from the user has not been read. Once a read receipt has been received for the message the style will switch to the standard variant.

ICConversationRecyclerView

NameDescriptionExampleSupported Values
myBackgroundResourceBackground Resource for my messagesEx: @drawable/my_message_bubbleDrawable reference. If not specified myBubbleColor is used instead
myBubbleColorBubble color for my messagesEx: @color/my_message_bubble_colorMay be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
myCornerRadiusCorner radius for my messagesEx: @dimen/default_corner_radiusMay be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
myTimeTextSizeSize of the time text for my messagesEx: @dimen/default_text_sizeMay be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
myTimeTextColorColor of the time text for my messagesEx: @color/default_text_colorMay be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
myTextColorColor of the text for my messagesEx: @color/default_text_colorMay be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
myTextLinkColorColor of the text used for links within my messagesEx: @color/default_text_link_colorMay be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
myTextSizeSize of the text for my messagesEx: @dimen/default_text_sizeMay be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
myTextTypefaceTypeface of the text for my messagesEx: normalMust be one of the following constant values monospace(3),normal(0),sans(1),serif (2)
myTextStyleStyle of the text for my messagesEx: normalMust be one or more (separated by '|') of the following constant values bold(1),italic(2),normal(0).
theirBackgroundResourceBackground resource for their messagesEx: @drawable/their_message_bubbleDrawable reference. If not specified, theirBubbleColor is used instead
theirBubbleColorColor of the bubble for their messagesEx: @color/their_message_bubble_colorMay be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
theirCornerRadiusCorner radius of the bubble for their messagesEx: @dimen/default_corner_radiusMay be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
theirTimeTextSizeSize of the time text for their messagesEx: @dimen/default_text_sizeMay be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
theirTimeTextColorColor of the time text for their messagesEx: @color/default_text_colorMay be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
theirTextColorColor of the text for their messagesEx: @color/default_text_colorMay be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
theirTextLinkColorColor of the text for links within their messagesEx: @color/default_text_colorMay be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
theirTextSizeSize of the text for their messagesEx: @dimen/default_text_sizeMay be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
theirTextTypefaceTypeface of the text for their messagesEx: normalMust be one of the following constant values monospace(3),normal(0),sans(1),serif (2)
theirTextStyleStyle of the text for their messagesEx: normalMust be one or more (separated by '|') of the following constant values bold(1),italic(2),normal(0).
myUnreadBackgroundResourceBackground resource for my unread messagesEx: @drawable/my_unread_message_bubbleDraw-able reference
myUnreadBubbleColorBubble color for my unread messagesEx: @color/connectui_dark_blueMay be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
myUnreadCornerRadiusCorner radius for the background for my unread messagesEx: @dimen/default_corner_radiusMay be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
myUnreadTimeTextSizeSize of the time text for my unread messagesEx: @dimen/default_text_sizeMay be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
myUnreadTimeTextColorColor of the time text for my unread messagesEx: @color/connectui_text_lightgreyMay be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
myUnreadTextColorColor of the text for my unread messagesEx: @color/connectui_whiteMay be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
myUnreadTextLinkColorColor of any links within the text of my unread messagesEx: @color/connectui_whiteMay be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
myUnreadTextSizeSize of the text for my unread messages.Ex: @dimen/default_text_sizeMay be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
myUnreadTextTypefaceTypeface of the text for my unread messagesEx: normalMust be one of the following constant values monospace(3),normal(0),sans(1),serif (2)
myUnreadTextStyleStyle of the text for my unread messagesEx: normalMust be one or more (separated by '|') of the following constant values bold(1),italic(2),normal(0).
alertBubbleColorColor of the bubble for alertsEx: @android:color/transparentMay be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
alertCornerRadiusCorner radius of the bubble for alertsEx: @dimen/default_corner_radiusMay be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
alertTextColorColor of the alert textEx: @color/connectui_text_darkgreyMay be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
alertTextSizeSize of the alert textEx: @dimen/default_text_sizeMay be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
alertTextTypefaceTypeface of the alert textEx: normalMust be one of the following constant values monospace(3),normal(0),sans(1),serif (2)
alertTextStyleStyle of the alert textEx: boldMust be one or more (separated by '|') of the following constant values bold(1),italic(2),normal(0).
conversationBackgroundColorBackground color of the componentEx: @color/conversation_bg_colorMay be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
avatarWidthThe avatar widthEx: 38dpA dimension value
avatarHeightThe avatar heightEx: 38dpA dimension value
avatarScaleTypeThe avatar image scale typeEx: fitXYMust be one of the following constant values viewMatrix(0), fitXY(1), fitStart(2), fitCenter(3), fitEnd(4), center(5), centerCrop(6), centerInside(7)
myMarginLeftThe left margin for my messagesEx: 4dpA dimension value
myMarginRightThe right margin for my messagesEx: 4dpA dimension value
theirMarginLeftThe left margin for their messagesEx: 4dpA dimension value
theirMarginRightThe left margin for their messagesEx: 4dpA dimension value
myUnreadMarginLeftThe left margin for my unread messagesEx: 4dpA dimension value
myUnreadMarginRightThe left margin for my unread messagesEx: 4dpA dimension value
quickReplyViewStyleThe style for quick reply viewEx: @style/ICICQuickReplyViewStyle

getMessageViewFactory

Syntax : protected ICConversationMessageViewFactory getMessageViewFactory()

This method used to get message view factory

Returns : Message view factory

getPartViewFactories

Syntax : protected ICMessagePartViewFactory[] getPartViewFactories()

This method used to get the array of partView factories to be registered

Returns : Array of partView factories to be registered

ICConversationCategoryDialogFragment

This class displays a list of conversation categories.

Categories are represented by ICConversationCategory instances, these instances may be nested to create a hierarchy of categories. The fragment displays one level of categories at a time when the user taps a category the fragment with either:

a. Where the category has sub-categories, displays the list of sub-categories
b. Where the category does not have sub-categories, raise an event via the ICConversationCategoryFragmentListener

Prerequisites

It must be hosted inside another fragment or activity that implements the ICConversationCategoryFragmentListener interface.

Instantiation

The fragment provides a helper method that instantiates the fragment with the required arguments bundle. Once instantiated the fragment may either be displayed as a dialog or embedded in a layout.

newInstance

This factory method is used to create a new instance of this fragment using the provided parameters.
Syntax: ICConversationCategoryDialogFragment newInstance(ArrayList<ICConversationCategory> categories)

  Return value: Returns a new instance of fragment ICConversationCategoryDialogFragment.

Interaction

The fragment displays a single level of categories at a time, if a category is selected which has sub-categories then the sub-category list replaces that which is currently shown. Pressing the back button will navigate up one level in the hierarchy.

When a final selection is made the selection is raised as an event through the ICConversationCategoryFragmentListener. A final selection is determined as a category that has no sub-categories.

onCategorySelected

This method is invoked when a user-selected category which does not have sub-categories

  Syntax: void onCategorySelected(ICConversationCategory category, ICConversationCategory parentCategory)

  Parameter:

ParameterTypeDescription
categoryICConversationCategoryselected conversation category
parentCategoryICConversationCategoryparent conversation category

com.imimobile.connect.ui.conversation.fragments.listeners

ICConversationsFragmentListener

Used to listen to ICConversationsFragment events.

void onThreadSelected(ICThread thread)

Invoked when a user selects a conversation within the fragment. Conversations are represented by an ICThread object, refer to the Core SDK documentation for details. Typically, you will use the id within ICThread to open the conversation within an instance of ICConversationFragment.

void onCreateThreadSelected()

Invoked when a user taps the create conversation button. You are responsible for creating the new thread and displaying the conversation UI to the user. If you have multiple contact points you may wish to consider using ICConversationCategoryDialogFragment as an easy way to present these.

Use the ICMessaging.createThread method within the Core SDK to create a new thread, refer to the Core SDK documentation for more information.

ICConversationCategoryFragmentListener

Used to listen to ICConversationCategoryFragment events.

void onCategorySelected(ICConversationCategory category, ICConversationCategory parentCategory)

Invoked when a user makes a final selection within the ICConversationCategoryFragment.
The parentCategory parameter will be null if the category has no parent.

ICMessageComposerPlugin

getContentDescription

Syntax : public java.lang.String getContentDescription()

This method is used to return message composer plugin content description

Returns: content description

setContentDescription

Syntax : public void setContentDescription(String contentDescription)

This method is used to set message composer plugin content description

Parameters: contentDescription - content description

ICMessageComposerAttachment

This class represents the attachment selected by user from composer

getMessagePart

Syntax : public ICMessagePart getMessagePart()

This method used to get the message part

Returns: message part

getThumbnail

Syntax : public Bitmap getThumbnail()

This method used to get the thumbnail

Returns: thumbnail

getPlugin

Syntax : public ICMessageComposerPlugin getPlugin()

This method used to get the message composer plugin instance

Returns: message composer plugin instance

getContentDescForImage

Syntax : public String getContentDescForImage()

This method used to get the content description for image

Returns: content description for image

setContentDescForImage

Syntax : public void setContentDescForImage(String contentDesc)

This method used to set the content description for image

Parameters : contentDesc -- content description for image

getContentDescForDeleteButton

Syntax : public String getContentDescForDeleteButton()

This method used to get the content description for delete button

Returns: content description for delete button

setContentDescForDeleteButton

Syntax : public void setContentDescForDeleteButton(String contentDesc)

This method used to set the content description for delete button

Parameters : contentDesc -- content description for delete button

CConversationMessageViewFactory

setStyles

Syntax : public void setStyles(ICMessageViewStyle myStyle, ICMessageViewStyle theirStyle, ICMessageViewStyle unReadStyle, ICMessageViewStyle alertStyle)

This method sets message view styles for my, their, unread and alert messages

Parameters:

ParameterDescription
myStylemy message style
theirStyletheir Message style
unReadStyleunRead message style
alertStyleAlert Message style

getContentDescForMyAvatar

Syntax : public String getContentDescForMyAvatar()

This method used get content description for My Avatar

Returns: content description for My Avatar

setContentDescForMyAvatar

Syntax : public void setContentDescForMyAvatar(String contentDesc)

This method used set content description for My Avatar

Parameters: contentDesc - - content Description for My Avatar

getContentDescForTheirAvatar

Syntax : public String getContentDescForTheirAvatar()

This method used get content description for senders Avatar

Returns: content description for senders Avatar

setContentDescForTheirAvatar

Syntax : public void setContentDescForTheirAvatar(String contentDesc)

This method used set content description for senders Avatar

Parameters: contentDesc - - content Description for senders Avatar

getContentDescForPublishMessageFailureIndicator

Syntax : public String getContentDescForPublishMessageFailureIndicator()

This method used get content description for publish Message failure indicator

Returns: content description for publish Message failure indicator

setContentDescForPublishMessageFailureIndicator

Syntax : public void setContentDescForPublishMessageFailureIndicator(String contentDesc)

This method used set content description for publish Message failure indicator

Parameters: contentDesc - - content Description for publish Message failure indicator

ICConversationMessageViewHolder

setStyles

Syntax : public void setStyles(ICMessageViewStyle myStyle, ICMessageViewStyle theirStyle, ICMessageViewStyle unReadStyle, ICMessageViewStyle alertStyle)

This method sets message view styles for my, their, unread and alert messages

Parameters:

ParameterDescription
myStylemy message style
theirStyletheir Message style
unReadStyleunRead message style
alertStyleAlert Message style

getContentDescForMyAvatar

Syntax : public String getContentDescForMyAvatar()

This method used get content description for My Avatar

Returns: content description for My Avatar

setContentDescForMyAvatar

Syntax : public void setContentDescForMyAvatar(String contentDesc)

This method used set content description for My Avatar

Parameters: contentDesc - - content Description for My Avatar

getContentDescForTheirAvatar

Syntax : public String getContentDescForTheirAvatar()

This method used get content description for senders Avatar

Returns: content description for senders Avatar

setContentDescForTheirAvatar

Syntax : public void setContentDescForTheirAvatar(String contentDesc)

This method used set content description for senders Avatar

Parameters: contentDesc - - content Description for senders Avatar

getContentDescForPublishMessageFailureIndicator

Syntax : public String getContentDescForPublishMessageFailureIndicator()

This method used get content description for publish Message failure indicator

Returns: content description for publish Message failure indicator

setContentDescForPublishMessageFailureIndicator

Syntax : public void setContentDescForPublishMessageFailureIndicator(String contentDesc)

This method used set content description for publish Message failure indicator

Parameters: contentDesc - - content Description for publish Message failure indicator

getStyle

Syntax : protected ICMessageViewStyle getStyle(ICMessageData messageData)

This method used get message view style

Returns : Message view style

ICConversationMessageViewStyle

getQuickReplyViewStyle

Syntax : public ICQuickReplyViewStyle getQuickReplyViewStyle()

This method used to get quick Reply view style

Returns : quick Reply view style

setQuickReplyViewStyle

Syntax : public void setQuickReplyViewStyle(ICQuickReplyViewStyle quickReplyViewStyle)

This method used to set quick Reply view style

Parameters: quickReplyViewStyle - - quick reply view style

ICInboxMessageViewFactory

setStyles

Syntax : public void setStyles(ICMessageViewStyle readStyle, ICMessageViewStyle unreadStyle)

This method sets message view styles for read and unread messages

Parameters:

ParameterDescription
readStyleread message style
unreadStyleunread Message style

getContentDescForAvatar

Syntax : public String getContentDescForAvatar()

This method used get content description for avatar

Returns: content description for avatar

setContentDescForAvatar

Syntax : public void setContentDescForAvatar(String contentDesc)

This method used set content description for publish Message failure indicator

Parameters: contentDesc - - content Description for avatar

ICInboxMessageViewHolder

setStyles

Syntax : public void setStyles(ICMessageViewStyle readStyle, ICMessageViewStyle unreadStyle)

This method sets message view styles for read and unread messages

Parameters:

ParameterDescription
readStyleread message style
unreadStyleunread Message style

getContentDescForAvatar

Syntax : public String getContentDescForAvatar()

This method used get content description for avatar

Returns: content description for avatar

setContentDescForAvatar

Syntax : public void setContentDescForAvatar(String contentDesc)

This method used set content description for publish Message failure indicator

Parameters: contentDesc - - content Description for avatar

getStyle

Syntax : protected ICMessageViewStyle getStyle(ICMessageData messageData)

This method used get message view style

Returns : Message view style

ICInboxMessageViewStyle

setTitleTextColor

public void setTitleTextColor(@ColorInt int color)

This method sets the text color for title.

Syntax: public void setTitleTextColor(int titleTextColor)

Parameters: titleTextColor. – title text color

setTitleTextSize

Syntax: public void setTitleTextSize(float titleTextSize)

This method sets the text size for title.

Parameters: titleTextSize – text size

setTitleTextTypeface

Syntax: public void setTitleTextTypeface(Typeface typeface)

This method sets the text typeface for title.

Parameters: Typeface – text typeface for title

getTitleTextColor

This method gets the text color for title.

Syntax: public int getTitleTextColor()

Returns: text color

getTitleTextSize

Syntax: public float getTitleTextSize()

This method gets the text size for title

Returns: text size for title

getTitleTextTypeface

Syntax: public android.graphics.Typeface getTitleTextTypeface()

This method gets the text typeface for title.

Returns: text typeface for title