Java Code Examples for org.telegram.messenger.UserObject#isDeleted()

The following examples show how to use org.telegram.messenger.UserObject#isDeleted() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AvatarDrawable.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
public AvatarDrawable(TLRPC.User user, boolean profile) {
    this();
    isProfile = profile;
    if (user != null) {
        setInfo(user.id, user.first_name, user.last_name, null);
        drawDeleted = UserObject.isDeleted(user);
    }
}
 
Example 2
Source File: AvatarDrawable.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
public AvatarDrawable(TLRPC.User user, boolean profile) {
    this();
    isProfile = profile;
    if (user != null) {
        setInfo(user.id, user.first_name, user.last_name, null);
        drawDeleted = UserObject.isDeleted(user);
    }
}
 
Example 3
Source File: DialogCell.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
private CharSequence formatArchivedDialogNames() {
    ArrayList<TLRPC.Dialog> dialogs = MessagesController.getInstance(currentAccount).getDialogs(currentDialogFolderId);
    currentDialogFolderDialogsCount = dialogs.size();
    SpannableStringBuilder builder = new SpannableStringBuilder();
    for (int a = 0, N = dialogs.size(); a < N; a++) {
        TLRPC.Dialog dialog = dialogs.get(a);
        TLRPC.User currentUser = null;
        TLRPC.Chat currentChat = null;
        if (DialogObject.isSecretDialogId(dialog.id)) {
            TLRPC.EncryptedChat encryptedChat = MessagesController.getInstance(currentAccount).getEncryptedChat((int) (dialog.id >> 32));
            if (encryptedChat != null) {
                currentUser = MessagesController.getInstance(currentAccount).getUser(encryptedChat.user_id);
            }
        } else {
            int lowerId = (int) dialog.id;
            if (lowerId > 0) {
                currentUser = MessagesController.getInstance(currentAccount).getUser(lowerId);
            } else {
                currentChat = MessagesController.getInstance(currentAccount).getChat(-lowerId);
            }
        }
        String title;
        if (currentChat != null) {
            title = currentChat.title.replace('\n', ' ');
        } else if (currentUser != null) {
            if (UserObject.isDeleted(currentUser)) {
                title = LocaleController.getString("HiddenName", R.string.HiddenName);
            } else {
                title = ContactsController.formatName(currentUser.first_name, currentUser.last_name).replace('\n', ' ');
            }
        } else {
            continue;
        }
        if (builder.length() > 0) {
            builder.append(", ");
        }
        int boldStart = builder.length();
        int boldEnd = boldStart + title.length();
        builder.append(title);
        if (dialog.unread_count > 0) {
            builder.setSpan(new TypefaceSpan(AndroidUtilities.getTypeface("fonts/rmedium.ttf"), 0, Theme.getColor(Theme.key_chats_nameArchived)), boldStart, boldEnd, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        }
        if (builder.length() > 150) {
            break;
        }
    }
    return Emoji.replaceEmoji(builder, Theme.dialogs_messagePaint[paintIndex].getFontMetricsInt(), AndroidUtilities.dp(17), false);
}
 
Example 4
Source File: AvatarDrawable.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
public void setInfo(TLRPC.User user) {
    if (user != null) {
        setInfo(user.id, user.first_name, user.last_name, null);
        drawDeleted = UserObject.isDeleted(user);
    }
}
 
Example 5
Source File: DialogCell.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
private CharSequence formatArchivedDialogNames() {
    ArrayList<TLRPC.Dialog> dialogs = MessagesController.getInstance(currentAccount).getDialogs(currentDialogFolderId);
    currentDialogFolderDialogsCount = dialogs.size();
    SpannableStringBuilder builder = new SpannableStringBuilder();
    for (int a = 0, N = dialogs.size(); a < N; a++) {
        TLRPC.Dialog dialog = dialogs.get(a);
        TLRPC.User currentUser = null;
        TLRPC.Chat currentChat = null;
        if (DialogObject.isSecretDialogId(dialog.id)) {
            TLRPC.EncryptedChat encryptedChat = MessagesController.getInstance(currentAccount).getEncryptedChat((int) (dialog.id >> 32));
            if (encryptedChat != null) {
                currentUser = MessagesController.getInstance(currentAccount).getUser(encryptedChat.user_id);
            }
        } else {
            int lowerId = (int) dialog.id;
            if (lowerId > 0) {
                currentUser = MessagesController.getInstance(currentAccount).getUser(lowerId);
            } else {
                currentChat = MessagesController.getInstance(currentAccount).getChat(-lowerId);
            }
        }
        String title;
        if (currentChat != null) {
            title = currentChat.title.replace('\n', ' ');
        } else if (currentUser != null) {
            if (UserObject.isDeleted(currentUser)) {
                title = LocaleController.getString("HiddenName", R.string.HiddenName);
            } else {
                title = ContactsController.formatName(currentUser.first_name, currentUser.last_name).replace('\n', ' ');
            }
        } else {
            continue;
        }
        if (builder.length() > 0) {
            builder.append(", ");
        }
        int boldStart = builder.length();
        int boldEnd = boldStart + title.length();
        builder.append(title);
        if (dialog.unread_count > 0) {
            builder.setSpan(new TypefaceSpan(AndroidUtilities.getTypeface("fonts/rmedium.ttf"), 0, Theme.getColor(Theme.key_chats_nameArchived)), boldStart, boldEnd, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        }
        if (builder.length() > 150) {
            break;
        }
    }
    return Emoji.replaceEmoji(builder, Theme.dialogs_messagePaint[paintIndex].getFontMetricsInt(), AndroidUtilities.dp(17), false);
}
 
Example 6
Source File: AvatarDrawable.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
public void setInfo(TLRPC.User user) {
    if (user != null) {
        setInfo(user.id, user.first_name, user.last_name, null);
        drawDeleted = UserObject.isDeleted(user);
    }
}