update to 1.3.6

This commit is contained in:
DrKLO 2013-12-26 15:43:37 +04:00
parent a65f5f9fee
commit 51add404ef
72 changed files with 3190 additions and 992 deletions

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.telegram.messenger"
android:versionCode="126"
android:versionName="1.3.5">
android:versionCode="129"
android:versionName="1.3.6">
<supports-screens android:anyDensity="true"
android:smallScreens="true"

View file

@ -39,18 +39,19 @@ public class TLClassStore {
classStore.put(TLRPC.TL_rpc_answer_dropped.constructor, TLRPC.TL_rpc_answer_dropped.class);
classStore.put(TLRPC.TL_rpc_answer_dropped_running.constructor, TLRPC.TL_rpc_answer_dropped_running.class);
classStore.put(TLRPC.TL_contacts_link.constructor, TLRPC.TL_contacts_link.class);
classStore.put(TLRPC.TL_encryptedFile.constructor, TLRPC.TL_encryptedFile.class);
classStore.put(TLRPC.TL_encryptedFileEmpty.constructor, TLRPC.TL_encryptedFileEmpty.class);
classStore.put(TLRPC.TL_peerUser.constructor, TLRPC.TL_peerUser.class);
classStore.put(TLRPC.TL_peerChat.constructor, TLRPC.TL_peerChat.class);
classStore.put(TLRPC.TL_encryptedFile.constructor, TLRPC.TL_encryptedFile.class);
classStore.put(TLRPC.TL_encryptedFileEmpty.constructor, TLRPC.TL_encryptedFileEmpty.class);
classStore.put(TLRPC.TL_destroy_session_ok.constructor, TLRPC.TL_destroy_session_ok.class);
classStore.put(TLRPC.TL_destroy_session_none.constructor, TLRPC.TL_destroy_session_none.class);
classStore.put(TLRPC.TL_updates_difference.constructor, TLRPC.TL_updates_difference.class);
classStore.put(TLRPC.TL_updates_getDifference.constructor, TLRPC.TL_updates_getDifference.class);
classStore.put(TLRPC.TL_updates_differenceSlice.constructor, TLRPC.TL_updates_differenceSlice.class);
classStore.put(TLRPC.TL_updates_differenceEmpty.constructor, TLRPC.TL_updates_differenceEmpty.class);
classStore.put(TLRPC.TL_updates_differenceSlice.constructor, TLRPC.TL_updates_differenceSlice.class);
classStore.put(TLRPC.TL_updates_difference.constructor, TLRPC.TL_updates_difference.class);
classStore.put(TLRPC.TL_geoPointEmpty.constructor, TLRPC.TL_geoPointEmpty.class);
classStore.put(TLRPC.TL_geoPoint.constructor, TLRPC.TL_geoPoint.class);
classStore.put(TLRPC.TL_help_appUpdate.constructor, TLRPC.TL_help_appUpdate.class);
classStore.put(TLRPC.TL_help_noAppUpdate.constructor, TLRPC.TL_help_noAppUpdate.class);
classStore.put(TLRPC.TL_messageForwarded.constructor, TLRPC.TL_messageForwarded.class);
classStore.put(TLRPC.TL_messageEmpty.constructor, TLRPC.TL_messageEmpty.class);
classStore.put(TLRPC.TL_message.constructor, TLRPC.TL_message.class);
@ -58,10 +59,13 @@ public class TLClassStore {
classStore.put(TLRPC.TL_inputPhoneContact.constructor, TLRPC.TL_inputPhoneContact.class);
classStore.put(TLRPC.TL_invokeAfterMsg.constructor, TLRPC.TL_invokeAfterMsg.class);
classStore.put(TLRPC.TL_messageMediaVideo.constructor, TLRPC.TL_messageMediaVideo.class);
classStore.put(TLRPC.TL_messageMediaGeo.constructor, TLRPC.TL_messageMediaGeo.class);
classStore.put(TLRPC.TL_messageMediaPhoto.constructor, TLRPC.TL_messageMediaPhoto.class);
classStore.put(TLRPC.TL_messageMediaDocument.constructor, TLRPC.TL_messageMediaDocument.class);
classStore.put(TLRPC.TL_messageMediaGeo.constructor, TLRPC.TL_messageMediaGeo.class);
classStore.put(TLRPC.TL_messageMediaEmpty.constructor, TLRPC.TL_messageMediaEmpty.class);
classStore.put(TLRPC.TL_messageMediaAudio.constructor, TLRPC.TL_messageMediaAudio.class);
classStore.put(TLRPC.TL_messageMediaContact.constructor, TLRPC.TL_messageMediaContact.class);
classStore.put(TLRPC.TL_messageMediaUnsupported.constructor, TLRPC.TL_messageMediaUnsupported.class);
classStore.put(TLRPC.TL_auth_sentCode.constructor, TLRPC.TL_auth_sentCode.class);
classStore.put(TLRPC.TL_peerNotifySettingsEmpty.constructor, TLRPC.TL_peerNotifySettingsEmpty.class);
classStore.put(TLRPC.TL_peerNotifySettings.constructor, TLRPC.TL_peerNotifySettings.class);
@ -74,6 +78,8 @@ public class TLClassStore {
classStore.put(TLRPC.TL_help_inviteText.constructor, TLRPC.TL_help_inviteText.class);
classStore.put(TLRPC.TL_messages_dhConfigNotModified.constructor, TLRPC.TL_messages_dhConfigNotModified.class);
classStore.put(TLRPC.TL_messages_dhConfig.constructor, TLRPC.TL_messages_dhConfig.class);
classStore.put(TLRPC.TL_audioEmpty.constructor, TLRPC.TL_audioEmpty.class);
classStore.put(TLRPC.TL_audio.constructor, TLRPC.TL_audio.class);
classStore.put(TLRPC.TL_destroy_sessions_res.constructor, TLRPC.TL_destroy_sessions_res.class);
classStore.put(TLRPC.TL_contacts_contacts.constructor, TLRPC.TL_contacts_contacts.class);
classStore.put(TLRPC.TL_contacts_contactsNotModified.constructor, TLRPC.TL_contacts_contactsNotModified.class);
@ -99,9 +105,11 @@ public class TLClassStore {
classStore.put(TLRPC.TL_inputNotifyUsers.constructor, TLRPC.TL_inputNotifyUsers.class);
classStore.put(TLRPC.TL_inputNotifyGeoChatPeer.constructor, TLRPC.TL_inputNotifyGeoChatPeer.class);
classStore.put(TLRPC.TL_inputNotifyAll.constructor, TLRPC.TL_inputNotifyAll.class);
classStore.put(TLRPC.TL_inputAudioFileLocation.constructor, TLRPC.TL_inputAudioFileLocation.class);
classStore.put(TLRPC.TL_inputEncryptedFileLocation.constructor, TLRPC.TL_inputEncryptedFileLocation.class);
classStore.put(TLRPC.TL_inputFileLocation.constructor, TLRPC.TL_inputFileLocation.class);
classStore.put(TLRPC.TL_inputVideoFileLocation.constructor, TLRPC.TL_inputVideoFileLocation.class);
classStore.put(TLRPC.TL_inputDocumentFileLocation.constructor, TLRPC.TL_inputDocumentFileLocation.class);
classStore.put(TLRPC.TL_inputFileLocation.constructor, TLRPC.TL_inputFileLocation.class);
classStore.put(TLRPC.TL_photos_photo.constructor, TLRPC.TL_photos_photo.class);
classStore.put(TLRPC.TL_userContact.constructor, TLRPC.TL_userContact.class);
classStore.put(TLRPC.TL_userRequest.constructor, TLRPC.TL_userRequest.class);
@ -128,31 +136,43 @@ public class TLClassStore {
classStore.put(TLRPC.TL_dh_gen_retry.constructor, TLRPC.TL_dh_gen_retry.class);
classStore.put(TLRPC.TL_dh_gen_fail.constructor, TLRPC.TL_dh_gen_fail.class);
classStore.put(TLRPC.TL_dh_gen_ok.constructor, TLRPC.TL_dh_gen_ok.class);
classStore.put(TLRPC.TL_peerNotifyEventsEmpty.constructor, TLRPC.TL_peerNotifyEventsEmpty.class);
classStore.put(TLRPC.TL_peerNotifyEventsAll.constructor, TLRPC.TL_peerNotifyEventsAll.class);
classStore.put(TLRPC.TL_chatLocated.constructor, TLRPC.TL_chatLocated.class);
classStore.put(TLRPC.TL_decryptedMessageService.constructor, TLRPC.TL_decryptedMessageService.class);
classStore.put(TLRPC.TL_decryptedMessage.constructor, TLRPC.TL_decryptedMessage.class);
classStore.put(TLRPC.TL_inputPeerNotifyEventsAll.constructor, TLRPC.TL_inputPeerNotifyEventsAll.class);
classStore.put(TLRPC.TL_inputPeerNotifyEventsEmpty.constructor, TLRPC.TL_inputPeerNotifyEventsEmpty.class);
classStore.put(TLRPC.TL_client_DH_inner_data.constructor, TLRPC.TL_client_DH_inner_data.class);
classStore.put(TLRPC.TL_video.constructor, TLRPC.TL_video.class);
classStore.put(TLRPC.TL_videoEmpty.constructor, TLRPC.TL_videoEmpty.class);
classStore.put(TLRPC.TL_contactBlocked.constructor, TLRPC.TL_contactBlocked.class);
classStore.put(TLRPC.TL_inputDocumentEmpty.constructor, TLRPC.TL_inputDocumentEmpty.class);
classStore.put(TLRPC.TL_inputDocument.constructor, TLRPC.TL_inputDocument.class);
classStore.put(TLRPC.TL_inputAppEvent.constructor, TLRPC.TL_inputAppEvent.class);
classStore.put(TLRPC.TL_messages_affectedHistory.constructor, TLRPC.TL_messages_affectedHistory.class);
classStore.put(TLRPC.TL_inputMediaUploadedPhoto.constructor, TLRPC.TL_inputMediaUploadedPhoto.class);
classStore.put(TLRPC.TL_documentEmpty.constructor, TLRPC.TL_documentEmpty.class);
classStore.put(TLRPC.TL_document.constructor, TLRPC.TL_document.class);
classStore.put(TLRPC.TL_inputMediaContact.constructor, TLRPC.TL_inputMediaContact.class);
classStore.put(TLRPC.TL_inputMediaUploadedThumbDocument.constructor, TLRPC.TL_inputMediaUploadedThumbDocument.class);
classStore.put(TLRPC.TL_inputMediaAudio.constructor, TLRPC.TL_inputMediaAudio.class);
classStore.put(TLRPC.TL_inputMediaDocument.constructor, TLRPC.TL_inputMediaDocument.class);
classStore.put(TLRPC.TL_inputMediaVideo.constructor, TLRPC.TL_inputMediaVideo.class);
classStore.put(TLRPC.TL_inputMediaGeoPoint.constructor, TLRPC.TL_inputMediaGeoPoint.class);
classStore.put(TLRPC.TL_inputMediaContact.constructor, TLRPC.TL_inputMediaContact.class);
classStore.put(TLRPC.TL_inputMediaUploadedThumbVideo.constructor, TLRPC.TL_inputMediaUploadedThumbVideo.class);
classStore.put(TLRPC.TL_inputMediaUploadedVideo.constructor, TLRPC.TL_inputMediaUploadedVideo.class);
classStore.put(TLRPC.TL_inputMediaPhoto.constructor, TLRPC.TL_inputMediaPhoto.class);
classStore.put(TLRPC.TL_inputMediaEmpty.constructor, TLRPC.TL_inputMediaEmpty.class);
classStore.put(TLRPC.TL_inputMediaUploadedThumbVideo.constructor, TLRPC.TL_inputMediaUploadedThumbVideo.class);
classStore.put(TLRPC.TL_inputMediaUploadedPhoto.constructor, TLRPC.TL_inputMediaUploadedPhoto.class);
classStore.put(TLRPC.TL_inputMediaUploadedAudio.constructor, TLRPC.TL_inputMediaUploadedAudio.class);
classStore.put(TLRPC.TL_inputMediaUploadedVideo.constructor, TLRPC.TL_inputMediaUploadedVideo.class);
classStore.put(TLRPC.TL_inputMediaUploadedDocument.constructor, TLRPC.TL_inputMediaUploadedDocument.class);
classStore.put(TLRPC.TL_inputMediaPhoto.constructor, TLRPC.TL_inputMediaPhoto.class);
classStore.put(TLRPC.TL_geochats_messagesSlice.constructor, TLRPC.TL_geochats_messagesSlice.class);
classStore.put(TLRPC.TL_geochats_messages.constructor, TLRPC.TL_geochats_messages.class);
classStore.put(TLRPC.TL_messages_sentMessage.constructor, TLRPC.TL_messages_sentMessage.class);
classStore.put(TLRPC.TL_messages_sentMessageLink.constructor, TLRPC.TL_messages_sentMessageLink.class);
classStore.put(TLRPC.TL_encryptedMessageService.constructor, TLRPC.TL_encryptedMessageService.class);
classStore.put(TLRPC.TL_encryptedMessage.constructor, TLRPC.TL_encryptedMessage.class);
classStore.put(TLRPC.TL_contactSuggested.constructor, TLRPC.TL_contactSuggested.class);
classStore.put(TLRPC.TL_server_DH_params_fail.constructor, TLRPC.TL_server_DH_params_fail.class);
classStore.put(TLRPC.TL_server_DH_params_ok.constructor, TLRPC.TL_server_DH_params_ok.class);
classStore.put(TLRPC.TL_userStatusEmpty.constructor, TLRPC.TL_userStatusEmpty.class);
@ -164,6 +184,7 @@ public class TLClassStore {
classStore.put(TLRPC.TL_updateEncryptedMessagesRead.constructor, TLRPC.TL_updateEncryptedMessagesRead.class);
classStore.put(TLRPC.TL_updateContactLink.constructor, TLRPC.TL_updateContactLink.class);
classStore.put(TLRPC.TL_updateReadMessages.constructor, TLRPC.TL_updateReadMessages.class);
classStore.put(TLRPC.TL_updateChatParticipantDelete.constructor, TLRPC.TL_updateChatParticipantDelete.class);
classStore.put(TLRPC.TL_updateRestoreMessages.constructor, TLRPC.TL_updateRestoreMessages.class);
classStore.put(TLRPC.TL_updateUserTyping.constructor, TLRPC.TL_updateUserTyping.class);
classStore.put(TLRPC.TL_updateChatUserTyping.constructor, TLRPC.TL_updateChatUserTyping.class);
@ -173,6 +194,7 @@ public class TLClassStore {
classStore.put(TLRPC.TL_updateMessageID.constructor, TLRPC.TL_updateMessageID.class);
classStore.put(TLRPC.TL_updateDeleteMessages.constructor, TLRPC.TL_updateDeleteMessages.class);
classStore.put(TLRPC.TL_updateEncryptedChatTyping.constructor, TLRPC.TL_updateEncryptedChatTyping.class);
classStore.put(TLRPC.TL_updateDcOptions.constructor, TLRPC.TL_updateDcOptions.class);
classStore.put(TLRPC.TL_updateChatParticipants.constructor, TLRPC.TL_updateChatParticipants.class);
classStore.put(TLRPC.TL_updateEncryption.constructor, TLRPC.TL_updateEncryption.class);
classStore.put(TLRPC.TL_updateActivation.constructor, TLRPC.TL_updateActivation.class);
@ -180,10 +202,13 @@ public class TLClassStore {
classStore.put(TLRPC.TL_updateNewGeoChatMessage.constructor, TLRPC.TL_updateNewGeoChatMessage.class);
classStore.put(TLRPC.TL_updateUserPhoto.constructor, TLRPC.TL_updateUserPhoto.class);
classStore.put(TLRPC.TL_updateContactRegistered.constructor, TLRPC.TL_updateContactRegistered.class);
classStore.put(TLRPC.TL_updateChatParticipantAdd.constructor, TLRPC.TL_updateChatParticipantAdd.class);
classStore.put(TLRPC.TL_updateUserStatus.constructor, TLRPC.TL_updateUserStatus.class);
classStore.put(TLRPC.TL_contacts_suggested.constructor, TLRPC.TL_contacts_suggested.class);
classStore.put(TLRPC.TL_rpc_error.constructor, TLRPC.TL_rpc_error.class);
classStore.put(TLRPC.TL_rpc_req_error.constructor, TLRPC.TL_rpc_req_error.class);
classStore.put(TLRPC.TL_inputEncryptedFile.constructor, TLRPC.TL_inputEncryptedFile.class);
classStore.put(TLRPC.TL_inputEncryptedFileBigUploaded.constructor, TLRPC.TL_inputEncryptedFileBigUploaded.class);
classStore.put(TLRPC.TL_inputEncryptedFileEmpty.constructor, TLRPC.TL_inputEncryptedFileEmpty.class);
classStore.put(TLRPC.TL_inputEncryptedFileUploaded.constructor, TLRPC.TL_inputEncryptedFileUploaded.class);
classStore.put(TLRPC.TL_decryptedMessageActionSetMessageTTL.constructor, TLRPC.TL_decryptedMessageActionSetMessageTTL.class);
@ -204,13 +229,17 @@ public class TLClassStore {
classStore.put(TLRPC.TL_geochats_statedMessage.constructor, TLRPC.TL_geochats_statedMessage.class);
classStore.put(TLRPC.TL_contact.constructor, TLRPC.TL_contact.class);
classStore.put(TLRPC.TL_config.constructor, TLRPC.TL_config.class);
classStore.put(TLRPC.TL_inputAudio.constructor, TLRPC.TL_inputAudio.class);
classStore.put(TLRPC.TL_inputAudioEmpty.constructor, TLRPC.TL_inputAudioEmpty.class);
classStore.put(TLRPC.TL_messages_chats.constructor, TLRPC.TL_messages_chats.class);
classStore.put(TLRPC.TL_contacts_found.constructor, TLRPC.TL_contacts_found.class);
classStore.put(TLRPC.TL_chatParticipants.constructor, TLRPC.TL_chatParticipants.class);
classStore.put(TLRPC.TL_chatParticipantsForbidden.constructor, TLRPC.TL_chatParticipantsForbidden.class);
classStore.put(TLRPC.TL_decryptedMessageMediaContact.constructor, TLRPC.TL_decryptedMessageMediaContact.class);
classStore.put(TLRPC.TL_decryptedMessageMediaVideo.constructor, TLRPC.TL_decryptedMessageMediaVideo.class);
classStore.put(TLRPC.TL_decryptedMessageMediaDocument.constructor, TLRPC.TL_decryptedMessageMediaDocument.class);
classStore.put(TLRPC.TL_decryptedMessageMediaGeoPoint.constructor, TLRPC.TL_decryptedMessageMediaGeoPoint.class);
classStore.put(TLRPC.TL_decryptedMessageMediaFile.constructor, TLRPC.TL_decryptedMessageMediaFile.class);
classStore.put(TLRPC.TL_decryptedMessageMediaAudio.constructor, TLRPC.TL_decryptedMessageMediaAudio.class);
classStore.put(TLRPC.TL_decryptedMessageMediaVideo.constructor, TLRPC.TL_decryptedMessageMediaVideo.class);
classStore.put(TLRPC.TL_decryptedMessageMediaContact.constructor, TLRPC.TL_decryptedMessageMediaContact.class);
classStore.put(TLRPC.TL_decryptedMessageMediaEmpty.constructor, TLRPC.TL_decryptedMessageMediaEmpty.class);
classStore.put(TLRPC.TL_decryptedMessageMediaPhoto.constructor, TLRPC.TL_decryptedMessageMediaPhoto.class);
classStore.put(TLRPC.TL_chatParticipant.constructor, TLRPC.TL_chatParticipant.class);
@ -231,25 +260,26 @@ public class TLClassStore {
classStore.put(TLRPC.TL_inputMessagesFilterEmpty.constructor, TLRPC.TL_inputMessagesFilterEmpty.class);
classStore.put(TLRPC.TL_inputMessagesFilterPhotos.constructor, TLRPC.TL_inputMessagesFilterPhotos.class);
classStore.put(TLRPC.TL_inputMessagesFilterPhotoVideo.constructor, TLRPC.TL_inputMessagesFilterPhotoVideo.class);
classStore.put(TLRPC.TL_geochats_located.constructor, TLRPC.TL_geochats_located.class);
classStore.put(TLRPC.TL_msgs_state_info.constructor, TLRPC.TL_msgs_state_info.class);
classStore.put(TLRPC.TL_upload_file.constructor, TLRPC.TL_upload_file.class);
classStore.put(TLRPC.TL_dialog.constructor, TLRPC.TL_dialog.class);
classStore.put(TLRPC.TL_messages_messageEmpty.constructor, TLRPC.TL_messages_messageEmpty.class);
classStore.put(TLRPC.TL_messages_message.constructor, TLRPC.TL_messages_message.class);
classStore.put(TLRPC.TL_fileLocation.constructor, TLRPC.TL_fileLocation.class);
classStore.put(TLRPC.TL_fileLocationUnavailable.constructor, TLRPC.TL_fileLocationUnavailable.class);
classStore.put(TLRPC.TL_messages_messageEmpty.constructor, TLRPC.TL_messages_messageEmpty.class);
classStore.put(TLRPC.TL_messages_message.constructor, TLRPC.TL_messages_message.class);
classStore.put(TLRPC.TL_geochats_located.constructor, TLRPC.TL_geochats_located.class);
classStore.put(TLRPC.TL_inputGeoChat.constructor, TLRPC.TL_inputGeoChat.class);
classStore.put(TLRPC.TL_protoMessage.constructor, TLRPC.TL_protoMessage.class);
classStore.put(TLRPC.TL_photoSize.constructor, TLRPC.TL_photoSize.class);
classStore.put(TLRPC.TL_photoSizeEmpty.constructor, TLRPC.TL_photoSizeEmpty.class);
classStore.put(TLRPC.TL_photoCachedSize.constructor, TLRPC.TL_photoCachedSize.class);
classStore.put(TLRPC.TL_contactFound.constructor, TLRPC.TL_contactFound.class);
classStore.put(TLRPC.TL_inputFileBig.constructor, TLRPC.TL_inputFileBig.class);
classStore.put(TLRPC.TL_inputFile.constructor, TLRPC.TL_inputFile.class);
classStore.put(TLRPC.TL_messages_statedMessageLink.constructor, TLRPC.TL_messages_statedMessageLink.class);
classStore.put(TLRPC.TL_messages_statedMessage.constructor, TLRPC.TL_messages_statedMessage.class);
classStore.put(TLRPC.TL_userFull.constructor, TLRPC.TL_userFull.class);
classStore.put(TLRPC.TL_msg_new_detailed_info.constructor, TLRPC.TL_msg_new_detailed_info.class);
classStore.put(TLRPC.TL_msg_detailed_info.constructor, TLRPC.TL_msg_detailed_info.class);
classStore.put(TLRPC.TL_updates_state.constructor, TLRPC.TL_updates_state.class);
classStore.put(TLRPC.TL_resPQ.constructor, TLRPC.TL_resPQ.class);
classStore.put(TLRPC.TL_updateShortChatMessage.constructor, TLRPC.TL_updateShortChatMessage.class);
classStore.put(TLRPC.TL_updates.constructor, TLRPC.TL_updates.class);
@ -260,7 +290,8 @@ public class TLClassStore {
classStore.put(TLRPC.TL_messages_chat.constructor, TLRPC.TL_messages_chat.class);
classStore.put(TLRPC.TL_wallPaper.constructor, TLRPC.TL_wallPaper.class);
classStore.put(TLRPC.TL_wallPaperSolid.constructor, TLRPC.TL_wallPaperSolid.class);
classStore.put(TLRPC.TL_updates_state.constructor, TLRPC.TL_updates_state.class);
classStore.put(TLRPC.TL_msg_new_detailed_info.constructor, TLRPC.TL_msg_new_detailed_info.class);
classStore.put(TLRPC.TL_msg_detailed_info.constructor, TLRPC.TL_msg_detailed_info.class);
classStore.put(TLRPC.TL_inputEncryptedChat.constructor, TLRPC.TL_inputEncryptedChat.class);
classStore.put(TLRPC.TL_inputChatPhoto.constructor, TLRPC.TL_inputChatPhoto.class);
classStore.put(TLRPC.TL_inputChatPhotoEmpty.constructor, TLRPC.TL_inputChatPhotoEmpty.class);
@ -277,6 +308,7 @@ public class TLClassStore {
classStore.put(TLRPC.TL_inputPeerSelf.constructor, TLRPC.TL_inputPeerSelf.class);
classStore.put(TLRPC.TL_inputPeerForeign.constructor, TLRPC.TL_inputPeerForeign.class);
classStore.put(TLRPC.TL_dcOption.constructor, TLRPC.TL_dcOption.class);
classStore.put(TLRPC.TL_decryptedMessageLayer.constructor, TLRPC.TL_decryptedMessageLayer.class);
classStore.put(TLRPC.TL_inputPhotoCropAuto.constructor, TLRPC.TL_inputPhotoCropAuto.class);
classStore.put(TLRPC.TL_inputPhotoCrop.constructor, TLRPC.TL_inputPhotoCrop.class);
classStore.put(TLRPC.TL_messages_dialogs.constructor, TLRPC.TL_messages_dialogs.class);
@ -295,6 +327,7 @@ public class TLClassStore {
classStore.put(TLRPC.TL_auth_signUp.constructor, TLRPC.TL_auth_signUp.class);
classStore.put(TLRPC.TL_auth_signIn.constructor, TLRPC.TL_auth_signIn.class);
classStore.put(TLRPC.TL_auth_logOut.constructor, TLRPC.TL_auth_logOut.class);
classStore.put(TLRPC.TL_auth_resetAuthorizations.constructor, TLRPC.TL_auth_resetAuthorizations.class);
classStore.put(TLRPC.TL_auth_sendInvites.constructor, TLRPC.TL_auth_sendInvites.class);
classStore.put(TLRPC.TL_auth_exportAuthorization.constructor, TLRPC.TL_auth_exportAuthorization.class);
classStore.put(TLRPC.TL_auth_importAuthorization.constructor, TLRPC.TL_auth_importAuthorization.class);
@ -311,6 +344,8 @@ public class TLClassStore {
classStore.put(TLRPC.TL_contacts_getStatuses.constructor, TLRPC.TL_contacts_getStatuses.class);
classStore.put(TLRPC.TL_contacts_getContacts.constructor, TLRPC.TL_contacts_getContacts.class);
classStore.put(TLRPC.TL_contacts_importContacts.constructor, TLRPC.TL_contacts_importContacts.class);
classStore.put(TLRPC.TL_contacts_search.constructor, TLRPC.TL_contacts_search.class);
classStore.put(TLRPC.TL_contacts_getSuggested.constructor, TLRPC.TL_contacts_getSuggested.class);
classStore.put(TLRPC.TL_contacts_deleteContact.constructor, TLRPC.TL_contacts_deleteContact.class);
classStore.put(TLRPC.TL_contacts_deleteContacts.constructor, TLRPC.TL_contacts_deleteContacts.class);
classStore.put(TLRPC.TL_contacts_block.constructor, TLRPC.TL_contacts_block.class);
@ -337,12 +372,14 @@ public class TLClassStore {
classStore.put(TLRPC.TL_messages_deleteChatUser.constructor, TLRPC.TL_messages_deleteChatUser.class);
classStore.put(TLRPC.TL_messages_createChat.constructor, TLRPC.TL_messages_createChat.class);
classStore.put(TLRPC.TL_updates_getState.constructor, TLRPC.TL_updates_getState.class);
classStore.put(TLRPC.TL_updates_getDifference.constructor, TLRPC.TL_updates_getDifference.class);
classStore.put(TLRPC.TL_photos_updateProfilePhoto.constructor, TLRPC.TL_photos_updateProfilePhoto.class);
classStore.put(TLRPC.TL_photos_uploadProfilePhoto.constructor, TLRPC.TL_photos_uploadProfilePhoto.class);
classStore.put(TLRPC.TL_upload_saveFilePart.constructor, TLRPC.TL_upload_saveFilePart.class);
classStore.put(TLRPC.TL_upload_getFile.constructor, TLRPC.TL_upload_getFile.class);
classStore.put(TLRPC.TL_help_getConfig.constructor, TLRPC.TL_help_getConfig.class);
classStore.put(TLRPC.TL_help_getNearestDc.constructor, TLRPC.TL_help_getNearestDc.class);
classStore.put(TLRPC.TL_help_getAppUpdate.constructor, TLRPC.TL_help_getAppUpdate.class);
classStore.put(TLRPC.TL_help_saveAppLog.constructor, TLRPC.TL_help_saveAppLog.class);
classStore.put(TLRPC.TL_help_getInviteText.constructor, TLRPC.TL_help_getInviteText.class);
classStore.put(TLRPC.TL_photos_getUserPhotos.constructor, TLRPC.TL_photos_getUserPhotos.class);
@ -360,7 +397,6 @@ public class TLClassStore {
classStore.put(TLRPC.TL_geochats_sendMessage.constructor, TLRPC.TL_geochats_sendMessage.class);
classStore.put(TLRPC.TL_geochats_sendMedia.constructor, TLRPC.TL_geochats_sendMedia.class);
classStore.put(TLRPC.TL_geochats_createGeoChat.constructor, TLRPC.TL_geochats_createGeoChat.class);
classStore.put(TLRPC.TL_updates_getDifference.constructor, TLRPC.TL_updates_getDifference.class);
classStore.put(TLRPC.TL_messages_getDhConfig.constructor, TLRPC.TL_messages_getDhConfig.class);
classStore.put(TLRPC.TL_messages_requestEncryption.constructor, TLRPC.TL_messages_requestEncryption.class);
classStore.put(TLRPC.TL_messages_acceptEncryption.constructor, TLRPC.TL_messages_acceptEncryption.class);
@ -372,20 +408,20 @@ public class TLClassStore {
classStore.put(TLRPC.TL_messages_sendEncryptedService.constructor, TLRPC.TL_messages_sendEncryptedService.class);
classStore.put(TLRPC.TL_messages_receivedQueue.constructor, TLRPC.TL_messages_receivedQueue.class);
classStore.put(TLRPC.TL_upload_saveBigFilePart.constructor, TLRPC.TL_upload_saveBigFilePart.class);
classStore.put(TLRPC.TL_inputEncryptedFileBigUploaded.constructor, TLRPC.TL_inputEncryptedFileBigUploaded.class);
classStore.put(TLRPC.TL_inputFileBig.constructor, TLRPC.TL_inputFileBig.class);
classStore.put(TLRPC.TL_messageMediaUnsupported.constructor, TLRPC.TL_messageMediaUnsupported.class);
classStore.put(TLRPC.TL_msg_container.constructor, TLRPC.TL_msg_container.class);
classStore.put(TLRPC.TL_fileEncryptedLocation.constructor, TLRPC.TL_fileEncryptedLocation.class);
classStore.put(TLRPC.TL_messageActionTTLChange.constructor, TLRPC.TL_messageActionTTLChange.class);
classStore.put(TLRPC.TL_videoEncrypted.constructor, TLRPC.TL_videoEncrypted.class);
classStore.put(TLRPC.TL_documentEncrypted.constructor, TLRPC.TL_documentEncrypted.class);
classStore.put(TLRPC.TL_gzip_packed.constructor, TLRPC.TL_gzip_packed.class);
classStore.put(TLRPC.Vector.constructor, TLRPC.Vector.class);
classStore.put(TLRPC.TL_userProfilePhotoOld.constructor, TLRPC.TL_userProfilePhotoOld.class);
classStore.put(TLRPC.TL_messageActionUserUpdatedPhoto.constructor, TLRPC.TL_messageActionUserUpdatedPhoto.class);
classStore.put(TLRPC.TL_messageActionUserJoined.constructor, TLRPC.TL_messageActionUserJoined.class);
classStore.put(TLRPC.TL_messageActionLoginUnknownLocation.constructor, TLRPC.TL_messageActionLoginUnknownLocation.class);
classStore.put(TLRPC.TL_encryptedChat_old.constructor, TLRPC.TL_encryptedChat_old.class);
classStore.put(TLRPC.TL_encryptedChatRequested_old.constructor, TLRPC.TL_encryptedChatRequested_old.class);
}
static TLClassStore store = null;

File diff suppressed because it is too large Load diff

View file

@ -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<Integer, Datacenter> datacenters = new HashMap<Integer, Datacenter>();
private HashMap<Long, ArrayList<Long>> processedMessageIdsSet = new HashMap<Long, ArrayList<Long>>();
private HashMap<Long, Integer> nextSeqNoInSession = new HashMap<Long, Integer>();
@ -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;
@ -2356,8 +2408,6 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
}
if (!doNotProcess) {
int messageLength = messageIs.readInt32();
int constructor = messageIs.readInt32();
TLObject message = TLClassStore.Instance().TLdeserialize(messageIs, constructor, getRequestWithMessageId(messageId));

View file

@ -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<String> addresses = new ArrayList<String>();
public HashMap<String, Integer> ports = new HashMap<String, Integer>();
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);

View file

@ -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) {

View file

@ -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) {

View file

@ -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);

View file

@ -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);

View file

@ -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<String, Object>();
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<String, Object>();
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<String, Object>();
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);

View file

@ -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<TLRPC.Message> arr = new ArrayList<TLRPC.Message>();
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<TLRPC.Message> arr = new ArrayList<TLRPC.Message>();
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);

View file

@ -58,6 +58,8 @@ public class RPCRequest {
boolean confirmed;
boolean initRequest = false;
ArrayList<Long> respondsToMessageIds = new ArrayList<Long>();
public void addRespondMessageId(long messageId) {

View file

@ -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);

View file

@ -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 "";
}
}

View file

@ -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);
}
}

View file

@ -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);

View file

@ -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<Integer> arr = new ArrayList<Integer>();
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);
}
}
}
}
}
}
}
}

