本文整理汇总了Java中cn.bmob.im.BmobChatManager类的典型用法代码示例。如果您正苦于以下问题:Java BmobChatManager类的具体用法?Java BmobChatManager怎么用?Java BmobChatManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BmobChatManager类属于cn.bmob.im包,在下文中一共展示了BmobChatManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:JoeSteven,项目名称:BiBi,代码行数:22,代码来源:ChatActivity.java
示例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, "发送请求失败,请重试");
}
});
}
开发者ID:JoeSteven,项目名称:BiBi,代码行数:18,代码来源:UserActivity.java
示例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);
}
});
}
开发者ID:JasonGaoH,项目名称:enjoychat,代码行数:29,代码来源:SetMyInfoActivity.java
示例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();
}
}
}
开发者ID:JasonGaoH,项目名称:enjoychat,代码行数:25,代码来源:MainActivity.java
示例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();
}
开发者ID:nEdAy,项目名称:XPPLE_IM,代码行数:18,代码来源:ChatActivity.java
示例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);
}
}
开发者ID:nEdAy,项目名称:XPPLE_IM,代码行数:18,代码来源:ChatActivity.java
示例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();
}
开发者ID:nEdAy,项目名称:XPPLE_IM,代码行数:20,代码来源:ChatActivity.java
示例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();
}
}
}
开发者ID:nEdAy,项目名称:XPPLE_IM,代码行数:30,代码来源:MainActivity.java
示例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();
}
开发者ID:HuTianQi,项目名称:QQ,代码行数:21,代码来源:ChatActivity.java
示例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);
}
});
}
开发者ID:HuTianQi,项目名称:QQ,代码行数:35,代码来源:SetMyInfoActivity.java
示例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();
}
}
}
开发者ID:HuTianQi,项目名称:QQ,代码行数:26,代码来源:MainActivity.java
示例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();
}
开发者ID:liuyanggithub,项目名称:Hi,代码行数:17,代码来源:ChatActivity.java
示例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();
}
开发者ID:liuyanggithub,项目名称:Hi,代码行数:21,代码来源:ChatActivity.java
示例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);
}
});
}
开发者ID:liuyanggithub,项目名称:Hi,代码行数:34,代码来源:SetMyInfoActivity.java
示例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();
}
}
}
开发者ID:liuyanggithub,项目名称:Hi,代码行数:28,代码来源:MainActivity.java
示例16: onCreate
import cn.bmob.im.BmobChatManager; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
userManager = BmobUserManager.getInstance(this);
manager = BmobChatManager.getInstance(this);
mApplication = CustomApplication.getInstance();
DisplayMetrics metric = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metric);
mScreenWidth = metric.widthPixels;
mScreenHeight = metric.heightPixels;
mRequestQueue = mApplication.getRequestQueue();
// this.tag = setTag();
}
开发者ID:liuyanggithub,项目名称:Hi,代码行数:17,代码来源:BaseActivity.java
示例17: 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(MainActivity1.this).saveReceiveMessage(true,message);
}
if(currentTabIndex==0){
//��ǰҳ�����Ϊ�Ựҳ�棬ˢ�´�ҳ��
if(recentFragment != null){
recentFragment.refresh();
}
}
}
开发者ID:liuyanggithub,项目名称:Hi,代码行数:26,代码来源:MainActivity1.java
示例18: 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();
}
开发者ID:hanks-zyh,项目名称:Conquer,代码行数:19,代码来源:ChatActivity.java
示例19: sendInvite
import cn.bmob.im.BmobChatManager; //导入依赖的package包/类
/**
* 发送好友邀请
*/
private void sendInvite(Task task) {
for (User user : at) {
Card card = new Card();
card.setType(1);// 0。提醒卡
card.setFid(currentUser.getObjectId());
card.setFusername(currentUser.getUsername());
card.setFnick(currentUser.getNick());
card.setFavatar(currentUser.getAvatar());
card.setZixiName(task.getName());
card.setTime(task.getTime());
card.settId(user.getObjectId());
if (audioUrl != null)
card.setAudioUrl(audioUrl);
if (imgUrl != null)
card.setImgUrl(imgUrl);
card.setContent("我在克服拖延症,记得提醒我哟!");
L.e(card.toString());
String json = new Gson().toJson(card);
L.d("发送邀请:" + user.getNick());
MsgUtils.sendMsg(context, BmobChatManager.getInstance(context.getApplicationContext()), user, json);
}
}
开发者ID:hanks-zyh,项目名称:Conquer,代码行数:26,代码来源:AddTaskActivity.java
示例20: send
import cn.bmob.im.BmobChatManager; //导入依赖的package包/类
protected void send(final int rbId) {
String text = et.getText().toString();
Card card = new Card();
card.setType(rbId == R.id.rb0 ? 0 : 1);// 0。提醒卡
card.setFid(currentUser.getObjectId());
card.setFusername(currentUser.getUsername());
card.setFnick(currentUser.getNick());
card.setZixiId(task.getId());
card.setZixiName(task.getName());
card.setTime(task.getTime());
card.settId(task.getUser().getObjectId());
card.setFavatar(currentUser.getAvatar());
if (audioUrl != null) card.setAudioUrl(audioUrl);
card.setContent(text);
L.e(card.toString());
String json = new Gson().toJson(card);
MsgUtils.sendMsg(context, BmobChatManager.getInstance(context), task.getUser(), json);
T.show(context, "信息已发送,等待对方回应");
A.finishSelf(context);
}
开发者ID:hanks-zyh,项目名称:Conquer,代码行数:22,代码来源:AlertActivity.java
注:本文中的cn.bmob.im.BmobChatManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论