Core UI
The Webex Connect UI SDK for Android builds on the message transport capabilities exposed within the Core SDK through a collection of customizable 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 customizable user interface components
The details of all of the public classes, interfaces, and methods are available in the sections that follow. Also, see the Quick Start Guide.
Packages
The following table lists all the packages along with their descriptions:
Package | Description |
---|---|
| The root-level package; contains base UI and SDK, initialization classes. |
The following packages have the root package name removed for brevity. | |
| Contains UI components for displaying and interacting within a conversation |
| Contains classes used to display a message composer UI. |
| It contains plugin classes use to support attachments within the composer. |
| It contains pre-built fragments for displaying a conversation and conversations list. |
| Contains data classes |
| Contains data classes that represent parts of a message |
| Contains enumerations |
| Contains classes used to display messages in an inbox style UI |
| Contains various interfaces |
| Contains utility classes |
| Contains base UI classes used to display message parts. |
| It contains UI classes for displaying location attachments. |
| It contains a base UI class for displaying media attachments. |
| It contains UI classes for displaying audio attachments. |
| It contains UI classes for displaying arbitrary file attachments. |
| It contains UI classes for displaying image attachments. |
| It contains UI classes for displaying video attachments. |
| It contains UI classes for displaying the textual parts of a message. |
| It contains UI classes for displaying URL attachments. |
com.imimobile.connect.ui
Classes | Interfaces |
---|---|
|
|
imiconnectUI
This class handles the initialization of the SDK.
Public Methods | |
---|---|
void | |
void | |
boolean | |
String |
startup
This method initializes the SDK for use. This variant must be called to initialize the SDK before any other features may be used.
Syntax: void startup(android.content.Context context, ICUIConfig config, ICUIStartupCallback callback)
Parameters:
Parameter | Type | Description |
---|---|---|
context |
| A valid Application Context |
config | A valid | |
callback | Used to notify startup success, may be |
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 shut down the SDK and performs cleanup, after this method is called, none of the SDK features will work
Syntax: void shutdown(com.imimobile.connect.core.callbacks.ICShutdownCallback callback)
Parameters:
Parameter | Type | Description |
---|---|---|
callback |
| Used to notify shutdown success, may be null |
isStarted
This method is used to verify whether the SDK has started or not.
Syntax: boolean isStarted()
Return value: Returns a value to indicate whether the SDK is started or not.
getSDKVersion
This method is used to retrieves/check the SDK build version.
Syntax: String getSDKVersion()
Return value: Returns the SDK build version.
ICUIConfig
This class represents the methods for SDK configuration.
ICUIConfig (Constructor)
This method is used to initialize an ICUIConfig instance with a fileProviderAuthority.
Syntax: ICUIConfig(@NonNull String fileProviderAuthority)
Parameters:
Parameter | Type | Description |
---|---|---|
fileProviderAuthority | String | file provider Authority |
Public Methods | |
---|---|
boolean | |
void | |
String |
isDownloadEmoji
This method is used to verify the download Emoji value, true or false.
Syntax: boolean isDownloadEmoji()
Return value: Returns true if Emoji download is true, false otherwise.
setDownloadEmoji
This method is used to set the download Emoji value.
Syntax: void setDownloadEmoji(boolean downloadEmoji)
Parameters:
Parameter | Type | Description |
---|---|---|
downloadEmoji | Boolean | Set the value of downloadEmoji |
getFileProviderAuthority
This method returns FileProviderAuthority.
Syntax: String getFileProviderAuthority()
Return value: Returns the FileProviderAuthority.
ICMessageViewStyle
This class provides style attributes that are utilized by ICInboxRecyclerView
and ICConversationRecyclerView
for customization of individual message view components.
Public Methods | |
---|---|
void | |
void | |
void | |
void | |
void | |
void | |
void | |
void | |
int | |
int | |
int | |
float | |
Typeface | |
int | |
int | |
int | |
int | |
int | |
void | |
int | |
void | |
int | |
void |
setBackgroundResource
This method sets the message background resource id.
Syntax: void setBackgroundResource(int resId)
Parameters:
Parameter | Type | Description |
---|---|---|
resId | Int | background resource id for message |
setTextColor
This method sets the message text color.
Syntax: void setTextColor(int color)
Parameters:
Parameter | Type | Description |
---|---|---|
color | int | color of message text |
setTextLinkColor
This method sets the message text link color.
Syntax: void setTextLinkColor(int textLinkColor)
Parameters:
Parameter | Type | Description |
---|---|---|
textLinkColor | int | text link color |
setTextSize
This method sets the message text size.
Syntax: void setTextSize(float size)
Parameters:
Parameter | Type | Description |
---|---|---|
size | float | Size of the text |
setTextTypeface
This method sets the message text typeface.
Syntax: void setTextTypeface(Typeface typeface)
Parameters:
Parameter | Type | Description |
---|---|---|
typeface | android.graphics.Typeface | typeface of message text |
setMargin
This method sets the message margin.
Syntax: void setMargin(int left, int right)
Parameters:
Parameter | Type | Description |
---|---|---|
left | int | Left margin of message |
right | int | Right margin of message |
setGravity
This method sets the message gravity.
Syntax: void setGravity(int gravity)
Parameters:
Parameter | Type | Description |
---|---|---|
gravity | int | gravity for message |
getGravity
This method sets the message gravity.
Syntax: getGravity()
Return value: Returns gravity for message.
getBackgroundResource
This method is used to get the Background resource Id for the message.
Syntax: int getBackgroundResource()
Returns value: Returns background resource Id for the message.
getTextColor
This method is used to get the text color for the message.
Syntax: int getTextColor()
Return value: Returns the message text color value in the form of 0xAARRGGBB
.
getTextLinkColor
This method is used to get the Text link color for the message.
Syntax: int getTextLinkColor()
Return value: Return message text link color value in the form of 0xAARRGGBB
getTextSize
This method is used to get the Text Size for the message.
Syntax: float getTextSize()
Return value: returns text size for Message
getTextTypeface
This method is used to get the Text typeface for message.
Syntax: Typeface getTextTypeface()
Return 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 the message.
Syntax: int getMarginLeft()
Return value: Returns margin left value for message
getMarginRight
This method is used to get the margin-right for the message.
Syntax: int getMarginLeft()
Return value: Returns margin right value for message
getCornerRadius
This method is used to get the Corner radius for the message.
Syntax: int getCornerRadius()
Return value: Returns Corner radius value for message
setCornerRadius
This method set the Corner radius value
Syntax: int getCornerRadius()
Parameters:
Parameter | Type | Description |
---|---|---|
cornerRadius | int | Corner radius value for message |
getBackgroundColor
This method is used to get the background color for the message.
Syntax: getBackgroundColor()
Return value:** Returns background color for message
setBackgroundColor
This method sets the background color for the message.
Syntax: void setBackgroundColor(int backgroundColor)
Parameters:
Parameter | Type | Description |
---|---|---|
backgroundColor | int | background color for message |
getTimeTextSize
This method is used to get the Time Text size for the message.
Syntax: int getTimeTextSize()
Return value: Returns Time Text size value for message
setTimeTextSize
This method sets Time Text size for the message
Syntax: void setTimeTextSize(int timeTextSize)
Parameters:
Parameter | Type | Description |
---|---|---|
timeTextSize | int | Time Text size value for message |
getTimeTextColor
This method is used to get the Time Text Color for the message.
Syntax: int getTimeTextColor()
Return value: Returns Time Text Color value for message in the form of 0xAARRGGBB
setTimeTextColor
This method sets the Time Text color for message.
Syntax: void setTimeTextColor(int timeTextColor)
Parameters:
Parameter | Type | Description |
---|---|---|
timeTextColor | int | Time Text color value for message in the form of 0xAARRGGBB |
ICMessageRecyclerView
This class has the 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 a message Adapter instance.
Syntax: protected ICMessageRecyclerView.MessageAdapter createMessageAdapter()
Return 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:
Parameter | Type | Description |
---|---|---|
menuBuilder | menu handler listener |
createPopupMenu
protected android.support.v7.widget.PopupMenu createPopupMenu(int adapterPosition,
ICMessageViewHolder holder)
registerMessageClickListener
public void registerMessageClickListener(ICMessageRecyclerView.ICMessageClickListener)
This method allows registering an object which implements the
ICMessageClickListener interface to listen for Message click listener.
Parameters:
listener - message click Listener
unregisterMessageClickListener
public void unregisterMessageClickListener(ICMessageRecyclerView.ICMessageClickListener)
This method allows unregistering a previously registered object which implements
the ICMessageClickListener interface, 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
Return:
returns the message data provider
setMessageViewFactory
public void setMessageViewFactory(ICMessageViewFactory<[V]> factory)
This method sets Message View factory object which inherits 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 an 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
Return:
returns my message view style
getTheirMessageViewStyle
protected ICMessageViewStyle getTheirMessageViewStyle()
This method returns its message view style.
Return:
returns their message view style
getUnreadMessageViewStyle
protected ICMessageViewStyle getUnreadMessageViewStyle()
This method returns the unread message view style.
Return:
returns Unread message view style
getAlertMessageViewStyle
protected ICMessageViewStyle getAlertMessageViewStyle()
This method returns the alert message view style.
Return:
returns Alert message view style
ICMessageViewHolder
This abstract class binds the ICMessageData
and applies the ICMessageViewStyle
to message views.
Public Methods | |
---|---|
void | |
void | bindMessage(ICMessageData messageData, ICMessagePart[] messageParts) |
void | |
ICMessagePartContainerViewHolder | |
View |
bindAvatar
This method binds the avatar to the message view holder.
Syntax: void bindAvatar(Bitmap avatar)
Parameters:
Parameter | type | Description |
---|---|---|
avatar | bitmap | avatar bitmap |
bindMessage
This method binds message parts to the respective message part view holder.
Syntax: void bindMessage(ICMessageData messageData, ICMessagePart[] messageParts)
Parameters:
Parameter | type | Description |
---|---|---|
messageData | com.imimobile.connect.core.messaging.ICMessageData messageData | ICMessageData |
messageParts | com.imimobile.connect.core.messaging.ICMessageData messageData | an array of message parts |
setMessageViewStyle
This method sets the message view style to message view holder.
Syntax: void setMessageViewStyle(ICMessageViewStyle style)
Parameters:
Parameter | type | Description |
---|---|---|
style | ICMessageViewStyle | Message view style |
getPartContainerViewHolder
This method returns the message part container view holder.
Syntax: abstract ICMessagePartContainerViewHolder getPartContainerViewHolder()
Return value: Returns message part container view holder
getPartContainerViewHolder
This method returns the message view holder.
Syntax: android.view.View getView()
Return value: Returns a 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:
Parameter | Type | Description |
---|---|---|
group | ICMessageGroup | message group |
Return value: Returns message Group Header View type
createMessageGroupHeaderView
This method is used to create the message group header view holder.
Syntax: abstract ICMessageGroupHeaderViewHolder createMessageGroupHeaderView(android.view.ViewGroup parent, long viewType)
Parameters:
Parameter | Type | Description |
---|---|---|
parent | android.view.ViewGroup | parent viewgroup |
viewType | long | view type |
Return value: Returns Message group Header View holder object.
getMessageViewIdentifier
This method is used to get the message view identifier based on message parts and factory map.
Syntax: getMessageViewIdentifier(ICMessageData messageData, ICMessagePart[] messageParts, java.util.Map<String,ICMessagePartViewFactory> factoryMap)
Parameters:
Parameter | Type | Description |
---|---|---|
messageData | ICMessageData | message data from adapter position |
messageParts | ICMessagePart[] | message parts from data provider |
factoryMap | java.util.Map<String,ICMessagePartViewFactory> | message partview factory map |
Return value: Returns the message Group Header View type.
createMessageView
This method is used to create a message view holder.
Syntax: createMessageView(android.view.ViewGroup parent, String identifier, java.util.List<ICMessagePartViewFactory> factoryList)
Parameters:
Parameter | Type | Description |
---|---|---|
parent | android.view.ViewGroup | parent view group |
identifier | String | message view identifier |
factoryList | List | message part view factory list |
Return value: Returns created message view holder.
createPartViews
This method is used to create part views. Message part views are added to the message part container view holder.
Syntax: createPartViews(ICMessageViewHolder<T> messageViewHolder, String identifier,java.util.List<ICMessagePartViewFactory> factoryList)
Parameters:
Parameter | Type | Description |
---|---|---|
messageViewHolder | ICMessageViewHolder | implementation of message view holder |
identifier | String | message view identifier |
factoryList | ICMessagePartViewFactory | message part view factory map |
ICMessageGroupHeaderViewHolder
This class binds message group details into the message group view.
bindMessageGroup
This method binds message group details.
Syntax: void bindMessageGroup(ICMessageGroup messageGroup)
Parameters:
Parameter | Type | Description |
---|---|---|
messageGroup | ICMessageGroup | message group details |
getView
This method returns the message group header view.
Syntax: View getView()
Return 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 the message group.
Syntax: abstract ICMessageGroup getMessageGroup(int position)
Parameters:
Parameter | Type | Description |
---|---|---|
position | Int | message adapter position |
Return value: Returns message group view.
getMessageCount
This abstract method is used to get the message count from the message data provider.
Syntax: abstract int getMessageCount()
Return 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:
Parameter | Type | Description |
---|---|---|
position | int | message adapter position |
Return value: Returns MessageData details from the message data provider.
getMessageParts
This method is used to get message parts from message details passed.
Syntax: ICMessagePart[] getMessageParts(ICMessageData message)
Parameters:
Parameter | Type | Description |
---|---|---|
message | ICMessageData | message data |
Return value: Returns array of message parts from message data.
deleteMessage
This method deletes the message from the data provider based on the position.
Syntax: abstract boolean deleteMessage(int position)
Parameters:
Parameter | Type | Description |
---|---|---|
position | Int | Position of the message |
Return 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 that implements the ICDataSetObserver
interface to listen for dataset changes in the message data provider.
Syntax: registerObserver(ICDataSetObserver observer)
Parameters:
Parameter | Type | Description |
---|---|---|
observer | ICDataSetObserver | DataSet 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 the Message data provider.
Syntax: unregisterObserver(ICDataSetObserver observer)
Parameters:
Parameter | Type | Description |
---|---|---|
observer | ICDataSetObserver | DataSet observer Listener |
ICMessageRecyclerView.ICMessageClickListener
This interface defines a callback to be invoked when a message view is clicked.
onMessageClick
This method will be invoked when the message click event happened
Syntax: `boolean onMessageClick(int position)``
Parameter | Type | Description |
---|---|---|
position | int | message position |
Return value: Returns True if the listener has consumed the message click event, false otherwise.
onMessageLongClick
This method is invoked when the message long-click event occurs.
Syntax: `boolean onMessageLongClick(int position)``
Parameter | Type | Description |
---|---|---|
position | int | message position |
Return 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 pop-up menu build.
Syntax: PopupMenu onBuildMenu(android.support.v7.widget.PopupMenu popupMenu,int adapterPosition,android.view.View anchor)
Parameter | Type | Descroption |
---|---|---|
popupMenu | android.support.v7.widget.PopupMenu | a new pop-up menu |
adapterPosition | int | message adapter position |
anchor | android.view.View | anchor view |
Return value: Returns a pop-up menu.
onMenuItemClick
This method is invoked when a menu item is clicked.
Syntax: boolean onMenuItemClick(MenuItem menuItem)
Parameter | Type | Description |
---|---|---|
menuItem | MenuItem | The menu item that was clicked |
com.imimobile.connect.ui.conversation
Classes | Interfaces |
---|---|
|
|
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 mode 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:
Parameter | Type | Description |
---|---|---|
context | Android context | |
conversationId | Conversation Id | |
extArgs | Bundle 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:
Parameter | Type | Description |
---|---|---|
context | Android context | |
categories | conversation categories | |
customerDetails | customer details object | |
extArgs | Bundle 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 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.
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, |
public ICConversationCategory(java.lang.String title, |
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()
Updated 6 months ago