View file

@ -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<ListItem> items = new ArrayList<ListItem>();
private boolean receiverRegistered = false;
private ArrayList<HistoryEntry> history = new ArrayList<HistoryEntry>();
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<File>() {
@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<String, ArrayList<String>> aliases = new HashMap<String, ArrayList<String>>();
ArrayList<String> result = new ArrayList<String>();
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<String>());
}
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;
}
}
}

View file

@ -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);

View file

@ -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();

View file

@ -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<TLRPC.PhotoSize> sizes = message.messageOwner.media.photo.sizes;
boolean set = false;
// for (TLRPC.PhotoSize size : sizes) {

View file

@ -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++;

View file

@ -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);

View file

@ -150,6 +150,7 @@ public class FrameLayoutFixed extends FrameLayout {
}
} catch (Exception e) {
FileLog.e("tmessages", e);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
}

View file

@ -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;
}
}

View file

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 869 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 875 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 883 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 652 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 444 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 501 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 764 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 651 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

View file

@ -0,0 +1,22 @@
<!--
~ 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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<solid android:color="#802a2a2a" />
</shape>
</item>
<item android:id="@android:id/progress">
<clip android:clipOrientation="horizontal" android:gravity="top|left">
<shape>
<solid android:color="#39b0dd" />
</shape>
</clip>
</item>
</layer-list>

