Show group member list.
@@ -42,8 +42,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
private ConcurrentHashMap<Integer, TLRPC.User> users = new ConcurrentHashMap<>(100, 1.0f, 2);
|
||||
private ConcurrentHashMap<String, TLRPC.User> usersByUsernames = new ConcurrentHashMap<>(100, 1.0f, 2);
|
||||
|
||||
private HashMap<Integer, TLRPC.ExportedChatInvite> exportedChats = new HashMap<>();
|
||||
|
||||
public ArrayList<TLRPC.TL_dialog> dialogs = new ArrayList<>();
|
||||
public ArrayList<TLRPC.TL_dialog> dialogsServerOnly = new ArrayList<>();
|
||||
public ArrayList<TLRPC.TL_dialog> dialogsGroupsOnly = new ArrayList<>();
|
||||
@@ -355,7 +353,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
dialogs_dict.clear();
|
||||
dialogs_read_inbox_max.clear();
|
||||
dialogs_read_outbox_max.clear();
|
||||
exportedChats.clear();
|
||||
dialogs.clear();
|
||||
channelViewsToSend.clear();
|
||||
channelViewsToReload.clear();
|
||||
@@ -466,10 +463,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
});
|
||||
}
|
||||
|
||||
public TLRPC.ExportedChatInvite getExportedInvite(int chat_id) {
|
||||
return exportedChats.get(chat_id);
|
||||
}
|
||||
|
||||
public boolean putUser(TLRPC.User user, boolean fromCache) {
|
||||
if (user == null) {
|
||||
return false;
|
||||
|
||||
@@ -13,7 +13,6 @@ import java.util.HashMap;
|
||||
|
||||
public class TLRPC {
|
||||
|
||||
public static final int CHAT_FLAG_IS_PUBLIC = 0x00000040;
|
||||
public static final int MESSAGE_FLAG_FWD = 0x00000004;
|
||||
public static final int MESSAGE_FLAG_REPLY = 0x00000008;
|
||||
public static final int MESSAGE_FLAG_HAS_FROM_ID = 0x00000100;
|
||||
@@ -216,14 +215,8 @@ public class TLRPC {
|
||||
|
||||
public static class ChatFull extends TLObject {
|
||||
public int flags;
|
||||
public boolean can_view_participants;
|
||||
public int id;
|
||||
public String about;
|
||||
public int participants_count;
|
||||
public int admins_count;
|
||||
public int kicked_count;
|
||||
public int migrated_from_chat_id;
|
||||
public int migrated_from_max_id;
|
||||
public int pinned_msg_id;
|
||||
public ChatParticipants participants;
|
||||
}
|
||||
@@ -231,9 +224,6 @@ public class TLRPC {
|
||||
public static class TL_channelFull extends ChatFull {
|
||||
}
|
||||
|
||||
public static class TL_chatFull extends ChatFull {
|
||||
}
|
||||
|
||||
public static class TL_topPeerCategoryPeers extends TLObject {
|
||||
public TopPeerCategory category;
|
||||
public int count;
|
||||
@@ -307,8 +297,6 @@ public class TLRPC {
|
||||
public boolean mutual_contact;
|
||||
public boolean deleted;
|
||||
public boolean bot;
|
||||
public boolean bot_chat_history;
|
||||
public boolean bot_nochats;
|
||||
public boolean verified;
|
||||
public boolean restricted;
|
||||
public boolean min;
|
||||
@@ -371,17 +359,6 @@ public class TLRPC {
|
||||
public static class TL_messageActionEmpty extends MessageAction {
|
||||
}
|
||||
|
||||
public static class DecryptedMessage extends TLObject {
|
||||
public int ttl;
|
||||
public String message;
|
||||
public DecryptedMessageMedia media;
|
||||
public DecryptedMessageAction action;
|
||||
public int flags;
|
||||
}
|
||||
|
||||
public static class TL_decryptedMessage extends DecryptedMessage {
|
||||
}
|
||||
|
||||
public static class Video extends TLObject {
|
||||
public long id;
|
||||
public int user_id;
|
||||
@@ -635,47 +612,15 @@ public class TLRPC {
|
||||
public int version;
|
||||
}
|
||||
|
||||
public static class TL_chatParticipantsForbidden extends ChatParticipants {
|
||||
}
|
||||
|
||||
public static class DecryptedMessageMedia extends TLObject {
|
||||
public int duration;
|
||||
public String mime_type;
|
||||
public int size;
|
||||
public byte[] key;
|
||||
public byte[] iv;
|
||||
public String first_name;
|
||||
public String last_name;
|
||||
public int user_id;
|
||||
public ArrayList<DocumentAttribute> attributes = new ArrayList<>();
|
||||
public String caption;
|
||||
public String url;
|
||||
public int w;
|
||||
public int h;
|
||||
public String file_name;
|
||||
public String title;
|
||||
public String address;
|
||||
public String provider;
|
||||
public long id;
|
||||
public int date;
|
||||
public int dc_id;
|
||||
}
|
||||
|
||||
public static class ChatParticipant extends TLObject {
|
||||
public int user_id;
|
||||
public int inviter_id;
|
||||
public int date;
|
||||
}
|
||||
|
||||
public static class TL_chatParticipant extends ChatParticipant {
|
||||
}
|
||||
|
||||
public static class Chat extends TLObject {
|
||||
public int flags;
|
||||
public boolean creator;
|
||||
public boolean kicked;
|
||||
public boolean admins_enabled;
|
||||
public boolean admin;
|
||||
public boolean deactivated;
|
||||
public int id;
|
||||
public String title;
|
||||
@@ -684,7 +629,6 @@ public class TLRPC {
|
||||
public int date;
|
||||
public int version;
|
||||
public boolean editor;
|
||||
public boolean moderator;
|
||||
public boolean broadcast;
|
||||
public boolean verified;
|
||||
public boolean megagroup;
|
||||
@@ -779,9 +723,6 @@ public class TLRPC {
|
||||
public String link;
|
||||
}
|
||||
|
||||
public static class TL_chatInviteExported extends ExportedChatInvite {
|
||||
}
|
||||
|
||||
public static class InputFile extends TLObject {
|
||||
public long id;
|
||||
public int parts;
|
||||
@@ -1013,9 +954,6 @@ public class TLRPC {
|
||||
public static class TL_message extends Message {
|
||||
}
|
||||
|
||||
public static class TL_message_secret extends TL_message {
|
||||
}
|
||||
|
||||
public static class TL_messageService extends Message {
|
||||
}
|
||||
|
||||
|
||||
@@ -246,7 +246,7 @@ public class ContactsAdapter extends BaseSectionsAdapter {
|
||||
|
||||
ArrayList<TLRPC.TL_contact> arr = usersSectionsDict.get(sortedUsersSectionsArray.get(section - (onlyUsers != 0 && !isAdmin ? 0 : 1)));
|
||||
TLRPC.User user = MessagesController.getInstance().getUser(arr.get(position).user_id);
|
||||
((UserCell) convertView).setData(user, null, null, 0);
|
||||
((UserCell) convertView).setData(123, 0, "ErrUserName2", "ErrUserStatus2", 0);
|
||||
if (checkedMap != null) {
|
||||
((UserCell) convertView).setChecked(checkedMap.containsKey(user.id), !scrolling);
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ public class SearchAdapter extends BaseSearchAdapter {
|
||||
}
|
||||
|
||||
if (useUserCell) {
|
||||
((UserCell) view).setData(object, name, username, 0);
|
||||
((UserCell) view).setData(123, 0, "ErrUserName", "ErrStatus", 0);
|
||||
if (checkedMap != null) {
|
||||
((UserCell) view).setChecked(checkedMap.containsKey(id), false);
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ public class BlockedUsersActivity extends BaseFragment implements NotificationCe
|
||||
} else {
|
||||
number = LocaleController.getString("NumberUnknown", R.string.NumberUnknown);
|
||||
}
|
||||
((UserCell) view).setData(user, null, number, 0);
|
||||
((UserCell) view).setData(123, 0, "ErrUserName", "ErrUserStatus", 0);
|
||||
}
|
||||
} else if (type == 1) {
|
||||
if (view == null) {
|
||||
|
||||
@@ -40,10 +40,11 @@ public class UserCell extends FrameLayout {
|
||||
private ImageView adminImage;
|
||||
|
||||
private AvatarDrawable avatarDrawable;
|
||||
private TLObject currentObject;
|
||||
private int user_id;
|
||||
private int chat_id;
|
||||
|
||||
private CharSequence currentName;
|
||||
private CharSequence currrntStatus;
|
||||
private CharSequence currentStatus;
|
||||
private int currentDrawable;
|
||||
|
||||
private String lastName;
|
||||
@@ -64,7 +65,7 @@ public class UserCell extends FrameLayout {
|
||||
|
||||
nameTextView = new SimpleTextView(context);
|
||||
nameTextView.setTextColor(0xff212121);
|
||||
nameTextView.setTextSize(17);
|
||||
nameTextView.setTextSize(16); /*same size as in TextCell */
|
||||
nameTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP);
|
||||
addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 20, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 28 + (checkbox == 2 ? 18 : 0) : (68 + padding), 11.5f, LocaleController.isRTL ? (68 + padding) : 28 + (checkbox == 2 ? 18 : 0), 0));
|
||||
|
||||
@@ -106,19 +107,12 @@ public class UserCell extends FrameLayout {
|
||||
}
|
||||
}
|
||||
|
||||
public void setData(TLObject user, CharSequence name, CharSequence status, int resId) {
|
||||
if (user == null) {
|
||||
currrntStatus = null;
|
||||
currentName = null;
|
||||
currentObject = null;
|
||||
nameTextView.setText("");
|
||||
statusTextView.setText("");
|
||||
avatarImageView.setImageDrawable(null);
|
||||
return;
|
||||
}
|
||||
currrntStatus = status;
|
||||
public void setData(int new_user_id, int new_chat_id, CharSequence name, CharSequence status, int resId) {
|
||||
currentStatus = null;
|
||||
currentStatus = status;
|
||||
currentName = name;
|
||||
currentObject = user;
|
||||
user_id = new_user_id;
|
||||
chat_id = new_chat_id;
|
||||
currentDrawable = resId;
|
||||
update(0);
|
||||
}
|
||||
@@ -154,25 +148,13 @@ public class UserCell extends FrameLayout {
|
||||
}
|
||||
|
||||
public void update(int mask) {
|
||||
if (currentObject == null) {
|
||||
if (user_id == 0 && chat_id==0) {
|
||||
return;
|
||||
}
|
||||
TLRPC.FileLocation photo = null;
|
||||
String newName = null;
|
||||
TLRPC.User currentUser = null;
|
||||
TLRPC.Chat currentChat = null;
|
||||
if (currentObject instanceof TLRPC.User) {
|
||||
currentUser = (TLRPC.User) currentObject;
|
||||
if (currentUser.photo != null) {
|
||||
photo = currentUser.photo.photo_small;
|
||||
}
|
||||
} else {
|
||||
currentChat = (TLRPC.Chat) currentObject;
|
||||
if (currentChat.photo != null) {
|
||||
photo = currentChat.photo.photo_small;
|
||||
}
|
||||
}
|
||||
//String newName = null;
|
||||
|
||||
/*
|
||||
if (mask != 0) {
|
||||
boolean continueUpdate = false;
|
||||
if ((mask & MessagesController.UPDATE_MASK_AVATAR) != 0) {
|
||||
@@ -180,7 +162,8 @@ public class UserCell extends FrameLayout {
|
||||
continueUpdate = true;
|
||||
}
|
||||
}
|
||||
if (currentUser != null && !continueUpdate && (mask & MessagesController.UPDATE_MASK_STATUS) != 0) {
|
||||
|
||||
if (user_id != 0 && !continueUpdate && (mask & MessagesController.UPDATE_MASK_STATUS) != 0) {
|
||||
int newStatus = 0;
|
||||
if (currentUser.status != null) {
|
||||
newStatus = currentUser.status.expires;
|
||||
@@ -189,6 +172,7 @@ public class UserCell extends FrameLayout {
|
||||
continueUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!continueUpdate && currentName == null && lastName != null && (mask & MessagesController.UPDATE_MASK_NAME) != 0) {
|
||||
if (currentUser != null) {
|
||||
newName = UserObject.getUserName(currentUser);
|
||||
@@ -203,7 +187,9 @@ public class UserCell extends FrameLayout {
|
||||
return;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
if (currentUser != null) {
|
||||
avatarDrawable.setInfoByUser(currentUser);
|
||||
if (currentUser.status != null) {
|
||||
@@ -214,30 +200,24 @@ public class UserCell extends FrameLayout {
|
||||
} else {
|
||||
avatarDrawable.setInfoByChat(currentChat);
|
||||
}
|
||||
*/
|
||||
|
||||
if (currentName != null) {
|
||||
lastName = null;
|
||||
nameTextView.setText(currentName);
|
||||
} else {
|
||||
}/* else {
|
||||
if (currentUser != null) {
|
||||
lastName = newName == null ? UserObject.getUserName(currentUser) : newName;
|
||||
} else {
|
||||
lastName = newName == null ? currentChat.title : newName;
|
||||
}
|
||||
nameTextView.setText(lastName);
|
||||
}
|
||||
if (currrntStatus != null) {
|
||||
}*/
|
||||
|
||||
if (currentStatus != null) {
|
||||
statusTextView.setTextColor(statusColor);
|
||||
statusTextView.setText(currrntStatus);
|
||||
} else if (currentUser != null) {
|
||||
if (currentUser.bot) {
|
||||
statusTextView.setTextColor(statusColor);
|
||||
if (currentUser.bot_chat_history || adminImage != null && adminImage.getVisibility() == VISIBLE) { //TODO fix
|
||||
statusTextView.setText(LocaleController.getString("BotStatusRead", R.string.BotStatusRead));
|
||||
} else {
|
||||
statusTextView.setText(LocaleController.getString("BotStatusCantRead", R.string.BotStatusCantRead));
|
||||
}
|
||||
} else {
|
||||
statusTextView.setText(currentStatus);
|
||||
} /* else if (currentUser != null) {
|
||||
if (currentUser.id == UserConfig.getClientUserId() || currentUser.status != null && currentUser.status.expires > ConnectionsManager.getInstance().getCurrentTime() || MessagesController.getInstance().onlinePrivacy.containsKey(currentUser.id)) {
|
||||
statusTextView.setTextColor(statusOnlineColor);
|
||||
statusTextView.setText(LocaleController.getString("Online", R.string.Online));
|
||||
@@ -245,14 +225,17 @@ public class UserCell extends FrameLayout {
|
||||
statusTextView.setTextColor(statusColor);
|
||||
statusTextView.setText(LocaleController.formatUserStatus(currentUser));
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if (imageView.getVisibility() == VISIBLE && currentDrawable == 0 || imageView.getVisibility() == GONE && currentDrawable != 0) {
|
||||
imageView.setVisibility(currentDrawable == 0 ? GONE : VISIBLE);
|
||||
imageView.setImageResource(currentDrawable);
|
||||
}
|
||||
avatarImageView.setImage(photo, "50_50", avatarDrawable);
|
||||
|
||||
if( currentName != null ) {
|
||||
avatarDrawable.setInfoByName(currentName.toString());
|
||||
avatarImageView.setImage(photo, "50_50", avatarDrawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -454,7 +454,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
||||
}
|
||||
|
||||
TLRPC.User user = MessagesController.getInstance().getUser(selectedContacts.get(i));
|
||||
((UserCell) view).setData(user, null, null, 0);
|
||||
((UserCell) view).setData(123, 0, "erruser", "errstatus", 0);
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,6 @@ import org.telegram.messenger.query.SharedMediaQuery;
|
||||
import org.telegram.messenger.ApplicationLoader;
|
||||
import org.telegram.messenger.support.widget.LinearLayoutManager;
|
||||
import org.telegram.messenger.support.widget.RecyclerView;
|
||||
import org.telegram.tgnet.ConnectionsManager;
|
||||
import org.telegram.tgnet.TLRPC;
|
||||
import org.telegram.messenger.ContactsController;
|
||||
import org.telegram.messenger.FileLog;
|
||||
@@ -59,8 +58,6 @@ import org.telegram.messenger.MessagesController;
|
||||
import org.telegram.messenger.NotificationCenter;
|
||||
import org.telegram.messenger.R;
|
||||
import org.telegram.messenger.MessageObject;
|
||||
import org.telegram.messenger.UserConfig;
|
||||
import org.telegram.messenger.Utilities;
|
||||
import org.telegram.ui.ActionBar.BackDrawable;
|
||||
import org.telegram.ui.ActionBar.SimpleTextView;
|
||||
import org.telegram.ui.Cells.DividerCell;
|
||||
@@ -81,9 +78,7 @@ import org.telegram.ui.Components.RecyclerListView;
|
||||
import org.telegram.ui.ActionBar.Theme;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
public class ProfileActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate, DialogsActivity.DialogsActivityDelegate, PhotoViewer.PhotoViewerProvider {
|
||||
|
||||
@@ -119,10 +114,8 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
private float animationProgress;
|
||||
|
||||
private AvatarUpdater avatarUpdater;
|
||||
private TLRPC.ChatFull info;
|
||||
private int selectedUser;
|
||||
private int onlineCount = -1;
|
||||
private ArrayList<Integer> sortedUsers;
|
||||
private int[] sortedUserIds;
|
||||
|
||||
private final TLRPC.EncryptedChat currentEncryptedChat = null;
|
||||
private TLRPC.Chat currentChat;
|
||||
@@ -143,6 +136,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
private int emptyRowChat2 = -1;
|
||||
private int addMemberRow = -1;
|
||||
private int membersEndRow = -1;
|
||||
private int membersSectionRow = -1;
|
||||
|
||||
private int rowCount = 0;
|
||||
|
||||
@@ -198,8 +192,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
} else if (chat_id != 0) {
|
||||
currentChat = MrMailbox.chatId2chat(chat_id);
|
||||
|
||||
sortedUsers = new ArrayList<>();
|
||||
updateOnlineCount();
|
||||
sortedUserIds = MrMailbox.MrMailboxGetChatContacts(MrMailbox.hMailbox, chat_id);
|
||||
|
||||
avatarUpdater = new AvatarUpdater();
|
||||
avatarUpdater.delegate = new AvatarUpdater.AvatarUpdaterDelegate() {
|
||||
@@ -449,18 +442,13 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
builder.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("AskStartChatWith", R.string.AskStartChatWith, name)));
|
||||
showDialog(builder.create());
|
||||
} else if (position > emptyRowChat2 && position < membersEndRow) {
|
||||
int user_id;
|
||||
if (!sortedUsers.isEmpty()) {
|
||||
user_id = info.participants.participants.get(sortedUsers.get(position - emptyRowChat2 - 1)).user_id;
|
||||
} else {
|
||||
user_id = info.participants.participants.get(position - emptyRowChat2 - 1).user_id;
|
||||
int curr_user_index = position - emptyRowChat2 - 1;
|
||||
if(curr_user_index>=0 && curr_user_index<sortedUserIds.length) {
|
||||
int curr_user_id = sortedUserIds[curr_user_index];
|
||||
Bundle args = new Bundle();
|
||||
args.putInt("user_id", curr_user_id);
|
||||
presentFragment(new ProfileActivity(args));
|
||||
}
|
||||
if (user_id == UserConfig.getClientUserId()) {
|
||||
return;
|
||||
}
|
||||
Bundle args = new Bundle();
|
||||
args.putInt("user_id", user_id);
|
||||
presentFragment(new ProfileActivity(args));
|
||||
} else if (position == addMemberRow) {
|
||||
openAddMember();
|
||||
} else {
|
||||
@@ -473,6 +461,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
@Override
|
||||
public boolean onItemClick(View view, int position) {
|
||||
if (position > emptyRowChat2 && position < membersEndRow) {
|
||||
/*
|
||||
if (getParentActivity() == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -525,6 +514,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
});
|
||||
}
|
||||
showDialog(builder.create());
|
||||
*/
|
||||
return true;
|
||||
} else {
|
||||
return processOnClickOrPress(position);
|
||||
@@ -661,9 +651,6 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
return false;
|
||||
}
|
||||
|
||||
private void leaveChatPressed() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveSelfArgs(Bundle args) {
|
||||
if (chat_id != 0) {
|
||||
@@ -691,6 +678,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
}
|
||||
|
||||
private void openAddMember() {
|
||||
/*
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean("onlyUsers", true);
|
||||
args.putBoolean("destroyAfterSelect", true);
|
||||
@@ -718,6 +706,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
fragment.setIgnoreUsers(users);
|
||||
}
|
||||
presentFragment(fragment);
|
||||
*/
|
||||
}
|
||||
|
||||
private void checkListViewScroll() {
|
||||
@@ -889,7 +878,6 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
}
|
||||
}
|
||||
if ((mask & MessagesController.UPDATE_MASK_CHANNEL) != 0 || (mask & MessagesController.UPDATE_MASK_CHAT_AVATAR) != 0 || (mask & MessagesController.UPDATE_MASK_CHAT_NAME) != 0 || (mask & MessagesController.UPDATE_MASK_CHAT_MEMBERS) != 0 || (mask & MessagesController.UPDATE_MASK_STATUS) != 0) {
|
||||
updateOnlineCount();
|
||||
updateProfileData();
|
||||
}
|
||||
if ((mask & MessagesController.UPDATE_MASK_CHANNEL) != 0) {
|
||||
@@ -1177,140 +1165,6 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
@Override
|
||||
public int getSelectedCount() { return 0; }
|
||||
|
||||
private void updateOnlineCount() {
|
||||
onlineCount = 0;
|
||||
int currentTime = ConnectionsManager.getInstance().getCurrentTime();
|
||||
sortedUsers.clear();
|
||||
if (info instanceof TLRPC.TL_chatFull || info instanceof TLRPC.TL_channelFull && info.participants_count <= 200 && info.participants != null) {
|
||||
for (int a = 0; a < info.participants.participants.size(); a++) {
|
||||
TLRPC.ChatParticipant participant = info.participants.participants.get(a);
|
||||
TLRPC.User user = MessagesController.getInstance().getUser(participant.user_id);
|
||||
if (user != null && user.status != null && (user.status.expires > currentTime || user.id == UserConfig.getClientUserId()) && user.status.expires > 10000) {
|
||||
onlineCount++;
|
||||
}
|
||||
sortedUsers.add(a);
|
||||
}
|
||||
|
||||
try {
|
||||
Collections.sort(sortedUsers, new Comparator<Integer>() {
|
||||
@Override
|
||||
public int compare(Integer lhs, Integer rhs) {
|
||||
TLRPC.User user1 = MessagesController.getInstance().getUser(info.participants.participants.get(rhs).user_id);
|
||||
TLRPC.User user2 = MessagesController.getInstance().getUser(info.participants.participants.get(lhs).user_id);
|
||||
int status1 = 0;
|
||||
int status2 = 0;
|
||||
if (user1 != null && user1.status != null) {
|
||||
if (user1.id == UserConfig.getClientUserId()) {
|
||||
status1 = ConnectionsManager.getInstance().getCurrentTime() + 50000;
|
||||
} else {
|
||||
status1 = user1.status.expires;
|
||||
}
|
||||
}
|
||||
if (user2 != null && user2.status != null) {
|
||||
if (user2.id == UserConfig.getClientUserId()) {
|
||||
status2 = ConnectionsManager.getInstance().getCurrentTime() + 50000;
|
||||
} else {
|
||||
status2 = user2.status.expires;
|
||||
}
|
||||
}
|
||||
if (status1 > 0 && status2 > 0) {
|
||||
if (status1 > status2) {
|
||||
return 1;
|
||||
} else if (status1 < status2) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
} else if (status1 < 0 && status2 < 0) {
|
||||
if (status1 > status2) {
|
||||
return 1;
|
||||
} else if (status1 < status2) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
} else if (status1 < 0 && status2 > 0 || status1 == 0 && status2 != 0) {
|
||||
return -1;
|
||||
} else if (status2 < 0 && status1 > 0 || status2 == 0 && status1 != 0) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
FileLog.e("tmessages", e);
|
||||
}
|
||||
|
||||
if (listAdapter != null) {
|
||||
listAdapter.notifyItemRangeChanged(emptyRowChat2 + 1, sortedUsers.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public void setChatInfo(TLRPC.ChatFull chatInfo) {
|
||||
info = chatInfo;
|
||||
if (info != null && info.migrated_from_chat_id != 0) {
|
||||
mergeDialogId = -info.migrated_from_chat_id;
|
||||
}
|
||||
fetchUsersFromChannelInfo();
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
private void fetchUsersFromChannelInfo() {
|
||||
if (info instanceof TLRPC.TL_channelFull && info.participants != null) {
|
||||
for (int a = 0; a < info.participants.participants.size(); a++) {
|
||||
TLRPC.ChatParticipant chatParticipant = info.participants.participants.get(a);
|
||||
participantsMap.put(chatParticipant.user_id, chatParticipant);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
private void kickUser(int uid) {
|
||||
if (uid != 0) {
|
||||
MessagesController.getInstance().deleteUserFromChat(chat_id, MessagesController.getInstance().getUser(uid), info);
|
||||
if (currentChat.megagroup && info != null && info.participants != null) {
|
||||
/*boolean changed = false;
|
||||
for (int a = 0; a < info.participants.participants.size(); a++) {
|
||||
TLRPC.ChannelParticipant p = ((TLRPC.TL_chatChannelParticipant) info.participants.participants.get(a)).channelParticipant;
|
||||
if (p.user_id == uid) {
|
||||
if (info != null) {
|
||||
info.participants_count--;
|
||||
}
|
||||
info.participants.participants.remove(a);
|
||||
changed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (info != null && info.participants != null) {
|
||||
for (int a = 0; a < info.participants.participants.size(); a++) {
|
||||
TLRPC.ChatParticipant p = info.participants.participants.get(a);
|
||||
if (p.user_id == uid) {
|
||||
info.participants.participants.remove(a);
|
||||
changed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (changed) {
|
||||
updateOnlineCount();
|
||||
updateRowsIds();
|
||||
listAdapter.notifyDataSetChanged();
|
||||
}*/
|
||||
}
|
||||
} else {
|
||||
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.closeChats);
|
||||
if (AndroidUtilities.isTablet()) {
|
||||
NotificationCenter.getInstance().postNotificationName(NotificationCenter.closeChats, -(long) chat_id);
|
||||
} else {
|
||||
NotificationCenter.getInstance().postNotificationName(NotificationCenter.closeChats);
|
||||
}
|
||||
MessagesController.getInstance().deleteUserFromChat(chat_id, MessagesController.getInstance().getUser(UserConfig.getClientUserId()), info);
|
||||
playProfileAnimation = false;
|
||||
finishFragment();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isChat() {
|
||||
return chat_id != 0;
|
||||
}
|
||||
@@ -1332,12 +1186,14 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
addMemberRow = rowCount++;
|
||||
}
|
||||
|
||||
//sectionRow = rowCount++;
|
||||
|
||||
if( chat_id != 0 ) {
|
||||
/*
|
||||
emptyRowChat = rowCount++;
|
||||
membersSectionRow = rowCount++;
|
||||
emptyRowChat2 = rowCount++;
|
||||
rowCount += 10;
|
||||
rowCount += sortedUserIds.length;
|
||||
membersEndRow = rowCount;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -1540,7 +1396,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
if (i == emptyRowChat || i == emptyRowChat2) {
|
||||
((EmptyCell) holder.itemView).setHeight(AndroidUtilities.dp(8));
|
||||
} else {
|
||||
((EmptyCell) holder.itemView).setHeight(AndroidUtilities.dp(36));
|
||||
((EmptyCell) holder.itemView).setHeight(AndroidUtilities.dp(14)); // was 36 when we used the "writeButton" for taking photos etc.
|
||||
}
|
||||
break;
|
||||
case typeTextDetailCell:
|
||||
@@ -1554,22 +1410,21 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
} else if (i == startChatRow) {
|
||||
textCell.setText(LocaleController.getString("NewChat", R.string.NewChat));
|
||||
} else if (i == settingsNotificationsRow) {
|
||||
textCell.setTextAndIcon(LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), R.drawable.profile_list);
|
||||
textCell.setTextAndIcon(LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), R.drawable.menu_settings);
|
||||
} else if (i == addMemberRow) {
|
||||
textCell.setText(LocaleController.getString("AddMember", R.string.AddMember));
|
||||
}
|
||||
break;
|
||||
case typeContactCell:
|
||||
UserCell userCell = ((UserCell) holder.itemView);
|
||||
TLRPC.ChatParticipant part;
|
||||
if (!sortedUsers.isEmpty()) {
|
||||
part = info.participants.participants.get(sortedUsers.get(i - emptyRowChat2 - 1));
|
||||
} else {
|
||||
part = info.participants.participants.get(i - emptyRowChat2 - 1);
|
||||
}
|
||||
if (part != null) {
|
||||
userCell.setIsAdmin(0);
|
||||
userCell.setData(MessagesController.getInstance().getUser(part.user_id), null, null, i == emptyRowChat2 + 1 ? R.drawable.menu_newgroup : 0);
|
||||
int curr_user_index = i - emptyRowChat2 - 1;
|
||||
if(curr_user_index>=0 && curr_user_index<sortedUserIds.length) {
|
||||
int curr_user_id = sortedUserIds[curr_user_index];
|
||||
long hContact = MrMailbox.MrMailboxGetContact(MrMailbox.hMailbox, curr_user_id);
|
||||
userCell.setData(curr_user_id, 0, MrMailbox.MrContactGetDisplayName(hContact),
|
||||
MrMailbox.MrContactGetAddr(hContact),
|
||||
curr_user_index==0? R.drawable.menu_newgroup : 0);
|
||||
MrMailbox.MrContactUnref(hContact);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1613,6 +1468,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
} else if (i > emptyRowChat2 && i < membersEndRow) {
|
||||
return typeContactCell;
|
||||
}
|
||||
else if(i==membersSectionRow) {
|
||||
return typeSection;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 990 B |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 972 B |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |