io.rong.imlib.model.Conversation Java Examples

The following examples show how to use io.rong.imlib.model.Conversation. 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: RecentMessageFgPresenter.java    From LQRWeChat with MIT License 6 votes vote down vote up
private void loadData() {
    RongIMClient.getInstance().getConversationList(new RongIMClient.ResultCallback<List<Conversation>>() {
        @Override
        public void onSuccess(List<Conversation> conversations) {
            if (conversations != null && conversations.size() > 0) {
                mData.clear();
                mData.addAll(conversations);
                filterData(mData);
            }
        }

        @Override
        public void onError(RongIMClient.ErrorCode errorCode) {
            LogUtils.e("加载最近会话失败:" + errorCode);
        }
    });
}
 
Example #2
Source File: DiscussionDetailActivity.java    From sealtalk-android with MIT License 6 votes vote down vote up
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    switch (buttonView.getId()) {
        case R.id.sw_discu_top:
            if (isChecked) {
                OperationRong.setConversationTop(mContext, Conversation.ConversationType.DISCUSSION, targetId, true);
            } else {
                OperationRong.setConversationTop(mContext, Conversation.ConversationType.DISCUSSION, targetId, false);
            }
            break;
        case R.id.sw_discu_notfaction:
            if (isChecked) {
                OperationRong.setConverstionNotif(mContext, Conversation.ConversationType.DISCUSSION, targetId, true);
            } else {
                OperationRong.setConverstionNotif(mContext, Conversation.ConversationType.DISCUSSION, targetId, false);
            }
            break;
    }
}
 
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 6 votes vote down vote up
/**
 * 设置应用公众服务界面 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) {
            getSupportActionBar().setTitle(publicServiceProfile.getName());
        }

        @Override
        public void onError(RongIMClient.ErrorCode errorCode) {

        }
    });
}
 
Example #6
Source File: SealAppContext.java    From sealtalk-android with MIT License 6 votes vote down vote up
private void setInputProvider() {

        RongIM.setOnReceiveMessageListener(this);
        RongIM.setConnectionStatusListener(this);

        InputProvider.ExtendProvider[] singleProvider = {
                new ImageInputProvider(RongContext.getInstance()),
                new RealTimeLocationInputProvider(RongContext.getInstance()) //带位置共享的地理位置
        };

        InputProvider.ExtendProvider[] muiltiProvider = {
                new ImageInputProvider(RongContext.getInstance()),
                new LocationInputProvider(RongContext.getInstance()),//地理位置
        };

        RongIM.resetInputExtensionProvider(Conversation.ConversationType.PRIVATE, singleProvider);
        RongIM.resetInputExtensionProvider(Conversation.ConversationType.DISCUSSION, muiltiProvider);
        RongIM.resetInputExtensionProvider(Conversation.ConversationType.CUSTOMER_SERVICE, muiltiProvider);
        RongIM.resetInputExtensionProvider(Conversation.ConversationType.GROUP, muiltiProvider);
    }
 
Example #7
Source File: ConversationActivity.java    From sealtalk-android with MIT License 6 votes vote down vote up
/**
 * 设置公共服务号 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) {
            getSupportActionBar().setTitle(publicServiceProfile.getName().toString());
        }

        @Override
        public void onError(RongIMClient.ErrorCode errorCode) {

        }
    });
}
 
Example #8
Source File: ConversationActivity.java    From sealtalk-android with MIT License 6 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.de_conversation_menu, menu);

    if (mConversationType == null)
        return true;

    if (mConversationType.equals(Conversation.ConversationType.CHATROOM)) {
        menu.getItem(0).setVisible(false);
    } else if (mConversationType.equals(Conversation.ConversationType.CUSTOMER_SERVICE)) {
        menu.getItem(0).setVisible(false);
    }

    return super.onCreateOptionsMenu(menu);
}
 
Example #9
Source File: SessionActivity.java    From LQRWeChat with MIT License 6 votes vote down vote up
@Override
public void init() {
    Intent intent = getIntent();
    mSessionId = intent.getStringExtra("sessionId");
    int sessionType = intent.getIntExtra("sessionType", SESSION_TYPE_PRIVATE);
    switch (sessionType) {
        case SESSION_TYPE_PRIVATE:
            mConversationType = Conversation.ConversationType.PRIVATE;
            break;
        case SESSION_TYPE_GROUP:
            mConversationType = Conversation.ConversationType.GROUP;
            break;
    }

    initAudioRecordManager();

    //设置会话已读
    RongIMClient.getInstance().clearMessagesUnreadStatus(mConversationType, mSessionId);
    registerBR();
}
 
Example #10
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 #11
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 #12
Source File: AudioCallInputProvider.java    From sealtalk-android with MIT License 6 votes vote down vote up
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if(resultCode != Activity.RESULT_OK) {
        return;
    }

    final Conversation conversation = getCurrentConversation();
    Intent intent = new Intent(RongVoIPIntent.RONG_INTENT_ACTION_VOIP_MULTIAUDIO);
    ArrayList<String> userIds = data.getStringArrayListExtra("invited");
    userIds.add(RongIMClient.getInstance().getCurrentUserId());
    intent.putExtra("conversationType", conversation.getConversationType().getName().toLowerCase());
    intent.putExtra("targetId", conversation.getTargetId());
    intent.putExtra("callAction", RongCallAction.ACTION_OUTGOING_CALL.getName());
    intent.putStringArrayListExtra("invitedUsers", userIds);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setPackage(getContext().getPackageName());
    getContext().getApplicationContext().startActivity(intent);
}
 
Example #13
Source File: MultiVideoCallActivity.java    From sealtalk-android with MIT License 6 votes vote down vote up
public void onAddButtonClick(View view) {
    setShouldShowFloat(false);

    if(callSession.getConversationType().equals(Conversation.ConversationType.DISCUSSION)) {
        RongIMClient.getInstance().getDiscussion(callSession.getTargetId(), new RongIMClient.ResultCallback<Discussion>() {
            @Override
            public void onSuccess(Discussion discussion) {
                Intent intent = new Intent(MultiVideoCallActivity.this, CallSelectMemberActivity.class);
                ArrayList<String> added = new ArrayList<>();
                List<CallUserProfile> list = RongCallClient.getInstance().getCallSession().getParticipantProfileList();
                for (CallUserProfile profile : list) {
                    added.add(profile.getUserId());
                }
                intent.putStringArrayListExtra("allMembers", (ArrayList<String>)discussion.getMemberIdList());
                intent.putStringArrayListExtra("invitedMembers", added);
                startActivityForResult(intent, 110);
            }

            @Override
            public void onError(RongIMClient.ErrorCode e) {

            }
        });
    }
}
 
Example #14
Source File: VideoCallInputProvider.java    From sealtalk-android with MIT License 6 votes vote down vote up
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if(resultCode != Activity.RESULT_OK) {
        return;
    }
    final Conversation conversation = getCurrentConversation();
    Intent intent = new Intent(RongVoIPIntent.RONG_INTENT_ACTION_VOIP_MULTIVIDEO);
    ArrayList<String> userIds = data.getStringArrayListExtra("invited");
    userIds.add(RongIMClient.getInstance().getCurrentUserId());
    intent.putExtra("conversationType", conversation.getConversationType().getName().toLowerCase());
    intent.putExtra("targetId", conversation.getTargetId());
    intent.putExtra("callAction", RongCallAction.ACTION_OUTGOING_CALL.getName());
    intent.putStringArrayListExtra("invitedUsers", userIds);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setPackage(getContext().getPackageName());
    getContext().getApplicationContext().startActivity(intent);
}
 
Example #15
Source File: RongCallKit.java    From sealtalk-android with MIT License 5 votes vote down vote up
/**
 * 发起单人通话。
 *
 * @param context   上下文
 * @param targetId  会话 id
 * @param mediaType 会话媒体类型
 */
