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 -> applicationVariants.all { variant ->
variant.outputs.all { output -> variant.outputs.all { output ->

View file

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

View file

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

View file

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

View file

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

View file

@ -19,7 +19,7 @@ public class BuildVars {
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 boolean TON_WALLET_STANDALONE = false; 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 String BUILD_VERSION_STRING = "5.13.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

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

View file

@ -1770,6 +1770,9 @@ public class MessageObject {
} }
public static void updatePollResults(TLRPC.TL_messageMediaPoll media, TLRPC.TL_pollResults results) { public static void updatePollResults(TLRPC.TL_messageMediaPoll media, TLRPC.TL_pollResults results) {
if (media == null || results == null) {
return;
}
if ((results.flags & 2) != 0) { if ((results.flags & 2) != 0) {
byte[] chosen = null; byte[] chosen = null;
if (results.min && media.results.results != null) { if (results.min && media.results.results != null) {
@ -3096,7 +3099,7 @@ public class MessageObject {
matcher = instagramUrlPattern.matcher(charSequence); matcher = instagramUrlPattern.matcher(charSequence);
} else { } else {
if (urlPattern == null) { 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); matcher = urlPattern.matcher(charSequence);
} }

View file

@ -133,7 +133,7 @@ public class NotificationCenter {
public static final int audioRouteChanged = totalEvents++; public static final int audioRouteChanged = totalEvents++;
public static final int didStartedCall = 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 closeInCallActivity = totalEvents++;
public static final int appDidLogout = totalEvents++; public static final int appDidLogout = totalEvents++;

View file

@ -224,9 +224,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
if (locationQueryCancelRunnable != null) { if (locationQueryCancelRunnable != null) {
AndroidUtilities.cancelRunOnUIThread(locationQueryCancelRunnable); AndroidUtilities.cancelRunOnUIThread(locationQueryCancelRunnable);
} }
locationQueryCancelRunnable = new Runnable() { locationQueryCancelRunnable = () -> {
@Override
public void run() {
if (locationQueryCancelRunnable != this) { if (locationQueryCancelRunnable != this) {
return; return;
} }
@ -238,7 +236,6 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
} }
} }
cleanup(); cleanup();
}
}; };
AndroidUtilities.runOnUIThread(locationQueryCancelRunnable, 5000); AndroidUtilities.runOnUIThread(locationQueryCancelRunnable, 5000);
} }
@ -1546,6 +1543,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
sentCount++; sentCount++;
if (scheduleDate != 0 && !currentSchedule) { if (scheduleDate != 0 && !currentSchedule) {
AndroidUtilities.runOnUIThread(() -> {
ArrayList<Integer> messageIds = new ArrayList<>(); ArrayList<Integer> messageIds = new ArrayList<>();
messageIds.add(oldId); messageIds.add(oldId);
getMessagesController().deleteMessages(messageIds, null, null, newMsgObj1.dialog_id, newMsgObj1.to_id.channel_id, false, true); getMessagesController().deleteMessages(messageIds, null, null, newMsgObj1.dialog_id, newMsgObj1.to_id.channel_id, false, true);
@ -1560,6 +1558,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
removeFromSendingMessages(oldId, scheduleDate != 0); removeFromSendingMessages(oldId, scheduleDate != 0);
}); });
}); });
});
} else { } else {
getMessagesStorage().getStorageQueue().postRunnable(() -> { getMessagesStorage().getStorageQueue().postRunnable(() -> {
getMessagesStorage().updateMessageStateAndId(newMsgObj1.random_id, oldId, newMsgObj1.id, 0, false, to_id.channel_id, scheduleDate != 0 ? 1 : 0); getMessagesStorage().updateMessageStateAndId(newMsgObj1.random_id, oldId, newMsgObj1.id, 0, false, to_id.channel_id, scheduleDate != 0 ? 1 : 0);
@ -2068,14 +2067,11 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
getMessagesController().processUpdates((TLRPC.Updates) response, false); getMessagesController().processUpdates((TLRPC.Updates) response, false);
voteSendTime.put(messageObject.getPollId(), SystemClock.uptimeMillis()); voteSendTime.put(messageObject.getPollId(), SystemClock.uptimeMillis());
} }
AndroidUtilities.runOnUIThread(new Runnable() { AndroidUtilities.runOnUIThread(() -> {
@Override
public void run() {
waitingForVote.remove(key); waitingForVote.remove(key);
if (finishRunnable != null) { if (finishRunnable != null) {
finishRunnable.run(); finishRunnable.run();
} }
}
}); });
}); });
} }
@ -4037,16 +4033,14 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
for (int a = 0, size = msgObjs.size(); a < size; a++) { for (int a = 0, size = msgObjs.size(); a < size; a++) {
putToSendingMessages(msgObjs.get(a).messageOwner, scheduled); 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 (error != null && FileRefController.isFileRefError(error.text)) {
if (parentObjects != null) { if (parentObjects != null) {
ArrayList<Object> arrayList = new ArrayList<>(parentObjects); ArrayList<Object> arrayList = new ArrayList<>(parentObjects);
getFileRefController().requestReference(arrayList, req, msgObjs, originalPaths, arrayList, delayedMessage, scheduled); getFileRefController().requestReference(arrayList, req, msgObjs, originalPaths, arrayList, delayedMessage, scheduled);
return; return;
} else if (delayedMessage != null) { } else if (delayedMessage != null) {
AndroidUtilities.runOnUIThread(new Runnable() { AndroidUtilities.runOnUIThread(() -> {
@Override
public void run() {
for (int a = 0, size = req.multi_media.size(); a < size; a++) { for (int a = 0, size = req.multi_media.size(); a < size; a++) {
if (delayedMessage.parentObjects.get(a) == null) { if (delayedMessage.parentObjects.get(a) == null) {
continue; continue;
@ -4064,11 +4058,11 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
delayedMessage.performMediaUpload = true; delayedMessage.performMediaUpload = true;
performSendDelayedMessage(delayedMessage, a); performSendDelayedMessage(delayedMessage, a);
} }
}
}); });
return; return;
} }
} }
AndroidUtilities.runOnUIThread(() -> {
boolean isSentError = false; boolean isSentError = false;
if (error == null) { if (error == null) {
SparseArray<TLRPC.Message> newMessages = new SparseArray<>(); SparseArray<TLRPC.Message> newMessages = new SparseArray<>();
@ -4173,7 +4167,8 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
removeFromSendingMessages(newMsgObj.id, scheduled); 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) { private void performSendMessageRequest(final TLObject req, final MessageObject msgObj, final String originalPath, DelayedMessage delayedMessage, Object parentObject, boolean scheduled) {
@ -4228,9 +4223,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
getFileRefController().requestReference(parentObject, req, msgObj, originalPath, parentMessage, check, delayedMessage, scheduled); getFileRefController().requestReference(parentObject, req, msgObj, originalPath, parentMessage, check, delayedMessage, scheduled);
return; return;
} else if (delayedMessage != null) { } else if (delayedMessage != null) {
AndroidUtilities.runOnUIThread(new Runnable() { AndroidUtilities.runOnUIThread(() -> {
@Override
public void run() {
removeFromSendingMessages(newMsgObj.id, scheduled); removeFromSendingMessages(newMsgObj.id, scheduled);
if (req instanceof TLRPC.TL_messages_sendMedia) { if (req instanceof TLRPC.TL_messages_sendMedia) {
TLRPC.TL_messages_sendMedia request = (TLRPC.TL_messages_sendMedia) req; TLRPC.TL_messages_sendMedia request = (TLRPC.TL_messages_sendMedia) req;
@ -4249,7 +4242,6 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
} }
delayedMessage.performMediaUpload = true; delayedMessage.performMediaUpload = true;
performSendDelayedMessage(delayedMessage); performSendDelayedMessage(delayedMessage);
}
}); });
return; return;
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1724,7 +1724,7 @@ public class DialogCell extends BaseCell {
Theme.dialogs_pinnedPaint.setColor(backgroundColor); Theme.dialogs_pinnedPaint.setColor(backgroundColor);
canvas.drawRect(tx - AndroidUtilities.dp(8), 0, getMeasuredWidth(), getMeasuredHeight(), Theme.dialogs_pinnedPaint); canvas.drawRect(tx - AndroidUtilities.dp(8), 0, getMeasuredWidth(), getMeasuredHeight(), Theme.dialogs_pinnedPaint);
if (currentRevealProgress == 0 && Theme.dialogs_archiveDrawableRecolored) { 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; Theme.dialogs_archiveDrawableRecolored = false;
} }
} }
@ -1743,7 +1743,7 @@ public class DialogCell extends BaseCell {
canvas.restore(); canvas.restore();
if (!Theme.dialogs_archiveDrawableRecolored) { 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; Theme.dialogs_archiveDrawableRecolored = true;
} }
} }

View file

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

View file

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

View file

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

View file

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

View file

@ -3495,6 +3495,9 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
} }
public void init() { public void init() {
if (baseFragment == null) {
return;
}
if (baseFragment instanceof ChatActivity) { if (baseFragment instanceof ChatActivity) {
galleryAlbumEntry = MediaController.allMediaAlbumEntry; galleryAlbumEntry = MediaController.allMediaAlbumEntry;
TLRPC.Chat chat = ((ChatActivity) baseFragment).getCurrentChat(); 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) { protected void onMeasure(int widthSpec, int heightSpec) {
ignoreLayout = true; ignoreLayout = true;
int width = MeasureSpec.getSize(widthSpec); 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; ignoreLayout = false;
super.onMeasure(widthSpec, heightSpec); 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.messagePlayingSpeedChanged);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didStartedCall); 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.messagePlayingSpeedChanged);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didStartedCall); NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didStartedCall);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didEndedCall); NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didEndCall);
if (additionalContextView != null) { if (additionalContextView != null) {
additionalContextView.checkVisibility(); additionalContextView.checkVisibility();
} }
@ -441,14 +441,12 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
checkLocationString(); 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); checkPlayer(false);
} else if (id == NotificationCenter.didStartedCall) { } else if (id == NotificationCenter.didStartedCall) {
checkCall(false); checkCall(false);
} else if (id == NotificationCenter.messagePlayingSpeedChanged) { } else if (id == NotificationCenter.messagePlayingSpeedChanged) {
updatePlaybackButton(); updatePlaybackButton();
} else {
checkPlayer(false);
} }
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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