View file

@ -0,0 +1,83 @@
<!--
~ 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.
-->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/HLRelativeLayout1"
android:layout_width="match_parent"
android:layout_height="64dp"
android:paddingLeft="13dp"
android:paddingRight="13dp">
<TextView
android:id="@+id/docs_item_type"
android:layout_width="55dp"
android:layout_height="42dp"
android:layout_marginTop="11dp"
android:background="#1A808080"
android:ellipsize="marquee"
android:gravity="center"
android:padding="5dp"
android:singleLine="true"
android:textColor="#919191"
android:textSize="16dp"
android:textStyle="bold"
android:layout_gravity="top|right"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="62dp"
android:layout_marginLeft="7dp"
android:layout_marginRight="66dp"
android:gravity="center_vertical"
android:orientation="vertical"
android:layout_gravity="top|right">
<TextView
android:id="@+id/docs_item_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:singleLine="true"
android:text="TextView"
android:textColor="#000"
android:textSize="18dp"
android:gravity="right"
android:layout_gravity="top|right"/>
<TextView
android:id="@+id/docs_item_info"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:ellipsize="marquee"
android:singleLine="true"
android:text="TextView"
android:textColor="#a6a6a6"
android:textSize="16dp"
android:gravity="right"
android:layout_gravity="top|right"/>
</LinearLayout>
<org.telegram.ui.Views.BackupImageView
android:id="@+id/docs_item_thumb"
android:layout_width="55dp"
android:layout_height="42dp"
android:scaleType="centerCrop"
android:layout_marginTop="11dp"
android:layout_gravity="top|right"/>
<View
android:background="@color/divider"
android:layout_width="fill_parent"
android:layout_height="1px"
android:layout_gravity="bottom"
android:id="@+id/settings_row_divider"/>
</FrameLayout>