public static void startSingleCall(Context context, String targetId, CallMediaType mediaType) {
    String action;
    if (mediaType.equals(CallMediaType.CALL_MEDIA_TYPE_AUDIO)) {
        action = RongVoIPIntent.RONG_INTENT_ACTION_VOIP_SINGLEAUDIO;
    } else {
        action = RongVoIPIntent.RONG_INTENT_ACTION_VOIP_SINGLEVIDEO;
    }
    Intent intent = new Intent(action);
    intent.putExtra("conversationType", Conversation.ConversationType.PRIVATE.getName().toLowerCase());
    intent.putExtra("targetId", targetId);
    intent.putExtra("callAction", RongCallAction.ACTION_OUTGOING_CALL.getName());
    context.startActivity(intent);
}
 
Example #16
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 #17
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 #18
Source File: NewFriendListActivity.java    From sealtalk-android with MIT License 5 votes vote down vote up
/**
 * 添加好友成功后,向对方发送一条消息
 *
 * @param id 对方id
 */
private void sendMessage(String id) {
    final AgreedFriendRequestMessage message = new AgreedFriendRequestMessage(id, "agree");

        //获取当前用户的 userid
        String userid = sp.getString("loginid", "");
        String username = sp.getString("loginnickname", "");
        String userportrait = sp.getString("loginPortrait", "");

        UserInfo userInfo = new UserInfo(userid, username, Uri.parse(userportrait));
        //把用户信息设置到消息体中,直接发送给对方,可以不设置,非必选项
        message.setUserInfo(userInfo);

            //发送一条添加成功的自定义消息,此条消息不会在ui上展示
            RongIM.getInstance().sendMessage(Conversation.ConversationType.PRIVATE, id, message, null, null, new RongIMClient.SendMessageCallback() {
                @Override
                public void onError(Integer messageId, RongIMClient.ErrorCode e) {
                    Log.e(TAG, Constants.DEBUG + "------DeAgreedFriendRequestMessage----onError--");
                }

                @Override
                public void onSuccess(Integer integer) {
                    Log.e(TAG, Constants.DEBUG + "------DeAgreedFriendRequestMessage----onSuccess--" + message.getMessage());

                }
            });
}
 
