Java Code Examples for org.telegram.ui.Cells.GroupCreateUserCell#setChecked()

The following examples show how to use org.telegram.ui.Cells.GroupCreateUserCell#setChecked() . 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: GroupCreateActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void checkVisibleRows() {
    int count = listView.getChildCount();
    for (int a = 0; a < count; a++) {
        View child = listView.getChildAt(a);
        if (child instanceof GroupCreateUserCell) {
            GroupCreateUserCell cell = (GroupCreateUserCell) child;
            TLRPC.User user = cell.getUser();
            if (user != null) {
                cell.setChecked(selectedContacts.indexOfKey(user.id) >= 0, true);
            }
        }
    }
}
 
Example 2
Source File: GroupCreateActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void checkVisibleRows() {
    int count = listView.getChildCount();
    for (int a = 0; a < count; a++) {
        View child = listView.getChildAt(a);
        if (child instanceof GroupCreateUserCell) {
            GroupCreateUserCell cell = (GroupCreateUserCell) child;
            TLRPC.User user = cell.getUser();
            if (user != null) {
                cell.setChecked(selectedContacts.indexOfKey(user.id) >= 0, true);
            }
        }
    }
}
 
Example 3
Source File: GroupCreateActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private void checkVisibleRows() {
    int count = listView.getChildCount();
    for (int a = 0; a < count; a++) {
        View child = listView.getChildAt(a);
        if (child instanceof GroupCreateUserCell) {
            GroupCreateUserCell cell = (GroupCreateUserCell) child;
            Object object = cell.getObject();
            int id;
            if (object instanceof TLRPC.User) {
                id = ((TLRPC.User) object).id;
            } else if (object instanceof TLRPC.Chat) {
                id = -((TLRPC.Chat) object).id;
            } else {
                id = 0;
            }
            if (id != 0) {
                if (ignoreUsers != null && ignoreUsers.indexOfKey(id) >= 0) {
                    cell.setChecked(true, false);
                    cell.setCheckBoxEnabled(false);
                } else {
                    cell.setChecked(selectedContacts.indexOfKey(id) >= 0, true);
                    cell.setCheckBoxEnabled(true);
                }
            }
        }
    }
}
 
Example 4
Source File: TooManyCommunitiesActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
    if (position >= headerPosition && headerPosition > 0) {
        holder.itemView.setAlpha(enterProgress);
    } else {
        holder.itemView.setAlpha(1f);
    }
    if (getItemViewType(position) == 4) {
        GroupCreateUserCell cell = (GroupCreateUserCell) holder.itemView;
        TLRPC.Chat chat = inactiveChats.get(position - inactiveChatsStartRow);
        String signature = inactiveChatsSignatures.get(position - inactiveChatsStartRow);
        cell.setObject(chat, chat.title, signature, position != inactiveChatsEndRow - 1);
        cell.setChecked(selectedIds.contains(chat.id), false);
    }
}
 
Example 5
Source File: TooManyCommunitiesActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
    TLRPC.Chat chat = searchResults.get(position);
    String signature = searchResultsSignatures.get(position);
    GroupCreateUserCell cell = ((GroupCreateUserCell) holder.itemView);
    cell.setObject(chat, chat.title, signature, position != searchResults.size() - 1);
    cell.setChecked(selectedIds.contains(chat.id), false);
}
 
Example 6
Source File: GroupCreateActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private void checkVisibleRows() {
    int count = listView.getChildCount();
    for (int a = 0; a < count; a++) {
        View child = listView.getChildAt(a);
        if (child instanceof GroupCreateUserCell) {
            GroupCreateUserCell cell = (GroupCreateUserCell) child;
            Object object = cell.getObject();
            int id;
            if (object instanceof TLRPC.User) {
                id = ((TLRPC.User) object).id;
            } else if (object instanceof TLRPC.Chat) {
                id = -((TLRPC.Chat) object).id;
            } else {
                id = 0;
            }
            if (id != 0) {
                if (ignoreUsers != null && ignoreUsers.indexOfKey(id) >= 0) {
                    cell.setChecked(true, false);
                    cell.setCheckBoxEnabled(false);
                } else {
                    cell.setChecked(selectedContacts.indexOfKey(id) >= 0, true);
                    cell.setCheckBoxEnabled(true);
                }
            }
        }
    }
}
 
Example 7
Source File: TooManyCommunitiesActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
    if (position >= headerPosition && headerPosition > 0) {
        holder.itemView.setAlpha(enterProgress);
    } else {
        holder.itemView.setAlpha(1f);
    }
    if (getItemViewType(position) == 4) {
        GroupCreateUserCell cell = (GroupCreateUserCell) holder.itemView;
        TLRPC.Chat chat = inactiveChats.get(position - inactiveChatsStartRow);
        String signature = inactiveChatsSignatures.get(position - inactiveChatsStartRow);
        cell.setObject(chat, chat.title, signature, position != inactiveChatsEndRow - 1);
        cell.setChecked(selectedIds.contains(chat.id), false);
    }
}
 
Example 8
Source File: TooManyCommunitiesActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
    TLRPC.Chat chat = searchResults.get(position);
    String signature = searchResultsSignatures.get(position);
    GroupCreateUserCell cell = ((GroupCreateUserCell) holder.itemView);
    cell.setObject(chat, chat.title, signature, position != searchResults.size() - 1);
    cell.setChecked(selectedIds.contains(chat.id), false);
}
 
Example 9
Source File: FilterUsersActivity.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
private void checkVisibleRows() {
    int count = listView.getChildCount();
    for (int a = 0; a < count; a++) {
        View child = listView.getChildAt(a);
        if (child instanceof GroupCreateUserCell) {
            GroupCreateUserCell cell = (GroupCreateUserCell) child;
            Object object = cell.getObject();
            int id;
            if (object instanceof String) {
                String str = (String) object;
                switch (str) {
                    case "contacts":
                        id = Integer.MIN_VALUE;
                        break;
                    case "non_contacts":
                        id = Integer.MIN_VALUE + 1;
                        break;
                    case "groups":
                        id = Integer.MIN_VALUE + 2;
                        break;
                    case "channels":
                        id = Integer.MIN_VALUE + 3;
                        break;
                    case "bots":
                        id = Integer.MIN_VALUE + 4;
                        break;
                    case "muted":
                        id = Integer.MIN_VALUE + 5;
                        break;
                    case "read":
                        id = Integer.MIN_VALUE + 6;
                        break;
                    case "archived":
                    default:
                        id = Integer.MIN_VALUE + 7;
                        break;
                }
            } else if (object instanceof TLRPC.User) {
                id = ((TLRPC.User) object).id;
            } else if (object instanceof TLRPC.Chat) {
                id = -((TLRPC.Chat) object).id;
            } else {
                id = 0;
            }
            if (id != 0) {
                cell.setChecked(selectedContacts.indexOfKey(id) >= 0, true);
                cell.setCheckBoxEnabled(true);
            }
        }
    }
}
 
Example 10
Source File: FilterUsersActivity.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
private void checkVisibleRows() {
    int count = listView.getChildCount();
    for (int a = 0; a < count; a++) {
        View child = listView.getChildAt(a);
        if (child instanceof GroupCreateUserCell) {
            GroupCreateUserCell cell = (GroupCreateUserCell) child;
            Object object = cell.getObject();
            int id;
            if (object instanceof String) {
                String str = (String) object;
                switch (str) {
                    case "contacts":
                        id = Integer.MIN_VALUE;
                        break;
                    case "non_contacts":
                        id = Integer.MIN_VALUE + 1;
                        break;
                    case "groups":
                        id = Integer.MIN_VALUE + 2;
                        break;
                    case "channels":
                        id = Integer.MIN_VALUE + 3;
                        break;
                    case "bots":
                        id = Integer.MIN_VALUE + 4;
                        break;
                    case "muted":
                        id = Integer.MIN_VALUE + 5;
                        break;
                    case "read":
                        id = Integer.MIN_VALUE + 6;
                        break;
                    case "archived":
                    default:
                        id = Integer.MIN_VALUE + 7;
                        break;
                }
            } else if (object instanceof TLRPC.User) {
                id = ((TLRPC.User) object).id;
            } else if (object instanceof TLRPC.Chat) {
                id = -((TLRPC.Chat) object).id;
            } else {
                id = 0;
            }
            if (id != 0) {
                cell.setChecked(selectedContacts.indexOfKey(id) >= 0, true);
                cell.setCheckBoxEnabled(true);
            }
        }
    }
}