本文整理汇总了Java中org.telegram.ui.Cells.CheckBoxCell类的典型用法代码示例。如果您正苦于以下问题:Java CheckBoxCell类的具体用法?Java CheckBoxCell怎么用?Java CheckBoxCell使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CheckBoxCell类属于org.telegram.ui.Cells包,在下文中一共展示了CheckBoxCell类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onViewAttachedToWindow
import org.telegram.ui.Cells.CheckBoxCell; //导入依赖的package包/类
@Override
public void onViewAttachedToWindow(RecyclerView.ViewHolder holder) {
int position = holder.getAdapterPosition();
switch (holder.getItemViewType()) {
case 0: {
CheckBoxCell cell = (CheckBoxCell) holder.itemView;
if (position == 0) {
cell.setChecked(currentFilter == null, false);
} else if (position == restrictionsRow) {
cell.setChecked(currentFilter == null || currentFilter.kick && currentFilter.ban && currentFilter.unkick && currentFilter.unban, false);
} else if (position == adminsRow) {
cell.setChecked(currentFilter == null || currentFilter.promote && currentFilter.demote, false);
} else if (position == membersRow) {
cell.setChecked(currentFilter == null || currentFilter.invite && currentFilter.join, false);
} else if (position == infoRow) {
cell.setChecked(currentFilter == null || currentFilter.info, false);
} else if (position == deleteRow) {
cell.setChecked(currentFilter == null || currentFilter.delete, false);
} else if (position == editRow) {
cell.setChecked(currentFilter == null || currentFilter.edit, false);
} else if (position == pinnedRow) {
cell.setChecked(currentFilter == null || currentFilter.pinned, false);
} else if (position == leavingRow) {
cell.setChecked(currentFilter == null || currentFilter.leave, false);
} else if (position == allAdminsRow) {
cell.setChecked(selectedAdmins == null, false);
}
break;
}
case 2: {
CheckBoxUserCell userCell = (CheckBoxUserCell) holder.itemView;
int userId = currentAdmins.get(position - allAdminsRow - 1).user_id;
userCell.setChecked(selectedAdmins == null || selectedAdmins.containsKey(userId), false);
break;
}
}
}
示例2: onBindViewHolder
import org.telegram.ui.Cells.CheckBoxCell; //导入依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
switch (holder.getItemViewType()) {
case 0: {
CheckBoxCell cell = (CheckBoxCell) holder.itemView;
if (position == 0) {
cell.setText(LocaleController.getString("EventLogFilterAll", R.string.EventLogFilterAll), "", currentFilter == null, true);
} else if (position == restrictionsRow) {
cell.setText(LocaleController.getString("EventLogFilterNewRestrictions", R.string.EventLogFilterNewRestrictions), "", currentFilter == null || currentFilter.kick && currentFilter.ban && currentFilter.unkick && currentFilter.unban, true);
} else if (position == adminsRow) {
cell.setText(LocaleController.getString("EventLogFilterNewAdmins", R.string.EventLogFilterNewAdmins), "", currentFilter == null || currentFilter.promote && currentFilter.demote, true);
} else if (position == membersRow) {
cell.setText(LocaleController.getString("EventLogFilterNewMembers", R.string.EventLogFilterNewMembers), "", currentFilter == null || currentFilter.invite && currentFilter.join, true);
} else if (position == infoRow) {
if (isMegagroup) {
cell.setText(LocaleController.getString("EventLogFilterGroupInfo", R.string.EventLogFilterGroupInfo), "", currentFilter == null || currentFilter.info, true);
} else {
cell.setText(LocaleController.getString("EventLogFilterChannelInfo", R.string.EventLogFilterChannelInfo), "", currentFilter == null || currentFilter.info, true);
}
} else if (position == deleteRow) {
cell.setText(LocaleController.getString("EventLogFilterDeletedMessages", R.string.EventLogFilterDeletedMessages), "", currentFilter == null || currentFilter.delete, true);
} else if (position == editRow) {
cell.setText(LocaleController.getString("EventLogFilterEditedMessages", R.string.EventLogFilterEditedMessages), "", currentFilter == null || currentFilter.edit, true);
} else if (position == pinnedRow) {
cell.setText(LocaleController.getString("EventLogFilterPinnedMessages", R.string.EventLogFilterPinnedMessages), "", currentFilter == null || currentFilter.pinned, true);
} else if (position == leavingRow) {
cell.setText(LocaleController.getString("EventLogFilterLeavingMembers", R.string.EventLogFilterLeavingMembers), "", currentFilter == null || currentFilter.leave, false);
} else if (position == allAdminsRow) {
cell.setText(LocaleController.getString("EventLogAllAdmins", R.string.EventLogAllAdmins), "", selectedAdmins == null, true);
}
break;
}
case 2: {
CheckBoxUserCell userCell = (CheckBoxUserCell) holder.itemView;
int userId = currentAdmins.get(position - allAdminsRow - 1).user_id;
userCell.setUser(MessagesController.getInstance().getUser(userId), selectedAdmins == null || selectedAdmins.containsKey(userId), position != getItemCount() - 1);
break;
}
}
}