Example #19
Source File: MainActivity.java    From sealtalk-android with MIT License 5 votes vote down vote up
/**
 *
 */
private void getConversationPush() {
    if (getIntent() != null && getIntent().hasExtra("PUSH_CONVERSATIONTYPE") && getIntent().hasExtra("PUSH_TARGETID")) {

        final String conversationType = getIntent().getStringExtra("PUSH_CONVERSATIONTYPE");
        final String targetId = getIntent().getStringExtra("PUSH_TARGETID");


            RongIM.getInstance().getConversation(Conversation.ConversationType.valueOf(conversationType), targetId, new RongIMClient.ResultCallback<Conversation>() {
                @Override
                public void onSuccess(Conversation conversation) {

                    if (conversation != null) {

                        if (conversation.getLatestMessage() instanceof ContactNotificationMessage) { //好友消息的push
                            startActivity(new Intent(MainActivity.this, NewFriendListActivity.class));
                        } else {
                            Uri uri = Uri.parse("rong://" + getApplicationInfo().packageName).buildUpon().appendPath("conversation")
                                    .appendPath(conversationType).appendQueryParameter("targetId", targetId).build();
                            Intent intent = new Intent(Intent.ACTION_VIEW);
                            intent.setData(uri);
                            startActivity(intent);
                        }
                    }
                }

                @Override
                public void onError(RongIMClient.ErrorCode e) {

                }
            });
    }
}
 
Example #20
Source File: GroupListActivity.java    From sealtalk-android with MIT License 5 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder viewHolder = null;
    final Groups mContent = list.get(position);
    if (convertView == null) {
        viewHolder = new ViewHolder();
        convertView = LayoutInflater.from(context).inflate(R.layout.group_item_new, null);
        viewHolder.tvTitle = (TextView) convertView.findViewById(R.id.groupname);
        viewHolder.mImageView = (SelectableRoundedImageView) convertView.findViewById(R.id.groupuri);
        viewHolder.groupChat = (Button) convertView.findViewById(R.id.group_chat);
        convertView.setTag(viewHolder);
    } else {
        viewHolder = (ViewHolder) convertView.getTag();
    }
    viewHolder.tvTitle.setText(mContent.getName());
    if (TextUtils.isEmpty(mContent.getPortraitUri())) {
        ImageLoader.getInstance().displayImage(RongGenerate.generateDefaultAvatar(mContent.getName(), mContent.getQunId()),viewHolder.mImageView, App.getOptions());
    }else {
        ImageLoader.getInstance().displayImage(mContent.getPortraitUri(), viewHolder.mImageView, App.getOptions());
    }
    viewHolder.groupChat.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            RongIM.getInstance().startConversation(mContext, Conversation.ConversationType.GROUP,mContent.getQunId(),mContent.getName());
        }
    });
    return convertView;
}
 
