use of de.pixart.messenger.databinding.ContactBinding in project Pix-Art-Messenger by kriztan.
the class ConferenceDetailsActivity method updateView.
private void updateView() {
invalidateOptionsMenu();
final MucOptions mucOptions = mConversation.getMucOptions();
final User self = mucOptions.getSelf();
String account;
if (Config.DOMAIN_LOCK != null) {
account = mConversation.getAccount().getJid().getLocalpart();
} else {
account = mConversation.getAccount().getJid().toBareJid().toString();
}
if (getSupportActionBar() != null) {
final ActionBar ab = getSupportActionBar();
if (ab != null) {
ab.setCustomView(R.layout.ab_title);
ab.setDisplayShowCustomEnabled(true);
TextView abtitle = findViewById(android.R.id.text1);
TextView absubtitle = findViewById(android.R.id.text2);
abtitle.setText(mConversation.getName());
abtitle.setSelected(true);
abtitle.setClickable(false);
absubtitle.setVisibility(View.GONE);
absubtitle.setClickable(false);
}
}
ConferenceName.setText(mConversation.getName());
mAccountJid.setText(getString(R.string.using_account, account));
if (xmppConnectionService.multipleAccounts()) {
mAccountJid.setVisibility(View.VISIBLE);
} else {
mAccountJid.setVisibility(View.GONE);
}
mYourPhoto.setImageBitmap(avatarService().get(mConversation.getAccount(), getPixel(48)));
setTitle(mConversation.getName());
mFullJid.setText(mConversation.getJid().toBareJid().toString());
mYourNick.setText(mucOptions.getActualNick());
TextView mRoleAffiliaton = findViewById(R.id.muc_role);
if (mucOptions.online()) {
mMoreDetails.setVisibility(View.VISIBLE);
mMucSettings.setVisibility(View.VISIBLE);
mConferenceInfoTable.setVisibility(this.mAdvancedMode ? View.VISIBLE : View.GONE);
final String status = getStatus(self);
if (status != null) {
mRoleAffiliaton.setVisibility(View.VISIBLE);
mRoleAffiliaton.setText(status);
} else {
mRoleAffiliaton.setVisibility(View.GONE);
}
if (mucOptions.membersOnly()) {
mConferenceType.setText(R.string.private_conference);
} else {
mConferenceType.setText(R.string.public_conference);
}
if (mucOptions.mamSupport()) {
mConferenceInfoMam.setText(R.string.server_info_available);
} else {
mConferenceInfoMam.setText(R.string.server_info_unavailable);
}
if (self.getAffiliation().ranks(MucOptions.Affiliation.OWNER)) {
mDestroyButton.setVisibility(View.VISIBLE);
mChangeConferenceSettingsButton.setVisibility(View.VISIBLE);
} else {
mDestroyButton.setVisibility(View.GONE);
mChangeConferenceSettingsButton.setVisibility(View.GONE);
}
} else {
mMoreDetails.setVisibility(View.GONE);
mMucSettings.setVisibility(View.GONE);
mConferenceInfoTable.setVisibility(View.GONE);
}
long mutedTill = mConversation.getLongAttribute(Conversation.ATTRIBUTE_MUTED_TILL, 0);
if (mutedTill == Long.MAX_VALUE) {
mNotifyStatusText.setText(R.string.notify_never);
mNotifyStatusButton.setImageResource(R.drawable.ic_notifications_off_grey600_24dp);
} else if (System.currentTimeMillis() < mutedTill) {
mNotifyStatusText.setText(R.string.notify_paused);
mNotifyStatusButton.setImageResource(R.drawable.ic_notifications_paused_grey600_24dp);
} else if (mConversation.alwaysNotify()) {
mNotifyStatusButton.setImageResource(R.drawable.ic_notifications_grey600_24dp);
mNotifyStatusText.setText(R.string.notify_on_all_messages);
} else {
mNotifyStatusButton.setImageResource(R.drawable.ic_notifications_none_grey600_24dp);
mNotifyStatusText.setText(R.string.notify_only_when_highlighted);
}
final LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
membersView.removeAllViews();
if (inflater == null) {
return;
}
final ArrayList<User> users = mucOptions.getUsers();
Collections.sort(users);
for (final User user : users) {
ContactBinding binding = DataBindingUtil.inflate(inflater, R.layout.contact, membersView, false);
final Contact contact = user.getContact();
final String name = user.getName();
this.setListItemBackgroundOnView(binding.getRoot());
if (contact != null && contact.showInRoster()) {
binding.getRoot().setOnClickListener((OnClickListener) view -> switchToContactDetails(contact));
}
registerForContextMenu(binding.getRoot());
binding.getRoot().setTag(user);
if (mAdvancedMode && user.getPgpKeyId() != 0) {
binding.key.setVisibility(View.VISIBLE);
binding.key.setOnClickListener(v -> viewPgpKey(user));
binding.key.setText(OpenPgpUtils.convertKeyIdToHex(user.getPgpKeyId()));
}
if (contact != null) {
binding.contactDisplayName.setText(contact.getDisplayName());
binding.contactJid.setText((name != null ? name + " \u2022 " : "") + getStatus(user));
} else {
binding.contactDisplayName.setText(name == null ? "" : name);
binding.contactJid.setText(getStatus(user));
}
loadAvatar(user, binding.contactPhoto);
if (user.getRole() == MucOptions.Role.NONE) {
binding.contactDisplayName.setAlpha(INACTIVE_ALPHA);
binding.key.setAlpha(INACTIVE_ALPHA);
binding.contactJid.setAlpha(INACTIVE_ALPHA);
binding.contactPhoto.setAlpha(INACTIVE_ALPHA);
}
membersView.addView(binding.getRoot());
if (mConversation.getMucOptions().canInvite()) {
mInviteButton.setVisibility(View.VISIBLE);
} else {
mInviteButton.setVisibility(View.GONE);
}
}
}
use of de.pixart.messenger.databinding.ContactBinding in project Pix-Art-Messenger by kriztan.
the class ListItemAdapter method getView.
@Override
public View getView(int position, View view, ViewGroup parent) {
LayoutInflater inflater = activity.getLayoutInflater();
ListItem item = getItem(position);
ViewHolder viewHolder;
if (view == null) {
ContactBinding binding = DataBindingUtil.inflate(inflater, R.layout.contact, parent, false);
viewHolder = ViewHolder.get(binding);
view = binding.getRoot();
} else {
viewHolder = (ViewHolder) view.getTag();
}
List<ListItem.Tag> tags = item.getTags(activity);
if (tags.size() == 0 || !this.showDynamicTags) {
viewHolder.tags.setVisibility(View.GONE);
} else {
viewHolder.tags.setVisibility(View.VISIBLE);
viewHolder.tags.removeAllViewsInLayout();
for (ListItem.Tag tag : tags) {
TextView tv = (TextView) inflater.inflate(R.layout.list_item_tag, viewHolder.tags, false);
tv.setText(tag.getName());
tv.setBackgroundColor(tag.getColor());
tv.setOnClickListener(this.onTagTvClick);
viewHolder.tags.addView(tv);
}
}
final String jid = item.getDisplayJid();
if (jid != null) {
viewHolder.jid.setVisibility(View.VISIBLE);
viewHolder.jid.setText(jid);
} else {
viewHolder.jid.setVisibility(View.GONE);
}
viewHolder.name.setText(item.getDisplayName());
if (tags.size() != 0) {
for (ListItem.Tag tag : tags) {
offline = tag.getOffline() == 1;
color = tag.getColor();
}
}
if (offline) {
viewHolder.name.setTextColor(ContextCompat.getColor(activity, R.color.black87));
viewHolder.name.setAlpha(INACTIVE_ALPHA);
viewHolder.jid.setAlpha(INACTIVE_ALPHA);
viewHolder.avatar.setAlpha(INACTIVE_ALPHA);
viewHolder.tags.setAlpha(INACTIVE_ALPHA);
} else {
if (ShowPresenceColoredNames()) {
viewHolder.name.setTextColor(color);
} else {
viewHolder.name.setTextColor(ContextCompat.getColor(activity, R.color.black87));
}
viewHolder.name.setAlpha(ACTIVE_ALPHA);
viewHolder.jid.setAlpha(ACTIVE_ALPHA);
viewHolder.avatar.setAlpha(ACTIVE_ALPHA);
viewHolder.tags.setAlpha(ACTIVE_ALPHA);
}
loadAvatar(item, viewHolder.avatar);
return view;
}
Aggregations