The IMIconnect UI SDK for Android builds on the message transport capabilities exposed within the Core SDK through a collection of customisable user interface components. These components may be used to easily integrate a fully featured rich messaging capability within a host application.

This document serves as a reference and details all of the public classes, interfaces, and methods.

New Classes and APIs are added to UI SDK to support message transport capabilities within the Core SDK through a collection of customisable user interface components

Find below, reference and details all of the public classes, interfaces and methods. A quick start guide is also available

Packages

PackageDescription
com.imimobile.connect.uiThe root level package; contains base UI and SDK initialization classes.
The following packages have the root package name removed for brevity.
.conversationContains UI components for displaying and interacting within a conversation
.conversation.composerContains classes used to display a message composer UI.
.conversation.composer.pluginsContains plugin classes use to support attachments within the composer.
.conversation.fragmentsContains pre-built fragments for displaying a conversation and conversations list.
.dataContains data classes
.data.messagepartContains data classes that represent parts of a message
.enumsContains enumerations
.inboxContains classes used to display messages in an inbox style UI
.interfacesContains various interfaces
.utilsContains utility classes
.views.partviewsContains base UI classes used to display message parts.
.views.partviews.locationContains UI classes for displaying location attachments.
.views.partviews.mediaContains base UI class for displaying media attachments.
.views.partviews.media.audioContains UI classes for displaying audio attachments.
.views.partviews.media.fileContains UI classes for displaying arbitrary file attachments.
.views.partviews.media.imageContains UI classes for displaying image attachments.
.views.partviews.media.videoContains UI classes for displaying video attachments.
.views.partviews.textContains UI classes for displaying the textual parts of a message.
.views.partviews.urlContains UI classes for displaying URL attachments.

com.imimobile.connect.ui

Classes

  • IMIconnectUI
  • ICUIConfig
  • ICMessageViewStyle
  • ICMessageRecyclerView
  • ICMessageViewHolder
  • ICMessageViewFactory
  • ICMessageGroupHeaderViewHolder
  • ICMessageDataProvider

Interfaces

  • ICMessageRecyclerView.ICMessageClickListener
  • ICMessageRecyclerView.ICMessageMenuHandler

IMIconnectUI

This class Handles initialisation of the SDK.

Public Methods
void startup
void shutdown
boolean isStarted
String getSDKVersion

startup


This method initialises the SDK for use. This variant must be called to initialise the SDK before any other features may be used

  Syntax: void startup(android.content.Context context, ICUIConfig config, ICUIStartupCallback callback)

  Parameters:

ParameterTypeDescription
contextcontent.ContextA valid Application Context
configICUIConfigA valid ICUIConfig instance which configures aspects of the SDK startup
callbackICUIStartupCallbackUsed to notify startup success, may be null

📘

Note:

When using download at runtime Emoji support, you should always implement the callback and use UI components until startup is complete.

shutdown


This method provides a means to shutdown the SDK and perform cleanup, after this method is called, none of the SDK features will work

  Syntax: void shutdown(com.imimobile.connect.core.callbacks.ICShutdownCallback callback)

  Parameters:

ParameterTypeDescription
callbackcom.imimobile.connect.core.callbacks.ICShutdownCallbackUsed to notify shutdown success, may be null

isStarted


This method is used to verify whether the SDK has started or not.

  Syntax: boolean isStarted()

Returns value: Returns a value to state whether the SDK is started or not.

getSDKVersion


This method is used to retrieves/check the sdk build version

  Syntax: String getSDKVersion()

Returns value: Returns the SDK build version

ICUIConfig

This class represents methods for sdk configuration.

ICUIConfig ( Constructor)


This method is used to initialize an ICUIConfig instance with a fileProviderAuthority.

  Syntax: ICUIConfig(@NonNull String fileProviderAuthority)

  Parameters:

ParameterTypeDescription
fileProviderAuthorityStringfile provider Authority
Public Methods
boolean isDownloadEmoji()
void setDownloadEmoji(boolean downloadEmoji)
String getfileproviderauthority()

isDownloadEmoji


This Method is used to verify download Emoji value true or not

  Syntax: boolean isDownloadEmoji()

Returns value:
Returns 'true' if Emoji download is true, 'false' otherwise.

setDownloadEmoji


This Method is used to set download Emoji value.

  Syntax: void setDownloadEmoji(boolean downloadEmoji)

  Parameters:

