Java Code Examples for io.rong.imlib.model.Conversation#ConversationType

The following examples show how to use io.rong.imlib.model.Conversation#ConversationType . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RongCallKit.java    From sealtalk-android with MIT License 6 votes vote down vote up
/**
 * 开始多人通话。
 * 返回当前会话用户列表提供者对象,用户拿到该对象后,异步从服务器取出当前会话用户列表后,
 * 调用提供者中的 onGotUserList 方法,填充 ArrayList<String> userIds 后,就会自动发起多人通话。
 *
 * @param context          上下文
 * @param conversationType 会话类型
 * @param targetId         会话 id
 * @param mediaType        通话的媒体类型:CALL_MEDIA_TYPE_AUDIO, CALL_MEDIA_TYPE_VIDEO
 * @return 返回当前会话用户列表提供者对象
 */
public static ICallUsersProvider startMultiCall(final Context context, final Conversation.ConversationType conversationType, final String targetId, final CallMediaType mediaType) {
    return new ICallUsersProvider() {
        @Override
        public void onGotUserList(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);
        }
    };
}
 
Example 2
Source File: RongCallKit.java    From sealtalk-android with MIT License 6 votes vote down vote up
/**
 * 发起多人通话
 *
 * @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);
}
 
Example 3
Source File: OperationRong.java    From sealtalk-android with MIT License 6 votes vote down vote up
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, "设置失败");
            }
        });
    }
 
Example 4
Source File: MainActivity.java    From sealtalk-android with MIT License 6 votes vote down vote up
protected void initData() {

        final Conversation.ConversationType[] conversationTypes = {Conversation.ConversationType.PRIVATE,
                Conversation.ConversationType.GROUP, Conversation.ConversationType.SYSTEM,
                Conversation.ConversationType.PUBLIC_SERVICE, Conversation.ConversationType.APP_PUBLIC_SERVICE};

        Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                RongIM.getInstance().setOnReceiveUnreadCountChangedListener(mCountListener, conversationTypes);
                RongIM.getInstance().setOnReceiveUnreadCountChangedListener(mCountListener1, Conversation.ConversationType.APP_PUBLIC_SERVICE);
            }
        }, 500);

        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(ACTION_DMEO_RECEIVE_MESSAGE);
        if (mBroadcastReciver == null) {
            mBroadcastReciver = new ReceiveMessageBroadcastReciver();
        }
        this.registerReceiver(mBroadcastReciver, intentFilter);

        getConversationPush();// 获取 push 的 id 和 target

        getPushMessage();
    }
 
Example 5
Source File: ConversationActivity.java    From sealtalk-android with MIT License 5 votes vote down vote up
/**
 * 设置会话页面 Title
 *
 * @param conversationType 会话类型
 * @param targetId         目标 Id
 */
private void setActionBarTitle(Conversation.ConversationType conversationType, String targetId) {

    if (conversationType == null)
        return;

    if (conversationType.equals(Conversation.ConversationType.PRIVATE)) {
        setPrivateActionBar(targetId);
    } else if (conversationType.equals(Conversation.ConversationType.GROUP)) {
        setGroupActionBar(targetId);
    } else if (conversationType.equals(Conversation.ConversationType.DISCUSSION)) {
        setDiscussionActionBar(targetId);
    } else if (conversationType.equals(Conversation.ConversationType.CHATROOM)) {
        getSupportActionBar().setTitle(title);
    } else if (conversationType.equals(Conversation.ConversationType.SYSTEM)) {
        getSupportActionBar().setTitle(R.string.de_actionbar_system);
    } else if (conversationType.equals(Conversation.ConversationType.APP_PUBLIC_SERVICE)) {
        setAppPublicServiceActionBar(targetId);
    } else if (conversationType.equals(Conversation.ConversationType.PUBLIC_SERVICE)) {
        setPublicServiceActionBar(targetId);
    } else if (conversationType.equals(Conversation.ConversationType.CUSTOMER_SERVICE)) {
        getSupportActionBar().setTitle(R.string.main_customer);
    } else {
        getSupportActionBar().setTitle(R.string.de_actionbar_sub_defult);
    }

}
 
