mirror of
https://github.com/ChronosX88/Influence.git
synced 2024-11-23 10:02:18 +00:00
If the user has no avatar, then put the first (upper case) letter of his JID
This commit is contained in:
parent
548de95a5a
commit
77c97cf012
@ -55,12 +55,13 @@ public class DialogListPresenter implements CoreContracts.IDialogListPresenterCo
|
||||
private CoreContracts.IChatListViewContract view;
|
||||
private CoreContracts.IDialogListLogicContract logic;
|
||||
private DialogsListAdapter<GenericDialog> dialogListAdapter = new DialogsListAdapter<>((imageView, url, payload) -> {
|
||||
String firstLetter = Character.toString(Character.toUpperCase(url.charAt(0)));
|
||||
imageView.setImageDrawable(TextDrawable.builder()
|
||||
.beginConfig()
|
||||
.width(32)
|
||||
.height(32)
|
||||
.endConfig()
|
||||
.buildRound(Character.toString(url.charAt(0)), ColorGenerator.MATERIAL.getColor(Character.toString(url.charAt(0)))));
|
||||
.buildRound(firstLetter, ColorGenerator.MATERIAL.getColor(firstLetter)));
|
||||
CompletableFuture.supplyAsync(() -> {
|
||||
while (AppHelper.getXmppConnection() == null);
|
||||
while (AppHelper.getXmppConnection().isConnectionAlive() != true);
|
||||
@ -150,12 +151,14 @@ public class DialogListPresenter implements CoreContracts.IDialogListPresenterCo
|
||||
@Override
|
||||
public void loadRemoteContactList() {
|
||||
CompletableFuture.supplyAsync(() -> logic.getRemoteContacts()).thenAccept((contacts) -> {
|
||||
if(contacts != null) {
|
||||
StreamSupport.stream(contacts).forEach(contact -> {
|
||||
LocalDBWrapper.createChatEntry(contact.getJid().asUnescapedString(), contact.getName() == null ? contact.getJid().asUnescapedString() : contact.getName());
|
||||
dialogListAdapter.upsertItem(new GenericDialog(LocalDBWrapper.getChatByChatID(contact.getJid().asUnescapedString())));
|
||||
});
|
||||
}
|
||||
AppHelper.getMainUIThread().post(() -> {
|
||||
if(contacts != null) {
|
||||
StreamSupport.stream(contacts).forEach(contact -> {
|
||||
LocalDBWrapper.createChatEntry(contact.getJid().asUnescapedString(), contact.getName() == null ? contact.getJid().asUnescapedString().split("@")[0] : contact.getName());
|
||||
dialogListAdapter.upsertItem(new GenericDialog(LocalDBWrapper.getChatByChatID(contact.getJid().asUnescapedString())));
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -97,12 +97,13 @@ class ChatActivity : AppCompatActivity(), CoreContracts.IChatViewContract {
|
||||
chatAvatar!!.setImageBitmap(avatar)
|
||||
} else {
|
||||
val chatName = intent.getStringExtra("chatName")
|
||||
val firstLetter = Character.toString(chatName[0].toUpperCase())
|
||||
chatAvatar!!.setImageDrawable(TextDrawable.builder()
|
||||
.beginConfig()
|
||||
.width(32)
|
||||
.height(32)
|
||||
.endConfig()
|
||||
.buildRound(Character.toString(chatName[0]), ColorGenerator.MATERIAL.getColor(Character.toString(chatName[0]))))
|
||||
.buildRound(firstLetter, ColorGenerator.MATERIAL.getColor(firstLetter)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user