View file

@ -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"/>
<LinearLayout
@ -27,7 +28,8 @@
android:baselineAligned="false"
android:id="@+id/chat_bubble_layout">
<FrameLayout android:layout_height="58dp"
<FrameLayout
android:layout_height="58dp"
android:layout_width="0dp"
android:id="@+id/shared_layout"
android:layout_weight="1">

View file

@ -0,0 +1,138 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="1dp"
android:paddingTop="1dp"
android:layout_gravity="top"
android:gravity="left">
<org.telegram.ui.Views.BackupImageView
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_marginLeft="6dp"
android:id="@+id/chat_group_avatar_image"
android:scaleType="fitCenter"
android:layout_marginBottom="2dp"
android:layout_marginRight="4dp"
android:layout_gravity="bottom"/>
<org.telegram.ui.Views.FrameLayoutFixed
android:orientation="horizontal"
android:layout_height="78dp"
android:layout_width="wrap_content"
android:paddingTop="9dp"
android:paddingLeft="18dp"
android:paddingRight="9dp"
android:layout_gravity="top|left"
android:id="@+id/chat_bubble_layout">
<org.telegram.ui.Views.FrameLayoutFixed
android:layout_height="69dp"
android:layout_width="wrap_content"
android:layout_gravity="top|right"
android:id="@+id/shared_layout">
<org.telegram.ui.Views.BackupImageView
android:layout_width="42dp"
android:layout_height="42dp"
android:background="#40b7c9d7"
android:src="@drawable/doc_blue"
android:scaleType="center"
android:id="@+id/contact_avatar"/>
<org.telegram.ui.Views.TightTextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginTop="3dp"
android:textSize="14dp"
android:lines="1"
android:singleLine="true"
android:layout_gravity="top"
android:ellipsize="end"
android:maxLines="1"
android:textColor="#000000"
android:layout_marginRight="2dp"
android:id="@+id/chat_user_group_name"
android:layout_marginLeft="50dp"/>
<org.telegram.ui.Views.TightTextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginLeft="50dp"
android:singleLine="true"
android:layout_marginTop="22dp"
android:layout_gravity="top"
android:layout_marginRight="2dp"
android:textSize="11dp"
android:maxLines="1"
android:textColor="#9daab8"
android:id="@+id/phone_text_view"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/chat_time_text"
android:textColor="#a1aab3"
android:textSize="12dp"
android:layout_marginBottom="5dp"
android:layout_gravity="bottom|right"/>
</org.telegram.ui.Views.FrameLayoutFixed>
</org.telegram.ui.Views.FrameLayoutFixed>
<org.telegram.ui.Views.FrameLayoutFixed
android:layout_height="wrap_content"
android:layout_width="140dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_gravity="center_vertical"
android:id="@+id/chat_view_action_layout"
android:visibility="gone">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:scaleType="centerInside"
android:layout_marginRight="4dp"
android:layout_gravity="right|center"
android:id="@+id/chat_view_action_cancel_button"
android:src="@drawable/ic_msg_btn_cross_custom"
android:clickable="true"/>
<ProgressBar
android:layout_width="fill_parent"
android:layout_height="3dp"
android:layout_gravity="left|center_vertical"
android:progressDrawable="@drawable/photo_progress_chat"
style="?android:attr/progressBarStyleHorizontal"
android:progress="50"
android:layout_marginLeft="12dp"
android:layout_marginRight="36dp"
android:id="@+id/chat_view_action_progress"
android:max="100"/>
</org.telegram.ui.Views.FrameLayoutFixed>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/DOWNLOAD"
android:textColor="#54759e"
android:background="@drawable/chat_incoming_media_states"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:id="@+id/chat_view_action_button"
android:textSize="14dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:descendantFocusability="blocksDescendants"
android:clickable="true"
android:gravity="center|left"
android:visibility="gone"
android:textStyle="bold"
android:layout_gravity="center_vertical|left"/>
</LinearLayout>

