private void setImage(Bitmap bmp) { if (bmp == null) { return; } mBlurBmp = ImageUtil.fastBlur(bmp, 32); mLayout.setBlurBackGroud(mBlurBmp); mRbmp = ImageUtil.getRoundedBitmap(bmp, false); mLayout.setUserPhoto(mRbmp); mPhotoStatus = PhotoStatus.MODIFY; mUserInfo.photo = Base64.encodeToString(ImageUtil.bitmapToByteArray(bmp), 0); mUserInfo.photo = mUserInfo.photo.replaceAll("\n", ""); mBackupPhoto = mUserInfo.photo; }
private void setView() { if (mUserInfo == null) { return; } mLayout.setUserID(mUserInfo.user_id); mLayout.setUserName(mUserInfo.name); if (mUserInfo.pin_exist) { mLayout.showPin(true); } else { mLayout.showPin(false); } mLayout.setUserID(mUserInfo.user_id); mLayout.setUserName(mUserInfo.name); mLayout.setEmail(mUserInfo.email); mLayout.setTelephone(mUserInfo.phone_number); mLayout.setLoginID(mUserInfo.login_id); setPermission(); if (mUserInfo.password_exist || (mPasswordData != null && !mPasswordData.isEmpty())) { mLayout.setPassword(getString(R.string.password_display)); } else { mLayout.setPassword(""); } if (mUserInfo.user_group != null) { mLayout.setUserGroup(mUserInfo.user_group.name); mLayout.setUserGroupID(mUserInfo.user_group.id); } else { // mLayout.setUserGroup(getString(R.string.all_users)); mLayout.setUserGroupID(String.valueOf(1)); } if (mUserInfo.isActive()) { mLayout.setStatus(getString(R.string.status) + " " + getString(R.string.active)); } else { mLayout.setStatus(getString(R.string.status) + " " + getString(R.string.inactive)); } mLayout.setStatusSwitch(mUserInfo.isActive()); mLayout.setDateStart( mUserInfo.getTimeFormmat( mTimeConvertProvider, User.UserTimeType.start_datetime, TimeConvertProvider.DATE_TYPE.FORMAT_DATE)); mLayout.setDateEnd( mUserInfo.getTimeFormmat( mTimeConvertProvider, User.UserTimeType.expiry_datetime, TimeConvertProvider.DATE_TYPE.FORMAT_DATE)); setAccessGroupCount(); setFingerCount(); setCardCount(); if (mUserInfo.pin_exist || (mPinData != null && !mPinData.isEmpty())) { mLayout.setPin(getString(R.string.password_display)); } else { mLayout.setPin(""); } mPinSwitch.init( getActivity(), new OnChangeListener() { @Override public void onChange(boolean on) { if (BuildConfig.DEBUG) { Log.e(TAG, "pin :" + on); } if (on) { showPinPasswodPopup(); } else { mLayout.setPin(""); mPinData = null; } } }, (mUserInfo.pin_exist || (mPinData != null && !mPinData.isEmpty()))); mPinSwitch.setSwitch((mUserInfo.pin_exist || (mPinData != null && !mPinData.isEmpty()))); mLayout.setUserPhotoDefault(); if (mRbmp != null) { mLayout.setUserPhoto(mRbmp); } else if (bmp != null) { mRbmp = ImageUtil.getRoundedBitmap(bmp, false); mLayout.setUserPhoto(mRbmp); } else { if (mUserInfo.photo != null && !mUserInfo.photo.isEmpty()) { byte[] photoByte = Base64.decode(mUserInfo.photo, 0); bmp = ImageUtil.byteArrayToBitmap(photoByte); if (bmp != null) { mBlurBmp = ImageUtil.fastBlur(bmp, 32); mLayout.setBlurBackGroud(mBlurBmp); mRbmp = ImageUtil.getRoundedBitmap(bmp, false); mLayout.setUserPhoto(mRbmp); } } } isExistImageCheck(); }