From ec533c5fff68ed8649c7f02cfbbd05c50f62c14b Mon Sep 17 00:00:00 2001 From: DrKLO Date: Fri, 4 Apr 2014 01:18:54 +0400 Subject: [PATCH] Optimize files upload, gif auto play after download, crash and bug fixes --- TMessagesProj/build.gradle | 4 +- .../main/java/jawnae/pyronet/ByteStream.java | 80 +---- .../main/java/jawnae/pyronet/PyroClient.java | 10 +- .../java/jawnae/pyronet/PyroSelector.java | 19 - .../telegram/messenger/AbsSerializedData.java | 1 + .../telegram/messenger/ByteBufferDesc.java | 50 ++- .../messenger/ConnectionsManager.java | 92 ++--- .../messenger/FileUploadOperation.java | 14 +- .../telegram/messenger/HandshakeAction.java | 8 +- .../telegram/messenger/MediaController.java | 21 +- .../messenger/MessagesController.java | 226 ++++++------ .../org/telegram/messenger/NativeLoader.java | 2 +- .../telegram/messenger/SerializedData.java | 19 + .../java/org/telegram/messenger/TLRPC.java | 109 +++--- .../org/telegram/messenger/TcpConnection.java | 50 ++- .../org/telegram/objects/MessageObject.java | 50 +-- .../org/telegram/objects/PhotoObject.java | 6 + .../org/telegram/ui/Cells/ChatAudioCell.java | 6 +- .../org/telegram/ui/Cells/ChatBaseCell.java | 22 +- .../org/telegram/ui/Cells/ChatMediaCell.java | 220 +++++++----- .../telegram/ui/Cells/ChatMessageCell.java | 8 +- .../org/telegram/ui/Cells/DialogCell.java | 4 +- .../java/org/telegram/ui/ChatActivity.java | 326 ++++++------------ .../org/telegram/ui/GalleryImageViewer.java | 4 +- .../org/telegram/ui/PhotoCropActivity.java | 2 +- .../org/telegram/ui/SettingsActivity.java | 19 +- .../src/main/res/drawable-hdpi/playvideo.png | Bin 0 -> 2654 bytes .../res/drawable-hdpi/playvideo_pressed.png | Bin 0 -> 2788 bytes .../src/main/res/drawable-ldpi/playvideo.png | Bin 0 -> 785 bytes .../res/drawable-ldpi/playvideo_pressed.png | Bin 0 -> 793 bytes .../src/main/res/drawable-mdpi/playvideo.png | Bin 0 -> 1823 bytes .../res/drawable-mdpi/playvideo_pressed.png | Bin 0 -> 1882 bytes .../src/main/res/drawable-xhdpi/playvideo.png | Bin 0 -> 3534 bytes .../res/drawable-xhdpi/playvideo_pressed.png | Bin 0 -> 3710 bytes .../main/res/drawable-xxhdpi/playvideo.png | Bin 0 -> 5360 bytes .../res/drawable-xxhdpi/playvideo_pressed.png | Bin 0 -> 5675 bytes .../drawable/chat_incoming_photo_states.xml | 7 - .../drawable/chat_outgoing_photo_states.xml | 7 - .../chat_group_incoming_video_layout.xml | 142 -------- .../res/layout/chat_incoming_video_layout.xml | 133 ------- .../res/layout/chat_outgoing_video_layout.xml | 153 -------- 41 files changed, 695 insertions(+), 1119 deletions(-) create mode 100755 TMessagesProj/src/main/res/drawable-hdpi/playvideo.png create mode 100755 TMessagesProj/src/main/res/drawable-hdpi/playvideo_pressed.png create mode 100755 TMessagesProj/src/main/res/drawable-ldpi/playvideo.png create mode 100755 TMessagesProj/src/main/res/drawable-ldpi/playvideo_pressed.png create mode 100755 TMessagesProj/src/main/res/drawable-mdpi/playvideo.png create mode 100755 TMessagesProj/src/main/res/drawable-mdpi/playvideo_pressed.png create mode 100755 TMessagesProj/src/main/res/drawable-xhdpi/playvideo.png create mode 100755 TMessagesProj/src/main/res/drawable-xhdpi/playvideo_pressed.png create mode 100755 TMessagesProj/src/main/res/drawable-xxhdpi/playvideo.png create mode 100755 TMessagesProj/src/main/res/drawable-xxhdpi/playvideo_pressed.png delete mode 100644 TMessagesProj/src/main/res/drawable/chat_incoming_photo_states.xml delete mode 100644 TMessagesProj/src/main/res/drawable/chat_outgoing_photo_states.xml delete mode 100644 TMessagesProj/src/main/res/layout/chat_group_incoming_video_layout.xml delete mode 100644 TMessagesProj/src/main/res/layout/chat_incoming_video_layout.xml delete mode 100644 TMessagesProj/src/main/res/layout/chat_outgoing_video_layout.xml diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 2e2c6ce5b..fa573d866 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -82,7 +82,7 @@ android { defaultConfig { minSdkVersion 8 targetSdkVersion 19 - versionCode 219 - versionName "1.4.9" + versionCode 220 + versionName "1.4.10" } } diff --git a/TMessagesProj/src/main/java/jawnae/pyronet/ByteStream.java b/TMessagesProj/src/main/java/jawnae/pyronet/ByteStream.java index 319c1fe42..39966ac18 100755 --- a/TMessagesProj/src/main/java/jawnae/pyronet/ByteStream.java +++ b/TMessagesProj/src/main/java/jawnae/pyronet/ByteStream.java @@ -18,38 +18,29 @@ package jawnae.pyronet; +import org.telegram.messenger.BuffersStorage; +import org.telegram.messenger.ByteBufferDesc; + import java.nio.ByteBuffer; import java.util.ArrayList; -import java.util.List; public class ByteStream { - private final List queue; + private final ArrayList queue; public ByteStream() { - // the queue is expected to be relatively small, and iterated often. - // hence removing the first element will be fast, even when using an - // ArrayList - this.queue = new ArrayList(); + this.queue = new ArrayList(); } - /** - * Appends the ByteBuffer instance to the ByteStream. The bytes are not - * copied, so do not modify the contents of the ByteBuffer. - */ - - public void append(ByteBuffer buf) { - if (buf == null) + public void append(ByteBufferDesc buf) { + if (buf == null) { throw new NullPointerException(); + } this.queue.add(buf); } - /** - * Returns whether there are any bytes pending in this stream - */ - public boolean hasData() { int size = this.queue.size(); - for (ByteBuffer aQueue : this.queue) { + for (ByteBufferDesc aQueue : this.queue) { if (aQueue.hasRemaining()) { return true; } @@ -57,29 +48,13 @@ public class ByteStream { return false; } - public int getByteCount() { - int size = this.queue.size(); - - int sum = 0; - for (ByteBuffer aQueue : this.queue) { - sum += aQueue.remaining(); - } - return sum; - } - - /** - * Fills the specified buffer with as much bytes as possible. When N bytes - * are read, the buffer position will be increased by N - */ - public void get(ByteBuffer dst) { if (dst == null) { throw new NullPointerException(); } - for (ByteBuffer data: this.queue) { - // data pos/lim must not be modified - data = data.slice(); + for (ByteBufferDesc bufferDesc : this.queue) { + ByteBuffer data = bufferDesc.buffer.slice(); if (data.remaining() > dst.remaining()) { data.limit(dst.remaining()); @@ -95,48 +70,25 @@ public class ByteStream { } } - /** - * Discards the specified amount of bytes from the stream. - * - * @throws PyroException - * if it failed to discard the specified number of bytes - */ - public void discard(int count) { int original = count; while (count > 0) { - // peek at the first buffer - ByteBuffer data = this.queue.get(0); + ByteBufferDesc data = this.queue.get(0); - if (count < data.remaining()) { - // discarding less bytes than remaining in buffer + if (count < data.buffer.remaining()) { data.position(data.position() + count); count = 0; break; } - // discard the first buffer this.queue.remove(0); - count -= data.remaining(); + BuffersStorage.getInstance().reuseFreeBuffer(data); + count -= data.buffer.remaining(); } if (count != 0) { - // apparantly we cannot discard the amount of bytes - // the user demanded, this is a bug in other code - throw new PyroException("discarded " + (original - count) + "/" - + original + " bytes"); + throw new PyroException("discarded " + (original - count) + "/" + original + " bytes"); } } - - public byte read() { - ByteBuffer data = this.queue.get(0); - byte result = data.get(); - if (!data.hasRemaining()) { - // discard the first buffer - this.queue.remove(0); - } - return result; - } - } diff --git a/TMessagesProj/src/main/java/jawnae/pyronet/PyroClient.java b/TMessagesProj/src/main/java/jawnae/pyronet/PyroClient.java index ea8bdd836..1044c9c6e 100755 --- a/TMessagesProj/src/main/java/jawnae/pyronet/PyroClient.java +++ b/TMessagesProj/src/main/java/jawnae/pyronet/PyroClient.java @@ -18,6 +18,8 @@ package jawnae.pyronet; +import org.telegram.messenger.ByteBufferDesc; + import java.io.EOFException; import java.io.IOException; import java.net.ConnectException; @@ -167,12 +169,6 @@ public class PyroClient { this.doEagerWrite = enabled; } - // - - public void writeCopy(ByteBuffer data) throws PyroException { - this.write(this.selector.copy(data)); - } - /** * Will enqueue the bytes to send them
* 1. when the selector is ready to write, if eagerWrite is disabled @@ -185,7 +181,7 @@ public class PyroClient { * when shutdown() has been called. */ - public void write(ByteBuffer data) throws PyroException { + public void write(ByteBufferDesc data) throws PyroException { this.selector.checkThread(); if (!this.key.isValid()) { diff --git a/TMessagesProj/src/main/java/jawnae/pyronet/PyroSelector.java b/TMessagesProj/src/main/java/jawnae/pyronet/PyroSelector.java index 899111d86..5db9e2ffc 100755 --- a/TMessagesProj/src/main/java/jawnae/pyronet/PyroSelector.java +++ b/TMessagesProj/src/main/java/jawnae/pyronet/PyroSelector.java @@ -56,25 +56,6 @@ public class PyroSelector { // - public ByteBuffer malloc(int size) { - return ByteBuffer.allocate(size); - } - - public ByteBuffer malloc(byte[] array) { - ByteBuffer copy = this.malloc(array.length); - copy.put(array); - copy.flip(); - return copy; - } - - public ByteBuffer copy(ByteBuffer buffer) { - ByteBuffer copy = this.malloc(buffer.remaining()); - copy.put(buffer); - buffer.position(buffer.position() - copy.remaining()); - copy.flip(); - return copy; - } - public final boolean isNetworkThread() { return DO_NOT_CHECK_NETWORK_THREAD || networkThread == Thread.currentThread(); } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/AbsSerializedData.java b/TMessagesProj/src/main/java/org/telegram/messenger/AbsSerializedData.java index 69449af9e..0f0bb480c 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/AbsSerializedData.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/AbsSerializedData.java @@ -30,6 +30,7 @@ public abstract class AbsSerializedData { public abstract String readString(); public abstract byte[] readByteArray(); public abstract ByteBufferDesc readByteBuffer(); + public abstract void writeByteBuffer(ByteBufferDesc buffer); public abstract double readDouble(); public abstract int length(); } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ByteBufferDesc.java b/TMessagesProj/src/main/java/org/telegram/messenger/ByteBufferDesc.java index 03d0a7c79..036539927 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ByteBufferDesc.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ByteBufferDesc.java @@ -78,7 +78,7 @@ public class ByteBufferDesc extends AbsSerializedData { if (!justCalc) { buffer.putLong(x); } else { - len += 4; + len += 8; } } catch(Exception e) { FileLog.e("tmessages", "write int64 error"); @@ -227,6 +227,54 @@ public class ByteBufferDesc extends AbsSerializedData { } } + public void writeByteBuffer(ByteBufferDesc b) { + try { + int l = b.limit(); + if (l <= 253) { + if (!justCalc) { + buffer.put((byte) l); + } else { + len += 1; + } + } else { + if (!justCalc) { + buffer.put((byte) 254); + buffer.put((byte) l); + buffer.put((byte) (l >> 8)); + buffer.put((byte) (l >> 16)); + } else { + len += 4; + } + } + if (!justCalc) { + b.rewind(); + buffer.put(b.buffer); + } else { + len += l; + } + int i = l <= 253 ? 1 : 4; + while((l + i) % 4 != 0) { + if (!justCalc) { + buffer.put((byte) 0); + } else { + len += 1; + } + i++; + } + } catch (Exception e) { + FileLog.e("tmessages", e); + } + } + + public void writeRaw(ByteBufferDesc b) { + if (justCalc) { + len += b.limit(); + } else { + b.rewind(); + buffer.put(b.buffer); + } + } + public int readInt32() { return readInt32(null); } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java b/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java index 17a9df38f..2ea99793e 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java @@ -489,6 +489,8 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. public void run() { Datacenter datacenter = datacenterWithId(currentDatacenterId); recreateSession(datacenter.authSessionId, datacenter); + recreateSession(datacenter.authDownloadSessionId, datacenter); + recreateSession(datacenter.authUploadSessionId, datacenter); } }); } @@ -503,6 +505,14 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. clearRequestsForRequestClass(RPCRequest.RPCRequestClassGeneric, datacenter); FileLog.d("tmessages", "***** Recreate generic session"); datacenter.authSessionId = getNewSessionId(); + } else if (sessionId == datacenter.authDownloadSessionId) { + clearRequestsForRequestClass(RPCRequest.RPCRequestClassDownloadMedia, datacenter); + FileLog.d("tmessages", "***** Recreate download session"); + datacenter.authDownloadSessionId = getNewSessionId(); + } else if (sessionId == datacenter.authUploadSessionId) { + clearRequestsForRequestClass(RPCRequest.RPCRequestClassUploadMedia, datacenter); + FileLog.d("tmessages", "***** Recreate upload session"); + datacenter.authUploadSessionId = getNewSessionId(); } } @@ -850,6 +860,8 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. } request.cancelled = true; + request.rawRequest.freeResources(); + request.rpcRequest.freeResources(); runningRequests.remove(i); break; } @@ -1025,7 +1037,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. Datacenter requestDatacenter = datacenterWithId(datacenterId); if (!request.initRequest && requestDatacenter.lastInitVersion != currentAppVersion) { request.rpcRequest = wrapInLayer(request.rawRequest, requestDatacenter.datacenterId, request); - SerializedData os = new SerializedData(true); + ByteBufferDesc os = new ByteBufferDesc(true); request.rpcRequest.serializeToStream(os); request.serializedLength = os.length(); } @@ -1520,7 +1532,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. } TLRPC.TL_protoMessage wrapMessage(TLObject message, long sessionId, boolean meaningful) { - SerializedData os = new SerializedData(true); + ByteBufferDesc os = new ByteBufferDesc(true); message.serializeToStream(os); if (os.length() != 0) { @@ -1552,7 +1564,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. msgAck.msg_ids = new ArrayList(); msgAck.msg_ids.addAll(arr); - SerializedData os = new SerializedData(true); + ByteBufferDesc os = new ByteBufferDesc(true); msgAck.serializeToStream(os); if (os.length() != 0) { @@ -1599,7 +1611,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. if (currentSize >= 3 * 1024 || a == messagesToSend.size() - 1) { ArrayList quickAckId = new ArrayList(); - byte[] transportData = createConnectionData(currentMessages, sessionId, quickAckId, connection); + ByteBufferDesc transportData = createConnectionData(currentMessages, sessionId, quickAckId, connection); if (transportData != null) { if (reportAck && quickAckId.size() != 0) { @@ -1622,7 +1634,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. } } - connection.sendData(transportData, reportAck, requestShortTimeout); + connection.sendData(null, transportData, reportAck, requestShortTimeout); } else { FileLog.e("tmessages", "***** Transport data is nil"); } @@ -1634,7 +1646,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. } @SuppressWarnings("unused") - byte[] createConnectionData(ArrayList messages, long sessionId, ArrayList quickAckId, TcpConnection connection) { + ByteBufferDesc createConnectionData(ArrayList messages, long sessionId, ArrayList quickAckId, TcpConnection connection) { Datacenter datacenter = datacenterWithId(connection.getDatacenterId()); if (datacenter.authKey == null) { return null; @@ -1711,11 +1723,11 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. messageSeqNo = generateMessageSeqNo(sessionId, false); } - SerializedData innerMessageOs = new SerializedData(); - messageBody.serializeToStream(innerMessageOs); - byte[] messageData = innerMessageOs.toByteArray(); + ByteBufferDesc sizeBuffer = new ByteBufferDesc(true); + messageBody.serializeToStream(sizeBuffer); + + ByteBufferDesc innerOs = BuffersStorage.getInstance().getFreeBuffer(8 + 8 + 8 + 4 + 4 + sizeBuffer.length()); - SerializedData innerOs = new SerializedData(8 + 8 + 8 + 4 + 4 + messageData.length); long serverSalt = datacenter.selectServerSalt(getCurrentTime()); if (serverSalt == 0) { innerOs.writeInt64(0); @@ -1725,11 +1737,10 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. innerOs.writeInt64(sessionId); innerOs.writeInt64(messageId); innerOs.writeInt32(messageSeqNo); - innerOs.writeInt32(messageData.length); - innerOs.writeRaw(messageData); - byte[] innerData = innerOs.toByteArray(); + innerOs.writeInt32(sizeBuffer.length()); + messageBody.serializeToStream(innerOs); - byte[] messageKeyFull = Utilities.computeSHA1(innerData); + byte[] messageKeyFull = Utilities.computeSHA1(innerOs.buffer, 0, innerOs.limit()); byte[] messageKey = new byte[16]; System.arraycopy(messageKeyFull, messageKeyFull.length - 16, messageKey, 0, 16); @@ -1740,35 +1751,29 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. MessageKeyData keyData = Utilities.generateMessageKeyData(datacenter.authKey, messageKey, false); - SerializedData dataForEncryption = new SerializedData(innerData.length + (innerData.length % 16)); - dataForEncryption.writeRaw(innerData); + int zeroCount = 0; + if (innerOs.limit() % 16 != 0) { + zeroCount = 16 - innerOs.limit() % 16; + } + + ByteBufferDesc dataForEncryption = BuffersStorage.getInstance().getFreeBuffer(innerOs.limit() + zeroCount); + dataForEncryption.writeRaw(innerOs); + BuffersStorage.getInstance().reuseFreeBuffer(innerOs); byte[] b = new byte[1]; - while (dataForEncryption.length() % 16 != 0) { + for (int a = 0; a < zeroCount; a++) { MessagesController.random.nextBytes(b); dataForEncryption.writeByte(b[0]); } - byte[] encryptedData = Utilities.aesIgeEncryption(dataForEncryption.toByteArray(), keyData.aesKey, keyData.aesIv, true, false, 0); + Utilities.aesIgeEncryption2(dataForEncryption.buffer, keyData.aesKey, keyData.aesIv, true, false, dataForEncryption.limit()); - try { - SerializedData data = new SerializedData(8 + messageKey.length + encryptedData.length); - data.writeInt64(datacenter.authKeyId); - data.writeRaw(messageKey); - data.writeRaw(encryptedData); + ByteBufferDesc data = BuffersStorage.getInstance().getFreeBuffer(8 + messageKey.length + dataForEncryption.limit()); + data.writeInt64(datacenter.authKeyId); + data.writeRaw(messageKey); + data.writeRaw(dataForEncryption); + BuffersStorage.getInstance().reuseFreeBuffer(dataForEncryption); - return data.toByteArray(); - } catch (Exception e) { - FileLog.e("tmessages", e); - innerData = null; - messageData = null; - System.gc(); - SerializedData data = new SerializedData(); - data.writeInt64(datacenter.authKeyId); - data.writeRaw(messageKey); - data.writeRaw(encryptedData); - - return data.toByteArray(); - } + return data; } void refillSaltSet(final Datacenter datacenter) { @@ -1821,6 +1826,8 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. RPCRequest request = runningRequests.get(i); removeRequestInClass(request.token); if (request.respondsToMessageId(requestMsgId)) { + request.rawRequest.freeResources(); + request.rpcRequest.freeResources(); runningRequests.remove(i); i--; } @@ -2188,6 +2195,9 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. } recreateSession(datacenter.authSessionId, datacenter); + recreateSession(datacenter.authDownloadSessionId, datacenter); + recreateSession(datacenter.authUploadSessionId, datacenter); + saveSession(); lastOutgoingMessageId = 0; @@ -2273,7 +2283,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. } static long nextPingId = 0; - byte[] generatePingData(Datacenter datacenter, boolean recordTime) { + ByteBufferDesc generatePingData(Datacenter datacenter, boolean recordTime) { long sessionId = datacenter.authSessionId; if (sessionId == 0) { return null; @@ -2300,9 +2310,9 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. return; } - byte[] transportData = generatePingData(datacenter, true); + ByteBufferDesc transportData = generatePingData(datacenter, true); if (transportData != null) { - datacenter.connection.sendData(transportData, false, true); + datacenter.connection.sendData(null, transportData, false, true); } } @@ -2698,6 +2708,8 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. } recreateSession(datacenter.authSessionId, datacenter); + recreateSession(datacenter.authDownloadSessionId, datacenter); + recreateSession(datacenter.authUploadSessionId, datacenter); if (datacenter.authKey == null) { datacenter.clearServerSalts(); @@ -2766,6 +2778,8 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. timeDifference = (Integer)params.get("timeDifference"); recreateSession(eactor.datacenter.authSessionId, eactor.datacenter); + recreateSession(eactor.datacenter.authDownloadSessionId, eactor.datacenter); + recreateSession(eactor.datacenter.authUploadSessionId, eactor.datacenter); } processRequestQueue(RPCRequest.RPCRequestClassTransportMask, eactor.datacenter.datacenterId); } else if (action instanceof ExportAuthorizationAction) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/FileUploadOperation.java b/TMessagesProj/src/main/java/org/telegram/messenger/FileUploadOperation.java index f4ba9c6f4..21f48ded3 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/FileUploadOperation.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/FileUploadOperation.java @@ -125,15 +125,21 @@ public class FileUploadOperation { if (key != null && readed % 16 != 0) { toAdd += 16 - readed % 16; } - byte[] sendBuffer = new byte[readed + toAdd]; + ByteBufferDesc sendBuffer = BuffersStorage.getInstance().getFreeBuffer(readed + toAdd); if (readed != uploadChunkSize) { isLastPart = true; } - System.arraycopy(readBuffer, 0, sendBuffer, 0, readed); + sendBuffer.writeRaw(readBuffer, 0, readed); + sendBuffer.rewind(); if (key != null) { - sendBuffer = Utilities.aesIgeEncryption(sendBuffer, key, iv, true, true, 0); + for (int a = 0; a < toAdd; a++) { + sendBuffer.writeByte(0); + } + Utilities.aesIgeEncryption2(sendBuffer.buffer, key, iv, true, true, readed + toAdd); + } + if (!isBigFile) { + mdEnc.update(sendBuffer.buffer); } - mdEnc.update(sendBuffer, 0, readed + toAdd); if (isBigFile) { TLRPC.TL_upload_saveBigFilePart req = new TLRPC.TL_upload_saveBigFilePart(); req.file_part = currentPartNum; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/HandshakeAction.java b/TMessagesProj/src/main/java/org/telegram/messenger/HandshakeAction.java index 82679649b..3d6fc6361 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/HandshakeAction.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/HandshakeAction.java @@ -179,7 +179,7 @@ public class HandshakeAction extends Action implements TcpConnection.TcpConnecti byte[] transportData = messageOs.toByteArray(); - datacenter.connection.sendData(transportData, false, false); + datacenter.connection.sendData(transportData, null, false, false); return transportData; } @@ -576,11 +576,11 @@ public class HandshakeAction extends Action implements TcpConnection.TcpConnecti return; } if (reqPQMsgData != null) { - datacenter.connection.sendData(reqPQMsgData, false, false); + datacenter.connection.sendData(reqPQMsgData, null, false, false); } else if (reqDHMsgData != null) { - datacenter.connection.sendData(reqDHMsgData, false, false); + datacenter.connection.sendData(reqDHMsgData, null, false, false); } else if (setClientDHParamsMsgData != null) { - datacenter.connection.sendData(setClientDHParamsMsgData, false, false); + datacenter.connection.sendData(setClientDHParamsMsgData, null, false, false); } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java index 018ffefb4..8219abaee 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java @@ -1016,8 +1016,23 @@ public class MediaController implements NotificationCenter.NotificationCenterDel }); } - public static void saveFile(String path, Context context, final int type, final String name) { - final File sourceFile = new File(Utilities.getCacheDir(), path); + public static void saveFile(String path, String fullPath, Context context, final int type, final String name) { + if (path == null && fullPath == null) { + return; + } + + File file = null; + if (fullPath != null && fullPath.length() != 0) { + file = new File(fullPath); + if (!file.exists()) { + file = null; + } + } + if (file == null) { + file = new File(Utilities.getCacheDir(), path); + } + + final File sourceFile = file; if (sourceFile.exists()) { ProgressDialog progressDialog = null; if (context != null) { @@ -1121,7 +1136,7 @@ public class MediaController implements NotificationCenter.NotificationCenterDel return null; } - if (currentGifMessageObject != null && messageObject.messageOwner.id == currentGifMessageObject.messageOwner.id) { + if (currentGifDrawable != null && currentGifMessageObject != null && messageObject.messageOwner.id == currentGifMessageObject.messageOwner.id) { currentMediaCell = cell; currentGifDrawable.parentView = new WeakReference(cell); return currentGifDrawable; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java index 18f693416..8ba0b1100 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java @@ -3274,7 +3274,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter } if (!(res instanceof TLRPC.TL_updates_differenceSlice)) { - if ((dialog_id != openned_dialog_id || ApplicationLoader.lastPauseTime != 0) && !obj.messageOwner.out && obj.messageOwner.unread && (lastMessage == null || lastMessage.messageOwner.date < obj.messageOwner.date)) { + if ((dialog_id != openned_dialog_id || ApplicationLoader.lastPauseTime != 0) && !obj.isOut() && obj.messageOwner.unread && (lastMessage == null || lastMessage.messageOwner.date < obj.messageOwner.date)) { if (!readMessages.contains(obj.messageOwner.id)) { lastMessage = obj; } @@ -3342,7 +3342,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter ConnectionsManager.getInstance().connectionState = 0; processUpdatesQueue(true); } else if (res instanceof TLRPC.TL_updates_differenceSlice) { - MessagesStorage.lastSeqValue = res.intermediate_state.seq; + //MessagesStorage.lastSeqValue = res.intermediate_state.seq; MessagesStorage.lastDateValue = res.intermediate_state.date; MessagesStorage.lastPtsValue = res.intermediate_state.pts; MessagesStorage.lastQtsValue = res.intermediate_state.qts; @@ -3380,123 +3380,131 @@ public class MessagesController implements NotificationCenter.NotificationCenter processUpdateArray(arr, null, null); } else if (updates instanceof TLRPC.TL_updateShortChatMessage) { boolean missingData = chats.get(updates.chat_id) == null || users.get(updates.from_id) == null; - if (MessagesStorage.lastSeqValue + 1 == updates.seq && !missingData) { - TLRPC.TL_message message = new TLRPC.TL_message(); - message.from_id = updates.from_id; - message.id = updates.id; - message.to_id = new TLRPC.TL_peerChat(); - message.to_id.chat_id = updates.chat_id; - message.message = updates.message; - message.date = updates.date; - message.unread = true; - message.media = new TLRPC.TL_messageMediaEmpty(); - MessagesStorage.lastSeqValue = updates.seq; - MessagesStorage.lastPtsValue = updates.pts; - final MessageObject obj = new MessageObject(message, null); - final ArrayList objArr = new ArrayList(); - objArr.add(obj); - ArrayList arr = new ArrayList(); - arr.add(message); - final boolean printUpdate = updatePrintingUsersWithNewMessages(-updates.chat_id, objArr); - if (printUpdate) { - updatePrintingStrings(); - } - Utilities.RunOnUIThread(new Runnable() { - @Override - public void run() { - if (printUpdate) { - NotificationCenter.getInstance().postNotificationName(updateInterfaces, UPDATE_MASK_USER_PRINT); - } - if (obj.messageOwner.from_id != UserConfig.clientUserId) { - long dialog_id; - if (obj.messageOwner.to_id.chat_id != 0) { - dialog_id = -obj.messageOwner.to_id.chat_id; - } else { - dialog_id = obj.messageOwner.to_id.user_id; - } - if (dialog_id != openned_dialog_id || ApplicationLoader.lastPauseTime != 0 || !ApplicationLoader.isScreenOn) { - showInAppNotification(obj); - } - } - updateInterfaceWithMessages(-updates.chat_id, objArr); - NotificationCenter.getInstance().postNotificationName(dialogsNeedReload); + if (missingData) { + needGetDiff = true; + } else { + if (MessagesStorage.lastSeqValue + 1 == updates.seq && !gettingDifference) { + TLRPC.TL_message message = new TLRPC.TL_message(); + message.from_id = updates.from_id; + message.id = updates.id; + message.to_id = new TLRPC.TL_peerChat(); + message.to_id.chat_id = updates.chat_id; + message.message = updates.message; + message.date = updates.date; + message.unread = true; + message.media = new TLRPC.TL_messageMediaEmpty(); + MessagesStorage.lastSeqValue = updates.seq; + MessagesStorage.lastPtsValue = updates.pts; + final MessageObject obj = new MessageObject(message, null); + final ArrayList objArr = new ArrayList(); + objArr.add(obj); + ArrayList arr = new ArrayList(); + arr.add(message); + final boolean printUpdate = updatePrintingUsersWithNewMessages(-updates.chat_id, objArr); + if (printUpdate) { + updatePrintingStrings(); } - }); - MessagesStorage.getInstance().putMessages(arr, false, true); - } else if (!missingData && MessagesStorage.lastSeqValue != updates.seq) { - FileLog.e("tmessages", "need get diff TL_updateShortChatMessage, seq: " + MessagesStorage.lastSeqValue + " " + updates.seq); - if (gettingDifference || updatesStartWaitTime == 0 || updatesStartWaitTime != 0 && updatesStartWaitTime + 1500 > System.currentTimeMillis()) { - if (updatesStartWaitTime == 0) { - updatesStartWaitTime = System.currentTimeMillis(); + Utilities.RunOnUIThread(new Runnable() { + @Override + public void run() { + if (printUpdate) { + NotificationCenter.getInstance().postNotificationName(updateInterfaces, UPDATE_MASK_USER_PRINT); + } + if (obj.messageOwner.from_id != UserConfig.clientUserId) { + long dialog_id; + if (obj.messageOwner.to_id.chat_id != 0) { + dialog_id = -obj.messageOwner.to_id.chat_id; + } else { + dialog_id = obj.messageOwner.to_id.user_id; + } + if (dialog_id != openned_dialog_id || ApplicationLoader.lastPauseTime != 0 || !ApplicationLoader.isScreenOn) { + showInAppNotification(obj); + } + } + updateInterfaceWithMessages(-updates.chat_id, objArr); + NotificationCenter.getInstance().postNotificationName(dialogsNeedReload); + } + }); + MessagesStorage.getInstance().putMessages(arr, false, true); + } else if (MessagesStorage.lastSeqValue != updates.seq) { + FileLog.e("tmessages", "need get diff TL_updateShortChatMessage, seq: " + MessagesStorage.lastSeqValue + " " + updates.seq); + if (gettingDifference || updatesStartWaitTime == 0 || updatesStartWaitTime != 0 && updatesStartWaitTime + 1500 > System.currentTimeMillis()) { + if (updatesStartWaitTime == 0) { + updatesStartWaitTime = System.currentTimeMillis(); + } + FileLog.e("tmessages", "add TL_updateShortChatMessage to queue"); + updatesQueue.add(updates); + addedToQueue = true; + } else { + needGetDiff = true; } - FileLog.e("tmessages", "add TL_updateShortChatMessage to queue"); - updatesQueue.add(updates); - addedToQueue = true; - } else { - needGetDiff = true; } } } else if (updates instanceof TLRPC.TL_updateShortMessage) { boolean missingData = users.get(updates.from_id) == null; - if (MessagesStorage.lastSeqValue + 1 == updates.seq && !missingData) { - TLRPC.TL_message message = new TLRPC.TL_message(); - message.from_id = updates.from_id; - message.id = updates.id; - message.to_id = new TLRPC.TL_peerUser(); - message.to_id.user_id = updates.from_id; - message.message = updates.message; - message.date = updates.date; - message.unread = true; - message.media = new TLRPC.TL_messageMediaEmpty(); - MessagesStorage.lastSeqValue = updates.seq; - MessagesStorage.lastPtsValue = updates.pts; - MessagesStorage.lastDateValue = updates.date; - final MessageObject obj = new MessageObject(message, null); - final ArrayList objArr = new ArrayList(); - objArr.add(obj); - ArrayList arr = new ArrayList(); - arr.add(message); - final boolean printUpdate = updatePrintingUsersWithNewMessages(updates.from_id, objArr); - if (printUpdate) { - updatePrintingStrings(); - } - Utilities.RunOnUIThread(new Runnable() { - @Override - public void run() { - if (printUpdate) { - NotificationCenter.getInstance().postNotificationName(updateInterfaces, UPDATE_MASK_USER_PRINT); - } - if (obj.messageOwner.from_id != UserConfig.clientUserId) { - long dialog_id; - if (obj.messageOwner.to_id.chat_id != 0) { - dialog_id = -obj.messageOwner.to_id.chat_id; - } else { - dialog_id = obj.messageOwner.to_id.user_id; - } - if (dialog_id != openned_dialog_id || ApplicationLoader.lastPauseTime != 0 || !ApplicationLoader.isScreenOn) { - showInAppNotification(obj); - } - } - updateInterfaceWithMessages(updates.from_id, objArr); - NotificationCenter.getInstance().postNotificationName(dialogsNeedReload); + if (missingData) { + needGetDiff = true; + } else { + if (MessagesStorage.lastSeqValue + 1 == updates.seq && !gettingDifference) { + TLRPC.TL_message message = new TLRPC.TL_message(); + message.from_id = updates.from_id; + message.id = updates.id; + message.to_id = new TLRPC.TL_peerUser(); + message.to_id.user_id = updates.from_id; + message.message = updates.message; + message.date = updates.date; + message.unread = true; + message.media = new TLRPC.TL_messageMediaEmpty(); + MessagesStorage.lastSeqValue = updates.seq; + MessagesStorage.lastPtsValue = updates.pts; + MessagesStorage.lastDateValue = updates.date; + final MessageObject obj = new MessageObject(message, null); + final ArrayList objArr = new ArrayList(); + objArr.add(obj); + ArrayList arr = new ArrayList(); + arr.add(message); + final boolean printUpdate = updatePrintingUsersWithNewMessages(updates.from_id, objArr); + if (printUpdate) { + updatePrintingStrings(); } - }); - MessagesStorage.getInstance().putMessages(arr, false, true); - } else if (!missingData && MessagesStorage.lastSeqValue != updates.seq) { - FileLog.e("tmessages", "need get diff TL_updateShortMessage, seq: " + MessagesStorage.lastSeqValue + " " + updates.seq); - if (gettingDifference || updatesStartWaitTime == 0 || updatesStartWaitTime != 0 && updatesStartWaitTime + 1500 > System.currentTimeMillis()) { - if (updatesStartWaitTime == 0) { - updatesStartWaitTime = System.currentTimeMillis(); + Utilities.RunOnUIThread(new Runnable() { + @Override + public void run() { + if (printUpdate) { + NotificationCenter.getInstance().postNotificationName(updateInterfaces, UPDATE_MASK_USER_PRINT); + } + if (obj.messageOwner.from_id != UserConfig.clientUserId) { + long dialog_id; + if (obj.messageOwner.to_id.chat_id != 0) { + dialog_id = -obj.messageOwner.to_id.chat_id; + } else { + dialog_id = obj.messageOwner.to_id.user_id; + } + if (dialog_id != openned_dialog_id || ApplicationLoader.lastPauseTime != 0 || !ApplicationLoader.isScreenOn) { + showInAppNotification(obj); + } + } + updateInterfaceWithMessages(updates.from_id, objArr); + NotificationCenter.getInstance().postNotificationName(dialogsNeedReload); + } + }); + MessagesStorage.getInstance().putMessages(arr, false, true); + } else if (MessagesStorage.lastSeqValue != updates.seq) { + FileLog.e("tmessages", "need get diff TL_updateShortMessage, seq: " + MessagesStorage.lastSeqValue + " " + updates.seq); + if (gettingDifference || updatesStartWaitTime == 0 || updatesStartWaitTime != 0 && updatesStartWaitTime + 1500 > System.currentTimeMillis()) { + if (updatesStartWaitTime == 0) { + updatesStartWaitTime = System.currentTimeMillis(); + } + FileLog.e("tmessages", "add TL_updateShortMessage to queue"); + updatesQueue.add(updates); + addedToQueue = true; + } else { + needGetDiff = true; } - FileLog.e("tmessages", "add TL_updateShortMessage to queue"); - updatesQueue.add(updates); - addedToQueue = true; - } else { - needGetDiff = true; } } } else if (updates instanceof TLRPC.TL_updatesCombined) { - if (MessagesStorage.lastSeqValue + 1 == updates.seq_start || MessagesStorage.lastSeqValue == updates.seq_start) { + if ((MessagesStorage.lastSeqValue + 1 == updates.seq_start || MessagesStorage.lastSeqValue == updates.seq_start) && !gettingDifference) { MessagesStorage.getInstance().putUsersAndChats(updates.users, updates.chats, true, true); int lastPtsValue = MessagesStorage.lastPtsValue; int lastQtsValue = MessagesStorage.lastQtsValue; @@ -3526,7 +3534,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter } } } else if (updates instanceof TLRPC.TL_updates) { - if (MessagesStorage.lastSeqValue + 1 == updates.seq || updates.seq == 0 || updates.seq == MessagesStorage.lastSeqValue) { + if ((MessagesStorage.lastSeqValue + 1 == updates.seq || updates.seq == 0 || updates.seq == MessagesStorage.lastSeqValue) && !gettingDifference) { MessagesStorage.getInstance().putUsersAndChats(updates.users, updates.chats, true, true); int lastPtsValue = MessagesStorage.lastPtsValue; int lastQtsValue = MessagesStorage.lastQtsValue; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/NativeLoader.java b/TMessagesProj/src/main/java/org/telegram/messenger/NativeLoader.java index 7816e3f07..0e2afdd4e 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/NativeLoader.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/NativeLoader.java @@ -34,7 +34,7 @@ public class NativeLoader { return; } - if (Build.VERSION.SDK_INT > 10) { + if (Build.VERSION.SDK_INT >= 9) { try { String folder = null; long libSize = 0; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/SerializedData.java b/TMessagesProj/src/main/java/org/telegram/messenger/SerializedData.java index 924f99f7c..59b59e6d5 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/SerializedData.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/SerializedData.java @@ -119,6 +119,25 @@ public class SerializedData extends AbsSerializedData { } } + public void writeByteBuffer(ByteBufferDesc buffer) { + if (!justCalc) { + //TODO ? + } else { + int l = buffer.limit(); + if (l <= 253) { + len += 1; + } else { + len += 4; + } + len += l; + int i = l <= 253 ? 1 : 4; + while((l + i) % 4 != 0) { + len += 1; + i++; + } + } + } + public int readInt32() { return readInt32(null); } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/TLRPC.java b/TMessagesProj/src/main/java/org/telegram/messenger/TLRPC.java index 8a3ea59f6..c624ee7f0 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/TLRPC.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/TLRPC.java @@ -7360,31 +7360,6 @@ public class TLRPC { } } - public static class TL_upload_saveFilePart extends TLObject { - public static int constructor = 0xb304a621; - - public long file_id; - public int file_part; - public byte[] bytes; - - public Class responseClass () { - return Bool.class; - } - - public void readParams(AbsSerializedData stream) { - file_id = stream.readInt64(); - file_part = stream.readInt32(); - bytes = stream.readByteArray(); - } - - public void serializeToStream(AbsSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(file_id); - stream.writeInt32(file_part); - stream.writeByteArray(bytes); - } - } - public static class TL_upload_getFile extends TLObject { public static int constructor = 0xe3a6cfb5; @@ -8111,34 +8086,6 @@ public class TLRPC { } } - public static class TL_upload_saveBigFilePart extends TLObject { - public static int constructor = 0xde7b673d; - - public long file_id; - public int file_part; - public int file_total_parts; - public byte[] bytes; - - public Class responseClass () { - return Bool.class; - } - - public void readParams(AbsSerializedData stream) { - file_id = stream.readInt64(); - file_part = stream.readInt32(); - file_total_parts = stream.readInt32(); - bytes = stream.readByteArray(); - } - - public void serializeToStream(AbsSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(file_id); - stream.writeInt32(file_part); - stream.writeInt32(file_total_parts); - stream.writeByteArray(bytes); - } - } - //manually created public static class UserStatus extends TLObject { @@ -9162,4 +9109,60 @@ public class TLRPC { } } } + + public static class TL_upload_saveBigFilePart extends TLObject { + public static int constructor = 0xde7b673d; + + public long file_id; + public int file_part; + public int file_total_parts; + public ByteBufferDesc bytes; + + public Class responseClass () { + return Bool.class; + } + + public void serializeToStream(AbsSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(file_id); + stream.writeInt32(file_part); + stream.writeInt32(file_total_parts); + stream.writeByteBuffer(bytes); + } + + @Override + public void freeResources() { + if (bytes != null) { + BuffersStorage.getInstance().reuseFreeBuffer(bytes); + bytes = null; + } + } + } + + public static class TL_upload_saveFilePart extends TLObject { + public static int constructor = 0xb304a621; + + public long file_id; + public int file_part; + public ByteBufferDesc bytes; + + public Class responseClass () { + return Bool.class; + } + + public void serializeToStream(AbsSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(file_id); + stream.writeInt32(file_part); + stream.writeByteBuffer(bytes); + } + + @Override + public void freeResources() { + if (bytes != null) { + BuffersStorage.getInstance().reuseFreeBuffer(bytes); + bytes = null; + } + } + } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/TcpConnection.java b/TMessagesProj/src/main/java/org/telegram/messenger/TcpConnection.java index c819424ce..bc8dc87bd 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/TcpConnection.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/TcpConnection.java @@ -271,7 +271,10 @@ public class TcpConnection extends PyroClientAdapter { connect(); } - public void sendData(final byte[] data, final boolean reportAck, final boolean startResponseTimeout) { + public void sendData(final byte[] data, final ByteBufferDesc buff, final boolean reportAck, final boolean startResponseTimeout) { + if (data == null && buff == null) { + return; + } selector.scheduleTask(new Runnable() { @Override public void run() { @@ -285,9 +288,28 @@ public class TcpConnection extends PyroClientAdapter { return; } - int packetLength = data.length / 4; + int bufferLen = 0; + if (data != null) { + bufferLen = data.length; + } else if (buff != null) { + bufferLen = buff.limit(); + } + int packetLength = bufferLen / 4; - SerializedData buffer = new SerializedData(); + if (packetLength < 0x7f) { + bufferLen++; + } else { + bufferLen += 4; + } + if (firstPacket) { + bufferLen++; + } + + ByteBufferDesc buffer = BuffersStorage.getInstance().getFreeBuffer(bufferLen); + if (firstPacket) { + buffer.writeByte((byte)0xef); + firstPacket = false; + } if (packetLength < 0x7f) { if (reportAck) { packetLength |= (1 << 7); @@ -300,20 +322,16 @@ public class TcpConnection extends PyroClientAdapter { } buffer.writeInt32(packetLength); } - buffer.writeRaw(data); - - final byte[] packet = buffer.toByteArray(); - - ByteBuffer sendBuffer = ByteBuffer.allocate((firstPacket ? 1 : 0) + packet.length); - sendBuffer.rewind(); - sendBuffer.order(ByteOrder.LITTLE_ENDIAN); - if (firstPacket) { - sendBuffer.put((byte)0xef); - firstPacket = false; + if (data != null) { + buffer.writeRaw(data); + } else { + buffer.writeRaw(buff); + BuffersStorage.getInstance().reuseFreeBuffer(buff); } - sendBuffer.put(packet); - sendBuffer.rewind(); - client.write(sendBuffer); + + buffer.rewind(); + + client.write(buffer); } }); } diff --git a/TMessagesProj/src/main/java/org/telegram/objects/MessageObject.java b/TMessagesProj/src/main/java/org/telegram/objects/MessageObject.java index c4f37d0c0..732bc887f 100644 --- a/TMessagesProj/src/main/java/org/telegram/objects/MessageObject.java +++ b/TMessagesProj/src/main/java/org/telegram/objects/MessageObject.java @@ -77,7 +77,7 @@ public class MessageObject { fromUser = MessagesController.getInstance().users.get(message.from_id); } if (message.action instanceof TLRPC.TL_messageActionChatCreate) { - if (message.from_id == UserConfig.clientUserId) { + if (isFromMe()) { messageText = LocaleController.getString("ActionYouCreateGroup", R.string.ActionYouCreateGroup); } else { if (fromUser != null) { @@ -88,7 +88,7 @@ public class MessageObject { } } else if (message.action instanceof TLRPC.TL_messageActionChatDeleteUser) { if (message.action.user_id == message.from_id) { - if (message.from_id == UserConfig.clientUserId) { + if (isFromMe()) { messageText = LocaleController.getString("ActionYouLeftUser", R.string.ActionYouLeftUser); } else { if (fromUser != null) { @@ -103,7 +103,7 @@ public class MessageObject { MessagesController.getInstance().users.get(message.action.user_id); } if (who != null && fromUser != null) { - if (message.from_id == UserConfig.clientUserId) { + if (isFromMe()) { messageText = LocaleController.getString("ActionYouKickUser", R.string.ActionYouKickUser).replace("un2", Utilities.formatName(who.first_name, who.last_name)); } else if (message.action.user_id == UserConfig.clientUserId) { messageText = LocaleController.getString("ActionKickUserYou", R.string.ActionKickUserYou).replace("un1", Utilities.formatName(fromUser.first_name, fromUser.last_name)); @@ -120,7 +120,7 @@ public class MessageObject { MessagesController.getInstance().users.get(message.action.user_id); } if (whoUser != null && fromUser != null) { - if (message.from_id == UserConfig.clientUserId) { + if (isFromMe()) { messageText = LocaleController.getString("ActionYouAddUser", R.string.ActionYouAddUser).replace("un2", Utilities.formatName(whoUser.first_name, whoUser.last_name)); } else if (message.action.user_id == UserConfig.clientUserId) { messageText = LocaleController.getString("ActionAddUserYou", R.string.ActionAddUserYou).replace("un1", Utilities.formatName(fromUser.first_name, fromUser.last_name)); @@ -135,7 +135,7 @@ public class MessageObject { for (TLRPC.PhotoSize size : message.action.photo.sizes) { photoThumbs.add(new PhotoObject(size)); } - if (message.from_id == UserConfig.clientUserId) { + if (isFromMe()) { messageText = LocaleController.getString("ActionYouChangedPhoto", R.string.ActionYouChangedPhoto); } else { if (fromUser != null) { @@ -145,7 +145,7 @@ public class MessageObject { } } } else if (message.action instanceof TLRPC.TL_messageActionChatEditTitle) { - if (message.from_id == UserConfig.clientUserId) { + if (isFromMe()) { messageText = LocaleController.getString("ActionYouChangedTitle", R.string.ActionYouChangedTitle).replace("un2", message.action.title); } else { if (fromUser != null) { @@ -155,7 +155,7 @@ public class MessageObject { } } } else if (message.action instanceof TLRPC.TL_messageActionChatDeletePhoto) { - if (message.from_id == UserConfig.clientUserId) { + if (isFromMe()) { messageText = LocaleController.getString("ActionYouRemovedPhoto", R.string.ActionYouRemovedPhoto); } else { if (fromUser != null) { @@ -182,7 +182,7 @@ public class MessageObject { } else { timeString = String.format("%d", message.action.ttl); } - if (message.from_id == UserConfig.clientUserId) { + if (isFromMe()) { messageText = LocaleController.formatString("MessageLifetimeChangedOutgoing", R.string.MessageLifetimeChangedOutgoing, timeString); } else { if (fromUser != null) { @@ -192,7 +192,7 @@ public class MessageObject { } } } else { - if (message.from_id == UserConfig.clientUserId) { + if (isFromMe()) { messageText = LocaleController.getString("MessageLifetimeYouRemoved", R.string.MessageLifetimeYouRemoved); } else { if (fromUser != null) { @@ -265,22 +265,18 @@ public class MessageObject { } else if (message.media != null && message.media instanceof TLRPC.TL_messageMediaPhoto) { contentType = type = 1; } else if (message.media != null && message.media instanceof TLRPC.TL_messageMediaGeo) { - if (message.from_id == UserConfig.clientUserId) { - contentType = type = 4; - } else { - contentType = type = 5; - } + contentType = 1; + type = 4; } else if (message.media != null && message.media instanceof TLRPC.TL_messageMediaVideo) { - if (message.from_id == UserConfig.clientUserId) { - contentType = type = 6; - } else { - contentType = type = 7; - } + contentType = 1; + type = 3; } else if (message.media != null && message.media instanceof TLRPC.TL_messageMediaContact) { - if (message.from_id == UserConfig.clientUserId) { - contentType = type = 12; + if (isFromMe()) { + contentType = 4; + type = 12; } else { - contentType = type = 13; + contentType = 5; + type = 13; } } else if (message.media != null && message.media instanceof TLRPC.TL_messageMediaUnsupported) { contentType = type = 0; @@ -289,7 +285,7 @@ public class MessageObject { contentType = 1; type = 8; } else { - if (message.from_id == UserConfig.clientUserId) { + if (isFromMe()) { contentType = type = 8; } else { contentType = type = 9; @@ -525,4 +521,12 @@ public class MessageObject { linesOffset += currentBlockLinesCount; } } + + public boolean isOut() { + return messageOwner.out; + } + + public boolean isFromMe() { + return messageOwner.from_id == UserConfig.clientUserId; + } } diff --git a/TMessagesProj/src/main/java/org/telegram/objects/PhotoObject.java b/TMessagesProj/src/main/java/org/telegram/objects/PhotoObject.java index 440cd2567..a93f03908 100644 --- a/TMessagesProj/src/main/java/org/telegram/objects/PhotoObject.java +++ b/TMessagesProj/src/main/java/org/telegram/objects/PhotoObject.java @@ -37,6 +37,9 @@ public class PhotoObject { } public static PhotoObject getClosestImageWithSize(ArrayList arr, int width, int height) { + if (arr == null) { + return null; + } int closestWidth = 9999; int closestHeight = 9999; PhotoObject closestObject = null; @@ -56,6 +59,9 @@ public class PhotoObject { } public static TLRPC.PhotoSize getClosestPhotoSizeWithSize(ArrayList sizes, int width, int height) { + if (sizes == null) { + return null; + } int closestWidth = 9999; int closestHeight = 9999; TLRPC.PhotoSize closestObject = null; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatAudioCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatAudioCell.java index 386ef6175..d50c274fe 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatAudioCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatAudioCell.java @@ -298,7 +298,7 @@ public class ChatAudioCell extends ChatBaseCell implements SeekBar.SeekBarDelega protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); - if (currentMessageObject.messageOwner.out) { + if (currentMessageObject.isOut()) { avatarImage.imageX = layoutWidth - backgroundWidth + Utilities.dp(9); seekBarX = layoutWidth - backgroundWidth + Utilities.dp(97); buttonX = layoutWidth - backgroundWidth + Utilities.dp(67); @@ -359,7 +359,7 @@ public class ChatAudioCell extends ChatBaseCell implements SeekBar.SeekBarDelega avatarImage.setImage((TLRPC.FileLocation)null, "50_50", getResources().getDrawable(Utilities.getUserAvatarForId(uid))); } - if (messageObject.messageOwner.out) { + if (messageObject.isOut()) { seekBar.type = 0; progressView.setProgressColors(0xffb4e396, 0xff6ac453); } else { @@ -393,7 +393,7 @@ public class ChatAudioCell extends ChatBaseCell implements SeekBar.SeekBarDelega canvas.restore(); int state = buttonState; - if (!currentMessageObject.messageOwner.out) { + if (!currentMessageObject.isOut()) { state += 4; timePaint.setColor(0xffa1aab3); } else { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java index 9ce7e17fc..a1aa6c9df 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java @@ -38,7 +38,7 @@ public class ChatBaseCell extends BaseCell { public static interface ChatBaseCellDelegate { public abstract void didPressedUserAvatar(ChatBaseCell cell, TLRPC.User user); - public abstract void didPressedCanceSendButton(ChatBaseCell cell); + public abstract void didPressedCancelSendButton(ChatBaseCell cell); public abstract void didLongPressed(ChatBaseCell cell); public abstract boolean canPerformActions(); public boolean onSwipeLeft(); @@ -246,7 +246,7 @@ public class ChatBaseCell extends BaseCell { } String newNameString = null; - if (drawName && isChat && newUser != null && !currentMessageObject.messageOwner.out) { + if (drawName && isChat && newUser != null && !currentMessageObject.isOut()) { newNameString = Utilities.formatName(newUser.first_name, newUser.last_name); } @@ -276,7 +276,7 @@ public class ChatBaseCell extends BaseCell { } currentUser = MessagesController.getInstance().users.get(messageObject.messageOwner.from_id); - if (isChat && !messageObject.messageOwner.out) { + if (isChat && !messageObject.isOut()) { isAvatarVisible = true; if (currentUser != null) { if (currentUser.photo != null) { @@ -289,7 +289,7 @@ public class ChatBaseCell extends BaseCell { } if (!media) { - if (currentMessageObject.messageOwner.out) { + if (currentMessageObject.isOut()) { currentTimePaint = timePaintOut; } else { currentTimePaint = timePaintIn; @@ -303,7 +303,7 @@ public class ChatBaseCell extends BaseCell { namesOffset = 0; - if (drawName && isChat && currentUser != null && !currentMessageObject.messageOwner.out) { + if (drawName && isChat && currentUser != null && !currentMessageObject.isOut()) { currentNameString = Utilities.formatName(currentUser.first_name, currentUser.last_name); nameWidth = getMaxNameWidth(); @@ -457,13 +457,13 @@ public class ChatBaseCell extends BaseCell { timeLayout = new StaticLayout(currentTimeString, currentTimePaint, timeWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); if (!media) { - if (!currentMessageObject.messageOwner.out) { + if (!currentMessageObject.isOut()) { timeX = backgroundWidth - Utilities.dp(9) - timeWidth + (isChat ? Utilities.dp(52) : 0); } else { timeX = layoutWidth - timeWidth - Utilities.dpf(38.5f); } } else { - if (!currentMessageObject.messageOwner.out) { + if (!currentMessageObject.isOut()) { timeX = backgroundWidth - Utilities.dp(4) - timeWidth + (isChat ? Utilities.dp(52) : 0); } else { timeX = layoutWidth - timeWidth - Utilities.dpf(42.0f); @@ -502,7 +502,7 @@ public class ChatBaseCell extends BaseCell { } Drawable currentBackgroundDrawable = null; - if (currentMessageObject.messageOwner.out) { + if (currentMessageObject.isOut()) { if (isPressed() && isCheckPressed || !isCheckPressed && isPressed) { if (!media) { currentBackgroundDrawable = backgroundDrawableOutSelected; @@ -551,7 +551,7 @@ public class ChatBaseCell extends BaseCell { if (drawForwardedName && forwardedNameLayout != null) { canvas.save(); - if (currentMessageObject.messageOwner.out) { + if (currentMessageObject.isOut()) { forwardNamePaint.setColor(0xff4a923c); forwardNameX = currentBackgroundDrawable.getBounds().left + Utilities.dp(10); forwardNameY = Utilities.dp(10 + (drawName ? 18 : 0)); @@ -566,7 +566,7 @@ public class ChatBaseCell extends BaseCell { } if (media) { - setDrawableBounds(mediaBackgroundDrawable, timeX - Utilities.dp(3), layoutHeight - Utilities.dpf(27.5f), timeWidth + Utilities.dp(6 + (currentMessageObject.messageOwner.out ? 20 : 0)), Utilities.dpf(16.5f)); + setDrawableBounds(mediaBackgroundDrawable, timeX - Utilities.dp(3), layoutHeight - Utilities.dpf(27.5f), timeWidth + Utilities.dp(6 + (currentMessageObject.isOut() ? 20 : 0)), Utilities.dpf(16.5f)); mediaBackgroundDrawable.draw(canvas); canvas.save(); @@ -580,7 +580,7 @@ public class ChatBaseCell extends BaseCell { canvas.restore(); } - if (currentMessageObject.messageOwner.out) { + if (currentMessageObject.isOut()) { boolean drawCheck1 = false; boolean drawCheck2 = false; boolean drawClock = false; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMediaCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMediaCell.java index 2d9aa5364..17b98dc18 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMediaCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMediaCell.java @@ -43,8 +43,10 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD private static Drawable placeholderInDrawable; private static Drawable placeholderOutDrawable; - private static Drawable[][] buttonStatesDrawables = new Drawable[3][2]; + private static Drawable videoIconDrawable; + private static Drawable[][] buttonStatesDrawables = new Drawable[4][2]; private static TextPaint infoPaint; + private static MessageObject lastDownloadedGifMessage = null; private GifDrawable gifDrawable = null; @@ -66,7 +68,8 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD private int buttonY; private StaticLayout infoLayout; - protected int infoWidth; + private int infoWidth; + private int infoOffset = 0; private String currentInfoString; public ChatMediaCellDelegate mediaDelegate = null; @@ -83,6 +86,9 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD buttonStatesDrawables[1][1] = getResources().getDrawable(R.drawable.photocancel_pressed); buttonStatesDrawables[2][0] = getResources().getDrawable(R.drawable.photogif); buttonStatesDrawables[2][1] = getResources().getDrawable(R.drawable.photogif_pressed); + buttonStatesDrawables[3][0] = getResources().getDrawable(R.drawable.playvideo); + buttonStatesDrawables[3][1] = getResources().getDrawable(R.drawable.playvideo_pressed); + videoIconDrawable = getResources().getDrawable(R.drawable.ic_video); infoPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); infoPaint.setColor(0xffffffff); @@ -187,10 +193,8 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD private void didPressedImage() { if (currentMessageObject.type == 1) { if (buttonState == -1) { - if (currentMessageObject.type == 1) { - if (mediaDelegate != null) { - mediaDelegate.didPressedImage(this); - } + if (mediaDelegate != null) { + mediaDelegate.didPressedImage(this); } } else if (buttonState == 0) { didPressedButton(); @@ -205,6 +209,14 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD } else if (buttonState == 2 || buttonState == 0) { didPressedButton(); } + } else if (currentMessageObject.type == 3) { + if (buttonState == 0 || buttonState == 3) { + didPressedButton(); + } + } else if (currentMessageObject.type == 4) { + if (mediaDelegate != null) { + mediaDelegate.didPressedImage(this); + } } } @@ -214,24 +226,32 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD if (currentMessageObject.imagePreview != null) { photoImage.setImage(currentPhotoObject.photoOwner.location, currentPhotoFilter, new BitmapDrawable(currentMessageObject.imagePreview), currentPhotoObject.photoOwner.size); } else { - photoImage.setImage(currentPhotoObject.photoOwner.location, currentPhotoFilter, currentMessageObject.messageOwner.out ? placeholderOutDrawable : placeholderInDrawable, currentPhotoObject.photoOwner.size); + photoImage.setImage(currentPhotoObject.photoOwner.location, currentPhotoFilter, currentMessageObject.isOut() ? placeholderOutDrawable : placeholderInDrawable, currentPhotoObject.photoOwner.size); } } else if (currentMessageObject.type == 8) { FileLoader.getInstance().loadFile(null, null, currentMessageObject.messageOwner.media.document, null); + lastDownloadedGifMessage = currentMessageObject; + } else if (currentMessageObject.type == 3) { + FileLoader.getInstance().loadFile(currentMessageObject.messageOwner.media.video, null, null, null); } progressVisible = true; buttonState = 1; invalidate(); } else if (buttonState == 1) { - if (currentMessageObject.messageOwner.out && currentMessageObject.messageOwner.send_state == MessagesController.MESSAGE_SEND_STATE_SENDING) { + if (currentMessageObject.isOut() && currentMessageObject.messageOwner.send_state == MessagesController.MESSAGE_SEND_STATE_SENDING) { if (delegate != null) { - delegate.didPressedCanceSendButton(this); + delegate.didPressedCancelSendButton(this); } } else { if (currentMessageObject.type == 1) { FileLoader.getInstance().cancelLoadingForImageView(photoImage); } else if (currentMessageObject.type == 8) { FileLoader.getInstance().cancelLoadFile(null, null, currentMessageObject.messageOwner.media.document, null); + if (lastDownloadedGifMessage.messageOwner.id == currentMessageObject.messageOwner.id) { + lastDownloadedGifMessage = null; + } + } else if (currentMessageObject.type == 3) { + FileLoader.getInstance().cancelLoadFile(currentMessageObject.messageOwner.media.video, null, null, null); } progressVisible = false; buttonState = 0; @@ -247,6 +267,10 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD buttonState = -1; invalidate(); } + } else if (buttonState == 3) { + if (mediaDelegate != null) { + mediaDelegate.didPressedImage(this); + } } } @@ -270,6 +294,18 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD String str = Utilities.formatFileSize(messageObject.messageOwner.media.document.size); if (currentInfoString == null || !currentInfoString.equals(str)) { currentInfoString = str; + infoOffset = 0; + infoWidth = (int) Math.ceil(infoPaint.measureText(currentInfoString)); + infoLayout = new StaticLayout(currentInfoString, infoPaint, infoWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); + } + } else if (messageObject.type == 3) { + int duration = messageObject.messageOwner.media.video.duration; + int minutes = duration / 60; + int seconds = duration - minutes * 60; + String str = String.format("%d:%02d, %s", minutes, seconds, Utilities.formatFileSize(messageObject.messageOwner.media.video.size)); + if (currentInfoString == null || !currentInfoString.equals(str)) { + currentInfoString = str; + infoOffset = videoIconDrawable.getIntrinsicWidth() + Utilities.dp(4); infoWidth = (int) Math.ceil(infoPaint.measureText(currentInfoString)); infoLayout = new StaticLayout(currentInfoString, infoPaint, infoWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); } @@ -278,81 +314,83 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD infoLayout = null; } - photoWidth = (int) (Math.min(Utilities.displaySize.x, Utilities.displaySize.y) * 0.7f); - photoHeight = photoWidth + Utilities.dp(100); - if (messageObject.type == 6 || messageObject.type == 7) { - photoWidth = (int) (Math.min(Utilities.displaySize.x, Utilities.displaySize.y) / 2.5f); - photoHeight = photoWidth + 100; - } - if (photoWidth > 800) { - photoWidth = 800; - } - if (photoHeight > 800) { - photoHeight = 800; - } + if (messageObject.type == 4) { + photoWidth = Utilities.dp(100); + photoHeight = Utilities.dp(100); + backgroundWidth = photoWidth + Utilities.dp(12); - currentPhotoObject = PhotoObject.getClosestImageWithSize(messageObject.photoThumbs, photoWidth, photoHeight); - if (currentPhotoObject != null) { - float scale = (float) currentPhotoObject.photoOwner.w / (float) photoWidth; - - int w = (int) (currentPhotoObject.photoOwner.w / scale); - int h = (int) (currentPhotoObject.photoOwner.h / scale); - if (h > photoHeight) { - float scale2 = h; - h = photoHeight; - scale2 /= h; - w = (int) (w / scale2); - } else if (h < Utilities.dp(120)) { - h = Utilities.dp(120); - float hScale = (float) currentPhotoObject.photoOwner.h / h; - if (currentPhotoObject.photoOwner.w / hScale < photoWidth) { - w = (int) (currentPhotoObject.photoOwner.w / hScale); - } - } - - photoWidth = w; - photoHeight = h; - backgroundWidth = w + Utilities.dp(12); - currentPhotoFilter = String.format(Locale.US, "%d_%d", (int) (w / Utilities.density), (int) (h / Utilities.density)); - - if (currentPhotoObject.image != null) { - photoImage.setImageBitmap(currentPhotoObject.image); - } else { - boolean photoExist = true; - String fileName = MessageObject.getAttachFileName(currentPhotoObject.photoOwner); - if (messageObject.type == 1) { - File cacheFile = new File(Utilities.getCacheDir(), fileName); - if (!cacheFile.exists()) { - photoExist = false; - } else { - MediaController.getInstance().removeLoadingFileObserver(this); - } - } - if (photoExist || downloadPhotos) { - if (messageObject.imagePreview != null) { - photoImage.setImage(currentPhotoObject.photoOwner.location, currentPhotoFilter, new BitmapDrawable(messageObject.imagePreview), currentPhotoObject.photoOwner.size); - } else { - photoImage.setImage(currentPhotoObject.photoOwner.location, currentPhotoFilter, messageObject.messageOwner.out ? placeholderOutDrawable : placeholderInDrawable, currentPhotoObject.photoOwner.size); - } - } else { - if (messageObject.imagePreview != null) { - photoImage.setImageBitmap(messageObject.imagePreview); - } else { - photoImage.setImageBitmap(messageObject.messageOwner.out ? placeholderOutDrawable : placeholderInDrawable); - } - } - } + double lat = messageObject.messageOwner.media.geo.lat; + double lon = messageObject.messageOwner.media.geo._long; + String url = String.format(Locale.US, "https://maps.googleapis.com/maps/api/staticmap?center=%f,%f&zoom=13&size=100x100&maptype=roadmap&scale=%d&markers=color:red|size:big|%f,%f&sensor=false", lat, lon, Math.min(2, (int)Math.ceil(Utilities.density)), lat, lon); + photoImage.setImage(url, null, messageObject.isOut() ? placeholderOutDrawable : placeholderInDrawable); } else { - photoImage.setImageBitmap(messageObject.messageOwner.out ? placeholderOutDrawable : placeholderInDrawable); + photoWidth = (int) (Math.min(Utilities.displaySize.x, Utilities.displaySize.y) * 0.7f); + photoHeight = photoWidth + Utilities.dp(100); + + if (photoWidth > 800) { + photoWidth = 800; + } + if (photoHeight > 800) { + photoHeight = 800; + } + + currentPhotoObject = PhotoObject.getClosestImageWithSize(messageObject.photoThumbs, photoWidth, photoHeight); + if (currentPhotoObject != null) { + float scale = (float) currentPhotoObject.photoOwner.w / (float) photoWidth; + + int w = (int) (currentPhotoObject.photoOwner.w / scale); + int h = (int) (currentPhotoObject.photoOwner.h / scale); + if (h > photoHeight) { + float scale2 = h; + h = photoHeight; + scale2 /= h; + w = (int) (w / scale2); + } else if (h < Utilities.dp(120)) { + h = Utilities.dp(120); + float hScale = (float) currentPhotoObject.photoOwner.h / h; + if (currentPhotoObject.photoOwner.w / hScale < photoWidth) { + w = (int) (currentPhotoObject.photoOwner.w / hScale); + } + } + + photoWidth = w; + photoHeight = h; + backgroundWidth = w + Utilities.dp(12); + currentPhotoFilter = String.format(Locale.US, "%d_%d", (int) (w / Utilities.density), (int) (h / Utilities.density)); + + if (currentPhotoObject.image != null) { + photoImage.setImageBitmap(currentPhotoObject.image); + } else { + boolean photoExist = true; + String fileName = MessageObject.getAttachFileName(currentPhotoObject.photoOwner); + if (messageObject.type == 1) { + File cacheFile = new File(Utilities.getCacheDir(), fileName); + if (!cacheFile.exists()) { + photoExist = false; + } else { + MediaController.getInstance().removeLoadingFileObserver(this); + } + } + if (photoExist || downloadPhotos) { + if (messageObject.imagePreview != null) { + photoImage.setImage(currentPhotoObject.photoOwner.location, currentPhotoFilter, new BitmapDrawable(messageObject.imagePreview), currentPhotoObject.photoOwner.size); + } else { + photoImage.setImage(currentPhotoObject.photoOwner.location, currentPhotoFilter, messageObject.isOut() ? placeholderOutDrawable : placeholderInDrawable, currentPhotoObject.photoOwner.size); + } + } else { + if (messageObject.imagePreview != null) { + photoImage.setImageBitmap(messageObject.imagePreview); + } else { + photoImage.setImageBitmap(messageObject.isOut() ? placeholderOutDrawable : placeholderInDrawable); + } + } + } + } else { + photoImage.setImageBitmap(messageObject.isOut() ? placeholderOutDrawable : placeholderInDrawable); + } } invalidate(); - /*if ((type == 6 || type == 7) && videoTimeText != null) { - int duration = message.messageOwner.media.video.duration; - int minutes = duration / 60; - int seconds = duration - minutes * 60; - videoTimeText.setText(String.format("%d:%02d", minutes, seconds)); - }*/ } updateButtonState(); } @@ -366,7 +404,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD } fileName = MessageObject.getAttachFileName(currentPhotoObject.photoOwner); cacheFile = new File(Utilities.getCacheDir(), fileName); - } else if (currentMessageObject.type == 8) { + } else if (currentMessageObject.type == 8 || currentMessageObject.type == 3) { if (currentMessageObject.messageOwner.attachPath != null && currentMessageObject.messageOwner.attachPath.length() != 0) { File f = new File(currentMessageObject.messageOwner.attachPath); if (f.exists()) { @@ -381,7 +419,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD if (fileName == null) { return; } - if (currentMessageObject.messageOwner.out && currentMessageObject.messageOwner.send_state == MessagesController.MESSAGE_SEND_STATE_SENDING) { + if (currentMessageObject.isOut() && currentMessageObject.messageOwner.send_state == MessagesController.MESSAGE_SEND_STATE_SENDING) { if (currentMessageObject.messageOwner.attachPath != null) { MediaController.getInstance().addLoadingFileObserver(currentMessageObject.messageOwner.attachPath, this); progressVisible = true; @@ -430,6 +468,8 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD progressVisible = false; if (currentMessageObject.type == 8 && (gifDrawable == null || gifDrawable != null && !gifDrawable.isRunning())) { buttonState = 2; + } else if (currentMessageObject.type == 3) { + buttonState = 3; } else { buttonState = -1; } @@ -447,7 +487,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); - if (currentMessageObject.messageOwner.out) { + if (currentMessageObject.isOut()) { photoImage.imageX = layoutWidth - backgroundWidth - Utilities.dp(3); } else { if (isChat) { @@ -490,18 +530,23 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD canvas.restore(); } - if (buttonState >= 0 && buttonState < 3) { + if (buttonState >= 0 && buttonState < 4) { Drawable currentButtonDrawable = buttonStatesDrawables[buttonState][buttonPressed]; setDrawableBounds(currentButtonDrawable, buttonX, buttonY); currentButtonDrawable.draw(canvas); } - if (infoLayout != null && (buttonState == 1 || buttonState == 0)) { - setDrawableBounds(mediaBackgroundDrawable, photoImage.imageX + Utilities.dp(4), photoImage.imageY + Utilities.dp(4), infoWidth + Utilities.dp(8), Utilities.dpf(16.5f)); + if (infoLayout != null && (buttonState == 1 || buttonState == 0 || buttonState == 3)) { + setDrawableBounds(mediaBackgroundDrawable, photoImage.imageX + Utilities.dp(4), photoImage.imageY + Utilities.dp(4), infoWidth + Utilities.dp(8) + infoOffset, Utilities.dpf(16.5f)); mediaBackgroundDrawable.draw(canvas); + if (currentMessageObject.type == 3) { + setDrawableBounds(videoIconDrawable, photoImage.imageX + Utilities.dp(8), photoImage.imageY + Utilities.dpf(7.5f)); + videoIconDrawable.draw(canvas); + } + canvas.save(); - canvas.translate(photoImage.imageX + Utilities.dp(8), photoImage.imageY + Utilities.dpf(5.5f)); + canvas.translate(photoImage.imageX + Utilities.dp(8) + infoOffset, photoImage.imageY + Utilities.dpf(5.5f)); infoLayout.draw(canvas); canvas.restore(); } @@ -515,6 +560,9 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD @Override public void onSuccessDownload(String fileName) { updateButtonState(); + if (currentMessageObject.type == 8 && lastDownloadedGifMessage != null && lastDownloadedGifMessage.messageOwner.id == currentMessageObject.messageOwner.id && buttonState == 2) { + didPressedButton(); + } } @Override diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java index 3055cddcc..478a155b3 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java @@ -131,7 +131,7 @@ public class ChatMessageCell extends ChatBaseCell { } pressedLink = null; int maxWidth; - if (isChat && !messageObject.messageOwner.out) { + if (isChat && !messageObject.isOut()) { maxWidth = Utilities.displaySize.x - Utilities.dp(122); drawName = true; } else { @@ -149,7 +149,7 @@ public class ChatMessageCell extends ChatBaseCell { maxChildWidth = Math.max(maxChildWidth, forwardedNameWidth); int timeMore = timeWidth + Utilities.dp(6); - if (messageObject.messageOwner.out) { + if (messageObject.isOut()) { timeMore += Utilities.dpf(20.5f); } @@ -176,7 +176,7 @@ public class ChatMessageCell extends ChatBaseCell { protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); - if (currentMessageObject.messageOwner.out) { + if (currentMessageObject.isOut()) { textX = layoutWidth - backgroundWidth + Utilities.dp(10); textY = Utilities.dp(10) + namesOffset; } else { @@ -192,7 +192,7 @@ public class ChatMessageCell extends ChatBaseCell { return; } - if (currentMessageObject.messageOwner.out) { + if (currentMessageObject.isOut()) { textX = layoutWidth - backgroundWidth + Utilities.dp(10); textY = Utilities.dp(10) + namesOffset; } else { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java index df5e8bc8d..055d0a510 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java @@ -465,7 +465,7 @@ public class DialogCell extends BaseCell { } else { if (chat != null) { String name = ""; - if (message.messageOwner.from_id == UserConfig.clientUserId) { + if (message.isFromMe()) { name = LocaleController.getString("FromYou", R.string.FromYou); } else { if (fromUser != null) { @@ -507,7 +507,7 @@ public class DialogCell extends BaseCell { } } - if (message.messageOwner.from_id == UserConfig.clientUserId) { + if (message.isFromMe()) { if (message.messageOwner.send_state == MessagesController.MESSAGE_SEND_STATE_SENDING) { drawCheck1 = false; drawCheck2 = false; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index 442cc4b38..7d2a9a773 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -64,7 +64,6 @@ import android.widget.EditText; import android.widget.FrameLayout; import android.widget.ImageButton; import android.widget.ImageView; -import android.widget.LinearLayout; import android.widget.PopupWindow; import android.widget.ProgressBar; import android.widget.RelativeLayout; @@ -105,7 +104,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; -import java.util.Locale; import java.util.concurrent.Semaphore; public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLayout.SizeNotifierRelativeLayoutDelegate, NotificationCenter.NotificationCenterDelegate, MessagesActivity.MessagesActivityDelegate, DocumentSelectActivity.DocumentSelectActivityDelegate { @@ -1230,14 +1228,14 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa private int getMessageType(MessageObject messageObject) { if (currentEncryptedChat == null) { - if (messageObject.messageOwner.id <= 0 && messageObject.messageOwner.out) { + if (messageObject.messageOwner.id <= 0 && messageObject.isOut()) { if (messageObject.messageOwner.send_state == MessagesController.MESSAGE_SEND_STATE_SEND_ERROR) { return 0; } else { return -1; } } else { - if (messageObject.type == 15) { + if (messageObject.type == 7) { return -1; } else if (messageObject.type == 10 || messageObject.type == 11) { if (messageObject.messageOwner.id == 0) { @@ -1279,7 +1277,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa } } } else { - if (messageObject.type == 15) { + if (messageObject.type == 7) { return -1; } else if (messageObject.messageOwner.send_state == MessagesController.MESSAGE_SEND_STATE_SEND_ERROR) { return 0; @@ -1767,7 +1765,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa if (minDate == 0 || obj.messageOwner.date < minDate) { minDate = obj.messageOwner.date; } - if (!obj.messageOwner.out && obj.messageOwner.unread) { + if (!obj.isOut() && obj.messageOwner.unread) { wasUnread = true; } messagesDict.put(obj.messageOwner.id, obj); @@ -1804,7 +1802,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa dateMsg.message = ""; dateMsg.id = 0; MessageObject dateObj = new MessageObject(dateMsg, null); - dateObj.contentType = dateObj.type = 15; + dateObj.contentType = dateObj.type = 7; boolean dateAdded = true; if (a != messArr.size() - 1) { MessageObject next = messArr.get(a + 1); @@ -1981,7 +1979,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa if (currentEncryptedChat != null && obj.messageOwner.action != null && obj.messageOwner.action instanceof TLRPC.TL_messageActionTTLChange && timerButton != null) { timerButton.setTime(obj.messageOwner.action.ttl); } - if (obj.messageOwner.out && obj.messageOwner.send_state == MessagesController.MESSAGE_SEND_STATE_SENDING) { + if (obj.isOut() && obj.messageOwner.send_state == MessagesController.MESSAGE_SEND_STATE_SENDING) { scrollToLastMessage(); return; } @@ -1995,7 +1993,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa currentMinMsgId = Math.min(obj.messageOwner.id, currentMinMsgId); } - if (!obj.messageOwner.out && obj.messageOwner.unread) { + if (!obj.isOut() && obj.messageOwner.unread) { unread_to_load++; currentMarkAsRead = true; } @@ -2033,11 +2031,11 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa progressBarMap.put(obj.messageOwner.attachPath, null); } - if (obj.messageOwner.out) { + if (obj.isOut()) { removeUnreadPlane(false); } - if (!obj.messageOwner.out && unreadMessageObject != null) { + if (!obj.isOut() && unreadMessageObject != null) { unread_to_load++; } @@ -2062,7 +2060,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa dateObj.contentType = dateObj.type = 10; messages.add(0, dateObj); } - if (!obj.messageOwner.out && obj.messageOwner.unread) { + if (!obj.isOut() && obj.messageOwner.unread) { obj.messageOwner.unread = false; markAsRead = true; } @@ -2316,9 +2314,9 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa int date = (Integer)args[1]; boolean started = false; for (MessageObject obj : messages) { - if (!obj.messageOwner.out) { + if (!obj.isOut()) { continue; - } else if (obj.messageOwner.out && !obj.messageOwner.unread) { + } else if (obj.isOut() && !obj.messageOwner.unread) { break; } if (obj.messageOwner.date <= date) { @@ -3014,12 +3012,12 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa if (currentEncryptedChat == null) { if (i == 0) { String fileName = selectedObject.getFileName(); - if (selectedObject.type == 6 || selectedObject.type == 7) { - MediaController.saveFile(fileName, parentActivity, 1, null); + if (selectedObject.type == 3) { + MediaController.saveFile(fileName, selectedObject.messageOwner.attachPath, parentActivity, 1, null); } else if (selectedObject.type == 1) { - MediaController.saveFile(fileName, parentActivity, 0, null); + MediaController.saveFile(fileName, selectedObject.messageOwner.attachPath, parentActivity, 0, null); } else if (selectedObject.type == 8 || selectedObject.type == 9) { - MediaController.saveFile(fileName, parentActivity, 2, selectedObject.messageOwner.media.document.file_name); + MediaController.saveFile(fileName, selectedObject.messageOwner.attachPath, parentActivity, 2, selectedObject.messageOwner.media.document.file_name); } } else if (i == 1) { processSelectedOption(2); @@ -3037,12 +3035,12 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa if (currentEncryptedChat == null) { if (i == 1) { String fileName = selectedObject.getFileName(); - if (selectedObject.type == 6 || selectedObject.type == 7) { - MediaController.saveFile(fileName, parentActivity, 1, null); + if (selectedObject.type == 3) { + MediaController.saveFile(fileName, selectedObject.messageOwner.attachPath, parentActivity, 1, null); } else if (selectedObject.type == 1) { - MediaController.saveFile(fileName, parentActivity, 0, null); + MediaController.saveFile(fileName, selectedObject.messageOwner.attachPath, parentActivity, 0, null); } else if (selectedObject.type == 8 || selectedObject.type == 9) { - MediaController.saveFile(fileName, parentActivity, 2, selectedObject.messageOwner.media.document.file_name); + MediaController.saveFile(fileName, selectedObject.messageOwner.attachPath, parentActivity, 2, selectedObject.messageOwner.media.document.file_name); } } else if (i == 2) { processSelectedOption(2); @@ -3120,7 +3118,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa } else { MessagesController.getInstance().sendMessage(selectedObject.messageOwner.message, dialog_id); } - } else if (selectedObject.type == 4 || selectedObject.type == 5) { + } else if (selectedObject.type == 4) { MessagesController.getInstance().sendMessage(selectedObject.messageOwner.media.geo.lat, selectedObject.messageOwner.media.geo._long, dialog_id); } else if (selectedObject.type == 1) { if (selectedObject.messageOwner instanceof TLRPC.TL_messageForwarded) { @@ -3129,7 +3127,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa TLRPC.TL_photo photo = (TLRPC.TL_photo)selectedObject.messageOwner.media.photo; MessagesController.getInstance().sendMessage(photo, dialog_id); } - } else if (selectedObject.type == 6 || selectedObject.type == 7) { + } else if (selectedObject.type == 3) { if (selectedObject.messageOwner instanceof TLRPC.TL_messageForwarded) { MessagesController.getInstance().sendMessage(selectedObject, dialog_id); } else { @@ -3481,11 +3479,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa private void updateRowBackground(ChatListRowHolderEx holder, boolean disableSelection, boolean selected) { int messageType = holder.message.type; if (!disableSelection) { - if (messageType == 4 || messageType == 6) { - holder.chatBubbleView.setBackgroundResource(R.drawable.chat_outgoing_photo_states); - } else if (messageType == 5 || messageType == 7) { - holder.chatBubbleView.setBackgroundResource(R.drawable.chat_incoming_photo_states); - } else if (messageType == 12) { + if (messageType == 12) { holder.chatBubbleView.setBackgroundResource(R.drawable.chat_outgoing_text_states); holder.chatBubbleView.setPadding(Utilities.dp(6), Utilities.dp(6), Utilities.dp(18), 0); } else if (messageType == 13) { @@ -3499,19 +3493,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa holder.chatBubbleView.setPadding(Utilities.dp(18), Utilities.dp(9), Utilities.dp(9), 0); } } else { - if (messageType == 4 || messageType == 6) { - if (selected) { - holder.chatBubbleView.setBackgroundResource(R.drawable.msg_out_photo_selected); - } else { - holder.chatBubbleView.setBackgroundResource(R.drawable.msg_out_photo); - } - } else if (messageType == 5 || messageType == 7) { - if (selected) { - holder.chatBubbleView.setBackgroundResource(R.drawable.msg_in_photo_selected); - } else { - holder.chatBubbleView.setBackgroundResource(R.drawable.msg_in_photo); - } - } else if (messageType == 12) { + if (messageType == 12) { if (selected) { holder.chatBubbleView.setBackgroundResource(R.drawable.msg_out_selected); } else { @@ -3543,6 +3525,26 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa } } + private void alertUserOpenError(MessageObject message) { + AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity); + builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); + builder.setPositiveButton(R.string.OK, null); + if (message.type == 3) { + builder.setMessage(R.string.NoPlayerInstalled); + } else { + builder.setMessage(LocaleController.formatString("NoHandleAppInstalled", R.string.NoHandleAppInstalled, message.messageOwner.media.document.mime_type)); + } + visibleDialog = builder.show(); + visibleDialog.setCanceledOnTouchOutside(true); + + visibleDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { + @Override + public void onDismiss(DialogInterface dialog) { + visibleDialog = null; + } + }); + } + private class ChatAdapter extends BaseAdapter { private Context mContext; @@ -3617,38 +3619,22 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa LayoutInflater li = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); if (type == 0) { view = new ChatMessageCell(mContext); - } else if (type == 4) { - view = li.inflate(R.layout.chat_outgoing_location_layout, viewGroup, false); - } else if (type == 5) { - if (currentChat != null) { - view = li.inflate(R.layout.chat_group_incoming_location_layout, viewGroup, false); - } else { - view = li.inflate(R.layout.chat_incoming_location_layout, viewGroup, false); - } - } else if (type == 1) { + } if (type == 1) { view = new ChatMediaCell(mContext); ((ChatMediaCell)view).downloadPhotos = downloadPhotos; - } else if (type == 6) { - view = li.inflate(R.layout.chat_outgoing_video_layout, viewGroup, false); - } else if (type == 7) { - if (currentChat != null) { - view = li.inflate(R.layout.chat_group_incoming_video_layout, viewGroup, false); - } else { - view = li.inflate(R.layout.chat_incoming_video_layout, viewGroup, false); - } } else if (type == 10) { view = li.inflate(R.layout.chat_action_message_layout, viewGroup, false); } else if (type == 11) { view = li.inflate(R.layout.chat_action_change_photo_layout, viewGroup, false); - } else if (type == 12) { + } else if (type == 4) { view = li.inflate(R.layout.chat_outgoing_contact_layout, viewGroup, false); - } else if (type == 13) { + } else if (type == 5) { if (currentChat != null) { view = li.inflate(R.layout.chat_group_incoming_contact_layout, viewGroup, false); } else { view = li.inflate(R.layout.chat_incoming_contact_layout, viewGroup, false); } - } else if (type == 15) { + } else if (type == 7) { view = li.inflate(R.layout.chat_unread_layout, viewGroup, false); } else if (type == 8) { view = li.inflate(R.layout.chat_outgoing_document_layout, viewGroup, false); @@ -3691,7 +3677,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa } @Override - public void didPressedCanceSendButton(ChatBaseCell cell) { + public void didPressedCancelSendButton(ChatBaseCell cell) { MessageObject message = cell.getMessageObject(); if (message.messageOwner.send_state != 0) { MessagesController.getInstance().cancelSendingMessage(message); @@ -3722,9 +3708,40 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa ((ChatMediaCell)view).mediaDelegate = new ChatMediaCell.ChatMediaCellDelegate() { @Override public void didPressedImage(ChatBaseCell cell) { - NotificationCenter.getInstance().addToMemCache(51, cell.getMessageObject()); - Intent intent = new Intent(parentActivity, GalleryImageViewer.class); - startActivity(intent); + MessageObject message = cell.getMessageObject(); + if (message.messageOwner.send_state == MessagesController.MESSAGE_SEND_STATE_SEND_ERROR) { + createMenu(cell, false); + return; + } else if (message.messageOwner.send_state == MessagesController.MESSAGE_SEND_STATE_SENDING) { + return; + } + if (message.type == 1) { + NotificationCenter.getInstance().addToMemCache(51, message); + Intent intent = new Intent(parentActivity, GalleryImageViewer.class); + startActivity(intent); + } else if (message.type == 3) { + try { + File f = null; + if (message.messageOwner.attachPath != null && message.messageOwner.attachPath.length() != 0) { + f = new File(message.messageOwner.attachPath); + } + if (f == null || f != null && !f.exists()) { + f = new File(Utilities.getCacheDir(), message.getFileName()); + } + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setDataAndType(Uri.fromFile(f), "video/mp4"); + startActivity(intent); + } catch (Exception e) { + alertUserOpenError(message); + } + } else if (message.type == 4) { + if (!isGoogleMapsInstalled()) { + return; + } + NotificationCenter.getInstance().addToMemCache(0, message); + LocationActivity fragment = new LocationActivity(); + ((LaunchActivity)parentActivity).presentFragment(fragment, "location_view", false); + } } }; } @@ -3757,11 +3774,11 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa if (!endReached && messages.size() != 0) { offset = 0; if (i == 0) { - return 14; + return 6; } } if (!unread_end_reached && i == (messages.size() + 1 - offset)) { - return 14; + return 6; } MessageObject message = messages.get(messages.size() - i - offset); return message.contentType; @@ -3769,7 +3786,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa @Override public int getViewTypeCount() { - return 16; + return 12; } @Override @@ -3838,91 +3855,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa nameTextView.setTextColor(Utilities.getColorForId(message.messageOwner.from_id)); } - if (type == 6 || type == 7) { - int width = (int)(Math.min(displaySize.x, displaySize.y) * 0.7f); - int height = width + Utilities.dp(100); - if (type == 6 || type == 7) { - width = (int)(Math.min(displaySize.x, displaySize.y) / 2.5f); - height = width + 100; - } - if (width > 800) { - width = 800; - } - if (height > 800) { - height = 800; - } - - PhotoObject photo = PhotoObject.getClosestImageWithSize(message.photoThumbs, width, height); - - if (photo != null) { - float scale = (float)photo.photoOwner.w / (float)width; - - int w = (int)(photo.photoOwner.w / scale); - int h = (int)(photo.photoOwner.h / scale); - if (h > height) { - float scale2 = h; - h = height; - scale2 /= h; - w = (int)(w / scale2); - } else if (h < Utilities.dp(120)) { - h = Utilities.dp(120); - float hScale = (float)photo.photoOwner.h / h; - if (photo.photoOwner.w / hScale < width) { - w = (int)(photo.photoOwner.w / hScale); - } - } - - FrameLayout.LayoutParams params = (FrameLayout.LayoutParams)photoImage.getLayoutParams(); - params.width = w; - params.height = h; - photoImage.setLayoutParams(params); - - LinearLayout.LayoutParams params2 = (LinearLayout.LayoutParams)chatBubbleView.getLayoutParams(); - params2.width = w + Utilities.dp(12); - params2.height = h + Utilities.dp(12); - chatBubbleView.setLayoutParams(params2); - - if (photo.image != null) { - photoImage.setImageBitmap(photo.image); - } else { - if (photoFileName == null) { - if (message.imagePreview != null) { - photoImage.setImage(photo.photoOwner.location, String.format(Locale.US, "%d_%d", (int)(w / Utilities.density), (int)(h / Utilities.density)), message.imagePreview); - } else { - photoImage.setImage(photo.photoOwner.location, String.format(Locale.US, "%d_%d", (int)(w / Utilities.density), (int)(h / Utilities.density)), message.messageOwner.out ? R.drawable.photo_placeholder_out : R.drawable.photo_placeholder_in); - } - } else { - if (downloadPhotos) { - addToLoadingFile(photoFileName, actionProgress); - if (message.imagePreview != null) { - photoImage.setImage(photo.photoOwner.location, String.format(Locale.US, "%d_%d", (int)(w / Utilities.density), (int)(h / Utilities.density)), message.imagePreview, photo.photoOwner.size); - } else { - photoImage.setImage(photo.photoOwner.location, String.format(Locale.US, "%d_%d", (int)(w / Utilities.density), (int)(h / Utilities.density)), message.messageOwner.out ? R.drawable.photo_placeholder_out : R.drawable.photo_placeholder_in, photo.photoOwner.size); - } - photoObjectToSet = null; - photoFilter = null; - } else { - photoFilter = String.format(Locale.US, "%d_%d", (int)(w / Utilities.density), (int)(h / Utilities.density)); - photoObjectToSet = photo; - photoImage.setImageBitmap(message.imagePreview); - } - } - } - } - - if ((type == 6 || type == 7) && videoTimeText != null) { - int duration = message.messageOwner.media.video.duration; - int minutes = duration / 60; - int seconds = duration - minutes * 60; - videoTimeText.setText(String.format("%d:%02d", minutes, seconds)); - } - } else if (type == 4 || type == 5) { - double lat = message.messageOwner.media.geo.lat; - double lon = message.messageOwner.media.geo._long; - String url = String.format(Locale.US, "https://maps.googleapis.com/maps/api/staticmap?center=%f,%f&zoom=13&size=100x100&maptype=roadmap&scale=%d&markers=color:red|size:big|%f,%f&sensor=false", lat, lon, Math.min(2, (int)Math.ceil(Utilities.density)), lat, lon); - photoImage.setImage(url, null, message.messageOwner.out ? R.drawable.photo_placeholder_out : R.drawable.photo_placeholder_in); - actionAttachButton.setText(LocaleController.getString("ViewLocation", R.string.ViewLocation)); - } else if (type == 11 || type == 10) { + if (type == 11 || type == 10) { int width = displaySize.x - Utilities.dp(30); messageTextView.setText(message.messageText); messageTextView.setMaxWidth(width); @@ -3979,7 +3912,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa contactAvatar.setImageResource(Utilities.getUserAvatarForId(message.messageOwner.media.user_id)); addContactView.setVisibility(View.GONE); } - } else if (type == 15) { + } else if (type == 7) { if (unread_to_load == 1) { messageTextView.setText(LocaleController.formatString("OneNewMessage", R.string.OneNewMessage, unread_to_load)); } else { @@ -4035,15 +3968,11 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa } } - if (message.messageOwner.from_id == UserConfig.clientUserId) { + if (message.isFromMe()) { if (halfCheckImage != null) { if (message.messageOwner.send_state == MessagesController.MESSAGE_SEND_STATE_SENDING) { checkImage.setVisibility(View.INVISIBLE); - if (type == 6 || type == 4) { - halfCheckImage.setImageResource(R.drawable.msg_clock_photo); - } else { - halfCheckImage.setImageResource(R.drawable.msg_clock); - } + halfCheckImage.setImageResource(R.drawable.msg_clock); halfCheckImage.setVisibility(View.VISIBLE); if (actionView != null) { if (actionView != null) { @@ -4077,19 +4006,11 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa if (!message.messageOwner.unread) { halfCheckImage.setVisibility(View.VISIBLE); checkImage.setVisibility(View.VISIBLE); - if (type == 6 || type == 4) { - halfCheckImage.setImageResource(R.drawable.msg_halfcheck_w); - } else { - halfCheckImage.setImageResource(R.drawable.msg_halfcheck); - } + halfCheckImage.setImageResource(R.drawable.msg_halfcheck); } else { halfCheckImage.setVisibility(View.VISIBLE); checkImage.setVisibility(View.INVISIBLE); - if (type == 6 || type == 4) { - halfCheckImage.setImageResource(R.drawable.msg_check_w); - } else { - halfCheckImage.setImageResource(R.drawable.msg_check); - } + halfCheckImage.setImageResource(R.drawable.msg_check); } if (actionView != null) { actionView.setVisibility(View.GONE); @@ -4100,7 +4021,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa } } } - if (message.type == 6 || message.type == 7 || message.type == 8 || message.type == 9) { + if (message.type == 8 || message.type == 9) { Integer tag = (Integer)actionProgress.getTag(); String file = progressByTag.get(tag); if (file != null) { @@ -4122,9 +4043,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa if (f.exists()) { if (actionAttachButton != null) { actionAttachButton.setVisibility(View.VISIBLE); - if (message.type == 6 || message.type == 7) { - actionAttachButton.setText(LocaleController.getString("ViewVideo", R.string.ViewVideo)); - } else if (message.type == 8 || message.type == 9) { + if (message.type == 8 || message.type == 9) { actionAttachButton.setText(LocaleController.getString("Open", R.string.Open)); } } @@ -4140,9 +4059,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa if ((cacheFile = new File(Utilities.getCacheDir(), fileName)).exists()) { if (actionAttachButton != null) { actionAttachButton.setVisibility(View.VISIBLE); - if (message.type == 6 || message.type == 7) { - actionAttachButton.setText(LocaleController.getString("ViewVideo", R.string.ViewVideo)); - } else if (message.type == 8 || message.type == 9) { + if (message.type == 8 || message.type == 9) { actionAttachButton.setText(LocaleController.getString("Open", R.string.Open)); } } @@ -4179,9 +4096,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa } if (actionAttachButton != null) { actionAttachButton.setVisibility(View.VISIBLE); - if (message.type == 6 || message.type == 7) { - actionAttachButton.setText(String.format("%s %.1f MB", LocaleController.getString("DOWNLOAD", R.string.DOWNLOAD), message.messageOwner.media.video.size / 1024.0f / 1024.0f)); - } else if (message.type == 8 || message.type == 9) { + if (message.type == 8 || message.type == 9) { actionAttachButton.setText(LocaleController.getString("DOWNLOAD", R.string.DOWNLOAD)); } } @@ -4412,13 +4327,11 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa if (file != null) { progressBarMap.remove(file); } - } else if (message.type == 6 || message.type == 7 || message.type == 8 || message.type == 9) { + } else if (message.type == 8 || message.type == 9) { String file = progressByTag.get(tag); if (file != null) { loadingFile.remove(file); - if (message.type == 6 || message.type == 7) { - FileLoader.getInstance().cancelLoadFile(message.messageOwner.media.video, null, null, null); - } else if (message.type == 8 || message.type == 9) { + if (message.type == 8 || message.type == 9) { FileLoader.getInstance().cancelLoadFile(null, null, message.messageOwner.media.document, null); } updateVisibleRows(); @@ -4447,44 +4360,17 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa } } - private void alertUserOpenError() { - AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity); - builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); - builder.setPositiveButton(R.string.OK, null); - if (message.type == 6 || message.type == 7) { - builder.setMessage(R.string.NoPlayerInstalled); - } else { - builder.setMessage(LocaleController.formatString("NoHandleAppInstalled", R.string.NoHandleAppInstalled, message.messageOwner.media.document.mime_type)); - } - visibleDialog = builder.show(); - visibleDialog.setCanceledOnTouchOutside(true); - - visibleDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { - @Override - public void onDismiss(DialogInterface dialog) { - visibleDialog = null; - } - }); - } - private void processOnClick(View view) { if (mActionMode != null) { processRowSelect(view); return; } if (message != null) { - if (message.type == 4 || message.type == 5) { - if (!isGoogleMapsInstalled()) { - return; - } - NotificationCenter.getInstance().addToMemCache(0, message); - LocationActivity fragment = new LocationActivity(); - ((LaunchActivity)parentActivity).presentFragment(fragment, "location_view", false); - } else if (message.type == 11) { + if (message.type == 11) { NotificationCenter.getInstance().addToMemCache(51, message); Intent intent = new Intent(parentActivity, GalleryImageViewer.class); startActivity(intent); - } else if (message.type == 6 || message.type == 7 || message.type == 8 || message.type == 9) { + } else if (message.type == 8 || message.type == 9) { File f = null; String fileName = message.getFileName(); if (message.messageOwner.attachPath != null && message.messageOwner.attachPath.length() != 0) { @@ -4497,9 +4383,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa String realMimeType = null; try { Intent intent = new Intent(Intent.ACTION_VIEW); - if (message.type == 6 || message.type == 7) { - intent.setDataAndType(Uri.fromFile(f), "video/mp4"); - } else if (message.type == 8 || message.type == 9) { + if (message.type == 8 || message.type == 9) { MimeTypeMap myMime = MimeTypeMap.getSingleton(); int idx = fileName.lastIndexOf("."); if (idx != -1) { @@ -4525,16 +4409,14 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa startActivity(intent); } } catch (Exception e) { - alertUserOpenError(); + alertUserOpenError(message); } } else { - if (message.messageOwner.send_state != MessagesController.MESSAGE_SEND_STATE_SEND_ERROR && message.messageOwner.send_state != MessagesController.MESSAGE_SEND_STATE_SENDING || !message.messageOwner.out) { + if (message.messageOwner.send_state != MessagesController.MESSAGE_SEND_STATE_SEND_ERROR && message.messageOwner.send_state != MessagesController.MESSAGE_SEND_STATE_SENDING || !message.isOut()) { if (!loadingFile.containsKey(fileName)) { progressByTag.put((Integer)actionProgress.getTag(), fileName); addToLoadingFile(fileName, actionProgress); - if (message.type == 6 || message.type == 7) { - FileLoader.getInstance().loadFile(message.messageOwner.media.video, null, null, null); - } else if (message.type == 8 || message.type == 9) { + if (message.type == 8 || message.type == 9) { FileLoader.getInstance().loadFile(null, null, message.messageOwner.media.document, null); } updateVisibleRows(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/GalleryImageViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/GalleryImageViewer.java index 1caf0d20c..b2dd8cd6a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/GalleryImageViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/GalleryImageViewer.java @@ -726,9 +726,9 @@ public class GalleryImageViewer extends AbstractGalleryActivity implements Notif return; } if (isVideo) { - MediaController.saveFile(currentFileName, this, 1, null); + MediaController.saveFile(currentFileName, null, this, 1, null); } else { - MediaController.saveFile(currentFileName, this, 0, null); + MediaController.saveFile(currentFileName, null, this, 0, null); } break; // case R.id.gallery_menu_send: { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PhotoCropActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/PhotoCropActivity.java index cf2594b7b..72de0addd 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PhotoCropActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PhotoCropActivity.java @@ -182,7 +182,7 @@ public class PhotoCropActivity extends BaseFragment { } private void updateBitmapSize() { - if (viewWidth == 0 || viewHeight == 0) { + if (viewWidth == 0 || viewHeight == 0 || imageToCrop == null) { return; } float percX = (rectX - bitmapX) / bitmapWidth; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java index 2a30b9303..08a4c8d66 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java @@ -21,10 +21,12 @@ import android.os.Bundle; import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBarActivity; import android.text.Html; +import android.text.Spannable; import android.text.method.LinkMovementMethod; import android.util.Base64; import android.view.LayoutInflater; import android.view.MenuItem; +import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; @@ -93,6 +95,18 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter private int telegramFaqRow; private int languageRow; + private static class LinkMovementMethodMy extends LinkMovementMethod { + @Override + public boolean onTouchEvent(TextView widget, Spannable buffer, MotionEvent event) { + try { + return super.onTouchEvent(widget, buffer, event); + } catch (Exception e) { + FileLog.e("tmessages", e); + } + return false; + } + } + @Override public boolean onFragmentCreate() { super.onFragmentCreate(); @@ -252,7 +266,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter message.setText(Html.fromHtml(LocaleController.getString("AskAQuestionInfo", R.string.AskAQuestionInfo))); message.setTextSize(18); message.setPadding(Utilities.dp(8), Utilities.dp(5), Utilities.dp(8), Utilities.dp(6)); - message.setMovementMethod(LinkMovementMethod.getInstance()); + message.setMovementMethod(new LinkMovementMethodMy()); AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity); builder.setView(message); @@ -642,6 +656,9 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter button2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { + if (parentActivity == null) { + return; + } AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity); diff --git a/TMessagesProj/src/main/res/drawable-hdpi/playvideo.png b/TMessagesProj/src/main/res/drawable-hdpi/playvideo.png new file mode 100755 index 0000000000000000000000000000000000000000..2de03e80aea692c6880527110658e06c3d0b4138 GIT binary patch literal 2654 zcmV-k3ZeChP)5G6qql~sg6Ib5+IrHJfGcFkfbD^kQ2RtO{l zRUQbViKNhFR_HtsO+k%7&EN9%cF;D^CeZt!6);AFxB#G@ zUu-}?zpn7MjsRdTrG=f>Yr5@#A^>_wTQlM%dfD zd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wtu=joX5Y=%<+^Ubo zBn>ZcoBi_T%h#}kPn;XdiHV6;fq{XZB#T5T1x*1EuD@?zqCNnNN1w5P6H63vmw5n7 z_^^6SROdg@IYZLKfMn1?O-=11zPyMH_mDEve#Lbp+M57Eg)SPF{I<5XHdj|yKPoOR zethoSxhH~5A10HzfWctsy1KfWg99|1bS%1p0PwxA0E_jIJgI0!XZl}f#3{j(crcB4 zo6nt{ozDTRVPj)so|!9xXlZFpRgBt10LX(eOGP!!#Qwhp@C}3yg$xg?*YLcAC5b%K z36h|H(I%D;F;5Un#h)n8hR@W=Ql^g9gLO<)q3a-RVjE7P@*e>P0O8+EuiMC|`Tzg` M07*qoM6N<$f=a60lmGw# literal 0 HcmV?d00001 diff --git a/TMessagesProj/src/main/res/drawable-hdpi/playvideo_pressed.png b/TMessagesProj/src/main/res/drawable-hdpi/playvideo_pressed.png new file mode 100755 index 0000000000000000000000000000000000000000..efda9fc01568c285a92716261b7b5646fa8c6e19 GIT binary patch literal 2788 zcmV%w%0HwnvBrSK; z)zyE*HF-(}f&tixPTg<}rE|5lwKcbI-!43R_H1!?gYIjwv$NCn_V%`%Hf`EhCMeu_ zNJ$2cC;-V-I0!)4iq5|006cv7urwhd;opggiIse)oP&dden3FLR7Xe0aYCU`g8?~f zV`CElNokck2n^V=wY4>h3?K&}IyyQlGc&VV9tPOL!a{rd_U+Chk!T{+M4cJe=#RA_ z{Q?0)xDpUT(bOar5R1j>adB~FikSYUPoHiS6cjYq%*_c?VHkTpWvk zUPSG@yu5;S>(-?LMvJ2Tft@>dPW1BfawByCj4TZejkT7Rmen!`0b4K-)lp1|^WYOS zpE`9aEiy8)K$)DQ*|TR44GRnN($&?~2aJ4Zj2{eXxy(S|VgW#$Mm<9+l{STjh9)H^ zC;zI9o+1W5I5sxcdngKiRzNa*t*op{WdZ^aPC^pq)YsS7ZQQu=?>RX+FO=DB9x`Oe zz!N7S%bo2oS2@j?-oR9X{jxy$X(Pve*AdqrAwEd zs#;_TcfN7+=F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tyN!f(Du>izb;y`eS_g0`ao{t1Q-bWZ=IX>4q4LK|L-T3U(Yi?Qs} z#l^+S)6>%dkoE$Bz?8Yv4$vRrGjSLXXw=N=vXlUigSJ=F2IAY-$lhN-Xl!9&Atbw0 z(?LJL=TE?%8p~E$1s;*dj~~y3Nzl%x2eZH7FjmD$%Z^V86I)d~q}u)`^nU>c06Jz> UDwdGs&j0`b07*qoM6N<$f>(WvlK=n! literal 0 HcmV?d00001 diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/playvideo.png b/TMessagesProj/src/main/res/drawable-xhdpi/playvideo.png new file mode 100755 index 0000000000000000000000000000000000000000..a43f768fca6deba85076c6d69a0d179f80ba01c2 GIT binary patch literal 3534 zcmV;<4KebGP)+9+0(2s0PZ*%e#@9np%JL>ecqKxM?jdtx17_fyNFF4znyREzLDFG-is}?ICb9 za0=W*FXI4)^E$%M7s9~y_4W1E)YMd_r>7V1*|Vn_K<<A1?k^vI{PAVzv`=L*qEDGJMd90TzqRr7^jxf_ zrlu+McQtkhxSxF50u1L`3O`>1tCGNGW@hFD2M7NG^0kvL`XGyV&R^? zrX9d=9xnWBBL6EbEiK%%Y16r~va$|38Ufg&Q&LhKmMvTMo|2N1GVxahUu=}g9AF?D zey0=x+L1fGYgC@d`e z)y>T<{ocKMJuHS%Vq)Uk8#ZkCKv7X~5>XuqARm$iz)OIWNF(6Lkt3(KZ{J?RVla7l zcxVF98>dg7u1!=Q1dzGX1b8J522`Q5v$Ngb-#_8lv15O-#@c0^SO zfP6w6fE9*uov$cxpFDZ;2*tv902k?0Qu^ho3E*vo3 zaN$DsD{w{AXPq(B;tb#-;sU>d+DPo8Y9si`3i zkoDpK{3*4OlarGtt!bX0fByMER#ukhj2SbOm;^GYZCONdGw_tb0LGw@dAQNr+uIWw z8v2X08mg$MsI++TVlQ~02jb)77cd3j#Kgou8X6jEh$^qa02cfSws(~*d<`lpDjER+ z0UzDDb0@;z-`|i4AfG>fzIY%pAq?;uY6IgIWZ7sP9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y$Fsf?} zxPjT3zWL@GOIew>D^{%7<>=^mLK^1nXstJEYik>#>c_zVMmkJwtX{p^MVh_1wYBvQ zn6^>S=$Nx-&o(nbRg8^|bwDp9zlh5Ts)qtN8Et6Xz^osUk&))oXea>s0~k4>5fKsB zm}21Q>+4T;adB}Xs`d%*Gte@w02Y6p-2MCan?R9|p;I_3UFg!KOaJ6>IDh9CaT$TL z@IC{*{>h}u_T6{i*}sDGWpZ-gj_tnEDFVmt^m9 z1qB5~LOHlF9DtF|Py!p1wk0GaEPVy*3&N~{#0pQO@PYOnN<$DFh)LVx zW3mxZU0uDMNZCaV@LNX$?r1~=N$beL4=Fo4`_k&wt1mD~WT3na3=H%lLZ6UM0$A4#0CGscYu(AaQ&Zr z*tc(AHfCy)C9rHZ`?a{ZI49709E3jYfD{Rw2=^qmXp_mOcHo@2a>yrufK8b z+_}QNd-qR~6ENmoS>XPZlqTt*ZjDbml{?Dw&oNU*x zU$4YWA(+fU5(^-=ZQEwBeED*=y}i9Hs9&N2%hBH*1^19O(reJ-b7yc3b3V|%1MLF< z*MY(ETUlAzALZrc4~Cng7*#A=TifXXrk;g`g|VTb;cO8ifFc}tzl64DkM<$b>VtiJ z(Xo;bG<&H1F{N$~P-|=J!^e*wzmy;k%vS|HJ-z<$E=^6%nS?nz5MeML2G-z5`)bDO zEuq~P5s8Kwv0h|n!emSw35i}50T>l@akyXEq7A@fMA-Z6_>6MfNSq!nL>M3ZJAc5! zKt{~DDf1w~2{ixgFUBcj(j&}gA)LjemoH1Ho=Qur@qYpg05rI&(@4%*?*IS*07*qo IM6N<$f-9z%J^%m! literal 0 HcmV?d00001 diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/playvideo_pressed.png b/TMessagesProj/src/main/res/drawable-xhdpi/playvideo_pressed.png new file mode 100755 index 0000000000000000000000000000000000000000..e75bdb5895ead25e1d8bef45a583047abb62699c GIT binary patch literal 3710 zcmV-^4uSEBP)R~CkwO%REoB1%9|WEYW$%K$2dK@urY3c?t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diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/playvideo_pressed.png b/TMessagesProj/src/main/res/drawable-xxhdpi/playvideo_pressed.png new file mode 100755 index 0000000000000000000000000000000000000000..bd3c6ec0d65806fb2767b2efc315f84d37d77a77 GIT binary patch literal 5675 zcmW-l1yoay`^HzmzyTwrQxK%PVaNpOk`!fh3n&tTu#tk4N{56|~Rg(@dV?9TwShi}hm+-q;u#3YZdEA*%&LUt9ijeIQgZ-c0vVv4LyK)i8)m z(Vb4)Ft36xwV5+_%8ZCkD)-IKz0epqS&V`GLG~XNLXH(22Df=Xcl7#5cimB3BK;z> zcHV*ZmBBl=fTQ&|e0@#JVq#Vn3)DRQP{uklGjlO%<06maPx6(rBDk;-UudDG7RFQl z)#k6r%Gi;mswyXYijg@PrZ03w$9$2*IDGLey^rl#gqTR&sUPlE&Ls&(H3erphe zqPY<*9i0f6!;B9(&leC7FmrNpLbFU67wLcyq@NGc90A9=RjH$dAsi*N@IL3zrXZoE zVY8d;_dl-B%bHtSS|BO{{QUf*vAl)3gkjJ=sofYJ zWDt8>nbcU~hYueDS30BX-n@Ae7f@HEqd7kc5gii~({5({T577Jqr)_fJH`=hVG(eI1w-$x zLExi^Z>j=1w;h=v5Xf*J6I`e-lAJkGFH?F*6==<;h)VWQPb$O=mysh5+s{TudDGxU z#of1m@7}$Bpd3xXkOorYtl43JzK4oi9YIwngl`}u%W>e*f?x)Sr8worNY0O)jSWAd z+~RG{qLsb9g^`|~p0AV-Zy8uYjBC?6mK9S;Il|N506I0YwqE?y*Vi}l${=9d+I_xx zd}4Zfnr$$`=oYWNP+DTG5jon?alO*ZNTcTR{A9Z!MZ}s-WW+L0%A@+(d^6<<>P>$c ziPMoAmdk1j3qtzXyaeev4+!?q9$jBujO@)d9Z^)gS`O{2cztmikd~SG;;|^_Y+L1& zuoP-_ef|0N)|PKu-$D^@{tIeaTKkRlb?Glee5YXAZF5SPY=ZQXh&%V#2&F2$u$6yf zaq*^z<7En%m)JxRr#>RG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mHrkGu~tZhsVZ`(R(5af6AwF&}{Bt5{LTaW$ngLeZUBLRdH;Q=klP$qDX z#gZHyj4LOoSP9B}Yi!^;2D0S$U@M;K5oo|8}(Q zwe0L{vEirk$3KbrD!s~i;-V{`fSgdv#(kTC}9RJjlY-^t1)ohy1qSE+b1ot?rSGYHDh)g@h^^q^$w@R+v>j zJ(tz0fL7vz;VN - - - - - - \ No newline at end of file diff --git a/TMessagesProj/src/main/res/drawable/chat_outgoing_photo_states.xml b/TMessagesProj/src/main/res/drawable/chat_outgoing_photo_states.xml deleted file mode 100644 index 888231668..000000000 --- a/TMessagesProj/src/main/res/drawable/chat_outgoing_photo_states.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/TMessagesProj/src/main/res/layout/chat_group_incoming_video_layout.xml b/TMessagesProj/src/main/res/layout/chat_group_incoming_video_layout.xml deleted file mode 100644 index 3e06478ab..000000000 --- a/TMessagesProj/src/main/res/layout/chat_group_incoming_video_layout.xml +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/TMessagesProj/src/main/res/layout/chat_incoming_video_layout.xml b/TMessagesProj/src/main/res/layout/chat_incoming_video_layout.xml deleted file mode 100644 index f9d92c130..000000000 --- a/TMessagesProj/src/main/res/layout/chat_incoming_video_layout.xml +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/TMessagesProj/src/main/res/layout/chat_outgoing_video_layout.xml b/TMessagesProj/src/main/res/layout/chat_outgoing_video_layout.xml deleted file mode 100644 index 83e227b57..000000000 --- a/TMessagesProj/src/main/res/layout/chat_outgoing_video_layout.xml +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file