From 51add404effb8952ae285fe1cdb19faef6dc8c16 Mon Sep 17 00:00:00 2001 From: DrKLO Date: Thu, 26 Dec 2013 15:43:37 +0400 Subject: [PATCH] update to 1.3.6 --- TMessagesProj/src/main/AndroidManifest.xml | 4 +- .../java/org/telegram/TL/TLClassStore.java | 86 +- .../src/main/java/org/telegram/TL/TLRPC.java | 1719 ++++++++++++----- .../messenger/ConnectionsManager.java | 64 +- .../org/telegram/messenger/Datacenter.java | 11 +- .../java/org/telegram/messenger/Emoji.java | 9 +- .../telegram/messenger/FileLoadOperation.java | 65 +- .../org/telegram/messenger/FileLoader.java | 60 +- .../java/org/telegram/messenger/FileLog.java | 12 +- .../telegram/messenger/HandshakeAction.java | 51 +- .../messenger/MessagesController.java | 166 +- .../org/telegram/messenger/RPCRequest.java | 2 + .../org/telegram/messenger/Utilities.java | 12 + .../org/telegram/objects/MessageObject.java | 45 + .../org/telegram/ui/ApplicationActivity.java | 6 +- .../org/telegram/ui/ApplicationLoader.java | 8 +- .../java/org/telegram/ui/ChatActivity.java | 474 +++-- .../telegram/ui/DocumentSelectActivity.java | 475 +++++ .../org/telegram/ui/GalleryImageViewer.java | 4 +- .../telegram/ui/LoginActivityPhoneView.java | 6 +- .../java/org/telegram/ui/MediaActivity.java | 2 +- .../org/telegram/ui/SettingsActivity.java | 2 +- .../ui/SettingsWallpapersActivity.java | 6 +- .../telegram/ui/Views/FrameLayoutFixed.java | 1 + .../ui/Views/NiceSupportMapFragment.java | 155 -- .../org/telegram/ui/Views/TightTextView.java | 3 + .../src/main/res/drawable-hdpi/doc_blue.png | Bin 0 -> 869 bytes .../src/main/res/drawable-hdpi/doc_green.png | Bin 0 -> 875 bytes .../src/main/res/drawable-hdpi/ic_ab_doc.png | Bin 0 -> 883 bytes .../main/res/drawable-hdpi/ic_directory.png | Bin 0 -> 652 bytes .../res/drawable-hdpi/ic_external_storage.png | Bin 0 -> 444 bytes .../src/main/res/drawable-hdpi/ic_storage.png | Bin 0 -> 325 bytes .../src/main/res/drawable-ldpi/doc_blue.png | Bin 0 -> 500 bytes .../src/main/res/drawable-ldpi/doc_green.png | Bin 0 -> 490 bytes .../src/main/res/drawable-ldpi/ic_ab_doc.png | Bin 0 -> 496 bytes .../src/main/res/drawable-mdpi/doc_blue.png | Bin 0 -> 589 bytes .../src/main/res/drawable-mdpi/doc_green.png | Bin 0 -> 587 bytes .../src/main/res/drawable-mdpi/ic_ab_doc.png | Bin 0 -> 604 bytes .../main/res/drawable-mdpi/ic_directory.png | Bin 0 -> 501 bytes .../res/drawable-mdpi/ic_external_storage.png | Bin 0 -> 330 bytes .../src/main/res/drawable-mdpi/ic_storage.png | Bin 0 -> 253 bytes .../src/main/res/drawable-xhdpi/doc_blue.png | Bin 0 -> 1759 bytes .../src/main/res/drawable-xhdpi/doc_green.png | Bin 0 -> 1758 bytes .../src/main/res/drawable-xhdpi/ic_ab_doc.png | Bin 0 -> 1690 bytes .../main/res/drawable-xhdpi/ic_directory.png | Bin 0 -> 764 bytes .../drawable-xhdpi/ic_external_storage.png | Bin 0 -> 651 bytes .../main/res/drawable-xhdpi/ic_storage.png | Bin 0 -> 414 bytes .../src/main/res/drawable-xxhdpi/doc_blue.png | Bin 0 -> 1602 bytes .../main/res/drawable-xxhdpi/doc_green.png | Bin 0 -> 1612 bytes .../main/res/drawable-xxhdpi/ic_ab_doc.png | Bin 0 -> 1620 bytes .../main/res/drawable-xxhdpi/ic_directory.png | Bin 0 -> 1160 bytes .../drawable-xxhdpi/ic_external_storage.png | Bin 0 -> 673 bytes .../main/res/drawable-xxhdpi/ic_storage.png | Bin 0 -> 589 bytes .../main/res/drawable/photo_progress_chat.xml | 22 + .../src/main/res/layout-ar/document_item.xml | 83 + .../chat_group_incoming_contact_layout.xml | 4 +- .../chat_group_incoming_document_layout.xml | 138 ++ .../chat_group_incoming_video_layout.xml | 5 +- .../layout/chat_incoming_contact_layout.xml | 1 - .../layout/chat_incoming_document_layout.xml | 128 ++ .../layout/chat_incoming_forward_layout.xml | 19 +- .../res/layout/chat_incoming_video_layout.xml | 8 +- .../src/main/res/layout/chat_layout.xml | 2 +- .../layout/chat_outgoing_contact_layout.xml | 2 +- .../layout/chat_outgoing_document_layout.xml | 155 ++ .../res/layout/chat_outgoing_photo_layout.xml | 10 +- .../res/layout/chat_outgoing_video_layout.xml | 5 +- .../src/main/res/layout/document_item.xml | 73 + .../res/layout/document_select_layout.xml | 28 + TMessagesProj/src/main/res/menu/chat_menu.xml | 5 + .../src/main/res/values-ar/strings.xml | 23 + TMessagesProj/src/main/res/values/strings.xml | 23 + 72 files changed, 3190 insertions(+), 992 deletions(-) create mode 100644 TMessagesProj/src/main/java/org/telegram/ui/DocumentSelectActivity.java delete mode 100644 TMessagesProj/src/main/java/org/telegram/ui/Views/NiceSupportMapFragment.java create mode 100755 TMessagesProj/src/main/res/drawable-hdpi/doc_blue.png create mode 100755 TMessagesProj/src/main/res/drawable-hdpi/doc_green.png create mode 100644 TMessagesProj/src/main/res/drawable-hdpi/ic_ab_doc.png create mode 100644 TMessagesProj/src/main/res/drawable-hdpi/ic_directory.png create mode 100644 TMessagesProj/src/main/res/drawable-hdpi/ic_external_storage.png create mode 100644 TMessagesProj/src/main/res/drawable-hdpi/ic_storage.png create mode 100755 TMessagesProj/src/main/res/drawable-ldpi/doc_blue.png create mode 100755 TMessagesProj/src/main/res/drawable-ldpi/doc_green.png create mode 100644 TMessagesProj/src/main/res/drawable-ldpi/ic_ab_doc.png create mode 100755 TMessagesProj/src/main/res/drawable-mdpi/doc_blue.png create mode 100755 TMessagesProj/src/main/res/drawable-mdpi/doc_green.png create mode 100644 TMessagesProj/src/main/res/drawable-mdpi/ic_ab_doc.png create mode 100644 TMessagesProj/src/main/res/drawable-mdpi/ic_directory.png create mode 100644 TMessagesProj/src/main/res/drawable-mdpi/ic_external_storage.png create mode 100644 TMessagesProj/src/main/res/drawable-mdpi/ic_storage.png create mode 100755 TMessagesProj/src/main/res/drawable-xhdpi/doc_blue.png create mode 100755 TMessagesProj/src/main/res/drawable-xhdpi/doc_green.png create mode 100644 TMessagesProj/src/main/res/drawable-xhdpi/ic_ab_doc.png create mode 100644 TMessagesProj/src/main/res/drawable-xhdpi/ic_directory.png create mode 100644 TMessagesProj/src/main/res/drawable-xhdpi/ic_external_storage.png create mode 100644 TMessagesProj/src/main/res/drawable-xhdpi/ic_storage.png create mode 100755 TMessagesProj/src/main/res/drawable-xxhdpi/doc_blue.png create mode 100755 TMessagesProj/src/main/res/drawable-xxhdpi/doc_green.png create mode 100644 TMessagesProj/src/main/res/drawable-xxhdpi/ic_ab_doc.png create mode 100644 TMessagesProj/src/main/res/drawable-xxhdpi/ic_directory.png create mode 100644 TMessagesProj/src/main/res/drawable-xxhdpi/ic_external_storage.png create mode 100644 TMessagesProj/src/main/res/drawable-xxhdpi/ic_storage.png create mode 100644 TMessagesProj/src/main/res/drawable/photo_progress_chat.xml create mode 100644 TMessagesProj/src/main/res/layout-ar/document_item.xml create mode 100644 TMessagesProj/src/main/res/layout/chat_group_incoming_document_layout.xml create mode 100644 TMessagesProj/src/main/res/layout/chat_incoming_document_layout.xml create mode 100644 TMessagesProj/src/main/res/layout/chat_outgoing_document_layout.xml create mode 100644 TMessagesProj/src/main/res/layout/document_item.xml create mode 100644 TMessagesProj/src/main/res/layout/document_select_layout.xml diff --git a/TMessagesProj/src/main/AndroidManifest.xml b/TMessagesProj/src/main/AndroidManifest.xml index 22ddb19d6..4a4be47de 100644 --- a/TMessagesProj/src/main/AndroidManifest.xml +++ b/TMessagesProj/src/main/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="129" + android:versionName="1.3.6"> new_messages = new ArrayList(); public ArrayList new_encrypted_messages = new ArrayList(); public ArrayList other_updates = new ArrayList(); public ArrayList chats = new ArrayList(); public ArrayList users = new ArrayList(); - public TL_updates_state state; - public int pts; - public int date; - public int qts; public TL_updates_state intermediate_state; - public int seq; + public TL_updates_state state; } - public static class TL_updates_difference extends updates_Difference { - public static int constructor = 0xf49ca0; + public static class TL_updates_differenceEmpty extends updates_Difference { + public static int constructor = 0x5d75a138; public void readParams(SerializedData stream) { - stream.readInt32(); - int count = stream.readInt32(); - for (int a = 0; a < count; a++) { - new_messages.add((Message)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32())); - } - stream.readInt32(); - count = stream.readInt32(); - for (int a = 0; a < count; a++) { - new_encrypted_messages.add((EncryptedMessage)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32())); - } - stream.readInt32(); - count = stream.readInt32(); - for (int a = 0; a < count; a++) { - other_updates.add((Update)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32())); - } - stream.readInt32(); - count = stream.readInt32(); - for (int a = 0; a < count; a++) { - chats.add((Chat)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32())); - } - stream.readInt32(); - count = stream.readInt32(); - for (int a = 0; a < count; a++) { - users.add((User)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32())); - } - state = (TL_updates_state)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()); + date = stream.readInt32(); + seq = stream.readInt32(); } public void serializeToStream(SerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = new_messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - new_messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = new_encrypted_messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - new_encrypted_messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = other_updates.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - other_updates.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - state.serializeToStream(stream); + stream.writeInt32(date); + stream.writeInt32(seq); } } @@ -678,19 +623,72 @@ public class TLRPC { } } - public static class TL_updates_differenceEmpty extends updates_Difference { - public static int constructor = 0x5d75a138; + public static class TL_updates_difference extends updates_Difference { + public static int constructor = 0xf49ca0; public void readParams(SerializedData stream) { - date = stream.readInt32(); - seq = stream.readInt32(); + stream.readInt32(); + int count = stream.readInt32(); + for (int a = 0; a < count; a++) { + new_messages.add((Message)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32())); + } + stream.readInt32(); + count = stream.readInt32(); + for (int a = 0; a < count; a++) { + new_encrypted_messages.add((EncryptedMessage)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32())); + } + stream.readInt32(); + count = stream.readInt32(); + for (int a = 0; a < count; a++) { + other_updates.add((Update)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32())); + } + stream.readInt32(); + count = stream.readInt32(); + for (int a = 0; a < count; a++) { + chats.add((Chat)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32())); + } + stream.readInt32(); + count = stream.readInt32(); + for (int a = 0; a < count; a++) { + users.add((User)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32())); + } + state = (TL_updates_state)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()); } public void serializeToStream(SerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(date); - stream.writeInt32(seq); + stream.writeInt32(0x1cb5c415); + int count = new_messages.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + new_messages.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = new_encrypted_messages.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + new_encrypted_messages.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = other_updates.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + other_updates.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = chats.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + chats.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = users.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + users.get(a).serializeToStream(stream); + } + state.serializeToStream(stream); } } @@ -724,6 +722,42 @@ public class TLRPC { } } + public static class help_AppUpdate extends TLObject { + public int id; + public boolean critical; + public String url; + public String text; + } + + public static class TL_help_appUpdate extends help_AppUpdate { + public static int constructor = 0x8987f311; + + + public void readParams(SerializedData stream) { + id = stream.readInt32(); + critical = stream.readBool(); + url = stream.readString(); + text = stream.readString(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(id); + stream.writeBool(critical); + stream.writeString(url); + stream.writeString(text); + } + } + + public static class TL_help_noAppUpdate extends help_AppUpdate { + public static int constructor = 0xc45a6536; + + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + } + } + public static class TL_messageEmpty extends Message { public static int constructor = 0x83e5de54; @@ -808,13 +842,15 @@ public class TLRPC { public static class MessageMedia extends TLObject { public Video video; - public GeoPoint geo; public Photo photo; + public Document document; + public GeoPoint geo; + public Audio audio; public String phone_number; public String first_name; public String last_name; - public byte[] bytes; public int user_id; + public byte[] bytes; } public static class TL_messageMediaVideo extends MessageMedia { @@ -831,20 +867,6 @@ public class TLRPC { } } - public static class TL_messageMediaGeo extends MessageMedia { - public static int constructor = 0x56e0d474; - - - public void readParams(SerializedData stream) { - geo = (GeoPoint)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()); - } - - public void serializeToStream(SerializedData stream) { - stream.writeInt32(constructor); - geo.serializeToStream(stream); - } - } - public static class TL_messageMediaPhoto extends MessageMedia { public static int constructor = 0xc8c45a2a; @@ -859,6 +881,34 @@ public class TLRPC { } } + public static class TL_messageMediaDocument extends MessageMedia { + public static int constructor = 0x2fda2204; + + + public void readParams(SerializedData stream) { + document = (Document)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + document.serializeToStream(stream); + } + } + + public static class TL_messageMediaGeo extends MessageMedia { + public static int constructor = 0x56e0d474; + + + public void readParams(SerializedData stream) { + geo = (GeoPoint)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + geo.serializeToStream(stream); + } + } + public static class TL_messageMediaEmpty extends MessageMedia { public static int constructor = 0x3ded6320; @@ -868,6 +918,20 @@ public class TLRPC { } } + public static class TL_messageMediaAudio extends MessageMedia { + public static int constructor = 0xc6b68300; + + + public void readParams(SerializedData stream) { + audio = (Audio)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + audio.serializeToStream(stream); + } + } + public static class TL_messageMediaContact extends MessageMedia { public static int constructor = 0x5e7d2f39; @@ -891,6 +955,7 @@ public class TLRPC { public static class TL_messageMediaUnsupported extends MessageMedia { public static int constructor = 0x29632a36; + public void readParams(SerializedData stream) { bytes = stream.readByteArray(); } @@ -1162,6 +1227,56 @@ public class TLRPC { } } + public static class Audio extends TLObject { + public long id; + public long access_hash; + public int user_id; + public int date; + public int duration; + public int size; + public int dc_id; + } + + public static class TL_audioEmpty extends Audio { + public static int constructor = 0x586988d8; + + + public void readParams(SerializedData stream) { + id = stream.readInt64(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + } + } + + public static class TL_audio extends Audio { + public static int constructor = 0x427425e7; + + + public void readParams(SerializedData stream) { + id = stream.readInt64(); + access_hash = stream.readInt64(); + user_id = stream.readInt32(); + date = stream.readInt32(); + duration = stream.readInt32(); + size = stream.readInt32(); + dc_id = stream.readInt32(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32(user_id); + stream.writeInt32(date); + stream.writeInt32(duration); + stream.writeInt32(size); + stream.writeInt32(dc_id); + } + } + public static class TL_destroy_sessions_res extends TLObject { public static int constructor = 0xfb95abcd; @@ -1724,6 +1839,22 @@ public class TLRPC { public long secret; } + public static class TL_inputAudioFileLocation extends InputFileLocation { + public static int constructor = 0x74dc404d; + + + public void readParams(SerializedData stream) { + id = stream.readInt64(); + access_hash = stream.readInt64(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + } + } + public static class TL_inputEncryptedFileLocation extends InputFileLocation { public static int constructor = 0xf5235d55; @@ -1740,6 +1871,38 @@ public class TLRPC { } } + public static class TL_inputVideoFileLocation extends InputFileLocation { + public static int constructor = 0x3d0364ec; + + + public void readParams(SerializedData stream) { + id = stream.readInt64(); + access_hash = stream.readInt64(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + } + } + + public static class TL_inputDocumentFileLocation extends InputFileLocation { + public static int constructor = 0x4e45abe9; + + + public void readParams(SerializedData stream) { + id = stream.readInt64(); + access_hash = stream.readInt64(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + } + } + public static class TL_inputFileLocation extends InputFileLocation { public static int constructor = 0x14637196; @@ -1758,22 +1921,6 @@ public class TLRPC { } } - public static class TL_inputVideoFileLocation extends InputFileLocation { - public static int constructor = 0x3d0364ec; - - - public void readParams(SerializedData stream) { - id = stream.readInt64(); - access_hash = stream.readInt64(); - } - - public void serializeToStream(SerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - } - } - public static class TL_photos_photo extends TLObject { public static int constructor = 0x20212ca8; @@ -2025,6 +2172,7 @@ public class TLRPC { public static class TL_messageActionChatEditPhoto extends MessageAction { public static int constructor = 0x7fcb13a8; + public void readParams(SerializedData stream) { photo = (Photo)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()); } @@ -2243,7 +2391,19 @@ public class TLRPC { } } - public static class TL_peerNotifyEventsAll extends TLObject { + public static class PeerNotifyEvents extends TLObject { + } + + public static class TL_peerNotifyEventsEmpty extends PeerNotifyEvents { + public static int constructor = 0xadd53cb3; + + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_peerNotifyEventsAll extends PeerNotifyEvents { public static int constructor = 0x6d1ded88; @@ -2296,21 +2456,6 @@ public class TLRPC { } } - public static class TL_decryptedMessageActionSetMessageTTL extends TLObject { - public static int constructor = 0xa1733aec; - - public int ttl_seconds; - - public void readParams(SerializedData stream) { - ttl_seconds = stream.readInt32(); - } - - public void serializeToStream(SerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(ttl_seconds); - } - } - public static class TL_decryptedMessage extends DecryptedMessage { public static int constructor = 0x1f814f1f; @@ -2331,7 +2476,10 @@ public class TLRPC { } } - public static class TL_inputPeerNotifyEventsAll extends TLObject { + public static class InputPeerNotifyEvents extends TLObject { + } + + public static class TL_inputPeerNotifyEventsAll extends InputPeerNotifyEvents { public static int constructor = 0xe86a2c74; @@ -2340,6 +2488,15 @@ public class TLRPC { } } + public static class TL_inputPeerNotifyEventsEmpty extends InputPeerNotifyEvents { + public static int constructor = 0xf03064d8; + + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + } + } + public static class TL_client_DH_inner_data extends TLObject { public static int constructor = 0x6643b654; @@ -2430,6 +2587,36 @@ public class TLRPC { } } + public static class InputDocument extends TLObject { + public long id; + public long access_hash; + } + + public static class TL_inputDocumentEmpty extends InputDocument { + public static int constructor = 0x72f0eaae; + + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_inputDocument extends InputDocument { + public static int constructor = 0x18798952; + + + public void readParams(SerializedData stream) { + id = stream.readInt64(); + access_hash = stream.readInt64(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + } + } + public static class TL_inputAppEvent extends TLObject { public static int constructor = 0x770656a8; @@ -2475,29 +2662,129 @@ public class TLRPC { } } + public static class TL_documentEmpty extends Document { + public static int constructor = 0x36f8c871; + + + public void readParams(SerializedData stream) { + id = stream.readInt64(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + } + } + + public static class TL_document extends Document { + public static int constructor = 0x9efc6326; + + + public void readParams(SerializedData stream) { + id = stream.readInt64(); + access_hash = stream.readInt64(); + user_id = stream.readInt32(); + date = stream.readInt32(); + file_name = stream.readString(); + mime_type = stream.readString(); + size = stream.readInt32(); + thumb = (PhotoSize)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()); + dc_id = stream.readInt32(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32(user_id); + stream.writeInt32(date); + stream.writeString(file_name); + stream.writeString(mime_type); + stream.writeInt32(size); + thumb.serializeToStream(stream); + stream.writeInt32(dc_id); + } + } + public static class InputMedia extends TLObject { - public InputFile file; - public InputGeoPoint geo_point; public String phone_number; public String first_name; public String last_name; + public InputFile file; public InputFile thumb; + public String file_name; + public String mime_type; + public InputGeoPoint geo_point; public int duration; public int w; public int h; } - public static class TL_inputMediaUploadedPhoto extends InputMedia { - public static int constructor = 0x2dc53a7d; + public static class TL_inputMediaContact extends InputMedia { + public static int constructor = 0xa6e45987; + + + public void readParams(SerializedData stream) { + phone_number = stream.readString(); + first_name = stream.readString(); + last_name = stream.readString(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(phone_number); + stream.writeString(first_name); + stream.writeString(last_name); + } + } + + public static class TL_inputMediaUploadedThumbDocument extends InputMedia { + public static int constructor = 0x3e46de5d; public void readParams(SerializedData stream) { file = (InputFile)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()); + thumb = (InputFile)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()); + file_name = stream.readString(); + mime_type = stream.readString(); } public void serializeToStream(SerializedData stream) { stream.writeInt32(constructor); file.serializeToStream(stream); + thumb.serializeToStream(stream); + stream.writeString(file_name); + stream.writeString(mime_type); + } + } + + public static class TL_inputMediaAudio extends InputMedia { + public static int constructor = 0x89938781; + + public InputAudio id; + + public void readParams(SerializedData stream) { + id = (InputAudio)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + id.serializeToStream(stream); + } + } + + public static class TL_inputMediaDocument extends InputMedia { + public static int constructor = 0xd184e841; + + public InputDocument id; + + public void readParams(SerializedData stream) { + id = (InputDocument)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + id.serializeToStream(stream); } } @@ -2530,21 +2817,12 @@ public class TLRPC { } } - public static class TL_inputMediaContact extends InputMedia { - public static int constructor = 0xa6e45987; + public static class TL_inputMediaEmpty extends InputMedia { + public static int constructor = 0x9664f57f; - public void readParams(SerializedData stream) { - phone_number = stream.readString(); - first_name = stream.readString(); - last_name = stream.readString(); - } - public void serializeToStream(SerializedData stream) { stream.writeInt32(constructor); - stream.writeString(phone_number); - stream.writeString(first_name); - stream.writeString(last_name); } } @@ -2570,6 +2848,36 @@ public class TLRPC { } } + public static class TL_inputMediaUploadedPhoto extends InputMedia { + public static int constructor = 0x2dc53a7d; + + + public void readParams(SerializedData stream) { + file = (InputFile)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + file.serializeToStream(stream); + } + } + + public static class TL_inputMediaUploadedAudio extends InputMedia { + public static int constructor = 0x61a6d436; + + + public void readParams(SerializedData stream) { + file = (InputFile)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()); + duration = stream.readInt32(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + file.serializeToStream(stream); + stream.writeInt32(duration); + } + } + public static class TL_inputMediaUploadedVideo extends InputMedia { public static int constructor = 0x4847d92a; @@ -2590,6 +2898,24 @@ public class TLRPC { } } + public static class TL_inputMediaUploadedDocument extends InputMedia { + public static int constructor = 0x34e794bd; + + + public void readParams(SerializedData stream) { + file = (InputFile)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()); + file_name = stream.readString(); + mime_type = stream.readString(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + file.serializeToStream(stream); + stream.writeString(file_name); + stream.writeString(mime_type); + } + } + public static class TL_inputMediaPhoto extends InputMedia { public static int constructor = 0x8f2ab2ec; @@ -2605,15 +2931,6 @@ public class TLRPC { } } - public static class TL_inputMediaEmpty extends InputMedia { - public static int constructor = 0x9664f57f; - - - public void serializeToStream(SerializedData stream) { - stream.writeInt32(constructor); - } - } - public static class geochats_Messages extends TLObject { public int count; public ArrayList messages = new ArrayList(); @@ -2822,6 +3139,24 @@ public class TLRPC { } } + public static class TL_contactSuggested extends TLObject { + public static int constructor = 0x3de191a1; + + public int user_id; + public int mutual_contacts; + + public void readParams(SerializedData stream) { + user_id = stream.readInt32(); + mutual_contacts = stream.readInt32(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(user_id); + stream.writeInt32(mutual_contacts); + } + } + public static class Server_DH_Params extends TLObject { public byte[] nonce; public byte[] server_nonce; @@ -2982,24 +3317,27 @@ public class TLRPC { public static class Update extends TLObject { public int chat_id; public int max_date; + public int date; public int user_id; public contacts_MyLink my_link; public contacts_ForeignLink foreign_link; public ArrayList messages = new ArrayList(); public int pts; + public int version; public String first_name; public String last_name; public int qts; public int id; public long random_id; + public ArrayList dc_options = new ArrayList(); public ChatParticipants participants; public EncryptedChat chat; - public int date; public long auth_key_id; public String device; public String location; public UserProfilePhoto photo; public boolean previous; + public int inviter_id; public UserStatus status; } @@ -3064,6 +3402,24 @@ public class TLRPC { } } + public static class TL_updateChatParticipantDelete extends Update { + public static int constructor = 0x6e5f8c22; + + + public void readParams(SerializedData stream) { + chat_id = stream.readInt32(); + user_id = stream.readInt32(); + version = stream.readInt32(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(chat_id); + stream.writeInt32(user_id); + stream.writeInt32(version); + } + } + public static class TL_updateRestoreMessages extends Update { public static int constructor = 0xd15de04d; @@ -3226,6 +3582,29 @@ public class TLRPC { } } + public static class TL_updateDcOptions extends Update { + public static int constructor = 0x8e5e9873; + + + public void readParams(SerializedData stream) { + stream.readInt32(); + int count = stream.readInt32(); + for (int a = 0; a < count; a++) { + dc_options.add((TL_dcOption)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32())); + } + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = dc_options.size(); + stream.writeInt32(count); + for (TL_dcOption dc_option : dc_options) { + dc_option.serializeToStream(stream); + } + } + } + public static class TL_updateChatParticipants extends Update { public static int constructor = 0x7761198; @@ -3341,6 +3720,26 @@ public class TLRPC { } } + public static class TL_updateChatParticipantAdd extends Update { + public static int constructor = 0x3a0eeb22; + + + public void readParams(SerializedData stream) { + chat_id = stream.readInt32(); + user_id = stream.readInt32(); + inviter_id = stream.readInt32(); + version = stream.readInt32(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(chat_id); + stream.writeInt32(user_id); + stream.writeInt32(inviter_id); + stream.writeInt32(version); + } + } + public static class TL_updateUserStatus extends Update { public static int constructor = 0x1bfbd823; @@ -3357,6 +3756,42 @@ public class TLRPC { } } + public static class TL_contacts_suggested extends TLObject { + public static int constructor = 0x5649dcc5; + + public ArrayList results = new ArrayList(); + public ArrayList users = new ArrayList(); + + public void readParams(SerializedData stream) { + stream.readInt32(); + int count = stream.readInt32(); + for (int a = 0; a < count; a++) { + results.add((TL_contactSuggested)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32())); + } + stream.readInt32(); + count = stream.readInt32(); + for (int a = 0; a < count; a++) { + users.add((User)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32())); + } + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = results.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + results.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = users.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + users.get(a).serializeToStream(stream); + } + } + } + public static class RpcError extends TLObject { public int error_code; public String error_message; @@ -3401,8 +3836,8 @@ public class TLRPC { public long id; public long access_hash; public int parts; - public String md5_checksum; public int key_fingerprint; + public String md5_checksum; } public static class TL_inputEncryptedFile extends InputEncryptedFile { @@ -3468,31 +3903,18 @@ public class TLRPC { } } - public static class TL_upload_saveBigFilePart extends TLObject { - public static int constructor = 0xde7b673d; + public static class TL_decryptedMessageActionSetMessageTTL extends TLObject { + public static int constructor = 0xa1733aec; - public long file_id; - public int file_part; - public int file_total_parts; - public byte[] bytes; - - public Class responseClass () { - return Bool.class; - } + public int ttl_seconds; public void readParams(SerializedData stream) { - file_id = stream.readInt64(); - file_part = stream.readInt32(); - file_total_parts = stream.readInt32(); - bytes = stream.readByteArray(); + ttl_seconds = stream.readInt32(); } public void serializeToStream(SerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(file_id); - stream.writeInt32(file_part); - stream.writeInt32(file_total_parts); - stream.writeByteArray(bytes); + stream.writeInt32(ttl_seconds); } } @@ -3726,7 +4148,7 @@ public class TLRPC { } public static class TL_encryptedChat extends EncryptedChat { - public static int constructor = 0x6601d14f; + public static int constructor = 0xfa56ce36; public void readParams(SerializedData stream) { @@ -3736,7 +4158,6 @@ public class TLRPC { admin_id = stream.readInt32(); participant_id = stream.readInt32(); g_a_or_b = stream.readByteArray(); - nonce = stream.readByteArray(); key_fingerprint = stream.readInt64(); } @@ -3748,13 +4169,12 @@ public class TLRPC { stream.writeInt32(admin_id); stream.writeInt32(participant_id); stream.writeByteArray(g_a_or_b); - stream.writeByteArray(nonce); stream.writeInt64(key_fingerprint); } } public static class TL_encryptedChatRequested extends EncryptedChat { - public static int constructor = 0xfda9a7b7; + public static int constructor = 0xc878527e; public void readParams(SerializedData stream) { @@ -3764,7 +4184,6 @@ public class TLRPC { admin_id = stream.readInt32(); participant_id = stream.readInt32(); g_a = stream.readByteArray(); - nonce = stream.readByteArray(); } public void serializeToStream(SerializedData stream) { @@ -3775,7 +4194,6 @@ public class TLRPC { stream.writeInt32(admin_id); stream.writeInt32(participant_id); stream.writeByteArray(g_a); - stream.writeByteArray(nonce); } } @@ -3875,6 +4293,36 @@ public class TLRPC { } } + public static class InputAudio extends TLObject { + public long id; + public long access_hash; + } + + public static class TL_inputAudio extends InputAudio { + public static int constructor = 0x77d440ff; + + + public void readParams(SerializedData stream) { + id = stream.readInt64(); + access_hash = stream.readInt64(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + } + } + + public static class TL_inputAudioEmpty extends InputAudio { + public static int constructor = 0xd95adc84; + + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + } + } + public static class TL_messages_chats extends TLObject { public static int constructor = 0x8150cbd8; @@ -3911,6 +4359,42 @@ public class TLRPC { } } + public static class TL_contacts_found extends TLObject { + public static int constructor = 0x566000e; + + public ArrayList results = new ArrayList(); + public ArrayList users = new ArrayList(); + + public void readParams(SerializedData stream) { + stream.readInt32(); + int count = stream.readInt32(); + for (int a = 0; a < count; a++) { + results.add((TL_contactFound)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32())); + } + stream.readInt32(); + count = stream.readInt32(); + for (int a = 0; a < count; a++) { + users.add((User)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32())); + } + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = results.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + results.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = users.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + users.get(a).serializeToStream(stream); + } + } + } + public static class ChatParticipants extends TLObject { public int chat_id; public int admin_id; @@ -3962,41 +4446,86 @@ public class TLRPC { } public static class DecryptedMessageMedia extends TLObject { - public String phone_number; - public String first_name; - public String last_name; - public int user_id; public byte[] thumb; public int thumb_w; public int thumb_h; - public int duration; - public int w; - public int h; + public String file_name; + public String mime_type; public int size; public byte[] key; public byte[] iv; public double lat; public double _long; - public String filename; + public int duration; + public int w; + public int h; + public String phone_number; + public String first_name; + public String last_name; + public int user_id; } - public static class TL_decryptedMessageMediaContact extends DecryptedMessageMedia { - public static int constructor = 0x588a0a97; + public static class TL_decryptedMessageMediaDocument extends DecryptedMessageMedia { + public static int constructor = 0xb095434b; public void readParams(SerializedData stream) { - phone_number = stream.readString(); - first_name = stream.readString(); - last_name = stream.readString(); - user_id = stream.readInt32(); + thumb = stream.readByteArray(); + thumb_w = stream.readInt32(); + thumb_h = stream.readInt32(); + file_name = stream.readString(); + mime_type = stream.readString(); + size = stream.readInt32(); + key = stream.readByteArray(); + iv = stream.readByteArray(); } public void serializeToStream(SerializedData stream) { stream.writeInt32(constructor); - stream.writeString(phone_number); - stream.writeString(first_name); - stream.writeString(last_name); - stream.writeInt32(user_id); + stream.writeByteArray(thumb); + stream.writeInt32(thumb_w); + stream.writeInt32(thumb_h); + stream.writeString(file_name); + stream.writeString(mime_type); + stream.writeInt32(size); + stream.writeByteArray(key); + stream.writeByteArray(iv); + } + } + + public static class TL_decryptedMessageMediaGeoPoint extends DecryptedMessageMedia { + public static int constructor = 0x35480a59; + + + public void readParams(SerializedData stream) { + lat = stream.readDouble(); + _long = stream.readDouble(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeDouble(lat); + stream.writeDouble(_long); + } + } + + public static class TL_decryptedMessageMediaAudio extends DecryptedMessageMedia { + public static int constructor = 0x6080758f; + + + public void readParams(SerializedData stream) { + duration = stream.readInt32(); + size = stream.readInt32(); + key = stream.readByteArray(); + iv = stream.readByteArray(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(duration); + stream.writeInt32(size); + stream.writeByteArray(key); + stream.writeByteArray(iv); } } @@ -4030,43 +4559,23 @@ public class TLRPC { } } - public static class TL_decryptedMessageMediaGeoPoint extends DecryptedMessageMedia { - public static int constructor = 0x35480a59; + public static class TL_decryptedMessageMediaContact extends DecryptedMessageMedia { + public static int constructor = 0x588a0a97; public void readParams(SerializedData stream) { - lat = stream.readDouble(); - _long = stream.readDouble(); + phone_number = stream.readString(); + first_name = stream.readString(); + last_name = stream.readString(); + user_id = stream.readInt32(); } public void serializeToStream(SerializedData stream) { stream.writeInt32(constructor); - stream.writeDouble(lat); - stream.writeDouble(_long); - } - } - - public static class TL_decryptedMessageMediaFile extends DecryptedMessageMedia { - public static int constructor = 0xc0bb4455; - - - public void readParams(SerializedData stream) { - filename = stream.readString(); - thumb = stream.readByteArray(); - thumb_w = stream.readInt32(); - thumb_h = stream.readInt32(); - key = stream.readByteArray(); - iv = stream.readByteArray(); - } - - public void serializeToStream(SerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(filename); - stream.writeByteArray(thumb); - stream.writeInt32(thumb_w); - stream.writeInt32(thumb_h); - stream.writeByteArray(key); - stream.writeByteArray(iv); + stream.writeString(phone_number); + stream.writeString(first_name); + stream.writeString(last_name); + stream.writeInt32(user_id); } } @@ -4194,7 +4703,6 @@ public class TLRPC { stream.writeInt32(version); } } - public static class TL_chat extends Chat { public static int constructor = 0x6e9c9bc7; @@ -4344,6 +4852,134 @@ public class TLRPC { } } + public static class TL_msgs_state_info extends TLObject { + public static int constructor = 0x04deb57d; + + public long req_msg_id; + public String info; + + public void readParams(SerializedData stream) { + req_msg_id = stream.readInt64(); + info = stream.readString(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(req_msg_id); + stream.writeString(info); + } + } + + public static class TL_upload_file extends TLObject { + public static int constructor = 0x96a18d5; + + public storage_FileType type; + public int mtime; + public byte[] bytes; + + public void readParams(SerializedData stream) { + type = (storage_FileType)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()); + mtime = stream.readInt32(); + bytes = stream.readByteArray(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + type.serializeToStream(stream); + stream.writeInt32(mtime); + stream.writeByteArray(bytes); + } + } + + public static class TL_fileLocation extends FileLocation { + public static int constructor = 0x53d69076; + + + public void readParams(SerializedData stream) { + dc_id = stream.readInt32(); + volume_id = stream.readInt64(); + local_id = stream.readInt32(); + secret = stream.readInt64(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(dc_id); + stream.writeInt64(volume_id); + stream.writeInt32(local_id); + stream.writeInt64(secret); + } + } + + public static class TL_fileLocationUnavailable extends FileLocation { + public static int constructor = 0x7c596b46; + + + public void readParams(SerializedData stream) { + volume_id = stream.readInt64(); + local_id = stream.readInt32(); + secret = stream.readInt64(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(volume_id); + stream.writeInt32(local_id); + stream.writeInt64(secret); + } + } + + public static class messages_Message extends TLObject { + public Message message; + public ArrayList chats = new ArrayList(); + public ArrayList users = new ArrayList(); + } + + public static class TL_messages_messageEmpty extends messages_Message { + public static int constructor = 0x3f4e0648; + + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_messages_message extends messages_Message { + public static int constructor = 0xff90c417; + + + public void readParams(SerializedData stream) { + message = (Message)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()); + stream.readInt32(); + int count = stream.readInt32(); + for (int a = 0; a < count; a++) { + chats.add((Chat)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32())); + } + stream.readInt32(); + count = stream.readInt32(); + for (int a = 0; a < count; a++) { + users.add((User)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32())); + } + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + message.serializeToStream(stream); + stream.writeInt32(0x1cb5c415); + int count = chats.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + chats.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = users.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + users.get(a).serializeToStream(stream); + } + } + } + public static class TL_geochats_located extends TLObject { public static int constructor = 0x48feb267; @@ -4404,134 +5040,6 @@ public class TLRPC { } } - public static class TL_msgs_state_info extends TLObject { - public static int constructor = 0x04deb57d; - - public long req_msg_id; - public String info; - - public void readParams(SerializedData stream) { - req_msg_id = stream.readInt64(); - info = stream.readString(); - } - - public void serializeToStream(SerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(req_msg_id); - stream.writeString(info); - } - } - - public static class TL_upload_file extends TLObject { - public static int constructor = 0x96a18d5; - - public storage_FileType type; - public int mtime; - public byte[] bytes; - - public void readParams(SerializedData stream) { - type = (storage_FileType)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()); - mtime = stream.readInt32(); - bytes = stream.readByteArray(); - } - - public void serializeToStream(SerializedData stream) { - stream.writeInt32(constructor); - type.serializeToStream(stream); - stream.writeInt32(mtime); - stream.writeByteArray(bytes); - } - } - - public static class messages_Message extends TLObject { - public Message message; - public ArrayList chats = new ArrayList(); - public ArrayList users = new ArrayList(); - } - - public static class TL_messages_messageEmpty extends messages_Message { - public static int constructor = 0x3f4e0648; - - - public void serializeToStream(SerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_messages_message extends messages_Message { - public static int constructor = 0xff90c417; - - - public void readParams(SerializedData stream) { - message = (Message)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()); - stream.readInt32(); - int count = stream.readInt32(); - for (int a = 0; a < count; a++) { - chats.add((Chat)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32())); - } - stream.readInt32(); - count = stream.readInt32(); - for (int a = 0; a < count; a++) { - users.add((User)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32())); - } - } - - public void serializeToStream(SerializedData stream) { - stream.writeInt32(constructor); - message.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } - - public static class TL_fileLocation extends FileLocation { - public static int constructor = 0x53d69076; - - - public void readParams(SerializedData stream) { - dc_id = stream.readInt32(); - volume_id = stream.readInt64(); - local_id = stream.readInt32(); - secret = stream.readInt64(); - } - - public void serializeToStream(SerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(dc_id); - stream.writeInt64(volume_id); - stream.writeInt32(local_id); - stream.writeInt64(secret); - } - } - - public static class TL_fileLocationUnavailable extends FileLocation { - public static int constructor = 0x7c596b46; - - - public void readParams(SerializedData stream) { - volume_id = stream.readInt64(); - local_id = stream.readInt32(); - secret = stream.readInt64(); - } - - public void serializeToStream(SerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(volume_id); - stream.writeInt32(local_id); - stream.writeInt64(secret); - } - } - public static class TL_inputGeoChat extends TLObject { public static int constructor = 0x74d456fa; @@ -4641,6 +5149,21 @@ public class TLRPC { } } + public static class TL_contactFound extends TLObject { + public static int constructor = 0xea879f95; + + public int user_id; + + public void readParams(SerializedData stream) { + user_id = stream.readInt32(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(user_id); + } + } + public static class InputFile extends TLObject { public long id; public int parts; @@ -4648,25 +5171,6 @@ public class TLRPC { public String md5_checksum; } - public static class TL_inputFile extends InputFile { - public static int constructor = 0xf52ff27f; - - public void readParams(SerializedData stream) { - id = stream.readInt64(); - parts = stream.readInt32(); - name = stream.readString(); - md5_checksum = stream.readString(); - } - - public void serializeToStream(SerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt32(parts); - stream.writeString(name); - stream.writeString(md5_checksum); - } - } - public static class TL_inputFileBig extends InputFile { public static int constructor = 0xfa4f0bb5; @@ -4685,6 +5189,26 @@ public class TLRPC { } } + public static class TL_inputFile extends InputFile { + public static int constructor = 0xf52ff27f; + + + public void readParams(SerializedData stream) { + id = stream.readInt64(); + parts = stream.readInt32(); + name = stream.readString(); + md5_checksum = stream.readString(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt32(parts); + stream.writeString(name); + stream.writeString(md5_checksum); + } + } + public static class messages_StatedMessage extends TLObject { public Message message; public ArrayList chats = new ArrayList(); @@ -4818,48 +5342,30 @@ public class TLRPC { } } - public static class MsgDetailedInfo extends TLObject { - public long answer_msg_id; - public int bytes; - public int status; - public long msg_id; - } - - public static class TL_msg_new_detailed_info extends MsgDetailedInfo { - public static int constructor = 0x809db6df; + public static class TL_updates_state extends TLObject { + public static int constructor = 0xa56c2a3e; + public int pts; + public int qts; + public int date; + public int seq; + public int unread_count; public void readParams(SerializedData stream) { - answer_msg_id = stream.readInt64(); - bytes = stream.readInt32(); - status = stream.readInt32(); + pts = stream.readInt32(); + qts = stream.readInt32(); + date = stream.readInt32(); + seq = stream.readInt32(); + unread_count = stream.readInt32(); } public void serializeToStream(SerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(answer_msg_id); - stream.writeInt32(bytes); - stream.writeInt32(status); - } - } - - public static class TL_msg_detailed_info extends MsgDetailedInfo { - public static int constructor = 0x276d3ec6; - - - public void readParams(SerializedData stream) { - msg_id = stream.readInt64(); - answer_msg_id = stream.readInt64(); - bytes = stream.readInt32(); - status = stream.readInt32(); - } - - public void serializeToStream(SerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(msg_id); - stream.writeInt64(answer_msg_id); - stream.writeInt32(bytes); - stream.writeInt32(status); + stream.writeInt32(pts); + stream.writeInt32(qts); + stream.writeInt32(date); + stream.writeInt32(seq); + stream.writeInt32(unread_count); } } @@ -5170,30 +5676,48 @@ public class TLRPC { } } - public static class TL_updates_state extends TLObject { - public static int constructor = 0xa56c2a3e; + public static class MsgDetailedInfo extends TLObject { + public long answer_msg_id; + public int bytes; + public int status; + public long msg_id; + } + + public static class TL_msg_new_detailed_info extends MsgDetailedInfo { + public static int constructor = 0x809db6df; - public int pts; - public int qts; - public int date; - public int seq; - public int unread_count; public void readParams(SerializedData stream) { - pts = stream.readInt32(); - qts = stream.readInt32(); - date = stream.readInt32(); - seq = stream.readInt32(); - unread_count = stream.readInt32(); + answer_msg_id = stream.readInt64(); + bytes = stream.readInt32(); + status = stream.readInt32(); } public void serializeToStream(SerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(pts); - stream.writeInt32(qts); - stream.writeInt32(date); - stream.writeInt32(seq); - stream.writeInt32(unread_count); + stream.writeInt64(answer_msg_id); + stream.writeInt32(bytes); + stream.writeInt32(status); + } + } + + public static class TL_msg_detailed_info extends MsgDetailedInfo { + public static int constructor = 0x276d3ec6; + + + public void readParams(SerializedData stream) { + msg_id = stream.readInt64(); + answer_msg_id = stream.readInt64(); + bytes = stream.readInt32(); + status = stream.readInt32(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(msg_id); + stream.writeInt64(answer_msg_id); + stream.writeInt32(bytes); + stream.writeInt32(status); } } @@ -5453,6 +5977,24 @@ public class TLRPC { } } + public static class TL_decryptedMessageLayer extends TLObject { + public static int constructor = 0x99a438cf; + + public int layer; + public DecryptedMessage message; + + public void readParams(SerializedData stream) { + layer = stream.readInt32(); + message = (DecryptedMessage)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(layer); + message.serializeToStream(stream); + } + } + public static class InputPhotoCrop extends TLObject { public double crop_left; public double crop_top; @@ -5827,6 +6369,19 @@ public class TLRPC { } } + public static class TL_auth_resetAuthorizations extends TLObject { + public static int constructor = 0x9fab0d1a; + + + public Class responseClass () { + return Bool.class; + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + } + } + public static class TL_auth_sendInvites extends TLObject { public static int constructor = 0x771c1d97; @@ -6155,6 +6710,47 @@ public class TLRPC { } } + public static class TL_contacts_search extends TLObject { + public static int constructor = 0x11f812d8; + + public String q; + public int limit; + + public Class responseClass () { + return TL_contacts_found.class; + } + + public void readParams(SerializedData stream) { + q = stream.readString(); + limit = stream.readInt32(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(q); + stream.writeInt32(limit); + } + } + + public static class TL_contacts_getSuggested extends TLObject { + public static int constructor = 0xcd773428; + + public int limit; + + public Class responseClass () { + return TL_contacts_suggested.class; + } + + public void readParams(SerializedData stream) { + limit = stream.readInt32(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(limit); + } + } + public static class TL_contacts_deleteContact extends TLObject { public static int constructor = 0x8e953744; @@ -6715,6 +7311,31 @@ public class TLRPC { } } + public static class TL_updates_getDifference extends TLObject { + public static int constructor = 0xa041495; + + public int pts; + public int date; + public int qts; + + public Class responseClass () { + return updates_Difference.class; + } + + public void readParams(SerializedData stream) { + pts = stream.readInt32(); + date = stream.readInt32(); + qts = stream.readInt32(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(pts); + stream.writeInt32(date); + stream.writeInt32(qts); + } + } + public static class TL_photos_updateProfilePhoto extends TLObject { public static int constructor = 0xeef579a0; @@ -6841,6 +7462,34 @@ public class TLRPC { } } + public static class TL_help_getAppUpdate extends TLObject { + public static int constructor = 0xc812ac7e; + + public String device_model; + public String system_version; + public String app_version; + public String lang_code; + + public Class responseClass () { + return help_AppUpdate.class; + } + + public void readParams(SerializedData stream) { + device_model = stream.readString(); + system_version = stream.readString(); + app_version = stream.readString(); + lang_code = stream.readString(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(device_model); + stream.writeString(system_version); + stream.writeString(app_version); + stream.writeString(lang_code); + } + } + public static class TL_help_saveAppLog extends TLObject { public static int constructor = 0x6f02f748; @@ -7275,31 +7924,6 @@ public class TLRPC { } } - public static class TL_updates_getDifference extends TLObject { - public static int constructor = 0xa041495; - - public int pts; - public int date; - public int qts; - - public Class responseClass () { - return updates_Difference.class; - } - - public void readParams(SerializedData stream) { - pts = stream.readInt32(); - date = stream.readInt32(); - qts = stream.readInt32(); - } - - public void serializeToStream(SerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(pts); - stream.writeInt32(date); - stream.writeInt32(qts); - } - } - public static class TL_messages_getDhConfig extends TLObject { public static int constructor = 0x26cf8950; @@ -7513,6 +8137,34 @@ 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(SerializedData stream) { + file_id = stream.readInt64(); + file_part = stream.readInt32(); + file_total_parts = stream.readInt32(); + bytes = stream.readByteArray(); + } + + public void serializeToStream(SerializedData 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 TL_messages_receivedQueue extends TLObject { @@ -8051,7 +8703,6 @@ public class TLRPC { public int admin_id; public int participant_id; public byte[] g_a_or_b; - public byte[] nonce; public long key_fingerprint; public byte[] g_a; public byte[] a_or_b; @@ -8110,6 +8761,21 @@ public class TLRPC { public byte[] iv; } + public static class Document extends TLObject { + public long id; + public long access_hash; + public int user_id; + public int date; + public String file_name; + public String mime_type; + public int size; + public PhotoSize thumb; + public int dc_id; + public String path; + public byte[] key; + public byte[] iv; + } + public static class MessageAction extends TLObject { public Photo photo; public UserProfilePhoto newUserPhoto; @@ -8133,6 +8799,40 @@ public class TLRPC { } } + public static class TL_documentEncrypted extends Document { + public static int constructor = 0x55555556; + + + public void readParams(SerializedData stream) { + id = stream.readInt64(); + access_hash = stream.readInt64(); + user_id = stream.readInt32(); + date = stream.readInt32(); + file_name = stream.readString(); + mime_type = stream.readString(); + size = stream.readInt32(); + thumb = (PhotoSize)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()); + dc_id = stream.readInt32(); + key = stream.readByteArray(); + iv = stream.readByteArray(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32(user_id); + stream.writeInt32(date); + stream.writeString(file_name); + stream.writeString(mime_type); + stream.writeInt32(size); + thumb.serializeToStream(stream); + stream.writeInt32(dc_id); + stream.writeByteArray(key); + stream.writeByteArray(iv); + } + } + public static class TL_videoEncrypted extends Video { public static int constructor = 0x55555553; @@ -8211,19 +8911,8 @@ public class TLRPC { } } - public static class invokeWithLayer8 extends TLObject { - public static int constructor = 0xe9abd9fd; - - public TLObject query; - - public void serializeToStream(SerializedData stream) { - stream.writeInt32(constructor); - query.serializeToStream(stream); - } - } - - public static class invokeWithLayer9 extends TLObject { - public static int constructor = 0x76715a63; + public static class invokeWithLayer11 extends TLObject { + public static int constructor = 0xa6b88fdf; public TLObject query; @@ -8271,4 +8960,56 @@ public class TLRPC { message.serializeToStream(stream); } } + + public static class TL_encryptedChat_old extends EncryptedChat { + public static int constructor = 0x6601d14f; + + + public void readParams(SerializedData stream) { + id = stream.readInt32(); + access_hash = stream.readInt64(); + date = stream.readInt32(); + admin_id = stream.readInt32(); + participant_id = stream.readInt32(); + g_a_or_b = stream.readByteArray(); + stream.readByteArray(); + key_fingerprint = stream.readInt64(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(TL_encryptedChat.constructor); + stream.writeInt32(id); + stream.writeInt64(access_hash); + stream.writeInt32(date); + stream.writeInt32(admin_id); + stream.writeInt32(participant_id); + stream.writeByteArray(g_a_or_b); + stream.writeInt64(key_fingerprint); + } + } + + public static class TL_encryptedChatRequested_old extends EncryptedChat { + public static int constructor = 0xfda9a7b7; + + + public void readParams(SerializedData stream) { + id = stream.readInt32(); + access_hash = stream.readInt64(); + date = stream.readInt32(); + admin_id = stream.readInt32(); + participant_id = stream.readInt32(); + g_a = stream.readByteArray(); + stream.readByteArray(); + } + + public void serializeToStream(SerializedData stream) { + stream.writeInt32(TL_encryptedChatRequested.constructor); + stream.writeInt32(id); + stream.writeInt64(access_hash); + stream.writeInt32(date); + stream.writeInt32(admin_id); + stream.writeInt32(participant_id); + stream.writeByteArray(g_a); + } + } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java b/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java index 753613987..4e8f42181 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java @@ -10,8 +10,10 @@ package org.telegram.messenger; import android.content.Context; import android.content.SharedPreferences; +import android.content.pm.PackageInfo; import android.net.ConnectivityManager; import android.net.NetworkInfo; +import android.os.Build; import android.util.Base64; import org.telegram.TL.TLClassStore; @@ -23,6 +25,7 @@ import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; +import java.util.Locale; import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.ConcurrentHashMap; @@ -30,6 +33,11 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.TcpConnectionDelegate { + public static boolean DEBUG_VERSION = false; + public static int APP_ID = 2458; + public static String APP_HASH = "5bce48dc7d331e62c955669eb7233217"; + public static String HOCKEY_APP_HASH = "your-hockeyapp-api-key-here"; + private HashMap datacenters = new HashMap(); private HashMap> processedMessageIdsSet = new HashMap>(); private HashMap nextSeqNoInSession = new HashMap(); @@ -62,6 +70,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. private boolean updatingDcSettings = false; private int updatingDcStartTime = 0; private int lastDcUpdateTime = 0; + private int currentAppVersion = 0; public static ConnectionsManager Instance = new ConnectionsManager(); @@ -73,6 +82,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. private int nextSleepTimeout = 60000; public ConnectionsManager() { + currentAppVersion = ApplicationLoader.getAppVersion(); lastOutgoingMessageId = 0; movingToDatacenterId = DEFAULT_DATACENTER_ID; loadSession(); @@ -622,9 +632,36 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. return performRpc(rpc, completionBlock, progressBlock, null, requiresCompletion, requestClass, datacenterId); } - TLObject wrapInLayer(TLObject object) { + TLObject wrapInLayer(TLObject object, int datacenterId, RPCRequest request) { if (object.layer() > 0) { - TLRPC.invokeWithLayer8 invoke = new TLRPC.invokeWithLayer8(); + Datacenter datacenter = datacenterWithId(datacenterId); + if (datacenter.lastInitVersion != currentAppVersion) { + request.initRequest = true; + TLRPC.initConnection invoke = new TLRPC.initConnection(); + invoke.query = object; + invoke.api_id = APP_ID; + try { + invoke.lang_code = Locale.getDefault().getCountry(); + invoke.device_model = Build.MANUFACTURER + Build.MODEL; + if (invoke.device_model == null) { + invoke.device_model = "Android unknown"; + } + PackageInfo pInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0); + invoke.app_version = pInfo.versionName; + if (invoke.app_version == null) { + invoke.app_version = "App version unknown"; + } + invoke.system_version = "SDK " + Build.VERSION.SDK_INT; + } catch (Exception e) { + FileLog.e("tmessages", e); + invoke.lang_code = "en"; + invoke.device_model = "Android unknown"; + invoke.app_version = "App version unknown"; + invoke.system_version = "SDK " + Build.VERSION.SDK_INT; + } + object = invoke; + } + TLRPC.invokeWithLayer11 invoke = new TLRPC.invokeWithLayer11(); invoke.query = object; FileLog.d("wrap in layer", "" + object); return invoke; @@ -647,7 +684,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. request.runningDatacenterId = datacenterId; request.rawRequest = rpc; - request.rpcRequest = wrapInLayer(rpc); + request.rpcRequest = wrapInLayer(rpc, datacenterId, request); request.completionBlock = completionBlock; request.progressBlock = progressBlock; request.quickAckBlock = quickAckBlock; @@ -1791,12 +1828,14 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. found = true; boolean discardResponse = false; + boolean isError = false; if (request.completionBlock != null) { TLRPC.TL_error implicitError = null; if (resultContainer.result instanceof TLRPC.TL_gzip_packed) { TLRPC.TL_gzip_packed packet = (TLRPC.TL_gzip_packed)resultContainer.result; TLObject uncomressed = Utilities.decompress(packet.packed_data, request.rawRequest); if (uncomressed == null) { + System.gc(); uncomressed = Utilities.decompress(packet.packed_data, request.rawRequest); } if (uncomressed == null) { @@ -1871,6 +1910,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. if (!discardResponse) { if (implicitError != null || resultContainer.result instanceof TLRPC.TL_error) { + isError = true; request.completionBlock.run(null, implicitError != null ? implicitError : (TLRPC.TL_error) resultContainer.result); } else { request.completionBlock.run(resultContainer.result, null); @@ -1878,6 +1918,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. } if (implicitError != null && implicitError.code == 401) { + isError = true; if (datacenter.datacenterId == currentDatacenterId || datacenter.datacenterId == movingToDatacenterId) { if ((request.flags & RPCRequest.RPCRequestClassGeneric) != 0) { Utilities.RunOnUIThread(new Runnable() { @@ -1901,6 +1942,15 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. } if (!discardResponse) { + if (request.initRequest && !isError) { + if (datacenter.lastInitVersion != currentAppVersion) { + datacenter.lastInitVersion = currentAppVersion; + saveSession(); + FileLog.e("tmessages", "init connection completed"); + } else { + FileLog.e("tmessages", "rpc is init, but init connection already completed"); + } + } rpcCompleted(resultMid); } else { request.runningMessageId = 0; @@ -2309,6 +2359,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. MessageKeyData keyData = Utilities.generateMessageKeyData(datacenter.authKey, messageKey, true); byte[] messageData = is.readData(data.length - 24); + messageData = Utilities.aesIgeEncryption(messageData, keyData.aesKey, keyData.aesIv, false, false); if (messageData == null) { FileLog.e("tmessages", "Error: can't decrypt message data " + connection); @@ -2329,6 +2380,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. long messageId = messageIs.readInt64(); int messageSeqNo = messageIs.readInt32(); + int messageLength = messageIs.readInt32(); if (isMessageIdProcessed(messageSessionId, messageId)) { doNotProcess = true; @@ -2342,22 +2394,20 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. } set.add(messageId); } - + byte[] realMessageKeyFull = Utilities.computeSHA1(messageData, 0, Math.min(messageLength + 32, messageData.length)); if (realMessageKeyFull == null) { return; } byte[] realMessageKey = new byte[16]; System.arraycopy(realMessageKeyFull, realMessageKeyFull.length - 16, realMessageKey, 0, 16); - + if (!Arrays.equals(messageKey, realMessageKey)) { FileLog.e("tmessages", "***** Error: invalid message key"); return; } if (!doNotProcess) { - int messageLength = messageIs.readInt32(); - int constructor = messageIs.readInt32(); TLObject message = TLClassStore.Instance().TLdeserialize(messageIs, constructor, getRequestWithMessageId(messageId)); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/Datacenter.java b/TMessagesProj/src/main/java/org/telegram/messenger/Datacenter.java index 89a25bd63..3953b7e59 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/Datacenter.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/Datacenter.java @@ -20,18 +20,19 @@ import java.util.Comparator; import java.util.HashMap; public class Datacenter { - private final int DATA_VERSION = 2; + private final int DATA_VERSION = 3; public int datacenterId; public ArrayList addresses = new ArrayList(); public HashMap ports = new HashMap(); - public int[] defaultPorts = new int[] {-1, 80, -1, 88, -1, 443, -1, 80, -1, 443, -1}; + public int[] defaultPorts = new int[] {-1, 80, -1, 443, -1, 443, -1, 80, -1, 443, -1}; public boolean authorized; public long authSessionId; public long authDownloadSessionId; public long authUploadSessionId; public byte[] authKey; public byte[] authKeyId; + public int lastInitVersion = 0; private volatile int currentPortNum = 0; private volatile int currentAddressNum = 0; @@ -74,8 +75,11 @@ public class Datacenter { } } else if (version == 1) { int currentVersion = data.readInt32(); - if (currentVersion == 2) { + if (currentVersion == 2 || currentVersion == 3) { datacenterId = data.readInt32(); + if (currentVersion == 3) { + lastInitVersion = data.readInt32(); + } int len = data.readInt32(); for (int a = 0; a < len; a++) { String address = data.readString(); @@ -182,6 +186,7 @@ public class Datacenter { public void SerializeToStream(SerializedData stream) { stream.writeInt32(DATA_VERSION); stream.writeInt32(datacenterId); + stream.writeInt32(lastInitVersion); stream.writeInt32(addresses.size()); for (String address : addresses) { stream.writeString(address); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/Emoji.java b/TMessagesProj/src/main/java/org/telegram/messenger/Emoji.java index 4a26ebeaf..ae1dcc2a4 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/Emoji.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/Emoji.java @@ -19,7 +19,6 @@ import android.graphics.Paint; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.text.Spannable; -import android.text.Spanned; import android.text.style.DynamicDrawableSpan; import android.text.style.ImageSpan; import android.view.View; @@ -510,9 +509,9 @@ public class Emoji { EmojiSpan span = new EmojiSpan(d, DynamicDrawableSpan.ALIGN_BOTTOM); emojiCount++; if (c>= 0xDDE6 && c <= 0xDDFA) { - s.setSpan(span, i - 3, i + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + s.setSpan(span, i - 3, i + 1, 0); } else { - s.setSpan(span, i - 1, i + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + s.setSpan(span, i - 1, i + 1, 0); } } buf = 0; @@ -527,7 +526,7 @@ public class Emoji { if(d != null) { EmojiSpan span = new EmojiSpan(d, DynamicDrawableSpan.ALIGN_BOTTOM); emojiCount++; - s.setSpan(span, i - 1, i + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + s.setSpan(span, i - 1, i + 1, 0); } buf = 0; } @@ -537,7 +536,7 @@ public class Emoji { if(d != null){ EmojiSpan span = new EmojiSpan(d, DynamicDrawableSpan.ALIGN_BOTTOM); emojiCount++; - s.setSpan(span, i, i + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + s.setSpan(span, i, i + 1, 0); } } if (emojiCount >= 50) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java index df09bfffc..8b4f6015e 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java @@ -42,6 +42,7 @@ public class FileLoadOperation { private File cacheFileFinal; private File cacheIvTemp; + private String ext; private String httpUrl; private URLConnection httpConnection; public boolean needBitmapCreate = true; @@ -90,6 +91,34 @@ public class FileLoadOperation { System.arraycopy(videoLocation.iv, 0, iv, 0, iv.length); key = videoLocation.key; } + ext = ".mp4"; + } + + public FileLoadOperation(TLRPC.Document documentLocation) { + if (documentLocation instanceof TLRPC.TL_document) { + location = new TLRPC.TL_inputDocumentFileLocation(); + datacenter_id = documentLocation.dc_id; + location.id = documentLocation.id; + location.access_hash = documentLocation.access_hash; + } else if (documentLocation instanceof TLRPC.TL_documentEncrypted) { + location = new TLRPC.TL_inputEncryptedFileLocation(); + location.id = documentLocation.id; + location.access_hash = documentLocation.access_hash; + datacenter_id = documentLocation.dc_id; + iv = new byte[32]; + System.arraycopy(documentLocation.iv, 0, iv, 0, iv.length); + key = documentLocation.key; + } + ext = documentLocation.file_name; + int idx = -1; + if (ext == null || (idx = ext.lastIndexOf(".")) == -1) { + ext = ""; + } else { + ext = ext.substring(idx); + if (ext.length() <= 1) { + ext = ""; + } + } } public FileLoadOperation(String url) { @@ -112,13 +141,20 @@ public class FileLoadOperation { } boolean ignoreCache = false; boolean onlyCache = false; + boolean isLocalFile = false; String fileNameFinal = null; String fileNameTemp = null; String fileNameIv = null; if (httpUrl != null) { - fileNameFinal = Utilities.MD5(httpUrl); - fileNameTemp = fileNameFinal + "_temp.jpg"; - fileNameFinal += ".jpg"; + if (!httpUrl.startsWith("http")) { + onlyCache = true; + isLocalFile = true; + fileNameFinal = httpUrl; + } else { + fileNameFinal = Utilities.MD5(httpUrl); + fileNameTemp = fileNameFinal + "_temp.jpg"; + fileNameFinal += ".jpg"; + } } else if (location.volume_id != 0 && location.local_id != 0) { fileNameTemp = location.volume_id + "_" + location.local_id + "_temp.jpg"; fileNameFinal = location.volume_id + "_" + location.local_id + ".jpg"; @@ -131,15 +167,20 @@ public class FileLoadOperation { } else { ignoreCache = true; needBitmapCreate = false; - fileNameTemp = datacenter_id + "_" + location.id + "_temp.mp4"; - fileNameFinal = datacenter_id + "_" + location.id + ".mp4"; + fileNameTemp = datacenter_id + "_" + location.id + "_temp" + ext; + fileNameFinal = datacenter_id + "_" + location.id + ext; if (key != null) { fileNameIv = datacenter_id + "_" + location.id + ".iv"; } } boolean exist; - cacheFileFinal = new File(Utilities.getCacheDir(), fileNameFinal); + if (isLocalFile) { + cacheFileFinal = new File(fileNameFinal); + } else { + cacheFileFinal = new File(Utilities.getCacheDir(), fileNameFinal); + } + final boolean dontDelete = isLocalFile; if ((exist = cacheFileFinal.exists()) && !ignoreCache) { Utilities.cacheOutQueue.postRunnable(new Runnable() { @Override @@ -184,7 +225,9 @@ public class FileLoadOperation { image = BitmapFactory.decodeStream(is, null, opts); is.close(); if (image == null) { - cacheFileFinal.delete(); + if (!dontDelete) { + cacheFileFinal.delete(); + } } else { if (filter != null && image != null) { float bitmapW = image.getWidth(); @@ -213,7 +256,9 @@ public class FileLoadOperation { } }); } catch (Exception e) { - cacheFileFinal.delete(); + if (!dontDelete) { + cacheFileFinal.delete(); + } FileLog.e("tmessages", e); } } @@ -293,7 +338,9 @@ public class FileLoadOperation { private void cleanup() { if (httpUrl != null) { try { - httpConnectionStream.close(); + if (httpConnectionStream != null) { + httpConnectionStream.close(); + } httpConnection = null; httpConnectionStream = null; } catch (Exception e) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoader.java b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoader.java index 9d3cbddcf..40e839a57 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoader.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoader.java @@ -19,6 +19,7 @@ import android.view.View; import android.widget.ImageView; import org.telegram.TL.TLRPC; +import org.telegram.objects.MessageObject; import org.telegram.ui.ApplicationLoader; import org.telegram.ui.Views.BackupImageView; @@ -388,8 +389,8 @@ public class FileLoader { }); } - public void cancelLoadFile(final TLRPC.Video video, final TLRPC.PhotoSize photo) { - if (video == null && photo == null) { + public void cancelLoadFile(final TLRPC.Video video, final TLRPC.PhotoSize photo, final TLRPC.Document document) { + if (video == null && photo == null && document == null) { return; } Utilities.fileUploadQueue.postRunnable(new Runnable() { @@ -397,9 +398,14 @@ public class FileLoader { public void run() { String fileName = null; if (video != null) { - fileName = video.dc_id + "_" + video.id + ".mp4"; + fileName = MessageObject.getAttachFileName(video); } else if (photo != null) { - fileName = photo.location.volume_id + "_" + photo.location.local_id + ".jpg"; + fileName = MessageObject.getAttachFileName(photo); + } else if (document != null) { + fileName = MessageObject.getAttachFileName(document); + } + if (fileName == null) { + return; } FileLoadOperation operation = loadOperationPaths.get(fileName); if (operation != null) { @@ -414,15 +420,20 @@ public class FileLoader { return loadOperationPaths.containsKey(fileName); } - public void loadFile(final TLRPC.Video video, final TLRPC.PhotoSize photo) { + public void loadFile(final TLRPC.Video video, final TLRPC.PhotoSize photo, final TLRPC.Document document) { Utilities.fileUploadQueue.postRunnable(new Runnable() { @Override public void run() { String fileName = null; if (video != null) { - fileName = video.dc_id + "_" + video.id + ".mp4"; + fileName = MessageObject.getAttachFileName(video); } else if (photo != null) { - fileName = photo.location.volume_id + "_" + photo.location.local_id + ".jpg"; + fileName = MessageObject.getAttachFileName(photo); + } else if (document != null) { + fileName = MessageObject.getAttachFileName(document); + } + if (fileName == null) { + return; } if (loadOperationPaths.containsKey(fileName)) { return; @@ -435,6 +446,9 @@ public class FileLoader { operation = new FileLoadOperation(photo.location); operation.totalBytesCount = photo.size; operation.needBitmapCreate = false; + } else if (document != null) { + operation = new FileLoadOperation(document); + operation.totalBytesCount = document.size; } final String arg1 = fileName; @@ -536,24 +550,6 @@ public class FileLoader { memCache.evictAll(); } - public void cleanDisk(boolean all) { - /*if (all) { - [cacheInQueue cancelAllOperations]; - [[NSFileManager defaultManager] removeItemAtPath:diskCachePath error:nil]; - [[NSFileManager defaultManager] createDirectoryAtPath:diskCachePath withIntermediateDirectories:YES attributes:nil error:NULL]; - } else { - NSDate *expirationDate = [NSDate dateWithTimeIntervalSinceNow:-cacheMaxCacheAge]; - NSDirectoryEnumerator *fileEnumerator = [[NSFileManager defaultManager] enumeratorAtPath:diskCachePath]; - for (NSString *fileName in fileEnumerator) { - NSString *filePath = [diskCachePath stringByAppendingPathComponent:fileName]; - NSDictionary *attrs = [[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:nil]; - if ([[[attrs fileModificationDate] laterDate:expirationDate] isEqualToDate:expirationDate]) { - [[NSFileManager defaultManager] removeItemAtPath:filePath error:nil]; - } - } - }*/ - } - public void cancelLoadingForImageView(final View imageView) { if (imageView == null) { return; @@ -598,10 +594,11 @@ public class FileLoader { String key; if (httpUrl != null) { key = Utilities.MD5(httpUrl); - } else if (filter == null) { - key = url.volume_id + "_" + url.local_id; } else { - key = url.volume_id + "_" + url.local_id + "@" + filter; + key = url.volume_id + "_" + url.local_id; + } + if (filter != null) { + key += "@" + filter; } Bitmap img = imageFromKey(key); @@ -664,10 +661,11 @@ public class FileLoader { String key; if (httpUrl != null) { key = Utilities.MD5(httpUrl); - } else if (filter == null) { - key = url.volume_id + "_" + url.local_id; } else { - key = url.volume_id + "_" + url.local_id + "@" + filter; + key = url.volume_id + "_" + url.local_id; + } + if (filter != null) { + key += "@" + filter; } Integer num = (Integer)imageView.getTag(R.string.CacheTag); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/FileLog.java b/TMessagesProj/src/main/java/org/telegram/messenger/FileLog.java index 557ade92c..00ce841ef 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/FileLog.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/FileLog.java @@ -20,8 +20,6 @@ import java.util.ArrayList; import java.util.Locale; public class FileLog { - public static boolean DEBUG_VERSION = true; - public static FileLog Instance = new FileLog(); private OutputStreamWriter streamWriter = null; private FastDateFormat dateFormat = null; @@ -29,7 +27,7 @@ public class FileLog { private File currentFile = null; public FileLog() { - if (!DEBUG_VERSION) { + if (!ConnectionsManager.DEBUG_VERSION) { return; } dateFormat = FastDateFormat.getInstance("dd_MM_yyyy_HH_mm_ss", Locale.US); @@ -59,7 +57,7 @@ public class FileLog { } public static void e(final String tag, final String message, final Throwable exception) { - if (!DEBUG_VERSION) { + if (!ConnectionsManager.DEBUG_VERSION) { return; } Log.e(tag, message, exception); @@ -80,7 +78,7 @@ public class FileLog { } public static void e(final String tag, final String message) { - if (!DEBUG_VERSION) { + if (!ConnectionsManager.DEBUG_VERSION) { return; } Log.e(tag, message); @@ -100,7 +98,7 @@ public class FileLog { } public static void e(final String tag, final Exception e) { - if (!DEBUG_VERSION) { + if (!ConnectionsManager.DEBUG_VERSION) { return; } e.printStackTrace(); @@ -124,7 +122,7 @@ public class FileLog { } public static void d(final String tag, final String message) { - if (!DEBUG_VERSION) { + if (!ConnectionsManager.DEBUG_VERSION) { return; } Log.d(tag, message); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/HandshakeAction.java b/TMessagesProj/src/main/java/org/telegram/messenger/HandshakeAction.java index a0673e421..46a401137 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/HandshakeAction.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/HandshakeAction.java @@ -77,9 +77,7 @@ public class HandshakeAction extends Action implements TcpConnection.TcpConnecti TLRPC.TL_req_pq reqPq = new TLRPC.TL_req_pq(); byte[] nonceBytes = new byte[16]; - for (int a = 0; a < 16; a++) { - nonceBytes[a] = (byte)(MessagesController.random.nextDouble() * 255); - } + MessagesController.random.nextBytes(nonceBytes); authNonce = reqPq.nonce = nonceBytes; reqPQMsgData = sendMessageData(reqPq, generateMessageId()); } @@ -104,6 +102,45 @@ public class HandshakeAction extends Action implements TcpConnection.TcpConnecti new BigInteger("010001", 16)}); map.put("fingerprint", 0xc3b42b026ce86b21L); serverPublicKeys.add(map); + + map = new HashMap(); + map.put("key", new BigInteger[]{ + new BigInteger("c6aeda78b02a251db4b6441031f467fa871faed32526c436524b1fb3b5dc" + + "a28efb8c089dd1b46d92c895993d87108254951c5f001a0f055f3063dcd14d431a300eb9e29" + + "517e359a1c9537e5e87ab1b116faecf5d17546ebc21db234d9d336a693efcb2b6fbcca1e7d1" + + "a0be414dca408a11609b9c4269a920b09fed1f9a1597be02761430f09e4bc48fcafbe289054" + + "c99dba51b6b5eb7d9c3a2ab4e490545b4676bd620e93804bcac93bf94f73f92c729ca899477" + + "ff17625ef14a934d51dc11d5f8650a3364586b3a52fcff2fedec8a8406cac4e751705a472e5" + + "5707e3c8cd5594342b119c6c3293532d85dbe9271ed54a2fd18b4dc79c04a30951107d5639397", 16), + new BigInteger("010001", 16)}); + map.put("fingerprint", 0x9a996a1db11c729bL); + serverPublicKeys.add(map); + + map = new HashMap(); + map.put("key", new BigInteger[]{ + new BigInteger("b1066749655935f0a5936f517034c943bea7f3365a8931ae52c8bcb14856" + + "f004b83d26cf2839be0f22607470d67481771c1ce5ec31de16b20bbaa4ecd2f7d2ecf6b6356" + + "f27501c226984263edc046b89fb6d3981546b01d7bd34fedcfcc1058e2d494bda732ff813e5" + + "0e1c6ae249890b225f82b22b1e55fcb063dc3c0e18e91c28d0c4aa627dec8353eee6038a95a" + + "4fd1ca984eb09f94aeb7a2220635a8ceb450ea7e61d915cdb4eecedaa083aa3801daf071855" + + "ec1fb38516cb6c2996d2d60c0ecbcfa57e4cf1fb0ed39b2f37e94ab4202ecf595e167b3ca62" + + "669a6da520859fb6d6c6203dfdfc79c75ec3ee97da8774b2da903e3435f2cd294670a75a526c1", 16), + new BigInteger("010001", 16)}); + map.put("fingerprint", 0xb05b2a6f70cdea78L); + serverPublicKeys.add(map); + + map = new HashMap(); + map.put("key", new BigInteger[]{ + new BigInteger("c2a8c55b4a62e2b78a19b91cf692bcdc4ba7c23fe4d06f194e2a0c30f6d9" + + "996f7d1a2bcc89bc1ac4333d44359a6c433252d1a8402d9970378b5912b75bc8cc3fa76710a" + + "025bcb9032df0b87d7607cc53b928712a174ea2a80a8176623588119d42ffce40205c6d7216" + + "0860d8d80b22a8b8651907cf388effbef29cd7cf2b4eb8a872052da1351cfe7fec214ce4830" + + "4ea472bd66329d60115b3420d08f6894b0410b6ab9450249967617670c932f7cbdb5d6fbcce" + + "1e492c595f483109999b2661fcdeec31b196429b7834c7211a93c6789d9ee601c18c39e521f" + + "da9d7264e61e518add6f0712d2d5228204b851e13c4f322e5c5431c3b7f31089668486aadc59f", 16), + new BigInteger("010001", 16)}); + map.put("fingerprint", 0x71e025b6c76033e3L); + serverPublicKeys.add(map); } } @@ -209,9 +246,7 @@ public class HandshakeAction extends Action implements TcpConnection.TcpConnecti innerData.q = reqDH.q; byte[] nonceBytes = new byte[32]; - for (int a = 0; a < 32; a++) { - nonceBytes[a] = (byte)(MessagesController.random.nextDouble() * 255); - } + MessagesController.random.nextBytes(nonceBytes); innerData.new_nonce = authNewNonce = nonceBytes; innerData.serializeToStream(os); @@ -340,9 +375,7 @@ public class HandshakeAction extends Action implements TcpConnection.TcpConnecti } byte[] b = new byte[256]; - for (int a = 0; a < 256; a++) { - b[a] = (byte)(MessagesController.random.nextDouble() * 255); - } + MessagesController.random.nextBytes(b); BigInteger p = new BigInteger(1, dhInnerData.dh_prime); BigInteger g_a = new BigInteger(1, dhInnerData.g_a); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java index 42350fd35..e39e47315 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java @@ -133,6 +133,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter public int type; public TLRPC.FileLocation location; public TLRPC.TL_video videoLocation; + public TLRPC.TL_document documentLocation; public MessageObject obj; public TLRPC.EncryptedChat encryptedChat; } @@ -1960,31 +1961,35 @@ public class MessagesController implements NotificationCenter.NotificationCenter } public void sendMessage(TLRPC.User user, long peer) { - sendMessage(null, 0, 0, null, null, null, null, user, peer); + sendMessage(null, 0, 0, null, null, null, null, user, null, peer); } public void sendMessage(MessageObject message, long peer) { - sendMessage(null, 0, 0, null, null, message, null, null, peer); + sendMessage(null, 0, 0, null, null, message, null, null, null, peer); + } + + public void sendMessage(TLRPC.TL_document document, long peer) { + sendMessage(null, 0, 0, null, null, null, null, null, document, peer); } public void sendMessage(String message, long peer) { - sendMessage(message, 0, 0, null, null, null, null, null, peer); + sendMessage(message, 0, 0, null, null, null, null, null, null, peer); } public void sendMessage(TLRPC.FileLocation location, long peer) { - sendMessage(null, 0, 0, null, null, null, location, null, peer); + sendMessage(null, 0, 0, null, null, null, location, null, null, peer); } public void sendMessage(double lat, double lon, long peer) { - sendMessage(null, lat, lon, null, null, null, null, null, peer); + sendMessage(null, lat, lon, null, null, null, null, null, null, peer); } public void sendMessage(TLRPC.TL_photo photo, long peer) { - sendMessage(null, 0, 0, photo, null, null, null, null, peer); + sendMessage(null, 0, 0, photo, null, null, null, null, null, peer); } public void sendMessage(TLRPC.TL_video video, long peer) { - sendMessage(null, 0, 0, null, video, null, null, null, peer); + sendMessage(null, 0, 0, null, video, null, null, null, null, peer); } public void sendTTLMessage(TLRPC.EncryptedChat encryptedChat) { @@ -2028,7 +2033,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter performSendEncryptedRequest(reqSend, newMsgObj, encryptedChat, null); } - private void sendMessage(String message, double lat, double lon, TLRPC.TL_photo photo, TLRPC.TL_video video, MessageObject msgObj, TLRPC.FileLocation location, TLRPC.User user, long peer) { + private void sendMessage(String message, double lat, double lon, TLRPC.TL_photo photo, TLRPC.TL_video video, MessageObject msgObj, TLRPC.FileLocation location, TLRPC.User user, TLRPC.TL_document document, long peer) { TLRPC.Message newMsg = null; int type = -1; if (message != null) { @@ -2095,6 +2100,13 @@ public class MessagesController implements NotificationCenter.NotificationCenter newMsg.media.user_id = user.id; newMsg.message = ""; type = 6; + } else if (document != null) { + newMsg = new TLRPC.TL_message(); + newMsg.media = new TLRPC.TL_messageMediaDocument(); + newMsg.media.document = document; + type = 7; + newMsg.message = "-1"; + newMsg.attachPath = document.path; } if (newMsg == null) { return; @@ -2172,7 +2184,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter reqSend.media = new TLRPC.TL_decryptedMessageMediaEmpty(); performSendEncryptedRequest(reqSend, newMsgObj, encryptedChat, null); } - } else if (type == 1 || type == 2 || type == 3 || type == 5 || type == 6) { + } else if (type == 1 || type == 2 || type == 3 || type == 5 || type == 6 || type == 7) { if (encryptedChat == null) { TLRPC.TL_messages_sendMedia reqSend = new TLRPC.TL_messages_sendMedia(); reqSend.peer = sendToPeer; @@ -2216,6 +2228,16 @@ public class MessagesController implements NotificationCenter.NotificationCenter reqSend.media.first_name = user.first_name; reqSend.media.last_name = user.last_name; performSendMessageRequest(reqSend, newMsgObj); + } else if (type == 7) { + reqSend.media = new TLRPC.TL_inputMediaUploadedDocument(); + reqSend.media.mime_type = document.mime_type; + reqSend.media.file_name = document.file_name; + DelayedMessage delayedMessage = new DelayedMessage(); + delayedMessage.sendRequest = reqSend; + delayedMessage.type = 2; + delayedMessage.obj = newMsgObj; + delayedMessage.documentLocation = document; + performSendDelayedMessage(delayedMessage); } } else { TLRPC.TL_decryptedMessage reqSend = new TLRPC.TL_decryptedMessage(); @@ -2280,6 +2302,26 @@ public class MessagesController implements NotificationCenter.NotificationCenter reqSend.media.last_name = user.last_name; reqSend.media.user_id = user.id; performSendEncryptedRequest(reqSend, newMsgObj, encryptedChat, null); + } else if (type == 7) { + reqSend.media = new TLRPC.TL_decryptedMessageMediaDocument(); + reqSend.media.iv = new byte[32]; + reqSend.media.key = new byte[32]; + random.nextBytes(reqSend.media.iv); + random.nextBytes(reqSend.media.key); + reqSend.media.size = document.size; + reqSend.media.thumb = new byte[0]; + reqSend.media.thumb_h = 0; + reqSend.media.thumb_w = 0; + reqSend.media.file_name = document.file_name; + reqSend.media.mime_type = document.mime_type; + + DelayedMessage delayedMessage = new DelayedMessage(); + delayedMessage.sendEncryptedRequest = reqSend; + delayedMessage.type = 2; + delayedMessage.obj = newMsgObj; + delayedMessage.encryptedChat = encryptedChat; + delayedMessage.documentLocation = document; + performSendDelayedMessage(delayedMessage); } } } else if (type == 4) { @@ -2337,6 +2379,9 @@ public class MessagesController implements NotificationCenter.NotificationCenter sendedMessage.message = newMsg.message; sendedMessage.attachPath = newMsg.attachPath; } + } else if (sendedMessage.media instanceof TLRPC.TL_messageMediaDocument && sendedMessage.media.document != null && newMsg.media instanceof TLRPC.TL_messageMediaDocument && newMsg.media.document != null) { + sendedMessage.message = newMsg.message; + sendedMessage.attachPath = newMsg.attachPath; } } else if (file != null) { if (newMsg.media instanceof TLRPC.TL_messageMediaPhoto && newMsg.media.photo != null) { @@ -2378,6 +2423,24 @@ public class MessagesController implements NotificationCenter.NotificationCenter ArrayList arr = new ArrayList(); arr.add(newMsg); MessagesStorage.Instance.putMessages(arr, false, true); + } else if (newMsg.media instanceof TLRPC.TL_messageMediaDocument && newMsg.media.document != null) { + TLRPC.Document document = newMsg.media.document; + newMsg.media.document = new TLRPC.TL_documentEncrypted(); + newMsg.media.document.id = file.id; + newMsg.media.document.access_hash = file.access_hash; + newMsg.media.document.user_id = document.user_id; + newMsg.media.document.date = document.date; + newMsg.media.document.file_name = document.file_name; + newMsg.media.document.mime_type = document.mime_type; + newMsg.media.document.size = file.size; + newMsg.media.document.key = decryptedMessage.media.key; + newMsg.media.document.iv = decryptedMessage.media.iv; + newMsg.media.document.path = document.path; + newMsg.media.document.thumb = document.thumb; + newMsg.media.document.dc_id = file.dc_id; + ArrayList arr = new ArrayList(); + arr.add(newMsg); + MessagesStorage.Instance.putMessages(arr, false, true); } } } @@ -2591,6 +2654,14 @@ public class MessagesController implements NotificationCenter.NotificationCenter delayedMessages.put(location, message); FileLoader.Instance.uploadFile(location, message.sendEncryptedRequest.media.key, message.sendEncryptedRequest.media.iv); } + } else if (message.type == 2) { + String location = message.documentLocation.path; + delayedMessages.put(location, message); + if (message.sendRequest != null) { + FileLoader.Instance.uploadFile(location, null, null); + } else { + FileLoader.Instance.uploadFile(location, message.sendEncryptedRequest.media.key, message.sendEncryptedRequest.media.iv); + } } } }); @@ -2903,12 +2974,17 @@ public class MessagesController implements NotificationCenter.NotificationCenter message.sendRequest.media.file = file; performSendMessageRequest(message.sendRequest, message.obj); } + } else if (message.type == 2) { + message.sendRequest.media.file = file; + performSendMessageRequest(message.sendRequest, message.obj); } } else if (encryptedFile != null) { if (message.type == 0) { performSendEncryptedRequest(message.sendEncryptedRequest, message.obj, message.encryptedChat, encryptedFile); } else if (message.type == 1) { performSendEncryptedRequest(message.sendEncryptedRequest, message.obj, message.encryptedChat, encryptedFile); + } else if (message.type == 2) { + performSendEncryptedRequest(message.sendEncryptedRequest, message.obj, message.encryptedChat, encryptedFile); } } delayedMessages.remove(location); @@ -4473,6 +4549,10 @@ public class MessagesController implements NotificationCenter.NotificationCenter msg = ApplicationLoader.applicationContext.getString(R.string.NotificationMessageContact, Utilities.formatName(u.first_name, u.last_name)); } else if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaGeo) { msg = ApplicationLoader.applicationContext.getString(R.string.NotificationMessageMap, Utilities.formatName(u.first_name, u.last_name)); + } else if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaDocument) { + msg = ApplicationLoader.applicationContext.getString(R.string.NotificationMessageDocument, Utilities.formatName(u.first_name, u.last_name)); + } else if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaAudio) { + msg = ApplicationLoader.applicationContext.getString(R.string.NotificationMessageAudio, Utilities.formatName(u.first_name, u.last_name)); } } } else if (chat_id != 0 && user_id == 0) { @@ -4527,6 +4607,10 @@ public class MessagesController implements NotificationCenter.NotificationCenter msg = ApplicationLoader.applicationContext.getString(R.string.NotificationMessageGroupContact, Utilities.formatName(u.first_name, u.last_name), chat.title); } else if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaGeo) { msg = ApplicationLoader.applicationContext.getString(R.string.NotificationMessageGroupMap, Utilities.formatName(u.first_name, u.last_name), chat.title); + } else if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaDocument) { + msg = ApplicationLoader.applicationContext.getString(R.string.NotificationMessageGroupDocument, Utilities.formatName(u.first_name, u.last_name), chat.title); + } else if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaAudio) { + msg = ApplicationLoader.applicationContext.getString(R.string.NotificationMessageGroupAudio, Utilities.formatName(u.first_name, u.last_name), chat.title); } } } @@ -4737,13 +4821,15 @@ public class MessagesController implements NotificationCenter.NotificationCenter newMessage.media.photo.date = newMessage.date; newMessage.media.photo.caption = ""; newMessage.media.photo.geo = new TLRPC.TL_geoPointEmpty(); - TLRPC.TL_photoCachedSize small = new TLRPC.TL_photoCachedSize(); - small.w = decryptedMessage.media.thumb_w; - small.h = decryptedMessage.media.thumb_h; - small.bytes = decryptedMessage.media.thumb; - small.type = "s"; - small.location = new TLRPC.TL_fileLocationUnavailable(); - newMessage.media.photo.sizes.add(small); + if (decryptedMessage.media.thumb.length != 0 && decryptedMessage.media.thumb.length <= 5000 && decryptedMessage.media.thumb_w < 100 && decryptedMessage.media.thumb_h < 100) { + TLRPC.TL_photoCachedSize small = new TLRPC.TL_photoCachedSize(); + small.w = decryptedMessage.media.thumb_w; + small.h = decryptedMessage.media.thumb_h; + small.bytes = decryptedMessage.media.thumb; + small.type = "s"; + small.location = new TLRPC.TL_fileLocationUnavailable(); + newMessage.media.photo.sizes.add(small); + } TLRPC.TL_photoSize big = new TLRPC.TL_photoSize(); big.w = decryptedMessage.media.w; @@ -4764,12 +4850,17 @@ public class MessagesController implements NotificationCenter.NotificationCenter } newMessage.media = new TLRPC.TL_messageMediaVideo(); newMessage.media.video = new TLRPC.TL_videoEncrypted(); - newMessage.media.video.thumb = new TLRPC.TL_photoCachedSize(); - newMessage.media.video.thumb.bytes = decryptedMessage.media.thumb; - newMessage.media.video.thumb.w = decryptedMessage.media.thumb_w; - newMessage.media.video.thumb.h = decryptedMessage.media.thumb_h; - newMessage.media.video.thumb.type = "s"; - newMessage.media.video.thumb.location = new TLRPC.TL_fileLocationUnavailable(); + if (decryptedMessage.media.thumb.length != 0 && decryptedMessage.media.thumb.length <= 5000 && decryptedMessage.media.thumb_w < 100 && decryptedMessage.media.thumb_h < 100) { + newMessage.media.video.thumb = new TLRPC.TL_photoCachedSize(); + newMessage.media.video.thumb.bytes = decryptedMessage.media.thumb; + newMessage.media.video.thumb.w = decryptedMessage.media.thumb_w; + newMessage.media.video.thumb.h = decryptedMessage.media.thumb_h; + newMessage.media.video.thumb.type = "s"; + newMessage.media.video.thumb.location = new TLRPC.TL_fileLocationUnavailable(); + } else { + newMessage.media.video.thumb = new TLRPC.TL_photoSizeEmpty(); + newMessage.media.video.thumb.type = "s"; + } newMessage.media.video.duration = decryptedMessage.media.duration; newMessage.media.video.dc_id = message.file.dc_id; newMessage.media.video.w = decryptedMessage.media.w; @@ -4782,6 +4873,33 @@ public class MessagesController implements NotificationCenter.NotificationCenter newMessage.media.video.access_hash = message.file.access_hash; newMessage.media.video.key = decryptedMessage.media.key; newMessage.media.video.iv = decryptedMessage.media.iv; + } else if (decryptedMessage.media instanceof TLRPC.TL_decryptedMessageMediaDocument) { + if (decryptedMessage.media.key.length != 32 || decryptedMessage.media.iv.length != 32) { + return null; + } + newMessage.media = new TLRPC.TL_messageMediaDocument(); + newMessage.media.document = new TLRPC.TL_documentEncrypted(); + newMessage.media.document.id = message.file.id; + newMessage.media.document.access_hash = message.file.access_hash; + newMessage.media.document.user_id = decryptedMessage.media.user_id; + newMessage.media.document.date = message.date; + newMessage.media.document.file_name = decryptedMessage.media.file_name; + newMessage.media.document.mime_type = decryptedMessage.media.mime_type; + newMessage.media.document.size = message.file.size; + newMessage.media.document.key = decryptedMessage.media.key; + newMessage.media.document.iv = decryptedMessage.media.iv; + if (decryptedMessage.media.thumb.length != 0 && decryptedMessage.media.thumb.length <= 5000 && decryptedMessage.media.thumb_w < 100 && decryptedMessage.media.thumb_h < 100) { + newMessage.media.document.thumb = new TLRPC.TL_photoCachedSize(); + newMessage.media.document.thumb.bytes = decryptedMessage.media.thumb; + newMessage.media.document.thumb.w = decryptedMessage.media.thumb_w; + newMessage.media.document.thumb.h = decryptedMessage.media.thumb_h; + newMessage.media.document.thumb.type = "s"; + newMessage.media.document.thumb.location = new TLRPC.TL_fileLocationUnavailable(); + } else { + newMessage.media.document.thumb = new TLRPC.TL_photoSizeEmpty(); + newMessage.media.document.thumb.type = "s"; + } + newMessage.media.document.dc_id = message.file.dc_id; } else { return null; } @@ -4903,7 +5021,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter } byte[] salt = new byte[256]; for (int a = 0; a < 256; a++) { - salt[a] = (byte)((byte)(random.nextDouble() * 255) ^ res.random[a]); + salt[a] = (byte)((byte)(random.nextDouble() * 256) ^ res.random[a]); } encryptedChat.a_or_b = salt; BigInteger p = new BigInteger(1, MessagesStorage.secretPBytes); @@ -5009,7 +5127,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter } final byte[] salt = new byte[256]; for (int a = 0; a < 256; a++) { - salt[a] = (byte)((byte)(random.nextDouble() * 255) ^ res.random[a]); + salt[a] = (byte)((byte)(random.nextDouble() * 256) ^ res.random[a]); } BigInteger i_g_a = BigInteger.valueOf(MessagesStorage.secretG); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/RPCRequest.java b/TMessagesProj/src/main/java/org/telegram/messenger/RPCRequest.java index 818f41bba..fb3626386 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/RPCRequest.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/RPCRequest.java @@ -58,6 +58,8 @@ public class RPCRequest { boolean confirmed; + boolean initRequest = false; + ArrayList respondsToMessageIds = new ArrayList(); public void addRespondMessageId(long messageId) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java b/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java index af042bf88..311d7ff22 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java @@ -753,6 +753,18 @@ public class Utilities { return result; } + public static String formatFileSize(long size) { + if (size < 1024) { + return String.format("%d B", size); + } else if (size < 1024 * 1024) { + return String.format("%.1f KB", size / 1024.0f); + } else if (size < 1024 * 1024 * 1024) { + return String.format("%.1f MB", size / 1024.0f / 1024.0f); + } else { + return String.format("%.1f GB", size / 1024.0f / 1024.0f / 1024.0f); + } + } + public static String stringForMessageListDate(long date) { Calendar rightNow = Calendar.getInstance(); int day = rightNow.get(Calendar.DAY_OF_YEAR); diff --git a/TMessagesProj/src/main/java/org/telegram/objects/MessageObject.java b/TMessagesProj/src/main/java/org/telegram/objects/MessageObject.java index eaf5b3fa3..cb949b30f 100644 --- a/TMessagesProj/src/main/java/org/telegram/objects/MessageObject.java +++ b/TMessagesProj/src/main/java/org/telegram/objects/MessageObject.java @@ -10,6 +10,7 @@ package org.telegram.objects; import android.graphics.Bitmap; +import org.telegram.TL.TLObject; import org.telegram.TL.TLRPC; import org.telegram.messenger.Emoji; import org.telegram.messenger.MessagesController; @@ -211,6 +212,10 @@ public class MessageObject { messageText = ApplicationLoader.applicationContext.getString(R.string.AttachContact); } else if (message.media instanceof TLRPC.TL_messageMediaUnsupported) { messageText = ApplicationLoader.applicationContext.getString(R.string.UnsuppotedMedia); + } else if (message.media instanceof TLRPC.TL_messageMediaDocument) { + messageText = ApplicationLoader.applicationContext.getString(R.string.AttachDocument); + } else if (message.media instanceof TLRPC.TL_messageMediaAudio) { + messageText = ApplicationLoader.applicationContext.getString(R.string.AttachAudio); } } else { messageText = message.message; @@ -255,6 +260,12 @@ public class MessageObject { } else { type = 1; } + } else if (message.media != null && message.media instanceof TLRPC.TL_messageMediaDocument) { + if (message.from_id == UserConfig.clientUserId) { + type = 16; + } else { + type = 17; + } } } else if (message instanceof TLRPC.TL_messageService) { if (message.action instanceof TLRPC.TL_messageActionChatEditPhoto || message.action instanceof TLRPC.TL_messageActionUserUpdatedPhoto) { @@ -277,4 +288,38 @@ public class MessageObject { int dateMonth = rightNow.get(Calendar.MONTH); dateKey = String.format("%d_%02d_%02d", dateYear, dateMonth, dateDay); } + + public String getFileName() { + if (messageOwner.media instanceof TLRPC.TL_messageMediaVideo) { + return getAttachFileName(messageOwner.media.video); + } else if (messageOwner.media instanceof TLRPC.TL_messageMediaDocument) { + return getAttachFileName(messageOwner.media.document); + } + return ""; + } + + public static String getAttachFileName(TLObject attach) { + if (attach instanceof TLRPC.Video) { + TLRPC.Video video = (TLRPC.Video)attach; + return video.dc_id + "_" + video.id + ".mp4"; + } else if (attach instanceof TLRPC.Document) { + TLRPC.Document document = (TLRPC.Document)attach; + String ext = document.file_name; + int idx = -1; + if (ext == null || (idx = ext.lastIndexOf(".")) == -1) { + ext = ""; + } else { + ext = ext.substring(idx); + } + if (ext.length() > 1) { + return document.dc_id + "_" + document.id + ext; + } else { + return document.dc_id + "_" + document.id; + } + } else if (attach instanceof TLRPC.PhotoSize) { + TLRPC.PhotoSize photo = (TLRPC.PhotoSize)attach; + return photo.location.volume_id + "_" + photo.location.local_id + ".jpg"; + } + return ""; + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ApplicationActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ApplicationActivity.java index 06a1cdf88..1353c3207 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ApplicationActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ApplicationActivity.java @@ -317,12 +317,12 @@ public class ApplicationActivity extends ActionBarActivity implements Notificati } private void checkForCrashes() { - CrashManager.register(this, "your-hockeyapp-api-key-here"); + CrashManager.register(this, ConnectionsManager.HOCKEY_APP_HASH); } private void checkForUpdates() { - if (FileLog.DEBUG_VERSION) { - UpdateManager.register(this, "your-hockeyapp-api-key-here"); + if (ConnectionsManager.DEBUG_VERSION) { + UpdateManager.register(this, ConnectionsManager.HOCKEY_APP_HASH); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ApplicationLoader.java b/TMessagesProj/src/main/java/org/telegram/ui/ApplicationLoader.java index 5b9c339f1..5da7a87b2 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ApplicationLoader.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ApplicationLoader.java @@ -150,7 +150,7 @@ public class ApplicationLoader extends Application { return ""; } int registeredVersion = prefs.getInt(PROPERTY_APP_VERSION, Integer.MIN_VALUE); - int currentVersion = getAppVersion(context); + int currentVersion = getAppVersion(); if (registeredVersion != currentVersion) { FileLog.d("tmessages", "App version changed."); return ""; @@ -162,9 +162,9 @@ public class ApplicationLoader extends Application { return getSharedPreferences(ApplicationLoader.class.getSimpleName(), Context.MODE_PRIVATE); } - private static int getAppVersion(Context context) { + public static int getAppVersion() { try { - PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); + PackageInfo packageInfo = applicationContext.getPackageManager().getPackageInfo(applicationContext.getPackageName(), 0); return packageInfo.versionCode; } catch (PackageManager.NameNotFoundException e) { throw new RuntimeException("Could not get package name: " + e); @@ -223,7 +223,7 @@ public class ApplicationLoader extends Application { private void storeRegistrationId(Context context, String regId) { final SharedPreferences prefs = getGCMPreferences(context); - int appVersion = getAppVersion(context); + int appVersion = getAppVersion(); FileLog.e("tmessages", "Saving regId on app version " + appVersion); SharedPreferences.Editor editor = prefs.edit(); editor.putString(PROPERTY_REG_ID, regId); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index 09964bc38..96fc843fd 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -53,6 +53,7 @@ import android.view.ViewParent; import android.view.ViewTreeObserver; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; +import android.webkit.MimeTypeMap; import android.widget.AbsListView; import android.widget.AdapterView; import android.widget.BaseAdapter; @@ -95,7 +96,7 @@ import java.util.Comparator; import java.util.HashMap; import java.util.Locale; -public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLayout.SizeNotifierRelativeLayoutDelegate, NotificationCenter.NotificationCenterDelegate, MessagesActivity.MessagesActivityDelegate { +public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLayout.SizeNotifierRelativeLayoutDelegate, NotificationCenter.NotificationCenterDelegate, MessagesActivity.MessagesActivityDelegate, DocumentSelectActivity.DocumentSelectActivityDelegate { private LayoutListView chatListView; private BackupImageView avatarImageView; private TLRPC.Chat currentChat; @@ -164,7 +165,6 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa private MessageObject unreadMessageObject = null; //private boolean reloadAfterAnimation = false; - private int videoLocalId; private String currentPicturePath; private TLRPC.ChatParticipants info = null; @@ -421,9 +421,17 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa v.setVisibility(View.VISIBLE); if (currentEncryptedChat.admin_id == UserConfig.clientUserId) { - secretViewStatusTextView.setText(String.format(getStringEntry(R.string.EncryptedPlaceholderTitleOutgoing), currentUser.first_name)); + if (currentUser.first_name.length() > 0) { + secretViewStatusTextView.setText(String.format(getStringEntry(R.string.EncryptedPlaceholderTitleOutgoing), currentUser.first_name)); + } else { + secretViewStatusTextView.setText(String.format(getStringEntry(R.string.EncryptedPlaceholderTitleOutgoing), currentUser.last_name)); + } } else { - secretViewStatusTextView.setText(String.format(getStringEntry(R.string.EncryptedPlaceholderTitleIncoming), currentUser.first_name)); + if (currentUser.first_name.length() > 0) { + secretViewStatusTextView.setText(String.format(getStringEntry(R.string.EncryptedPlaceholderTitleIncoming), currentUser.first_name)); + } else { + secretViewStatusTextView.setText(String.format(getStringEntry(R.string.EncryptedPlaceholderTitleIncoming), currentUser.last_name)); + } } updateSecretStatus(); @@ -1192,7 +1200,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa TLRPC.TL_video video = new TLRPC.TL_video(); video.thumb = size; video.caption = ""; - video.id = videoLocalId; + video.id = 0; video.path = videoPath; File temp = new File(videoPath); if (temp != null && temp.exists()) { @@ -2360,6 +2368,10 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa } else if (selectedObject.type == 12 || selectedObject.type == 13) { TLRPC.User user = MessagesController.Instance.users.get(selectedObject.messageOwner.media.user_id); MessagesController.Instance.sendMessage(user, dialog_id); + } else if (selectedObject.type == 16 || selectedObject.type == 17) { + TLRPC.TL_document document = (TLRPC.TL_document)selectedObject.messageOwner.media.document; + document.path = selectedObject.messageOwner.attachPath; + MessagesController.Instance.sendMessage(document, dialog_id); } ArrayList arr = new ArrayList(); arr.add(selectedObject.messageOwner.id); @@ -2404,6 +2416,33 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa } } + @Override + public void didSelectFile(DocumentSelectActivity activity, String path, String name, String ext, long size) { + activity.finishFragment(); + TLRPC.TL_document document = new TLRPC.TL_document(); + document.thumb = new TLRPC.TL_photoSizeEmpty(); + document.thumb.type = "s"; + document.id = 0; + document.user_id = UserConfig.clientUserId; + document.date = ConnectionsManager.Instance.getCurrentTime(); + document.file_name = name; + document.size = (int)size; + document.dc_id = 0; + document.path = path; + if (ext.length() != 0) { + MimeTypeMap myMime = MimeTypeMap.getSingleton(); + String mimeType = myMime.getMimeTypeFromExtension(ext.toLowerCase()); + if (mimeType != null) { + document.mime_type = mimeType; + } else { + document.mime_type = "application/octet-stream"; + } + } else { + document.mime_type = "application/octet-stream"; + } + MessagesController.Instance.sendMessage(document, dialog_id); + } + @Override public void didSelectDialog(MessagesActivity activity, long did) { if (dialog_id != 0 && (forwaringMessage != null || !selectedMessagesIds.isEmpty())) { @@ -2537,6 +2576,12 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa ((ApplicationActivity)parentActivity).presentFragment(fragment, "location", false); break; } + case R.id.attach_document: { + DocumentSelectActivity fragment = new DocumentSelectActivity(); + fragment.delegate = this; + ((ApplicationActivity)parentActivity).presentFragment(fragment, "document", false); + break; + } } return true; } @@ -2656,6 +2701,12 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa } else if (messageType == 13) { holder.chatBubbleView.setBackgroundResource(R.drawable.chat_incoming_text_states); holder.chatBubbleView.setPadding((int)(15 * displayDensity), (int)(6 * displayDensity), (int)(9 * displayDensity), 0); + } else if (messageType == 16) { + holder.chatBubbleView.setBackgroundResource(R.drawable.chat_outgoing_text_states); + holder.chatBubbleView.setPadding((int)(9 * displayDensity), (int)(9 * displayDensity), (int)(18 * displayDensity), 0); + } else if (messageType == 17) { + holder.chatBubbleView.setBackgroundResource(R.drawable.chat_incoming_text_states); + holder.chatBubbleView.setPadding((int)(18 * displayDensity), (int)(9 * displayDensity), (int)(9 * displayDensity), 0); } } else { if (messageType == 2 || messageType == 4 || messageType == 6) { @@ -2698,6 +2749,20 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa holder.chatBubbleView.setBackgroundResource(R.drawable.msg_in); } holder.chatBubbleView.setPadding((int)(15 * displayDensity), (int)(6 * displayDensity), (int)(9 * displayDensity), 0); + } else if (messageType == 16) { + if (selected) { + holder.chatBubbleView.setBackgroundResource(R.drawable.msg_out_selected); + } else { + holder.chatBubbleView.setBackgroundResource(R.drawable.msg_out); + } + holder.chatBubbleView.setPadding((int)(9 * displayDensity), (int)(9 * displayDensity), (int)(18 * displayDensity), 0); + } else if (messageType == 17) { + if (selected) { + holder.chatBubbleView.setBackgroundResource(R.drawable.msg_in_selected); + } else { + holder.chatBubbleView.setBackgroundResource(R.drawable.msg_in); + } + holder.chatBubbleView.setPadding((int)(18 * displayDensity), (int)(9 * displayDensity), (int)(9 * displayDensity), 0); } } } @@ -2830,6 +2895,14 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa } } else if (type == 15) { view = li.inflate(R.layout.chat_unread_layout, viewGroup, false); + } else if (type == 16) { + view = li.inflate(R.layout.chat_outgoing_document_layout, viewGroup, false); + } else if (type == 17) { + if (currentChat != null) { + view = li.inflate(R.layout.chat_group_incoming_document_layout, viewGroup, false); + } else { + view = li.inflate(R.layout.chat_incoming_document_layout, viewGroup, false); + } } } @@ -2871,6 +2944,12 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa } else if (messageType == 13) { holder.chatBubbleView.setBackgroundResource(R.drawable.chat_incoming_text_states); holder.chatBubbleView.setPadding((int)(15 * displayDensity), (int)(6 * displayDensity), (int)(9 * displayDensity), 0); + } else if (messageType == 16) { + holder.chatBubbleView.setBackgroundResource(R.drawable.chat_outgoing_text_states); + holder.chatBubbleView.setPadding((int)(9 * displayDensity), (int)(9 * displayDensity), (int)(18 * displayDensity), 0); + } else if (messageType == 17) { + holder.chatBubbleView.setBackgroundResource(R.drawable.chat_incoming_text_states); + holder.chatBubbleView.setPadding((int)(18 * displayDensity), (int)(9 * displayDensity), (int)(9 * displayDensity), 0); } } else { if (messageType == 2 || messageType == 4 || messageType == 6) { @@ -2913,6 +2992,20 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa holder.chatBubbleView.setBackgroundResource(R.drawable.msg_in); } holder.chatBubbleView.setPadding((int)(15 * displayDensity), (int)(6 * displayDensity), (int)(9 * displayDensity), 0); + } else if (messageType == 16) { + if (selected) { + holder.chatBubbleView.setBackgroundResource(R.drawable.msg_out_selected); + } else { + holder.chatBubbleView.setBackgroundResource(R.drawable.msg_out); + } + holder.chatBubbleView.setPadding((int)(9 * displayDensity), (int)(9 * displayDensity), (int)(18 * displayDensity), 0); + } else if (messageType == 17) { + if (selected) { + holder.chatBubbleView.setBackgroundResource(R.drawable.msg_in_selected); + } else { + holder.chatBubbleView.setBackgroundResource(R.drawable.msg_in); + } + holder.chatBubbleView.setPadding((int)(18 * displayDensity), (int)(9 * displayDensity), (int)(9 * displayDensity), 0); } } @@ -2939,7 +3032,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa @Override public int getViewTypeCount() { - return 16; + return 18; } @Override @@ -3014,7 +3107,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa avatarImageView.setImage(photo, "50_50", placeHolderId); } - if (type != 12 && type != 13 && nameTextView != null && fromUser != null) { + if (type != 12 && type != 13 && nameTextView != null && fromUser != null && type != 16 && type != 17) { nameTextView.setText(Utilities.formatName(fromUser.first_name, fromUser.last_name)); nameTextView.setTextColor(Utilities.getColorForId(message.messageOwner.from_id)); } @@ -3026,7 +3119,6 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa } } else if (type == 2 || type == 3 || type == 6 || type == 7) { int width = (int)(Math.min(displaySize.x, displaySize.y) / 2.5f); - /*PhotoObject photo = PhotoObject.getClosestImageWithSize(message.photoThumbs, width, width + 100);*/ PhotoObject photo = PhotoObject.getClosestImageWithSize(message.photoThumbs, width, width + 100); if (photo != null) { @@ -3141,6 +3233,48 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa } else { messageTextView.setText(String.format(getStringEntry(R.string.FewNewMessages), unread_to_load)); } + } else if (type == 16 || type == 17) { + TLRPC.Document document = message.messageOwner.media.document; + if (document instanceof TLRPC.TL_document || document instanceof TLRPC.TL_documentEncrypted) { + nameTextView.setText(message.messageOwner.media.document.file_name); + + String fileName = message.getFileName(); + int idx = fileName.lastIndexOf("."); + String ext = null; + if (idx != -1) { + ext = fileName.substring(idx + 1); + } + if (ext == null || ext.length() == 0) { + ext = message.messageOwner.media.document.mime_type; + } + ext = ext.toUpperCase(); + if (document.size < 1024) { + phoneTextView.setText(String.format("%d B %s", document.size, ext)); + } else if (document.size < 1024 * 1024) { + phoneTextView.setText(String.format("%.1f KB %s", document.size / 1024.0f, ext)); + } else { + phoneTextView.setText(String.format("%.1f MB %s", document.size / 1024.0f / 1024.0f, ext)); + } + if (document.thumb instanceof TLRPC.TL_photoSize) { + + } else if (document.thumb instanceof TLRPC.TL_photoCachedSize) { + + } else { + if (type == 16) { + contactAvatar.setImageResource(R.drawable.doc_green); + } else { + contactAvatar.setImageResource(R.drawable.doc_blue); + } + } + } else { + nameTextView.setText("Error"); + phoneTextView.setText("Error"); + if (type == 16) { + contactAvatar.setImageResource(R.drawable.doc_green); + } else { + contactAvatar.setImageResource(R.drawable.doc_blue); + } + } } if (message.messageOwner.id < 0 && message.messageOwner.send_state != MessagesController.MESSAGE_SEND_STATE_SENT) { @@ -3212,7 +3346,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa } } } - if (message.type == 6 || message.type == 7) { + if (message.type == 6 || message.type == 7 || message.type == 16 || message.type == 17) { Integer tag = (Integer)actionProgress.getTag(); String file = progressByTag.get(tag); if (file != null) { @@ -3222,14 +3356,18 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa if (file != null) { progressBarMap.remove(file); } - String fileName = message.messageOwner.media.video.dc_id + "_" + message.messageOwner.media.video.id + ".mp4"; + String fileName = message.getFileName(); boolean load = false; if (message.messageOwner.attachPath != null && message.messageOwner.attachPath.length() != 0) { File f = new File(message.messageOwner.attachPath); if (f.exists()) { actionAttachButton.setVisibility(View.VISIBLE); actionView.setVisibility(View.GONE); - actionAttachButton.setText(getStringEntry(R.string.ViewVideo)); + if (message.type == 6 || message.type == 7) { + actionAttachButton.setText(getStringEntry(R.string.ViewVideo)); + } else if (message.type == 16 || message.type == 17) { + actionAttachButton.setText(getStringEntry(R.string.Open)); + } } else { load = true; } @@ -3238,7 +3376,11 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa if (cacheFile.exists()) { actionAttachButton.setVisibility(View.VISIBLE); actionView.setVisibility(View.GONE); - actionAttachButton.setText(getStringEntry(R.string.ViewVideo)); + if (message.type == 6 || message.type == 7) { + actionAttachButton.setText(getStringEntry(R.string.ViewVideo)); + } else if (message.type == 16 || message.type == 17) { + actionAttachButton.setText(getStringEntry(R.string.Open)); + } } else { load = true; } @@ -3258,11 +3400,33 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa } else { actionView.setVisibility(View.GONE); actionAttachButton.setVisibility(View.VISIBLE); - actionAttachButton.setText(String.format("%s %.1f MB", getStringEntry(R.string.DOWNLOAD), message.messageOwner.media.video.size / 1024.0f / 1024.0f)); + if (message.type == 6 || message.type == 7) { + actionAttachButton.setText(String.format("%s %.1f MB", getStringEntry(R.string.DOWNLOAD), message.messageOwner.media.video.size / 1024.0f / 1024.0f)); + } else if (message.type == 16 || message.type == 17) { + actionAttachButton.setText(getStringEntry(R.string.DOWNLOAD)); + } } } } } + if (message.type == 16 || message.type == 17) { + int width; + if (currentChat != null && type != 16) { + if (actionView.getVisibility() == View.VISIBLE) { + width = displaySize.x - (int)(290 * displayDensity); + } else { + width = displaySize.x - (int)(270 * displayDensity); + } + } else { + if (actionView.getVisibility() == View.VISIBLE) { + width = displaySize.x - (int)(240 * displayDensity); + } else { + width = displaySize.x - (int)(220 * displayDensity); + } + } + nameTextView.setMaxWidth(width); + phoneTextView.setMaxWidth(width); + } } public ChatListRowHolderEx(View view) { @@ -3343,16 +3507,20 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa contactView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - if (mActionMode != null) { - processRowSelect(view); - return; - } - if (message.messageOwner.media.user_id != UserConfig.clientUserId) { - UserProfileActivity fragment = new UserProfileActivity(); - Bundle args = new Bundle(); - args.putInt("user_id", message.messageOwner.media.user_id); - fragment.setArguments(args); - ((ApplicationActivity)parentActivity).presentFragment(fragment, "user_" + message.messageOwner.media.user_id, false); + if (message.type == 16 || message.type == 17) { + processOnClick(view); + } else if (message.type == 12 || message.type == 13) { + if (mActionMode != null) { + processRowSelect(view); + return; + } + if (message.messageOwner.media.user_id != UserConfig.clientUserId) { + UserProfileActivity fragment = new UserProfileActivity(); + Bundle args = new Bundle(); + args.putInt("user_id", message.messageOwner.media.user_id); + fragment.setArguments(args); + ((ApplicationActivity)parentActivity).presentFragment(fragment, "user_" + message.messageOwner.media.user_id, false); + } } } }); @@ -3370,83 +3538,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa actionAttachButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - if (mActionMode != null) { - processRowSelect(view); - return; - } - if (message != null) { - if (message.type == 4 || message.type == 5) { - if (!isGoogleMapsInstalled()) { - return; - } - NotificationCenter.Instance.addToMemCache(0, message); - LocationActivity fragment = new LocationActivity(); - ((ApplicationActivity)parentActivity).presentFragment(fragment, "location_view", false); - } else if (message.type == 2 || message.type == 3) { - NotificationCenter.Instance.addToMemCache(51, message); - Intent intent = new Intent(parentActivity, GalleryImageViewer.class); - startActivity(intent); - } else if (message.type == 6 || message.type == 7) { - boolean loadFile = false; - String fileName = message.messageOwner.media.video.dc_id + "_" + message.messageOwner.media.video.id + ".mp4"; - if (message.messageOwner.attachPath != null && message.messageOwner.attachPath.length() != 0) { - File f = new File(message.messageOwner.attachPath); - if (f.exists()) { - try { - Intent intent = new Intent(Intent.ACTION_VIEW); - intent.setDataAndType(Uri.fromFile(f), "video/mp4"); - startActivity(intent); - } catch (Exception e) { - AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity); - builder.setTitle(R.string.AppName); - builder.setMessage(R.string.NoPlayerInstalled); - visibleDialog = builder.show(); - visibleDialog.setCanceledOnTouchOutside(true); - visibleDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { - @Override - public void onDismiss(DialogInterface dialog) { - visibleDialog = null; - } - }); - } - } else { - loadFile = true; - } - } else { - File cacheFile = new File(Utilities.getCacheDir(), fileName); - if (cacheFile.exists()) { - try { - Intent intent = new Intent(Intent.ACTION_VIEW); - intent.setDataAndType(Uri.fromFile(cacheFile), "video/mp4"); - startActivity(intent); - } catch (Exception e) { - AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity); - builder.setTitle(R.string.AppName); - builder.setMessage(R.string.NoPlayerInstalled); - visibleDialog = builder.show(); - visibleDialog.setCanceledOnTouchOutside(true); - - visibleDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { - @Override - public void onDismiss(DialogInterface dialog) { - visibleDialog = null; - } - }); - } - } else { - loadFile = true; - } - } - if (loadFile) { - if (!loadingFile.containsKey(fileName)) { - progressByTag.put((Integer)actionProgress.getTag(), fileName); - addToLoadingFile(fileName, actionProgress); - FileLoader.Instance.loadFile(message.messageOwner.media.video, null); - updateVisibleRows(); - } - } - } - } + processOnClick(view); } }); } @@ -3482,11 +3574,15 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa if (file != null) { progressBarMap.remove(file); } - } else if (message.type == 6 || message.type == 7) { + } else if (message.type == 6 || message.type == 7 || message.type == 16 || message.type == 17) { String file = progressByTag.get(tag); if (file != null) { loadingFile.remove(file); - FileLoader.Instance.cancelLoadFile(message.messageOwner.media.video, null); + if (message.type == 6 || message.type == 7) { + FileLoader.Instance.cancelLoadFile(message.messageOwner.media.video, null, null); + } else if (message.type == 16 || message.type == 17) { + FileLoader.Instance.cancelLoadFile(null, null, message.messageOwner.media.document); + } updateVisibleRows(); } } @@ -3499,88 +3595,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa photoImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - if (mActionMode != null) { - processRowSelect(view); - return; - } - if (message != null) { - if (message.type == 4 || message.type == 5) { - if (!isGoogleMapsInstalled()) { - return; - } - NotificationCenter.Instance.addToMemCache(0, message); - LocationActivity fragment = new LocationActivity(); - ((ApplicationActivity)parentActivity).presentFragment(fragment, "location_view", false); - } else if (message.type == 2 || message.type == 3) { - NotificationCenter.Instance.addToMemCache(51, message); - Intent intent = new Intent(parentActivity, GalleryImageViewer.class); - startActivity(intent); - } else if (message.type == 11) { - NotificationCenter.Instance.addToMemCache(51, message); - Intent intent = new Intent(parentActivity, GalleryImageViewer.class); - startActivity(intent); - } else if (message.type == 6 || message.type == 7) { - boolean loadFile = false; - String fileName = message.messageOwner.media.video.dc_id + "_" + message.messageOwner.media.video.id + ".mp4"; - if (message.messageOwner.attachPath != null && message.messageOwner.attachPath.length() != 0) { - File f = new File(message.messageOwner.attachPath); - if (f.exists()) { - try { - Intent intent = new Intent(Intent.ACTION_VIEW); - intent.setDataAndType(Uri.fromFile(f), "video/mp4"); - startActivity(intent); - } catch (Exception e) { - AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity); - builder.setTitle(R.string.AppName); - builder.setMessage(R.string.NoPlayerInstalled); - visibleDialog = builder.show(); - visibleDialog.setCanceledOnTouchOutside(true); - - visibleDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { - @Override - public void onDismiss(DialogInterface dialog) { - visibleDialog = null; - } - }); - } - } else { - loadFile = true; - } - } else { - File cacheFile = new File(Utilities.getCacheDir(), fileName); - if (cacheFile.exists()) { - try { - Intent intent = new Intent(Intent.ACTION_VIEW); - intent.setDataAndType(Uri.fromFile(cacheFile), "video/*"); - startActivity(intent); - } catch (Exception e) { - AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity); - builder.setTitle(R.string.AppName); - builder.setMessage(R.string.NoPlayerInstalled); - visibleDialog = builder.show(); - visibleDialog.setCanceledOnTouchOutside(true); - - visibleDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { - @Override - public void onDismiss(DialogInterface dialog) { - visibleDialog = null; - } - }); - } - } else { - loadFile = true; - } - } - if (loadFile) { - if (!loadingFile.containsKey(fileName)) { - progressByTag.put((Integer)actionProgress.getTag(), fileName); - addToLoadingFile(fileName, actionProgress); - FileLoader.Instance.loadFile(message.messageOwner.media.video, null); - updateVisibleRows(); - } - } - } - } + processOnClick(view); } }); @@ -3609,5 +3624,96 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa }); } } + + 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.Instance.addToMemCache(0, message); + LocationActivity fragment = new LocationActivity(); + ((ApplicationActivity)parentActivity).presentFragment(fragment, "location_view", false); + } else if (message.type == 2 || message.type == 3) { + NotificationCenter.Instance.addToMemCache(51, message); + Intent intent = new Intent(parentActivity, GalleryImageViewer.class); + startActivity(intent); + } else if (message.type == 11) { + NotificationCenter.Instance.addToMemCache(51, message); + Intent intent = new Intent(parentActivity, GalleryImageViewer.class); + startActivity(intent); + } else if (message.type == 6 || message.type == 7 || message.type == 16 || message.type == 17) { + File f = null; + String fileName = message.getFileName(); + if (message.messageOwner.attachPath != null && message.messageOwner.attachPath.length() != 0) { + f = new File(message.messageOwner.attachPath); + } else { + f = new File(Utilities.getCacheDir(), fileName); + } + if (f != null && f.exists()) { + 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 == 16 || message.type == 17) { + MimeTypeMap myMime = MimeTypeMap.getSingleton(); + int idx = fileName.lastIndexOf("."); + if (idx != -1) { + String ext = fileName.substring(idx + 1); + String mimeType = myMime.getMimeTypeFromExtension(ext.toLowerCase()); + if (mimeType != null) { + intent.setDataAndType(Uri.fromFile(f), mimeType); + } else { + intent.setDataAndType(Uri.fromFile(f), "text/plain"); + } + } else { + intent.setDataAndType(Uri.fromFile(f), "text/plain"); + } + } + startActivity(intent); + } catch (Exception e) { + AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity); + builder.setTitle(R.string.AppName); + builder.setPositiveButton(R.string.OK, null); + if (message.type == 6 || message.type == 7) { + builder.setMessage(R.string.NoPlayerInstalled); + } else { + builder.setMessage(String.format(getStringEntry(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; + } + }); + } + } 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 (!loadingFile.containsKey(fileName)) { + progressByTag.put((Integer)actionProgress.getTag(), fileName); + addToLoadingFile(fileName, actionProgress); + if (message.type == 6 || message.type == 7) { + FileLoader.Instance.loadFile(message.messageOwner.media.video, null, null); + } else if (message.type == 16 || message.type == 17) { + FileLoader.Instance.loadFile(null, null, message.messageOwner.media.document); + } + updateVisibleRows(); + } + } else { + if (message.messageOwner.send_state == MessagesController.MESSAGE_SEND_STATE_SEND_ERROR) { + createMenu(view, false); + } + } + } + } + } + } } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/DocumentSelectActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/DocumentSelectActivity.java new file mode 100644 index 000000000..5d9937219 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/DocumentSelectActivity.java @@ -0,0 +1,475 @@ +/* + * This is the source code of Telegram for Android v. 1.3.2. + * It is licensed under GNU GPL v. 2 or later. + * You should have received a copy of the license in this archive (see LICENSE). + * + * Copyright Nikolai Kudashov, 2013. + */ + +package org.telegram.ui; + +import android.app.AlertDialog; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.os.Build; +import android.os.Bundle; +import android.os.Environment; +import android.os.StatFs; +import android.support.v7.app.ActionBar; +import android.view.LayoutInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.BaseAdapter; +import android.widget.ImageView; +import android.widget.ListView; +import android.widget.TextView; + +import org.telegram.messenger.FileLog; +import org.telegram.messenger.R; +import org.telegram.messenger.Utilities; +import org.telegram.ui.Views.BackupImageView; +import org.telegram.ui.Views.BaseFragment; +import org.telegram.ui.Views.OnSwipeTouchListener; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.HashMap; + +public class DocumentSelectActivity extends BaseFragment { + + public static abstract interface DocumentSelectActivityDelegate { + public void didSelectFile(DocumentSelectActivity activity, String path, String name, String ext, long size); + } + + private ListView listView; + private ListAdapter listAdapter; + private File currentDir; + private TextView emptyView; + private ArrayList items = new ArrayList(); + private boolean receiverRegistered = false; + private ArrayList history = new ArrayList(); + private long sizeLimit = 1024 * 1024 * 1024; + public DocumentSelectActivityDelegate delegate; + + private class ListItem { + int icon; + String title; + String subtitle = ""; + String ext = ""; + String thumb; + File file; + } + + private class HistoryEntry { + int scrollItem, scrollOffset; + File dir; + String title; + } + + private BroadcastReceiver receiver = new BroadcastReceiver() { + @Override + public void onReceive(Context arg0, Intent intent) { + Runnable r = new Runnable() { + public void run() { + if (currentDir == null){ + listRoots(); + } else { + listFiles(currentDir); + } + } + }; + if (Intent.ACTION_MEDIA_UNMOUNTED.equals(intent.getAction())) { + listView.postDelayed(r, 1000); + } else { + r.run(); + } + } + }; + + @Override + public boolean onFragmentCreate() { + super.onFragmentCreate(); + return true; + } + + @Override + public void onFragmentDestroy() { + if (receiverRegistered) { + parentActivity.unregisterReceiver(receiver); + } + super.onFragmentDestroy(); + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setHasOptionsMenu(true); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + if (!receiverRegistered) { + receiverRegistered = true; + IntentFilter filter = new IntentFilter(); + filter.addAction(Intent.ACTION_MEDIA_BAD_REMOVAL); + filter.addAction(Intent.ACTION_MEDIA_CHECKING); + filter.addAction(Intent.ACTION_MEDIA_EJECT); + filter.addAction(Intent.ACTION_MEDIA_MOUNTED); + filter.addAction(Intent.ACTION_MEDIA_NOFS); + filter.addAction(Intent.ACTION_MEDIA_REMOVED); + filter.addAction(Intent.ACTION_MEDIA_SHARED); + filter.addAction(Intent.ACTION_MEDIA_UNMOUNTABLE); + filter.addAction(Intent.ACTION_MEDIA_UNMOUNTED); + filter.addDataScheme("file"); + parentActivity.registerReceiver(receiver, filter); + } + + if (fragmentView == null) { + fragmentView = inflater.inflate(R.layout.document_select_layout, container, false); + listAdapter = new ListAdapter(parentActivity); + emptyView = (TextView)fragmentView.findViewById(R.id.searchEmptyView); + listView = (ListView)fragmentView.findViewById(R.id.listView); + listView.setEmptyView(emptyView); + listView.setAdapter(listAdapter); + listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView adapterView, View view, int i, long l) { + ListItem item = items.get(i); + File file = item.file; + if (file.isDirectory()) { + HistoryEntry he = new HistoryEntry(); + he.scrollItem = listView.getFirstVisiblePosition(); + he.scrollOffset = listView.getChildAt(0).getTop(); + he.dir = currentDir; + ActionBar actionBar = parentActivity.getSupportActionBar(); + he.title = actionBar.getTitle().toString(); + if (!listFiles(file)){ + return; + } + history.add(he); + actionBar.setTitle(item.title); + listView.setSelection(0); + } else { + if (!file.canRead()) { + showErrorBox(getString(R.string.AccessError)); + return; + } + if (sizeLimit != 0) { + if (file.length() > sizeLimit) { + showErrorBox(getString(R.string.FileUploadLimit, Utilities.formatFileSize(sizeLimit))); + return; + } + } + if (file.length() == 0) { + return; + } + if (delegate != null) { + delegate.didSelectFile(DocumentSelectActivity.this, file.getAbsolutePath(), item.title, item.ext, file.length()); + } + } + } + }); + + listView.setOnTouchListener(new OnSwipeTouchListener() { + public void onSwipeRight() { + finishFragment(true); + } + }); + listRoots(); + } else { + ViewGroup parent = (ViewGroup)fragmentView.getParent(); + if (parent != null) { + parent.removeView(fragmentView); + } + } + return fragmentView; + } + + @Override + public void applySelfActionBar() { + if (parentActivity == null) { + return; + } + ActionBar actionBar = parentActivity.getSupportActionBar(); + actionBar.setDisplayShowTitleEnabled(true); + actionBar.setDisplayShowHomeEnabled(false); + actionBar.setDisplayHomeAsUpEnabled(true); + actionBar.setDisplayUseLogoEnabled(false); + actionBar.setDisplayShowCustomEnabled(false); + actionBar.setSubtitle(null); + actionBar.setCustomView(null); + actionBar.setTitle(getStringEntry(R.string.SelectFile)); + + TextView title = (TextView)parentActivity.findViewById(R.id.action_bar_title); + if (title == null) { + final int subtitleId = parentActivity.getResources().getIdentifier("action_bar_title", "id", "android"); + title = (TextView)parentActivity.findViewById(subtitleId); + } + if (title != null) { + title.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); + title.setCompoundDrawablePadding(0); + } + } + + @Override + public void onResume() { + super.onResume(); + if (isFinish) { + return; + } + if (getActivity() == null) { + return; + } + if (!firstStart && listAdapter != null) { + listAdapter.notifyDataSetChanged(); + } + firstStart = false; + ((ApplicationActivity)parentActivity).showActionBar(); + ((ApplicationActivity)parentActivity).updateActionBar(); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int itemId = item.getItemId(); + switch (itemId) { + case android.R.id.home: + finishFragment(); + break; + } + return true; + } + + @Override + public boolean onBackPressed() { + if (history.size() > 0){ + HistoryEntry he = history.remove(history.size() - 1); + ActionBar actionBar = parentActivity.getSupportActionBar(); + actionBar.setTitle(he.title); + if (he.dir != null) { + listFiles(he.dir); + } else { + listRoots(); + } + listView.setSelectionFromTop(he.scrollItem, he.scrollOffset); + return false; + } + return super.onBackPressed(); + } + + private boolean listFiles(File dir) { + if (!dir.canRead()) { + if (dir.getAbsolutePath().startsWith(Environment.getExternalStorageDirectory().toString()) + || dir.getAbsolutePath().startsWith("/sdcard") + || dir.getAbsolutePath().startsWith("/mnt/sdcard")) { + if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED) + && !Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED_READ_ONLY)) { + currentDir = dir; + items.clear(); + String state = Environment.getExternalStorageState(); + if (Environment.MEDIA_SHARED.equals(state)){ + emptyView.setText(R.string.UsbActive); + } else { + emptyView.setText(R.string.NotMounted); + } + listAdapter.notifyDataSetChanged(); + return true; + } + } + showErrorBox(getString(R.string.AccessError)); + return false; + } + emptyView.setText(R.string.NoFiles); + File[] files = null; + try { + files = dir.listFiles(); + } catch(Exception e) { + showErrorBox(e.getLocalizedMessage()); + return false; + } + if (files == null) { + showErrorBox(getString(R.string.UnknownError)); + return false; + } + currentDir = dir; + items.clear(); + Arrays.sort(files, new Comparator() { + @Override + public int compare(File lhs, File rhs) { + if (lhs.isDirectory() != rhs.isDirectory()) { + return lhs.isDirectory() ? -1 : 1; + } + return lhs.getName().compareToIgnoreCase(rhs.getName()); + } + }); + for (File file : files) { + if (file.getName().startsWith(".")) { + continue; + } + ListItem item = new ListItem(); + item.title = file.getName(); + item.file = file; + if (file.isDirectory()) { + item.icon = R.drawable.ic_directory; + } else { + String fname = file.getName(); + String[] sp = fname.split("\\."); + item.ext = sp.length > 1 ? sp[sp.length - 1] : "?"; + item.subtitle = Utilities.formatFileSize(file.length()); + fname = fname.toLowerCase(); + if (fname.endsWith(".jpg") || fname.endsWith(".png") || fname.endsWith(".gif") || fname.endsWith(".jpeg")) { + item.thumb = file.getAbsolutePath(); + } + } + items.add(item); + } + listAdapter.notifyDataSetChanged(); + return true; + } + + private void showErrorBox(String error){ + new AlertDialog.Builder(parentActivity) + .setTitle(R.string.AppName) + .setMessage(error) + .setPositiveButton(R.string.OK, null) + .show(); + } + + private void listRoots() { + currentDir = null; + items.clear(); + String extStorage = Environment.getExternalStorageDirectory().getAbsolutePath(); + ListItem ext = new ListItem(); + ext.title = getString(Build.VERSION.SDK_INT < 9 || Environment.isExternalStorageRemovable() ? R.string.SdCard : R.string.InternalStorage); + ext.icon = Build.VERSION.SDK_INT < 9 || Environment.isExternalStorageRemovable() ? R.drawable.ic_external_storage : R.drawable.ic_storage; + ext.subtitle = getRootSubtitle(extStorage); + ext.file = Environment.getExternalStorageDirectory(); + items.add(ext); + try { + BufferedReader reader = new BufferedReader(new FileReader("/proc/mounts")); + String line; + HashMap> aliases = new HashMap>(); + ArrayList result = new ArrayList(); + String extDevice = null; + while ((line = reader.readLine()) != null) { + if ((!line.contains("/mnt") && !line.contains("/storage") && !line.contains("/sdcard")) || line.contains("asec") || line.contains("tmpfs") || line.contains("none")) { + continue; + } + String[] info = line.split(" "); + if (!aliases.containsKey(info[0])) { + aliases.put(info[0], new ArrayList()); + } + aliases.get(info[0]).add(info[1]); + if (info[1].equals(extStorage)) { + extDevice=info[0]; + } + result.add(info[1]); + } + reader.close(); + if (extDevice != null) { + result.removeAll(aliases.get(extDevice)); + for (String path : result) { + boolean isSd = path.toLowerCase().contains("sd"); + ListItem item = new ListItem(); + item.title = getString(isSd ? R.string.SdCard : R.string.ExternalStorage); + item.icon = R.drawable.ic_external_storage; + item.subtitle = getRootSubtitle(path); + item.file = new File(path); + items.add(item); + } + } + } catch (Exception e) { + FileLog.e("tmessages", e); + } + ListItem fs = new ListItem(); + fs.title = "/"; + fs.subtitle = getString(R.string.SystemRoot); + fs.icon = R.drawable.ic_directory; + fs.file = new File("/"); + items.add(fs); + listAdapter.notifyDataSetChanged(); + } + + private String getRootSubtitle(String path){ + StatFs stat = new StatFs(path); + long total = (long)stat.getBlockCount() * (long)stat.getBlockSize(); + long free = (long)stat.getAvailableBlocks() * (long)stat.getBlockSize(); + if (total == 0) { + return ""; + } + return getString(R.string.FreeOfTotal, Utilities.formatFileSize(free), Utilities.formatFileSize(total)); + } + + private class ListAdapter extends BaseAdapter { + private Context mContext; + + public ListAdapter(Context context) { + mContext = context; + } + + @Override + public int getCount() { + return items.size(); + } + + @Override + public Object getItem(int position) { + return items.get(position); + } + + @Override + public long getItemId(int position) { + return 0; + } + + public int getViewTypeCount(){ + return 2; + } + + public int getItemViewType(int pos){ + return items.get(pos).subtitle.length() > 0 ? 0 : 1; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + View v = convertView; + ListItem item = items.get(position); + if (v == null) { + v = View.inflate(mContext, R.layout.document_item, null); + if (item.subtitle.length() == 0) { + v.findViewById(R.id.docs_item_info).setVisibility(View.GONE); + } + } + TextView typeTextView = (TextView)v.findViewById(R.id.docs_item_type); + ((TextView)v.findViewById(R.id.docs_item_title)).setText(item.title); + + ((TextView)v.findViewById(R.id.docs_item_info)).setText(item.subtitle); + BackupImageView imageView = (BackupImageView)v.findViewById(R.id.docs_item_thumb); + if (item.thumb != null) { + imageView.setImageBitmap(null); + typeTextView.setText(item.ext.toUpperCase().substring(0, Math.min(item.ext.length(), 4))); + imageView.setImage(item.thumb, "55_42", 0); + imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); + imageView.setVisibility(View.VISIBLE); + typeTextView.setVisibility(View.VISIBLE); + } else if (item.icon != 0) { + imageView.setImageResource(item.icon); + imageView.setScaleType(ImageView.ScaleType.CENTER); + imageView.setVisibility(View.VISIBLE); + typeTextView.setVisibility(View.GONE); + } else { + typeTextView.setText(item.ext.toUpperCase().substring(0, Math.min(item.ext.length(), 4))); + imageView.setVisibility(View.GONE); + typeTextView.setVisibility(View.VISIBLE); + } + return v; + } + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/GalleryImageViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/GalleryImageViewer.java index 6356db688..cc30936b3 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/GalleryImageViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/GalleryImageViewer.java @@ -924,9 +924,9 @@ public class GalleryImageViewer extends AbstractGalleryActivity implements Notif } if (loadFile) { if (!FileLoader.Instance.isLoadingFile(fileName)) { - FileLoader.Instance.loadFile(message.messageOwner.media.video, null); + FileLoader.Instance.loadFile(message.messageOwner.media.video, null, null); } else { - FileLoader.Instance.cancelLoadFile(message.messageOwner.media.video, null); + FileLoader.Instance.cancelLoadFile(message.messageOwner.media.video, null, null); } checkCurrentFile(); processViews(playButton, message); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LoginActivityPhoneView.java b/TMessagesProj/src/main/java/org/telegram/ui/LoginActivityPhoneView.java index 47d948b2c..6cffca0e9 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LoginActivityPhoneView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LoginActivityPhoneView.java @@ -292,8 +292,6 @@ public class LoginActivityPhoneView extends SlideView implements AdapterView.OnI updatePhoneField(); } - - @Override public void onNothingSelected(AdapterView adapterView) { @@ -303,8 +301,8 @@ public class LoginActivityPhoneView extends SlideView implements AdapterView.OnI public void onNextPressed() { TLRPC.TL_auth_sendCode req = new TLRPC.TL_auth_sendCode(); String phone = PhoneFormat.stripExceptNumbers("" + codeField.getText() + phoneField.getText()); - req.api_hash = "5bce48dc7d331e62c955669eb7233217"; - req.api_id = 2458; + req.api_hash = ConnectionsManager.APP_HASH; + req.api_id = ConnectionsManager.APP_ID; req.sms_type = 0; req.phone_number = phone; req.lang_code = Locale.getDefault().getCountry(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/MediaActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/MediaActivity.java index a2bb05447..44debb60f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/MediaActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/MediaActivity.java @@ -382,7 +382,7 @@ public class MediaActivity extends BaseFragment implements NotificationCenter.No BackupImageView imageView = (BackupImageView)view.findViewById(R.id.media_photo_image); - if (message.messageOwner.media.photo != null && !message.messageOwner.media.photo.sizes.isEmpty()) { + if (message.messageOwner.media != null && message.messageOwner.media.photo != null && !message.messageOwner.media.photo.sizes.isEmpty()) { ArrayList sizes = message.messageOwner.media.photo.sizes; boolean set = false; // for (TLRPC.PhotoSize size : sizes) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java index 0f5b2845c..de8a6c29e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java @@ -102,7 +102,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter blockedRow = rowCount++; backgroundRow = rowCount++; supportSectionRow = rowCount++; - if (FileLog.DEBUG_VERSION) { + if (ConnectionsManager.DEBUG_VERSION) { sendLogsRow = rowCount++; } askQuestionRow = rowCount++; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/SettingsWallpapersActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/SettingsWallpapersActivity.java index d789666ff..d719b5739 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/SettingsWallpapersActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/SettingsWallpapersActivity.java @@ -248,11 +248,11 @@ public class SettingsWallpapersActivity extends BaseFragment implements Notifica progressBar.setVisibility(View.VISIBLE); loadingSize = size; selectedColor = 0; - FileLoader.Instance.loadFile(null, size); + FileLoader.Instance.loadFile(null, size, null); backgroundImage.setBackgroundColor(0); } else { if (loadingFile != null) { - FileLoader.Instance.cancelLoadFile(null, loadingSize); + FileLoader.Instance.cancelLoadFile(null, loadingSize, null); } loadingFileObject = null; loadingFile = null; @@ -265,7 +265,7 @@ public class SettingsWallpapersActivity extends BaseFragment implements Notifica } } else { if (loadingFile != null) { - FileLoader.Instance.cancelLoadFile(null, loadingSize); + FileLoader.Instance.cancelLoadFile(null, loadingSize, null); } if (selectedBackground == 1000001) { backgroundImage.setImageResource(R.drawable.background_hd); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Views/FrameLayoutFixed.java b/TMessagesProj/src/main/java/org/telegram/ui/Views/FrameLayoutFixed.java index fc676acff..73bcd9dcd 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Views/FrameLayoutFixed.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Views/FrameLayoutFixed.java @@ -150,6 +150,7 @@ public class FrameLayoutFixed extends FrameLayout { } } catch (Exception e) { FileLog.e("tmessages", e); + super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Views/NiceSupportMapFragment.java b/TMessagesProj/src/main/java/org/telegram/ui/Views/NiceSupportMapFragment.java deleted file mode 100644 index 59a0608a6..000000000 --- a/TMessagesProj/src/main/java/org/telegram/ui/Views/NiceSupportMapFragment.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * This is the source code of Telegram for Android v. 1.3.2. - * It is licensed under GNU GPL v. 2 or later. - * You should have received a copy of the license in this archive (see LICENSE). - * - * Copyright Nikolai Kudashov, 2013. - */ - -package org.telegram.ui.Views; - -import android.annotation.SuppressLint; -import android.graphics.PixelFormat; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.MotionEvent; -import android.view.SurfaceHolder; -import android.view.SurfaceView; -import android.view.TextureView; -import android.view.View; -import android.view.View.OnTouchListener; -import android.view.ViewGroup; - -import com.google.android.gms.maps.SupportMapFragment; - -public class NiceSupportMapFragment extends SupportMapFragment { - - private View drawingView; - private boolean hasTextureViewSupport = false; - private boolean preventParentScrolling = true; - - private boolean textureViewSupport() { - boolean exist = true; - try { - Class.forName("android.view.TextureView"); - } catch (ClassNotFoundException e) { - exist = false; - } - return exist; - } - - private View searchAndFindDrawingView(ViewGroup group) { - int childCount = group.getChildCount(); - for (int i = 0; i < childCount; i++) { - View child = group.getChildAt(i); - if (child instanceof ViewGroup) { - View view = searchAndFindDrawingView((ViewGroup) child); - - if (view != null) { - return view; - } - } - - if (child instanceof SurfaceView) { - return (View) child; - } - - if (hasTextureViewSupport) { // if we have support for texture view - if (child instanceof TextureView) { - return (View) child; - } - } - } - return null; - } - - @SuppressLint("NewApi") - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - - ViewGroup view = (ViewGroup) super.onCreateView(inflater, container, - savedInstanceState); - view.setBackgroundColor(0x00000000); // Set Root View to be transparent - // to prevent black screen on - // load - - hasTextureViewSupport = textureViewSupport(); // Find out if we support - // texture view on this - // device - drawingView = searchAndFindDrawingView(view); // Find the view the map - // is using for Open GL - - if (drawingView == null) - return view; // If we didn't get anything then abort - - drawingView.setBackgroundColor(0x00000000); // Stop black artifact from - // being left behind on - // scroll - - // Create On Touch Listener for MapView Parent Scrolling Fix - Many thanks to Gemerson Ribas (gmribas) for help with this fix. - OnTouchListener touchListener = new OnTouchListener() { - public boolean onTouch(View view, MotionEvent event) { - - int action = event.getAction(); - - switch (action) { - - case MotionEvent.ACTION_DOWN: - // Disallow Parent to intercept touch events. - view.getParent().requestDisallowInterceptTouchEvent(preventParentScrolling); - break; - - case MotionEvent.ACTION_UP: - // Allow Parent to intercept touch events. - view.getParent().requestDisallowInterceptTouchEvent(!preventParentScrolling); - break; - - } - - // Handle View touch events. - view.onTouchEvent(event); - return false; - } - }; - - // texture view - if (hasTextureViewSupport) { // If we support texture view and the - // drawing view is a TextureView then - // tweak it and return the fragment view - - if (drawingView instanceof TextureView) { - - TextureView textureView = (TextureView) drawingView; - - // Stop Containing Views from moving when a user is interacting - // with Map View Directly - textureView.setOnTouchListener(touchListener); - - return view; - } - - } - - // Otherwise continue onto legacy surface view hack - final SurfaceView surfaceView = (SurfaceView) drawingView; - - // Fix for reducing black view flash issues - SurfaceHolder holder = surfaceView.getHolder(); - holder.setFormat(PixelFormat.RGB_888); - - // Stop Containing Views from moving when a user is interacting with - // Map View Directly - surfaceView.setOnTouchListener(touchListener); - - return view; - } - - public boolean getPreventParentScrolling() { - return preventParentScrolling; - } - - public void setPreventParentScrolling(boolean value) { - preventParentScrolling = value; - } - -} \ No newline at end of file diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Views/TightTextView.java b/TMessagesProj/src/main/java/org/telegram/ui/Views/TightTextView.java index 59d45b81b..f4ed8c2df 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Views/TightTextView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Views/TightTextView.java @@ -87,6 +87,8 @@ public class TightTextView extends TextView { if (w < getMeasuredWidth()) { super.onMeasure(MeasureSpec.makeMeasureSpec(w, MeasureSpec.AT_MOST), heightMeasureSpec); } + } else { + super.onMeasure(MeasureSpec.makeMeasureSpec(Math.min(maxWidth, linesMaxWidth), MeasureSpec.AT_MOST), heightMeasureSpec); } } } @@ -99,6 +101,7 @@ public class TightTextView extends TextView { public void setMaxWidth(int maxpixels) { super.setMaxWidth(maxpixels); hasMaxWidth = true; + maxWidth = maxpixels; } @Override diff --git a/TMessagesProj/src/main/res/drawable-hdpi/doc_blue.png b/TMessagesProj/src/main/res/drawable-hdpi/doc_blue.png new file mode 100755 index 0000000000000000000000000000000000000000..c9cd69113e1a8a0fd835dae48986984a582163c7 GIT binary patch literal 869 zcmV-r1DgDaP)f9 zKBw^3w>UR|8#pHjJpt(nLQjD6mN%n3SL*fz@eS%5IJ41gH60Hu3kx_BD~*C<4Bx*q zJ2MN5)9Dnv=kXzU=VKNy3+OpM_PxN<^RKq2F2Ocn*I*HTHlqUj3AX!o_2qbp9?;+~ zU=Mh_WZy^l-3v^}=F$Y@U?qb-;;dJAOubZsi2PCnXpk)nl^E<3{*57I%yC7|+k%K} zY5@s@zZF2=28gJ@Vm!x;I}i~~B_P3=rttT+AAtyc&UY$e3IQCxXai3~WW-C6%?rK- zL;`%;;W|Ia@%2~&Ld-UG@Y*wbFx@@=2FrwWYP_%`*(n@DK!|V#Xvg3m&?0iaj_*B$ z$g<{|ig-oS!^gz^8H3l^XaTk+=OhhY7*0S7_=Kgwlw>2t z(q&lVoj|G^y#)|>bCZJr&+9c&QGAEVLB+o_g-lw+BiF z9}|GEMIGRwSI`z3CMY49=YT2Ij{vwhO@$Kt-Vt8W{s&uW9(sNjF~U=~>rPVDq|&MZ z{y*=T*@x?&dCxZctpy11X#>2%HDQG}>jvR@SfxJGXvE+PvY^X`R7&>+;<^#wRh!Up z6=1Rqhu1e=S>UPn__|q1wZvs#ylDGmP6Ly8l|o`I#H`pghVdV_(B*0P!Vj-9F z?PN-dnN$eZuJB#!K;8mAae#j-gk9jf)PcMqp6hmGDQhE2A(g7Zn>m1A@mUpaEVU5@ zTN9Blcvlb5{^V9DGPdpHSs@g>H>iMrGlx$PT(*;Eh0q7QtAJHaf4;PACo=)Q@U;=| zl7;@T&qtEmm9UY&8wy^JE>EYw3ja${SmC&-8Px-dJZzHou=kFen$ZP3vPC)c!!7Ru z=nQYb3nkVDI<}TaX+wT v87CmK9t$D|8;ki({VZS>FbkM;yb3S?)Rs&>d;T<+00000NkvXXu0mjfJv@d> literal 0 HcmV?d00001 diff --git a/TMessagesProj/src/main/res/drawable-hdpi/doc_green.png b/TMessagesProj/src/main/res/drawable-hdpi/doc_green.png new file mode 100755 index 0000000000000000000000000000000000000000..890cc33fb806db1446902d62e2b14edc7b46d5a9 GIT binary patch literal 875 zcmV-x1C;!UP)p7ZBJc-ZNRR<6n?g&1p5KD`||1g@e(~?z+b?g z@Oa6-SNPovOvvWa1Y}?ZgFfP{mv~IQRDg)=QUn-~Een+h>^=UCAY|-uNzU7Xh;(WJ zF@wJoKwk%lD8V8;$Bugtp{5cLV@y-{ho&Ea2y@O?Dq;!&96oOYPei1|ORC8Wz6B@& zKIw3sM{;~UmVgkmO%=TH%pS~ikH5fDA)Q(;>_~PB#}E)AoCVr3_$M?)&NuPBhY(p- zTvHRT4l01dYXLs4`EAzc=Dh^q>~Z*rxIbm^CL1ll*5sVH#tXvUPsf>WWla*1-Sg zJv;kw{WI@1&3fuW?N@!rOI&@I0&%pJ`Mv_?#^0q9&EneSx@c1bE#hbX*14 zEW_c=jaLou)O&p0tfX4vvM*k=eKKc&NxVuSu@-VR54{`glccb6hIbOsPzNF*m-Fpp zLW-GG2-mLgUF$&B0zP(te=USv;Jeg;tR|kTc4P@_BMKpv>cN{ifM4-h6>coG5jk5E z$``z=2WWqCClr~c?c`Y@6udX6fPXWGPY+zSlV^p{2fV9*RYiZkY}ihw0(|akBiycu1dPJa~sm!PoRaZ@v@2Q+!uB<*1z95*$i3wUOWa_EO!-b2XD z;4LoJ4S1ozu%P|Vmc{&_@J=4UQcq#*ON%|)A8a$KvQaQ~2-!z|32T{EaQ@0D9|OKq z8pZvn{((zY-0RYvAN%z8RZ3_SZ002ovPDHLkV1kq& Bh*1Cl literal 0 HcmV?d00001 diff --git a/TMessagesProj/src/main/res/drawable-hdpi/ic_ab_doc.png b/TMessagesProj/src/main/res/drawable-hdpi/ic_ab_doc.png new file mode 100644 index 0000000000000000000000000000000000000000..30ff62d1950c420fb60b7b32b2918365668d417a GIT binary patch literal 883 zcmV-(1C0EMP)GXazUUqr0)LOy@$Y7@g|SUcdsGM`aMaQq5E&w>>yqxmyNr>qML zz)K!UIII}_15QPrU&40`XkBj5#Hy_dz~Qw3pF6(0>a7++?Q!@Waf>B`hiLT0%q@8) zcUYl40X*Py6u^#xL?ev}jaovo&WI+xWC9R)`;wCY&+|aZmig#dUlGNek_sTe1N7bj zFXe%Zxt3=4X#%TKTVT!LcdRgL$^+c>N?Jl21?432oSG`rNuc&=D3stI1K~BgmtB9( z6!0zCCPw(26czHeqyE(z(2y&D<;CjKh9#8!ye-1YV( zEb=vi;iEdT8u*lAZzTxfUQh+a0HR3T*NDIe=RZTl7H8siLV^1aSglhoy3*kbVnocdC$zhY!!yW>g zn$88N*rsgza4We0^bl%ptgyk{K*ypX8YLe=wGehp8+Q3fLg|!QZ0~Uv+FcaFc>^srl$?l#~?^9_NDAUz*NxQd(d<{8B#%FbFUR(ChdkzyJWDTAG*8{ObS!002ov JPDHLkV1l}dhhYE! literal 0 HcmV?d00001 diff --git a/TMessagesProj/src/main/res/drawable-hdpi/ic_directory.png b/TMessagesProj/src/main/res/drawable-hdpi/ic_directory.png new file mode 100644 index 0000000000000000000000000000000000000000..0d999eeabc082d9018d03d83d7f790ff5ca29d8d GIT binary patch literal 652 zcmeAS@N?(olHy`uVBq!ia0vp^AZ*XU1|*B!=F0;q$r9IylHmNblJdl&R0hYC{G?O` z&)mfH)S%SFl*+=BsWuD@OnRO!jv*Dd-pujzW_A>4tv<%9qQPb!Q*d5)fp~t^$4C4h z?stjvD@j~gAjf0G=6fI}M(DxAF^ zn9)&4#W9G*a{>^Fz}P}p-zN#2|9q_QX4BiNuRlHJwP@gf_$;5fp!C<%EZ27jgl!#i z_MhR|bMk^&+LeP6kriFlOPXbw?zR2qFxq$Q0dG^u;!=yh`kTv`^vm@ZZp;mx(C#1M zeyskU4tLSPz!T@(PReC|Ut+w2;ks3+;EOJfPwZA~d%V}3s91Fm3l8PIAy=h2%X6EiC52E_u(d^j&0o8UW}41 zlV`TKPifrKVcjs_AtKw`X#R)EA`?Q_9OF7v#qgc`l*2P;cKhugWY-^aRsPJq^?gWz zVMq3aTbs7}P6#zr5R^R6@jCI&IW6W&t+(zWYFd?B=6+#W$5zA{6uqsk(9hwUi4vW_cUAUbb2(#Quq6oi;;8bj0t{*Nv|mZT~el>{;WBh&Ol~ e9;@LrVCar$Jty#l{~<7WF?hQAxvXJdru1|5`;Ea*@^{o!KRb7K!@27EwnwFWOb$#!6F4R` zu&5{qDll?-d|9nl#`rwuBEy=0*$NYL-k#dF&18!Dr_k+}`G5SKzGp&wdCfnS{(pP^ zO_~36`z@hL@q}F+QoBs^zOC7~`v-qfwDbw@#a8d0zFzzN_(P@K)#~=AnqwSx-3azx z{>>!uZ+4|#zQxwZC4!S~s!x>cne@r4PO!WD*!&Ki7Q33$GMS6TCX}7@v6}FF#Z9^U zhHu}h7%h%IBJ=hAWR^~qiC;W~Jo{B9s(k9Oy=1aiWs=J!Wlxo26^P798BZlo65oG&#glf4y}b{}Q~d7McF j~)xpR>BkO7ZdVv~fjupx)DA;;$@2jmo`6$HDF zy#21XH}vG>w_EC$PP_M;^>d7-!XytRN0o^#LYzvSDnc$oJC(Pem_0S<-Q%FiZ~oq` zu74Xf(KJvnbZxHNtcmu9X%{}9_NiUr@n^kKe@LO0(aICkGTtxD)?ICXyzkq5+Y4K^ zU1OW*GVi5jk?Swx!U)g$vY6G^)IPbqzjaCeP3Xi+@;c%-h2Gkhti2=;G!bZLv8}sT z{i6y08csakpY2`0A>7rgenU)(_m=M$wuQo+=X+jHdK6Ff+V+XtHX{ T0pocR^HFNx3lxSPE}QA z%64WZZs%h*ZQnlT=sZCB;^ykIXj|(Hl?dbsx^-jt0Nf(b{!bEtJSF)vummoE5SRfu z=H1Z}k$eSY$TU<_8RjJO9C(nE3_bw}Voi?k09XN%xuG-}5Db<`h?rSTE}3qCl(NjY z^o8ra-T_E1M3P}dnS>ys_O2!CvR43+L6Q4FqGWpHxZwp$yA$%JldLwS8*T#&-*;Vrk1gfP3LN}SIg8OcX~s+pNf9j= zNZ)~BrZst?PhzX$Q-$`6TryJ*3R%gW)MR@ zT$z!d$&im;caJj+0VHGjboW-CTI=<-2=ENUs`2^&-6PQcB8vcD6TXG!&@~i8Q>eha zKiDF|7f_B&V>OjyPBJf`XW2>b9RQGOIDSXa0+P%Pt;wONw?zVCW)?1)ZlE=7nR4kT z*9V;g5H29eFriHXNa(%q$hztjKx|O(5XzKI?|g4~!16o@yje-kGG#RsEWeNzt&~jy z{pRvH`=M|Y!0`?g+^`}d2i(qw+`-1$*riNo>f^xL)PVau1EYe)SW}&?A}o?7x?v!F z28Nkhc&T^d>f*LW`vaHER0YNCbMSp| z;J8=imnnFD$$cQzuoOF(M~8V3w7#sTd0HJxys#%$0IRJkqv5C+S@RN@UB8Bs2O1 mycm1?h5!E2pIzWbfB^txw#xR?8shx`0000e-hd{3 zZse_R)e}^1ASY-&0p0*Sf%dI$+CDcaH;^N613Q!aYo?P$R#;=2lw_m)z<&SE&d$Q% za5x0lJchxQkEh9q@2V1Xw}D+MU?S_cr~9G&j~A8A9l zm!mOOU4)%0A>dogF^_TzZEZ#_;Gu@WC_h`BZNLJLaml6y!qiS^CSg}yB9IIBR=CM{ zGMgjxwaIp&Ragz~2Jr9%9Zmtt0Ix0Znb0exP1VwLihu-_7KnjoO6Pm$&;p}%Sp^*O zQ3JdbrFJeVVktJKqtHrymZjf$3 zxiw~GSS(9f?EOVo?F{=3_HRnZE!xIFLC03HXX3NWutOL0Tmq zSpm+blU@-3e1|#C3ABKAfX?jz%|wCC>>HBQ-GBw2D6J5n)N36;h%A> z&{rngg;ruUxEsL36LdHQCH}{xU|Y8dw&0|x9Q%AJHRY6FtzNOUaz$I5 zDA8vhZL8oLkQ^_U6~ex;mE%hokO>w57>WPA;H}FLMJE>1Vc@wBxR>vO|8K)TZ{SCO Z0RWjzL;VXUz108!002ovPDHLkV1gZn`$hl& literal 0 HcmV?d00001 diff --git a/TMessagesProj/src/main/res/drawable-mdpi/ic_ab_doc.png b/TMessagesProj/src/main/res/drawable-mdpi/ic_ab_doc.png new file mode 100644 index 0000000000000000000000000000000000000000..da7ea4e34d0a493a5aef7f196e372fd75c331207 GIT binary patch literal 604 zcmV-i0;BzjP)VAI*EQjK z+>yIn*RM@}FKOPFY*g2EG-Me^1DC-AI1AB9nx-*brc^J5{6_V~7*n;i9r>;Sf-^X$ z8Y_=?RM!+l`6~ecUf}kXDueb^&oLtzo~@dK=pBFqR{_pD_uA(e_k?H1;9Q_@aC;qO z5fVHV@F#{~5vJchgrlbW4oK!S_{ zvGCl{`P~_`$ZCDEfTuiZfE!`8GvSCvY))UA*KUZ>*bW~Y_<=UK literal 0 HcmV?d00001 diff --git a/TMessagesProj/src/main/res/drawable-mdpi/ic_directory.png b/TMessagesProj/src/main/res/drawable-mdpi/ic_directory.png new file mode 100644 index 0000000000000000000000000000000000000000..d3359460dea73b1439c5aaca9f7ac105da190f72 GIT binary patch literal 501 zcmVK@i8?6b~W@LR5!3 zsGXJWo%>Jv_af*I=+r492_(?ei0CI3@`}pz`5oFIBE;R89o%N%%kE*{+xOX>ncaCN zP18)QwvdU~6i(q3PT>^p-^1lx1{-5G&@^UvZUpt9eP}#wAm=5*b>|v0E=U%tLG^iZ z%beqQ+UZiPF-JSNDFtU-d>%2kE%1#u_{QB>v*l8dZ25}~pabX%8v49|Gh6-zj$rnn zB#LwHhn-^86U5;n`dd)JE9i~!d5q4{9nAm06?5%xXI~-krcf4s<4P!xShahsdLI2X z0gp>C|1%d{$F>!_ilOb0^C&p8ZA~aw^ts@!;SvM5WD)%p0kB)l|IP*X<&srOb^>rm zTsIUdU%IxxF65GzTyPg~iC4H}8U3;VSP%1$xZpa%iKNMSaXvSnR|*L@3W+;5IJm?I znq{ac0M|+#Z`nTCQYw+OSnD}>WY*qFLK~fHPu#`oDwG$1JNBvjT;X19xe?N+tT|!- rhca)bzta^?;S^5c6fS1Ci2wrtj}U6`)sg-u00000NkvXXu0mjfJ2v8P literal 0 HcmV?d00001 diff --git a/TMessagesProj/src/main/res/drawable-mdpi/ic_external_storage.png b/TMessagesProj/src/main/res/drawable-mdpi/ic_external_storage.png new file mode 100644 index 0000000000000000000000000000000000000000..d6614588881ec63ce2cb7b4fb7a528716818062b GIT binary patch literal 330 zcmV-Q0k!^#P)`6pHRCwC#nGFhqFbsv;%|q-IZtF&m z&{F7-p`F*mB4P_ni(00000 literal 0 HcmV?d00001 diff --git a/TMessagesProj/src/main/res/drawable-mdpi/ic_storage.png b/TMessagesProj/src/main/res/drawable-mdpi/ic_storage.png new file mode 100644 index 0000000000000000000000000000000000000000..7bc0ddab531ddbbebadee9308f4ae58bc50c33c4 GIT binary patch literal 253 zcmeAS@N?(olHy`uVBq!ia0vp^=0L2)!3HG7Cm&`8Qj#UE5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS>JispN|IEGZ*dNbXTt3g4)b#8|3^VckLtAtDTykatwR$SyN z*^`uS<|OdrPwhNUFU>Dj&Mzt&nE5OoH2k)`6Y*(MhtIYZkL}8L=jgAmM+B|qZpEAydRe%f!+3@O&;sJ(=B_{nG%i0$Koyy?p>gTe~DWM4ff8k=~ literal 0 HcmV?d00001 diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/doc_blue.png b/TMessagesProj/src/main/res/drawable-xhdpi/doc_blue.png new file mode 100755 index 0000000000000000000000000000000000000000..f8cfa704a131c288ed2d75b58bba6bd137c9376c GIT binary patch literal 1759 zcmV<51|a!~P)hD*h0Sp9o43qo|RHh`|pv(Eu8M0Te_lt-pXsV}l~J zr~!XX!2l&yTWLKnoQc=#%u z`{RI%i2H#G;BH{^k+1}20aYH(J6RU65fNAlMC?aWv`R3_C6EL>2TXVPZX@tHunRCZ z*&7%NT;lNHRsuy>4ow|x2`qMS{#Bq9sB!r>rvmo^C4z`T;4ffGM_K~&>4a?ufYHEY z59f{T25tqifjTi>glL@JQ3x<={sHBDF7RF(&hZH_45$}lPk@AzgHFIS;7RfM58$c@ zvw1C0z#L($2QWLx1dIokiqFl!HNa<)o)C#|gF0t1q984Z1Y8a*7uRgzdSB~PJ~_nW z6d*rn1Y8Kb3v?A@B`jasx&woN^MKSaqrfD_4;9&gA>dr#eLfl6?o(lF>=d93*h5kD zHLw?W2{#P^YgM&iAS-?8rc$ukz#~n!8!a9D87&pf^0-Jy{LR_m_9G@8k0(x_O z%d+$$MU1q*KzWF#+y{6ogm9}@#Ko0>o^)P5i8rYFr1s7LJ_34)u@8VeU<^Ay+Xe#H zg^<;OXok9T&1Wj7CW%aKES=70C>d-t!5UySa0SEPws9dM&bEel5s=Jme}NeLf;TQ3 zl{7|3Uoo}{n5sx>ViL6N9FJ=cQUWRF1a#p>MXngz3XB38#aJpyl9{@Kn;?HXoVQsV zclEe_o;cnVYXZ#rdqIWhPT(?Nzv@0$u$Q-O3-d8X+Wm0Q6mBg43@D#(> zwx20R>J&+3Om4PqH#$aAM)p@XweKfQ!$-pLr_#nzi_inmU&~yd)`?BskePE-9G@ zu4m^cZ5XwMZFQ>CY(E0v{0;cCNM-D?+{%)62QWwV{w6|pxSTqNJ%VhSihxQrZy-Zm zik_SB^c&ip063q=^_(PbvXF{Snz`|Xs`nqm#20SUG=qs#OKj8p94p4=!1>i}&faa^ z6ovD{S;J*>Qw+SKrkZv6wjkN={oQVI0Lx)7m0#woc^TY4=p)9K!1-HZr34o#=Vv-N zZ^HO>b^fUy&YwoLD4l=W!TEHSIO+Uym0#MOfbk-8m#Ppqc0QkcH!)^z@HLn7*^*dF zS+l%msd+{{nmxmQsw@`c>9@p;09>q=+(kpQvn_-Z9Bc zHBBiTm+!&Mrf5MV?*c5P%p%!`t5*HD-LkG%VZ2b4NlQuMRm|qLeavKfNZq5U3fW?; zipjJwS`p)y5=>_WkYQ}{!d)IslgSa6im@*#iJO#qT&C1x4a?|$KW^L)0-VCwl(K0m zjHOdX(Tx^k+xWS`K|M}V5^h7KR2X|nV)O2Aq=Qp!RgZCrfM+R3 zWgDu)I1;DsbWxAn{ocKaMha&!Tif<6`v5m7>LiIrI<&Y`r~#yU%=b`_af<+10{1ad zxvkB~E|R!P%^RyazGg0`igwz&jJOvtC2xcZ?eATt=QERQrz%4>F-(a4M68^bljSJ=9|$2sl9; z|L8KOQB{M7)&7C8)7e?-Cg>3>Miwan2gR}5TbS>-pLc+@f3EueBnl|09+x>ZLG5ah z{zm9mm*t@CD|Ux9VW>ybLEh}59s?HvTgCAZ)t_tIp`1!(*vmIZrX8N(p&kQAK)Lnr z24xc0cQ}^JCp}cD$9xa<7(4>d4j)vzK&G@6h2i{4sy`V?qx@)VY}-kF|GO1Oi|Uu6P=tln|95PEV_mOhZNHd;NRn+{a%5R;c!}u|jqxLZB$Ti# z3^$r~u>-92;|WGffFBzoORU51^mm6b_f1xfS}P#t*Or+19njg_1zN}M&{zvK!1L4t z*ZR4e6Zaf&Bv|7A3?&Fi5Rf1sK|q3lPHg`OFaYsIpso~#rVRi9002ovPDHLkV1j=h BE=>Rc literal 0 HcmV?d00001 diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/doc_green.png b/TMessagesProj/src/main/res/drawable-xhdpi/doc_green.png new file mode 100755 index 0000000000000000000000000000000000000000..ff5df25e4179216ea078144f145e58ed74051df9 GIT binary patch literal 1758 zcmV<41|j*0P)hD*o^jKM|E8Mo}UG5rZFUq5(Ai0;q^qiobwLV}l~J zr~!XX!2l&yTWLKnoQc=#%AvfSrK3 z$=<+F;39_yw-PA9a%k>oOJK2s^Di4-fm)Y;b24xbP$q~d2L1x3bfhIPmrmHW9~ccx z_Hf?VF5qS$7pNEWC5Xo99fbh1Zthpk=L7Gw;~XCY!+-`c_XJ2dG3W$L1D+J0{{XIt zFq_u_Ma&V#dH}P6Ou%?xsrcLiTm^g@=?Rhe)~j=tA__8sNWf*la&gU8uJ`wR$|nao zP6G;qM!@;N+dx+_SH|+CtvfIXI0r}%GYU*%{6LW%7y`})-sO|A?OqkO#!dn%fZY^D zUjuu97l7l#xXwB;9vl<`&H&Z|$I46%Jnlf!X4dhe#Jm|_4{QQX3vsO)F+M#A1oYfSSFp%QZm?Rf;GTu;Btn)ZR0{joNbMXA|RF7{yZ`FId5Dx zDjAHBzG7|_FjbM%%p_>rSsvFOqy$pj3FyL&ihMD*1sDZ1iMe!=Br|mtH$nb(IB$y> zclEe_ff#R!Hvwk-J*Pr+2XHB{Pj#Ow*vs3tnfm}uF6S-^^<<&^vZ*zkN@83Hn9uOF z?PrRSdPPzNlbdbZfRTzMX?OE`+tzp}LEH9t92XM;9sp*F&%2qteo)6P1SX2lKQTfY zT+VCi|2*;e7vM#Qr$13i-^Eadf5wFXTzm%p%u(6bti^BCp|jb;OOo*=erwzaz{ToVz8=H)A@y~C-sFGQrgdoh+sQKcL}k>>K;v1$Q5(d zOr}lIiWt9?U?wYo3}cfQ?(k@uOpdr%%zZ&g+^p2&GNm4CSw{EyapQgv;1tHDluc7% zES)lnZnT)&%Fm4s>T!~i*m)l6F}?(#Bz9wF*I`_w!q`g^n|FUB9Gq&edQ3#JzwidBas`fA4a5Av3vlYD0)7s4awgOlSn;iLt50 zOI?o3Wh2uige10`pj0t;i-&qlI05~|_!AdFGMG-uzTs8}r?N>%4>32(Lp=t9faApY zN0(!oR5f^5?H?FBm7S$-f*!HrWRVhZK#bkq!hFa5y#1{Gv(@(}P(VrbxXhsmim65V z8=+ramV>sh*d5k}p&m^Kd83PZ3|s_k5#u4MKi9ThIhD?^mv4?tJ3PTdJqC_|O6%VZ z$`r2ea4eNidZ<#5g&yiLcm$vwKA?7iOld0#!}*m|e=?Fr`O(%ULJ7`MvbTcjFwLcG zR#NHNwuAcqcPoJw)h|V%2#c-%@7Vsvx?acHejx>sB-^~?$g$e-64N6Z6Gs3^C}UR` zZZz#=2UzFF6O5JsKQ=^`Scl%}?+WAC*I6~{tbmwbTVm#SKxc9nXf3-#W3AKx&r%Ou z?dNVz!gIjkV9Eb8lq4WYK$3tY0Z9TnvHc^!0Lts1h(HfbBme*a07*qoM6N<$f{oEP ABme*a literal 0 HcmV?d00001 diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/ic_ab_doc.png b/TMessagesProj/src/main/res/drawable-xhdpi/ic_ab_doc.png new file mode 100644 index 0000000000000000000000000000000000000000..aaa8b4178d6bf0c8ddc6ba1e961532f97680186f GIT binary patch literal 1690 zcmV;L24(q)P)xY?>gtM?fFjz3 zz@5Mhm(NE57c*{RB3=i6E99h!LWNL~B47b<7f_z(@95&+0=6O&GDDGo1aLoao#nG% zfnR_gc61yt6}W_dC+!Ph9Y{Dc)Rw?Pi}RlXDd339Z^i>R0&@islrv5PokJ-CXuaPo z_WOXfz@8j`KMi;kI9H5qL=@~83T1GC#rftuoG1GUcoygtWA|V}#>Sn1Idq|7{}k|I zz-*odIygs=jRbCqGXYlu4~TtATC0JdgB}nezYl*t5wxcy zaO}5%v%Fma)WwYeDql-go!`jiOB;nTW!6dTOfFGCrE;$rnjWVzNOJZm<;)u@Y{|y5 z7^)Z7MWyXCU^8&c=RDsF$0x^yfC<1dma&e#2fS+`X@x3j&h=f(%jbFE507(otMf*_ z1je!RvMlZ7*_SpEXtFr3#n0nD*V`LpVh1Y%MswK9nfQ{|eMXT)Ge1U!@`pk%Bzc>1 z!d2V}y2-?2(w9uvjbx4?Qu(ivVhvSoHv(*9sz2_*a4uG)t(V`da26P)Z4F7 z&Px&`!ESbi*xnyD0kr-WsSr)GzVEY;bg3Bo9cWi1NvrppSt!41)*6oe5H-tE9V+{_0SDDrZwKZnlA4(Wo6Y1UCG)^q%QB(6 zLl27mV=S}=zYH?-jp`y-@vSUr*8{hz-oJ&z-)6O(CuGyq$%#@L>4GPfmf3*W?;msm z;5=pA#p)tER6{~`4RD|8{o6V5<=Qm8Vi7+RSVPFRcMF`~ov$xt0i34{zC>Ll)$ecA zSL>K086h2(nUppD2^Lb0y$S5FNbDx19=F5!R9H%|QFV5&0lO?=yhO><^&Z*zd=^I1 zsrOCxmbX#raXI$}j!|@MDnz{GYpX@(PVt3GBNh0VTAQ1=t+km=5`SW{4?T=hk0i0H z#269U8T6SzAOdhQN8r4J?Jer#Do#uT)+UuEm%~-E^Rj88rS!6Dnku*(oFc~Prf5fy zX8{FwgE(oo>c5?qb-5*s-PUFWulY%0Y#--|vljK3RO+$KLp_Gx4UXZ&B*S=@C5)w} zryMa&>GyV}{S%x>>y#Y!Qjeh%;1YC)e29d%g_+UTW+XUu=^=2o)vQayfc zX@X)K0SCnP6xE+=J8bFfmYIQ1j_6L(8V~gtI|BBK#Ft=&my4BiVw|efW1EM1j2{7L zhfk`zKn<+m{G6vcKV3yqYcbl|D3oAI$==1R4l7*BW|JBC8f==S@NpBN74)7U6k$CJ z9ch2F(4oY4j>*2;n=}LO4^k3+&e8`2iN@#%U=rqXSD5Sb`5x{7)5VyDSr z1<%~X^wgl##FWaylc_cg3{3MpT^vIyZoQf7=pF4S(pnpuy?R|t=LNA_Y0vpJA_DIG z7XPImyF+VTOVaARO&cb0Wx28n26AWlo^M@gbB8nEXy^MncD{>eRrK%QF*bg$w&d0K z-^wTE$9)iE;9~^B0uCT-a0WwW873fnAOMC@3pdVb4i8NgemwckM0F{NPk#S&^G{4a z{DE!SuNUs`x{NbE^Ew*$o__yC^rvXxO#it)kNr;0XPoXYEP1?cK95CvREN~edk6RS zNzKf);A`nQvu)1fL$1#vyw@F8`t04Qel7B{{usNTYc~D zN##$Pw}joPu44ASyIP0$T}0gE{FRFKft9=_^F_BWow3vR_RGvl&v{?By<2wu|D4o^ zv)5Ih&psL%pS%6re#hC|8zMJx?)u|%!A~;Z1GnG5aBw}#juVDAzgG3_zR+UrYiPNu zoxgFx&C0Kbw0Bf(-8(U!jcNPcCvP`SdSIozam(!|3C%3!izLfuCSB5co2!r!zU!Ox z`UkJBrp*_WDSr z1<%~X^wgl##FWaylc_cg3{1M7E{-7;x8BUzm~|*X!tJr@m1PMmFS$!JN{U`wDZk)Z z@cKoy%l*R}H&6b-;TNn13Dz{m|V#mrY)q6#%gR^`Vu)JWndyJ+x|H7Ec^(!u$8*+O@p-BW zJcoDxtob*|y(V?_rLar?gcfLToa?+td8?VW?HmukxTnj#R(^_MFAB{|Q<~Bx-RpMc zZP|U>^WGkF1kM!R^SQS9<{7V9g6WdF?Tm01OKGxccD4)BNx!`6_-K}3+IxW~gTe~DWM4fd4eZ= literal 0 HcmV?d00001 diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/ic_storage.png b/TMessagesProj/src/main/res/drawable-xhdpi/ic_storage.png new file mode 100644 index 0000000000000000000000000000000000000000..6aba104d940c5b67005520a2064563a771131d0a GIT binary patch literal 414 zcmeAS@N?(olHy`uVBq!ia0vp^c|aV(!3HFgcQF|NDajJoh?3y^w370~qErUQl>DSr z1<%~X^wgl##FWaylc_cg42%w*E{-7;x8B^|&3ni|#O376VtxC zVLFWYJE}bo^vW5Z<8?gnG^Lj%=BOb1+D*@Xy8jL?Jo0u|KZ}JwXT{=6Di78wFtUSP z+wRD;?IWFEG&sN6_bcN)Fu)l+UHx3v IIVCg!0Kj;!Jpcdz literal 0 HcmV?d00001 diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/doc_blue.png b/TMessagesProj/src/main/res/drawable-xxhdpi/doc_blue.png new file mode 100755 index 0000000000000000000000000000000000000000..f9e72f34dc6cd45a9b285ff3c77fdd6f7233da17 GIT binary patch literal 1602 zcmV-I2EF--P)m3P z8|SZowI`@NLE;JGOrUfEs}sci>tB?72Z%SQN6-f838etTJ(4Hgoph2(;D8{AtmHkC zN4}$!5AW~qN^Cg$AOr{jLV%bMAOwgB0YZS75FiAIof!eYUtUAsVxd>6*OgugeBIaq z)?Tk?y-K~RHXr`=%V(!w?&CxqYo^y7fS)iwSFgEVxA46}uOC24aJ!fo@HN<5z5eKx zG2mlXU-zchBakBmv`94#@V-9p?I<#Y0K#(c*d#zi>k8*yubl;O_2+zt4cTNV+;1rxMY0dD zNv@DcNPLy2VRR?Db)E`r4tJL;|<*u1=%?eP=o)3cv}S?S_S?c zN+cECOq~D@{A<;dXa@bnsm*@ByrxqnAR(%azQJ#z;DGE+lOrGj&rgZ!WY1jRG)+&i zat}HCr{Q~7Q?>uz0>0}7dO-!a}eP`_$HI<=j-aD3($s`D{0H4x#T%yL< z(K>j4H97*IeRl!BYt$$t4cVrZIdaeO5CGsm5u2t9_%^DjOXFlpRnMa#;0XMr1Nf=p zPr|BzUOYp3lyVdVXz&x&UD@;{Nhe6zd9b+FbY1oJ%jftBV8B<7;M<-7H@|}^1^u${ z{>*YeiHm?E@Vh9RE>UADTT{gQIUu(!Dyn!0umr#80KRGoKGm>sRnrF9HwxuGeGxnY zateH%KRNKbo(I^1|G;>EMo1O+J^;E1=>6m$PJpi*qUO|YnQnQ_fKR2KL$m}i;1?SF zHRG{9z|V-XwPd@M*p>|VSfhAQF%Rd0zJuk=(h+>y zgOj;Kx7_;(%!Oz0yL#QNC-7YcxMpgA5g4BlK*|K#`>O!C+L!kx3V*^T=m?BY0@iK8 zcZ?ce-piG|YZY+*$QuDrR<2I|@D%~RORo0iy)KPne4FqQ2^Dz$9s%Fiu&t~2ZifUv zNEr$wTr%MMQZ`+@ml}b2=mY%PdVN)a2EWeLZ=NT zjW6({)`AS+_aUy?=sQ@WxKjg6$;EOWV0*CP(y(zQ?;sZ_YFe84dSu3;Lnu1xP~3(FJl2e2mv59n7n^QNYbYOh7{LI6_JIA08`bo zx11nz71st;He(^cG{E}P1Nb)j&Zxi-ML>!)N}T16;8PuPl;DRV;J@6BNz*5_J_g`} z>Pgw0suW>kn3PZ`T3ovwGx#wPU`iDnfSK}hm_L02pfk3yCfAqBOY$m|KVw{Mic!~AG1 z*kG2$G(@vsJRf;+P0E$x|Mf^T;+pGVR?x{fW)iNeMWt*;JsAh7$miK>w6b!vQUoZW z)a&4Ftf})S1%B`pWJpPw`ZpRlYXN)#RaKNtR@8d{LBs;&iMfG{<~?uE%KpD!2mxY3 zfDj-i1PB3QLVyq;CIkopVnTorASMJvZ+`_C0K@cz1GN7ang9R*07*qoM6N<$f~1G! AZ2$lO literal 0 HcmV?d00001 diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/doc_green.png b/TMessagesProj/src/main/res/drawable-xxhdpi/doc_green.png new file mode 100755 index 0000000000000000000000000000000000000000..e7d32c22e0b923cae886eb8fddf61b0a12783393 GIT binary patch literal 1612 zcmV-S2DABzP)Qz6Lf*1#t)G64XJC!i@mK%bB4>QljV?fItw$mh;|x zK2q|hkB<)}HlBSF0)zk|Kuib_0>p#>AwWzB5CX)mjDT;yzJ$KSQm8&EG7#7U|Rp;J|M>oF}~w7Qi*{^EVV^ljU%|m82jZ{08i`UboQI*m&(8JbVSj zVRfMt0{$}o0_FpQ-x^jE?tMhTR0znS&&N8QP~e{zbW;=**FZo6{wv~bHF#(p_%l>U zD!Nad01o_x8b~yQdE(M$-+q0`QzalHx{aa1Z=>LZ)TZPJ$iVY+qB}V>@8^Krb?B(#A;1#+eGl+eNARhEjq94WNZr^g_tO`_BcPN!PA00aJBgTG-s z)(7|n(Y991v`h_(m7EgZA5t!#8z;A5OM-^!Bn_T_wsn}6%s}1-*x-REO6%4%}@G=1SocC^h zfgiONWB`8%am_~G!3M>H8sU^&Ec*er8yhYI8`tuVazt^62#7&kGji_>@nfGUa} zwq+#gE&y`kS{WnwK?%^{FBPqdZY|%+Wnhcp{<7f-fV^K4;140L`P$5%WCRq-eEQ(f z5quYMEtZ@6Mj_xH@mO2%XUbh%!#49*v49_h0FW9?-oGX!=}Q1ZiffgM$U;Pbsp~mf zo*;7-*G5$~VM^z_XHB9D!tNd^JCcwqf1CN&Lx7Hglfs`!)sXPQ)P%;{x60pUezX?y zflW`)e&$Fk*`%Zc6z$fF8&d8R|J5VWifdgh=*c+dBwSyM3jC-~#z89bx%Zlk=MN@D zfD%eQ4&KJvK0hh&2O*$sP4!xU2cJ3u-xTxP6bkO(HGrrMOOPk#>i7NQ_Bn5F%KqCg zCR+pKs|>F(0>p#>AwWzB5CX)603kpK5CVh%AwWzBxK{g5fB^txs(Gq%6N=aX0000< KMNUMnLSTa1+5XJ{ literal 0 HcmV?d00001 diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/ic_ab_doc.png b/TMessagesProj/src/main/res/drawable-xxhdpi/ic_ab_doc.png new file mode 100644 index 0000000000000000000000000000000000000000..7a199265936614800ef381d3130430257cfcb997 GIT binary patch literal 1620 zcmV-a2CMmrP)w`Re22gOT-T*8~9(Km?Ex0Ym^95kLfx5dlO1S+{o6_XjA; zGW8|q;xc?p`6%FLX-7W(@X_$`4x@EBdDAq*CLobb_*eq?h2j6inDMcI-|hMM38aia z0wS9Ld&Nf;aE=PbfsYr65+cAd)vOI3?|MFwwqE&oBLZ++ourTy5%rmm4H2NWwPnhw zVUiX0myb{I^AslL!jP84|2(-)(qkvU1ir}MJILoI;KX^pz=W(U*x-6UV&1@2-wQGU zWhe%|0DB7+jZf~sgX&0SZ*cC5E<+ax_zifeZ}oD3RCTY3h6VinaH*Ye1rwtV{HF+| zV+-fmBhgn}A^{cLJO+NuNpb^|x2ih2y)*)59fL3JSrbvWF`{571eB1Ib(Kyk@MSvM zXriFH1Of#3j~Z`lVZv<_e}-CC3){$rilEk@9%0M|cX95bO+UOd583jkp z+%&pApa9P=k?N!|96vpg8RSI$+p{^7CXQX6{cg$v#JZb-f{!&pOHG9$J$1$W70!26 z8X8*!tPSAr5#sJGQo^aixpkbtYt1}0nmJ$%T8zqe2Jjyp^D)*@cV^d_fnOoHcZVE% z@9Bx+dammT^%x0Q8NlBdh?^lzl&s-(spe~+H=e^BfO(+}_!x1gIlj=OIN8zKR!8M% zB7pZWCUI>W7&Wb;YgU!7Q^zW8_ykyhkLf!hQL_suB}+}38x{f3zK4MC8#PSRL)fO3 zndX|qAppRCL?+D;@NHDlkj80h*_`D`zzO(;2lyp3uY|P;y?CPOQHDVP$G%|x%4RG{ zx=?62!fci>RmZhW)704$U;v*5f^WM9EI-4tOH{s}k%-$&UDi5gYeT57!C z1mxPGqRNK=OYrv|;4???v4-u%BK6EPSG577#V(wy=;Ym`BOGW0AJ4U-tn1o`b(Ncx(*tF}b-mbjw(ySjY1IBm{8q zmj>`d#5EW2v4-v00KTqKJQ|MemjKXrbUCvQ1mAXle#i!{&bPo^M+V>5>lTr~581#q zVLfbti5UT?Ou)UrO^~Z&d9OI;f%UKjCME$}SMUR)CYJY_O5QC?xc?{`0Z>+M&Tf2z zfFEnKZHV`VG>Z96!Y3rO;Q5UP{8*c9L%nz1C-}mWJfb8d2*mSa?e`4zUQ>s>wRF1t z8ZiX?n3cvV5%_ys@Uxa8R8bMJ(lB{12L3Wq$vYeZ0ww8~-itMghpxfzgaAwMZ5K8| z8a7kO+d24MML-VXTGtQv221(ilK$Ez($`Sme1aR=@3|B>MCEY=ZYgrHg zdH)UpzYB3K)?)r3BcNiM-3N}~hlp#rJlxj{0k;~DwFN(hxTagof6fK`Bm{uepz{6= zB1xYEm{MG;Sw@y30_JLU!fFRusJPavvY873stv5aB7kqB?+gn3R0NcoM#*F;#kDNK zPenkX%0CvhzOT3zYcYRZjhLh9qy&?=wiq(_IT4^r6*l5pjK%!%69ApDjmcaeDy}`V zf!Ix=bTU&^Mh6EHOl5AC%4RMRaJ1|Vd@HOqa@|3JpNat0GgB3;2Zw^6wX&HD0lHLk zmk|7H#I@cD0KG?5x6gSL_`F~{w>M`Eq6*S2wyYdUC|SJ4{L3MLN5PTl-$*4$creTf z@^R8wi}@E-hDv*da}=94U&tk4wH%QtAio}oER z(h~*f@=MkBxp%jNB!H~LIe?4^AOgsU03v{l2p|H;hyWshj0hkC$o|_u0R{lqM?5qa SMil}80000|6H_V+Po~;1FtBKOx;TbZ+4@kq-FxBLvIpE^ z2er4}`{w^`QN$jBUPVU{pDnyc6FPrfN?N@o^Z4@%ylZZA#vZhMF8S-{A?F)=XCA)! z{+#jiGx_SV_rDt}2%n$HG(ku~)q`__&=M98&LAcjsmU1BG=)La(W?PUDyTYmfs{f> zwX++2nqTf(*Yo`DimfZAYs>v|ys~!1`o-Vot1=qdJy>(vXvNM6;fvz3EqdGo!xz`7 zEd3T+v3ui$_RocuuePXpojTO&QvAvD%I7Z%PfxleSE|0Ut(stT+wXw&Eek=Tb7zm= zve4Z8G3(0jWsOsAR%pK}z3gzxr{uF)-Icy?^D$%zUxq z^xnU7SLiR|o1;0gQT$o@FVC2!37>8z^-eiaaZCm1?uc6ThwoRsT`@aw|M~FQ>~?WM z+a6V2*}CGlonKJef;qDG-LGn=tkX395Pju&OUbe`N2b@_moJIk{)2V5$k((h-p1vt z!;%vJ%`0R2q4w-|b&%ZI^@fh-)9-2TUtQUpwzxp+)nb7k=VyGkeOo=_Y5to?r?7`R zvQH(R%HKS_etPXh{m>sXryPFc%KbC@;n(iK=Rb|CmX_XEeQIE@vsW+ocK_~U>3gp= zE>lb0>0O-saxZty%0qgZ{WE54;w|~16xOW%=)B~f8Ujuem0E%<$1lQ0ZJaP*Bvff&73~{Q+(%wjJraP zr5c?Js+Yv9E%j!(nz;ArL1S;rDIAw}z24w`N?9#ULGX#;`NzSgf+nV#)4!{!Hoe+# zv5FybsZRH7+qJvTKAJS;um{W5g;h!!UO`?gTNAYpD;Rlc3SMbb>s+wX1J2l)3v#6n z^GUVTo65U4U)TjS=z@-*39F`R)2$6NmlQ9b9HgXiUR7B0Imoz7C5_!vgdB4t&YLap z0h>F0io1f~m6m6n3pCg4ag1}$JD7ouh(taq4Jc=gC%rtTfN7rs{;F091gqI zxO7sG(h8|eA;(~gU@w-d3tRN7f}$RzOfGUewS0SC=K`xGUM#8hAgM&--wei{m2>nL z2d`7!uln@WlpD7g^W8*0U0%U{ll@jISNXBhrzd}We)#6&|6_%-KmK2MetIvU+E(|6H_V+Po~;1FfciLx;TbZ+a5yG89vt`R3T1j!8Lci&P#*S7slZ z_up^k+6NLZ^>x;Qyyf})MsV3_g?|?kmby$)@N(hQD``8bf8G(uexv#FZ`}niNJzxI zxNs%sD*GC{q`7aC&xLvIscqKSxIATT*uL+lf7m|h~U|_*41(I*VVM<=>q4`nhUr$-OqYr!mYg&$P=ubw0D1 z?@~qQ&iv0TU9Z&6hxtGF-PUk+#^V{DXZ*hA=Kfh-w6V9UYiGBbor`C+>9#+=x{;z1 v5r>eN19@-}#Gi{;0+qZ3RPTOPJ;3mim0!TYV3!my%`teo`njxgN@xNA#&jgT literal 0 HcmV?d00001 diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/ic_storage.png b/TMessagesProj/src/main/res/drawable-xxhdpi/ic_storage.png new file mode 100644 index 0000000000000000000000000000000000000000..a19c0aa887d187c1940540e1d077a99a0503dbeb GIT binary patch literal 589 zcmeAS@N?(olHy`uVBq!ia0vp^OM$qKgAGW!Ub<)oq$EpRBT9nv(@M${i&7aJQ}UBi z6+Ckj(^G>|6H_V+Po~;1FfhLNba4!+xb^04pdXW=h{MH|iOh?BCx$&S18kT5gw5X`BM89YTRk8iEkYaY~1fOQ!~$Qt)!&T;wtZ zOtAzic~u-y{4`m6Y0WnIZ}|L|ox9TWC@v{Tzykr^B&;7~}ZQ%mtV*V6MmnkqK1 zS-ep25>Q + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/layout-ar/document_item.xml b/TMessagesProj/src/main/res/layout-ar/document_item.xml new file mode 100644 index 000000000..d83e00d30 --- /dev/null +++ b/TMessagesProj/src/main/res/layout-ar/document_item.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/layout/chat_group_incoming_contact_layout.xml b/TMessagesProj/src/main/res/layout/chat_group_incoming_contact_layout.xml index e626c8c71..f86882572 100644 --- a/TMessagesProj/src/main/res/layout/chat_group_incoming_contact_layout.xml +++ b/TMessagesProj/src/main/res/layout/chat_group_incoming_contact_layout.xml @@ -16,6 +16,7 @@ android:id="@+id/chat_group_avatar_image" android:scaleType="fitCenter" android:layout_marginBottom="2dp" + android:layout_marginRight="4dp" android:layout_gravity="bottom"/> - diff --git a/TMessagesProj/src/main/res/layout/chat_group_incoming_document_layout.xml b/TMessagesProj/src/main/res/layout/chat_group_incoming_document_layout.xml new file mode 100644 index 000000000..92c29c4db --- /dev/null +++ b/TMessagesProj/src/main/res/layout/chat_group_incoming_document_layout.xml @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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 index 80a33fc42..ac594232d 100644 --- a/TMessagesProj/src/main/res/layout/chat_group_incoming_video_layout.xml +++ b/TMessagesProj/src/main/res/layout/chat_group_incoming_video_layout.xml @@ -130,12 +130,13 @@ diff --git a/TMessagesProj/src/main/res/layout/chat_incoming_contact_layout.xml b/TMessagesProj/src/main/res/layout/chat_incoming_contact_layout.xml index b38a36681..946a2649c 100644 --- a/TMessagesProj/src/main/res/layout/chat_incoming_contact_layout.xml +++ b/TMessagesProj/src/main/res/layout/chat_incoming_contact_layout.xml @@ -2,7 +2,6 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/layout/chat_incoming_forward_layout.xml b/TMessagesProj/src/main/res/layout/chat_incoming_forward_layout.xml index a4d518a4b..7ef566b04 100644 --- a/TMessagesProj/src/main/res/layout/chat_incoming_forward_layout.xml +++ b/TMessagesProj/src/main/res/layout/chat_incoming_forward_layout.xml @@ -16,15 +16,16 @@ android:id="@+id/message_layout" android:layout_gravity="top|left"> - + - diff --git a/TMessagesProj/src/main/res/layout/chat_layout.xml b/TMessagesProj/src/main/res/layout/chat_layout.xml index fd58fb826..3098d1a7d 100644 --- a/TMessagesProj/src/main/res/layout/chat_layout.xml +++ b/TMessagesProj/src/main/res/layout/chat_layout.xml @@ -28,7 +28,7 @@ android:textSize="14dp" android:id="@+id/searchEmptyView" android:visibility="gone" - android:layout_centerInParent="true"/> + android:layout_gravity="center"/> + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/layout/chat_outgoing_document_layout.xml b/TMessagesProj/src/main/res/layout/chat_outgoing_document_layout.xml new file mode 100644 index 000000000..1845e7a8f --- /dev/null +++ b/TMessagesProj/src/main/res/layout/chat_outgoing_document_layout.xml @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/layout/chat_outgoing_photo_layout.xml b/TMessagesProj/src/main/res/layout/chat_outgoing_photo_layout.xml index 5416e6d16..cb6b899b7 100644 --- a/TMessagesProj/src/main/res/layout/chat_outgoing_photo_layout.xml +++ b/TMessagesProj/src/main/res/layout/chat_outgoing_photo_layout.xml @@ -15,7 +15,7 @@ android:layout_marginRight="10dp" android:id="@+id/chat_view_action_layout" android:layout_gravity="center" - android:visibility="visible"> + android:visibility="gone"> @@ -55,7 +56,8 @@ android:clickable="true" android:gravity="center" android:textStyle="bold" - android:layout_gravity="center"/> + android:layout_gravity="center" + android:visibility="gone"/> diff --git a/TMessagesProj/src/main/res/layout/document_item.xml b/TMessagesProj/src/main/res/layout/document_item.xml new file mode 100644 index 000000000..aa20aba2b --- /dev/null +++ b/TMessagesProj/src/main/res/layout/document_item.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/layout/document_select_layout.xml b/TMessagesProj/src/main/res/layout/document_select_layout.xml new file mode 100644 index 000000000..bb2811e8a --- /dev/null +++ b/TMessagesProj/src/main/res/layout/document_select_layout.xml @@ -0,0 +1,28 @@ + + + + + + + diff --git a/TMessagesProj/src/main/res/menu/chat_menu.xml b/TMessagesProj/src/main/res/menu/chat_menu.xml index 3a17931b7..f817aaadb 100644 --- a/TMessagesProj/src/main/res/menu/chat_menu.xml +++ b/TMessagesProj/src/main/res/menu/chat_menu.xml @@ -24,6 +24,11 @@ android:title="@string/ChatVideo" android:id="@+id/attach_video"/> + + لقد قمت بالدخول للمحادثة السرية. مسح سجل التاريخ حذف وخروج + + + اختر ملف + متاح %1$s من %2$s + حدث خطأ غير معروف + خطأ في الوصول + لا يوجد ملفات بعد... + حجم الملف لا يمكن أن يكون أكبر من %1$s + الذاكرة غير مثبتة + نقل اليو إس بي مفعل + الذاكرة الداخلية + الذاكرة الخارجية + جذر النظام + بطاقة الذاكرة مخفي @@ -59,6 +73,7 @@ صورة موقع مقطع مرئي + مستند ...لا توجد رسائل بعد عرض الصورة عرض الموقع @@ -105,12 +120,16 @@ %1$s قام بإرسال مقطع مرئي لك %1$s قام بإرسال جهة اتصال لك %1$s قام بإرسال خريطة لك + %1$s قام بإرسال مستند لك + %1$s قام بإرسال مقطع صوتي لك %1$s @ %2$s: %3$s %1$s قام بإرسال رسالة للمجموعة %2$s %1$s قام بإرسال صورة للمجموعة %2$s %1$s قام بإرسال مقطع مرئي للمجموعة %2$s %1$s قام بإرسال جهة اتصال للمجموعة %2$s %1$s قام بإرسال خريطة للمجموعة %2$s + %1$s قام بإرسال مستند للمجموعة %2$s + %1$s قام بإرسال مقطع صوتي للمجموعة %2$s %1$s قام بدعوتك للمجموعة %2$s %1$s قام بتعديل اسم المجموعة %2$s %1$s قام بتغيير صورة المجموعة %2$s @@ -235,6 +254,7 @@ التالي رجوع تم + فتح إلغاء إضافة تعديل @@ -264,6 +284,8 @@ مقطع مرئي موقع جهة اتصال + مستند + مقطع صوتي أنت @@ -275,6 +297,7 @@ اسم العائلة غير صحيح جاري التحميل ... ليس لديك أي مشغل مقاطع مرئية، يرجى تنزيل أية مشغل + لا يوجد لديك تطبيق يمكنه فته هذا المستند، يرجى تنزيل تطبيق يمكنه للإستمرار هذا المستخدم ليس لديه تيليجرام بعد ، هل ترغب في دعوته الآن؟ هل أنت متأكد؟ هل تريد حذف هذه الدردشة؟ diff --git a/TMessagesProj/src/main/res/values/strings.xml b/TMessagesProj/src/main/res/values/strings.xml index 90385a1b9..c271755d9 100644 --- a/TMessagesProj/src/main/res/values/strings.xml +++ b/TMessagesProj/src/main/res/values/strings.xml @@ -47,6 +47,20 @@ Clear History Delete and Exit + + Select File + Free %1$s of %2$s + Unknown error + Access error + No files yet... + File size shouldn\'t be greater than %1$s + Storage not mounted + Usb transfer active + Internal Storage + External Storage + System Root + SD Card + invisible typing... @@ -59,6 +73,7 @@ Gallery Location Video + Document No messages here yet... View Photo View Location @@ -105,12 +120,16 @@ %1$s sent you a video %1$s shared a contact with you %1$s sent you a map + %1$s sent you a document + %1$s sent you an audio %1$s @ %2$s: %3$s %1$s sent a message to the group %2$s %1$s sent a photo to the group %2$s %1$s sent a video to the group %2$s %1$s shared a contact in the group %2$s %1$s sent a map to the group %2$s + %1$s sent a document to the group %2$s + %1$s sent an audio to the group %2$s %1$s invited you to the group %2$s %1$s edited the group\'s %2$s name %1$s edited the group\'s %2$s photo @@ -235,6 +254,7 @@ Next Back Done + Open Cancel Add Edit @@ -264,6 +284,8 @@ Video Location Contact + Document + Audio You @@ -275,6 +297,7 @@ Invalid last name Loading... You don\'t have a video player, please install one to continue + You don\'t have any application that can handle with mime type \'%1$s\', please install one to continue This user does not have Telegram yet, send an invitation? Are you sure? Add contact?