ParameterTypeDescription
downloadEmojiBooleanSet the value of downloadEmoji

getFileProviderAuthority


This method returns FileProviderAuthority

  Syntax: String getFileProviderAuthority()

Returns value: Returns the FileProviderAuthority

ICMessageViewStyle

This class provides style attributes that are utilised by ICInboxRecyclerView & ICConversationRecyclerView for customization individual Message view components

setBackgroundResource


This method sets message background resource id

  Syntax: void setBackgroundResource(int resId)

  Parameters:

ParameterTypeDescription
resIdIntbackground resource id for message

setTextColor


This method sets message text color

  Syntax: void setTextColor(int color)

  Parameters:

ParameterTypeDescription
colorintcolor of message text

setTextLinkColor


This method sets message text link color

  Syntax: void setTextLinkColor(int textLinkColor)

  Parameters:

ParameterTypeDescription
textLinkColorinttext link color

setTextSize


This method sets message text size

  Syntax: void setTextSize(float size)

  Parameters:

ParameterTypeDescription
sizefloatSize of the text

setTextTypeface


This method sets message text typeface

  Syntax: void setTextTypeface(Typeface typeface)

  Parameters:

ParameterTypeDescription
typefaceandroid.graphics.Typefacetypeface of message text

setMargin


This method sets message text typeface

  Syntax: void setMargin(int left, int right)
Parameters:

ParameterTypeDescription
leftintLeft margin of message
rightintRight margin of message

setGravity


This method sets message gravity

  Syntax: void setGravity(int gravity)

  Parameters:

ParameterTypeDescription
gravityintgravity for message

getGravity


This method sets message gravity

  Syntax: getGravity()

  Returns value: Returns Gravity for message

getBackgroundResource


This method is used to get the Background resource Id for message

  Syntax: int getBackgroundResource()

  Returns value: Returns background resource Id for message

getTextColor


This method is used to get the Text color for message

  Syntax: int getTextColor()

  Returns value: Returns message text color value in the form of 0xAARRGGBB

getTextLinkColor


This method is used to get the Text link color for message.

  Syntax: int getTextLinkColor()

  Returns value: Return message text link color value in the form of 0xAARRGGBB

getTextSize


This method is used to get the Text Size for message.

  Syntax: float getTextSize()

  Returns value: returns text size for Message

getTextTypeface


This method is used to get the Text typeface for message.

  Syntax: Typeface getTextTypeface()

  Returns value: Returns text typeface for Message. Must be one of the following constant values monospace(3),normal(0),sans(1),serif (2)

getMarginLeft


This method is used to get the margin Left for message.

  Syntax: int getMarginLeft()

  Returns value: Returns margin left value for message

getMarginRight


This method is used to get the margin right for message.

  Syntax: int getMarginLeft()

  Returns value: Returns margin right value for message

getCornerRadius


This method is used to get the Corner radius for the message.

  Syntax: int getCornerRadius()

  Returns value: Returns Corner radius value for message

setCornerRadius


This method set the Corner radius value

  Syntax: int getCornerRadius()

  Parameters:

ParameterTypeDescription
cornerRadiusintCorner radius value for message

getBackgroundColor


This method is used to get the background color for message.

  Syntax: getBackgroundColor()

  Returns value:** Returns background color for message

setBackgroundColor


This method sets background color for message

  Syntax: void setBackgroundColor(int backgroundColor)

  Parameters:

ParameterTypeDescription
backgroundColorintbackground color for message

getTimeTextSize


This method is used to get the Time Text size for message.

  Syntax: int getTimeTextSize()

  Returns value: Returns Time Text size value for message

setTimeTextSize


This method sets Time Text size for message

  Syntax: void setTimeTextSize(int timeTextSize)

  Parameters:

ParameterTypeDescription
timeTextSizeintTime Text size value for message

getTimeTextColor


This method is used to get the Time Text Color for message.

  Syntax: int getTimeTextColor()

  Returns value: Returns Time Text Color value for message in the form of 0xAARRGGBB

setTimeTextColor


This method sets Time Text color for message

  Syntax: void setTimeTextColor(int timeTextColor)

  Parameters:

ParameterTypeDescription
timeTextColorintTime Text color value for message in the form of 0xAARRGGBB

ICMessageRecyclerView

This class has responsibility to obtain its data through ICMessageDataProvider and uses ICMessageViewHolder instances to display the data.

