Update to 5.13.1 (1827)

This commit is contained in:
DrKLO 2020-01-05 14:50:11 +03:00
parent 46be79049e
commit dd07a925ee
33 changed files with 352 additions and 264 deletions

View file

@ -283,7 +283,7 @@ android {
}
}
defaultConfig.versionCode = 1826
defaultConfig.versionCode = 1827
applicationVariants.all { variant ->
variant.outputs.all { output ->

View file

@ -431,9 +431,8 @@ bool LOTLayerItem::resolveKeyPath(LOTKeyPath &keyPath, uint depth,
}
if (!keyPath.skip(name())) {
if (keyPath.fullyResolvesTo(name(), depth) &&
transformProp(value.property())) {
//@TODO handle propery update.
if (keyPath.fullyResolvesTo(name(), depth) && transformProp(value.property())) {
mDirtyFlag = DirtyFlagBit::All;
}
}
return true;
@ -445,7 +444,9 @@ bool LOTShapeLayerItem::resolveKeyPath(LOTKeyPath &keyPath, uint depth,
if (LOTLayerItem::resolveKeyPath(keyPath, depth, value)) {
if (keyPath.propagate(name(), depth)) {
uint newDepth = keyPath.nextDepth(name(), depth);
mRoot->resolveKeyPath(keyPath, newDepth, value);
if (mRoot->resolveKeyPath(keyPath, newDepth, value)) {
mDirtyFlag = DirtyFlagBit::All;
}
}
return true;
}
@ -459,7 +460,9 @@ bool LOTCompLayerItem::resolveKeyPath(LOTKeyPath &keyPath, uint depth,
if (keyPath.propagate(name(), depth)) {
uint newDepth = keyPath.nextDepth(name(), depth);
for (const auto &layer : mLayers) {
layer->resolveKeyPath(keyPath, newDepth, value);
if (layer->resolveKeyPath(keyPath, newDepth, value)) {
mDirtyFlag = DirtyFlagBit::All;
}
}
}
return true;

View file

@ -533,7 +533,9 @@ int32_t ConnectionSocket::checkSocketError(int32_t *error) {
void ConnectionSocket::closeSocket(int32_t reason, int32_t error) {
lastEventTime = ConnectionsManager::getInstance(instanceNum).getCurrentTimeMonotonicMillis();
ConnectionsManager::getInstance(instanceNum).detachConnection(this);
if (reason != 2) {
ConnectionsManager::getInstance(instanceNum).detachConnection(this);
}
if (socketFd >= 0) {
epoll_ctl(ConnectionsManager::getInstance(instanceNum).epolFd, EPOLL_CTL_DEL, socketFd, nullptr);
if (close(socketFd) != 0) {
@ -977,15 +979,17 @@ time_t ConnectionSocket::getTimeout() {
return timeout;
}
void ConnectionSocket::checkTimeout(int64_t now) {
bool ConnectionSocket::checkTimeout(int64_t now) {
if (timeout != 0 && (now - lastEventTime) > (int64_t) timeout * 1000) {
if (!onConnectedSent || hasPendingRequests()) {
closeSocket(2, 0);
return true;
} else {
lastEventTime = ConnectionsManager::getInstance(instanceNum).getCurrentTimeMonotonicMillis();
if (LOGS_ENABLED) DEBUG_D("connection(%p) reset last event time, no requests", this);
}
}
return false;
}
bool ConnectionSocket::hasTlsHashMismatch() {

View file

@ -38,7 +38,7 @@ public:
protected:
int32_t instanceNum;
void onEvent(uint32_t events);
void checkTimeout(int64_t now);
bool checkTimeout(int64_t now);
void resetLastEventTime();
bool hasTlsHashMismatch();
virtual void onReceivedData(NativeByteBuffer *buffer) = 0;

View file

@ -197,9 +197,12 @@ void ConnectionsManager::select() {
EventObject *eventObject = (EventObject *) epollEvents[a].data.ptr;
eventObject->onEvent(epollEvents[a].events);
}
size_t count = activeConnections.size();
for (uint32_t a = 0; a < count; a++) {
activeConnections[a]->checkTimeout(now);
for (std::vector<ConnectionSocket *>::iterator iter = activeConnections.begin(); iter != activeConnections.end();) {
if ((*iter)->checkTimeout(now)) {
iter = activeConnections.erase(iter);
} else {
iter++;
}
}
Datacenter *datacenter = getDatacenterWithId(currentDatacenterId);
@ -2225,7 +2228,7 @@ void ConnectionsManager::processRequestQueue(uint32_t connectionTypes, uint32_t
uint32_t retryMax = 10;
if (!(request->requestFlags & RequestFlagForceDownload)) {
if (request->failedByFloodWait) {
retryMax = 1;
retryMax = 2;
} else {
retryMax = 6;
}

View file

@ -19,7 +19,7 @@ public class BuildVars {
public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true;
public static boolean TON_WALLET_STANDALONE = false;
public static int BUILD_VERSION = 1826;
public static int BUILD_VERSION = 1827;
public static String BUILD_VERSION_STRING = "5.13.0";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";

View file

@ -2776,7 +2776,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
return true;
}
public boolean resumeAudio(MessageObject messageObject) {
private boolean resumeAudio(MessageObject messageObject) {
if (audioPlayer == null && videoPlayer == null || messageObject == null || playingMessageObject == null || !isSamePlayingMessage(messageObject)) {
return false;
}

View file

@ -403,8 +403,8 @@ public class MessageObject {
isOut = messageObject.isOutOwner();
needShare = !isOut && (
messageObject.messageOwner.fwd_from != null && messageObject.messageOwner.fwd_from.saved_from_peer != null ||
messageObject.messageOwner.from_id > 0 && (messageObject.messageOwner.to_id.channel_id != 0 || messageObject.messageOwner.to_id.chat_id != 0 ||
messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaGame || messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaInvoice)
messageObject.messageOwner.from_id > 0 && (messageObject.messageOwner.to_id.channel_id != 0 || messageObject.messageOwner.to_id.chat_id != 0 ||
messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaGame || messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaInvoice)
);
}
TLRPC.PhotoSize photoSize = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, AndroidUtilities.getPhotoSize());
@ -1770,6 +1770,9 @@ public class MessageObject {
}
public static void updatePollResults(TLRPC.TL_messageMediaPoll media, TLRPC.TL_pollResults results) {
if (media == null || results == null) {
return;
}
if ((results.flags & 2) != 0) {
byte[] chosen = null;
if (results.min && media.results.results != null) {
@ -3096,7 +3099,7 @@ public class MessageObject {
matcher = instagramUrlPattern.matcher(charSequence);
} else {
if (urlPattern == null) {
urlPattern = Pattern.compile("(^|\\s)/[a-zA-Z@\\d_]{1,255}|(^|\\s|\\()@[a-zA-Z\\d_]{1,32}|(^|\\s|\\()#[\\w.]+|(^|\\s)\\$[A-Z]{3,8}([ ,.]|$)");
urlPattern = Pattern.compile("(^|\\s)/[a-zA-Z@\\d_]{1,255}|(^|\\s|\\()@[a-zA-Z\\d_]{1,32}|(^|\\s|\\()#[^0-9][\\w.]+|(^|\\s)\\$[A-Z]{3,8}([ ,.]|$)");
}
matcher = urlPattern.matcher(charSequence);
}

View file

@ -133,7 +133,7 @@ public class NotificationCenter {
public static final int audioRouteChanged = totalEvents++;
public static final int didStartedCall = totalEvents++;
public static final int didEndedCall = totalEvents++;
public static final int didEndCall = totalEvents++;
public static final int closeInCallActivity = totalEvents++;
public static final int appDidLogout = totalEvents++;

View file

@ -224,21 +224,18 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
if (locationQueryCancelRunnable != null) {
AndroidUtilities.cancelRunOnUIThread(locationQueryCancelRunnable);
}
locationQueryCancelRunnable = new Runnable() {
@Override
public void run() {
if (locationQueryCancelRunnable != this) {
return;
}
if (delegate != null) {
if (lastKnownLocation != null) {
delegate.onLocationAcquired(lastKnownLocation);
} else {
delegate.onUnableLocationAcquire();
}
}
cleanup();
locationQueryCancelRunnable = () -> {
if (locationQueryCancelRunnable != this) {
return;
}
if (delegate != null) {
if (lastKnownLocation != null) {
delegate.onLocationAcquired(lastKnownLocation);
} else {
delegate.onUnableLocationAcquire();
}
}
cleanup();
};
AndroidUtilities.runOnUIThread(locationQueryCancelRunnable, 5000);
}
@ -1546,18 +1543,20 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
sentCount++;
if (scheduleDate != 0 && !currentSchedule) {
ArrayList<Integer> messageIds = new ArrayList<>();
messageIds.add(oldId);
getMessagesController().deleteMessages(messageIds, null, null, newMsgObj1.dialog_id, newMsgObj1.to_id.channel_id, false, true);
getMessagesStorage().getStorageQueue().postRunnable(() -> {
getMessagesStorage().putMessages(sentMessages, true, false, false, 0, false);
AndroidUtilities.runOnUIThread(() -> {
ArrayList<MessageObject> messageObjects = new ArrayList<>();
messageObjects.add(new MessageObject(msgObj.currentAccount, msgObj.messageOwner, true));
getMessagesController().updateInterfaceWithMessages(newMsgObj1.dialog_id, messageObjects, false);
getMediaDataController().increasePeerRaiting(newMsgObj1.dialog_id);
processSentMessage(oldId);
removeFromSendingMessages(oldId, scheduleDate != 0);
AndroidUtilities.runOnUIThread(() -> {
ArrayList<Integer> messageIds = new ArrayList<>();
messageIds.add(oldId);
getMessagesController().deleteMessages(messageIds, null, null, newMsgObj1.dialog_id, newMsgObj1.to_id.channel_id, false, true);
getMessagesStorage().getStorageQueue().postRunnable(() -> {
getMessagesStorage().putMessages(sentMessages, true, false, false, 0, false);
AndroidUtilities.runOnUIThread(() -> {
ArrayList<MessageObject> messageObjects = new ArrayList<>();
messageObjects.add(new MessageObject(msgObj.currentAccount, msgObj.messageOwner, true));
getMessagesController().updateInterfaceWithMessages(newMsgObj1.dialog_id, messageObjects, false);
getMediaDataController().increasePeerRaiting(newMsgObj1.dialog_id);
processSentMessage(oldId);
removeFromSendingMessages(oldId, scheduleDate != 0);
});
});
});
} else {
@ -2068,13 +2067,10 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
getMessagesController().processUpdates((TLRPC.Updates) response, false);
voteSendTime.put(messageObject.getPollId(), SystemClock.uptimeMillis());
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
waitingForVote.remove(key);
if (finishRunnable != null) {
finishRunnable.run();
}
AndroidUtilities.runOnUIThread(() -> {
waitingForVote.remove(key);
if (finishRunnable != null) {
finishRunnable.run();
}
});
});
@ -4037,143 +4033,142 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
for (int a = 0, size = msgObjs.size(); a < size; a++) {
putToSendingMessages(msgObjs.get(a).messageOwner, scheduled);
}
getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
getConnectionsManager().sendRequest(req, (response, error) -> {
if (error != null && FileRefController.isFileRefError(error.text)) {
if (parentObjects != null) {
ArrayList<Object> arrayList = new ArrayList<>(parentObjects);
getFileRefController().requestReference(arrayList, req, msgObjs, originalPaths, arrayList, delayedMessage, scheduled);
return;
} else if (delayedMessage != null) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
for (int a = 0, size = req.multi_media.size(); a < size; a++) {
if (delayedMessage.parentObjects.get(a) == null) {
continue;
}
removeFromSendingMessages(msgObjs.get(a).getId(), scheduled);
TLRPC.TL_inputSingleMedia request = req.multi_media.get(a);
if (request.media instanceof TLRPC.TL_inputMediaPhoto) {
request.media = delayedMessage.inputMedias.get(a);
} else if (request.media instanceof TLRPC.TL_inputMediaDocument) {
request.media = delayedMessage.inputMedias.get(a);
}
delayedMessage.videoEditedInfo = delayedMessage.videoEditedInfos.get(a);
delayedMessage.httpLocation = delayedMessage.httpLocations.get(a);
delayedMessage.photoSize = delayedMessage.locations.get(a);
delayedMessage.performMediaUpload = true;
performSendDelayedMessage(delayedMessage, a);
AndroidUtilities.runOnUIThread(() -> {
for (int a = 0, size = req.multi_media.size(); a < size; a++) {
if (delayedMessage.parentObjects.get(a) == null) {
continue;
}
removeFromSendingMessages(msgObjs.get(a).getId(), scheduled);
TLRPC.TL_inputSingleMedia request = req.multi_media.get(a);
if (request.media instanceof TLRPC.TL_inputMediaPhoto) {
request.media = delayedMessage.inputMedias.get(a);
} else if (request.media instanceof TLRPC.TL_inputMediaDocument) {
request.media = delayedMessage.inputMedias.get(a);
}
delayedMessage.videoEditedInfo = delayedMessage.videoEditedInfos.get(a);
delayedMessage.httpLocation = delayedMessage.httpLocations.get(a);
delayedMessage.photoSize = delayedMessage.locations.get(a);
delayedMessage.performMediaUpload = true;
performSendDelayedMessage(delayedMessage, a);
}
});
return;
}
}
boolean isSentError = false;
if (error == null) {
SparseArray<TLRPC.Message> newMessages = new SparseArray<>();
LongSparseArray<Integer> newIds = new LongSparseArray<>();
final TLRPC.Updates updates = (TLRPC.Updates) response;
ArrayList<TLRPC.Update> updatesArr = ((TLRPC.Updates) response).updates;
for (int a = 0; a < updatesArr.size(); a++) {
TLRPC.Update update = updatesArr.get(a);
if (update instanceof TLRPC.TL_updateMessageID) {
TLRPC.TL_updateMessageID updateMessageID = (TLRPC.TL_updateMessageID) update;
newIds.put(updateMessageID.random_id, updateMessageID.id);
updatesArr.remove(a);
a--;
} else if (update instanceof TLRPC.TL_updateNewMessage) {
final TLRPC.TL_updateNewMessage newMessage = (TLRPC.TL_updateNewMessage) update;
newMessages.put(newMessage.message.id, newMessage.message);
Utilities.stageQueue.postRunnable(() -> getMessagesController().processNewDifferenceParams(-1, newMessage.pts, -1, newMessage.pts_count));
updatesArr.remove(a);
a--;
} else if (update instanceof TLRPC.TL_updateNewChannelMessage) {
final TLRPC.TL_updateNewChannelMessage newMessage = (TLRPC.TL_updateNewChannelMessage) update;
newMessages.put(newMessage.message.id, newMessage.message);
Utilities.stageQueue.postRunnable(() -> getMessagesController().processNewChannelDifferenceParams(newMessage.pts, newMessage.pts_count, newMessage.message.to_id.channel_id));
updatesArr.remove(a);
a--;
} else if (update instanceof TLRPC.TL_updateNewScheduledMessage) {
final TLRPC.TL_updateNewScheduledMessage newMessage = (TLRPC.TL_updateNewScheduledMessage) update;
newMessages.put(newMessage.message.id, newMessage.message);
updatesArr.remove(a);
a--;
AndroidUtilities.runOnUIThread(() -> {
boolean isSentError = false;
if (error == null) {
SparseArray<TLRPC.Message> newMessages = new SparseArray<>();
LongSparseArray<Integer> newIds = new LongSparseArray<>();
final TLRPC.Updates updates = (TLRPC.Updates) response;
ArrayList<TLRPC.Update> updatesArr = ((TLRPC.Updates) response).updates;
for (int a = 0; a < updatesArr.size(); a++) {
TLRPC.Update update = updatesArr.get(a);
if (update instanceof TLRPC.TL_updateMessageID) {
TLRPC.TL_updateMessageID updateMessageID = (TLRPC.TL_updateMessageID) update;
newIds.put(updateMessageID.random_id, updateMessageID.id);
updatesArr.remove(a);
a--;
} else if (update instanceof TLRPC.TL_updateNewMessage) {
final TLRPC.TL_updateNewMessage newMessage = (TLRPC.TL_updateNewMessage) update;
newMessages.put(newMessage.message.id, newMessage.message);
Utilities.stageQueue.postRunnable(() -> getMessagesController().processNewDifferenceParams(-1, newMessage.pts, -1, newMessage.pts_count));
updatesArr.remove(a);
a--;
} else if (update instanceof TLRPC.TL_updateNewChannelMessage) {
final TLRPC.TL_updateNewChannelMessage newMessage = (TLRPC.TL_updateNewChannelMessage) update;
newMessages.put(newMessage.message.id, newMessage.message);
Utilities.stageQueue.postRunnable(() -> getMessagesController().processNewChannelDifferenceParams(newMessage.pts, newMessage.pts_count, newMessage.message.to_id.channel_id));
updatesArr.remove(a);
a--;
} else if (update instanceof TLRPC.TL_updateNewScheduledMessage) {
final TLRPC.TL_updateNewScheduledMessage newMessage = (TLRPC.TL_updateNewScheduledMessage) update;
newMessages.put(newMessage.message.id, newMessage.message);
updatesArr.remove(a);
a--;
}
}
}
for (int i = 0; i < msgObjs.size(); i++) {
final MessageObject msgObj = msgObjs.get(i);
final String originalPath = originalPaths.get(i);
final TLRPC.Message newMsgObj = msgObj.messageOwner;
final int oldId = newMsgObj.id;
final ArrayList<TLRPC.Message> sentMessages = new ArrayList<>();
final String attachPath = newMsgObj.attachPath;
final long grouped_id;
final int existFlags;
for (int i = 0; i < msgObjs.size(); i++) {
final MessageObject msgObj = msgObjs.get(i);
final String originalPath = originalPaths.get(i);
final TLRPC.Message newMsgObj = msgObj.messageOwner;
final int oldId = newMsgObj.id;
final ArrayList<TLRPC.Message> sentMessages = new ArrayList<>();
final String attachPath = newMsgObj.attachPath;
final long grouped_id;
final int existFlags;
Integer id = newIds.get(newMsgObj.random_id);
if (id != null) {
TLRPC.Message message = newMessages.get(id);
if (message != null) {
sentMessages.add(message);
updateMediaPaths(msgObj, message, message.id, originalPath, false);
existFlags = msgObj.getMediaExistanceFlags();
newMsgObj.id = message.id;
if ((newMsgObj.flags & TLRPC.MESSAGE_FLAG_MEGAGROUP) != 0) {
message.flags |= TLRPC.MESSAGE_FLAG_MEGAGROUP;
}
grouped_id = message.grouped_id;
if (!scheduled) {
Integer value = getMessagesController().dialogs_read_outbox_max.get(message.dialog_id);
if (value == null) {
value = getMessagesStorage().getDialogReadMax(message.out, message.dialog_id);
getMessagesController().dialogs_read_outbox_max.put(message.dialog_id, value);
Integer id = newIds.get(newMsgObj.random_id);
if (id != null) {
TLRPC.Message message = newMessages.get(id);
if (message != null) {
sentMessages.add(message);
updateMediaPaths(msgObj, message, message.id, originalPath, false);
existFlags = msgObj.getMediaExistanceFlags();
newMsgObj.id = message.id;
if ((newMsgObj.flags & TLRPC.MESSAGE_FLAG_MEGAGROUP) != 0) {
message.flags |= TLRPC.MESSAGE_FLAG_MEGAGROUP;
}
message.unread = value < message.id;
grouped_id = message.grouped_id;
if (!scheduled) {
Integer value = getMessagesController().dialogs_read_outbox_max.get(message.dialog_id);
if (value == null) {
value = getMessagesStorage().getDialogReadMax(message.out, message.dialog_id);
getMessagesController().dialogs_read_outbox_max.put(message.dialog_id, value);
}
message.unread = value < message.id;
}
} else {
isSentError = true;
break;
}
} else {
isSentError = true;
break;
}
} else {
isSentError = true;
break;
}
if (!isSentError) {
getStatsController().incrementSentItemsCount(ApplicationLoader.getCurrentNetworkType(), StatsController.TYPE_MESSAGES, 1);
newMsgObj.send_state = MessageObject.MESSAGE_SEND_STATE_SENT;
getNotificationCenter().postNotificationName(NotificationCenter.messageReceivedByServer, oldId, newMsgObj.id, newMsgObj, newMsgObj.dialog_id, grouped_id, existFlags, scheduled);
getMessagesStorage().getStorageQueue().postRunnable(() -> {
getMessagesStorage().updateMessageStateAndId(newMsgObj.random_id, oldId, newMsgObj.id, 0, false, newMsgObj.to_id.channel_id, scheduled ? 1 : 0);
getMessagesStorage().putMessages(sentMessages, true, false, false, 0, scheduled);
AndroidUtilities.runOnUIThread(() -> {
getMediaDataController().increasePeerRaiting(newMsgObj.dialog_id);
getNotificationCenter().postNotificationName(NotificationCenter.messageReceivedByServer, oldId, newMsgObj.id, newMsgObj, newMsgObj.dialog_id, grouped_id, existFlags, scheduled);
processSentMessage(oldId);
removeFromSendingMessages(oldId, scheduled);
if (!isSentError) {
getStatsController().incrementSentItemsCount(ApplicationLoader.getCurrentNetworkType(), StatsController.TYPE_MESSAGES, 1);
newMsgObj.send_state = MessageObject.MESSAGE_SEND_STATE_SENT;
getNotificationCenter().postNotificationName(NotificationCenter.messageReceivedByServer, oldId, newMsgObj.id, newMsgObj, newMsgObj.dialog_id, grouped_id, existFlags, scheduled);
getMessagesStorage().getStorageQueue().postRunnable(() -> {
getMessagesStorage().updateMessageStateAndId(newMsgObj.random_id, oldId, newMsgObj.id, 0, false, newMsgObj.to_id.channel_id, scheduled ? 1 : 0);
getMessagesStorage().putMessages(sentMessages, true, false, false, 0, scheduled);
AndroidUtilities.runOnUIThread(() -> {
getMediaDataController().increasePeerRaiting(newMsgObj.dialog_id);
getNotificationCenter().postNotificationName(NotificationCenter.messageReceivedByServer, oldId, newMsgObj.id, newMsgObj, newMsgObj.dialog_id, grouped_id, existFlags, scheduled);
processSentMessage(oldId);
removeFromSendingMessages(oldId, scheduled);
});
});
});
}
}
Utilities.stageQueue.postRunnable(() -> getMessagesController().processUpdates(updates, false));
} else {
AlertsCreator.processError(currentAccount, error, null, req);
isSentError = true;
}
if (isSentError) {
for (int i = 0; i < msgObjs.size(); i++) {
TLRPC.Message newMsgObj = msgObjs.get(i).messageOwner;
getMessagesStorage().markMessageAsSendError(newMsgObj, scheduled);
newMsgObj.send_state = MessageObject.MESSAGE_SEND_STATE_SEND_ERROR;
getNotificationCenter().postNotificationName(NotificationCenter.messageSendError, newMsgObj.id);
processSentMessage(newMsgObj.id);
removeFromSendingMessages(newMsgObj.id, scheduled);
}
}
Utilities.stageQueue.postRunnable(() -> getMessagesController().processUpdates(updates, false));
} else {
AlertsCreator.processError(currentAccount, error, null, req);
isSentError = true;
}
if (isSentError) {
for (int i = 0; i < msgObjs.size(); i++) {
TLRPC.Message newMsgObj = msgObjs.get(i).messageOwner;
getMessagesStorage().markMessageAsSendError(newMsgObj, scheduled);
newMsgObj.send_state = MessageObject.MESSAGE_SEND_STATE_SEND_ERROR;
getNotificationCenter().postNotificationName(NotificationCenter.messageSendError, newMsgObj.id);
processSentMessage(newMsgObj.id);
removeFromSendingMessages(newMsgObj.id, scheduled);
}
}
}), null, ConnectionsManager.RequestFlagCanCompress | ConnectionsManager.RequestFlagInvokeAfter);
});
}, null, ConnectionsManager.RequestFlagCanCompress | ConnectionsManager.RequestFlagInvokeAfter);
}
private void performSendMessageRequest(final TLObject req, final MessageObject msgObj, final String originalPath, DelayedMessage delayedMessage, Object parentObject, boolean scheduled) {
@ -4228,28 +4223,25 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
getFileRefController().requestReference(parentObject, req, msgObj, originalPath, parentMessage, check, delayedMessage, scheduled);
return;
} else if (delayedMessage != null) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
removeFromSendingMessages(newMsgObj.id, scheduled);
if (req instanceof TLRPC.TL_messages_sendMedia) {
TLRPC.TL_messages_sendMedia request = (TLRPC.TL_messages_sendMedia) req;
if (request.media instanceof TLRPC.TL_inputMediaPhoto) {
request.media = delayedMessage.inputUploadMedia;
} else if (request.media instanceof TLRPC.TL_inputMediaDocument) {
request.media = delayedMessage.inputUploadMedia;
}
} else if (req instanceof TLRPC.TL_messages_editMessage) {
TLRPC.TL_messages_editMessage request = (TLRPC.TL_messages_editMessage) req;
if (request.media instanceof TLRPC.TL_inputMediaPhoto) {
request.media = delayedMessage.inputUploadMedia;
} else if (request.media instanceof TLRPC.TL_inputMediaDocument) {
request.media = delayedMessage.inputUploadMedia;
}
AndroidUtilities.runOnUIThread(() -> {
removeFromSendingMessages(newMsgObj.id, scheduled);
if (req instanceof TLRPC.TL_messages_sendMedia) {
TLRPC.TL_messages_sendMedia request = (TLRPC.TL_messages_sendMedia) req;
if (request.media instanceof TLRPC.TL_inputMediaPhoto) {
request.media = delayedMessage.inputUploadMedia;
} else if (request.media instanceof TLRPC.TL_inputMediaDocument) {
request.media = delayedMessage.inputUploadMedia;
}
} else if (req instanceof TLRPC.TL_messages_editMessage) {
TLRPC.TL_messages_editMessage request = (TLRPC.TL_messages_editMessage) req;
if (request.media instanceof TLRPC.TL_inputMediaPhoto) {
request.media = delayedMessage.inputUploadMedia;
} else if (request.media instanceof TLRPC.TL_inputMediaDocument) {
request.media = delayedMessage.inputUploadMedia;
}
delayedMessage.performMediaUpload = true;
performSendDelayedMessage(delayedMessage);
}
delayedMessage.performMediaUpload = true;
performSendDelayedMessage(delayedMessage);
});
return;
}

View file

@ -594,7 +594,7 @@ public abstract class VoIPBaseService extends Service implements SensorEventList
AndroidUtilities.runOnUIThread(new Runnable(){
@Override
public void run(){
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.didEndedCall);
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.didEndCall);
}
});
if (controller != null && controllerStarted) {

View file

@ -112,7 +112,12 @@ public class AlertDialog extends Dialog implements Drawable.Callback {
private Rect backgroundPaddings;
private Runnable dismissRunnable = this::dismiss;
private Runnable showRunnable = this::show;
private Runnable showRunnable = () -> {
if (isShowing()) {
return;
}
show();
};
private ArrayList<AlertDialogCell> itemViews = new ArrayList<>();
@ -1026,6 +1031,7 @@ public class AlertDialog extends Dialog implements Drawable.Callback {
}
public void showDelayed(long delay) {
AndroidUtilities.cancelRunOnUIThread(showRunnable);
AndroidUtilities.runOnUIThread(showRunnable, delay);
}

View file

@ -1167,6 +1167,9 @@ public class Theme {
}
ThemeAccent defaultAccent = themeAccentsMap.get(DEFALT_THEME_ACCENT_ID);
ThemeAccent accent = themeAccentsMap.get(currentAccentId);
if (defaultAccent == null || accent == null) {
return false;
}
return defaultAccent.myMessagesAccentColor == accent.myMessagesAccentColor && defaultAccent.myMessagesGradientAccentColor == accent.myMessagesGradientAccentColor;
}
@ -5996,28 +5999,38 @@ public class Theme {
setDrawableColorByKey(avatar_savedDrawable, key_avatar_text);
dialogs_archiveAvatarDrawable.setLayerColor("Arrow1.**", getColor(key_avatar_backgroundArchived));
dialogs_archiveAvatarDrawable.setLayerColor("Arrow2.**", getColor(key_avatar_backgroundArchived));
dialogs_archiveAvatarDrawable.setLayerColor("Box2.**", getColor(key_avatar_text));
dialogs_archiveAvatarDrawable.setLayerColor("Box1.**", getColor(key_avatar_text));
dialogs_archiveAvatarDrawable.beginApplyLayerColors();
dialogs_archiveAvatarDrawable.setLayerColor("Arrow1.**", getNonAnimatedColor(key_avatar_backgroundArchived));
dialogs_archiveAvatarDrawable.setLayerColor("Arrow2.**", getNonAnimatedColor(key_avatar_backgroundArchived));
dialogs_archiveAvatarDrawable.setLayerColor("Box2.**", getNonAnimatedColor(key_avatar_text));
dialogs_archiveAvatarDrawable.setLayerColor("Box1.**", getNonAnimatedColor(key_avatar_text));
dialogs_archiveAvatarDrawable.commitApplyLayerColors();
dialogs_archiveAvatarDrawableRecolored = false;
dialogs_archiveAvatarDrawable.setAllowDecodeSingleFrame(true);
dialogs_pinArchiveDrawable.setLayerColor("Arrow.**", getColor(key_chats_archiveIcon));
dialogs_pinArchiveDrawable.setLayerColor("Line.**", getColor(key_chats_archiveIcon));
dialogs_unpinArchiveDrawable.setLayerColor("Arrow.**", getColor(key_chats_archiveIcon));
dialogs_unpinArchiveDrawable.setLayerColor("Line.**", getColor(key_chats_archiveIcon));
dialogs_archiveDrawable.setLayerColor("Arrow.**", getColor(key_chats_archiveBackground));
dialogs_archiveDrawable.setLayerColor("Box2.**", getColor(key_chats_archiveIcon));
dialogs_archiveDrawable.setLayerColor("Box1.**", getColor(key_chats_archiveIcon));
dialogs_pinArchiveDrawable.beginApplyLayerColors();
dialogs_pinArchiveDrawable.setLayerColor("Arrow.**", getNonAnimatedColor(key_chats_archiveIcon));
dialogs_pinArchiveDrawable.setLayerColor("Line.**", getNonAnimatedColor(key_chats_archiveIcon));
dialogs_pinArchiveDrawable.commitApplyLayerColors();
dialogs_unpinArchiveDrawable.beginApplyLayerColors();
dialogs_unpinArchiveDrawable.setLayerColor("Arrow.**", getNonAnimatedColor(key_chats_archiveIcon));
dialogs_unpinArchiveDrawable.setLayerColor("Line.**", getNonAnimatedColor(key_chats_archiveIcon));
dialogs_unpinArchiveDrawable.commitApplyLayerColors();
dialogs_archiveDrawable.beginApplyLayerColors();
dialogs_archiveDrawable.setLayerColor("Arrow.**", getNonAnimatedColor(key_chats_archiveBackground));
dialogs_archiveDrawable.setLayerColor("Box2.**", getNonAnimatedColor(key_chats_archiveIcon));
dialogs_archiveDrawable.setLayerColor("Box1.**", getNonAnimatedColor(key_chats_archiveIcon));
dialogs_archiveDrawable.commitApplyLayerColors();
dialogs_archiveDrawableRecolored = false;
dialogs_unarchiveDrawable.setLayerColor("Arrow1.**", getColor(key_chats_archiveIcon));
dialogs_unarchiveDrawable.setLayerColor("Arrow2.**", getColor(key_chats_archivePinBackground));
dialogs_unarchiveDrawable.setLayerColor("Box2.**", getColor(key_chats_archiveIcon));
dialogs_unarchiveDrawable.setLayerColor("Box1.**", getColor(key_chats_archiveIcon));
dialogs_unarchiveDrawable.beginApplyLayerColors();
dialogs_unarchiveDrawable.setLayerColor("Arrow1.**", getNonAnimatedColor(key_chats_archiveIcon));
dialogs_unarchiveDrawable.setLayerColor("Arrow2.**", getNonAnimatedColor(key_chats_archivePinBackground));
dialogs_unarchiveDrawable.setLayerColor("Box2.**", getNonAnimatedColor(key_chats_archiveIcon));
dialogs_unarchiveDrawable.setLayerColor("Box1.**", getNonAnimatedColor(key_chats_archiveIcon));
dialogs_unarchiveDrawable.commitApplyLayerColors();
}
public static void createDialogsResources(Context context) {
@ -6835,6 +6848,10 @@ public class Theme {
return 0;
}
public static int getNonAnimatedColor(String key) {
return getColor(key, null, true);
}
public static int getColor(String key) {
return getColor(key, null, false);
}

View file

@ -401,7 +401,7 @@ public class SearchAdapterHelper {
return;
}
boolean changed = false;
Pattern pattern = Pattern.compile("(^|\\s)#[\\w@.]+");
Pattern pattern = Pattern.compile("(^|\\s)#[^0-9][\\w@.]+");
Matcher matcher = pattern.matcher(message);
while (matcher.find()) {
int start = matcher.start();

View file

@ -884,7 +884,7 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
listView[1].setAlpha(1.0f);
listView[1].setTranslationX(0.0f);
listView[0].setBackgroundColor(backgroundPaint.getColor());
updateInterfaceForCurrentPage(true, 0);
updateInterfaceForCurrentPage(true, -1);
} else {
movingPage = false;
}

View file

@ -5629,6 +5629,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
needNewVisiblePart = false;
}
forceNotDrawTime = currentMessagesGroup != null;
photoImage.setPressed((isHighlightedAnimated || isHighlighted) && currentPosition != null ? 2 : 0);
photoImage.setVisible(!PhotoViewer.isShowingImage(currentMessageObject) && !SecretMediaViewer.getInstance().isShowingImage(currentMessageObject), false);
if (!photoImage.getVisible()) {
mediaWasInvisible = true;
@ -6540,6 +6541,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
public void updateButtonState(boolean ifSame, boolean animated, boolean fromSet) {
if (currentMessageObject == null) {
return;
}
if (animated && (PhotoViewer.isShowingImage(currentMessageObject) || !attachedToWindow)) {
animated = false;
}
@ -7964,14 +7968,15 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
Drawable drawable = a == 0 ? currentBackgroundDrawable : currentBackgroundSelectedDrawable;
if (drawable instanceof Theme.MessageDrawable) {
Theme.MessageDrawable messageDrawable = (Theme.MessageDrawable) drawable;
if (parentHeight == 0) {
parentHeight = AndroidUtilities.displaySize.y;
int h = parentHeight;
if (h == 0) {
h = AndroidUtilities.displaySize.y;
if (getParent() instanceof View) {
View view = (View) getParent();
parentHeight = view.getMeasuredHeight();
h = view.getMeasuredHeight();
}
}
messageDrawable.setTop(getTop(), parentHeight);
messageDrawable.setTop(getTop(), h);
}
}
if (isHighlightedAnimated) {
@ -9186,7 +9191,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
AccessibilityEvent event = AccessibilityEvent.obtain(eventType);
event.setPackageName(getContext().getPackageName());
event.setSource(ChatMessageCell.this, viewId);
getParent().requestSendAccessibilityEvent(ChatMessageCell.this, event);
if (getParent() != null) {
getParent().requestSendAccessibilityEvent(ChatMessageCell.this, event);
}
}
}

View file

@ -1724,7 +1724,7 @@ public class DialogCell extends BaseCell {
Theme.dialogs_pinnedPaint.setColor(backgroundColor);
canvas.drawRect(tx - AndroidUtilities.dp(8), 0, getMeasuredWidth(), getMeasuredHeight(), Theme.dialogs_pinnedPaint);
if (currentRevealProgress == 0 && Theme.dialogs_archiveDrawableRecolored) {
Theme.dialogs_archiveDrawable.setLayerColor("Arrow.**", Theme.getColor(Theme.key_chats_archiveBackground));
Theme.dialogs_archiveDrawable.setLayerColor("Arrow.**", Theme.getNonAnimatedColor(Theme.key_chats_archiveBackground));
Theme.dialogs_archiveDrawableRecolored = false;
}
}
@ -1743,7 +1743,7 @@ public class DialogCell extends BaseCell {
canvas.restore();
if (!Theme.dialogs_archiveDrawableRecolored) {
Theme.dialogs_archiveDrawable.setLayerColor("Arrow.**", Theme.getColor(Theme.key_chats_archivePinBackground));
Theme.dialogs_archiveDrawable.setLayerColor("Arrow.**", Theme.getNonAnimatedColor(Theme.key_chats_archivePinBackground));
Theme.dialogs_archiveDrawableRecolored = true;
}
}

View file

@ -1315,7 +1315,9 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
return;
}
CharSequence str = getTextForCopy();
if (str == null) {
return;
}
android.content.ClipboardManager clipboard = (android.content.ClipboardManager) ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE);
android.content.ClipData clip = android.content.ClipData.newPlainText("label", str);
clipboard.setPrimaryClip(clip);
@ -1327,7 +1329,11 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
}
protected CharSequence getTextForCopy() {
return getText(selectedView, false).subSequence(selectionStart, selectionEnd);
CharSequence text = getText(selectedView, false);
if (text != null) {
return text.subSequence(selectionStart, selectionEnd);
}
return null;
}
protected int[] offsetToCord(int offset) {
@ -1540,14 +1546,14 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
}
MessageObject selectedMessageObject = selectedView.getMessageObject();
if (selectedMessageObject == null) {
if (selectedMessageObject == null || selectedMessageObject.textLayoutBlocks == null) {
return;
}
if (messageObject.getId() == selectedCellId) {
int selectionStart = this.selectionStart;
int selectionEnd = this.selectionEnd;
if (selectedView.getMessageObject().textLayoutBlocks.size() > 1) {
if (selectedMessageObject.textLayoutBlocks.size() > 1) {
if (selectionStart < block.charactersOffset) {
selectionStart = block.charactersOffset;
}
@ -2334,9 +2340,17 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
int n = startViewPosition == endViewPosition ? endViewChildPosition : childCountByPosition.get(i) - 1;
for (int k = startViewChildPosition; k <= n; k++) {
CharSequence text = textByPosition.get(i + (k << 16));
if (text == null) {
continue;
}
if (startViewPosition == endViewPosition && k == endViewChildPosition && k == startViewChildPosition) {
int e = endViewOffset;
int s = startViewOffset;
if (e < s) {
int tmp = s;
s = e;
e = tmp;
}
if (s < text.length()) {
if (e > text.length()) e = text.length();
stringBuilder.append(text.subSequence(s, e));
@ -2369,6 +2383,9 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
} else if (i == endViewPosition) {
for (int k = 0; k <= endViewChildPosition; k++) {
CharSequence text = textByPosition.get(i + (k << 16));
if (text == null) {
continue;
}
if (startViewPosition == endViewPosition && k == endViewChildPosition && k == startViewChildPosition) {
int e = endViewOffset;
int s = startViewOffset;

View file

@ -393,6 +393,7 @@ public class ThemesHorizontalListCell extends RecyclerListView implements Notifi
themeInfo = theme;
isFirst = first;
isLast = last;
accentId = theme.currentAccentId;
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) button.getLayoutParams();
layoutParams.leftMargin = AndroidUtilities.dp(isFirst ? 22 + 27 : 27);
button.setLayoutParams(layoutParams);

View file

@ -2628,14 +2628,16 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
MessageBackgroundDrawable backgroundDrawable = cell.getBackgroundDrawable();
if ((backgroundDrawable.isAnimationInProgress() || cell.isDrawingSelectionBackground()) && (position == null || (position.flags & MessageObject.POSITION_FLAG_RIGHT) != 0)) {
if (cell.isHighlighted() || cell.isHighlightedAnimated()) {
int color = Theme.getColor(Theme.key_chat_selectedBackground);
int alpha = Color.alpha(color);
canvas.save();
canvas.translate(0, cell.getTranslationY());
Theme.chat_replyLinePaint.setColor(Theme.getColor(Theme.key_chat_selectedBackground));
Theme.chat_replyLinePaint.setAlpha((int) (alpha * cell.getHightlightAlpha()));
canvas.drawRect(0, cell.getTop(), getMeasuredWidth(), cell.getBottom(), Theme.chat_replyLinePaint);
canvas.restore();
if (position == null) {
int color = Theme.getColor(Theme.key_chat_selectedBackground);
int alpha = Color.alpha(color);
canvas.save();
canvas.translate(0, cell.getTranslationY());
Theme.chat_replyLinePaint.setColor(Theme.getColor(Theme.key_chat_selectedBackground));
Theme.chat_replyLinePaint.setAlpha((int) (alpha * cell.getHightlightAlpha()));
canvas.drawRect(0, cell.getTop(), getMeasuredWidth(), cell.getBottom(), Theme.chat_replyLinePaint);
canvas.restore();
}
} else {
backgroundDrawable.setColor(Theme.getColor(Theme.key_chat_selectedBackground));
int y = (int) cell.getY();
@ -5358,9 +5360,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
chatScrollHelper.setScrollDirection(scrollDirection);
if (progressDialog == null) {
progressDialog = new AlertDialog(getParentActivity(), 3);
if (progressDialog != null) {
progressDialog.dismiss();
}
progressDialog = new AlertDialog(getParentActivity(), 3);
progressDialog.setOnCancelListener(dialog -> postponedScrollIsCanceled = true);
progressDialog.showDelayed(400);
@ -7264,7 +7267,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (forwardingMessages != null) {
ArrayList<MessageObject> messagesToForward = forwardingMessages;
forwardingMessages = null;
forwardMessages(messagesToForward, false, notify, scheduleDate != 0 && scheduleDate != 0x7ffffffe ? scheduleDate + 1 : 0);
forwardMessages(messagesToForward, false, notify, scheduleDate != 0 && scheduleDate != 0x7ffffffe ? scheduleDate + 1 : scheduleDate);
}
chatActivityEnterView.setForceShowSendButton(false, false);
chatActivityEnterView.hideTopView(animated);
@ -7370,9 +7373,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
} else {
if (pagedown) {
if (progressDialog == null) {
progressDialog = new AlertDialog(getParentActivity(), 3);
if (progressDialog != null) {
progressDialog.dismiss();
}
progressDialog = new AlertDialog(getParentActivity(), 3);
progressDialog.setOnCancelListener(dialog -> postponedScrollIsCanceled = true);
progressDialog.showDelayed(400);
@ -7763,8 +7767,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private AlertDialog progressDialog;
public void
scrollToMessageId(int id, int fromMessageId, boolean select, int loadIndex, boolean forceScroll) {
public void scrollToMessageId(int id, int fromMessageId, boolean select, int loadIndex, boolean forceScroll) {
if (chatListView.animationRunning || getParentActivity() == null) {
return;
}
@ -7804,7 +7807,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
MessageObject primary = groupedMessages.findPrimaryMessageObject();
if (primary != null) {
object = primary;
id = object.getId();
}
}
@ -7841,7 +7843,15 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (found) {
int yOffset = getScrollOffsetForMessage(object);
chatListView.smoothScrollBy(0,view.getTop() - chatListView.getPaddingTop() - yOffset);
int scrollY = view.getTop() - chatListView.getPaddingTop() - yOffset;
int maxScrollOffset = chatListView.computeVerticalScrollRange() - chatListView.computeVerticalScrollOffset() - chatListView.computeVerticalScrollExtent();
if (maxScrollOffset < 0) maxScrollOffset = 0;
if (scrollY > maxScrollOffset) {
scrollY = maxScrollOffset;
}
if (scrollY != 0) {
chatListView.smoothScrollBy(0, scrollY);
}
break;
}
}
@ -7887,13 +7897,22 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (h < maxH) {
int yOffset = getScrollOffsetForMessage(object);
if (view != null) {
int scrollY;
if (scrollDirection == RecyclerAnimationScrollHelper.SCROLL_DIRECTION_UP) {
chatListView.smoothScrollBy(0, view.getTop() - chatListView.getPaddingTop() - h - yOffset);
scrollY= view.getTop() - chatListView.getPaddingTop() - h - yOffset;
} else {
MessageObject messageObject = messages.get(position - chatAdapter.messagesStartRow);
int scrollToHeight = dummyMessageCell.computeHeight(messageObject, groupedMessagesMap.get(messageObject.getGroupId()));
int t = chatListView.getMeasuredHeight() - scrollToHeight;
chatListView.smoothScrollBy(0, -(chatListView.getMeasuredHeight() - view.getBottom()) + t + h - yOffset);
scrollY= -(chatListView.getMeasuredHeight() - view.getBottom()) + t + h - yOffset;
}
int maxScrollOffset = chatListView.computeVerticalScrollRange() - chatListView.computeVerticalScrollOffset() - chatListView.computeVerticalScrollExtent();
if (maxScrollOffset < 0) maxScrollOffset = 0;
if (scrollY > maxScrollOffset) {
scrollY = maxScrollOffset;
}
if (scrollY != 0) {
chatListView.smoothScrollBy(0, scrollY);
}
} else {
chatListView.smoothScrollToPosition(position);
@ -7916,9 +7935,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
if (query) {
if (progressDialog == null) {
progressDialog = new AlertDialog(getParentActivity(), 3);
if (progressDialog != null) {
progressDialog.dismiss();
}
progressDialog = new AlertDialog(getParentActivity(), 3);
progressDialog.setOnCancelListener(dialog -> postponedScrollIsCanceled = true);
progressDialog.showDelayed(400);

View file

@ -251,8 +251,8 @@ public class AvatarDrawable extends Drawable {
canvas.drawCircle(size / 2.0f, size / 2.0f, size / 2.0f * archivedAvatarProgress, Theme.avatar_backgroundPaint);
if (Theme.dialogs_archiveAvatarDrawableRecolored) {
Theme.dialogs_archiveAvatarDrawable.beginApplyLayerColors();
Theme.dialogs_archiveAvatarDrawable.setLayerColor("Arrow1.**", Theme.getColor(Theme.key_avatar_backgroundArchived));
Theme.dialogs_archiveAvatarDrawable.setLayerColor("Arrow2.**", Theme.getColor(Theme.key_avatar_backgroundArchived));
Theme.dialogs_archiveAvatarDrawable.setLayerColor("Arrow1.**", Theme.getNonAnimatedColor(Theme.key_avatar_backgroundArchived));
Theme.dialogs_archiveAvatarDrawable.setLayerColor("Arrow2.**", Theme.getNonAnimatedColor(Theme.key_avatar_backgroundArchived));
Theme.dialogs_archiveAvatarDrawable.commitApplyLayerColors();
Theme.dialogs_archiveAvatarDrawableRecolored = false;
}

View file

@ -2774,6 +2774,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
});
runningAnimation2.start();
updateFieldRight(0);
if (delegate != null && getVisibility() == VISIBLE) {
delegate.onAttachButtonHidden();
}
}
runningAnimationType = 5;
@ -2856,6 +2859,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
}
if (attachLayout != null) {
attachLayout.setVisibility(GONE);
if (delegate != null && getVisibility() == VISIBLE) {
delegate.onAttachButtonHidden();
}
updateFieldRight(0);
}
scheduleButtonHidden = false;

View file

@ -3495,6 +3495,9 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
}
public void init() {
if (baseFragment == null) {
return;
}
if (baseFragment instanceof ChatActivity) {
galleryAlbumEntry = MediaController.allMediaAlbumEntry;
TLRPC.Chat chat = ((ChatActivity) baseFragment).getCurrentChat();

View file

@ -830,7 +830,7 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
protected void onMeasure(int widthSpec, int heightSpec) {
ignoreLayout = true;
int width = MeasureSpec.getSize(widthSpec);
emojiLayoutManager.setSpanCount(width / AndroidUtilities.dp(AndroidUtilities.isTablet() ? 60 : 45));
emojiLayoutManager.setSpanCount(Math.max(1, width / AndroidUtilities.dp(AndroidUtilities.isTablet() ? 60 : 45)));
ignoreLayout = false;
super.onMeasure(widthSpec, heightSpec);
}

View file

@ -390,7 +390,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
}
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.messagePlayingSpeedChanged);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didStartedCall);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didEndedCall);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didEndCall);
}
}
@ -412,7 +412,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
}
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.messagePlayingSpeedChanged);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didStartedCall);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didEndedCall);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didEndCall);
if (additionalContextView != null) {
additionalContextView.checkVisibility();
}
@ -441,14 +441,12 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
checkLocationString();
}
}
} else if (id == NotificationCenter.messagePlayingDidStart || id == NotificationCenter.messagePlayingPlayStateChanged || id == NotificationCenter.messagePlayingDidReset || id == NotificationCenter.didEndedCall) {
} else if (id == NotificationCenter.messagePlayingDidStart || id == NotificationCenter.messagePlayingPlayStateChanged || id == NotificationCenter.messagePlayingDidReset || id == NotificationCenter.didEndCall) {
checkPlayer(false);
} else if (id == NotificationCenter.didStartedCall) {
checkCall(false);
} else if (id == NotificationCenter.messagePlayingSpeedChanged) {
updatePlaybackButton();
} else {
checkPlayer(false);
}
}

View file

@ -18,7 +18,6 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
@ -29,7 +28,6 @@ import com.google.android.gms.vision.face.Face;
import com.google.android.gms.vision.face.FaceDetector;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.Bitmaps;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.DispatchQueue;
@ -868,9 +866,9 @@ public class PhotoPaintView extends FrameLayout implements EntityView.EntityView
setTextDimVisibility(true, textPaintView);
textPaintView.beginEditing();
InputMethodManager inputMethodManager = (InputMethodManager) ApplicationLoader.applicationContext.getSystemService(Activity.INPUT_METHOD_SERVICE);
inputMethodManager.toggleSoftInputFromWindow(textPaintView.getFocusedView().getWindowToken(), InputMethodManager.SHOW_FORCED, 0);
View view = textPaintView.getFocusedView();
view.requestFocus();
AndroidUtilities.showKeyboard(view);
}
public void closeTextEnter(boolean apply) {

View file

@ -334,8 +334,8 @@ public class PullForegroundDrawable {
Theme.dialogs_archiveAvatarDrawable.setProgress(0f);
if (!Theme.dialogs_archiveAvatarDrawableRecolored) {
Theme.dialogs_archiveAvatarDrawable.beginApplyLayerColors();
Theme.dialogs_archiveAvatarDrawable.setLayerColor("Arrow1.**", Theme.getColor(avatarBackgroundColorKey));
Theme.dialogs_archiveAvatarDrawable.setLayerColor("Arrow2.**", Theme.getColor(avatarBackgroundColorKey));
Theme.dialogs_archiveAvatarDrawable.setLayerColor("Arrow1.**", Theme.getNonAnimatedColor(avatarBackgroundColorKey));
Theme.dialogs_archiveAvatarDrawable.setLayerColor("Arrow2.**", Theme.getNonAnimatedColor(avatarBackgroundColorKey));
Theme.dialogs_archiveAvatarDrawable.commitApplyLayerColors();
Theme.dialogs_archiveAvatarDrawableRecolored = true;
}
@ -532,7 +532,7 @@ public class PullForegroundDrawable {
private void setOutProgress(float value) {
outProgress = value;
int color = ColorUtils.blendARGB(Theme.getColor(avatarBackgroundColorKey), Theme.getColor(backgroundActiveColorKey), 1f - outProgress);
int color = ColorUtils.blendARGB(Theme.getNonAnimatedColor(avatarBackgroundColorKey), Theme.getNonAnimatedColor(backgroundActiveColorKey), 1f - outProgress);
paintBackgroundAccent.setColor(color);
if (changeAvatarColor && isDraw()) {
Theme.dialogs_archiveAvatarDrawable.beginApplyLayerColors();

View file

@ -809,6 +809,7 @@ public class StickersAlert extends BottomSheet implements NotificationCenter.Not
@Override
public void onAnimationEnd(Animator animation) {
stickerPreviewLayout.setVisibility(View.GONE);
stickerImageView.setImageDrawable(null);
}
});
animatorSet.start();

View file

@ -2535,7 +2535,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
dialogInsertFinished = 0;
dialogChangeFinished = 0;
AndroidUtilities.runOnUIThread(() -> {
if (folderId != 0 && frozenDialogsList.isEmpty()) {
if (folderId != 0 && (frozenDialogsList == null || frozenDialogsList.isEmpty())) {
listView.setEmptyView(null);
progressView.setVisibility(View.INVISIBLE);
finishFragment();

View file

@ -2421,7 +2421,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
}
});
try {
progressDialog.showDelayed(3);
progressDialog.showDelayed(300);
} catch (Exception ignore) {
}
@ -3255,9 +3255,13 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
openThemeAccentPreview(loadingTheme, loadingThemeWallpaper, loadingThemeInfo);
onThemeLoadFinish();
} else {
Theme.ThemeInfo info = loadingThemeInfo;
Utilities.globalQueue.postRunnable(() -> {
loadingThemeInfo.createBackground(file, loadingThemeInfo.pathToWallpaper);
info.createBackground(file, info.pathToWallpaper);
AndroidUtilities.runOnUIThread(() -> {
if (loadingTheme == null) {
return;
}
File locFile = new File(ApplicationLoader.getFilesDirFixed(), "remote" + loadingTheme.id + ".attheme");
Theme.ThemeInfo finalThemeInfo = Theme.applyThemeFile(locFile, loadingTheme.title, loadingTheme, true);
if (finalThemeInfo != null) {

View file

@ -3077,7 +3077,9 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen
private void setDonePressed(boolean value) {
donePressed = value;
swipeBackEnabled = !value;
actionBar.getBackButton().setEnabled(!donePressed);
if (actionBar != null) {
actionBar.getBackButton().setEnabled(!donePressed);
}
if (detailSettingsCell[0] != null) {
detailSettingsCell[0].setEnabled(!donePressed);
}

View file

@ -1821,8 +1821,11 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
private void setScaleToFill() {
float bitmapWidth = centerImage.getBitmapWidth();
float containerWidth = getContainerViewWidth();
float bitmapHeight = centerImage.getBitmapHeight();
if (bitmapWidth == 0 || bitmapHeight == 0) {
return;
}
float containerWidth = getContainerViewWidth();
float containerHeight = getContainerViewHeight();
float scaleFit = Math.min(containerHeight / bitmapHeight, containerWidth / bitmapWidth);
float width = (int) (bitmapWidth * scaleFit);
@ -2002,7 +2005,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
animatingImageView.setTranslationX(animatingImageView.getTranslationX() - getLeftInset());
animationValues[0][2] = animatingImageView.getTranslationX();
}
windowView.requestLayout();
if (windowView != null) {
windowView.requestLayout();
}
}
containerView.setPadding(insets.getSystemWindowInsetLeft(), 0, insets.getSystemWindowInsetRight(), 0);
return insets.consumeSystemWindowInsets();
@ -2669,6 +2674,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
pickerViewSendButton.setBackgroundDrawable(drawable);
pickerViewSendButton.setColorFilter(new PorterDuffColorFilter(0xffffffff, PorterDuff.Mode.MULTIPLY));
pickerViewSendButton.setImageResource(R.drawable.attach_send);
pickerViewSendButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_dialogFloatingIcon), PorterDuff.Mode.MULTIPLY));
containerView.addView(pickerViewSendButton, LayoutHelper.createFrame(56, 56, Gravity.RIGHT | Gravity.BOTTOM, 0, 0, 14, 14));
pickerViewSendButton.setContentDescription(LocaleController.getString("Send", R.string.Send));
pickerViewSendButton.setOnClickListener(v -> {
@ -4018,6 +4024,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
Drawable drawable = pickerViewSendButton.getBackground();
Theme.setSelectorDrawableColor(drawable, color, false);
Theme.setSelectorDrawableColor(drawable, Theme.getColor(Build.VERSION.SDK_INT >= 21 ? Theme.key_dialogFloatingButtonPressed : Theme.key_dialogFloatingButton), true);
pickerViewSendButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_dialogFloatingIcon), PorterDuff.Mode.MULTIPLY));
}
if (checkImageView != null) {
checkImageView.setColor(Theme.getColor(Theme.key_dialogFloatingButton), 0xffffffff);

View file

@ -287,12 +287,8 @@ public class TooManyCommunitiesActivity extends BaseFragment {
}).start();
RecyclerListView list = searchViewContainer.getVisibility() == View.VISIBLE ? searchListView : listView;
//ValueAnimator listPaddingAnimator = ValueAnimator.ofFloat(listView.getPaddingBottom(), 0);
list.hideSelector(false);
// listPaddingAnimator.addUpdateListener(animation -> {
// float v = (float) animation.getAnimatedValue();
//
// });
int last = ((LinearLayoutManager) list.getLayoutManager()).findLastVisibleItemPosition();
if (last == list.getAdapter().getItemCount() - 1 || (last == list.getAdapter().getItemCount() - 2 && list == listView)) {
RecyclerView.ViewHolder holder = list.findViewHolderForAdapterPosition(last);