use of cx.ring.account.RingAccountViewModelImpl in project ring-client-android by savoirfairelinux.
the class TVHomeAccountCreationFragment method goToAccountCreation.
@Override
public void goToAccountCreation() {
RingAccountViewModelImpl ringAccountViewModel = new RingAccountViewModelImpl();
ringAccountViewModel.setLink(false);
GuidedStepFragment.add(getFragmentManager(), TVProfileCreationFragment.newInstance(ringAccountViewModel));
}
use of cx.ring.account.RingAccountViewModelImpl in project ring-client-android by savoirfairelinux.
the class TVHomeAccountCreationFragment method goToAccountLink.
@Override
public void goToAccountLink() {
RingAccountViewModelImpl ringAccountViewModel = new RingAccountViewModelImpl();
ringAccountViewModel.setLink(true);
GuidedStepFragment.add(getFragmentManager(), TVProfileCreationFragment.newInstance(ringAccountViewModel));
}
use of cx.ring.account.RingAccountViewModelImpl in project ring-client-android by savoirfairelinux.
the class TVProfileCreationFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
((RingApplication) getActivity().getApplication()).getRingInjectionComponent().inject(this);
super.onViewCreated(view, savedInstanceState);
RingAccountViewModelImpl ringAccountViewModel = (RingAccountViewModelImpl) getArguments().get(RingAccountCreationFragment.KEY_RING_ACCOUNT);
presenter.initPresenter(ringAccountViewModel);
if (ringAccountViewModel != null && ringAccountViewModel.getPhoto() != null) {
getGuidanceStylist().getIconView().setImageBitmap(ringAccountViewModel.getPhoto());
}
}
use of cx.ring.account.RingAccountViewModelImpl in project ring-client-android by savoirfairelinux.
the class TVProfileCreationFragment method photoUpdate.
@Override
public void photoUpdate(RingAccountViewModel ringAccountViewModel) {
((RingAccountViewModelImpl) ringAccountViewModel).setPhoto(mSourcePhoto);
RingAccountViewModelImpl model = (RingAccountViewModelImpl) ringAccountViewModel;
Glide.with(getActivity()).load(model.getPhoto()).apply(AvatarFactory.getGlideOptions(true, false)).transition(DrawableTransitionOptions.withCrossFade()).into(getGuidanceStylist().getIconView());
}
use of cx.ring.account.RingAccountViewModelImpl 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());
});
}
Aggregations