Public Constructors
public ICMessageRecyclerView(Context context)
public ICMessageRecyclerView(Context context,AttributeSet attrs)
public ICMessageRecyclerView(Context context,AttributeSet attrs,int defStyle)

createMessageAdapter


This method is used to create message Adapter instance

  Syntax: protected ICMessageRecyclerView.MessageAdapter createMessageAdapter()
Returns value:** returns message adapter

init


This method is used to Initialize the message recycler View

  Syntax: protected void init()

setMessageMenuHandler


This method sets an object which implements ICMessageMenuHandler interface to listen menu build and menu Item click callbacks

  Syntax: void setMessageMenuHandler(ICMessageRecyclerView.ICMessageMenuHandler menuBuilder)

  Parameters:

ParameterTypeDescription
menuBuilderICMessageRecyclerView.ICMessageMenuHandlermenu handler listener

createPopupMenu

protected android.support.v7.widget.PopupMenu createPopupMenu(int adapterPosition,

ICMessageViewHolder holder)

registerMessageClickListener

public void registerMessageClickListener(ICMessageRecyclerView.ICMessageClickListener listener)

This method allows to register an object which implements the
ICMessageClickListener interface to listen for Message click listener.

Parameters:

listener - message click Listener

unregisterMessageClickListener

public void unregisterMessageClickListener(ICMessageRecyclerView.ICMessageClickListener listener)

This method allows to unregister a previously registered object which implements
the ICMessageClickListener interface, in order to stop listening for Message
click listener.

Parameters:

listener - message click Listener

setAdapter

public void setAdapter(android.support.v7.widget.RecyclerView.Adapter adapter)

Overrides:

setAdapter in class android.support.v7.widget.RecyclerView

onVisibilityChanged

protected void onVisibilityChanged(View changedView,

int visibility)

Automatically refresh on resume

Overrides:

onVisibilityChanged in class View

refresh

public void refresh()

This method refreshes this adapter based on data set changed

registerPartViewFactories

public void registerPartViewFactories(ICMessagePartViewFactory[] factories)

This method register partView factories to be handled by this message Recycler
View

Parameters:

factories - Array of partView factories to be registered

unregisterPartViewFactories

public void unregisterPartViewFactories(ICMessagePartViewFactory[] factories)

This method unregister partView factories for this message Recycler View

Parameters:

factories - Array of partView factories to be registered

setMessageProvider

public void setMessageProvider(T provider)
throws ICException

This method sets message provider which implements ICMessageDataProvider

Parameters:

provider - message data provider

Throws:

com.imimobile.connect.core.exception.ICException

getMessageProvider

public T getMessageProvider()

This method returns message data provider

Returns:

returns the message data provider

setMessageViewFactory

public void setMessageViewFactory(ICMessageViewFactory<[V]> factory)

This method sets Message View factory object which inherit from
ICMessageViewFactory

Parameters:

factory – messageViewFactory

setMessageViewStyle

public void setMessageViewStyle(ICMessageViewStyle myStyle,

ICMessageViewStyle theirStyle)

This method sets message view styles for my Messages and Their Messages

Parameters:

myStyle - my message style

theirStyle - their Message style

setUnreadMessageViewStyle

public void setUnreadMessageViewStyle(ICMessageViewStyle unreadStyle)

This method sets message view style for unRead Messages

Parameters:

unreadStyle - unRead message style

setAlertMessageViewStyle

public void setAlertMessageViewStyle(ICMessageViewStyle style)

This method sets alert message view style

Parameters:

style - Alert Message style

setAvatars

public void setAvatars(Bitmap myAvatar,

Bitmap theirAvatar)

This method set avatar for my Message and Their Message

Parameters:

myAvatar - avatar for my message

theirAvatar - avatar for their message

getMyMessageViewStyle

protected ICMessageViewStyle getMyMessageViewStyle()

This method returns my message view style

Returns:

returns my message view style

getTheirMessageViewStyle

protected ICMessageViewStyle getTheirMessageViewStyle()

This method returns their message view style

Returns:

returns their message view style

getUnreadMessageViewStyle

protected ICMessageViewStyle getUnreadMessageViewStyle()

This method returns Unread message view style

Returns:

returns Unread message view style

getAlertMessageViewStyle

protected ICMessageViewStyle getAlertMessageViewStyle()

This method returns Alert message view style

Returns:

returns Alert message view style

ICMessageViewHolder