View file

@ -130,12 +130,13 @@
<ProgressBar
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_height="3dp"
android:layout_gravity="left|center_vertical"
android:progressDrawable="@drawable/photo_progress_chat"
style="?android:attr/progressBarStyleHorizontal"
android:progress="50"
android:layout_marginLeft="12dp"
android:layout_marginRight="36dp"
android:layout_gravity="center|left"
android:id="@+id/chat_view_action_progress"
android:max="100"/>

View file

@ -2,7 +2,6 @@
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="1dp"

View file

@ -0,0 +1,128 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="1dp"
android:paddingTop="1dp"
android:layout_gravity="top"
android:gravity="left">
<org.telegram.ui.Views.FrameLayoutFixed
android:orientation="horizontal"
android:layout_height="78dp"
android:layout_width="wrap_content"
android:paddingTop="9dp"
android:paddingLeft="18dp"
android:paddingRight="9dp"
android:layout_gravity="top|left"
android:id="@+id/chat_bubble_layout">
<org.telegram.ui.Views.FrameLayoutFixed
android:layout_height="69dp"
android:layout_width="wrap_content"
android:layout_gravity="top|right"
android:id="@+id/shared_layout">
<org.telegram.ui.Views.BackupImageView
android:layout_width="42dp"
android:layout_height="42dp"
android:background="#40b7c9d7"
android:src="@drawable/doc_blue"
android:scaleType="center"
android:id="@+id/contact_avatar"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:scrollHorizontally="true"
android:layout_marginTop="3dp"
android:textSize="14dp"
android:lines="1"
android:singleLine="true"
android:layout_marginRight="2dp"
android:layout_gravity="top"
android:ellipsize="end"
android:textColor="#000000"
android:id="@+id/chat_user_group_name"
android:maxLines="1"
android:layout_marginLeft="50dp"/>
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginTop="22dp"
android:layout_gravity="top"
android:layout_marginRight="2dp"
android:textSize="11dp"
android:maxLines="1"
android:singleLine="true"
android:textColor="#9daab8"
android:id="@+id/phone_text_view"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/chat_time_text"
android:textColor="#a1aab3"
android:textSize="12dp"
android:layout_gravity="bottom|right"
android:layout_marginBottom="5dp"/>
</org.telegram.ui.Views.FrameLayoutFixed>
</org.telegram.ui.Views.FrameLayoutFixed>
<org.telegram.ui.Views.FrameLayoutFixed
android:layout_height="wrap_content"
android:layout_width="140dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_gravity="center_vertical"
android:id="@+id/chat_view_action_layout"
android:visibility="gone">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:scaleType="centerInside"
android:layout_marginRight="4dp"
android:layout_gravity="right|center"
android:id="@+id/chat_view_action_cancel_button"
android:src="@drawable/ic_msg_btn_cross_custom"
android:clickable="true"/>
<ProgressBar
android:layout_width="fill_parent"
android:layout_height="3dp"
android:layout_gravity="left|center_vertical"
android:progressDrawable="@drawable/photo_progress_chat"
style="?android:attr/progressBarStyleHorizontal"
android:progress="50"
android:layout_marginLeft="12dp"
android:layout_marginRight="36dp"
android:id="@+id/chat_view_action_progress"
android:max="100"/>
</org.telegram.ui.Views.FrameLayoutFixed>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/DOWNLOAD"
android:textColor="#54759e"
android:background="@drawable/chat_incoming_media_states"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:id="@+id/chat_view_action_button"
android:textSize="14dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:descendantFocusability="blocksDescendants"
android:clickable="true"
android:gravity="center"
android:visibility="gone"
android:textStyle="bold"
android:layout_gravity="center_vertical"/>
</LinearLayout>

