本文整理汇总了Java中org.telegram.tgnet.TLRPC.TL_privacyValueAllowAll方法的典型用法代码示例。如果您正苦于以下问题:Java TLRPC.TL_privacyValueAllowAll方法的具体用法?Java TLRPC.TL_privacyValueAllowAll怎么用?Java TLRPC.TL_privacyValueAllowAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.telegram.tgnet.TLRPC
的用法示例。
在下文中一共展示了TLRPC.TL_privacyValueAllowAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkPrivacy
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private void checkPrivacy() {
currentPlus = new ArrayList<>();
currentMinus = new ArrayList<>();
ArrayList<TLRPC.PrivacyRule> privacyRules = ContactsController.getInstance().getPrivacyRules(isGroup);
if (privacyRules.size() == 0) {
currentType = 1;
return;
}
int type = -1;
for (int a = 0; a < privacyRules.size(); a++) {
TLRPC.PrivacyRule rule = privacyRules.get(a);
if (rule instanceof TLRPC.TL_privacyValueAllowUsers) {
currentPlus.addAll(rule.users);
} else if (rule instanceof TLRPC.TL_privacyValueDisallowUsers) {
currentMinus.addAll(rule.users);
} else if (rule instanceof TLRPC.TL_privacyValueAllowAll) {
type = 0;
} else if (rule instanceof TLRPC.TL_privacyValueDisallowAll) {
type = 1;
} else {
type = 2;
}
}
if (type == 0 || type == -1 && currentMinus.size() > 0) {
currentType = 0;
} else if (type == 2 || type == -1 && currentMinus.size() > 0 && currentPlus.size() > 0) {
currentType = 2;
} else if (type == 1 || type == -1 && currentPlus.size() > 0) {
currentType = 1;
}
if (doneButton != null) {
doneButton.setVisibility(View.GONE);
}
updateRows();
}
示例2: formatRulesString
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private String formatRulesString(boolean isGroup) {
ArrayList<TLRPC.PrivacyRule> privacyRules = ContactsController.getInstance().getPrivacyRules(isGroup);
if (privacyRules.size() == 0) {
return LocaleController.getString("LastSeenNobody", R.string.LastSeenNobody);
}
int type = -1;
int plus = 0;
int minus = 0;
for (int a = 0; a < privacyRules.size(); a++) {
TLRPC.PrivacyRule rule = privacyRules.get(a);
if (rule instanceof TLRPC.TL_privacyValueAllowUsers) {
plus += rule.users.size();
} else if (rule instanceof TLRPC.TL_privacyValueDisallowUsers) {
minus += rule.users.size();
} else if (rule instanceof TLRPC.TL_privacyValueAllowAll) {
type = 0;
} else if (rule instanceof TLRPC.TL_privacyValueDisallowAll) {
type = 1;
} else {
type = 2;
}
}
if (type == 0 || type == -1 && minus > 0) {
if (minus == 0) {
return LocaleController.getString("LastSeenEverybody", R.string.LastSeenEverybody);
} else {
return LocaleController.formatString("LastSeenEverybodyMinus", R.string.LastSeenEverybodyMinus, minus);
}
} else if (type == 2 || type == -1 && minus > 0 && plus > 0) {
if (plus == 0 && minus == 0) {
return LocaleController.getString("LastSeenContacts", R.string.LastSeenContacts);
} else {
if (plus != 0 && minus != 0) {
return LocaleController.formatString("LastSeenContactsMinusPlus", R.string.LastSeenContactsMinusPlus, minus, plus);
} else if (minus != 0) {
return LocaleController.formatString("LastSeenContactsMinus", R.string.LastSeenContactsMinus, minus);
} else {
return LocaleController.formatString("LastSeenContactsPlus", R.string.LastSeenContactsPlus, plus);
}
}
} else if (type == 1 || plus > 0) {
if (plus == 0) {
return LocaleController.getString("LastSeenNobody", R.string.LastSeenNobody);
} else {
return LocaleController.formatString("LastSeenNobodyPlus", R.string.LastSeenNobodyPlus, plus);
}
}
return "unknown";
}