use of org.jivesoftware.smack.SmackException in project xabber-android by redsolution.
the class AccountInfoEditorFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle args = getArguments();
account = args.getString(ARGUMENT_ACCOUNT, null);
String vCardString = args.getString(ARGUMENT_VCARD, null);
if (vCardString != null) {
try {
vCard = ContactVcardViewerFragment.parseVCard(vCardString);
} catch (XmlPullParserException | IOException | SmackException e) {
LogManager.exception(this, e);
}
}
if (savedInstanceState != null) {
final String avatarImageUriString = savedInstanceState.getString(SAVE_NEW_AVATAR_IMAGE_URI);
if (avatarImageUriString != null) {
newAvatarImageUri = Uri.parse(avatarImageUriString);
}
final String photoFileUriString = savedInstanceState.getString(SAVE_PHOTO_FILE_URI);
if (photoFileUriString != null) {
photoFileUri = Uri.parse(photoFileUriString);
}
removeAvatarFlag = savedInstanceState.getBoolean(SAVE_REMOVE_AVATAR_FLAG);
}
}
use of org.jivesoftware.smack.SmackException in project xabber-android by redsolution.
the class ForwardedProvider method parse.
@Override
public Forwarded parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackException {
DelayInformationProvider delayInformationProvider = new DelayInformationProvider();
DelayInformation delayInformation = null;
Stanza packet = null;
boolean done = false;
while (!done) {
int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("delay"))
delayInformation = delayInformationProvider.parse(parser);
else if (parser.getName().equals("message"))
packet = PacketParserUtils.parseMessage(parser);
else
throw new SmackException("Unsupported forwarded packet type: " + parser.getName());
} else if (eventType == XmlPullParser.END_TAG && parser.getName().equals(Forwarded.ELEMENT_NAME))
done = true;
}
if (packet == null)
throw new SmackException("forwarded extension must contain a packet");
return new Forwarded(delayInformation, packet);
}
use of org.jivesoftware.smack.SmackException 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