Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. mFirebaseTextMessages.add(FirebaseTextMessage.createForRemoteUser(messageToDisplay, System.currentTimeMillis(), "a"));
  2. suggestReplies();
  3. private void suggestReplies(){
  4. mFirebaseSmartReply.suggestReplies(mFirebaseTextMessages)
  5. .addOnSuccessListener(new OnSuccessListener<SmartReplySuggestionResult>() {
  6. @Override
  7. public void onSuccess(SmartReplySuggestionResult result) {
  8. if (result.getStatus() == SmartReplySuggestionResult.STATUS_NOT_SUPPORTED_LANGUAGE) {
  9. // The conversation's language isn't supported, so the
  10. // the result doesn't contain any suggestions.
  11. } else if (result.getStatus() == SmartReplySuggestionResult.STATUS_SUCCESS) {
  12. // Task completed successfully
  13. // ...
  14.  
  15. suggestionList.clear();
  16. for (SmartReplySuggestion suggestion : result.getSuggestions()) {
  17. String replyText = suggestion.getText();
  18. Log.d(TAG, replyText);
  19. suggestionList.add(replyText);
  20. }
  21. mSuggestionAdapter.notifyDataSetChanged();
  22. mRecyclerView.setVisibility(View.VISIBLE);
  23. }
  24. }
  25. })
  26. .addOnFailureListener(new OnFailureListener() {
  27. @Override
  28. public void onFailure(@NonNull Exception e) {
  29. // Task failed with an exception
  30. // ...
  31. }
  32. });
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement