Java Code Examples for org.telegram.messenger.AndroidUtilities#VcardItem

The following examples show how to use org.telegram.messenger.AndroidUtilities#VcardItem . 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: PhonebookShareActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public void setVCardItem(AndroidUtilities.VcardItem item, int icon) {
    textView.setText(item.getValue(true));
    valueTextView.setText(item.getType());
    if (checkBox != null) {
        checkBox.setChecked(item.checked, false);
    }
    if (icon != 0) {
        imageView.setImageResource(icon);
    } else {
        imageView.setImageDrawable(null);
    }
}
 
Example 2
Source File: PhonebookShareActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    switch (holder.getItemViewType()) {
        case 0: {
            if (position == overscrollRow) {
                ((EmptyCell) holder.itemView).setHeight(AndroidUtilities.dp(88));
            } else {
                ((EmptyCell) holder.itemView).setHeight(AndroidUtilities.dp(16));
            }
            break;
        }
        case 1: {
            TextCheckBoxCell cell = (TextCheckBoxCell) holder.itemView;
            AndroidUtilities.VcardItem item;
            int icon;
            if (position >= phoneStartRow && position < phoneEndRow) {
                item = phones.get(position - phoneStartRow);
                if (position == phoneStartRow) {
                    icon = R.drawable.profile_phone;
                } else {
                    icon = 0;
                }
            } else {
                item = other.get(position - vcardStartRow);
                if (position == vcardStartRow) {
                    icon = R.drawable.profile_info;
                } else {
                    icon = 0;
                }
            }
            cell.setVCardItem(item, icon);
            break;
        }
    }
}
 
Example 3
Source File: PhonebookShareActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public void setVCardItem(AndroidUtilities.VcardItem item, int icon) {
    textView.setText(item.getValue(true));
    valueTextView.setText(item.getType());
    if (checkBox != null) {
        checkBox.setChecked(item.checked, false);
    }
    if (icon != 0) {
        imageView.setImageResource(icon);
    } else {
        imageView.setImageDrawable(null);
    }
}
 
Example 4
Source File: PhonebookShareActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    switch (holder.getItemViewType()) {
        case 0: {
            if (position == overscrollRow) {
                ((EmptyCell) holder.itemView).setHeight(AndroidUtilities.dp(88));
            } else {
                ((EmptyCell) holder.itemView).setHeight(AndroidUtilities.dp(16));
            }
            break;
        }
        case 1: {
            TextCheckBoxCell cell = (TextCheckBoxCell) holder.itemView;
            AndroidUtilities.VcardItem item;
            int icon;
            if (position >= phoneStartRow && position < phoneEndRow) {
                item = phones.get(position - phoneStartRow);
                if (position == phoneStartRow) {
                    icon = R.drawable.profile_phone;
                } else {
                    icon = 0;
                }
            } else {
                item = other.get(position - vcardStartRow);
                if (position == vcardStartRow) {
                    icon = R.drawable.profile_info;
                } else {
                    icon = 0;
                }
            }
            cell.setVCardItem(item, icon);
            break;
        }
    }
}
 
Example 5
Source File: PhonebookShareAlert.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
public void setVCardItem(AndroidUtilities.VcardItem item, int icon, boolean divider) {
    textView.setText(item.getValue(true));
    valueTextView.setText(item.getType());
    if (checkBox != null) {
        checkBox.setChecked(item.checked, false);
    }
    if (icon != 0) {
        imageView.setImageResource(icon);
    } else {
        imageView.setImageDrawable(null);
    }
    needDivider = divider;
    setWillNotDraw(!needDivider);
}
 
Example 6
Source File: PhonebookShareAlert.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
public void onBindViewHolder(View itemView, int position, int type) {
    if (type == 1) {
        TextCheckBoxCell cell = (TextCheckBoxCell) itemView;
        AndroidUtilities.VcardItem item;
        int icon;
        if (position >= phoneStartRow && position < phoneEndRow) {
            item = phones.get(position - phoneStartRow);
            icon = R.drawable.menu_calls;
        } else {
            item = other.get(position - vcardStartRow);
            if (item.type == 1) {
                icon = R.drawable.menu_mail;
            } else if (item.type == 2) {
                icon = R.drawable.menu_location;
            } else if (item.type == 3) {
                icon = R.drawable.msg_link;
            } else if (item.type == 4) {
                icon = R.drawable.profile_info;
            } else if (item.type == 5) {
                icon = R.drawable.menu_date;
            } else if (item.type == 6) {
                if ("ORG".equalsIgnoreCase(item.getRawType(true))) {
                    icon = R.drawable.menu_work;
                } else {
                    icon = R.drawable.menu_jobtitle;
                }
            } else if (item.type == 20) {
                icon = R.drawable.menu_info;
            } else {
                icon = R.drawable.menu_info;
            }
        }
        cell.setVCardItem(item, icon, position != getItemCount() - 1);
    }
}
 
Example 7
Source File: PhonebookShareAlert.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
public void setVCardItem(AndroidUtilities.VcardItem item, int icon, boolean divider) {
    textView.setText(item.getValue(true));
    valueTextView.setText(item.getType());
    if (checkBox != null) {
        checkBox.setChecked(item.checked, false);
    }
    if (icon != 0) {
        imageView.setImageResource(icon);
    } else {
        imageView.setImageDrawable(null);
    }
    needDivider = divider;
    setWillNotDraw(!needDivider);
}
 
Example 8
Source File: PhonebookShareAlert.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
public void onBindViewHolder(View itemView, int position, int type) {
    if (type == 1) {
        TextCheckBoxCell cell = (TextCheckBoxCell) itemView;
        AndroidUtilities.VcardItem item;
        int icon;
        if (position >= phoneStartRow && position < phoneEndRow) {
            item = phones.get(position - phoneStartRow);
            icon = R.drawable.menu_calls;
        } else {
            item = other.get(position - vcardStartRow);
            if (item.type == 1) {
                icon = R.drawable.menu_mail;
            } else if (item.type == 2) {
                icon = R.drawable.menu_location;
            } else if (item.type == 3) {
                icon = R.drawable.msg_link;
            } else if (item.type == 4) {
                icon = R.drawable.profile_info;
            } else if (item.type == 5) {
                icon = R.drawable.menu_date;
            } else if (item.type == 6) {
                if ("ORG".equalsIgnoreCase(item.getRawType(true))) {
                    icon = R.drawable.menu_work;
                } else {
                    icon = R.drawable.menu_jobtitle;
                }
            } else if (item.type == 20) {
                icon = R.drawable.menu_info;
            } else {
                icon = R.drawable.menu_info;
            }
        }
        cell.setVCardItem(item, icon, position != getItemCount() - 1);
    }
}