Java Code Examples for org.telegram.messenger.MessagesController#DIALOG_FILTER_FLAG_BOTS
The following examples show how to use
org.telegram.messenger.MessagesController#DIALOG_FILTER_FLAG_BOTS .
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: FilterUsersActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override public void onClick(View v) { GroupCreateSpan span = (GroupCreateSpan) v; if (span.isDeleting()) { currentDeletingSpan = null; spansContainer.removeSpan(span); if (span.getUid() == Integer.MIN_VALUE) { filterFlags &=~ MessagesController.DIALOG_FILTER_FLAG_CONTACTS; } else if (span.getUid() == Integer.MIN_VALUE + 1) { filterFlags &=~ MessagesController.DIALOG_FILTER_FLAG_NON_CONTACTS; } else if (span.getUid() == Integer.MIN_VALUE + 2) { filterFlags &=~ MessagesController.DIALOG_FILTER_FLAG_GROUPS; } else if (span.getUid() == Integer.MIN_VALUE + 3) { filterFlags &=~ MessagesController.DIALOG_FILTER_FLAG_CHANNELS; } else if (span.getUid() == Integer.MIN_VALUE + 4) { filterFlags &=~ MessagesController.DIALOG_FILTER_FLAG_BOTS; } else if (span.getUid() == Integer.MIN_VALUE + 5) { filterFlags &=~ MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED; } else if (span.getUid() == Integer.MIN_VALUE + 6) { filterFlags &=~ MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_READ; } else if (span.getUid() == Integer.MIN_VALUE + 7) { filterFlags &=~ MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED; } updateHint(); checkVisibleRows(); } else { if (currentDeletingSpan != null) { currentDeletingSpan.cancelDeleteAnimation(); } currentDeletingSpan = span; span.startDeleteAnimation(); } }
Example 2
Source File: FiltersListBottomSheet.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { BottomSheet.BottomSheetCell cell = (BottomSheet.BottomSheetCell) holder.itemView; if (position < dialogFilters.size()) { cell.getImageView().setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_dialogIcon), PorterDuff.Mode.MULTIPLY)); MessagesController.DialogFilter filter = dialogFilters.get(position); cell.setTextColor(Theme.getColor(Theme.key_dialogTextBlack)); int icon; if ((filter.flags & MessagesController.DIALOG_FILTER_FLAG_ALL_CHATS) == (MessagesController.DIALOG_FILTER_FLAG_CONTACTS | MessagesController.DIALOG_FILTER_FLAG_NON_CONTACTS)) { icon = R.drawable.menu_private; } else if ((filter.flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_READ) != 0 && (filter.flags & MessagesController.DIALOG_FILTER_FLAG_ALL_CHATS) == MessagesController.DIALOG_FILTER_FLAG_ALL_CHATS) { icon = R.drawable.menu_unread; } else if ((filter.flags & MessagesController.DIALOG_FILTER_FLAG_ALL_CHATS) == MessagesController.DIALOG_FILTER_FLAG_CHANNELS) { icon = R.drawable.menu_broadcast; } else if ((filter.flags & MessagesController.DIALOG_FILTER_FLAG_ALL_CHATS) == MessagesController.DIALOG_FILTER_FLAG_GROUPS) { icon = R.drawable.menu_groups; } else if ((filter.flags & MessagesController.DIALOG_FILTER_FLAG_ALL_CHATS) == MessagesController.DIALOG_FILTER_FLAG_CONTACTS) { icon = R.drawable.menu_contacts; } else if ((filter.flags & MessagesController.DIALOG_FILTER_FLAG_ALL_CHATS) == MessagesController.DIALOG_FILTER_FLAG_BOTS) { icon = R.drawable.menu_bots; } else { icon = R.drawable.menu_folders; } cell.setTextAndIcon(filter.name, icon); } else { cell.getImageView().setColorFilter(null); Drawable drawable1 = context.getResources().getDrawable(R.drawable.poll_add_circle); Drawable drawable2 = context.getResources().getDrawable(R.drawable.poll_add_plus); drawable1.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_switchTrackChecked), PorterDuff.Mode.MULTIPLY)); drawable2.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_checkboxCheck), PorterDuff.Mode.MULTIPLY)); CombinedDrawable combinedDrawable = new CombinedDrawable(drawable1, drawable2); cell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4)); cell.setTextAndIcon(LocaleController.getString("CreateNewFilter", R.string.CreateNewFilter), combinedDrawable); } }
Example 3
Source File: FilterUsersActivity.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Override public void onClick(View v) { GroupCreateSpan span = (GroupCreateSpan) v; if (span.isDeleting()) { currentDeletingSpan = null; spansContainer.removeSpan(span); if (span.getUid() == Integer.MIN_VALUE) { filterFlags &=~ MessagesController.DIALOG_FILTER_FLAG_CONTACTS; } else if (span.getUid() == Integer.MIN_VALUE + 1) { filterFlags &=~ MessagesController.DIALOG_FILTER_FLAG_NON_CONTACTS; } else if (span.getUid() == Integer.MIN_VALUE + 2) { filterFlags &=~ MessagesController.DIALOG_FILTER_FLAG_GROUPS; } else if (span.getUid() == Integer.MIN_VALUE + 3) { filterFlags &=~ MessagesController.DIALOG_FILTER_FLAG_CHANNELS; } else if (span.getUid() == Integer.MIN_VALUE + 4) { filterFlags &=~ MessagesController.DIALOG_FILTER_FLAG_BOTS; } else if (span.getUid() == Integer.MIN_VALUE + 5) { filterFlags &=~ MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED; } else if (span.getUid() == Integer.MIN_VALUE + 6) { filterFlags &=~ MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_READ; } else if (span.getUid() == Integer.MIN_VALUE + 7) { filterFlags &=~ MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED; } updateHint(); checkVisibleRows(); } else { if (currentDeletingSpan != null) { currentDeletingSpan.cancelDeleteAnimation(); } currentDeletingSpan = span; span.startDeleteAnimation(); } }
Example 4
Source File: FiltersListBottomSheet.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { BottomSheet.BottomSheetCell cell = (BottomSheet.BottomSheetCell) holder.itemView; if (position < dialogFilters.size()) { cell.getImageView().setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_dialogIcon), PorterDuff.Mode.MULTIPLY)); MessagesController.DialogFilter filter = dialogFilters.get(position); cell.setTextColor(Theme.getColor(Theme.key_dialogTextBlack)); int icon; if ((filter.flags & MessagesController.DIALOG_FILTER_FLAG_ALL_CHATS) == (MessagesController.DIALOG_FILTER_FLAG_CONTACTS | MessagesController.DIALOG_FILTER_FLAG_NON_CONTACTS)) { icon = R.drawable.menu_private; } else if ((filter.flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_READ) != 0 && (filter.flags & MessagesController.DIALOG_FILTER_FLAG_ALL_CHATS) == MessagesController.DIALOG_FILTER_FLAG_ALL_CHATS) { icon = R.drawable.menu_unread; } else if ((filter.flags & MessagesController.DIALOG_FILTER_FLAG_ALL_CHATS) == MessagesController.DIALOG_FILTER_FLAG_CHANNELS) { icon = R.drawable.menu_broadcast; } else if ((filter.flags & MessagesController.DIALOG_FILTER_FLAG_ALL_CHATS) == MessagesController.DIALOG_FILTER_FLAG_GROUPS) { icon = R.drawable.menu_groups; } else if ((filter.flags & MessagesController.DIALOG_FILTER_FLAG_ALL_CHATS) == MessagesController.DIALOG_FILTER_FLAG_CONTACTS) { icon = R.drawable.menu_contacts; } else if ((filter.flags & MessagesController.DIALOG_FILTER_FLAG_ALL_CHATS) == MessagesController.DIALOG_FILTER_FLAG_BOTS) { icon = R.drawable.menu_bots; } else { icon = R.drawable.menu_folders; } cell.setTextAndIcon(filter.name, icon); } else { cell.getImageView().setColorFilter(null); Drawable drawable1 = context.getResources().getDrawable(R.drawable.poll_add_circle); Drawable drawable2 = context.getResources().getDrawable(R.drawable.poll_add_plus); drawable1.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_switchTrackChecked), PorterDuff.Mode.MULTIPLY)); drawable2.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_checkboxCheck), PorterDuff.Mode.MULTIPLY)); CombinedDrawable combinedDrawable = new CombinedDrawable(drawable1, drawable2); cell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4)); cell.setTextAndIcon(LocaleController.getString("CreateNewFilter", R.string.CreateNewFilter), combinedDrawable); } }
Example 5
Source File: FiltersSetupActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
public void setFilter(MessagesController.DialogFilter filter, boolean divider) { currentFilter = filter; StringBuilder info = new StringBuilder(); if ((filter.flags & MessagesController.DIALOG_FILTER_FLAG_ALL_CHATS) == MessagesController.DIALOG_FILTER_FLAG_ALL_CHATS) { info.append(LocaleController.getString("FilterAllChats", R.string.FilterAllChats)); } else { if ((filter.flags & MessagesController.DIALOG_FILTER_FLAG_CONTACTS) != 0) { if (info.length() != 0) { info.append(", "); } info.append(LocaleController.getString("FilterContacts", R.string.FilterContacts)); } if ((filter.flags & MessagesController.DIALOG_FILTER_FLAG_NON_CONTACTS) != 0) { if (info.length() != 0) { info.append(", "); } info.append(LocaleController.getString("FilterNonContacts", R.string.FilterNonContacts)); } if ((filter.flags & MessagesController.DIALOG_FILTER_FLAG_GROUPS) != 0) { if (info.length() != 0) { info.append(", "); } info.append(LocaleController.getString("FilterGroups", R.string.FilterGroups)); } if ((filter.flags & MessagesController.DIALOG_FILTER_FLAG_CHANNELS) != 0) { if (info.length() != 0) { info.append(", "); } info.append(LocaleController.getString("FilterChannels", R.string.FilterChannels)); } if ((filter.flags & MessagesController.DIALOG_FILTER_FLAG_BOTS) != 0) { if (info.length() != 0) { info.append(", "); } info.append(LocaleController.getString("FilterBots", R.string.FilterBots)); } } if (!filter.alwaysShow.isEmpty() || !filter.neverShow.isEmpty()) { if (info.length() != 0) { info.append(", "); } info.append(LocaleController.formatPluralString("Exception", filter.alwaysShow.size() + filter.neverShow.size())); } if (info.length() == 0) { info.append(LocaleController.getString("FilterNoChats", R.string.FilterNoChats)); } textView.setText(Emoji.replaceEmoji(filter.name, textView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false)); valueTextView.setText(info); //valueTextView.setVisibility(VISIBLE); needDivider = divider; }
Example 6
Source File: FilterCreateActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
private void fillFilterName() { if (!creatingNew || !TextUtils.isEmpty(newFilterName) && nameChangedManually) { return; } int flags = newFilterFlags & MessagesController.DIALOG_FILTER_FLAG_ALL_CHATS; String newName = ""; if ((flags & MessagesController.DIALOG_FILTER_FLAG_ALL_CHATS) == MessagesController.DIALOG_FILTER_FLAG_ALL_CHATS) { if ((newFilterFlags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_READ) != 0) { newName = LocaleController.getString("FilterNameUnread", R.string.FilterNameUnread); } else if ((newFilterFlags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) != 0) { newName = LocaleController.getString("FilterNameNonMuted", R.string.FilterNameNonMuted); } } else if ((flags & MessagesController.DIALOG_FILTER_FLAG_CONTACTS) != 0) { flags &=~ MessagesController.DIALOG_FILTER_FLAG_CONTACTS; if (flags == 0) { newName = LocaleController.getString("FilterContacts", R.string.FilterContacts); } } else if ((flags & MessagesController.DIALOG_FILTER_FLAG_NON_CONTACTS) != 0) { flags &=~ MessagesController.DIALOG_FILTER_FLAG_NON_CONTACTS; if (flags == 0) { newName = LocaleController.getString("FilterNonContacts", R.string.FilterNonContacts); } } else if ((flags & MessagesController.DIALOG_FILTER_FLAG_GROUPS) != 0) { flags &=~ MessagesController.DIALOG_FILTER_FLAG_GROUPS; if (flags == 0) { newName = LocaleController.getString("FilterGroups", R.string.FilterGroups); } } else if ((flags & MessagesController.DIALOG_FILTER_FLAG_BOTS) != 0) { flags &=~ MessagesController.DIALOG_FILTER_FLAG_BOTS; if (flags == 0) { newName = LocaleController.getString("FilterBots", R.string.FilterBots); } } else if ((flags & MessagesController.DIALOG_FILTER_FLAG_CHANNELS) != 0) { flags &=~ MessagesController.DIALOG_FILTER_FLAG_CHANNELS; if (flags == 0) { newName = LocaleController.getString("FilterChannels", R.string.FilterChannels); } } if (newName != null && newName.length() > MAX_NAME_LENGTH) { newName = ""; } newFilterName = newName; RecyclerView.ViewHolder holder = listView.findViewHolderForAdapterPosition(nameRow); if (holder != null) { adapter.onViewAttachedToWindow(holder); } }
Example 7
Source File: FiltersSetupActivity.java From Telegram with GNU General Public License v2.0 | 4 votes |
public void setFilter(MessagesController.DialogFilter filter, boolean divider) { currentFilter = filter; StringBuilder info = new StringBuilder(); if ((filter.flags & MessagesController.DIALOG_FILTER_FLAG_ALL_CHATS) == MessagesController.DIALOG_FILTER_FLAG_ALL_CHATS) { info.append(LocaleController.getString("FilterAllChats", R.string.FilterAllChats)); } else { if ((filter.flags & MessagesController.DIALOG_FILTER_FLAG_CONTACTS) != 0) { if (info.length() != 0) { info.append(", "); } info.append(LocaleController.getString("FilterContacts", R.string.FilterContacts)); } if ((filter.flags & MessagesController.DIALOG_FILTER_FLAG_NON_CONTACTS) != 0) { if (info.length() != 0) { info.append(", "); } info.append(LocaleController.getString("FilterNonContacts", R.string.FilterNonContacts)); } if ((filter.flags & MessagesController.DIALOG_FILTER_FLAG_GROUPS) != 0) { if (info.length() != 0) { info.append(", "); } info.append(LocaleController.getString("FilterGroups", R.string.FilterGroups)); } if ((filter.flags & MessagesController.DIALOG_FILTER_FLAG_CHANNELS) != 0) { if (info.length() != 0) { info.append(", "); } info.append(LocaleController.getString("FilterChannels", R.string.FilterChannels)); } if ((filter.flags & MessagesController.DIALOG_FILTER_FLAG_BOTS) != 0) { if (info.length() != 0) { info.append(", "); } info.append(LocaleController.getString("FilterBots", R.string.FilterBots)); } } if (!filter.alwaysShow.isEmpty() || !filter.neverShow.isEmpty()) { if (info.length() != 0) { info.append(", "); } info.append(LocaleController.formatPluralString("Exception", filter.alwaysShow.size() + filter.neverShow.size())); } if (info.length() == 0) { info.append(LocaleController.getString("FilterNoChats", R.string.FilterNoChats)); } textView.setText(Emoji.replaceEmoji(filter.name, textView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false)); valueTextView.setText(info); //valueTextView.setVisibility(VISIBLE); needDivider = divider; }
Example 8
Source File: FilterCreateActivity.java From Telegram with GNU General Public License v2.0 | 4 votes |
private void fillFilterName() { if (!creatingNew || !TextUtils.isEmpty(newFilterName) && nameChangedManually) { return; } int flags = newFilterFlags & MessagesController.DIALOG_FILTER_FLAG_ALL_CHATS; String newName = ""; if ((flags & MessagesController.DIALOG_FILTER_FLAG_ALL_CHATS) == MessagesController.DIALOG_FILTER_FLAG_ALL_CHATS) { if ((newFilterFlags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_READ) != 0) { newName = LocaleController.getString("FilterNameUnread", R.string.FilterNameUnread); } else if ((newFilterFlags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) != 0) { newName = LocaleController.getString("FilterNameNonMuted", R.string.FilterNameNonMuted); } } else if ((flags & MessagesController.DIALOG_FILTER_FLAG_CONTACTS) != 0) { flags &=~ MessagesController.DIALOG_FILTER_FLAG_CONTACTS; if (flags == 0) { newName = LocaleController.getString("FilterContacts", R.string.FilterContacts); } } else if ((flags & MessagesController.DIALOG_FILTER_FLAG_NON_CONTACTS) != 0) { flags &=~ MessagesController.DIALOG_FILTER_FLAG_NON_CONTACTS; if (flags == 0) { newName = LocaleController.getString("FilterNonContacts", R.string.FilterNonContacts); } } else if ((flags & MessagesController.DIALOG_FILTER_FLAG_GROUPS) != 0) { flags &=~ MessagesController.DIALOG_FILTER_FLAG_GROUPS; if (flags == 0) { newName = LocaleController.getString("FilterGroups", R.string.FilterGroups); } } else if ((flags & MessagesController.DIALOG_FILTER_FLAG_BOTS) != 0) { flags &=~ MessagesController.DIALOG_FILTER_FLAG_BOTS; if (flags == 0) { newName = LocaleController.getString("FilterBots", R.string.FilterBots); } } else if ((flags & MessagesController.DIALOG_FILTER_FLAG_CHANNELS) != 0) { flags &=~ MessagesController.DIALOG_FILTER_FLAG_CHANNELS; if (flags == 0) { newName = LocaleController.getString("FilterChannels", R.string.FilterChannels); } } if (newName != null && newName.length() > MAX_NAME_LENGTH) { newName = ""; } newFilterName = newName; RecyclerView.ViewHolder holder = listView.findViewHolderForAdapterPosition(nameRow); if (holder != null) { adapter.onViewAttachedToWindow(holder); } }