Java Code Examples for org.telegram.tgnet.TLRPC#PrivacyRule
The following examples show how to use
org.telegram.tgnet.TLRPC#PrivacyRule .
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: ContactsController.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
public ArrayList<TLRPC.PrivacyRule> getPrivacyRules(int type) { switch (type) { case PRIVACY_RULES_TYPE_LASTSEEN: return lastseenPrivacyRules; case PRIVACY_RULES_TYPE_INVITE: return groupPrivacyRules; case PRIVACY_RULES_TYPE_CALLS: return callPrivacyRules; case PRIVACY_RULES_TYPE_P2P: return p2pPrivacyRules; case PRIVACY_RULES_TYPE_PHOTO: return profilePhotoPrivacyRules; case PRIVACY_RULES_TYPE_FORWARDS: return forwardsPrivacyRules; case PRIVACY_RULES_TYPE_PHONE: return phonePrivacyRules; case PRIVACY_RULES_TYPE_ADDED_BY_PHONE: return addedByPhonePrivacyRules; } return null; }
Example 2
Source File: ContactsController.java From Telegram with GNU General Public License v2.0 | 6 votes |
public ArrayList<TLRPC.PrivacyRule> getPrivacyRules(int type) { switch (type) { case PRIVACY_RULES_TYPE_LASTSEEN: return lastseenPrivacyRules; case PRIVACY_RULES_TYPE_INVITE: return groupPrivacyRules; case PRIVACY_RULES_TYPE_CALLS: return callPrivacyRules; case PRIVACY_RULES_TYPE_P2P: return p2pPrivacyRules; case PRIVACY_RULES_TYPE_PHOTO: return profilePhotoPrivacyRules; case PRIVACY_RULES_TYPE_FORWARDS: return forwardsPrivacyRules; case PRIVACY_RULES_TYPE_PHONE: return phonePrivacyRules; case PRIVACY_RULES_TYPE_ADDED_BY_PHONE: return addedByPhonePrivacyRules; } return null; }
Example 3
Source File: ContactsController.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public ArrayList<TLRPC.PrivacyRule> getPrivacyRules(int type) { if (type == 2) { return callPrivacyRules; } else if (type == 1) { return groupPrivacyRules; } else { return privacyRules; } }
Example 4
Source File: ContactsController.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public void setPrivacyRules(ArrayList<TLRPC.PrivacyRule> rules, int type) { if (type == 2) { callPrivacyRules = rules; } else if (type == 1) { groupPrivacyRules = rules; } else { privacyRules = rules; } NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.privacyRulesUpdated); reloadContactsStatuses(); }
Example 5
Source File: PrivacyControlActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private void checkPrivacy() { currentPlus = new ArrayList<>(); currentMinus = new ArrayList<>(); ArrayList<TLRPC.PrivacyRule> privacyRules = ContactsController.getInstance(currentAccount).getPrivacyRules(rulesType); if (privacyRules == null || 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(); }
Example 6
Source File: ContactsController.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public ArrayList<TLRPC.PrivacyRule> getPrivacyRules(int type) { if (type == 2) { return callPrivacyRules; } else if (type == 1) { return groupPrivacyRules; } else { return privacyRules; } }
Example 7
Source File: ContactsController.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public void setPrivacyRules(ArrayList<TLRPC.PrivacyRule> rules, int type) { if (type == 2) { callPrivacyRules = rules; } else if (type == 1) { groupPrivacyRules = rules; } else { privacyRules = rules; } NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.privacyRulesUpdated); reloadContactsStatuses(); }
Example 8
Source File: PrivacyControlActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private void checkPrivacy() { currentPlus = new ArrayList<>(); currentMinus = new ArrayList<>(); ArrayList<TLRPC.PrivacyRule> privacyRules = ContactsController.getInstance(currentAccount).getPrivacyRules(rulesType); if (privacyRules == null || 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(); }
Example 9
Source File: ContactsController.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
public void setPrivacyRules(ArrayList<TLRPC.PrivacyRule> rules, int type) { switch (type) { case PRIVACY_RULES_TYPE_LASTSEEN: lastseenPrivacyRules = rules; break; case PRIVACY_RULES_TYPE_INVITE: groupPrivacyRules = rules; break; case PRIVACY_RULES_TYPE_CALLS: callPrivacyRules = rules; break; case PRIVACY_RULES_TYPE_P2P: p2pPrivacyRules = rules; break; case PRIVACY_RULES_TYPE_PHOTO: profilePhotoPrivacyRules = rules; break; case PRIVACY_RULES_TYPE_FORWARDS: forwardsPrivacyRules = rules; break; case PRIVACY_RULES_TYPE_PHONE: phonePrivacyRules = rules; break; case PRIVACY_RULES_TYPE_ADDED_BY_PHONE: addedByPhonePrivacyRules = rules; break; } getNotificationCenter().postNotificationName(NotificationCenter.privacyRulesUpdated); reloadContactsStatuses(); }
Example 10
Source File: ContactsController.java From Telegram with GNU General Public License v2.0 | 5 votes |
public void setPrivacyRules(ArrayList<TLRPC.PrivacyRule> rules, int type) { switch (type) { case PRIVACY_RULES_TYPE_LASTSEEN: lastseenPrivacyRules = rules; break; case PRIVACY_RULES_TYPE_INVITE: groupPrivacyRules = rules; break; case PRIVACY_RULES_TYPE_CALLS: callPrivacyRules = rules; break; case PRIVACY_RULES_TYPE_P2P: p2pPrivacyRules = rules; break; case PRIVACY_RULES_TYPE_PHOTO: profilePhotoPrivacyRules = rules; break; case PRIVACY_RULES_TYPE_FORWARDS: forwardsPrivacyRules = rules; break; case PRIVACY_RULES_TYPE_PHONE: phonePrivacyRules = rules; break; case PRIVACY_RULES_TYPE_ADDED_BY_PHONE: addedByPhonePrivacyRules = rules; break; } getNotificationCenter().postNotificationName(NotificationCenter.privacyRulesUpdated); reloadContactsStatuses(); }
Example 11
Source File: PrivacySettingsActivity.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
private String formatRulesString(int rulesType) { ArrayList<TLRPC.PrivacyRule> privacyRules = ContactsController.getInstance(currentAccount).getPrivacyRules(rulesType); 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"; }
Example 12
Source File: PrivacySettingsActivity.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
private String formatRulesString(int rulesType) { ArrayList<TLRPC.PrivacyRule> privacyRules = ContactsController.getInstance(currentAccount).getPrivacyRules(rulesType); 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"; }