当前位置: 首页>>代码示例>>Java>>正文


Java TLRPC.TL_privacyValueAllowUsers方法代码示例

本文整理汇总了Java中org.telegram.tgnet.TLRPC.TL_privacyValueAllowUsers方法的典型用法代码示例。如果您正苦于以下问题:Java TLRPC.TL_privacyValueAllowUsers方法的具体用法?Java TLRPC.TL_privacyValueAllowUsers怎么用?Java TLRPC.TL_privacyValueAllowUsers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.telegram.tgnet.TLRPC的用法示例。


在下文中一共展示了TLRPC.TL_privacyValueAllowUsers方法的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();
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:36,代码来源:PrivacyControlActivity.java

示例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";
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:50,代码来源:PrivacySettingsActivity.java


注:本文中的org.telegram.tgnet.TLRPC.TL_privacyValueAllowUsers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。