Example 6
Source File: ConversationActivity.java    From sealtalk-android with MIT License 5 votes vote down vote up
/**
 * 加载会话页面 ConversationFragment
 *
 * @param mConversationType
 * @param mTargetId
 */
private void enterFragment(Conversation.ConversationType mConversationType, String mTargetId) {

    fragment = new ConversationFragment();

    Uri uri = Uri.parse("rong://" + getApplicationInfo().packageName).buildUpon()
            .appendPath("conversation").appendPath(mConversationType.getName().toLowerCase())
            .appendQueryParameter("targetId", mTargetId).build();

    fragment.setUri(uri);
    fragment.setInputBoardListener(new InputView.IInputBoardListener() {
        @Override
        public void onBoardExpanded(int height) {
            NLog.e(TAG, "onBoardExpanded h : " + height);
        }

        @Override
        public void onBoardCollapsed() {
            NLog.e(TAG, "onBoardCollapsed");
        }
    });

    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    //xxx 为你要加载的 id
    transaction.add(R.id.rong_content, fragment);
    transaction.commitAllowingStateLoss();
}
 
Example 7
Source File: SealAppContext.java    From sealtalk-android with MIT License 5 votes vote down vote up
private void startRealTimeLocation(Context context, Conversation.ConversationType conversationType, String targetId) {
    RongIMClient.getInstance().startRealTimeLocation(conversationType, targetId);

    Intent intent = new Intent(((FragmentActivity) context), RealTimeLocationActivity.class);
    intent.putExtra("conversationType", conversationType.getValue());
    intent.putExtra("targetId", targetId);
    context.startActivity(intent);
}
 
Example 8
Source File: SealAppContext.java    From sealtalk-android with MIT License 5 votes vote down vote up
private void joinRealTimeLocation(Context context, Conversation.ConversationType conversationType, String targetId) {
    RongIMClient.getInstance().joinRealTimeLocation(conversationType, targetId);

    Intent intent = new Intent(((FragmentActivity) context), RealTimeLocationActivity.class);
    intent.putExtra("conversationType", conversationType.getValue());
    intent.putExtra("targetId", targetId);
    context.startActivity(intent);
}
 
Example 9
Source File: OperationRong.java    From sealtalk-android with MIT License 5 votes vote down vote up
public static void setConversationTop(final Context context, Conversation.ConversationType conversationType, String targetId, boolean state) {
        if (!TextUtils.isEmpty(targetId) && RongIM.getInstance() != null) {
            RongIM.getInstance().setConversationToTop(conversationType, targetId, state, new RongIMClient.ResultCallback<Boolean>() {
                @Override
                public void onSuccess(Boolean aBoolean) {
//                    NToast.shortToast(context, "设置成功");
                }

                @Override
                public void onError(RongIMClient.ErrorCode errorCode) {
                    NToast.shortToast(context, "设置失败");
                }
            });
        }
    }
 
Example 10
Source File: DoubleChatRoomActivity.java    From sealtalk-android with MIT License 5 votes vote down vote up
private void enterFragment1(Conversation.ConversationType mConversationType, String mTargetId) {

        ConversationFragment fragment = new ConversationFragment();

        Uri uri = Uri.parse("rong://" + getApplicationInfo().packageName).buildUpon()
                .appendPath("conversation").appendPath(mConversationType.getName().toLowerCase())
                .appendQueryParameter("targetId", mTargetId).build();

        fragment.setUri(uri);
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        transaction.add(R.id.temp1, fragment);
        transaction.commit();
    }
 
Example 11
Source File: DoubleChatRoomActivity.java    From sealtalk-android with MIT License 5 votes vote down vote up
private void enterFragment2(Conversation.ConversationType mConversationType, String mTargetId) {

        ConversationFragment fragment = new ConversationFragment();

        Uri uri = Uri.parse("rong://" + getApplicationInfo().packageName).buildUpon()
                .appendPath("conversation").appendPath(mConversationType.getName().toLowerCase())
                .appendQueryParameter("targetId", mTargetId).build();

        fragment.setUri(uri);
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        transaction.add(R.id.temp2, fragment);
        transaction.commit();
    }
 
