本文整理汇总了Java中cn.bmob.im.BmobChatManager类的典型用法代码示例。如果您正苦于以下问题:Java BmobChatManager类的具体用法?Java BmobChatManager怎么用?Java BmobChatManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BmobChatManager类属于cn.bmob.im包,在下文中一共展示了BmobChatManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onReceive
import cn.bmob.im.BmobChatManager; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
String from = intent.getStringExtra("fromId");
String msgId = intent.getStringExtra("msgId");
String msgTime = intent.getStringExtra("msgTime");
// 收到这个广播的时候,message已经在消息表中,可直接获取
if(TextUtils.isEmpty(from)&&TextUtils.isEmpty(msgId)&&TextUtils.isEmpty(msgTime)){
BmobMsg msg = BmobChatManager.getInstance(ChatActivity.this).getMessage(msgId, msgTime);
if (!from.equals(mTargetId))// 如果不是当前正在聊天对象的消息,不处理
return;
//添加到当前页面
mMsgs.add(msg);
mAdapter.notifyDataSetChanged();
// 定位
mListView.setSelection(mAdapter.getCount() - 1);
//取消当前聊天对象的未读标示
BmobDB.create(ChatActivity.this).resetUnread(mTargetId);
}
// 记得把广播给终结掉
abortBroadcast();
}
示例2: addFriend
import cn.bmob.im.BmobChatManager; //导入依赖的package包/类
public void addFriend(View v){
mAddFriend.setClickable(false);
Log.e("BB", "接收人ID" + mUser.getObjectId());
BmobChatManager.getInstance(this).sendTagMessage(BmobConfig.TAG_ADD_CONTACT, mUser.getObjectId(), new PushListener() {
@Override
public void onSuccess() {
ToastUtils.make(UserActivity.this, "发送请求成功,等待对方回应");
mAddFriend.setClickable(true);
}
@Override
public void onFailure(int i, String s) {
mAddFriend.setClickable(true);
ToastUtils.make(UserActivity.this, "发送请求失败,请重试");
}
});
}
示例3: addFriend
import cn.bmob.im.BmobChatManager; //导入依赖的package包/类
/**
* ��Ӻ�������
*/
private void addFriend() {
final ProgressDialog progress = new ProgressDialog(this);
progress.setMessage("�������...");
progress.setCanceledOnTouchOutside(false);
progress.show();
// ����TAG����----->��Ӻ���
BmobChatManager.getInstance(this).sendTagMessage(
BmobConfig.TAG_ADD_CONTACT, user.getObjectId(),
new PushListener() {
@Override
public void onSuccess() {
progress.dismiss();
showToast("��������ɹ����ȴ��Է���֤");
}
@Override
public void onFailure(int arg0, String arg1) {
progress.dismiss();
showToast("��������ɹ����ȴ��Է���֤");
showLog("��������ʧ��:" + arg1);
}
});
}
示例4: refreshNewMessage
import cn.bmob.im.BmobChatManager; //导入依赖的package包/类
/**
* ˢ�½���
*
* @param message
*/
private void refreshNewMessage(BmobMsg message) {
boolean isAllowVoice = CustomApplication.getInstance().getSpUtil()
.isAllowVoice();
if (isAllowVoice) {
CustomApplication.getInstance().getMediaPlayer().start();
}
iv_recent_tips.setVisibility(View.VISIBLE);
// �洢����
if (message != null) {
BmobChatManager.getInstance(MainActivity.this).saveReceiveMessage(
true, message);
}
if (currentTabIndex == 0) {
// ��ǰҳ�����Ϊ�Ựҳ�棬ˢ�´�ҳ��
if (recentFragment != null) {
recentFragment.refresh();
}
}
}
示例5: onCreate
import cn.bmob.im.BmobChatManager; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chat);
manager = BmobChatManager.getInstance(this);
MsgPagerNum = 0;
// 组装聊天对象
targetUser = (BmobChatUser) getIntent().getSerializableExtra("user");
targetId = targetUser.getObjectId();
// BmobLog.i("聊天对象:" + targetUser.getUsername() + ",targetId = "
// + targetId);
// 注册广播接收器
initNewMessageBroadCast();
initView();
initRealTimeDataListener();
}
示例6: handleMessage
import cn.bmob.im.BmobChatManager; //导入依赖的package包/类
@Override
public void handleMessage(Message msg) {
if (msg.what == NEW_MESSAGE) {
BmobMsg message = (BmobMsg) msg.obj;
String uid = message.getBelongId();
BmobMsg m = BmobChatManager.getInstance(ChatActivity.this)
.getMessage(message.getConversationId(),
message.getMsgTime());
if (!uid.equals(targetId))// 如果不是当前正在聊天对象的消息,不处理
return;
mAdapter.add(m);
// 定位
mListView.setSelection(mAdapter.getCount() - 1);
// 取消当前聊天对象的未读标示
BmobDB.create(ChatActivity.this).resetUnread(targetId);
}
}
示例7: onReceive
import cn.bmob.im.BmobChatManager; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
String from = intent.getStringExtra("fromId");
String msgId = intent.getStringExtra("msgId");
String msgTime = intent.getStringExtra("msgTime");
// 收到这个广播的时候,message已经在消息表中,可直接获取
BmobMsg msg = BmobChatManager.getInstance(ChatActivity.this)
.getMessage(msgId, msgTime);
if (!from.equals(targetId))// 如果不是当前正在聊天对象的消息,不处理
return;
// 添加到当前页面
mAdapter.add(msg);
// 定位
mListView.setSelection(mAdapter.getCount() - 1);
// 取消当前聊天对象的未读标示
BmobDB.create(ChatActivity.this).resetUnread(targetId);
// 记得把广播给终结掉
abortBroadcast();
}
示例8: refreshNewMsg
import cn.bmob.im.BmobChatManager; //导入依赖的package包/类
/**
* 刷新界面
*
* @Title: refreshNewMsg
* @Description: TODO
* @param @param message
* @return void
* @throws
*/
private void refreshNewMsg(BmobMsg message) {
// 声音提示
boolean isAllow = CustomApplcation.getInstance().getSpUtil()
.isAllowVoice();
if (isAllow) {
CustomApplcation.getInstance().getMediaPlayer().start();
}
iv_recent_tips.setVisibility(View.VISIBLE);
// 也要存储起来
if (message != null) {
BmobChatManager.getInstance(MainActivity.this).saveReceiveMessage(
true, message);
}
if (currentTabIndex == 0) {
// 当前页面如果为会话页面,刷新此页面
if (recentFragment != null) {
recentFragment.refresh();
}
}
}
示例9: onReceive
import cn.bmob.im.BmobChatManager; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
String from = intent.getStringExtra("fromId");
String msgId = intent.getStringExtra("msgId");
String msgTime = intent.getStringExtra("msgTime");
if(!TextUtils.isEmpty(from)&& !TextUtils.isEmpty(msgId)&& !TextUtils.isEmpty(msgTime)){
BmobMsg msg = BmobChatManager.getInstance(ChatActivity.this).getMessage(msgId, msgTime);
if (!from.equals(targetId))
return;
mAdapter.add(msg);
mListView.setSelection(mAdapter.getCount() - 1);
BmobDB.create(ChatActivity.this).resetUnread(targetId);
}
abortBroadcast();
}
示例10: addFriend
import cn.bmob.im.BmobChatManager; //导入依赖的package包/类
/**
* ��Ӻ�������
*
* @Title: addFriend
* @Description: TODO
* @param
* @return void
* @throws
*/
private void addFriend() {
final ProgressDialog progress = new ProgressDialog(this);
progress.setMessage("正在添加...");
progress.setCanceledOnTouchOutside(false);
progress.show();
BmobChatManager.getInstance(this).sendTagMessage(BmobConfig.TAG_ADD_CONTACT,
user.getObjectId(), new PushListener() {
@Override
public void onSuccess() {
// TODO Auto-generated method stub
progress.dismiss();
ShowToast("发送请求成功,等待对方验证!");
}
@Override
public void onFailure(int arg0, final String arg1) {
// TODO Auto-generated method stub
progress.dismiss();
ShowToast("发送请求成功,等待对方验证!");
ShowLog("发送请求失败:" + arg1);
}
});
}
示例11: refreshNewMsg
import cn.bmob.im.BmobChatManager; //导入依赖的package包/类
/**
* @Title: refreshNewMsg
* @Description: TODO
* @param @param message
* @return void
* @throws
*/
private void refreshNewMsg(BmobMsg message){
// ������ʾ
boolean isAllow = CustomApplcation.getInstance().getSpUtil().isAllowVoice();
if(isAllow){
CustomApplcation.getInstance().getMediaPlayer().start();
}
iv_recent_tips.setVisibility(View.VISIBLE);
if(message!=null){
BmobChatManager.getInstance(MainActivity.this).saveReceiveMessage(true,message);
}
if(currentTabIndex==0){
if(recentFragment != null){
recentFragment.refresh();
}
}
}
示例12: onCreate
import cn.bmob.im.BmobChatManager; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chat);
manager = BmobChatManager.getInstance(this);
MsgPagerNum = 0;
// ��װ�������
targetUser = (BmobChatUser) getIntent().getSerializableExtra("user");
targetId = targetUser.getObjectId();
// BmobLog.i("�������" + targetUser.getUsername() + ",targetId = "
// + targetId);
//ע��㲥������
initNewMessageBroadCast();
initView();
}
示例13: onReceive
import cn.bmob.im.BmobChatManager; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
String from = intent.getStringExtra("fromId");
String msgId = intent.getStringExtra("msgId");
String msgTime = intent.getStringExtra("msgTime");
// �յ�����㲥��ʱ��message�Ѿ�����Ϣ���У���ֱ�ӻ�ȡ
if(TextUtils.isEmpty(from)&&TextUtils.isEmpty(msgId)&&TextUtils.isEmpty(msgTime)){
BmobMsg msg = BmobChatManager.getInstance(ChatActivity.this).getMessage(msgId, msgTime);
if (!from.equals(targetId))// ������ǵ�ǰ��������������Ϣ��������
return;
//��ӵ���ǰҳ��
mAdapter.add(msg);
// ��λ
mListView.setSelection(mAdapter.getCount() - 1);
//ȡ����ǰ��������δ����ʾ
BmobDB.create(ChatActivity.this).resetUnread(targetId);
}
// �ǵðѹ㲥���ս��
abortBroadcast();
}
示例14: addFriend
import cn.bmob.im.BmobChatManager; //导入依赖的package包/类
/**
* ��Ӻ�������
*
* @Title: addFriend
* @Description: TODO
* @param
* @return void
* @throws
*/
private void addFriend() {
final ProgressDialog progress = new ProgressDialog(this);
progress.setMessage("�������...");
progress.setCanceledOnTouchOutside(false);
progress.show();
// ����tag����
BmobChatManager.getInstance(this).sendTagMessage(BmobConfig.TAG_ADD_CONTACT, user.getObjectId(), new PushListener() {
@Override
public void onSuccess() {
// TODO Auto-generated method stub
progress.dismiss();
ShowToast("��������ɹ����ȴ��Է���֤��");
}
@Override
public void onFailure(int arg0, final String arg1) {
// TODO Auto-generated method stub
progress.dismiss();
ShowToast("��������ɹ����ȴ��Է���֤��");
ShowLog("��������ʧ��:" + arg1);
}
});
}
示例15: refreshNewMsg
import cn.bmob.im.BmobChatManager; //导入依赖的package包/类
/**
* ˢ�½���
*
* @Title: refreshNewMsg
* @Description: TODO
* @param @param message
* @return void
* @throws
*/
private void refreshNewMsg(BmobMsg message) {
// ������ʾ
boolean isAllow = CustomApplication.getInstance().getSpUtil().isAllowVoice();
if (isAllow) {
CustomApplication.getInstance().getMediaPlayer().start();
}
iv_recent_tips.setVisibility(View.VISIBLE);
// ҲҪ�洢����
if (message != null) {
BmobChatManager.getInstance(MainActivity.this).saveReceiveMessage(true, message);
}
if (currentTabIndex == 0) {
// ��ǰҳ�����Ϊ�Ựҳ�棬ˢ�´�ҳ��
if (recentFragment != null) {
recentFragment.refresh();
}
}
}