Show list of used clients in contact details

This commit is contained in:
Arne 2025-01-09 13:52:34 +01:00
parent cf1cbd506c
commit 56979376ca
2 changed files with 21 additions and 2 deletions

View file

@ -258,7 +258,6 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
populateView();
});
binding.addContactButton.setOnClickListener(v -> showAddToRosterDialog(contact));
mMediaAdapter = new MediaAdapter(this, R.dimen.media_size);
this.binding.media.setAdapter(mMediaAdapter);
GridManager.setupLayoutManager(this, this.binding.media, R.dimen.media_size);
@ -490,7 +489,6 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
}
binding.statusMessage.setText(builder);
}
if (contact.getOption(Contact.Options.FROM)) {
binding.detailsSendPresence.setText(R.string.send_presence_updates);
binding.detailsSendPresence.setChecked(true);
@ -783,6 +781,19 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
xmppConnectionService.updateConversation(conversation);
});
//Show used clients of contact
String[] resources = contact.getPresences().toResourceArray();
if (resources.length == 0) {
binding.clients.setVisibility(View.GONE);
} else {
binding.clients.setVisibility(View.VISIBLE);
for (int i = 0; i < resources.length; i++) {
binding.clients.append(resources[i]);
binding.clients.append("\n");
}
}
populateView();
}
}

View file

@ -119,6 +119,14 @@
android:textAppearance="?textAppearanceBodyMedium"
tools:text="Hey there! Im using monocles chat" />
<TextView
android:id="@+id/clients"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:textAppearance="?textAppearanceBodyMedium" />
<Button
android:id="@+id/add_contact_button"
style="@style/Widget.Material3.Button.ElevatedButton"