Update to 7.9.2 (2389)

This commit is contained in:
DrKLO 2021-08-05 23:35:18 +03:00
parent 24c6968b8a
commit fc12550efb
3398 changed files with 464 additions and 544 deletions

View file

@ -19,8 +19,8 @@ public class BuildVars {
public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true;
public static boolean NO_SCOPED_STORAGE = true/* || Build.VERSION.SDK_INT <= 28*/;
public static int BUILD_VERSION = 2387;
public static String BUILD_VERSION_STRING = "7.9.1";
public static int BUILD_VERSION = 2389;
public static String BUILD_VERSION_STRING = "7.9.2";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
public static String APPCENTER_HASH = "a5b5c4f5-51da-dedc-9918-d9766a22ca7c";

View file

@ -40,7 +40,7 @@ public class Emoji {
private static int bigImgSize;
private static boolean inited = false;
private static Paint placeholderPaint;
private static int[] emojiCounts = new int[]{1695, 199, 123, 332, 128, 222, 290, 259};
private static int[] emojiCounts = new int[]{1906, 199, 123, 332, 128, 222, 292, 259};
private static Bitmap[][] emojiBmp = new Bitmap[8][];
private static boolean[][] loadingEmoji = new boolean[8][];
@ -92,33 +92,16 @@ public class Emoji {
private static void loadEmojiInternal(final byte page, final short page2) {
try {
float scale;
int imageResize = 1;
int imageResize;
if (AndroidUtilities.density <= 1.0f) {
scale = 2.0f;
imageResize = 2;
} else if (AndroidUtilities.density <= 1.5f) {
scale = 2.0f;
} else if (AndroidUtilities.density <= 2.0f) {
scale = 2.0f;
} else {
scale = 2.0f;
imageResize = 1;
}
String imageName;
File imageFile;
try {
for (int a = 13; a < 16; a++) {
imageName = String.format(Locale.US, "v%d_emoji%.01fx_%d.png", a, scale, page);
imageFile = ApplicationLoader.applicationContext.getFileStreamPath(imageName);
if (imageFile.exists()) {
imageFile.delete();
}
}
} catch (Exception e) {
FileLog.e(e);
}
Bitmap bitmap = null;
try {
InputStream is = ApplicationLoader.applicationContext.getAssets().open("emoji/" + String.format(Locale.US, "%d_%d.png", page, page2));
@ -483,7 +466,7 @@ public class Emoji {
emojiCode.setLength(0);
doneEmoji = false;
}
if ((Build.VERSION.SDK_INT < 23 || Build.VERSION.SDK_INT >= 29) && emojiCount >= 50) {
if ((Build.VERSION.SDK_INT < 23 || Build.VERSION.SDK_INT >= 29) && !BuildVars.DEBUG_PRIVATE_VERSION && emojiCount >= 50) {
break;
}
}

File diff suppressed because one or more lines are too long

View file

@ -68,8 +68,8 @@ public class FileLoadOperation {
private final static int downloadChunkSize = 1024 * 32;
private final static int downloadChunkSizeBig = 1024 * 128;
private final static int cdnChunkCheckSize = 1024 * 128;
private final static int maxDownloadRequests = 4;
private final static int maxDownloadRequestsBig = 4;
private final static int maxDownloadRequests = BuildVars.DEBUG_PRIVATE_VERSION ? 8 : 4;
private final static int maxDownloadRequestsBig = BuildVars.DEBUG_PRIVATE_VERSION ? 8 : 4;
private final static int bigFileSizeFrom = 1024 * 1024;
private final static int maxCdnParts = (int) (FileLoader.MAX_FILE_SIZE / downloadChunkSizeBig);

View file

@ -899,7 +899,7 @@ public class MessageObject {
}
public MessageObject(int accountNum, TLRPC.Message message, MessageObject replyToMessage, AbstractMap<Integer, TLRPC.User> users, AbstractMap<Integer, TLRPC.Chat> chats, SparseArray<TLRPC.User> sUsers, SparseArray<TLRPC.Chat> sChats, boolean generateLayout, boolean checkMediaExists, long eid) {
Theme.createCommonChatResources();
Theme.createCommonMessageResources();
currentAccount = accountNum;
messageOwner = message;
@ -2363,7 +2363,7 @@ public class MessageObject {
}
wantedBotKeyboardWidth = 0;
if (messageOwner.reply_markup instanceof TLRPC.TL_replyInlineMarkup || messageOwner.reactions != null && !messageOwner.reactions.results.isEmpty()) {
Theme.createCommonChatResources();
Theme.createCommonMessageResources();
if (botButtonsLayout == null) {
botButtonsLayout = new StringBuilder();
} else {
@ -5035,8 +5035,9 @@ public class MessageObject {
}
public static TLRPC.InputStickerSet getInputStickerSet(TLRPC.Message message) {
if (message.media != null && message.media.document != null) {
return getInputStickerSet(message.media.document);
TLRPC.Document document = getDocument(message);
if (document != null) {
return getInputStickerSet(document);
}
return null;
}

View file

@ -3836,7 +3836,7 @@ public class MessagesController extends BaseController implements NotificationCe
public void didAddedNewTask(final int minDate, final SparseArray<ArrayList<Long>> mids) {
Utilities.stageQueue.postRunnable(() -> {
if (currentDeletingTaskMids == null && !gettingNewDeleteTask || currentDeletingTaskTime != 0 && minDate < currentDeletingTaskTime) {
getNewDeleteTask(null, 0);
getNewDeleteTask(null, 0, false);
}
});
if (mids != null) {
@ -3844,10 +3844,10 @@ public class MessagesController extends BaseController implements NotificationCe
}
}
public void getNewDeleteTask(final ArrayList<Integer> oldTask, final int channelId) {
public void getNewDeleteTask(final ArrayList<Integer> oldTask, final int channelId, boolean oldMedia) {
Utilities.stageQueue.postRunnable(() -> {
gettingNewDeleteTask = true;
getMessagesStorage().getNewTask(oldTask, channelId);
getMessagesStorage().getNewTask(oldTask, channelId, oldMedia);
});
}
@ -3868,7 +3868,7 @@ public class MessagesController extends BaseController implements NotificationCe
deleteMessages(mids, null, null, 0, 0, false, false, !mids.isEmpty() && mids.get(0) > 0);
}
Utilities.stageQueue.postRunnable(() -> {
getNewDeleteTask(mids, currentDeletingTaskChannelId);
getNewDeleteTask(mids, currentDeletingTaskChannelId, currentDeletingTaskMedia);
currentDeletingTaskTime = 0;
currentDeletingTaskMids = null;
currentDeletingTaskMedia = false;
@ -5196,10 +5196,18 @@ public class MessagesController extends BaseController implements NotificationCe
if (info != null) {
if (fullUsers.get(user.id) == null) {
fullUsers.put(user.id, info);
int index = blockePeers.indexOfKey(user.id);
if (info.blocked) {
blockePeers.put(user.id, 1);
if (index < 0) {
blockePeers.put(user.id, 1);
getNotificationCenter().postNotificationName(NotificationCenter.blockedUsersDidLoad);
}
} else {
blockePeers.delete(user.id);
if (index >= 0) {
blockePeers.removeAt(index);
getNotificationCenter().postNotificationName(NotificationCenter.blockedUsersDidLoad);
}
}
}
getNotificationCenter().postNotificationName(NotificationCenter.userInfoDidLoad, user.id, info);
@ -7471,7 +7479,7 @@ public class MessagesController extends BaseController implements NotificationCe
public void processLoadedDialogs(final TLRPC.messages_Dialogs dialogsRes, final ArrayList<TLRPC.EncryptedChat> encChats, final int folderId, final int offset, final int count, final int loadType, final boolean resetEnd, final boolean migrate, final boolean fromCache) {
Utilities.stageQueue.postRunnable(() -> {
if (!firstGettingTask) {
getNewDeleteTask(null, 0);
getNewDeleteTask(null, 0, false);
firstGettingTask = true;
}

View file

@ -93,7 +93,7 @@ public class MessagesStorage extends BaseController {
private CountDownLatch openSync = new CountDownLatch(1);
private static volatile MessagesStorage[] Instance = new MessagesStorage[UserConfig.MAX_ACCOUNT_COUNT];
private final static int LAST_DB_VERSION = 79;
private final static int LAST_DB_VERSION = 80;
public static MessagesStorage getInstance(int num) {
MessagesStorage localInstance = Instance[num];
@ -323,8 +323,8 @@ public class MessagesStorage extends BaseController {
database.executeFast("CREATE TABLE randoms(random_id INTEGER, mid INTEGER, PRIMARY KEY (random_id, mid))").stepThis().dispose();
database.executeFast("CREATE INDEX IF NOT EXISTS mid_idx_randoms ON randoms(mid);").stepThis().dispose();
database.executeFast("CREATE TABLE enc_tasks_v2(mid INTEGER PRIMARY KEY, date INTEGER, media INTEGER)").stepThis().dispose();
database.executeFast("CREATE INDEX IF NOT EXISTS date_idx_enc_tasks_v2 ON enc_tasks_v2(date);").stepThis().dispose();
database.executeFast("CREATE TABLE enc_tasks_v3(mid INTEGER, date INTEGER, media INTEGER, PRIMARY KEY(mid, media))").stepThis().dispose();
database.executeFast("CREATE INDEX IF NOT EXISTS date_idx_enc_tasks_v3 ON enc_tasks_v3(date);").stepThis().dispose();
database.executeFast("CREATE TABLE messages_seq(mid INTEGER PRIMARY KEY, seq_in INTEGER, seq_out INTEGER);").stepThis().dispose();
database.executeFast("CREATE INDEX IF NOT EXISTS seq_idx_messages_seq ON messages_seq(seq_in, seq_out);").stepThis().dispose();
@ -959,6 +959,34 @@ public class MessagesStorage extends BaseController {
version = 79;
}
if (version == 79) {
database.executeFast("CREATE TABLE IF NOT EXISTS enc_tasks_v3(mid INTEGER, date INTEGER, media INTEGER, PRIMARY KEY(mid, media))").stepThis().dispose();
database.executeFast("CREATE INDEX IF NOT EXISTS date_idx_enc_tasks_v3 ON enc_tasks_v3(date);").stepThis().dispose();
database.beginTransaction();
SQLiteCursor cursor = database.queryFinalized("SELECT mid, date, media FROM enc_tasks_v2 WHERE 1");
SQLitePreparedStatement state = database.executeFast("REPLACE INTO enc_tasks_v3 VALUES(?, ?, ?)");
if (cursor.next()) {
long mid = cursor.longValue(0);
int date = cursor.intValue(1);
int media = cursor.intValue(2);
state.requery();
state.bindLong(1, mid);
state.bindInteger(2, date);
state.bindInteger(3, media);
state.step();
}
state.dispose();
cursor.dispose();
database.commitTransaction();
database.executeFast("DROP INDEX IF EXISTS date_idx_enc_tasks_v2;").stepThis().dispose();
database.executeFast("DROP TABLE IF EXISTS enc_tasks_v2;").stepThis().dispose();
database.executeFast("PRAGMA user_version = 80").stepThis().dispose();
version = 80;
}
if (version == 80) {
}
} catch (Exception e) {
@ -3639,7 +3667,7 @@ public class MessagesStorage extends BaseController {
});
}
public void getNewTask(final ArrayList<Integer> oldTask, final int channelId) {
public void getNewTask(final ArrayList<Integer> oldTask, final int channelId, boolean isMediaTask) {
storageQueue.postRunnable(() -> {
try {
if (oldTask != null) {
@ -3658,13 +3686,17 @@ public class MessagesStorage extends BaseController {
} else {
ids = TextUtils.join(",", oldTask);
}
database.executeFast(String.format(Locale.US, "DELETE FROM enc_tasks_v2 WHERE mid IN(%s)", ids)).stepThis().dispose();
if (isMediaTask) {
database.executeFast(String.format(Locale.US, "DELETE FROM enc_tasks_v3 WHERE mid IN(%s) AND media = 1", ids)).stepThis().dispose();
} else {
database.executeFast(String.format(Locale.US, "DELETE FROM enc_tasks_v3 WHERE mid IN(%s) AND media = 0", ids)).stepThis().dispose();
}
}
int date = 0;
int channelId1 = -1;
boolean media = false;
Boolean media = null;
ArrayList<Integer> arr = null;
SQLiteCursor cursor = database.queryFinalized("SELECT mid, date, media FROM enc_tasks_v2 WHERE date = (SELECT min(date) FROM enc_tasks_v2)");
SQLiteCursor cursor = database.queryFinalized("SELECT mid, date, media FROM enc_tasks_v3 WHERE date = (SELECT min(date) FROM enc_tasks_v3)");
while (cursor.next()) {
long mid = cursor.longValue(0);
if (channelId1 == -1) {
@ -3678,13 +3710,19 @@ public class MessagesStorage extends BaseController {
arr = new ArrayList<>();
}
int m = (int) mid;
arr.add(m);
boolean newMedia;
int isMedia = cursor.intValue(2);
if (isMedia == -1) {
media = m > 0;
newMedia = m > 0;
} else {
media = isMedia != 0;
newMedia = isMedia != 0;
}
if (media == null) {
media = newMedia;
} else if (media != newMedia) {
continue;
}
arr.add(m);
}
cursor.dispose();
getMessagesController().processLoadedDeleteTask(date, arr, media, channelId1);
@ -3781,7 +3819,7 @@ public class MessagesStorage extends BaseController {
getNotificationCenter().postNotificationName(NotificationCenter.messagesReadContent, midsArray);
});
SQLitePreparedStatement state = database.executeFast("REPLACE INTO enc_tasks_v2 VALUES(?, ?, ?)");
SQLitePreparedStatement state = database.executeFast("REPLACE INTO enc_tasks_v3 VALUES(?, ?, ?)");
for (int a = 0; a < messages.size(); a++) {
int key = messages.keyAt(a);
ArrayList<Long> arr = messages.get(key);
@ -3849,7 +3887,7 @@ public class MessagesStorage extends BaseController {
if (messages.size() != 0) {
database.beginTransaction();
SQLitePreparedStatement state = database.executeFast("REPLACE INTO enc_tasks_v2 VALUES(?, ?, ?)");
SQLitePreparedStatement state = database.executeFast("REPLACE INTO enc_tasks_v3 VALUES(?, ?, ?)");
for (int a = 0; a < messages.size(); a++) {
int key = messages.keyAt(a);
ArrayList<Long> arr = messages.get(key);
@ -6702,7 +6740,7 @@ public class MessagesStorage extends BaseController {
}
if (MessageObject.isSecretMedia(message)) {
try {
SQLiteCursor cursor2 = database.queryFinalized(String.format(Locale.US, "SELECT date FROM enc_tasks_v2 WHERE mid = %d", message.id));
SQLiteCursor cursor2 = database.queryFinalized(String.format(Locale.US, "SELECT date FROM enc_tasks_v3 WHERE mid = %d", message.id));
if (cursor2.next()) {
message.destroyTime = cursor2.intValue(0);
}
@ -8659,7 +8697,7 @@ public class MessagesStorage extends BaseController {
if (message.ttl_period != 0 && message.id > 0) {
if (state_tasks == null) {
state_tasks = database.executeFast("REPLACE INTO enc_tasks_v2 VALUES(?, ?, ?)");
state_tasks = database.executeFast("REPLACE INTO enc_tasks_v3 VALUES(?, ?, ?)");
}
state_tasks.requery();
state_tasks.bindLong(1, messageId);
@ -10480,7 +10518,7 @@ public class MessagesStorage extends BaseController {
if (message.ttl_period != 0 && message.id > 0) {
if (state_tasks == null) {
state_tasks = database.executeFast("REPLACE INTO enc_tasks_v2 VALUES(?, ?, ?)");
state_tasks = database.executeFast("REPLACE INTO enc_tasks_v3 VALUES(?, ?, ?)");
}
state_tasks.requery();
state_tasks.bindLong(1, messageId);
@ -11096,7 +11134,7 @@ public class MessagesStorage extends BaseController {
if (message.ttl_period != 0 && message.id > 0) {
if (state_tasks == null) {
state_tasks = database.executeFast("REPLACE INTO enc_tasks_v2 VALUES(?, ?, ?)");
state_tasks = database.executeFast("REPLACE INTO enc_tasks_v3 VALUES(?, ?, ?)");
}
state_tasks.requery();
state_tasks.bindLong(1, messageId);

View file

@ -1225,7 +1225,8 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
if (object.type != 0) {
object.generateCaption();
} else {
object.generateLayout(null);
object.resetLayout();
object.checkLayout();
}
ArrayList<TLRPC.Message> arr = new ArrayList<>();
@ -2237,13 +2238,14 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
if (!retry) {
if (messageObject.editingMessage != null) {
String oldMessge = newMsg.message;
newMsg.message = messageObject.editingMessage.toString();
messageObject.caption = null;
if (type == 1) {
if (messageObject.editingMessageEntities != null) {
newMsg.entities = messageObject.editingMessageEntities;
newMsg.flags |= 128;
} else {
} else if (!TextUtils.equals(oldMessge, newMsg.message)) {
newMsg.flags &=~ 128;
}
} else {
@ -2256,7 +2258,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
if (entities != null && !entities.isEmpty()) {
newMsg.entities = entities;
newMsg.flags |= 128;
} else {
} else if (!TextUtils.equals(oldMessge, newMsg.message)) {
newMsg.flags &=~ 128;
}
}
@ -2274,7 +2276,8 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaPhoto || messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaDocument) {
messageObject.generateCaption();
} else {
messageObject.generateLayout(null);
messageObject.resetLayout();
messageObject.checkLayout();
}
}
messageObject.createMessageSendInfo();
@ -5397,6 +5400,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
msgObj.messageOwner.ttl_period = message.ttl_period;
msgObj.messageOwner.flags |= 33554432;
}
msgObj.messageOwner.entities = message.entities;
updateMediaPaths(msgObj, message, message.id, originalPath, false);
existFlags = msgObj.getMediaExistanceFlags();
newMsgObj.id = message.id;
@ -7849,20 +7853,18 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
float scale = videoEditedInfo.originalWidth > videoEditedInfo.originalHeight ? maxSize / videoEditedInfo.originalWidth : maxSize / videoEditedInfo.originalHeight;
videoEditedInfo.resultWidth = Math.round(videoEditedInfo.originalWidth * scale / 2) * 2;
videoEditedInfo.resultHeight = Math.round(videoEditedInfo.originalHeight * scale / 2) * 2;
bitrate = MediaController.makeVideoBitrate(
videoEditedInfo.originalHeight, videoEditedInfo.originalWidth,
originalBitrate,
videoEditedInfo.resultHeight, videoEditedInfo.resultWidth
);
}
bitrate = MediaController.makeVideoBitrate(
videoEditedInfo.originalHeight, videoEditedInfo.originalWidth,
originalBitrate,
videoEditedInfo.resultHeight, videoEditedInfo.resultWidth
);
if (selectedCompression == compressionsCount - 1) {
videoEditedInfo.resultWidth = videoEditedInfo.originalWidth;
videoEditedInfo.resultHeight = videoEditedInfo.originalHeight;
videoEditedInfo.bitrate = originalBitrate;
videoEditedInfo.estimatedSize = (int) (new File(videoPath).length());
videoEditedInfo.bitrate = bitrate;
videoEditedInfo.estimatedSize = (int) (audioFramesSize + videoDuration / 1000.0f * bitrate / 8);
} else {
videoEditedInfo.bitrate = bitrate;
videoEditedInfo.estimatedSize = (int) (audioFramesSize + videoFramesSize);

View file

@ -1650,6 +1650,23 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
}
groupCallPeer = peer;
groupCall.setSelfPeer(groupCallPeer);
TLRPC.ChatFull chatFull = MessagesController.getInstance(currentAccount).getChatFull(groupCall.chatId);
if (chatFull != null) {
chatFull.groupcall_default_join_as = groupCall.selfPeer;
if (chatFull.groupcall_default_join_as != null) {
if (chatFull instanceof TLRPC.TL_chatFull) {
chatFull.flags |= 32768;
} else {
chatFull.flags |= 67108864;
}
} else {
if (chatFull instanceof TLRPC.TL_chatFull) {
chatFull.flags &=~ 32768;
} else {
chatFull.flags &=~ 67108864;
}
}
}
createGroupInstance(CAPTURE_DEVICE_CAMERA, true);
if (videoState[CAPTURE_DEVICE_SCREEN] == Instance.VIDEO_STATE_ACTIVE) {
createGroupInstance(CAPTURE_DEVICE_SCREEN, true);
@ -2358,7 +2375,7 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
l.onVideoAvailableChange(isVideoAvailable);
}
}
captureDevice[CAPTURE_DEVICE_CAMERA] = 0;
destroyCaptureDevice[CAPTURE_DEVICE_CAMERA] = false;
AndroidUtilities.runOnUIThread(new Runnable() {
@Override

View file

@ -32,7 +32,6 @@ import android.graphics.PixelFormat;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.PorterDuffXfermode;
import android.graphics.RadialGradient;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader;
@ -123,7 +122,6 @@ import java.util.concurrent.CountDownLatch;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.ColorUtils;
public class Theme {
@ -7378,7 +7376,7 @@ public class Theme {
}
}
public static void createCommonChatResources() {
public static void createCommonMessageResources() {
synchronized (sync) {
if (chat_msgTextPaint == null) {
chat_msgTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
@ -7397,6 +7395,10 @@ public class Theme {
chat_msgGameTextPaint.setTextSize(AndroidUtilities.dp(14));
chat_msgBotButtonPaint.setTextSize(AndroidUtilities.dp(15));
}
}
public static void createCommonChatResources() {
createCommonMessageResources();
if (chat_infoPaint == null) {
chat_infoPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
@ -7469,17 +7471,10 @@ public class Theme {
chat_composeBackgroundPaint = new Paint();
chat_radialProgressPausedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
chat_radialProgressPausedSeekbarPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
}
if (chat_actionBackgroundPaint == null) {
chat_actionBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
}
if (chat_actionBackgroundSelectedPaint == null) {
chat_actionBackgroundSelectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
}
if (chat_actionBackgroundPaint2 == null) {
chat_actionBackgroundPaint2 = new Paint(Paint.ANTI_ALIAS_FLAG);
}
if (chat_actionBackgroundSelectedPaint2 == null) {
chat_actionBackgroundSelectedPaint2 = new Paint(Paint.ANTI_ALIAS_FLAG);
}
}

View file

@ -10943,7 +10943,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
canvas.restore();
if (adminLayout != null) {
int color;
if (currentMessageObject.isOutOwner()) {
if (currentMessageObject.shouldDrawWithoutBackground()) {
color = Theme.getColor(Theme.key_chat_stickerReplyNameText);
} else if (currentMessageObject.isOutOwner()) {
color = Theme.getColor(isDrawSelectionBackground() ? Theme.key_chat_outAdminSelectedText : Theme.key_chat_outAdminText);
} else {
color = Theme.getColor(isDrawSelectionBackground() ? Theme.key_chat_inAdminSelectedText : Theme.key_chat_inAdminText);
@ -10972,7 +10974,14 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
ax -= AndroidUtilities.dp(48);
}
} else {
if (!mediaBackground && currentMessageObject.isOutOwner()) {
if (currentMessageObject.shouldDrawWithoutBackground()) {
if (currentMessageObject.isOutOwner()) {
ax = AndroidUtilities.dp(28) + nameWidth - adminLayout.getLineWidth(0);
} else {
ax = backgroundDrawableLeft + transitionParams.deltaLeft + backgroundDrawableRight + AndroidUtilities.dp(22) + nameWidth - adminLayout.getLineWidth(0);
}
} else if (!mediaBackground && currentMessageObject.isOutOwner()) {
ax = backgroundDrawableLeft + backgroundDrawableRight - AndroidUtilities.dp(17) - adminLayout.getLineWidth(0);
} else {
ax = backgroundDrawableLeft + backgroundDrawableRight - AndroidUtilities.dp(11) - adminLayout.getLineWidth(0);
@ -13584,6 +13593,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
private final int REPLY = 497;
private final int COMMENT = 496;
private final int POLL_HINT = 495;
private final int FORWARD = 494;
private Path linkPath = new Path();
private RectF rectF = new RectF();
private Rect rect = new Rect();
@ -13754,7 +13764,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
i++;
}
}
if (currentMessageObject.caption instanceof Spannable) {
if (currentMessageObject.caption instanceof Spannable && captionLayout != null) {
Spannable buffer = (Spannable) currentMessageObject.caption;
CharacterStyle[] links = buffer.getSpans(0, buffer.length(), ClickableSpan.class);
i = 0;
@ -13788,6 +13798,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
if (replyNameLayout != null) {
info.addChild(ChatMessageCell.this, REPLY);
}
if (forwardedNameLayout[0] != null && forwardedNameLayout[1] != null) {
info.addChild(ChatMessageCell.this, FORWARD);
}
if (drawSelectionBackground || getBackground() != null) {
info.setSelected(true);
}
@ -13989,6 +14002,27 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
rect.offset(pos[0], pos[1]);
info.setBoundsInScreen(rect);
info.setClickable(true);
} else if (virtualViewId == FORWARD) {
info.setEnabled(true);
StringBuilder sb = new StringBuilder();
if (forwardedNameLayout[0] != null && forwardedNameLayout[1] != null) {
for (int a = 0; a < 2; a++) {
sb.append(forwardedNameLayout[a].getText());
sb.append(a == 0 ? " " : "\n");
}
}
info.setContentDescription(sb.toString());
info.addAction(AccessibilityNodeInfo.ACTION_CLICK);
int x = (int) Math.min(forwardNameX - forwardNameOffsetX[0], forwardNameX - forwardNameOffsetX[1]);
rect.set(x, forwardNameY, x + forwardedNameWidth, forwardNameY + AndroidUtilities.dp(32));
info.setBoundsInParent(rect);
if (accessibilityVirtualViewBounds.get(virtualViewId) == null || !accessibilityVirtualViewBounds.get(virtualViewId).equals(rect)) {
accessibilityVirtualViewBounds.put(virtualViewId, new Rect(rect));
}
rect.offset(pos[0], pos[1]);
info.setBoundsInScreen(rect);
info.setClickable(true);
} else if (virtualViewId == COMMENT) {
info.setClassName("android.widget.Button");
info.setEnabled(true);
@ -14073,7 +14107,17 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
if (delegate != null && (!isThreadChat || currentMessageObject.getReplyTopMsgId() != 0) && currentMessageObject.hasValidReplyMessageObject()) {
delegate.didPressReplyMessage(ChatMessageCell.this, currentMessageObject.getReplyMsgId());
}
} else if (virtualViewId == COMMENT) {
} else if (virtualViewId == FORWARD) {
if (delegate != null) {
if (currentForwardChannel != null) {
delegate.didPressChannelAvatar(ChatMessageCell.this, currentForwardChannel, currentMessageObject.messageOwner.fwd_from.channel_post, lastTouchX, lastTouchY);
} else if (currentForwardUser != null) {
delegate.didPressUserAvatar(ChatMessageCell.this, currentForwardUser, lastTouchX, lastTouchY);
} else if (currentForwardName != null) {
delegate.didPressHiddenForward(ChatMessageCell.this);
}
}
} else if (virtualViewId == COMMENT) {
if (delegate != null) {
if (isRepliesChat) {
delegate.didPressSideButton(ChatMessageCell.this);

View file

@ -3120,7 +3120,7 @@ public class DialogCell extends BaseCell {
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
if (isFolderCell() && archivedChatsDrawable != null && archivedChatsDrawable.pullProgress == 0.0f) {
if (isFolderCell() && archivedChatsDrawable != null && SharedConfig.archiveHidden && archivedChatsDrawable.pullProgress == 0.0f) {
info.setVisibleToUser(false);
} else {
info.addAction(AccessibilityNodeInfo.ACTION_CLICK);

View file

@ -2234,7 +2234,7 @@ public class ChannelAdminLogActivity extends BaseFragment implements Notificatio
@Override
public void didPressImage(ChatMessageCell cell, float x, float y) {
MessageObject message = cell.getMessageObject();
if (message.type == 13) {
if (message.getInputStickerSet() != null) {
showDialog(new StickersAlert(getParentActivity(), ChannelAdminLogActivity.this, message.getInputStickerSet(), null, null));
} else if (message.isVideo() || message.type == 1 || message.type == 0 && !message.isWebpageDocument() || message.isGif()) {
PhotoViewer.getInstance().setParentActivity(getParentActivity());

View file

@ -56,7 +56,6 @@ import android.text.TextUtils;
import android.text.style.CharacterStyle;
import android.text.style.ForegroundColorSpan;
import android.text.style.URLSpan;
import android.util.Log;
import android.util.LongSparseArray;
import android.util.Property;
import android.util.SparseArray;
@ -6690,28 +6689,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
replyLayout.setOnClickListener(v -> {
if (forwardingMessages != null && !forwardingMessages.isEmpty()) {
int hasPoll = 0;
boolean hasInvoice = false;
for (int a = 0, N = forwardingMessages.size(); a < N; a++) {
MessageObject messageObject = forwardingMessages.get(a);
if (messageObject.isPoll()) {
if (hasPoll != 2) {
hasPoll = messageObject.isPublicPoll() ? 2 : 1;
}
} else if (messageObject.isInvoice()) {
hasInvoice = true;
}
selectedMessagesIds[0].put(messageObject.getId(), messageObject);
}
Bundle args = new Bundle();
args.putBoolean("onlySelect", true);
args.putInt("dialogsType", 3);
args.putInt("hasPoll", hasPoll);
args.putBoolean("hasInvoice", hasInvoice);
args.putInt("messagesCount", forwardingMessages.size());
DialogsActivity fragment = new DialogsActivity(args);
fragment.setDelegate(ChatActivity.this);
presentFragment(fragment);
openAnotherForward();
} else if (replyingMessageObject != null && (!isThreadChat() || replyingMessageObject.getId() != threadMessageId)) {
scrollToMessageId(replyingMessageObject.getId(), 0, true, 0, true, 0);
} else if (editingMessageObject != null) {
@ -6756,28 +6734,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
});
builder.setNegativeButton(LocaleController.getString("SelectOtherChat", R.string.SelectOtherChat), (dialogInterface, i) -> {
if (forwardingMessages != null && !forwardingMessages.isEmpty()) {
int hasPoll = 0;
boolean hasInvoice = false;
for (int a = 0, N = forwardingMessages.size(); a < N; a++) {
MessageObject messageObject = forwardingMessages.get(a);
if (messageObject.isPoll()) {
if (hasPoll != 2) {
hasPoll = messageObject.isPublicPoll() ? 2 : 1;
}
} else if (messageObject.isInvoice()) {
hasInvoice = true;
}
selectedMessagesIds[0].put(messageObject.getId(), messageObject);
}
Bundle args = new Bundle();
args.putBoolean("onlySelect", true);
args.putInt("dialogsType", 3);
args.putInt("hasPoll", hasPoll);
args.putBoolean("hasInvoice", hasInvoice);
args.putInt("messagesCount", forwardingMessages.size());
DialogsActivity fragment = new DialogsActivity(args);
fragment.setDelegate(ChatActivity.this);
presentFragment(fragment);
openAnotherForward();
}
});
builder.show();
@ -7560,6 +7517,31 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
private void openAnotherForward() {
int hasPoll = 0;
boolean hasInvoice = false;
for (int a = 0, N = forwardingMessages.size(); a < N; a++) {
MessageObject messageObject = forwardingMessages.get(a);
if (messageObject.isPoll()) {
if (hasPoll != 2) {
hasPoll = messageObject.isPublicPoll() ? 2 : 1;
}
} else if (messageObject.isInvoice()) {
hasInvoice = true;
}
selectedMessagesIds[0].put(messageObject.getId(), messageObject);
}
Bundle args = new Bundle();
args.putBoolean("onlySelect", true);
args.putInt("dialogsType", 3);
args.putInt("hasPoll", hasPoll);
args.putBoolean("hasInvoice", hasInvoice);
args.putInt("messagesCount", forwardingMessages.size());
DialogsActivity fragment = new DialogsActivity(args);
fragment.setDelegate(ChatActivity.this);
presentFragment(fragment);
}
private void openPinnedMessagesList(boolean preview) {
if (getParentActivity() == null || parentLayout == null || parentLayout.getLastFragment() != this || pinnedMessageIds.isEmpty()) {
return;
@ -10198,7 +10180,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
replyObjectTextView.setLayoutParams(layoutParams2);
chatActivityEnterView.showTopView(true, openKeyboard);
} else {
if (replyingMessageObject == null && forwardingMessages == null && foundWebPage == null && editingMessageObject == null) {
if (replyingMessageObject == null && forwardingMessages == null && foundWebPage == null && editingMessageObject == null && !chatActivityEnterView.isTopViewVisible()) {
return;
}
if (replyingMessageObject != null && replyingMessageObject.messageOwner.reply_markup instanceof TLRPC.TL_replyKeyboardForceReply) {
@ -20210,6 +20192,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
if (dids.size() > 1 || dids.get(0) == getUserConfig().getClientUserId() || message != null) {
forwardingMessages = null;
hideFieldPanel(false);
for (int a = 0; a < dids.size(); a++) {
long did = dids.get(a);
@ -22003,7 +21986,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
cell.invalidate();
SecretMediaViewer.getInstance().setParentActivity(getParentActivity());
SecretMediaViewer.getInstance().openMedia(message, photoViewerProvider, action);
} else if (message.type == MessageObject.TYPE_STICKER || message.type == MessageObject.TYPE_ANIMATED_STICKER) {
} else if (message.getInputStickerSet() != null) {
StickersAlert alert = new StickersAlert(getParentActivity(), ChatActivity.this, message.getInputStickerSet(), null, bottomOverlayChat.getVisibility() != View.VISIBLE && (currentChat == null || ChatObject.canSendStickers(currentChat)) ? chatActivityEnterView : null);
alert.setCalcMandatoryInsets(isKeyboardVisible());
showDialog(alert);

View file

@ -50,6 +50,8 @@ public class AvatarsImageView extends FrameLayout {
int currentStyle;
boolean centered;
private boolean isInCall;
public void commitTransition(boolean animated) {
if (!wasDraw || !animated) {
transitionProgress = 1f;
@ -174,7 +176,7 @@ public class AvatarsImageView extends FrameLayout {
Random random = new Random();
public AvatarsImageView(Context context) {
public AvatarsImageView(Context context, boolean inCall) {
super(context);
for (int a = 0; a < 3; a++) {
currentStates[a] = new DrawingState();
@ -189,6 +191,7 @@ public class AvatarsImageView extends FrameLayout {
animatingStates[a].avatarDrawable = new AvatarDrawable();
animatingStates[a].avatarDrawable.setTextSize(AndroidUtilities.dp(9));
}
isInCall = inCall;
setWillNotDraw(false);
xRefP.setColor(0);
xRefP.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
@ -220,7 +223,11 @@ public class AvatarsImageView extends FrameLayout {
if (id == AccountInstance.getInstance(account).getUserConfig().getClientUserId()) {
animatingStates[index].lastSpeakTime = 0;
} else {
animatingStates[index].lastSpeakTime = participant.lastActiveDate;
if (isInCall) {
animatingStates[index].lastSpeakTime = participant.lastActiveDate;
} else {
animatingStates[index].lastSpeakTime = participant.active_date;
}
}
} else {
animatingStates[index].lastSpeakTime = participant.active_date;

View file

@ -2098,7 +2098,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
CharSequence message = AndroidUtilities.getTrimmedString(charSequence.toString());
if (delegate != null) {
if (!ignoreTextChange) {
if (count > 2 || TextUtils.isEmpty(charSequence)) {
if (before > count + 1 || (count - before) > 2 || TextUtils.isEmpty(charSequence)) {
messageWebPageSearch = true;
}
delegate.onTextChanged(charSequence, before > count + 1 || (count - before) > 2);

View file

@ -404,7 +404,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
updatePlaybackButton();
}
avatars = new AvatarsImageView(context);
avatars = new AvatarsImageView(context, false);
avatars.setDelegate(() -> updateAvatars(true));
avatars.setVisibility(GONE);
addView(avatars, LayoutHelper.createFrame(108, 36, Gravity.LEFT | Gravity.TOP));

View file

@ -329,7 +329,7 @@ public class GroupCallPip implements NotificationCenter.NotificationCenterDelega
button = new GroupCallPipButton(context, currentAccount, false);
windowView.addView(button, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.CENTER));
avatarsImageView = new AvatarsImageView(context);
avatarsImageView = new AvatarsImageView(context, true);
avatarsImageView.setStyle(5);
avatarsImageView.setCentered(true);
avatarsImageView.setVisibility(View.GONE);

View file

@ -433,7 +433,7 @@ public class LinkActionView extends LinearLayout {
public AvatarsContainer(@NonNull Context context) {
super(context);
avatarsImageView = new AvatarsImageView(context) {
avatarsImageView = new AvatarsImageView(context, false) {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int N = Math.min(3, usersCount);

View file

@ -287,7 +287,7 @@ public class GroupCallRenderersContainer extends FrameLayout {
}
};
speakingMembersAvatars = new AvatarsImageView(context);
speakingMembersAvatars = new AvatarsImageView(context, true);
speakingMembersAvatars.setStyle(AvatarsImageView.STYLE_GROUP_CALL_TOOLTIP);
speakingMembersToast.setClipChildren(false);

View file

@ -489,6 +489,11 @@ public abstract class PrivateVideoPreviewDialog extends FrameLayout implements V
}
}
@Override
public void onCameraSwitch(boolean isFrontFace) {
update();
}
public void update() {
if (VoIPService.getSharedInstance() != null) {
textureView.renderer.setMirror(VoIPService.getSharedInstance().isFrontFaceCamera());

View file

@ -3198,6 +3198,9 @@ public class GroupCallActivity extends BottomSheet implements NotificationCenter
if (cell.getUser() == null) {
return;
}
parentActivity.switchToAccount(currentAccount, true);
Bundle args = new Bundle();
args.putInt("user_id", cell.getUser().id);
if (cell.hasAvatarSet()) {
@ -6627,6 +6630,7 @@ public class GroupCallActivity extends BottomSheet implements NotificationCenter
}
}
} else if (option == 6) {
parentActivity.switchToAccount(currentAccount, true);
Bundle args = new Bundle();
if (peerId > 0) {
args.putInt("user_id", peerId);
@ -6636,6 +6640,7 @@ public class GroupCallActivity extends BottomSheet implements NotificationCenter
parentActivity.presentFragment(new ChatActivity(args));
dismiss();
} else if (option == 8) {
parentActivity.switchToAccount(currentAccount, true);
BaseFragment fragment = parentActivity.getActionBarLayout().fragmentsStack.get(parentActivity.getActionBarLayout().fragmentsStack.size() - 1);
if (fragment instanceof ChatActivity) {
if (((ChatActivity) fragment).getDialogId() == peerId) {

View file

@ -6884,6 +6884,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
toggleMiniProgress(buffering, true);
}
}
if (aspectRatioFrameLayout != null) {
aspectRatioFrameLayout.setKeepScreenOn(playWhenReady && (playbackState != ExoPlayer.STATE_ENDED && playbackState != ExoPlayer.STATE_IDLE));
}
if (playWhenReady && (playbackState != ExoPlayer.STATE_ENDED && playbackState != ExoPlayer.STATE_IDLE)) {
try {
parentActivity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);