View file

@ -16,15 +16,16 @@
android:id="@+id/message_layout"
android:layout_gravity="top|left">
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textColor="#006fc8"
android:textSize="14dp"
android:maxLines="1"
android:ellipsize="end"
android:text="@string/ForwardedMessage"
android:layout_gravity="top|left"
android:id="@+id/chat_text_forward_text"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textColor="#006fc8"
android:textSize="14dp"
android:maxLines="1"
android:ellipsize="end"
android:text="@string/ForwardedMessage"
android:layout_gravity="top|left"
android:id="@+id/chat_text_forward_text"/>
<TextView
android:layout_height="wrap_content"

View file

@ -101,7 +101,8 @@
android:textStyle="bold"
android:layout_marginLeft="10dp"/>
<org.telegram.ui.Views.FrameLayoutFixed android:layout_height="wrap_content"
<org.telegram.ui.Views.FrameLayoutFixed
android:layout_height="wrap_content"
android:layout_width="140dp"
android:layout_marginLeft="10dp"
android:layout_gravity="center_vertical"
@ -120,12 +121,13 @@
<ProgressBar
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_height="3dp"
android:layout_gravity="left|center_vertical"
android:progressDrawable="@drawable/photo_progress_chat"
style="?android:attr/progressBarStyleHorizontal"
android:progress="50"
android:layout_marginLeft="12dp"
android:layout_marginRight="36dp"
android:layout_gravity="center|left"
android:id="@+id/chat_view_action_progress"
android:max="100"/>

View file

@ -28,7 +28,7 @@
android:textSize="14dp"
android:id="@+id/searchEmptyView"
android:visibility="gone"
android:layout_centerInParent="true"/>
android:layout_gravity="center"/>
<include
layout="@layout/encrypted_chat_placeholder"

View file

@ -2,7 +2,6 @@
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="1dp"
@ -106,4 +105,5 @@
</FrameLayout>
</LinearLayout>
</FrameLayout>

View file

