use of ezvcard.property.Uid in project ring-client-android by savoirfairelinux.
the class AccountWizardActivity method saveProfile.
@Override
public void saveProfile(final String accountID, final RingAccountViewModel ringAccountViewModel) {
runOnUiThread(() -> {
RingAccountViewModelImpl ringAccountViewModelImpl = (RingAccountViewModelImpl) ringAccountViewModel;
VCard vcard = new VCard();
vcard.setFormattedName(new FormattedName(ringAccountViewModelImpl.getFullName()));
vcard.setUid(new Uid(ringAccountViewModelImpl.getUsername()));
ByteArrayOutputStream stream = new ByteArrayOutputStream();
if (ringAccountViewModelImpl.getPhoto() != null) {
ringAccountViewModelImpl.getPhoto().compress(Bitmap.CompressFormat.PNG, 100, stream);
Photo photoVCard = new Photo(stream.toByteArray(), ImageType.PNG);
vcard.removeProperties(Photo.class);
vcard.addPhoto(photoVCard);
}
vcard.removeProperties(RawProperty.class);
VCardUtils.saveLocalProfileToDisk(vcard, accountID, getFilesDir());
});
}
use of ezvcard.property.Uid in project ring-client-android by savoirfairelinux.
the class SIPCreationPresenter method saveProfile.
private void saveProfile(String accountID) {
VCard vcard = new VCard();
String formattedName = mAccount.getUsername();
if (formattedName.isEmpty()) {
formattedName = mAccount.getAlias();
}
vcard.setFormattedName(new FormattedName(formattedName));
String vcardUid = formattedName + accountID;
vcard.setUid(new Uid(vcardUid));
vcard.removeProperties(RawProperty.class);
VCardUtils.saveLocalProfileToDisk(vcard, accountID, mDeviceService.provideFilesDir());
}
use of ezvcard.property.Uid in project ring-client-android by savoirfairelinux.
the class TVAccountWizard method saveProfile.
@Override
public void saveProfile(final String accountID, final RingAccountViewModel ringAccountViewModel) {
runOnUiThread(() -> {
RingAccountViewModelImpl ringAccountViewModelImpl = (RingAccountViewModelImpl) ringAccountViewModel;
VCard vcard = new VCard();
vcard.setFormattedName(new FormattedName(ringAccountViewModelImpl.getFullName()));
vcard.setUid(new Uid(ringAccountViewModelImpl.getUsername()));
ByteArrayOutputStream stream = new ByteArrayOutputStream();
if (ringAccountViewModelImpl.getPhoto() != null) {
Bitmap reduced = BitmapUtils.reduceBitmap(ringAccountViewModelImpl.getPhoto(), VCardUtils.VCARD_PHOTO_SIZE);
reduced.compress(Bitmap.CompressFormat.PNG, 100, stream);
Photo photoVCard = new Photo(stream.toByteArray(), ImageType.PNG);
vcard.removeProperties(Photo.class);
vcard.addPhoto(photoVCard);
}
vcard.removeProperties(RawProperty.class);
VCardUtils.saveLocalProfileToDisk(vcard, accountID, getFilesDir());
});
}
use of ezvcard.property.Uid in project ring-client-android by savoirfairelinux.
the class VCardUtils method setupDefaultProfile.
private static VCard setupDefaultProfile(File filesDir, String accountId) {
VCard vcard = new VCard();
vcard.setUid(new Uid(accountId));
saveLocalProfileToDisk(vcard, accountId, filesDir);
return vcard;
}
use of ezvcard.property.Uid in project ring-client-android by savoirfairelinux.
the class RingNavigationPresenter method saveVCardPhoto.
public void saveVCardPhoto(Photo photo) {
String accountId = mAccountService.getCurrentAccount().getAccountID();
String ringId = mAccountService.getCurrentAccount().getUsername();
File filesDir = mDeviceRuntimeService.provideFilesDir();
VCard vcard = VCardUtils.loadLocalProfileFromDisk(filesDir, accountId);
vcard.setUid(new Uid(ringId));
vcard.removeProperties(Photo.class);
vcard.addPhoto(photo);
vcard.removeProperties(RawProperty.class);
VCardUtils.saveLocalProfileToDisk(vcard, accountId, filesDir);
updateUser();
}
Aggregations