Example #21
Source File: SessionAdapter.java    From LQRWeChat with MIT License 5 votes vote down vote up
private void setName(LQRViewHolderForRecyclerView helper, Message item, int position) {
        if (item.getConversationType() == Conversation.ConversationType.PRIVATE) {
            helper.setViewVisibility(R.id.tvName, View.GONE);
        } else {
            helper.setViewVisibility(R.id.tvName, View.GONE);
//                    .setText(R.id.tvName, item.getContent().getUserInfo().getName());
        }
    }
 
Example #22
Source File: MessageFragment.java    From Fishing with GNU General Public License v3.0 5 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.social_fragment_message, container, false);
    ButterKnife.inject(this, root);
    around.setOnClickListener(v -> startActivity(new Intent(getActivity(), AroundActivity.class)));
    search.setOnClickListener(c -> startActivity(new Intent(getActivity(), UserFindActivity.class)));
    contacts.setOnClickListener(v -> startActivity(new Intent(getActivity(), ContactActivity.class)));
    listFragment = ConversationListFragment.getInstance();
    getChildFragmentManager().beginTransaction().add(R.id.container, listFragment, "ChatList").commit();
    Uri uri = Uri.parse("rong://" + getActivity().getApplicationInfo().packageName).buildUpon()
            .appendPath("conversationlist")
            .appendQueryParameter(Conversation.ConversationType.PRIVATE.getName(), "false") //设置私聊会话是否聚合显示
            .appendQueryParameter(Conversation.ConversationType.GROUP.getName(), "true")//群组
            .appendQueryParameter(Conversation.ConversationType.DISCUSSION.getName(), "true")//讨论组
            .appendQueryParameter(Conversation.ConversationType.APP_PUBLIC_SERVICE.getName(), "false")//应用公众服务。
            .appendQueryParameter(Conversation.ConversationType.PUBLIC_SERVICE.getName(), "false")//公共服务号
            .appendQueryParameter(Conversation.ConversationType.SYSTEM.getName(), "false")//系统
            .build();
    listFragment.setUri(uri);
    fabMenu.setOnTouchListener((v, event) -> {
        if (fabMenu.isOpened()){
            fabMenu.close(true);
            return true;
        }
        return false;
    });
    return root;
}
 
Example #23
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 #24
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 #25
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 #26
Source File: ContactNotificationMessageProvider.java    From sealtalk-android with MIT License 5 votes vote down vote up
@Override
public void onItemLongClick(View view, int position, ContactNotificationMessage content, final UIMessage message) {
    String name = null;
    if (message.getConversationType().getName().equals(Conversation.ConversationType.APP_PUBLIC_SERVICE.getName()) ||
            message.getConversationType().getName().equals(Conversation.ConversationType.PUBLIC_SERVICE.getName())) {
        Conversation.PublicServiceType publicServiceType = Conversation.PublicServiceType.setValue(message.getConversationType().getValue());
        PublicServiceProfile info = RongUserInfoManager.getInstance().getPublicServiceProfile(publicServiceType, message.getTargetId());
        if (info != null)
            name = info.getName();
    } else {
        UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(message.getSenderUserId());
        if (userInfo != null)
            name = userInfo.getName();
    }
    String[] items;

    items = new String[]{view.getContext().getResources().getString(R.string.de_dialog_item_message_delete)};

    ArraysDialogFragment.newInstance(name, items).setArraysDialogItemListener(new ArraysDialogFragment.OnArraysDialogItemListener() {
        @Override
        public void OnArraysDialogItemClick(DialogInterface dialog, int which) {
            if (which == 0)
                RongIM.getInstance().getRongIMClient().deleteMessages(new int[]{message.getMessageId()}, null);

        }
    }).show(((FragmentActivity) view.getContext()).getSupportFragmentManager());
}
 
