From c92ecf973ce6f7e1dfec3b47c53cd94b1b5d85ab Mon Sep 17 00:00:00 2001 From: DrKLO Date: Mon, 24 Jul 2017 00:06:13 +0300 Subject: [PATCH] Update to 4.2.1 --- TMessagesProj/build.gradle | 4 +- .../org/telegram/messenger/BuildVars.java | 2 +- .../telegram/messenger/FileLoadOperation.java | 55 ++++++++++--------- .../ui/Components/PhotoPaintView.java | 3 + 4 files changed, 35 insertions(+), 29 deletions(-) diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 3fd149acd..a20b94dee 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -90,7 +90,7 @@ android { } } - defaultConfig.versionCode = 1040 + defaultConfig.versionCode = 1043 sourceSets.debug { manifest.srcFile 'config/debug/AndroidManifest.xml' @@ -162,7 +162,7 @@ android { defaultConfig { minSdkVersion 16 targetSdkVersion 25 - versionName "4.2.0" + versionName “4.2.1” externalNativeBuild { ndkBuild { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java index a15c16ce4..28ac4b3e9 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java @@ -11,7 +11,7 @@ package org.telegram.messenger; public class BuildVars { public static boolean DEBUG_VERSION = false; public static boolean DEBUG_PRIVATE_VERSION = false; - public static int BUILD_VERSION = 1042; + public static int BUILD_VERSION = 1043; public static String BUILD_VERSION_STRING = "4.2"; public static int APP_ID = 0; //obtain your own APP_ID at https://core.telegram.org/api/obtaining_api_id public static String APP_HASH = ""; //obtain your own APP_HASH at https://core.telegram.org/api/obtaining_api_id diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java index bfdce2c9f..01ec763d9 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java @@ -581,16 +581,17 @@ public class FileLoadOperation { RequestInfo delayedRequestInfo = delayedRequestInfos.get(a); if (downloadedBytes == delayedRequestInfo.offset) { delayedRequestInfos.remove(a); - processRequestResult(delayedRequestInfo, null); - if (delayedRequestInfo.response != null) { - delayedRequestInfo.response.disableFree = false; - delayedRequestInfo.response.freeResources(); - } else if (delayedRequestInfo.responseWeb != null) { - delayedRequestInfo.responseWeb.disableFree = false; - delayedRequestInfo.responseWeb.freeResources(); - } else if (delayedRequestInfo.responseCdn != null) { - delayedRequestInfo.responseCdn.disableFree = false; - delayedRequestInfo.responseCdn.freeResources(); + if (!processRequestResult(delayedRequestInfo, null)) { + if (delayedRequestInfo.response != null) { + delayedRequestInfo.response.disableFree = false; + delayedRequestInfo.response.freeResources(); + } else if (delayedRequestInfo.responseWeb != null) { + delayedRequestInfo.responseWeb.disableFree = false; + delayedRequestInfo.responseWeb.freeResources(); + } else if (delayedRequestInfo.responseCdn != null) { + delayedRequestInfo.responseCdn.disableFree = false; + delayedRequestInfo.responseCdn.freeResources(); + } } break; } @@ -600,16 +601,16 @@ public class FileLoadOperation { }, null, null, 0, datacenter_id, ConnectionsManager.ConnectionTypeGeneric, true); } - private void processRequestResult(RequestInfo requestInfo, TLRPC.TL_error error) { + private boolean processRequestResult(RequestInfo requestInfo, TLRPC.TL_error error) { if (state != stateDownloading) { - return; + return false; } requestInfos.remove(requestInfo); if (error == null) { try { if (downloadedBytes != requestInfo.offset) { delayRequestInfo(requestInfo); - return; + return false; } NativeByteBuffer bytes; if (requestInfo.response != null) { @@ -623,7 +624,7 @@ public class FileLoadOperation { } if (bytes == null || bytes.limit() == 0) { onFinishLoadingFile(true); - return; + return false; } int currentBytesSize = bytes.limit(); if (isCdn) { @@ -633,7 +634,7 @@ public class FileLoadOperation { if (hash == null) { delayRequestInfo(requestInfo); requestFileOffsets(fileOffset); - return; + return true; } } @@ -694,7 +695,7 @@ public class FileLoadOperation { } onFail(false, 0); cacheFileTemp.delete(); - return; + return false; } lastCheckedCdnPart = cdnCheckPart; } @@ -711,16 +712,17 @@ public class FileLoadOperation { RequestInfo delayedRequestInfo = delayedRequestInfos.get(a); if (downloadedBytes == delayedRequestInfo.offset) { delayedRequestInfos.remove(a); - processRequestResult(delayedRequestInfo, null); - if (delayedRequestInfo.response != null) { - delayedRequestInfo.response.disableFree = false; - delayedRequestInfo.response.freeResources(); - } else if (delayedRequestInfo.responseWeb != null) { - delayedRequestInfo.responseWeb.disableFree = false; - delayedRequestInfo.responseWeb.freeResources(); - } else if (delayedRequestInfo.responseCdn != null) { - delayedRequestInfo.responseCdn.disableFree = false; - delayedRequestInfo.responseCdn.freeResources(); + if (!processRequestResult(delayedRequestInfo, null)) { + if (delayedRequestInfo.response != null) { + delayedRequestInfo.response.disableFree = false; + delayedRequestInfo.response.freeResources(); + } else if (delayedRequestInfo.responseWeb != null) { + delayedRequestInfo.responseWeb.disableFree = false; + delayedRequestInfo.responseWeb.freeResources(); + } else if (delayedRequestInfo.responseCdn != null) { + delayedRequestInfo.responseCdn.disableFree = false; + delayedRequestInfo.responseCdn.freeResources(); + } } break; } @@ -775,6 +777,7 @@ public class FileLoadOperation { onFail(false, 0); } } + return false; } private void onFail(boolean thread, final int reason) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoPaintView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoPaintView.java index 2a01a2f11..ecca31c9d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoPaintView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoPaintView.java @@ -740,6 +740,9 @@ public class PhotoPaintView extends FrameLayout implements EntityView.EntityView private void removeEntity(EntityView entityView) { if (entityView == currentEntityView) { currentEntityView.deselect(); + if (editingText) { + closeTextEnter(false); + } currentEntityView = null; updateSettingsButton(); }