本文整理汇总了Java中io.rong.imlib.RongIMClient类的典型用法代码示例。如果您正苦于以下问题:Java RongIMClient类的具体用法?Java RongIMClient怎么用?Java RongIMClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RongIMClient类属于io.rong.imlib包,在下文中一共展示了RongIMClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDisableCameraBtnClick
import io.rong.imlib.RongIMClient; //导入依赖的package包/类
public void onDisableCameraBtnClick(View view) {
TextView text = (TextView) bottomButtonContainer.findViewById(R.id.rc_voip_disable_camera_text);
String currentUserId = RongIMClient.getInstance().getCurrentUserId();
RongCallClient.getInstance().setEnableLocalVideo(view.isSelected());
if (view.isSelected()) {
text.setText(R.string.rc_voip_disable_camera);
if (localViewUserId.equals(currentUserId)) {
localView.setVisibility(View.VISIBLE);
} else {
remoteViewContainer.findViewWithTag(currentUserId).setVisibility(View.VISIBLE);
}
} else {
text.setText(R.string.rc_voip_enable_camera);
if (localViewUserId.equals(currentUserId)) {
localView.setVisibility(View.GONE);
} else {
remoteViewContainer.findViewWithTag(currentUserId).setVisibility(View.GONE);
}
}
view.setSelected(!view.isSelected());
}
示例2: onActivityResult
import io.rong.imlib.RongIMClient; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode != Activity.RESULT_OK) {
return;
}
Intent intent = new Intent(RongVoIPIntent.RONG_INTENT_ACTION_VOIP_MULTIVIDEO);
ArrayList<String> userIds = data.getStringArrayListExtra("invited");
userIds.add(RongIMClient.getInstance().getCurrentUserId());
intent.putExtra("conversationType", conversationType.getName().toLowerCase());
intent.putExtra("targetId", targetId);
intent.putExtra("callAction", RongCallAction.ACTION_OUTGOING_CALL.getName());
intent.putStringArrayListExtra("invitedUsers", userIds);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setPackage(context.getPackageName());
context.getApplicationContext().startActivity(intent);
}
示例3: startMultiCall
import io.rong.imlib.RongIMClient; //导入依赖的package包/类
/**
* 发起多人通话
*
* @param context 上下文
* @param conversationType 会话类型
* @param targetId 会话 id
* @param mediaType 会话媒体类型
* @param userIds 参与者 id 列表
*/
public static void startMultiCall(Context context, Conversation.ConversationType conversationType, String targetId, CallMediaType mediaType, ArrayList<String> userIds) {
String action;
if (mediaType.equals(CallMediaType.CALL_MEDIA_TYPE_AUDIO)) {
action = RongVoIPIntent.RONG_INTENT_ACTION_VOIP_MULTIAUDIO;
} else {
action = RongVoIPIntent.RONG_INTENT_ACTION_VOIP_MULTIVIDEO;
}
Intent intent = new Intent(action);
userIds.add(RongIMClient.getInstance().getCurrentUserId());
intent.putExtra("conversationType", conversationType.getName().toLowerCase());
intent.putExtra("targetId", targetId);
intent.putExtra("callAction", RongCallAction.ACTION_OUTGOING_CALL.getName());
intent.putStringArrayListExtra("invitedUsers", userIds);
context.startActivity(intent);
}
示例4: onDestroy
import io.rong.imlib.RongIMClient; //导入依赖的package包/类
@Override
protected void onDestroy() {
super.onDestroy();
if (localBroadcastManager != null) {
localBroadcastManager.unregisterReceiver(mainReceiver);
}
RongIM.getInstance().removeUnReadMessageCountChangedObserver(new IUnReadMessageObserver() {
@Override
public void onCountChanged(int i) {
}
});
if (RongIM.getInstance().getCurrentConnectionStatus()
== RongIMClient.ConnectionStatusListener.ConnectionStatus.CONNECTED) {
RongIM.getInstance().disconnect();
}
}
示例5: getConnectCallback
import io.rong.imlib.RongIMClient; //导入依赖的package包/类
public RongIMClient.ConnectCallback getConnectCallback() {
RongIMClient.ConnectCallback connectCallback = new RongIMClient.ConnectCallback() {
@Override
public void onTokenIncorrect() {
NLog.d(TAG, "ConnectCallback connect onTokenIncorrect");
SealUserInfoManager.getInstance().reGetToken();
}
@Override
public void onSuccess(String s) {
NLog.d(TAG, "ConnectCallback connect onSuccess");
SharedPreferences sp = mContext.getSharedPreferences("config", Context.MODE_PRIVATE);
sp.edit().putString(SealConst.SEALTALK_LOGIN_ID, s).apply();
}
@Override
public void onError(final RongIMClient.ErrorCode e) {
NLog.d(TAG, "ConnectCallback connect onError-ErrorCode=" + e);
}
};
return connectCallback;
}
示例6: setConverstionNotif
import io.rong.imlib.RongIMClient; //导入依赖的package包/类
public static void setConverstionNotif(final Context context, Conversation.ConversationType conversationType, String targetId, boolean state) {
Conversation.ConversationNotificationStatus cns;
if (state) {
cns = Conversation.ConversationNotificationStatus.DO_NOT_DISTURB;
} else {
cns = Conversation.ConversationNotificationStatus.NOTIFY;
}
RongIM.getInstance().setConversationNotificationStatus(conversationType, targetId, cns, new RongIMClient.ResultCallback<Conversation.ConversationNotificationStatus>() {
@Override
public void onSuccess(Conversation.ConversationNotificationStatus conversationNotificationStatus) {
if (conversationNotificationStatus == Conversation.ConversationNotificationStatus.DO_NOT_DISTURB) {
// NToast.shortToast(context, "设置免打扰成功");
} else if (conversationNotificationStatus == Conversation.ConversationNotificationStatus.NOTIFY) {
// NToast.shortToast(context, "取消免打扰成功");
}
}
@Override
public void onError(RongIMClient.ErrorCode errorCode) {
NToast.shortToast(context, "设置失败");
}
});
}
示例7: initListener
import io.rong.imlib.RongIMClient; //导入依赖的package包/类
@Override
public void initListener() {
mOivAbout.setOnClickListener(v -> jumpToActivity(AboutActivity.class));
mOivHelpFeedback.setOnClickListener(v1 -> jumpToWebViewActivity(AppConst.WeChatUrl.HELP_FEED_BACK));
mOivExit.setOnClickListener(v -> {
if (mExitView == null) {
mExitView = View.inflate(this, R.layout.dialog_exit, null);
mExitDialog = new CustomDialog(this, mExitView, R.style.MyDialog);
mExitView.findViewById(R.id.tvExitAccount).setOnClickListener(v1 -> {
RongIMClient.getInstance().logout();
UserCache.clear();
mExitDialog.dismiss();
MyApp.exit();
jumpToActivityAndClearTask(LoginActivity.class);
});
mExitView.findViewById(R.id.tvExitApp).setOnClickListener(v1 -> {
RongIMClient.getInstance().disconnect();
mExitDialog.dismiss();
MyApp.exit();
});
}
mExitDialog.show();
});
}
示例8: initBlackListStatusView
import io.rong.imlib.RongIMClient; //导入依赖的package包/类
private void initBlackListStatusView() {
if (mIsFriendsRelationship) {
Button rightButton = getHeadRightButton();
rightButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.main_activity_contact_more));
rightButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View v) {
RongIM.getInstance().getBlacklistStatus(mFriend.getUserId(), new RongIMClient.ResultCallback<RongIMClient.BlacklistStatus>() {
@Override
public void onSuccess(RongIMClient.BlacklistStatus blacklistStatus) {
SinglePopWindow morePopWindow = new SinglePopWindow(UserDetailActivity.this, mFriend, blacklistStatus);
morePopWindow.showPopupWindow(v);
}
@Override
public void onError(RongIMClient.ErrorCode e) {
}
});
}
});
}
}
示例9: onDragOut
import io.rong.imlib.RongIMClient; //导入依赖的package包/类
@Override
public void onDragOut() {
mUnreadNumView.setVisibility(View.GONE);
NToast.shortToast(mContext, getString(R.string.clear_success));
RongIM.getInstance().getConversationList(new RongIMClient.ResultCallback<List<Conversation>>() {
@Override
public void onSuccess(List<Conversation> conversations) {
if (conversations != null && conversations.size() > 0) {
for (Conversation c : conversations) {
RongIM.getInstance().clearMessagesUnreadStatus(c.getConversationType(), c.getTargetId(), null);
}
}
}
@Override
public void onError(RongIMClient.ErrorCode e) {
}
}, mConversationsTypes);
}
示例10: onCreate
import io.rong.imlib.RongIMClient; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
sp = getSharedPreferences("config", MODE_PRIVATE);
mDialog = new LoadingDialog(this);
Intent intent = getIntent();
//push
if (intent.getData().getScheme().equals("rong") && intent.getData().getQueryParameter("push") != null) {
//通过intent.getData().getQueryParameter("push") 为true,判断是否是push消息
if (intent.getData().getQueryParameter("push").equals("true")) {
enterActivity();
}
} else {//通知过来
//程序切到后台,收到消息后点击进入,会执行这里
if (RongIM.getInstance().getCurrentConnectionStatus().equals(RongIMClient.ConnectionStatusListener.ConnectionStatus.DISCONNECTED)) {
enterActivity();
} else {
startActivity(new Intent(ConversationListActivity.this, MainActivity.class));
finish();
}
}
}
示例11: sendShareMessage
import io.rong.imlib.RongIMClient; //导入依赖的package包/类
private void sendShareMessage(Conversation.ConversationType conversationType, String targetId, MessageContent content) {
RongIM.getInstance().sendMessage(conversationType, targetId, content, null, null, new RongIMClient.SendMessageCallback() {
@Override
public void onError(Integer messageId, RongIMClient.ErrorCode e) {
NLog.e("share", e.getValue());
LoadDialog.dismiss(mContext);
NToast.shortToast(mContext, "分享失败");
}
@Override
public void onSuccess(Integer integer) {
LoadDialog.dismiss(mContext);
NToast.shortToast(mContext, "分享成功");
}
});
}
示例12: getConversations
import io.rong.imlib.RongIMClient; //导入依赖的package包/类
private void getConversations() {
final Conversation.ConversationType[] conversationTypes = {
Conversation.ConversationType.PRIVATE,
Conversation.ConversationType.GROUP,
};
if (RongIM.getInstance().getCurrentConnectionStatus().equals(RongIMClient.ConnectionStatusListener.ConnectionStatus.CONNECTED)) {
RongIM.getInstance().getConversationList(new RongIMClient.ResultCallback<List<Conversation>>() {
@Override
public void onSuccess(List<Conversation> conversations) {
conversationsList = conversations;
getGroups();
}
@Override
public void onError(RongIMClient.ErrorCode e) {
}
}, conversationTypes);
}
}
示例13: setAppPublicServiceActionBar
import io.rong.imlib.RongIMClient; //导入依赖的package包/类
/**
* 设置应用公众服务界面 ActionBar
*/
private void setAppPublicServiceActionBar(String targetId) {
if (targetId == null)
return;
RongIM.getInstance().getPublicServiceProfile(Conversation.PublicServiceType.APP_PUBLIC_SERVICE
, targetId, new RongIMClient.ResultCallback<PublicServiceProfile>() {
@Override
public void onSuccess(PublicServiceProfile publicServiceProfile) {
setTitle(publicServiceProfile.getName());
}
@Override
public void onError(RongIMClient.ErrorCode errorCode) {
}
});
}
示例14: setPublicServiceActionBar
import io.rong.imlib.RongIMClient; //导入依赖的package包/类
/**
* 设置公共服务号 ActionBar
*/
private void setPublicServiceActionBar(String targetId) {
if (targetId == null)
return;
RongIM.getInstance().getPublicServiceProfile(Conversation.PublicServiceType.PUBLIC_SERVICE
, targetId, new RongIMClient.ResultCallback<PublicServiceProfile>() {
@Override
public void onSuccess(PublicServiceProfile publicServiceProfile) {
setTitle(publicServiceProfile.getName());
}
@Override
public void onError(RongIMClient.ErrorCode errorCode) {
}
});
}
示例15: setDiscussionActionBar
import io.rong.imlib.RongIMClient; //导入依赖的package包/类
/**
* 设置讨论组界面 ActionBar
*/
private void setDiscussionActionBar(String targetId) {
if (targetId != null) {
RongIM.getInstance().getDiscussion(targetId
, new RongIMClient.ResultCallback<Discussion>() {
@Override
public void onSuccess(Discussion discussion) {
setTitle(discussion.getName());
}
@Override
public void onError(RongIMClient.ErrorCode e) {
if (e.equals(RongIMClient.ErrorCode.NOT_IN_DISCUSSION)) {
setTitle("不在讨论组中");
supportInvalidateOptionsMenu();
}
}
});
} else {
setTitle("讨论组");
}
}