@ -0,0 +1,155 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="1dp"
android:paddingTop="1dp"
android:layout_gravity="top"
android:gravity="right">
<org.telegram.ui.Views.FrameLayoutFixed
android:layout_height="wrap_content"
android:layout_width="140dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:id="@+id/chat_view_action_layout"
android:layout_gravity="center"
android:visibility="gone">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:scaleType="centerInside"
android:layout_marginLeft="4dp"
android:id="@+id/chat_view_action_cancel_button"
android:src="@drawable/ic_msg_btn_cross_custom"
android:layout_gravity="left|center"
android:clickable="true"/>
<ProgressBar
android:layout_width="fill_parent"
android:layout_height="3dp"
style="?android:attr/progressBarStyleHorizontal"
android:progress="50"
android:layout_marginLeft="36dp"
android:layout_marginRight="12dp"
android:layout_gravity="right|center_vertical"
android:progressDrawable="@drawable/photo_progress_chat"
android:id="@+id/chat_view_action_progress"
android:max="100"/>
</org.telegram.ui.Views.FrameLayoutFixed>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/DOWNLOAD"
android:textColor="#54759e"
android:background="@drawable/chat_incoming_media_states"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:id="@+id/chat_view_action_button"
android:textSize="14dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:descendantFocusability="blocksDescendants"
android:clickable="true"
android:gravity="center"
android:visibility="gone"
android:textStyle="bold"
android:layout_gravity="center"/>
<org.telegram.ui.Views.FrameLayoutFixed
android:layout_height="78dp"
android:layout_width="wrap_content"
android:paddingTop="9dp"
android:paddingLeft="9dp"
android:paddingRight="18dp"
android:layout_gravity="top|right"
android:id="@+id/chat_bubble_layout">
<org.telegram.ui.Views.FrameLayoutFixed
android:layout_height="69dp"
android:layout_width="wrap_content"
android:layout_gravity="top|right"
android:id="@+id/shared_layout">
<org.telegram.ui.Views.BackupImageView
android:layout_width="42dp"
android:layout_height="42dp"
android:background="#408ed057"
android:src="@drawable/doc_green"
android:scaleType="center"
android:id="@+id/contact_avatar"/>
<org.telegram.ui.Views.TightTextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:scrollHorizontally="true"
android:layout_marginTop="3dp"
android:textSize="14dp"
android:lines="1"
android:singleLine="true"
android:layout_marginRight="2dp"
android:layout_gravity="top"
android:ellipsize="end"
android:textColor="#000000"
android:id="@+id/chat_user_group_name"
android:layout_marginLeft="50dp"/>
<org.telegram.ui.Views.TightTextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginTop="22dp"
android:layout_gravity="top"
android:layout_marginRight="2dp"
android:textSize="11dp"
android:maxLines="1"
android:textColor="#75b166"
android:id="@+id/phone_text_view"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/chat_time_layout"
android:layout_gravity="bottom|right"
android:layout_marginBottom="5dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/chat_time_text"
android:textColor="#70b15c"
android:textSize="12dp"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/msg_check"
android:layout_marginTop="2dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="-8dp"
android:id="@+id/chat_row_check"
android:visibility="visible"
android:layout_gravity="top"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/msg_halfcheck"
android:layout_marginTop="2dp"
android:id="@+id/chat_row_halfcheck"
android:visibility="visible"
android:layout_gravity="top"/>
</LinearLayout>
</org.telegram.ui.Views.FrameLayoutFixed>
</org.telegram.ui.Views.FrameLayoutFixed>
</LinearLayout>

View file

@ -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">
<ImageView
android:layout_width="30dp"
@ -29,12 +29,13 @@
<ProgressBar
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_height="3dp"
android:layout_gravity="right|center_vertical"
android:progressDrawable="@drawable/photo_progress_chat"
style="?android:attr/progressBarStyleHorizontal"
android:progress="50"
android:layout_marginLeft="36dp"
android:layout_marginRight="12dp"
android:layout_gravity="right|center"
android:id="@+id/chat_view_action_progress"
android:max="100"/>
@ -55,7 +56,8 @@
android:clickable="true"
android:gravity="center"
android:textStyle="bold"
android:layout_gravity="center"/>
android:layout_gravity="center"
android:visibility="gone"/>
<org.telegram.ui.Views.FrameLayoutFixed
android:layout_width="wrap_content"

View file

@ -29,12 +29,13 @@
<ProgressBar
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_height="3dp"
android:layout_gravity="right|center_vertical"
android:progressDrawable="@drawable/photo_progress_chat"
style="?android:attr/progressBarStyleHorizontal"
android:progress="50"
android:layout_marginLeft="36dp"
android:layout_marginRight="12dp"
android:layout_gravity="right|center"
android:id="@+id/chat_view_action_progress"
android:max="100"/>

View file

@ -0,0 +1,73 @@
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/HLRelativeLayout1"
android:layout_width="match_parent"
android:layout_height="64dp"
android:paddingLeft="13dp"
android:paddingRight="13dp">
<TextView
android:id="@+id/docs_item_type"
android:layout_width="55dp"
android:layout_height="42dp"
android:layout_marginTop="11dp"
android:background="#1A808080"
android:ellipsize="marquee"
android:gravity="center"
android:padding="5dp"
android:singleLine="true"
android:textColor="#919191"
android:textSize="16dp"
android:textStyle="bold"
android:layout_gravity="top|left"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="62dp"
android:layout_marginRight="7dp"
android:layout_marginLeft="66dp"
android:gravity="center_vertical"
android:orientation="vertical"
android:layout_gravity="top|left">
<TextView
android:id="@+id/docs_item_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:singleLine="true"
android:text="TextView"
android:textColor="#000"
android:textSize="18dp"
android:layout_gravity="top|left"/>
<TextView
android:id="@+id/docs_item_info"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:ellipsize="marquee"
android:singleLine="true"
android:text="TextView"
android:textColor="#a6a6a6"
android:textSize="16dp"
android:layout_gravity="top|left"/>
</LinearLayout>
<org.telegram.ui.Views.BackupImageView
android:id="@+id/docs_item_thumb"
android:layout_width="55dp"
android:layout_height="42dp"
android:scaleType="centerCrop"
android:layout_marginTop="11dp"
android:layout_gravity="top|left"/>
<View
android:background="@color/divider"
android:layout_width="fill_parent"
android:layout_height="1px"
android:layout_gravity="bottom"
android:id="@+id/settings_row_divider"/>
</FrameLayout>

View file

@ -0,0 +1,28 @@
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/listView"
android:clipToPadding="false"
android:fadingEdge="none"
android:fadingEdgeLength="0dp"
android:dividerHeight="0dp"
android:divider="@null"
android:scrollbars="none"
android:cacheColorHint="#ffffffff"/>
<TextView android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="#808080"
android:gravity="center"
android:text="@string/NoFiles"
android:textSize="24dp"
android:id="@+id/searchEmptyView"
android:visibility="gone"
android:layout_gravity="top"/>
</FrameLayout>

View file

@ -24,6 +24,11 @@
android:title="@string/ChatVideo"
android:id="@+id/attach_video"/>
<item
android:icon="@drawable/ic_ab_doc"
android:title="@string/ChatDocument"
android:id="@+id/attach_document"/>
<item
android:icon="@drawable/ic_attach_location"
android:title="@string/ChatLocation"

View file