This abstract class responsibility is to bind ICMessageData and apply styles ICMessageViewStyle to message Views.

Public Methods
void bindAvatar(Bitmap avatar)
void bindMessage(ICMessageData messageData, ICMessagePart[] messageParts)
void setMessageViewStyle(ICMessageViewStyle style)
ICMessagePartContainerViewHolder getPartContainerViewHolder()
View getView()

bindAvatar


This method binds avatar to message view holder

  Syntax: void bindAvatar(Bitmap avatar)

  Parameters:

ParametertypeDescription
avatarbitmapavatar bitmap

bindMessage


This method binds message parts to respective message part view holder

  Syntax: void bindMessage(ICMessageData messageData, ICMessagePart[] messageParts)
Parameters:

ParametertypeDescription
messageDatacom.imimobile.connect.core.messaging.ICMessageData messageDataICMessageData
messagePartscom.imimobile.connect.core.messaging.ICMessageData messageDataan array of message parts

setMessageViewStyle


This method sets message view style to message view holder

  Syntax: void setMessageViewStyle(ICMessageViewStyle style)

  Parameters:

ParametertypeDescription
styleICMessageViewStyleMessage view style

getPartContainerViewHolder


This method returns message part container view holder.

  Syntax: abstract ICMessagePartContainerViewHolder getPartContainerViewHolder()

  Returns value: Returns message part container view holder

getPartContainerViewHolder


This Method returns Message View holder.

  Syntax: android.view.View getView()

  Returns value: Returns view object for message view holder.

ICMessageViewFactory

This factory has the responsibility to create all the message views that will be displayed in the conversation.

getMessageGroupHeaderViewType


This method used to get message Group Header View type

  Syntax: long getMessageGroupHeaderViewType(ICMessageGroup group)

  Parameters:

ParameterTypeDescription
groupICMessageGroupmessage group

  Returns value: Returns message Group Header View type

createMessageGroupHeaderView


This method used to create message group header View holder.

  Syntax: abstract ICMessageGroupHeaderViewHolder createMessageGroupHeaderView(android.view.ViewGroup parent, long viewType)

  Parameters:

ParameterTypeDescription
parentandroid.view.ViewGroupparent viewgroup
viewTypelongview type

  Returns value: Returns Message group Header View holder object.

getMessageViewIdentifier


This method is to get message view identifier based on message parts and factory map

  Syntax: getMessageViewIdentifier(ICMessageData messageData, ICMessagePart[] messageParts, java.util.Map<String,ICMessagePartViewFactory> factoryMap)

  Parameters:

ParameterTypeDescription
messageDataICMessageDatamessage data from adapter position
messagePartsICMessagePart[]message parts from data provider
factoryMapjava.util.Map<String,ICMessagePartViewFactory>message partview factory map

  Returns value: Returns message Group Header View type

createMessageView


This method is used to create message view holder.

  Syntax: createMessageView(android.view.ViewGroup parent, String identifier, java.util.List<ICMessagePartViewFactory> factoryList)

  Parameters:

ParameterTypeDescription
parentandroid.view.ViewGroupparent view group
identifierStringmessage view identifier
factoryListListmessage part view factory list

  Returns value: Returns created message view holder.

createPartViews


This method used to create part views, message part views are added to message part container View holder.

  Syntax: createPartViews(ICMessageViewHolder<T> messageViewHolder, String identifier,java.util.List<ICMessagePartViewFactory> factoryList)

  Parameters:

ParameterTypeDescription
messageViewHolderICMessageViewHolderimplementation of message view holder
identifierStringmessage view identifier
factoryListICMessagePartViewFactorymessage part view factory map

ICMessageGroupHeaderViewHolder

This class binds message group details into message Group View.

bindMessageGroup


This method binds message group details.

  Syntax: void bindMessageGroup(ICMessageGroup messageGroup)

  Parameters:

ParameterTypeDescription
messageGroupICMessageGroupmessage group details

getView


This method returns message group header view.

  Syntax: View getView()

  Returns value: Returns message group view

ICMessageDataProvider

This class provides an interface to obtain message data for displaying it in ICMessageViewHolder instances.

getMessageGroup


This abstract method is used to get message group.

  Syntax: abstract ICMessageGroup getMessageGroup(int position)

  Parameters:

ParameterTypeDescription
positionIntmessage adapter position

  Returns value: Returns message group view

getMessageCount


