public boolean isHissageNumber(String number) { if (TextUtils.isEmpty(number)) { NmsLog.error(TAG, "isHissageNumber. number is empty!"); return false; } if (number.contains("@")) { return false; } String cutNumber = NmsCommonUtils.nmsGetStandardPhoneNum(number); if (TextUtils.isEmpty(cutNumber)) { NmsLog.warn(TAG, "isHisssageNumber. cutNumber is empty!"); } return engineadapter.get().nmsUIGetIsHesineAccount(cutNumber) == 0 ? true : false; }
public Bitmap getGroupChatContactAvatar(NmsGroupChatContact groupChatContact) { if (groupChatContact == null) { NmsLog.error(TAG, "groupChatContact is invalid!"); return null; } ArrayList<Bitmap> bitmapList = new ArrayList<Bitmap>(); short[] memberIds = groupChatContact.getMemberIds(); if (memberIds != null) { for (int index = 0; index < memberIds.length && bitmapList.size() < 3; ++index) { Bitmap avatar = getAvatarViaEngineContactId(memberIds[index]); if (avatar != null) { bitmapList.add(avatar); } } } else { NmsLog.warn(TAG, "memberIds is null."); } if (bitmapList.size() < 3 && groupChatContact.isAlive()) { // myself bitmap Bitmap avatar = getMyselfAvatarViaSimId(groupChatContact.getSimId()); if (avatar == null) { avatar = mDefaultBitmap; } bitmapList.add(avatar); } bitmapList = fillBitmapList(groupChatContact.getMemberCount(), bitmapList, mDefaultBitmap, mBlankBitmap); Bitmap result = null; if (bitmapList != null && bitmapList.size() == 3) { result = NmsCommonUtils.stitchBitmap(bitmapList.get(0), bitmapList.get(1), bitmapList.get(2)); } return result; }
public boolean isMyselfEngineContactId(short engContactId) { if (engContactId <= 0) { NmsLog.error(TAG, "engContactId <= 0"); return false; } short[] ids = engineadapter.get().nmsUIGetSelfContactIds(); if (ids == null) { NmsLog.warn(TAG, "engContactIds is null"); return false; } boolean result = false; for (short id : ids) { if (id == engContactId) { result = true; break; } } return result; }
public Bitmap getEngineAvatarViaEngineContactId(short engineContactId) { if (engineContactId <= 0) { NmsLog.error(TAG, "getEngineAvatarViaEngineContactId. engineContactId is invalid!"); return null; } Bitmap result = null; if (isMyselfEngineContactId(engineContactId)) { NmsContact contact = engineadapter.get().nmsUIGetContact(engineContactId); NmsProfileSettings userProfile = engineadapter .get() .nmsUIGetUserInfoViaImsi( engineadapter.get().nmsUIGetImsiViaNumber(contact.getNumber())); if (userProfile != null) { result = userProfile.getProfileSettingsAvatar(); } } else { SNmsImg photoPath = engineadapter.get().nmsUIGetContactImg(engineContactId); if (photoPath != null) { if (photoPath.imgPath != null) { try { result = BitmapFactory.decodeFile(photoPath.imgPath); } catch (Exception e) { NmsLog.warn( TAG, "BitmapFactory.decodeFile failed, engineContactId: " + engineContactId); } } else if (photoPath.byteImg != null) { result = BitmapFactory.decodeByteArray(photoPath.byteImg, 0, photoPath.byteImg.length); } } } return result; }