private void viewPgpKey(User user) { PgpEngine pgp = xmppConnectionService.getPgpEngine(); if (pgp != null) { PendingIntent intent = pgp.getIntentForKey(conversation.getAccount(), user.getPgpKeyId()); if (intent != null) { try { startIntentSenderForResult(intent.getIntentSender(), 0, null, 0, 0, 0); } catch (SendIntentException e) { } } } }
private void populateView() { mAccountJid.setText(getString(R.string.using_account, conversation.getAccount().getJid())); mYourPhoto.setImageBitmap(avatarService().get(conversation.getAccount(), getPixel(48))); setTitle(conversation.getName()); mFullJid.setText(conversation.getContactJid().split("/", 2)[0]); mYourNick.setText(conversation.getMucOptions().getActualNick()); mRoleAffiliaton = (TextView) findViewById(R.id.muc_role); if (conversation.getMucOptions().online()) { mMoreDetails.setVisibility(View.VISIBLE); User self = conversation.getMucOptions().getSelf(); switch (self.getAffiliation()) { case User.AFFILIATION_ADMIN: mRoleAffiliaton.setText( getReadableRole(self.getRole()) + " (" + getString(R.string.admin) + ")"); break; case User.AFFILIATION_OWNER: mRoleAffiliaton.setText( getReadableRole(self.getRole()) + " (" + getString(R.string.owner) + ")"); break; default: mRoleAffiliaton.setText(getReadableRole(self.getRole())); break; } } this.users.clear(); this.users.addAll(conversation.getMucOptions().getUsers()); LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); membersView.removeAllViews(); for (final User user : conversation.getMucOptions().getUsers()) { View view = inflater.inflate(R.layout.contact, membersView, false); TextView name = (TextView) view.findViewById(R.id.contact_display_name); TextView key = (TextView) view.findViewById(R.id.key); TextView role = (TextView) view.findViewById(R.id.contact_jid); if (user.getPgpKeyId() != 0) { key.setVisibility(View.VISIBLE); key.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { viewPgpKey(user); } }); key.setText(OpenPgpUtils.convertKeyIdToHex(user.getPgpKeyId())); } Bitmap bm; Contact contact = user.getContact(); if (contact != null) { bm = avatarService().get(contact, getPixel(48)); name.setText(contact.getDisplayName()); role.setText(user.getName() + " \u2022 " + getReadableRole(user.getRole())); } else { bm = avatarService().get(user.getName(), getPixel(48)); name.setText(user.getName()); role.setText(getReadableRole(user.getRole())); } ImageView iv = (ImageView) view.findViewById(R.id.contact_photo); iv.setImageBitmap(bm); membersView.addView(view); } }