This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//File Message | |
// Sending a file message with a raw file | |
List<FileMessage.ThumbnailSize> thumbnailSizes = new ArrayList<>(); | |
thumbnailSizes.add(new ThumbnailSize(100,100)); | |
FileMessageParams params = new FileMessageParams() | |
.setFile(FILE) | |
.setFileName(FILE_NAME) | |
.setFileSize(FILE_SIZE) | |
.setMimeType(MIME_TYPE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//User Message | |
List<String> translationTargetLanguages = new ArrayList<>(); | |
translationTargetLanguages.add("fr"); // French | |
translationTargetLanguages.add("de"); // German | |
UserMessageParams params = new UserMessageParams() | |
.setMessage(TEXT_MESSAGE) | |
.setCustomType(CUSTOM_TYPE) | |
.setData(DATA) | |
.setTranslationTargetLanguages(translationTargetLanguages) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GroupChannelChatPresenterImpl @Inject constructor(private val preferenceHelper: AppPreferenceHelper) : | |
GroupChannelChatPresenter { | |
private lateinit var view: GroupChannelChatView | |
private lateinit var channelUrl: String | |
private lateinit var message: String | |
private var channel: GroupChannel? = null | |
private lateinit var context: Context | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GroupChannelChatActivity : AppCompatActivity(), GroupChannelChatView, GroupChannelChatAdapter.OnItemClickListener { | |
private val EXTRA_CHANNEL_URL = "EXTRA_CHANNEL_URL" | |
@Inject | |
lateinit var presenter: GroupChannelChatPresenterImpl | |
private lateinit var recyclerView: RecyclerView | |
private lateinit var adapter: GroupChannelChatAdapter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GroupChannelChatAdapter(context: Context, listener: OnItemClickListener) : | |
RecyclerView.Adapter<RecyclerView.ViewHolder>() { | |
private var messages: MutableList<BaseMessage> | |
private var context: Context | |
private var listener: OnItemClickListener | |
init { | |
messages = ArrayList() | |
this.context = context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:map="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content"> | |
<TextView | |
android:id="@+id/text_gchat_map_date_other" | |
android:layout_width="wrap_content" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:map="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_marginTop="@dimen/activity_vertical_margin"> | |
<TextView |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private class ChatAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { | |
private static final int VIEW_TYPE_MESSAGE_SENT = 1; | |
private static final int VIEW_TYPE_MESSAGE_RECEIVED = 2; | |
private ArrayList<BaseMessage> mMessageList; | |
private OpenChannel mChannel; | |
ChatAdapter(OpenChannel channel) { | |
mMessageList = new ArrayList<>(); | |
mChannel = channel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onResume() { | |
super.onResume(); | |
// Receives messages from SendBird servers | |
SendBird.addChannelHandler(CHANNEL_HANDLER_ID, new SendBird.ChannelHandler() { | |
@Override | |
public void onMessageReceived(BaseChannel baseChannel, BaseMessage baseMessage) { | |
if (baseChannel.getUrl().equals(mChannelUrl) && baseMessage instanceof UserMessage) { | |
mChatAdapter.appendMessage((UserMessage) baseMessage); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_chat); | |
mSendButton = (Button) findViewById(R.id.button_chat_send); | |
mMessageEditText = (EditText) findViewById(R.id.edittext_chat); | |
mRecyclerView = (RecyclerView) findViewById(R.id.reycler_chat); | |
mLayoutManager = new LinearLayoutManager(this); |