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
- ICConversationActivity
- ICConversationCategory
- ICConversationMessageViewFactory
- ICConversationMessageViewHolder
- ICConversationRecyclerView
- ICMessageDisplayedListener
- ICMessageComposerView
- ICMessageComposerPlugin
- ICMessageComposerAudioPlugin
- ICMessageComposerFilePlugin
- ICMessageComposerGalleryPlugin
- ICMessageComposerImageCameraPlugin
- ICMessageComposerLocationPlugin
- ICMessageComposerVideoCameraPlugin
- ICMessageComposerPluginCallback
Interfaces
Fragments
- com.imimobile.connect.ui.conversation.fragments
- ICConversationsFragment
- com.imimobile.connect.ui.conversation.fragments.listeners
- ICConversationsFragmentListener
- ICConversationCategoryFragmentListener
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:
Parameter | Type | Description |
---|---|---|
context | Context | Android context |
conversationId | String | conversation Id |
extArgs | Bundle | Bundle 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:
Parameter | Type | Description |
---|---|---|
context | Context | Android context |
categories | ICConversationCategory | conversation categories |
customerDetails | ICCustomerDetails | customer details object |
extArgs | Bundle | Bundle 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:
Parameter | Description |
---|---|
thread | thread object |
extArgs | extra bundle arguments |
composerFlavorId | composer flavour Id |
showConversation
Syntax : protected void showConversation(@Nullable final ICThread thread, @Nullable final Bundle extArgs)
This method used to show conversation screen
Parameters:
Parameter | Description |
---|---|
thread | thread object |
extArgs | extra 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:
Parameter | Description |
---|---|
fragment | fragment instance |
title | title for fragment |
isLeft | true if fragment needs to show on left side ,false otherwise |
tag | tag 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:
Parameters | Type | Description |
---|---|---|
imageUri | Uri | image, 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:
Parameters | Type | Description |
---|---|---|
title | java.lang.String | Conversation 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
Description | Type | Description |
---|---|---|
subcategories | java.util.ArrayList | An array list of sub categories |
addSubCategory
This method is used to add Conversation category to SubCategories.
Syntax: void addSubCategory(ICConversationCategory category)
Parameters:
Description | Type | Description |
---|---|---|
category | (ICConversationCategory | Conversation 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:
Parameter | Type | Description |
---|---|---|
message | com.imimobile.connect.core.messaging.ICMessage | ICMessage instance |
messageParts | ICMessagePart[] | 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:
Parameter | Type | Description |
---|---|---|
enabled | boolean | true for enable , false otherwise |
registerPlugin
This method used to registers a Message composer plugin.
Syntax: void registerPlugin(ICMessageComposerPlugin plugin)
Parameters:
Parameter | Type | Description |
---|---|---|
plugin | ICMessageComposerPlugin | a 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:
Parameter | Type | Description |
---|---|---|
requestCode | int | Request code from the Activity's onActivityResult. |
resultCode | int | Result code from the Activity's onActivityResult. |
data | android.content.Intent | Intent 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:
Parameter | Type | Description |
---|---|---|
callback | ICMessageComposerViewCallback | message 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:
Parameter | Type | Description |
---|---|---|
displayName | string | message composer plugin display name |
iconResId | integer | message 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:
Parameter | Type | Description |
---|---|---|
callback - | ICMessageComposerPluginCallback | MessageComposerPlugin 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:
Parameter | Type | Description |
---|---|---|
requestCode | int | Request code from the Activity's onActivityResult. |
resultCode | int | Result code from the Activity's onActivityResult. |
data | int | Intent 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:
Parameter | Type | Description |
---|---|---|
message | CMessage | An ICMessage instance |
messageParts | ICMessagePart[] | 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:
Parameter | Type | Description |
---|---|---|
displayName | string | Message composer plugin display name |
iconResId | integer | Message composer plugin icon resource Id |
activity | activity | Android 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:
Parameter | Type | Description |
---|---|---|
displayName | string | message composer plugin display name |
iconResId | integer | message composer plugin icon resource Id |
activity | activity | android 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:
Parameter | Type | Description |
---|---|---|
displayName | string | message composer plugin display name |
iconResId | integer | message composer plugin icon resource Id |
plugin icon resource Id activity | activity | android 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:
Parameter | Type | Description |
---|---|---|
displayName | string | message composer plugin display name |
iconResId | integer | message composer plugin icon resource Id |
activity | activity | android 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:
Parameter | Type | Description |
---|---|---|
displayName | string | message composer plugin display name |
iconResId | integer | message composer plugin icon resource Id |
activity | activity | android 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:
Parameter | Type | Description |
---|---|---|
displayName | string | message composer plugin display name |
iconResId - message composer plugin icon resource Id | integer | message composer plugin icon resource Id |
activity | activiry | android 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:
Parameter | Type | Description |
---|---|---|
plugin | ICMessageComposerPlugin | The plugin that created the message part and the thumbnail |
part | ICMessagePart | The message part to be added |
thumbnail | Bitmap | The 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
Name | Description | Example | Supported Values |
---|---|---|---|
readTitleTextColor | Text color for the message title for read messages | Ex: @color/default_text_color | A color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
readTitleTextSize | Text size for the message title for read messages | Ex : @dimen/default_title_text_size | 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). |
readTitleTextTypeface | Typeface for the message title for read messages | Ex: normal | Must be one of the following constant values monospace(3),normal(0),sans(1),serif (2) |
readTitleTextStyle | Text style for the message title for read messages | Ex: normal | Must be one or more (separated by '|') of the following constant values bold(1),italic(2),normal(0). |
readTextColor | Text color for the message body for read messages | Ex: @color/befault_text_color | A color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
readTextSize | Text size for the message body for read messages | Ex: @dimen/default_text_size | 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). |
readTextTypeface | Typeface for the message body for read messages | Ex: normal | Must be one of the following constant values monospace(3),normal(0),sans(1),serif (2) |
readTextStyle | Text style for the message body for read messages | Ex: normal | Must be one or more (separated by '|') of the following constant values bold(1),italic(2),normal(0). |
readBgColor | Background colour for read messages | Ex: @color/default_bg_color | May 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". |
readCornerRadius | Corner radius for read messages | Ex: @dimen/default_corner_radius | May 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). |
unReadTitleTextColor | Text color for the message title for unread messages | Ex: @color/inbox_text_color | May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
unReadTitleTextSize | Text size for the message title for unread messages | Ex: @dimen/default_title_text_size | May 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). |
unReadTitleTextTypeface | Typeface for the message title for unread messages | Ex: normal | Must be one of the following constant values monospace(3),normal(0),sans(1),serif (2) |
unReadTitleTextStyle | Text style for the message title for unread messages | Ex:bold | Must be one or more (separated by '|') of the following constant values bold(1),italic(2),normal(0). |
unReadTextColor | Text color for the message body for unread messages | Ex: @color/unread_text_color | May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
unReadTextSize | Text size for the message body for unread messages | Ex: @dimen/default_text_size | May 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). |
unReadTextTypeface | Typeface for the message body for unread messages | Ex:normal | Must be one of the following constant values monospace(3),normal(0),sans(1),serif (2) |
unReadTextStyle | Text style for the message body for unread messages | Ex:normal | Must be one or more (separated by '|') of the following constant values bold(1),italic(2),normal(0). |
unReadBgColor | Background colour for unread messages | Ex: @color/inbox_bg_color | May 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". |
unReadCornerRadius | Corner radius for unread messages | Ex: @dimen/default_corner_radius | May 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). |
timeTextSize | Size of the text which displays the message time | Ex: @dimen/default_text_size | May 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). |
timeTextColor | Color of the text that displays the message time | Ex: @color/inbox_text_color | May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
badgeBackgroundResource | Background resource for the message badge | Ex: @drawable/badge | Reference to a draw-able resource to use for the Badge. |
badgeTextSize | Size of the text for the message badge | Ex: @dimen/default_text_size | May 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). |
badgeTextColor | Color of the text for the message badge | Ex: @color/connectui_white | May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
badgeTextTypeface | Typeface of the text for the message badge | Ex: normal | Must be one of the following constant values monospace(3),normal(0),sans(1),serif (2) |
badgeTextStyle | Style of the text for the message badge | Ex: normal | Must be one or more (separated by '|') of the following constant values bold(1),italic(2),normal(0). |
avatarWidth | The avatar width | Ex: 38dp | A dimension value |
avatarHeight | The avatar height | Ex: 38dp | A dimension value |
avatarScaleType | The avatar image scale type | Ex: fitXY | Must 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:
Parameter | Type | |
---|---|---|
threadId | String | threadId 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
Name | Description | Example | Supported Values |
---|---|---|---|
myBackgroundResource | Background Resource for my messages | Ex: @drawable/my_message_bubble | Drawable reference. If not specified myBubbleColor is used instead |
myBubbleColor | Bubble color for my messages | Ex: @color/my_message_bubble_color | May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
myCornerRadius | Corner radius for my messages | Ex: @dimen/default_corner_radius | May 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). |
myTimeTextSize | Size of the time text for my messages | Ex: @dimen/default_text_size | May 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). |
myTimeTextColor | Color of the time text for my messages | Ex: @color/default_text_color | May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
myTextColor | Color of the text for my messages | Ex: @color/default_text_color | May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
myTextLinkColor | Color of the text used for links within my messages | Ex: @color/default_text_link_color | May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
myTextSize | Size of the text for my messages | Ex: @dimen/default_text_size | May 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). |
myTextTypeface | Typeface of the text for my messages | Ex: normal | Must be one of the following constant values monospace(3),normal(0),sans(1),serif (2) |
myTextStyle | Style of the text for my messages | Ex: normal | Must be one or more (separated by '|') of the following constant values bold(1),italic(2),normal(0). |
theirBackgroundResource | Background resource for their messages | Ex: @drawable/their_message_bubble | Drawable reference. If not specified, theirBubbleColor is used instead |
theirBubbleColor | Color of the bubble for their messages | Ex: @color/their_message_bubble_color | May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
theirCornerRadius | Corner radius of the bubble for their messages | Ex: @dimen/default_corner_radius | May 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). |
theirTimeTextSize | Size of the time text for their messages | Ex: @dimen/default_text_size | May 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). |
theirTimeTextColor | Color of the time text for their messages | Ex: @color/default_text_color | May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
theirTextColor | Color of the text for their messages | Ex: @color/default_text_color | May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
theirTextLinkColor | Color of the text for links within their messages | Ex: @color/default_text_color | May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
theirTextSize | Size of the text for their messages | Ex: @dimen/default_text_size | May 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). |
theirTextTypeface | Typeface of the text for their messages | Ex: normal | Must be one of the following constant values monospace(3),normal(0),sans(1),serif (2) |
theirTextStyle | Style of the text for their messages | Ex: normal | Must be one or more (separated by '|') of the following constant values bold(1),italic(2),normal(0). |
myUnreadBackgroundResource | Background resource for my unread messages | Ex: @drawable/my_unread_message_bubble | Draw-able reference |
myUnreadBubbleColor | Bubble color for my unread messages | Ex: @color/connectui_dark_blue | May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
myUnreadCornerRadius | Corner radius for the background for my unread messages | Ex: @dimen/default_corner_radius | May 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). |
myUnreadTimeTextSize | Size of the time text for my unread messages | Ex: @dimen/default_text_size | May 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). |
myUnreadTimeTextColor | Color of the time text for my unread messages | Ex: @color/connectui_text_lightgrey | May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
myUnreadTextColor | Color of the text for my unread messages | Ex: @color/connectui_white | May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
myUnreadTextLinkColor | Color of any links within the text of my unread messages | Ex: @color/connectui_white | May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
myUnreadTextSize | Size of the text for my unread messages. | Ex: @dimen/default_text_size | May 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). |
myUnreadTextTypeface | Typeface of the text for my unread messages | Ex: normal | Must be one of the following constant values monospace(3),normal(0),sans(1),serif (2) |
myUnreadTextStyle | Style of the text for my unread messages | Ex: normal | Must be one or more (separated by '|') of the following constant values bold(1),italic(2),normal(0). |
alertBubbleColor | Color of the bubble for alerts | Ex: @android:color/transparent | May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
alertCornerRadius | Corner radius of the bubble for alerts | Ex: @dimen/default_corner_radius | May 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). |
alertTextColor | Color of the alert text | Ex: @color/connectui_text_darkgrey | May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
alertTextSize | Size of the alert text | Ex: @dimen/default_text_size | May 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). |
alertTextTypeface | Typeface of the alert text | Ex: normal | Must be one of the following constant values monospace(3),normal(0),sans(1),serif (2) |
alertTextStyle | Style of the alert text | Ex: bold | Must be one or more (separated by '|') of the following constant values bold(1),italic(2),normal(0). |
conversationBackgroundColor | Background color of the component | Ex: @color/conversation_bg_color | May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
avatarWidth | The avatar width | Ex: 38dp | A dimension value |
avatarHeight | The avatar height | Ex: 38dp | A dimension value |
avatarScaleType | The avatar image scale type | Ex: fitXY | Must be one of the following constant values viewMatrix(0), fitXY(1), fitStart(2), fitCenter(3), fitEnd(4), center(5), centerCrop(6), centerInside(7) |
myMarginLeft | The left margin for my messages | Ex: 4dp | A dimension value |
myMarginRight | The right margin for my messages | Ex: 4dp | A dimension value |
theirMarginLeft | The left margin for their messages | Ex: 4dp | A dimension value |
theirMarginRight | The left margin for their messages | Ex: 4dp | A dimension value |
myUnreadMarginLeft | The left margin for my unread messages | Ex: 4dp | A dimension value |
myUnreadMarginRight | The left margin for my unread messages | Ex: 4dp | A dimension value |
quickReplyViewStyle | The style for quick reply view | Ex: @style/IC | ICQuickReplyViewStyle |
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:
Parameter | Type | Description |
---|---|---|
category | ICConversationCategory | selected conversation category |
parentCategory | ICConversationCategory | parent 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:
Parameter | Description |
---|---|
myStyle | my message style |
theirStyle | their Message style |
unReadStyle | unRead message style |
alertStyle | Alert 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:
Parameter | Description |
---|---|
myStyle | my message style |
theirStyle | their Message style |
unReadStyle | unRead message style |
alertStyle | Alert 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:
Parameter | Description |
---|---|
readStyle | read message style |
unreadStyle | unread 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:
Parameter | Description |
---|---|
readStyle | read message style |
unreadStyle | unread 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
Updated 11 months ago