@ -47,6 +47,20 @@
<string name="ClearHistory">مسح سجل التاريخ</string>
<string name="DeleteChat">حذف وخروج</string>
<!--documents view-->
<string name="SelectFile">اختر ملف</string>
<string name="FreeOfTotal">متاح %1$s من %2$s</string>
<string name="UnknownError">حدث خطأ غير معروف</string>
<string name="AccessError">خطأ في الوصول</string>
<string name="NoFiles">لا يوجد ملفات بعد...</string>
<string name="FileUploadLimit">حجم الملف لا يمكن أن يكون أكبر من %1$s</string>
<string name="NotMounted">الذاكرة غير مثبتة</string>
<string name="UsbActive">نقل اليو إس بي مفعل</string>
<string name="InternalStorage">الذاكرة الداخلية</string>
<string name="ExternalStorage">الذاكرة الخارجية</string>
<string name="SystemRoot">جذر النظام</string>
<string name="SdCard">بطاقة الذاكرة</string>
<!--chat view-->
<string name="Invisible">مخفي</string>
<string name="Typing">جاري الكتابة… </string>
@ -59,6 +73,7 @@
<string name="ChatGallery">صورة</string>
<string name="ChatLocation"> موقع</string>
<string name="ChatVideo">مقطع مرئي</string>
<string name="ChatDocument">مستند</string>
<string name="NoMessages">...لا توجد رسائل بعد</string>
<string name="ViewPhoto">عرض الصورة</string>
<string name="ViewLocation">عرض الموقع</string>
@ -105,12 +120,16 @@
<string name="NotificationMessageVideo">%1$s قام بإرسال مقطع مرئي لك</string>
<string name="NotificationMessageContact">%1$s قام بإرسال جهة اتصال لك</string>
<string name="NotificationMessageMap">%1$s قام بإرسال خريطة لك</string>
<string name="NotificationMessageDocument">%1$s قام بإرسال مستند لك</string>
<string name="NotificationMessageAudio">%1$s قام بإرسال مقطع صوتي لك</string>
<string name="NotificationMessageGroupText">%1$s @ %2$s: %3$s</string>
<string name="NotificationMessageGroupNoText">%1$s قام بإرسال رسالة للمجموعة %2$s</string>
<string name="NotificationMessageGroupPhoto">%1$s قام بإرسال صورة للمجموعة %2$s</string>
<string name="NotificationMessageGroupVideo">%1$s قام بإرسال مقطع مرئي للمجموعة %2$s</string>
<string name="NotificationMessageGroupContact">%1$s قام بإرسال جهة اتصال للمجموعة %2$s</string>
<string name="NotificationMessageGroupMap">%1$s قام بإرسال خريطة للمجموعة %2$s</string>
<string name="NotificationMessageGroupDocument">%1$s قام بإرسال مستند للمجموعة %2$s</string>
<string name="NotificationMessageGroupAudio">%1$s قام بإرسال مقطع صوتي للمجموعة %2$s</string>
<string name="NotificationInvitedToGroup">%1$s قام بدعوتك للمجموعة %2$s</string>
<string name="NotificationEditedGroupName">%1$s قام بتعديل اسم المجموعة %2$s</string>
<string name="NotificationEditedGroupPhoto">%1$s قام بتغيير صورة المجموعة %2$s</string>
@ -235,6 +254,7 @@
<string name="Next">التالي</string>
<string name="Back">رجوع</string>
<string name="Done">تم</string>
<string name="Open">فتح</string>
<string name="Cancel">إلغاء</string>
<string name="Add">إضافة</string>
<string name="Edit">تعديل</string>
@ -264,6 +284,8 @@
<string name="AttachVideo">مقطع مرئي</string>
<string name="AttachLocation">موقع</string>
<string name="AttachContact">جهة اتصال</string>
<string name="AttachDocument">مستند</string>
<string name="AttachAudio">مقطع صوتي</string>
<string name="FromYou">أنت</string>
<!--Alert messages-->
@ -275,6 +297,7 @@
<string name="InvalidLastName">اسم العائلة غير صحيح</string>
<string name="Loading">جاري التحميل ...</string>
<string name="NoPlayerInstalled">ليس لديك أي مشغل مقاطع مرئية، يرجى تنزيل أية مشغل</string>
<string name="NoHandleAppInstalled">لا يوجد لديك تطبيق يمكنه فته هذا المستند، يرجى تنزيل تطبيق يمكنه للإستمرار</string>
<string name="InviteUser">هذا المستخدم ليس لديه تيليجرام بعد ، هل ترغب في دعوته الآن؟</string>
<string name="AreYouSure">هل أنت متأكد؟</string>
<string name="DeleteChatQuestion">هل تريد حذف هذه الدردشة؟</string>

View file

@ -47,6 +47,20 @@
<string name="ClearHistory">Clear History</string>
<string name="DeleteChat">Delete and Exit</string>
<!--documents view-->
<string name="SelectFile">Select File</string>
<string name="FreeOfTotal">Free %1$s of %2$s</string>
<string name="UnknownError">Unknown error</string>
<string name="AccessError">Access error</string>
<string name="NoFiles">No files yet...</string>
<string name="FileUploadLimit">File size shouldn\'t be greater than %1$s</string>
<string name="NotMounted">Storage not mounted</string>
<string name="UsbActive">Usb transfer active</string>
<string name="InternalStorage">Internal Storage</string>
<string name="ExternalStorage">External Storage</string>
<string name="SystemRoot">System Root</string>
<string name="SdCard">SD Card</string>
<!--chat view-->
<string name="Invisible">invisible</string>
<string name="Typing">typing...</string>
@ -59,6 +73,7 @@
<string name="ChatGallery">Gallery</string>
<string name="ChatLocation">Location</string>
<string name="ChatVideo">Video</string>
<string name="ChatDocument">Document</string>
<string name="NoMessages">No messages here yet...</string>
<string name="ViewPhoto">View Photo</string>
<string name="ViewLocation">View Location</string>
@ -105,12 +120,16 @@
<string name="NotificationMessageVideo">%1$s sent you a video</string>
<string name="NotificationMessageContact">%1$s shared a contact with you</string>
<string name="NotificationMessageMap">%1$s sent you a map</string>
<string name="NotificationMessageDocument">%1$s sent you a document</string>
<string name="NotificationMessageAudio">%1$s sent you an audio</string>
<string name="NotificationMessageGroupText">%1$s @ %2$s: %3$s</string>
<string name="NotificationMessageGroupNoText">%1$s sent a message to the group %2$s</string>
<string name="NotificationMessageGroupPhoto">%1$s sent a photo to the group %2$s</string>
<string name="NotificationMessageGroupVideo">%1$s sent a video to the group %2$s</string>
<string name="NotificationMessageGroupContact">%1$s shared a contact in the group %2$s</string>
<string name="NotificationMessageGroupMap">%1$s sent a map to the group %2$s</string>
<string name="NotificationMessageGroupDocument">%1$s sent a document to the group %2$s</string>
<string name="NotificationMessageGroupAudio">%1$s sent an audio to the group %2$s</string>
<string name="NotificationInvitedToGroup">%1$s invited you to the group %2$s</string>
<string name="NotificationEditedGroupName">%1$s edited the group\'s %2$s name</string>
<string name="NotificationEditedGroupPhoto">%1$s edited the group\'s %2$s photo</string>
@ -235,6 +254,7 @@
<string name="Next">Next</string>
<string name="Back">Back</string>
<string name="Done">Done</string>
<string name="Open">Open</string>
<string name="Cancel">Cancel</string>
<string name="Add">Add</string>
<string name="Edit">Edit</string>
@ -264,6 +284,8 @@
<string name="AttachVideo">Video</string>
<string name="AttachLocation">Location</string>
<string name="AttachContact">Contact</string>
<string name="AttachDocument">Document</string>
<string name="AttachAudio">Audio</string>
<string name="FromYou">You</string>
<!--Alert messages-->
@ -275,6 +297,7 @@
<string name="InvalidLastName">Invalid last name</string>
<string name="Loading">Loading...</string>
<string name="NoPlayerInstalled">You don\'t have a video player, please install one to continue</string>
<string name="NoHandleAppInstalled">You don\'t have any application that can handle with mime type \'%1$s\', please install one to continue</string>
<string name="InviteUser">This user does not have Telegram yet, send an invitation?</string>
<string name="AreYouSure">Are you sure?</string>
<string name="AddContactQ">Add contact?</string>