Example #27
Source File: SessionActivity.java    From LQRWeChat with MIT License 5 votes vote down vote up
private void setTitle() {
    if (mConversationType == Conversation.ConversationType.PRIVATE) {
        UserInfo userInfo = DBManager.getInstance().getUserInfo(mSessionId);
        if (userInfo != null)
            setToolbarTitle(userInfo.getName());
    } else if (mConversationType == Conversation.ConversationType.GROUP) {
        Groups groups = DBManager.getInstance().getGroupsById(mSessionId);
        if (groups != null)
            setToolbarTitle(groups.getName());
    }
}
 
Example #28
Source File: NewGroupDetailActivity.java    From sealtalk-android with MIT License 5 votes vote down vote up
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    switch (buttonView.getId()) {
        case R.id.sw_group_top:
            if (isChecked) {
                if (mGroup != null) {
                    OperationRong.setConversationTop(mContext, Conversation.ConversationType.GROUP, mGroup.getId(), true);
                }
            } else {
                if (mGroup != null) {
                    OperationRong.setConversationTop(mContext, Conversation.ConversationType.GROUP, mGroup.getId(), false);
                }
            }
            break;
        case R.id.sw_group_notfaction:
            if (isChecked) {
                if (mGroup != null) {
                    OperationRong.setConverstionNotif(mContext, Conversation.ConversationType.GROUP, mGroup.getId(), true);
                }
            } else {
                if (mGroup != null) {
                    OperationRong.setConverstionNotif(mContext, Conversation.ConversationType.GROUP, mGroup.getId(), false);
                }
            }

            break;
    }
}
 
Example #29
Source File: SessionInfoActivity.java    From LQRWeChat with MIT License 5 votes vote down vote up
@Override
public void init() {
    Intent intent = getIntent();
    mSessionId = intent.getStringExtra("sessionId");
    mSessionType = intent.getIntExtra("sessionType", SESSION_TYPE_PRIVATE);
    switch (mSessionType) {
        case SESSION_TYPE_PRIVATE:
            mConversationType = Conversation.ConversationType.PRIVATE;
            break;
        case SESSION_TYPE_GROUP:
            mConversationType = Conversation.ConversationType.GROUP;
            break;
    }
    registerBR();
}
 
Example #30
Source File: SessionInfoAtPresenter.java    From LQRWeChat with MIT License 5 votes vote down vote up
private void setAdapter() {
    if (mAdapter == null) {
        mAdapter = new LQRAdapterForRecyclerView<GroupMember>(mContext, mData, R.layout.item_member_info) {
            @Override
            public void convert(LQRViewHolderForRecyclerView helper, GroupMember item, int position) {
                ImageView ivHeader = helper.getView(R.id.ivHeader);
                if (mIsManager && position >= mData.size() - 2) {//+和-
                    if (position == mData.size() - 2) {//+
                        ivHeader.setImageResource(R.mipmap.ic_add_team_member);
                    } else {//-
                        ivHeader.setImageResource(R.mipmap.ic_remove_team_member);
                    }
                    helper.setText(R.id.tvName, "");
                } else if (!mIsManager && position >= mData.size() - 1) {//+
                    ivHeader.setImageResource(R.mipmap.ic_add_team_member);
                    helper.setText(R.id.tvName, "");
                } else {
                    Glide.with(mContext).load(item.getPortraitUri()).centerCrop().into(ivHeader);
                    helper.setText(R.id.tvName, item.getName());
                }
            }
        };
        mAdapter.setOnItemClickListener((helper, parent, itemView, position) -> {
            if (mIsManager && position >= mData.size() - 2) {//+和-
                if (position == mData.size() - 2) {//+
                    addMember(mConversationType == Conversation.ConversationType.GROUP);
                } else {//-
                    removeMember();
                }
            } else if (!mIsManager && position >= mData.size() - 1) {//+
                addMember(mConversationType == Conversation.ConversationType.GROUP);
            } else {
                seeUserInfo(DBManager.getInstance().getUserInfo(mData.get(position).getUserId()));
            }
        });
        getView().getRvMember().setAdapter(mAdapter);
    } else {
        mAdapter.notifyDataSetChangedWrapper();
    }
}