Message partview

com.imimobile.connect.ui.conversation

This package contains the following classes and interfaces.

Classes

  • ICConversationActivity
  • ICConversationCategory
  • ICConversationMessageViewFactory
  • ICConversationMessageViewHolder
  • ICConversationRecyclerView

Interfaces

  • ICMessageDisplayedListener
  • ICRetryClickListener

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


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 customised 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,

ICConversationCategory

Organisations 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 IMIconnect, 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.

ICConversationMessageViewFactory

Factory class that inherits from ICMessageViewFactory and creates ICConversationMessageViewHolder instances. Used as the default message view factory within ICConversationRecyclerView.

Refer ICMessageViewFactory, for details of the base methods, that are overridden by this class.

ICConversationMessageViewHolder

Concrete implementation of ICMessageViewHolder for use with ICConversationRecyclerView.

Refer ICMessageViewFactory, for details of the base methods, that are overridden by this class. In addition to the base, method overrides this class exposes the following methods.

setTimeVisibility


This method sets the visibility of the time display

  Syntax: boolean setTimeVisibilty(int visibility)

setStatusVisibility


This method sets the visibility of the status display

  Syntax: boolean setStatusVisibility(int visibility)

setOnRetryClickListener


This method Sets the listener which will be invoked when the retry message publication button is pressed.

  Syntax: boolean setOnRetryClickListener(ICRetryClickListener listener)

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 Unregisters 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)

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)

com.imimobile.connect.ui.conversation. composer

ICMessageComposerView

This class handles 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 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 message based on 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 to register an object, which implements the ICMessageComposerViewCallback to listen for message composed events, start Typing and stop typing events which occur while composing a message.

  Syntax: void setCallBack(ICMessageComposerViewCallback callback)
``
Parameters:

ParameterTypeDescription
callbackICMessageComposerViewCallbackmessage composer view callback

ICMessageComposerViewCallback

This interface represents call back methods implemented in message composer view to listen for message composed events, start Typing and stop typing events which 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[]Aan Array of ICMessage parts

onStartTyping


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

  Syntax: void onStopTyping()

onStopTyping


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

  Syntax: void onStopTyping()

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 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 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 to register 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 to register 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 creation of message instance 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 creation of message instance from the File document attachment message parts selected by the user.

ICMessageComposerFilePlugin


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

  Parameters:

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

ICMessageComposerGalleryPlugin

This class implements the ICMessageComposerPlugin and is responsible for creation of message instance from the attachment message parts selected by the user in 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 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 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 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 IMIconnect backend services. To achieve the best possible user experience it is recommended that you configure an appropriate message synchronisation 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, please 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 host 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 which utilises 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 "@[+][package:]type/name" or a theme attribute in the form "?[package:]type/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 "@[+][package:]type/name" or a theme attribute in the form "?[package:]type/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 drawable 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).

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 IMIconnect backend services. To achieve the best possible user experience, it is recommended that you configure an appropriate message synchronisation 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 which utilises 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_bubbleDrawable 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".

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

Must be hosted inside another fragment or an activity that implements the ICConversationCategoryFragmentListener interface.

Instantiation

The fragment provides a helper method which 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, please 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, please 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.


Copyright © 2000 - 2021 IMImobile Limited | All Rights Reserved