cn.jpush.im.android.api.model.UserInfo Java Examples
The following examples show how to use
cn.jpush.im.android.api.model.UserInfo.
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: MessageNotReadFragment.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
private void initListViewClick() { mReceipt_noRead.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { UserInfo userInfo = (UserInfo) parent.getItemAtPosition(position); Intent intent = new Intent(); if (userInfo.isFriend()) { intent.setClass(mContext, FriendInfoActivity.class); }else { intent.setClass(mContext, GroupNotFriendActivity.class); } intent.putExtra(JGApplication.TARGET_ID, userInfo.getUserName()); intent.putExtra(JGApplication.TARGET_APP_KEY, userInfo.getAppKey()); intent.putExtra(JGApplication.GROUP_ID, mGroupId); startActivity(intent); } }); }
Example #2
Source File: JmessageFlutterPlugin.java From jmessage-flutter-plugin with MIT License | 6 votes |
/** * 监听管理员拒绝入群申请事件 */ public void onEventMainThread(GroupApprovalRefuseEvent event) { Log.d(TAG, "GroupApprovalRefuseEvent, event: " + event); final HashMap json = new HashMap(); json.put("reason", event.getReason()); json.put("groupId", event.getGid() + ""); event.getFromUserInfo(new GetUserInfoCallback() { @Override public void gotResult(int status, String desc, UserInfo userInfo) { if (status == 0) { json.put("groupManager", toJson(userInfo)); } } }); JmessageFlutterPlugin.instance.channel.invokeMethod("onReceiveGroupAdminReject", json); }
Example #3
Source File: MembersInChatActivity.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
private void addAll() { String nickname, pinyin; ItemModel itemModel; mPinyinList.clear(); mShowUserList.clear(); for (UserInfo userInfo: mMemberInfoList) { itemModel = new ItemModel(); itemModel.data = userInfo; nickname = userInfo.getNickname(); if (TextUtils.isEmpty(nickname)) { nickname = userInfo.getUserName(); } pinyin = HanyuPinyin.getInstance().getStringPinYin(nickname); mPinyinList.add(pinyin); itemModel.highlight = new SpannableString(nickname); mShowUserList.add(itemModel); } mUIHandler.sendEmptyMessage(SEARCH_MEMBER_SUCCESS); }
Example #4
Source File: JmessageFlutterPlugin.java From jmessage-flutter-plugin with MIT License | 6 votes |
private void getUserInfo(MethodCall call, final Result result) { HashMap<String, Object> map = call.arguments(); String username, appKey; try { JSONObject params = new JSONObject(map); username = params.getString("username"); appKey = params.has("appKey") ? params.getString("appKey") : JmessageFlutterPlugin.appKey; } catch (JSONException e) { e.printStackTrace(); handleResult(ERR_CODE_PARAMETER, ERR_MSG_PARAMETER, result); return; } JMessageClient.getUserInfo(username, appKey, new GetUserInfoCallback() { @Override public void gotResult(int status, String desc, UserInfo userInfo) { if (status == 0) { handleResult(toJson(userInfo), status, desc, result); } else { handleResult(status, desc, result); } } }); }
Example #5
Source File: MembersInChatActivity.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
/** * @param userInfo 要增加的成员的用户名,目前一次只能增加一个 */ private void addAMember(final UserInfo userInfo) { mLoadingDialog = DialogCreator.createLoadingDialog(mContext, mContext.getString(R.string.adding_hint)); mLoadingDialog.show(); ArrayList<String> list = new ArrayList<String>(); list.add(userInfo.getUserName()); JMessageClient.addGroupMembers(mGroupId, list, new BasicCallback() { @Override public void gotResult(final int status, final String desc) { mLoadingDialog.dismiss(); if (status == 0) { // 添加群成员 refreshMemberList(); Toast.makeText(mContext, mContext.getString(R.string.added), Toast.LENGTH_SHORT).show(); } else { Toast.makeText(MembersInChatActivity.this, "添加失败" + desc, Toast.LENGTH_SHORT).show(); } } }); }
Example #6
Source File: MembersInChatActivity.java From jmessage-android-uikit with MIT License | 6 votes |
/** * @param userInfo 要增加的成员的用户名,目前一次只能增加一个 */ private void addAMember(final UserInfo userInfo) { mLoadingDialog = DialogCreator.createLoadingDialog(mContext, mContext.getString(IdHelper.getString(mContext, "jmui_adding_hint"))); mLoadingDialog.show(); ArrayList<String> list = new ArrayList<String>(); list.add(userInfo.getUserName()); JMessageClient.addGroupMembers(mGroupId, list, new BasicCallback() { @Override public void gotResult(final int status, final String desc) { if (status == 0) { // 添加群成员 // mAdapter.refreshMemberList(mGroupId); refreshMemberList(); // mMemberInfoList = mAdapter.getMemberList(); mListView.setSelection(mListView.getBottom()); // mTitle.setText("(" + mMemberInfoList.size() + ")"); mLoadingDialog.dismiss(); } else { mLoadingDialog.dismiss(); HandleResponseCode.onHandle(mContext, status, true); } } }); }
Example #7
Source File: ChatDetailController.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
/** * @param userInfo 要增加的成员的用户名,目前一次只能增加一个 */ private void addAMember(final UserInfo userInfo) { mLoadingDialog = DialogCreator.createLoadingDialog(mContext, mContext.getString(R.string.adding_hint)); mLoadingDialog.show(); ArrayList<String> list = new ArrayList<String>(); list.add(userInfo.getUserName()); JMessageClient.addGroupMembers(mGroupId, list, new BasicCallback() { @Override public void gotResult(final int status, final String desc) { mLoadingDialog.dismiss(); if (status == 0) { refreshMemberList(); } else { ToastUtil.shortToast(mContext, "添加失败"); } } }); }
Example #8
Source File: PullMsgListActivity.java From Android-IM with Apache License 2.0 | 6 votes |
private void dataAdapter2(final int id) { JMessageClient.getUserInfo(id + "", "", new GetUserInfoCallback() { @Override public void gotResult(int i, String s, UserInfo userInfo) { bean = new MessageBean(); // Log.e("userinfoMsg", ""+userInfo); bean.setTitle(userInfo.getNickname()); bean.setContent(userInfo.getUserName() + ""); bean.setUserName(userInfo.getUserName()); bean.setType(1); bean.setFriends(userInfo.isFriend()); bean.setImg(userInfo.getAvatarFile().toURI().toString()); // Log.e("bean1===", bean.getTitle() + " ," + bean.getContent()); TYPE_BUTTON = 1; list2.add(bean); adapter2.notifyDataSetChanged(); } }); }
Example #9
Source File: MessageAlreadyReadFragment.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
private void initListViewClick() { mReceipt_alreadyRead.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { UserInfo userInfo = (UserInfo) parent.getItemAtPosition(position); Intent intent = new Intent(); if (userInfo.isFriend()) { intent.setClass(mContext, FriendInfoActivity.class); }else { intent.setClass(mContext, GroupNotFriendActivity.class); } intent.putExtra(JGApplication.TARGET_ID, userInfo.getUserName()); intent.putExtra(JGApplication.TARGET_APP_KEY, userInfo.getAppKey()); intent.putExtra(JGApplication.GROUP_ID, mGroupId); startActivity(intent); } }); }
Example #10
Source File: ChatDetailController.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
public void isShowMore() { JMessageClient.getGroupInfo(mGroupId, new GetGroupInfoCallback() { @Override public void gotResult(int responseCode, String responseMessage, GroupInfo groupInfo) { if (responseCode == 0) { List<UserInfo> groupMembers = groupInfo.getGroupMembers(); if (mIsCreator) { if (groupMembers.size() > 13) { mChatDetailView.isLoadMoreShow(true); } else { mChatDetailView.isLoadMoreShow(false); } } else { if (groupMembers.size() > 14) { mChatDetailView.isLoadMoreShow(true); } else { mChatDetailView.isLoadMoreShow(false); } } } } }); }
Example #11
Source File: LoginActivity.java From Android-IM with Apache License 2.0 | 6 votes |
public void initUserInfo(String id, final int type){ showProgressDialog("正在初始化数据"); JMessageClient.getUserInfo(id, new GetUserInfoCallback() { @Override public void gotResult(int i, String s, UserInfo userInfo) { dismissProgressDialog(); if (i==0) { // Log.e("info-Login", ""+JMessageClient.getMyInfo()+"\n"+JMessageClient.getConversationList()+"\n"+userInfo); Intent intent = new Intent(LoginActivity.this , MainActivity.class); intent.putExtra("LOGINTYPE", type); startActivity(intent); } } }); }
Example #12
Source File: SearchGroupActivity.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
private void initListener() { final Intent intent = new Intent(); mLv_searchGroup.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Object itemAtPosition = parent.getItemAtPosition(position); if (itemAtPosition instanceof UserInfo) { UserInfo info = ((UserInfo) itemAtPosition); if (info.isFriend()) { intent.setClass(SearchGroupActivity.this, FriendInfoActivity.class); intent.putExtra("fromSearch", true); } else { intent.setClass(SearchGroupActivity.this, GroupNotFriendActivity.class); } intent.putExtra(JGApplication.TARGET_ID, info.getUserName()); intent.putExtra(JGApplication.TARGET_APP_KEY, info.getAppKey()); startActivity(intent); } } }); }
Example #13
Source File: NotFriendSettingActivity.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_not_friend_setting); mBtn_addBlackList = (SlipButton) findViewById(R.id.btn_addBlackList); mUserName = getIntent().getStringExtra("notFriendUserName"); mBtn_addBlackList.setOnChangedListener(R.id.btn_addBlackList, this); JMessageClient.getUserInfo(mUserName, new GetUserInfoCallback() { @Override public void gotResult(int i, String s, UserInfo userInfo) { if (i == 0) { mUserInfo = userInfo; mBtn_addBlackList.setChecked(userInfo.getBlacklist() == 1); } } }); }
Example #14
Source File: ChatActivity.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
/** * 当在聊天界面断网再次连接时收离线事件刷新 */ public void onEvent(OfflineMessageEvent event) { Conversation conv = event.getConversation(); if (conv.getType().equals(ConversationType.single)) { UserInfo userInfo = (UserInfo) conv.getTargetInfo(); String targetId = userInfo.getUserName(); String appKey = userInfo.getAppKey(); if (mIsSingle && targetId.equals(mTargetId) && appKey.equals(mTargetAppKey)) { List<Message> singleOfflineMsgList = event.getOfflineMessageList(); if (singleOfflineMsgList != null && singleOfflineMsgList.size() > 0) { mChatView.setToBottom(); mChatAdapter.addMsgListToList(singleOfflineMsgList); } } } else { long groupId = ((GroupInfo) conv.getTargetInfo()).getGroupID(); if (groupId == mGroupId) { List<Message> offlineMessageList = event.getOfflineMessageList(); if (offlineMessageList != null && offlineMessageList.size() > 0) { mChatView.setToBottom(); mChatAdapter.addMsgListToList(offlineMessageList); } } } }
Example #15
Source File: MeFragment.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
@Override public void onResume() { UserInfo myInfo = JMessageClient.getMyInfo(); myInfo.getAvatarBitmap(new GetAvatarBitmapCallback() { @Override public void gotResult(int i, String s, Bitmap bitmap) { if (i == 0) { mMeView.showPhoto(bitmap); mMeController.setBitmap(bitmap); }else { mMeView.showPhoto(null); mMeController.setBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.rc_default_portrait)); } } }); mMeView.showNickName(myInfo); super.onResume(); }
Example #16
Source File: GroupDetailActivity.java From jmessage-android-uikit with MIT License | 6 votes |
private void getUserInfo(final String targetId, final Dialog dialog){ JMessageClient.getUserInfo(targetId, new GetUserInfoCallback() { @Override public void gotResult(final int status, String desc, final UserInfo userInfo) { if (mLoadingDialog != null) { mLoadingDialog.dismiss(); } if (status == 0) { addAMember(userInfo); dialog.cancel(); } else { HandleResponseCode.onHandle(mContext, status, true); } } }); }
Example #17
Source File: ChattingListAdapter.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
public void setSendMsgs(int msgIds) { Message msg = mConv.getMessage(msgIds); if (msg != null) { mMsgList.add(msg); incrementStartPosition(); mMsgQueue.offer(msg); } if (mMsgQueue.size() > 0) { Message message = mMsgQueue.element(); if (mConv.getType() == ConversationType.single) { UserInfo userInfo = (UserInfo) message.getTargetInfo(); sendNextImgMsg(message); } else { sendNextImgMsg(message); } notifyDataSetChanged(); } }
Example #18
Source File: AtMemberAdapter.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
private String getLetter(UserInfo userInfo) { String displayName = userInfo.getDisplayName(); ArrayList<HanziToPinyin.Token> tokens = HanziToPinyin.getInstance() .get(displayName); StringBuilder sb = new StringBuilder(); if (tokens != null && tokens.size() > 0) { for (HanziToPinyin.Token token : tokens) { if (token.type == HanziToPinyin.Token.PINYIN) { sb.append(token.target); } else { sb.append(token.source); } } } String sortString = sb.toString().substring(0, 1).toUpperCase(); if (sortString.matches("[A-Z]")) { letter = sortString.toUpperCase(); } else { letter = "#"; } return letter; }
Example #19
Source File: AtMemberAdapter.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
@Override public View getHeaderView(int position, View convertView, ViewGroup parent) { HeaderViewHolder holder; UserInfo userInfo = mList.get(position); if (convertView == null) { holder = new HeaderViewHolder(); convertView = LayoutInflater.from(mContext).inflate(R.layout.header, parent, false); holder.text = (TextView) convertView.findViewById(R.id.section_tv); convertView.setTag(holder); } else { holder = (HeaderViewHolder) convertView.getTag(); } String letters = getLetter(userInfo); holder.text.setText(letters); return convertView; }
Example #20
Source File: MembersInChatActivity.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
/** * 添加成员时检查是否存在该群成员 * * @param targetId 要添加的用户 * @return 返回是否存在该用户 */ private boolean checkIfNotContainUser(String targetId) { if (mMemberInfoList != null) { for (UserInfo userInfo : mMemberInfoList) { if (userInfo.getUserName().equals(targetId)) return false; } return true; } return true; }
Example #21
Source File: SearchMoreGroupActivity.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
private String getGroupName(List<UserInfo> groupMembers, StringBuilder builder) { for (UserInfo info : groupMembers) { String noteName = info.getDisplayName(); builder.append(noteName); builder.append(","); } return builder.substring(0, builder.lastIndexOf(",")); }
Example #22
Source File: GroupDetailActivity.java From jmessage-android-uikit with MIT License | 5 votes |
/** * 添加成员时检查是否存在该群成员 * * @param targetID 要添加的用户 * @return 返回是否存在该用户 */ private boolean checkIfNotContainUser(String targetID) { if (mMembersList != null) { for (UserInfo userInfo : mMembersList) { if (userInfo.getUserName().equals(targetID)) return false; } return true; } return true; }
Example #23
Source File: JsonUtils.java From jmessage-flutter-plugin with MIT License | 5 votes |
static List toJson(List list) { List jsonArray = new ArrayList(); if (list == null) { return jsonArray; } for (Object object : list) { if (object instanceof UserInfo) { jsonArray.add(toJson((UserInfo) object)); } else if (object instanceof GroupInfo) { jsonArray.add(toJson((GroupInfo) object)); } else if (object instanceof GroupBasicInfo) { jsonArray.add(toJson((GroupBasicInfo) object)); } else if (object instanceof Message) { jsonArray.add(toJson((Message) object)); } else if (object instanceof GroupMemberInfo) { jsonArray.add(toJson((GroupMemberInfo) object)); } else { jsonArray.add(object); } } return jsonArray; }
Example #24
Source File: SearchFriendBusinessActivity.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Object selectObject = parent.getItemAtPosition(position); if (selectObject instanceof UserInfo) { UserInfo friend = (UserInfo) selectObject; if (getIntent().getBooleanExtra("isSingle", false)) { setBusinessCard(friend, JMessageClient.getSingleConversation(getIntent().getStringExtra("userId"))); } else { setBusinessCard(friend, JMessageClient.getGroupConversation(getIntent().getLongExtra("groupId", 0))); } } }
Example #25
Source File: GroupGridViewAdapter.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
public GroupGridViewAdapter(GroupGridViewActivity context, List<UserInfo> memberInfoList, boolean isCreator, int size) { this.mContext = context; mInflater = LayoutInflater.from(context); this.mMemberList = memberInfoList; this.mIsCreator = isCreator; this.mAvatarSize = size; mCurrentNum = mMemberList.size(); }
Example #26
Source File: ContactFragment.java From Android-IM with Apache License 2.0 | 5 votes |
private void initItemOnClick() { mFriendsAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { @Override public void onItemClick(BaseQuickAdapter adapter, View view, int position) { UserInfo userInfo = (UserInfo) mFriendsAdapter.getData().get(position); Intent intent = new Intent(getActivity(), UserInfoActivity.class); intent.putExtra("USERNAME", userInfo.getUserName()); startActivity(intent); } }); }
Example #27
Source File: AtMemberAdapter.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
@Override public View getView(int position, View convertView, ViewGroup viewGroup) { if (null == convertView) { convertView = LayoutInflater.from(mContext).inflate(R.layout.item_contact, null); } final ImageView headIcon = ViewHolder.get(convertView, R.id.head_icon_iv); TextView name = ViewHolder.get(convertView, R.id.name); final UserInfo userInfo = mList.get(position); userInfo.getAvatarBitmap(new GetAvatarBitmapCallback() { @Override public void gotResult(int status, String desc, Bitmap bitmap) { if (status == 0) { headIcon.setImageBitmap(bitmap); } else { headIcon.setImageResource(R.drawable.jmui_head_icon); } } }); String displayName = userInfo.getNotename(); if (TextUtils.isEmpty(displayName)) { displayName = userInfo.getNickname(); if (TextUtils.isEmpty(displayName)) { displayName = userInfo.getUserName(); } } name.setText(displayName); return convertView; }
Example #28
Source File: GroupMemberGridAdapter.java From jmessage-android-uikit with MIT License | 5 votes |
public void refreshMemberList(List<UserInfo> memberList) { mMemberList = memberList; if (mMemberList.size() > MAX_GRID_ITEM) { mCurrentNum = MAX_GRID_ITEM - 1; } else { mCurrentNum = mMemberList.size(); } mRestNum = mRestArray[mCurrentNum % 4]; notifyDataSetChanged(); }
Example #29
Source File: GroupMemberGridAdapter.java From jmessage-android-uikit with MIT License | 5 votes |
public GroupMemberGridAdapter(Context context, List<UserInfo> memberList, boolean isCreator, int size) { this.mContext = context; mInflater = LayoutInflater.from(context); mIsGroup = true; this.mMemberList = memberList; mCurrentNum = mMemberList.size(); this.mIsCreator = isCreator; this.mAvatarSize = size; initBlankItem(); }
Example #30
Source File: MeFragment.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
public void Logout() { final Intent intent = new Intent(); UserInfo info = JMessageClient.getMyInfo(); if (null != info) { SharePreferenceManager.setCachedUsername(info.getUserName()); if (info.getAvatarFile() != null) { SharePreferenceManager.setCachedAvatarPath(info.getAvatarFile().getAbsolutePath()); } JMessageClient.logout(); intent.setClass(mContext, LoginActivity.class); startActivity(intent); } else { ToastUtil.shortToast(mContext, "退出失败"); } }