This abstract method is used to get the message count from message data provider.

  Syntax: abstract int getMessageCount()

  Returns value: Returns the message count from message data provider.

getMessageData


This abstract method is used to get message data details from message data provider

  Syntax: abstract ICMessageData getMessageData(int position)

  Parameters:

ParameterTypeDescription
positionintmessage adapter position

  Returns value: Returns MessageData details from message data provider.

getMessageParts


This method is used to get message parts from message details passed.

  Syntax: ICMessagePart[] getMessageParts(ICMessageData message)

  Parameters:

ParameterTypeDescription
messageICMessageDatamessage data

  Returns value: Returns array of message parts from message data.

deleteMessage


This method deletes message from data provider based on position

  Syntax: abstract boolean deleteMessage(int position)

  Parameters:

ParameterTypeDescription
PositionIntPosition of the message

  Returns value: Returns true if message deletion is successful , false otherwise

notifyDataSetChanged


This method notifies any registered observers that the data set has changed.

  Syntax: void notifyDataSetChanged()

registerObserver


This method allows registering an object which implements the ICDataSetObserver interface to listen for DataSet changes in Message data provider

  Syntax: registerObserver(ICDataSetObserver observer)

  Parameters:

ParameterTypeDescription
observerICDataSetObserverDataSet observer Listener

unregisterObserver


This method allows unregistering a previously registered object which implements the ICDataSetObserver interface, in order to stop listening for DataSet changes in Message data provider.

  Syntax: unregisterObserver(ICDataSetObserver observer)

  Parameters:

ParameterTypeDescription
observer -ICDataSetObserverDataSet observer Listener

ICMessageRecyclerView.ICMessageClickListener

This interface defines for a callback to be invoked when a Message view is clicked

onMessageClick


This method will be invoked when message click event happened

  Syntax: `boolean onMessageClick(int position)``

ParameterTypeDescription
positionintmessage position

  Returns value: Returns True if the listener has consumed the message click event, false otherwise.

onMessageLongClick


This method will be invoked when message long click event happened.

  Syntax: `boolean onMessageLongClick(int position)``

ParameterTypeDescription
positionintmessage position

  Returns value: True if the listener has consumed the message long click event, false otherwise.

ICMessageRecyclerView.ICMessageMenuHandler

This interface definition to be invoked to listen menu build and menu Item click callbacks

onBuildMenu


This method is used to callback upon popup menu build

  Syntax: PopupMenu onBuildMenu(android.support.v7.widget.PopupMenu popupMenu,int adapterPosition,android.view.View anchor)

ParameterTypeDescroption
popupMenuandroid.support.v7.widget.PopupMenua new popup menu
adapterPositionintmessage adapter position
anchorandroid.view.Viewanchor view

  Returns value: Returns popup menu

onMenuItemClick


This method will be invoked when the menu item was clicked

  Syntax: boolean onMenuItemClick(MenuItem menuItem)

ParameterTypeDescription
menuItemMenuItemitem the menu item that was clicked

com.imimobile.connect.ui.conversation

Classes

  • ICConversationActivity
  • ICConversationCategory
  • ICConversationMessageViewFactory
  • ICConversationMessageViewHolder
  • ICConversationRecyclerView

Interfaces

  • ICMessageDisplayedListener
  • ICRetryClickListener

ICConversationActivity

This activity leverages the functionality of the lower level components and provides necessary wiring to combine them into a fully 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. Select a conversation to display the conversation view and allow 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 is provided to cover different usage 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 your 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 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 is shown 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


This method Starts the activity to display a specific conversation.

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

  Parameters:

ParameterTypeDescription
contextAndroid context
conversationIdConversation Id
extArgsBundle with extra arguments

Starts the activity to display a list of conversations.

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

  Parameters:

ParameterTypeDescription
contextAndroid context
categoriesconversation categories
customerDetailscustomer details object
extArgsBundle with extra arguments

Styling

The activity may be 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. Refer to their styling sections for further information.

ICConversationCategory

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

The information contained in an 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.

Properties

Property Description
Title A user-friendly title
Image A bitmap object representing the category
Sub-categories An array list of sub categories

Constructors

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

Methods

getImageUri

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

  Syntax: `android.net.Uri getImageUri()``

  Return Value: Returns a uri to an image representing the category, which must be a local uri.

setImageUri

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

  Syntax: android.net.Uri getImageUri()


Copyright © 2000 - 2021 IMImobile Limited | All Rights Reserved