This file contains hidden or 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
public class MainActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
SendBird.init("192F73AB-EED6-465B-9B77-1F34406B5658", this); | |
SendBirdDesk.init(); | |
SendBird.connect("test_user_1", new SendBird.ConnectHandler() { | |
@Override |
This file contains hidden or 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
package com.example.simplechatsb; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.os.Bundle; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.Button; |
This file contains hidden or 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
package com.example.simplechatsb; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.os.Bundle; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.Button; |
This file contains hidden or 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 | |
public int getItemCount() { | |
return mList.size(); | |
} |
This file contains hidden or 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 | |
public void onBindViewHolder(GroupChannelListViewHolder holder, int position) { | |
holder.channelUrl = mList.get(position).getUrl(); | |
holder.channelUrlTextView.setText(holder.channelUrl); | |
final String channelUrl = holder.channelUrl; | |
holder.joinChannelButton.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View v ) { | |
Context context = v.getContext(); |
This file contains hidden or 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
public class GroupChannelListViewHolder extends RecyclerView.ViewHolder{ | |
public TextView channelUrlTextView; | |
public Button joinChannelButton; | |
private String channelUrl; | |
public GroupChannelListViewHolder(LinearLayout v) { | |
super(v); | |
channelUrlTextView = itemView.findViewById(R.id.channel_url_text_view); | |
joinChannelButton = itemView.findViewById(R.id.join_channel_button); | |
} |
This file contains hidden or 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
public class GroupChannelListAdapter extends RecyclerView.Adapter<GroupChannelListAdapter.GroupChannelListViewHolder> { | |
private List<GroupChannel> mList; | |
private String mChannelType; | |
public GroupChannelListAdapter(List<GroupChannel> list, String channelType) { | |
mList = list; | |
mChannelType = channelType; | |
} |
This file contains hidden or 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
package com.example.simplechatsb; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.support.v7.widget.LinearLayoutManager; | |
import android.support.v7.widget.RecyclerView; | |
import android.util.Log; | |
import com.sendbird.android.GroupChannel; | |
import com.sendbird.android.GroupChannelListQuery; |
This file contains hidden or 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
protected void connect_sendbird() { | |
SendBird.connect(USER_ID, new SendBird.ConnectHandler() { | |
@Override | |
public void onConnected(User user, SendBirdException e) { | |
if (e != null) { // Error. | |
return; | |
} | |
} | |
}); | |
} |
This file contains hidden or 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
protected void populate_group_channel_list(List<GroupChannel> list) { | |
RecyclerView rvGroupChannelList = findViewById(R.id.channelListRecyclerView); | |
GroupChannelListAdapter adapter = new GroupChannelListAdapter(list, CHANNEL_TYPE); | |
rvGroupChannelList.setAdapter(adapter); | |
rvGroupChannelList.setLayoutManager(new LinearLayoutManager(this)); | |
} | |
protected void populate_open_channel_list(List<OpenChannel> list) { | |
RecyclerView rvOpenChannelList = findViewById(R.id.channelListRecyclerView); |
NewerOlder