use of com.xabber.android.ui.fragment.ContactVcardViewerFragment in project xabber-android by redsolution.
the class AccountViewer method editAccountInfo.
private void editAccountInfo() {
VCard vCard = ((ContactVcardViewerFragment) getFragmentManager().findFragmentById(R.id.scrollable_container)).getvCard();
if (vCard != null) {
Intent intent = AccountInfoEditor.createIntent(this, account, vCard.getChildElementXML().toString());
startActivityForResult(intent, ACCOUNT_INFO_EDITOR_REQUEST_CODE);
}
}
use of com.xabber.android.ui.fragment.ContactVcardViewerFragment in project xabber-android by redsolution.
the class AccountViewer method onActivityResult.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode != ACCOUNT_INFO_EDITOR_REQUEST_CODE) {
return;
}
final ContactVcardViewerFragment contactVcardViewerFragment = (ContactVcardViewerFragment) getFragmentManager().findFragmentById(R.id.scrollable_container);
if (resultCode == AccountInfoEditorFragment.REQUEST_NEED_VCARD) {
contactVcardViewerFragment.requestVCard();
}
if (resultCode == RESULT_OK) {
String vCardXml = data.getStringExtra(AccountInfoEditorFragment.ARGUMENT_VCARD);
VCard vCard = null;
if (vCardXml != null) {
try {
vCard = ContactVcardViewerFragment.parseVCard(vCardXml);
} catch (XmlPullParserException | IOException | SmackException e) {
e.printStackTrace();
}
}
if (vCard != null) {
vCard.getField(VCardProperty.NICKNAME.name());
contactVcardViewerFragment.onVCardReceived(account, Jid.getBareAddress(account), vCard);
} else {
contactVcardViewerFragment.requestVCard();
}
}
}
Aggregations