Update to 7.4.0 (2223)

This commit is contained in:
DrKLO 2021-01-28 18:42:39 +03:00
parent 77bbe5baec
commit eb94e31b4c
10 changed files with 130 additions and 61 deletions

View file

@ -290,7 +290,7 @@ android {
} }
} }
defaultConfig.versionCode = 2221 defaultConfig.versionCode = 2223
applicationVariants.all { variant -> applicationVariants.all { variant ->
variant.outputs.all { output -> variant.outputs.all { output ->

View file

@ -18,7 +18,7 @@ public class BuildVars {
public static boolean LOGS_ENABLED = false; public static boolean LOGS_ENABLED = false;
public static boolean USE_CLOUD_STRINGS = true; public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true; public static boolean CHECK_UPDATES = true;
public static int BUILD_VERSION = 2221; public static int BUILD_VERSION = 2223;
public static String BUILD_VERSION_STRING = "7.4.0"; public static String BUILD_VERSION_STRING = "7.4.0";
public static int APP_ID = 4; public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103"; public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";

View file

@ -4628,7 +4628,7 @@ public class MessagesStorage extends BaseController {
final TLRPC.ChatFull finalInfo = info; final TLRPC.ChatFull finalInfo = info;
AndroidUtilities.runOnUIThread(() -> getNotificationCenter().postNotificationName(NotificationCenter.chatInfoDidLoad, finalInfo, 0, false)); AndroidUtilities.runOnUIThread(() -> getNotificationCenter().postNotificationName(NotificationCenter.chatInfoDidLoad, finalInfo, 0, false));
SQLitePreparedStatement state = database.executeFast("REPLACE INTO chat_settings_v2 VALUES(?, ?, ?, ?, ?)"); SQLitePreparedStatement state = database.executeFast("REPLACE INTO chat_settings_v2 VALUES(?, ?, ?, ?, ?, ?)");
NativeByteBuffer data = new NativeByteBuffer(info.getObjectSize()); NativeByteBuffer data = new NativeByteBuffer(info.getObjectSize());
info.serializeToStream(data); info.serializeToStream(data);
state.bindInteger(1, info.id); state.bindInteger(1, info.id);
@ -4636,6 +4636,7 @@ public class MessagesStorage extends BaseController {
state.bindInteger(3, info.pinned_msg_id); state.bindInteger(3, info.pinned_msg_id);
state.bindInteger(4, info.online_count); state.bindInteger(4, info.online_count);
state.bindInteger(5, info.inviterId); state.bindInteger(5, info.inviterId);
state.bindInteger(6, info.invitesCount);
state.step(); state.step();
state.dispose(); state.dispose();
data.reuse(); data.reuse();
@ -5180,7 +5181,7 @@ public class MessagesStorage extends BaseController {
final TLRPC.ChatFull finalInfo = info; final TLRPC.ChatFull finalInfo = info;
AndroidUtilities.runOnUIThread(() -> getNotificationCenter().postNotificationName(NotificationCenter.chatInfoDidLoad, finalInfo, 0, false)); AndroidUtilities.runOnUIThread(() -> getNotificationCenter().postNotificationName(NotificationCenter.chatInfoDidLoad, finalInfo, 0, false));
SQLitePreparedStatement state = database.executeFast("REPLACE INTO chat_settings_v2 VALUES(?, ?, ?, ?, ?)"); SQLitePreparedStatement state = database.executeFast("REPLACE INTO chat_settings_v2 VALUES(?, ?, ?, ?, ?, ?)");
NativeByteBuffer data = new NativeByteBuffer(info.getObjectSize()); NativeByteBuffer data = new NativeByteBuffer(info.getObjectSize());
info.serializeToStream(data); info.serializeToStream(data);
state.bindInteger(1, chat_id); state.bindInteger(1, chat_id);
@ -5188,6 +5189,7 @@ public class MessagesStorage extends BaseController {
state.bindInteger(3, info.pinned_msg_id); state.bindInteger(3, info.pinned_msg_id);
state.bindInteger(4, info.online_count); state.bindInteger(4, info.online_count);
state.bindInteger(5, info.inviterId); state.bindInteger(5, info.inviterId);
state.bindInteger(6, info.invitesCount);
state.step(); state.step();
state.dispose(); state.dispose();
data.reuse(); data.reuse();

View file

@ -5470,6 +5470,9 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
} }
String path = MediaController.copyFileToCache(mediaUri, "txt"); String path = MediaController.copyFileToCache(mediaUri, "txt");
if (path == null) {
continue;
}
final File f = new File(path); final File f = new File(path);
long size; long size;
if (!f.exists() || (size = f.length()) == 0) { if (!f.exists() || (size = f.length()) == 0) {
@ -5483,6 +5486,14 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
} }
importingHistory.totalSize += size; importingHistory.totalSize += size;
if (a == 0) { if (a == 0) {
if (size > 32 * 1024 * 1024) {
f.delete();
AndroidUtilities.runOnUIThread(() -> {
Toast.makeText(ApplicationLoader.applicationContext, LocaleController.getString("ImportFileTooLarge", R.string.ImportFileTooLarge), Toast.LENGTH_SHORT).show();
onStartImport.run(0);
});
return;
}
importingHistory.historyPath = path; importingHistory.historyPath = path;
} else { } else {
importingHistory.uploadMedia.add(path); importingHistory.uploadMedia.add(path);

View file

@ -745,7 +745,9 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente
@Override @Override
public void invalidate() { public void invalidate() {
super.invalidate(); super.invalidate();
fragmentView.invalidate(); if (fragmentView != null) {
fragmentView.invalidate();
}
} }
}; };
listView.setLayoutManager(layoutManager = new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false) { listView.setLayoutManager(layoutManager = new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false) {

View file

@ -541,6 +541,10 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
} }
VoIPHelper.startCall(chatActivity.getMessagesController().getChat(call.chatId), false, fragment.getParentActivity()); VoIPHelper.startCall(chatActivity.getMessagesController().getChat(call.chatId), false, fragment.getParentActivity());
} else if (currentStyle == 5) { } else if (currentStyle == 5) {
SendMessagesHelper.ImportingHistory importingHistory = parentFragment.getSendMessagesHelper().getImportingHistory(((ChatActivity) parentFragment).getDialogId());
if (importingHistory == null) {
return;
}
ImportingAlert importingAlert = new ImportingAlert(getContext(), (ChatActivity) fragment); ImportingAlert importingAlert = new ImportingAlert(getContext(), (ChatActivity) fragment);
importingAlert.setOnHideListener(dialog -> checkImport(false)); importingAlert.setOnHideListener(dialog -> checkImport(false));
fragment.showDialog(importingAlert); fragment.showDialog(importingAlert);
@ -610,7 +614,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
show = true; show = true;
} else if (fragment instanceof ChatActivity && fragment.getSendMessagesHelper().getImportingHistory(((ChatActivity) fragment).getDialogId()) != null && !isPlayingVoice()) { } else if (fragment instanceof ChatActivity && fragment.getSendMessagesHelper().getImportingHistory(((ChatActivity) fragment).getDialogId()) != null && !isPlayingVoice()) {
show = true; show = true;
} else if (fragment instanceof ChatActivity && ((ChatActivity) fragment).getGroupCall() != null && !GroupCallPip.isShowing() && !isPlayingVoice()) { } else if (fragment instanceof ChatActivity && ((ChatActivity) fragment).getGroupCall() != null && ((ChatActivity) fragment).getGroupCall().call.participants_count > 0 && !GroupCallPip.isShowing() && !isPlayingVoice()) {
show = true; show = true;
} else { } else {
MessageObject messageObject = MediaController.getInstance().getPlayingMessageObject(); MessageObject messageObject = MediaController.getInstance().getPlayingMessageObject();
@ -881,7 +885,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
checkCall(true); checkCall(true);
} else if (fragment instanceof ChatActivity && fragment.getSendMessagesHelper().getImportingHistory(((ChatActivity) fragment).getDialogId()) != null && !isPlayingVoice()) { } else if (fragment instanceof ChatActivity && fragment.getSendMessagesHelper().getImportingHistory(((ChatActivity) fragment).getDialogId()) != null && !isPlayingVoice()) {
checkImport(true); checkImport(true);
} else if (fragment instanceof ChatActivity && ((ChatActivity) fragment).getGroupCall() != null && !GroupCallPip.isShowing() && !isPlayingVoice()) { } else if (fragment instanceof ChatActivity && ((ChatActivity) fragment).getGroupCall() != null && ((ChatActivity) fragment).getGroupCall().call.participants_count > 0 && !GroupCallPip.isShowing() && !isPlayingVoice()) {
checkCall(true); checkCall(true);
} else { } else {
checkPlayer(true); checkPlayer(true);
@ -1220,8 +1224,9 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
if (messageObject == null || messageObject.getId() == 0 || messageObject.isVideo()) { if (messageObject == null || messageObject.getId() == 0 || messageObject.isVideo()) {
lastMessageObject = null; lastMessageObject = null;
boolean callAvailable = supportsCalls && VoIPService.getSharedInstance() != null && !VoIPService.getSharedInstance().isHangingUp() && VoIPService.getSharedInstance().getCallState() != VoIPService.STATE_WAITING_INCOMING && !GroupCallPip.isShowing(); boolean callAvailable = supportsCalls && VoIPService.getSharedInstance() != null && !VoIPService.getSharedInstance().isHangingUp() && VoIPService.getSharedInstance().getCallState() != VoIPService.STATE_WAITING_INCOMING && !GroupCallPip.isShowing();
if (!isPlayingVoice() && !callAvailable && fragment instanceof ChatActivity && ((ChatActivity) fragment).getGroupCall() != null && !GroupCallPip.isShowing()) { if (!isPlayingVoice() && !callAvailable && fragment instanceof ChatActivity && !GroupCallPip.isShowing()) {
callAvailable = true; ChatObject.Call call = ((ChatActivity) fragment).getGroupCall();
callAvailable = call != null && call.call.participants_count > 0;
} }
if (callAvailable) { if (callAvailable) {
checkCall(false); checkCall(false);
@ -1600,7 +1605,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
}); });
animatorSet.start(); animatorSet.start();
} }
} else if (currentStyle == -1 || currentStyle == 4 || currentStyle == 3 || currentStyle == 1) { } else if (visible && (currentStyle == -1 || currentStyle == 4 || currentStyle == 3 || currentStyle == 1)) {
visible = false; visible = false;
setVisibility(GONE); setVisibility(GONE);
} }

View file

@ -16,6 +16,7 @@ import android.view.WindowManager;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -64,6 +65,8 @@ public class LinkActionView extends LinearLayout {
private QRCodeBottomSheet qrCodeBottomSheet; private QRCodeBottomSheet qrCodeBottomSheet;
private boolean isPublic; private boolean isPublic;
float[] point = new float[2];
public LinkActionView(Context context, BaseFragment fragment, BottomSheet bottomSheet, int chatId, boolean permanent) { public LinkActionView(Context context, BaseFragment fragment, BottomSheet bottomSheet, int chatId, boolean permanent) {
super(context); super(context);
this.fragment = fragment; this.fragment = fragment;
@ -227,41 +230,29 @@ public class LinkActionView extends LinearLayout {
layout.addView(subItem, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48)); layout.addView(subItem, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48));
FrameLayout container; FrameLayout container;
float y = 0;
if (bottomSheet == null) { if (bottomSheet == null) {
container = fragment.getParentLayout(); container = fragment.getParentLayout();
} else { } else {
container = bottomSheet.getContainer(); container = bottomSheet.getContainer();
} }
View v = frameLayout;
while (v != container) {
y += v.getY();
v = (View) v.getParent();
if (!(v instanceof ViewGroup)) {
return;
}
}
if (container != null) { if (container != null) {
FrameLayout finalContainer = container; float x = 0;
float y;
getPointOnScreen(frameLayout, container, point);
y = point[1];
final FrameLayout finalContainer = container;
View dimView = new View(context) { View dimView = new View(context) {
@Override @Override
protected void onDraw(Canvas canvas) { protected void onDraw(Canvas canvas) {
canvas.drawColor(0x33000000); canvas.drawColor(0x33000000);
float x = 0; getPointOnScreen(frameLayout, finalContainer, point);
float y = 0;
View v = frameLayout;
while (v != finalContainer) {
y += v.getY();
x += v.getX();
v = (View) v.getParent();
if (!(v instanceof ViewGroup)) {
return;
}
}
canvas.save(); canvas.save();
canvas.translate(x, y); canvas.translate(point[0], point[1]);
frameLayout.draw(canvas); frameLayout.draw(canvas);
canvas.restore(); canvas.restore();
} }
@ -302,7 +293,11 @@ public class LinkActionView extends LinearLayout {
} }
}); });
actionBarPopupWindow.showAtLocation(container, 0, (int) container.getMeasuredWidth() - layout.getMeasuredWidth() - AndroidUtilities.dp(16), (int) y + frameLayout.getMeasuredHeight()); if (AndroidUtilities.isTablet()) {
y += container.getPaddingTop();
x -= container.getPaddingLeft();
}
actionBarPopupWindow.showAtLocation(container, 0, (int) (container.getMeasuredWidth() - layout.getMeasuredWidth() - AndroidUtilities.dp(16) + container.getX() + x), (int) (y + frameLayout.getMeasuredHeight() + container.getY()));
} }
}); });
@ -316,6 +311,27 @@ public class LinkActionView extends LinearLayout {
updateColors(); updateColors();
} }
private void getPointOnScreen(FrameLayout frameLayout, FrameLayout finalContainer, float[] point) {
float x = 0;
float y = 0;
View v = frameLayout;
while (v != finalContainer) {
y += v.getY();
x += v.getX();
if (v instanceof ScrollView) {
y -= v.getScrollY();
}
v = (View) v.getParent();
if (!(v instanceof ViewGroup)) {
return;
}
}
x -= finalContainer.getPaddingLeft();
y -= finalContainer.getPaddingTop();
point[0] = x;
point[1] = y;
}
private void showQrCode() { private void showQrCode() {
qrCodeBottomSheet = new QRCodeBottomSheet(getContext(), link) { qrCodeBottomSheet = new QRCodeBottomSheet(getContext(), link) {
@Override @Override

View file

@ -2409,10 +2409,11 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
Runnable cancelRunnable = null; Runnable cancelRunnable = null;
String content; String content;
InputStream inputStream = null;
try { try {
int linesCount = 0; int linesCount = 0;
InputStream in = getContentResolver().openInputStream(importUri); inputStream = getContentResolver().openInputStream(importUri);
BufferedReader r = new BufferedReader(new InputStreamReader(in)); BufferedReader r = new BufferedReader(new InputStreamReader(inputStream));
StringBuilder total = new StringBuilder(); StringBuilder total = new StringBuilder();
for (String line; (line = r.readLine()) != null && linesCount < 100; ) { for (String line; (line = r.readLine()) != null && linesCount < 100; ) {
total.append(line).append('\n'); total.append(line).append('\n');
@ -2422,6 +2423,14 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
} catch (Exception e) { } catch (Exception e) {
FileLog.e(e); FileLog.e(e);
return; return;
} finally {
try {
if (inputStream != null) {
inputStream.close();
}
} catch (Exception e2) {
FileLog.e(e2);
}
} }
final TLRPC.TL_messages_checkHistoryImport req = new TLRPC.TL_messages_checkHistoryImport(); final TLRPC.TL_messages_checkHistoryImport req = new TLRPC.TL_messages_checkHistoryImport();
req.import_head = content; req.import_head = content;
@ -3388,6 +3397,8 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
final int account = dialogsFragment != null ? dialogsFragment.getCurrentAccount() : currentAccount; final int account = dialogsFragment != null ? dialogsFragment.getCurrentAccount() : currentAccount;
if (exportingChatUri != null) { if (exportingChatUri != null) {
Uri uri = exportingChatUri;
ArrayList<Uri> documentsUris = documentsUrisArray != null ? new ArrayList<>(documentsUrisArray) : null;
final AlertDialog progressDialog = new AlertDialog(this, 3); final AlertDialog progressDialog = new AlertDialog(this, 3);
SendMessagesHelper.getInstance(account).prepareImportHistory(dids.get(0), exportingChatUri, documentsUrisArray, (result) -> { SendMessagesHelper.getInstance(account).prepareImportHistory(dids.get(0), exportingChatUri, documentsUrisArray, (result) -> {
if (result != 0) { if (result != 0) {
@ -3405,7 +3416,12 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
fragment.setOpenImport(); fragment.setOpenImport();
actionBarLayout.presentFragment(fragment, dialogsFragment != null || param, dialogsFragment == null, true, false); actionBarLayout.presentFragment(fragment, dialogsFragment != null || param, dialogsFragment == null, true, false);
} else { } else {
dialogsFragment.finishFragment(); documentsUrisArray = documentsUris;
if (documentsUrisArray == null) {
documentsUrisArray = new ArrayList<>();
}
documentsUrisArray.add(0, uri);
openDialogsToSend(true);
} }
try { try {
progressDialog.dismiss(); progressDialog.dismiss();

View file

@ -398,7 +398,8 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
private int transitionIndex; private int transitionIndex;
private TLRPC.Document preloadedSticker; private TLRPC.Document preloadedSticker;
private ArrayList<TLRPC.ChatParticipant> chatParticipants = new ArrayList<>(); private ArrayList<TLRPC.ChatParticipant> visibleChatParticipants = new ArrayList<>();
private ArrayList<Integer> visibleSortedUsers = new ArrayList<>();
private int usersForceShowingIn = 0; private int usersForceShowingIn = 0;
private final Property<ProfileActivity, Float> HEADER_SHADOW = new AnimationProperties.FloatProperty<ProfileActivity>("headerShadow") { private final Property<ProfileActivity, Float> HEADER_SHADOW = new AnimationProperties.FloatProperty<ProfileActivity>("headerShadow") {
@ -1328,7 +1329,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
getNotificationCenter().addObserver(this, NotificationCenter.groupCallUpdated); getNotificationCenter().addObserver(this, NotificationCenter.groupCallUpdated);
sortedUsers = new ArrayList<>(); sortedUsers = new ArrayList<>();
updateOnlineCount(); updateOnlineCount(true);
if (chatInfo == null) { if (chatInfo == null) {
chatInfo = getMessagesController().getChatFull(chat_id); chatInfo = getMessagesController().getChatFull(chat_id);
} }
@ -3455,7 +3456,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
} }
} }
if (changed) { if (changed) {
updateOnlineCount(); updateOnlineCount(true);
updateRowsIds(); updateRowsIds();
listAdapter.notifyDataSetChanged(); listAdapter.notifyDataSetChanged();
} }
@ -3819,10 +3820,20 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
if (chatInfo.participants == null) { if (chatInfo.participants == null) {
chatInfo.participants = new TLRPC.TL_chatParticipants(); chatInfo.participants = new TLRPC.TL_chatParticipants();
} }
TLRPC.ChatParticipant participant = new TLRPC.TL_chatParticipant(); if (ChatObject.isChannel(currentChat)) {
participant.user_id = user.id; TLRPC.TL_chatChannelParticipant channelParticipant1 = new TLRPC.TL_chatChannelParticipant();
participant.inviter_id = getAccountInstance().getUserConfig().clientUserId; channelParticipant1.channelParticipant = new TLRPC.TL_channelParticipant();
chatInfo.participants.participants.add(participant); channelParticipant1.channelParticipant.inviter_id = getUserConfig().getClientUserId();
channelParticipant1.channelParticipant.user_id = user.id;
channelParticipant1.channelParticipant.date = getConnectionsManager().getCurrentTime();
chatInfo.participants.participants.add(channelParticipant1);
} else {
TLRPC.ChatParticipant participant = new TLRPC.TL_chatParticipant();
participant.user_id = user.id;
participant.inviter_id = getAccountInstance().getUserConfig().clientUserId;
chatInfo.participants.participants.add(participant);
}
chatInfo.participants_count++;
getMessagesController().putUser(user, false); getMessagesController().putUser(user, false);
} }
} }
@ -4330,7 +4341,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
if ((mask & MessagesController.UPDATE_MASK_CHAT) != 0) { if ((mask & MessagesController.UPDATE_MASK_CHAT) != 0) {
updateListAnimated(true); updateListAnimated(true);
} else { } else {
updateOnlineCount(); updateOnlineCount(true);
} }
updateProfileData(); updateProfileData();
} }
@ -4352,7 +4363,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
return; return;
} }
chatInfo.online_count = (Integer) args[1]; chatInfo.online_count = (Integer) args[1];
updateOnlineCount(); updateOnlineCount(true);
updateProfileData(); updateProfileData();
} else if (id == NotificationCenter.contactsDidLoad) { } else if (id == NotificationCenter.contactsDidLoad) {
createActionBarMenu(true); createActionBarMenu(true);
@ -4855,7 +4866,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
return null; return null;
} }
private void updateOnlineCount() { private void updateOnlineCount(boolean notify) {
onlineCount = 0; onlineCount = 0;
int currentTime = getConnectionsManager().getCurrentTime(); int currentTime = getConnectionsManager().getCurrentTime();
sortedUsers.clear(); sortedUsers.clear();
@ -4918,7 +4929,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
FileLog.e(e); FileLog.e(e);
} }
if (listAdapter != null && membersStartRow > 0) { if (notify && listAdapter != null && membersStartRow > 0) {
listAdapter.notifyItemRangeChanged(membersStartRow, sortedUsers.size()); listAdapter.notifyItemRangeChanged(membersStartRow, sortedUsers.size());
} }
if (sharedMediaLayout != null && sharedMediaRow != -1 && (sortedUsers.size() > 5 || usersForceShowingIn == 2) && usersForceShowingIn != 1) { if (sharedMediaLayout != null && sharedMediaRow != -1 && (sortedUsers.size() > 5 || usersForceShowingIn == 2) && usersForceShowingIn != 1) {
@ -5052,7 +5063,8 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
unblockRow = -1; unblockRow = -1;
joinRow = -1; joinRow = -1;
lastSectionRow = -1; lastSectionRow = -1;
chatParticipants.clear(); visibleChatParticipants.clear();
visibleSortedUsers.clear();
boolean hasMedia = false; boolean hasMedia = false;
if (sharedMediaPreloader != null) { if (sharedMediaPreloader != null) {
@ -5201,7 +5213,10 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
rowCount += count; rowCount += count;
membersEndRow = rowCount; membersEndRow = rowCount;
membersSectionRow = rowCount++; membersSectionRow = rowCount++;
chatParticipants.addAll(chatInfo.participants.participants); visibleChatParticipants.addAll(chatInfo.participants.participants);
if (sortedUsers != null) {
visibleSortedUsers.addAll(sortedUsers);
}
usersForceShowingIn = 1; usersForceShowingIn = 1;
if (sharedMediaLayout != null) { if (sharedMediaLayout != null) {
sharedMediaLayout.setChatUsers(null, null); sharedMediaLayout.setChatUsers(null, null);
@ -5237,7 +5252,10 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
rowCount += chatInfo.participants.participants.size(); rowCount += chatInfo.participants.participants.size();
membersEndRow = rowCount; membersEndRow = rowCount;
membersSectionRow = rowCount++; membersSectionRow = rowCount++;
chatParticipants.addAll(chatInfo.participants.participants); visibleChatParticipants.addAll(chatInfo.participants.participants);
if (sortedUsers != null) {
visibleSortedUsers.addAll(sortedUsers);
}
if (sharedMediaLayout != null) { if (sharedMediaLayout != null) {
sharedMediaLayout.setChatUsers(null, null); sharedMediaLayout.setChatUsers(null, null);
} }
@ -6686,10 +6704,10 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
UserCell userCell = (UserCell) holder.itemView; UserCell userCell = (UserCell) holder.itemView;
TLRPC.ChatParticipant part; TLRPC.ChatParticipant part;
try { try {
if (!sortedUsers.isEmpty()) { if (!visibleSortedUsers.isEmpty()) {
part = chatInfo.participants.participants.get(sortedUsers.get(position - membersStartRow)); part = visibleChatParticipants.get(visibleSortedUsers.get(position - membersStartRow));
} else { } else {
part = chatInfo.participants.participants.get(position - membersStartRow); part = visibleChatParticipants.get(position - membersStartRow);
} }
} catch (Exception e) { } catch (Exception e) {
part = null; part = null;
@ -7511,7 +7529,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
public void updateListAnimated(boolean updateOnlineCount) { public void updateListAnimated(boolean updateOnlineCount) {
if (listAdapter == null) { if (listAdapter == null) {
if (updateOnlineCount) { if (updateOnlineCount) {
updateOnlineCount(); updateOnlineCount(false);
} }
updateRowsIds(); updateRowsIds();
return; return;
@ -7522,14 +7540,12 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
diffCallback.fillPositions(diffCallback.oldPositionToItem); diffCallback.fillPositions(diffCallback.oldPositionToItem);
diffCallback.oldChatParticipant.clear(); diffCallback.oldChatParticipant.clear();
diffCallback.oldChatParticipantSorted.clear(); diffCallback.oldChatParticipantSorted.clear();
if (sortedUsers != null) { diffCallback.oldChatParticipant.addAll(visibleChatParticipants);
diffCallback.oldChatParticipantSorted.addAll(sortedUsers); diffCallback.oldChatParticipantSorted.addAll(visibleSortedUsers);
}
diffCallback.oldChatParticipant.addAll(chatParticipants);
diffCallback.oldMembersStartRow = membersStartRow; diffCallback.oldMembersStartRow = membersStartRow;
diffCallback.oldMembersEndRow = membersEndRow; diffCallback.oldMembersEndRow = membersEndRow;
if (updateOnlineCount) { if (updateOnlineCount) {
updateOnlineCount(); updateOnlineCount(false);
} }
updateRowsIds(); updateRowsIds();
diffCallback.fillPositions(diffCallback.newPositionToItem); diffCallback.fillPositions(diffCallback.newPositionToItem);
@ -7589,9 +7605,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
} }
if (!sortedUsers.isEmpty()) { if (!sortedUsers.isEmpty()) {
newItem = chatParticipants.get(sortedUsers.get(newItemPosition - membersStartRow)); newItem = visibleChatParticipants.get(visibleSortedUsers.get(newItemPosition - membersStartRow));
} else { } else {
newItem = chatParticipants.get(newItemPosition - membersStartRow); newItem = visibleChatParticipants.get(newItemPosition - membersStartRow);
} }
return oldItem.user_id == newItem.user_id; return oldItem.user_id == newItem.user_id;
} }

View file

@ -1123,6 +1123,7 @@
<string name="PinnedMessagesHidden">Pinned messages hidden</string> <string name="PinnedMessagesHidden">Pinned messages hidden</string>
<string name="PinnedMessagesHiddenInfo">You will see the bar with pinned messages only if a new message is pinned.</string> <string name="PinnedMessagesHiddenInfo">You will see the bar with pinned messages only if a new message is pinned.</string>
<string name="ImportedMessage">Imported</string> <string name="ImportedMessage">Imported</string>
<string name="ImportFileTooLarge">Importing file is too large.</string>
<string name="AudioSpeedNormal">Audio will play at normal speed.</string> <string name="AudioSpeedNormal">Audio will play at normal speed.</string>
<string name="AudioSpeedFast">Audio will play two times faster.</string> <string name="AudioSpeedFast">Audio will play two times faster.</string>
<string name="MessageCopied">Message copied to clipboard.</string> <string name="MessageCopied">Message copied to clipboard.</string>