Package io.smooch.ui
Class ConversationActivity
- java.lang.Object
-
- AppCompatActivity
-
- io.smooch.ui.ConversationActivity
-
- All Implemented Interfaces:
ConversationDelegate
public class ConversationActivity extends AppCompatActivity implements ConversationDelegate
-
-
Field Summary
-
Fields inherited from interface io.smooch.core.ConversationDelegate
INTEGRATOR_DELEGATE
-
-
Constructor Summary
Constructors Constructor Description ConversationActivity()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ConversationActivityBuilder
builder()
Returns a new builder for configuring and displayingConversationActivity
.static void
close()
Closes the conversation view.void
onBackPressed()
void
onCardSummaryLoaded(CardSummary cardSummary)
Notifies the delegate when a saved stripe card is loaded.void
onConversationEventReceived(ConversationEvent conversationEvent)
Notifies the delegate of a new activity.void
onConversationsListUpdated(java.util.List<Conversation> conversationsList)
Notifies the delegate when the conversations list was updated.protected void
onCreate(android.os.Bundle savedInstanceState)
boolean
onCreateOptionsMenu(android.view.Menu menu)
protected void
onDestroy()
void
onInitializationStatusChanged(InitializationStatus status)
Notifies the delegate of a change in Initialization status.void
onLoginComplete(LoginResult result)
Notifies the delegate when a call toSmooch.login(String, String, SmoochCallback)
is completevoid
onLogoutComplete(LogoutResult result)
Notifies the delegate when a call toSmooch.logout(SmoochCallback)
is completevoid
onMessageSent(Message message, MessageUploadStatus status)
Notifies the delegate of a message being sent.void
onMessagesReceived(Conversation conversation, java.util.List<Message> messages)
Notifies the delegate of new incoming messages.void
onMessagesReset(Conversation conversation, java.util.List<Message> messages)
Notifies the delegate the messages in a conversation have been reset.boolean
onOptionsItemSelected(android.view.MenuItem item)
void
onPause()
void
onPaymentProcessed(MessageAction messageAction, PaymentStatus status)
Notifies the delegate when payment is processed.void
onPurchaseComplete()
void
onResume()
void
onShadedAreaClick()
void
onSmoochConnectionStatusChanged(SmoochConnectionStatus status)
Notifies the delegate when the user's connection to Smooch has changed.void
onSmoochHidden()
Notifies the delegate when the Smooch Conversation is hidden.void
onSmoochShown()
Notifies the delegate when the Smooch Conversation is shown.void
onStart()
void
onStop()
void
onStripeFragmentClose()
void
onStripeFragmentShown()
void
onUnreadCountChanged(Conversation conversation, int unreadCount)
Notifies the delegate of a change in unread message count.void
onWebviewHidden()
void
onWebviewShown()
boolean
shouldTriggerAction(MessageAction messageAction)
Allows a delegate to override default action behavior.
-
-
-
Method Detail
-
builder
public static ConversationActivityBuilder builder()
Returns a new builder for configuring and displayingConversationActivity
.- Returns:
- a new
ConversationActivityBuilder
-
close
public static void close()
Closes the conversation view.Ignored if the conversation is not running.
-
onCreate
protected void onCreate(android.os.Bundle savedInstanceState)
-
onDestroy
protected void onDestroy()
-
onCreateOptionsMenu
public boolean onCreateOptionsMenu(android.view.Menu menu)
-
onOptionsItemSelected
public boolean onOptionsItemSelected(android.view.MenuItem item)
-
onBackPressed
public void onBackPressed()
-
onResume
public void onResume()
-
onPause
public void onPause()
-
onStart
public void onStart()
-
onStop
public void onStop()
-
onMessagesReceived
public void onMessagesReceived(Conversation conversation, java.util.List<Message> messages)
Description copied from interface:ConversationDelegate
Notifies the delegate of new incoming messages.Called when new messages are received from the server.
- Specified by:
onMessagesReceived
in interfaceConversationDelegate
- Parameters:
conversation
- The conversation object.messages
- A list of Message objects representing the new messages.
-
onMessagesReset
public void onMessagesReset(Conversation conversation, java.util.List<Message> messages)
Description copied from interface:ConversationDelegate
Notifies the delegate the messages in a conversation have been reset.Called when new messages are received from the server that do not match locally stored cache or if a different conversation was loaded.
- Specified by:
onMessagesReset
in interfaceConversationDelegate
- Parameters:
conversation
- The conversation object.messages
- A list of Message objects representing the new messages.
-
onUnreadCountChanged
public void onUnreadCountChanged(Conversation conversation, int unreadCount)
Description copied from interface:ConversationDelegate
Notifies the delegate of a change in unread message count.Called when conversation data is fetched from the server, or when the user enters the conversation activity.
- Specified by:
onUnreadCountChanged
in interfaceConversationDelegate
- Parameters:
conversation
- The conversation objectunreadCount
- The count of unread messages
-
onMessageSent
public void onMessageSent(Message message, MessageUploadStatus status)
Description copied from interface:ConversationDelegate
Notifies the delegate of a message being sent.Called once the message has been sent successfully or not.
- Specified by:
onMessageSent
in interfaceConversationDelegate
- Parameters:
message
- The message that was sentstatus
- The status of the message that was sent- See Also:
MessageUploadStatus
-
onConversationEventReceived
public void onConversationEventReceived(ConversationEvent conversationEvent)
Description copied from interface:ConversationDelegate
Notifies the delegate of a new activity.Called when a new activity is received from the server
- Specified by:
onConversationEventReceived
in interfaceConversationDelegate
- Parameters:
conversationEvent
- The conversationActivity that was received- See Also:
ConversationEventType
-
onInitializationStatusChanged
public void onInitializationStatusChanged(InitializationStatus status)
Description copied from interface:ConversationDelegate
Notifies the delegate of a change in Initialization status.- Specified by:
onInitializationStatusChanged
in interfaceConversationDelegate
- Parameters:
status
- The new status- See Also:
InitializationStatus
-
onLoginComplete
public void onLoginComplete(LoginResult result)
Description copied from interface:ConversationDelegate
Notifies the delegate when a call toSmooch.login(String, String, SmoochCallback)
is complete- Specified by:
onLoginComplete
in interfaceConversationDelegate
- Parameters:
result
- The login result- See Also:
LoginResult
-
onLogoutComplete
public void onLogoutComplete(LogoutResult result)
Description copied from interface:ConversationDelegate
Notifies the delegate when a call toSmooch.logout(SmoochCallback)
is complete- Specified by:
onLogoutComplete
in interfaceConversationDelegate
- Parameters:
result
- The logout result- See Also:
LogoutResult
-
onPaymentProcessed
public void onPaymentProcessed(MessageAction messageAction, PaymentStatus status)
Description copied from interface:ConversationDelegate
Notifies the delegate when payment is processed.- Specified by:
onPaymentProcessed
in interfaceConversationDelegate
- Parameters:
messageAction
- The purchased message actionstatus
- The status of the payment- See Also:
MessageAction
,PaymentStatus
-
shouldTriggerAction
public boolean shouldTriggerAction(MessageAction messageAction)
Description copied from interface:ConversationDelegate
Allows a delegate to override default action behavior.Called when the user taps a message action.
- Specified by:
shouldTriggerAction
in interfaceConversationDelegate
- Parameters:
messageAction
- The message action that was tapped.- Returns:
- false to prevent default behaviour of message action click, true otherwise
- See Also:
MessageAction
-
onCardSummaryLoaded
public void onCardSummaryLoaded(CardSummary cardSummary)
Description copied from interface:ConversationDelegate
Notifies the delegate when a saved stripe card is loaded.Called when the stripe card info is loaded.
- Specified by:
onCardSummaryLoaded
in interfaceConversationDelegate
- Parameters:
cardSummary
- The stripe card information.- See Also:
CardSummary
-
onSmoochConnectionStatusChanged
public void onSmoochConnectionStatusChanged(SmoochConnectionStatus status)
Description copied from interface:ConversationDelegate
Notifies the delegate when the user's connection to Smooch has changed.Called when the user's connection to Smooch changes.
- Specified by:
onSmoochConnectionStatusChanged
in interfaceConversationDelegate
- Parameters:
status
- The connection status.- See Also:
SmoochConnectionStatus
-
onSmoochShown
public void onSmoochShown()
Description copied from interface:ConversationDelegate
Notifies the delegate when the Smooch Conversation is shown.- Specified by:
onSmoochShown
in interfaceConversationDelegate
-
onSmoochHidden
public void onSmoochHidden()
Description copied from interface:ConversationDelegate
Notifies the delegate when the Smooch Conversation is hidden.- Specified by:
onSmoochHidden
in interfaceConversationDelegate
-
onConversationsListUpdated
public void onConversationsListUpdated(java.util.List<Conversation> conversationsList)
Description copied from interface:ConversationDelegate
Notifies the delegate when the conversations list was updated. If you are building your own conversation list UI, implement this method to receive updates on any conversations in the list for this user- Specified by:
onConversationsListUpdated
in interfaceConversationDelegate
- Parameters:
conversationsList
- an updated list ofConversation
-
onStripeFragmentShown
public void onStripeFragmentShown()
-
onStripeFragmentClose
public void onStripeFragmentClose()
-
onPurchaseComplete
public void onPurchaseComplete()
-
onShadedAreaClick
public void onShadedAreaClick()
-
onWebviewShown
public void onWebviewShown()
-
onWebviewHidden
public void onWebviewHidden()
-
-