Java Code Examples for org.telegram.messenger.UserObject#isUserSelf()
The following examples show how to use
org.telegram.messenger.UserObject#isUserSelf() .
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: ChatAvatarContainer.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void checkAndUpdateAvatar() { if (parentFragment == null) { return; } TLRPC.FileLocation newPhoto = null; TLRPC.User user = parentFragment.getCurrentUser(); TLRPC.Chat chat = parentFragment.getCurrentChat(); if (user != null) { avatarDrawable.setInfo(user); if (UserObject.isUserSelf(user)) { avatarDrawable.setSavedMessages(2); } else if (user.photo != null) { newPhoto = user.photo.photo_small; } } else if (chat != null) { if (chat.photo != null) { newPhoto = chat.photo.photo_small; } avatarDrawable.setInfo(chat); } if (avatarImageView != null) { avatarImageView.setImage(newPhoto, "50_50", avatarDrawable); } }
Example 2
Source File: ChatAvatarContainer.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void checkAndUpdateAvatar() { if (parentFragment == null) { return; } TLRPC.FileLocation newPhoto = null; TLRPC.User user = parentFragment.getCurrentUser(); TLRPC.Chat chat = parentFragment.getCurrentChat(); if (user != null) { avatarDrawable.setInfo(user); if (UserObject.isUserSelf(user)) { avatarDrawable.setSavedMessages(2); } else if (user.photo != null) { newPhoto = user.photo.photo_small; } } else if (chat != null) { if (chat.photo != null) { newPhoto = chat.photo.photo_small; } avatarDrawable.setInfo(chat); } if (avatarImageView != null) { avatarImageView.setImage(newPhoto, "50_50", avatarDrawable); } }
Example 3
Source File: ChatAvatarContainer.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
public void setUserAvatar(TLRPC.User user) { TLRPC.FileLocation newPhoto = null; avatarDrawable.setInfo(user); if (UserObject.isUserSelf(user)) { avatarDrawable.setAvatarType(AvatarDrawable.AVATAR_TYPE_SAVED); avatarDrawable.setSmallSize(true); if (avatarImageView != null) { avatarImageView.setImage(null, null, avatarDrawable, user); } } else { avatarDrawable.setSmallSize(false); if (avatarImageView != null) { avatarImageView.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, user); } } }
Example 4
Source File: ChatAvatarContainer.java From Telegram with GNU General Public License v2.0 | 6 votes |
public void setUserAvatar(TLRPC.User user) { TLRPC.FileLocation newPhoto = null; avatarDrawable.setInfo(user); if (UserObject.isUserSelf(user)) { avatarDrawable.setAvatarType(AvatarDrawable.AVATAR_TYPE_SAVED); avatarDrawable.setSmallSize(true); if (avatarImageView != null) { avatarImageView.setImage(null, null, avatarDrawable, user); } } else { avatarDrawable.setSmallSize(false); if (avatarImageView != null) { avatarImageView.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, user); } } }
Example 5
Source File: ShareDialogCell.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public void setDialog(int uid, boolean checked, CharSequence name) { TLRPC.FileLocation photo = null; if (uid > 0) { TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(uid); avatarDrawable.setInfo(user); if (UserObject.isUserSelf(user)) { nameTextView.setText(LocaleController.getString("SavedMessages", R.string.SavedMessages)); avatarDrawable.setSavedMessages(1); } else { if (name != null) { nameTextView.setText(name); } else if (user != null) { nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name)); } else { nameTextView.setText(""); } if (user != null && user.photo != null) { photo = user.photo.photo_small; } } } else { TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-uid); if (name != null) { nameTextView.setText(name); } else if (chat != null) { nameTextView.setText(chat.title); } else { nameTextView.setText(""); } avatarDrawable.setInfo(chat); if (chat != null && chat.photo != null) { photo = chat.photo.photo_small; } } imageView.setImage(photo, "50_50", avatarDrawable); checkBox.setChecked(checked, false); }
Example 6
Source File: ChatAvatarContainer.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public void setUserAvatar(TLRPC.User user) { TLRPC.FileLocation newPhoto = null; avatarDrawable.setInfo(user); if (UserObject.isUserSelf(user)) { avatarDrawable.setSavedMessages(2); } else if (user.photo != null) { newPhoto = user.photo.photo_small; } if (avatarImageView != null) { avatarImageView.setImage(newPhoto, "50_50", avatarDrawable); } }
Example 7
Source File: ShareDialogCell.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public void setDialog(int uid, boolean checked, CharSequence name) { TLRPC.FileLocation photo = null; if (uid > 0) { TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(uid); avatarDrawable.setInfo(user); if (UserObject.isUserSelf(user)) { nameTextView.setText(LocaleController.getString("SavedMessages", R.string.SavedMessages)); avatarDrawable.setSavedMessages(1); } else { if (name != null) { nameTextView.setText(name); } else if (user != null) { nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name)); } else { nameTextView.setText(""); } if (user != null && user.photo != null) { photo = user.photo.photo_small; } } } else { TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-uid); if (name != null) { nameTextView.setText(name); } else if (chat != null) { nameTextView.setText(chat.title); } else { nameTextView.setText(""); } avatarDrawable.setInfo(chat); if (chat != null && chat.photo != null) { photo = chat.photo.photo_small; } } imageView.setImage(photo, "50_50", avatarDrawable); checkBox.setChecked(checked, false); }
Example 8
Source File: ChatAvatarContainer.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public void setUserAvatar(TLRPC.User user) { TLRPC.FileLocation newPhoto = null; avatarDrawable.setInfo(user); if (UserObject.isUserSelf(user)) { avatarDrawable.setSavedMessages(2); } else if (user.photo != null) { newPhoto = user.photo.photo_small; } if (avatarImageView != null) { avatarImageView.setImage(newPhoto, "50_50", avatarDrawable); } }
Example 9
Source File: ShareDialogCell.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
public void setDialog(int uid, boolean checked, CharSequence name) { if (uid > 0) { user = MessagesController.getInstance(currentAccount).getUser(uid); avatarDrawable.setInfo(user); if (UserObject.isUserSelf(user)) { nameTextView.setText(LocaleController.getString("SavedMessages", R.string.SavedMessages)); avatarDrawable.setAvatarType(AvatarDrawable.AVATAR_TYPE_SAVED); imageView.setImage(null, null, avatarDrawable, user); } else { if (name != null) { nameTextView.setText(name); } else if (user != null) { nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name)); } else { nameTextView.setText(""); } imageView.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, user); } } else { user = null; TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-uid); if (name != null) { nameTextView.setText(name); } else if (chat != null) { nameTextView.setText(chat.title); } else { nameTextView.setText(""); } avatarDrawable.setInfo(chat); imageView.setImage(ImageLocation.getForChat(chat, false), "50_50", avatarDrawable, chat); } checkBox.setChecked(checked, false); }
Example 10
Source File: ChatAvatarContainer.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
public void checkAndUpdateAvatar() { if (parentFragment == null) { return; } TLRPC.User user = parentFragment.getCurrentUser(); TLRPC.Chat chat = parentFragment.getCurrentChat(); if (user != null) { avatarDrawable.setInfo(user); if (UserObject.isUserSelf(user)) { avatarDrawable.setSmallSize(true); avatarDrawable.setAvatarType(AvatarDrawable.AVATAR_TYPE_SAVED); if (avatarImageView != null) { avatarImageView.setImage(null, null, avatarDrawable, user); } } else { avatarDrawable.setSmallSize(false); if (avatarImageView != null) { avatarImageView.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, user); } } } else if (chat != null) { avatarDrawable.setInfo(chat); if (avatarImageView != null) { avatarImageView.setImage(ImageLocation.getForChat(chat, false), "50_50", avatarDrawable, chat); } } }
Example 11
Source File: ShareDialogCell.java From Telegram with GNU General Public License v2.0 | 5 votes |
public void setDialog(int uid, boolean checked, CharSequence name) { if (uid > 0) { user = MessagesController.getInstance(currentAccount).getUser(uid); avatarDrawable.setInfo(user); if (UserObject.isUserSelf(user)) { nameTextView.setText(LocaleController.getString("SavedMessages", R.string.SavedMessages)); avatarDrawable.setAvatarType(AvatarDrawable.AVATAR_TYPE_SAVED); imageView.setImage(null, null, avatarDrawable, user); } else { if (name != null) { nameTextView.setText(name); } else if (user != null) { nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name)); } else { nameTextView.setText(""); } imageView.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, user); } } else { user = null; TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-uid); if (name != null) { nameTextView.setText(name); } else if (chat != null) { nameTextView.setText(chat.title); } else { nameTextView.setText(""); } avatarDrawable.setInfo(chat); imageView.setImage(ImageLocation.getForChat(chat, false), "50_50", avatarDrawable, chat); } checkBox.setChecked(checked, false); }
Example 12
Source File: ChatAvatarContainer.java From Telegram with GNU General Public License v2.0 | 5 votes |
public void checkAndUpdateAvatar() { if (parentFragment == null) { return; } TLRPC.User user = parentFragment.getCurrentUser(); TLRPC.Chat chat = parentFragment.getCurrentChat(); if (user != null) { avatarDrawable.setInfo(user); if (UserObject.isUserSelf(user)) { avatarDrawable.setSmallSize(true); avatarDrawable.setAvatarType(AvatarDrawable.AVATAR_TYPE_SAVED); if (avatarImageView != null) { avatarImageView.setImage(null, null, avatarDrawable, user); } } else { avatarDrawable.setSmallSize(false); if (avatarImageView != null) { avatarImageView.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, user); } } } else if (chat != null) { avatarDrawable.setInfo(chat); if (avatarImageView != null) { avatarImageView.setImage(ImageLocation.getForChat(chat, false), "50_50", avatarDrawable, chat); } } }
Example 13
Source File: ChatAvatarContainer.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
public void updateSubtitle() { if (parentFragment == null) { return; } TLRPC.User user = parentFragment.getCurrentUser(); if (UserObject.isUserSelf(user)) { if (subtitleTextView.getVisibility() != GONE) { subtitleTextView.setVisibility(GONE); } return; } TLRPC.Chat chat = parentFragment.getCurrentChat(); CharSequence printString = MessagesController.getInstance(currentAccount).printingStrings.get(parentFragment.getDialogId()); if (printString != null) { printString = TextUtils.replace(printString, new String[]{"..."}, new String[]{""}); } CharSequence newSubtitle; if (printString == null || printString.length() == 0 || ChatObject.isChannel(chat) && !chat.megagroup) { setTypingAnimation(false); if (chat != null) { TLRPC.ChatFull info = parentFragment.getCurrentChatInfo(); if (ChatObject.isChannel(chat)) { if (info != null && info.participants_count != 0) { if (chat.megagroup && info.participants_count <= 200) { if (onlineCount > 1 && info.participants_count != 0) { newSubtitle = String.format("%s, %s", LocaleController.formatPluralString("Members", info.participants_count), LocaleController.formatPluralString("OnlineCount", onlineCount)); } else { newSubtitle = LocaleController.formatPluralString("Members", info.participants_count); } } else { int result[] = new int[1]; String shortNumber = LocaleController.formatShortNumber(info.participants_count, result); if (chat.megagroup) { newSubtitle = LocaleController.formatPluralString("Members", result[0]).replace(String.format("%d", result[0]), shortNumber); } else { newSubtitle = LocaleController.formatPluralString("Subscribers", result[0]).replace(String.format("%d", result[0]), shortNumber); } } } else { if (chat.megagroup) { newSubtitle = LocaleController.getString("Loading", R.string.Loading).toLowerCase(); } else { if ((chat.flags & TLRPC.CHAT_FLAG_IS_PUBLIC) != 0) { newSubtitle = LocaleController.getString("ChannelPublic", R.string.ChannelPublic).toLowerCase(); } else { newSubtitle = LocaleController.getString("ChannelPrivate", R.string.ChannelPrivate).toLowerCase(); } } } } else { if (ChatObject.isKickedFromChat(chat)) { newSubtitle = LocaleController.getString("YouWereKicked", R.string.YouWereKicked); } else if (ChatObject.isLeftFromChat(chat)) { newSubtitle = LocaleController.getString("YouLeft", R.string.YouLeft); } else { int count = chat.participants_count; if (info != null && info.participants != null) { count = info.participants.participants.size(); } if (onlineCount > 1 && count != 0) { newSubtitle = String.format("%s, %s", LocaleController.formatPluralString("Members", count), LocaleController.formatPluralString("OnlineCount", onlineCount)); } else { newSubtitle = LocaleController.formatPluralString("Members", count); } } } } else if (user != null) { TLRPC.User newUser = MessagesController.getInstance(currentAccount).getUser(user.id); if (newUser != null) { user = newUser; } String newStatus; if (user.id == UserConfig.getInstance(currentAccount).getClientUserId()) { newStatus = LocaleController.getString("ChatYourSelf", R.string.ChatYourSelf); } else if (user.id == 333000 || user.id == 777000) { newStatus = LocaleController.getString("ServiceNotifications", R.string.ServiceNotifications); } else if (user.bot) { newStatus = LocaleController.getString("Bot", R.string.Bot); } else { newStatus = LocaleController.formatUserStatus(currentAccount, user); } newSubtitle = newStatus; } else { newSubtitle = ""; } } else { newSubtitle = printString; setTypingAnimation(true); } if (lastSubtitle == null) { subtitleTextView.setText(newSubtitle); } else { lastSubtitle = newSubtitle; } }
Example 14
Source File: ChatAvatarContainer.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
public void updateSubtitle() { if (parentFragment == null) { return; } TLRPC.User user = parentFragment.getCurrentUser(); if (UserObject.isUserSelf(user)) { if (subtitleTextView.getVisibility() != GONE) { subtitleTextView.setVisibility(GONE); } return; } TLRPC.Chat chat = parentFragment.getCurrentChat(); CharSequence printString = MessagesController.getInstance(currentAccount).printingStrings.get(parentFragment.getDialogId()); if (printString != null) { printString = TextUtils.replace(printString, new String[]{"..."}, new String[]{""}); } CharSequence newSubtitle; if (printString == null || printString.length() == 0 || ChatObject.isChannel(chat) && !chat.megagroup) { setTypingAnimation(false); if (chat != null) { TLRPC.ChatFull info = parentFragment.getCurrentChatInfo(); if (ChatObject.isChannel(chat)) { if (info != null && info.participants_count != 0) { if (chat.megagroup && info.participants_count <= 200) { if (onlineCount > 1 && info.participants_count != 0) { newSubtitle = String.format("%s, %s", LocaleController.formatPluralString("Members", info.participants_count), LocaleController.formatPluralString("OnlineCount", onlineCount)); } else { newSubtitle = LocaleController.formatPluralString("Members", info.participants_count); } } else { int result[] = new int[1]; String shortNumber = LocaleController.formatShortNumber(info.participants_count, result); if (chat.megagroup) { newSubtitle = LocaleController.formatPluralString("Members", result[0]).replace(String.format("%d", result[0]), shortNumber); } else { newSubtitle = LocaleController.formatPluralString("Subscribers", result[0]).replace(String.format("%d", result[0]), shortNumber); } } } else { if (chat.megagroup) { newSubtitle = LocaleController.getString("Loading", R.string.Loading).toLowerCase(); } else { if ((chat.flags & TLRPC.CHAT_FLAG_IS_PUBLIC) != 0) { newSubtitle = LocaleController.getString("ChannelPublic", R.string.ChannelPublic).toLowerCase(); } else { newSubtitle = LocaleController.getString("ChannelPrivate", R.string.ChannelPrivate).toLowerCase(); } } } } else { if (ChatObject.isKickedFromChat(chat)) { newSubtitle = LocaleController.getString("YouWereKicked", R.string.YouWereKicked); } else if (ChatObject.isLeftFromChat(chat)) { newSubtitle = LocaleController.getString("YouLeft", R.string.YouLeft); } else { int count = chat.participants_count; if (info != null && info.participants != null) { count = info.participants.participants.size(); } if (onlineCount > 1 && count != 0) { newSubtitle = String.format("%s, %s", LocaleController.formatPluralString("Members", count), LocaleController.formatPluralString("OnlineCount", onlineCount)); } else { newSubtitle = LocaleController.formatPluralString("Members", count); } } } } else if (user != null) { TLRPC.User newUser = MessagesController.getInstance(currentAccount).getUser(user.id); if (newUser != null) { user = newUser; } String newStatus; if (user.id == UserConfig.getInstance(currentAccount).getClientUserId()) { newStatus = LocaleController.getString("ChatYourSelf", R.string.ChatYourSelf); } else if (user.id == 333000 || user.id == 777000) { newStatus = LocaleController.getString("ServiceNotifications", R.string.ServiceNotifications); } else if (user.bot) { newStatus = LocaleController.getString("Bot", R.string.Bot); } else { newStatus = LocaleController.formatUserStatus(currentAccount, user); } newSubtitle = newStatus; } else { newSubtitle = ""; } } else { newSubtitle = printString; setTypingAnimation(true); } if (lastSubtitle == null) { subtitleTextView.setText(newSubtitle); } else { lastSubtitle = newSubtitle; } }