Java Code Examples for cn.jpush.im.android.api.model.UserInfo#getAvatarFile()
The following examples show how to use
cn.jpush.im.android.api.model.UserInfo#getAvatarFile() .
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: ForwardMsgAdapter.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { final ViewHolder holder; if (null == convertView) { holder = new ViewHolder(); convertView = LayoutInflater.from(mContext).inflate(R.layout.item_contact, null); holder.name = (TextView) convertView.findViewById(R.id.name); holder.avatar = (ImageView) convertView.findViewById(R.id.head_icon_iv); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } Conversation conversation = mConvList.get(position); if (conversation.getType() == ConversationType.group) { holder.name.setText(conversation.getTitle()); holder.avatar.setImageResource(R.drawable.group); } else { UserInfo userInfo = (UserInfo) conversation.getTargetInfo(); holder.name.setText(userInfo.getDisplayName()); if (userInfo.getAvatarFile() != null) { holder.avatar.setImageBitmap(BitmapFactory.decodeFile(userInfo.getAvatarFile().getAbsolutePath())); }else { holder.avatar.setImageResource(R.drawable.jmui_head_icon); } } return convertView; }
Example 2
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, "退出失败"); } }
Example 3
Source File: NotReadAdapter.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { final ViewHolder holder; if (convertView == null) { holder = new ViewHolder(); convertView = mInflater.inflate(R.layout.receipt_no_read, parent, false); holder.iv_noRead = (ImageView) convertView.findViewById(R.id.iv_noRead); holder.tv_noRead = (TextView) convertView.findViewById(R.id.tv_noRead); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } UserInfo info = unRead.get(position); String displayName = info.getDisplayName(); File avatarFile = info.getAvatarFile(); if (avatarFile != null && avatarFile.exists()) { holder.iv_noRead.setImageBitmap(BitmapFactory.decodeFile(avatarFile.getAbsolutePath())); } else { info.getAvatarBitmap(new GetAvatarBitmapCallback() { @Override public void gotResult(int i, String s, Bitmap bitmap) { if (i == 0) { holder.iv_noRead.setImageBitmap(bitmap); } else { holder.iv_noRead.setImageResource(R.drawable.jmui_head_icon); } } }); } holder.tv_noRead.setText(displayName); return convertView; }
Example 4
Source File: AlreadyReadAdapter.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { final ViewHolder holder; if (convertView == null) { holder = new ViewHolder(); convertView = mInflater.inflate(R.layout.receipt_already_read, parent, false); holder.iv_alreadyRead = (ImageView) convertView.findViewById(R.id.iv_alreadyRead); holder.tv_alreadyRead = (TextView) convertView.findViewById(R.id.tv_alreadyRead); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } UserInfo info = alreadyRead.get(position); String displayName = info.getDisplayName(); File avatarFile = info.getAvatarFile(); if (avatarFile != null && avatarFile.exists()) { holder.iv_alreadyRead.setImageBitmap(BitmapFactory.decodeFile(avatarFile.getAbsolutePath())); } else { info.getAvatarBitmap(new GetAvatarBitmapCallback() { @Override public void gotResult(int i, String s, Bitmap bitmap) { if (i == 0) { holder.iv_alreadyRead.setImageBitmap(bitmap); } else { holder.iv_alreadyRead.setImageResource(R.drawable.jmui_head_icon); } } }); } holder.tv_alreadyRead.setText(displayName); return convertView; }
Example 5
Source File: JsonUtils.java From jmessage-flutter-plugin with MIT License | 4 votes |
static HashMap toJson(final UserInfo userInfo) { if (userInfo == null) { return null; } final HashMap result = new HashMap<String, Object>(); result.put("type", "user"); if (null != userInfo.getGender()) { switch (userInfo.getGender()) { case male: result.put("gender", "male"); break; case female: result.put("gender", "female"); break; case unknown: result.put("gender", "unknown"); } } else { result.put("gender", "unknown"); } result.put("username", userInfo.getUserName() != null ? userInfo.getUserName() : ""); result.put("appKey", userInfo.getAppKey()); result.put("nickname", userInfo.getNickname() != null ? userInfo.getNickname(): ""); if (userInfo.getAvatarFile() != null) { result.put("avatarThumbPath", userInfo.getAvatarFile().getAbsolutePath()); } else { result.put("avatarThumbPath", ""); } if (userInfo.getBirthday() != 0) { DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); try { String tsStr = sdf.format(userInfo.getBirthday()); result.put("birthday", tsStr); } catch (Exception e) { e.printStackTrace(); } } else { long time = userInfo.getBirthday(); result.put("birthday", ""); } result.put("region", userInfo.getRegion() != null ? userInfo.getRegion() :""); result.put("signature", userInfo.getSignature() != null ? userInfo.getSignature() : ""); result.put("address", userInfo.getAddress() != null ? userInfo.getAddress() : ""); result.put("noteName", userInfo.getNotename() != null ? userInfo.getNotename() : ""); result.put("noteText", userInfo.getNoteText() != null ? userInfo.getNoteText() : ""); result.put("isNoDisturb", userInfo.getNoDisturb() == 1); result.put("isInBlackList", userInfo.getBlacklist() == 1); result.put("isFriend", userInfo.isFriend()); Map<String, String> extras = userInfo.getExtras(); result.put("extras", extras != null ? extras : new HashMap<String, String>()); return result; }