Example 12
Source File: SingleCallActivity.java    From sealtalk-android with MIT License 4 votes vote down vote up
private void setupIntent () {
    RongCallCommon.CallMediaType mediaType;
    Intent intent = getIntent();
    RongCallAction callAction = RongCallAction.valueOf(intent.getStringExtra("callAction"));
    if (callAction == null || callAction.equals(RongCallAction.ACTION_RESUME_CALL)) {
        return;
    }
    if (callAction.equals(RongCallAction.ACTION_INCOMING_CALL)) {
        callSession = intent.getParcelableExtra("callSession");
        mediaType = callSession.getMediaType();
        targetId = callSession.getInviterUserId();
    } else if (callAction.equals(RongCallAction.ACTION_OUTGOING_CALL)) {
        if (intent.getAction().equals(RongVoIPIntent.RONG_INTENT_ACTION_VOIP_SINGLEAUDIO)) {
            mediaType = RongCallCommon.CallMediaType.AUDIO;
        } else {
            mediaType = RongCallCommon.CallMediaType.VIDEO;
        }
        Conversation.ConversationType conversationType = Conversation.ConversationType.valueOf(intent.getStringExtra("conversationType").toUpperCase(Locale.getDefault()));
        targetId = intent.getStringExtra("targetId");

        List<String> userIds = new ArrayList<>();
        userIds.add(targetId);
        RongCallClient.getInstance().startCall(conversationType, targetId, userIds, mediaType, null);
    } else {
        callSession = RongCallClient.getInstance().getCallSession();
        mediaType = callSession.getMediaType();
    }

    if (mediaType.equals(RongCallCommon.CallMediaType.AUDIO)) {
        handFree = false;
    } else if (mediaType.equals(RongCallCommon.CallMediaType.VIDEO)) {
        handFree = true;
    }

    UserInfo userInfo = RongContext.getInstance().getUserInfoFromCache(targetId);
    if (userInfo != null) {
        TextView userName = (TextView) mUserInfoContainer.findViewById(R.id.rc_voip_user_name);
        userName.setText(userInfo.getName());
        if (mediaType.equals(RongCallCommon.CallMediaType.AUDIO)) {
            AsyncImageView userPortrait = (AsyncImageView) mUserInfoContainer.findViewById(R.id.rc_voip_user_portrait);
            if (userPortrait != null) {
                userPortrait.setResource(userInfo.getPortraitUri().toString(), R.drawable.rc_default_portrait);
            }
        }
    }
}
 
Example 13
Source File: SessionAtPresenter.java    From LQRWeChat with MIT License 4 votes vote down vote up
public SessionAtPresenter(BaseFragmentActivity context, String sessionId, Conversation.ConversationType conversationType) {
    super(context);
    mSessionId = sessionId;
    mConversationType = conversationType;
}
 
Example 14
Source File: SealAppContext.java    From sealtalk-android with MIT License 4 votes vote down vote up
@Override
public boolean onUserPortraitLongClick(Context context, Conversation.ConversationType conversationType, UserInfo userInfo) {
    return false;
}
 
Example 15
Source File: SealAppContext.java    From sealtalk-android with MIT License 4 votes vote down vote up
@Override
public boolean onUserPortraitClick(Context context, Conversation.ConversationType conversationType, UserInfo userInfo) {
    return false;
}
 
Example 16
Source File: SealAppContext.java    From sealtalk-android with MIT License 4 votes vote down vote up
@Override
public boolean onConversationPortraitLongClick(Context context, Conversation.ConversationType conversationType, String s) {
    return false;
}
 
Example 17
Source File: SealAppContext.java    From sealtalk-android with MIT License 4 votes vote down vote up
@Override
public boolean onConversationPortraitClick(Context context, Conversation.ConversationType conversationType, String s) {
    return false;
}
 
Example 18
Source File: SessionInfoAtPresenter.java    From LQRWeChat with MIT License 4 votes vote down vote up
public SessionInfoAtPresenter(BaseActivity context, String sessionId, Conversation.ConversationType conversationType) {
    super(context);
    mSessionId = sessionId;
    mConversationType = conversationType;
}