diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 3d0a989b1..c83bc962a 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -3,15 +3,15 @@ import cn.hutool.core.util.RuntimeUtil apply plugin: "com.android.application" apply plugin: "kotlin-android" -def verName = "8.3.1-1" -def verCode = 515 +def verName = "8.4.2-preview01" +def verCode = 520 if (System.getenv("DEBUG_BUILD") == "true") { verName += "-" + RuntimeUtil.execForStr("git log --pretty=format:'%h' -n 1") } -def officialVer = "8.3.1" -def officialCode = 2495 +def officialVer = "8.4.2" +def officialCode = 2526 def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json") diff --git a/TMessagesProj/proguard-rules.pro b/TMessagesProj/proguard-rules.pro index b3dbe039c..8956fc6e7 100644 --- a/TMessagesProj/proguard-rules.pro +++ b/TMessagesProj/proguard-rules.pro @@ -69,8 +69,8 @@ -keep class tw.nekomimi.nekogram.InternalUpdater$NekoXReleaseNote { *; } -keep class tw.nekomimi.nekogram.InternalUpdater$NekoXAPK { *; } --keep class tw.nekomimi.nkmr.MiniCDNDrive$metaJSON { *; } --keep class tw.nekomimi.nkmr.MiniCDNDrive$metaJSON_Block { *; } +## https://developers.google.com/ml-kit/known-issues#android_issues +#-keep class com.google.mlkit.nl.languageid.internal.LanguageIdentificationJni { *; } # Constant folding for resource integers may mean that a resource passed to this method appears to be unused. Keep the method to prevent this from happening. -keep class com.google.android.exoplayer2.upstream.RawResourceDataSource { diff --git a/TMessagesProj/src/gservcies/java/org/telegram/messenger/GcmPushListenerService.java b/TMessagesProj/src/gservcies/java/org/telegram/messenger/GcmPushListenerService.java index c1c63b045..86f868f54 100644 --- a/TMessagesProj/src/gservcies/java/org/telegram/messenger/GcmPushListenerService.java +++ b/TMessagesProj/src/gservcies/java/org/telegram/messenger/GcmPushListenerService.java @@ -315,6 +315,11 @@ public class GcmPushListenerService extends FirebaseMessagingService { processNotification = true; } } + + if (loc_key.startsWith("REACT_") || loc_key.startsWith("CHAT_REACT_")) { + processNotification = true; + } + if (processNotification) { long chat_from_id = custom.optLong("chat_from_id", 0); long chat_from_broadcast_id = custom.optLong("chat_from_broadcast_id", 0); @@ -361,7 +366,9 @@ public class GcmPushListenerService extends FirebaseMessagingService { if (BuildVars.LOGS_ENABLED) { FileLog.d("GCM received message notification " + loc_key + " for dialogId = " + dialogId + " mid = " + msg_id); } - switch (loc_key) { + if (loc_key.startsWith("REACT_") || loc_key.startsWith("CHAT_REACT_")) { + messageText = getReactedText(loc_key, args); + } else {switch (loc_key) { case "MESSAGE_TEXT": case "CHANNEL_MESSAGE_TEXT": { messageText = LocaleController.formatString("NotificationMessageText", R.string.NotificationMessageText, args[0], args[1]); @@ -745,274 +752,279 @@ public class GcmPushListenerService extends FirebaseMessagingService { break; } case "CHAT_MESSAGE_FWDS": { - messageText = LocaleController.formatString("NotificationGroupForwardedFew", R.string.NotificationGroupForwardedFew, args[0], args[1], LocaleController.formatPluralString("messages", Utilities.parseInt(args[2]))); - localMessage = true; - break; - } - case "CHAT_MESSAGE_PHOTOS": { - messageText = LocaleController.formatString("NotificationGroupFew", R.string.NotificationGroupFew, args[0], args[1], LocaleController.formatPluralString("Photos", Utilities.parseInt(args[2]))); - localMessage = true; - break; - } - case "CHAT_MESSAGE_VIDEOS": { - messageText = LocaleController.formatString("NotificationGroupFew", R.string.NotificationGroupFew, args[0], args[1], LocaleController.formatPluralString("Videos", Utilities.parseInt(args[2]))); - localMessage = true; - break; - } - case "CHAT_MESSAGE_PLAYLIST": { - messageText = LocaleController.formatString("NotificationGroupFew", R.string.NotificationGroupFew, args[0], args[1], LocaleController.formatPluralString("MusicFiles", Utilities.parseInt(args[2]))); - localMessage = true; - break; - } - case "CHAT_MESSAGE_DOCS": { - messageText = LocaleController.formatString("NotificationGroupFew", R.string.NotificationGroupFew, args[0], args[1], LocaleController.formatPluralString("Files", Utilities.parseInt(args[2]))); - localMessage = true; - break; - } - case "CHAT_MESSAGES": { - messageText = LocaleController.formatString("NotificationGroupAlbum", R.string.NotificationGroupAlbum, args[0], args[1]); - localMessage = true; - break; - } - case "PINNED_TEXT": { - if (dialogId > 0) { - messageText = LocaleController.formatString("NotificationActionPinnedTextUser", R.string.NotificationActionPinnedTextUser, args[0], args[1]); - } else { - if (isGroup) { - messageText = LocaleController.formatString("NotificationActionPinnedText", R.string.NotificationActionPinnedText, args[0], args[1], args[2]); - } else { - messageText = LocaleController.formatString("NotificationActionPinnedTextChannel", R.string.NotificationActionPinnedTextChannel, args[0], args[1]); - } + messageText = LocaleController.formatString("NotificationGroupForwardedFew", R.string.NotificationGroupForwardedFew, args[0], args[1], LocaleController.formatPluralString("messages", Utilities.parseInt(args[2]))); + localMessage = true; + break; } - break; - } - case "PINNED_NOTEXT": { - if (dialogId > 0) { - messageText = LocaleController.formatString("NotificationActionPinnedNoTextUser", R.string.NotificationActionPinnedNoTextUser, args[0], args[1]); - } else { - if (isGroup) { - messageText = LocaleController.formatString("NotificationActionPinnedNoText", R.string.NotificationActionPinnedNoText, args[0], args[1]); - } else { - messageText = LocaleController.formatString("NotificationActionPinnedNoTextChannel", R.string.NotificationActionPinnedNoTextChannel, args[0]); - } + case "CHAT_MESSAGE_PHOTOS": { + messageText = LocaleController.formatString("NotificationGroupFew", R.string.NotificationGroupFew, args[0], args[1], LocaleController.formatPluralString("Photos", Utilities.parseInt(args[2]))); + localMessage = true; + break; } - break; - } - case "PINNED_PHOTO": { - if (dialogId > 0) { - messageText = LocaleController.formatString("NotificationActionPinnedPhotoUser", R.string.NotificationActionPinnedPhotoUser, args[0], args[1]); - } else { - if (isGroup) { - messageText = LocaleController.formatString("NotificationActionPinnedPhoto", R.string.NotificationActionPinnedPhoto, args[0], args[1]); - } else { - messageText = LocaleController.formatString("NotificationActionPinnedPhotoChannel", R.string.NotificationActionPinnedPhotoChannel, args[0]); - } + case "CHAT_MESSAGE_VIDEOS": { + messageText = LocaleController.formatString("NotificationGroupFew", R.string.NotificationGroupFew, args[0], args[1], LocaleController.formatPluralString("Videos", Utilities.parseInt(args[2]))); + localMessage = true; + break; } - break; - } - case "PINNED_VIDEO": { - if (dialogId > 0) { - messageText = LocaleController.formatString("NotificationActionPinnedVideoUser", R.string.NotificationActionPinnedVideoUser, args[0], args[1]); - } else { - if (isGroup) { - messageText = LocaleController.formatString("NotificationActionPinnedVideo", R.string.NotificationActionPinnedVideo, args[0], args[1]); - } else { - messageText = LocaleController.formatString("NotificationActionPinnedVideoChannel", R.string.NotificationActionPinnedVideoChannel, args[0]); - } + case "CHAT_MESSAGE_PLAYLIST": { + messageText = LocaleController.formatString("NotificationGroupFew", R.string.NotificationGroupFew, args[0], args[1], LocaleController.formatPluralString("MusicFiles", Utilities.parseInt(args[2]))); + localMessage = true; + break; } - break; - } - case "PINNED_ROUND": { - if (dialogId > 0) { - messageText = LocaleController.formatString("NotificationActionPinnedRoundUser", R.string.NotificationActionPinnedRoundUser, args[0], args[1]); - } else { - if (isGroup) { - messageText = LocaleController.formatString("NotificationActionPinnedRound", R.string.NotificationActionPinnedRound, args[0], args[1]); - } else { - messageText = LocaleController.formatString("NotificationActionPinnedRoundChannel", R.string.NotificationActionPinnedRoundChannel, args[0]); - } + case "CHAT_MESSAGE_DOCS": { + messageText = LocaleController.formatString("NotificationGroupFew", R.string.NotificationGroupFew, args[0], args[1], LocaleController.formatPluralString("Files", Utilities.parseInt(args[2]))); + localMessage = true; + break; } - break; - } - case "PINNED_DOC": { - if (dialogId > 0) { - messageText = LocaleController.formatString("NotificationActionPinnedFileUser", R.string.NotificationActionPinnedFileUser, args[0], args[1]); - } else { - if (isGroup) { - messageText = LocaleController.formatString("NotificationActionPinnedFile", R.string.NotificationActionPinnedFile, args[0], args[1]); - } else { - messageText = LocaleController.formatString("NotificationActionPinnedFileChannel", R.string.NotificationActionPinnedFileChannel, args[0]); - } + case "CHAT_MESSAGES": { + messageText = LocaleController.formatString("NotificationGroupAlbum", R.string.NotificationGroupAlbum, args[0], args[1]); + localMessage = true; + break; } - break; - } - case "PINNED_STICKER": { - if (dialogId > 0) { - if (args.length > 1 && !TextUtils.isEmpty(args[1])) { - messageText = LocaleController.formatString("NotificationActionPinnedStickerEmojiUser", R.string.NotificationActionPinnedStickerEmojiUser, args[0], args[1]); + case "PINNED_TEXT": { + if (dialogId > 0) { + messageText = LocaleController.formatString("NotificationActionPinnedTextUser", R.string.NotificationActionPinnedTextUser, args[0], args[1]); } else { - messageText = LocaleController.formatString("NotificationActionPinnedStickerUser", R.string.NotificationActionPinnedStickerUser, args[0]); - } - } else { - if (isGroup) { - if (args.length > 2 && !TextUtils.isEmpty(args[2])) { - messageText = LocaleController.formatString("NotificationActionPinnedStickerEmoji", R.string.NotificationActionPinnedStickerEmoji, args[0], args[2], args[1]); + if (isGroup) { + messageText = LocaleController.formatString("NotificationActionPinnedText", R.string.NotificationActionPinnedText, args[0], args[1], args[2]); } else { - messageText = LocaleController.formatString("NotificationActionPinnedSticker", R.string.NotificationActionPinnedSticker, args[0], args[1]); + messageText = LocaleController.formatString("NotificationActionPinnedTextChannel", R.string.NotificationActionPinnedTextChannel, args[0], args[1]); } + } + break; + } + case "PINNED_NOTEXT": { + if (dialogId > 0) { + messageText = LocaleController.formatString("NotificationActionPinnedNoTextUser", R.string.NotificationActionPinnedNoTextUser, args[0], args[1]); } else { + if (isGroup) { + messageText = LocaleController.formatString("NotificationActionPinnedNoText", R.string.NotificationActionPinnedNoText, args[0], args[1]); + } else { + messageText = LocaleController.formatString("NotificationActionPinnedNoTextChannel", R.string.NotificationActionPinnedNoTextChannel, args[0]); + } + } + break; + } + case "PINNED_PHOTO": { + if (dialogId > 0) { + messageText = LocaleController.formatString("NotificationActionPinnedPhotoUser", R.string.NotificationActionPinnedPhotoUser, args[0], args[1]); + } else { + if (isGroup) { + messageText = LocaleController.formatString("NotificationActionPinnedPhoto", R.string.NotificationActionPinnedPhoto, args[0], args[1]); + } else { + messageText = LocaleController.formatString("NotificationActionPinnedPhotoChannel", R.string.NotificationActionPinnedPhotoChannel, args[0]); + } + } + break; + } + case "PINNED_VIDEO": { + if (dialogId > 0) { + messageText = LocaleController.formatString("NotificationActionPinnedVideoUser", R.string.NotificationActionPinnedVideoUser, args[0], args[1]); + } else { + if (isGroup) { + messageText = LocaleController.formatString("NotificationActionPinnedVideo", R.string.NotificationActionPinnedVideo, args[0], args[1]); + } else { + messageText = LocaleController.formatString("NotificationActionPinnedVideoChannel", R.string.NotificationActionPinnedVideoChannel, args[0]); + } + } + break; + } + case "PINNED_ROUND": { + if (dialogId > 0) { + messageText = LocaleController.formatString("NotificationActionPinnedRoundUser", R.string.NotificationActionPinnedRoundUser, args[0], args[1]); + } else { + if (isGroup) { + messageText = LocaleController.formatString("NotificationActionPinnedRound", R.string.NotificationActionPinnedRound, args[0], args[1]); + } else { + messageText = LocaleController.formatString("NotificationActionPinnedRoundChannel", R.string.NotificationActionPinnedRoundChannel, args[0]); + } + } + break; + } + case "PINNED_DOC": { + if (dialogId > 0) { + messageText = LocaleController.formatString("NotificationActionPinnedFileUser", R.string.NotificationActionPinnedFileUser, args[0], args[1]); + } else { + if (isGroup) { + messageText = LocaleController.formatString("NotificationActionPinnedFile", R.string.NotificationActionPinnedFile, args[0], args[1]); + } else { + messageText = LocaleController.formatString("NotificationActionPinnedFileChannel", R.string.NotificationActionPinnedFileChannel, args[0]); + } + } + break; + } + case "PINNED_STICKER": { + if (dialogId > 0) { if (args.length > 1 && !TextUtils.isEmpty(args[1])) { - messageText = LocaleController.formatString("NotificationActionPinnedStickerEmojiChannel", R.string.NotificationActionPinnedStickerEmojiChannel, args[0], args[1]); + messageText = LocaleController.formatString("NotificationActionPinnedStickerEmojiUser", R.string.NotificationActionPinnedStickerEmojiUser, args[0], args[1]); } else { - messageText = LocaleController.formatString("NotificationActionPinnedStickerChannel", R.string.NotificationActionPinnedStickerChannel, args[0]); + messageText = LocaleController.formatString("NotificationActionPinnedStickerUser", R.string.NotificationActionPinnedStickerUser, args[0]); + } + } else { + if (isGroup) { + if (args.length > 2 && !TextUtils.isEmpty(args[2])) { + messageText = LocaleController.formatString("NotificationActionPinnedStickerEmoji", R.string.NotificationActionPinnedStickerEmoji, args[0], args[2], args[1]); + } else { + messageText = LocaleController.formatString("NotificationActionPinnedSticker", R.string.NotificationActionPinnedSticker, args[0], args[1]); + } + } else { + if (args.length > 1 && !TextUtils.isEmpty(args[1])) { + messageText = LocaleController.formatString("NotificationActionPinnedStickerEmojiChannel", R.string.NotificationActionPinnedStickerEmojiChannel, args[0], args[1]); + } else { + messageText = LocaleController.formatString("NotificationActionPinnedStickerChannel", R.string.NotificationActionPinnedStickerChannel, args[0]); + } } } + break; } - break; - } - case "PINNED_AUDIO": { - if (dialogId > 0) { - messageText = LocaleController.formatString("NotificationActionPinnedVoiceUser", R.string.NotificationActionPinnedVoiceUser, args[0], args[1]); - } else { - if (isGroup) { - messageText = LocaleController.formatString("NotificationActionPinnedVoice", R.string.NotificationActionPinnedVoice, args[0], args[1]); + case "PINNED_AUDIO": { + if (dialogId > 0) { + messageText = LocaleController.formatString("NotificationActionPinnedVoiceUser", R.string.NotificationActionPinnedVoiceUser, args[0], args[1]); } else { - messageText = LocaleController.formatString("NotificationActionPinnedVoiceChannel", R.string.NotificationActionPinnedVoiceChannel, args[0]); + if (isGroup) { + messageText = LocaleController.formatString("NotificationActionPinnedVoice", R.string.NotificationActionPinnedVoice, args[0], args[1]); + } else { + messageText = LocaleController.formatString("NotificationActionPinnedVoiceChannel", R.string.NotificationActionPinnedVoiceChannel, args[0]); + } } + break; } - break; - } - case "PINNED_CONTACT": { - if (dialogId > 0) { - messageText = LocaleController.formatString("NotificationActionPinnedContactUser", R.string.NotificationActionPinnedContactUser, args[0], args[1]); - } else { - if (isGroup) { - messageText = LocaleController.formatString("NotificationActionPinnedContact2", R.string.NotificationActionPinnedContact2, args[0], args[2], args[1]); + case "PINNED_CONTACT": { + if (dialogId > 0) { + messageText = LocaleController.formatString("NotificationActionPinnedContactUser", R.string.NotificationActionPinnedContactUser, args[0], args[1]); } else { - messageText = LocaleController.formatString("NotificationActionPinnedContactChannel2", R.string.NotificationActionPinnedContactChannel2, args[0], args[1]); + if (isGroup) { + messageText = LocaleController.formatString("NotificationActionPinnedContact2", R.string.NotificationActionPinnedContact2, args[0], args[2], args[1]); + } else { + messageText = LocaleController.formatString("NotificationActionPinnedContactChannel2", R.string.NotificationActionPinnedContactChannel2, args[0], args[1]); + } } + break; } - break; - } - case "PINNED_QUIZ": { - if (dialogId > 0) { - messageText = LocaleController.formatString("NotificationActionPinnedQuizUser", R.string.NotificationActionPinnedQuizUser, args[0], args[1]); - } else { - if (isGroup) { - messageText = LocaleController.formatString("NotificationActionPinnedQuiz2", R.string.NotificationActionPinnedQuiz2, args[0], args[2], args[1]); + case "PINNED_QUIZ": { + if (dialogId > 0) { + messageText = LocaleController.formatString("NotificationActionPinnedQuizUser", R.string.NotificationActionPinnedQuizUser, args[0], args[1]); } else { - messageText = LocaleController.formatString("NotificationActionPinnedQuizChannel2", R.string.NotificationActionPinnedQuizChannel2, args[0], args[1]); + if (isGroup) { + messageText = LocaleController.formatString("NotificationActionPinnedQuiz2", R.string.NotificationActionPinnedQuiz2, args[0], args[2], args[1]); + } else { + messageText = LocaleController.formatString("NotificationActionPinnedQuizChannel2", R.string.NotificationActionPinnedQuizChannel2, args[0], args[1]); + } } + break; } - break; - } - case "PINNED_POLL": { - if (dialogId > 0) { - messageText = LocaleController.formatString("NotificationActionPinnedPollUser", R.string.NotificationActionPinnedPollUser, args[0], args[1]); - } else { - if (isGroup) { - messageText = LocaleController.formatString("NotificationActionPinnedPoll2", R.string.NotificationActionPinnedPoll2, args[0], args[2], args[1]); + case "PINNED_POLL": { + if (dialogId > 0) { + messageText = LocaleController.formatString("NotificationActionPinnedPollUser", R.string.NotificationActionPinnedPollUser, args[0], args[1]); } else { - messageText = LocaleController.formatString("NotificationActionPinnedPollChannel2", R.string.NotificationActionPinnedPollChannel2, args[0], args[1]); + if (isGroup) { + messageText = LocaleController.formatString("NotificationActionPinnedPoll2", R.string.NotificationActionPinnedPoll2, args[0], args[2], args[1]); + } else { + messageText = LocaleController.formatString("NotificationActionPinnedPollChannel2", R.string.NotificationActionPinnedPollChannel2, args[0], args[1]); + } } + break; } - break; - } - case "PINNED_GEO": { - if (dialogId > 0) { - messageText = LocaleController.formatString("NotificationActionPinnedGeoUser", R.string.NotificationActionPinnedGeoUser, args[0], args[1]); - } else { - if (isGroup) { - messageText = LocaleController.formatString("NotificationActionPinnedGeo", R.string.NotificationActionPinnedGeo, args[0], args[1]); + case "PINNED_GEO": { + if (dialogId > 0) { + messageText = LocaleController.formatString("NotificationActionPinnedGeoUser", R.string.NotificationActionPinnedGeoUser, args[0], args[1]); } else { - messageText = LocaleController.formatString("NotificationActionPinnedGeoChannel", R.string.NotificationActionPinnedGeoChannel, args[0]); + if (isGroup) { + messageText = LocaleController.formatString("NotificationActionPinnedGeo", R.string.NotificationActionPinnedGeo, args[0], args[1]); + } else { + messageText = LocaleController.formatString("NotificationActionPinnedGeoChannel", R.string.NotificationActionPinnedGeoChannel, args[0]); + } } + break; } - break; - } - case "PINNED_GEOLIVE": { - if (dialogId > 0) { - messageText = LocaleController.formatString("NotificationActionPinnedGeoLiveUser", R.string.NotificationActionPinnedGeoLiveUser, args[0], args[1]); - } else { - if (isGroup) { - messageText = LocaleController.formatString("NotificationActionPinnedGeoLive", R.string.NotificationActionPinnedGeoLive, args[0], args[1]); + case "PINNED_GEOLIVE": { + if (dialogId > 0) { + messageText = LocaleController.formatString("NotificationActionPinnedGeoLiveUser", R.string.NotificationActionPinnedGeoLiveUser, args[0], args[1]); } else { - messageText = LocaleController.formatString("NotificationActionPinnedGeoLiveChannel", R.string.NotificationActionPinnedGeoLiveChannel, args[0]); + if (isGroup) { + messageText = LocaleController.formatString("NotificationActionPinnedGeoLive", R.string.NotificationActionPinnedGeoLive, args[0], args[1]); + } else { + messageText = LocaleController.formatString("NotificationActionPinnedGeoLiveChannel", R.string.NotificationActionPinnedGeoLiveChannel, args[0]); + } } + break; } - break; - } - case "PINNED_GAME": { - if (dialogId > 0) { - messageText = LocaleController.formatString("NotificationActionPinnedGameUser", R.string.NotificationActionPinnedGameUser, args[0], args[1]); - } else { - if (isGroup) { - messageText = LocaleController.formatString("NotificationActionPinnedGame", R.string.NotificationActionPinnedGame, args[0], args[1]); + case "PINNED_GAME": { + if (dialogId > 0) { + messageText = LocaleController.formatString("NotificationActionPinnedGameUser", R.string.NotificationActionPinnedGameUser, args[0], args[1]); } else { - messageText = LocaleController.formatString("NotificationActionPinnedGameChannel", R.string.NotificationActionPinnedGameChannel, args[0]); + if (isGroup) { + messageText = LocaleController.formatString("NotificationActionPinnedGame", R.string.NotificationActionPinnedGame, args[0], args[1]); + } else { + messageText = LocaleController.formatString("NotificationActionPinnedGameChannel", R.string.NotificationActionPinnedGameChannel, args[0]); + } } + break; } - break; - } - case "PINNED_GAME_SCORE": { - if (dialogId > 0) { - messageText = LocaleController.formatString("NotificationActionPinnedGameScoreUser", R.string.NotificationActionPinnedGameScoreUser, args[0], args[1]); - } else { - if (isGroup) { - messageText = LocaleController.formatString("NotificationActionPinnedGameScore", R.string.NotificationActionPinnedGameScore, args[0], args[1]); + case "PINNED_GAME_SCORE": { + if (dialogId > 0) { + messageText = LocaleController.formatString("NotificationActionPinnedGameScoreUser", R.string.NotificationActionPinnedGameScoreUser, args[0], args[1]); } else { - messageText = LocaleController.formatString("NotificationActionPinnedGameScoreChannel", R.string.NotificationActionPinnedGameScoreChannel, args[0]); + if (isGroup) { + messageText = LocaleController.formatString("NotificationActionPinnedGameScore", R.string.NotificationActionPinnedGameScore, args[0], args[1]); + } else { + messageText = LocaleController.formatString("NotificationActionPinnedGameScoreChannel", R.string.NotificationActionPinnedGameScoreChannel, args[0]); + } } + break; } - break; - } - case "PINNED_INVOICE": { - if (dialogId > 0) { - messageText = LocaleController.formatString("NotificationActionPinnedInvoiceUser", R.string.NotificationActionPinnedInvoiceUser, args[0], args[1]); - } else { - if (isGroup) { - messageText = LocaleController.formatString("NotificationActionPinnedInvoice", R.string.NotificationActionPinnedInvoice, args[0], args[1]); + case "PINNED_INVOICE": { + if (dialogId > 0) { + messageText = LocaleController.formatString("NotificationActionPinnedInvoiceUser", R.string.NotificationActionPinnedInvoiceUser, args[0], args[1]); } else { - messageText = LocaleController.formatString("NotificationActionPinnedInvoiceChannel", R.string.NotificationActionPinnedInvoiceChannel, args[0]); + if (isGroup) { + messageText = LocaleController.formatString("NotificationActionPinnedInvoice", R.string.NotificationActionPinnedInvoice, args[0], args[1]); + } else { + messageText = LocaleController.formatString("NotificationActionPinnedInvoiceChannel", R.string.NotificationActionPinnedInvoiceChannel, args[0]); + } } + break; } - break; - } - case "PINNED_GIF": { - if (dialogId > 0) { - messageText = LocaleController.formatString("NotificationActionPinnedGifUser", R.string.NotificationActionPinnedGifUser, args[0], args[1]); - } else { - if (isGroup) { - messageText = LocaleController.formatString("NotificationActionPinnedGif", R.string.NotificationActionPinnedGif, args[0], args[1]); + case "PINNED_GIF": { + if (dialogId > 0) { + messageText = LocaleController.formatString("NotificationActionPinnedGifUser", R.string.NotificationActionPinnedGifUser, args[0], args[1]); } else { - messageText = LocaleController.formatString("NotificationActionPinnedGifChannel", R.string.NotificationActionPinnedGifChannel, args[0]); + if (isGroup) { + messageText = LocaleController.formatString("NotificationActionPinnedGif", R.string.NotificationActionPinnedGif, args[0], args[1]); + } else { + messageText = LocaleController.formatString("NotificationActionPinnedGifChannel", R.string.NotificationActionPinnedGifChannel, args[0]); + } } + break; } - break; - } - case "ENCRYPTED_MESSAGE": { - messageText = LocaleController.getString("YouHaveNewMessage", R.string.YouHaveNewMessage); - name = LocaleController.getString("SecretChatName", R.string.SecretChatName); - localMessage = true; - break; - } - case "CONTACT_JOINED": - case "AUTH_UNKNOWN": - case "AUTH_REGION": - case "LOCKED_MESSAGE": - case "ENCRYPTION_REQUEST": - case "ENCRYPTION_ACCEPT": - case "PHONE_CALL_REQUEST": - case "MESSAGE_MUTED": - case "PHONE_CALL_MISSED": { - //ignored - break; - } - default: { - if (BuildVars.LOGS_ENABLED) { - FileLog.w("unhandled loc_key = " + loc_key); + case "ENCRYPTED_MESSAGE": { + messageText = LocaleController.getString("YouHaveNewMessage", R.string.YouHaveNewMessage); + name = LocaleController.getString("SecretChatName", R.string.SecretChatName); + localMessage = true; + break; + } + case "REACT_TEXT": { + break; + } + case "CONTACT_JOINED": + case "AUTH_UNKNOWN": + case "AUTH_REGION": + case "LOCKED_MESSAGE": + case "ENCRYPTION_REQUEST": + case "ENCRYPTION_ACCEPT": + case "PHONE_CALL_REQUEST": + case "MESSAGE_MUTED": + case "PHONE_CALL_MISSED": { + //ignored + break; + } + + default: { + if (BuildVars.LOGS_ENABLED) { + FileLog.w("unhandled loc_key = " + loc_key); + } + break; } - break; } } if (messageText != null) { @@ -1095,6 +1107,108 @@ public class GcmPushListenerService extends FirebaseMessagingService { } } + private String getReactedText(String loc_key, String[] args) { + switch (loc_key) { + case "REACT_TEXT": { + return LocaleController.formatString("PushReactText", R.string.PushReactText, args); + } + case "REACT_NOTEXT": { + return LocaleController.formatString("PushReactNoText", R.string.PushReactNoText, args); + } + case "REACT_PHOTO": { + return LocaleController.formatString("PushReactPhoto", R.string.PushReactPhoto, args); + } + case "REACT_VIDEO": { + return LocaleController.formatString("PushReactVideo", R.string.PushReactVideo, args); + } + case "REACT_ROUND": { + return LocaleController.formatString("PushReactRound", R.string.PushReactRound, args); + } + case "REACT_DOC": { + return LocaleController.formatString("PushReactDoc", R.string.PushReactDoc, args); + } + case "REACT_STICKER": { + return LocaleController.formatString("PushReactSticker", R.string.PushReactSticker, args); + } + case "REACT_AUDIO": { + return LocaleController.formatString("PushReactAudio", R.string.PushReactAudio, args); + } + case "REACT_CONTACT": { + return LocaleController.formatString("PushReactContect", R.string.PushReactContect, args); + } + case "REACT_GEO": { + return LocaleController.formatString("PushReactGeo", R.string.PushReactGeo, args); + } + case "REACT_GEOLIVE": { + return LocaleController.formatString("PushReactGeoLocation", R.string.PushReactGeoLocation, args); + } + case "REACT_POLL": { + return LocaleController.formatString("PushReactPoll", R.string.PushReactPoll, args); + } + case "REACT_QUIZ": { + return LocaleController.formatString("PushReactQuiz", R.string.PushReactQuiz, args); + } + case "REACT_GAME": { + return LocaleController.formatString("PushReactGame", R.string.PushReactGame, args); + } + case "REACT_INVOICE": { + return LocaleController.formatString("PushReactInvoice", R.string.PushReactInvoice, args); + } + case "REACT_GIF": { + return LocaleController.formatString("PushReactGif", R.string.PushReactGif, args); + } + case "CHAT_REACT_TEXT": { + return LocaleController.formatString("PushChatReactText", R.string.PushChatReactText, args); + } + case "CHAT_REACT_NOTEXT": { + return LocaleController.formatString("PushChatReactNotext", R.string.PushChatReactNotext, args); + } + case "CHAT_REACT_PHOTO": { + return LocaleController.formatString("PushChatReactPhoto", R.string.PushChatReactPhoto, args); + } + case "CHAT_REACT_VIDEO": { + return LocaleController.formatString("PushChatReactVideo", R.string.PushChatReactVideo, args); + } + case "CHAT_REACT_ROUND": { + return LocaleController.formatString("PushChatReactRound", R.string.PushChatReactRound, args); + } + case "CHAT_REACT_DOC": { + return LocaleController.formatString("PushChatReactDoc", R.string.PushChatReactDoc, args); + } + case "CHAT_REACT_STICKER": { + return LocaleController.formatString("PushChatReactSticker", R.string.PushChatReactSticker, args); + } + case "CHAT_REACT_AUDIO": { + return LocaleController.formatString("PushChatReactAudio", R.string.PushChatReactAudio, args); + } + case "CHAT_REACT_CONTACT": { + return LocaleController.formatString("PushChatReactContact", R.string.PushChatReactContact, args); + } + case "CHAT_REACT_GEO": { + return LocaleController.formatString("PushChatReactGeo", R.string.PushChatReactGeo, args); + } + case "CHAT_REACT_GEOLIVE": { + return LocaleController.formatString("PushChatReactGeoLive", R.string.PushChatReactGeoLive, args); + } + case "CHAT_REACT_POLL": { + return LocaleController.formatString("PushChatReactPoll", R.string.PushChatReactPoll, args); + } + case "CHAT_REACT_QUIZ": { + return LocaleController.formatString("PushChatReactQuiz", R.string.PushChatReactQuiz, args); + } + case "CHAT_REACT_GAME": { + return LocaleController.formatString("PushChatReactGame", R.string.PushChatReactGame, args); + } + case "CHAT_REACT_INVOICE": { + return LocaleController.formatString("PushChatReactInvoice", R.string.PushChatReactInvoice, args); + } + case "CHAT_REACT_GIF": { + return LocaleController.formatString("PushChatReactGif", R.string.PushChatReactGif, args); + } + } + return null; + } + private void onDecryptError() { for (int a : SharedConfig.activeAccounts) { if (UserConfig.getInstance(a).isClientActivated()) { diff --git a/TMessagesProj/src/main/AndroidManifest.xml b/TMessagesProj/src/main/AndroidManifest.xml index b1e0733d6..e9da11583 100644 --- a/TMessagesProj/src/main/AndroidManifest.xml +++ b/TMessagesProj/src/main/AndroidManifest.xml @@ -97,7 +97,7 @@ - + @@ -112,6 +112,7 @@ android:manageSpaceActivity="org.telegram.ui.ExternalActionActivity" android:networkSecurityConfig="@xml/network_security_config" android:requestLegacyExternalStorage="true" + android:preserveLegacyExternalStorage="true" android:roundIcon="@mipmap/ic_launcher" android:supportsRtl="false" android:theme="@style/Theme.TMessages.Start" @@ -508,9 +509,9 @@ - + + + diff --git a/TMessagesProj/src/main/assets/fonts/rcondensedbold.ttf b/TMessagesProj/src/main/assets/fonts/rcondensedbold.ttf new file mode 100644 index 000000000..7fe31289c Binary files /dev/null and b/TMessagesProj/src/main/assets/fonts/rcondensedbold.ttf differ diff --git a/TMessagesProj/src/main/java/androidx/recyclerview/widget/ChatListItemAnimator.java b/TMessagesProj/src/main/java/androidx/recyclerview/widget/ChatListItemAnimator.java index d591a64a5..69accd45b 100644 --- a/TMessagesProj/src/main/java/androidx/recyclerview/widget/ChatListItemAnimator.java +++ b/TMessagesProj/src/main/java/androidx/recyclerview/widget/ChatListItemAnimator.java @@ -5,7 +5,6 @@ import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; -import android.os.Build; import android.view.View; import android.view.ViewPropertyAnimator; import android.view.animation.Interpolator; @@ -495,8 +494,9 @@ public class ChatListItemAnimator extends DefaultItemAnimator { if (group == null && params.wasDraw) { boolean isOut = chatMessageCell.getMessageObject().isOutOwner(); - if ((isOut && params.lastDrawingBackgroundRect.left != chatMessageCell.getBackgroundDrawableLeft()) || - (!isOut && params.lastDrawingBackgroundRect.right != chatMessageCell.getBackgroundDrawableRight()) || + boolean widthChanged = (isOut && params.lastDrawingBackgroundRect.left != chatMessageCell.getBackgroundDrawableLeft()) || + (!isOut && params.lastDrawingBackgroundRect.right != chatMessageCell.getBackgroundDrawableRight()); + if (widthChanged || params.lastDrawingBackgroundRect.top != chatMessageCell.getBackgroundDrawableTop() || params.lastDrawingBackgroundRect.bottom != chatMessageCell.getBackgroundDrawableBottom()) { moveInfo.deltaBottom = chatMessageCell.getBackgroundDrawableBottom() - params.lastDrawingBackgroundRect.bottom; @@ -509,6 +509,7 @@ public class ChatListItemAnimator extends DefaultItemAnimator { moveInfo.animateBackgroundOnly = true; params.animateBackgroundBoundsInner = true; + params.animateBackgroundWidth = widthChanged; params.deltaLeft = -moveInfo.deltaLeft; params.deltaRight = -moveInfo.deltaRight; params.deltaTop = -moveInfo.deltaTop; @@ -1208,6 +1209,9 @@ public class ChatListItemAnimator extends DefaultItemAnimator { } public void groupWillChanged(MessageObject.GroupedMessages groupedMessages) { + if (groupedMessages == null) { + return; + } if (groupedMessages.messages.size() == 0) { groupedMessages.transitionParams.drawBackgroundForDeletedItems = true; } else { diff --git a/TMessagesProj/src/main/java/com/carrotsearch/randomizedtesting/MurmurHash3.java b/TMessagesProj/src/main/java/com/carrotsearch/randomizedtesting/MurmurHash3.java new file mode 100644 index 000000000..db2f073d6 --- /dev/null +++ b/TMessagesProj/src/main/java/com/carrotsearch/randomizedtesting/MurmurHash3.java @@ -0,0 +1,42 @@ +package com.carrotsearch.randomizedtesting; + +/** + * Hash routines for primitive types. The implementation is based on the finalization step + * from Austin Appleby's MurmurHash3. + * + * @see "http://sites.google.com/site/murmurhash/" + */ +final class MurmurHash3 +{ + private MurmurHash3() + { + // no instances. + } + + /** + * Hashes a 4-byte sequence (Java int). + */ + public static int hash(int k) + { + k ^= k >>> 16; + k *= 0x85ebca6b; + k ^= k >>> 13; + k *= 0xc2b2ae35; + k ^= k >>> 16; + return k; + } + + /** + * Hashes an 8-byte sequence (Java long). + */ + public static long hash(long k) + { + k ^= k >>> 33; + k *= 0xff51afd7ed558ccdL; + k ^= k >>> 33; + k *= 0xc4ceb9fe1a85ec53L; + k ^= k >>> 33; + + return k; + } +} \ No newline at end of file diff --git a/TMessagesProj/src/main/java/com/carrotsearch/randomizedtesting/Xoroshiro128PlusRandom.java b/TMessagesProj/src/main/java/com/carrotsearch/randomizedtesting/Xoroshiro128PlusRandom.java new file mode 100644 index 000000000..f4d6acaa4 --- /dev/null +++ b/TMessagesProj/src/main/java/com/carrotsearch/randomizedtesting/Xoroshiro128PlusRandom.java @@ -0,0 +1,97 @@ +package com.carrotsearch.randomizedtesting; + +import java.util.Random; + +/** + * Implements Xoroshiro128PlusRandom. Not synchronized (anywhere). + * + * @see "http://xoroshiro.di.unimi.it/" + */ +@SuppressWarnings("serial") +public class Xoroshiro128PlusRandom extends Random { + private static final double DOUBLE_UNIT = 0x1.0p-53; // 1.0 / (1L << 53); + private static final float FLOAT_UNIT = 0x1.0p-24f; // 1.0 / (1L << 24); + + private long s0, s1; + + public Xoroshiro128PlusRandom(long seed) { + // Must be here, the only Random constructor. Has side-effects on setSeed, see below. + super(0); + + s0 = MurmurHash3.hash(seed); + s1 = MurmurHash3.hash(s0); + + if (s0 == 0 && s1 == 0) { + s0 = MurmurHash3.hash(0xdeadbeefL); + s1 = MurmurHash3.hash(s0); + } + } + + @Override + public void setSeed(long seed) { + // Called from super constructor and observing uninitialized state? + if (s0 == 0 && s1 == 0) { + return; + } + + throw new RuntimeException("No seed set"); + } + + @Override + public boolean nextBoolean() { + return nextLong() >= 0; + } + + @Override + public void nextBytes(byte[] bytes) { + for (int i = 0, len = bytes.length; i < len; ) { + long rnd = nextInt(); + for (int n = Math.min(len - i, 8); n-- > 0; rnd >>>= 8) { + bytes[i++] = (byte) rnd; + } + } + } + + @Override + public double nextDouble() { + return (nextLong() >>> 11) * DOUBLE_UNIT; + } + + @Override + public float nextFloat() { + return (nextInt() >>> 8) * FLOAT_UNIT; + } + + @Override + public int nextInt() { + return (int) nextLong(); + } + + @Override + public int nextInt(int n) { + // Leave superclass's implementation. + return super.nextInt(n); + } + + @Override + public double nextGaussian() { + // Leave superclass's implementation. + return super.nextGaussian(); + } + + @Override + public long nextLong() { + final long s0 = this.s0; + long s1 = this.s1; + final long result = s0 + s1; + s1 ^= s0; + this.s0 = Long.rotateLeft(s0, 55) ^ s1 ^ s1 << 14; + this.s1 = Long.rotateLeft(s1, 36); + return result; + } + + @Override + protected int next(int bits) { + return ((int) nextLong()) >>> (32 - bits); + } +} \ No newline at end of file diff --git a/TMessagesProj/src/main/java/com/google/zxing/qrcode/QRCodeWriter.java b/TMessagesProj/src/main/java/com/google/zxing/qrcode/QRCodeWriter.java index 3dad97212..8c0195fbf 100755 --- a/TMessagesProj/src/main/java/com/google/zxing/qrcode/QRCodeWriter.java +++ b/TMessagesProj/src/main/java/com/google/zxing/qrcode/QRCodeWriter.java @@ -19,7 +19,11 @@ package com.google.zxing.qrcode; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; +import android.graphics.Color; import android.graphics.Paint; +import android.graphics.Path; +import android.graphics.RectF; +import android.graphics.Region; import android.graphics.drawable.Drawable; import android.graphics.drawable.GradientDrawable; @@ -33,6 +37,8 @@ import com.google.zxing.qrcode.encoder.QRCode; import org.telegram.messenger.ApplicationLoader; import org.telegram.messenger.R; +import org.telegram.messenger.SvgHelper; +import org.telegram.ui.Components.RLottieDrawable; import java.util.Arrays; import java.util.Map; @@ -243,7 +249,194 @@ public final class QRCodeWriter { return x >= 0 && y >= 0 && x < input.getWidth() && y < input.getHeight() && input.get(x, y) == 1; } - public int getImageSize() { + public Bitmap encode(String contents, int width, int height, Map hints, Bitmap bitmap) throws WriterException { + return encode(contents, width, height, hints, bitmap, 1.0f, 0xffffffff, 0xff000000); + } + + public Bitmap encode(String contents, int width, int height, Map hints, Bitmap bitmap, float radiusFactor, int backgroundColor, int color) throws WriterException { + + if (contents.isEmpty()) { + throw new IllegalArgumentException("Found empty contents"); + } + + if (width < 0 || height < 0) { + throw new IllegalArgumentException("Requested dimensions are too small: " + width + 'x' + height); + } + + ErrorCorrectionLevel errorCorrectionLevel = ErrorCorrectionLevel.L; + int quietZone = QUIET_ZONE_SIZE; + if (hints != null) { + if (hints.containsKey(EncodeHintType.ERROR_CORRECTION)) { + errorCorrectionLevel = ErrorCorrectionLevel.valueOf(hints.get(EncodeHintType.ERROR_CORRECTION).toString()); + } + if (hints.containsKey(EncodeHintType.MARGIN)) { + quietZone = Integer.parseInt(hints.get(EncodeHintType.MARGIN).toString()); + } + } + + QRCode code = Encoder.encode(contents, errorCorrectionLevel, hints); + + input = code.getMatrix(); + if (input == null) { + throw new IllegalStateException(); + } + int inputWidth = input.getWidth(); + int inputHeight = input.getHeight(); + + for (int x = 0; x < inputWidth; x++) { + if (has(x, 0)) { + sideQuadSize++; + } else { + break; + } + } + + int qrWidth = inputWidth + (quietZone * 2); + int qrHeight = inputHeight + (quietZone * 2); + int outputWidth = Math.max(width, qrWidth); + int outputHeight = Math.max(height, qrHeight); + + int multiple = Math.min(outputWidth / qrWidth, outputHeight / qrHeight); + + int padding = 16; + + int size = multiple * inputWidth + padding * 2; + if (bitmap == null || bitmap.getWidth() != size) { + bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888); + } + Canvas canvas = new Canvas(bitmap); + canvas.drawColor(backgroundColor); + Paint blackPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + blackPaint.setColor(color); + + GradientDrawable rect = new GradientDrawable(); + rect.setShape(GradientDrawable.RECTANGLE); + rect.setCornerRadii(radii); + + imageBloks = Math.round((size - 32) / 4.65f / multiple); + if (imageBloks % 2 != inputWidth % 2) { + imageBloks++; + } + imageBlockX = (inputWidth - imageBloks) / 2; + imageSize = imageBloks * multiple - 24; + int imageX = (size - imageSize) / 2; + + boolean isTransparentBackground = Color.alpha(backgroundColor) == 0; + Path clipPath = new Path(); + RectF rectF = new RectF(); + for (int a = 0; a < 3; a++) { + int x, y; + if (a == 0) { + x = padding; + y = padding; + } else if (a == 1) { + x = size - sideQuadSize * multiple - padding; + y = padding; + } else { + x = padding; + y = size - sideQuadSize * multiple - padding; + } + + float r; + if (isTransparentBackground) { + rectF.set(x + multiple, y + multiple, x + (sideQuadSize - 1) * multiple, y + (sideQuadSize - 1) * multiple); + r = (sideQuadSize * multiple) / 4.0f * radiusFactor; + clipPath.reset(); + clipPath.addRoundRect(rectF, r, r, Path.Direction.CW); + clipPath.close(); + canvas.save(); + canvas.clipPath(clipPath, Region.Op.DIFFERENCE); + } + r = (sideQuadSize * multiple) / 3.0f * radiusFactor; + Arrays.fill(radii, r); + rect.setColor(color); + rect.setBounds(x, y, x + sideQuadSize * multiple, y + sideQuadSize * multiple); + rect.draw(canvas); + canvas.drawRect(x + multiple, y + multiple, x + (sideQuadSize - 1) * multiple, y + (sideQuadSize - 1) * multiple, blackPaint); + if (isTransparentBackground) { + canvas.restore(); + } + + if (!isTransparentBackground) { + r = (sideQuadSize * multiple) / 4.0f * radiusFactor; + Arrays.fill(radii, r); + rect.setColor(backgroundColor); + rect.setBounds(x + multiple, y + multiple, x + (sideQuadSize - 1) * multiple, y + (sideQuadSize - 1) * multiple); + rect.draw(canvas); + } + + r = ((sideQuadSize - 2) * multiple) / 4.0f * radiusFactor; + Arrays.fill(radii, r); + rect.setColor(color); + rect.setBounds(x + multiple * 2, y + multiple * 2, x + (sideQuadSize - 2) * multiple, y + (sideQuadSize - 2) * multiple); + rect.draw(canvas); + } + float r = multiple / 2.0f * radiusFactor; + + for (int y = 0, outputY = padding; y < inputHeight; y++, outputY += multiple) { + for (int x = 0, outputX = padding; x < inputWidth; x++, outputX += multiple) { + if (has(x, y)) { + Arrays.fill(radii, r); + if (has(x, y - 1)) { + radii[0] = radii[1] = 0; + radii[2] = radii[3] = 0; + } + if (has(x, y + 1)) { + radii[6] = radii[7] = 0; + radii[4] = radii[5] = 0; + } + if (has(x - 1, y)) { + radii[0] = radii[1] = 0; + radii[6] = radii[7] = 0; + } + if (has(x + 1, y)) { + radii[2] = radii[3] = 0; + radii[4] = radii[5] = 0; + } + rect.setColor(color); + rect.setBounds(outputX, outputY, outputX + multiple, outputY + multiple); + rect.draw(canvas); + } else { + boolean has = false; + Arrays.fill(radii, 0); + if (has(x - 1, y - 1) && has(x - 1, y) && has(x, y - 1)) { + radii[0] = radii[1] = r; + has = true; + } + if (has(x + 1, y - 1) && has(x + 1, y) && has(x, y - 1)) { + radii[2] = radii[3] = r; + has = true; + } + if (has(x - 1, y + 1) && has(x - 1, y) && has(x, y + 1)) { + radii[6] = radii[7] = r; + has = true; + } + if (has(x + 1, y + 1) && has(x + 1, y) && has(x, y + 1)) { + radii[4] = radii[5] = r; + has = true; + } + if (has && !isTransparentBackground) { + canvas.drawRect(outputX, outputY, outputX + multiple, outputY + multiple, blackPaint); + rect.setColor(backgroundColor); + rect.setBounds(outputX, outputY, outputX + multiple, outputY + multiple); + rect.draw(canvas); + } + } + } + } + + String svg = RLottieDrawable.readRes(null, R.raw.qr_logo); + Bitmap icon = SvgHelper.getBitmap(svg, imageSize, imageSize, false); + canvas.drawBitmap(icon, imageX, imageX, null); + icon.recycle(); + + canvas.setBitmap(null); + + return bitmap; + } + + + public int getImageSize() { return imageSize; } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java b/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java index a06d7b5c3..b6ea61655 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java @@ -28,6 +28,7 @@ import android.content.res.AssetFileDescriptor; import android.content.res.Configuration; import android.database.Cursor; import android.graphics.Bitmap; +import android.graphics.BitmapFactory; import android.graphics.Color; import android.graphics.Matrix; import android.graphics.Paint; @@ -1993,6 +1994,29 @@ public class AndroidUtilities { } } + public static int charSequenceIndexOf(CharSequence cs, CharSequence needle, int fromIndex) { + for (int i = fromIndex; i < cs.length() - needle.length(); i++) { + boolean eq = true; + for (int j = 0; j < needle.length(); j++) { + if (needle.charAt(j) != cs.charAt(i + j)) { + eq = false; + break; + } + } + if (eq) + return i; + } + return -1; + } + + public static int charSequenceIndexOf(CharSequence cs, CharSequence needle) { + return charSequenceIndexOf(cs, needle, 0); + } + + public static boolean charSequenceContains(CharSequence cs, CharSequence needle) { + return charSequenceIndexOf(cs, needle) != -1; + } + public static CharSequence getTrimmedString(CharSequence src) { if (src == null || src.length() == 0) { return src; @@ -2936,6 +2960,57 @@ public class AndroidUtilities { return openForView(f, fileName, document.mime_type, activity, null); } + public static SpannableStringBuilder formatSpannableSimple(String format, CharSequence... cs) { + return formatSpannable(format, i -> "%s", cs); + } + + public static SpannableStringBuilder formatSpannable(String format, CharSequence... cs) { + if (format.contains("%s")) + return formatSpannableSimple(format, cs); + return formatSpannable(format, i -> "%" + (i + 1) + "$s", cs); + } + + public static SpannableStringBuilder formatSpannable(String format, GenericProvider keysProvider, CharSequence... cs) { + SpannableStringBuilder stringBuilder = new SpannableStringBuilder(format); + for (int i = 0; i < cs.length; i++) { + String key = keysProvider.provide(i); + int j = format.indexOf(key); + if (j != -1) { + stringBuilder.replace(j, j + key.length(), cs[i]); + format = format.substring(0, j) + cs[i].toString() + format.substring(j + key.length()); + } + } + return stringBuilder; + } + + public static CharSequence replaceTwoNewLinesToOne(CharSequence original) { + char[] buf = new char[2]; + if (original instanceof StringBuilder) { + StringBuilder stringBuilder = (StringBuilder) original; + for (int a = 0, N = original.length(); a < N - 2; a++) { + stringBuilder.getChars(a, a + 2, buf, 0); + if (buf[0] == '\n' && buf[1] == '\n') { + stringBuilder = stringBuilder.replace(a, a + 2, "\n"); + a--; + N--; + } + } + return original; + } else if (original instanceof SpannableStringBuilder) { + SpannableStringBuilder stringBuilder = (SpannableStringBuilder) original; + for (int a = 0, N = original.length(); a < N - 2; a++) { + stringBuilder.getChars(a, a + 2, buf, 0); + if (buf[0] == '\n' && buf[1] == '\n') { + stringBuilder = stringBuilder.replace(a, a + 2, "\n"); + a--; + N--; + } + } + return original; + } + return original.toString().replace("\n\n", "\n"); + } + public static CharSequence replaceNewLines(CharSequence original) { if (original instanceof StringBuilder) { StringBuilder stringBuilder = (StringBuilder) original; @@ -2944,6 +3019,7 @@ public class AndroidUtilities { stringBuilder.setCharAt(a, ' '); } } + return original; } else if (original instanceof SpannableStringBuilder) { SpannableStringBuilder stringBuilder = (SpannableStringBuilder) original; for (int a = 0, N = original.length(); a < N; a++) { @@ -2951,6 +3027,7 @@ public class AndroidUtilities { stringBuilder.replace(a, a + 1, " "); } } + return original; } return original.toString().replace('\n', ' '); } @@ -4248,6 +4325,9 @@ public class AndroidUtilities { } public static boolean checkHostForPunycode(String url) { + if (url == null) { + return false; + } boolean hasLatin = false; boolean hasNonLatin = false; try { @@ -4381,4 +4461,75 @@ public class AndroidUtilities { return preferences.getInt(key, (int) defaultValue); } } + + public static Bitmap getScaledBitmap(float w, float h, String path, String streamPath, int streamOffset) { + FileInputStream stream = null; + try { + BitmapFactory.Options options = new BitmapFactory.Options(); + options.inJustDecodeBounds = true; + + if (path != null) { + BitmapFactory.decodeFile(path, options); + } else { + stream = new FileInputStream(streamPath); + stream.getChannel().position(streamOffset); + BitmapFactory.decodeStream(stream, null, options); + } + if (options.outWidth > 0 && options.outHeight > 0) { + if (w > h && options.outWidth < options.outHeight) { + float temp = w; + w = h; + h = temp; + } + float scale = Math.min(options.outWidth / w, options.outHeight / h); + options.inSampleSize = 1; + if (scale > 1.0f) { + do { + options.inSampleSize *= 2; + } while (options.inSampleSize < scale); + } + options.inJustDecodeBounds = false; + Bitmap wallpaper; + if (path != null) { + wallpaper = BitmapFactory.decodeFile(path, options); + } else { + stream.getChannel().position(streamOffset); + wallpaper = BitmapFactory.decodeStream(stream, null, options); + } + return wallpaper; + } + } catch (Throwable e) { + FileLog.e(e); + } finally { + try { + if (stream != null) { + stream.close(); + } + } catch (Exception e2) { + FileLog.e(e2); + } + } + return null; + } + + public static Uri getBitmapShareUri(Bitmap bitmap, String fileName, Bitmap.CompressFormat format) { + File cachePath = AndroidUtilities.getCacheDir(); + if (!cachePath.isDirectory()) { + try { + cachePath.mkdirs(); + } catch (Exception e) { + FileLog.e(e); + return null; + } + } + File file = new File(cachePath, fileName); + try (FileOutputStream out = new FileOutputStream(file)) { + bitmap.compress(format, 100, out); + out.close(); + return FileProvider.getUriForFile(ApplicationLoader.applicationContext, BuildConfig.APPLICATION_ID + ".provider", file); + } catch (IOException e) { + FileLog.e(e); + } + return null; + } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ForwardingMessagesParams.java b/TMessagesProj/src/main/java/org/telegram/messenger/ForwardingMessagesParams.java index 3bfb40ca8..3bfc46f5f 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ForwardingMessagesParams.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ForwardingMessagesParams.java @@ -21,6 +21,7 @@ public class ForwardingMessagesParams { public boolean isSecret; public boolean willSeeSenders; public boolean multiplyUsers; + public boolean hasSpoilers; public ArrayList pollChoosenAnswers = new ArrayList<>(); @@ -29,6 +30,7 @@ public class ForwardingMessagesParams { hasCaption = false; hasSenders = false; isSecret = DialogObject.isEncryptedDialog(newDialogId); + hasSpoilers = false; ArrayList hiddenSendersName = new ArrayList<>(); for (int i = 0; i < messages.size(); i++) { MessageObject messageObject = messages.get(i); @@ -46,6 +48,17 @@ public class ForwardingMessagesParams { message.media = messageObject.messageOwner.media; message.action = messageObject.messageOwner.action; message.edit_date = 0; + if (messageObject.messageOwner.entities != null) { + message.entities.addAll(messageObject.messageOwner.entities); + if (!hasSpoilers) { + for (TLRPC.MessageEntity e : message.entities) { + if (e instanceof TLRPC.TL_messageEntitySpoiler) { + hasSpoilers = true; + break; + } + } + } + } message.out = true; message.unread = false; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/GenericProvider.java b/TMessagesProj/src/main/java/org/telegram/messenger/GenericProvider.java new file mode 100644 index 000000000..2be3b3c1f --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/messenger/GenericProvider.java @@ -0,0 +1,5 @@ +package org.telegram.messenger; + +public interface GenericProvider { + T provide(F obj); +} diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java b/TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java index 70ff896ca..7780f7bb9 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java @@ -30,7 +30,7 @@ import android.text.TextUtils; import android.util.SparseArray; import androidx.exifinterface.media.ExifInterface; -import com.google.android.exoplayer2.util.Log; +import androidx.exifinterface.media.ExifInterface; import org.json.JSONArray; import org.json.JSONObject; @@ -362,7 +362,7 @@ public class ImageLoader { } } } catch (Exception e) { - FileLog.e(e); + FileLog.e(e, false); } httpConnectionStream = httpConnection.getInputStream(); @@ -854,7 +854,7 @@ public class ImageLoader { float h_filter = Float.parseFloat(args[1]); w = Math.min(512, (int) (w_filter * AndroidUtilities.density)); h = Math.min(512, (int) (h_filter * AndroidUtilities.density)); - if (w_filter <= 90 && h_filter <= 90) { + if (w_filter <= 90 && h_filter <= 90 && !cacheImage.filter.contains("nolimit")) { w = Math.min(w, 160); h = Math.min(h, 160); limitFps = true; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java b/TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java index cdd3e4c48..45db469e9 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java @@ -42,10 +42,12 @@ import java.io.IOException; import java.text.NumberFormat; import java.util.ArrayList; import java.util.Calendar; +import java.util.Collection; import java.util.Currency; import java.util.Date; import java.util.HashMap; import java.util.Locale; +import java.util.Map; import java.util.TimeZone; import tw.nekomimi.nkmr.NekomuraConfig; @@ -504,6 +506,13 @@ public class LocaleController { } return languagesDict.get(key.toLowerCase().replace("-", "_")); } + public LocaleInfo getLanguageByPlural(String plural) { + Collection values = languagesDict.values(); + for (LocaleInfo l : values) + if (l.pluralLangCode != null && l.pluralLangCode.equals(plural)) + return l; + return null; + } private void addRules(String[] languages, PluralRules rules) { for (String language : languages) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java index 02c46081e..14b31697b 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java @@ -3694,52 +3694,83 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener, new Thread(() -> { try { - File dir; - if (isMusic) { - dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC); + if (Build.VERSION.SDK_INT >= 29) { + for (int b = 0, N = messageObjects.size(); b < N; b++) { + MessageObject message = messageObjects.get(b); + String path = message.messageOwner.attachPath; + String name = message.getDocumentName(); + if (path != null && path.length() > 0) { + File temp = new File(path); + if (!temp.exists()) { + path = null; + } + } + if (path == null || path.length() == 0) { + path = FileLoader.getPathToMessage(message.messageOwner).toString(); + } + File sourceFile = new File(path); + if (!sourceFile.exists()) { + waitingForFile = new CountDownLatch(1); + addMessageToLoad(message); + waitingForFile.await(); + } + if (cancelled) { + break; + } + if (sourceFile.exists()) { + saveFileInternal(isMusic ? 3 : 2, sourceFile, name); + } + } } else { - dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); - } - dir.mkdir(); - for (int b = 0, N = messageObjects.size(); b < N; b++) { - MessageObject message = messageObjects.get(b); - String name = message.getDocumentName(); - File destFile = new File(dir, name); - if (destFile.exists()) { - int idx = name.lastIndexOf('.'); - for (int a = 0; a < 10; a++) { - String newName; - if (idx != -1) { - newName = name.substring(0, idx) + "(" + (a + 1) + ")" + name.substring(idx); - } else { - newName = name + "(" + (a + 1) + ")"; - } - destFile = new File(dir, newName); - if (!destFile.exists()) { - break; + File dir; + if (isMusic) { + dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC); + } else { + dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); + } + dir.mkdir(); + for (int b = 0, N = messageObjects.size(); b < N; b++) { + MessageObject message = messageObjects.get(b); + String name = message.getDocumentName(); + File destFile = new File(dir, name); + if (destFile.exists()) { + int idx = name.lastIndexOf('.'); + for (int a = 0; a < 10; a++) { + String newName; + if (idx != -1) { + newName = name.substring(0, idx) + "(" + (a + 1) + ")" + name.substring(idx); + } else { + newName = name + "(" + (a + 1) + ")"; + } + destFile = new File(dir, newName); + if (!destFile.exists()) { + break; + } } } - } - if (!destFile.exists()) { - destFile.createNewFile(); - } - String path = message.messageOwner.attachPath; - if (path != null && path.length() > 0) { - File temp = new File(path); - if (!temp.exists()) { - path = null; + if (!destFile.exists()) { + destFile.createNewFile(); + } + String path = message.messageOwner.attachPath; + if (path != null && path.length() > 0) { + File temp = new File(path); + if (!temp.exists()) { + path = null; + } + } + if (path == null || path.length() == 0) { + path = FileLoader.getPathToMessage(message.messageOwner).toString(); + } + File sourceFile = new File(path); + if (!sourceFile.exists()) { + waitingForFile = new CountDownLatch(1); + addMessageToLoad(message); + waitingForFile.await(); + } + if (sourceFile.exists()) { + copyFile(sourceFile, destFile, message.getMimeType()); } } - if (path == null || path.length() == 0) { - path = FileLoader.getPathToMessage(message.messageOwner).toString(); - } - File sourceFile = new File(path); - if (!sourceFile.exists()) { - waitingForFile = new CountDownLatch(1); - addMessageToLoad(message); - waitingForFile.await(); - } - copyFile(sourceFile, destFile, message.getMimeType()); } checkIfFinished(); } catch (Exception e) { @@ -3953,62 +3984,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener, boolean result = true; final String folderName = "NekoX"; if (Build.VERSION.SDK_INT >= 29) { - try { - int selectedType = type; - ContentValues contentValues = new ContentValues(); - String extension = MimeTypeMap.getFileExtensionFromUrl(sourceFile.getAbsolutePath()); - String mimeType = null; - if (extension != null) { - mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); - } - Uri uriToInsert = null; - if ((type == 0 || type == 1) && mimeType != null) { - if (mimeType.startsWith("image")) { - selectedType = 0; - } - if (mimeType.startsWith("video")) { - selectedType = 1; - } - } - if (selectedType == 0) { - uriToInsert = MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY); - File dirDest = new File(Environment.DIRECTORY_PICTURES, folderName); - contentValues.put(MediaStore.MediaColumns.RELATIVE_PATH, dirDest + File.separator); - contentValues.put(MediaStore.Images.Media.DISPLAY_NAME, AndroidUtilities.generateFileName(0, extension)); - contentValues.put(MediaStore.Images.Media.MIME_TYPE, mimeType); - } else if (selectedType == 1) { - File dirDest = new File(Environment.DIRECTORY_MOVIES, folderName); - contentValues.put(MediaStore.MediaColumns.RELATIVE_PATH, dirDest + File.separator); - uriToInsert = MediaStore.Video.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY); - contentValues.put(MediaStore.Video.Media.DISPLAY_NAME, AndroidUtilities.generateFileName(1, extension)); - contentValues.put(MediaStore.Video.Media.MIME_TYPE, mimeType); - } else if (selectedType == 2) { - File dirDest = new File(Environment.DIRECTORY_DOWNLOADS, folderName); - contentValues.put(MediaStore.MediaColumns.RELATIVE_PATH, dirDest + File.separator); - uriToInsert = MediaStore.Downloads.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY); - contentValues.put(MediaStore.Downloads.DISPLAY_NAME, sourceFile.getName()); - contentValues.put(MediaStore.Downloads.MIME_TYPE, mimeType); - } else { - File dirDest = new File(Environment.DIRECTORY_MUSIC, folderName); - contentValues.put(MediaStore.MediaColumns.RELATIVE_PATH, dirDest + File.separator); - uriToInsert = MediaStore.Audio.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY); - contentValues.put(MediaStore.Audio.Media.DISPLAY_NAME, sourceFile.getName()); - contentValues.put(MediaStore.Audio.Media.MIME_TYPE, mimeType); - } - - contentValues.put(MediaStore.MediaColumns.MIME_TYPE, mimeType); - - Uri dstUri = context.getContentResolver().insert(uriToInsert, contentValues); - if (dstUri != null) { - FileInputStream fileInputStream = new FileInputStream(sourceFile); - OutputStream outputStream = context.getContentResolver().openOutputStream(dstUri); - AndroidUtilities.copyFile(fileInputStream, outputStream); - fileInputStream.close(); - } - } catch (Exception e) { - FileLog.e(e); - result = false; - } + result = saveFileInternal(type, sourceFile, null); } else { File destFile; if (type == 0) { @@ -4128,6 +4104,76 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener, } } + private static boolean saveFileInternal(int type, File sourceFile, String filename) { + try { + int selectedType = type; + ContentValues contentValues = new ContentValues(); + String extension = MimeTypeMap.getFileExtensionFromUrl(sourceFile.getAbsolutePath()); + String mimeType = null; + if (extension != null) { + mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); + } + Uri uriToInsert = null; + if ((type == 0 || type == 1) && mimeType != null) { + if (mimeType.startsWith("image")) { + selectedType = 0; + } + if (mimeType.startsWith("video")) { + selectedType = 1; + } + } + final String folderName = "NekoX"; + if (selectedType == 0) { + if (filename == null) { + filename = AndroidUtilities.generateFileName(0, extension); + } + uriToInsert = MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY); + File dirDest = new File(Environment.DIRECTORY_PICTURES, folderName); + contentValues.put(MediaStore.MediaColumns.RELATIVE_PATH, dirDest + File.separator); + contentValues.put(MediaStore.Images.Media.DISPLAY_NAME, filename); + contentValues.put(MediaStore.Images.Media.MIME_TYPE, mimeType); + } else if (selectedType == 1) { + if (filename == null) { + filename = AndroidUtilities.generateFileName(1, extension); + } + File dirDest = new File(Environment.DIRECTORY_MOVIES, folderName); + contentValues.put(MediaStore.MediaColumns.RELATIVE_PATH, dirDest + File.separator); + uriToInsert = MediaStore.Video.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY); + contentValues.put(MediaStore.Video.Media.DISPLAY_NAME, filename); + } else if (selectedType == 2) { + if (filename == null) { + filename = sourceFile.getName(); + } + File dirDest = new File(Environment.DIRECTORY_DOWNLOADS, folderName); + contentValues.put(MediaStore.MediaColumns.RELATIVE_PATH, dirDest + File.separator); + uriToInsert = MediaStore.Downloads.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY); + contentValues.put(MediaStore.Downloads.DISPLAY_NAME, filename); + } else { + if (filename == null) { + filename = sourceFile.getName(); + } + File dirDest = new File(Environment.DIRECTORY_MUSIC, folderName); + contentValues.put(MediaStore.MediaColumns.RELATIVE_PATH, dirDest + File.separator); + uriToInsert = MediaStore.Audio.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY); + contentValues.put(MediaStore.Audio.Media.DISPLAY_NAME, filename); + } + + contentValues.put(MediaStore.MediaColumns.MIME_TYPE, mimeType); + + Uri dstUri = ApplicationLoader.applicationContext.getContentResolver().insert(uriToInsert, contentValues); + if (dstUri != null) { + FileInputStream fileInputStream = new FileInputStream(sourceFile); + OutputStream outputStream = ApplicationLoader.applicationContext.getContentResolver().openOutputStream(dstUri); + AndroidUtilities.copyFile(fileInputStream, outputStream); + fileInputStream.close(); + } + return true; + } catch (Exception e) { + FileLog.e(e); + return false; + } + } + public static String getStickerExt(Uri uri) { InputStream inputStream = null; try { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java index e53eaa295..1e1fb264d 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java @@ -10,6 +10,7 @@ package org.telegram.messenger; import android.app.Activity; import android.content.Context; +import android.content.Entity; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.ShortcutManager; @@ -32,7 +33,6 @@ import android.text.Spanned; import android.text.SpannedString; import android.text.TextUtils; import android.text.style.CharacterStyle; -import android.util.Log; import android.util.SparseArray; import android.widget.Toast; @@ -40,6 +40,11 @@ import androidx.core.content.pm.ShortcutInfoCompat; import androidx.core.content.pm.ShortcutManagerCompat; import androidx.core.graphics.drawable.IconCompat; +import androidx.collection.LongSparseArray; +import androidx.core.content.pm.ShortcutInfoCompat; +import androidx.core.content.pm.ShortcutManagerCompat; +import androidx.core.graphics.drawable.IconCompat; + import org.telegram.SQLite.SQLiteCursor; import org.telegram.SQLite.SQLiteDatabase; import org.telegram.SQLite.SQLiteException; @@ -53,7 +58,6 @@ import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.Components.AvatarDrawable; import org.telegram.ui.Components.Bulletin; -import org.telegram.ui.Components.SharedMediaLayout; import org.telegram.ui.Components.StickerSetBulletinLayout; import org.telegram.ui.Components.StickersArchiveAlert; import org.telegram.ui.Components.TextStyleSpan; @@ -63,7 +67,6 @@ import org.telegram.ui.LaunchActivity; import java.io.File; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; @@ -74,6 +77,8 @@ import java.util.Map; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CountDownLatch; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import androidx.collection.LongSparseArray; import tw.nekomimi.nkmr.NekomuraConfig; @@ -82,6 +87,10 @@ import tw.nekomimi.nekogram.PinnedStickerHelper; @SuppressWarnings("unchecked") public class MediaDataController extends BaseController { + private static Pattern BOLD_PATTERN = Pattern.compile("\\*\\*(.+?)\\*\\*"), + ITALIC_PATTERN = Pattern.compile("__(.+?)__"), + SPOILER_PATTERN = Pattern.compile("\\|\\|(.+?)\\|\\|"), + STRIKE_PATTERN = Pattern.compile("~~(.+?)~~"); public static String SHORTCUT_CATEGORY = "org.telegram.messenger.SHORTCUT_SHARE"; @@ -158,6 +167,14 @@ public class MediaDataController extends BaseController { public static final int TYPE_GREETINGS = 3; + private int reactionsUpdateHash; + private List reactionsList = new ArrayList<>(); + private List enabledReactionsList = new ArrayList<>(); + private HashMap reactionsMap = new HashMap<>(); + private String doubleTapReaction; + private boolean isLoadingReactions; + private int reactionsUpdateDate; + private ArrayList[] stickerSets = new ArrayList[]{new ArrayList<>(), new ArrayList<>(), new ArrayList<>(0), new ArrayList<>(), new ArrayList<>()}; private LongSparseArray[] stickersByIds = new LongSparseArray[]{new LongSparseArray<>(), new LongSparseArray<>(), new LongSparseArray<>(), new LongSparseArray<>(), new LongSparseArray<>()}; private LongSparseArray stickerSetsById = new LongSparseArray<>(); @@ -269,6 +286,136 @@ public class MediaDataController extends BaseController { } } + public void checkReactions() { + if (!isLoadingReactions && Math.abs(System.currentTimeMillis() / 1000 - reactionsUpdateDate) >= 60 * 60) { + loadReactions(true, false); + } + } + + public List getReactionsList() { + return reactionsList; + } + + public void loadReactions(boolean cache, boolean force) { + isLoadingReactions = true; + if (cache) { + getMessagesStorage().getStorageQueue().postRunnable(() -> { + SQLiteCursor c = null; + int hash = 0; + int date = 0; + List reactions = null; + try { + c = getMessagesStorage().getDatabase().queryFinalized("SELECT data, hash, date FROM reactions"); + if (c.next()) { + NativeByteBuffer data = c.byteBufferValue(0); + if (data != null) { + int count = data.readInt32(false); + reactions = new ArrayList<>(count); + for (int i = 0; i < count; i++) { + TLRPC.TL_availableReaction react = TLRPC.TL_availableReaction.TLdeserialize(data, data.readInt32(false), true); + reactions.add(react); + } + data.reuse(); + } + hash = c.intValue(1); + date = c.intValue(2); + } + } catch (Exception e) { + FileLog.e(e); + } finally { + if (c != null) { + c.dispose(); + } + } + processLoadedReactions(reactions, hash, date, true); + }); + } else { + TLRPC.TL_messages_getAvailableReactions req = new TLRPC.TL_messages_getAvailableReactions(); + req.hash = force ? 0 : reactionsUpdateHash; + getConnectionsManager().sendRequest(req, (response, error) -> { + int date = (int) (System.currentTimeMillis() / 1000); + if (response instanceof TLRPC.TL_messages_availableReactionsNotModified) { + processLoadedReactions(null, 0, date, false); + } else if (response instanceof TLRPC.TL_messages_availableReactions) { + TLRPC.TL_messages_availableReactions r = (TLRPC.TL_messages_availableReactions) response; + processLoadedReactions(r.reactions, r.hash, date, false); + } + }); + } + } + + private void processLoadedReactions(List reactions, int hash, int date, boolean cache) { + if (reactions != null && date != 0) { + reactionsList.clear(); + reactionsMap.clear(); + enabledReactionsList.clear(); + reactionsList.addAll(reactions); + for (int i = 0; i < reactionsList.size(); i++) { + reactionsList.get(i).positionInList = i; + reactionsMap.put(reactionsList.get(i).reaction, reactionsList.get(i)); + if (!reactionsList.get(i).inactive) { + enabledReactionsList.add(reactionsList.get(i)); + } + } + reactionsUpdateHash = hash; + } + reactionsUpdateDate = date; + if (reactions != null) { + AndroidUtilities.runOnUIThread(() -> { + for (int i = 0; i < reactions.size(); i++) { + ImageReceiver imageReceiver = new ImageReceiver(); + TLRPC.TL_availableReaction reaction = reactions.get(i); + imageReceiver.setImage(ImageLocation.getForDocument(reaction.activate_animation), null, null, null, 0, 1); + imageReceiver.setImage(ImageLocation.getForDocument(reaction.appear_animation), null, null, null, 0, 1); + imageReceiver = new ImageReceiver(); + imageReceiver.setImage(ImageLocation.getForDocument(reaction.static_icon), null, null, null, 0, 1); + } + NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.reactionsDidLoad); + }); + } + + if (!cache) { + putReactionsToCache(reactions, hash, date); + } else if (Math.abs(System.currentTimeMillis() / 1000 - date) >= 60 * 60) { + loadReactions(false, true); + } + } + + private void putReactionsToCache(List reactions, int hash, int date) { + ArrayList reactionsFinal = reactions != null ? new ArrayList<>(reactions) : null; + getMessagesStorage().getStorageQueue().postRunnable(() -> { + try { + if (reactionsFinal != null) { + SQLitePreparedStatement state = getMessagesStorage().getDatabase().executeFast("REPLACE INTO reactions VALUES(?, ?, ?)"); + state.requery(); + int size = 4; // Integer.BYTES + for (int a = 0; a < reactionsFinal.size(); a++) { + size += reactionsFinal.get(a).getObjectSize(); + } + NativeByteBuffer data = new NativeByteBuffer(size); + data.writeInt32(reactionsFinal.size()); + for (int a = 0; a < reactionsFinal.size(); a++) { + reactionsFinal.get(a).serializeToStream(data); + } + state.bindByteBuffer(1, data); + state.bindInteger(2, hash); + state.bindInteger(3, date); + state.step(); + data.reuse(); + state.dispose(); + } else { + SQLitePreparedStatement state = getMessagesStorage().getDatabase().executeFast("UPDATE reactions SET date = ?"); + state.requery(); + state.bindLong(1, date); + state.step(); + state.dispose(); + } + } catch (Exception e) { + FileLog.e(e); + } + }); + } + public void checkFeaturedStickers() { if (!loadingFeaturedStickers && (!featuredStickersLoaded || Math.abs(System.currentTimeMillis() / 1000 - loadFeaturedDate) >= 60 * 60)) { loadFeaturedStickers(true, false); @@ -4375,7 +4522,7 @@ public class MediaDataController extends BaseController { Collections.sort(entities, entityComparator); } - private static boolean checkInclusion(int index, ArrayList entities, boolean end) { + private static boolean checkInclusion(int index, List entities, boolean end) { if (entities == null || entities.isEmpty()) { return false; } @@ -4389,7 +4536,7 @@ public class MediaDataController extends BaseController { return false; } - private static boolean checkIntersection(int start, int end, ArrayList entities) { + private static boolean checkIntersection(int start, int end, List entities) { if (entities == null || entities.isEmpty()) { return false; } @@ -4403,16 +4550,6 @@ public class MediaDataController extends BaseController { return false; } - private static void removeOffsetAfter(int start, int countToRemove, ArrayList entities) { - int count = entities.size(); - for (int a = 0; a < count; a++) { - TLRPC.MessageEntity entity = entities.get(a); - if (entity.offset > start) { - entity.offset -= countToRemove; - } - } - } - public CharSequence substring(CharSequence source, int start, int end) { if (source instanceof SpannableStringBuilder) { return source.subSequence(start, end); @@ -4500,14 +4637,30 @@ public class MediaDataController extends BaseController { } } } - if (span != null && start < end) { - editable.setSpan(span, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + if (span != null && start < end && start < editable.length()) { + editable.setSpan(span, start, Math.min(editable.length(), end), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } } catch (Exception e) { FileLog.e(e); } } + public static void addTextStyleRuns(TLRPC.DraftMessage msg, Spannable text) { + addTextStyleRuns(msg.entities, msg.message, text); + } + + public static void addTextStyleRuns(MessageObject msg, Spannable text) { + addTextStyleRuns(msg.messageOwner.entities, msg.messageText, text); + } + + public static void addTextStyleRuns(ArrayList entities, CharSequence messageText, Spannable text) { + for (TextStyleSpan prevSpan : text.getSpans(0, text.length(), TextStyleSpan.class)) + text.removeSpan(prevSpan); + for (TextStyleSpan.TextStyleRun run : MediaDataController.getTextStyleRuns(entities, messageText)) { + MediaDataController.addStyleToText(new TextStyleSpan(run), run.start, run.end, text, true); + } + } + public static ArrayList getTextStyleRuns(ArrayList entities, CharSequence text) { ArrayList runs = new ArrayList<>(); ArrayList entitiesCopy = new ArrayList<>(entities); @@ -4532,7 +4685,9 @@ public class MediaDataController extends BaseController { newRun.start = entity.offset; newRun.end = newRun.start + entity.length; TLRPC.MessageEntity urlEntity = null; - if (entity instanceof TLRPC.TL_messageEntityStrike) { + if (entity instanceof TLRPC.TL_messageEntitySpoiler) { + newRun.flags = TextStyleSpan.FLAG_STYLE_SPOILER; + } else if (entity instanceof TLRPC.TL_messageEntityStrike) { newRun.flags = TextStyleSpan.FLAG_STYLE_STRIKE; } else if (entity instanceof TLRPC.TL_messageEntityUnderline) { newRun.flags = TextStyleSpan.FLAG_STYLE_UNDERLINE; @@ -4623,42 +4778,26 @@ public class MediaDataController extends BaseController { } public void addStyle(int flags, int spanStart, int spanEnd, ArrayList entities) { - if ((flags & TextStyleSpan.FLAG_STYLE_BOLD) != 0) { - TLRPC.MessageEntity entity = new TLRPC.TL_messageEntityBold(); - entity.offset = spanStart; - entity.length = spanEnd - spanStart; - entities.add(entity); - } - if ((flags & TextStyleSpan.FLAG_STYLE_ITALIC) != 0) { - TLRPC.MessageEntity entity = new TLRPC.TL_messageEntityItalic(); - entity.offset = spanStart; - entity.length = spanEnd - spanStart; - entities.add(entity); - } - if ((flags & TextStyleSpan.FLAG_STYLE_MONO) != 0) { - TLRPC.MessageEntity entity = new TLRPC.TL_messageEntityCode(); - entity.offset = spanStart; - entity.length = spanEnd - spanStart; - entities.add(entity); - } - if ((flags & TextStyleSpan.FLAG_STYLE_STRIKE) != 0) { - TLRPC.MessageEntity entity = new TLRPC.TL_messageEntityStrike(); - entity.offset = spanStart; - entity.length = spanEnd - spanStart; - entities.add(entity); - } - if ((flags & TextStyleSpan.FLAG_STYLE_UNDERLINE) != 0) { - TLRPC.MessageEntity entity = new TLRPC.TL_messageEntityUnderline(); - entity.offset = spanStart; - entity.length = spanEnd - spanStart; - entities.add(entity); - } - if ((flags & TextStyleSpan.FLAG_STYLE_QUOTE) != 0) { - TLRPC.MessageEntity entity = new TLRPC.TL_messageEntityBlockquote(); - entity.offset = spanStart; - entity.length = spanEnd - spanStart; - entities.add(entity); - } + if ((flags & TextStyleSpan.FLAG_STYLE_SPOILER) != 0) + entities.add(setEntityStartEnd(new TLRPC.TL_messageEntitySpoiler(), spanStart, spanEnd)); + if ((flags & TextStyleSpan.FLAG_STYLE_BOLD) != 0) + entities.add(setEntityStartEnd(new TLRPC.TL_messageEntityBold(), spanStart, spanEnd)); + if ((flags & TextStyleSpan.FLAG_STYLE_ITALIC) != 0) + entities.add(setEntityStartEnd(new TLRPC.TL_messageEntityItalic(), spanStart, spanEnd)); + if ((flags & TextStyleSpan.FLAG_STYLE_MONO) != 0) + entities.add(setEntityStartEnd(new TLRPC.TL_messageEntityCode(), spanStart, spanEnd)); + if ((flags & TextStyleSpan.FLAG_STYLE_STRIKE) != 0) + entities.add(setEntityStartEnd(new TLRPC.TL_messageEntityStrike(), spanStart, spanEnd)); + if ((flags & TextStyleSpan.FLAG_STYLE_UNDERLINE) != 0) + entities.add(setEntityStartEnd(new TLRPC.TL_messageEntityUnderline(), spanStart, spanEnd)); + if ((flags & TextStyleSpan.FLAG_STYLE_QUOTE) != 0) + entities.add(setEntityStartEnd(new TLRPC.TL_messageEntityBlockquote(), spanStart, spanEnd)); + } + + private TLRPC.MessageEntity setEntityStartEnd(TLRPC.MessageEntity entity, int spanStart, int spanEnd) { + entity.offset = spanStart; + entity.length = spanEnd - spanStart; + return entity; } public ArrayList getEntities(CharSequence[] message, boolean allowStrike) { @@ -4672,9 +4811,6 @@ public class MediaDataController extends BaseController { boolean isPre = false; final String mono = "`"; final String pre = "```"; - final String bold = "**"; - final String italic = "__"; - final String strike = "~~"; while ((index = TextUtils.indexOf(message[0], !isPre ? mono : pre, lastIndex)) != -1) { if (start == -1) { isPre = message[0].length() - index > 2 && message[0].charAt(index + 1) == '`' && message[0].charAt(index + 2) == '`'; @@ -4797,79 +4933,40 @@ public class MediaDataController extends BaseController { } } - int count = allowStrike ? 3 : 2; - for (int c = 0; c < count; c++) { - lastIndex = 0; - start = -1; - String checkString; - char checkChar; - switch (c) { - case 0: - checkString = bold; - checkChar = '*'; - break; - case 1: - checkString = italic; - checkChar = '_'; - break; - case 2: - default: - checkString = strike; - checkChar = '~'; - break; - } - while ((index = TextUtils.indexOf(message[0], checkString, lastIndex)) != -1) { - if (start == -1) { - char prevChar = index == 0 ? ' ' : message[0].charAt(index - 1); - if (!checkInclusion(index, entities, false) && (prevChar == ' ' || prevChar == '\n')) { - start = index; - } - lastIndex = index + 2; - } else { - for (int a = index + 2; a < message[0].length(); a++) { - if (message[0].charAt(a) == checkChar) { - index++; - } else { - break; - } - } - lastIndex = index + 2; - if (checkInclusion(index, entities, false) || checkIntersection(start, index, entities)) { - start = -1; - continue; - } - if (start + 2 != index) { - if (entities == null) { - entities = new ArrayList<>(); - } - try { - message[0] = AndroidUtilities.concat(substring(message[0], 0, start), substring(message[0], start + 2, index), substring(message[0], index + 2, message[0].length())); - } catch (Exception e) { - message[0] = substring(message[0], 0, start).toString() + substring(message[0], start + 2, index).toString() + substring(message[0], index + 2, message[0].length()).toString(); - } - - TLRPC.MessageEntity entity; - if (c == 0) { - entity = new TLRPC.TL_messageEntityBold(); - } else if (c == 1) { - entity = new TLRPC.TL_messageEntityItalic(); - } else { - entity = new TLRPC.TL_messageEntityStrike(); - } - entity.offset = start; - entity.length = index - start - 2; - removeOffsetAfter(entity.offset + entity.length, 4, entities); - entities.add(entity); - lastIndex -= 4; - } - start = -1; - } - } + CharSequence cs = message[0]; + if (entities == null) entities = new ArrayList<>(); + cs = parsePattern(cs, BOLD_PATTERN, entities, obj -> new TLRPC.TL_messageEntityBold()); + cs = parsePattern(cs, ITALIC_PATTERN, entities, obj -> new TLRPC.TL_messageEntityItalic()); + cs = parsePattern(cs, SPOILER_PATTERN, entities, obj -> new TLRPC.TL_messageEntitySpoiler()); + if (allowStrike) { + cs = parsePattern(cs, STRIKE_PATTERN, entities, obj -> new TLRPC.TL_messageEntityStrike()); } + message[0] = cs; return entities; } + private CharSequence parsePattern(CharSequence cs, Pattern pattern, List entities, GenericProvider entityProvider) { + Matcher m = pattern.matcher(cs); + int offset = 0; + while (m.find()) { + if (checkInclusion(m.start(), entities, false) || checkIntersection(m.start(), m.end(), entities)) { + + } + + String gr = m.group(1); + cs = cs.subSequence(0, m.start() - offset) + gr + cs.subSequence(m.end() - offset, cs.length()); + + TLRPC.MessageEntity entity = entityProvider.provide(null); + entity.offset = m.start() + offset; + entity.length = gr.length(); + entities.add(entity); + + offset += m.end() - m.start() - gr.length(); + } + return cs; + } + //---------------- MESSAGES END ---------------- private LongSparseArray draftsFolderIds = new LongSparseArray<>(); @@ -5392,6 +5489,33 @@ public class MediaDataController extends BaseController { }); } + public HashMap getReactionsMap() { + return reactionsMap; + } + + public String getDoubleTapReaction() { + if (doubleTapReaction != null) { + return doubleTapReaction; + } + if (!getReactionsList().isEmpty()) { + String savedReaction = MessagesController.getEmojiSettings(currentAccount).getString("reaction_on_double_tap", null); + if (savedReaction != null && getReactionsMap().get(savedReaction) != null) { + doubleTapReaction = savedReaction; + return doubleTapReaction; + } + return getReactionsList().get(0).reaction; + } + return null; + } + + public void setDoubleTapReaction(String reaction) { + MessagesController.getEmojiSettings(currentAccount).edit().putString("reaction_on_double_tap", reaction).apply(); + doubleTapReaction = reaction; + } + + public List getEnabledReactionsList() { + return enabledReactionsList; + } //---------------- BOT END ---------------- //---------------- EMOJI START ---------------- diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java index 9ca0e1c70..4385bdc8a 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java @@ -10,6 +10,7 @@ package org.telegram.messenger; import android.graphics.Typeface; import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Build; import android.text.Layout; @@ -25,6 +26,8 @@ import android.text.style.URLSpan; import android.text.util.Linkify; import android.util.Base64; +import androidx.collection.LongSparseArray; + import org.telegram.PhoneFormat.PhoneFormat; import org.telegram.messenger.browser.Browser; import org.telegram.tgnet.ConnectionsManager; @@ -33,6 +36,7 @@ import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Cells.ChatMessageCell; +import org.telegram.ui.Components.spoilers.SpoilerEffect; import org.telegram.ui.Components.TextStyleSpan; import org.telegram.ui.Components.TypefaceSpan; import org.telegram.ui.Components.URLSpanBotCommand; @@ -54,6 +58,9 @@ import java.util.Calendar; import java.util.Collections; import java.util.GregorianCalendar; import java.util.HashMap; +import java.util.List; +import java.util.Stack; +import java.util.concurrent.atomic.AtomicReference; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -62,6 +69,7 @@ import tw.nekomimi.nkmr.NekomuraConfig; import tw.nekomimi.nekogram.NekoXConfig; import androidx.collection.LongSparseArray; +import androidx.core.math.MathUtils; public class MessageObject { @@ -94,6 +102,9 @@ public class MessageObject { public CharSequence caption; public MessageObject replyMessageObject; public int type = 1000; + public boolean reactionsVisibleOnScreen; + public long reactionsLastCheckTime; + public String customName; private int isRoundVideoCached; public long eventId; public int contentType; @@ -127,8 +138,12 @@ public class MessageObject { public boolean isRestrictedMessage; public long loadedFileSize; + public boolean isSpoilersRevealed; public byte[] sponsoredId; public int sponsoredChannelPost; + public TLRPC.ChatInvite sponsoredChatInvite; + public String sponsoredChatInviteHash; + public String botStartParam; public boolean animateComments; @@ -210,11 +225,16 @@ public class MessageObject { " & ", " . " }; + public Drawable customAvatarDrawable; public int getEmojiOnlyCount() { return emojiOnlyCount; } + public boolean shouldDrawReactionsInLayout() { + return getDialogId() < 0; + } + public static class SendAnimationData { public float x; public float y; @@ -351,6 +371,9 @@ public class MessageObject { } public static class TextLayoutBlock { + public final static int FLAG_RTL = 1, FLAG_NOT_RTL = 2; + + public AtomicReference spoilersPatchedTextLayout = new AtomicReference<>(); public StaticLayout textLayout; public float textYOffset; public int charactersOffset; @@ -358,9 +381,10 @@ public class MessageObject { public int height; public int heightByOffset; public byte directionFlags; + public List spoilers = new ArrayList<>(); public boolean isRtl() { - return (directionFlags & 1) != 0 && (directionFlags & 2) == 0; + return (directionFlags & FLAG_RTL) != 0 && (directionFlags & FLAG_NOT_RTL) == 0; } } @@ -822,13 +846,17 @@ public class MessageObject { } public MessageObject findPrimaryMessageObject() { + return findMessageWithFlags(MessageObject.POSITION_FLAG_TOP | MessageObject.POSITION_FLAG_LEFT); + } + + public MessageObject findMessageWithFlags(int flags) { if (!messages.isEmpty() && positions.isEmpty()) { calculate(); } for (int i = 0; i < messages.size(); i++) { MessageObject object = messages.get(i); MessageObject.GroupedMessagePosition position = positions.get(object); - if (position != null && (position.flags & (MessageObject.POSITION_FLAG_TOP | MessageObject.POSITION_FLAG_LEFT)) != 0) { + if (position != null && (position.flags & (flags)) == flags) { return object; } } @@ -1652,12 +1680,16 @@ public class MessageObject { message = new TLRPC.TL_message(); message.out = false; message.unread = false; - message.from_id = new TLRPC.TL_peerUser(); - message.from_id.user_id = event.user_id; message.peer_id = peer_id; message.date = event.date; TLRPC.Message newMessage = ((TLRPC.TL_channelAdminLogEventActionEditMessage) event.action).new_message; TLRPC.Message oldMessage = ((TLRPC.TL_channelAdminLogEventActionEditMessage) event.action).prev_message; + if (newMessage != null && newMessage.from_id != null) { + message.from_id = newMessage.from_id; + } else { + message.from_id = new TLRPC.TL_peerUser(); + message.from_id.user_id = event.user_id; + } if (newMessage.media != null && !(newMessage.media instanceof TLRPC.TL_messageMediaEmpty) && !(newMessage.media instanceof TLRPC.TL_messageMediaWebPage)/* && TextUtils.isEmpty(newMessage.message)*/) { boolean changedCaption; boolean changedMedia; @@ -1864,6 +1896,10 @@ public class MessageObject { } else if (event.action instanceof TLRPC.TL_channelAdminLogEventActionSendMessage) { message = ((TLRPC.TL_channelAdminLogEventActionSendMessage) event.action).message; messageText = replaceWithLink(LocaleController.getString("EventLogSendMessages", R.string.EventLogSendMessages), "un1", fromUser); + } else if (event.action instanceof TLRPC.TL_channelAdminLogEventActionChangeAvailableReactions) { + String oldReactions = TextUtils.join(", ", ((TLRPC.TL_channelAdminLogEventActionChangeAvailableReactions) event.action).prev_value); + String newReactions = TextUtils.join(", ", ((TLRPC.TL_channelAdminLogEventActionChangeAvailableReactions) event.action).new_value); + messageText = replaceWithLink(LocaleController.formatString("ActionReactionsChanged", R.string.ActionReactionsChanged, oldReactions, newReactions), "un1", fromUser); } else { messageText = "unsupported " + event.action; } @@ -2125,7 +2161,8 @@ public class MessageObject { mess = mess.subSequence(0, 20) + "..."; } mess = Emoji.replaceEmoji(mess, Theme.chat_msgTextPaint.getFontMetricsInt(), AndroidUtilities.dp(20), false); - messageText = replaceWithLink(LocaleController.formatString("ActionPinnedText", R.string.ActionPinnedText, mess), "un1", fromUser != null ? fromUser : chat); + MediaDataController.addTextStyleRuns(replyMessageObject, (Spannable) mess); + messageText = replaceWithLink(AndroidUtilities.formatSpannable(LocaleController.getString("ActionPinnedText", R.string.ActionPinnedText), mess), "un1", fromUser != null ? fromUser : chat); } else { messageText = replaceWithLink(LocaleController.getString("ActionPinnedNoText", R.string.ActionPinnedNoText), "un1", fromUser != null ? fromUser : chat); } @@ -4061,7 +4098,8 @@ public class MessageObject { entity instanceof TLRPC.TL_messageEntityPre || entity instanceof TLRPC.TL_messageEntityMentionName || entity instanceof TLRPC.TL_inputMessageEntityMentionName || - entity instanceof TLRPC.TL_messageEntityTextUrl) { + entity instanceof TLRPC.TL_messageEntityTextUrl || + entity instanceof TLRPC.TL_messageEntitySpoiler) { if (spans != null && spans.length > 0) { for (int b = 0; b < spans.length; b++) { if (spans[b] == null) { @@ -4081,7 +4119,9 @@ public class MessageObject { newRun.start = entity.offset; newRun.end = newRun.start + entity.length; TLRPC.MessageEntity urlEntity = null; - if (entity instanceof TLRPC.TL_messageEntityStrike) { + if (entity instanceof TLRPC.TL_messageEntitySpoiler) { + newRun.flags = TextStyleSpan.FLAG_STYLE_SPOILER; + } else if (entity instanceof TLRPC.TL_messageEntityStrike) { newRun.flags = TextStyleSpan.FLAG_STYLE_STRIKE; } else if (entity instanceof TLRPC.TL_messageEntityUnderline) { newRun.flags = TextStyleSpan.FLAG_STYLE_UNDERLINE; @@ -4188,6 +4228,7 @@ public class MessageObject { for (int a = 0; a < count; a++) { TextStyleSpan.TextStyleRun run = runs.get(a); + boolean setRun = false; String url = run.urlEntity != null ? TextUtils.substring(text, run.urlEntity.offset, run.urlEntity.offset + run.urlEntity.length) : null; if (run.urlEntity instanceof TLRPC.TL_messageEntityBotCommand) { spannable.setSpan(new URLSpanBotCommand(url, t, run), run.start, run.end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); @@ -4222,6 +4263,10 @@ public class MessageObject { } else if ((run.flags & TextStyleSpan.FLAG_STYLE_MONO) != 0) { spannable.setSpan(new URLSpanMono(spannable, run.start, run.end, t, run), run.start, run.end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } else { + setRun = true; + spannable.setSpan(new TextStyleSpan(run), run.start, run.end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + } + if (!setRun && (run.flags & TextStyleSpan.FLAG_STYLE_SPOILER) != 0) { spannable.setSpan(new TextStyleSpan(run), run.start, run.end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } } @@ -4417,6 +4462,7 @@ public class MessageObject { block.textYOffset = 0; block.charactersOffset = 0; block.charactersEnd = textLayout.getText().length(); + if (emojiOnlyCount != 0) { switch (emojiOnlyCount) { case 1: @@ -4444,15 +4490,17 @@ public class MessageObject { block.charactersOffset = startCharacter; block.charactersEnd = endCharacter; try { + SpannableStringBuilder sb = SpannableStringBuilder.valueOf(messageText.subSequence(startCharacter, endCharacter)); if (hasUrls && Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - block.textLayout = StaticLayout.Builder.obtain(messageText, startCharacter, endCharacter, paint, maxWidth + AndroidUtilities.dp(2)) + block.textLayout = StaticLayout.Builder.obtain(sb, 0, sb.length(), paint, maxWidth + AndroidUtilities.dp(2)) .setBreakStrategy(StaticLayout.BREAK_STRATEGY_HIGH_QUALITY) .setHyphenationFrequency(StaticLayout.HYPHENATION_FREQUENCY_NONE) .setAlignment(Layout.Alignment.ALIGN_NORMAL) .build(); } else { - block.textLayout = new StaticLayout(messageText, startCharacter, endCharacter, paint, maxWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); + block.textLayout = new StaticLayout(sb, 0, sb.length(), paint, maxWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); } + block.textYOffset = textLayout.getLineTop(linesOffset); if (a != 0) { block.height = (int) (block.textYOffset - prevOffset); @@ -4472,6 +4520,10 @@ public class MessageObject { } } } + block.spoilers.clear(); + if (!isSpoilersRevealed) { + SpoilerEffect.addSpoilers(null, block.textLayout, null, block.spoilers); + } textLayoutBlocks.add(block); @@ -4535,10 +4587,10 @@ public class MessageObject { if (lineLeft > 0) { textXOffset = Math.min(textXOffset, lineLeft); - block.directionFlags |= 1; + block.directionFlags |= TextLayoutBlock.FLAG_RTL; hasRtl = true; } else { - block.directionFlags |= 2; + block.directionFlags |= TextLayoutBlock.FLAG_NOT_RTL; } try { @@ -4570,9 +4622,9 @@ public class MessageObject { linesMaxWidth += lastLeft; } hasRtl = blocksCount != 1; - block.directionFlags |= 1; + block.directionFlags |= TextLayoutBlock.FLAG_RTL; } else { - block.directionFlags |= 2; + block.directionFlags |= TextLayoutBlock.FLAG_NOT_RTL; } textWidth = Math.max(textWidth, Math.min(maxWidth, linesMaxWidth)); @@ -4606,10 +4658,16 @@ public class MessageObject { } public boolean needDrawAvatar() { + if (customAvatarDrawable != null) { + return true; + } return !isSponsored() && (isFromUser() || isFromGroup() || eventId != 0 || messageOwner.fwd_from != null && messageOwner.fwd_from.saved_from_peer != null); } private boolean needDrawAvatarInternal() { + if (customAvatarDrawable != null) { + return true; + } return !isSponsored() && (isFromChat() && isFromUser() || isFromGroup() || eventId != 0 || messageOwner.fwd_from != null && messageOwner.fwd_from.saved_from_peer != null); } @@ -5881,7 +5939,7 @@ public class MessageObject { if (message.out && message instanceof TLRPC.TL_messageService) { return message.id != 1 && ChatObject.canUserDoAdminAction(chat, ChatObject.ACTION_DELETE_MESSAGES); } - return inScheduleMode || message.id != 1 && (chat.creator || chat.admin_rights != null && (chat.admin_rights.delete_messages || message.out && (chat.megagroup || chat.admin_rights.post_messages)) || chat.megagroup && message.out && (message.from_id instanceof TLRPC.TL_peerUser || message.from_id instanceof TLRPC.TL_peerChannel)); + return inScheduleMode || message.id != 1 && (chat.creator || chat.admin_rights != null && (chat.admin_rights.delete_messages || message.out && (chat.megagroup || chat.admin_rights.post_messages)) || chat.megagroup && message.out); } return inScheduleMode || isOut(message) || !ChatObject.isChannel(chat); } @@ -6233,4 +6291,75 @@ public class MessageObject { public boolean equals(MessageObject obj) { return getId() == obj.getId() && getDialogId() == obj.getDialogId(); } + + public boolean isReactionsAvailable() { + return !isEditing() && !isSponsored() && isSent() && messageOwner.action == null; + } + + public boolean selectReaction(String reaction, boolean fromDoubleTap) { + if (messageOwner.reactions == null) { + messageOwner.reactions = new TLRPC.TL_messageReactions(); + messageOwner.reactions.can_see_list = isFromGroup() || isFromUser(); + } + + TLRPC.TL_reactionCount choosenReaction = null; + TLRPC.TL_reactionCount newReaction = null; + for (int i = 0; i < messageOwner.reactions.results.size(); i++) { + if (messageOwner.reactions.results.get(i).chosen) { + choosenReaction = messageOwner.reactions.results.get(i); + } + if (messageOwner.reactions.results.get(i).reaction.equals(reaction)) { + newReaction = messageOwner.reactions.results.get(i); + } + } + + if (choosenReaction != null && (choosenReaction == newReaction || fromDoubleTap)) { + choosenReaction.chosen = false; + choosenReaction.count--; + if (choosenReaction.count <= 0) { + messageOwner.reactions.results.remove(choosenReaction); + } + if (messageOwner.reactions.can_see_list) { + for (int i = 0; i < messageOwner.reactions.recent_reactons.size(); i++) { + if (messageOwner.reactions.recent_reactons.get(i).user_id == UserConfig.getInstance(currentAccount).getClientUserId()) { + messageOwner.reactions.recent_reactons.remove(i); + i--; + } + } + } + return false; + } + + if (choosenReaction != null) { + choosenReaction.chosen = false; + choosenReaction.count--; + if (choosenReaction.count <= 0) { + messageOwner.reactions.results.remove(choosenReaction); + } + if (messageOwner.reactions.can_see_list) { + for (int i = 0; i < messageOwner.reactions.recent_reactons.size(); i++) { + if (messageOwner.reactions.recent_reactons.get(i).user_id == UserConfig.getInstance(currentAccount).getClientUserId()) { + messageOwner.reactions.recent_reactons.remove(i); + i--; + } + } + } + } + if (newReaction == null) { + newReaction = new TLRPC.TL_reactionCount(); + newReaction.reaction = reaction; + messageOwner.reactions.results.add(newReaction); + } + + newReaction.chosen = true; + newReaction.count++; + + if (messageOwner.reactions.can_see_list) { + TLRPC.TL_messageUserReaction action = new TLRPC.TL_messageUserReaction(); + messageOwner.reactions.recent_reactons.add(0, action); + action.user_id = UserConfig.getInstance(currentAccount).getClientUserId(); + action.reaction = reaction; + } + return true; + } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java index 9af977fc7..43625aa95 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java @@ -42,27 +42,26 @@ import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; -import org.telegram.ui.ActionBar.EmojiThemes; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.ChatActivity; import org.telegram.ui.Components.AlertsCreator; import org.telegram.ui.Components.BulletinFactory; import org.telegram.ui.Components.JoinCallAlert; import org.telegram.ui.Components.MotionBackgroundDrawable; +import org.telegram.ui.Components.SwipeGestureSettingsView; import org.telegram.ui.DialogsActivity; import org.telegram.ui.EditWidgetActivity; import org.telegram.ui.LaunchActivity; import org.telegram.ui.ProfileActivity; -import org.telegram.ui.Components.SwipeGestureSettingsView; import java.io.File; -import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; @@ -149,6 +148,10 @@ public class MessagesController extends BaseController implements NotificationCe private int pollsToCheckSize; private long lastViewsCheckTime; + private LongSparseArray> reactionsToCheck = new LongSparseArray<>(); + private long lastReactionsCheckTime; + private LongSparseArray> reactionsTempDialogs = new LongSparseArray<>(); + public ArrayList dialogFilters = new ArrayList<>(); public SparseArray dialogFiltersById = new SparseArray<>(); private boolean loadingSuggestedFilters; @@ -304,6 +307,8 @@ public class MessagesController extends BaseController implements NotificationCe public int mapProvider; public int availableMapProviders; public int updateCheckDelay; + public int chatReadMarkSizeThreshold; + public int chatReadMarkExpirePeriod; public String mapKey; public int maxMessageLength; public int maxCaptionLength; @@ -333,7 +338,6 @@ public class MessagesController extends BaseController implements NotificationCe public Set exportPrivateUri; public boolean autoarchiveAvailable; public int groipCallVideoMaxParticipants; - public int chatReadMarkSizeThreshold; public boolean suggestStickersApiOnly; public ArrayList gifSearchEmojies = new ArrayList<>(); public HashSet diceEmojies; @@ -882,6 +886,7 @@ public class MessagesController extends BaseController implements NotificationCe autoarchiveAvailable = mainPreferences.getBoolean("autoarchiveAvailable", false); groipCallVideoMaxParticipants = mainPreferences.getInt("groipCallVideoMaxParticipants", 30); chatReadMarkSizeThreshold = mainPreferences.getInt("chatReadMarkSizeThreshold", 100); + chatReadMarkExpirePeriod = mainPreferences.getInt("chatReadMarkExpirePeriod", 7 * 86400); suggestStickersApiOnly = mainPreferences.getBoolean("suggestStickersApiOnly", false); roundVideoSize = mainPreferences.getInt("roundVideoSize", 384); roundVideoBitrate = mainPreferences.getInt("roundVideoBitrate", 1000); @@ -1228,7 +1233,6 @@ public class MessagesController extends BaseController implements NotificationCe getMessagesStorage().putDialogs(pinnedRemoteDialogs, 0); } - AndroidUtilities.runOnUIThread(() -> { if (remote != 2) { dialogFilters = filters; @@ -1752,7 +1756,6 @@ public class MessagesController extends BaseController implements NotificationCe case "chat_read_mark_size_threshold": { if (value.value instanceof TLRPC.TL_jsonNumber) { TLRPC.TL_jsonNumber number = (TLRPC.TL_jsonNumber) value.value; - Log.e("test", chatReadMarkSizeThreshold + ""); if (number.value != chatReadMarkSizeThreshold) { chatReadMarkSizeThreshold = (int) number.value; editor.putInt("chatReadMarkSizeThreshold", chatReadMarkSizeThreshold); @@ -1761,6 +1764,17 @@ public class MessagesController extends BaseController implements NotificationCe } break; } + case "chat_read_mark_expire_period": { + if (value.value instanceof TLRPC.TL_jsonNumber) { + TLRPC.TL_jsonNumber number = (TLRPC.TL_jsonNumber) value.value; + if (number.value != chatReadMarkExpirePeriod) { + chatReadMarkExpirePeriod = (int) number.value; + editor.putInt("chatReadMarkExpirePeriod", chatReadMarkExpirePeriod); + changed = true; + } + } + break; + } case "inapp_update_check_delay": { if (value.value instanceof TLRPC.TL_jsonNumber) { TLRPC.TL_jsonNumber number = (TLRPC.TL_jsonNumber) value.value; @@ -2718,6 +2732,7 @@ public class MessagesController extends BaseController implements NotificationCe channelViewsToSend.clear(); pollsToCheck.clear(); pollsToCheckSize = 0; + reactionsToCheck.clear(); dialogsServerOnly.clear(); dialogsForward.clear(); allDialogs.clear(); @@ -2949,6 +2964,12 @@ public class MessagesController extends BaseController implements NotificationCe object.pollVisibleOnScreen = false; } } + array = reactionsToCheck.get(dialogId); + if (array != null) { + for (int i = 0; i < array.size(); i++) { + array.valueAt(i).reactionsVisibleOnScreen = false; + } + } } } Utilities.stageQueue.postRunnable(() -> { @@ -5583,6 +5604,57 @@ public class MessagesController extends BaseController implements NotificationCe } } int currentServerTime = getConnectionsManager().getCurrentTime(); + if (Math.abs(System.currentTimeMillis() - lastReactionsCheckTime) >= 15000) { + lastReactionsCheckTime = System.currentTimeMillis(); + if (reactionsToCheck.size() > 0) { + AndroidUtilities.runOnUIThread(() -> { + long time = SystemClock.elapsedRealtime(); + for (int a = 0, N = reactionsToCheck.size(); a < N; a++) { + SparseArray array = reactionsToCheck.valueAt(a); + if (array == null) { + continue; + } + reactionsTempDialogs.clear(); + for (int b = 0, N2 = array.size(); b < N2; b++) { + MessageObject messageObject = array.valueAt(b); + List ids = reactionsTempDialogs.get(messageObject.getDialogId()); + if (ids == null) { + reactionsTempDialogs.put(messageObject.getDialogId(), ids = new ArrayList<>()); + } + ids.add(messageObject.getId()); + + int timeout = 15000; + if (Math.abs(time - messageObject.reactionsLastCheckTime) < timeout) { + if (!messageObject.reactionsVisibleOnScreen) { + array.remove(messageObject.getId()); + N2--; + b--; + } + } else { + messageObject.reactionsLastCheckTime = time; + } + } + if (array.size() == 0) { + reactionsToCheck.remove(reactionsToCheck.keyAt(a)); + N--; + a--; + } + } + + for (int i = 0; i < reactionsTempDialogs.size(); i++) { + TLRPC.TL_messages_getMessagesReactions req = new TLRPC.TL_messages_getMessagesReactions(); + req.peer = getInputPeer(reactionsTempDialogs.keyAt(i)); + req.id.addAll(reactionsTempDialogs.valueAt(i)); + getConnectionsManager().sendRequest(req, (response, error) -> { + if (error == null) { + TLRPC.Updates updates = (TLRPC.Updates) response; + processUpdates(updates, false); + } + }); + } + }); + } + } if (Math.abs(System.currentTimeMillis() - lastViewsCheckTime) >= 5000) { lastViewsCheckTime = System.currentTimeMillis(); if (channelViewsToSend.size() != 0) { @@ -8761,6 +8833,28 @@ public class MessagesController extends BaseController implements NotificationCe }); } + public void addToReactionsQueue(long dialogId, ArrayList visibleObjects) { + SparseArray array = reactionsToCheck.get(dialogId); + if (array == null) { + reactionsToCheck.put(dialogId, array = new SparseArray<>()); + } + for (int a = 0, N = array.size(); a < N; a++) { + MessageObject object = array.valueAt(a); + object.reactionsVisibleOnScreen = false; + } + int time = getConnectionsManager().getCurrentTime(); + for (int a = 0, N = visibleObjects.size(); a < N; a++) { + MessageObject messageObject = visibleObjects.get(a); + int id = messageObject.getId(); + MessageObject object = array.get(id); + if (object != null) { + object.reactionsVisibleOnScreen = true; + } else { + array.put(id, messageObject); + } + } + } + public void addToPollsQueue(long dialogId, ArrayList visibleObjects) { SparseArray array = pollsToCheck.get(dialogId); if (array == null) { @@ -14283,6 +14377,8 @@ public class MessagesController extends BaseController implements NotificationCe messageObject.sponsoredId = sponsoredMessage.random_id; messageObject.botStartParam = sponsoredMessage.start_param; messageObject.sponsoredChannelPost = sponsoredMessage.channel_post; + messageObject.sponsoredChatInvite = sponsoredMessage.chat_invite; + messageObject.sponsoredChatInviteHash = sponsoredMessage.chat_invite_hash; result.add(messageObject); } } @@ -15156,10 +15252,7 @@ public class MessagesController extends BaseController implements NotificationCe } public void markSponsoredAsRead(long dialog_id, MessageObject object) { - ArrayList messages = getSponsoredMessages(dialog_id); - if (messages != null) { - messages.remove(object); - } + sponsoredMessages.remove(dialog_id); } public void deleteMessagesRange(long dialogId, long channelId, int minDate, int maxDate, boolean forAll, Runnable callback) { @@ -15191,6 +15284,23 @@ public class MessagesController extends BaseController implements NotificationCe }); } + public void setChatReactions(long chatId, List reactions) { + TLRPC.TL_messages_setChatAvailableReactions req = new TLRPC.TL_messages_setChatAvailableReactions(); + req.peer = getInputPeer(-chatId); + req.available_reactions.addAll(reactions); + getConnectionsManager().sendRequest(req, (response, error) -> { + if (response != null) { + processUpdates((TLRPC.Updates) response, false); + TLRPC.ChatFull full = getChatFull(chatId); + if (full != null) { + full.available_reactions = new ArrayList<>(reactions); + getMessagesStorage().updateChatInfo(full, false); + } + AndroidUtilities.runOnUIThread(() -> getNotificationCenter().postNotificationName(NotificationCenter.chatAvailableReactionsUpdated, chatId)); + } + }); + } + public interface MessagesLoadedCallback { void onMessagesLoaded(boolean fromCache); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java index af8d6943b..e6c5693a6 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java @@ -21,6 +21,9 @@ import android.util.SparseIntArray; import androidx.annotation.UiThread; +import androidx.annotation.UiThread; +import androidx.collection.LongSparseArray; + import org.telegram.PhoneFormat.PhoneFormat; import org.telegram.SQLite.SQLiteCursor; import org.telegram.SQLite.SQLiteDatabase; @@ -121,7 +124,7 @@ public class MessagesStorage extends BaseController { private CountDownLatch openSync = new CountDownLatch(1); private static SparseArray Instance = new SparseArray(); - private final static int LAST_DB_VERSION = 86; + private final static int LAST_DB_VERSION = 87; private boolean databaseMigrationInProgress; public static MessagesStorage getInstance(int num) { @@ -296,7 +299,7 @@ public class MessagesStorage extends BaseController { shmCacheFile = new File(filesDir, "cache4.db-shm"); boolean createTable = false; - //cacheFile.delete(); + if (!cacheFile.exists()) { createTable = true; } @@ -426,6 +429,7 @@ public class MessagesStorage extends BaseController { database.executeFast("CREATE TABLE polls_v2(mid INTEGER, uid INTEGER, id INTEGER, PRIMARY KEY (mid, uid));").stepThis().dispose(); database.executeFast("CREATE INDEX IF NOT EXISTS polls_id_v2 ON polls_v2(id);").stepThis().dispose(); + database.executeFast("CREATE TABLE reactions(data BLOB, hash INTEGER, date INTEGER);").stepThis().dispose(); //version database.executeFast("PRAGMA user_version = " + LAST_DB_VERSION).stepThis().dispose(); } else { @@ -456,6 +460,9 @@ public class MessagesStorage extends BaseController { } cursor.dispose(); } catch (Exception e) { + if (e.getMessage() != null && e.getMessage().contains("malformed")) { + throw new RuntimeException("malformed"); + } FileLog.e(e); try { database.executeFast("CREATE TABLE IF NOT EXISTS params(id INTEGER PRIMARY KEY, seq INTEGER, pts INTEGER, date INTEGER, qts INTEGER, lsv INTEGER, sg INTEGER, pbytes BLOB)").stepThis().dispose(); @@ -1555,6 +1562,12 @@ public class MessagesStorage extends BaseController { version = 86; } + if (version == 86) { + database.executeFast("CREATE TABLE IF NOT EXISTS reactions(data BLOB, hash INTEGER, date INTEGER);").stepThis().dispose(); + database.executeFast("PRAGMA user_version = 87").stepThis().dispose(); + version = 87; + } + FileLog.d("MessagesStorage db migration finished"); AndroidUtilities.runOnUIThread(() -> { databaseMigrationInProgress = false; @@ -6041,6 +6054,9 @@ public class MessagesStorage extends BaseController { participant = TLRPC.ChannelParticipant.TLdeserialize(data, data.readInt32(false), false); data.reuse(); } + if (participant != null && participant.user_id == getUserConfig().clientUserId) { + user = getUserConfig().getCurrentUser(); + } if (user != null && participant != null) { if (user.status != null) { user.status.expires = cursor.intValue(1); @@ -8774,7 +8790,7 @@ public class MessagesStorage extends BaseController { try { SQLitePreparedStatement state = database.executeFast("UPDATE messages_v2 SET replies_data = ? WHERE mid = ? AND uid = ?"); TLRPC.MessageReplies currentReplies = null; - SQLiteCursor cursor = database.queryFinalized(String.format("SELECT replies_data FROM messages_v2 WHERE mid = %d AND uid = %d", mid, -chatId)); + SQLiteCursor cursor = database.queryFinalized(String.format(Locale.ENGLISH, "SELECT replies_data FROM messages_v2 WHERE mid = %d AND uid = %d", mid, -chatId)); if (cursor.next()) { NativeByteBuffer data = cursor.byteBufferValue(0); if (data != null) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/NotificationCenter.java b/TMessagesProj/src/main/java/org/telegram/messenger/NotificationCenter.java index 484abee0e..adc689664 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/NotificationCenter.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/NotificationCenter.java @@ -109,6 +109,8 @@ public class NotificationCenter { public static final int newPeopleNearbyAvailable = totalEvents++; public static final int stopAllHeavyOperations = totalEvents++; public static final int startAllHeavyOperations = totalEvents++; + public static final int stopSpoilers = totalEvents++; + public static final int startSpoilers = totalEvents++; public static final int sendingMessagesChanged = totalEvents++; public static final int didUpdateReactions = totalEvents++; public static final int didVerifyMessagesStickers = totalEvents++; @@ -228,6 +230,8 @@ public class NotificationCenter { public static final int onDatabaseMigration = totalEvents++; public static final int onEmojiInteractionsReceived = totalEvents++; public static final int emojiPreviewThemesChanged = totalEvents++; + public static final int reactionsDidLoad = totalEvents++; + public static final int chatAvailableReactionsUpdated = totalEvents++; // custom diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/NotificationsController.java b/TMessagesProj/src/main/java/org/telegram/messenger/NotificationsController.java index bd676ad0a..9b6deda8a 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/NotificationsController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/NotificationsController.java @@ -1385,7 +1385,7 @@ public class NotificationsController extends BaseController { } } } - return messageObject.messageOwner.message; + return replaceSpoilers(messageObject); } long selfUsedId = getUserConfig().getClientUserId(); if (fromId == 0) { @@ -1834,13 +1834,13 @@ public class NotificationsController extends BaseController { } else { if (messageObject.isMediaEmpty()) { if (!TextUtils.isEmpty(messageObject.messageOwner.message)) { - return messageObject.messageOwner.message; + return replaceSpoilers(messageObject); } else { return LocaleController.getString("Message", R.string.Message); } } else if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaPhoto) { if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(messageObject.messageOwner.message)) { - return "\uD83D\uDDBC " + messageObject.messageOwner.message; + return "\uD83D\uDDBC " + replaceSpoilers(messageObject); } else if (messageObject.messageOwner.media.ttl_seconds != 0) { return LocaleController.getString("AttachDestructingPhoto", R.string.AttachDestructingPhoto); } else { @@ -1848,7 +1848,7 @@ public class NotificationsController extends BaseController { } } else if (messageObject.isVideo()) { if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(messageObject.messageOwner.message)) { - return "\uD83D\uDCF9 " + messageObject.messageOwner.message; + return "\uD83D\uDCF9 " + replaceSpoilers(messageObject); } else if (messageObject.messageOwner.media.ttl_seconds != 0) { return LocaleController.getString("AttachDestructingVideo", R.string.AttachDestructingVideo); } else { @@ -1884,19 +1884,19 @@ public class NotificationsController extends BaseController { } } else if (messageObject.isGif()) { if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(messageObject.messageOwner.message)) { - return "\uD83C\uDFAC " + messageObject.messageOwner.message; + return "\uD83C\uDFAC " + replaceSpoilers(messageObject); } else { return LocaleController.getString("AttachGif", R.string.AttachGif); } } else { if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(messageObject.messageOwner.message)) { - return "\uD83D\uDCCE " + messageObject.messageOwner.message; + return "\uD83D\uDCCE " + replaceSpoilers(messageObject); } else { return LocaleController.getString("AttachDocument", R.string.AttachDocument); } } } else if (!TextUtils.isEmpty(messageObject.messageText)) { - return messageObject.messageText.toString(); + return replaceSpoilers(messageObject); } else { return LocaleController.getString("Message", R.string.Message); } @@ -1911,6 +1911,27 @@ public class NotificationsController extends BaseController { return null; } + char[] spoilerChars = new char[] { + '⠌', '⡢', '⢑','⠨', + }; + + private String replaceSpoilers(MessageObject messageObject) { + String text = messageObject.messageOwner.message; + if (text == null || messageObject == null || messageObject.messageOwner == null || messageObject.messageOwner.entities == null) { + return null; + } + StringBuilder stringBuilder = new StringBuilder(text); + for (int i = 0; i < messageObject.messageOwner.entities.size(); i++) { + if (messageObject.messageOwner.entities.get(i) instanceof TLRPC.TL_messageEntitySpoiler) { + TLRPC.TL_messageEntitySpoiler spoiler = (TLRPC.TL_messageEntitySpoiler) messageObject.messageOwner.entities.get(i); + for (int j = 0; j < spoiler.length; j++) { + stringBuilder.setCharAt(spoiler.offset + j, spoilerChars[j % spoilerChars.length]); + } + } + } + return stringBuilder.toString(); + } + private String getStringForMessage(MessageObject messageObject, boolean shortMessage, boolean[] text, boolean[] preview) { if (AndroidUtilities.needShowPasscode() || SharedConfig.isWaitingForPasscodeEnter) { return LocaleController.getString("YouHaveNewMessage", R.string.YouHaveNewMessage); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java b/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java index 834445eaf..00f838fa2 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java @@ -1460,7 +1460,8 @@ public boolean retriedToSend; entity instanceof TLRPC.TL_messageEntityItalic || entity instanceof TLRPC.TL_messageEntityPre || entity instanceof TLRPC.TL_messageEntityCode || - entity instanceof TLRPC.TL_messageEntityTextUrl) { + entity instanceof TLRPC.TL_messageEntityTextUrl || + entity instanceof TLRPC.TL_messageEntitySpoiler) { entities.add(entity); } } @@ -2655,7 +2656,7 @@ public boolean retriedToSend; return voteSendTime.get(pollId, 0L); } - public void sendReaction(MessageObject messageObject, CharSequence reaction, ChatActivity parentFragment) { + public void sendReaction(MessageObject messageObject, CharSequence reaction, ChatActivity parentFragment, Runnable callback) { if (messageObject == null || parentFragment == null) { return; } @@ -2669,16 +2670,10 @@ public boolean retriedToSend; getConnectionsManager().sendRequest(req, (response, error) -> { if (response != null) { getMessagesController().processUpdates((TLRPC.Updates) response, false); - } - /*AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - waitingForVote.remove(key); - if (finishRunnable != null) { - finishRunnable.run(); - } + if (callback != null) { + AndroidUtilities.runOnUIThread(callback); } - });*/ + } }); } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/SharedConfig.java b/TMessagesProj/src/main/java/org/telegram/messenger/SharedConfig.java index 6ec168c99..8e6469963 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/SharedConfig.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/SharedConfig.java @@ -31,17 +31,24 @@ import org.apache.commons.lang3.StringUtils; import org.dizitart.no2.objects.filters.ObjectFilters; import org.json.JSONArray; import org.json.JSONException; +import androidx.annotation.IntDef; +import androidx.core.content.pm.ShortcutManagerCompat; + import org.json.JSONObject; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.SerializedData; import org.telegram.ui.Components.SwipeGestureSettingsView; import org.telegram.tgnet.TLRPC; +import org.telegram.ui.Components.SwipeGestureSettingsView; import java.io.File; import java.io.RandomAccessFile; import java.net.InetSocketAddress; import java.net.Proxy; import java.util.Arrays; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; @@ -67,6 +74,7 @@ import static com.v2ray.ang.V2RayConfig.SSR_PROTOCOL; import static com.v2ray.ang.V2RayConfig.SS_PROTOCOL; import static com.v2ray.ang.V2RayConfig.WSS_PROTOCOL; import static com.v2ray.ang.V2RayConfig.WS_PROTOCOL; +import java.util.Locale; public class SharedConfig { @@ -107,6 +115,7 @@ public class SharedConfig { public static boolean searchMessagesAsListUsed; public static boolean stickersReorderingHintUsed; public static boolean disableVoiceAudioEffects; + public static boolean drawSnowInChat; private static int lastLocalId = -210000; public static String storageCacheDir; @@ -1271,6 +1280,7 @@ public class SharedConfig { mediaColumnsCount = preferences.getInt("mediaColumnsCount", 3); fastScrollHintCount = preferences.getInt("fastScrollHintCount", 3); dontAskManageStorage = preferences.getBoolean("dontAskManageStorage", false); + drawSnowInChat = preferences.getBoolean("drawSnowInChat", BuildVars.DEBUG_VERSION); preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); showNotificationsForAllAccounts = preferences.getBoolean("AllAccounts", true); @@ -1608,6 +1618,14 @@ public class SharedConfig { editor.commit(); } + public static void toggleDrawSnowInChat() { + drawSnowInChat = !drawSnowInChat; + SharedPreferences preferences = MessagesController.getGlobalMainSettings(); + SharedPreferences.Editor editor = preferences.edit(); + editor.putBoolean("drawSnowInChat", drawSnowInChat); + editor.commit(); + } + public static void toggleNoiseSupression() { noiseSupression = !noiseSupression; SharedPreferences preferences = MessagesController.getGlobalMainSettings(); @@ -2248,25 +2266,38 @@ public class SharedConfig { public final static int PERFORMANCE_CLASS_AVERAGE = 1; public final static int PERFORMANCE_CLASS_HIGH = 2; + @Retention(RetentionPolicy.SOURCE) + @IntDef({ + PERFORMANCE_CLASS_LOW, + PERFORMANCE_CLASS_AVERAGE, + PERFORMANCE_CLASS_HIGH + }) + public @interface PerformanceClass {} + + @PerformanceClass public static int getDevicePerformanceClass() { if (devicePerformanceClass == -1) { - int maxCpuFreq = -1; - try { - RandomAccessFile reader = new RandomAccessFile("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq", "r"); - String line = reader.readLine(); - if (line != null) { - maxCpuFreq = Utilities.parseInt(line) / 1000; - } - reader.close(); - } catch (Throwable ignore) { - - } int androidVersion = Build.VERSION.SDK_INT; int cpuCount = ConnectionsManager.CPU_COUNT; int memoryClass = ((ActivityManager) ApplicationLoader.applicationContext.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryClass(); + int totalCpuFreq = 0; + int freqResolved = 0; + for (int i = 0; i < cpuCount; i++) { + try { + RandomAccessFile reader = new RandomAccessFile(String.format(Locale.ENGLISH, "/sys/devices/system/cpu/cpu%d/cpufreq/cpuinfo_max_freq", i), "r"); + String line = reader.readLine(); + if (line != null) { + totalCpuFreq += Utilities.parseInt(line) / 1000; + freqResolved++; + } + reader.close(); + } catch (Throwable ignore) {} + } + int maxCpuFreq = freqResolved == 0 ? -1 : (int) Math.ceil(totalCpuFreq / (float) freqResolved); + if (androidVersion < 21 || cpuCount <= 2 || memoryClass <= 100 || cpuCount <= 4 && maxCpuFreq != -1 && maxCpuFreq <= 1250 || cpuCount <= 4 && maxCpuFreq <= 1600 && memoryClass <= 128 && androidVersion <= 21 || cpuCount <= 4 && maxCpuFreq <= 1300 && memoryClass <= 128 && androidVersion <= 24) { devicePerformanceClass = PERFORMANCE_CLASS_LOW; - } else if (cpuCount < 8 || memoryClass <= 160 || maxCpuFreq != -1 && maxCpuFreq <= 1650 || maxCpuFreq == -1 && cpuCount == 8 && androidVersion <= 23) { + } else if (cpuCount < 8 || memoryClass <= 160 || maxCpuFreq != -1 && maxCpuFreq <= 2050 || maxCpuFreq == -1 && cpuCount == 8 && androidVersion <= 23) { devicePerformanceClass = PERFORMANCE_CLASS_AVERAGE; } else { devicePerformanceClass = PERFORMANCE_CLASS_HIGH; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java b/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java index b522187e4..45eaecd29 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java @@ -14,12 +14,15 @@ import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Rect; +import com.carrotsearch.randomizedtesting.Xoroshiro128PlusRandom; + import java.io.File; import java.io.FileInputStream; import java.math.BigInteger; import java.nio.ByteBuffer; import java.security.MessageDigest; import java.security.SecureRandom; +import java.util.Random; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -27,6 +30,7 @@ public class Utilities { public static Pattern pattern = Pattern.compile("[\\-0-9]+"); public static SecureRandom random = new SecureRandom(); + public static Random fastRandom = new Xoroshiro128PlusRandom(random.nextLong()); public static volatile DispatchQueue stageQueue = new DispatchQueue("stageQueue"); public static volatile DispatchQueue globalQueue = new DispatchQueue("globalQueue"); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/video/MediaCodecVideoConvertor.java b/TMessagesProj/src/main/java/org/telegram/messenger/video/MediaCodecVideoConvertor.java index 042bca03b..b5c6fb476 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/video/MediaCodecVideoConvertor.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/video/MediaCodecVideoConvertor.java @@ -166,7 +166,7 @@ public class MediaCodecVideoConvertor { inputSurface.makeCurrent(); encoder.start(); - // outputSurface = new OutputSurface(savedFilterState, videoPath, paintPath, mediaEntities, null, resultWidth, resultHeight, rotationValue, framerate, true); + outputSurface = new OutputSurface(savedFilterState, videoPath, paintPath, mediaEntities, null, resultWidth, resultHeight, rotationValue, framerate, true); ByteBuffer[] encoderOutputBuffers = null; ByteBuffer[] encoderInputBuffers = null; diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java b/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java index 5b1cbe784..db5cd7b57 100644 --- a/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java +++ b/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java @@ -13,7 +13,6 @@ import android.os.Build; import android.text.TextUtils; import org.osmdroid.util.TileSystemWebMercator; -import com.google.android.exoplayer2.util.Log; import org.telegram.messenger.FileLog; import org.telegram.messenger.ImageLoader; @@ -45,7 +44,7 @@ public class TLRPC { //public static final int USER_FLAG_BOT = 0x00004000; //public static final int USER_FLAG_BOT_READING_HISTORY = 0x00008000; //public static final int USER_FLAG_BOT_CANT_JOIN_GROUP = 0x00010000; - //public static final int USER_FLAG_VERIFIED = 0x00020000; + //public static final int USER_FLAG_VERIFIED = 0x00020000; //public static final int CHAT_FLAG_CREATOR = 0x00000001; //public static final int CHAT_FLAG_USER_KICKED = 0x00000002; @@ -67,10 +66,10 @@ public class TLRPC { public static final int MESSAGE_FLAG_HAS_FROM_ID = 0x00000100; public static final int MESSAGE_FLAG_HAS_MEDIA = 0x00000200; public static final int MESSAGE_FLAG_HAS_VIEWS = 0x00000400; - public static final int MESSAGE_FLAG_HAS_BOT_ID = 0x00000800; - public static final int MESSAGE_FLAG_EDITED = 0x00008000; + public static final int MESSAGE_FLAG_HAS_BOT_ID = 0x00000800; + public static final int MESSAGE_FLAG_EDITED = 0x00008000; - public static final int LAYER = 135; + public static final int LAYER = 136; public static class TL_stats_megagroupStats extends TLObject { public static int constructor = 0xef7ff916; @@ -605,71 +604,71 @@ public class TLRPC { } } - public static class TL_help_termsOfService extends TLObject { - public static int constructor = 0x780a0310; + public static class TL_help_termsOfService extends TLObject { + public static int constructor = 0x780a0310; - public int flags; - public boolean popup; - public TL_dataJSON id; - public String text; - public ArrayList entities = new ArrayList<>(); - public int min_age_confirm; + public int flags; + public boolean popup; + public TL_dataJSON id; + public String text; + public ArrayList entities = new ArrayList<>(); + public int min_age_confirm; - public static TL_help_termsOfService TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_help_termsOfService.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_help_termsOfService", constructor)); - } else { - return null; - } - } - TL_help_termsOfService result = new TL_help_termsOfService(); - result.readParams(stream, exception); - return result; - } + public static TL_help_termsOfService TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_help_termsOfService.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_help_termsOfService", constructor)); + } else { + return null; + } + } + TL_help_termsOfService result = new TL_help_termsOfService(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - popup = (flags & 1) != 0; - id = TL_dataJSON.TLdeserialize(stream, stream.readInt32(exception), exception); - text = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - if ((flags & 2) != 0) { - min_age_confirm = stream.readInt32(exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + popup = (flags & 1) != 0; + id = TL_dataJSON.TLdeserialize(stream, stream.readInt32(exception), exception); + text = stream.readString(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + entities.add(object); + } + if ((flags & 2) != 0) { + min_age_confirm = stream.readInt32(exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = popup ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - id.serializeToStream(stream); - stream.writeString(text); - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - if ((flags & 2) != 0) { - stream.writeInt32(min_age_confirm); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = popup ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + id.serializeToStream(stream); + stream.writeString(text); + stream.writeInt32(0x1cb5c415); + int count = entities.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + entities.get(a).serializeToStream(stream); + } + if ((flags & 2) != 0) { + stream.writeInt32(min_age_confirm); + } + } + } public static class TL_payments_paymentReceipt extends TLObject { public static int constructor = 0x70c4fe03; @@ -993,90 +992,90 @@ public class TLRPC { } } - public static abstract class messages_SentEncryptedMessage extends TLObject { - public int date; - public EncryptedFile file; + public static abstract class messages_SentEncryptedMessage extends TLObject { + public int date; + public EncryptedFile file; - public static messages_SentEncryptedMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - messages_SentEncryptedMessage result = null; - switch (constructor) { - case 0x560f8935: - result = new TL_messages_sentEncryptedMessage(); - break; - case 0x9493ff32: - result = new TL_messages_sentEncryptedFile(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in messages_SentEncryptedMessage", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static messages_SentEncryptedMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + messages_SentEncryptedMessage result = null; + switch (constructor) { + case 0x560f8935: + result = new TL_messages_sentEncryptedMessage(); + break; + case 0x9493ff32: + result = new TL_messages_sentEncryptedFile(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in messages_SentEncryptedMessage", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_messages_sentEncryptedMessage extends messages_SentEncryptedMessage { - public static int constructor = 0x560f8935; + public static class TL_messages_sentEncryptedMessage extends messages_SentEncryptedMessage { + public static int constructor = 0x560f8935; - public void readParams(AbstractSerializedData stream, boolean exception) { - date = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + date = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(date); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(date); + } + } - public static class TL_messages_sentEncryptedFile extends messages_SentEncryptedMessage { - public static int constructor = 0x9493ff32; + public static class TL_messages_sentEncryptedFile extends messages_SentEncryptedMessage { + public static int constructor = 0x9493ff32; - public void readParams(AbstractSerializedData stream, boolean exception) { - date = stream.readInt32(exception); + public void readParams(AbstractSerializedData stream, boolean exception) { + date = stream.readInt32(exception); file = EncryptedFile.TLdeserialize(stream, stream.readInt32(exception), exception); - } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(date); - file.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(date); + file.serializeToStream(stream); + } + } - public static class TL_error extends TLObject { - public static int constructor = 0xc4b9f9bb; + public static class TL_error extends TLObject { + public static int constructor = 0xc4b9f9bb; - public int code; - public String text; + public int code; + public String text; - public static TL_error TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_error.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_error", constructor)); - } else { - return null; - } - } - TL_error result = new TL_error(); - result.readParams(stream, exception); - return result; - } + public static TL_error TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_error.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_error", constructor)); + } else { + return null; + } + } + TL_error result = new TL_error(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(AbstractSerializedData stream, boolean exception) { code = stream.readInt32(exception); - text = stream.readString(exception); - } + text = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(code); - stream.writeString(text); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(code); + stream.writeString(text); + } + } public static abstract class UrlAuthResult extends TLObject { @@ -1151,496 +1150,496 @@ public class TLRPC { } } - public static class TL_messages_chatFull extends TLObject { - public static int constructor = 0xe5d7d19c; - - public ChatFull full_chat; - public ArrayList chats = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); - - public static TL_messages_chatFull TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messages_chatFull.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_chatFull", constructor)); - } else { - return null; - } - } - TL_messages_chatFull result = new TL_messages_chatFull(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - full_chat = ChatFull.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - full_chat.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } - - public static class TL_account_passwordSettings extends TLObject { - public static int constructor = 0x9a5c33e5; - - public int flags; - public String email; - public TL_secureSecretSettings secure_settings; - - public static TL_account_passwordSettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_account_passwordSettings.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_account_passwordSettings", constructor)); - } else { - return null; - } - } - TL_account_passwordSettings result = new TL_account_passwordSettings(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - if ((flags & 1) != 0) { - email = stream.readString(exception); - } - if ((flags & 2) != 0) { - secure_settings = TL_secureSecretSettings.TLdeserialize(stream, stream.readInt32(exception), exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - stream.writeString(email); - } - if ((flags & 2) != 0) { - secure_settings.serializeToStream(stream); - } - } - } - - public static abstract class DocumentAttribute extends TLObject { - public String alt; - public InputStickerSet stickerset; - public int duration; - public int flags; - public TL_maskCoords mask_coords; - public boolean round_message; - public boolean supports_streaming; - public String file_name; - public int w; - public int h; - public boolean mask; - public String title; - public String performer; - public boolean voice; - public byte[] waveform; - - public static DocumentAttribute TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - DocumentAttribute result = null; - switch (constructor) { - case 0x3a556302: - result = new TL_documentAttributeSticker_layer55(); - break; - case 0x51448e5: - result = new TL_documentAttributeAudio_old(); - break; - case 0x6319d612: - result = new TL_documentAttributeSticker(); - break; - case 0x11b58939: - result = new TL_documentAttributeAnimated(); - break; - case 0x15590068: - result = new TL_documentAttributeFilename(); - break; - case 0xef02ce6: - result = new TL_documentAttributeVideo(); - break; - case 0x5910cccb: - result = new TL_documentAttributeVideo_layer65(); - break; - case 0xded218e0: - result = new TL_documentAttributeAudio_layer45(); - break; - case 0xfb0a5727: - result = new TL_documentAttributeSticker_old(); - break; - case 0x9801d2f7: - result = new TL_documentAttributeHasStickers(); - break; - case 0x994c9882: - result = new TL_documentAttributeSticker_old2(); - break; - case 0x6c37c15c: - result = new TL_documentAttributeImageSize(); - break; - case 0x9852f9c6: - result = new TL_documentAttributeAudio(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in DocumentAttribute", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } - - public static class TL_documentAttributeSticker_layer55 extends TL_documentAttributeSticker { - public static int constructor = 0x3a556302; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - alt = stream.readString(exception); - stickerset = InputStickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(alt); - stickerset.serializeToStream(stream); - } - } - - public static class TL_documentAttributeAudio_old extends TL_documentAttributeAudio { - public static int constructor = 0x51448e5; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - duration = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(duration); - } - } - - public static class TL_documentAttributeSticker extends DocumentAttribute { - public static int constructor = 0x6319d612; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - mask = (flags & 2) != 0; - alt = stream.readString(exception); - stickerset = InputStickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 1) != 0) { - mask_coords = TL_maskCoords.TLdeserialize(stream, stream.readInt32(exception), exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = mask ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - stream.writeString(alt); - stickerset.serializeToStream(stream); - if ((flags & 1) != 0) { - mask_coords.serializeToStream(stream); - } - } - } - - public static class TL_documentAttributeAnimated extends DocumentAttribute { - public static int constructor = 0x11b58939; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_documentAttributeFilename extends DocumentAttribute { - public static int constructor = 0x15590068; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - file_name = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(file_name); - } - } - - public static class TL_documentAttributeVideo extends DocumentAttribute { - public static int constructor = 0xef02ce6; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - round_message = (flags & 1) != 0; - supports_streaming = (flags & 2) != 0; - duration = stream.readInt32(exception); - w = stream.readInt32(exception); - h = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = round_message ? (flags | 1) : (flags &~ 1); - flags = supports_streaming ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - stream.writeInt32(duration); - stream.writeInt32(w); - stream.writeInt32(h); - } - } - - public static class TL_documentAttributeVideo_layer65 extends TL_documentAttributeVideo { - public static int constructor = 0x5910cccb; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - duration = stream.readInt32(exception); - w = stream.readInt32(exception); - h = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(duration); - stream.writeInt32(w); - stream.writeInt32(h); - } - } - - public static class TL_documentAttributeAudio_layer45 extends TL_documentAttributeAudio { - public static int constructor = 0xded218e0; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - duration = stream.readInt32(exception); - title = stream.readString(exception); - performer = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(duration); - stream.writeString(title); - stream.writeString(performer); - } - } - - public static class TL_documentAttributeSticker_old extends TL_documentAttributeSticker { - public static int constructor = 0xfb0a5727; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_documentAttributeHasStickers extends DocumentAttribute { - public static int constructor = 0x9801d2f7; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_documentAttributeSticker_old2 extends TL_documentAttributeSticker { - public static int constructor = 0x994c9882; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - alt = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(alt); - } - } - - public static class TL_documentAttributeImageSize extends DocumentAttribute { - public static int constructor = 0x6c37c15c; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - w = stream.readInt32(exception); - h = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(w); - stream.writeInt32(h); - } - } - - public static class TL_documentAttributeAudio extends DocumentAttribute { - public static int constructor = 0x9852f9c6; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - voice = (flags & 1024) != 0; - duration = stream.readInt32(exception); - if ((flags & 1) != 0) { - title = stream.readString(exception); - } - if ((flags & 2) != 0) { - performer = stream.readString(exception); - } - if ((flags & 4) != 0) { - waveform = stream.readByteArray(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = voice ? (flags | 1024) : (flags &~ 1024); - stream.writeInt32(flags); - stream.writeInt32(duration); - if ((flags & 1) != 0) { - stream.writeString(title); - } - if ((flags & 2) != 0) { - stream.writeString(performer); - } - if ((flags & 4) != 0) { - stream.writeByteArray(waveform); - } - } - } - - public static class TL_textPhone extends RichText { - public static int constructor = 0x1ccb966a; - - public RichText text; - public String phone; - - public void readParams(AbstractSerializedData stream, boolean exception) { - text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - phone = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - text.serializeToStream(stream); - stream.writeString(phone); - } - } - - public static class TL_textSuperscript extends RichText { - public static int constructor = 0xc7fb5e01; - - public RichText text; - - public void readParams(AbstractSerializedData stream, boolean exception) { - text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - text.serializeToStream(stream); - } - } - - public static class TL_textImage extends RichText { - public static int constructor = 0x81ccf4f; - - public long document_id; - public int w; - public int h; - - public void readParams(AbstractSerializedData stream, boolean exception) { - document_id = stream.readInt64(exception); - w = stream.readInt32(exception); - h = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(document_id); - stream.writeInt32(w); - stream.writeInt32(h); - } - } - - public static class TL_textEmpty extends RichText { - public static int constructor = 0xdc3d824f; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_textUrl extends RichText { - public static int constructor = 0x3c2884c1; - - public RichText text; - - public void readParams(AbstractSerializedData stream, boolean exception) { - text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - url = stream.readString(exception); - webpage_id = stream.readInt64(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - text.serializeToStream(stream); - stream.writeString(url); - stream.writeInt64(webpage_id); - } - } + public static class TL_messages_chatFull extends TLObject { + public static int constructor = 0xe5d7d19c; + + public ChatFull full_chat; + public ArrayList chats = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); + + public static TL_messages_chatFull TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_messages_chatFull.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_messages_chatFull", constructor)); + } else { + return null; + } + } + TL_messages_chatFull result = new TL_messages_chatFull(); + result.readParams(stream, exception); + return result; + } + + public void readParams(AbstractSerializedData stream, boolean exception) { + full_chat = ChatFull.TLdeserialize(stream, stream.readInt32(exception), exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + chats.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + users.add(object); + } + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + full_chat.serializeToStream(stream); + stream.writeInt32(0x1cb5c415); + int count = chats.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + chats.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = users.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + users.get(a).serializeToStream(stream); + } + } + } + + public static class TL_account_passwordSettings extends TLObject { + public static int constructor = 0x9a5c33e5; + + public int flags; + public String email; + public TL_secureSecretSettings secure_settings; + + public static TL_account_passwordSettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_account_passwordSettings.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_account_passwordSettings", constructor)); + } else { + return null; + } + } + TL_account_passwordSettings result = new TL_account_passwordSettings(); + result.readParams(stream, exception); + return result; + } + + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + if ((flags & 1) != 0) { + email = stream.readString(exception); + } + if ((flags & 2) != 0) { + secure_settings = TL_secureSecretSettings.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + stream.writeString(email); + } + if ((flags & 2) != 0) { + secure_settings.serializeToStream(stream); + } + } + } + + public static abstract class DocumentAttribute extends TLObject { + public String alt; + public InputStickerSet stickerset; + public int duration; + public int flags; + public TL_maskCoords mask_coords; + public boolean round_message; + public boolean supports_streaming; + public String file_name; + public int w; + public int h; + public boolean mask; + public String title; + public String performer; + public boolean voice; + public byte[] waveform; + + public static DocumentAttribute TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + DocumentAttribute result = null; + switch (constructor) { + case 0x3a556302: + result = new TL_documentAttributeSticker_layer55(); + break; + case 0x51448e5: + result = new TL_documentAttributeAudio_old(); + break; + case 0x6319d612: + result = new TL_documentAttributeSticker(); + break; + case 0x11b58939: + result = new TL_documentAttributeAnimated(); + break; + case 0x15590068: + result = new TL_documentAttributeFilename(); + break; + case 0xef02ce6: + result = new TL_documentAttributeVideo(); + break; + case 0x5910cccb: + result = new TL_documentAttributeVideo_layer65(); + break; + case 0xded218e0: + result = new TL_documentAttributeAudio_layer45(); + break; + case 0xfb0a5727: + result = new TL_documentAttributeSticker_old(); + break; + case 0x9801d2f7: + result = new TL_documentAttributeHasStickers(); + break; + case 0x994c9882: + result = new TL_documentAttributeSticker_old2(); + break; + case 0x6c37c15c: + result = new TL_documentAttributeImageSize(); + break; + case 0x9852f9c6: + result = new TL_documentAttributeAudio(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in DocumentAttribute", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } + + public static class TL_documentAttributeSticker_layer55 extends TL_documentAttributeSticker { + public static int constructor = 0x3a556302; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + alt = stream.readString(exception); + stickerset = InputStickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(alt); + stickerset.serializeToStream(stream); + } + } + + public static class TL_documentAttributeAudio_old extends TL_documentAttributeAudio { + public static int constructor = 0x51448e5; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + duration = stream.readInt32(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(duration); + } + } + + public static class TL_documentAttributeSticker extends DocumentAttribute { + public static int constructor = 0x6319d612; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + mask = (flags & 2) != 0; + alt = stream.readString(exception); + stickerset = InputStickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 1) != 0) { + mask_coords = TL_maskCoords.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = mask ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + stream.writeString(alt); + stickerset.serializeToStream(stream); + if ((flags & 1) != 0) { + mask_coords.serializeToStream(stream); + } + } + } + + public static class TL_documentAttributeAnimated extends DocumentAttribute { + public static int constructor = 0x11b58939; + + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_documentAttributeFilename extends DocumentAttribute { + public static int constructor = 0x15590068; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + file_name = stream.readString(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(file_name); + } + } + + public static class TL_documentAttributeVideo extends DocumentAttribute { + public static int constructor = 0xef02ce6; + + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + round_message = (flags & 1) != 0; + supports_streaming = (flags & 2) != 0; + duration = stream.readInt32(exception); + w = stream.readInt32(exception); + h = stream.readInt32(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = round_message ? (flags | 1) : (flags &~ 1); + flags = supports_streaming ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + stream.writeInt32(duration); + stream.writeInt32(w); + stream.writeInt32(h); + } + } + + public static class TL_documentAttributeVideo_layer65 extends TL_documentAttributeVideo { + public static int constructor = 0x5910cccb; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + duration = stream.readInt32(exception); + w = stream.readInt32(exception); + h = stream.readInt32(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(duration); + stream.writeInt32(w); + stream.writeInt32(h); + } + } + + public static class TL_documentAttributeAudio_layer45 extends TL_documentAttributeAudio { + public static int constructor = 0xded218e0; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + duration = stream.readInt32(exception); + title = stream.readString(exception); + performer = stream.readString(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(duration); + stream.writeString(title); + stream.writeString(performer); + } + } + + public static class TL_documentAttributeSticker_old extends TL_documentAttributeSticker { + public static int constructor = 0xfb0a5727; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_documentAttributeHasStickers extends DocumentAttribute { + public static int constructor = 0x9801d2f7; + + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_documentAttributeSticker_old2 extends TL_documentAttributeSticker { + public static int constructor = 0x994c9882; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + alt = stream.readString(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(alt); + } + } + + public static class TL_documentAttributeImageSize extends DocumentAttribute { + public static int constructor = 0x6c37c15c; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + w = stream.readInt32(exception); + h = stream.readInt32(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(w); + stream.writeInt32(h); + } + } + + public static class TL_documentAttributeAudio extends DocumentAttribute { + public static int constructor = 0x9852f9c6; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + voice = (flags & 1024) != 0; + duration = stream.readInt32(exception); + if ((flags & 1) != 0) { + title = stream.readString(exception); + } + if ((flags & 2) != 0) { + performer = stream.readString(exception); + } + if ((flags & 4) != 0) { + waveform = stream.readByteArray(exception); + } + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = voice ? (flags | 1024) : (flags &~ 1024); + stream.writeInt32(flags); + stream.writeInt32(duration); + if ((flags & 1) != 0) { + stream.writeString(title); + } + if ((flags & 2) != 0) { + stream.writeString(performer); + } + if ((flags & 4) != 0) { + stream.writeByteArray(waveform); + } + } + } + + public static class TL_textPhone extends RichText { + public static int constructor = 0x1ccb966a; + + public RichText text; + public String phone; + + public void readParams(AbstractSerializedData stream, boolean exception) { + text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + phone = stream.readString(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + text.serializeToStream(stream); + stream.writeString(phone); + } + } + + public static class TL_textSuperscript extends RichText { + public static int constructor = 0xc7fb5e01; + + public RichText text; + + public void readParams(AbstractSerializedData stream, boolean exception) { + text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + text.serializeToStream(stream); + } + } + + public static class TL_textImage extends RichText { + public static int constructor = 0x81ccf4f; + + public long document_id; + public int w; + public int h; + + public void readParams(AbstractSerializedData stream, boolean exception) { + document_id = stream.readInt64(exception); + w = stream.readInt32(exception); + h = stream.readInt32(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(document_id); + stream.writeInt32(w); + stream.writeInt32(h); + } + } + + public static class TL_textEmpty extends RichText { + public static int constructor = 0xdc3d824f; + + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_textUrl extends RichText { + public static int constructor = 0x3c2884c1; + + public RichText text; + + public void readParams(AbstractSerializedData stream, boolean exception) { + text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + url = stream.readString(exception); + webpage_id = stream.readInt64(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + text.serializeToStream(stream); + stream.writeString(url); + stream.writeInt64(webpage_id); + } + } public static class TL_textAnchor extends RichText { public static int constructor = 0x35553762; @@ -1660,175 +1659,175 @@ public class TLRPC { } } - public static class TL_textStrike extends RichText { - public static int constructor = 0x9bf8bb95; + public static class TL_textStrike extends RichText { + public static int constructor = 0x9bf8bb95; - public RichText text; + public RichText text; - public void readParams(AbstractSerializedData stream, boolean exception) { - text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - text.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + text.serializeToStream(stream); + } + } - public static class TL_textMarked extends RichText { - public static int constructor = 0x34b8621; + public static class TL_textMarked extends RichText { + public static int constructor = 0x34b8621; - public RichText text; + public RichText text; - public void readParams(AbstractSerializedData stream, boolean exception) { - text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - text.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + text.serializeToStream(stream); + } + } - public static class TL_textFixed extends RichText { - public static int constructor = 0x6c3f19b9; + public static class TL_textFixed extends RichText { + public static int constructor = 0x6c3f19b9; - public RichText text; + public RichText text; - public void readParams(AbstractSerializedData stream, boolean exception) { - text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - text.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + text.serializeToStream(stream); + } + } - public static class TL_textEmail extends RichText { - public static int constructor = 0xde5a0dd6; + public static class TL_textEmail extends RichText { + public static int constructor = 0xde5a0dd6; - public RichText text; + public RichText text; - public void readParams(AbstractSerializedData stream, boolean exception) { - text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - email = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + email = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - text.serializeToStream(stream); - stream.writeString(email); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + text.serializeToStream(stream); + stream.writeString(email); + } + } - public static class TL_textPlain extends RichText { - public static int constructor = 0x744694e0; + public static class TL_textPlain extends RichText { + public static int constructor = 0x744694e0; - public String text; + public String text; - public void readParams(AbstractSerializedData stream, boolean exception) { - text = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(text); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(text); + } + } - public static class TL_textConcat extends RichText { - public static int constructor = 0x7e6260d7; + public static class TL_textConcat extends RichText { + public static int constructor = 0x7e6260d7; - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RichText object = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - texts.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + RichText object = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + texts.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = texts.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - texts.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = texts.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + texts.get(a).serializeToStream(stream); + } + } + } - public static class TL_textBold extends RichText { - public static int constructor = 0x6724abc4; + public static class TL_textBold extends RichText { + public static int constructor = 0x6724abc4; - public RichText text; + public RichText text; - public void readParams(AbstractSerializedData stream, boolean exception) { - text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - text.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + text.serializeToStream(stream); + } + } - public static class TL_textItalic extends RichText { - public static int constructor = 0xd912a59c; + public static class TL_textItalic extends RichText { + public static int constructor = 0xd912a59c; - public RichText text; + public RichText text; - public void readParams(AbstractSerializedData stream, boolean exception) { - text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - text.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + text.serializeToStream(stream); + } + } - public static class TL_textUnderline extends RichText { - public static int constructor = 0xc12622c4; + public static class TL_textUnderline extends RichText { + public static int constructor = 0xc12622c4; - public RichText text; + public RichText text; - public void readParams(AbstractSerializedData stream, boolean exception) { - text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - text.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + text.serializeToStream(stream); + } + } - public static class TL_textSubscript extends RichText { - public static int constructor = 0xed6a8504; + public static class TL_textSubscript extends RichText { + public static int constructor = 0xed6a8504; - public RichText text; + public RichText text; - public void readParams(AbstractSerializedData stream, boolean exception) { - text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - text.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + text.serializeToStream(stream); + } + } public static class TL_statsURL extends TLObject { public static int constructor = 0x47a971e0; @@ -1889,87 +1888,87 @@ public class TLRPC { } } - public static class TL_messages_botCallbackAnswer extends TLObject { - public static int constructor = 0x36585ea4; + public static class TL_messages_botCallbackAnswer extends TLObject { + public static int constructor = 0x36585ea4; - public int flags; - public boolean alert; - public boolean has_url; - public boolean native_ui; - public String message; - public String url; - public int cache_time; + public int flags; + public boolean alert; + public boolean has_url; + public boolean native_ui; + public String message; + public String url; + public int cache_time; - public static TL_messages_botCallbackAnswer TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messages_botCallbackAnswer.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_botCallbackAnswer", constructor)); - } else { - return null; - } - } - TL_messages_botCallbackAnswer result = new TL_messages_botCallbackAnswer(); - result.readParams(stream, exception); - return result; - } + public static TL_messages_botCallbackAnswer TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_messages_botCallbackAnswer.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_messages_botCallbackAnswer", constructor)); + } else { + return null; + } + } + TL_messages_botCallbackAnswer result = new TL_messages_botCallbackAnswer(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - alert = (flags & 2) != 0; - has_url = (flags & 8) != 0; - native_ui = (flags & 16) != 0; - if ((flags & 1) != 0) { - message = stream.readString(exception); - } - if ((flags & 4) != 0) { - url = stream.readString(exception); - } - cache_time = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + alert = (flags & 2) != 0; + has_url = (flags & 8) != 0; + native_ui = (flags & 16) != 0; + if ((flags & 1) != 0) { + message = stream.readString(exception); + } + if ((flags & 4) != 0) { + url = stream.readString(exception); + } + cache_time = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = alert ? (flags | 2) : (flags &~ 2); - flags = has_url ? (flags | 8) : (flags &~ 8); - flags = native_ui ? (flags | 16) : (flags &~ 16); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - stream.writeString(message); - } - if ((flags & 4) != 0) { - stream.writeString(url); - } - stream.writeInt32(cache_time); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = alert ? (flags | 2) : (flags &~ 2); + flags = has_url ? (flags | 8) : (flags &~ 8); + flags = native_ui ? (flags | 16) : (flags &~ 16); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + stream.writeString(message); + } + if ((flags & 4) != 0) { + stream.writeString(url); + } + stream.writeInt32(cache_time); + } + } - public static class TL_dataJSON extends TLObject { - public static int constructor = 0x7d748d04; + public static class TL_dataJSON extends TLObject { + public static int constructor = 0x7d748d04; - public String data; + public String data; - public static TL_dataJSON TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_dataJSON.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_dataJSON", constructor)); - } else { - return null; - } - } - TL_dataJSON result = new TL_dataJSON(); - result.readParams(stream, exception); - return result; - } + public static TL_dataJSON TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_dataJSON.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_dataJSON", constructor)); + } else { + return null; + } + } + TL_dataJSON result = new TL_dataJSON(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - data = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + data = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(data); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(data); + } + } public static class TL_contactStatus extends TLObject { public static int constructor = 0x16d9703b; @@ -2128,59 +2127,59 @@ public class TLRPC { } public static class TL_channelBannedRights_layer92 extends TLObject { - public static int constructor = 0x58cf4249; + public static int constructor = 0x58cf4249; - public int flags; - public boolean view_messages; - public boolean send_messages; - public boolean send_media; - public boolean send_stickers; - public boolean send_gifs; - public boolean send_games; - public boolean send_inline; - public boolean embed_links; - public int until_date; + public int flags; + public boolean view_messages; + public boolean send_messages; + public boolean send_media; + public boolean send_stickers; + public boolean send_gifs; + public boolean send_games; + public boolean send_inline; + public boolean embed_links; + public int until_date; - public static TL_channelBannedRights_layer92 TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_channelBannedRights_layer92.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_channelBannedRights_layer92", constructor)); - } else { - return null; - } - } - TL_channelBannedRights_layer92 result = new TL_channelBannedRights_layer92(); - result.readParams(stream, exception); - return result; - } + public static TL_channelBannedRights_layer92 TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_channelBannedRights_layer92.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_channelBannedRights_layer92", constructor)); + } else { + return null; + } + } + TL_channelBannedRights_layer92 result = new TL_channelBannedRights_layer92(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - view_messages = (flags & 1) != 0; - send_messages = (flags & 2) != 0; - send_media = (flags & 4) != 0; - send_stickers = (flags & 8) != 0; - send_gifs = (flags & 16) != 0; - send_games = (flags & 32) != 0; - send_inline = (flags & 64) != 0; - embed_links = (flags & 128) != 0; - until_date = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + view_messages = (flags & 1) != 0; + send_messages = (flags & 2) != 0; + send_media = (flags & 4) != 0; + send_stickers = (flags & 8) != 0; + send_gifs = (flags & 16) != 0; + send_games = (flags & 32) != 0; + send_inline = (flags & 64) != 0; + embed_links = (flags & 128) != 0; + until_date = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = view_messages ? (flags | 1) : (flags &~ 1); - flags = send_messages ? (flags | 2) : (flags &~ 2); - flags = send_media ? (flags | 4) : (flags &~ 4); - flags = send_stickers ? (flags | 8) : (flags &~ 8); - flags = send_gifs ? (flags | 16) : (flags &~ 16); - flags = send_games ? (flags | 32) : (flags &~ 32); - flags = send_inline ? (flags | 64) : (flags &~ 64); - flags = embed_links ? (flags | 128) : (flags &~ 128); - stream.writeInt32(flags); - stream.writeInt32(until_date); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = view_messages ? (flags | 1) : (flags &~ 1); + flags = send_messages ? (flags | 2) : (flags &~ 2); + flags = send_media ? (flags | 4) : (flags &~ 4); + flags = send_stickers ? (flags | 8) : (flags &~ 8); + flags = send_gifs ? (flags | 16) : (flags &~ 16); + flags = send_games ? (flags | 32) : (flags &~ 32); + flags = send_inline ? (flags | 64) : (flags &~ 64); + flags = embed_links ? (flags | 128) : (flags &~ 128); + stream.writeInt32(flags); + stream.writeInt32(until_date); + } + } public static abstract class DialogPeer extends TLObject { @@ -2235,7 +2234,7 @@ public class TLRPC { } public static class TL_messageUserReaction extends TLObject { - public static int constructor = 0xd267dcbc; + public static int constructor = 0x932844fa; public long user_id; public String reaction; @@ -2254,13 +2253,13 @@ public class TLRPC { } public void readParams(AbstractSerializedData stream, boolean exception) { - user_id = stream.readInt32(exception); + user_id = stream.readInt64(exception); reaction = stream.readString(exception); } public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32((int) user_id); + stream.writeInt64(user_id); stream.writeString(reaction); } } @@ -3229,62 +3228,62 @@ public class TLRPC { } public static abstract class EncryptedFile extends TLObject { - public long id; - public long access_hash; - public int size; - public int dc_id; - public int key_fingerprint; + public long id; + public long access_hash; + public int size; + public int dc_id; + public int key_fingerprint; - public static EncryptedFile TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - EncryptedFile result = null; - switch (constructor) { - case 0x4a70994c: - result = new TL_encryptedFile(); - break; - case 0xc21f497e: - result = new TL_encryptedFileEmpty(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in EncryptedFile", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static EncryptedFile TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + EncryptedFile result = null; + switch (constructor) { + case 0x4a70994c: + result = new TL_encryptedFile(); + break; + case 0xc21f497e: + result = new TL_encryptedFileEmpty(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in EncryptedFile", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_encryptedFile extends EncryptedFile { - public static int constructor = 0x4a70994c; + public static class TL_encryptedFile extends EncryptedFile { + public static int constructor = 0x4a70994c; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - size = stream.readInt32(exception); - dc_id = stream.readInt32(exception); - key_fingerprint = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + size = stream.readInt32(exception); + dc_id = stream.readInt32(exception); + key_fingerprint = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(size); - stream.writeInt32(dc_id); - stream.writeInt32(key_fingerprint); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32(size); + stream.writeInt32(dc_id); + stream.writeInt32(key_fingerprint); + } + } - public static class TL_encryptedFileEmpty extends EncryptedFile { - public static int constructor = 0xc21f497e; + public static class TL_encryptedFileEmpty extends EncryptedFile { + public static int constructor = 0xc21f497e; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static abstract class Peer extends TLObject { @@ -3408,36 +3407,36 @@ public class TLRPC { } } - public static class TL_labeledPrice extends TLObject { - public static int constructor = 0xcb296bf8; + public static class TL_labeledPrice extends TLObject { + public static int constructor = 0xcb296bf8; - public String label; - public long amount; + public String label; + public long amount; - public static TL_labeledPrice TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_labeledPrice.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_labeledPrice", constructor)); - } else { - return null; - } - } - TL_labeledPrice result = new TL_labeledPrice(); - result.readParams(stream, exception); - return result; - } + public static TL_labeledPrice TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_labeledPrice.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_labeledPrice", constructor)); + } else { + return null; + } + } + TL_labeledPrice result = new TL_labeledPrice(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - label = stream.readString(exception); - amount = stream.readInt64(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + label = stream.readString(exception); + amount = stream.readInt64(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(label); - stream.writeInt64(amount); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(label); + stream.writeInt64(amount); + } + } public static class TL_messages_exportedChatInvites extends TLObject { public static int constructor = 0xbdc62dcc; @@ -3552,139 +3551,139 @@ public class TLRPC { } } - public static class TL_langPackDifference extends TLObject { - public static int constructor = 0xf385c1f6; + public static class TL_langPackDifference extends TLObject { + public static int constructor = 0xf385c1f6; - public String lang_code; - public int from_version; - public int version; - public ArrayList strings = new ArrayList<>(); + public String lang_code; + public int from_version; + public int version; + public ArrayList strings = new ArrayList<>(); - public static TL_langPackDifference TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_langPackDifference.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_langPackDifference", constructor)); - } else { - return null; - } - } - TL_langPackDifference result = new TL_langPackDifference(); - result.readParams(stream, exception); - return result; - } + public static TL_langPackDifference TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_langPackDifference.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_langPackDifference", constructor)); + } else { + return null; + } + } + TL_langPackDifference result = new TL_langPackDifference(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - lang_code = stream.readString(exception); - from_version = stream.readInt32(exception); - version = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - LangPackString object = LangPackString.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - strings.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + lang_code = stream.readString(exception); + from_version = stream.readInt32(exception); + version = stream.readInt32(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + LangPackString object = LangPackString.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + strings.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(lang_code); - stream.writeInt32(from_version); - stream.writeInt32(version); - stream.writeInt32(0x1cb5c415); - int count = strings.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - strings.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(lang_code); + stream.writeInt32(from_version); + stream.writeInt32(version); + stream.writeInt32(0x1cb5c415); + int count = strings.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + strings.get(a).serializeToStream(stream); + } + } + } - public static abstract class help_DeepLinkInfo extends TLObject { + public static abstract class help_DeepLinkInfo extends TLObject { - public static help_DeepLinkInfo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - help_DeepLinkInfo result = null; - switch (constructor) { - case 0x66afa166: - result = new TL_help_deepLinkInfoEmpty(); - break; - case 0x6a4ee832: - result = new TL_help_deepLinkInfo(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in help_DeepLinkInfo", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static help_DeepLinkInfo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + help_DeepLinkInfo result = null; + switch (constructor) { + case 0x66afa166: + result = new TL_help_deepLinkInfoEmpty(); + break; + case 0x6a4ee832: + result = new TL_help_deepLinkInfo(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in help_DeepLinkInfo", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_help_deepLinkInfoEmpty extends help_DeepLinkInfo { - public static int constructor = 0x66afa166; + public static class TL_help_deepLinkInfoEmpty extends help_DeepLinkInfo { + public static int constructor = 0x66afa166; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_help_deepLinkInfo extends help_DeepLinkInfo { - public static int constructor = 0x6a4ee832; + public static class TL_help_deepLinkInfo extends help_DeepLinkInfo { + public static int constructor = 0x6a4ee832; - public int flags; - public boolean update_app; - public String message; - public ArrayList entities = new ArrayList<>(); + public int flags; + public boolean update_app; + public String message; + public ArrayList entities = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - update_app = (flags & 1) != 0; - message = stream.readString(exception); - if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + update_app = (flags & 1) != 0; + message = stream.readString(exception); + if ((flags & 2) != 0) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + entities.add(object); + } + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = update_app ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeString(message); - if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = update_app ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + stream.writeString(message); + if ((flags & 2) != 0) { + stream.writeInt32(0x1cb5c415); + int count = entities.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + entities.get(a).serializeToStream(stream); + } + } + } + } public static class TL_chatAdminRights extends TLObject { public static int constructor = 0x5fb224d5; @@ -4127,100 +4126,100 @@ public class TLRPC { } } - public static abstract class SecureFile extends TLObject { + public static abstract class SecureFile extends TLObject { - public static SecureFile TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - SecureFile result = null; - switch (constructor) { - case 0x64199744: - result = new TL_secureFileEmpty(); - break; - case 0xe0277a62: - result = new TL_secureFile(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in SecureFile", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static SecureFile TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + SecureFile result = null; + switch (constructor) { + case 0x64199744: + result = new TL_secureFileEmpty(); + break; + case 0xe0277a62: + result = new TL_secureFile(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in SecureFile", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_secureFileEmpty extends SecureFile { - public static int constructor = 0x64199744; + public static class TL_secureFileEmpty extends SecureFile { + public static int constructor = 0x64199744; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_secureFile extends SecureFile { - public static int constructor = 0xe0277a62; + public static class TL_secureFile extends SecureFile { + public static int constructor = 0xe0277a62; - public long id; - public long access_hash; - public int size; - public int dc_id; - public int date; - public byte[] file_hash; - public byte[] secret; + public long id; + public long access_hash; + public int size; + public int dc_id; + public int date; + public byte[] file_hash; + public byte[] secret; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - size = stream.readInt32(exception); - dc_id = stream.readInt32(exception); - date = stream.readInt32(exception); - file_hash = stream.readByteArray(exception); - secret = stream.readByteArray(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + size = stream.readInt32(exception); + dc_id = stream.readInt32(exception); + date = stream.readInt32(exception); + file_hash = stream.readByteArray(exception); + secret = stream.readByteArray(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(size); - stream.writeInt32(dc_id); - stream.writeInt32(date); - stream.writeByteArray(file_hash); - stream.writeByteArray(secret); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32(size); + stream.writeInt32(dc_id); + stream.writeInt32(date); + stream.writeByteArray(file_hash); + stream.writeByteArray(secret); + } + } - public static class TL_messages_affectedMessages extends TLObject { - public static int constructor = 0x84d19185; + public static class TL_messages_affectedMessages extends TLObject { + public static int constructor = 0x84d19185; - public int pts; - public int pts_count; + public int pts; + public int pts_count; - public static TL_messages_affectedMessages TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messages_affectedMessages.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_affectedMessages", constructor)); - } else { - return null; - } - } - TL_messages_affectedMessages result = new TL_messages_affectedMessages(); - result.readParams(stream, exception); - return result; - } + public static TL_messages_affectedMessages TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_messages_affectedMessages.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_messages_affectedMessages", constructor)); + } else { + return null; + } + } + TL_messages_affectedMessages result = new TL_messages_affectedMessages(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - pts = stream.readInt32(exception); - pts_count = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + pts = stream.readInt32(exception); + pts_count = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(pts); - stream.writeInt32(pts_count); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(pts); + stream.writeInt32(pts_count); + } + } public static class TL_messages_chatInviteImporters extends TLObject { public static int constructor = 0x81b6b00a; @@ -4599,311 +4598,311 @@ public class TLRPC { } } - public static abstract class updates_Difference extends TLObject { - public ArrayList new_messages = new ArrayList<>(); - public ArrayList new_encrypted_messages = new ArrayList<>(); - public ArrayList other_updates = new ArrayList<>(); - public ArrayList chats = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); - public TL_updates_state state; - public TL_updates_state intermediate_state; - public int pts; - public int date; - public int seq; + public static abstract class updates_Difference extends TLObject { + public ArrayList new_messages = new ArrayList<>(); + public ArrayList new_encrypted_messages = new ArrayList<>(); + public ArrayList other_updates = new ArrayList<>(); + public ArrayList chats = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); + public TL_updates_state state; + public TL_updates_state intermediate_state; + public int pts; + public int date; + public int seq; - public static updates_Difference TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - updates_Difference result = null; - switch (constructor) { - case 0xf49ca0: - result = new TL_updates_difference(); - break; - case 0xa8fb1981: - result = new TL_updates_differenceSlice(); - break; - case 0x4afe8f6d: - result = new TL_updates_differenceTooLong(); - break; - case 0x5d75a138: - result = new TL_updates_differenceEmpty(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in updates_Difference", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static updates_Difference TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + updates_Difference result = null; + switch (constructor) { + case 0xf49ca0: + result = new TL_updates_difference(); + break; + case 0xa8fb1981: + result = new TL_updates_differenceSlice(); + break; + case 0x4afe8f6d: + result = new TL_updates_differenceTooLong(); + break; + case 0x5d75a138: + result = new TL_updates_differenceEmpty(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in updates_Difference", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_updates_difference extends updates_Difference { - public static int constructor = 0xf49ca0; + public static class TL_updates_difference extends updates_Difference { + public static int constructor = 0xf49ca0; - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Message object = Message.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - new_messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - EncryptedMessage object = EncryptedMessage.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - new_encrypted_messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Update object = Update.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - other_updates.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - state = TL_updates_state.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + Message object = Message.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + new_messages.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + EncryptedMessage object = EncryptedMessage.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + new_encrypted_messages.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + Update object = Update.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + other_updates.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + chats.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + users.add(object); + } + state = TL_updates_state.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = new_messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - new_messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = new_encrypted_messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - new_encrypted_messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = other_updates.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - other_updates.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - state.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = new_messages.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + new_messages.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = new_encrypted_messages.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + new_encrypted_messages.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = other_updates.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + other_updates.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = chats.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + chats.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = users.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + users.get(a).serializeToStream(stream); + } + state.serializeToStream(stream); + } + } - public static class TL_updates_differenceSlice extends updates_Difference { - public static int constructor = 0xa8fb1981; + public static class TL_updates_differenceSlice extends updates_Difference { + public static int constructor = 0xa8fb1981; - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Message object = Message.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - new_messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - EncryptedMessage object = EncryptedMessage.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - new_encrypted_messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Update object = Update.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - other_updates.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - intermediate_state = TL_updates_state.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + Message object = Message.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + new_messages.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + EncryptedMessage object = EncryptedMessage.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + new_encrypted_messages.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + Update object = Update.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + other_updates.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + chats.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + users.add(object); + } + intermediate_state = TL_updates_state.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = new_messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - new_messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = new_encrypted_messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - new_encrypted_messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = other_updates.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - other_updates.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - intermediate_state.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = new_messages.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + new_messages.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = new_encrypted_messages.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + new_encrypted_messages.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = other_updates.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + other_updates.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = chats.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + chats.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = users.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + users.get(a).serializeToStream(stream); + } + intermediate_state.serializeToStream(stream); + } + } - public static class TL_updates_differenceTooLong extends updates_Difference { - public static int constructor = 0x4afe8f6d; + public static class TL_updates_differenceTooLong extends updates_Difference { + public static int constructor = 0x4afe8f6d; - public void readParams(AbstractSerializedData stream, boolean exception) { - pts = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + pts = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(pts); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(pts); + } + } - public static class TL_updates_differenceEmpty extends updates_Difference { - public static int constructor = 0x5d75a138; + public static class TL_updates_differenceEmpty extends updates_Difference { + public static int constructor = 0x5d75a138; - public void readParams(AbstractSerializedData stream, boolean exception) { - date = stream.readInt32(exception); - seq = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + date = stream.readInt32(exception); + seq = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(date); - stream.writeInt32(seq); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(date); + stream.writeInt32(seq); + } + } public static abstract class PrivacyKey extends TLObject { @@ -5017,25 +5016,25 @@ public class TLRPC { } } - public static abstract class GeoPoint extends TLObject { + public static abstract class GeoPoint extends TLObject { public int flags; public double _long; public double lat; public int accuracy_radius; - public long access_hash; + public long access_hash; - public static GeoPoint TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - GeoPoint result = null; - switch (constructor) { - case 0x296f104: - result = new TL_geoPoint_layer119(); - break; - case 0x2049d70c: - result = new TL_geoPoint_layer81(); - break; - case 0x1117dd5f: - result = new TL_geoPointEmpty(); - break; + public static GeoPoint TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + GeoPoint result = null; + switch (constructor) { + case 0x296f104: + result = new TL_geoPoint_layer119(); + break; + case 0x2049d70c: + result = new TL_geoPoint_layer81(); + break; + case 0x1117dd5f: + result = new TL_geoPointEmpty(); + break; case 0xb2a2f663: result = new TL_geoPoint(); break; @@ -5061,48 +5060,48 @@ public class TLRPC { } } - public static class TL_geoPoint_layer119 extends TL_geoPoint { - public static int constructor = 0x296f104; + public static class TL_geoPoint_layer119 extends TL_geoPoint { + public static int constructor = 0x296f104; - public void readParams(AbstractSerializedData stream, boolean exception) { - _long = stream.readDouble(exception); - lat = stream.readDouble(exception); - access_hash = stream.readInt64(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + _long = stream.readDouble(exception); + lat = stream.readDouble(exception); + access_hash = stream.readInt64(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeDouble(_long); - stream.writeDouble(lat); - stream.writeInt64(access_hash); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeDouble(_long); + stream.writeDouble(lat); + stream.writeInt64(access_hash); + } + } - public static class TL_geoPoint_layer81 extends TL_geoPoint { - public static int constructor = 0x2049d70c; + public static class TL_geoPoint_layer81 extends TL_geoPoint { + public static int constructor = 0x2049d70c; - public void readParams(AbstractSerializedData stream, boolean exception) { - _long = stream.readDouble(exception); - lat = stream.readDouble(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + _long = stream.readDouble(exception); + lat = stream.readDouble(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeDouble(_long); - stream.writeDouble(lat); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeDouble(_long); + stream.writeDouble(lat); + } + } - public static class TL_geoPointEmpty extends GeoPoint { - public static int constructor = 0x1117dd5f; + public static class TL_geoPointEmpty extends GeoPoint { + public static int constructor = 0x1117dd5f; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_geoPoint extends GeoPoint { public static int constructor = 0xb2a2f663; @@ -5352,36 +5351,36 @@ public class TLRPC { } } - public static class TL_inputGroupCall extends TLObject { - public static int constructor = 0xd8aa840f; + public static class TL_inputGroupCall extends TLObject { + public static int constructor = 0xd8aa840f; - public long id; - public long access_hash; + public long id; + public long access_hash; - public static TL_inputGroupCall TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_inputGroupCall.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_inputGroupCall", constructor)); - } else { - return null; - } - } - TL_inputGroupCall result = new TL_inputGroupCall(); - result.readParams(stream, exception); - return result; - } + public static TL_inputGroupCall TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_inputGroupCall.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_inputGroupCall", constructor)); + } else { + return null; + } + } + TL_inputGroupCall result = new TL_inputGroupCall(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + } + } public static abstract class help_AppUpdate extends TLObject { @@ -5573,39 +5572,39 @@ public class TLRPC { } } - public static abstract class messages_FavedStickers extends TLObject { + public static abstract class messages_FavedStickers extends TLObject { public long hash; public ArrayList packs = new ArrayList<>(); public ArrayList stickers = new ArrayList<>(); - public static messages_FavedStickers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - messages_FavedStickers result = null; - switch (constructor) { - case 0x9e8fa6d3: - result = new TL_messages_favedStickersNotModified(); - break; + public static messages_FavedStickers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + messages_FavedStickers result = null; + switch (constructor) { + case 0x9e8fa6d3: + result = new TL_messages_favedStickersNotModified(); + break; case 0x2cb51097: result = new TL_messages_favedStickers(); break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in messages_FavedStickers", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in messages_FavedStickers", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_messages_favedStickersNotModified extends messages_FavedStickers { - public static int constructor = 0x9e8fa6d3; + public static class TL_messages_favedStickersNotModified extends messages_FavedStickers { + public static int constructor = 0x9e8fa6d3; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_messages_favedStickers extends messages_FavedStickers { public static int constructor = 0x2cb51097; @@ -5776,118 +5775,118 @@ public class TLRPC { } } - public static abstract class SendMessageAction extends TLObject { - public int progress; + public static abstract class SendMessageAction extends TLObject { + public int progress; - public static SendMessageAction TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - SendMessageAction result = null; - switch (constructor) { - case 0xdd6a8f48: - result = new TL_sendMessageGamePlayAction(); - break; - case 0xd52f73f7: - result = new TL_sendMessageRecordAudioAction(); - break; - case 0x92042ff7: - result = new TL_sendMessageUploadVideoAction_old(); - break; - case 0xe6ac8a6f: - result = new TL_sendMessageUploadAudioAction_old(); - break; - case 0xf351d7ab: - result = new TL_sendMessageUploadAudioAction(); - break; - case 0xd1d34a26: - result = new TL_sendMessageUploadPhotoAction(); - break; - case 0x8faee98e: - result = new TL_sendMessageUploadDocumentAction_old(); - break; - case 0xe9763aec: - result = new TL_sendMessageUploadVideoAction(); - break; - case 0xfd5ec8f5: - result = new TL_sendMessageCancelAction(); - break; - case 0x176f8ba1: - result = new TL_sendMessageGeoLocationAction(); - break; - case 0x628cbc6f: - result = new TL_sendMessageChooseContactAction(); - break; + public static SendMessageAction TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + SendMessageAction result = null; + switch (constructor) { + case 0xdd6a8f48: + result = new TL_sendMessageGamePlayAction(); + break; + case 0xd52f73f7: + result = new TL_sendMessageRecordAudioAction(); + break; + case 0x92042ff7: + result = new TL_sendMessageUploadVideoAction_old(); + break; + case 0xe6ac8a6f: + result = new TL_sendMessageUploadAudioAction_old(); + break; + case 0xf351d7ab: + result = new TL_sendMessageUploadAudioAction(); + break; + case 0xd1d34a26: + result = new TL_sendMessageUploadPhotoAction(); + break; + case 0x8faee98e: + result = new TL_sendMessageUploadDocumentAction_old(); + break; + case 0xe9763aec: + result = new TL_sendMessageUploadVideoAction(); + break; + case 0xfd5ec8f5: + result = new TL_sendMessageCancelAction(); + break; + case 0x176f8ba1: + result = new TL_sendMessageGeoLocationAction(); + break; + case 0x628cbc6f: + result = new TL_sendMessageChooseContactAction(); + break; case 0xb05ac6b1: result = new TL_sendMessageChooseStickerAction(); break; - case 0x88f27fbc: - result = new TL_sendMessageRecordRoundAction(); - break; - case 0x243e1c66: - result = new TL_sendMessageUploadRoundAction(); - break; - case 0x16bf744e: - result = new TL_sendMessageTypingAction(); - break; + case 0x88f27fbc: + result = new TL_sendMessageRecordRoundAction(); + break; + case 0x243e1c66: + result = new TL_sendMessageUploadRoundAction(); + break; + case 0x16bf744e: + result = new TL_sendMessageTypingAction(); + break; case 0xdbda9246: result = new TL_sendMessageHistoryImportAction(); break; - case 0x990a3c1a: - result = new TL_sendMessageUploadPhotoAction_old(); - break; - case 0xaa0cd9e4: - result = new TL_sendMessageUploadDocumentAction(); - break; + case 0x990a3c1a: + result = new TL_sendMessageUploadPhotoAction_old(); + break; + case 0xaa0cd9e4: + result = new TL_sendMessageUploadDocumentAction(); + break; case 0xd92c2285: result = new TL_speakingInGroupCallAction(); break; - case 0xa187d66f: - result = new TL_sendMessageRecordVideoAction(); - break; + case 0xa187d66f: + result = new TL_sendMessageRecordVideoAction(); + break; case 0x25972bcb: result = new TL_sendMessageEmojiInteraction(); break; case 0xb665902e: result = new TL_sendMessageEmojiInteractionSeen(); break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in SendMessageAction", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in SendMessageAction", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_sendMessageGamePlayAction extends SendMessageAction { - public static int constructor = 0xdd6a8f48; + public static class TL_sendMessageGamePlayAction extends SendMessageAction { + public static int constructor = 0xdd6a8f48; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_sendMessageRecordAudioAction extends SendMessageAction { - public static int constructor = 0xd52f73f7; + public static class TL_sendMessageRecordAudioAction extends SendMessageAction { + public static int constructor = 0xd52f73f7; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_sendMessageUploadVideoAction_old extends TL_sendMessageUploadVideoAction { - public static int constructor = 0x92042ff7; + public static class TL_sendMessageUploadVideoAction_old extends TL_sendMessageUploadVideoAction { + public static int constructor = 0x92042ff7; - public void readParams(AbstractSerializedData stream, boolean exception) { - } + public void readParams(AbstractSerializedData stream, boolean exception) { + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_sendMessageEmojiInteraction extends SendMessageAction { public static int constructor = 0x25972bcb; @@ -5911,97 +5910,97 @@ public class TLRPC { } public static class TL_sendMessageUploadAudioAction_old extends TL_sendMessageUploadAudioAction { - public static int constructor = 0xe6ac8a6f; + public static int constructor = 0xe6ac8a6f; - public void readParams(AbstractSerializedData stream, boolean exception) { - } + public void readParams(AbstractSerializedData stream, boolean exception) { + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_sendMessageUploadAudioAction extends SendMessageAction { - public static int constructor = 0xf351d7ab; + public static class TL_sendMessageUploadAudioAction extends SendMessageAction { + public static int constructor = 0xf351d7ab; - public void readParams(AbstractSerializedData stream, boolean exception) { - progress = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + progress = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(progress); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(progress); + } + } - public static class TL_sendMessageUploadPhotoAction extends SendMessageAction { - public static int constructor = 0xd1d34a26; + public static class TL_sendMessageUploadPhotoAction extends SendMessageAction { + public static int constructor = 0xd1d34a26; - public void readParams(AbstractSerializedData stream, boolean exception) { - progress = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + progress = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(progress); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(progress); + } + } - public static class TL_sendMessageUploadDocumentAction_old extends TL_sendMessageUploadDocumentAction { - public static int constructor = 0x8faee98e; + public static class TL_sendMessageUploadDocumentAction_old extends TL_sendMessageUploadDocumentAction { + public static int constructor = 0x8faee98e; - public void readParams(AbstractSerializedData stream, boolean exception) { - } + public void readParams(AbstractSerializedData stream, boolean exception) { + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_sendMessageUploadVideoAction extends SendMessageAction { - public static int constructor = 0xe9763aec; + public static class TL_sendMessageUploadVideoAction extends SendMessageAction { + public static int constructor = 0xe9763aec; - public void readParams(AbstractSerializedData stream, boolean exception) { - progress = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + progress = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(progress); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(progress); + } + } - public static class TL_sendMessageCancelAction extends SendMessageAction { - public static int constructor = 0xfd5ec8f5; + public static class TL_sendMessageCancelAction extends SendMessageAction { + public static int constructor = 0xfd5ec8f5; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_sendMessageGeoLocationAction extends SendMessageAction { - public static int constructor = 0x176f8ba1; + public static class TL_sendMessageGeoLocationAction extends SendMessageAction { + public static int constructor = 0x176f8ba1; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_sendMessageChooseContactAction extends SendMessageAction { - public static int constructor = 0x628cbc6f; + public static class TL_sendMessageChooseContactAction extends SendMessageAction { + public static int constructor = 0x628cbc6f; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_sendMessageChooseStickerAction extends SendMessageAction { public static int constructor = 0xb05ac6b1; @@ -6012,28 +6011,28 @@ public class TLRPC { } } - public static class TL_sendMessageRecordRoundAction extends SendMessageAction { - public static int constructor = 0x88f27fbc; + public static class TL_sendMessageRecordRoundAction extends SendMessageAction { + public static int constructor = 0x88f27fbc; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_sendMessageUploadRoundAction extends SendMessageAction { - public static int constructor = 0x243e1c66; + public static class TL_sendMessageUploadRoundAction extends SendMessageAction { + public static int constructor = 0x243e1c66; - public void readParams(AbstractSerializedData stream, boolean exception) { - progress = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + progress = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(progress); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(progress); + } + } public static class TL_sendMessageEmojiInteractionSeen extends SendMessageAction { public static int constructor = 0xb665902e; @@ -6050,14 +6049,14 @@ public class TLRPC { } } - public static class TL_sendMessageTypingAction extends SendMessageAction { - public static int constructor = 0x16bf744e; + public static class TL_sendMessageTypingAction extends SendMessageAction { + public static int constructor = 0x16bf744e; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_sendMessageHistoryImportAction extends SendMessageAction { public static int constructor = 0xdbda9246; @@ -6074,31 +6073,31 @@ public class TLRPC { } } - public static class TL_sendMessageUploadPhotoAction_old extends TL_sendMessageUploadPhotoAction { - public static int constructor = 0x990a3c1a; + public static class TL_sendMessageUploadPhotoAction_old extends TL_sendMessageUploadPhotoAction { + public static int constructor = 0x990a3c1a; - public void readParams(AbstractSerializedData stream, boolean exception) { - } + public void readParams(AbstractSerializedData stream, boolean exception) { + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_sendMessageUploadDocumentAction extends SendMessageAction { - public static int constructor = 0xaa0cd9e4; + public static class TL_sendMessageUploadDocumentAction extends SendMessageAction { + public static int constructor = 0xaa0cd9e4; - public void readParams(AbstractSerializedData stream, boolean exception) { - progress = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + progress = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(progress); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(progress); + } + } public static class TL_speakingInGroupCallAction extends SendMessageAction { public static int constructor = 0xd92c2285; @@ -6109,90 +6108,90 @@ public class TLRPC { } } - public static class TL_sendMessageRecordVideoAction extends SendMessageAction { - public static int constructor = 0xa187d66f; + public static class TL_sendMessageRecordVideoAction extends SendMessageAction { + public static int constructor = 0xa187d66f; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static abstract class auth_SentCodeType extends TLObject { - public int length; - public String pattern; + public static abstract class auth_SentCodeType extends TLObject { + public int length; + public String pattern; public String prefix; - public static auth_SentCodeType TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - auth_SentCodeType result = null; - switch (constructor) { - case 0x3dbb5986: - result = new TL_auth_sentCodeTypeApp(); - break; - case 0x5353e5a7: - result = new TL_auth_sentCodeTypeCall(); - break; - case 0xab03c6d9: - result = new TL_auth_sentCodeTypeFlashCall(); - break; + public static auth_SentCodeType TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + auth_SentCodeType result = null; + switch (constructor) { + case 0x3dbb5986: + result = new TL_auth_sentCodeTypeApp(); + break; + case 0x5353e5a7: + result = new TL_auth_sentCodeTypeCall(); + break; + case 0xab03c6d9: + result = new TL_auth_sentCodeTypeFlashCall(); + break; case 0x82006484: result = new TL_auth_sentCodeTypeMissedCall(); break; - case 0xc000bba2: - result = new TL_auth_sentCodeTypeSms(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in auth_SentCodeType", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + case 0xc000bba2: + result = new TL_auth_sentCodeTypeSms(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in auth_SentCodeType", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_auth_sentCodeTypeApp extends auth_SentCodeType { - public static int constructor = 0x3dbb5986; + public static class TL_auth_sentCodeTypeApp extends auth_SentCodeType { + public static int constructor = 0x3dbb5986; - public void readParams(AbstractSerializedData stream, boolean exception) { - length = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + length = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(length); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(length); + } + } - public static class TL_auth_sentCodeTypeCall extends auth_SentCodeType { - public static int constructor = 0x5353e5a7; + public static class TL_auth_sentCodeTypeCall extends auth_SentCodeType { + public static int constructor = 0x5353e5a7; - public void readParams(AbstractSerializedData stream, boolean exception) { - length = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + length = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(length); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(length); + } + } - public static class TL_auth_sentCodeTypeFlashCall extends auth_SentCodeType { - public static int constructor = 0xab03c6d9; + public static class TL_auth_sentCodeTypeFlashCall extends auth_SentCodeType { + public static int constructor = 0xab03c6d9; - public void readParams(AbstractSerializedData stream, boolean exception) { - pattern = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + pattern = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(pattern); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(pattern); + } + } public static class TL_auth_sentCodeTypeMissedCall extends auth_SentCodeType { public static int constructor = 0x82006484; @@ -6209,84 +6208,84 @@ public class TLRPC { } } - public static class TL_auth_sentCodeTypeSms extends auth_SentCodeType { - public static int constructor = 0xc000bba2; + public static class TL_auth_sentCodeTypeSms extends auth_SentCodeType { + public static int constructor = 0xc000bba2; - public void readParams(AbstractSerializedData stream, boolean exception) { - length = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + length = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(length); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(length); + } + } - public static abstract class messages_StickerSetInstallResult extends TLObject { - public ArrayList sets = new ArrayList<>(); + public static abstract class messages_StickerSetInstallResult extends TLObject { + public ArrayList sets = new ArrayList<>(); - public static messages_StickerSetInstallResult TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - messages_StickerSetInstallResult result = null; - switch (constructor) { - case 0x38641628: - result = new TL_messages_stickerSetInstallResultSuccess(); - break; - case 0x35e410a8: - result = new TL_messages_stickerSetInstallResultArchive(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in messages_StickerSetInstallResult", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static messages_StickerSetInstallResult TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + messages_StickerSetInstallResult result = null; + switch (constructor) { + case 0x38641628: + result = new TL_messages_stickerSetInstallResultSuccess(); + break; + case 0x35e410a8: + result = new TL_messages_stickerSetInstallResultArchive(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in messages_StickerSetInstallResult", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_messages_stickerSetInstallResultSuccess extends messages_StickerSetInstallResult { - public static int constructor = 0x38641628; + public static class TL_messages_stickerSetInstallResultSuccess extends messages_StickerSetInstallResult { + public static int constructor = 0x38641628; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_messages_stickerSetInstallResultArchive extends messages_StickerSetInstallResult { - public static int constructor = 0x35e410a8; + public static class TL_messages_stickerSetInstallResultArchive extends messages_StickerSetInstallResult { + public static int constructor = 0x35e410a8; - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - StickerSetCovered object = StickerSetCovered.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - sets.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + StickerSetCovered object = StickerSetCovered.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + sets.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = sets.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - sets.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = sets.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + sets.get(a).serializeToStream(stream); + } + } + } public static class TL_peerSettings extends TLObject { public static int constructor = 0xa518110d; @@ -6499,133 +6498,133 @@ public class TLRPC { } } - public static class TL_channels_adminLogResults extends TLObject { - public static int constructor = 0xed8af74d; + public static class TL_channels_adminLogResults extends TLObject { + public static int constructor = 0xed8af74d; - public ArrayList events = new ArrayList<>(); - public ArrayList chats = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); + public ArrayList events = new ArrayList<>(); + public ArrayList chats = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); - public static TL_channels_adminLogResults TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_channels_adminLogResults.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_channels_adminLogResults", constructor)); - } else { - return null; - } - } - TL_channels_adminLogResults result = new TL_channels_adminLogResults(); - result.readParams(stream, exception); - return result; - } + public static TL_channels_adminLogResults TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_channels_adminLogResults.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_channels_adminLogResults", constructor)); + } else { + return null; + } + } + TL_channels_adminLogResults result = new TL_channels_adminLogResults(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_channelAdminLogEvent object = TL_channelAdminLogEvent.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - events.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + TL_channelAdminLogEvent object = TL_channelAdminLogEvent.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + events.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + chats.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + users.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = events.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - events.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = events.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + events.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = chats.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + chats.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = users.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + users.get(a).serializeToStream(stream); + } + } + } - public static class TL_inputPhoneContact extends TLObject { - public static int constructor = 0xf392b7f4; + public static class TL_inputPhoneContact extends TLObject { + public static int constructor = 0xf392b7f4; - public long client_id; - public String phone; - public String first_name; - public String last_name; + public long client_id; + public String phone; + public String first_name; + public String last_name; - public static TL_inputPhoneContact TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_inputPhoneContact.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_inputPhoneContact", constructor)); - } else { - return null; - } - } - TL_inputPhoneContact result = new TL_inputPhoneContact(); - result.readParams(stream, exception); - return result; - } + public static TL_inputPhoneContact TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_inputPhoneContact.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_inputPhoneContact", constructor)); + } else { + return null; + } + } + TL_inputPhoneContact result = new TL_inputPhoneContact(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - client_id = stream.readInt64(exception); - phone = stream.readString(exception); - first_name = stream.readString(exception); - last_name = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + client_id = stream.readInt64(exception); + phone = stream.readString(exception); + first_name = stream.readString(exception); + last_name = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(client_id); - stream.writeString(phone); - stream.writeString(first_name); - stream.writeString(last_name); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(client_id); + stream.writeString(phone); + stream.writeString(first_name); + stream.writeString(last_name); + } + } public static abstract class ThemeSettings extends TLObject { @@ -6814,36 +6813,36 @@ public class TLRPC { } } - public static class TL_pageCaption extends TLObject { - public static int constructor = 0x6f747657; + public static class TL_pageCaption extends TLObject { + public static int constructor = 0x6f747657; - public RichText text; - public RichText credit; + public RichText text; + public RichText credit; - public static TL_pageCaption TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_pageCaption.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_pageCaption", constructor)); - } else { - return null; - } - } - TL_pageCaption result = new TL_pageCaption(); - result.readParams(stream, exception); - return result; - } + public static TL_pageCaption TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_pageCaption.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_pageCaption", constructor)); + } else { + return null; + } + } + TL_pageCaption result = new TL_pageCaption(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - credit = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + credit = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - text.serializeToStream(stream); - credit.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + text.serializeToStream(stream); + credit.serializeToStream(stream); + } + } public static abstract class PrivacyRule extends TLObject { @@ -7105,194 +7104,194 @@ public class TLRPC { } } - public static class TL_messageMediaUnsupported_old extends TL_messageMediaUnsupported { - public static int constructor = 0x29632a36; + public static class TL_messageMediaUnsupported_old extends TL_messageMediaUnsupported { + public static int constructor = 0x29632a36; - public void readParams(AbstractSerializedData stream, boolean exception) { - bytes = stream.readByteArray(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + bytes = stream.readByteArray(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(bytes); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeByteArray(bytes); + } + } - public static class TL_messageMediaAudio_layer45 extends MessageMedia { - public static int constructor = 0xc6b68300; + public static class TL_messageMediaAudio_layer45 extends MessageMedia { + public static int constructor = 0xc6b68300; - public void readParams(AbstractSerializedData stream, boolean exception) { - audio_unused = Audio.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + audio_unused = Audio.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - audio_unused.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + audio_unused.serializeToStream(stream); + } + } - public static class TL_messageMediaPhoto_old extends TL_messageMediaPhoto { - public static int constructor = 0xc8c45a2a; + public static class TL_messageMediaPhoto_old extends TL_messageMediaPhoto { + public static int constructor = 0xc8c45a2a; - public void readParams(AbstractSerializedData stream, boolean exception) { - photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - photo.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + photo.serializeToStream(stream); + } + } - public static class TL_messageMediaInvoice extends MessageMedia { - public static int constructor = 0x84551347; + public static class TL_messageMediaInvoice extends MessageMedia { + public static int constructor = 0x84551347; - public WebDocument photo; + public WebDocument photo; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - shipping_address_requested = (flags & 2) != 0; - test = (flags & 8) != 0; - title = stream.readString(exception); - description = stream.readString(exception); - if ((flags & 1) != 0) { - photo = WebDocument.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 4) != 0) { - receipt_msg_id = stream.readInt32(exception); - } - currency = stream.readString(exception); - total_amount = stream.readInt64(exception); - start_param = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + shipping_address_requested = (flags & 2) != 0; + test = (flags & 8) != 0; + title = stream.readString(exception); + description = stream.readString(exception); + if ((flags & 1) != 0) { + photo = WebDocument.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 4) != 0) { + receipt_msg_id = stream.readInt32(exception); + } + currency = stream.readString(exception); + total_amount = stream.readInt64(exception); + start_param = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = shipping_address_requested ? (flags | 2) : (flags &~ 2); - flags = test ? (flags | 8) : (flags &~ 8); - stream.writeInt32(flags); - stream.writeString(title); - stream.writeString(description); - if ((flags & 1) != 0) { - photo.serializeToStream(stream); - } - if ((flags & 4) != 0) { - stream.writeInt32(receipt_msg_id); - } - stream.writeString(currency); - stream.writeInt64(total_amount); - stream.writeString(start_param); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = shipping_address_requested ? (flags | 2) : (flags &~ 2); + flags = test ? (flags | 8) : (flags &~ 8); + stream.writeInt32(flags); + stream.writeString(title); + stream.writeString(description); + if ((flags & 1) != 0) { + photo.serializeToStream(stream); + } + if ((flags & 4) != 0) { + stream.writeInt32(receipt_msg_id); + } + stream.writeString(currency); + stream.writeInt64(total_amount); + stream.writeString(start_param); + } + } - public static class TL_messageMediaUnsupported extends MessageMedia { - public static int constructor = 0x9f84f49e; + public static class TL_messageMediaUnsupported extends MessageMedia { + public static int constructor = 0x9f84f49e; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_messageMediaEmpty extends MessageMedia { - public static int constructor = 0x3ded6320; + public static class TL_messageMediaEmpty extends MessageMedia { + public static int constructor = 0x3ded6320; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_messageMediaVenue extends MessageMedia { - public static int constructor = 0x2ec0533f; + public static class TL_messageMediaVenue extends MessageMedia { + public static int constructor = 0x2ec0533f; - public void readParams(AbstractSerializedData stream, boolean exception) { - geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); - title = stream.readString(exception); - address = stream.readString(exception); - provider = stream.readString(exception); - venue_id = stream.readString(exception); - venue_type = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); + title = stream.readString(exception); + address = stream.readString(exception); + provider = stream.readString(exception); + venue_id = stream.readString(exception); + venue_type = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - geo.serializeToStream(stream); - stream.writeString(title); - stream.writeString(address); - stream.writeString(provider); - stream.writeString(venue_id); - stream.writeString(venue_type); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + geo.serializeToStream(stream); + stream.writeString(title); + stream.writeString(address); + stream.writeString(provider); + stream.writeString(venue_id); + stream.writeString(venue_type); + } + } - public static class TL_messageMediaVenue_layer71 extends MessageMedia { - public static int constructor = 0x7912b71f; + public static class TL_messageMediaVenue_layer71 extends MessageMedia { + public static int constructor = 0x7912b71f; - public void readParams(AbstractSerializedData stream, boolean exception) { - geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); - title = stream.readString(exception); - address = stream.readString(exception); - provider = stream.readString(exception); - venue_id = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); + title = stream.readString(exception); + address = stream.readString(exception); + provider = stream.readString(exception); + venue_id = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - geo.serializeToStream(stream); - stream.writeString(title); - stream.writeString(address); - stream.writeString(provider); - stream.writeString(venue_id); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + geo.serializeToStream(stream); + stream.writeString(title); + stream.writeString(address); + stream.writeString(provider); + stream.writeString(venue_id); + } + } - public static class TL_messageMediaVideo_old extends TL_messageMediaVideo_layer45 { - public static int constructor = 0xa2d24290; + public static class TL_messageMediaVideo_old extends TL_messageMediaVideo_layer45 { + public static int constructor = 0xa2d24290; - public void readParams(AbstractSerializedData stream, boolean exception) { - video_unused = Video.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + video_unused = Video.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - video_unused.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + video_unused.serializeToStream(stream); + } + } - public static class TL_messageMediaDocument extends MessageMedia { - public static int constructor = 0x9cb070d7; + public static class TL_messageMediaDocument extends MessageMedia { + public static int constructor = 0x9cb070d7; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - if ((flags & 1) != 0) { - document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - } else { - document = new TL_documentEmpty(); - } - if ((flags & 4) != 0) { - ttl_seconds = stream.readInt32(exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + if ((flags & 1) != 0) { + document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); + } else { + document = new TL_documentEmpty(); + } + if ((flags & 4) != 0) { + ttl_seconds = stream.readInt32(exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - document.serializeToStream(stream); - } - if ((flags & 4) != 0) { - stream.writeInt32(ttl_seconds); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + document.serializeToStream(stream); + } + if ((flags & 4) != 0) { + stream.writeInt32(ttl_seconds); + } + } + } public static class TL_messageMediaDocument_layer74 extends TL_messageMediaDocument { public static int constructor = 0x7c4414d3; @@ -7303,8 +7302,8 @@ public class TLRPC { if ((flags & 1) != 0) { document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); } else { - document = new TL_documentEmpty(); - } + document = new TL_documentEmpty(); + } if ((flags & 2) != 0) { captionLegacy = stream.readString(exception); } @@ -7328,62 +7327,62 @@ public class TLRPC { } } - public static class TL_messageMediaDocument_old extends TL_messageMediaDocument { - public static int constructor = 0x2fda2204; + public static class TL_messageMediaDocument_old extends TL_messageMediaDocument { + public static int constructor = 0x2fda2204; - public void readParams(AbstractSerializedData stream, boolean exception) { - document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - document.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + document.serializeToStream(stream); + } + } - public static class TL_messageMediaDocument_layer68 extends TL_messageMediaDocument { - public static int constructor = 0xf3e02ea8; + public static class TL_messageMediaDocument_layer68 extends TL_messageMediaDocument { + public static int constructor = 0xf3e02ea8; - public void readParams(AbstractSerializedData stream, boolean exception) { - document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - captionLegacy = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); + captionLegacy = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - document.serializeToStream(stream); - stream.writeString(captionLegacy); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + document.serializeToStream(stream); + stream.writeString(captionLegacy); + } + } - public static class TL_messageMediaPhoto extends MessageMedia { - public static int constructor = 0x695150d7; + public static class TL_messageMediaPhoto extends MessageMedia { + public static int constructor = 0x695150d7; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - if ((flags & 1) != 0) { - photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - } else { - photo = new TL_photoEmpty(); - } - if ((flags & 4) != 0) { - ttl_seconds = stream.readInt32(exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + if ((flags & 1) != 0) { + photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + } else { + photo = new TL_photoEmpty(); + } + if ((flags & 4) != 0) { + ttl_seconds = stream.readInt32(exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - photo.serializeToStream(stream); - } - if ((flags & 4) != 0) { - stream.writeInt32(ttl_seconds); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + photo.serializeToStream(stream); + } + if ((flags & 4) != 0) { + stream.writeInt32(ttl_seconds); + } + } + } public static class TL_messageMediaPoll extends MessageMedia { public static int constructor = 0x4bd6e798; @@ -7411,8 +7410,8 @@ public class TLRPC { if ((flags & 1) != 0) { photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); } else { - photo = new TL_photoEmpty(); - } + photo = new TL_photoEmpty(); + } if ((flags & 2) != 0) { captionLegacy = stream.readString(exception); } @@ -7466,108 +7465,108 @@ public class TLRPC { } } - public static class TL_messageMediaGeoLive_layer119 extends TL_messageMediaGeoLive { - public static int constructor = 0x7c3c2609; + public static class TL_messageMediaGeoLive_layer119 extends TL_messageMediaGeoLive { + public static int constructor = 0x7c3c2609; - public void readParams(AbstractSerializedData stream, boolean exception) { - geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); - period = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); + period = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - geo.serializeToStream(stream); - stream.writeInt32(period); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + geo.serializeToStream(stream); + stream.writeInt32(period); + } + } - public static class TL_messageMediaGame extends MessageMedia { - public static int constructor = 0xfdb19008; + public static class TL_messageMediaGame extends MessageMedia { + public static int constructor = 0xfdb19008; - public void readParams(AbstractSerializedData stream, boolean exception) { - game = TL_game.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + game = TL_game.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - game.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + game.serializeToStream(stream); + } + } - public static class TL_messageMediaContact_layer81 extends TL_messageMediaContact { - public static int constructor = 0x5e7d2f39; + public static class TL_messageMediaContact_layer81 extends TL_messageMediaContact { + public static int constructor = 0x5e7d2f39; - public void readParams(AbstractSerializedData stream, boolean exception) { - phone_number = stream.readString(exception); - first_name = stream.readString(exception); - last_name = stream.readString(exception); - user_id = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + phone_number = stream.readString(exception); + first_name = stream.readString(exception); + last_name = stream.readString(exception); + user_id = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(phone_number); - stream.writeString(first_name); - stream.writeString(last_name); - stream.writeInt32((int) user_id); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(phone_number); + stream.writeString(first_name); + stream.writeString(last_name); + stream.writeInt32((int) user_id); + } + } - public static class TL_messageMediaPhoto_layer68 extends TL_messageMediaPhoto { - public static int constructor = 0x3d8ce53d; + public static class TL_messageMediaPhoto_layer68 extends TL_messageMediaPhoto { + public static int constructor = 0x3d8ce53d; - public void readParams(AbstractSerializedData stream, boolean exception) { - photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - captionLegacy = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + captionLegacy = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - photo.serializeToStream(stream); - stream.writeString(captionLegacy); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + photo.serializeToStream(stream); + stream.writeString(captionLegacy); + } + } - public static class TL_messageMediaVideo_layer45 extends MessageMedia { - public static int constructor = 0x5bcf1675; + public static class TL_messageMediaVideo_layer45 extends MessageMedia { + public static int constructor = 0x5bcf1675; - public void readParams(AbstractSerializedData stream, boolean exception) { - video_unused = Video.TLdeserialize(stream, stream.readInt32(exception), exception); - captionLegacy = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + video_unused = Video.TLdeserialize(stream, stream.readInt32(exception), exception); + captionLegacy = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - video_unused.serializeToStream(stream); - stream.writeString(captionLegacy); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + video_unused.serializeToStream(stream); + stream.writeString(captionLegacy); + } + } - public static class TL_messageMediaContact_layer131 extends TL_messageMediaContact { - public static int constructor = 0xcbf24940; + public static class TL_messageMediaContact_layer131 extends TL_messageMediaContact { + public static int constructor = 0xcbf24940; - public void readParams(AbstractSerializedData stream, boolean exception) { - phone_number = stream.readString(exception); - first_name = stream.readString(exception); - last_name = stream.readString(exception); - vcard = stream.readString(exception); - user_id = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + phone_number = stream.readString(exception); + first_name = stream.readString(exception); + last_name = stream.readString(exception); + vcard = stream.readString(exception); + user_id = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(phone_number); - stream.writeString(first_name); - stream.writeString(last_name); - stream.writeString(vcard); - stream.writeInt32((int) user_id); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(phone_number); + stream.writeString(first_name); + stream.writeString(last_name); + stream.writeString(vcard); + stream.writeInt32((int) user_id); + } + } public static class TL_messageMediaContact extends MessageMedia { public static int constructor = 0x70322949; @@ -7622,145 +7621,145 @@ public class TLRPC { } } - public static class TL_messageMediaGeo extends MessageMedia { - public static int constructor = 0x56e0d474; + public static class TL_messageMediaGeo extends MessageMedia { + public static int constructor = 0x56e0d474; - public void readParams(AbstractSerializedData stream, boolean exception) { - geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - geo.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + geo.serializeToStream(stream); + } + } - public static class TL_messageMediaWebPage extends MessageMedia { - public static int constructor = 0xa32dd600; + public static class TL_messageMediaWebPage extends MessageMedia { + public static int constructor = 0xa32dd600; - public void readParams(AbstractSerializedData stream, boolean exception) { - webpage = WebPage.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + webpage = WebPage.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - webpage.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + webpage.serializeToStream(stream); + } + } - public static abstract class LangPackString extends TLObject { - public int flags; - public String key; - public String zero_value; - public String one_value; - public String two_value; - public String few_value; - public String many_value; - public String other_value; - public String value; + public static abstract class LangPackString extends TLObject { + public int flags; + public String key; + public String zero_value; + public String one_value; + public String two_value; + public String few_value; + public String many_value; + public String other_value; + public String value; - public static LangPackString TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - LangPackString result = null; - switch (constructor) { - case 0x6c47ac9f: - result = new TL_langPackStringPluralized(); - break; - case 0xcad181f6: - result = new TL_langPackString(); - break; - case 0x2979eeb2: - result = new TL_langPackStringDeleted(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in LangPackString", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static LangPackString TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + LangPackString result = null; + switch (constructor) { + case 0x6c47ac9f: + result = new TL_langPackStringPluralized(); + break; + case 0xcad181f6: + result = new TL_langPackString(); + break; + case 0x2979eeb2: + result = new TL_langPackStringDeleted(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in LangPackString", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_langPackStringPluralized extends LangPackString { - public static int constructor = 0x6c47ac9f; + public static class TL_langPackStringPluralized extends LangPackString { + public static int constructor = 0x6c47ac9f; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - key = stream.readString(exception); - if ((flags & 1) != 0) { - zero_value = stream.readString(exception); - } - if ((flags & 2) != 0) { - one_value = stream.readString(exception); - } - if ((flags & 4) != 0) { - two_value = stream.readString(exception); - } - if ((flags & 8) != 0) { - few_value = stream.readString(exception); - } - if ((flags & 16) != 0) { - many_value = stream.readString(exception); - } - other_value = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + key = stream.readString(exception); + if ((flags & 1) != 0) { + zero_value = stream.readString(exception); + } + if ((flags & 2) != 0) { + one_value = stream.readString(exception); + } + if ((flags & 4) != 0) { + two_value = stream.readString(exception); + } + if ((flags & 8) != 0) { + few_value = stream.readString(exception); + } + if ((flags & 16) != 0) { + many_value = stream.readString(exception); + } + other_value = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeString(key); - if ((flags & 1) != 0) { - stream.writeString(zero_value); - } - if ((flags & 2) != 0) { - stream.writeString(one_value); - } - if ((flags & 4) != 0) { - stream.writeString(two_value); - } - if ((flags & 8) != 0) { - stream.writeString(few_value); - } - if ((flags & 16) != 0) { - stream.writeString(many_value); - } - stream.writeString(other_value); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeString(key); + if ((flags & 1) != 0) { + stream.writeString(zero_value); + } + if ((flags & 2) != 0) { + stream.writeString(one_value); + } + if ((flags & 4) != 0) { + stream.writeString(two_value); + } + if ((flags & 8) != 0) { + stream.writeString(few_value); + } + if ((flags & 16) != 0) { + stream.writeString(many_value); + } + stream.writeString(other_value); + } + } - public static class TL_langPackString extends LangPackString { - public static int constructor = 0xcad181f6; + public static class TL_langPackString extends LangPackString { + public static int constructor = 0xcad181f6; - public void readParams(AbstractSerializedData stream, boolean exception) { - key = stream.readString(exception); - value = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + key = stream.readString(exception); + value = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(key); - stream.writeString(value); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(key); + stream.writeString(value); + } + } - public static class TL_langPackStringDeleted extends LangPackString { - public static int constructor = 0x2979eeb2; + public static class TL_langPackStringDeleted extends LangPackString { + public static int constructor = 0x2979eeb2; - public void readParams(AbstractSerializedData stream, boolean exception) { - key = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + key = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(key); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(key); + } + } public static class TL_auth_sentCode extends TLObject { public static int constructor = 0x5e002502; @@ -7810,252 +7809,252 @@ public class TLRPC { } } - public static abstract class BotInlineResult extends TLObject { + public static abstract class BotInlineResult extends TLObject { - public int flags; - public String id; - public String type; - public Photo photo; - public Document document; - public String title; - public String description; - public String url; - public WebDocument thumb; - public WebDocument content; - public BotInlineMessage send_message; - public long query_id; + public int flags; + public String id; + public String type; + public Photo photo; + public Document document; + public String title; + public String description; + public String url; + public WebDocument thumb; + public WebDocument content; + public BotInlineMessage send_message; + public long query_id; - public static BotInlineResult TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - BotInlineResult result = null; - switch (constructor) { - case 0x11965f3a: - result = new TL_botInlineResult(); - break; - case 0x17db940b: - result = new TL_botInlineMediaResult(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in BotInlineResult", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static BotInlineResult TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + BotInlineResult result = null; + switch (constructor) { + case 0x11965f3a: + result = new TL_botInlineResult(); + break; + case 0x17db940b: + result = new TL_botInlineMediaResult(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in BotInlineResult", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_botInlineResult extends BotInlineResult { - public static int constructor = 0x11965f3a; + public static class TL_botInlineResult extends BotInlineResult { + public static int constructor = 0x11965f3a; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - id = stream.readString(exception); - type = stream.readString(exception); - if ((flags & 2) != 0) { - title = stream.readString(exception); - } - if ((flags & 4) != 0) { - description = stream.readString(exception); - } - if ((flags & 8) != 0) { - url = stream.readString(exception); - } - if ((flags & 16) != 0) { - thumb = WebDocument.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 32) != 0) { - content = WebDocument.TLdeserialize(stream, stream.readInt32(exception), exception); - } - send_message = BotInlineMessage.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + id = stream.readString(exception); + type = stream.readString(exception); + if ((flags & 2) != 0) { + title = stream.readString(exception); + } + if ((flags & 4) != 0) { + description = stream.readString(exception); + } + if ((flags & 8) != 0) { + url = stream.readString(exception); + } + if ((flags & 16) != 0) { + thumb = WebDocument.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 32) != 0) { + content = WebDocument.TLdeserialize(stream, stream.readInt32(exception), exception); + } + send_message = BotInlineMessage.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeString(id); - stream.writeString(type); - if ((flags & 2) != 0) { - stream.writeString(title); - } - if ((flags & 4) != 0) { - stream.writeString(description); - } - if ((flags & 8) != 0) { - stream.writeString(url); - } - if ((flags & 16) != 0) { - thumb.serializeToStream(stream); - } - if ((flags & 32) != 0) { - content.serializeToStream(stream); - } - send_message.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeString(id); + stream.writeString(type); + if ((flags & 2) != 0) { + stream.writeString(title); + } + if ((flags & 4) != 0) { + stream.writeString(description); + } + if ((flags & 8) != 0) { + stream.writeString(url); + } + if ((flags & 16) != 0) { + thumb.serializeToStream(stream); + } + if ((flags & 32) != 0) { + content.serializeToStream(stream); + } + send_message.serializeToStream(stream); + } + } - public static class TL_botInlineMediaResult extends BotInlineResult { - public static int constructor = 0x17db940b; + public static class TL_botInlineMediaResult extends BotInlineResult { + public static int constructor = 0x17db940b; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - id = stream.readString(exception); - type = stream.readString(exception); - if ((flags & 1) != 0) { - photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 2) != 0) { - document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 4) != 0) { - title = stream.readString(exception); - } - if ((flags & 8) != 0) { - description = stream.readString(exception); - } - send_message = BotInlineMessage.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + id = stream.readString(exception); + type = stream.readString(exception); + if ((flags & 1) != 0) { + photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 2) != 0) { + document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 4) != 0) { + title = stream.readString(exception); + } + if ((flags & 8) != 0) { + description = stream.readString(exception); + } + send_message = BotInlineMessage.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeString(id); - stream.writeString(type); - if ((flags & 1) != 0) { - photo.serializeToStream(stream); - } - if ((flags & 2) != 0) { - document.serializeToStream(stream); - } - if ((flags & 4) != 0) { - stream.writeString(title); - } - if ((flags & 8) != 0) { - stream.writeString(description); - } - send_message.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeString(id); + stream.writeString(type); + if ((flags & 1) != 0) { + photo.serializeToStream(stream); + } + if ((flags & 2) != 0) { + document.serializeToStream(stream); + } + if ((flags & 4) != 0) { + stream.writeString(title); + } + if ((flags & 8) != 0) { + stream.writeString(description); + } + send_message.serializeToStream(stream); + } + } - public static abstract class PeerNotifySettings extends TLObject { - public int flags; - public int mute_until; - public String sound; - public boolean show_previews; - public int events_mask; - public boolean silent; + public static abstract class PeerNotifySettings extends TLObject { + public int flags; + public int mute_until; + public String sound; + public boolean show_previews; + public int events_mask; + public boolean silent; - public static PeerNotifySettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - PeerNotifySettings result = null; - switch (constructor) { - case 0x9acda4c0: - result = new TL_peerNotifySettings_layer77(); - break; - case 0xaf509d20: - result = new TL_peerNotifySettings(); - break; - case 0x8d5e11ee: - result = new TL_peerNotifySettings_layer47(); - break; - case 0x70a68512: - result = new TL_peerNotifySettingsEmpty_layer77(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in PeerNotifySettings", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static PeerNotifySettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + PeerNotifySettings result = null; + switch (constructor) { + case 0x9acda4c0: + result = new TL_peerNotifySettings_layer77(); + break; + case 0xaf509d20: + result = new TL_peerNotifySettings(); + break; + case 0x8d5e11ee: + result = new TL_peerNotifySettings_layer47(); + break; + case 0x70a68512: + result = new TL_peerNotifySettingsEmpty_layer77(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in PeerNotifySettings", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_peerNotifySettings_layer77 extends TL_peerNotifySettings { - public static int constructor = 0x9acda4c0; + public static class TL_peerNotifySettings_layer77 extends TL_peerNotifySettings { + public static int constructor = 0x9acda4c0; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - show_previews = (flags & 1) != 0; - silent = (flags & 2) != 0; - mute_until = stream.readInt32(exception); - sound = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + show_previews = (flags & 1) != 0; + silent = (flags & 2) != 0; + mute_until = stream.readInt32(exception); + sound = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = show_previews ? (flags | 1) : (flags &~ 1); - flags = silent ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - stream.writeInt32(mute_until); - stream.writeString(sound); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = show_previews ? (flags | 1) : (flags &~ 1); + flags = silent ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + stream.writeInt32(mute_until); + stream.writeString(sound); + } + } - public static class TL_peerNotifySettings extends PeerNotifySettings { - public static int constructor = 0xaf509d20; + public static class TL_peerNotifySettings extends PeerNotifySettings { + public static int constructor = 0xaf509d20; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - if ((flags & 1) != 0) { - show_previews = stream.readBool(exception); - } - if ((flags & 2) != 0) { - silent = stream.readBool(exception); - } - if ((flags & 4) != 0) { - mute_until = stream.readInt32(exception); - } - if ((flags & 8) != 0) { - sound = stream.readString(exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + if ((flags & 1) != 0) { + show_previews = stream.readBool(exception); + } + if ((flags & 2) != 0) { + silent = stream.readBool(exception); + } + if ((flags & 4) != 0) { + mute_until = stream.readInt32(exception); + } + if ((flags & 8) != 0) { + sound = stream.readString(exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - stream.writeBool(show_previews); - } - if ((flags & 2) != 0) { - stream.writeBool(silent); - } - if ((flags & 4) != 0) { - stream.writeInt32(mute_until); - } - if ((flags & 8) != 0) { - stream.writeString(sound); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + stream.writeBool(show_previews); + } + if ((flags & 2) != 0) { + stream.writeBool(silent); + } + if ((flags & 4) != 0) { + stream.writeInt32(mute_until); + } + if ((flags & 8) != 0) { + stream.writeString(sound); + } + } + } - public static class TL_peerNotifySettings_layer47 extends TL_peerNotifySettings { - public static int constructor = 0x8d5e11ee; + public static class TL_peerNotifySettings_layer47 extends TL_peerNotifySettings { + public static int constructor = 0x8d5e11ee; - public void readParams(AbstractSerializedData stream, boolean exception) { - mute_until = stream.readInt32(exception); - sound = stream.readString(exception); - show_previews = stream.readBool(exception); - events_mask = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + mute_until = stream.readInt32(exception); + sound = stream.readString(exception); + show_previews = stream.readBool(exception); + events_mask = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(mute_until); - stream.writeString(sound); - stream.writeBool(show_previews); - stream.writeInt32(events_mask); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(mute_until); + stream.writeString(sound); + stream.writeBool(show_previews); + stream.writeInt32(events_mask); + } + } - public static class TL_peerNotifySettingsEmpty_layer77 extends PeerNotifySettings { - public static int constructor = 0x70a68512; + public static class TL_peerNotifySettingsEmpty_layer77 extends PeerNotifySettings { + public static int constructor = 0x70a68512; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static abstract class contacts_Blocked extends TLObject { @@ -8236,183 +8235,183 @@ public class TLRPC { } } - public static class TL_inputSecureValue extends TLObject { - public static int constructor = 0xdb21d0a7; + public static class TL_inputSecureValue extends TLObject { + public static int constructor = 0xdb21d0a7; - public int flags; - public SecureValueType type; - public TL_secureData data; - public InputSecureFile front_side; - public InputSecureFile reverse_side; - public InputSecureFile selfie; - public ArrayList translation = new ArrayList<>(); - public ArrayList files = new ArrayList<>(); - public SecurePlainData plain_data; + public int flags; + public SecureValueType type; + public TL_secureData data; + public InputSecureFile front_side; + public InputSecureFile reverse_side; + public InputSecureFile selfie; + public ArrayList translation = new ArrayList<>(); + public ArrayList files = new ArrayList<>(); + public SecurePlainData plain_data; - public static TL_inputSecureValue TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_inputSecureValue.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_inputSecureValue", constructor)); - } else { - return null; - } - } - TL_inputSecureValue result = new TL_inputSecureValue(); - result.readParams(stream, exception); - return result; - } + public static TL_inputSecureValue TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_inputSecureValue.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_inputSecureValue", constructor)); + } else { + return null; + } + } + TL_inputSecureValue result = new TL_inputSecureValue(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 1) != 0) { - data = TL_secureData.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 2) != 0) { - front_side = InputSecureFile.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 4) != 0) { - reverse_side = InputSecureFile.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 8) != 0) { - selfie = InputSecureFile.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 64) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InputSecureFile object = InputSecureFile.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - translation.add(object); - } - } - if ((flags & 16) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InputSecureFile object = InputSecureFile.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - files.add(object); - } - } - if ((flags & 32) != 0) { - plain_data = SecurePlainData.TLdeserialize(stream, stream.readInt32(exception), exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 1) != 0) { + data = TL_secureData.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 2) != 0) { + front_side = InputSecureFile.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 4) != 0) { + reverse_side = InputSecureFile.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 8) != 0) { + selfie = InputSecureFile.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 64) != 0) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + InputSecureFile object = InputSecureFile.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + translation.add(object); + } + } + if ((flags & 16) != 0) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + InputSecureFile object = InputSecureFile.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + files.add(object); + } + } + if ((flags & 32) != 0) { + plain_data = SecurePlainData.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - type.serializeToStream(stream); - if ((flags & 1) != 0) { - data.serializeToStream(stream); - } - if ((flags & 2) != 0) { - front_side.serializeToStream(stream); - } - if ((flags & 4) != 0) { - reverse_side.serializeToStream(stream); - } - if ((flags & 8) != 0) { - selfie.serializeToStream(stream); - } - if ((flags & 64) != 0) { - stream.writeInt32(0x1cb5c415); - int count = translation.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - translation.get(a).serializeToStream(stream); - } - } - if ((flags & 16) != 0) { - stream.writeInt32(0x1cb5c415); - int count = files.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - files.get(a).serializeToStream(stream); - } - } - if ((flags & 32) != 0) { - plain_data.serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + type.serializeToStream(stream); + if ((flags & 1) != 0) { + data.serializeToStream(stream); + } + if ((flags & 2) != 0) { + front_side.serializeToStream(stream); + } + if ((flags & 4) != 0) { + reverse_side.serializeToStream(stream); + } + if ((flags & 8) != 0) { + selfie.serializeToStream(stream); + } + if ((flags & 64) != 0) { + stream.writeInt32(0x1cb5c415); + int count = translation.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + translation.get(a).serializeToStream(stream); + } + } + if ((flags & 16) != 0) { + stream.writeInt32(0x1cb5c415); + int count = files.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + files.get(a).serializeToStream(stream); + } + } + if ((flags & 32) != 0) { + plain_data.serializeToStream(stream); + } + } + } - public static abstract class messages_DhConfig extends TLObject { - public byte[] random; - public int g; - public byte[] p; - public int version; + public static abstract class messages_DhConfig extends TLObject { + public byte[] random; + public int g; + public byte[] p; + public int version; - public static messages_DhConfig TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - messages_DhConfig result = null; - switch (constructor) { - case 0xc0e24635: - result = new TL_messages_dhConfigNotModified(); - break; - case 0x2c221edd: - result = new TL_messages_dhConfig(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in messages_DhConfig", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static messages_DhConfig TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + messages_DhConfig result = null; + switch (constructor) { + case 0xc0e24635: + result = new TL_messages_dhConfigNotModified(); + break; + case 0x2c221edd: + result = new TL_messages_dhConfig(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in messages_DhConfig", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_messages_dhConfigNotModified extends messages_DhConfig { - public static int constructor = 0xc0e24635; + public static class TL_messages_dhConfigNotModified extends messages_DhConfig { + public static int constructor = 0xc0e24635; - public void readParams(AbstractSerializedData stream, boolean exception) { - random = stream.readByteArray(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + random = stream.readByteArray(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(random); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeByteArray(random); + } + } - public static class TL_messages_dhConfig extends messages_DhConfig { - public static int constructor = 0x2c221edd; + public static class TL_messages_dhConfig extends messages_DhConfig { + public static int constructor = 0x2c221edd; - public void readParams(AbstractSerializedData stream, boolean exception) { - g = stream.readInt32(exception); - p = stream.readByteArray(exception); - version = stream.readInt32(exception); - random = stream.readByteArray(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + g = stream.readInt32(exception); + p = stream.readByteArray(exception); + version = stream.readInt32(exception); + random = stream.readByteArray(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(g); - stream.writeByteArray(p); - stream.writeInt32(version); - stream.writeByteArray(random); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(g); + stream.writeByteArray(p); + stream.writeInt32(version); + stream.writeByteArray(random); + } + } public static class TL_globalPrivacySettings extends TLObject { public static int constructor = 0xbea2f424; @@ -8523,116 +8522,34 @@ public class TLRPC { } } - public static class TL_secureValueHash extends TLObject { - public static int constructor = 0xed1ecdb0; + public static class TL_secureValueHash extends TLObject { + public static int constructor = 0xed1ecdb0; - public SecureValueType type; - public byte[] hash; + public SecureValueType type; + public byte[] hash; - public static TL_secureValueHash TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_secureValueHash.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_secureValueHash", constructor)); - } else { - return null; - } - } - TL_secureValueHash result = new TL_secureValueHash(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); - hash = stream.readByteArray(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - type.serializeToStream(stream); - stream.writeByteArray(hash); - } - } - - public static class TL_messageReactionsList extends TLObject { - public static int constructor = 0xe3ae6108; - - public int flags; - public int count; - public ArrayList reactions = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); - public String next_offset; - - public static TL_messageReactionsList TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messageReactionsList.constructor != constructor) { + public static TL_secureValueHash TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_secureValueHash.constructor != constructor) { if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messageReactionsList", constructor)); + throw new RuntimeException(String.format("can't parse magic %x in TL_secureValueHash", constructor)); } else { return null; } } - TL_messageReactionsList result = new TL_messageReactionsList(); + TL_secureValueHash result = new TL_secureValueHash(); result.readParams(stream, exception); return result; } public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_messageUserReaction object = TL_messageUserReaction.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - reactions.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - if ((flags & 1) != 0) { - next_offset = stream.readString(exception); - } + type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); + hash = stream.readByteArray(exception); } public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = reactions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - reactions.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - if ((flags & 1) != 0) { - stream.writeString(next_offset); - } + type.serializeToStream(stream); + stream.writeByteArray(hash); } } @@ -8725,7 +8642,7 @@ public class TLRPC { } } - public static abstract class InputGeoPoint extends TLObject { + public static abstract class InputGeoPoint extends TLObject { public int flags; public double lat; @@ -8733,24 +8650,24 @@ public class TLRPC { public int accuracy_radius; public static InputGeoPoint TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - InputGeoPoint result = null; - switch (constructor) { + InputGeoPoint result = null; + switch (constructor) { case 0x48222faf: result = new TL_inputGeoPoint(); break; - case 0xe4c123d6: - result = new TL_inputGeoPointEmpty(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in InputGeoPoint", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + case 0xe4c123d6: + result = new TL_inputGeoPointEmpty(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in InputGeoPoint", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } public static class TL_inputGeoPoint extends InputGeoPoint { public static int constructor = 0x48222faf; @@ -8776,207 +8693,207 @@ public class TLRPC { } } - public static class TL_inputGeoPointEmpty extends InputGeoPoint { - public static int constructor = 0xe4c123d6; + public static class TL_inputGeoPointEmpty extends InputGeoPoint { + public static int constructor = 0xe4c123d6; - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); - } - } + } + } - public static class TL_help_inviteText extends TLObject { - public static int constructor = 0x18cb9f78; + public static class TL_help_inviteText extends TLObject { + public static int constructor = 0x18cb9f78; - public String message; + public String message; - public static TL_help_inviteText TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_help_inviteText.constructor != constructor) { - if (exception) { + public static TL_help_inviteText TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_help_inviteText.constructor != constructor) { + if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_help_inviteText", constructor)); - } else { + } else { return null; - } - } + } + } TL_help_inviteText result = new TL_help_inviteText(); - result.readParams(stream, exception); - return result; - } + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - message = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + message = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(message); - } - } + stream.writeString(message); + } + } - public static abstract class Audio extends TLObject { - public long id; - public long access_hash; - public int date; - public int duration; - public String mime_type; - public int size; - public int dc_id; - public long user_id; - public byte[] key; - public byte[] iv; + public static abstract class Audio extends TLObject { + public long id; + public long access_hash; + public int date; + public int duration; + public String mime_type; + public int size; + public int dc_id; + public long user_id; + public byte[] key; + public byte[] iv; - public static Audio TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - Audio result = null; - switch (constructor) { - case 0x586988d8: - result = new TL_audioEmpty_layer45(); - break; - case 0xf9e35055: - result = new TL_audio_layer45(); - break; - case 0x427425e7: - result = new TL_audio_old(); - break; - case 0x555555F6: - result = new TL_audioEncrypted(); - break; - case 0xc7ac6496: - result = new TL_audio_old2(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in Audio", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static Audio TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + Audio result = null; + switch (constructor) { + case 0x586988d8: + result = new TL_audioEmpty_layer45(); + break; + case 0xf9e35055: + result = new TL_audio_layer45(); + break; + case 0x427425e7: + result = new TL_audio_old(); + break; + case 0x555555F6: + result = new TL_audioEncrypted(); + break; + case 0xc7ac6496: + result = new TL_audio_old2(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in Audio", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_audioEmpty_layer45 extends Audio { - public static int constructor = 0x586988d8; + public static class TL_audioEmpty_layer45 extends Audio { + public static int constructor = 0x586988d8; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + } + } - public static class TL_audio_layer45 extends Audio { - public static int constructor = 0xf9e35055; + public static class TL_audio_layer45 extends Audio { + public static int constructor = 0xf9e35055; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - date = stream.readInt32(exception); - duration = stream.readInt32(exception); - mime_type = stream.readString(exception); - size = stream.readInt32(exception); - dc_id = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + date = stream.readInt32(exception); + duration = stream.readInt32(exception); + mime_type = stream.readString(exception); + size = stream.readInt32(exception); + dc_id = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(date); - stream.writeInt32(duration); - stream.writeString(mime_type); - stream.writeInt32(size); - stream.writeInt32(dc_id); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32(date); + stream.writeInt32(duration); + stream.writeString(mime_type); + stream.writeInt32(size); + stream.writeInt32(dc_id); + } + } - public static class TL_audio_old extends TL_audio_layer45 { - public static int constructor = 0x427425e7; + public static class TL_audio_old extends TL_audio_layer45 { + public static int constructor = 0x427425e7; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - user_id = stream.readInt32(exception); - date = stream.readInt32(exception); - duration = stream.readInt32(exception); - size = stream.readInt32(exception); - dc_id = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + user_id = stream.readInt32(exception); + date = stream.readInt32(exception); + duration = stream.readInt32(exception); + size = stream.readInt32(exception); + dc_id = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32((int) user_id); - stream.writeInt32(date); - stream.writeInt32(duration); - stream.writeInt32(size); - stream.writeInt32(dc_id); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32((int) user_id); + stream.writeInt32(date); + stream.writeInt32(duration); + stream.writeInt32(size); + stream.writeInt32(dc_id); + } + } - public static class TL_audioEncrypted extends TL_audio_layer45 { - public static int constructor = 0x555555F6; + public static class TL_audioEncrypted extends TL_audio_layer45 { + public static int constructor = 0x555555F6; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - user_id = stream.readInt32(exception); - date = stream.readInt32(exception); - duration = stream.readInt32(exception); - size = stream.readInt32(exception); - dc_id = stream.readInt32(exception); - key = stream.readByteArray(exception); - iv = stream.readByteArray(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + user_id = stream.readInt32(exception); + date = stream.readInt32(exception); + duration = stream.readInt32(exception); + size = stream.readInt32(exception); + dc_id = stream.readInt32(exception); + key = stream.readByteArray(exception); + iv = stream.readByteArray(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32((int) user_id); - stream.writeInt32(date); - stream.writeInt32(duration); - stream.writeInt32(size); - stream.writeInt32(dc_id); - stream.writeByteArray(key); - stream.writeByteArray(iv); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32((int) user_id); + stream.writeInt32(date); + stream.writeInt32(duration); + stream.writeInt32(size); + stream.writeInt32(dc_id); + stream.writeByteArray(key); + stream.writeByteArray(iv); + } + } - public static class TL_audio_old2 extends TL_audio_layer45 { - public static int constructor = 0xc7ac6496; + public static class TL_audio_old2 extends TL_audio_layer45 { + public static int constructor = 0xc7ac6496; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - user_id = stream.readInt32(exception); - date = stream.readInt32(exception); - duration = stream.readInt32(exception); - mime_type = stream.readString(exception); - size = stream.readInt32(exception); - dc_id = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + user_id = stream.readInt32(exception); + date = stream.readInt32(exception); + duration = stream.readInt32(exception); + mime_type = stream.readString(exception); + size = stream.readInt32(exception); + dc_id = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32((int) user_id); - stream.writeInt32(date); - stream.writeInt32(duration); - stream.writeString(mime_type); - stream.writeInt32(size); - stream.writeInt32(dc_id); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32((int) user_id); + stream.writeInt32(date); + stream.writeInt32(duration); + stream.writeString(mime_type); + stream.writeInt32(size); + stream.writeInt32(dc_id); + } + } public static class TL_help_country extends TLObject { public static int constructor = 0xc3878e23; @@ -9044,69 +8961,69 @@ public class TLRPC { } } - public static abstract class SecurePasswordKdfAlgo extends TLObject { + public static abstract class SecurePasswordKdfAlgo extends TLObject { - public static SecurePasswordKdfAlgo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - SecurePasswordKdfAlgo result = null; - switch (constructor) { - case 0xbbf2dda0: - result = new TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000(); - break; - case 0x86471d92: - result = new TL_securePasswordKdfAlgoSHA512(); - break; - case 0x4a8537: - result = new TL_securePasswordKdfAlgoUnknown(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in SecurePasswordKdfAlgo", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static SecurePasswordKdfAlgo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + SecurePasswordKdfAlgo result = null; + switch (constructor) { + case 0xbbf2dda0: + result = new TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000(); + break; + case 0x86471d92: + result = new TL_securePasswordKdfAlgoSHA512(); + break; + case 0x4a8537: + result = new TL_securePasswordKdfAlgoUnknown(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in SecurePasswordKdfAlgo", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000 extends SecurePasswordKdfAlgo { - public static int constructor = 0xbbf2dda0; + public static class TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000 extends SecurePasswordKdfAlgo { + public static int constructor = 0xbbf2dda0; - public byte[] salt; + public byte[] salt; - public void readParams(AbstractSerializedData stream, boolean exception) { - salt = stream.readByteArray(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + salt = stream.readByteArray(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(salt); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeByteArray(salt); + } + } - public static class TL_securePasswordKdfAlgoSHA512 extends SecurePasswordKdfAlgo { - public static int constructor = 0x86471d92; + public static class TL_securePasswordKdfAlgoSHA512 extends SecurePasswordKdfAlgo { + public static int constructor = 0x86471d92; - public byte[] salt; + public byte[] salt; - public void readParams(AbstractSerializedData stream, boolean exception) { - salt = stream.readByteArray(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + salt = stream.readByteArray(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(salt); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeByteArray(salt); + } + } - public static class TL_securePasswordKdfAlgoUnknown extends SecurePasswordKdfAlgo { - public static int constructor = 0x4a8537; + public static class TL_securePasswordKdfAlgoUnknown extends SecurePasswordKdfAlgo { + public static int constructor = 0x4a8537; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_messages_historyImport extends TLObject { public static int constructor = 0x1662af0b; @@ -9136,124 +9053,124 @@ public class TLRPC { } } - public static abstract class BotInfo extends TLObject { - public long user_id; - public String description; - public ArrayList commands = new ArrayList<>(); - public int version; + public static abstract class BotInfo extends TLObject { + public long user_id; + public String description; + public ArrayList commands = new ArrayList<>(); + public int version; - public static BotInfo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - BotInfo result = null; - switch (constructor) { - case 0xbb2e37ce: - result = new TL_botInfoEmpty_layer48(); - break; - case 0x98e81d3a: - result = new TL_botInfo_layer131(); - break; - case 0x9cf585d: - result = new TL_botInfo_layer48(); - break; + public static BotInfo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + BotInfo result = null; + switch (constructor) { + case 0xbb2e37ce: + result = new TL_botInfoEmpty_layer48(); + break; + case 0x98e81d3a: + result = new TL_botInfo_layer131(); + break; + case 0x9cf585d: + result = new TL_botInfo_layer48(); + break; case 0x1b74b335: result = new TL_botInfo(); break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in BotInfo", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in BotInfo", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_botInfoEmpty_layer48 extends TL_botInfo { - public static int constructor = 0xbb2e37ce; + public static class TL_botInfoEmpty_layer48 extends TL_botInfo { + public static int constructor = 0xbb2e37ce; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_botInfo_layer131 extends TL_botInfo { - public static int constructor = 0x98e81d3a; + public static class TL_botInfo_layer131 extends TL_botInfo { + public static int constructor = 0x98e81d3a; - public void readParams(AbstractSerializedData stream, boolean exception) { - user_id = stream.readInt32(exception); - description = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_botCommand object = TL_botCommand.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - commands.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + user_id = stream.readInt32(exception); + description = stream.readString(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + TL_botCommand object = TL_botCommand.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + commands.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32((int) user_id); - stream.writeString(description); - stream.writeInt32(0x1cb5c415); - int count = commands.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - commands.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32((int) user_id); + stream.writeString(description); + stream.writeInt32(0x1cb5c415); + int count = commands.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + commands.get(a).serializeToStream(stream); + } + } + } - public static class TL_botInfo_layer48 extends TL_botInfo { - public static int constructor = 0x9cf585d; + public static class TL_botInfo_layer48 extends TL_botInfo { + public static int constructor = 0x9cf585d; - public void readParams(AbstractSerializedData stream, boolean exception) { - user_id = stream.readInt32(exception); - version = stream.readInt32(exception); - stream.readString(exception); - description = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_botCommand object = TL_botCommand.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - commands.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + user_id = stream.readInt32(exception); + version = stream.readInt32(exception); + stream.readString(exception); + description = stream.readString(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + TL_botCommand object = TL_botCommand.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + commands.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32((int) user_id); - stream.writeInt32(version); - stream.writeString(""); - stream.writeString(description); - stream.writeInt32(0x1cb5c415); - int count = commands.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - commands.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32((int) user_id); + stream.writeInt32(version); + stream.writeString(""); + stream.writeString(description); + stream.writeInt32(0x1cb5c415); + int count = commands.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + commands.get(a).serializeToStream(stream); + } + } + } public static class TL_botInfo extends BotInfo { public static int constructor = 0x1b74b335; @@ -9292,63 +9209,63 @@ public class TLRPC { } } - public static abstract class InputGame extends TLObject { - public InputUser bot_id; - public String short_name; - public long id; - public long access_hash; + public static abstract class InputGame extends TLObject { + public InputUser bot_id; + public String short_name; + public long id; + public long access_hash; - public static InputGame TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - InputGame result = null; - switch (constructor) { - case 0xc331e80a: - result = new TL_inputGameShortName(); - break; - case 0x32c3e77: - result = new TL_inputGameID(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in InputGame", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static InputGame TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + InputGame result = null; + switch (constructor) { + case 0xc331e80a: + result = new TL_inputGameShortName(); + break; + case 0x32c3e77: + result = new TL_inputGameID(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in InputGame", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_inputGameShortName extends InputGame { - public static int constructor = 0xc331e80a; + public static class TL_inputGameShortName extends InputGame { + public static int constructor = 0xc331e80a; - public void readParams(AbstractSerializedData stream, boolean exception) { - bot_id = InputUser.TLdeserialize(stream, stream.readInt32(exception), exception); - short_name = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + bot_id = InputUser.TLdeserialize(stream, stream.readInt32(exception), exception); + short_name = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - bot_id.serializeToStream(stream); - stream.writeString(short_name); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + bot_id.serializeToStream(stream); + stream.writeString(short_name); + } + } - public static class TL_inputGameID extends InputGame { - public static int constructor = 0x32c3e77; + public static class TL_inputGameID extends InputGame { + public static int constructor = 0x32c3e77; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + } + } public static abstract class MessageReplies extends TLObject { @@ -9928,178 +9845,178 @@ public class TLRPC { } } - public static abstract class contacts_Contacts extends TLObject { - public ArrayList contacts = new ArrayList<>(); - public int saved_count; - public ArrayList users = new ArrayList<>(); + public static abstract class contacts_Contacts extends TLObject { + public ArrayList contacts = new ArrayList<>(); + public int saved_count; + public ArrayList users = new ArrayList<>(); - public static contacts_Contacts TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - contacts_Contacts result = null; - switch (constructor) { - case 0xb74ba9d2: - result = new TL_contacts_contactsNotModified(); - break; - case 0xeae87e42: - result = new TL_contacts_contacts(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in contacts_Contacts", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static contacts_Contacts TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + contacts_Contacts result = null; + switch (constructor) { + case 0xb74ba9d2: + result = new TL_contacts_contactsNotModified(); + break; + case 0xeae87e42: + result = new TL_contacts_contacts(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in contacts_Contacts", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_contacts_contactsNotModified extends contacts_Contacts { - public static int constructor = 0xb74ba9d2; + public static class TL_contacts_contactsNotModified extends contacts_Contacts { + public static int constructor = 0xb74ba9d2; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_contacts_contacts extends contacts_Contacts { - public static int constructor = 0xeae87e42; + public static class TL_contacts_contacts extends contacts_Contacts { + public static int constructor = 0xeae87e42; - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_contact object = TL_contact.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - contacts.add(object); - } - saved_count = stream.readInt32(exception); - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + TL_contact object = TL_contact.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + contacts.add(object); + } + saved_count = stream.readInt32(exception); + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + users.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = contacts.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - contacts.get(a).serializeToStream(stream); - } - stream.writeInt32(saved_count); - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = contacts.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + contacts.get(a).serializeToStream(stream); + } + stream.writeInt32(saved_count); + stream.writeInt32(0x1cb5c415); + count = users.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + users.get(a).serializeToStream(stream); + } + } + } - public static abstract class SecureRequiredType extends TLObject { + public static abstract class SecureRequiredType extends TLObject { - public static SecureRequiredType TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - SecureRequiredType result = null; - switch (constructor) { - case 0x829d99da: - result = new TL_secureRequiredType(); - break; - case 0x27477b4: - result = new TL_secureRequiredTypeOneOf(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in SecureRequiredType", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static SecureRequiredType TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + SecureRequiredType result = null; + switch (constructor) { + case 0x829d99da: + result = new TL_secureRequiredType(); + break; + case 0x27477b4: + result = new TL_secureRequiredTypeOneOf(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in SecureRequiredType", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_secureRequiredType extends SecureRequiredType { - public static int constructor = 0x829d99da; + public static class TL_secureRequiredType extends SecureRequiredType { + public static int constructor = 0x829d99da; - public int flags; - public boolean native_names; - public boolean selfie_required; - public boolean translation_required; - public SecureValueType type; + public int flags; + public boolean native_names; + public boolean selfie_required; + public boolean translation_required; + public SecureValueType type; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - native_names = (flags & 1) != 0; - selfie_required = (flags & 2) != 0; - translation_required = (flags & 4) != 0; - type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + native_names = (flags & 1) != 0; + selfie_required = (flags & 2) != 0; + translation_required = (flags & 4) != 0; + type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = native_names ? (flags | 1) : (flags &~ 1); - flags = selfie_required ? (flags | 2) : (flags &~ 2); - flags = translation_required ? (flags | 4) : (flags &~ 4); - stream.writeInt32(flags); - type.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = native_names ? (flags | 1) : (flags &~ 1); + flags = selfie_required ? (flags | 2) : (flags &~ 2); + flags = translation_required ? (flags | 4) : (flags &~ 4); + stream.writeInt32(flags); + type.serializeToStream(stream); + } + } - public static class TL_secureRequiredTypeOneOf extends SecureRequiredType { - public static int constructor = 0x27477b4; + public static class TL_secureRequiredTypeOneOf extends SecureRequiredType { + public static int constructor = 0x27477b4; - public ArrayList types = new ArrayList<>(); + public ArrayList types = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - SecureRequiredType object = SecureRequiredType.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - types.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + SecureRequiredType object = SecureRequiredType.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + types.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = types.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - types.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = types.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + types.get(a).serializeToStream(stream); + } + } + } public static abstract class InputPrivacyKey extends TLObject { @@ -10366,137 +10283,137 @@ public class TLRPC { } } - public static abstract class photos_Photos extends TLObject { - public ArrayList photos = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); - public int count; + public static abstract class photos_Photos extends TLObject { + public ArrayList photos = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); + public int count; - public static photos_Photos TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - photos_Photos result = null; - switch (constructor) { - case 0x8dca6aa5: - result = new TL_photos_photos(); - break; - case 0x15051f54: - result = new TL_photos_photosSlice(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in photos_Photos", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static photos_Photos TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + photos_Photos result = null; + switch (constructor) { + case 0x8dca6aa5: + result = new TL_photos_photos(); + break; + case 0x15051f54: + result = new TL_photos_photosSlice(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in photos_Photos", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_photos_photos extends photos_Photos { - public static int constructor = 0x8dca6aa5; + public static class TL_photos_photos extends photos_Photos { + public static int constructor = 0x8dca6aa5; - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Photo object = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - photos.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = photos.size(); - stream.writeInt32(count); + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); for (int a = 0; a < count; a++) { - photos.get(a).serializeToStream(stream); + Photo object = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + photos.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + users.add(object); + } + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = photos.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + photos.get(a).serializeToStream(stream); } stream.writeInt32(0x1cb5c415); count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + users.get(a).serializeToStream(stream); + } + } + } - public static class TL_photos_photosSlice extends photos_Photos { - public static int constructor = 0x15051f54; + public static class TL_photos_photosSlice extends photos_Photos { + public static int constructor = 0x15051f54; - public void readParams(AbstractSerializedData stream, boolean exception) { - count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + public void readParams(AbstractSerializedData stream, boolean exception) { + count = stream.readInt32(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); } return; - } - int count = stream.readInt32(exception); + } + int count = stream.readInt32(exception); for (int a = 0; a < count; a++) { Photo object = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; + if (object == null) { + return; } photos.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + users.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = photos.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(count); + stream.writeInt32(0x1cb5c415); + int count = photos.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { photos.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); + } + stream.writeInt32(0x1cb5c415); count = users.size(); stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); + for (int a = 0; a < count; a++) { + users.get(a).serializeToStream(stream); } } } @@ -10548,18 +10465,23 @@ public class TLRPC { public String theme_emoticon; public int requests_pending; public Peer default_send_as; + public ArrayList available_reactions = new ArrayList<>(); + public long inviterId; //custom public int invitesCount; //custom public static ChatFull TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { ChatFull result = null; switch (constructor) { - case 0x46a6ffb4: + case 0xd18ee226: result = new TL_chatFull(); break; - case 0x56662e2e: + case 0xe13c3d20: result = new TL_channelFull(); break; + case 0x56662e2e: + result = new TL_channelFull_layer135(); + break; case 0x59cff963: result = new TL_channelFull_layer134(); break; @@ -10644,6 +10566,9 @@ public class TLRPC { case 0xedd2a791: result = new TL_chatFull_layer92(); break; + case 0x46a6ffb4: + result = new TL_chatFull_layer135(); + break; case 0xfab31aa3: result = new TL_channelFull_old(); break; @@ -11874,7 +11799,7 @@ public class TLRPC { } } - public static class TL_chatFull extends ChatFull { + public static class TL_chatFull_layer135 extends ChatFull { public static int constructor = 0x46a6ffb4; public void readParams(AbstractSerializedData stream, boolean exception) { @@ -11999,7 +11924,7 @@ public class TLRPC { } } - public static class TL_channelFull extends ChatFull { + public static class TL_channelFull_layer135 extends ChatFull { public static int constructor = 0x56662e2e; public void readParams(AbstractSerializedData stream, boolean exception) { @@ -12699,6 +12624,419 @@ public class TLRPC { } } + public static class TL_chatFull extends ChatFull { + public static int constructor = 0xd18ee226; + + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + can_set_username = (flags & 128) != 0; + has_scheduled = (flags & 256) != 0; + id = stream.readInt64(exception); + about = stream.readString(exception); + participants = ChatParticipants.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 4) != 0) { + chat_photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + } + notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 8192) != 0) { + exported_invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 8) != 0) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + bot_info.add(object); + } + } + if ((flags & 64) != 0) { + pinned_msg_id = stream.readInt32(exception); + } + if ((flags & 2048) != 0) { + folder_id = stream.readInt32(exception); + } + if ((flags & 4096) != 0) { + call = TL_inputGroupCall.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 16384) != 0) { + ttl_period = stream.readInt32(exception); + } + if ((flags & 32768) != 0) { + groupcall_default_join_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 65536) != 0) { + theme_emoticon = stream.readString(exception); + } + if ((flags & 131072) != 0) { + requests_pending = stream.readInt32(exception); + } + if ((flags & 131072) != 0) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + recent_requesters.add(stream.readInt64(exception)); + } + } + if ((flags & 262144) != 0) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + available_reactions.add(stream.readString(exception)); + } + } + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = can_set_username ? (flags | 128) : (flags &~ 128); + flags = has_scheduled ? (flags | 256) : (flags &~ 256); + stream.writeInt32(flags); + stream.writeInt64(id); + stream.writeString(about); + participants.serializeToStream(stream); + if ((flags & 4) != 0) { + chat_photo.serializeToStream(stream); + } + notify_settings.serializeToStream(stream); + if ((flags & 8192) != 0) { + exported_invite.serializeToStream(stream); + } + if ((flags & 8) != 0) { + stream.writeInt32(0x1cb5c415); + int count = bot_info.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + bot_info.get(a).serializeToStream(stream); + } + } + if ((flags & 64) != 0) { + stream.writeInt32(pinned_msg_id); + } + if ((flags & 2048) != 0) { + stream.writeInt32(folder_id); + } + if ((flags & 4096) != 0) { + call.serializeToStream(stream); + } + if ((flags & 16384) != 0) { + stream.writeInt32(ttl_period); + } + if ((flags & 32768) != 0) { + groupcall_default_join_as.serializeToStream(stream); + } + if ((flags & 65536) != 0) { + stream.writeString(theme_emoticon); + } + if ((flags & 131072) != 0) { + stream.writeInt32(requests_pending); + } + if ((flags & 131072) != 0) { + stream.writeInt32(0x1cb5c415); + int count = recent_requesters.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeInt64(recent_requesters.get(a)); + } + } + if ((flags & 262144) != 0) { + stream.writeInt32(0x1cb5c415); + int count = available_reactions.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeString(available_reactions.get(a)); + } + } + } + } + + public static class TL_channelFull extends ChatFull { + public static int constructor = 0xe13c3d20; + + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + can_view_participants = (flags & 8) != 0; + can_set_username = (flags & 64) != 0; + can_set_stickers = (flags & 128) != 0; + hidden_prehistory = (flags & 1024) != 0; + can_set_location = (flags & 65536) != 0; + has_scheduled = (flags & 524288) != 0; + can_view_stats = (flags & 1048576) != 0; + blocked = (flags & 4194304) != 0; + id = stream.readInt64(exception); + about = stream.readString(exception); + if ((flags & 1) != 0) { + participants_count = stream.readInt32(exception); + } + if ((flags & 2) != 0) { + admins_count = stream.readInt32(exception); + } + if ((flags & 4) != 0) { + kicked_count = stream.readInt32(exception); + } + if ((flags & 4) != 0) { + banned_count = stream.readInt32(exception); + } + if ((flags & 8192) != 0) { + online_count = stream.readInt32(exception); + } + read_inbox_max_id = stream.readInt32(exception); + read_outbox_max_id = stream.readInt32(exception); + unread_count = stream.readInt32(exception); + chat_photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 8388608) != 0) { + exported_invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); + } + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + bot_info.add(object); + } + if ((flags & 16) != 0) { + migrated_from_chat_id = stream.readInt64(exception); + } + if ((flags & 16) != 0) { + migrated_from_max_id = stream.readInt32(exception); + } + if ((flags & 32) != 0) { + pinned_msg_id = stream.readInt32(exception); + } + if ((flags & 256) != 0) { + stickerset = StickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 512) != 0) { + available_min_id = stream.readInt32(exception); + } + if ((flags & 2048) != 0) { + folder_id = stream.readInt32(exception); + } + if ((flags & 16384) != 0) { + linked_chat_id = stream.readInt64(exception); + } + if ((flags & 32768) != 0) { + location = ChannelLocation.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 131072) != 0) { + slowmode_seconds = stream.readInt32(exception); + } + if ((flags & 262144) != 0) { + slowmode_next_send_date = stream.readInt32(exception); + } + if ((flags & 4096) != 0) { + stats_dc = stream.readInt32(exception); + } + pts = stream.readInt32(exception); + if ((flags & 2097152) != 0) { + call = TL_inputGroupCall.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 16777216) != 0) { + ttl_period = stream.readInt32(exception); + } + if ((flags & 33554432) != 0) { + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + pending_suggestions.add(stream.readString(exception)); + } + } + if ((flags & 67108864) != 0) { + groupcall_default_join_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 134217728) != 0) { + theme_emoticon = stream.readString(exception); + } + if ((flags & 268435456) != 0) { + requests_pending = stream.readInt32(exception); + } + if ((flags & 268435456) != 0) { + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + recent_requesters.add(stream.readInt64(exception)); + } + } + if ((flags & 536870912) != 0) { + default_send_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 1073741824) != 0) { + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + available_reactions.add(stream.readString(exception)); + } + } + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = can_view_participants ? (flags | 8) : (flags &~ 8); + flags = can_set_username ? (flags | 64) : (flags &~ 64); + flags = can_set_stickers ? (flags | 128) : (flags &~ 128); + flags = hidden_prehistory ? (flags | 1024) : (flags &~ 1024); + flags = can_set_location ? (flags | 65536) : (flags &~ 65536); + flags = has_scheduled ? (flags | 524288) : (flags &~ 524288); + flags = can_view_stats ? (flags | 1048576) : (flags &~ 1048576); + flags = blocked ? (flags | 4194304) : (flags &~ 4194304); + stream.writeInt32(flags); + stream.writeInt64(id); + stream.writeString(about); + if ((flags & 1) != 0) { + stream.writeInt32(participants_count); + } + if ((flags & 2) != 0) { + stream.writeInt32(admins_count); + } + if ((flags & 4) != 0) { + stream.writeInt32(kicked_count); + } + if ((flags & 4) != 0) { + stream.writeInt32(banned_count); + } + if ((flags & 8192) != 0) { + stream.writeInt32(online_count); + } + stream.writeInt32(read_inbox_max_id); + stream.writeInt32(read_outbox_max_id); + stream.writeInt32(unread_count); + chat_photo.serializeToStream(stream); + notify_settings.serializeToStream(stream); + if ((flags & 8388608) != 0) { + exported_invite.serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + int count = bot_info.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + bot_info.get(a).serializeToStream(stream); + } + if ((flags & 16) != 0) { + stream.writeInt64(migrated_from_chat_id); + } + if ((flags & 16) != 0) { + stream.writeInt32(migrated_from_max_id); + } + if ((flags & 32) != 0) { + stream.writeInt32(pinned_msg_id); + } + if ((flags & 256) != 0) { + stickerset.serializeToStream(stream); + } + if ((flags & 512) != 0) { + stream.writeInt32(available_min_id); + } + if ((flags & 2048) != 0) { + stream.writeInt32(folder_id); + } + if ((flags & 16384) != 0) { + stream.writeInt64(linked_chat_id); + } + if ((flags & 32768) != 0) { + location.serializeToStream(stream); + } + if ((flags & 131072) != 0) { + stream.writeInt32(slowmode_seconds); + } + if ((flags & 262144) != 0) { + stream.writeInt32(slowmode_next_send_date); + } + if ((flags & 4096) != 0) { + stream.writeInt32(stats_dc); + } + stream.writeInt32(pts); + if ((flags & 2097152) != 0) { + call.serializeToStream(stream); + } + if ((flags & 16777216) != 0) { + stream.writeInt32(ttl_period); + } + if ((flags & 33554432) != 0) { + stream.writeInt32(0x1cb5c415); + count = pending_suggestions.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeString(pending_suggestions.get(a)); + } + } + if ((flags & 67108864) != 0) { + groupcall_default_join_as.serializeToStream(stream); + } + if ((flags & 134217728) != 0) { + stream.writeString(theme_emoticon); + } + if ((flags & 268435456) != 0) { + stream.writeInt32(requests_pending); + } + if ((flags & 268435456) != 0) { + stream.writeInt32(0x1cb5c415); + count = recent_requesters.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeInt64(recent_requesters.get(a)); + } + } + if ((flags & 536870912) != 0) { + default_send_as.serializeToStream(stream); + } + if ((flags & 1073741824) != 0) { + stream.writeInt32(0x1cb5c415); + count = available_reactions.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeString(available_reactions.get(a)); + } + } + } + } + public static class TL_channelFull_layer131 extends TL_channelFull { public static int constructor = 0x548c3f93; @@ -14894,61 +15232,61 @@ public class TLRPC { } } - public static class TL_inputPeerNotifySettings extends TLObject { - public static int constructor = 0x9c3d198e; + public static class TL_inputPeerNotifySettings extends TLObject { + public static int constructor = 0x9c3d198e; - public int flags; - public boolean show_previews; - public boolean silent; - public int mute_until; - public String sound; + public int flags; + public boolean show_previews; + public boolean silent; + public int mute_until; + public String sound; - public static TL_inputPeerNotifySettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_inputPeerNotifySettings.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_inputPeerNotifySettings", constructor)); - } else { - return null; - } - } - TL_inputPeerNotifySettings result = new TL_inputPeerNotifySettings(); - result.readParams(stream, exception); - return result; - } + public static TL_inputPeerNotifySettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_inputPeerNotifySettings.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_inputPeerNotifySettings", constructor)); + } else { + return null; + } + } + TL_inputPeerNotifySettings result = new TL_inputPeerNotifySettings(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - if ((flags & 1) != 0) { - show_previews = stream.readBool(exception); - } - if ((flags & 2) != 0) { - silent = stream.readBool(exception); - } - if ((flags & 4) != 0) { - mute_until = stream.readInt32(exception); - } - if ((flags & 8) != 0) { - sound = stream.readString(exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + if ((flags & 1) != 0) { + show_previews = stream.readBool(exception); + } + if ((flags & 2) != 0) { + silent = stream.readBool(exception); + } + if ((flags & 4) != 0) { + mute_until = stream.readInt32(exception); + } + if ((flags & 8) != 0) { + sound = stream.readString(exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - stream.writeBool(show_previews); - } - if ((flags & 2) != 0) { - stream.writeBool(silent); - } - if ((flags & 4) != 0) { - stream.writeInt32(mute_until); - } - if ((flags & 8) != 0) { - stream.writeString(sound); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + stream.writeBool(show_previews); + } + if ((flags & 2) != 0) { + stream.writeBool(silent); + } + if ((flags & 4) != 0) { + stream.writeInt32(mute_until); + } + if ((flags & 8) != 0) { + stream.writeString(sound); + } + } + } public static abstract class auth_LoginToken extends TLObject { @@ -15192,27 +15530,27 @@ public class TLRPC { } } - public static class TL_null extends TLObject { - public static int constructor = 0x56730bcc; + public static class TL_null extends TLObject { + public static int constructor = 0x56730bcc; - public static TL_null TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_null.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_null", constructor)); - } else { - return null; - } - } - TL_null result = new TL_null(); - result.readParams(stream, exception); - return result; + public static TL_null TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_null.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_null", constructor)); + } else { + return null; + } + } + TL_null result = new TL_null(); + result.readParams(stream, exception); + return result; } public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + stream.writeInt32(constructor); + } + } public static abstract class Page extends TLObject { @@ -15732,58 +16070,58 @@ public class TLRPC { } } - public static class TL_topPeerCategoryPeers extends TLObject { - public static int constructor = 0xfb834291; + public static class TL_topPeerCategoryPeers extends TLObject { + public static int constructor = 0xfb834291; - public TopPeerCategory category; - public int count; - public ArrayList peers = new ArrayList<>(); + public TopPeerCategory category; + public int count; + public ArrayList peers = new ArrayList<>(); - public static TL_topPeerCategoryPeers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_topPeerCategoryPeers.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_topPeerCategoryPeers", constructor)); - } else { - return null; - } - } - TL_topPeerCategoryPeers result = new TL_topPeerCategoryPeers(); - result.readParams(stream, exception); - return result; - } + public static TL_topPeerCategoryPeers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_topPeerCategoryPeers.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_topPeerCategoryPeers", constructor)); + } else { + return null; + } + } + TL_topPeerCategoryPeers result = new TL_topPeerCategoryPeers(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - category = TopPeerCategory.TLdeserialize(stream, stream.readInt32(exception), exception); - count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_topPeer object = TL_topPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - peers.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + category = TopPeerCategory.TLdeserialize(stream, stream.readInt32(exception), exception); + count = stream.readInt32(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + TL_topPeer object = TL_topPeer.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + peers.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - category.serializeToStream(stream); - stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - peers.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + category.serializeToStream(stream); + stream.writeInt32(count); + stream.writeInt32(0x1cb5c415); + int count = peers.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + peers.get(a).serializeToStream(stream); + } + } + } public static abstract class InputUser extends TLObject { @@ -15870,14 +16208,14 @@ public class TLRPC { } } - public static abstract class KeyboardButton extends TLObject { - public String text; - public String url; - public int flags; - public boolean same_peer; - public String query; - public byte[] data; - public int button_id; + public static abstract class KeyboardButton extends TLObject { + public String text; + public String url; + public int flags; + public boolean same_peer; + public String query; + public byte[] data; + public int button_id; public boolean request_write_access; public InputUser bot; public String fwd_text; @@ -15889,48 +16227,48 @@ public class TLRPC { public static KeyboardButton TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { KeyboardButton result = null; switch (constructor) { - case 0xd02e7fd4: - result = new TL_inputKeyboardButtonUrlAuth(); - break; - case 0xa2fa4880: - result = new TL_keyboardButton(); - break; - case 0xfc796b3f: - result = new TL_keyboardButtonRequestGeoLocation(); - break; - case 0x258aff05: - result = new TL_keyboardButtonUrl(); + case 0xb16a6c29: + result = new TL_keyboardButtonRequestPhone(); break; case 0x50f41ccf: result = new TL_keyboardButtonGame(); break; - case 0x683a5e46: - result = new TL_keyboardButtonCallback_layer117(); + case 0x258aff05: + result = new TL_keyboardButtonUrl(); break; case 0x568a748: result = new TL_keyboardButtonSwitchInline(); break; - case 0xb16a6c29: - result = new TL_keyboardButtonRequestPhone(); + case 0xfc796b3f: + result = new TL_keyboardButtonRequestGeoLocation(); break; case 0x10b78d29: result = new TL_keyboardButtonUrlAuth(); break; + case 0xd02e7fd4: + result = new TL_inputKeyboardButtonUrlAuth(); + break; case 0xbbc7515d: result = new TL_keyboardButtonRequestPoll(); break; case 0xafd93fbb: result = new TL_keyboardButtonBuy(); break; + case 0x683a5e46: + result = new TL_keyboardButtonCallback_layer117(); + break; + case 0xa2fa4880: + result = new TL_keyboardButton(); + break; + case 0x35bbdb6b: + result = new TL_keyboardButtonCallback(); + break; case 0xe988037b: result = new TL_inputKeyboardButtonUserProfile(); break; case 0x308660c1: result = new TL_keyboardButtonUserProfile(); break; - case 0x35bbdb6b: - result = new TL_keyboardButtonCallback(); - break; } if (result == null && exception) { throw new RuntimeException(String.format("can't parse magic %x in KeyboardButton", constructor)); @@ -15942,83 +16280,83 @@ public class TLRPC { } } - public static class TL_keyboardButtonRequestPhone extends KeyboardButton { - public static int constructor = 0xb16a6c29; + public static class TL_keyboardButtonRequestPhone extends KeyboardButton { + public static int constructor = 0xb16a6c29; - public void readParams(AbstractSerializedData stream, boolean exception) { - text = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(text); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(text); + } + } - public static class TL_keyboardButtonGame extends KeyboardButton { - public static int constructor = 0x50f41ccf; + public static class TL_keyboardButtonGame extends KeyboardButton { + public static int constructor = 0x50f41ccf; - public void readParams(AbstractSerializedData stream, boolean exception) { - text = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(text); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(text); + } + } - public static class TL_keyboardButtonUrl extends KeyboardButton { - public static int constructor = 0x258aff05; + public static class TL_keyboardButtonUrl extends KeyboardButton { + public static int constructor = 0x258aff05; - public void readParams(AbstractSerializedData stream, boolean exception) { - text = stream.readString(exception); - url = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = stream.readString(exception); + url = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(text); - stream.writeString(url); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(text); + stream.writeString(url); + } + } - public static class TL_keyboardButtonSwitchInline extends KeyboardButton { - public static int constructor = 0x568a748; + public static class TL_keyboardButtonSwitchInline extends KeyboardButton { + public static int constructor = 0x568a748; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - same_peer = (flags & 1) != 0; - text = stream.readString(exception); - query = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + same_peer = (flags & 1) != 0; + text = stream.readString(exception); + query = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = same_peer ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeString(text); - stream.writeString(query); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = same_peer ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + stream.writeString(text); + stream.writeString(query); + } + } - public static class TL_keyboardButtonRequestGeoLocation extends KeyboardButton { - public static int constructor = 0xfc796b3f; + public static class TL_keyboardButtonRequestGeoLocation extends KeyboardButton { + public static int constructor = 0xfc796b3f; - public void readParams(AbstractSerializedData stream, boolean exception) { - text = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(text); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(text); + } + } public static class TL_keyboardButtonUrlAuth extends KeyboardButton { public static int constructor = 0x10b78d29; @@ -16096,6 +16434,20 @@ public class TLRPC { } } + public static class TL_keyboardButtonBuy extends KeyboardButton { + public static int constructor = 0xafd93fbb; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + text = stream.readString(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(text); + } + } + public static class TL_inputKeyboardButtonUserProfile extends KeyboardButton { public static int constructor = 0xe988037b; @@ -16126,20 +16478,6 @@ public class TLRPC { } } - public static class TL_keyboardButtonBuy extends KeyboardButton { - public static int constructor = 0xafd93fbb; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - text = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(text); - } - } - public static class TL_keyboardButtonCallback extends KeyboardButton { public static int constructor = 0x35bbdb6b; @@ -16160,35 +16498,35 @@ public class TLRPC { } } - public static class TL_keyboardButtonCallback_layer117 extends TL_keyboardButtonCallback { - public static int constructor = 0x683a5e46; + public static class TL_keyboardButtonCallback_layer117 extends TL_keyboardButtonCallback { + public static int constructor = 0x683a5e46; - public void readParams(AbstractSerializedData stream, boolean exception) { - text = stream.readString(exception); - data = stream.readByteArray(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = stream.readString(exception); + data = stream.readByteArray(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(text); - stream.writeByteArray(data); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(text); + stream.writeByteArray(data); + } + } - public static class TL_keyboardButton extends KeyboardButton { - public static int constructor = 0xa2fa4880; + public static class TL_keyboardButton extends KeyboardButton { + public static int constructor = 0xa2fa4880; - public void readParams(AbstractSerializedData stream, boolean exception) { - text = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(text); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(text); + } + } public static abstract class VideoSize extends TLObject { @@ -16746,92 +17084,92 @@ public class TLRPC { } } - public static class TL_keyboardButtonRow extends TLObject { - public static int constructor = 0x77608b83; + public static class TL_keyboardButtonRow extends TLObject { + public static int constructor = 0x77608b83; - public ArrayList buttons = new ArrayList<>(); + public ArrayList buttons = new ArrayList<>(); - public static TL_keyboardButtonRow TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_keyboardButtonRow.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_keyboardButtonRow", constructor)); - } else { - return null; - } - } - TL_keyboardButtonRow result = new TL_keyboardButtonRow(); - result.readParams(stream, exception); - return result; - } + public static TL_keyboardButtonRow TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_keyboardButtonRow.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_keyboardButtonRow", constructor)); + } else { + return null; + } + } + TL_keyboardButtonRow result = new TL_keyboardButtonRow(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - KeyboardButton object = KeyboardButton.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - buttons.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + KeyboardButton object = KeyboardButton.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + buttons.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = buttons.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - buttons.get(a).serializeToStream(stream); - } - } - } + stream.writeInt32(0x1cb5c415); + int count = buttons.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + buttons.get(a).serializeToStream(stream); + } + } + } - public static abstract class Bool extends TLObject { + public static abstract class Bool extends TLObject { - public static Bool TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - Bool result = null; - switch (constructor) { - case 0x997275b5: - result = new TL_boolTrue(); + public static Bool TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + Bool result = null; + switch (constructor) { + case 0x997275b5: + result = new TL_boolTrue(); break; case 0xbc799737: - result = new TL_boolFalse(); + result = new TL_boolFalse(); break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in Bool", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in Bool", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_boolTrue extends Bool { - public static int constructor = 0x997275b5; + public static class TL_boolTrue extends Bool { + public static int constructor = 0x997275b5; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_boolFalse extends Bool { - public static int constructor = 0xbc799737; + public static class TL_boolFalse extends Bool { + public static int constructor = 0xbc799737; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_messages_discussionMessage extends TLObject { public static int constructor = 0xa6341782; @@ -17056,71 +17394,71 @@ public class TLRPC { } } - public static abstract class WebPage extends TLObject { - public int flags; - public long id; - public String url; - public String display_url; - public int hash; - public String type; - public String site_name; - public String title; - public String description; - public Photo photo; - public String embed_url; - public String embed_type; - public int embed_width; - public int embed_height; - public int duration; - public String author; - public Document document; - public Page cached_page; - public int date; + public static abstract class WebPage extends TLObject { + public int flags; + public long id; + public String url; + public String display_url; + public int hash; + public String type; + public String site_name; + public String title; + public String description; + public Photo photo; + public String embed_url; + public String embed_type; + public int embed_width; + public int embed_height; + public int duration; + public String author; + public Document document; + public Page cached_page; + public int date; public ArrayList attributes = new ArrayList<>(); - public static WebPage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - WebPage result = null; - switch (constructor) { + public static WebPage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + WebPage result = null; + switch (constructor) { case 0xe89c45b2: result = new TL_webPage(); break; case 0xfa64e172: result = new TL_webPage_layer107(); break; - case 0x5f07b4bc: - result = new TL_webPage_layer104(); - break; - case 0xa31ea0b5: - result = new TL_webPage_old(); - break; - case 0xeb1477e8: - result = new TL_webPageEmpty(); - break; - case 0xd41a5167: - result = new TL_webPageUrlPending(); - break; + case 0x5f07b4bc: + result = new TL_webPage_layer104(); + break; + case 0xa31ea0b5: + result = new TL_webPage_old(); + break; + case 0xeb1477e8: + result = new TL_webPageEmpty(); + break; + case 0xd41a5167: + result = new TL_webPageUrlPending(); + break; case 0x7311ca11: result = new TL_webPageNotModified(); break; - case 0xc586da1c: - result = new TL_webPagePending(); - break; - case 0x85849473: - result = new TL_webPageNotModified_layer110(); - break; - case 0xca820ed7: - result = new TL_webPage_layer58(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in WebPage", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + case 0xc586da1c: + result = new TL_webPagePending(); + break; + case 0x85849473: + result = new TL_webPageNotModified_layer110(); + break; + case 0xca820ed7: + result = new TL_webPage_layer58(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in WebPage", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } public static class TL_webPage extends WebPage { public static int constructor = 0xe89c45b2; @@ -17370,244 +17708,244 @@ public class TLRPC { } } - public static class TL_webPage_layer104 extends TL_webPage { - public static int constructor = 0x5f07b4bc; + public static class TL_webPage_layer104 extends TL_webPage { + public static int constructor = 0x5f07b4bc; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - id = stream.readInt64(exception); - url = stream.readString(exception); - display_url = stream.readString(exception); - hash = stream.readInt32(exception); - if ((flags & 1) != 0) { - type = stream.readString(exception); - } - if ((flags & 2) != 0) { - site_name = stream.readString(exception); - } - if ((flags & 4) != 0) { - title = stream.readString(exception); - } - if ((flags & 8) != 0) { - description = stream.readString(exception); - } - if ((flags & 16) != 0) { - photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 32) != 0) { - embed_url = stream.readString(exception); - } - if ((flags & 32) != 0) { - embed_type = stream.readString(exception); - } - if ((flags & 64) != 0) { - embed_width = stream.readInt32(exception); - } - if ((flags & 64) != 0) { - embed_height = stream.readInt32(exception); - } - if ((flags & 128) != 0) { - duration = stream.readInt32(exception); - } - if ((flags & 256) != 0) { - author = stream.readString(exception); - } - if ((flags & 512) != 0) { - document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 1024) != 0) { - cached_page = Page.TLdeserialize(stream, stream.readInt32(exception), exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + id = stream.readInt64(exception); + url = stream.readString(exception); + display_url = stream.readString(exception); + hash = stream.readInt32(exception); + if ((flags & 1) != 0) { + type = stream.readString(exception); + } + if ((flags & 2) != 0) { + site_name = stream.readString(exception); + } + if ((flags & 4) != 0) { + title = stream.readString(exception); + } + if ((flags & 8) != 0) { + description = stream.readString(exception); + } + if ((flags & 16) != 0) { + photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 32) != 0) { + embed_url = stream.readString(exception); + } + if ((flags & 32) != 0) { + embed_type = stream.readString(exception); + } + if ((flags & 64) != 0) { + embed_width = stream.readInt32(exception); + } + if ((flags & 64) != 0) { + embed_height = stream.readInt32(exception); + } + if ((flags & 128) != 0) { + duration = stream.readInt32(exception); + } + if ((flags & 256) != 0) { + author = stream.readString(exception); + } + if ((flags & 512) != 0) { + document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 1024) != 0) { + cached_page = Page.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeInt64(id); - stream.writeString(url); - stream.writeString(display_url); - stream.writeInt32(hash); - if ((flags & 1) != 0) { - stream.writeString(type); - } - if ((flags & 2) != 0) { - stream.writeString(site_name); - } - if ((flags & 4) != 0) { - stream.writeString(title); - } - if ((flags & 8) != 0) { - stream.writeString(description); - } - if ((flags & 16) != 0) { - photo.serializeToStream(stream); - } - if ((flags & 32) != 0) { - stream.writeString(embed_url); - } - if ((flags & 32) != 0) { - stream.writeString(embed_type); - } - if ((flags & 64) != 0) { - stream.writeInt32(embed_width); - } - if ((flags & 64) != 0) { - stream.writeInt32(embed_height); - } - if ((flags & 128) != 0) { - stream.writeInt32(duration); - } - if ((flags & 256) != 0) { - stream.writeString(author); - } - if ((flags & 512) != 0) { - document.serializeToStream(stream); - } - if ((flags & 1024) != 0) { - cached_page.serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeInt64(id); + stream.writeString(url); + stream.writeString(display_url); + stream.writeInt32(hash); + if ((flags & 1) != 0) { + stream.writeString(type); + } + if ((flags & 2) != 0) { + stream.writeString(site_name); + } + if ((flags & 4) != 0) { + stream.writeString(title); + } + if ((flags & 8) != 0) { + stream.writeString(description); + } + if ((flags & 16) != 0) { + photo.serializeToStream(stream); + } + if ((flags & 32) != 0) { + stream.writeString(embed_url); + } + if ((flags & 32) != 0) { + stream.writeString(embed_type); + } + if ((flags & 64) != 0) { + stream.writeInt32(embed_width); + } + if ((flags & 64) != 0) { + stream.writeInt32(embed_height); + } + if ((flags & 128) != 0) { + stream.writeInt32(duration); + } + if ((flags & 256) != 0) { + stream.writeString(author); + } + if ((flags & 512) != 0) { + document.serializeToStream(stream); + } + if ((flags & 1024) != 0) { + cached_page.serializeToStream(stream); + } + } + } - public static class TL_webPage_old extends TL_webPage { - public static int constructor = 0xa31ea0b5; + public static class TL_webPage_old extends TL_webPage { + public static int constructor = 0xa31ea0b5; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - id = stream.readInt64(exception); - url = stream.readString(exception); - display_url = stream.readString(exception); - if ((flags & 1) != 0) { - type = stream.readString(exception); - } - if ((flags & 2) != 0) { - site_name = stream.readString(exception); - } - if ((flags & 4) != 0) { - title = stream.readString(exception); - } - if ((flags & 8) != 0) { - description = stream.readString(exception); - } - if ((flags & 16) != 0) { - photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 32) != 0) { - embed_url = stream.readString(exception); - } - if ((flags & 32) != 0) { - embed_type = stream.readString(exception); - } - if ((flags & 64) != 0) { - embed_width = stream.readInt32(exception); - } - if ((flags & 64) != 0) { - embed_height = stream.readInt32(exception); - } - if ((flags & 128) != 0) { - duration = stream.readInt32(exception); - } - if ((flags & 256) != 0) { - author = stream.readString(exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + id = stream.readInt64(exception); + url = stream.readString(exception); + display_url = stream.readString(exception); + if ((flags & 1) != 0) { + type = stream.readString(exception); + } + if ((flags & 2) != 0) { + site_name = stream.readString(exception); + } + if ((flags & 4) != 0) { + title = stream.readString(exception); + } + if ((flags & 8) != 0) { + description = stream.readString(exception); + } + if ((flags & 16) != 0) { + photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 32) != 0) { + embed_url = stream.readString(exception); + } + if ((flags & 32) != 0) { + embed_type = stream.readString(exception); + } + if ((flags & 64) != 0) { + embed_width = stream.readInt32(exception); + } + if ((flags & 64) != 0) { + embed_height = stream.readInt32(exception); + } + if ((flags & 128) != 0) { + duration = stream.readInt32(exception); + } + if ((flags & 256) != 0) { + author = stream.readString(exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeInt64(id); - stream.writeString(url); - stream.writeString(display_url); - if ((flags & 1) != 0) { - stream.writeString(type); - } - if ((flags & 2) != 0) { - stream.writeString(site_name); - } - if ((flags & 4) != 0) { - stream.writeString(title); - } - if ((flags & 8) != 0) { - stream.writeString(description); - } - if ((flags & 16) != 0) { - photo.serializeToStream(stream); - } - if ((flags & 32) != 0) { - stream.writeString(embed_url); - } - if ((flags & 32) != 0) { - stream.writeString(embed_type); - } - if ((flags & 64) != 0) { - stream.writeInt32(embed_width); - } - if ((flags & 64) != 0) { - stream.writeInt32(embed_height); - } - if ((flags & 128) != 0) { - stream.writeInt32(duration); - } - if ((flags & 256) != 0) { - stream.writeString(author); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeInt64(id); + stream.writeString(url); + stream.writeString(display_url); + if ((flags & 1) != 0) { + stream.writeString(type); + } + if ((flags & 2) != 0) { + stream.writeString(site_name); + } + if ((flags & 4) != 0) { + stream.writeString(title); + } + if ((flags & 8) != 0) { + stream.writeString(description); + } + if ((flags & 16) != 0) { + photo.serializeToStream(stream); + } + if ((flags & 32) != 0) { + stream.writeString(embed_url); + } + if ((flags & 32) != 0) { + stream.writeString(embed_type); + } + if ((flags & 64) != 0) { + stream.writeInt32(embed_width); + } + if ((flags & 64) != 0) { + stream.writeInt32(embed_height); + } + if ((flags & 128) != 0) { + stream.writeInt32(duration); + } + if ((flags & 256) != 0) { + stream.writeString(author); + } + } + } - public static class TL_webPageEmpty extends WebPage { - public static int constructor = 0xeb1477e8; + public static class TL_webPageEmpty extends WebPage { + public static int constructor = 0xeb1477e8; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + } + } - public static class TL_webPageUrlPending extends WebPage { - public static int constructor = 0xd41a5167; + public static class TL_webPageUrlPending extends WebPage { + public static int constructor = 0xd41a5167; - public void readParams(AbstractSerializedData stream, boolean exception) { - url = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + url = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(url); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(url); + } + } - public static class TL_webPagePending extends WebPage { - public static int constructor = 0xc586da1c; + public static class TL_webPagePending extends WebPage { + public static int constructor = 0xc586da1c; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - date = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + date = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt32(date); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt32(date); + } + } - public static class TL_webPageNotModified_layer110 extends TL_webPageNotModified { - public static int constructor = 0x85849473; + public static class TL_webPageNotModified_layer110 extends TL_webPageNotModified { + public static int constructor = 0x85849473; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_webPageNotModified extends WebPage { public static int constructor = 0x7311ca11; @@ -17630,97 +17968,97 @@ public class TLRPC { } } - public static class TL_webPage_layer58 extends TL_webPage { - public static int constructor = 0xca820ed7; + public static class TL_webPage_layer58 extends TL_webPage { + public static int constructor = 0xca820ed7; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - id = stream.readInt64(exception); - url = stream.readString(exception); - display_url = stream.readString(exception); - if ((flags & 1) != 0) { - type = stream.readString(exception); - } - if ((flags & 2) != 0) { - site_name = stream.readString(exception); - } - if ((flags & 4) != 0) { - title = stream.readString(exception); - } - if ((flags & 8) != 0) { - description = stream.readString(exception); - } - if ((flags & 16) != 0) { - photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 32) != 0) { - embed_url = stream.readString(exception); - } - if ((flags & 32) != 0) { - embed_type = stream.readString(exception); - } - if ((flags & 64) != 0) { - embed_width = stream.readInt32(exception); - } - if ((flags & 64) != 0) { - embed_height = stream.readInt32(exception); - } - if ((flags & 128) != 0) { - duration = stream.readInt32(exception); - } - if ((flags & 256) != 0) { - author = stream.readString(exception); - } - if ((flags & 512) != 0) { - document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + id = stream.readInt64(exception); + url = stream.readString(exception); + display_url = stream.readString(exception); + if ((flags & 1) != 0) { + type = stream.readString(exception); + } + if ((flags & 2) != 0) { + site_name = stream.readString(exception); + } + if ((flags & 4) != 0) { + title = stream.readString(exception); + } + if ((flags & 8) != 0) { + description = stream.readString(exception); + } + if ((flags & 16) != 0) { + photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 32) != 0) { + embed_url = stream.readString(exception); + } + if ((flags & 32) != 0) { + embed_type = stream.readString(exception); + } + if ((flags & 64) != 0) { + embed_width = stream.readInt32(exception); + } + if ((flags & 64) != 0) { + embed_height = stream.readInt32(exception); + } + if ((flags & 128) != 0) { + duration = stream.readInt32(exception); + } + if ((flags & 256) != 0) { + author = stream.readString(exception); + } + if ((flags & 512) != 0) { + document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeInt64(id); - stream.writeString(url); - stream.writeString(display_url); - if ((flags & 1) != 0) { - stream.writeString(type); - } - if ((flags & 2) != 0) { - stream.writeString(site_name); - } - if ((flags & 4) != 0) { - stream.writeString(title); - } - if ((flags & 8) != 0) { - stream.writeString(description); - } - if ((flags & 16) != 0) { - photo.serializeToStream(stream); - } - if ((flags & 32) != 0) { - stream.writeString(embed_url); - } - if ((flags & 32) != 0) { - stream.writeString(embed_type); - } - if ((flags & 64) != 0) { - stream.writeInt32(embed_width); - } - if ((flags & 64) != 0) { - stream.writeInt32(embed_height); - } - if ((flags & 128) != 0) { - stream.writeInt32(duration); - } - if ((flags & 256) != 0) { - stream.writeString(author); - } - if ((flags & 512) != 0) { - document.serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeInt64(id); + stream.writeString(url); + stream.writeString(display_url); + if ((flags & 1) != 0) { + stream.writeString(type); + } + if ((flags & 2) != 0) { + stream.writeString(site_name); + } + if ((flags & 4) != 0) { + stream.writeString(title); + } + if ((flags & 8) != 0) { + stream.writeString(description); + } + if ((flags & 16) != 0) { + photo.serializeToStream(stream); + } + if ((flags & 32) != 0) { + stream.writeString(embed_url); + } + if ((flags & 32) != 0) { + stream.writeString(embed_type); + } + if ((flags & 64) != 0) { + stream.writeInt32(embed_width); + } + if ((flags & 64) != 0) { + stream.writeInt32(embed_height); + } + if ((flags & 128) != 0) { + stream.writeInt32(duration); + } + if ((flags & 256) != 0) { + stream.writeString(author); + } + if ((flags & 512) != 0) { + document.serializeToStream(stream); + } + } + } public static abstract class messages_FeaturedStickers extends TLObject { @@ -17817,456 +18155,456 @@ public class TLRPC { } } - public static abstract class SecureValueError extends TLObject { + public static abstract class SecureValueError extends TLObject { - public static SecureValueError TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - SecureValueError result = null; - switch (constructor) { - case 0x7a700873: - result = new TL_secureValueErrorFile(); - break; - case 0xbe3dfa: - result = new TL_secureValueErrorFrontSide(); - break; - case 0x666220e9: - result = new TL_secureValueErrorFiles(); - break; - case 0x868a2aa5: - result = new TL_secureValueErrorReverseSide(); - break; - case 0xa1144770: - result = new TL_secureValueErrorTranslationFile(); - break; - case 0x869d758f: - result = new TL_secureValueError(); - break; - case 0xe8a40bd9: - result = new TL_secureValueErrorData(); - break; - case 0x34636dd8: - result = new TL_secureValueErrorTranslationFiles(); - break; - case 0xe537ced6: - result = new TL_secureValueErrorSelfie(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in SecureValueError", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static SecureValueError TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + SecureValueError result = null; + switch (constructor) { + case 0x7a700873: + result = new TL_secureValueErrorFile(); + break; + case 0xbe3dfa: + result = new TL_secureValueErrorFrontSide(); + break; + case 0x666220e9: + result = new TL_secureValueErrorFiles(); + break; + case 0x868a2aa5: + result = new TL_secureValueErrorReverseSide(); + break; + case 0xa1144770: + result = new TL_secureValueErrorTranslationFile(); + break; + case 0x869d758f: + result = new TL_secureValueError(); + break; + case 0xe8a40bd9: + result = new TL_secureValueErrorData(); + break; + case 0x34636dd8: + result = new TL_secureValueErrorTranslationFiles(); + break; + case 0xe537ced6: + result = new TL_secureValueErrorSelfie(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in SecureValueError", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_secureValueErrorFile extends SecureValueError { - public static int constructor = 0x7a700873; + public static class TL_secureValueErrorFile extends SecureValueError { + public static int constructor = 0x7a700873; - public SecureValueType type; - public byte[] file_hash; - public String text; + public SecureValueType type; + public byte[] file_hash; + public String text; - public void readParams(AbstractSerializedData stream, boolean exception) { - type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); - file_hash = stream.readByteArray(exception); - text = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); + file_hash = stream.readByteArray(exception); + text = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - type.serializeToStream(stream); - stream.writeByteArray(file_hash); - stream.writeString(text); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + type.serializeToStream(stream); + stream.writeByteArray(file_hash); + stream.writeString(text); + } + } - public static class TL_secureValueErrorFrontSide extends SecureValueError { - public static int constructor = 0xbe3dfa; + public static class TL_secureValueErrorFrontSide extends SecureValueError { + public static int constructor = 0xbe3dfa; - public SecureValueType type; - public byte[] file_hash; - public String text; + public SecureValueType type; + public byte[] file_hash; + public String text; - public void readParams(AbstractSerializedData stream, boolean exception) { - type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); - file_hash = stream.readByteArray(exception); - text = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); + file_hash = stream.readByteArray(exception); + text = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - type.serializeToStream(stream); - stream.writeByteArray(file_hash); - stream.writeString(text); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + type.serializeToStream(stream); + stream.writeByteArray(file_hash); + stream.writeString(text); + } + } - public static class TL_secureValueErrorFiles extends SecureValueError { - public static int constructor = 0x666220e9; + public static class TL_secureValueErrorFiles extends SecureValueError { + public static int constructor = 0x666220e9; - public SecureValueType type; - public ArrayList file_hash = new ArrayList<>(); - public String text; + public SecureValueType type; + public ArrayList file_hash = new ArrayList<>(); + public String text; - public void readParams(AbstractSerializedData stream, boolean exception) { - type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - file_hash.add(stream.readByteArray(exception)); - } - text = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + file_hash.add(stream.readByteArray(exception)); + } + text = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - type.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = file_hash.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeByteArray(file_hash.get(a)); - } - stream.writeString(text); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + type.serializeToStream(stream); + stream.writeInt32(0x1cb5c415); + int count = file_hash.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeByteArray(file_hash.get(a)); + } + stream.writeString(text); + } + } - public static class TL_secureValueErrorReverseSide extends SecureValueError { - public static int constructor = 0x868a2aa5; + public static class TL_secureValueErrorReverseSide extends SecureValueError { + public static int constructor = 0x868a2aa5; - public SecureValueType type; - public byte[] file_hash; - public String text; + public SecureValueType type; + public byte[] file_hash; + public String text; - public void readParams(AbstractSerializedData stream, boolean exception) { - type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); - file_hash = stream.readByteArray(exception); - text = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); + file_hash = stream.readByteArray(exception); + text = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - type.serializeToStream(stream); - stream.writeByteArray(file_hash); - stream.writeString(text); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + type.serializeToStream(stream); + stream.writeByteArray(file_hash); + stream.writeString(text); + } + } - public static class TL_secureValueErrorTranslationFile extends SecureValueError { - public static int constructor = 0xa1144770; + public static class TL_secureValueErrorTranslationFile extends SecureValueError { + public static int constructor = 0xa1144770; - public SecureValueType type; - public byte[] file_hash; - public String text; + public SecureValueType type; + public byte[] file_hash; + public String text; - public void readParams(AbstractSerializedData stream, boolean exception) { - type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); - file_hash = stream.readByteArray(exception); - text = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); + file_hash = stream.readByteArray(exception); + text = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - type.serializeToStream(stream); - stream.writeByteArray(file_hash); - stream.writeString(text); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + type.serializeToStream(stream); + stream.writeByteArray(file_hash); + stream.writeString(text); + } + } - public static class TL_secureValueError extends SecureValueError { - public static int constructor = 0x869d758f; + public static class TL_secureValueError extends SecureValueError { + public static int constructor = 0x869d758f; - public SecureValueType type; - public byte[] hash; - public String text; + public SecureValueType type; + public byte[] hash; + public String text; - public void readParams(AbstractSerializedData stream, boolean exception) { - type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); - hash = stream.readByteArray(exception); - text = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); + hash = stream.readByteArray(exception); + text = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - type.serializeToStream(stream); - stream.writeByteArray(hash); - stream.writeString(text); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + type.serializeToStream(stream); + stream.writeByteArray(hash); + stream.writeString(text); + } + } - public static class TL_secureValueErrorData extends SecureValueError { - public static int constructor = 0xe8a40bd9; + public static class TL_secureValueErrorData extends SecureValueError { + public static int constructor = 0xe8a40bd9; - public SecureValueType type; - public byte[] data_hash; - public String field; - public String text; + public SecureValueType type; + public byte[] data_hash; + public String field; + public String text; - public void readParams(AbstractSerializedData stream, boolean exception) { - type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); - data_hash = stream.readByteArray(exception); - field = stream.readString(exception); - text = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); + data_hash = stream.readByteArray(exception); + field = stream.readString(exception); + text = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - type.serializeToStream(stream); - stream.writeByteArray(data_hash); - stream.writeString(field); - stream.writeString(text); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + type.serializeToStream(stream); + stream.writeByteArray(data_hash); + stream.writeString(field); + stream.writeString(text); + } + } - public static class TL_secureValueErrorTranslationFiles extends SecureValueError { - public static int constructor = 0x34636dd8; + public static class TL_secureValueErrorTranslationFiles extends SecureValueError { + public static int constructor = 0x34636dd8; - public SecureValueType type; - public ArrayList file_hash = new ArrayList<>(); - public String text; + public SecureValueType type; + public ArrayList file_hash = new ArrayList<>(); + public String text; - public void readParams(AbstractSerializedData stream, boolean exception) { - type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - file_hash.add(stream.readByteArray(exception)); - } - text = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + file_hash.add(stream.readByteArray(exception)); + } + text = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - type.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = file_hash.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeByteArray(file_hash.get(a)); - } - stream.writeString(text); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + type.serializeToStream(stream); + stream.writeInt32(0x1cb5c415); + int count = file_hash.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeByteArray(file_hash.get(a)); + } + stream.writeString(text); + } + } - public static class TL_secureValueErrorSelfie extends SecureValueError { - public static int constructor = 0xe537ced6; + public static class TL_secureValueErrorSelfie extends SecureValueError { + public static int constructor = 0xe537ced6; - public SecureValueType type; - public byte[] file_hash; - public String text; + public SecureValueType type; + public byte[] file_hash; + public String text; - public void readParams(AbstractSerializedData stream, boolean exception) { - type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); - file_hash = stream.readByteArray(exception); - text = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); + file_hash = stream.readByteArray(exception); + text = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - type.serializeToStream(stream); - stream.writeByteArray(file_hash); - stream.writeString(text); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + type.serializeToStream(stream); + stream.writeByteArray(file_hash); + stream.writeString(text); + } + } - public static class TL_secureValue extends TLObject { - public static int constructor = 0x187fa0ca; + public static class TL_secureValue extends TLObject { + public static int constructor = 0x187fa0ca; - public int flags; - public SecureValueType type; - public TL_secureData data; - public SecureFile front_side; - public SecureFile reverse_side; - public SecureFile selfie; - public ArrayList translation = new ArrayList<>(); - public ArrayList files = new ArrayList<>(); - public SecurePlainData plain_data; - public byte[] hash; + public int flags; + public SecureValueType type; + public TL_secureData data; + public SecureFile front_side; + public SecureFile reverse_side; + public SecureFile selfie; + public ArrayList translation = new ArrayList<>(); + public ArrayList files = new ArrayList<>(); + public SecurePlainData plain_data; + public byte[] hash; - public static TL_secureValue TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_secureValue.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_secureValue", constructor)); - } else { - return null; - } - } - TL_secureValue result = new TL_secureValue(); - result.readParams(stream, exception); - return result; - } + public static TL_secureValue TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_secureValue.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_secureValue", constructor)); + } else { + return null; + } + } + TL_secureValue result = new TL_secureValue(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 1) != 0) { - data = TL_secureData.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 2) != 0) { - front_side = SecureFile.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 4) != 0) { - reverse_side = SecureFile.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 8) != 0) { - selfie = SecureFile.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 64) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - SecureFile object = SecureFile.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - translation.add(object); - } - } - if ((flags & 16) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - SecureFile object = SecureFile.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - files.add(object); - } - } - if ((flags & 32) != 0) { - plain_data = SecurePlainData.TLdeserialize(stream, stream.readInt32(exception), exception); - } - hash = stream.readByteArray(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 1) != 0) { + data = TL_secureData.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 2) != 0) { + front_side = SecureFile.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 4) != 0) { + reverse_side = SecureFile.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 8) != 0) { + selfie = SecureFile.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 64) != 0) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + SecureFile object = SecureFile.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + translation.add(object); + } + } + if ((flags & 16) != 0) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + SecureFile object = SecureFile.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + files.add(object); + } + } + if ((flags & 32) != 0) { + plain_data = SecurePlainData.TLdeserialize(stream, stream.readInt32(exception), exception); + } + hash = stream.readByteArray(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - type.serializeToStream(stream); - if ((flags & 1) != 0) { - data.serializeToStream(stream); - } - if ((flags & 2) != 0) { - front_side.serializeToStream(stream); - } - if ((flags & 4) != 0) { - reverse_side.serializeToStream(stream); - } - if ((flags & 8) != 0) { - selfie.serializeToStream(stream); - } - if ((flags & 64) != 0) { - stream.writeInt32(0x1cb5c415); - int count = translation.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - translation.get(a).serializeToStream(stream); - } - } - if ((flags & 16) != 0) { - stream.writeInt32(0x1cb5c415); - int count = files.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - files.get(a).serializeToStream(stream); - } - } - if ((flags & 32) != 0) { - plain_data.serializeToStream(stream); - } - stream.writeByteArray(hash); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + type.serializeToStream(stream); + if ((flags & 1) != 0) { + data.serializeToStream(stream); + } + if ((flags & 2) != 0) { + front_side.serializeToStream(stream); + } + if ((flags & 4) != 0) { + reverse_side.serializeToStream(stream); + } + if ((flags & 8) != 0) { + selfie.serializeToStream(stream); + } + if ((flags & 64) != 0) { + stream.writeInt32(0x1cb5c415); + int count = translation.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + translation.get(a).serializeToStream(stream); + } + } + if ((flags & 16) != 0) { + stream.writeInt32(0x1cb5c415); + int count = files.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + files.get(a).serializeToStream(stream); + } + } + if ((flags & 32) != 0) { + plain_data.serializeToStream(stream); + } + stream.writeByteArray(hash); + } + } - public static abstract class PhoneCallDiscardReason extends TLObject { - public byte[] encrypted_key; + public static abstract class PhoneCallDiscardReason extends TLObject { + public byte[] encrypted_key; - public static PhoneCallDiscardReason TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - PhoneCallDiscardReason result = null; - switch (constructor) { - case 0x57adc690: - result = new TL_phoneCallDiscardReasonHangup(); - break; - case 0xfaf7e8c9: - result = new TL_phoneCallDiscardReasonBusy(); - break; - case 0x85e42301: - result = new TL_phoneCallDiscardReasonMissed(); - break; - case 0xe095c1a0: - result = new TL_phoneCallDiscardReasonDisconnect(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in PhoneCallDiscardReason", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static PhoneCallDiscardReason TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + PhoneCallDiscardReason result = null; + switch (constructor) { + case 0x57adc690: + result = new TL_phoneCallDiscardReasonHangup(); + break; + case 0xfaf7e8c9: + result = new TL_phoneCallDiscardReasonBusy(); + break; + case 0x85e42301: + result = new TL_phoneCallDiscardReasonMissed(); + break; + case 0xe095c1a0: + result = new TL_phoneCallDiscardReasonDisconnect(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in PhoneCallDiscardReason", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_phoneCallDiscardReasonHangup extends PhoneCallDiscardReason { - public static int constructor = 0x57adc690; + public static class TL_phoneCallDiscardReasonHangup extends PhoneCallDiscardReason { + public static int constructor = 0x57adc690; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_phoneCallDiscardReasonBusy extends PhoneCallDiscardReason { - public static int constructor = 0xfaf7e8c9; + public static class TL_phoneCallDiscardReasonBusy extends PhoneCallDiscardReason { + public static int constructor = 0xfaf7e8c9; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_phoneCallDiscardReasonMissed extends PhoneCallDiscardReason { - public static int constructor = 0x85e42301; + public static class TL_phoneCallDiscardReasonMissed extends PhoneCallDiscardReason { + public static int constructor = 0x85e42301; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_phoneCallDiscardReasonDisconnect extends PhoneCallDiscardReason { - public static int constructor = 0xe095c1a0; + public static class TL_phoneCallDiscardReasonDisconnect extends PhoneCallDiscardReason { + public static int constructor = 0xe095c1a0; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_dialogFilter extends TLObject { public static int constructor = 0x7438f7e8; @@ -18399,64 +18737,64 @@ public class TLRPC { } } - public static class TL_auth_passwordRecovery extends TLObject { - public static int constructor = 0x137948a5; + public static class TL_auth_passwordRecovery extends TLObject { + public static int constructor = 0x137948a5; - public String email_pattern; + public String email_pattern; - public static TL_auth_passwordRecovery TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_auth_passwordRecovery.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_auth_passwordRecovery", constructor)); - } else { - return null; - } - } - TL_auth_passwordRecovery result = new TL_auth_passwordRecovery(); - result.readParams(stream, exception); - return result; - } + public static TL_auth_passwordRecovery TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_auth_passwordRecovery.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_auth_passwordRecovery", constructor)); + } else { + return null; + } + } + TL_auth_passwordRecovery result = new TL_auth_passwordRecovery(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - email_pattern = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(email_pattern); - } - } - - public static class TL_botCommand extends TLObject { - public static int constructor = 0xc27ac8c7; - - public String command; - public String description; - - public static TL_botCommand TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_botCommand.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_botCommand", constructor)); - } else { - return null; - } - } - TL_botCommand result = new TL_botCommand(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - command = stream.readString(exception); - description = stream.readString(exception); + public void readParams(AbstractSerializedData stream, boolean exception) { + email_pattern = stream.readString(exception); } public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(command); - stream.writeString(description); - } - } + stream.writeInt32(constructor); + stream.writeString(email_pattern); + } + } + + public static class TL_botCommand extends TLObject { + public static int constructor = 0xc27ac8c7; + + public String command; + public String description; + + public static TL_botCommand TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_botCommand.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_botCommand", constructor)); + } else { + return null; + } + } + TL_botCommand result = new TL_botCommand(); + result.readParams(stream, exception); + return result; + } + + public void readParams(AbstractSerializedData stream, boolean exception) { + command = stream.readString(exception); + description = stream.readString(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(command); + stream.writeString(description); + } + } public static abstract class InputNotifyPeer extends TLObject { @@ -18748,110 +19086,110 @@ public class TLRPC { } } - public static class TL_photos_photo extends TLObject { - public static int constructor = 0x20212ca8; + public static class TL_photos_photo extends TLObject { + public static int constructor = 0x20212ca8; - public Photo photo; - public ArrayList users = new ArrayList<>(); + public Photo photo; + public ArrayList users = new ArrayList<>(); public static TL_photos_photo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_photos_photo.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_photos_photo", constructor)); - } else { - return null; - } - } - TL_photos_photo result = new TL_photos_photo(); - result.readParams(stream, exception); - return result; + if (TL_photos_photo.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_photos_photo", constructor)); + } else { + return null; + } + } + TL_photos_photo result = new TL_photos_photo(); + result.readParams(stream, exception); + return result; } public void readParams(AbstractSerializedData stream, boolean exception) { - photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } + photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + users.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); photo.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); + stream.writeInt32(0x1cb5c415); + int count = users.size(); + stream.writeInt32(count); for (int a = 0; a < count; a++) { users.get(a).serializeToStream(stream); - } - } - } + } + } + } - public static abstract class help_TermsOfServiceUpdate extends TLObject { + public static abstract class help_TermsOfServiceUpdate extends TLObject { - public static help_TermsOfServiceUpdate TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - help_TermsOfServiceUpdate result = null; - switch (constructor) { - case 0x28ecf961: - result = new TL_help_termsOfServiceUpdate(); - break; - case 0xe3309f7f: - result = new TL_help_termsOfServiceUpdateEmpty(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in help_TermsOfServiceUpdate", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static help_TermsOfServiceUpdate TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + help_TermsOfServiceUpdate result = null; + switch (constructor) { + case 0x28ecf961: + result = new TL_help_termsOfServiceUpdate(); + break; + case 0xe3309f7f: + result = new TL_help_termsOfServiceUpdateEmpty(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in help_TermsOfServiceUpdate", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_help_termsOfServiceUpdate extends help_TermsOfServiceUpdate { - public static int constructor = 0x28ecf961; + public static class TL_help_termsOfServiceUpdate extends help_TermsOfServiceUpdate { + public static int constructor = 0x28ecf961; - public int expires; - public TL_help_termsOfService terms_of_service; + public int expires; + public TL_help_termsOfService terms_of_service; - public void readParams(AbstractSerializedData stream, boolean exception) { - expires = stream.readInt32(exception); - terms_of_service = TL_help_termsOfService.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + expires = stream.readInt32(exception); + terms_of_service = TL_help_termsOfService.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(expires); - terms_of_service.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(expires); + terms_of_service.serializeToStream(stream); + } + } - public static class TL_help_termsOfServiceUpdateEmpty extends help_TermsOfServiceUpdate { - public static int constructor = 0xe3309f7f; + public static class TL_help_termsOfServiceUpdateEmpty extends help_TermsOfServiceUpdate { + public static int constructor = 0xe3309f7f; - public int expires; + public int expires; - public void readParams(AbstractSerializedData stream, boolean exception) { - expires = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + expires = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(expires); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(expires); + } + } public static class TL_messages_chatAdminsWithInvites extends TLObject { public static int constructor = 0xb69b72d7; @@ -19341,36 +19679,36 @@ public class TLRPC { } } - public static abstract class User extends TLObject { - public long id; - public String first_name; - public String last_name; - public String username; - public long access_hash; - public String phone; - public UserProfilePhoto photo; - public UserStatus status; - public int flags; - public boolean self; - public boolean contact; - public boolean mutual_contact; - public boolean deleted; - public boolean bot; - public boolean bot_chat_history; - public boolean bot_nochats; - public boolean verified; - public boolean restricted; - public boolean min; - public boolean bot_inline_geo; + public static abstract class User extends TLObject { + public long id; + public String first_name; + public String last_name; + public String username; + public long access_hash; + public String phone; + public UserProfilePhoto photo; + public UserStatus status; + public int flags; + public boolean self; + public boolean contact; + public boolean mutual_contact; + public boolean deleted; + public boolean bot; + public boolean bot_chat_history; + public boolean bot_nochats; + public boolean verified; + public boolean restricted; + public boolean min; + public boolean bot_inline_geo; public boolean support; public boolean scam; public boolean apply_min_photo; public boolean fake; - public int bot_info_version; - public String bot_inline_placeholder; - public String lang_code; - public boolean inactive; - public boolean explicit_content; + public int bot_info_version; + public String bot_inline_placeholder; + public String lang_code; + public boolean inactive; + public boolean explicit_content; public ArrayList restriction_reason = new ArrayList<>(); public boolean verifiedExtended() { @@ -19395,109 +19733,109 @@ public class TLRPC { case 0x938458c1: result = new TL_user_layer131(); break; - case 0x2e13f4c3: - result = new TL_user_layer104(); - break; - case 0x720535ec: - result = new TL_userSelf_old(); - break; - case 0x1c60e608: - result = new TL_userSelf_old3(); - break; - case 0xd6016d7a: - result = new TL_userDeleted_old2(); - break; - case 0x200250ba: - result = new TL_userEmpty_layer131(); - break; - case 0x22e8ceb0: - result = new TL_userRequest_old(); - break; - case 0x5214c89d: - result = new TL_userForeign_old(); - break; - case 0x75cf7a8: - result = new TL_userForeign_old2(); - break; - case 0xd9ccc4ef: - result = new TL_userRequest_old2(); - break; - case 0xb29ad7cc: - result = new TL_userDeleted_old(); - break; - case 0xd10d979a: - result = new TL_user_layer65(); - break; - case 0x22e49072: - result = new TL_user_old(); - break; - case 0x7007b451: - result = new TL_userSelf_old2(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in User", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + case 0x2e13f4c3: + result = new TL_user_layer104(); + break; + case 0x720535ec: + result = new TL_userSelf_old(); + break; + case 0x1c60e608: + result = new TL_userSelf_old3(); + break; + case 0xd6016d7a: + result = new TL_userDeleted_old2(); + break; + case 0x200250ba: + result = new TL_userEmpty_layer131(); + break; + case 0x22e8ceb0: + result = new TL_userRequest_old(); + break; + case 0x5214c89d: + result = new TL_userForeign_old(); + break; + case 0x75cf7a8: + result = new TL_userForeign_old2(); + break; + case 0xd9ccc4ef: + result = new TL_userRequest_old2(); + break; + case 0xb29ad7cc: + result = new TL_userDeleted_old(); + break; + case 0xd10d979a: + result = new TL_user_layer65(); + break; + case 0x22e49072: + result = new TL_user_old(); + break; + case 0x7007b451: + result = new TL_userSelf_old2(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in User", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_userContact_old2 extends User { - public static int constructor = 0xcab35e18; + public static class TL_userContact_old2 extends User { + public static int constructor = 0xcab35e18; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - first_name = stream.readString(exception); - last_name = stream.readString(exception); - username = stream.readString(exception); - access_hash = stream.readInt64(exception); - phone = stream.readString(exception); - photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + first_name = stream.readString(exception); + last_name = stream.readString(exception); + username = stream.readString(exception); + access_hash = stream.readInt64(exception); + phone = stream.readString(exception); + photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); stream.writeInt32((int) id); - stream.writeString(first_name); - stream.writeString(last_name); - stream.writeString(username); - stream.writeInt64(access_hash); - stream.writeString(phone); - photo.serializeToStream(stream); - status.serializeToStream(stream); - } - } + stream.writeString(first_name); + stream.writeString(last_name); + stream.writeString(username); + stream.writeInt64(access_hash); + stream.writeString(phone); + photo.serializeToStream(stream); + status.serializeToStream(stream); + } + } - public static class TL_userContact_old extends TL_userContact_old2 { - public static int constructor = 0xf2fb8319; + public static class TL_userContact_old extends TL_userContact_old2 { + public static int constructor = 0xf2fb8319; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - first_name = stream.readString(exception); - last_name = stream.readString(exception); - access_hash = stream.readInt64(exception); - phone = stream.readString(exception); - photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + first_name = stream.readString(exception); + last_name = stream.readString(exception); + access_hash = stream.readInt64(exception); + phone = stream.readString(exception); + photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); stream.writeInt32((int) id); - stream.writeString(first_name); - stream.writeString(last_name); - stream.writeInt64(access_hash); - stream.writeString(phone); - photo.serializeToStream(stream); - status.serializeToStream(stream); - } - } + stream.writeString(first_name); + stream.writeString(last_name); + stream.writeInt64(access_hash); + stream.writeString(phone); + photo.serializeToStream(stream); + status.serializeToStream(stream); + } + } public static class TL_userEmpty extends User { public static int constructor = 0xd3bc4b7a; @@ -19883,421 +20221,421 @@ public class TLRPC { } } - public static class TL_userSelf_old extends TL_userSelf_old3 { - public static int constructor = 0x720535ec; + public static class TL_userSelf_old extends TL_userSelf_old3 { + public static int constructor = 0x720535ec; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - first_name = stream.readString(exception); - last_name = stream.readString(exception); - phone = stream.readString(exception); - photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); - inactive = stream.readBool(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + first_name = stream.readString(exception); + last_name = stream.readString(exception); + phone = stream.readString(exception); + photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); + inactive = stream.readBool(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); stream.writeInt32((int) id); - stream.writeString(first_name); - stream.writeString(last_name); - stream.writeString(phone); - photo.serializeToStream(stream); - status.serializeToStream(stream); - stream.writeBool(inactive); - } - } + stream.writeString(first_name); + stream.writeString(last_name); + stream.writeString(phone); + photo.serializeToStream(stream); + status.serializeToStream(stream); + stream.writeBool(inactive); + } + } - public static class TL_userSelf_old3 extends User { - public static int constructor = 0x1c60e608; + public static class TL_userSelf_old3 extends User { + public static int constructor = 0x1c60e608; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - first_name = stream.readString(exception); - last_name = stream.readString(exception); - username = stream.readString(exception); - phone = stream.readString(exception); - photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + first_name = stream.readString(exception); + last_name = stream.readString(exception); + username = stream.readString(exception); + phone = stream.readString(exception); + photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); stream.writeInt32((int) id); - stream.writeString(first_name); - stream.writeString(last_name); - stream.writeString(username); - stream.writeString(phone); - photo.serializeToStream(stream); - status.serializeToStream(stream); - } - } + stream.writeString(first_name); + stream.writeString(last_name); + stream.writeString(username); + stream.writeString(phone); + photo.serializeToStream(stream); + status.serializeToStream(stream); + } + } - public static class TL_userDeleted_old2 extends User { - public static int constructor = 0xd6016d7a; + public static class TL_userDeleted_old2 extends User { + public static int constructor = 0xd6016d7a; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - first_name = stream.readString(exception); - last_name = stream.readString(exception); - username = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + first_name = stream.readString(exception); + last_name = stream.readString(exception); + username = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); stream.writeInt32((int) id); - stream.writeString(first_name); - stream.writeString(last_name); - stream.writeString(username); - } - } + stream.writeString(first_name); + stream.writeString(last_name); + stream.writeString(username); + } + } - public static class TL_userEmpty_layer131 extends TL_userEmpty { - public static int constructor = 0x200250ba; + public static class TL_userEmpty_layer131 extends TL_userEmpty { + public static int constructor = 0x200250ba; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); stream.writeInt32((int) id); - } - } + } + } - public static class TL_userRequest_old extends TL_userRequest_old2 { - public static int constructor = 0x22e8ceb0; + public static class TL_userRequest_old extends TL_userRequest_old2 { + public static int constructor = 0x22e8ceb0; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - first_name = stream.readString(exception); - last_name = stream.readString(exception); - access_hash = stream.readInt64(exception); - phone = stream.readString(exception); - photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + first_name = stream.readString(exception); + last_name = stream.readString(exception); + access_hash = stream.readInt64(exception); + phone = stream.readString(exception); + photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); stream.writeInt32((int) id); - stream.writeString(first_name); - stream.writeString(last_name); - stream.writeInt64(access_hash); - stream.writeString(phone); - photo.serializeToStream(stream); - status.serializeToStream(stream); - } - } + stream.writeString(first_name); + stream.writeString(last_name); + stream.writeInt64(access_hash); + stream.writeString(phone); + photo.serializeToStream(stream); + status.serializeToStream(stream); + } + } - public static class TL_userForeign_old extends TL_userForeign_old2 { - public static int constructor = 0x5214c89d; + public static class TL_userForeign_old extends TL_userForeign_old2 { + public static int constructor = 0x5214c89d; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - first_name = stream.readString(exception); - last_name = stream.readString(exception); - access_hash = stream.readInt64(exception); - photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + first_name = stream.readString(exception); + last_name = stream.readString(exception); + access_hash = stream.readInt64(exception); + photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); stream.writeInt32((int) id); - stream.writeString(first_name); - stream.writeString(last_name); - stream.writeInt64(access_hash); - photo.serializeToStream(stream); - status.serializeToStream(stream); - } - } + stream.writeString(first_name); + stream.writeString(last_name); + stream.writeInt64(access_hash); + photo.serializeToStream(stream); + status.serializeToStream(stream); + } + } - public static class TL_userForeign_old2 extends User { - public static int constructor = 0x75cf7a8; + public static class TL_userForeign_old2 extends User { + public static int constructor = 0x75cf7a8; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - first_name = stream.readString(exception); - last_name = stream.readString(exception); - username = stream.readString(exception); - access_hash = stream.readInt64(exception); - photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + first_name = stream.readString(exception); + last_name = stream.readString(exception); + username = stream.readString(exception); + access_hash = stream.readInt64(exception); + photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); stream.writeInt32((int) id); - stream.writeString(first_name); - stream.writeString(last_name); - stream.writeString(username); - stream.writeInt64(access_hash); - photo.serializeToStream(stream); - status.serializeToStream(stream); - } - } + stream.writeString(first_name); + stream.writeString(last_name); + stream.writeString(username); + stream.writeInt64(access_hash); + photo.serializeToStream(stream); + status.serializeToStream(stream); + } + } - public static class TL_userRequest_old2 extends User { - public static int constructor = 0xd9ccc4ef; + public static class TL_userRequest_old2 extends User { + public static int constructor = 0xd9ccc4ef; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - first_name = stream.readString(exception); - last_name = stream.readString(exception); - username = stream.readString(exception); - access_hash = stream.readInt64(exception); - phone = stream.readString(exception); - photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + first_name = stream.readString(exception); + last_name = stream.readString(exception); + username = stream.readString(exception); + access_hash = stream.readInt64(exception); + phone = stream.readString(exception); + photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); stream.writeInt32((int) id); - stream.writeString(first_name); - stream.writeString(last_name); - stream.writeString(username); - stream.writeInt64(access_hash); - stream.writeString(phone); - photo.serializeToStream(stream); - status.serializeToStream(stream); - } - } + stream.writeString(first_name); + stream.writeString(last_name); + stream.writeString(username); + stream.writeInt64(access_hash); + stream.writeString(phone); + photo.serializeToStream(stream); + status.serializeToStream(stream); + } + } - public static class TL_userDeleted_old extends TL_userDeleted_old2 { - public static int constructor = 0xb29ad7cc; + public static class TL_userDeleted_old extends TL_userDeleted_old2 { + public static int constructor = 0xb29ad7cc; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - first_name = stream.readString(exception); - last_name = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + first_name = stream.readString(exception); + last_name = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); stream.writeInt32((int) id); - stream.writeString(first_name); - stream.writeString(last_name); - } - } + stream.writeString(first_name); + stream.writeString(last_name); + } + } - public static class TL_user_layer65 extends TL_user { - public static int constructor = 0xd10d979a; + public static class TL_user_layer65 extends TL_user { + public static int constructor = 0xd10d979a; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - self = (flags & 1024) != 0; - contact = (flags & 2048) != 0; - mutual_contact = (flags & 4096) != 0; - deleted = (flags & 8192) != 0; - bot = (flags & 16384) != 0; - bot_chat_history = (flags & 32768) != 0; - bot_nochats = (flags & 65536) != 0; - verified = (flags & 131072) != 0; - restricted = (flags & 262144) != 0; - min = (flags & 1048576) != 0; - bot_inline_geo = (flags & 2097152) != 0; - id = stream.readInt32(exception); - if ((flags & 1) != 0) { - access_hash = stream.readInt64(exception); - } - if ((flags & 2) != 0) { - first_name = stream.readString(exception); - } - if ((flags & 4) != 0) { - last_name = stream.readString(exception); - } - if ((flags & 8) != 0) { - username = stream.readString(exception); - } - if ((flags & 16) != 0) { - phone = stream.readString(exception); - } - if ((flags & 32) != 0) { - photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 64) != 0) { - status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 16384) != 0) { - bot_info_version = stream.readInt32(exception); - } - if ((flags & 262144) != 0) { - stream.readString(exception); - } - if ((flags & 524288) != 0) { - bot_inline_placeholder = stream.readString(exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + self = (flags & 1024) != 0; + contact = (flags & 2048) != 0; + mutual_contact = (flags & 4096) != 0; + deleted = (flags & 8192) != 0; + bot = (flags & 16384) != 0; + bot_chat_history = (flags & 32768) != 0; + bot_nochats = (flags & 65536) != 0; + verified = (flags & 131072) != 0; + restricted = (flags & 262144) != 0; + min = (flags & 1048576) != 0; + bot_inline_geo = (flags & 2097152) != 0; + id = stream.readInt32(exception); + if ((flags & 1) != 0) { + access_hash = stream.readInt64(exception); + } + if ((flags & 2) != 0) { + first_name = stream.readString(exception); + } + if ((flags & 4) != 0) { + last_name = stream.readString(exception); + } + if ((flags & 8) != 0) { + username = stream.readString(exception); + } + if ((flags & 16) != 0) { + phone = stream.readString(exception); + } + if ((flags & 32) != 0) { + photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 64) != 0) { + status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 16384) != 0) { + bot_info_version = stream.readInt32(exception); + } + if ((flags & 262144) != 0) { + stream.readString(exception); + } + if ((flags & 524288) != 0) { + bot_inline_placeholder = stream.readString(exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = self ? (flags | 1024) : (flags &~ 1024); - flags = contact ? (flags | 2048) : (flags &~ 2048); - flags = mutual_contact ? (flags | 4096) : (flags &~ 4096); - flags = deleted ? (flags | 8192) : (flags &~ 8192); - flags = bot ? (flags | 16384) : (flags &~ 16384); - flags = bot_chat_history ? (flags | 32768) : (flags &~ 32768); - flags = bot_nochats ? (flags | 65536) : (flags &~ 65536); - flags = verified ? (flags | 131072) : (flags &~ 131072); - flags = restricted ? (flags | 262144) : (flags &~ 262144); - flags = min ? (flags | 1048576) : (flags &~ 1048576); - flags = bot_inline_geo ? (flags | 2097152) : (flags &~ 2097152); - stream.writeInt32(flags); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = self ? (flags | 1024) : (flags &~ 1024); + flags = contact ? (flags | 2048) : (flags &~ 2048); + flags = mutual_contact ? (flags | 4096) : (flags &~ 4096); + flags = deleted ? (flags | 8192) : (flags &~ 8192); + flags = bot ? (flags | 16384) : (flags &~ 16384); + flags = bot_chat_history ? (flags | 32768) : (flags &~ 32768); + flags = bot_nochats ? (flags | 65536) : (flags &~ 65536); + flags = verified ? (flags | 131072) : (flags &~ 131072); + flags = restricted ? (flags | 262144) : (flags &~ 262144); + flags = min ? (flags | 1048576) : (flags &~ 1048576); + flags = bot_inline_geo ? (flags | 2097152) : (flags &~ 2097152); + stream.writeInt32(flags); stream.writeInt32((int) id); - if ((flags & 1) != 0) { - stream.writeInt64(access_hash); - } - if ((flags & 2) != 0) { - stream.writeString(first_name); - } - if ((flags & 4) != 0) { - stream.writeString(last_name); - } - if ((flags & 8) != 0) { - stream.writeString(username); - } - if ((flags & 16) != 0) { - stream.writeString(phone); - } - if ((flags & 32) != 0) { - photo.serializeToStream(stream); - } - if ((flags & 64) != 0) { - status.serializeToStream(stream); - } - if ((flags & 16384) != 0) { - stream.writeInt32(bot_info_version); - } - if ((flags & 262144) != 0) { - stream.writeString(""); - } - if ((flags & 524288) != 0) { - stream.writeString(bot_inline_placeholder); - } - } - } + if ((flags & 1) != 0) { + stream.writeInt64(access_hash); + } + if ((flags & 2) != 0) { + stream.writeString(first_name); + } + if ((flags & 4) != 0) { + stream.writeString(last_name); + } + if ((flags & 8) != 0) { + stream.writeString(username); + } + if ((flags & 16) != 0) { + stream.writeString(phone); + } + if ((flags & 32) != 0) { + photo.serializeToStream(stream); + } + if ((flags & 64) != 0) { + status.serializeToStream(stream); + } + if ((flags & 16384) != 0) { + stream.writeInt32(bot_info_version); + } + if ((flags & 262144) != 0) { + stream.writeString(""); + } + if ((flags & 524288) != 0) { + stream.writeString(bot_inline_placeholder); + } + } + } - public static class TL_user_old extends TL_user { - public static int constructor = 0x22e49072; + public static class TL_user_old extends TL_user { + public static int constructor = 0x22e49072; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - self = (flags & 1024) != 0; - contact = (flags & 2048) != 0; - mutual_contact = (flags & 4096) != 0; - deleted = (flags & 8192) != 0; - bot = (flags & 16384) != 0; - bot_chat_history = (flags & 32768) != 0; - bot_nochats = (flags & 65536) != 0; - verified = (flags & 131072) != 0; - explicit_content = (flags & 262144) != 0; - id = stream.readInt32(exception); - if ((flags & 1) != 0) { - access_hash = stream.readInt64(exception); - } - if ((flags & 2) != 0) { - first_name = stream.readString(exception); - } - if ((flags & 4) != 0) { - last_name = stream.readString(exception); - } - if ((flags & 8) != 0) { - username = stream.readString(exception); - } - if ((flags & 16) != 0) { - phone = stream.readString(exception); - } - if ((flags & 32) != 0) { - photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 64) != 0) { - status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 16384) != 0) { - bot_info_version = stream.readInt32(exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + self = (flags & 1024) != 0; + contact = (flags & 2048) != 0; + mutual_contact = (flags & 4096) != 0; + deleted = (flags & 8192) != 0; + bot = (flags & 16384) != 0; + bot_chat_history = (flags & 32768) != 0; + bot_nochats = (flags & 65536) != 0; + verified = (flags & 131072) != 0; + explicit_content = (flags & 262144) != 0; + id = stream.readInt32(exception); + if ((flags & 1) != 0) { + access_hash = stream.readInt64(exception); + } + if ((flags & 2) != 0) { + first_name = stream.readString(exception); + } + if ((flags & 4) != 0) { + last_name = stream.readString(exception); + } + if ((flags & 8) != 0) { + username = stream.readString(exception); + } + if ((flags & 16) != 0) { + phone = stream.readString(exception); + } + if ((flags & 32) != 0) { + photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 64) != 0) { + status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 16384) != 0) { + bot_info_version = stream.readInt32(exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = self ? (flags | 1024) : (flags &~ 1024); - flags = contact ? (flags | 2048) : (flags &~ 2048); - flags = mutual_contact ? (flags | 4096) : (flags &~ 4096); - flags = deleted ? (flags | 8192) : (flags &~ 8192); - flags = bot ? (flags | 16384) : (flags &~ 16384); - flags = bot_chat_history ? (flags | 32768) : (flags &~ 32768); - flags = bot_nochats ? (flags | 65536) : (flags &~ 65536); - flags = verified ? (flags | 131072) : (flags &~ 131072); - flags = explicit_content ? (flags | 262144) : (flags &~ 262144); - stream.writeInt32(flags); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = self ? (flags | 1024) : (flags &~ 1024); + flags = contact ? (flags | 2048) : (flags &~ 2048); + flags = mutual_contact ? (flags | 4096) : (flags &~ 4096); + flags = deleted ? (flags | 8192) : (flags &~ 8192); + flags = bot ? (flags | 16384) : (flags &~ 16384); + flags = bot_chat_history ? (flags | 32768) : (flags &~ 32768); + flags = bot_nochats ? (flags | 65536) : (flags &~ 65536); + flags = verified ? (flags | 131072) : (flags &~ 131072); + flags = explicit_content ? (flags | 262144) : (flags &~ 262144); + stream.writeInt32(flags); stream.writeInt32((int) id); - if ((flags & 1) != 0) { - stream.writeInt64(access_hash); - } - if ((flags & 2) != 0) { - stream.writeString(first_name); - } - if ((flags & 4) != 0) { - stream.writeString(last_name); - } - if ((flags & 8) != 0) { - stream.writeString(username); - } - if ((flags & 16) != 0) { - stream.writeString(phone); - } - if ((flags & 32) != 0) { - photo.serializeToStream(stream); - } - if ((flags & 64) != 0) { - status.serializeToStream(stream); - } - if ((flags & 16384) != 0) { - stream.writeInt32(bot_info_version); - } - } - } + if ((flags & 1) != 0) { + stream.writeInt64(access_hash); + } + if ((flags & 2) != 0) { + stream.writeString(first_name); + } + if ((flags & 4) != 0) { + stream.writeString(last_name); + } + if ((flags & 8) != 0) { + stream.writeString(username); + } + if ((flags & 16) != 0) { + stream.writeString(phone); + } + if ((flags & 32) != 0) { + photo.serializeToStream(stream); + } + if ((flags & 64) != 0) { + status.serializeToStream(stream); + } + if ((flags & 16384) != 0) { + stream.writeInt32(bot_info_version); + } + } + } - public static class TL_userSelf_old2 extends TL_userSelf_old3 { - public static int constructor = 0x7007b451; + public static class TL_userSelf_old2 extends TL_userSelf_old3 { + public static int constructor = 0x7007b451; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - first_name = stream.readString(exception); - last_name = stream.readString(exception); - username = stream.readString(exception); - phone = stream.readString(exception); - photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); - inactive = stream.readBool(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + first_name = stream.readString(exception); + last_name = stream.readString(exception); + username = stream.readString(exception); + phone = stream.readString(exception); + photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); + inactive = stream.readBool(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); stream.writeInt32((int) id); - stream.writeString(first_name); - stream.writeString(last_name); - stream.writeString(username); - stream.writeString(phone); - photo.serializeToStream(stream); - status.serializeToStream(stream); - stream.writeBool(inactive); - } - } + stream.writeString(first_name); + stream.writeString(last_name); + stream.writeString(username); + stream.writeString(phone); + photo.serializeToStream(stream); + status.serializeToStream(stream); + stream.writeBool(inactive); + } + } public static abstract class RecentMeUrl extends TLObject { @@ -20529,124 +20867,124 @@ public class TLRPC { } } - public static class TL_messages_highScores extends TLObject { - public static int constructor = 0x9a3bfd99; + public static class TL_messages_highScores extends TLObject { + public static int constructor = 0x9a3bfd99; - public ArrayList scores = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); + public ArrayList scores = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); - public static TL_messages_highScores TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messages_highScores.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_highScores", constructor)); - } else { - return null; - } - } - TL_messages_highScores result = new TL_messages_highScores(); - result.readParams(stream, exception); - return result; - } + public static TL_messages_highScores TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_messages_highScores.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_messages_highScores", constructor)); + } else { + return null; + } + } + TL_messages_highScores result = new TL_messages_highScores(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_highScore object = TL_highScore.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - scores.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + TL_highScore object = TL_highScore.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + scores.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + users.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = scores.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - scores.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = scores.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + scores.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = users.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + users.get(a).serializeToStream(stream); + } + } + } - public static class TL_phone_phoneCall extends TLObject { - public static int constructor = 0xec82e140; + public static class TL_phone_phoneCall extends TLObject { + public static int constructor = 0xec82e140; - public PhoneCall phone_call; - public ArrayList users = new ArrayList<>(); + public PhoneCall phone_call; + public ArrayList users = new ArrayList<>(); - public static TL_phone_phoneCall TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_phone_phoneCall.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_phone_phoneCall", constructor)); - } else { - return null; - } - } - TL_phone_phoneCall result = new TL_phone_phoneCall(); - result.readParams(stream, exception); - return result; - } + public static TL_phone_phoneCall TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_phone_phoneCall.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_phone_phoneCall", constructor)); + } else { + return null; + } + } + TL_phone_phoneCall result = new TL_phone_phoneCall(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - phone_call = PhoneCall.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + phone_call = PhoneCall.TLdeserialize(stream, stream.readInt32(exception), exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + users.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - phone_call.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + phone_call.serializeToStream(stream); + stream.writeInt32(0x1cb5c415); + int count = users.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + users.get(a).serializeToStream(stream); + } + } + } public static abstract class ChannelParticipantsFilter extends TLObject { @@ -20801,45 +21139,45 @@ public class TLRPC { } } - public static abstract class MessageAction extends TLObject { - public String title; - public String address; - public DecryptedMessageAction encryptedAction; - public String message; - public ArrayList users = new ArrayList<>(); - public TL_inputGroupCall call; - public long channel_id; - public Photo photo; - public long chat_id; - public long user_id; - public UserProfilePhoto newUserPhoto; - public long inviter_id; - public int ttl; - public int flags; - public long call_id; - public PhoneCallDiscardReason reason; - public int duration; - public String currency; - public long total_amount; - public long game_id; - public int score; - public boolean video; + public static abstract class MessageAction extends TLObject { + public String title; + public String address; + public DecryptedMessageAction encryptedAction; + public String message; + public ArrayList users = new ArrayList<>(); + public TL_inputGroupCall call; + public long channel_id; + public Photo photo; + public long chat_id; + public long user_id; + public UserProfilePhoto newUserPhoto; + public long inviter_id; + public int ttl; + public int flags; + public long call_id; + public PhoneCallDiscardReason reason; + public int duration; + public String currency; + public long total_amount; + public long game_id; + public int score; + public boolean video; - public static MessageAction TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - MessageAction result = null; - switch (constructor) { - case 0x555555F5: - result = new TL_messageActionLoginUnknownLocation(); - break; - case 0x555555F7: - result = new TL_messageEncryptedAction(); - break; - case 0xfae69f56: - result = new TL_messageActionCustomAction(); - break; - case 0xa6638b9a: - result = new TL_messageActionChatCreate_layer131(); - break; + public static MessageAction TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + MessageAction result = null; + switch (constructor) { + case 0x555555F5: + result = new TL_messageActionLoginUnknownLocation(); + break; + case 0x555555F7: + result = new TL_messageEncryptedAction(); + break; + case 0xfae69f56: + result = new TL_messageActionCustomAction(); + break; + case 0xa6638b9a: + result = new TL_messageActionChatCreate_layer131(); + break; case 0xbd47cbad: result = new TL_messageActionChatCreate(); break; @@ -20852,165 +21190,165 @@ public class TLRPC { case 0xa43f30cc: result = new TL_messageActionChatDeleteUser(); break; - case 0x51bdb021: - result = new TL_messageActionChatMigrateTo_layer131(); - break; + case 0x51bdb021: + result = new TL_messageActionChatMigrateTo_layer131(); + break; case 0xe1037f92: result = new TL_messageActionChatMigrateTo(); break; case 0xea3948e9: result = new TL_messageActionChannelMigrateFrom(); break; - case 0x7a0d7f42: - result = new TL_messageActionGroupCall(); - break; + case 0x7a0d7f42: + result = new TL_messageActionGroupCall(); + break; case 0xaa786345: result = new TL_messageActionSetChatTheme(); break; - case 0x4792929b: - result = new TL_messageActionScreenshotTaken(); - break; + case 0x4792929b: + result = new TL_messageActionScreenshotTaken(); + break; case 0x1baa035: result = new TL_messageActionPhoneNumberRequest(); break; case 0xebbca3cb: result = new TL_messageActionChatJoinedByRequest(); break; - case 0x9fbab604: - result = new TL_messageActionHistoryClear(); - break; - case 0x7fcb13a8: - result = new TL_messageActionChatEditPhoto(); - break; + case 0x9fbab604: + result = new TL_messageActionHistoryClear(); + break; + case 0x7fcb13a8: + result = new TL_messageActionChatEditPhoto(); + break; case 0x31224c3: result = new TL_messageActionChatJoinedByLink(); break; - case 0xb055eaee: - result = new TL_messageActionChannelMigrateFrom_layer131(); - break; - case 0x488a7337: - result = new TL_messageActionChatAddUser_layer131(); - break; - case 0xb2ae9b0c: - result = new TL_messageActionChatDeleteUser_layer131(); - break; - case 0x55555557: - result = new TL_messageActionCreatedBroadcastList(); - break; - case 0x55555550: - result = new TL_messageActionUserJoined(); - break; - case 0x55555551: - result = new TL_messageActionUserUpdatedPhoto(); - break; - case 0x5e3cfc4b: - result = new TL_messageActionChatAddUser_old(); - break; - case 0x55555552: - result = new TL_messageActionTTLChange(); - break; + case 0xb055eaee: + result = new TL_messageActionChannelMigrateFrom_layer131(); + break; + case 0x488a7337: + result = new TL_messageActionChatAddUser_layer131(); + break; + case 0xb2ae9b0c: + result = new TL_messageActionChatDeleteUser_layer131(); + break; + case 0x55555557: + result = new TL_messageActionCreatedBroadcastList(); + break; + case 0x55555550: + result = new TL_messageActionUserJoined(); + break; + case 0x55555551: + result = new TL_messageActionUserUpdatedPhoto(); + break; + case 0x5e3cfc4b: + result = new TL_messageActionChatAddUser_old(); + break; + case 0x55555552: + result = new TL_messageActionTTLChange(); + break; case 0xaa1afbfd: result = new TL_messageActionSetMessagesTTL(); break; case 0xd95c6154: result = new TL_messageActionSecureValuesSent(); break; - case 0xf89cf5e8: - result = new TL_messageActionChatJoinedByLink_layer131(); - break; + case 0xf89cf5e8: + result = new TL_messageActionChatJoinedByLink_layer131(); + break; case 0xf3f25f76: result = new TL_messageActionContactSignUp(); break; - case 0x95d2ac92: - result = new TL_messageActionChannelCreate(); - break; - case 0x94bd38ed: - result = new TL_messageActionPinMessage(); - break; + case 0x95d2ac92: + result = new TL_messageActionChannelCreate(); + break; + case 0x94bd38ed: + result = new TL_messageActionPinMessage(); + break; case 0x98e0d697: result = new TL_messageActionGeoProximityReached(); break; - case 0x95e3fbef: - result = new TL_messageActionChatDeletePhoto(); - break; + case 0x95e3fbef: + result = new TL_messageActionChatDeletePhoto(); + break; case 0x76b9f11a: result = new TL_messageActionInviteToGroupCall_layer131(); break; - case 0x80e11a7f: - result = new TL_messageActionPhoneCall(); - break; - case 0xb5a1ce5a: - result = new TL_messageActionChatEditTitle(); - break; - case 0xabe9affe: - result = new TL_messageActionBotAllowed(); - break; - case 0x40699cd0: - result = new TL_messageActionPaymentSent(); - break; - case 0xb6aef7b0: - result = new TL_messageActionEmpty(); - break; - case 0x92a72876: - result = new TL_messageActionGameScore(); - break; + case 0x80e11a7f: + result = new TL_messageActionPhoneCall(); + break; + case 0xb5a1ce5a: + result = new TL_messageActionChatEditTitle(); + break; + case 0xabe9affe: + result = new TL_messageActionBotAllowed(); + break; + case 0x40699cd0: + result = new TL_messageActionPaymentSent(); + break; + case 0xb6aef7b0: + result = new TL_messageActionEmpty(); + break; + case 0x92a72876: + result = new TL_messageActionGameScore(); + break; case 0xb3a07661: result = new TL_messageActionGroupCallScheduled(); break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in MessageAction", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in MessageAction", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_messageActionLoginUnknownLocation extends MessageAction { - public static int constructor = 0x555555F5; + public static class TL_messageActionLoginUnknownLocation extends MessageAction { + public static int constructor = 0x555555F5; - public void readParams(AbstractSerializedData stream, boolean exception) { - title = stream.readString(exception); - address = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + title = stream.readString(exception); + address = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(title); - stream.writeString(address); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(title); + stream.writeString(address); + } + } - public static class TL_messageEncryptedAction extends MessageAction { - public static int constructor = 0x555555F7; + public static class TL_messageEncryptedAction extends MessageAction { + public static int constructor = 0x555555F7; - public void readParams(AbstractSerializedData stream, boolean exception) { - encryptedAction = DecryptedMessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + encryptedAction = DecryptedMessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - encryptedAction.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + encryptedAction.serializeToStream(stream); + } + } - public static class TL_messageActionCustomAction extends MessageAction { - public static int constructor = 0xfae69f56; + public static class TL_messageActionCustomAction extends MessageAction { + public static int constructor = 0xfae69f56; - public void readParams(AbstractSerializedData stream, boolean exception) { - message = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + message = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(message); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(message); + } + } public static class TL_messageActionChatCreate extends MessageAction { public static int constructor = 0xbd47cbad; @@ -21043,36 +21381,36 @@ public class TLRPC { } } - public static class TL_messageActionChatCreate_layer131 extends TL_messageActionChatCreate { - public static int constructor = 0xa6638b9a; + public static class TL_messageActionChatCreate_layer131 extends TL_messageActionChatCreate { + public static int constructor = 0xa6638b9a; - public void readParams(AbstractSerializedData stream, boolean exception) { - title = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - users.add((long) stream.readInt32(exception)); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + title = stream.readString(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + users.add((long) stream.readInt32(exception)); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(title); - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32((int) (long) users.get(a)); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(title); + stream.writeInt32(0x1cb5c415); + int count = users.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeInt32((int) (long) users.get(a)); + } + } + } public static class TL_messageActionInviteToGroupCall extends MessageAction { public static int constructor = 0x502f92f7; @@ -21223,51 +21561,51 @@ public class TLRPC { } } - public static class TL_messageActionChatMigrateTo_layer131 extends TL_messageActionChatMigrateTo { - public static int constructor = 0x51bdb021; + public static class TL_messageActionChatMigrateTo_layer131 extends TL_messageActionChatMigrateTo { + public static int constructor = 0x51bdb021; - public void readParams(AbstractSerializedData stream, boolean exception) { - channel_id = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + channel_id = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32((int) channel_id); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32((int) channel_id); + } + } - public static class TL_messageActionHistoryClear extends MessageAction { - public static int constructor = 0x9fbab604; + public static class TL_messageActionHistoryClear extends MessageAction { + public static int constructor = 0x9fbab604; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_messageActionChatEditPhoto extends MessageAction { - public static int constructor = 0x7fcb13a8; + public static class TL_messageActionChatEditPhoto extends MessageAction { + public static int constructor = 0x7fcb13a8; - public void readParams(AbstractSerializedData stream, boolean exception) { - photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - photo.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + photo.serializeToStream(stream); + } + } - public static class TL_messageActionScreenshotTaken extends MessageAction { - public static int constructor = 0x4792929b; + public static class TL_messageActionScreenshotTaken extends MessageAction { + public static int constructor = 0x4792929b; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_messageActionPhoneNumberRequest extends MessageAction { public static int constructor = 0x1baa035; @@ -21315,73 +21653,73 @@ public class TLRPC { } } - public static class TL_messageActionChannelMigrateFrom_layer131 extends TL_messageActionChannelMigrateFrom { - public static int constructor = 0xb055eaee; + public static class TL_messageActionChannelMigrateFrom_layer131 extends TL_messageActionChannelMigrateFrom { + public static int constructor = 0xb055eaee; - public void readParams(AbstractSerializedData stream, boolean exception) { - title = stream.readString(exception); - chat_id = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + title = stream.readString(exception); + chat_id = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(title); - stream.writeInt32((int) chat_id); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(title); + stream.writeInt32((int) chat_id); + } + } - public static class TL_messageActionChatAddUser_layer131 extends TL_messageActionChatAddUser { - public static int constructor = 0x488a7337; + public static class TL_messageActionChatAddUser_layer131 extends TL_messageActionChatAddUser { + public static int constructor = 0x488a7337; - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - users.add((long) stream.readInt32(exception)); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + users.add((long) stream.readInt32(exception)); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32((int) (long) users.get(a)); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = users.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeInt32((int) (long) users.get(a)); + } + } + } - public static class TL_messageActionChatDeleteUser_layer131 extends TL_messageActionChatDeleteUser { - public static int constructor = 0xb2ae9b0c; + public static class TL_messageActionChatDeleteUser_layer131 extends TL_messageActionChatDeleteUser { + public static int constructor = 0xb2ae9b0c; - public void readParams(AbstractSerializedData stream, boolean exception) { - user_id = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + user_id = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32((int) user_id); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32((int) user_id); + } + } - public static class TL_messageActionCreatedBroadcastList extends MessageAction { - public static int constructor = 0x55555557; + public static class TL_messageActionCreatedBroadcastList extends MessageAction { + public static int constructor = 0x55555557; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_messageActionInviteToGroupCall_layer131 extends TL_messageActionInviteToGroupCall { public static int constructor = 0x76b9f11a; @@ -21414,28 +21752,28 @@ public class TLRPC { } } - public static class TL_messageActionUserJoined extends MessageAction { - public static int constructor = 0x55555550; + public static class TL_messageActionUserJoined extends MessageAction { + public static int constructor = 0x55555550; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_messageActionUserUpdatedPhoto extends MessageAction { - public static int constructor = 0x55555551; + public static class TL_messageActionUserUpdatedPhoto extends MessageAction { + public static int constructor = 0x55555551; - public void readParams(AbstractSerializedData stream, boolean exception) { - newUserPhoto = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + newUserPhoto = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - newUserPhoto.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + newUserPhoto.serializeToStream(stream); + } + } public static class TL_messageActionContactSignUp extends MessageAction { public static int constructor = 0xf3f25f76; @@ -21446,33 +21784,33 @@ public class TLRPC { } } - public static class TL_messageActionChatAddUser_old extends TL_messageActionChatAddUser { - public static int constructor = 0x5e3cfc4b; + public static class TL_messageActionChatAddUser_old extends TL_messageActionChatAddUser { + public static int constructor = 0x5e3cfc4b; - public void readParams(AbstractSerializedData stream, boolean exception) { - user_id = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + user_id = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32((int) user_id); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32((int) user_id); + } + } - public static class TL_messageActionTTLChange extends MessageAction { - public static int constructor = 0x55555552; + public static class TL_messageActionTTLChange extends MessageAction { + public static int constructor = 0x55555552; - public void readParams(AbstractSerializedData stream, boolean exception) { - ttl = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + ttl = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(ttl); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(ttl); + } + } public static class TL_messageActionSetMessagesTTL extends MessageAction { public static int constructor = 0xaa1afbfd; @@ -21489,33 +21827,33 @@ public class TLRPC { } } - public static class TL_messageActionChatJoinedByLink_layer131 extends TL_messageActionChatJoinedByLink { - public static int constructor = 0xf89cf5e8; + public static class TL_messageActionChatJoinedByLink_layer131 extends TL_messageActionChatJoinedByLink { + public static int constructor = 0xf89cf5e8; - public void readParams(AbstractSerializedData stream, boolean exception) { - inviter_id = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + inviter_id = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32((int) inviter_id); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32((int) inviter_id); + } + } - public static class TL_messageActionChannelCreate extends MessageAction { - public static int constructor = 0x95d2ac92; + public static class TL_messageActionChannelCreate extends MessageAction { + public static int constructor = 0x95d2ac92; - public void readParams(AbstractSerializedData stream, boolean exception) { - title = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + title = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(title); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(title); + } + } public static class TL_messageActionSecureValuesSent extends MessageAction { public static int constructor = 0xd95c6154; @@ -21551,14 +21889,14 @@ public class TLRPC { } } - public static class TL_messageActionPinMessage extends MessageAction { - public static int constructor = 0x94bd38ed; + public static class TL_messageActionPinMessage extends MessageAction { + public static int constructor = 0x94bd38ed; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_messageActionGeoProximityReached extends MessageAction { public static int constructor = 0x98e0d697; @@ -21581,14 +21919,14 @@ public class TLRPC { } } - public static class TL_messageActionChatDeletePhoto extends MessageAction { - public static int constructor = 0x95e3fbef; + public static class TL_messageActionChatDeletePhoto extends MessageAction { + public static int constructor = 0x95e3fbef; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_messageActionPhoneCall extends MessageAction { public static int constructor = 0x80e11a7f; @@ -21620,75 +21958,75 @@ public class TLRPC { } } - public static class TL_messageActionChatEditTitle extends MessageAction { - public static int constructor = 0xb5a1ce5a; + public static class TL_messageActionChatEditTitle extends MessageAction { + public static int constructor = 0xb5a1ce5a; - public void readParams(AbstractSerializedData stream, boolean exception) { - title = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + title = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(title); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(title); + } + } - public static class TL_messageActionPaymentSent extends MessageAction { - public static int constructor = 0x40699cd0; + public static class TL_messageActionPaymentSent extends MessageAction { + public static int constructor = 0x40699cd0; - public void readParams(AbstractSerializedData stream, boolean exception) { - currency = stream.readString(exception); - total_amount = stream.readInt64(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + currency = stream.readString(exception); + total_amount = stream.readInt64(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(currency); - stream.writeInt64(total_amount); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(currency); + stream.writeInt64(total_amount); + } + } - public static class TL_messageActionBotAllowed extends MessageAction { - public static int constructor = 0xabe9affe; + public static class TL_messageActionBotAllowed extends MessageAction { + public static int constructor = 0xabe9affe; - public String domain; + public String domain; - public void readParams(AbstractSerializedData stream, boolean exception) { - domain = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + domain = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(domain); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(domain); + } + } - public static class TL_messageActionEmpty extends MessageAction { - public static int constructor = 0xb6aef7b0; + public static class TL_messageActionEmpty extends MessageAction { + public static int constructor = 0xb6aef7b0; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_messageActionGameScore extends MessageAction { - public static int constructor = 0x92a72876; + public static class TL_messageActionGameScore extends MessageAction { + public static int constructor = 0x92a72876; - public void readParams(AbstractSerializedData stream, boolean exception) { - game_id = stream.readInt64(exception); - score = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + game_id = stream.readInt64(exception); + score = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(game_id); - stream.writeInt32(score); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(game_id); + stream.writeInt32(score); + } + } public static class TL_messageActionGroupCallScheduled extends MessageAction { public static int constructor = 0xb3a07661; @@ -21819,309 +22157,309 @@ public class TLRPC { } } - public static class TL_messages_archivedStickers extends TLObject { - public static int constructor = 0x4fcba9c8; + public static class TL_messages_archivedStickers extends TLObject { + public static int constructor = 0x4fcba9c8; - public int count; - public ArrayList sets = new ArrayList<>(); + public int count; + public ArrayList sets = new ArrayList<>(); - public static TL_messages_archivedStickers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messages_archivedStickers.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_archivedStickers", constructor)); - } else { - return null; - } - } - TL_messages_archivedStickers result = new TL_messages_archivedStickers(); - result.readParams(stream, exception); - return result; - } + public static TL_messages_archivedStickers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_messages_archivedStickers.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_messages_archivedStickers", constructor)); + } else { + return null; + } + } + TL_messages_archivedStickers result = new TL_messages_archivedStickers(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - StickerSetCovered object = StickerSetCovered.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - sets.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + count = stream.readInt32(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + StickerSetCovered object = StickerSetCovered.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + sets.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = sets.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - sets.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(count); + stream.writeInt32(0x1cb5c415); + int count = sets.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + sets.get(a).serializeToStream(stream); + } + } + } - public static abstract class DecryptedMessage extends TLObject { - public long random_id; - public int ttl; - public String message; - public DecryptedMessageMedia media; - public DecryptedMessageAction action; - public byte[] random_bytes; - public int flags; - public ArrayList entities = new ArrayList<>(); - public String via_bot_name; - public long reply_to_random_id; - public long grouped_id; - public boolean silent; + public static abstract class DecryptedMessage extends TLObject { + public long random_id; + public int ttl; + public String message; + public DecryptedMessageMedia media; + public DecryptedMessageAction action; + public byte[] random_bytes; + public int flags; + public ArrayList entities = new ArrayList<>(); + public String via_bot_name; + public long reply_to_random_id; + public long grouped_id; + public boolean silent; - public static DecryptedMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - DecryptedMessage result = null; - switch (constructor) { - case 0x204d3878: - result = new TL_decryptedMessage_layer17(); - break; - case 0x73164160: - result = new TL_decryptedMessageService(); - break; - case 0xaa48327d: - result = new TL_decryptedMessageService_layer8(); - break; - case 0x1f814f1f: - result = new TL_decryptedMessage_layer8(); - break; - case 0x91cc4674: - result = new TL_decryptedMessage(); - break; - case 0x36b091de: - result = new TL_decryptedMessage_layer45(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in DecryptedMessage", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static DecryptedMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + DecryptedMessage result = null; + switch (constructor) { + case 0x204d3878: + result = new TL_decryptedMessage_layer17(); + break; + case 0x73164160: + result = new TL_decryptedMessageService(); + break; + case 0xaa48327d: + result = new TL_decryptedMessageService_layer8(); + break; + case 0x1f814f1f: + result = new TL_decryptedMessage_layer8(); + break; + case 0x91cc4674: + result = new TL_decryptedMessage(); + break; + case 0x36b091de: + result = new TL_decryptedMessage_layer45(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in DecryptedMessage", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_decryptedMessage_layer17 extends TL_decryptedMessage { - public static int constructor = 0x204d3878; + public static class TL_decryptedMessage_layer17 extends TL_decryptedMessage { + public static int constructor = 0x204d3878; - public void readParams(AbstractSerializedData stream, boolean exception) { - random_id = stream.readInt64(exception); - ttl = stream.readInt32(exception); - message = stream.readString(exception); - media = DecryptedMessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + random_id = stream.readInt64(exception); + ttl = stream.readInt32(exception); + message = stream.readString(exception); + media = DecryptedMessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(random_id); - stream.writeInt32(ttl); - stream.writeString(message); - media.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(random_id); + stream.writeInt32(ttl); + stream.writeString(message); + media.serializeToStream(stream); + } + } - public static class TL_decryptedMessageService extends DecryptedMessage { - public static int constructor = 0x73164160; + public static class TL_decryptedMessageService extends DecryptedMessage { + public static int constructor = 0x73164160; - public void readParams(AbstractSerializedData stream, boolean exception) { - random_id = stream.readInt64(exception); - action = DecryptedMessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + random_id = stream.readInt64(exception); + action = DecryptedMessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(random_id); - action.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(random_id); + action.serializeToStream(stream); + } + } - public static class TL_decryptedMessageService_layer8 extends TL_decryptedMessageService { - public static int constructor = 0xaa48327d; + public static class TL_decryptedMessageService_layer8 extends TL_decryptedMessageService { + public static int constructor = 0xaa48327d; - public void readParams(AbstractSerializedData stream, boolean exception) { - random_id = stream.readInt64(exception); - random_bytes = stream.readByteArray(exception); - action = DecryptedMessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + random_id = stream.readInt64(exception); + random_bytes = stream.readByteArray(exception); + action = DecryptedMessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(random_id); - stream.writeByteArray(random_bytes); - action.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(random_id); + stream.writeByteArray(random_bytes); + action.serializeToStream(stream); + } + } - public static class TL_decryptedMessage_layer8 extends TL_decryptedMessage { - public static int constructor = 0x1f814f1f; + public static class TL_decryptedMessage_layer8 extends TL_decryptedMessage { + public static int constructor = 0x1f814f1f; - public void readParams(AbstractSerializedData stream, boolean exception) { - random_id = stream.readInt64(exception); - random_bytes = stream.readByteArray(exception); - message = stream.readString(exception); - media = DecryptedMessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + random_id = stream.readInt64(exception); + random_bytes = stream.readByteArray(exception); + message = stream.readString(exception); + media = DecryptedMessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(random_id); - stream.writeByteArray(random_bytes); - stream.writeString(message); - media.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(random_id); + stream.writeByteArray(random_bytes); + stream.writeString(message); + media.serializeToStream(stream); + } + } - public static class TL_decryptedMessage extends DecryptedMessage { - public static int constructor = 0x91cc4674; + public static class TL_decryptedMessage extends DecryptedMessage { + public static int constructor = 0x91cc4674; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); silent = (flags & 32) != 0; - random_id = stream.readInt64(exception); - ttl = stream.readInt32(exception); - message = stream.readString(exception); - if ((flags & 512) != 0) { - media = DecryptedMessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - if ((flags & 2048) != 0) { - via_bot_name = stream.readString(exception); - } - if ((flags & 8) != 0) { - reply_to_random_id = stream.readInt64(exception); - } - if ((flags & 131072) != 0) { - grouped_id = stream.readInt64(exception); - } - } + random_id = stream.readInt64(exception); + ttl = stream.readInt32(exception); + message = stream.readString(exception); + if ((flags & 512) != 0) { + media = DecryptedMessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 128) != 0) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + entities.add(object); + } + } + if ((flags & 2048) != 0) { + via_bot_name = stream.readString(exception); + } + if ((flags & 8) != 0) { + reply_to_random_id = stream.readInt64(exception); + } + if ((flags & 131072) != 0) { + grouped_id = stream.readInt64(exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); flags = silent ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt64(random_id); - stream.writeInt32(ttl); - stream.writeString(message); - if ((flags & 512) != 0) { - media.serializeToStream(stream); - } - if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 2048) != 0) { - stream.writeString(via_bot_name); - } - if ((flags & 8) != 0) { - stream.writeInt64(reply_to_random_id); - } - if ((flags & 131072) != 0) { - stream.writeInt64(grouped_id); - } - } - } + stream.writeInt32(flags); + stream.writeInt64(random_id); + stream.writeInt32(ttl); + stream.writeString(message); + if ((flags & 512) != 0) { + media.serializeToStream(stream); + } + if ((flags & 128) != 0) { + stream.writeInt32(0x1cb5c415); + int count = entities.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + entities.get(a).serializeToStream(stream); + } + } + if ((flags & 2048) != 0) { + stream.writeString(via_bot_name); + } + if ((flags & 8) != 0) { + stream.writeInt64(reply_to_random_id); + } + if ((flags & 131072) != 0) { + stream.writeInt64(grouped_id); + } + } + } - public static class TL_decryptedMessage_layer45 extends TL_decryptedMessage { - public static int constructor = 0x36b091de; + public static class TL_decryptedMessage_layer45 extends TL_decryptedMessage { + public static int constructor = 0x36b091de; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - random_id = stream.readInt64(exception); - ttl = stream.readInt32(exception); - message = stream.readString(exception); - if ((flags & 512) != 0) { - media = DecryptedMessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - if ((flags & 2048) != 0) { - via_bot_name = stream.readString(exception); - } - if ((flags & 8) != 0) { - reply_to_random_id = stream.readInt64(exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + random_id = stream.readInt64(exception); + ttl = stream.readInt32(exception); + message = stream.readString(exception); + if ((flags & 512) != 0) { + media = DecryptedMessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 128) != 0) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + entities.add(object); + } + } + if ((flags & 2048) != 0) { + via_bot_name = stream.readString(exception); + } + if ((flags & 8) != 0) { + reply_to_random_id = stream.readInt64(exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeInt64(random_id); - stream.writeInt32(ttl); - stream.writeString(message); - if ((flags & 512) != 0) { - media.serializeToStream(stream); - } - if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 2048) != 0) { - stream.writeString(via_bot_name); - } - if ((flags & 8) != 0) { - stream.writeInt64(reply_to_random_id); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeInt64(random_id); + stream.writeInt32(ttl); + stream.writeString(message); + if ((flags & 512) != 0) { + media.serializeToStream(stream); + } + if ((flags & 128) != 0) { + stream.writeInt32(0x1cb5c415); + int count = entities.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + entities.get(a).serializeToStream(stream); + } + } + if ((flags & 2048) != 0) { + stream.writeString(via_bot_name); + } + if ((flags & 8) != 0) { + stream.writeInt64(reply_to_random_id); + } + } + } public static abstract class account_Themes extends TLObject { @@ -22365,68 +22703,70 @@ public class TLRPC { } } - public static class TL_inputWebDocument extends TLObject { - public static int constructor = 0x9bed434d; + public static class TL_inputWebDocument extends TLObject { + public static int constructor = 0x9bed434d; - public String url; - public int size; - public String mime_type; - public ArrayList attributes = new ArrayList<>(); + public String url; + public int size; + public String mime_type; + public ArrayList attributes = new ArrayList<>(); - public static TL_inputWebDocument TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_inputWebDocument.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_inputWebDocument", constructor)); - } else { - return null; - } - } - TL_inputWebDocument result = new TL_inputWebDocument(); - result.readParams(stream, exception); - return result; - } + public static TL_inputWebDocument TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_inputWebDocument.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_inputWebDocument", constructor)); + } else { + return null; + } + } + TL_inputWebDocument result = new TL_inputWebDocument(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - url = stream.readString(exception); - size = stream.readInt32(exception); - mime_type = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + url = stream.readString(exception); + size = stream.readInt32(exception); + mime_type = stream.readString(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + attributes.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(url); - stream.writeInt32(size); - stream.writeString(mime_type); - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(url); + stream.writeInt32(size); + stream.writeString(mime_type); + stream.writeInt32(0x1cb5c415); + int count = attributes.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + attributes.get(a).serializeToStream(stream); + } + } + } public static class TL_messageReactions extends TLObject { - public static int constructor = 0xb87a24d1; + public static int constructor = 0x87b6e36; public int flags; public boolean min; + public boolean can_see_list; public ArrayList results = new ArrayList<>(); + public ArrayList recent_reactons = new ArrayList<>(); public static TL_messageReactions TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { if (TL_messageReactions.constructor != constructor) { @@ -22444,6 +22784,7 @@ public class TLRPC { public void readParams(AbstractSerializedData stream, boolean exception) { flags = stream.readInt32(exception); min = (flags & 1) != 0; + can_see_list = (flags & 4) != 0; int magic = stream.readInt32(exception); if (magic != 0x1cb5c415) { if (exception) { @@ -22459,11 +22800,29 @@ public class TLRPC { } results.add(object); } + if ((flags & 2) != 0) { + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + TL_messageUserReaction object = TL_messageUserReaction.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + recent_reactons.add(object); + } + } } public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); flags = min ? (flags | 1) : (flags &~ 1); + flags = can_see_list ? (flags | 4) : (flags &~ 4); stream.writeInt32(flags); stream.writeInt32(0x1cb5c415); int count = results.size(); @@ -22471,242 +22830,250 @@ public class TLRPC { for (int a = 0; a < count; a++) { results.get(a).serializeToStream(stream); } + if ((flags & 2) != 0) { + stream.writeInt32(0x1cb5c415); + count = recent_reactons.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + recent_reactons.get(a).serializeToStream(stream); + } + } } } - public static abstract class Video extends TLObject { - public long id; - public long access_hash; - public long user_id; - public int date; - public int duration; - public int size; - public PhotoSize thumb; - public int dc_id; - public int w; - public int h; - public String mime_type; - public String caption; - public byte[] key; - public byte[] iv; + public static abstract class Video extends TLObject { + public long id; + public long access_hash; + public long user_id; + public int date; + public int duration; + public int size; + public PhotoSize thumb; + public int dc_id; + public int w; + public int h; + public String mime_type; + public String caption; + public byte[] key; + public byte[] iv; - public static Video TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - Video result = null; - switch (constructor) { - case 0xee9f4a4d: - result = new TL_video_old3(); - break; - case 0xf72887d3: - result = new TL_video_layer45(); - break; - case 0x55555553: - result = new TL_videoEncrypted(); - break; - case 0x5a04a49f: - result = new TL_video_old(); - break; - case 0x388fa391: - result = new TL_video_old2(); - break; - case 0xc10658a8: - result = new TL_videoEmpty_layer45(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in Video", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static Video TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + Video result = null; + switch (constructor) { + case 0xee9f4a4d: + result = new TL_video_old3(); + break; + case 0xf72887d3: + result = new TL_video_layer45(); + break; + case 0x55555553: + result = new TL_videoEncrypted(); + break; + case 0x5a04a49f: + result = new TL_video_old(); + break; + case 0x388fa391: + result = new TL_video_old2(); + break; + case 0xc10658a8: + result = new TL_videoEmpty_layer45(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in Video", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_video_old3 extends TL_video_layer45 { - public static int constructor = 0xee9f4a4d; + public static class TL_video_old3 extends TL_video_layer45 { + public static int constructor = 0xee9f4a4d; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - user_id = stream.readInt32(exception); - date = stream.readInt32(exception); - duration = stream.readInt32(exception); - size = stream.readInt32(exception); - thumb = PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception); - dc_id = stream.readInt32(exception); - w = stream.readInt32(exception); - h = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + user_id = stream.readInt32(exception); + date = stream.readInt32(exception); + duration = stream.readInt32(exception); + size = stream.readInt32(exception); + thumb = PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception); + dc_id = stream.readInt32(exception); + w = stream.readInt32(exception); + h = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32((int) user_id); - stream.writeInt32(date); - stream.writeInt32(duration); - stream.writeInt32(size); - thumb.serializeToStream(stream); - stream.writeInt32(dc_id); - stream.writeInt32(w); - stream.writeInt32(h); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32((int) user_id); + stream.writeInt32(date); + stream.writeInt32(duration); + stream.writeInt32(size); + thumb.serializeToStream(stream); + stream.writeInt32(dc_id); + stream.writeInt32(w); + stream.writeInt32(h); + } + } - public static class TL_video_layer45 extends Video { - public static int constructor = 0xf72887d3; + public static class TL_video_layer45 extends Video { + public static int constructor = 0xf72887d3; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - date = stream.readInt32(exception); - duration = stream.readInt32(exception); - mime_type = stream.readString(exception); - size = stream.readInt32(exception); - thumb = PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception); - dc_id = stream.readInt32(exception); - w = stream.readInt32(exception); - h = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + date = stream.readInt32(exception); + duration = stream.readInt32(exception); + mime_type = stream.readString(exception); + size = stream.readInt32(exception); + thumb = PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception); + dc_id = stream.readInt32(exception); + w = stream.readInt32(exception); + h = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(date); - stream.writeInt32(duration); - stream.writeString(mime_type); - stream.writeInt32(size); - thumb.serializeToStream(stream); - stream.writeInt32(dc_id); - stream.writeInt32(w); - stream.writeInt32(h); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32(date); + stream.writeInt32(duration); + stream.writeString(mime_type); + stream.writeInt32(size); + thumb.serializeToStream(stream); + stream.writeInt32(dc_id); + stream.writeInt32(w); + stream.writeInt32(h); + } + } - public static class TL_videoEncrypted extends TL_video_layer45 { - public static int constructor = 0x55555553; + public static class TL_videoEncrypted extends TL_video_layer45 { + public static int constructor = 0x55555553; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - user_id = stream.readInt32(exception); - date = stream.readInt32(exception); - caption = stream.readString(exception); - duration = stream.readInt32(exception); - size = stream.readInt32(exception); - thumb = PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception); - dc_id = stream.readInt32(exception); - w = stream.readInt32(exception); - h = stream.readInt32(exception); - key = stream.readByteArray(exception); - iv = stream.readByteArray(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + user_id = stream.readInt32(exception); + date = stream.readInt32(exception); + caption = stream.readString(exception); + duration = stream.readInt32(exception); + size = stream.readInt32(exception); + thumb = PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception); + dc_id = stream.readInt32(exception); + w = stream.readInt32(exception); + h = stream.readInt32(exception); + key = stream.readByteArray(exception); + iv = stream.readByteArray(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32((int) user_id); - stream.writeInt32(date); - stream.writeString(caption); - stream.writeInt32(duration); - stream.writeInt32(size); - thumb.serializeToStream(stream); - stream.writeInt32(dc_id); - stream.writeInt32(w); - stream.writeInt32(h); - stream.writeByteArray(key); - stream.writeByteArray(iv); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32((int) user_id); + stream.writeInt32(date); + stream.writeString(caption); + stream.writeInt32(duration); + stream.writeInt32(size); + thumb.serializeToStream(stream); + stream.writeInt32(dc_id); + stream.writeInt32(w); + stream.writeInt32(h); + stream.writeByteArray(key); + stream.writeByteArray(iv); + } + } - public static class TL_video_old extends TL_video_layer45 { - public static int constructor = 0x5a04a49f; + public static class TL_video_old extends TL_video_layer45 { + public static int constructor = 0x5a04a49f; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - user_id = stream.readInt32(exception); - date = stream.readInt32(exception); - caption = stream.readString(exception); - duration = stream.readInt32(exception); - size = stream.readInt32(exception); - thumb = PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception); - dc_id = stream.readInt32(exception); - w = stream.readInt32(exception); - h = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + user_id = stream.readInt32(exception); + date = stream.readInt32(exception); + caption = stream.readString(exception); + duration = stream.readInt32(exception); + size = stream.readInt32(exception); + thumb = PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception); + dc_id = stream.readInt32(exception); + w = stream.readInt32(exception); + h = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32((int) user_id); - stream.writeInt32(date); - stream.writeString(caption); - stream.writeInt32(duration); - stream.writeInt32(size); - thumb.serializeToStream(stream); - stream.writeInt32(dc_id); - stream.writeInt32(w); - stream.writeInt32(h); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32((int) user_id); + stream.writeInt32(date); + stream.writeString(caption); + stream.writeInt32(duration); + stream.writeInt32(size); + thumb.serializeToStream(stream); + stream.writeInt32(dc_id); + stream.writeInt32(w); + stream.writeInt32(h); + } + } - public static class TL_video_old2 extends TL_video_layer45 { - public static int constructor = 0x388fa391; + public static class TL_video_old2 extends TL_video_layer45 { + public static int constructor = 0x388fa391; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - user_id = stream.readInt32(exception); - date = stream.readInt32(exception); - caption = stream.readString(exception); - duration = stream.readInt32(exception); - mime_type = stream.readString(exception); - size = stream.readInt32(exception); - thumb = PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception); - dc_id = stream.readInt32(exception); - w = stream.readInt32(exception); - h = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + user_id = stream.readInt32(exception); + date = stream.readInt32(exception); + caption = stream.readString(exception); + duration = stream.readInt32(exception); + mime_type = stream.readString(exception); + size = stream.readInt32(exception); + thumb = PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception); + dc_id = stream.readInt32(exception); + w = stream.readInt32(exception); + h = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32((int) user_id); - stream.writeInt32(date); - stream.writeString(caption); - stream.writeInt32(duration); - stream.writeString(mime_type); - stream.writeInt32(size); - thumb.serializeToStream(stream); - stream.writeInt32(dc_id); - stream.writeInt32(w); - stream.writeInt32(h); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32((int) user_id); + stream.writeInt32(date); + stream.writeString(caption); + stream.writeInt32(duration); + stream.writeString(mime_type); + stream.writeInt32(size); + thumb.serializeToStream(stream); + stream.writeInt32(dc_id); + stream.writeInt32(w); + stream.writeInt32(h); + } + } - public static class TL_videoEmpty_layer45 extends Video { - public static int constructor = 0xc10658a8; + public static class TL_videoEmpty_layer45 extends Video { + public static int constructor = 0xc10658a8; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + } + } public static abstract class InputPaymentCredentials extends TLObject { @@ -22788,36 +23155,36 @@ public class TLRPC { } } - public static class TL_exportedMessageLink extends TLObject { - public static int constructor = 0x5dab1af4; + public static class TL_exportedMessageLink extends TLObject { + public static int constructor = 0x5dab1af4; - public String link; - public String html; + public String link; + public String html; - public static TL_exportedMessageLink TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_exportedMessageLink.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_exportedMessageLink", constructor)); - } else { - return null; - } - } - TL_exportedMessageLink result = new TL_exportedMessageLink(); - result.readParams(stream, exception); - return result; - } + public static TL_exportedMessageLink TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_exportedMessageLink.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_exportedMessageLink", constructor)); + } else { + return null; + } + } + TL_exportedMessageLink result = new TL_exportedMessageLink(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - link = stream.readString(exception); - html = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + link = stream.readString(exception); + html = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(link); - stream.writeString(html); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(link); + stream.writeString(html); + } + } public static class TL_groupCallParticipantVideo extends TLObject { public static int constructor = 0x67753ac8; @@ -23040,66 +23407,66 @@ public class TLRPC { } } - public static class TL_payments_validatedRequestedInfo extends TLObject { - public static int constructor = 0xd1451883; + public static class TL_payments_validatedRequestedInfo extends TLObject { + public static int constructor = 0xd1451883; - public int flags; - public String id; - public ArrayList shipping_options = new ArrayList<>(); + public int flags; + public String id; + public ArrayList shipping_options = new ArrayList<>(); - public static TL_payments_validatedRequestedInfo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_payments_validatedRequestedInfo.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_payments_validatedRequestedInfo", constructor)); - } else { - return null; - } - } - TL_payments_validatedRequestedInfo result = new TL_payments_validatedRequestedInfo(); - result.readParams(stream, exception); - return result; - } + public static TL_payments_validatedRequestedInfo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_payments_validatedRequestedInfo.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_payments_validatedRequestedInfo", constructor)); + } else { + return null; + } + } + TL_payments_validatedRequestedInfo result = new TL_payments_validatedRequestedInfo(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - if ((flags & 1) != 0) { - id = stream.readString(exception); - } - if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_shippingOption object = TL_shippingOption.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - shipping_options.add(object); - } - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + if ((flags & 1) != 0) { + id = stream.readString(exception); + } + if ((flags & 2) != 0) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + TL_shippingOption object = TL_shippingOption.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + shipping_options.add(object); + } + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - stream.writeString(id); - } - if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = shipping_options.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - shipping_options.get(a).serializeToStream(stream); - } - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + stream.writeString(id); + } + if ((flags & 2) != 0) { + stream.writeInt32(0x1cb5c415); + int count = shipping_options.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + shipping_options.get(a).serializeToStream(stream); + } + } + } + } public static class TL_jsonObjectValue extends TLObject { public static int constructor = 0xc0de1bd9; @@ -23204,111 +23571,111 @@ public class TLRPC { } } - public static class TL_shippingOption extends TLObject { - public static int constructor = 0xb6213cdf; + public static class TL_shippingOption extends TLObject { + public static int constructor = 0xb6213cdf; - public String id; - public String title; - public ArrayList prices = new ArrayList<>(); + public String id; + public String title; + public ArrayList prices = new ArrayList<>(); - public static TL_shippingOption TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_shippingOption.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_shippingOption", constructor)); - } else { - return null; - } - } - TL_shippingOption result = new TL_shippingOption(); - result.readParams(stream, exception); - return result; - } + public static TL_shippingOption TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_shippingOption.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_shippingOption", constructor)); + } else { + return null; + } + } + TL_shippingOption result = new TL_shippingOption(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readString(exception); - title = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_labeledPrice object = TL_labeledPrice.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - prices.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readString(exception); + title = stream.readString(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + TL_labeledPrice object = TL_labeledPrice.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + prices.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(id); - stream.writeString(title); - stream.writeInt32(0x1cb5c415); - int count = prices.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - prices.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(id); + stream.writeString(title); + stream.writeInt32(0x1cb5c415); + int count = prices.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + prices.get(a).serializeToStream(stream); + } + } + } - public static abstract class InputDocument extends TLObject { - public long id; - public long access_hash; - public byte[] file_reference; + public static abstract class InputDocument extends TLObject { + public long id; + public long access_hash; + public byte[] file_reference; - public static InputDocument TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - InputDocument result = null; - switch (constructor) { - case 0x72f0eaae: - result = new TL_inputDocumentEmpty(); - break; - case 0x1abfb575: - result = new TL_inputDocument(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in InputDocument", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static InputDocument TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + InputDocument result = null; + switch (constructor) { + case 0x72f0eaae: + result = new TL_inputDocumentEmpty(); + break; + case 0x1abfb575: + result = new TL_inputDocument(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in InputDocument", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_inputDocumentEmpty extends InputDocument { - public static int constructor = 0x72f0eaae; + public static class TL_inputDocumentEmpty extends InputDocument { + public static int constructor = 0x72f0eaae; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_inputDocument extends InputDocument { - public static int constructor = 0x1abfb575; + public static class TL_inputDocument extends InputDocument { + public static int constructor = 0x1abfb575; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - file_reference = stream.readByteArray(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + file_reference = stream.readByteArray(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeByteArray(file_reference); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeByteArray(file_reference); + } + } public static class TL_folderPeer extends TLObject { public static int constructor = 0xe9baa668; @@ -23430,177 +23797,177 @@ public class TLRPC { } } - public static abstract class SecureValueType extends TLObject { + public static abstract class SecureValueType extends TLObject { - public static SecureValueType TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - SecureValueType result = null; - switch (constructor) { - case 0xcbe31e26: - result = new TL_secureValueTypeAddress(); - break; - case 0x99e3806a: - result = new TL_secureValueTypePassportRegistration(); - break; - case 0xa0d0744b: - result = new TL_secureValueTypeIdentityCard(); - break; - case 0xfc36954e: - result = new TL_secureValueTypeUtilityBill(); - break; - case 0x89137c0d: - result = new TL_secureValueTypeBankStatement(); - break; - case 0x8e3ca7ee: - result = new TL_secureValueTypeEmail(); - break; - case 0x9d2a81e3: - result = new TL_secureValueTypePersonalDetails(); - break; - case 0xea02ec33: - result = new TL_secureValueTypeTemporaryRegistration(); - break; - case 0x3dac6a00: - result = new TL_secureValueTypePassport(); - break; - case 0x8b883488: - result = new TL_secureValueTypeRentalAgreement(); - break; - case 0x6e425c4: - result = new TL_secureValueTypeDriverLicense(); - break; - case 0xb320aadb: - result = new TL_secureValueTypePhone(); - break; - case 0x99a48f23: - result = new TL_secureValueTypeInternalPassport(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in SecureValueType", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static SecureValueType TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + SecureValueType result = null; + switch (constructor) { + case 0xcbe31e26: + result = new TL_secureValueTypeAddress(); + break; + case 0x99e3806a: + result = new TL_secureValueTypePassportRegistration(); + break; + case 0xa0d0744b: + result = new TL_secureValueTypeIdentityCard(); + break; + case 0xfc36954e: + result = new TL_secureValueTypeUtilityBill(); + break; + case 0x89137c0d: + result = new TL_secureValueTypeBankStatement(); + break; + case 0x8e3ca7ee: + result = new TL_secureValueTypeEmail(); + break; + case 0x9d2a81e3: + result = new TL_secureValueTypePersonalDetails(); + break; + case 0xea02ec33: + result = new TL_secureValueTypeTemporaryRegistration(); + break; + case 0x3dac6a00: + result = new TL_secureValueTypePassport(); + break; + case 0x8b883488: + result = new TL_secureValueTypeRentalAgreement(); + break; + case 0x6e425c4: + result = new TL_secureValueTypeDriverLicense(); + break; + case 0xb320aadb: + result = new TL_secureValueTypePhone(); + break; + case 0x99a48f23: + result = new TL_secureValueTypeInternalPassport(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in SecureValueType", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_secureValueTypeAddress extends SecureValueType { - public static int constructor = 0xcbe31e26; + public static class TL_secureValueTypeAddress extends SecureValueType { + public static int constructor = 0xcbe31e26; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_secureValueTypePassportRegistration extends SecureValueType { - public static int constructor = 0x99e3806a; + public static class TL_secureValueTypePassportRegistration extends SecureValueType { + public static int constructor = 0x99e3806a; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_secureValueTypeIdentityCard extends SecureValueType { - public static int constructor = 0xa0d0744b; + public static class TL_secureValueTypeIdentityCard extends SecureValueType { + public static int constructor = 0xa0d0744b; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_secureValueTypeUtilityBill extends SecureValueType { - public static int constructor = 0xfc36954e; + public static class TL_secureValueTypeUtilityBill extends SecureValueType { + public static int constructor = 0xfc36954e; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_secureValueTypeBankStatement extends SecureValueType { - public static int constructor = 0x89137c0d; + public static class TL_secureValueTypeBankStatement extends SecureValueType { + public static int constructor = 0x89137c0d; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_secureValueTypeEmail extends SecureValueType { - public static int constructor = 0x8e3ca7ee; + public static class TL_secureValueTypeEmail extends SecureValueType { + public static int constructor = 0x8e3ca7ee; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_secureValueTypePersonalDetails extends SecureValueType { - public static int constructor = 0x9d2a81e3; + public static class TL_secureValueTypePersonalDetails extends SecureValueType { + public static int constructor = 0x9d2a81e3; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_secureValueTypeTemporaryRegistration extends SecureValueType { - public static int constructor = 0xea02ec33; + public static class TL_secureValueTypeTemporaryRegistration extends SecureValueType { + public static int constructor = 0xea02ec33; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_secureValueTypePassport extends SecureValueType { - public static int constructor = 0x3dac6a00; + public static class TL_secureValueTypePassport extends SecureValueType { + public static int constructor = 0x3dac6a00; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_secureValueTypeRentalAgreement extends SecureValueType { - public static int constructor = 0x8b883488; + public static class TL_secureValueTypeRentalAgreement extends SecureValueType { + public static int constructor = 0x8b883488; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_secureValueTypeDriverLicense extends SecureValueType { - public static int constructor = 0x6e425c4; + public static class TL_secureValueTypeDriverLicense extends SecureValueType { + public static int constructor = 0x6e425c4; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_secureValueTypePhone extends SecureValueType { - public static int constructor = 0xb320aadb; + public static class TL_secureValueTypePhone extends SecureValueType { + public static int constructor = 0xb320aadb; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_secureValueTypeInternalPassport extends SecureValueType { - public static int constructor = 0x99a48f23; + public static class TL_secureValueTypeInternalPassport extends SecureValueType { + public static int constructor = 0x99a48f23; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_peerBlocked extends TLObject { public static int constructor = 0xe8fd8014; @@ -23633,230 +24000,230 @@ public class TLRPC { } } - public static class TL_messages_affectedHistory extends TLObject { + public static class TL_messages_affectedHistory extends TLObject { public static int constructor = 0xb45c69d1; - public int pts; - public int pts_count; - public int offset; + public int pts; + public int pts_count; + public int offset; - public static TL_messages_affectedHistory TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messages_affectedHistory.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_affectedHistory", constructor)); - } else { - return null; - } - } - TL_messages_affectedHistory result = new TL_messages_affectedHistory(); - result.readParams(stream, exception); - return result; + public static TL_messages_affectedHistory TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_messages_affectedHistory.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_messages_affectedHistory", constructor)); + } else { + return null; + } + } + TL_messages_affectedHistory result = new TL_messages_affectedHistory(); + result.readParams(stream, exception); + return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(AbstractSerializedData stream, boolean exception) { pts = stream.readInt32(exception); - pts_count = stream.readInt32(exception); - offset = stream.readInt32(exception); - } + pts_count = stream.readInt32(exception); + offset = stream.readInt32(exception); + } public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(pts); - stream.writeInt32(pts_count); - stream.writeInt32(offset); - } - } + stream.writeInt32(pts_count); + stream.writeInt32(offset); + } + } - public static abstract class Document extends TLObject { + public static abstract class Document extends TLObject { public int flags; - public long id; - public long access_hash; - public byte[] file_reference; - public long user_id; - public int date; - public String file_name; - public String mime_type; - public int size; + public long id; + public long access_hash; + public byte[] file_reference; + public long user_id; + public int date; + public String file_name; + public String mime_type; + public int size; public ArrayList thumbs = new ArrayList<>(); public ArrayList video_thumbs = new ArrayList<>(); - public int version; - public int dc_id; - public byte[] key; - public byte[] iv; - public ArrayList attributes = new ArrayList<>(); + public int version; + public int dc_id; + public byte[] key; + public byte[] iv; + public ArrayList attributes = new ArrayList<>(); - public static Document TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - Document result = null; - switch (constructor) { + public static Document TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + Document result = null; + switch (constructor) { case 0x9ba29cc1: result = new TL_document_layer113(); break; - case 0x59534e4c: - result = new TL_document_layer92(); - break; - case 0x87232bc7: - result = new TL_document_layer82(); - break; - case 0x55555556: - result = new TL_documentEncrypted_old(); - break; + case 0x59534e4c: + result = new TL_document_layer92(); + break; + case 0x87232bc7: + result = new TL_document_layer82(); + break; + case 0x55555556: + result = new TL_documentEncrypted_old(); + break; case 0x1e87342b: result = new TL_document(); break; - case 0x9efc6326: - result = new TL_document_old(); - break; - case 0x36f8c871: - result = new TL_documentEmpty(); - break; - case 0x55555558: - result = new TL_documentEncrypted(); - break; - case 0xf9a39f4f: - result = new TL_document_layer53(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in Document", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + case 0x9efc6326: + result = new TL_document_old(); + break; + case 0x36f8c871: + result = new TL_documentEmpty(); + break; + case 0x55555558: + result = new TL_documentEncrypted(); + break; + case 0xf9a39f4f: + result = new TL_document_layer53(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in Document", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_document_layer92 extends TL_document { - public static int constructor = 0x59534e4c; + public static class TL_document_layer92 extends TL_document { + public static int constructor = 0x59534e4c; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - file_reference = stream.readByteArray(exception); - date = stream.readInt32(exception); - mime_type = stream.readString(exception); - size = stream.readInt32(exception); - thumbs.add(PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception)); - dc_id = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + file_reference = stream.readByteArray(exception); + date = stream.readInt32(exception); + mime_type = stream.readString(exception); + size = stream.readInt32(exception); + thumbs.add(PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception)); + dc_id = stream.readInt32(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + attributes.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeByteArray(file_reference); - stream.writeInt32(date); - stream.writeString(mime_type); - stream.writeInt32(size); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeByteArray(file_reference); + stream.writeInt32(date); + stream.writeString(mime_type); + stream.writeInt32(size); thumbs.get(0).serializeToStream(stream); - stream.writeInt32(dc_id); - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } - } - } + stream.writeInt32(dc_id); + stream.writeInt32(0x1cb5c415); + int count = attributes.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + attributes.get(a).serializeToStream(stream); + } + } + } - public static class TL_document_layer82 extends TL_document { - public static int constructor = 0x87232bc7; + public static class TL_document_layer82 extends TL_document { + public static int constructor = 0x87232bc7; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - date = stream.readInt32(exception); - mime_type = stream.readString(exception); - size = stream.readInt32(exception); - thumbs.add(PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception)); - dc_id = stream.readInt32(exception); - stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + date = stream.readInt32(exception); + mime_type = stream.readString(exception); + size = stream.readInt32(exception); + thumbs.add(PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception)); + dc_id = stream.readInt32(exception); + stream.readInt32(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + attributes.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(date); - stream.writeString(mime_type); - stream.writeInt32(size); - thumbs.get(0).serializeToStream(stream); - stream.writeInt32(dc_id); - stream.writeInt32(0); - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32(date); + stream.writeString(mime_type); + stream.writeInt32(size); + thumbs.get(0).serializeToStream(stream); + stream.writeInt32(dc_id); + stream.writeInt32(0); + stream.writeInt32(0x1cb5c415); + int count = attributes.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + attributes.get(a).serializeToStream(stream); + } + } + } - public static class TL_documentEncrypted_old extends TL_document { - public static int constructor = 0x55555556; + public static class TL_documentEncrypted_old extends TL_document { + public static int constructor = 0x55555556; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); user_id = stream.readInt32(exception); - date = stream.readInt32(exception); - file_name = stream.readString(exception); - mime_type = stream.readString(exception); - size = stream.readInt32(exception); - thumbs.add(PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception)); - dc_id = stream.readInt32(exception); + date = stream.readInt32(exception); + file_name = stream.readString(exception); + mime_type = stream.readString(exception); + size = stream.readInt32(exception); + thumbs.add(PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception)); + dc_id = stream.readInt32(exception); key = stream.readByteArray(exception); - iv = stream.readByteArray(exception); - } + iv = stream.readByteArray(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32((int) user_id); - stream.writeInt32(date); - stream.writeString(file_name); - stream.writeString(mime_type); - stream.writeInt32(size); - thumbs.get(0).serializeToStream(stream); - stream.writeInt32(dc_id); - stream.writeByteArray(key); - stream.writeByteArray(iv); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32((int) user_id); + stream.writeInt32(date); + stream.writeString(file_name); + stream.writeString(mime_type); + stream.writeInt32(size); + thumbs.get(0).serializeToStream(stream); + stream.writeInt32(dc_id); + stream.writeByteArray(key); + stream.writeByteArray(iv); + } + } public static class TL_document extends Document { public static int constructor = 0x1e87342b; @@ -24031,147 +24398,147 @@ public class TLRPC { } } - public static class TL_document_old extends TL_document { - public static int constructor = 0x9efc6326; + public static class TL_document_old extends TL_document { + public static int constructor = 0x9efc6326; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(AbstractSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); - user_id = stream.readInt32(exception); - date = stream.readInt32(exception); + user_id = stream.readInt32(exception); + date = stream.readInt32(exception); file_name = stream.readString(exception); - mime_type = stream.readString(exception); + mime_type = stream.readString(exception); size = stream.readInt32(exception); thumbs.add(PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception)); - dc_id = stream.readInt32(exception); - } + dc_id = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); stream.writeInt32((int) user_id); stream.writeInt32(date); - stream.writeString(file_name); + stream.writeString(file_name); stream.writeString(mime_type); stream.writeInt32(size); - thumbs.get(0).serializeToStream(stream); - stream.writeInt32(dc_id); - } - } + thumbs.get(0).serializeToStream(stream); + stream.writeInt32(dc_id); + } + } - public static class TL_documentEmpty extends Document { - public static int constructor = 0x36f8c871; + public static class TL_documentEmpty extends Document { + public static int constructor = 0x36f8c871; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + } public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - } - } + stream.writeInt32(constructor); + stream.writeInt64(id); + } + } - public static class TL_documentEncrypted extends Document { - public static int constructor = 0x55555558; + public static class TL_documentEncrypted extends Document { + public static int constructor = 0x55555558; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - date = stream.readInt32(exception); - mime_type = stream.readString(exception); - size = stream.readInt32(exception); - thumbs.add(PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception)); - dc_id = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); - } - key = stream.readByteArray(exception); - iv = stream.readByteArray(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + date = stream.readInt32(exception); + mime_type = stream.readString(exception); + size = stream.readInt32(exception); + thumbs.add(PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception)); + dc_id = stream.readInt32(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + attributes.add(object); + } + key = stream.readByteArray(exception); + iv = stream.readByteArray(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(date); - stream.writeString(mime_type); - stream.writeInt32(size); - thumbs.get(0).serializeToStream(stream); - stream.writeInt32(dc_id); - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } - stream.writeByteArray(key); - stream.writeByteArray(iv); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32(date); + stream.writeString(mime_type); + stream.writeInt32(size); + thumbs.get(0).serializeToStream(stream); + stream.writeInt32(dc_id); + stream.writeInt32(0x1cb5c415); + int count = attributes.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + attributes.get(a).serializeToStream(stream); + } + stream.writeByteArray(key); + stream.writeByteArray(iv); + } + } - public static class TL_document_layer53 extends TL_document { - public static int constructor = 0xf9a39f4f; + public static class TL_document_layer53 extends TL_document { + public static int constructor = 0xf9a39f4f; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - date = stream.readInt32(exception); - mime_type = stream.readString(exception); - size = stream.readInt32(exception); - thumbs.add(PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception)); - dc_id = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + date = stream.readInt32(exception); + mime_type = stream.readString(exception); + size = stream.readInt32(exception); + thumbs.add(PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception)); + dc_id = stream.readInt32(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + attributes.add(object); } } public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(id); + stream.writeInt64(id); stream.writeInt64(access_hash); - stream.writeInt32(date); + stream.writeInt32(date); stream.writeString(mime_type); - stream.writeInt32(size); + stream.writeInt32(size); thumbs.get(0).serializeToStream(stream); - stream.writeInt32(dc_id); + stream.writeInt32(dc_id); stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } - } - } + int count = attributes.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + attributes.get(a).serializeToStream(stream); + } + } + } public static abstract class PasswordKdfAlgo extends TLObject { @@ -24228,11 +24595,11 @@ public class TLRPC { } } - public static abstract class PageBlock extends TLObject { - public boolean first; //custom - public boolean bottom; //custom - public int level; //custom - public int mid; //custom + public static abstract class PageBlock extends TLObject { + public boolean first; //custom + public boolean bottom; //custom + public int level; //custom + public int mid; //custom public int groupId; //custom public PhotoSize thumb; //custom public TLObject thumbObject; //custom @@ -24366,171 +24733,171 @@ public class TLRPC { } return result; } - } + } - public static class TL_pageBlockOrderedList extends PageBlock { - public static int constructor = 0x9a8ae1e1; + public static class TL_pageBlockOrderedList extends PageBlock { + public static int constructor = 0x9a8ae1e1; - public ArrayList items = new ArrayList<>(); + public ArrayList items = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PageListOrderedItem object = PageListOrderedItem.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - items.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + PageListOrderedItem object = PageListOrderedItem.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + items.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = items.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - items.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = items.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + items.get(a).serializeToStream(stream); + } + } + } - public static class TL_pageBlockEmbedPost extends PageBlock { - public static int constructor = 0xf259a80b; + public static class TL_pageBlockEmbedPost extends PageBlock { + public static int constructor = 0xf259a80b; - public String url; - public long webpage_id; - public long author_photo_id; - public String author; - public int date; - public ArrayList blocks = new ArrayList<>(); - public TL_pageCaption caption; + public String url; + public long webpage_id; + public long author_photo_id; + public String author; + public int date; + public ArrayList blocks = new ArrayList<>(); + public TL_pageCaption caption; - public void readParams(AbstractSerializedData stream, boolean exception) { - url = stream.readString(exception); - webpage_id = stream.readInt64(exception); - author_photo_id = stream.readInt64(exception); - author = stream.readString(exception); - date = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - blocks.add(object); - } - caption = TL_pageCaption.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + url = stream.readString(exception); + webpage_id = stream.readInt64(exception); + author_photo_id = stream.readInt64(exception); + author = stream.readString(exception); + date = stream.readInt32(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + blocks.add(object); + } + caption = TL_pageCaption.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(url); - stream.writeInt64(webpage_id); - stream.writeInt64(author_photo_id); - stream.writeString(author); - stream.writeInt32(date); - stream.writeInt32(0x1cb5c415); - int count = blocks.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - blocks.get(a).serializeToStream(stream); - } - caption.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(url); + stream.writeInt64(webpage_id); + stream.writeInt64(author_photo_id); + stream.writeString(author); + stream.writeInt32(date); + stream.writeInt32(0x1cb5c415); + int count = blocks.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + blocks.get(a).serializeToStream(stream); + } + caption.serializeToStream(stream); + } + } - public static class TL_pageBlockParagraph extends PageBlock { - public static int constructor = 0x467a0766; + public static class TL_pageBlockParagraph extends PageBlock { + public static int constructor = 0x467a0766; - public RichText text; + public RichText text; - public void readParams(AbstractSerializedData stream, boolean exception) { - text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - text.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + text.serializeToStream(stream); + } + } - public static class TL_pageBlockKicker extends PageBlock { - public static int constructor = 0x1e148390; + public static class TL_pageBlockKicker extends PageBlock { + public static int constructor = 0x1e148390; - public RichText text; + public RichText text; - public void readParams(AbstractSerializedData stream, boolean exception) { - text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - text.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + text.serializeToStream(stream); + } + } - public static class TL_pageBlockFooter extends PageBlock { - public static int constructor = 0x48870999; + public static class TL_pageBlockFooter extends PageBlock { + public static int constructor = 0x48870999; - public RichText text; + public RichText text; - public void readParams(AbstractSerializedData stream, boolean exception) { - text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - text.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + text.serializeToStream(stream); + } + } - public static class TL_pageBlockHeader extends PageBlock { - public static int constructor = 0xbfd064ec; + public static class TL_pageBlockHeader extends PageBlock { + public static int constructor = 0xbfd064ec; - public RichText text; + public RichText text; - public void readParams(AbstractSerializedData stream, boolean exception) { - text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - text.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + text.serializeToStream(stream); + } + } - public static class TL_pageBlockPreformatted extends PageBlock { - public static int constructor = 0xc070d93e; + public static class TL_pageBlockPreformatted extends PageBlock { + public static int constructor = 0xc070d93e; - public RichText text; - public String language; + public RichText text; + public String language; - public void readParams(AbstractSerializedData stream, boolean exception) { - text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - language = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + language = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - text.serializeToStream(stream); - stream.writeString(language); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + text.serializeToStream(stream); + stream.writeString(language); + } + } public static class TL_pageBlockRelatedArticles extends PageBlock { public static int constructor = 0x16115a96; @@ -24569,72 +24936,72 @@ public class TLRPC { } } - public static class TL_pageBlockSubheader extends PageBlock { - public static int constructor = 0xf12bb6e1; + public static class TL_pageBlockSubheader extends PageBlock { + public static int constructor = 0xf12bb6e1; - public RichText text; + public RichText text; - public void readParams(AbstractSerializedData stream, boolean exception) { - text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - text.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + text.serializeToStream(stream); + } + } - public static class TL_pageBlockSlideshow extends PageBlock { - public static int constructor = 0x31f9590; + public static class TL_pageBlockSlideshow extends PageBlock { + public static int constructor = 0x31f9590; - public ArrayList items = new ArrayList<>(); - public TL_pageCaption caption; + public ArrayList items = new ArrayList<>(); + public TL_pageCaption caption; - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - items.add(object); - } - caption = TL_pageCaption.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + items.add(object); + } + caption = TL_pageCaption.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = items.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - items.get(a).serializeToStream(stream); - } - caption.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = items.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + items.get(a).serializeToStream(stream); + } + caption.serializeToStream(stream); + } + } - public static class TL_pageBlockAnchor extends PageBlock { - public static int constructor = 0xce0d37b0; + public static class TL_pageBlockAnchor extends PageBlock { + public static int constructor = 0xce0d37b0; - public String name; + public String name; - public void readParams(AbstractSerializedData stream, boolean exception) { - name = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + name = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(name); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(name); + } + } public static class TL_pageBlockMap extends PageBlock { public static int constructor = 0xa44f3ef6; @@ -24663,130 +25030,130 @@ public class TLRPC { } } - public static class TL_pageBlockDivider extends PageBlock { - public static int constructor = 0xdb20b188; + public static class TL_pageBlockDivider extends PageBlock { + public static int constructor = 0xdb20b188; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_pageBlockPhoto extends PageBlock { - public static int constructor = 0x1759c560; + public static class TL_pageBlockPhoto extends PageBlock { + public static int constructor = 0x1759c560; - public int flags; - public long photo_id; - public TL_pageCaption caption; - public String url; - public long webpage_id; + public int flags; + public long photo_id; + public TL_pageCaption caption; + public String url; + public long webpage_id; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - photo_id = stream.readInt64(exception); - caption = TL_pageCaption.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 1) != 0) { - url = stream.readString(exception); - } - if ((flags & 1) != 0) { - webpage_id = stream.readInt64(exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + photo_id = stream.readInt64(exception); + caption = TL_pageCaption.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 1) != 0) { + url = stream.readString(exception); + } + if ((flags & 1) != 0) { + webpage_id = stream.readInt64(exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeInt64(photo_id); - caption.serializeToStream(stream); - if ((flags & 1) != 0) { - stream.writeString(url); - } - if ((flags & 1) != 0) { - stream.writeInt64(webpage_id); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeInt64(photo_id); + caption.serializeToStream(stream); + if ((flags & 1) != 0) { + stream.writeString(url); + } + if ((flags & 1) != 0) { + stream.writeInt64(webpage_id); + } + } + } - public static class TL_pageBlockList extends PageBlock { - public static int constructor = 0xe4e88011; + public static class TL_pageBlockList extends PageBlock { + public static int constructor = 0xe4e88011; public boolean ordered; - public ArrayList items = new ArrayList<>(); + public ArrayList items = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PageListItem object = PageListItem.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - items.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + PageListItem object = PageListItem.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + items.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = items.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - items.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = items.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + items.get(a).serializeToStream(stream); + } + } + } - public static class TL_pageBlockUnsupported extends PageBlock { - public static int constructor = 0x13567e8a; + public static class TL_pageBlockUnsupported extends PageBlock { + public static int constructor = 0x13567e8a; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_pageBlockCollage extends PageBlock { - public static int constructor = 0x65a0fa4d; + public static class TL_pageBlockCollage extends PageBlock { + public static int constructor = 0x65a0fa4d; - public ArrayList items = new ArrayList<>(); - public TL_pageCaption caption; + public ArrayList items = new ArrayList<>(); + public TL_pageCaption caption; - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - items.add(object); - } - caption = TL_pageCaption.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + items.add(object); + } + caption = TL_pageCaption.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = items.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - items.get(a).serializeToStream(stream); - } - caption.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = items.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + items.get(a).serializeToStream(stream); + } + caption.serializeToStream(stream); + } + } public static class TL_pageBlockEmbed extends PageBlock { public static int constructor = 0xa8718dc5; @@ -24847,203 +25214,203 @@ public class TLRPC { } } - public static class TL_pageBlockSubtitle extends PageBlock { - public static int constructor = 0x8ffa9a1f; + public static class TL_pageBlockSubtitle extends PageBlock { + public static int constructor = 0x8ffa9a1f; - public RichText text; + public RichText text; - public void readParams(AbstractSerializedData stream, boolean exception) { - text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - text.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + text.serializeToStream(stream); + } + } - public static class TL_pageBlockBlockquote extends PageBlock { - public static int constructor = 0x263d7c26; + public static class TL_pageBlockBlockquote extends PageBlock { + public static int constructor = 0x263d7c26; - public RichText text; - public RichText caption; + public RichText text; + public RichText caption; - public void readParams(AbstractSerializedData stream, boolean exception) { - text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - caption = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + caption = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - text.serializeToStream(stream); - caption.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + text.serializeToStream(stream); + caption.serializeToStream(stream); + } + } - public static class TL_pageBlockDetails extends PageBlock { - public static int constructor = 0x76768bed; + public static class TL_pageBlockDetails extends PageBlock { + public static int constructor = 0x76768bed; - public int flags; - public boolean open; - public ArrayList blocks = new ArrayList<>(); - public RichText title; + public int flags; + public boolean open; + public ArrayList blocks = new ArrayList<>(); + public RichText title; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - open = (flags & 1) != 0; - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - blocks.add(object); - } - title = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + open = (flags & 1) != 0; + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + blocks.add(object); + } + title = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = open ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = blocks.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - blocks.get(a).serializeToStream(stream); - } - title.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = open ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + stream.writeInt32(0x1cb5c415); + int count = blocks.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + blocks.get(a).serializeToStream(stream); + } + title.serializeToStream(stream); + } + } - public static class TL_pageBlockChannel extends PageBlock { - public static int constructor = 0xef1751b5; + public static class TL_pageBlockChannel extends PageBlock { + public static int constructor = 0xef1751b5; - public Chat channel; + public Chat channel; - public void readParams(AbstractSerializedData stream, boolean exception) { - channel = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + channel = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - channel.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + channel.serializeToStream(stream); + } + } - public static class TL_pageBlockVideo extends PageBlock { - public static int constructor = 0x7c8fe7b6; + public static class TL_pageBlockVideo extends PageBlock { + public static int constructor = 0x7c8fe7b6; - public int flags; - public boolean autoplay; - public boolean loop; - public long video_id; - public TL_pageCaption caption; + public int flags; + public boolean autoplay; + public boolean loop; + public long video_id; + public TL_pageCaption caption; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - autoplay = (flags & 1) != 0; - loop = (flags & 2) != 0; - video_id = stream.readInt64(exception); - caption = TL_pageCaption.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + autoplay = (flags & 1) != 0; + loop = (flags & 2) != 0; + video_id = stream.readInt64(exception); + caption = TL_pageCaption.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = autoplay ? (flags | 1) : (flags &~ 1); - flags = loop ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - stream.writeInt64(video_id); - caption.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = autoplay ? (flags | 1) : (flags &~ 1); + flags = loop ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + stream.writeInt64(video_id); + caption.serializeToStream(stream); + } + } - public static class TL_pageBlockEmbed_layer60 extends TL_pageBlockEmbed { - public static int constructor = 0xd935d8fb; + public static class TL_pageBlockEmbed_layer60 extends TL_pageBlockEmbed { + public static int constructor = 0xd935d8fb; - public int flags; - public boolean full_width; - public boolean allow_scrolling; - public String url; - public String html; - public int w; - public int h; - public RichText caption; + public int flags; + public boolean full_width; + public boolean allow_scrolling; + public String url; + public String html; + public int w; + public int h; + public RichText caption; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - full_width = (flags & 1) != 0; - allow_scrolling = (flags & 8) != 0; - if ((flags & 2) != 0) { - url = stream.readString(exception); - } - if ((flags & 4) != 0) { - html = stream.readString(exception); - } - w = stream.readInt32(exception); - h = stream.readInt32(exception); - caption = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + full_width = (flags & 1) != 0; + allow_scrolling = (flags & 8) != 0; + if ((flags & 2) != 0) { + url = stream.readString(exception); + } + if ((flags & 4) != 0) { + html = stream.readString(exception); + } + w = stream.readInt32(exception); + h = stream.readInt32(exception); + caption = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = full_width ? (flags | 1) : (flags &~ 1); - flags = allow_scrolling ? (flags | 8) : (flags &~ 8); - stream.writeInt32(flags); - if ((flags & 2) != 0) { - stream.writeString(url); - } - if ((flags & 4) != 0) { - stream.writeString(html); - } - stream.writeInt32(w); - stream.writeInt32(h); - caption.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = full_width ? (flags | 1) : (flags &~ 1); + flags = allow_scrolling ? (flags | 8) : (flags &~ 8); + stream.writeInt32(flags); + if ((flags & 2) != 0) { + stream.writeString(url); + } + if ((flags & 4) != 0) { + stream.writeString(html); + } + stream.writeInt32(w); + stream.writeInt32(h); + caption.serializeToStream(stream); + } + } - public static class TL_pageBlockPullquote extends PageBlock { - public static int constructor = 0x4f4456d3; + public static class TL_pageBlockPullquote extends PageBlock { + public static int constructor = 0x4f4456d3; - public RichText text; - public RichText caption; + public RichText text; + public RichText caption; - public void readParams(AbstractSerializedData stream, boolean exception) { - text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - caption = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + caption = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - text.serializeToStream(stream); - caption.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + text.serializeToStream(stream); + caption.serializeToStream(stream); + } + } - public static class TL_pageBlockAudio extends PageBlock { - public static int constructor = 0x804361ea; + public static class TL_pageBlockAudio extends PageBlock { + public static int constructor = 0x804361ea; - public long audio_id; - public TL_pageCaption caption; + public long audio_id; + public TL_pageCaption caption; - public void readParams(AbstractSerializedData stream, boolean exception) { - audio_id = stream.readInt64(exception); - caption = TL_pageCaption.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + audio_id = stream.readInt64(exception); + caption = TL_pageCaption.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(audio_id); - caption.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(audio_id); + caption.serializeToStream(stream); + } + } public static class TL_pageBlockTable extends PageBlock { public static int constructor = 0xbf4dea82; @@ -25091,53 +25458,53 @@ public class TLRPC { } } - public static class TL_pageBlockTitle extends PageBlock { - public static int constructor = 0x70abc3fd; + public static class TL_pageBlockTitle extends PageBlock { + public static int constructor = 0x70abc3fd; - public RichText text; + public RichText text; - public void readParams(AbstractSerializedData stream, boolean exception) { - text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - text.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + text.serializeToStream(stream); + } + } public static class TL_pageBlockCover extends PageBlock { - public static int constructor = 0x39f23300; + public static int constructor = 0x39f23300; - public PageBlock cover; + public PageBlock cover; - public void readParams(AbstractSerializedData stream, boolean exception) { - cover = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + cover = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - cover.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + cover.serializeToStream(stream); + } + } - public static class TL_pageBlockAuthorDate extends PageBlock { - public static int constructor = 0xbaafe5e0; + public static class TL_pageBlockAuthorDate extends PageBlock { + public static int constructor = 0xbaafe5e0; - public RichText author; - public int published_date; + public RichText author; + public int published_date; - public void readParams(AbstractSerializedData stream, boolean exception) { - author = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - published_date = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + author = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + published_date = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - author.serializeToStream(stream); - stream.writeInt32(published_date); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + author.serializeToStream(stream); + stream.writeInt32(published_date); + } + } public static abstract class InputPrivacyRule extends TLObject { @@ -25343,42 +25710,42 @@ public class TLRPC { } } - public static class TL_maskCoords extends TLObject { - public static int constructor = 0xaed6dbb2; + public static class TL_maskCoords extends TLObject { + public static int constructor = 0xaed6dbb2; - public int n; - public double x; - public double y; - public double zoom; + public int n; + public double x; + public double y; + public double zoom; - public static TL_maskCoords TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_maskCoords.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_maskCoords", constructor)); - } else { - return null; - } - } - TL_maskCoords result = new TL_maskCoords(); - result.readParams(stream, exception); - return result; - } + public static TL_maskCoords TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_maskCoords.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_maskCoords", constructor)); + } else { + return null; + } + } + TL_maskCoords result = new TL_maskCoords(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - n = stream.readInt32(exception); - x = stream.readDouble(exception); - y = stream.readDouble(exception); - zoom = stream.readDouble(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + n = stream.readInt32(exception); + x = stream.readDouble(exception); + y = stream.readDouble(exception); + zoom = stream.readDouble(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(n); - stream.writeDouble(x); - stream.writeDouble(y); - stream.writeDouble(zoom); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(n); + stream.writeDouble(x); + stream.writeDouble(y); + stream.writeDouble(zoom); + } + } public static class TL_messages_votesList extends TLObject { public static int constructor = 0x823f649; @@ -25496,105 +25863,105 @@ public class TLRPC { } } - public static abstract class InputMedia extends TLObject { - public String phone_number; - public String first_name; - public String last_name; - public String vcard; - public int flags; - public int ttl_seconds; - public InputGeoPoint geo_point; - public InputFile file; - public ArrayList stickers = new ArrayList<>(); - public String title; - public String address; - public String provider; - public String venue_id; - public String venue_type; + public static abstract class InputMedia extends TLObject { + public String phone_number; + public String first_name; + public String last_name; + public String vcard; + public int flags; + public int ttl_seconds; + public InputGeoPoint geo_point; + public InputFile file; + public ArrayList stickers = new ArrayList<>(); + public String title; + public String address; + public String provider; + public String venue_id; + public String venue_type; public int heading; - public int period; - public boolean nosound_video; + public int period; + public boolean nosound_video; public boolean force_file; public boolean stopped; - public InputFile thumb; - public String mime_type; - public ArrayList attributes = new ArrayList<>(); - public int proximity_notification_radius; + public InputFile thumb; + public String mime_type; + public ArrayList attributes = new ArrayList<>(); + public int proximity_notification_radius; - public static InputMedia TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - InputMedia result = null; - switch (constructor) { - case 0xf8ab7dfb: - result = new TL_inputMediaContact(); - break; + public static InputMedia TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + InputMedia result = null; + switch (constructor) { + case 0xf8ab7dfb: + result = new TL_inputMediaContact(); + break; case 0x33473058: result = new TL_inputMediaDocument(); break; - case 0xd33f43f3: - result = new TL_inputMediaGame(); - break; + case 0xd33f43f3: + result = new TL_inputMediaGame(); + break; case 0xe66fbf7b: result = new TL_inputMediaDice(); break; - case 0xf9c44144: - result = new TL_inputMediaGeoPoint(); - break; - case 0xfb52dc99: - result = new TL_inputMediaDocumentExternal(); - break; - case 0x9664f57f: - result = new TL_inputMediaEmpty(); - break; + case 0xf9c44144: + result = new TL_inputMediaGeoPoint(); + break; + case 0xfb52dc99: + result = new TL_inputMediaDocumentExternal(); + break; + case 0x9664f57f: + result = new TL_inputMediaEmpty(); + break; case 0xf94e5f1: result = new TL_inputMediaPoll(); break; - case 0x1e287d04: - result = new TL_inputMediaUploadedPhoto(); - break; - case 0xc13d1c11: - result = new TL_inputMediaVenue(); - break; + case 0x1e287d04: + result = new TL_inputMediaUploadedPhoto(); + break; + case 0xc13d1c11: + result = new TL_inputMediaVenue(); + break; case 0x971fa843: result = new TL_inputMediaGeoLive(); break; - case 0x5b38c6c1: - result = new TL_inputMediaUploadedDocument(); - break; - case 0xe5bbfe1a: - result = new TL_inputMediaPhotoExternal(); - break; - case 0xb3ba0635: - result = new TL_inputMediaPhoto(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in InputMedia", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + case 0x5b38c6c1: + result = new TL_inputMediaUploadedDocument(); + break; + case 0xe5bbfe1a: + result = new TL_inputMediaPhotoExternal(); + break; + case 0xb3ba0635: + result = new TL_inputMediaPhoto(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in InputMedia", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_inputMediaContact extends InputMedia { - public static int constructor = 0xf8ab7dfb; + public static class TL_inputMediaContact extends InputMedia { + public static int constructor = 0xf8ab7dfb; - public void readParams(AbstractSerializedData stream, boolean exception) { - phone_number = stream.readString(exception); - first_name = stream.readString(exception); - last_name = stream.readString(exception); - vcard = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + phone_number = stream.readString(exception); + first_name = stream.readString(exception); + last_name = stream.readString(exception); + vcard = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(phone_number); - stream.writeString(first_name); - stream.writeString(last_name); - stream.writeString(vcard); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(phone_number); + stream.writeString(first_name); + stream.writeString(last_name); + stream.writeString(vcard); + } + } public static class TL_inputMediaDocument extends InputMedia { public static int constructor = 0x33473058; @@ -25626,20 +25993,20 @@ public class TLRPC { } } - public static class TL_inputMediaGame extends InputMedia { - public static int constructor = 0xd33f43f3; + public static class TL_inputMediaGame extends InputMedia { + public static int constructor = 0xd33f43f3; - public InputGame id; + public InputGame id; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = InputGame.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = InputGame.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - id.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + id.serializeToStream(stream); + } + } public static class TL_inputMediaDice extends InputMedia { public static int constructor = 0xe66fbf7b; @@ -25656,51 +26023,51 @@ public class TLRPC { } } - public static class TL_inputMediaGeoPoint extends InputMedia { - public static int constructor = 0xf9c44144; + public static class TL_inputMediaGeoPoint extends InputMedia { + public static int constructor = 0xf9c44144; - public void readParams(AbstractSerializedData stream, boolean exception) { - geo_point = InputGeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + geo_point = InputGeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - geo_point.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + geo_point.serializeToStream(stream); + } + } - public static class TL_inputMediaDocumentExternal extends InputMedia { - public static int constructor = 0xfb52dc99; + public static class TL_inputMediaDocumentExternal extends InputMedia { + public static int constructor = 0xfb52dc99; - public String url; + public String url; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - url = stream.readString(exception); - if ((flags & 1) != 0) { - ttl_seconds = stream.readInt32(exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + url = stream.readString(exception); + if ((flags & 1) != 0) { + ttl_seconds = stream.readInt32(exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeString(url); - if ((flags & 1) != 0) { - stream.writeInt32(ttl_seconds); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeString(url); + if ((flags & 1) != 0) { + stream.writeInt32(ttl_seconds); + } + } + } - public static class TL_inputMediaEmpty extends InputMedia { - public static int constructor = 0x9664f57f; + public static class TL_inputMediaEmpty extends InputMedia { + public static int constructor = 0x9664f57f; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_inputMediaPoll extends InputMedia { public static int constructor = 0xf94e5f1; @@ -25774,76 +26141,76 @@ public class TLRPC { } } - public static class TL_inputMediaUploadedPhoto extends InputMedia { - public static int constructor = 0x1e287d04; + public static class TL_inputMediaUploadedPhoto extends InputMedia { + public static int constructor = 0x1e287d04; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - file = InputFile.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InputDocument object = InputDocument.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - stickers.add(object); - } - } - if ((flags & 2) != 0) { - ttl_seconds = stream.readInt32(exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + file = InputFile.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 1) != 0) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + InputDocument object = InputDocument.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + stickers.add(object); + } + } + if ((flags & 2) != 0) { + ttl_seconds = stream.readInt32(exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - file.serializeToStream(stream); - if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = stickers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stickers.get(a).serializeToStream(stream); - } - } - if ((flags & 2) != 0) { - stream.writeInt32(ttl_seconds); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + file.serializeToStream(stream); + if ((flags & 1) != 0) { + stream.writeInt32(0x1cb5c415); + int count = stickers.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stickers.get(a).serializeToStream(stream); + } + } + if ((flags & 2) != 0) { + stream.writeInt32(ttl_seconds); + } + } + } - public static class TL_inputMediaVenue extends InputMedia { - public static int constructor = 0xc13d1c11; + public static class TL_inputMediaVenue extends InputMedia { + public static int constructor = 0xc13d1c11; - public void readParams(AbstractSerializedData stream, boolean exception) { - geo_point = InputGeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); - title = stream.readString(exception); - address = stream.readString(exception); - provider = stream.readString(exception); - venue_id = stream.readString(exception); - venue_type = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + geo_point = InputGeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); + title = stream.readString(exception); + address = stream.readString(exception); + provider = stream.readString(exception); + venue_id = stream.readString(exception); + venue_type = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - geo_point.serializeToStream(stream); - stream.writeString(title); - stream.writeString(address); - stream.writeString(provider); - stream.writeString(venue_id); - stream.writeString(venue_type); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + geo_point.serializeToStream(stream); + stream.writeString(title); + stream.writeString(address); + stream.writeString(provider); + stream.writeString(venue_id); + stream.writeString(venue_type); + } + } public static class TL_inputMediaGeoLive extends InputMedia { public static int constructor = 0x971fa843; @@ -25961,196 +26328,196 @@ public class TLRPC { } } - public static class TL_inputMediaPhotoExternal extends InputMedia { - public static int constructor = 0xe5bbfe1a; + public static class TL_inputMediaPhotoExternal extends InputMedia { + public static int constructor = 0xe5bbfe1a; - public String url; + public String url; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - url = stream.readString(exception); - if ((flags & 1) != 0) { - ttl_seconds = stream.readInt32(exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + url = stream.readString(exception); + if ((flags & 1) != 0) { + ttl_seconds = stream.readInt32(exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeString(url); - if ((flags & 1) != 0) { - stream.writeInt32(ttl_seconds); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeString(url); + if ((flags & 1) != 0) { + stream.writeInt32(ttl_seconds); + } + } + } - public static class TL_inputMediaPhoto extends InputMedia { - public static int constructor = 0xb3ba0635; + public static class TL_inputMediaPhoto extends InputMedia { + public static int constructor = 0xb3ba0635; - public InputPhoto id; + public InputPhoto id; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - id = InputPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 1) != 0) { - ttl_seconds = stream.readInt32(exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + id = InputPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 1) != 0) { + ttl_seconds = stream.readInt32(exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - id.serializeToStream(stream); - if ((flags & 1) != 0) { - stream.writeInt32(ttl_seconds); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + id.serializeToStream(stream); + if ((flags & 1) != 0) { + stream.writeInt32(ttl_seconds); + } + } + } - public static abstract class StickerSetCovered extends TLObject { - public StickerSet set; - public ArrayList covers = new ArrayList<>(); - public Document cover; + public static abstract class StickerSetCovered extends TLObject { + public StickerSet set; + public ArrayList covers = new ArrayList<>(); + public Document cover; - public static StickerSetCovered TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - StickerSetCovered result = null; - switch (constructor) { - case 0x3407e51b: - result = new TL_stickerSetMultiCovered(); - break; - case 0x6410a5d2: - result = new TL_stickerSetCovered(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in StickerSetCovered", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } - - public static class TL_stickerSetMultiCovered extends StickerSetCovered { - public static int constructor = 0x3407e51b; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - set = StickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - covers.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - set.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = covers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - covers.get(a).serializeToStream(stream); - } - } - } - - public static class TL_stickerSetCovered extends StickerSetCovered { - public static int constructor = 0x6410a5d2; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - set = StickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); - cover = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - set.serializeToStream(stream); - cover.serializeToStream(stream); - } - } - - public static abstract class EncryptedMessage extends TLObject { - public long random_id; - public int chat_id; - public int date; - public byte[] bytes; - public EncryptedFile file; - - public static EncryptedMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - EncryptedMessage result = null; - switch (constructor) { - case 0x23734b06: - result = new TL_encryptedMessageService(); - break; - case 0xed18c118: - result = new TL_encryptedMessage(); + public static StickerSetCovered TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + StickerSetCovered result = null; + switch (constructor) { + case 0x3407e51b: + result = new TL_stickerSetMultiCovered(); + break; + case 0x6410a5d2: + result = new TL_stickerSetCovered(); break; } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in EncryptedMessage", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in StickerSetCovered", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_encryptedMessageService extends EncryptedMessage { - public static int constructor = 0x23734b06; + public static class TL_stickerSetMultiCovered extends StickerSetCovered { + public static int constructor = 0x3407e51b; - public void readParams(AbstractSerializedData stream, boolean exception) { - random_id = stream.readInt64(exception); - chat_id = stream.readInt32(exception); - date = stream.readInt32(exception); - bytes = stream.readByteArray(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + set = StickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + covers.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(random_id); - stream.writeInt32(chat_id); - stream.writeInt32(date); - stream.writeByteArray(bytes); - } - } - - public static class TL_encryptedMessage extends EncryptedMessage { - public static int constructor = 0xed18c118; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - random_id = stream.readInt64(exception); - chat_id = stream.readInt32(exception); - date = stream.readInt32(exception); - bytes = stream.readByteArray(exception); - file = EncryptedFile.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(random_id); + set.serializeToStream(stream); + stream.writeInt32(0x1cb5c415); + int count = covers.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + covers.get(a).serializeToStream(stream); + } + } + } + + public static class TL_stickerSetCovered extends StickerSetCovered { + public static int constructor = 0x6410a5d2; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + set = StickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); + cover = Document.TLdeserialize(stream, stream.readInt32(exception), exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + set.serializeToStream(stream); + cover.serializeToStream(stream); + } + } + + public static abstract class EncryptedMessage extends TLObject { + public long random_id; + public int chat_id; + public int date; + public byte[] bytes; + public EncryptedFile file; + + public static EncryptedMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + EncryptedMessage result = null; + switch (constructor) { + case 0x23734b06: + result = new TL_encryptedMessageService(); + break; + case 0xed18c118: + result = new TL_encryptedMessage(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in EncryptedMessage", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } + + public static class TL_encryptedMessageService extends EncryptedMessage { + public static int constructor = 0x23734b06; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + random_id = stream.readInt64(exception); + chat_id = stream.readInt32(exception); + date = stream.readInt32(exception); + bytes = stream.readByteArray(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(random_id); stream.writeInt32(chat_id); stream.writeInt32(date); - stream.writeByteArray(bytes); - file.serializeToStream(stream); - } - } + stream.writeByteArray(bytes); + } + } + + public static class TL_encryptedMessage extends EncryptedMessage { + public static int constructor = 0xed18c118; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + random_id = stream.readInt64(exception); + chat_id = stream.readInt32(exception); + date = stream.readInt32(exception); + bytes = stream.readByteArray(exception); + file = EncryptedFile.TLdeserialize(stream, stream.readInt32(exception), exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(random_id); + stream.writeInt32(chat_id); + stream.writeInt32(date); + stream.writeByteArray(bytes); + file.serializeToStream(stream); + } + } public static abstract class InputStickerSet extends TLObject { @@ -26326,104 +26693,104 @@ public class TLRPC { } } - public static abstract class UserStatus extends TLObject { - public int expires; + public static abstract class UserStatus extends TLObject { + public int expires; - public static UserStatus TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - UserStatus result = null; - switch (constructor) { - case 0x8c703f: - result = new TL_userStatusOffline(); - break; - case 0x7bf09fc: - result = new TL_userStatusLastWeek(); - break; - case 0x9d05049: - result = new TL_userStatusEmpty(); - break; - case 0x77ebc742: - result = new TL_userStatusLastMonth(); - break; - case 0xedb93949: - result = new TL_userStatusOnline(); - break; - case 0xe26f42f1: - result = new TL_userStatusRecently(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in UserStatus", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static UserStatus TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + UserStatus result = null; + switch (constructor) { + case 0x8c703f: + result = new TL_userStatusOffline(); + break; + case 0x7bf09fc: + result = new TL_userStatusLastWeek(); + break; + case 0x9d05049: + result = new TL_userStatusEmpty(); + break; + case 0x77ebc742: + result = new TL_userStatusLastMonth(); + break; + case 0xedb93949: + result = new TL_userStatusOnline(); + break; + case 0xe26f42f1: + result = new TL_userStatusRecently(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in UserStatus", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_userStatusOffline extends UserStatus { + public static class TL_userStatusOffline extends UserStatus { public static int constructor = 0x8c703f; - public void readParams(AbstractSerializedData stream, boolean exception) { - expires = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + expires = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(expires); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(expires); + } + } - public static class TL_userStatusLastWeek extends UserStatus { - public static int constructor = 0x7bf09fc; + public static class TL_userStatusLastWeek extends UserStatus { + public static int constructor = 0x7bf09fc; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_userStatusEmpty extends UserStatus { - public static int constructor = 0x9d05049; + public static class TL_userStatusEmpty extends UserStatus { + public static int constructor = 0x9d05049; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_userStatusLastMonth extends UserStatus { - public static int constructor = 0x77ebc742; + public static class TL_userStatusLastMonth extends UserStatus { + public static int constructor = 0x77ebc742; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); } } public static class TL_userStatusOnline extends UserStatus { - public static int constructor = 0xedb93949; + public static int constructor = 0xedb93949; - public void readParams(AbstractSerializedData stream, boolean exception) { - expires = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + expires = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(expires); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(expires); + } + } - public static class TL_userStatusRecently extends UserStatus { - public static int constructor = 0xe26f42f1; + public static class TL_userStatusRecently extends UserStatus { + public static int constructor = 0xe26f42f1; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_messages_peerSettings extends TLObject { public static int constructor = 0x6880b94d; @@ -26525,36 +26892,36 @@ public class TLRPC { } } - public static class TL_messages_messageEditData extends TLObject { - public static int constructor = 0x26b5dde6; + public static class TL_messages_messageEditData extends TLObject { + public static int constructor = 0x26b5dde6; - public int flags; - public boolean caption; + public int flags; + public boolean caption; - public static TL_messages_messageEditData TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messages_messageEditData.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_messageEditData", constructor)); - } else { - return null; - } - } - TL_messages_messageEditData result = new TL_messages_messageEditData(); - result.readParams(stream, exception); - return result; - } + public static TL_messages_messageEditData TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_messages_messageEditData.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_messages_messageEditData", constructor)); + } else { + return null; + } + } + TL_messages_messageEditData result = new TL_messages_messageEditData(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - caption = (flags & 1) != 0; - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + caption = (flags & 1) != 0; + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = caption ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = caption ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + } + } public static abstract class MessageUserVote extends TLObject { @@ -26793,36 +27160,36 @@ public class TLRPC { } } - public static class TL_inlineBotSwitchPM extends TLObject { - public static int constructor = 0x3c20629f; + public static class TL_inlineBotSwitchPM extends TLObject { + public static int constructor = 0x3c20629f; - public String text; - public String start_param; + public String text; + public String start_param; - public static TL_inlineBotSwitchPM TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_inlineBotSwitchPM.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_inlineBotSwitchPM", constructor)); - } else { - return null; - } - } - TL_inlineBotSwitchPM result = new TL_inlineBotSwitchPM(); - result.readParams(stream, exception); - return result; - } + public static TL_inlineBotSwitchPM TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_inlineBotSwitchPM.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_inlineBotSwitchPM", constructor)); + } else { + return null; + } + } + TL_inlineBotSwitchPM result = new TL_inlineBotSwitchPM(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - text = stream.readString(exception); - start_param = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + text = stream.readString(exception); + start_param = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(text); - stream.writeString(start_param); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(text); + stream.writeString(start_param); + } + } public static abstract class Update extends TLObject { @@ -29072,158 +29439,158 @@ public class TLRPC { } } - public static class TL_receivedNotifyMessage extends TLObject { - public static int constructor = 0xa384b779; + public static class TL_receivedNotifyMessage extends TLObject { + public static int constructor = 0xa384b779; - public int id; - public int flags; + public int id; + public int flags; - public static TL_receivedNotifyMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_receivedNotifyMessage.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_receivedNotifyMessage", constructor)); - } else { - return null; - } - } - TL_receivedNotifyMessage result = new TL_receivedNotifyMessage(); - result.readParams(stream, exception); - return result; - } + public static TL_receivedNotifyMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_receivedNotifyMessage.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_receivedNotifyMessage", constructor)); + } else { + return null; + } + } + TL_receivedNotifyMessage result = new TL_receivedNotifyMessage(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - flags = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + flags = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeInt32(flags); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(id); + stream.writeInt32(flags); + } + } - public static abstract class InputEncryptedFile extends TLObject { - public long id; - public long access_hash; - public int parts; - public int key_fingerprint; - public String md5_checksum; + public static abstract class InputEncryptedFile extends TLObject { + public long id; + public long access_hash; + public int parts; + public int key_fingerprint; + public String md5_checksum; public static InputEncryptedFile TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - InputEncryptedFile result = null; - switch (constructor) { - case 0x5a17b5e5: - result = new TL_inputEncryptedFile(); - break; - case 0x2dc173c8: - result = new TL_inputEncryptedFileBigUploaded(); - break; - case 0x1837c364: - result = new TL_inputEncryptedFileEmpty(); + InputEncryptedFile result = null; + switch (constructor) { + case 0x5a17b5e5: + result = new TL_inputEncryptedFile(); break; - case 0x64bd0306: - result = new TL_inputEncryptedFileUploaded(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in InputEncryptedFile", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + case 0x2dc173c8: + result = new TL_inputEncryptedFileBigUploaded(); + break; + case 0x1837c364: + result = new TL_inputEncryptedFileEmpty(); + break; + case 0x64bd0306: + result = new TL_inputEncryptedFileUploaded(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in InputEncryptedFile", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_inputEncryptedFile extends InputEncryptedFile { - public static int constructor = 0x5a17b5e5; + public static class TL_inputEncryptedFile extends InputEncryptedFile { + public static int constructor = 0x5a17b5e5; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - } - } - - public static class TL_inputEncryptedFileBigUploaded extends InputEncryptedFile { - public static int constructor = 0x2dc173c8; - - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(AbstractSerializedData stream, boolean exception) { id = stream.readInt64(exception); - parts = stream.readInt32(exception); - key_fingerprint = stream.readInt32(exception); - } + access_hash = stream.readInt64(exception); + } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); - stream.writeInt32(parts); - stream.writeInt32(key_fingerprint); - } - } + stream.writeInt64(access_hash); + } + } - public static class TL_inputEncryptedFileEmpty extends InputEncryptedFile { - public static int constructor = 0x1837c364; + public static class TL_inputEncryptedFileBigUploaded extends InputEncryptedFile { + public static int constructor = 0x2dc173c8; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + parts = stream.readInt32(exception); + key_fingerprint = stream.readInt32(exception); + } - public static class TL_inputEncryptedFileUploaded extends InputEncryptedFile { - public static int constructor = 0x64bd0306; + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt32(parts); + stream.writeInt32(key_fingerprint); + } + } + + public static class TL_inputEncryptedFileEmpty extends InputEncryptedFile { + public static int constructor = 0x1837c364; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - parts = stream.readInt32(exception); - md5_checksum = stream.readString(exception); - key_fingerprint = stream.readInt32(exception); - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt32(parts); - stream.writeString(md5_checksum); - stream.writeInt32(key_fingerprint); - } - } + public static class TL_inputEncryptedFileUploaded extends InputEncryptedFile { + public static int constructor = 0x64bd0306; - public static abstract class messages_AllStickers extends TLObject { - public String hash; - public ArrayList sets = new ArrayList<>(); - public ArrayList packs = new ArrayList<>(); - public ArrayList documents = new ArrayList<>(); - public static messages_AllStickers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - messages_AllStickers result = null; - switch (constructor) { + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + parts = stream.readInt32(exception); + md5_checksum = stream.readString(exception); + key_fingerprint = stream.readInt32(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt32(parts); + stream.writeString(md5_checksum); + stream.writeInt32(key_fingerprint); + } + } + + public static abstract class messages_AllStickers extends TLObject { + public String hash; + public ArrayList sets = new ArrayList<>(); + public ArrayList packs = new ArrayList<>(); + public ArrayList documents = new ArrayList<>(); + + public static messages_AllStickers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + messages_AllStickers result = null; + switch (constructor) { case 0xcdbbcebb: result = new TL_messages_allStickers(); break; - case 0xe86602c3: - result = new TL_messages_allStickersNotModified(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in messages_AllStickers", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + case 0xe86602c3: + result = new TL_messages_allStickersNotModified(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in messages_AllStickers", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } public static class TL_messages_allStickers extends messages_AllStickers { public static int constructor = 0xcdbbcebb; @@ -29261,14 +29628,14 @@ public class TLRPC { } } - public static class TL_messages_allStickersNotModified extends messages_AllStickers { - public static int constructor = 0xe86602c3; + public static class TL_messages_allStickersNotModified extends messages_AllStickers { + public static int constructor = 0xe86602c3; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_messages_messageViews extends TLObject { public static int constructor = 0xb6c4f543; @@ -29361,297 +29728,297 @@ public class TLRPC { } } - public static abstract class DecryptedMessageAction extends TLObject { - public int ttl_seconds; - public int layer; - public ArrayList random_ids = new ArrayList<>(); - public long exchange_id; - public long key_fingerprint; - public SendMessageAction action; - public byte[] g_b; - public int start_seq_no; - public int end_seq_no; - public byte[] g_a; + public static abstract class DecryptedMessageAction extends TLObject { + public int ttl_seconds; + public int layer; + public ArrayList random_ids = new ArrayList<>(); + public long exchange_id; + public long key_fingerprint; + public SendMessageAction action; + public byte[] g_b; + public int start_seq_no; + public int end_seq_no; + public byte[] g_a; - public static DecryptedMessageAction TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - DecryptedMessageAction result = null; - switch (constructor) { - case 0xa1733aec: - result = new TL_decryptedMessageActionSetMessageTTL(); - break; - case 0xf3048883: - result = new TL_decryptedMessageActionNotifyLayer(); - break; - case 0x65614304: - result = new TL_decryptedMessageActionDeleteMessages(); - break; - case 0xec2e0b9b: - result = new TL_decryptedMessageActionCommitKey(); - break; - case 0xdd05ec6b: - result = new TL_decryptedMessageActionAbortKey(); - break; - case 0x6719e45c: - result = new TL_decryptedMessageActionFlushHistory(); - break; - case 0xccb27641: - result = new TL_decryptedMessageActionTyping(); - break; - case 0x6fe1735b: - result = new TL_decryptedMessageActionAcceptKey(); - break; - case 0xc4f40be: - result = new TL_decryptedMessageActionReadMessages(); - break; - case 0x511110b0: - result = new TL_decryptedMessageActionResend(); - break; - case 0xf3c9611b: - result = new TL_decryptedMessageActionRequestKey(); - break; - case 0x8ac1f475: - result = new TL_decryptedMessageActionScreenshotMessages(); - break; - case 0xa82fdd63: - result = new TL_decryptedMessageActionNoop(); - break; - } - if (result == null && exception) { + public static DecryptedMessageAction TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + DecryptedMessageAction result = null; + switch (constructor) { + case 0xa1733aec: + result = new TL_decryptedMessageActionSetMessageTTL(); + break; + case 0xf3048883: + result = new TL_decryptedMessageActionNotifyLayer(); + break; + case 0x65614304: + result = new TL_decryptedMessageActionDeleteMessages(); + break; + case 0xec2e0b9b: + result = new TL_decryptedMessageActionCommitKey(); + break; + case 0xdd05ec6b: + result = new TL_decryptedMessageActionAbortKey(); + break; + case 0x6719e45c: + result = new TL_decryptedMessageActionFlushHistory(); + break; + case 0xccb27641: + result = new TL_decryptedMessageActionTyping(); + break; + case 0x6fe1735b: + result = new TL_decryptedMessageActionAcceptKey(); + break; + case 0xc4f40be: + result = new TL_decryptedMessageActionReadMessages(); + break; + case 0x511110b0: + result = new TL_decryptedMessageActionResend(); + break; + case 0xf3c9611b: + result = new TL_decryptedMessageActionRequestKey(); + break; + case 0x8ac1f475: + result = new TL_decryptedMessageActionScreenshotMessages(); + break; + case 0xa82fdd63: + result = new TL_decryptedMessageActionNoop(); + break; + } + if (result == null && exception) { throw new RuntimeException(String.format("can't parse magic %x in DecryptedMessageAction", constructor)); - } - if (result != null) { + } + if (result != null) { result.readParams(stream, exception); } - return result; - } - } - - public static class TL_decryptedMessageActionSetMessageTTL extends DecryptedMessageAction { - public static int constructor = 0xa1733aec; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - ttl_seconds = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(ttl_seconds); - } - } - - public static class TL_decryptedMessageActionNotifyLayer extends DecryptedMessageAction { - public static int constructor = 0xf3048883; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - layer = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(layer); - } - } - - public static class TL_decryptedMessageActionDeleteMessages extends DecryptedMessageAction { - public static int constructor = 0x65614304; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - random_ids.add(stream.readInt64(exception)); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = random_ids.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(random_ids.get(a)); - } + return result; } - } + } - public static class TL_decryptedMessageActionCommitKey extends DecryptedMessageAction { - public static int constructor = 0xec2e0b9b; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - exchange_id = stream.readInt64(exception); - key_fingerprint = stream.readInt64(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(exchange_id); - stream.writeInt64(key_fingerprint); - } - } - - public static class TL_decryptedMessageActionAbortKey extends DecryptedMessageAction { - public static int constructor = 0xdd05ec6b; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - exchange_id = stream.readInt64(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(exchange_id); - } - } - - public static class TL_decryptedMessageActionFlushHistory extends DecryptedMessageAction { - public static int constructor = 0x6719e45c; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_decryptedMessageActionTyping extends DecryptedMessageAction { - public static int constructor = 0xccb27641; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - action = SendMessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - action.serializeToStream(stream); - } - } - - public static class TL_decryptedMessageActionAcceptKey extends DecryptedMessageAction { - public static int constructor = 0x6fe1735b; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - exchange_id = stream.readInt64(exception); - g_b = stream.readByteArray(exception); - key_fingerprint = stream.readInt64(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(exchange_id); - stream.writeByteArray(g_b); - stream.writeInt64(key_fingerprint); - } - } - - public static class TL_decryptedMessageActionReadMessages extends DecryptedMessageAction { - public static int constructor = 0xc4f40be; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - random_ids.add(stream.readInt64(exception)); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = random_ids.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(random_ids.get(a)); - } - } - } - - public static class TL_decryptedMessageActionResend extends DecryptedMessageAction { - public static int constructor = 0x511110b0; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - start_seq_no = stream.readInt32(exception); - end_seq_no = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(start_seq_no); - stream.writeInt32(end_seq_no); - } - } - - public static class TL_decryptedMessageActionRequestKey extends DecryptedMessageAction { - public static int constructor = 0xf3c9611b; + public static class TL_decryptedMessageActionSetMessageTTL extends DecryptedMessageAction { + public static int constructor = 0xa1733aec; public void readParams(AbstractSerializedData stream, boolean exception) { - exchange_id = stream.readInt64(exception); - g_a = stream.readByteArray(exception); - } + ttl_seconds = stream.readInt32(exception); + } public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(exchange_id); - stream.writeByteArray(g_a); - } - } - - public static class TL_decryptedMessageActionScreenshotMessages extends DecryptedMessageAction { - public static int constructor = 0x8ac1f475; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - random_ids.add(stream.readInt64(exception)); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = random_ids.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(random_ids.get(a)); - } - } + stream.writeInt32(constructor); + stream.writeInt32(ttl_seconds); + } } - public static class TL_decryptedMessageActionNoop extends DecryptedMessageAction { - public static int constructor = 0xa82fdd63; + public static class TL_decryptedMessageActionNotifyLayer extends DecryptedMessageAction { + public static int constructor = 0xf3048883; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + layer = stream.readInt32(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(layer); + } + } + + public static class TL_decryptedMessageActionDeleteMessages extends DecryptedMessageAction { + public static int constructor = 0x65614304; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + random_ids.add(stream.readInt64(exception)); + } + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = random_ids.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeInt64(random_ids.get(a)); + } + } + } + + public static class TL_decryptedMessageActionCommitKey extends DecryptedMessageAction { + public static int constructor = 0xec2e0b9b; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + exchange_id = stream.readInt64(exception); + key_fingerprint = stream.readInt64(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(exchange_id); + stream.writeInt64(key_fingerprint); + } + } + + public static class TL_decryptedMessageActionAbortKey extends DecryptedMessageAction { + public static int constructor = 0xdd05ec6b; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + exchange_id = stream.readInt64(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(exchange_id); + } + } + + public static class TL_decryptedMessageActionFlushHistory extends DecryptedMessageAction { + public static int constructor = 0x6719e45c; + + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_decryptedMessageActionTyping extends DecryptedMessageAction { + public static int constructor = 0xccb27641; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + action = SendMessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + action.serializeToStream(stream); + } + } + + public static class TL_decryptedMessageActionAcceptKey extends DecryptedMessageAction { + public static int constructor = 0x6fe1735b; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + exchange_id = stream.readInt64(exception); + g_b = stream.readByteArray(exception); + key_fingerprint = stream.readInt64(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(exchange_id); + stream.writeByteArray(g_b); + stream.writeInt64(key_fingerprint); + } + } + + public static class TL_decryptedMessageActionReadMessages extends DecryptedMessageAction { + public static int constructor = 0xc4f40be; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + random_ids.add(stream.readInt64(exception)); + } + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = random_ids.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeInt64(random_ids.get(a)); + } + } + } + + public static class TL_decryptedMessageActionResend extends DecryptedMessageAction { + public static int constructor = 0x511110b0; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + start_seq_no = stream.readInt32(exception); + end_seq_no = stream.readInt32(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(start_seq_no); + stream.writeInt32(end_seq_no); + } + } + + public static class TL_decryptedMessageActionRequestKey extends DecryptedMessageAction { + public static int constructor = 0xf3c9611b; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + exchange_id = stream.readInt64(exception); + g_a = stream.readByteArray(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(exchange_id); + stream.writeByteArray(g_a); + } + } + + public static class TL_decryptedMessageActionScreenshotMessages extends DecryptedMessageAction { + public static int constructor = 0x8ac1f475; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + random_ids.add(stream.readInt64(exception)); + } + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = random_ids.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeInt64(random_ids.get(a)); + } + } + } + + public static class TL_decryptedMessageActionNoop extends DecryptedMessageAction { + public static int constructor = 0xa82fdd63; + + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static abstract class InputCheckPasswordSRP extends TLObject { @@ -30064,57 +30431,60 @@ public class TLRPC { } } - public static abstract class MessageEntity extends TLObject { - public int offset; - public int length; - public String url; - public String language; + public static abstract class MessageEntity extends TLObject { + public int offset; + public int length; + public String url; + public String language; - public static MessageEntity TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - MessageEntity result = null; - switch (constructor) { - case 0x76a6d327: - result = new TL_messageEntityTextUrl(); - break; - case 0x6cef8ac7: - result = new TL_messageEntityBotCommand(); - break; - case 0x64e475c2: - result = new TL_messageEntityEmail(); - break; - case 0x73924be0: - result = new TL_messageEntityPre(); - break; - case 0xbb92ba95: - result = new TL_messageEntityUnknown(); - break; - case 0x6ed02538: - result = new TL_messageEntityUrl(); - break; - case 0x826f8b60: - result = new TL_messageEntityItalic(); - break; - case 0xfa04579d: - result = new TL_messageEntityMention(); - break; - case 0x352dca58: - result = new TL_messageEntityMentionName_layer131(); - break; - case 0x208e68c9: - result = new TL_inputMessageEntityMentionName(); - break; - case 0x4c4e743f: - result = new TL_messageEntityCashtag(); - break; - case 0xbd610bc9: - result = new TL_messageEntityBold(); - break; - case 0x6f635b0d: - result = new TL_messageEntityHashtag(); - break; - case 0x28a20571: - result = new TL_messageEntityCode(); - break; + public static MessageEntity TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + MessageEntity result = null; + switch (constructor) { + case 0x76a6d327: + result = new TL_messageEntityTextUrl(); + break; + case 0x6cef8ac7: + result = new TL_messageEntityBotCommand(); + break; + case 0x64e475c2: + result = new TL_messageEntityEmail(); + break; + case 0x73924be0: + result = new TL_messageEntityPre(); + break; + case 0xbb92ba95: + result = new TL_messageEntityUnknown(); + break; + case 0x6ed02538: + result = new TL_messageEntityUrl(); + break; + case 0x826f8b60: + result = new TL_messageEntityItalic(); + break; + case 0xfa04579d: + result = new TL_messageEntityMention(); + break; + case 0x32ca960f: + result = new TL_messageEntitySpoiler(); + break; + case 0x352dca58: + result = new TL_messageEntityMentionName_layer131(); + break; + case 0x208e68c9: + result = new TL_inputMessageEntityMentionName(); + break; + case 0x4c4e743f: + result = new TL_messageEntityCashtag(); + break; + case 0xbd610bc9: + result = new TL_messageEntityBold(); + break; + case 0x6f635b0d: + result = new TL_messageEntityHashtag(); + break; + case 0x28a20571: + result = new TL_messageEntityCode(); + break; case 0xbf0693d4: result = new TL_messageEntityStrike(); break; @@ -30127,254 +30497,269 @@ public class TLRPC { case 0x761e6af4: result = new TL_messageEntityBankCard(); break; - case 0x9b69e34b: - result = new TL_messageEntityPhone(); - break; + case 0x9b69e34b: + result = new TL_messageEntityPhone(); + break; case 0xdc7b1140: result = new TL_messageEntityMentionName(); break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in MessageEntity", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in MessageEntity", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_messageEntityTextUrl extends MessageEntity { - public static int constructor = 0x76a6d327; + public static class TL_messageEntityTextUrl extends MessageEntity { + public static int constructor = 0x76a6d327; - public void readParams(AbstractSerializedData stream, boolean exception) { - offset = stream.readInt32(exception); - length = stream.readInt32(exception); - url = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + offset = stream.readInt32(exception); + length = stream.readInt32(exception); + url = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(offset); - stream.writeInt32(length); - stream.writeString(url); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(offset); + stream.writeInt32(length); + stream.writeString(url); + } + } - public static class TL_messageEntityBotCommand extends MessageEntity { - public static int constructor = 0x6cef8ac7; + public static class TL_messageEntityBotCommand extends MessageEntity { + public static int constructor = 0x6cef8ac7; - public void readParams(AbstractSerializedData stream, boolean exception) { - offset = stream.readInt32(exception); - length = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + offset = stream.readInt32(exception); + length = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(offset); - stream.writeInt32(length); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(offset); + stream.writeInt32(length); + } + } - public static class TL_messageEntityEmail extends MessageEntity { - public static int constructor = 0x64e475c2; + public static class TL_messageEntityEmail extends MessageEntity { + public static int constructor = 0x64e475c2; - public void readParams(AbstractSerializedData stream, boolean exception) { - offset = stream.readInt32(exception); - length = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + offset = stream.readInt32(exception); + length = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(offset); - stream.writeInt32(length); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(offset); + stream.writeInt32(length); + } + } - public static class TL_messageEntityPre extends MessageEntity { - public static int constructor = 0x73924be0; + public static class TL_messageEntityPre extends MessageEntity { + public static int constructor = 0x73924be0; - public void readParams(AbstractSerializedData stream, boolean exception) { - offset = stream.readInt32(exception); - length = stream.readInt32(exception); - language = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + offset = stream.readInt32(exception); + length = stream.readInt32(exception); + language = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(offset); - stream.writeInt32(length); - stream.writeString(language); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(offset); + stream.writeInt32(length); + stream.writeString(language); + } + } - public static class TL_messageEntityUnknown extends MessageEntity { - public static int constructor = 0xbb92ba95; + public static class TL_messageEntityUnknown extends MessageEntity { + public static int constructor = 0xbb92ba95; - public void readParams(AbstractSerializedData stream, boolean exception) { - offset = stream.readInt32(exception); - length = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + offset = stream.readInt32(exception); + length = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(offset); - stream.writeInt32(length); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(offset); + stream.writeInt32(length); + } + } - public static class TL_messageEntityUrl extends MessageEntity { - public static int constructor = 0x6ed02538; + public static class TL_messageEntityUrl extends MessageEntity { + public static int constructor = 0x6ed02538; - public void readParams(AbstractSerializedData stream, boolean exception) { - offset = stream.readInt32(exception); - length = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + offset = stream.readInt32(exception); + length = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(offset); - stream.writeInt32(length); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(offset); + stream.writeInt32(length); + } + } - public static class TL_messageEntityItalic extends MessageEntity { - public static int constructor = 0x826f8b60; + public static class TL_messageEntityItalic extends MessageEntity { + public static int constructor = 0x826f8b60; - public void readParams(AbstractSerializedData stream, boolean exception) { - offset = stream.readInt32(exception); - length = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + offset = stream.readInt32(exception); + length = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(offset); - stream.writeInt32(length); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(offset); + stream.writeInt32(length); + } + } - public static class TL_messageEntityMention extends MessageEntity { - public static int constructor = 0xfa04579d; + public static class TL_messageEntityMention extends MessageEntity { + public static int constructor = 0xfa04579d; - public void readParams(AbstractSerializedData stream, boolean exception) { - offset = stream.readInt32(exception); - length = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + offset = stream.readInt32(exception); + length = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(offset); - stream.writeInt32(length); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(offset); + stream.writeInt32(length); + } + } - public static class TL_messageEntityMentionName_layer131 extends TL_messageEntityMentionName { - public static int constructor = 0x352dca58; + public static class TL_messageEntitySpoiler extends MessageEntity { + public static int constructor = 0x32ca960f; + + public void readParams(AbstractSerializedData stream, boolean exception) { + offset = stream.readInt32(exception); + length = stream.readInt32(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(offset); + stream.writeInt32(length); + } + } + + public static class TL_messageEntityMentionName_layer131 extends TL_messageEntityMentionName { + public static int constructor = 0x352dca58; - public void readParams(AbstractSerializedData stream, boolean exception) { - offset = stream.readInt32(exception); - length = stream.readInt32(exception); - user_id = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + offset = stream.readInt32(exception); + length = stream.readInt32(exception); + user_id = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(offset); - stream.writeInt32(length); - stream.writeInt32((int) user_id); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(offset); + stream.writeInt32(length); + stream.writeInt32((int) user_id); + } + } - public static class TL_inputMessageEntityMentionName extends MessageEntity { - public static int constructor = 0x208e68c9; + public static class TL_inputMessageEntityMentionName extends MessageEntity { + public static int constructor = 0x208e68c9; - public InputUser user_id; + public InputUser user_id; - public void readParams(AbstractSerializedData stream, boolean exception) { - offset = stream.readInt32(exception); - length = stream.readInt32(exception); - user_id = InputUser.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + offset = stream.readInt32(exception); + length = stream.readInt32(exception); + user_id = InputUser.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(offset); - stream.writeInt32(length); - user_id.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(offset); + stream.writeInt32(length); + user_id.serializeToStream(stream); + } + } - public static class TL_messageEntityCashtag extends MessageEntity { - public static int constructor = 0x4c4e743f; + public static class TL_messageEntityCashtag extends MessageEntity { + public static int constructor = 0x4c4e743f; - public void readParams(AbstractSerializedData stream, boolean exception) { - offset = stream.readInt32(exception); - length = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + offset = stream.readInt32(exception); + length = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(offset); - stream.writeInt32(length); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(offset); + stream.writeInt32(length); + } + } - public static class TL_messageEntityBold extends MessageEntity { - public static int constructor = 0xbd610bc9; + public static class TL_messageEntityBold extends MessageEntity { + public static int constructor = 0xbd610bc9; - public void readParams(AbstractSerializedData stream, boolean exception) { - offset = stream.readInt32(exception); - length = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + offset = stream.readInt32(exception); + length = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(offset); - stream.writeInt32(length); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(offset); + stream.writeInt32(length); + } + } - public static class TL_messageEntityHashtag extends MessageEntity { - public static int constructor = 0x6f635b0d; + public static class TL_messageEntityHashtag extends MessageEntity { + public static int constructor = 0x6f635b0d; - public void readParams(AbstractSerializedData stream, boolean exception) { - offset = stream.readInt32(exception); - length = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + offset = stream.readInt32(exception); + length = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(offset); - stream.writeInt32(length); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(offset); + stream.writeInt32(length); + } + } - public static class TL_messageEntityCode extends MessageEntity { - public static int constructor = 0x28a20571; + public static class TL_messageEntityCode extends MessageEntity { + public static int constructor = 0x28a20571; - public void readParams(AbstractSerializedData stream, boolean exception) { - offset = stream.readInt32(exception); - length = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + offset = stream.readInt32(exception); + length = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(offset); - stream.writeInt32(length); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(offset); + stream.writeInt32(length); + } + } public static class TL_messageEntityStrike extends MessageEntity { public static int constructor = 0xbf0693d4; @@ -30440,20 +30825,20 @@ public class TLRPC { } } - public static class TL_messageEntityPhone extends MessageEntity { - public static int constructor = 0x9b69e34b; + public static class TL_messageEntityPhone extends MessageEntity { + public static int constructor = 0x9b69e34b; - public void readParams(AbstractSerializedData stream, boolean exception) { - offset = stream.readInt32(exception); - length = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + offset = stream.readInt32(exception); + length = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(offset); - stream.writeInt32(length); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(offset); + stream.writeInt32(length); + } + } public static class TL_messageEntityMentionName extends MessageEntity { public static int constructor = 0xdc7b1140; @@ -30956,163 +31341,163 @@ public class TLRPC { } } - public static class TL_encryptedChatRequested_old extends TL_encryptedChatRequested { - public static int constructor = 0xfda9a7b7; + public static class TL_encryptedChatRequested_old extends TL_encryptedChatRequested { + public static int constructor = 0xfda9a7b7; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt32(exception); access_hash = stream.readInt64(exception); - date = stream.readInt32(exception); - admin_id = stream.readInt32(exception); - participant_id = stream.readInt32(exception); - g_a = stream.readByteArray(exception); - nonce = stream.readByteArray(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeInt64(access_hash); - stream.writeInt32(date); - stream.writeInt32((int) admin_id); - stream.writeInt32((int) participant_id); - stream.writeByteArray(g_a); - stream.writeByteArray(nonce); - } - } - - public static class TL_encryptedChatRequested_layer115 extends EncryptedChat { - public static int constructor = 0xc878527e; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - access_hash = stream.readInt64(exception); - date = stream.readInt32(exception); + date = stream.readInt32(exception); admin_id = stream.readInt32(exception); - participant_id = stream.readInt32(exception); - g_a = stream.readByteArray(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeInt64(access_hash); - stream.writeInt32(date); - stream.writeInt32((int) admin_id); - stream.writeInt32((int) participant_id); - stream.writeByteArray(g_a); - } - } - - public static class TL_encryptedChat_layer131 extends TL_encryptedChat { - public static int constructor = 0xfa56ce36; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - access_hash = stream.readInt64(exception); - date = stream.readInt32(exception); - admin_id = stream.readInt32(exception); participant_id = stream.readInt32(exception); - g_a_or_b = stream.readByteArray(exception); - key_fingerprint = stream.readInt64(exception); + g_a = stream.readByteArray(exception); + nonce = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeInt64(access_hash); - stream.writeInt32(date); - stream.writeInt32((int) admin_id); - stream.writeInt32((int) participant_id); - stream.writeByteArray(g_a_or_b); - stream.writeInt64(key_fingerprint); - } - } + stream.writeInt32(id); + stream.writeInt64(access_hash); + stream.writeInt32(date); + stream.writeInt32((int) admin_id); + stream.writeInt32((int) participant_id); + stream.writeByteArray(g_a); + stream.writeByteArray(nonce); + } + } - public static class TL_encryptedChat_old extends TL_encryptedChat { - public static int constructor = 0x6601d14f; + public static class TL_encryptedChatRequested_layer115 extends EncryptedChat { + public static int constructor = 0xc878527e; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - access_hash = stream.readInt64(exception); - date = stream.readInt32(exception); - admin_id = stream.readInt32(exception); + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + access_hash = stream.readInt64(exception); + date = stream.readInt32(exception); + admin_id = stream.readInt32(exception); participant_id = stream.readInt32(exception); - g_a_or_b = stream.readByteArray(exception); - nonce = stream.readByteArray(exception); - key_fingerprint = stream.readInt64(exception); - } + g_a = stream.readByteArray(exception); + } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeInt64(access_hash); - stream.writeInt32(date); - stream.writeInt32((int) admin_id); - stream.writeInt32((int) participant_id); - stream.writeByteArray(g_a_or_b); - stream.writeByteArray(nonce); - stream.writeInt64(key_fingerprint); - } - } + stream.writeInt32(id); + stream.writeInt64(access_hash); + stream.writeInt32(date); + stream.writeInt32((int) admin_id); + stream.writeInt32((int) participant_id); + stream.writeByteArray(g_a); + } + } - public static class TL_encryptedChatEmpty extends EncryptedChat { + public static class TL_encryptedChat_layer131 extends TL_encryptedChat { + public static int constructor = 0xfa56ce36; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + access_hash = stream.readInt64(exception); + date = stream.readInt32(exception); + admin_id = stream.readInt32(exception); + participant_id = stream.readInt32(exception); + g_a_or_b = stream.readByteArray(exception); + key_fingerprint = stream.readInt64(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(id); + stream.writeInt64(access_hash); + stream.writeInt32(date); + stream.writeInt32((int) admin_id); + stream.writeInt32((int) participant_id); + stream.writeByteArray(g_a_or_b); + stream.writeInt64(key_fingerprint); + } + } + + public static class TL_encryptedChat_old extends TL_encryptedChat { + public static int constructor = 0x6601d14f; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + access_hash = stream.readInt64(exception); + date = stream.readInt32(exception); + admin_id = stream.readInt32(exception); + participant_id = stream.readInt32(exception); + g_a_or_b = stream.readByteArray(exception); + nonce = stream.readByteArray(exception); + key_fingerprint = stream.readInt64(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(id); + stream.writeInt64(access_hash); + stream.writeInt32(date); + stream.writeInt32((int) admin_id); + stream.writeInt32((int) participant_id); + stream.writeByteArray(g_a_or_b); + stream.writeByteArray(nonce); + stream.writeInt64(key_fingerprint); + } + } + + public static class TL_encryptedChatEmpty extends EncryptedChat { public static int constructor = 0xab7ec0a0; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + } public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - } - } + stream.writeInt32(constructor); + stream.writeInt32(id); + } + } - public static class TL_encryptedChatWaiting_layer131 extends TL_encryptedChatWaiting { - public static int constructor = 0x3bf703dc; + public static class TL_encryptedChatWaiting_layer131 extends TL_encryptedChatWaiting { + public static int constructor = 0x3bf703dc; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - access_hash = stream.readInt64(exception); - date = stream.readInt32(exception); - admin_id = stream.readInt32(exception); - participant_id = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + access_hash = stream.readInt64(exception); + date = stream.readInt32(exception); + admin_id = stream.readInt32(exception); + participant_id = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeInt64(access_hash); - stream.writeInt32(date); - stream.writeInt32((int) admin_id); - stream.writeInt32((int) participant_id); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(id); + stream.writeInt64(access_hash); + stream.writeInt32(date); + stream.writeInt32((int) admin_id); + stream.writeInt32((int) participant_id); + } + } - public static class TL_encryptedChatDiscarded_layer122 extends TL_encryptedChatDiscarded { - public static int constructor = 0x13d6dd27; + public static class TL_encryptedChatDiscarded_layer122 extends TL_encryptedChatDiscarded { + public static int constructor = 0x13d6dd27; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(id); + } + } public static class TL_encryptedChatDiscarded extends EncryptedChat { public static int constructor = 0x1e1c7c45; - + public void readParams(AbstractSerializedData stream, boolean exception) { flags = stream.readInt32(exception); @@ -31210,34 +31595,34 @@ public class TLRPC { public static abstract class messages_FoundStickerSets extends TLObject { - public static messages_FoundStickerSets TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - messages_FoundStickerSets result = null; - switch (constructor) { - case 0xd54b65d: - result = new TL_messages_foundStickerSetsNotModified(); - break; + public static messages_FoundStickerSets TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + messages_FoundStickerSets result = null; + switch (constructor) { + case 0xd54b65d: + result = new TL_messages_foundStickerSetsNotModified(); + break; case 0x8af09dd2: result = new TL_messages_foundStickerSets(); break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in messages_FoundStickerSets", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in messages_FoundStickerSets", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_messages_foundStickerSetsNotModified extends messages_FoundStickerSets { - public static int constructor = 0xd54b65d; + public static class TL_messages_foundStickerSetsNotModified extends messages_FoundStickerSets { + public static int constructor = 0xd54b65d; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_messages_foundStickerSets extends messages_FoundStickerSets { public static int constructor = 0x8af09dd2; @@ -31428,39 +31813,39 @@ public class TLRPC { } } - public static class TL_secureData extends TLObject { - public static int constructor = 0x8aeabec3; + public static class TL_secureData extends TLObject { + public static int constructor = 0x8aeabec3; - public byte[] data; - public byte[] data_hash; - public byte[] secret; + public byte[] data; + public byte[] data_hash; + public byte[] secret; - public static TL_secureData TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_secureData.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_secureData", constructor)); - } else { - return null; - } - } - TL_secureData result = new TL_secureData(); - result.readParams(stream, exception); - return result; - } + public static TL_secureData TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_secureData.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_secureData", constructor)); + } else { + return null; + } + } + TL_secureData result = new TL_secureData(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - data = stream.readByteArray(exception); - data_hash = stream.readByteArray(exception); - secret = stream.readByteArray(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + data = stream.readByteArray(exception); + data_hash = stream.readByteArray(exception); + secret = stream.readByteArray(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(data); - stream.writeByteArray(data_hash); - stream.writeByteArray(secret); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeByteArray(data); + stream.writeByteArray(data_hash); + stream.writeByteArray(secret); + } + } public static class TL_config extends TLObject { public static int constructor = 0x330b4067; @@ -31698,281 +32083,281 @@ public class TLRPC { } } - public static abstract class contacts_TopPeers extends TLObject { + public static abstract class contacts_TopPeers extends TLObject { - public static contacts_TopPeers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - contacts_TopPeers result = null; - switch (constructor) { - case 0x70b772a8: - result = new TL_contacts_topPeers(); - break; - case 0xb52c939d: - result = new TL_contacts_topPeersDisabled(); - break; - case 0xde266ef5: - result = new TL_contacts_topPeersNotModified(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in contacts_TopPeers", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static contacts_TopPeers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + contacts_TopPeers result = null; + switch (constructor) { + case 0x70b772a8: + result = new TL_contacts_topPeers(); + break; + case 0xb52c939d: + result = new TL_contacts_topPeersDisabled(); + break; + case 0xde266ef5: + result = new TL_contacts_topPeersNotModified(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in contacts_TopPeers", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_contacts_topPeers extends contacts_TopPeers { - public static int constructor = 0x70b772a8; + public static class TL_contacts_topPeers extends contacts_TopPeers { + public static int constructor = 0x70b772a8; - public ArrayList categories = new ArrayList<>(); - public ArrayList chats = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); + public ArrayList categories = new ArrayList<>(); + public ArrayList chats = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_topPeerCategoryPeers object = TL_topPeerCategoryPeers.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - categories.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + TL_topPeerCategoryPeers object = TL_topPeerCategoryPeers.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + categories.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + chats.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + users.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = categories.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - categories.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = categories.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + categories.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = chats.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + chats.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = users.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + users.get(a).serializeToStream(stream); + } + } + } - public static class TL_contacts_topPeersDisabled extends contacts_TopPeers { - public static int constructor = 0xb52c939d; + public static class TL_contacts_topPeersDisabled extends contacts_TopPeers { + public static int constructor = 0xb52c939d; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_contacts_topPeersNotModified extends contacts_TopPeers { - public static int constructor = 0xde266ef5; + public static class TL_contacts_topPeersNotModified extends contacts_TopPeers { + public static int constructor = 0xde266ef5; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_help_support extends TLObject { - public static int constructor = 0x17c6b5f6; + public static class TL_help_support extends TLObject { + public static int constructor = 0x17c6b5f6; - public String phone_number; - public User user; + public String phone_number; + public User user; - public static TL_help_support TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_help_support.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_help_support", constructor)); - } else { - return null; - } - } - TL_help_support result = new TL_help_support(); - result.readParams(stream, exception); - return result; - } + public static TL_help_support TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_help_support.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_help_support", constructor)); + } else { + return null; + } + } + TL_help_support result = new TL_help_support(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - phone_number = stream.readString(exception); - user = User.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + phone_number = stream.readString(exception); + user = User.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); stream.writeString(phone_number); - user.serializeToStream(stream); - } - } + user.serializeToStream(stream); + } + } - public static class TL_account_tmpPassword extends TLObject { - public static int constructor = 0xdb64fd34; + public static class TL_account_tmpPassword extends TLObject { + public static int constructor = 0xdb64fd34; - public byte[] tmp_password; - public int valid_until; + public byte[] tmp_password; + public int valid_until; - public static TL_account_tmpPassword TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_account_tmpPassword.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_account_tmpPassword", constructor)); - } else { - return null; - } - } - TL_account_tmpPassword result = new TL_account_tmpPassword(); - result.readParams(stream, exception); - return result; - } + public static TL_account_tmpPassword TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_account_tmpPassword.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_account_tmpPassword", constructor)); + } else { + return null; + } + } + TL_account_tmpPassword result = new TL_account_tmpPassword(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - tmp_password = stream.readByteArray(exception); - valid_until = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + tmp_password = stream.readByteArray(exception); + valid_until = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(tmp_password); - stream.writeInt32(valid_until); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeByteArray(tmp_password); + stream.writeInt32(valid_until); + } + } - public static abstract class messages_Chats extends TLObject { - public ArrayList chats = new ArrayList<>(); - public int count; + public static abstract class messages_Chats extends TLObject { + public ArrayList chats = new ArrayList<>(); + public int count; - public static messages_Chats TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - messages_Chats result = null; - switch (constructor) { - case 0x64ff9fd5: - result = new TL_messages_chats(); - break; - case 0x9cd81144: - result = new TL_messages_chatsSlice(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in messages_Chats", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static messages_Chats TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + messages_Chats result = null; + switch (constructor) { + case 0x64ff9fd5: + result = new TL_messages_chats(); + break; + case 0x9cd81144: + result = new TL_messages_chatsSlice(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in messages_Chats", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_messages_chats extends messages_Chats { - public static int constructor = 0x64ff9fd5; + public static class TL_messages_chats extends messages_Chats { + public static int constructor = 0x64ff9fd5; - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + chats.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = chats.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + chats.get(a).serializeToStream(stream); + } + } + } - public static class TL_messages_chatsSlice extends messages_Chats { - public static int constructor = 0x9cd81144; + public static class TL_messages_chatsSlice extends messages_Chats { + public static int constructor = 0x9cd81144; - public void readParams(AbstractSerializedData stream, boolean exception) { - count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + count = stream.readInt32(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + chats.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(count); + stream.writeInt32(0x1cb5c415); + int count = chats.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + chats.get(a).serializeToStream(stream); + } + } + } public static abstract class InputChannel extends TLObject { @@ -32315,162 +32700,162 @@ public class TLRPC { } } - public static abstract class messages_BotResults extends TLObject { - public int flags; - public boolean gallery; - public long query_id; - public String next_offset; - public TL_inlineBotSwitchPM switch_pm; - public ArrayList results = new ArrayList<>(); - public int cache_time; - public ArrayList users = new ArrayList<>(); + public static abstract class messages_BotResults extends TLObject { + public int flags; + public boolean gallery; + public long query_id; + public String next_offset; + public TL_inlineBotSwitchPM switch_pm; + public ArrayList results = new ArrayList<>(); + public int cache_time; + public ArrayList users = new ArrayList<>(); - public static messages_BotResults TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - messages_BotResults result = null; - switch (constructor) { - case 0xccd3563d: - result = new TL_messages_botResults_layer71(); - break; - case 0x947ca848: - result = new TL_messages_botResults(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in messages_BotResults", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static messages_BotResults TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + messages_BotResults result = null; + switch (constructor) { + case 0xccd3563d: + result = new TL_messages_botResults_layer71(); + break; + case 0x947ca848: + result = new TL_messages_botResults(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in messages_BotResults", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_messages_botResults_layer71 extends TL_messages_botResults { - public static int constructor = 0xccd3563d; + public static class TL_messages_botResults_layer71 extends TL_messages_botResults { + public static int constructor = 0xccd3563d; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - gallery = (flags & 1) != 0; - query_id = stream.readInt64(exception); - if ((flags & 2) != 0) { - next_offset = stream.readString(exception); - } - if ((flags & 4) != 0) { - switch_pm = TL_inlineBotSwitchPM.TLdeserialize(stream, stream.readInt32(exception), exception); - } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - BotInlineResult object = BotInlineResult.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - results.add(object); - } - cache_time = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + gallery = (flags & 1) != 0; + query_id = stream.readInt64(exception); + if ((flags & 2) != 0) { + next_offset = stream.readString(exception); + } + if ((flags & 4) != 0) { + switch_pm = TL_inlineBotSwitchPM.TLdeserialize(stream, stream.readInt32(exception), exception); + } + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + BotInlineResult object = BotInlineResult.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + results.add(object); + } + cache_time = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = gallery ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeInt64(query_id); - if ((flags & 2) != 0) { - stream.writeString(next_offset); - } - if ((flags & 4) != 0) { - switch_pm.serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - int count = results.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - results.get(a).serializeToStream(stream); - } - stream.writeInt32(cache_time); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = gallery ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + stream.writeInt64(query_id); + if ((flags & 2) != 0) { + stream.writeString(next_offset); + } + if ((flags & 4) != 0) { + switch_pm.serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + int count = results.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + results.get(a).serializeToStream(stream); + } + stream.writeInt32(cache_time); + } + } - public static class TL_messages_botResults extends messages_BotResults { - public static int constructor = 0x947ca848; + public static class TL_messages_botResults extends messages_BotResults { + public static int constructor = 0x947ca848; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - gallery = (flags & 1) != 0; - query_id = stream.readInt64(exception); - if ((flags & 2) != 0) { - next_offset = stream.readString(exception); - } - if ((flags & 4) != 0) { - switch_pm = TL_inlineBotSwitchPM.TLdeserialize(stream, stream.readInt32(exception), exception); - } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - BotInlineResult object = BotInlineResult.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - results.add(object); - } - cache_time = stream.readInt32(exception); - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + gallery = (flags & 1) != 0; + query_id = stream.readInt64(exception); + if ((flags & 2) != 0) { + next_offset = stream.readString(exception); + } + if ((flags & 4) != 0) { + switch_pm = TL_inlineBotSwitchPM.TLdeserialize(stream, stream.readInt32(exception), exception); + } + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + BotInlineResult object = BotInlineResult.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + results.add(object); + } + cache_time = stream.readInt32(exception); + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + users.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = gallery ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeInt64(query_id); - if ((flags & 2) != 0) { - stream.writeString(next_offset); - } - if ((flags & 4) != 0) { - switch_pm.serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - int count = results.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - results.get(a).serializeToStream(stream); - } - stream.writeInt32(cache_time); - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = gallery ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + stream.writeInt64(query_id); + if ((flags & 2) != 0) { + stream.writeString(next_offset); + } + if ((flags & 4) != 0) { + switch_pm.serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + int count = results.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + results.get(a).serializeToStream(stream); + } + stream.writeInt32(cache_time); + stream.writeInt32(0x1cb5c415); + count = users.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + users.get(a).serializeToStream(stream); + } + } + } public static class TL_inputFolderPeer extends TLObject { public static int constructor = 0xfbd2c296; @@ -32588,125 +32973,125 @@ public class TLRPC { } } - public static class TL_inputBotInlineMessageID extends TLObject { - public static int constructor = 0x890c3d89; + public static class TL_inputBotInlineMessageID extends TLObject { + public static int constructor = 0x890c3d89; - public int dc_id; - public long id; - public long access_hash; + public int dc_id; + public long id; + public long access_hash; - public static TL_inputBotInlineMessageID TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_inputBotInlineMessageID.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_inputBotInlineMessageID", constructor)); - } else { - return null; - } - } - TL_inputBotInlineMessageID result = new TL_inputBotInlineMessageID(); - result.readParams(stream, exception); - return result; - } + public static TL_inputBotInlineMessageID TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_inputBotInlineMessageID.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_inputBotInlineMessageID", constructor)); + } else { + return null; + } + } + TL_inputBotInlineMessageID result = new TL_inputBotInlineMessageID(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - dc_id = stream.readInt32(exception); - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + dc_id = stream.readInt32(exception); + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(dc_id); - stream.writeInt64(id); - stream.writeInt64(access_hash); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(dc_id); + stream.writeInt64(id); + stream.writeInt64(access_hash); + } + } - public static abstract class SecurePlainData extends TLObject { + public static abstract class SecurePlainData extends TLObject { - public static SecurePlainData TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - SecurePlainData result = null; - switch (constructor) { - case 0x21ec5a5f: - result = new TL_securePlainEmail(); - break; - case 0x7d6099dd: - result = new TL_securePlainPhone(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in SecurePlainData", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static SecurePlainData TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + SecurePlainData result = null; + switch (constructor) { + case 0x21ec5a5f: + result = new TL_securePlainEmail(); + break; + case 0x7d6099dd: + result = new TL_securePlainPhone(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in SecurePlainData", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_securePlainEmail extends SecurePlainData { - public static int constructor = 0x21ec5a5f; + public static class TL_securePlainEmail extends SecurePlainData { + public static int constructor = 0x21ec5a5f; - public String email; + public String email; - public void readParams(AbstractSerializedData stream, boolean exception) { - email = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + email = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(email); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(email); + } + } - public static class TL_securePlainPhone extends SecurePlainData { - public static int constructor = 0x7d6099dd; + public static class TL_securePlainPhone extends SecurePlainData { + public static int constructor = 0x7d6099dd; - public String phone; + public String phone; - public void readParams(AbstractSerializedData stream, boolean exception) { - phone = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + phone = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(phone); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(phone); + } + } - public static class TL_secureSecretSettings extends TLObject { - public static int constructor = 0x1527bcac; + public static class TL_secureSecretSettings extends TLObject { + public static int constructor = 0x1527bcac; - public SecurePasswordKdfAlgo secure_algo; - public byte[] secure_secret; - public long secure_secret_id; + public SecurePasswordKdfAlgo secure_algo; + public byte[] secure_secret; + public long secure_secret_id; - public static TL_secureSecretSettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_secureSecretSettings.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_secureSecretSettings", constructor)); - } else { - return null; - } - } - TL_secureSecretSettings result = new TL_secureSecretSettings(); - result.readParams(stream, exception); - return result; - } + public static TL_secureSecretSettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_secureSecretSettings.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_secureSecretSettings", constructor)); + } else { + return null; + } + } + TL_secureSecretSettings result = new TL_secureSecretSettings(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - secure_algo = SecurePasswordKdfAlgo.TLdeserialize(stream, stream.readInt32(exception), exception); - secure_secret = stream.readByteArray(exception); - secure_secret_id = stream.readInt64(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + secure_algo = SecurePasswordKdfAlgo.TLdeserialize(stream, stream.readInt32(exception), exception); + secure_secret = stream.readByteArray(exception); + secure_secret_id = stream.readInt64(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - secure_algo.serializeToStream(stream); - stream.writeByteArray(secure_secret); - stream.writeInt64(secure_secret_id); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + secure_algo.serializeToStream(stream); + stream.writeByteArray(secure_secret); + stream.writeInt64(secure_secret_id); + } + } public static class TL_emojiLanguage extends TLObject { public static int constructor = 0xb3fb5361; @@ -32979,173 +33364,173 @@ public class TLRPC { } } - public static abstract class updates_ChannelDifference extends TLObject { - public int flags; - public boolean isFinal; - public int pts; - public int timeout; - public ArrayList new_messages = new ArrayList<>(); - public ArrayList other_updates = new ArrayList<>(); - public ArrayList chats = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); + public static abstract class updates_ChannelDifference extends TLObject { + public int flags; + public boolean isFinal; + public int pts; + public int timeout; + public ArrayList new_messages = new ArrayList<>(); + public ArrayList other_updates = new ArrayList<>(); + public ArrayList chats = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); public Dialog dialog; - public ArrayList messages = new ArrayList<>(); + public ArrayList messages = new ArrayList<>(); - public static updates_ChannelDifference TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - updates_ChannelDifference result = null; - switch (constructor) { - case 0x3e11affb: - result = new TL_updates_channelDifferenceEmpty(); - break; - case 0x2064674e: - result = new TL_updates_channelDifference(); - break; + public static updates_ChannelDifference TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + updates_ChannelDifference result = null; + switch (constructor) { + case 0x3e11affb: + result = new TL_updates_channelDifferenceEmpty(); + break; + case 0x2064674e: + result = new TL_updates_channelDifference(); + break; case 0xa4bcc6fe: result = new TL_updates_channelDifferenceTooLong(); break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in updates_ChannelDifference", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in updates_ChannelDifference", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_updates_channelDifferenceEmpty extends updates_ChannelDifference { - public static int constructor = 0x3e11affb; + public static class TL_updates_channelDifferenceEmpty extends updates_ChannelDifference { + public static int constructor = 0x3e11affb; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - isFinal = (flags & 1) != 0; - pts = stream.readInt32(exception); - if ((flags & 2) != 0) { - timeout = stream.readInt32(exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + isFinal = (flags & 1) != 0; + pts = stream.readInt32(exception); + if ((flags & 2) != 0) { + timeout = stream.readInt32(exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = isFinal ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeInt32(pts); - if ((flags & 2) != 0) { - stream.writeInt32(timeout); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = isFinal ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + stream.writeInt32(pts); + if ((flags & 2) != 0) { + stream.writeInt32(timeout); + } + } + } - public static class TL_updates_channelDifference extends updates_ChannelDifference { - public static int constructor = 0x2064674e; + public static class TL_updates_channelDifference extends updates_ChannelDifference { + public static int constructor = 0x2064674e; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - isFinal = (flags & 1) != 0; - pts = stream.readInt32(exception); - if ((flags & 2) != 0) { - timeout = stream.readInt32(exception); - } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Message object = Message.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - new_messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Update object = Update.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - other_updates.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + isFinal = (flags & 1) != 0; + pts = stream.readInt32(exception); + if ((flags & 2) != 0) { + timeout = stream.readInt32(exception); + } + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + Message object = Message.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + new_messages.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + Update object = Update.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + other_updates.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + chats.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + users.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = isFinal ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeInt32(pts); - if ((flags & 2) != 0) { - stream.writeInt32(timeout); - } - stream.writeInt32(0x1cb5c415); - int count = new_messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - new_messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = other_updates.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - other_updates.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = isFinal ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + stream.writeInt32(pts); + if ((flags & 2) != 0) { + stream.writeInt32(timeout); + } + stream.writeInt32(0x1cb5c415); + int count = new_messages.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + new_messages.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = other_updates.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + other_updates.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = chats.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + chats.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = users.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + users.get(a).serializeToStream(stream); + } + } + } public static class TL_updates_channelDifferenceTooLong extends updates_ChannelDifference { public static int constructor = 0xa4bcc6fe; @@ -33234,37 +33619,39 @@ public class TLRPC { } } - public static abstract class ChannelMessagesFilter extends TLObject { - public int flags; - public boolean exclude_new_messages; - public ArrayList ranges = new ArrayList<>(); + public static abstract class ChannelMessagesFilter extends TLObject { + public int flags; + public boolean exclude_new_messages; + public ArrayList ranges = new ArrayList<>(); - public static ChannelMessagesFilter TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - ChannelMessagesFilter result = null; - switch (constructor) { - case 0x94d42ee7: - result = new TL_channelMessagesFilterEmpty(); - break; - case 0xcd77d957: - result = new TL_channelMessagesFilter(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in ChannelMessagesFilter", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static ChannelMessagesFilter TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + ChannelMessagesFilter result = null; + switch (constructor) { + case 0x94d42ee7: + result = new TL_channelMessagesFilterEmpty(); + break; + case 0xcd77d957: + result = new TL_channelMessagesFilter(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in ChannelMessagesFilter", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } public static class TL_sponsoredMessage extends TLObject { - public static int constructor = 0xd151e19a; + public static int constructor = 0x3a836df8; public int flags; public byte[] random_id; public Peer from_id; + public ChatInvite chat_invite; + public String chat_invite_hash; public int channel_post; public String start_param; public String message; @@ -33286,7 +33673,15 @@ public class TLRPC { public void readParams(AbstractSerializedData stream, boolean exception) { flags = stream.readInt32(exception); random_id = stream.readByteArray(exception); - from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 8) != 0) { + from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 16) != 0) { + chat_invite = ChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 16) != 0) { + chat_invite_hash = stream.readString(exception); + } if ((flags & 4) != 0) { channel_post = stream.readInt32(exception); } @@ -33317,7 +33712,15 @@ public class TLRPC { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeByteArray(random_id); - from_id.serializeToStream(stream); + if ((flags & 8) != 0) { + from_id.serializeToStream(stream); + } + if ((flags & 16) != 0) { + chat_invite.serializeToStream(stream); + } + if ((flags & 16) != 0) { + stream.writeString(chat_invite_hash); + } if ((flags & 4) != 0) { stream.writeInt32(channel_post); } @@ -33336,265 +33739,265 @@ public class TLRPC { } } - public static class TL_account_authorizationForm extends TLObject { - public static int constructor = 0xad2e1cd8; + public static class TL_account_authorizationForm extends TLObject { + public static int constructor = 0xad2e1cd8; - public int flags; - public ArrayList required_types = new ArrayList<>(); - public ArrayList values = new ArrayList<>(); - public ArrayList errors = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); - public String privacy_policy_url; + public int flags; + public ArrayList required_types = new ArrayList<>(); + public ArrayList values = new ArrayList<>(); + public ArrayList errors = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); + public String privacy_policy_url; - public static TL_account_authorizationForm TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_account_authorizationForm.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_account_authorizationForm", constructor)); - } else { - return null; - } - } - TL_account_authorizationForm result = new TL_account_authorizationForm(); - result.readParams(stream, exception); - return result; - } + public static TL_account_authorizationForm TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_account_authorizationForm.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_account_authorizationForm", constructor)); + } else { + return null; + } + } + TL_account_authorizationForm result = new TL_account_authorizationForm(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - SecureRequiredType object = SecureRequiredType.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - required_types.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_secureValue object = TL_secureValue.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - values.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - SecureValueError object = SecureValueError.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - errors.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - if ((flags & 1) != 0) { - privacy_policy_url = stream.readString(exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + SecureRequiredType object = SecureRequiredType.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + required_types.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + TL_secureValue object = TL_secureValue.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + values.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + SecureValueError object = SecureValueError.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + errors.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + users.add(object); + } + if ((flags & 1) != 0) { + privacy_policy_url = stream.readString(exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = required_types.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - required_types.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = values.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - values.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = errors.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - errors.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - if ((flags & 1) != 0) { - stream.writeString(privacy_policy_url); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeInt32(0x1cb5c415); + int count = required_types.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + required_types.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = values.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + values.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = errors.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + errors.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = users.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + users.get(a).serializeToStream(stream); + } + if ((flags & 1) != 0) { + stream.writeString(privacy_policy_url); + } + } + } - public static class TL_help_recentMeUrls extends TLObject { - public static int constructor = 0xe0310d7; + public static class TL_help_recentMeUrls extends TLObject { + public static int constructor = 0xe0310d7; - public ArrayList urls = new ArrayList<>(); - public ArrayList chats = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); + public ArrayList urls = new ArrayList<>(); + public ArrayList chats = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); - public static TL_help_recentMeUrls TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_help_recentMeUrls.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_help_recentMeUrls", constructor)); - } else { - return null; - } - } - TL_help_recentMeUrls result = new TL_help_recentMeUrls(); - result.readParams(stream, exception); - return result; - } + public static TL_help_recentMeUrls TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_help_recentMeUrls.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_help_recentMeUrls", constructor)); + } else { + return null; + } + } + TL_help_recentMeUrls result = new TL_help_recentMeUrls(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RecentMeUrl object = RecentMeUrl.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - urls.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + RecentMeUrl object = RecentMeUrl.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + urls.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + chats.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + users.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = urls.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - urls.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = urls.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + urls.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = chats.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + chats.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = users.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + users.get(a).serializeToStream(stream); + } + } + } - public static class TL_channelMessagesFilterEmpty extends ChannelMessagesFilter { - public static int constructor = 0x94d42ee7; + public static class TL_channelMessagesFilterEmpty extends ChannelMessagesFilter { + public static int constructor = 0x94d42ee7; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_channelMessagesFilter extends ChannelMessagesFilter { - public static int constructor = 0xcd77d957; + public static class TL_channelMessagesFilter extends ChannelMessagesFilter { + public static int constructor = 0xcd77d957; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - exclude_new_messages = (flags & 2) != 0; - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_messageRange object = TL_messageRange.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - ranges.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + exclude_new_messages = (flags & 2) != 0; + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + TL_messageRange object = TL_messageRange.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + ranges.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = exclude_new_messages ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = ranges.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - ranges.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = exclude_new_messages ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + stream.writeInt32(0x1cb5c415); + int count = ranges.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + ranges.get(a).serializeToStream(stream); + } + } + } public static class TL_bankCardOpenUrl extends TLObject { public static int constructor = 0xf568028a; @@ -33643,7 +34046,7 @@ public class TLRPC { } } TL_contacts_resolvedPeer result = new TL_contacts_resolvedPeer(); - result.readParams(stream, exception); + result.readParams(stream, exception); return result; } @@ -33820,252 +34223,252 @@ public class TLRPC { } } - public static class TL_inputSingleMedia extends TLObject { - public static int constructor = 0x1cc6e91f; + public static class TL_inputSingleMedia extends TLObject { + public static int constructor = 0x1cc6e91f; - public int flags; - public InputMedia media; - public long random_id; - public String message; - public ArrayList entities = new ArrayList<>(); + public int flags; + public InputMedia media; + public long random_id; + public String message; + public ArrayList entities = new ArrayList<>(); - public static TL_inputSingleMedia TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_inputSingleMedia.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_inputSingleMedia", constructor)); - } else { - return null; - } - } - TL_inputSingleMedia result = new TL_inputSingleMedia(); - result.readParams(stream, exception); - return result; - } + public static TL_inputSingleMedia TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_inputSingleMedia.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_inputSingleMedia", constructor)); + } else { + return null; + } + } + TL_inputSingleMedia result = new TL_inputSingleMedia(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - media = InputMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - random_id = stream.readInt64(exception); - message = stream.readString(exception); - if ((flags & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + media = InputMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + random_id = stream.readInt64(exception); + message = stream.readString(exception); + if ((flags & 1) != 0) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + entities.add(object); + } + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - media.serializeToStream(stream); - stream.writeInt64(random_id); - stream.writeString(message); - if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + media.serializeToStream(stream); + stream.writeInt64(random_id); + stream.writeString(message); + if ((flags & 1) != 0) { + stream.writeInt32(0x1cb5c415); + int count = entities.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + entities.get(a).serializeToStream(stream); + } + } + } + } - public static class TL_inputPhoneCall extends TLObject { - public static int constructor = 0x1e36fded; + public static class TL_inputPhoneCall extends TLObject { + public static int constructor = 0x1e36fded; - public long id; - public long access_hash; + public long id; + public long access_hash; - public static TL_inputPhoneCall TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_inputPhoneCall.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_inputPhoneCall", constructor)); - } else { - return null; - } - } - TL_inputPhoneCall result = new TL_inputPhoneCall(); - result.readParams(stream, exception); - return result; - } + public static TL_inputPhoneCall TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_inputPhoneCall.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_inputPhoneCall", constructor)); + } else { + return null; + } + } + TL_inputPhoneCall result = new TL_inputPhoneCall(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + } + } - public static abstract class WebDocument extends TLObject { - public String url; - public long access_hash; - public int size; - public String mime_type; - public ArrayList attributes = new ArrayList<>(); + public static abstract class WebDocument extends TLObject { + public String url; + public long access_hash; + public int size; + public String mime_type; + public ArrayList attributes = new ArrayList<>(); - public static WebDocument TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - WebDocument result = null; - switch (constructor) { - case 0xf9c8bcc6: - result = new TL_webDocumentNoProxy(); - break; - case 0xc61acbd8: - result = new TL_webDocument_layer81(); - break; - case 0x1c570ed1: - result = new TL_webDocument(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in WebDocument", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static WebDocument TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + WebDocument result = null; + switch (constructor) { + case 0xf9c8bcc6: + result = new TL_webDocumentNoProxy(); + break; + case 0xc61acbd8: + result = new TL_webDocument_layer81(); + break; + case 0x1c570ed1: + result = new TL_webDocument(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in WebDocument", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_webDocumentNoProxy extends WebDocument { - public static int constructor = 0xf9c8bcc6; + public static class TL_webDocumentNoProxy extends WebDocument { + public static int constructor = 0xf9c8bcc6; - public void readParams(AbstractSerializedData stream, boolean exception) { - url = stream.readString(exception); - size = stream.readInt32(exception); - mime_type = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + url = stream.readString(exception); + size = stream.readInt32(exception); + mime_type = stream.readString(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + attributes.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(url); - stream.writeInt32(size); - stream.writeString(mime_type); - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(url); + stream.writeInt32(size); + stream.writeString(mime_type); + stream.writeInt32(0x1cb5c415); + int count = attributes.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + attributes.get(a).serializeToStream(stream); + } + } + } - public static class TL_webDocument_layer81 extends TL_webDocument { - public static int constructor = 0xc61acbd8; + public static class TL_webDocument_layer81 extends TL_webDocument { + public static int constructor = 0xc61acbd8; - public void readParams(AbstractSerializedData stream, boolean exception) { - url = stream.readString(exception); - access_hash = stream.readInt64(exception); - size = stream.readInt32(exception); - mime_type = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); - } - stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + url = stream.readString(exception); + access_hash = stream.readInt64(exception); + size = stream.readInt32(exception); + mime_type = stream.readString(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + attributes.add(object); + } + stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(url); - stream.writeInt64(access_hash); - stream.writeInt32(size); - stream.writeString(mime_type); - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } - stream.writeInt32(0); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(url); + stream.writeInt64(access_hash); + stream.writeInt32(size); + stream.writeString(mime_type); + stream.writeInt32(0x1cb5c415); + int count = attributes.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + attributes.get(a).serializeToStream(stream); + } + stream.writeInt32(0); + } + } - public static class TL_webDocument extends WebDocument { - public static int constructor = 0x1c570ed1; + public static class TL_webDocument extends WebDocument { + public static int constructor = 0x1c570ed1; - public void readParams(AbstractSerializedData stream, boolean exception) { - url = stream.readString(exception); - access_hash = stream.readInt64(exception); - size = stream.readInt32(exception); - mime_type = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + url = stream.readString(exception); + access_hash = stream.readInt64(exception); + size = stream.readInt32(exception); + mime_type = stream.readString(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + attributes.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(url); - stream.writeInt64(access_hash); - stream.writeInt32(size); - stream.writeString(mime_type); - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(url); + stream.writeInt64(access_hash); + stream.writeInt32(size); + stream.writeString(mime_type); + stream.writeInt32(0x1cb5c415); + int count = attributes.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + attributes.get(a).serializeToStream(stream); + } + } + } public static abstract class help_PromoData extends TLObject { @@ -34186,27 +34589,27 @@ public class TLRPC { } } - public static abstract class ChannelParticipant extends TLObject { + public static abstract class ChannelParticipant extends TLObject { public Peer peer; - public long kicked_by; - public int date; - public TL_channelBannedRights_layer92 banned_rights_layer92; - public long inviter_id; - public int flags; - public boolean can_edit; + public long kicked_by; + public int date; + public TL_channelBannedRights_layer92 banned_rights_layer92; + public long inviter_id; + public int flags; + public boolean can_edit; public boolean self; - public boolean left; - public long promoted_by; - public TL_channelAdminRights_layer92 admin_rights_layer92; + public boolean left; + public long promoted_by; + public TL_channelAdminRights_layer92 admin_rights_layer92; public TL_chatAdminRights admin_rights; public TL_chatBannedRights banned_rights; public String rank; public boolean via_invite; public long user_id; - public static ChannelParticipant TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - ChannelParticipant result = null; - switch (constructor) { + public static ChannelParticipant TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + ChannelParticipant result = null; + switch (constructor) { case 0x222c1886: result = new TL_channelParticipantBanned_layer92(); break; @@ -34273,16 +34676,16 @@ public class TLRPC { case 0x8cc5e69a: result = new TL_channelParticipantKicked_layer67(); break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in ChannelParticipant", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in ChannelParticipant", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } public static class TL_channelParticipant extends ChannelParticipant { public static int constructor = 0xc00c07c0; @@ -34507,75 +34910,75 @@ public class TLRPC { } } - public static class TL_channelParticipantCreator_layer103 extends TL_channelParticipantCreator { - public static int constructor = 0xe3e2e1f9; + public static class TL_channelParticipantCreator_layer103 extends TL_channelParticipantCreator { + public static int constructor = 0xe3e2e1f9; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(AbstractSerializedData stream, boolean exception) { peer = new TLRPC.TL_peerUser(); peer.user_id = stream.readInt32(exception); - } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32((int) peer.user_id); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32((int) peer.user_id); + } + } - public static class TL_channelParticipant_layer131 extends TL_channelParticipant { - public static int constructor = 0x15ebac1d; + public static class TL_channelParticipant_layer131 extends TL_channelParticipant { + public static int constructor = 0x15ebac1d; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(AbstractSerializedData stream, boolean exception) { peer = new TLRPC.TL_peerUser(); peer.user_id = stream.readInt32(exception); - date = stream.readInt32(exception); - } + date = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32((int) peer.user_id); - stream.writeInt32(date); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32((int) peer.user_id); + stream.writeInt32(date); + } + } - public static class TL_channelParticipantKicked_layer67 extends ChannelParticipant { - public static int constructor = 0x8cc5e69a; + public static class TL_channelParticipantKicked_layer67 extends ChannelParticipant { + public static int constructor = 0x8cc5e69a; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(AbstractSerializedData stream, boolean exception) { peer = new TLRPC.TL_peerUser(); peer.user_id = stream.readInt32(exception); - kicked_by = stream.readInt32(exception); - date = stream.readInt32(exception); - } + kicked_by = stream.readInt32(exception); + date = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32((int) peer.user_id); - stream.writeInt32((int) kicked_by); - stream.writeInt32(date); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32((int) peer.user_id); + stream.writeInt32((int) kicked_by); + stream.writeInt32(date); + } + } - public static class TL_channelParticipantSelf_layer131 extends TL_channelParticipantSelf { - public static int constructor = 0xa3289a6d; + public static class TL_channelParticipantSelf_layer131 extends TL_channelParticipantSelf { + public static int constructor = 0xa3289a6d; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(AbstractSerializedData stream, boolean exception) { peer = new TLRPC.TL_peerUser(); peer.user_id = stream.readInt32(exception); - inviter_id = stream.readInt32(exception); - date = stream.readInt32(exception); - } + inviter_id = stream.readInt32(exception); + date = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32((int) peer.user_id); - stream.writeInt32((int) inviter_id); - stream.writeInt32(date); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32((int) peer.user_id); + stream.writeInt32((int) inviter_id); + stream.writeInt32(date); + } + } public static class TL_channelParticipantAdmin_layer131 extends TL_channelParticipantAdmin { public static int constructor = 0xccbebbaf; @@ -34664,71 +35067,71 @@ public class TLRPC { } } - public static class TL_channelParticipantModerator_layer67 extends TL_channelParticipantAdmin { - public static int constructor = 0x91057fef; + public static class TL_channelParticipantModerator_layer67 extends TL_channelParticipantAdmin { + public static int constructor = 0x91057fef; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(AbstractSerializedData stream, boolean exception) { peer = new TLRPC.TL_peerUser(); peer.user_id = stream.readInt32(exception); - inviter_id = stream.readInt32(exception); - date = stream.readInt32(exception); - } + inviter_id = stream.readInt32(exception); + date = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32((int) peer.user_id); - stream.writeInt32((int) inviter_id); - stream.writeInt32(date); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32((int) peer.user_id); + stream.writeInt32((int) inviter_id); + stream.writeInt32(date); + } + } - public static class TL_channelParticipantEditor_layer67 extends TL_channelParticipantAdmin { - public static int constructor = 0x98192d61; + public static class TL_channelParticipantEditor_layer67 extends TL_channelParticipantAdmin { + public static int constructor = 0x98192d61; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(AbstractSerializedData stream, boolean exception) { peer = new TLRPC.TL_peerUser(); peer.user_id = stream.readInt32(exception); - inviter_id = stream.readInt32(exception); - date = stream.readInt32(exception); - } + inviter_id = stream.readInt32(exception); + date = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32((int) peer.user_id); - stream.writeInt32((int) inviter_id); - stream.writeInt32(date); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32((int) peer.user_id); + stream.writeInt32((int) inviter_id); + stream.writeInt32(date); + } + } - public static class TL_channelParticipantAdmin_layer92 extends TL_channelParticipantAdmin { - public static int constructor = 0xa82fa898; + public static class TL_channelParticipantAdmin_layer92 extends TL_channelParticipantAdmin { + public static int constructor = 0xa82fa898; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - can_edit = (flags & 1) != 0; + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + can_edit = (flags & 1) != 0; peer = new TLRPC.TL_peerUser(); peer.user_id = stream.readInt32(exception); - inviter_id = stream.readInt32(exception); - promoted_by = stream.readInt32(exception); - date = stream.readInt32(exception); - admin_rights_layer92 = TL_channelAdminRights_layer92.TLdeserialize(stream, stream.readInt32(exception), exception); + inviter_id = stream.readInt32(exception); + promoted_by = stream.readInt32(exception); + date = stream.readInt32(exception); + admin_rights_layer92 = TL_channelAdminRights_layer92.TLdeserialize(stream, stream.readInt32(exception), exception); admin_rights = Chat.mergeAdminRights(admin_rights_layer92); - } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = can_edit ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeInt32((int) peer.user_id); - stream.writeInt32((int) inviter_id); - stream.writeInt32((int) promoted_by); - stream.writeInt32(date); - admin_rights_layer92.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = can_edit ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + stream.writeInt32((int) peer.user_id); + stream.writeInt32((int) inviter_id); + stream.writeInt32((int) promoted_by); + stream.writeInt32(date); + admin_rights_layer92.serializeToStream(stream); + } + } public static class TL_channelParticipantAdmin_layer103 extends TL_channelParticipantAdmin { public static int constructor = 0x5daa6e23; @@ -34763,82 +35166,82 @@ public class TLRPC { } } - public static abstract class InputStickeredMedia extends TLObject { + public static abstract class InputStickeredMedia extends TLObject { - public static InputStickeredMedia TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - InputStickeredMedia result = null; - switch (constructor) { - case 0x438865b: - result = new TL_inputStickeredMediaDocument(); - break; - case 0x4a992157: - result = new TL_inputStickeredMediaPhoto(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in InputStickeredMedia", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static InputStickeredMedia TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + InputStickeredMedia result = null; + switch (constructor) { + case 0x438865b: + result = new TL_inputStickeredMediaDocument(); + break; + case 0x4a992157: + result = new TL_inputStickeredMediaPhoto(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in InputStickeredMedia", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_inputStickeredMediaDocument extends InputStickeredMedia { - public static int constructor = 0x438865b; + public static class TL_inputStickeredMediaDocument extends InputStickeredMedia { + public static int constructor = 0x438865b; - public InputDocument id; + public InputDocument id; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = InputDocument.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = InputDocument.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - id.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + id.serializeToStream(stream); + } + } - public static class TL_inputStickeredMediaPhoto extends InputStickeredMedia { - public static int constructor = 0x4a992157; + public static class TL_inputStickeredMediaPhoto extends InputStickeredMedia { + public static int constructor = 0x4a992157; - public InputPhoto id; + public InputPhoto id; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = InputPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = InputPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - id.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + id.serializeToStream(stream); + } + } - public static abstract class channels_ChannelParticipants extends TLObject { - public int count; - public ArrayList participants = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); + public static abstract class channels_ChannelParticipants extends TLObject { + public int count; + public ArrayList participants = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); - public static channels_ChannelParticipants TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - channels_ChannelParticipants result = null; - switch (constructor) { + public static channels_ChannelParticipants TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + channels_ChannelParticipants result = null; + switch (constructor) { case 0x9ab0feaf: result = new TL_channels_channelParticipants(); break; - case 0xf0173fe9: - result = new TL_channels_channelParticipantsNotModified(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in channels_ChannelParticipants", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + case 0xf0173fe9: + result = new TL_channels_channelParticipantsNotModified(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in channels_ChannelParticipants", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } public static class TL_channels_channelParticipants extends channels_ChannelParticipants { public static int constructor = 0x9ab0feaf; @@ -34921,14 +35324,14 @@ public class TLRPC { } } - public static class TL_channels_channelParticipantsNotModified extends channels_ChannelParticipants { - public static int constructor = 0xf0173fe9; + public static class TL_channels_channelParticipantsNotModified extends channels_ChannelParticipants { + public static int constructor = 0xf0173fe9; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static abstract class WallPaperSettings extends TLObject { @@ -35091,130 +35494,130 @@ public class TLRPC { } } - public static class TL_contacts_found extends TLObject { - public static int constructor = 0xb3134d9d; + public static class TL_contacts_found extends TLObject { + public static int constructor = 0xb3134d9d; - public ArrayList my_results = new ArrayList<>(); - public ArrayList results = new ArrayList<>(); - public ArrayList chats = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); + public ArrayList my_results = new ArrayList<>(); + public ArrayList results = new ArrayList<>(); + public ArrayList chats = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); - public static TL_contacts_found TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_contacts_found.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_contacts_found", constructor)); - } else { - return null; - } - } - TL_contacts_found result = new TL_contacts_found(); - result.readParams(stream, exception); - return result; - } + public static TL_contacts_found TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_contacts_found.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_contacts_found", constructor)); + } else { + return null; + } + } + TL_contacts_found result = new TL_contacts_found(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Peer object = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - my_results.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Peer object = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - results.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + Peer object = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + my_results.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + Peer object = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + results.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + chats.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + users.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = my_results.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - my_results.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = results.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - results.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = my_results.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + my_results.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = results.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + results.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = chats.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + chats.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = users.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + users.get(a).serializeToStream(stream); + } + } + } - public static abstract class ChatParticipants extends TLObject { - public int flags; - public long chat_id; - public ChatParticipant self_participant; - public ArrayList participants = new ArrayList<>(); - public int version; - public long admin_id; + public static abstract class ChatParticipants extends TLObject { + public int flags; + public long chat_id; + public ChatParticipant self_participant; + public ArrayList participants = new ArrayList<>(); + public int version; + public long admin_id; - public static ChatParticipants TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - ChatParticipants result = null; - switch (constructor) { + public static ChatParticipants TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + ChatParticipants result = null; + switch (constructor) { case 0xfc900c2b: result = new TL_chatParticipantsForbidden_layer131(); break; @@ -35233,16 +35636,16 @@ public class TLRPC { case 0xfd2bb8a: result = new TL_chatParticipantsForbidden_old(); break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in ChatParticipants", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in ChatParticipants", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } public static class TL_chatParticipantsForbidden_layer131 extends TL_chatParticipantsForbidden { public static int constructor = 0xfc900c2b; @@ -35415,557 +35818,557 @@ public class TLRPC { } } - public static class TL_game extends TLObject { - public static int constructor = 0xbdf9653b; - - public int flags; - public long id; - public long access_hash; - public String short_name; - public String title; - public String description; - public Photo photo; - public Document document; - - public static TL_game TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_game.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_game", constructor)); - } else { - return null; - } - } - TL_game result = new TL_game(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - short_name = stream.readString(exception); - title = stream.readString(exception); - description = stream.readString(exception); - photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 1) != 0) { - document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeString(short_name); - stream.writeString(title); - stream.writeString(description); - photo.serializeToStream(stream); - if ((flags & 1) != 0) { - document.serializeToStream(stream); - } - } - } - - public static abstract class DecryptedMessageMedia extends TLObject { - public int duration; - public String mime_type; - public int size; - public byte[] key; - public byte[] iv; - public double lat; - public double _long; - public String phone_number; - public String first_name; - public String last_name; - public long user_id; - public int thumb_w; - public int thumb_h; - public ArrayList attributes = new ArrayList<>(); - public String caption; - public String url; - public int w; - public int h; - public String file_name; - public String title; - public String address; - public String provider; - public String venue_id; - public long id; - public long access_hash; - public int date; - public int dc_id; - - public static DecryptedMessageMedia TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - DecryptedMessageMedia result = null; - switch (constructor) { - case 0x57e0a9cb: - result = new TL_decryptedMessageMediaAudio(); - break; - case 0x35480a59: - result = new TL_decryptedMessageMediaGeoPoint(); - break; - case 0x588a0a97: - result = new TL_decryptedMessageMediaContact(); - break; - case 0x89f5c4a: - result = new TL_decryptedMessageMediaEmpty(); - break; - case 0x7afe8ae2: - result = new TL_decryptedMessageMediaDocument(); - break; - case 0xe50511d8: - result = new TL_decryptedMessageMediaWebPage(); - break; - case 0xf1fa8d78: - result = new TL_decryptedMessageMediaPhoto(); - break; - case 0x970c8c0e: - result = new TL_decryptedMessageMediaVideo(); - break; - case 0xb095434b: - result = new TL_decryptedMessageMediaDocument_layer8(); - break; - case 0x4cee6ef3: - result = new TL_decryptedMessageMediaVideo_layer8(); - break; - case 0x8a0df56f: - result = new TL_decryptedMessageMediaVenue(); - break; - case 0xfa95b0dd: - result = new TL_decryptedMessageMediaExternalDocument(); - break; - case 0x524a415d: - result = new TL_decryptedMessageMediaVideo_layer17(); - break; - case 0x6080758f: - result = new TL_decryptedMessageMediaAudio_layer8(); - break; - case 0x32798a8c: - result = new TL_decryptedMessageMediaPhoto_layer8(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in DecryptedMessageMedia", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } - - public static class TL_decryptedMessageMediaAudio extends DecryptedMessageMedia { - public static int constructor = 0x57e0a9cb; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - duration = stream.readInt32(exception); - mime_type = stream.readString(exception); - size = stream.readInt32(exception); - key = stream.readByteArray(exception); - iv = stream.readByteArray(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(duration); - stream.writeString(mime_type); - stream.writeInt32(size); - stream.writeByteArray(key); - stream.writeByteArray(iv); - } - } - - public static class TL_decryptedMessageMediaGeoPoint extends DecryptedMessageMedia { - public static int constructor = 0x35480a59; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - lat = stream.readDouble(exception); - _long = stream.readDouble(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeDouble(lat); - stream.writeDouble(_long); - } - } - - public static class TL_decryptedMessageMediaContact extends DecryptedMessageMedia { - public static int constructor = 0x588a0a97; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - phone_number = stream.readString(exception); - first_name = stream.readString(exception); - last_name = stream.readString(exception); - user_id = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(phone_number); - stream.writeString(first_name); - stream.writeString(last_name); - stream.writeInt32((int) user_id); - } - } - - public static class TL_decryptedMessageMediaEmpty extends DecryptedMessageMedia { - public static int constructor = 0x89f5c4a; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_decryptedMessageMediaDocument extends DecryptedMessageMedia { - public static int constructor = 0x7afe8ae2; - - public byte[] thumb; - - public void readParams(AbstractSerializedData stream, boolean exception) { - thumb = stream.readByteArray(exception); - thumb_w = stream.readInt32(exception); - thumb_h = stream.readInt32(exception); - mime_type = stream.readString(exception); - size = stream.readInt32(exception); - key = stream.readByteArray(exception); - iv = stream.readByteArray(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); - } - caption = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(thumb); - stream.writeInt32(thumb_w); - stream.writeInt32(thumb_h); - stream.writeString(mime_type); - stream.writeInt32(size); - stream.writeByteArray(key); - stream.writeByteArray(iv); - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } - stream.writeString(caption); - } - } - - public static class TL_decryptedMessageMediaWebPage extends DecryptedMessageMedia { - public static int constructor = 0xe50511d8; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - url = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(url); - } - } - - public static class TL_decryptedMessageMediaPhoto extends DecryptedMessageMedia { - public static int constructor = 0xf1fa8d78; - - public byte[] thumb; - - public void readParams(AbstractSerializedData stream, boolean exception) { - thumb = stream.readByteArray(exception); - thumb_w = stream.readInt32(exception); - thumb_h = stream.readInt32(exception); - w = stream.readInt32(exception); - h = stream.readInt32(exception); - size = stream.readInt32(exception); - key = stream.readByteArray(exception); - iv = stream.readByteArray(exception); - caption = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(thumb); - stream.writeInt32(thumb_w); - stream.writeInt32(thumb_h); - stream.writeInt32(w); - stream.writeInt32(h); - stream.writeInt32(size); - stream.writeByteArray(key); - stream.writeByteArray(iv); - stream.writeString(caption); - } - } - - public static class TL_decryptedMessageMediaVideo extends DecryptedMessageMedia { - public static int constructor = 0x970c8c0e; - - public byte[] thumb; - - public void readParams(AbstractSerializedData stream, boolean exception) { - thumb = stream.readByteArray(exception); - thumb_w = stream.readInt32(exception); - thumb_h = stream.readInt32(exception); - duration = stream.readInt32(exception); - mime_type = stream.readString(exception); - w = stream.readInt32(exception); - h = stream.readInt32(exception); - size = stream.readInt32(exception); - key = stream.readByteArray(exception); - iv = stream.readByteArray(exception); - caption = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(thumb); - stream.writeInt32(thumb_w); - stream.writeInt32(thumb_h); - stream.writeInt32(duration); - stream.writeString(mime_type); - stream.writeInt32(w); - stream.writeInt32(h); - stream.writeInt32(size); - stream.writeByteArray(key); - stream.writeByteArray(iv); - stream.writeString(caption); - } - } - - public static class TL_decryptedMessageMediaDocument_layer8 extends TL_decryptedMessageMediaDocument { - public static int constructor = 0xb095434b; - - public byte[] thumb; - - public void readParams(AbstractSerializedData stream, boolean exception) { - thumb = stream.readByteArray(exception); - thumb_w = stream.readInt32(exception); - thumb_h = stream.readInt32(exception); - file_name = stream.readString(exception); - mime_type = stream.readString(exception); - size = stream.readInt32(exception); - key = stream.readByteArray(exception); - iv = stream.readByteArray(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(thumb); - stream.writeInt32(thumb_w); - stream.writeInt32(thumb_h); - stream.writeString(file_name); - stream.writeString(mime_type); - stream.writeInt32(size); - stream.writeByteArray(key); - stream.writeByteArray(iv); - } - } - - public static class TL_decryptedMessageMediaVideo_layer8 extends TL_decryptedMessageMediaVideo { - public static int constructor = 0x4cee6ef3; - - public byte[] thumb; - - public void readParams(AbstractSerializedData stream, boolean exception) { - thumb = stream.readByteArray(exception); - thumb_w = stream.readInt32(exception); - thumb_h = stream.readInt32(exception); - duration = stream.readInt32(exception); - w = stream.readInt32(exception); - h = stream.readInt32(exception); - size = stream.readInt32(exception); - key = stream.readByteArray(exception); - iv = stream.readByteArray(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(thumb); - stream.writeInt32(thumb_w); - stream.writeInt32(thumb_h); - stream.writeInt32(duration); - stream.writeInt32(w); - stream.writeInt32(h); - stream.writeInt32(size); - stream.writeByteArray(key); - stream.writeByteArray(iv); - } - } - - public static class TL_decryptedMessageMediaVenue extends DecryptedMessageMedia { - public static int constructor = 0x8a0df56f; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - lat = stream.readDouble(exception); - _long = stream.readDouble(exception); - title = stream.readString(exception); - address = stream.readString(exception); - provider = stream.readString(exception); - venue_id = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeDouble(lat); - stream.writeDouble(_long); - stream.writeString(title); - stream.writeString(address); - stream.writeString(provider); - stream.writeString(venue_id); - } - } - - public static class TL_decryptedMessageMediaExternalDocument extends DecryptedMessageMedia { - public static int constructor = 0xfa95b0dd; - - public PhotoSize thumb; - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - date = stream.readInt32(exception); - mime_type = stream.readString(exception); - size = stream.readInt32(exception); - thumb = PhotoSize.TLdeserialize(0, id, 0, stream, stream.readInt32(exception), exception); - dc_id = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(date); - stream.writeString(mime_type); - stream.writeInt32(size); - thumb.serializeToStream(stream); - stream.writeInt32(dc_id); - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } - } - } - - public static class TL_decryptedMessageMediaVideo_layer17 extends TL_decryptedMessageMediaVideo { - public static int constructor = 0x524a415d; - - public byte[] thumb; - - public void readParams(AbstractSerializedData stream, boolean exception) { - thumb = stream.readByteArray(exception); - thumb_w = stream.readInt32(exception); - thumb_h = stream.readInt32(exception); - duration = stream.readInt32(exception); - mime_type = stream.readString(exception); - w = stream.readInt32(exception); - h = stream.readInt32(exception); - size = stream.readInt32(exception); - key = stream.readByteArray(exception); - iv = stream.readByteArray(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(thumb); - stream.writeInt32(thumb_w); - stream.writeInt32(thumb_h); - stream.writeInt32(duration); - stream.writeString(mime_type); - stream.writeInt32(w); - stream.writeInt32(h); - stream.writeInt32(size); - stream.writeByteArray(key); - stream.writeByteArray(iv); - } - } - - public static class TL_decryptedMessageMediaAudio_layer8 extends TL_decryptedMessageMediaAudio { - public static int constructor = 0x6080758f; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - duration = stream.readInt32(exception); - size = stream.readInt32(exception); - key = stream.readByteArray(exception); - iv = stream.readByteArray(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(duration); - stream.writeInt32(size); - stream.writeByteArray(key); - stream.writeByteArray(iv); - } - } - - public static class TL_decryptedMessageMediaPhoto_layer8 extends TL_decryptedMessageMediaPhoto { - public static int constructor = 0x32798a8c; - - public byte[] thumb; - - public void readParams(AbstractSerializedData stream, boolean exception) { - thumb = stream.readByteArray(exception); - thumb_w = stream.readInt32(exception); - thumb_h = stream.readInt32(exception); - w = stream.readInt32(exception); - h = stream.readInt32(exception); - size = stream.readInt32(exception); - key = stream.readByteArray(exception); - iv = stream.readByteArray(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(thumb); - stream.writeInt32(thumb_w); - stream.writeInt32(thumb_h); - stream.writeInt32(w); - stream.writeInt32(h); - stream.writeInt32(size); - stream.writeByteArray(key); - stream.writeByteArray(iv); - } - } + public static class TL_game extends TLObject { + public static int constructor = 0xbdf9653b; + + public int flags; + public long id; + public long access_hash; + public String short_name; + public String title; + public String description; + public Photo photo; + public Document document; + + public static TL_game TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_game.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_game", constructor)); + } else { + return null; + } + } + TL_game result = new TL_game(); + result.readParams(stream, exception); + return result; + } + + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + short_name = stream.readString(exception); + title = stream.readString(exception); + description = stream.readString(exception); + photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 1) != 0) { + document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeString(short_name); + stream.writeString(title); + stream.writeString(description); + photo.serializeToStream(stream); + if ((flags & 1) != 0) { + document.serializeToStream(stream); + } + } + } + + public static abstract class DecryptedMessageMedia extends TLObject { + public int duration; + public String mime_type; + public int size; + public byte[] key; + public byte[] iv; + public double lat; + public double _long; + public String phone_number; + public String first_name; + public String last_name; + public long user_id; + public int thumb_w; + public int thumb_h; + public ArrayList attributes = new ArrayList<>(); + public String caption; + public String url; + public int w; + public int h; + public String file_name; + public String title; + public String address; + public String provider; + public String venue_id; + public long id; + public long access_hash; + public int date; + public int dc_id; + + public static DecryptedMessageMedia TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + DecryptedMessageMedia result = null; + switch (constructor) { + case 0x57e0a9cb: + result = new TL_decryptedMessageMediaAudio(); + break; + case 0x35480a59: + result = new TL_decryptedMessageMediaGeoPoint(); + break; + case 0x588a0a97: + result = new TL_decryptedMessageMediaContact(); + break; + case 0x89f5c4a: + result = new TL_decryptedMessageMediaEmpty(); + break; + case 0x7afe8ae2: + result = new TL_decryptedMessageMediaDocument(); + break; + case 0xe50511d8: + result = new TL_decryptedMessageMediaWebPage(); + break; + case 0xf1fa8d78: + result = new TL_decryptedMessageMediaPhoto(); + break; + case 0x970c8c0e: + result = new TL_decryptedMessageMediaVideo(); + break; + case 0xb095434b: + result = new TL_decryptedMessageMediaDocument_layer8(); + break; + case 0x4cee6ef3: + result = new TL_decryptedMessageMediaVideo_layer8(); + break; + case 0x8a0df56f: + result = new TL_decryptedMessageMediaVenue(); + break; + case 0xfa95b0dd: + result = new TL_decryptedMessageMediaExternalDocument(); + break; + case 0x524a415d: + result = new TL_decryptedMessageMediaVideo_layer17(); + break; + case 0x6080758f: + result = new TL_decryptedMessageMediaAudio_layer8(); + break; + case 0x32798a8c: + result = new TL_decryptedMessageMediaPhoto_layer8(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in DecryptedMessageMedia", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } + + public static class TL_decryptedMessageMediaAudio extends DecryptedMessageMedia { + public static int constructor = 0x57e0a9cb; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + duration = stream.readInt32(exception); + mime_type = stream.readString(exception); + size = stream.readInt32(exception); + key = stream.readByteArray(exception); + iv = stream.readByteArray(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(duration); + stream.writeString(mime_type); + stream.writeInt32(size); + stream.writeByteArray(key); + stream.writeByteArray(iv); + } + } + + public static class TL_decryptedMessageMediaGeoPoint extends DecryptedMessageMedia { + public static int constructor = 0x35480a59; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + lat = stream.readDouble(exception); + _long = stream.readDouble(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeDouble(lat); + stream.writeDouble(_long); + } + } + + public static class TL_decryptedMessageMediaContact extends DecryptedMessageMedia { + public static int constructor = 0x588a0a97; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + phone_number = stream.readString(exception); + first_name = stream.readString(exception); + last_name = stream.readString(exception); + user_id = stream.readInt32(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(phone_number); + stream.writeString(first_name); + stream.writeString(last_name); + stream.writeInt32((int) user_id); + } + } + + public static class TL_decryptedMessageMediaEmpty extends DecryptedMessageMedia { + public static int constructor = 0x89f5c4a; + + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_decryptedMessageMediaDocument extends DecryptedMessageMedia { + public static int constructor = 0x7afe8ae2; + + public byte[] thumb; + + public void readParams(AbstractSerializedData stream, boolean exception) { + thumb = stream.readByteArray(exception); + thumb_w = stream.readInt32(exception); + thumb_h = stream.readInt32(exception); + mime_type = stream.readString(exception); + size = stream.readInt32(exception); + key = stream.readByteArray(exception); + iv = stream.readByteArray(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + attributes.add(object); + } + caption = stream.readString(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeByteArray(thumb); + stream.writeInt32(thumb_w); + stream.writeInt32(thumb_h); + stream.writeString(mime_type); + stream.writeInt32(size); + stream.writeByteArray(key); + stream.writeByteArray(iv); + stream.writeInt32(0x1cb5c415); + int count = attributes.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + attributes.get(a).serializeToStream(stream); + } + stream.writeString(caption); + } + } + + public static class TL_decryptedMessageMediaWebPage extends DecryptedMessageMedia { + public static int constructor = 0xe50511d8; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + url = stream.readString(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(url); + } + } + + public static class TL_decryptedMessageMediaPhoto extends DecryptedMessageMedia { + public static int constructor = 0xf1fa8d78; + + public byte[] thumb; + + public void readParams(AbstractSerializedData stream, boolean exception) { + thumb = stream.readByteArray(exception); + thumb_w = stream.readInt32(exception); + thumb_h = stream.readInt32(exception); + w = stream.readInt32(exception); + h = stream.readInt32(exception); + size = stream.readInt32(exception); + key = stream.readByteArray(exception); + iv = stream.readByteArray(exception); + caption = stream.readString(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeByteArray(thumb); + stream.writeInt32(thumb_w); + stream.writeInt32(thumb_h); + stream.writeInt32(w); + stream.writeInt32(h); + stream.writeInt32(size); + stream.writeByteArray(key); + stream.writeByteArray(iv); + stream.writeString(caption); + } + } + + public static class TL_decryptedMessageMediaVideo extends DecryptedMessageMedia { + public static int constructor = 0x970c8c0e; + + public byte[] thumb; + + public void readParams(AbstractSerializedData stream, boolean exception) { + thumb = stream.readByteArray(exception); + thumb_w = stream.readInt32(exception); + thumb_h = stream.readInt32(exception); + duration = stream.readInt32(exception); + mime_type = stream.readString(exception); + w = stream.readInt32(exception); + h = stream.readInt32(exception); + size = stream.readInt32(exception); + key = stream.readByteArray(exception); + iv = stream.readByteArray(exception); + caption = stream.readString(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeByteArray(thumb); + stream.writeInt32(thumb_w); + stream.writeInt32(thumb_h); + stream.writeInt32(duration); + stream.writeString(mime_type); + stream.writeInt32(w); + stream.writeInt32(h); + stream.writeInt32(size); + stream.writeByteArray(key); + stream.writeByteArray(iv); + stream.writeString(caption); + } + } + + public static class TL_decryptedMessageMediaDocument_layer8 extends TL_decryptedMessageMediaDocument { + public static int constructor = 0xb095434b; + + public byte[] thumb; + + public void readParams(AbstractSerializedData stream, boolean exception) { + thumb = stream.readByteArray(exception); + thumb_w = stream.readInt32(exception); + thumb_h = stream.readInt32(exception); + file_name = stream.readString(exception); + mime_type = stream.readString(exception); + size = stream.readInt32(exception); + key = stream.readByteArray(exception); + iv = stream.readByteArray(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeByteArray(thumb); + stream.writeInt32(thumb_w); + stream.writeInt32(thumb_h); + stream.writeString(file_name); + stream.writeString(mime_type); + stream.writeInt32(size); + stream.writeByteArray(key); + stream.writeByteArray(iv); + } + } + + public static class TL_decryptedMessageMediaVideo_layer8 extends TL_decryptedMessageMediaVideo { + public static int constructor = 0x4cee6ef3; + + public byte[] thumb; + + public void readParams(AbstractSerializedData stream, boolean exception) { + thumb = stream.readByteArray(exception); + thumb_w = stream.readInt32(exception); + thumb_h = stream.readInt32(exception); + duration = stream.readInt32(exception); + w = stream.readInt32(exception); + h = stream.readInt32(exception); + size = stream.readInt32(exception); + key = stream.readByteArray(exception); + iv = stream.readByteArray(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeByteArray(thumb); + stream.writeInt32(thumb_w); + stream.writeInt32(thumb_h); + stream.writeInt32(duration); + stream.writeInt32(w); + stream.writeInt32(h); + stream.writeInt32(size); + stream.writeByteArray(key); + stream.writeByteArray(iv); + } + } + + public static class TL_decryptedMessageMediaVenue extends DecryptedMessageMedia { + public static int constructor = 0x8a0df56f; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + lat = stream.readDouble(exception); + _long = stream.readDouble(exception); + title = stream.readString(exception); + address = stream.readString(exception); + provider = stream.readString(exception); + venue_id = stream.readString(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeDouble(lat); + stream.writeDouble(_long); + stream.writeString(title); + stream.writeString(address); + stream.writeString(provider); + stream.writeString(venue_id); + } + } + + public static class TL_decryptedMessageMediaExternalDocument extends DecryptedMessageMedia { + public static int constructor = 0xfa95b0dd; + + public PhotoSize thumb; + + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + date = stream.readInt32(exception); + mime_type = stream.readString(exception); + size = stream.readInt32(exception); + thumb = PhotoSize.TLdeserialize(0, id, 0, stream, stream.readInt32(exception), exception); + dc_id = stream.readInt32(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + attributes.add(object); + } + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32(date); + stream.writeString(mime_type); + stream.writeInt32(size); + thumb.serializeToStream(stream); + stream.writeInt32(dc_id); + stream.writeInt32(0x1cb5c415); + int count = attributes.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + attributes.get(a).serializeToStream(stream); + } + } + } + + public static class TL_decryptedMessageMediaVideo_layer17 extends TL_decryptedMessageMediaVideo { + public static int constructor = 0x524a415d; + + public byte[] thumb; + + public void readParams(AbstractSerializedData stream, boolean exception) { + thumb = stream.readByteArray(exception); + thumb_w = stream.readInt32(exception); + thumb_h = stream.readInt32(exception); + duration = stream.readInt32(exception); + mime_type = stream.readString(exception); + w = stream.readInt32(exception); + h = stream.readInt32(exception); + size = stream.readInt32(exception); + key = stream.readByteArray(exception); + iv = stream.readByteArray(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeByteArray(thumb); + stream.writeInt32(thumb_w); + stream.writeInt32(thumb_h); + stream.writeInt32(duration); + stream.writeString(mime_type); + stream.writeInt32(w); + stream.writeInt32(h); + stream.writeInt32(size); + stream.writeByteArray(key); + stream.writeByteArray(iv); + } + } + + public static class TL_decryptedMessageMediaAudio_layer8 extends TL_decryptedMessageMediaAudio { + public static int constructor = 0x6080758f; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + duration = stream.readInt32(exception); + size = stream.readInt32(exception); + key = stream.readByteArray(exception); + iv = stream.readByteArray(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(duration); + stream.writeInt32(size); + stream.writeByteArray(key); + stream.writeByteArray(iv); + } + } + + public static class TL_decryptedMessageMediaPhoto_layer8 extends TL_decryptedMessageMediaPhoto { + public static int constructor = 0x32798a8c; + + public byte[] thumb; + + public void readParams(AbstractSerializedData stream, boolean exception) { + thumb = stream.readByteArray(exception); + thumb_w = stream.readInt32(exception); + thumb_h = stream.readInt32(exception); + w = stream.readInt32(exception); + h = stream.readInt32(exception); + size = stream.readInt32(exception); + key = stream.readByteArray(exception); + iv = stream.readByteArray(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeByteArray(thumb); + stream.writeInt32(thumb_w); + stream.writeInt32(thumb_h); + stream.writeInt32(w); + stream.writeInt32(h); + stream.writeInt32(size); + stream.writeByteArray(key); + stream.writeByteArray(iv); + } + } public static abstract class EmojiKeyword extends TLObject { @@ -36089,15 +36492,15 @@ public class TLRPC { } } - public static abstract class ChatParticipant extends TLObject { + public static abstract class ChatParticipant extends TLObject { - public long user_id; - public long inviter_id; - public int date; + public long user_id; + public long inviter_id; + public int date; - public static ChatParticipant TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - ChatParticipant result = null; - switch (constructor) { + public static ChatParticipant TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + ChatParticipant result = null; + switch (constructor) { case 0xe2d6e436: result = new TL_chatParticipantAdmin_layer131(); break; @@ -36116,16 +36519,16 @@ public class TLRPC { case 0xe46bcee4: result = new TL_chatParticipantCreator(); break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in ChatParticipant", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in ChatParticipant", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } public static class TL_chatParticipantAdmin_layer131 extends TL_chatParticipantAdmin { public static int constructor = 0xe2d6e436; @@ -36227,6 +36630,59 @@ public class TLRPC { } } + public static class TL_availableReaction extends TLObject { + public static int constructor = 0x21d7c4b; + + public int flags; + public boolean inactive; + public String reaction; + public String title; + public Document static_icon; + public Document appear_animation; + public Document select_animation; + public Document activate_animation; + public Document effect_animation; + public int positionInList; //custom + + public static TL_availableReaction TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_availableReaction.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_availableReaction", constructor)); + } else { + return null; + } + } + TL_availableReaction result = new TL_availableReaction(); + result.readParams(stream, exception); + return result; + } + + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + inactive = (flags & 1) != 0; + reaction = stream.readString(exception); + title = stream.readString(exception); + static_icon = Document.TLdeserialize(stream, stream.readInt32(exception), exception); + appear_animation = Document.TLdeserialize(stream, stream.readInt32(exception), exception); + select_animation = Document.TLdeserialize(stream, stream.readInt32(exception), exception); + activate_animation = Document.TLdeserialize(stream, stream.readInt32(exception), exception); + effect_animation = Document.TLdeserialize(stream, stream.readInt32(exception), exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = inactive ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + stream.writeString(reaction); + stream.writeString(title); + static_icon.serializeToStream(stream); + appear_animation.serializeToStream(stream); + select_animation.serializeToStream(stream); + activate_animation.serializeToStream(stream); + effect_animation.serializeToStream(stream); + } + } + public static class TL_webAuthorization extends TLObject { public static int constructor = 0xa6f8f452; @@ -36279,115 +36735,115 @@ public class TLRPC { } } - public static abstract class InputSecureFile extends TLObject { + public static abstract class InputSecureFile extends TLObject { - public static InputSecureFile TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - InputSecureFile result = null; - switch (constructor) { - case 0x3334b0f0: - result = new TL_inputSecureFileUploaded(); - break; - case 0x5367e5be: - result = new TL_inputSecureFile(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in InputSecureFile", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static InputSecureFile TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + InputSecureFile result = null; + switch (constructor) { + case 0x3334b0f0: + result = new TL_inputSecureFileUploaded(); + break; + case 0x5367e5be: + result = new TL_inputSecureFile(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in InputSecureFile", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_inputSecureFileUploaded extends InputSecureFile { - public static int constructor = 0x3334b0f0; + public static class TL_inputSecureFileUploaded extends InputSecureFile { + public static int constructor = 0x3334b0f0; - public long id; - public int parts; - public String md5_checksum; - public byte[] file_hash; - public byte[] secret; + public long id; + public int parts; + public String md5_checksum; + public byte[] file_hash; + public byte[] secret; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - parts = stream.readInt32(exception); - md5_checksum = stream.readString(exception); - file_hash = stream.readByteArray(exception); - secret = stream.readByteArray(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + parts = stream.readInt32(exception); + md5_checksum = stream.readString(exception); + file_hash = stream.readByteArray(exception); + secret = stream.readByteArray(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt32(parts); - stream.writeString(md5_checksum); - stream.writeByteArray(file_hash); - stream.writeByteArray(secret); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt32(parts); + stream.writeString(md5_checksum); + stream.writeByteArray(file_hash); + stream.writeByteArray(secret); + } + } - public static class TL_inputSecureFile extends InputSecureFile { - public static int constructor = 0x5367e5be; + public static class TL_inputSecureFile extends InputSecureFile { + public static int constructor = 0x5367e5be; - public long id; - public long access_hash; + public long id; + public long access_hash; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + } + } - public static class TL_postAddress extends TLObject { - public static int constructor = 0x1e8caaeb; + public static class TL_postAddress extends TLObject { + public static int constructor = 0x1e8caaeb; - public String street_line1; - public String street_line2; - public String city; - public String state; - public String country_iso2; - public String post_code; + public String street_line1; + public String street_line2; + public String city; + public String state; + public String country_iso2; + public String post_code; - public static TL_postAddress TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_postAddress.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_postAddress", constructor)); - } else { - return null; - } - } - TL_postAddress result = new TL_postAddress(); - result.readParams(stream, exception); - return result; - } + public static TL_postAddress TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_postAddress.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_postAddress", constructor)); + } else { + return null; + } + } + TL_postAddress result = new TL_postAddress(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - street_line1 = stream.readString(exception); - street_line2 = stream.readString(exception); - city = stream.readString(exception); - state = stream.readString(exception); - country_iso2 = stream.readString(exception); - post_code = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + street_line1 = stream.readString(exception); + street_line2 = stream.readString(exception); + city = stream.readString(exception); + state = stream.readString(exception); + country_iso2 = stream.readString(exception); + post_code = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(street_line1); - stream.writeString(street_line2); - stream.writeString(city); - stream.writeString(state); - stream.writeString(country_iso2); - stream.writeString(post_code); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(street_line1); + stream.writeString(street_line2); + stream.writeString(city); + stream.writeString(state); + stream.writeString(country_iso2); + stream.writeString(post_code); + } + } public static abstract class ChannelAdminLogEventAction extends TLObject { @@ -36478,12 +36934,12 @@ public class TLRPC { case 0x23209745: result = new TL_channelAdminLogEventActionStartGroupCall(); break; + case 0x9cf7f76a: + result = new TL_channelAdminLogEventActionChangeAvailableReactions(); + break; case 0x50c7ac8: result = new TL_channelAdminLogEventActionChangeLinkedChat(); break; - case 0x278f2868: - result = new TL_channelAdminLogEventActionSendMessage(); - break; case 0x1b7907ae: result = new TL_channelAdminLogEventActionToggleInvites(); break; @@ -36993,6 +37449,54 @@ public class TLRPC { } } + public static class TL_channelAdminLogEventActionChangeAvailableReactions extends ChannelAdminLogEventAction { + public static int constructor = 0x9cf7f76a; + + public ArrayList prev_value = new ArrayList<>(); + public ArrayList new_value = new ArrayList<>(); + + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + prev_value.add(stream.readString(exception)); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + new_value.add(stream.readString(exception)); + } + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = prev_value.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeString(prev_value.get(a)); + } + stream.writeInt32(0x1cb5c415); + count = new_value.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeString(new_value.get(a)); + } + } + } + public static class TL_channelAdminLogEventActionToggleInvites extends ChannelAdminLogEventAction { public static int constructor = 0x1b7907ae; @@ -37089,75 +37593,75 @@ public class TLRPC { } } - public static abstract class InputWebFileLocation extends TLObject { + public static abstract class InputWebFileLocation extends TLObject { - public static InputWebFileLocation TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - InputWebFileLocation result = null; - switch (constructor) { - case 0x9f2221c9: - result = new TL_inputWebFileGeoPointLocation(); - break; - case 0xc239d686: - result = new TL_inputWebFileLocation(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in InputWebFileLocation", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static InputWebFileLocation TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + InputWebFileLocation result = null; + switch (constructor) { + case 0x9f2221c9: + result = new TL_inputWebFileGeoPointLocation(); + break; + case 0xc239d686: + result = new TL_inputWebFileLocation(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in InputWebFileLocation", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_inputWebFileGeoPointLocation extends InputWebFileLocation { - public static int constructor = 0x9f2221c9; + public static class TL_inputWebFileGeoPointLocation extends InputWebFileLocation { + public static int constructor = 0x9f2221c9; - public InputGeoPoint geo_point; - public long access_hash; - public int w; - public int h; - public int zoom; - public int scale; + public InputGeoPoint geo_point; + public long access_hash; + public int w; + public int h; + public int zoom; + public int scale; - public void readParams(AbstractSerializedData stream, boolean exception) { - geo_point = InputGeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); - access_hash = stream.readInt64(exception); - w = stream.readInt32(exception); - h = stream.readInt32(exception); - zoom = stream.readInt32(exception); - scale = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + geo_point = InputGeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); + access_hash = stream.readInt64(exception); + w = stream.readInt32(exception); + h = stream.readInt32(exception); + zoom = stream.readInt32(exception); + scale = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - geo_point.serializeToStream(stream); - stream.writeInt64(access_hash); - stream.writeInt32(w); - stream.writeInt32(h); - stream.writeInt32(zoom); - stream.writeInt32(scale); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + geo_point.serializeToStream(stream); + stream.writeInt64(access_hash); + stream.writeInt32(w); + stream.writeInt32(h); + stream.writeInt32(zoom); + stream.writeInt32(scale); + } + } - public static class TL_inputWebFileLocation extends InputWebFileLocation { - public static int constructor = 0xc239d686; + public static class TL_inputWebFileLocation extends InputWebFileLocation { + public static int constructor = 0xc239d686; - public String url; - public long access_hash; + public String url; + public long access_hash; - public void readParams(AbstractSerializedData stream, boolean exception) { - url = stream.readString(exception); - access_hash = stream.readInt64(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + url = stream.readString(exception); + access_hash = stream.readInt64(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(url); - stream.writeInt64(access_hash); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(url); + stream.writeInt64(access_hash); + } + } public static abstract class PeerLocated extends TLObject { @@ -37300,36 +37804,36 @@ public class TLRPC { } } - public static class TL_account_sentEmailCode extends TLObject { - public static int constructor = 0x811f854f; + public static class TL_account_sentEmailCode extends TLObject { + public static int constructor = 0x811f854f; - public String email_pattern; - public int length; + public String email_pattern; + public int length; - public static TL_account_sentEmailCode TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_account_sentEmailCode.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_account_sentEmailCode", constructor)); - } else { - return null; - } - } - TL_account_sentEmailCode result = new TL_account_sentEmailCode(); - result.readParams(stream, exception); - return result; - } + public static TL_account_sentEmailCode TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_account_sentEmailCode.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_account_sentEmailCode", constructor)); + } else { + return null; + } + } + TL_account_sentEmailCode result = new TL_account_sentEmailCode(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - email_pattern = stream.readString(exception); - length = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + email_pattern = stream.readString(exception); + length = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(email_pattern); - stream.writeInt32(length); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(email_pattern); + stream.writeInt32(length); + } + } public static class TL_messages_inactiveChats extends TLObject { public static int constructor = 0xa927fec5; @@ -37418,88 +37922,88 @@ public class TLRPC { } } - public static class TL_channelAdminRights_layer92 extends TLObject { - public static int constructor = 0x5d7ceba5; + public static class TL_channelAdminRights_layer92 extends TLObject { + public static int constructor = 0x5d7ceba5; - public int flags; - public boolean change_info; - public boolean post_messages; - public boolean edit_messages; - public boolean delete_messages; - public boolean ban_users; - public boolean invite_users; - public boolean pin_messages; - public boolean add_admins; - public boolean manage_call; + public int flags; + public boolean change_info; + public boolean post_messages; + public boolean edit_messages; + public boolean delete_messages; + public boolean ban_users; + public boolean invite_users; + public boolean pin_messages; + public boolean add_admins; + public boolean manage_call; - public static TL_channelAdminRights_layer92 TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_channelAdminRights_layer92.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_channelAdminRights_layer92", constructor)); - } else { - return null; - } - } - TL_channelAdminRights_layer92 result = new TL_channelAdminRights_layer92(); - result.readParams(stream, exception); - return result; - } + public static TL_channelAdminRights_layer92 TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_channelAdminRights_layer92.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_channelAdminRights_layer92", constructor)); + } else { + return null; + } + } + TL_channelAdminRights_layer92 result = new TL_channelAdminRights_layer92(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - change_info = (flags & 1) != 0; - post_messages = (flags & 2) != 0; - edit_messages = (flags & 4) != 0; - delete_messages = (flags & 8) != 0; - ban_users = (flags & 16) != 0; - invite_users = (flags & 32) != 0; - pin_messages = (flags & 128) != 0; - add_admins = (flags & 512) != 0; - manage_call = (flags & 1024) != 0; - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + change_info = (flags & 1) != 0; + post_messages = (flags & 2) != 0; + edit_messages = (flags & 4) != 0; + delete_messages = (flags & 8) != 0; + ban_users = (flags & 16) != 0; + invite_users = (flags & 32) != 0; + pin_messages = (flags & 128) != 0; + add_admins = (flags & 512) != 0; + manage_call = (flags & 1024) != 0; + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = change_info ? (flags | 1) : (flags &~ 1); - flags = post_messages ? (flags | 2) : (flags &~ 2); - flags = edit_messages ? (flags | 4) : (flags &~ 4); - flags = delete_messages ? (flags | 8) : (flags &~ 8); - flags = ban_users ? (flags | 16) : (flags &~ 16); - flags = invite_users ? (flags | 32) : (flags &~ 32); - flags = pin_messages ? (flags | 128) : (flags &~ 128); - flags = add_admins ? (flags | 512) : (flags &~ 512); - flags = manage_call ? (flags | 1024) : (flags &~ 1024); - stream.writeInt32(flags); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = change_info ? (flags | 1) : (flags &~ 1); + flags = post_messages ? (flags | 2) : (flags &~ 2); + flags = edit_messages ? (flags | 4) : (flags &~ 4); + flags = delete_messages ? (flags | 8) : (flags &~ 8); + flags = ban_users ? (flags | 16) : (flags &~ 16); + flags = invite_users ? (flags | 32) : (flags &~ 32); + flags = pin_messages ? (flags | 128) : (flags &~ 128); + flags = add_admins ? (flags | 512) : (flags &~ 512); + flags = manage_call ? (flags | 1024) : (flags &~ 1024); + stream.writeInt32(flags); + } + } - public static abstract class Chat extends TLObject { - public long id; - public String title; - public int date; - public int flags; - public boolean creator; - public boolean kicked; - public boolean deactivated; - public boolean left; + public static abstract class Chat extends TLObject { + public long id; + public String title; + public int date; + public int flags; + public boolean creator; + public boolean kicked; + public boolean deactivated; + public boolean left; public boolean has_geo; public boolean slowmode_enabled; - public ChatPhoto photo; - public int participants_count; - public int version; - public boolean broadcast; - public boolean megagroup; - public long access_hash; - public int until_date; - public boolean moderator; - public boolean verified; - public boolean restricted; - public boolean signatures; - public String username; - public boolean min; + public ChatPhoto photo; + public int participants_count; + public int version; + public boolean broadcast; + public boolean megagroup; + public long access_hash; + public int until_date; + public boolean moderator; + public boolean verified; + public boolean restricted; + public boolean signatures; + public String username; + public boolean min; public boolean scam; public boolean has_link; - public boolean explicit_content; + public boolean explicit_content; public boolean call_active; public boolean call_not_empty; public boolean fake; @@ -37511,7 +38015,7 @@ public class TLRPC { public TL_chatAdminRights admin_rights; public TL_chatBannedRights banned_rights; public TL_chatBannedRights default_banned_rights; - public InputChannel migrated_to; + public InputChannel migrated_to; public boolean verifiedExtended() { return verified || ArrayUtil.contains(NekoXConfig.officialChats, id); @@ -37600,8 +38104,8 @@ public class TLRPC { } protected static TL_chatBannedRights mergeBannedRights(TL_channelBannedRights_layer92 rights) { - if (rights == null) { - return null; + if (rights == null) { + return null; } TL_chatBannedRights newRights = new TL_chatBannedRights(); newRights.view_messages = rights.view_messages; @@ -37635,58 +38139,58 @@ public class TLRPC { newRights.add_admins = rights.add_admins; return newRights; } - } + } - public static class TL_chatForbidden_old extends TL_chatForbidden { - public static int constructor = 0xfb0ccc41; + public static class TL_chatForbidden_old extends TL_chatForbidden { + public static int constructor = 0xfb0ccc41; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - title = stream.readString(exception); - date = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + title = stream.readString(exception); + date = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32((int) id); - stream.writeString(title); - stream.writeInt32(date); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32((int) id); + stream.writeString(title); + stream.writeInt32(date); + } + } - public static class TL_chat_old2 extends TL_chat { - public static int constructor = 0x7312bc48; + public static class TL_chat_old2 extends TL_chat { + public static int constructor = 0x7312bc48; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - creator = (flags & 1) != 0; - kicked = (flags & 2) != 0; - left = (flags & 4) != 0; - deactivated = (flags & 32) != 0; - id = stream.readInt32(exception); - title = stream.readString(exception); - photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - participants_count = stream.readInt32(exception); - date = stream.readInt32(exception); - version = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + creator = (flags & 1) != 0; + kicked = (flags & 2) != 0; + left = (flags & 4) != 0; + deactivated = (flags & 32) != 0; + id = stream.readInt32(exception); + title = stream.readString(exception); + photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + participants_count = stream.readInt32(exception); + date = stream.readInt32(exception); + version = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = creator ? (flags | 1) : (flags &~ 1); - flags = kicked ? (flags | 2) : (flags &~ 2); - flags = left ? (flags | 4) : (flags &~ 4); - flags = deactivated ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt32((int) id); - stream.writeString(title); - photo.serializeToStream(stream); - stream.writeInt32(participants_count); - stream.writeInt32(date); - stream.writeInt32(version); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = creator ? (flags | 1) : (flags &~ 1); + flags = kicked ? (flags | 2) : (flags &~ 2); + flags = left ? (flags | 4) : (flags &~ 4); + flags = deactivated ? (flags | 32) : (flags &~ 32); + stream.writeInt32(flags); + stream.writeInt32((int) id); + stream.writeString(title); + photo.serializeToStream(stream); + stream.writeInt32(participants_count); + stream.writeInt32(date); + stream.writeInt32(version); + } + } public static class TL_chat extends Chat { public static int constructor = 0x41cbf256; @@ -37832,132 +38336,132 @@ public class TLRPC { } } - public static class TL_channelForbidden_layer131 extends TL_channelForbidden { - public static int constructor = 0x289da732; + public static class TL_channelForbidden_layer131 extends TL_channelForbidden { + public static int constructor = 0x289da732; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - broadcast = (flags & 32) != 0; - megagroup = (flags & 256) != 0; - id = stream.readInt32(exception); - access_hash = stream.readInt64(exception); - title = stream.readString(exception); - if ((flags & 65536) != 0) { - until_date = stream.readInt32(exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + broadcast = (flags & 32) != 0; + megagroup = (flags & 256) != 0; + id = stream.readInt32(exception); + access_hash = stream.readInt64(exception); + title = stream.readString(exception); + if ((flags & 65536) != 0) { + until_date = stream.readInt32(exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = broadcast ? (flags | 32) : (flags &~ 32); - flags = megagroup ? (flags | 256) : (flags &~ 256); - stream.writeInt32(flags); - stream.writeInt32((int) id); - stream.writeInt64(access_hash); - stream.writeString(title); - if ((flags & 65536) != 0) { - stream.writeInt32(until_date); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = broadcast ? (flags | 32) : (flags &~ 32); + flags = megagroup ? (flags | 256) : (flags &~ 256); + stream.writeInt32(flags); + stream.writeInt32((int) id); + stream.writeInt64(access_hash); + stream.writeString(title); + if ((flags & 65536) != 0) { + stream.writeInt32(until_date); + } + } + } - public static class TL_channelForbidden_layer67 extends TL_channelForbidden { - public static int constructor = 0x8537784f; + public static class TL_channelForbidden_layer67 extends TL_channelForbidden { + public static int constructor = 0x8537784f; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - broadcast = (flags & 32) != 0; - megagroup = (flags & 256) != 0; - id = stream.readInt32(exception); - access_hash = stream.readInt64(exception); - title = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + broadcast = (flags & 32) != 0; + megagroup = (flags & 256) != 0; + id = stream.readInt32(exception); + access_hash = stream.readInt64(exception); + title = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = broadcast ? (flags | 32) : (flags &~ 32); - flags = megagroup ? (flags | 256) : (flags &~ 256); - stream.writeInt32(flags); - stream.writeInt32((int) id); - stream.writeInt64(access_hash); - stream.writeString(title); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = broadcast ? (flags | 32) : (flags &~ 32); + flags = megagroup ? (flags | 256) : (flags &~ 256); + stream.writeInt32(flags); + stream.writeInt32((int) id); + stream.writeInt64(access_hash); + stream.writeString(title); + } + } - public static class TL_channel_layer48 extends TL_channel { - public static int constructor = 0x4b1b7506; + public static class TL_channel_layer48 extends TL_channel { + public static int constructor = 0x4b1b7506; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - creator = (flags & 1) != 0; - kicked = (flags & 2) != 0; - left = (flags & 4) != 0; - moderator = (flags & 16) != 0; - broadcast = (flags & 32) != 0; - verified = (flags & 128) != 0; - megagroup = (flags & 256) != 0; - restricted = (flags & 512) != 0; - signatures = (flags & 2048) != 0; - id = stream.readInt32(exception); - access_hash = stream.readInt64(exception); - title = stream.readString(exception); - if ((flags & 64) != 0) { - username = stream.readString(exception); - } - photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - date = stream.readInt32(exception); - version = stream.readInt32(exception); - if ((flags & 512) != 0) { - stream.readString(exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + creator = (flags & 1) != 0; + kicked = (flags & 2) != 0; + left = (flags & 4) != 0; + moderator = (flags & 16) != 0; + broadcast = (flags & 32) != 0; + verified = (flags & 128) != 0; + megagroup = (flags & 256) != 0; + restricted = (flags & 512) != 0; + signatures = (flags & 2048) != 0; + id = stream.readInt32(exception); + access_hash = stream.readInt64(exception); + title = stream.readString(exception); + if ((flags & 64) != 0) { + username = stream.readString(exception); + } + photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + date = stream.readInt32(exception); + version = stream.readInt32(exception); + if ((flags & 512) != 0) { + stream.readString(exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = creator ? (flags | 1) : (flags &~ 1); - flags = kicked ? (flags | 2) : (flags &~ 2); - flags = left ? (flags | 4) : (flags &~ 4); - flags = moderator ? (flags | 16) : (flags &~ 16); - flags = broadcast ? (flags | 32) : (flags &~ 32); - flags = verified ? (flags | 128) : (flags &~ 128); - flags = megagroup ? (flags | 256) : (flags &~ 256); - flags = restricted ? (flags | 512) : (flags &~ 512); - flags = signatures ? (flags | 2048) : (flags &~ 2048); - stream.writeInt32(flags); - stream.writeInt32((int) id); - stream.writeInt64(access_hash); - stream.writeString(title); - if ((flags & 64) != 0) { - stream.writeString(username); - } - photo.serializeToStream(stream); - stream.writeInt32(date); - stream.writeInt32(version); - if ((flags & 512) != 0) { - stream.writeString(""); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = creator ? (flags | 1) : (flags &~ 1); + flags = kicked ? (flags | 2) : (flags &~ 2); + flags = left ? (flags | 4) : (flags &~ 4); + flags = moderator ? (flags | 16) : (flags &~ 16); + flags = broadcast ? (flags | 32) : (flags &~ 32); + flags = verified ? (flags | 128) : (flags &~ 128); + flags = megagroup ? (flags | 256) : (flags &~ 256); + flags = restricted ? (flags | 512) : (flags &~ 512); + flags = signatures ? (flags | 2048) : (flags &~ 2048); + stream.writeInt32(flags); + stream.writeInt32((int) id); + stream.writeInt64(access_hash); + stream.writeString(title); + if ((flags & 64) != 0) { + stream.writeString(username); + } + photo.serializeToStream(stream); + stream.writeInt32(date); + stream.writeInt32(version); + if ((flags & 512) != 0) { + stream.writeString(""); + } + } + } - public static class TL_channelForbidden_layer52 extends TL_channelForbidden { - public static int constructor = 0x2d85832c; + public static class TL_channelForbidden_layer52 extends TL_channelForbidden { + public static int constructor = 0x2d85832c; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - access_hash = stream.readInt64(exception); - title = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + access_hash = stream.readInt64(exception); + title = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32((int) id); - stream.writeInt64(access_hash); - stream.writeString(title); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32((int) id); + stream.writeInt64(access_hash); + stream.writeString(title); + } + } public static class TL_channel extends Chat { public static int constructor = 0x8261ac61; @@ -38092,154 +38596,154 @@ public class TLRPC { } } - public static class TL_chatForbidden_layer131 extends TL_chatForbidden { - public static int constructor = 0x7328bdb; + public static class TL_chatForbidden_layer131 extends TL_chatForbidden { + public static int constructor = 0x7328bdb; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - title = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + title = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32((int) id); - stream.writeString(title); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32((int) id); + stream.writeString(title); + } + } - public static class TL_channel_layer67 extends TL_channel { - public static int constructor = 0xa14dca52; + public static class TL_channel_layer67 extends TL_channel { + public static int constructor = 0xa14dca52; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - creator = (flags & 1) != 0; - kicked = (flags & 2) != 0; - left = (flags & 4) != 0; - moderator = (flags & 16) != 0; - broadcast = (flags & 32) != 0; - verified = (flags & 128) != 0; - megagroup = (flags & 256) != 0; - restricted = (flags & 512) != 0; - signatures = (flags & 2048) != 0; - min = (flags & 4096) != 0; - id = stream.readInt32(exception); - if ((flags & 8192) != 0) { - access_hash = stream.readInt64(exception); - } - title = stream.readString(exception); - if ((flags & 64) != 0) { - username = stream.readString(exception); - } - photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - date = stream.readInt32(exception); - version = stream.readInt32(exception); - if ((flags & 512) != 0) { - stream.readString(exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + creator = (flags & 1) != 0; + kicked = (flags & 2) != 0; + left = (flags & 4) != 0; + moderator = (flags & 16) != 0; + broadcast = (flags & 32) != 0; + verified = (flags & 128) != 0; + megagroup = (flags & 256) != 0; + restricted = (flags & 512) != 0; + signatures = (flags & 2048) != 0; + min = (flags & 4096) != 0; + id = stream.readInt32(exception); + if ((flags & 8192) != 0) { + access_hash = stream.readInt64(exception); + } + title = stream.readString(exception); + if ((flags & 64) != 0) { + username = stream.readString(exception); + } + photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + date = stream.readInt32(exception); + version = stream.readInt32(exception); + if ((flags & 512) != 0) { + stream.readString(exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = creator ? (flags | 1) : (flags &~ 1); - flags = kicked ? (flags | 2) : (flags &~ 2); - flags = left ? (flags | 4) : (flags &~ 4); - flags = moderator ? (flags | 16) : (flags &~ 16); - flags = broadcast ? (flags | 32) : (flags &~ 32); - flags = verified ? (flags | 128) : (flags &~ 128); - flags = megagroup ? (flags | 256) : (flags &~ 256); - flags = restricted ? (flags | 512) : (flags &~ 512); - flags = signatures ? (flags | 2048) : (flags &~ 2048); - flags = min ? (flags | 4096) : (flags &~ 4096); - stream.writeInt32(flags); - stream.writeInt32((int) id); - if ((flags & 8192) != 0) { - stream.writeInt64(access_hash); - } - stream.writeString(title); - if ((flags & 64) != 0) { - stream.writeString(username); - } - photo.serializeToStream(stream); - stream.writeInt32(date); - stream.writeInt32(version); - if ((flags & 512) != 0) { - stream.writeString(""); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = creator ? (flags | 1) : (flags &~ 1); + flags = kicked ? (flags | 2) : (flags &~ 2); + flags = left ? (flags | 4) : (flags &~ 4); + flags = moderator ? (flags | 16) : (flags &~ 16); + flags = broadcast ? (flags | 32) : (flags &~ 32); + flags = verified ? (flags | 128) : (flags &~ 128); + flags = megagroup ? (flags | 256) : (flags &~ 256); + flags = restricted ? (flags | 512) : (flags &~ 512); + flags = signatures ? (flags | 2048) : (flags &~ 2048); + flags = min ? (flags | 4096) : (flags &~ 4096); + stream.writeInt32(flags); + stream.writeInt32((int) id); + if ((flags & 8192) != 0) { + stream.writeInt64(access_hash); + } + stream.writeString(title); + if ((flags & 64) != 0) { + stream.writeString(username); + } + photo.serializeToStream(stream); + stream.writeInt32(date); + stream.writeInt32(version); + if ((flags & 512) != 0) { + stream.writeString(""); + } + } + } - public static class TL_channel_old extends TL_channel { - public static int constructor = 0x678e9587; + public static class TL_channel_old extends TL_channel { + public static int constructor = 0x678e9587; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - creator = (flags & 1) != 0; - kicked = (flags & 2) != 0; - left = (flags & 4) != 0; - moderator = (flags & 16) != 0; - broadcast = (flags & 32) != 0; - verified = (flags & 128) != 0; - megagroup = (flags & 256) != 0; - explicit_content = (flags & 512) != 0; - id = stream.readInt32(exception); - access_hash = stream.readInt64(exception); - title = stream.readString(exception); - if ((flags & 64) != 0) { - username = stream.readString(exception); - } - photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - date = stream.readInt32(exception); - version = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + creator = (flags & 1) != 0; + kicked = (flags & 2) != 0; + left = (flags & 4) != 0; + moderator = (flags & 16) != 0; + broadcast = (flags & 32) != 0; + verified = (flags & 128) != 0; + megagroup = (flags & 256) != 0; + explicit_content = (flags & 512) != 0; + id = stream.readInt32(exception); + access_hash = stream.readInt64(exception); + title = stream.readString(exception); + if ((flags & 64) != 0) { + username = stream.readString(exception); + } + photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + date = stream.readInt32(exception); + version = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = creator ? (flags | 1) : (flags &~ 1); - flags = kicked ? (flags | 2) : (flags &~ 2); - flags = left ? (flags | 4) : (flags &~ 4); - flags = moderator ? (flags | 16) : (flags &~ 16); - flags = broadcast ? (flags | 32) : (flags &~ 32); - flags = verified ? (flags | 128) : (flags &~ 128); - flags = megagroup ? (flags | 256) : (flags &~ 256); - flags = explicit_content ? (flags | 512) : (flags &~ 512); - stream.writeInt32(flags); - stream.writeInt32((int) id); - stream.writeInt64(access_hash); - stream.writeString(title); - if ((flags & 64) != 0) { - stream.writeString(username); - } - photo.serializeToStream(stream); - stream.writeInt32(date); - stream.writeInt32(version); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = creator ? (flags | 1) : (flags &~ 1); + flags = kicked ? (flags | 2) : (flags &~ 2); + flags = left ? (flags | 4) : (flags &~ 4); + flags = moderator ? (flags | 16) : (flags &~ 16); + flags = broadcast ? (flags | 32) : (flags &~ 32); + flags = verified ? (flags | 128) : (flags &~ 128); + flags = megagroup ? (flags | 256) : (flags &~ 256); + flags = explicit_content ? (flags | 512) : (flags &~ 512); + stream.writeInt32(flags); + stream.writeInt32((int) id); + stream.writeInt64(access_hash); + stream.writeString(title); + if ((flags & 64) != 0) { + stream.writeString(username); + } + photo.serializeToStream(stream); + stream.writeInt32(date); + stream.writeInt32(version); + } + } - public static class TL_chat_old extends TL_chat { - public static int constructor = 0x6e9c9bc7; + public static class TL_chat_old extends TL_chat { + public static int constructor = 0x6e9c9bc7; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - title = stream.readString(exception); - photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - participants_count = stream.readInt32(exception); - date = stream.readInt32(exception); - left = stream.readBool(exception); - version = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + title = stream.readString(exception); + photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + participants_count = stream.readInt32(exception); + date = stream.readInt32(exception); + left = stream.readBool(exception); + version = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32((int) id); - stream.writeString(title); - photo.serializeToStream(stream); - stream.writeInt32(participants_count); - stream.writeInt32(date); - stream.writeBool(left); - stream.writeInt32(version); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32((int) id); + stream.writeString(title); + photo.serializeToStream(stream); + stream.writeInt32(participants_count); + stream.writeInt32(date); + stream.writeBool(left); + stream.writeInt32(version); + } + } public static class TL_channel_layer131 extends TL_channel { public static int constructor = 0xd31a961e; @@ -38623,121 +39127,121 @@ public class TLRPC { } } - public static class TL_channel_layer92 extends TL_channel { - public static int constructor = 0xc88974ac; + public static class TL_channel_layer92 extends TL_channel { + public static int constructor = 0xc88974ac; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - creator = (flags & 1) != 0; - left = (flags & 4) != 0; - broadcast = (flags & 32) != 0; - verified = (flags & 128) != 0; - megagroup = (flags & 256) != 0; - restricted = (flags & 512) != 0; - signatures = (flags & 2048) != 0; - min = (flags & 4096) != 0; - id = stream.readInt32(exception); - if ((flags & 8192) != 0) { - access_hash = stream.readInt64(exception); - } - title = stream.readString(exception); - if ((flags & 64) != 0) { - username = stream.readString(exception); - } - photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - date = stream.readInt32(exception); - version = stream.readInt32(exception); - if ((flags & 512) != 0) { - stream.readString(exception); - } - if ((flags & 16384) != 0) { - admin_rights_layer92 = TL_channelAdminRights_layer92.TLdeserialize(stream, stream.readInt32(exception), exception); + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + creator = (flags & 1) != 0; + left = (flags & 4) != 0; + broadcast = (flags & 32) != 0; + verified = (flags & 128) != 0; + megagroup = (flags & 256) != 0; + restricted = (flags & 512) != 0; + signatures = (flags & 2048) != 0; + min = (flags & 4096) != 0; + id = stream.readInt32(exception); + if ((flags & 8192) != 0) { + access_hash = stream.readInt64(exception); + } + title = stream.readString(exception); + if ((flags & 64) != 0) { + username = stream.readString(exception); + } + photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + date = stream.readInt32(exception); + version = stream.readInt32(exception); + if ((flags & 512) != 0) { + stream.readString(exception); + } + if ((flags & 16384) != 0) { + admin_rights_layer92 = TL_channelAdminRights_layer92.TLdeserialize(stream, stream.readInt32(exception), exception); admin_rights = mergeAdminRights(admin_rights_layer92); - } - if ((flags & 32768) != 0) { - banned_rights_layer92 = TL_channelBannedRights_layer92.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 32768) != 0) { + banned_rights_layer92 = TL_channelBannedRights_layer92.TLdeserialize(stream, stream.readInt32(exception), exception); banned_rights = mergeBannedRights(banned_rights_layer92); - } - if ((flags & 131072) != 0) { - participants_count = stream.readInt32(exception); - } - } + } + if ((flags & 131072) != 0) { + participants_count = stream.readInt32(exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = creator ? (flags | 1) : (flags &~ 1); - flags = left ? (flags | 4) : (flags &~ 4); - flags = broadcast ? (flags | 32) : (flags &~ 32); - flags = verified ? (flags | 128) : (flags &~ 128); - flags = megagroup ? (flags | 256) : (flags &~ 256); - flags = restricted ? (flags | 512) : (flags &~ 512); - flags = signatures ? (flags | 2048) : (flags &~ 2048); - flags = min ? (flags | 4096) : (flags &~ 4096); - stream.writeInt32(flags); - stream.writeInt32((int) id); - if ((flags & 8192) != 0) { - stream.writeInt64(access_hash); - } - stream.writeString(title); - if ((flags & 64) != 0) { - stream.writeString(username); - } - photo.serializeToStream(stream); - stream.writeInt32(date); - stream.writeInt32(version); - if ((flags & 512) != 0) { - stream.writeString(""); - } - if ((flags & 16384) != 0) { - admin_rights_layer92.serializeToStream(stream); - } - if ((flags & 32768) != 0) { - banned_rights_layer92.serializeToStream(stream); - } - if ((flags & 131072) != 0) { - stream.writeInt32(participants_count); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = creator ? (flags | 1) : (flags &~ 1); + flags = left ? (flags | 4) : (flags &~ 4); + flags = broadcast ? (flags | 32) : (flags &~ 32); + flags = verified ? (flags | 128) : (flags &~ 128); + flags = megagroup ? (flags | 256) : (flags &~ 256); + flags = restricted ? (flags | 512) : (flags &~ 512); + flags = signatures ? (flags | 2048) : (flags &~ 2048); + flags = min ? (flags | 4096) : (flags &~ 4096); + stream.writeInt32(flags); + stream.writeInt32((int) id); + if ((flags & 8192) != 0) { + stream.writeInt64(access_hash); + } + stream.writeString(title); + if ((flags & 64) != 0) { + stream.writeString(username); + } + photo.serializeToStream(stream); + stream.writeInt32(date); + stream.writeInt32(version); + if ((flags & 512) != 0) { + stream.writeString(""); + } + if ((flags & 16384) != 0) { + admin_rights_layer92.serializeToStream(stream); + } + if ((flags & 32768) != 0) { + banned_rights_layer92.serializeToStream(stream); + } + if ((flags & 131072) != 0) { + stream.writeInt32(participants_count); + } + } + } - public static class TL_chat_layer92 extends TL_chat { - public static int constructor = 0xd91cdd54; + public static class TL_chat_layer92 extends TL_chat { + public static int constructor = 0xd91cdd54; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - creator = (flags & 1) != 0; - kicked = (flags & 2) != 0; - left = (flags & 4) != 0; - deactivated = (flags & 32) != 0; - id = stream.readInt32(exception); - title = stream.readString(exception); - photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - participants_count = stream.readInt32(exception); - date = stream.readInt32(exception); - version = stream.readInt32(exception); - if ((flags & 64) != 0) { - migrated_to = InputChannel.TLdeserialize(stream, stream.readInt32(exception), exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + creator = (flags & 1) != 0; + kicked = (flags & 2) != 0; + left = (flags & 4) != 0; + deactivated = (flags & 32) != 0; + id = stream.readInt32(exception); + title = stream.readString(exception); + photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + participants_count = stream.readInt32(exception); + date = stream.readInt32(exception); + version = stream.readInt32(exception); + if ((flags & 64) != 0) { + migrated_to = InputChannel.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = creator ? (flags | 1) : (flags &~ 1); - flags = kicked ? (flags | 2) : (flags &~ 2); - flags = left ? (flags | 4) : (flags &~ 4); - flags = deactivated ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt32((int) id); - stream.writeString(title); - photo.serializeToStream(stream); - stream.writeInt32(participants_count); - stream.writeInt32(date); - stream.writeInt32(version); - if ((flags & 64) != 0) { - migrated_to.serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = creator ? (flags | 1) : (flags &~ 1); + flags = kicked ? (flags | 2) : (flags &~ 2); + flags = left ? (flags | 4) : (flags &~ 4); + flags = deactivated ? (flags | 32) : (flags &~ 32); + stream.writeInt32(flags); + stream.writeInt32((int) id); + stream.writeString(title); + photo.serializeToStream(stream); + stream.writeInt32(participants_count); + stream.writeInt32(date); + stream.writeInt32(version); + if ((flags & 64) != 0) { + migrated_to.serializeToStream(stream); + } + } + } public static class TL_restrictionReason extends TLObject { public static int constructor = 0xd072acb4; @@ -39169,196 +39673,196 @@ public class TLRPC { } } - public static abstract class storage_FileType extends TLObject { + public static abstract class storage_FileType extends TLObject { - public static storage_FileType TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - storage_FileType result = null; - switch (constructor) { - case 0xaa963b05: - result = new TL_storage_fileUnknown(); - break; - case 0xb3cea0e4: - result = new TL_storage_fileMp4(); - break; - case 0x1081464c: - result = new TL_storage_fileWebp(); - break; - case 0xa4f63c0: - result = new TL_storage_filePng(); - break; - case 0xcae1aadf: - result = new TL_storage_fileGif(); - break; - case 0xae1e508d: - result = new TL_storage_filePdf(); - break; - case 0x528a0677: - result = new TL_storage_fileMp3(); - break; - case 0x7efe0e: - result = new TL_storage_fileJpeg(); - break; - case 0x4b09ebbc: - result = new TL_storage_fileMov(); - break; - case 0x40bc6f52: - result = new TL_storage_filePartial(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in storage_FileType", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static storage_FileType TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + storage_FileType result = null; + switch (constructor) { + case 0xaa963b05: + result = new TL_storage_fileUnknown(); + break; + case 0xb3cea0e4: + result = new TL_storage_fileMp4(); + break; + case 0x1081464c: + result = new TL_storage_fileWebp(); + break; + case 0xa4f63c0: + result = new TL_storage_filePng(); + break; + case 0xcae1aadf: + result = new TL_storage_fileGif(); + break; + case 0xae1e508d: + result = new TL_storage_filePdf(); + break; + case 0x528a0677: + result = new TL_storage_fileMp3(); + break; + case 0x7efe0e: + result = new TL_storage_fileJpeg(); + break; + case 0x4b09ebbc: + result = new TL_storage_fileMov(); + break; + case 0x40bc6f52: + result = new TL_storage_filePartial(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in storage_FileType", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_storage_fileUnknown extends storage_FileType { - public static int constructor = 0xaa963b05; + public static class TL_storage_fileUnknown extends storage_FileType { + public static int constructor = 0xaa963b05; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_storage_fileMp4 extends storage_FileType { - public static int constructor = 0xb3cea0e4; + public static class TL_storage_fileMp4 extends storage_FileType { + public static int constructor = 0xb3cea0e4; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_storage_fileWebp extends storage_FileType { - public static int constructor = 0x1081464c; + public static class TL_storage_fileWebp extends storage_FileType { + public static int constructor = 0x1081464c; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_storage_filePng extends storage_FileType { - public static int constructor = 0xa4f63c0; + public static class TL_storage_filePng extends storage_FileType { + public static int constructor = 0xa4f63c0; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_storage_fileGif extends storage_FileType { - public static int constructor = 0xcae1aadf; + public static class TL_storage_fileGif extends storage_FileType { + public static int constructor = 0xcae1aadf; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_storage_filePdf extends storage_FileType { - public static int constructor = 0xae1e508d; + public static class TL_storage_filePdf extends storage_FileType { + public static int constructor = 0xae1e508d; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_storage_fileMp3 extends storage_FileType { - public static int constructor = 0x528a0677; + public static class TL_storage_fileMp3 extends storage_FileType { + public static int constructor = 0x528a0677; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_storage_fileJpeg extends storage_FileType { - public static int constructor = 0x7efe0e; + public static class TL_storage_fileJpeg extends storage_FileType { + public static int constructor = 0x7efe0e; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_storage_fileMov extends storage_FileType { - public static int constructor = 0x4b09ebbc; + public static class TL_storage_fileMov extends storage_FileType { + public static int constructor = 0x4b09ebbc; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_storage_filePartial extends storage_FileType { - public static int constructor = 0x40bc6f52; + public static class TL_storage_filePartial extends storage_FileType { + public static int constructor = 0x40bc6f52; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static abstract class auth_CodeType extends TLObject { + public static abstract class auth_CodeType extends TLObject { - public static auth_CodeType TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - auth_CodeType result = null; - switch (constructor) { - case 0x72a3158c: - result = new TL_auth_codeTypeSms(); - break; - case 0x741cd3e3: - result = new TL_auth_codeTypeCall(); - break; - case 0x226ccefb: - result = new TL_auth_codeTypeFlashCall(); - break; + public static auth_CodeType TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + auth_CodeType result = null; + switch (constructor) { + case 0x72a3158c: + result = new TL_auth_codeTypeSms(); + break; + case 0x741cd3e3: + result = new TL_auth_codeTypeCall(); + break; + case 0x226ccefb: + result = new TL_auth_codeTypeFlashCall(); + break; case 0xd61ad6ee: result = new TL_auth_codeTypeMissedCall(); break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in auth_CodeType", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in auth_CodeType", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_auth_codeTypeSms extends auth_CodeType { - public static int constructor = 0x72a3158c; + public static class TL_auth_codeTypeSms extends auth_CodeType { + public static int constructor = 0x72a3158c; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_auth_codeTypeCall extends auth_CodeType { - public static int constructor = 0x741cd3e3; + public static class TL_auth_codeTypeCall extends auth_CodeType { + public static int constructor = 0x741cd3e3; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_auth_codeTypeFlashCall extends auth_CodeType { - public static int constructor = 0x226ccefb; + public static class TL_auth_codeTypeFlashCall extends auth_CodeType { + public static int constructor = 0x226ccefb; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_auth_codeTypeMissedCall extends auth_CodeType { public static int constructor = 0xd61ad6ee; @@ -39369,158 +39873,158 @@ public class TLRPC { } } - public static abstract class MessagesFilter extends TLObject { - public int flags; - public boolean missed; + public static abstract class MessagesFilter extends TLObject { + public int flags; + public boolean missed; - public static MessagesFilter TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - MessagesFilter result = null; - switch (constructor) { - case 0xffc86587: - result = new TL_inputMessagesFilterGif(); - break; - case 0x3751b49e: - result = new TL_inputMessagesFilterMusic(); - break; - case 0x3a20ecb8: - result = new TL_inputMessagesFilterChatPhotos(); - break; - case 0x9609a51c: - result = new TL_inputMessagesFilterPhotos(); - break; - case 0x7ef0dd87: - result = new TL_inputMessagesFilterUrl(); - break; - case 0x9eddf188: - result = new TL_inputMessagesFilterDocument(); - break; - case 0x56e9f0e4: - result = new TL_inputMessagesFilterPhotoVideo(); - break; - case 0xd95e73bb: - result = new TL_inputMessagesFilterPhotoVideoDocuments(); - break; - case 0xe7026d0d: - result = new TL_inputMessagesFilterGeo(); - break; + public static MessagesFilter TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + MessagesFilter result = null; + switch (constructor) { + case 0xffc86587: + result = new TL_inputMessagesFilterGif(); + break; + case 0x3751b49e: + result = new TL_inputMessagesFilterMusic(); + break; + case 0x3a20ecb8: + result = new TL_inputMessagesFilterChatPhotos(); + break; + case 0x9609a51c: + result = new TL_inputMessagesFilterPhotos(); + break; + case 0x7ef0dd87: + result = new TL_inputMessagesFilterUrl(); + break; + case 0x9eddf188: + result = new TL_inputMessagesFilterDocument(); + break; + case 0x56e9f0e4: + result = new TL_inputMessagesFilterPhotoVideo(); + break; + case 0xd95e73bb: + result = new TL_inputMessagesFilterPhotoVideoDocuments(); + break; + case 0xe7026d0d: + result = new TL_inputMessagesFilterGeo(); + break; case 0x1bb00451: result = new TL_inputMessagesFilterPinned(); break; - case 0xc1f8e69a: - result = new TL_inputMessagesFilterMyMentions(); - break; - case 0x7a7c17a4: - result = new TL_inputMessagesFilterRoundVoice(); - break; - case 0xe062db83: - result = new TL_inputMessagesFilterContacts(); - break; - case 0x50f5c392: - result = new TL_inputMessagesFilterVoice(); - break; - case 0x9fc00e65: - result = new TL_inputMessagesFilterVideo(); - break; - case 0x80c99768: - result = new TL_inputMessagesFilterPhoneCalls(); - break; - case 0x57e2f66c: - result = new TL_inputMessagesFilterEmpty(); - break; - case 0xb549da53: - result = new TL_inputMessagesFilterRoundVideo(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in MessagesFilter", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + case 0xc1f8e69a: + result = new TL_inputMessagesFilterMyMentions(); + break; + case 0x7a7c17a4: + result = new TL_inputMessagesFilterRoundVoice(); + break; + case 0xe062db83: + result = new TL_inputMessagesFilterContacts(); + break; + case 0x50f5c392: + result = new TL_inputMessagesFilterVoice(); + break; + case 0x9fc00e65: + result = new TL_inputMessagesFilterVideo(); + break; + case 0x80c99768: + result = new TL_inputMessagesFilterPhoneCalls(); + break; + case 0x57e2f66c: + result = new TL_inputMessagesFilterEmpty(); + break; + case 0xb549da53: + result = new TL_inputMessagesFilterRoundVideo(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in MessagesFilter", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_inputMessagesFilterGif extends MessagesFilter { - public static int constructor = 0xffc86587; + public static class TL_inputMessagesFilterGif extends MessagesFilter { + public static int constructor = 0xffc86587; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_inputMessagesFilterMusic extends MessagesFilter { - public static int constructor = 0x3751b49e; + public static class TL_inputMessagesFilterMusic extends MessagesFilter { + public static int constructor = 0x3751b49e; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_inputMessagesFilterChatPhotos extends MessagesFilter { - public static int constructor = 0x3a20ecb8; + public static class TL_inputMessagesFilterChatPhotos extends MessagesFilter { + public static int constructor = 0x3a20ecb8; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_inputMessagesFilterPhotos extends MessagesFilter { - public static int constructor = 0x9609a51c; + public static class TL_inputMessagesFilterPhotos extends MessagesFilter { + public static int constructor = 0x9609a51c; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_inputMessagesFilterUrl extends MessagesFilter { - public static int constructor = 0x7ef0dd87; + public static class TL_inputMessagesFilterUrl extends MessagesFilter { + public static int constructor = 0x7ef0dd87; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_inputMessagesFilterDocument extends MessagesFilter { - public static int constructor = 0x9eddf188; + public static class TL_inputMessagesFilterDocument extends MessagesFilter { + public static int constructor = 0x9eddf188; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_inputMessagesFilterPhotoVideo extends MessagesFilter { - public static int constructor = 0x56e9f0e4; + public static class TL_inputMessagesFilterPhotoVideo extends MessagesFilter { + public static int constructor = 0x56e9f0e4; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_inputMessagesFilterPhotoVideoDocuments extends MessagesFilter { - public static int constructor = 0xd95e73bb; + public static class TL_inputMessagesFilterPhotoVideoDocuments extends MessagesFilter { + public static int constructor = 0xd95e73bb; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_inputMessagesFilterGeo extends MessagesFilter { - public static int constructor = 0xe7026d0d; + public static class TL_inputMessagesFilterGeo extends MessagesFilter { + public static int constructor = 0xe7026d0d; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_inputMessagesFilterPinned extends MessagesFilter { public static int constructor = 0x1bb00451; @@ -39531,84 +40035,84 @@ public class TLRPC { } } - public static class TL_inputMessagesFilterMyMentions extends MessagesFilter { - public static int constructor = 0xc1f8e69a; + public static class TL_inputMessagesFilterMyMentions extends MessagesFilter { + public static int constructor = 0xc1f8e69a; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_inputMessagesFilterRoundVoice extends MessagesFilter { - public static int constructor = 0x7a7c17a4; + public static class TL_inputMessagesFilterRoundVoice extends MessagesFilter { + public static int constructor = 0x7a7c17a4; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_inputMessagesFilterVoice extends MessagesFilter { - public static int constructor = 0x50f5c392; + public static class TL_inputMessagesFilterVoice extends MessagesFilter { + public static int constructor = 0x50f5c392; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_inputMessagesFilterContacts extends MessagesFilter { - public static int constructor = 0xe062db83; + public static class TL_inputMessagesFilterContacts extends MessagesFilter { + public static int constructor = 0xe062db83; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_inputMessagesFilterVideo extends MessagesFilter { - public static int constructor = 0x9fc00e65; + public static class TL_inputMessagesFilterVideo extends MessagesFilter { + public static int constructor = 0x9fc00e65; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_inputMessagesFilterPhoneCalls extends MessagesFilter { - public static int constructor = 0x80c99768; + public static class TL_inputMessagesFilterPhoneCalls extends MessagesFilter { + public static int constructor = 0x80c99768; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - missed = (flags & 1) != 0; - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + missed = (flags & 1) != 0; + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = missed ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = missed ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + } + } - public static class TL_inputMessagesFilterEmpty extends MessagesFilter { - public static int constructor = 0x57e2f66c; + public static class TL_inputMessagesFilterEmpty extends MessagesFilter { + public static int constructor = 0x57e2f66c; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_inputMessagesFilterRoundVideo extends MessagesFilter { - public static int constructor = 0xb549da53; + public static class TL_inputMessagesFilterRoundVideo extends MessagesFilter { + public static int constructor = 0xb549da53; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_phone_groupParticipants extends TLObject { public static int constructor = 0xf47751b6; @@ -39710,138 +40214,138 @@ public class TLRPC { } } - public static abstract class PageListOrderedItem extends TLObject { + public static abstract class PageListOrderedItem extends TLObject { - public static PageListOrderedItem TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - PageListOrderedItem result = null; - switch (constructor) { - case 0x5e068047: - result = new TL_pageListOrderedItemText(); - break; - case 0x98dd8936: - result = new TL_pageListOrderedItemBlocks(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in PageListOrderedItem", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static PageListOrderedItem TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + PageListOrderedItem result = null; + switch (constructor) { + case 0x5e068047: + result = new TL_pageListOrderedItemText(); + break; + case 0x98dd8936: + result = new TL_pageListOrderedItemBlocks(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in PageListOrderedItem", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_pageListOrderedItemText extends PageListOrderedItem { - public static int constructor = 0x5e068047; + public static class TL_pageListOrderedItemText extends PageListOrderedItem { + public static int constructor = 0x5e068047; - public String num; - public RichText text; + public String num; + public RichText text; - public void readParams(AbstractSerializedData stream, boolean exception) { - num = stream.readString(exception); - text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + num = stream.readString(exception); + text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(num); - text.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(num); + text.serializeToStream(stream); + } + } - public static class TL_pageListOrderedItemBlocks extends PageListOrderedItem { - public static int constructor = 0x98dd8936; + public static class TL_pageListOrderedItemBlocks extends PageListOrderedItem { + public static int constructor = 0x98dd8936; - public String num; - public ArrayList blocks = new ArrayList<>(); + public String num; + public ArrayList blocks = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - num = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - blocks.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + num = stream.readString(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + blocks.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(num); - stream.writeInt32(0x1cb5c415); - int count = blocks.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - blocks.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(num); + stream.writeInt32(0x1cb5c415); + int count = blocks.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + blocks.get(a).serializeToStream(stream); + } + } + } - public static class TL_messages_messageEmpty extends TLObject { - public static int constructor = 0x3f4e0648; + public static class TL_messages_messageEmpty extends TLObject { + public static int constructor = 0x3f4e0648; - public static TL_messages_messageEmpty TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messages_messageEmpty.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_messageEmpty", constructor)); - } else { - return null; - } - } - TL_messages_messageEmpty result = new TL_messages_messageEmpty(); - result.readParams(stream, exception); - return result; - } + public static TL_messages_messageEmpty TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_messages_messageEmpty.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_messages_messageEmpty", constructor)); + } else { + return null; + } + } + TL_messages_messageEmpty result = new TL_messages_messageEmpty(); + result.readParams(stream, exception); + return result; + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_secureCredentialsEncrypted extends TLObject { - public static int constructor = 0x33f0ea47; + public static class TL_secureCredentialsEncrypted extends TLObject { + public static int constructor = 0x33f0ea47; - public byte[] data; - public byte[] hash; - public byte[] secret; + public byte[] data; + public byte[] hash; + public byte[] secret; - public static TL_secureCredentialsEncrypted TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_secureCredentialsEncrypted.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_secureCredentialsEncrypted", constructor)); - } else { - return null; - } - } - TL_secureCredentialsEncrypted result = new TL_secureCredentialsEncrypted(); - result.readParams(stream, exception); - return result; - } + public static TL_secureCredentialsEncrypted TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_secureCredentialsEncrypted.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_secureCredentialsEncrypted", constructor)); + } else { + return null; + } + } + TL_secureCredentialsEncrypted result = new TL_secureCredentialsEncrypted(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - data = stream.readByteArray(exception); - hash = stream.readByteArray(exception); - secret = stream.readByteArray(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + data = stream.readByteArray(exception); + hash = stream.readByteArray(exception); + secret = stream.readByteArray(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(data); - stream.writeByteArray(hash); - stream.writeByteArray(secret); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeByteArray(data); + stream.writeByteArray(hash); + stream.writeByteArray(secret); + } + } public static abstract class MessageFwdHeader extends TLObject { @@ -40345,38 +40849,38 @@ public class TLRPC { } } - public static abstract class messages_SavedGifs extends TLObject { - public long hash; - public ArrayList gifs = new ArrayList<>(); + public static abstract class messages_SavedGifs extends TLObject { + public long hash; + public ArrayList gifs = new ArrayList<>(); - public static messages_SavedGifs TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - messages_SavedGifs result = null; - switch (constructor) { - case 0xe8025ca2: - result = new TL_messages_savedGifsNotModified(); - break; + public static messages_SavedGifs TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + messages_SavedGifs result = null; + switch (constructor) { + case 0xe8025ca2: + result = new TL_messages_savedGifsNotModified(); + break; case 0x84a02a0d: result = new TL_messages_savedGifs(); break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in messages_SavedGifs", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in messages_SavedGifs", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_messages_savedGifsNotModified extends messages_SavedGifs { - public static int constructor = 0xe8025ca2; + public static class TL_messages_savedGifsNotModified extends messages_SavedGifs { + public static int constructor = 0xe8025ca2; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_messages_savedGifs extends messages_SavedGifs { public static int constructor = 0x84a02a0d; @@ -40413,36 +40917,36 @@ public class TLRPC { } } - public static abstract class PhotoSize extends TLObject { - public String type; - public FileLocation location; - public int w; - public int h; - public int size; - public byte[] bytes; + public static abstract class PhotoSize extends TLObject { + public String type; + public FileLocation location; + public int w; + public int h; + public int size; + public byte[] bytes; - public static PhotoSize TLdeserialize(long photo_id, long document_id, long sticker_set_id, AbstractSerializedData stream, int constructor, boolean exception) { - PhotoSize result = null; - switch (constructor) { + public static PhotoSize TLdeserialize(long photo_id, long document_id, long sticker_set_id, AbstractSerializedData stream, int constructor, boolean exception) { + PhotoSize result = null; + switch (constructor) { case 0xd8214d41: result = new TL_photoPathSize(); break; - case 0x77bfb61b: - result = new TL_photoSize_layer127(); - break; - case 0xe17e23c: - result = new TL_photoSizeEmpty(); - break; + case 0x77bfb61b: + result = new TL_photoSize_layer127(); + break; + case 0xe17e23c: + result = new TL_photoSizeEmpty(); + break; case 0x5aa86a51: result = new TL_photoSizeProgressive_layer127(); break; case 0xe0b0bc2e: result = new TL_photoStrippedSize(); break; - case 0xe9a734fa: - result = new TL_photoCachedSize_layer127(); - break; + case 0xe9a734fa: + result = new TL_photoCachedSize_layer127(); + break; case 0x75c78e60: result = new TL_photoSize(); break; @@ -40452,14 +40956,14 @@ public class TLRPC { case 0xfa3efb95: result = new TL_photoSizeProgressive(); break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in PhotoSize", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - if (result.location == null) { - if (!TextUtils.isEmpty(result.type) && (photo_id != 0 || document_id != 0 || sticker_set_id != 0)) { + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in PhotoSize", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + if (result.location == null) { + if (!TextUtils.isEmpty(result.type) && (photo_id != 0 || document_id != 0 || sticker_set_id != 0)) { result.location = new TL_fileLocationToBeDeprecated(); if (photo_id != 0) { result.location.volume_id = -photo_id; @@ -40475,10 +40979,10 @@ public class TLRPC { result.location = new TL_fileLocationUnavailable(); } } - } - return result; - } - } + } + return result; + } + } public static class TL_photoStrippedSize extends PhotoSize { public static int constructor = 0xe0b0bc2e; @@ -40537,63 +41041,63 @@ public class TLRPC { } } - public static class TL_photoSize_layer127 extends TL_photoSize { - public static int constructor = 0x77bfb61b; + public static class TL_photoSize_layer127 extends TL_photoSize { + public static int constructor = 0x77bfb61b; - public void readParams(AbstractSerializedData stream, boolean exception) { - type = stream.readString(exception); - location = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception); - w = stream.readInt32(exception); - h = stream.readInt32(exception); - size = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + type = stream.readString(exception); + location = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception); + w = stream.readInt32(exception); + h = stream.readInt32(exception); + size = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(type); - location.serializeToStream(stream); - stream.writeInt32(w); - stream.writeInt32(h); - stream.writeInt32(size); - } - } - - public static class TL_photoSizeEmpty extends PhotoSize { - public static int constructor = 0xe17e23c; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - type = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(type); - } - } - - public static class TL_photoCachedSize_layer127 extends TL_photoCachedSize { - public static int constructor = 0xe9a734fa; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - type = stream.readString(exception); - location = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception); - w = stream.readInt32(exception); - h = stream.readInt32(exception); - bytes = stream.readByteArray(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(type); - location.serializeToStream(stream); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(type); + location.serializeToStream(stream); stream.writeInt32(w); - stream.writeInt32(h); + stream.writeInt32(h); + stream.writeInt32(size); + } + } + + public static class TL_photoSizeEmpty extends PhotoSize { + public static int constructor = 0xe17e23c; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + type = stream.readString(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(type); + } + } + + public static class TL_photoCachedSize_layer127 extends TL_photoCachedSize { + public static int constructor = 0xe9a734fa; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + type = stream.readString(exception); + location = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception); + w = stream.readInt32(exception); + h = stream.readInt32(exception); + bytes = stream.readByteArray(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(type); + location.serializeToStream(stream); + stream.writeInt32(w); + stream.writeInt32(h); stream.writeByteArray(bytes); - } - } + } + } public static class TL_photoSize extends PhotoSize { public static int constructor = 0x75c78e60; @@ -40900,178 +41404,178 @@ public class TLRPC { } } - public static abstract class InputFile extends TLObject { - public long id; - public int parts; - public String name; - public String md5_checksum; + public static abstract class InputFile extends TLObject { + public long id; + public int parts; + public String name; + public String md5_checksum; - public static InputFile TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - InputFile result = null; - switch (constructor) { - case 0xfa4f0bb5: - result = new TL_inputFileBig(); - break; - case 0xf52ff27f: - result = new TL_inputFile(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in InputFile", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static InputFile TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + InputFile result = null; + switch (constructor) { + case 0xfa4f0bb5: + result = new TL_inputFileBig(); + break; + case 0xf52ff27f: + result = new TL_inputFile(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in InputFile", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_inputFileBig extends InputFile { - public static int constructor = 0xfa4f0bb5; + public static class TL_inputFileBig extends InputFile { + public static int constructor = 0xfa4f0bb5; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - parts = stream.readInt32(exception); - name = stream.readString(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + parts = stream.readInt32(exception); + name = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt32(parts); - stream.writeString(name); - } - } - - public static class TL_inputFile extends InputFile { - public static int constructor = 0xf52ff27f; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - parts = stream.readInt32(exception); - name = stream.readString(exception); - md5_checksum = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt32(parts); - stream.writeString(name); - stream.writeString(md5_checksum); - } - } + stream.writeInt64(id); + stream.writeInt32(parts); + stream.writeString(name); + } + } - public static class TL_account_webAuthorizations extends TLObject { - public static int constructor = 0xed56c9fc; + public static class TL_inputFile extends InputFile { + public static int constructor = 0xf52ff27f; - public ArrayList authorizations = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); - public static TL_account_webAuthorizations TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_account_webAuthorizations.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_account_webAuthorizations", constructor)); - } else { - return null; - } - } - TL_account_webAuthorizations result = new TL_account_webAuthorizations(); - result.readParams(stream, exception); - return result; - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + parts = stream.readInt32(exception); + name = stream.readString(exception); + md5_checksum = stream.readString(exception); + } - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_webAuthorization object = TL_webAuthorization.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - authorizations.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt32(parts); + stream.writeString(name); + stream.writeString(md5_checksum); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = authorizations.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - authorizations.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } + public static class TL_account_webAuthorizations extends TLObject { + public static int constructor = 0xed56c9fc; - public static class TL_updates_state extends TLObject { - public static int constructor = 0xa56c2a3e; + public ArrayList authorizations = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); - public int pts; - public int qts; - public int date; - public int seq; - public int unread_count; + public static TL_account_webAuthorizations TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_account_webAuthorizations.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_account_webAuthorizations", constructor)); + } else { + return null; + } + } + TL_account_webAuthorizations result = new TL_account_webAuthorizations(); + result.readParams(stream, exception); + return result; + } - public static TL_updates_state TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_updates_state.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_updates_state", constructor)); - } else { - return null; - } - } - TL_updates_state result = new TL_updates_state(); - result.readParams(stream, exception); - return result; - } + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + TL_webAuthorization object = TL_webAuthorization.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + authorizations.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + users.add(object); + } + } - public void readParams(AbstractSerializedData stream, boolean exception) { - pts = stream.readInt32(exception); - qts = stream.readInt32(exception); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = authorizations.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + authorizations.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = users.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + users.get(a).serializeToStream(stream); + } + } + } + + public static class TL_updates_state extends TLObject { + public static int constructor = 0xa56c2a3e; + + public int pts; + public int qts; + public int date; + public int seq; + public int unread_count; + + public static TL_updates_state TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_updates_state.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_updates_state", constructor)); + } else { + return null; + } + } + TL_updates_state result = new TL_updates_state(); + result.readParams(stream, exception); + return result; + } + + public void readParams(AbstractSerializedData stream, boolean exception) { + pts = stream.readInt32(exception); + qts = stream.readInt32(exception); date = stream.readInt32(exception); - seq = stream.readInt32(exception); - unread_count = stream.readInt32(exception); - } + seq = stream.readInt32(exception); + unread_count = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(pts); + stream.writeInt32(pts); stream.writeInt32(qts); stream.writeInt32(date); - stream.writeInt32(seq); - stream.writeInt32(unread_count); - } - } + stream.writeInt32(seq); + stream.writeInt32(unread_count); + } + } public static class TL_reactionCount extends TLObject { public static int constructor = 0x6fb250d1; @@ -41110,6 +41614,74 @@ public class TLRPC { } } + public static abstract class messages_AvailableReactions extends TLObject { + + public static messages_AvailableReactions TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + messages_AvailableReactions result = null; + switch (constructor) { + case 0x9f071957: + result = new TL_messages_availableReactionsNotModified(); + break; + case 0x768e3aad: + result = new TL_messages_availableReactions(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in messages_AvailableReactions", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } + + public static class TL_messages_availableReactionsNotModified extends messages_AvailableReactions { + public static int constructor = 0x9f071957; + + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_messages_availableReactions extends messages_AvailableReactions { + public static int constructor = 0x768e3aad; + + public int hash; + public ArrayList reactions = new ArrayList<>(); + + public void readParams(AbstractSerializedData stream, boolean exception) { + hash = stream.readInt32(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + TL_availableReaction object = TL_availableReaction.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + reactions.add(object); + } + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(hash); + stream.writeInt32(0x1cb5c415); + int count = reactions.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + reactions.get(a).serializeToStream(stream); + } + } + } + public static abstract class UserFull extends TLObject { public int flags; @@ -41570,36 +42142,36 @@ public class TLRPC { } } - public static abstract class Updates extends TLObject { - public ArrayList updates = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); - public ArrayList chats = new ArrayList<>(); - public int date; - public int seq; - public int flags; - public boolean out; - public boolean mentioned; - public boolean media_unread; - public boolean silent; - public int id; - public long user_id; - public String message; - public int pts; - public int pts_count; - public MessageFwdHeader fwd_from; - public long via_bot_id; + public static abstract class Updates extends TLObject { + public ArrayList updates = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); + public ArrayList chats = new ArrayList<>(); + public int date; + public int seq; + public int flags; + public boolean out; + public boolean mentioned; + public boolean media_unread; + public boolean silent; + public int id; + public long user_id; + public String message; + public int pts; + public int pts_count; + public MessageFwdHeader fwd_from; + public long via_bot_id; public TL_messageReplyHeader reply_to; - public ArrayList entities = new ArrayList<>(); - public MessageMedia media; - public Update update; - public long from_id; - public long chat_id; - public int seq_start; + public ArrayList entities = new ArrayList<>(); + public MessageMedia media; + public Update update; + public long from_id; + public long chat_id; + public int seq_start; public int ttl_period; - public static Updates TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - Updates result = null; - switch (constructor) { + public static Updates TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + Updates result = null; + switch (constructor) { case 0x74ae4240: result = new TL_updates(); break; @@ -41621,71 +42193,71 @@ public class TLRPC { case 0xe317af7e: result = new TL_updatesTooLong(); break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in Updates", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in Updates", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_updates extends Updates { - public static int constructor = 0x74ae4240; + public static class TL_updates extends Updates { + public static int constructor = 0x74ae4240; - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Update object = Update.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - updates.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - date = stream.readInt32(exception); - seq = stream.readInt32(exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + Update object = Update.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + updates.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + users.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + chats.add(object); + } + date = stream.readInt32(exception); + seq = stream.readInt32(exception); + } + } public static class TL_updateShortMessage extends Updates { public static int constructor = 0x313bc7f8; @@ -41772,15 +42344,15 @@ public class TLRPC { } } - public static class TL_updateShort extends Updates { - public static int constructor = 0x78d4dec1; + public static class TL_updateShort extends Updates { + public static int constructor = 0x78d4dec1; - public void readParams(AbstractSerializedData stream, boolean exception) { - update = Update.TLdeserialize(stream, stream.readInt32(exception), exception); - date = stream.readInt32(exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + update = Update.TLdeserialize(stream, stream.readInt32(exception), exception); + date = stream.readInt32(exception); + } + } public static class TL_updateShortChatMessage extends Updates { public static int constructor = 0x4d6deea5; @@ -41831,65 +42403,65 @@ public class TLRPC { } } - public static class TL_updatesCombined extends Updates { - public static int constructor = 0x725b04c3; + public static class TL_updatesCombined extends Updates { + public static int constructor = 0x725b04c3; - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Update object = Update.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - updates.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - date = stream.readInt32(exception); - seq_start = stream.readInt32(exception); - seq = stream.readInt32(exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + Update object = Update.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + updates.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + users.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + chats.add(object); + } + date = stream.readInt32(exception); + seq_start = stream.readInt32(exception); + seq = stream.readInt32(exception); + } + } - public static class TL_updatesTooLong extends Updates { - public static int constructor = 0xe317af7e; - } + public static class TL_updatesTooLong extends Updates { + public static int constructor = 0xe317af7e; + } public static abstract class WallPaper extends TLObject { @@ -42042,184 +42614,184 @@ public class TLRPC { } } - public static class TL_paymentSavedCredentialsCard extends TLObject { - public static int constructor = 0xcdc27a1f; + public static class TL_paymentSavedCredentialsCard extends TLObject { + public static int constructor = 0xcdc27a1f; - public String id; - public String title; + public String id; + public String title; - public static TL_paymentSavedCredentialsCard TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_paymentSavedCredentialsCard.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_paymentSavedCredentialsCard", constructor)); - } else { - return null; - } - } - TL_paymentSavedCredentialsCard result = new TL_paymentSavedCredentialsCard(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readString(exception); - title = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(id); - stream.writeString(title); - } - } - - public static abstract class PageListItem extends TLObject { - - public static PageListItem TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - PageListItem result = null; - switch (constructor) { - case 0x25e073fc: - result = new TL_pageListItemBlocks(); - break; - case 0xb92fb6cd: - result = new TL_pageListItemText(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in PageListItem", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } - - public static class TL_pageListItemBlocks extends PageListItem { - public static int constructor = 0x25e073fc; - - public ArrayList blocks = new ArrayList<>(); - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - blocks.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = blocks.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - blocks.get(a).serializeToStream(stream); - } - } - } - - public static class TL_pageListItemText extends PageListItem { - public static int constructor = 0xb92fb6cd; - - public RichText text; - - public void readParams(AbstractSerializedData stream, boolean exception) { - text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - text.serializeToStream(stream); - } - } - - public static class TL_stickerPack extends TLObject { - public static int constructor = 0x12b299d4; - - public String emoticon; - public ArrayList documents = new ArrayList<>(); - - public static TL_stickerPack TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_stickerPack.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_stickerPack", constructor)); - } else { - return null; - } - } - TL_stickerPack result = new TL_stickerPack(); - result.readParams(stream, exception); - return result; + public static TL_paymentSavedCredentialsCard TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_paymentSavedCredentialsCard.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_paymentSavedCredentialsCard", constructor)); + } else { + return null; + } + } + TL_paymentSavedCredentialsCard result = new TL_paymentSavedCredentialsCard(); + result.readParams(stream, exception); + return result; } public void readParams(AbstractSerializedData stream, boolean exception) { - emoticon = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - documents.add(stream.readInt64(exception)); - } - } + id = stream.readString(exception); + title = stream.readString(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(emoticon); - stream.writeInt32(0x1cb5c415); - int count = documents.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(documents.get(a)); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(id); + stream.writeString(title); + } + } - public static class TL_inputEncryptedChat extends TLObject { - public static int constructor = 0xf141b5e1; + public static abstract class PageListItem extends TLObject { - public int chat_id; - public long access_hash; + public static PageListItem TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + PageListItem result = null; + switch (constructor) { + case 0x25e073fc: + result = new TL_pageListItemBlocks(); + break; + case 0xb92fb6cd: + result = new TL_pageListItemText(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in PageListItem", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static TL_inputEncryptedChat TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_inputEncryptedChat.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_inputEncryptedChat", constructor)); - } else { - return null; - } - } - TL_inputEncryptedChat result = new TL_inputEncryptedChat(); - result.readParams(stream, exception); - return result; + public static class TL_pageListItemBlocks extends PageListItem { + public static int constructor = 0x25e073fc; + + public ArrayList blocks = new ArrayList<>(); + + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + blocks.add(object); + } + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = blocks.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + blocks.get(a).serializeToStream(stream); + } + } + } + + public static class TL_pageListItemText extends PageListItem { + public static int constructor = 0xb92fb6cd; + + public RichText text; + + public void readParams(AbstractSerializedData stream, boolean exception) { + text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + text.serializeToStream(stream); + } + } + + public static class TL_stickerPack extends TLObject { + public static int constructor = 0x12b299d4; + + public String emoticon; + public ArrayList documents = new ArrayList<>(); + + public static TL_stickerPack TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_stickerPack.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_stickerPack", constructor)); + } else { + return null; + } + } + TL_stickerPack result = new TL_stickerPack(); + result.readParams(stream, exception); + return result; } public void readParams(AbstractSerializedData stream, boolean exception) { - chat_id = stream.readInt32(exception); - access_hash = stream.readInt64(exception); - } + emoticon = stream.readString(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + documents.add(stream.readInt64(exception)); + } + } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(emoticon); + stream.writeInt32(0x1cb5c415); + int count = documents.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeInt64(documents.get(a)); + } + } + } + + public static class TL_inputEncryptedChat extends TLObject { + public static int constructor = 0xf141b5e1; + + public int chat_id; + public long access_hash; + + public static TL_inputEncryptedChat TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_inputEncryptedChat.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_inputEncryptedChat", constructor)); + } else { + return null; + } + } + TL_inputEncryptedChat result = new TL_inputEncryptedChat(); + result.readParams(stream, exception); + return result; + } + + public void readParams(AbstractSerializedData stream, boolean exception) { + chat_id = stream.readInt32(exception); + access_hash = stream.readInt64(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(chat_id); - stream.writeInt64(access_hash); - } - } + stream.writeInt64(access_hash); + } + } public static abstract class InputChatPhoto extends TLObject { @@ -42306,129 +42878,211 @@ public class TLRPC { } } - public static class TL_nearestDc extends TLObject { - public static int constructor = 0x8e1a1775; + public static class TL_nearestDc extends TLObject { + public static int constructor = 0x8e1a1775; - public String country; - public int this_dc; - public int nearest_dc; + public String country; + public int this_dc; + public int nearest_dc; - public static TL_nearestDc TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_nearestDc.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_nearestDc", constructor)); - } else { - return null; - } - } - TL_nearestDc result = new TL_nearestDc(); - result.readParams(stream, exception); - return result; - } + public static TL_nearestDc TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_nearestDc.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_nearestDc", constructor)); + } else { + return null; + } + } + TL_nearestDc result = new TL_nearestDc(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(AbstractSerializedData stream, boolean exception) { country = stream.readString(exception); - this_dc = stream.readInt32(exception); - nearest_dc = stream.readInt32(exception); - } + this_dc = stream.readInt32(exception); + nearest_dc = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); stream.writeString(country); - stream.writeInt32(this_dc); - stream.writeInt32(nearest_dc); - } - } + stream.writeInt32(this_dc); + stream.writeInt32(nearest_dc); + } + } - public static class TL_payments_savedInfo extends TLObject { - public static int constructor = 0xfb8fe43c; + public static class TL_payments_savedInfo extends TLObject { + public static int constructor = 0xfb8fe43c; - public int flags; - public boolean has_saved_credentials; - public TL_paymentRequestedInfo saved_info; + public int flags; + public boolean has_saved_credentials; + public TL_paymentRequestedInfo saved_info; - public static TL_payments_savedInfo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_payments_savedInfo.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_payments_savedInfo", constructor)); - } else { - return null; - } - } - TL_payments_savedInfo result = new TL_payments_savedInfo(); - result.readParams(stream, exception); - return result; - } + public static TL_payments_savedInfo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_payments_savedInfo.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_payments_savedInfo", constructor)); + } else { + return null; + } + } + TL_payments_savedInfo result = new TL_payments_savedInfo(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - has_saved_credentials = (flags & 2) != 0; - if ((flags & 1) != 0) { - saved_info = TL_paymentRequestedInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + has_saved_credentials = (flags & 2) != 0; + if ((flags & 1) != 0) { + saved_info = TL_paymentRequestedInfo.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = has_saved_credentials ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - saved_info.serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = has_saved_credentials ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + saved_info.serializeToStream(stream); + } + } + } - public static abstract class InputPhoto extends TLObject { - public long id; - public long access_hash; - public byte[] file_reference; + public static abstract class InputPhoto extends TLObject { + public long id; + public long access_hash; + public byte[] file_reference; - public static InputPhoto TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - InputPhoto result = null; - switch (constructor) { - case 0x1cd7bf0d: - result = new TL_inputPhotoEmpty(); - break; - case 0x3bb3b94a: - result = new TL_inputPhoto(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in InputPhoto", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static InputPhoto TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + InputPhoto result = null; + switch (constructor) { + case 0x1cd7bf0d: + result = new TL_inputPhotoEmpty(); + break; + case 0x3bb3b94a: + result = new TL_inputPhoto(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in InputPhoto", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_inputPhotoEmpty extends InputPhoto { - public static int constructor = 0x1cd7bf0d; + public static class TL_inputPhotoEmpty extends InputPhoto { + public static int constructor = 0x1cd7bf0d; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_inputPhoto extends InputPhoto { - public static int constructor = 0x3bb3b94a; + public static class TL_inputPhoto extends InputPhoto { + public static int constructor = 0x3bb3b94a; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - file_reference = stream.readByteArray(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + file_reference = stream.readByteArray(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeByteArray(file_reference); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeByteArray(file_reference); + } + } + + public static class TL_messages_messageReactionsList extends TLObject { + public static int constructor = 0xa366923c; + + public int flags; + public int count; + public ArrayList reactions = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); + public String next_offset; + + public static TL_messages_messageReactionsList TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_messages_messageReactionsList.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_messages_messageReactionsList", constructor)); + } else { + return null; + } + } + TL_messages_messageReactionsList result = new TL_messages_messageReactionsList(); + result.readParams(stream, exception); + return result; + } + + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + count = stream.readInt32(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + TL_messageUserReaction object = TL_messageUserReaction.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + reactions.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + users.add(object); + } + if ((flags & 1) != 0) { + next_offset = stream.readString(exception); + } + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeInt32(count); + stream.writeInt32(0x1cb5c415); + int count = reactions.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + reactions.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = users.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + users.get(a).serializeToStream(stream); + } + if ((flags & 1) != 0) { + stream.writeString(next_offset); + } + } + } public static class TL_importedContact extends TLObject { public static int constructor = 0xc13e3c50; @@ -42489,27 +43143,27 @@ public class TLRPC { } } - public static abstract class messages_RecentStickers extends TLObject { + public static abstract class messages_RecentStickers extends TLObject { - public static messages_RecentStickers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - messages_RecentStickers result = null; - switch (constructor) { + public static messages_RecentStickers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + messages_RecentStickers result = null; + switch (constructor) { case 0x88d37c56: result = new TL_messages_recentStickers(); break; - case 0xb17f890: - result = new TL_messages_recentStickersNotModified(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in messages_RecentStickers", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + case 0xb17f890: + result = new TL_messages_recentStickersNotModified(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in messages_RecentStickers", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } public static class TL_messages_recentStickers extends messages_RecentStickers { public static int constructor = 0x88d37c56; @@ -42588,14 +43242,14 @@ public class TLRPC { } } - public static class TL_messages_recentStickersNotModified extends messages_RecentStickers { - public static int constructor = 0xb17f890; + public static class TL_messages_recentStickersNotModified extends messages_RecentStickers { + public static int constructor = 0xb17f890; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_pageRelatedArticle extends TLObject { public static int constructor = 0xb390dc08; @@ -42666,64 +43320,64 @@ public class TLRPC { } } - public static class TL_accountDaysTTL extends TLObject { - public static int constructor = 0xb8d0afdf; + public static class TL_accountDaysTTL extends TLObject { + public static int constructor = 0xb8d0afdf; - public int days; + public int days; - public static TL_accountDaysTTL TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_accountDaysTTL.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_accountDaysTTL", constructor)); - } else { - return null; - } - } - TL_accountDaysTTL result = new TL_accountDaysTTL(); - result.readParams(stream, exception); - return result; - } + public static TL_accountDaysTTL TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_accountDaysTTL.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_accountDaysTTL", constructor)); + } else { + return null; + } + } + TL_accountDaysTTL result = new TL_accountDaysTTL(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - days = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + days = stream.readInt32(exception); + } public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(days); - } - } + stream.writeInt32(constructor); + stream.writeInt32(days); + } + } - public static abstract class messages_Stickers extends TLObject { + public static abstract class messages_Stickers extends TLObject { - public static messages_Stickers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - messages_Stickers result = null; - switch (constructor) { - case 0xf1749a22: - result = new TL_messages_stickersNotModified(); - break; + public static messages_Stickers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + messages_Stickers result = null; + switch (constructor) { + case 0xf1749a22: + result = new TL_messages_stickersNotModified(); + break; case 0x30a6ec7e: result = new TL_messages_stickers(); break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in messages_Stickers", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in messages_Stickers", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_messages_stickersNotModified extends messages_Stickers { - public static int constructor = 0xf1749a22; + public static class TL_messages_stickersNotModified extends messages_Stickers { + public static int constructor = 0xf1749a22; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_messages_stickers extends messages_Stickers { public static int constructor = 0x30a6ec7e; @@ -43003,54 +43657,54 @@ public class TLRPC { } } - public static abstract class help_PassportConfig extends TLObject { + public static abstract class help_PassportConfig extends TLObject { - public static help_PassportConfig TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - help_PassportConfig result = null; - switch (constructor) { - case 0xbfb9f457: - result = new TL_help_passportConfigNotModified(); - break; - case 0xa098d6af: - result = new TL_help_passportConfig(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in help_PassportConfig", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static help_PassportConfig TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + help_PassportConfig result = null; + switch (constructor) { + case 0xbfb9f457: + result = new TL_help_passportConfigNotModified(); + break; + case 0xa098d6af: + result = new TL_help_passportConfig(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in help_PassportConfig", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_help_passportConfigNotModified extends help_PassportConfig { - public static int constructor = 0xbfb9f457; + public static class TL_help_passportConfigNotModified extends help_PassportConfig { + public static int constructor = 0xbfb9f457; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_help_passportConfig extends help_PassportConfig { - public static int constructor = 0xa098d6af; + public static class TL_help_passportConfig extends help_PassportConfig { + public static int constructor = 0xa098d6af; - public int hash; - public TL_dataJSON countries_langs; + public int hash; + public TL_dataJSON countries_langs; - public void readParams(AbstractSerializedData stream, boolean exception) { - hash = stream.readInt32(exception); - countries_langs = TL_dataJSON.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + hash = stream.readInt32(exception); + countries_langs = TL_dataJSON.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(hash); - countries_langs.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(hash); + countries_langs.serializeToStream(stream); + } + } public static class TL_phone_exportedGroupCallInvite extends TLObject { public static int constructor = 0x204bd158; @@ -43080,174 +43734,174 @@ public class TLRPC { } } - public static class TL_account_passwordInputSettings extends TLObject { - public static int constructor = 0xc23727c9; + public static class TL_account_passwordInputSettings extends TLObject { + public static int constructor = 0xc23727c9; - public int flags; - public PasswordKdfAlgo new_algo; - public byte[] new_password_hash; - public String hint; - public String email; - public TL_secureSecretSettings new_secure_settings; + public int flags; + public PasswordKdfAlgo new_algo; + public byte[] new_password_hash; + public String hint; + public String email; + public TL_secureSecretSettings new_secure_settings; - public static TL_account_passwordInputSettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_account_passwordInputSettings.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_account_passwordInputSettings", constructor)); - } else { - return null; - } - } - TL_account_passwordInputSettings result = new TL_account_passwordInputSettings(); - result.readParams(stream, exception); - return result; - } + public static TL_account_passwordInputSettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_account_passwordInputSettings.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_account_passwordInputSettings", constructor)); + } else { + return null; + } + } + TL_account_passwordInputSettings result = new TL_account_passwordInputSettings(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - if ((flags & 1) != 0) { - new_algo = PasswordKdfAlgo.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 1) != 0) { - new_password_hash = stream.readByteArray(exception); - } - if ((flags & 1) != 0) { - hint = stream.readString(exception); - } - if ((flags & 2) != 0) { - email = stream.readString(exception); - } - if ((flags & 4) != 0) { - new_secure_settings = TL_secureSecretSettings.TLdeserialize(stream, stream.readInt32(exception), exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + if ((flags & 1) != 0) { + new_algo = PasswordKdfAlgo.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 1) != 0) { + new_password_hash = stream.readByteArray(exception); + } + if ((flags & 1) != 0) { + hint = stream.readString(exception); + } + if ((flags & 2) != 0) { + email = stream.readString(exception); + } + if ((flags & 4) != 0) { + new_secure_settings = TL_secureSecretSettings.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - new_algo.serializeToStream(stream); - } - if ((flags & 1) != 0) { - stream.writeByteArray(new_password_hash); - } - if ((flags & 1) != 0) { - stream.writeString(hint); - } - if ((flags & 2) != 0) { - stream.writeString(email); - } - if ((flags & 4) != 0) { - new_secure_settings.serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + new_algo.serializeToStream(stream); + } + if ((flags & 1) != 0) { + stream.writeByteArray(new_password_hash); + } + if ((flags & 1) != 0) { + stream.writeString(hint); + } + if ((flags & 2) != 0) { + stream.writeString(email); + } + if ((flags & 4) != 0) { + new_secure_settings.serializeToStream(stream); + } + } + } - public static class TL_dcOption extends TLObject { - public static int constructor = 0x18b7a10d; + public static class TL_dcOption extends TLObject { + public static int constructor = 0x18b7a10d; - public int flags; - public boolean ipv6; - public boolean media_only; - public boolean tcpo_only; - public boolean cdn; - public boolean isStatic; - public int id; - public String ip_address; - public int port; - public byte[] secret; + public int flags; + public boolean ipv6; + public boolean media_only; + public boolean tcpo_only; + public boolean cdn; + public boolean isStatic; + public int id; + public String ip_address; + public int port; + public byte[] secret; - public static TL_dcOption TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_dcOption.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_dcOption", constructor)); - } else { - return null; - } - } - TL_dcOption result = new TL_dcOption(); - result.readParams(stream, exception); - return result; - } + public static TL_dcOption TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_dcOption.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_dcOption", constructor)); + } else { + return null; + } + } + TL_dcOption result = new TL_dcOption(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - ipv6 = (flags & 1) != 0; - media_only = (flags & 2) != 0; - tcpo_only = (flags & 4) != 0; - cdn = (flags & 8) != 0; - isStatic = (flags & 16) != 0; - id = stream.readInt32(exception); - ip_address = stream.readString(exception); - port = stream.readInt32(exception); - if ((flags & 1024) != 0) { - secret = stream.readByteArray(exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + ipv6 = (flags & 1) != 0; + media_only = (flags & 2) != 0; + tcpo_only = (flags & 4) != 0; + cdn = (flags & 8) != 0; + isStatic = (flags & 16) != 0; + id = stream.readInt32(exception); + ip_address = stream.readString(exception); + port = stream.readInt32(exception); + if ((flags & 1024) != 0) { + secret = stream.readByteArray(exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = ipv6 ? (flags | 1) : (flags &~ 1); - flags = media_only ? (flags | 2) : (flags &~ 2); - flags = tcpo_only ? (flags | 4) : (flags &~ 4); - flags = cdn ? (flags | 8) : (flags &~ 8); - flags = isStatic ? (flags | 16) : (flags &~ 16); - stream.writeInt32(flags); - stream.writeInt32(id); - stream.writeString(ip_address); - stream.writeInt32(port); - if ((flags & 1024) != 0) { - stream.writeByteArray(secret); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = ipv6 ? (flags | 1) : (flags &~ 1); + flags = media_only ? (flags | 2) : (flags &~ 2); + flags = tcpo_only ? (flags | 4) : (flags &~ 4); + flags = cdn ? (flags | 8) : (flags &~ 8); + flags = isStatic ? (flags | 16) : (flags &~ 16); + stream.writeInt32(flags); + stream.writeInt32(id); + stream.writeString(ip_address); + stream.writeInt32(port); + if ((flags & 1024) != 0) { + stream.writeByteArray(secret); + } + } + } - public static class TL_pageTableRow extends TLObject { - public static int constructor = 0xe0c0c5e5; + public static class TL_pageTableRow extends TLObject { + public static int constructor = 0xe0c0c5e5; - public ArrayList cells = new ArrayList<>(); + public ArrayList cells = new ArrayList<>(); - public static TL_pageTableRow TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_pageTableRow.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_pageTableRow", constructor)); - } else { - return null; - } - } - TL_pageTableRow result = new TL_pageTableRow(); - result.readParams(stream, exception); - return result; - } + public static TL_pageTableRow TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_pageTableRow.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_pageTableRow", constructor)); + } else { + return null; + } + } + TL_pageTableRow result = new TL_pageTableRow(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_pageTableCell object = TL_pageTableCell.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - cells.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + TL_pageTableCell object = TL_pageTableCell.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + cells.add(object); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = cells.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - cells.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = cells.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + cells.get(a).serializeToStream(stream); + } + } + } public static class TL_emojiURL extends TLObject { public static int constructor = 0xa575739d; @@ -43277,45 +43931,45 @@ public class TLRPC { } } - public static class TL_decryptedMessageLayer extends TLObject { - public static int constructor = 0x1be31789; + public static class TL_decryptedMessageLayer extends TLObject { + public static int constructor = 0x1be31789; - public byte[] random_bytes; - public int layer; - public int in_seq_no; - public int out_seq_no; - public DecryptedMessage message; + public byte[] random_bytes; + public int layer; + public int in_seq_no; + public int out_seq_no; + public DecryptedMessage message; - public static TL_decryptedMessageLayer TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_decryptedMessageLayer.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_decryptedMessageLayer", constructor)); - } else { - return null; - } - } - TL_decryptedMessageLayer result = new TL_decryptedMessageLayer(); - result.readParams(stream, exception); - return result; - } + public static TL_decryptedMessageLayer TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_decryptedMessageLayer.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_decryptedMessageLayer", constructor)); + } else { + return null; + } + } + TL_decryptedMessageLayer result = new TL_decryptedMessageLayer(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - random_bytes = stream.readByteArray(exception); - layer = stream.readInt32(exception); + public void readParams(AbstractSerializedData stream, boolean exception) { + random_bytes = stream.readByteArray(exception); + layer = stream.readInt32(exception); in_seq_no = stream.readInt32(exception); out_seq_no = stream.readInt32(exception); - message = DecryptedMessage.TLdeserialize(stream, stream.readInt32(exception), exception); - } + message = DecryptedMessage.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(random_bytes); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeByteArray(random_bytes); stream.writeInt32(layer); - stream.writeInt32(in_seq_no); - stream.writeInt32(out_seq_no); - message.serializeToStream(stream); - } - } + stream.writeInt32(in_seq_no); + stream.writeInt32(out_seq_no); + message.serializeToStream(stream); + } + } public static class TL_groupCallParticipant extends TLObject { public static int constructor = 0xeba636fe; @@ -43440,186 +44094,186 @@ public class TLRPC { } } - public static class TL_fileHash extends TLObject { - public static int constructor = 0x6242c773; + public static class TL_fileHash extends TLObject { + public static int constructor = 0x6242c773; - public int offset; - public int limit; - public byte[] hash; + public int offset; + public int limit; + public byte[] hash; - public static TL_fileHash TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_fileHash.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_fileHash", constructor)); - } else { - return null; - } - } - TL_fileHash result = new TL_fileHash(); - result.readParams(stream, exception); - return result; - } + public static TL_fileHash TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_fileHash.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_fileHash", constructor)); + } else { + return null; + } + } + TL_fileHash result = new TL_fileHash(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - offset = stream.readInt32(exception); - limit = stream.readInt32(exception); - hash = stream.readByteArray(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + offset = stream.readInt32(exception); + limit = stream.readInt32(exception); + hash = stream.readByteArray(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(offset); - stream.writeInt32(limit); - stream.writeByteArray(hash); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(offset); + stream.writeInt32(limit); + stream.writeByteArray(hash); + } + } - public static class TL_messages_peerDialogs extends TLObject { - public static int constructor = 0x3371c354; + public static class TL_messages_peerDialogs extends TLObject { + public static int constructor = 0x3371c354; - public ArrayList dialogs = new ArrayList<>(); - public ArrayList messages = new ArrayList<>(); - public ArrayList chats = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); - public TL_updates_state state; + public ArrayList dialogs = new ArrayList<>(); + public ArrayList messages = new ArrayList<>(); + public ArrayList chats = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); + public TL_updates_state state; - public static TL_messages_peerDialogs TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messages_peerDialogs.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_peerDialogs", constructor)); - } else { - return null; - } - } - TL_messages_peerDialogs result = new TL_messages_peerDialogs(); - result.readParams(stream, exception); - return result; - } + public static TL_messages_peerDialogs TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_messages_peerDialogs.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_messages_peerDialogs", constructor)); + } else { + return null; + } + } + TL_messages_peerDialogs result = new TL_messages_peerDialogs(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Dialog object = Dialog.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - dialogs.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Message object = Message.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - state = TL_updates_state.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + Dialog object = Dialog.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + dialogs.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + Message object = Message.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + messages.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + chats.add(object); + } + magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + users.add(object); + } + state = TL_updates_state.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = dialogs.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - dialogs.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - state.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = dialogs.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + dialogs.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = messages.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + messages.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = chats.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + chats.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = users.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + users.get(a).serializeToStream(stream); + } + state.serializeToStream(stream); + } + } - public static class TL_topPeer extends TLObject { - public static int constructor = 0xedcdc05b; + public static class TL_topPeer extends TLObject { + public static int constructor = 0xedcdc05b; - public Peer peer; - public double rating; + public Peer peer; + public double rating; - public static TL_topPeer TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_topPeer.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_topPeer", constructor)); - } else { - return null; - } - } - TL_topPeer result = new TL_topPeer(); - result.readParams(stream, exception); - return result; - } + public static TL_topPeer TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_topPeer.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_topPeer", constructor)); + } else { + return null; + } + } + TL_topPeer result = new TL_topPeer(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - rating = stream.readDouble(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + rating = stream.readDouble(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeDouble(rating); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + stream.writeDouble(rating); + } + } public static abstract class account_ResetPasswordResult extends TLObject { @@ -43971,61 +44625,61 @@ public class TLRPC { } } - public static class TL_paymentRequestedInfo extends TLObject { - public static int constructor = 0x909c3f94; + public static class TL_paymentRequestedInfo extends TLObject { + public static int constructor = 0x909c3f94; - public int flags; - public String name; - public String phone; - public String email; - public TL_postAddress shipping_address; + public int flags; + public String name; + public String phone; + public String email; + public TL_postAddress shipping_address; - public static TL_paymentRequestedInfo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_paymentRequestedInfo.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_paymentRequestedInfo", constructor)); - } else { - return null; - } - } - TL_paymentRequestedInfo result = new TL_paymentRequestedInfo(); - result.readParams(stream, exception); - return result; - } + public static TL_paymentRequestedInfo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_paymentRequestedInfo.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_paymentRequestedInfo", constructor)); + } else { + return null; + } + } + TL_paymentRequestedInfo result = new TL_paymentRequestedInfo(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - if ((flags & 1) != 0) { - name = stream.readString(exception); - } - if ((flags & 2) != 0) { - phone = stream.readString(exception); - } - if ((flags & 4) != 0) { - email = stream.readString(exception); - } - if ((flags & 8) != 0) { - shipping_address = TL_postAddress.TLdeserialize(stream, stream.readInt32(exception), exception); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + if ((flags & 1) != 0) { + name = stream.readString(exception); + } + if ((flags & 2) != 0) { + phone = stream.readString(exception); + } + if ((flags & 4) != 0) { + email = stream.readString(exception); + } + if ((flags & 8) != 0) { + shipping_address = TL_postAddress.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - stream.writeString(name); - } - if ((flags & 2) != 0) { - stream.writeString(phone); - } - if ((flags & 4) != 0) { - stream.writeString(email); - } - if ((flags & 8) != 0) { - shipping_address.serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + stream.writeString(name); + } + if ((flags & 2) != 0) { + stream.writeString(phone); + } + if ((flags & 4) != 0) { + stream.writeString(email); + } + if ((flags & 8) != 0) { + shipping_address.serializeToStream(stream); + } + } + } public static class TL_auth_sendCode extends TLObject { public static int constructor = 0xa677244f; @@ -44069,24 +44723,24 @@ public class TLRPC { } } - public static class TL_auth_signIn extends TLObject { - public static int constructor = 0xbcd51581; + public static class TL_auth_signIn extends TLObject { + public static int constructor = 0xbcd51581; - public String phone_number; - public String phone_code_hash; - public String phone_code; + public String phone_number; + public String phone_code_hash; + public String phone_code; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return auth_Authorization.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return auth_Authorization.TLdeserialize(stream, constructor, exception); } public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(phone_number); - stream.writeString(phone_code_hash); - stream.writeString(phone_code); - } - } + stream.writeInt32(constructor); + stream.writeString(phone_number); + stream.writeString(phone_code_hash); + stream.writeString(phone_code); + } + } public static class TL_auth_logOut extends TLObject { public static int constructor = 0x3e72ba19; @@ -44101,33 +44755,33 @@ public class TLRPC { } } - public static class TL_auth_resetAuthorizations extends TLObject { - public static int constructor = 0x9fab0d1a; + public static class TL_auth_resetAuthorizations extends TLObject { + public static int constructor = 0x9fab0d1a; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_auth_exportAuthorization extends TLObject { - public static int constructor = 0xe5bfffcd; - - public int dc_id; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_auth_exportedAuthorization.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(dc_id); - } - } + stream.writeInt32(constructor); + } + } + + public static class TL_auth_exportAuthorization extends TLObject { + public static int constructor = 0xe5bfffcd; + + public int dc_id; + + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_auth_exportedAuthorization.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(dc_id); + } + } public static class TL_auth_importAuthorization extends TLObject { public static int constructor = 0xa57a7dad; @@ -44292,92 +44946,92 @@ public class TLRPC { } } - public static class TL_account_updateNotifySettings extends TLObject { - public static int constructor = 0x84be5b93; + public static class TL_account_updateNotifySettings extends TLObject { + public static int constructor = 0x84be5b93; - public InputNotifyPeer peer; - public TL_inputPeerNotifySettings settings; + public InputNotifyPeer peer; + public TL_inputPeerNotifySettings settings; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - settings.serializeToStream(stream); - } - } - - public static class TL_account_getNotifySettings extends TLObject { - public static int constructor = 0x12b3ad31; - - public InputNotifyPeer peer; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return PeerNotifySettings.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - } - } + stream.writeInt32(constructor); + peer.serializeToStream(stream); + settings.serializeToStream(stream); + } + } - public static class TL_account_resetNotifySettings extends TLObject { - public static int constructor = 0xdb7e1747; + public static class TL_account_getNotifySettings extends TLObject { + public static int constructor = 0x12b3ad31; + public InputNotifyPeer peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return PeerNotifySettings.TLdeserialize(stream, constructor, exception); + } public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + stream.writeInt32(constructor); + peer.serializeToStream(stream); + } + } - public static class TL_account_updateProfile extends TLObject { - public static int constructor = 0x78515775; + public static class TL_account_resetNotifySettings extends TLObject { + public static int constructor = 0xdb7e1747; - public int flags; - public String first_name; - public String last_name; - public String about; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return User.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - stream.writeString(first_name); - } - if ((flags & 2) != 0) { - stream.writeString(last_name); - } - if ((flags & 4) != 0) { - stream.writeString(about); - } - } - } - - public static class TL_account_updateStatus extends TLObject { - public static int constructor = 0x6628562c; - - public boolean offline; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeBool(offline); - } - } + stream.writeInt32(constructor); + } + } + + public static class TL_account_updateProfile extends TLObject { + public static int constructor = 0x78515775; + + public int flags; + public String first_name; + public String last_name; + public String about; + + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return User.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + stream.writeString(first_name); + } + if ((flags & 2) != 0) { + stream.writeString(last_name); + } + if ((flags & 4) != 0) { + stream.writeString(about); + } + } + } + + public static class TL_account_updateStatus extends TLObject { + public static int constructor = 0x6628562c; + + public boolean offline; + + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeBool(offline); + } + } public static class TL_account_getWallPapers extends TLObject { public static int constructor = 0x7967d36; @@ -44394,34 +45048,34 @@ public class TLRPC { } } - public static class TL_users_getUsers extends TLObject { - public static int constructor = 0xd91a548; + public static class TL_users_getUsers extends TLObject { + public static int constructor = 0xd91a548; - public ArrayList id = new ArrayList<>(); + public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + Vector vector = new Vector(); + int size = stream.readInt32(exception); + for (int a = 0; a < size; a++) { + User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return vector; + } + vector.objects.add(object); + } + return vector; + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - id.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = id.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + id.get(a).serializeToStream(stream); + } + } + } public static class TL_account_reportPeer extends TLObject { public static int constructor = 0xc5ba3d86; @@ -44538,27 +45192,27 @@ public class TLRPC { } } - public static class TL_contacts_getStatuses extends TLObject { - public static int constructor = 0xc4a353ee; + public static class TL_contacts_getStatuses extends TLObject { + public static int constructor = 0xc4a353ee; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - TL_contactStatus object = TL_contactStatus.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + Vector vector = new Vector(); + int size = stream.readInt32(exception); + for (int a = 0; a < size; a++) { + TL_contactStatus object = TL_contactStatus.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return vector; + } + vector.objects.add(object); } return vector; - } + } public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + stream.writeInt32(constructor); + } + } public static class TL_contacts_getContacts extends TLObject { public static int constructor = 0x5dd69e12; @@ -44575,25 +45229,25 @@ public class TLRPC { } } - public static class TL_contacts_importContacts extends TLObject { - public static int constructor = 0x2c800be5; + public static class TL_contacts_importContacts extends TLObject { + public static int constructor = 0x2c800be5; - public ArrayList contacts = new ArrayList<>(); + public ArrayList contacts = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_contacts_importedContacts.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_contacts_importedContacts.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = contacts.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - contacts.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = contacts.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + contacts.get(a).serializeToStream(stream); + } + } + } public static class TL_contacts_deleteContacts extends TLObject { public static int constructor = 0x96a0e00; @@ -44665,88 +45319,88 @@ public class TLRPC { } } - public static class TL_contacts_getBlocked extends TLObject { + public static class TL_contacts_getBlocked extends TLObject { public static int constructor = 0xf57c350f; - public int offset; - public int limit; + public int offset; + public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return contacts_Blocked.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return contacts_Blocked.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(offset); - stream.writeInt32(limit); - } - } + stream.writeInt32(offset); + stream.writeInt32(limit); + } + } - public static class TL_contacts_exportCard extends TLObject { - public static int constructor = 0x84e53737; + public static class TL_contacts_exportCard extends TLObject { + public static int constructor = 0x84e53737; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - vector.objects.add(stream.readInt32(exception)); - } - return vector; - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + Vector vector = new Vector(); + int size = stream.readInt32(exception); + for (int a = 0; a < size; a++) { + vector.objects.add(stream.readInt32(exception)); + } + return vector; + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_contacts_importCard extends TLObject { - public static int constructor = 0x4fe196fe; + public static class TL_contacts_importCard extends TLObject { + public static int constructor = 0x4fe196fe; - public ArrayList export_card = new ArrayList<>(); + public ArrayList export_card = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return User.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return User.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = export_card.size(); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = export_card.size(); stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(export_card.get(a)); - } - } - } + for (int a = 0; a < count; a++) { + stream.writeInt32(export_card.get(a)); + } + } + } - public static class TL_contacts_resetSaved extends TLObject { - public static int constructor = 0x879537f1; + public static class TL_contacts_resetSaved extends TLObject { + public static int constructor = 0x879537f1; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_contacts_toggleTopPeers extends TLObject { - public static int constructor = 0x8514bdda; + public static class TL_contacts_toggleTopPeers extends TLObject { + public static int constructor = 0x8514bdda; - public boolean enabled; + public boolean enabled; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeBool(enabled); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeBool(enabled); + } + } public static class TL_contacts_addContact extends TLObject { public static int constructor = 0xe8f463d0; @@ -44834,25 +45488,25 @@ public class TLRPC { } } - public static class TL_messages_getMessages extends TLObject { - public static int constructor = 0x4222fa74; + public static class TL_messages_getMessages extends TLObject { + public static int constructor = 0x4222fa74; - public ArrayList id = new ArrayList<>(); + public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_Messages.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return messages_Messages.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = id.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeInt32(id.get(a)); + } + } + } public static class TL_messages_getDialogs extends TLObject { public static int constructor = 0xa0f4cb4f; @@ -44959,48 +45613,48 @@ public class TLRPC { } } - public static class TL_help_getTermsOfServiceUpdate extends TLObject { - public static int constructor = 0x2ca51fd1; + public static class TL_help_getTermsOfServiceUpdate extends TLObject { + public static int constructor = 0x2ca51fd1; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return help_TermsOfServiceUpdate.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return help_TermsOfServiceUpdate.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_help_acceptTermsOfService extends TLObject { - public static int constructor = 0xee72f79a; + public static class TL_help_acceptTermsOfService extends TLObject { + public static int constructor = 0xee72f79a; - public TL_dataJSON id; + public TL_dataJSON id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - id.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + id.serializeToStream(stream); + } + } - public static class TL_help_getPassportConfig extends TLObject { - public static int constructor = 0xc661ad08; + public static class TL_help_getPassportConfig extends TLObject { + public static int constructor = 0xc661ad08; - public int hash; + public int hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return help_PassportConfig.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return help_PassportConfig.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(hash); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(hash); + } + } public static class TL_help_getSupportName extends TLObject { public static int constructor = 0xd360e72c; @@ -45116,22 +45770,22 @@ public class TLRPC { } } - public static class TL_messages_readHistory extends TLObject { - public static int constructor = 0xe306d3a; + public static class TL_messages_readHistory extends TLObject { + public static int constructor = 0xe306d3a; - public InputPeer peer; - public int max_id; + public InputPeer peer; + public int max_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_affectedMessages.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_messages_affectedMessages.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(max_id); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + stream.writeInt32(max_id); + } + } public static class TL_messages_deleteHistory extends TLObject { public static int constructor = 0xb08f922a; @@ -45164,22 +45818,22 @@ public class TLRPC { } } - public static class TL_channels_togglePreHistoryHidden extends TLObject { - public static int constructor = 0xeabbb94c; + public static class TL_channels_togglePreHistoryHidden extends TLObject { + public static int constructor = 0xeabbb94c; - public InputChannel channel; - public boolean enabled; + public InputChannel channel; + public boolean enabled; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - channel.serializeToStream(stream); - stream.writeBool(enabled); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + channel.serializeToStream(stream); + stream.writeBool(enabled); + } + } public static class TL_channels_getGroupsForDiscussion extends TLObject { public static int constructor = 0xf5dad378; @@ -45320,82 +45974,82 @@ public class TLRPC { } } - public static class TL_messages_deleteMessages extends TLObject { - public static int constructor = 0xe58e95d2; + public static class TL_messages_deleteMessages extends TLObject { + public static int constructor = 0xe58e95d2; - public int flags; - public boolean revoke; - public ArrayList id = new ArrayList<>(); + public int flags; + public boolean revoke; + public ArrayList id = new ArrayList<>(); - public static TL_messages_deleteMessages TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messages_deleteMessages.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_deleteMessages", constructor)); - } else { - return null; - } - } - TL_messages_deleteMessages result = new TL_messages_deleteMessages(); - result.readParams(stream, exception); - return result; - } + public static TL_messages_deleteMessages TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_messages_deleteMessages.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_messages_deleteMessages", constructor)); + } else { + return null; + } + } + TL_messages_deleteMessages result = new TL_messages_deleteMessages(); + result.readParams(stream, exception); + return result; + } - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_affectedMessages.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_messages_affectedMessages.TLdeserialize(stream, constructor, exception); + } - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - revoke = (flags & 1) != 0; - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - id.add(stream.readInt32(exception)); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + revoke = (flags & 1) != 0; + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + id.add(stream.readInt32(exception)); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = revoke ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = revoke ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + stream.writeInt32(0x1cb5c415); + int count = id.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeInt32(id.get(a)); + } + } + } - public static class TL_messages_receivedMessages extends TLObject { - public static int constructor = 0x5a954c0; + public static class TL_messages_receivedMessages extends TLObject { + public static int constructor = 0x5a954c0; public int max_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - TL_receivedNotifyMessage object = TL_receivedNotifyMessage.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + Vector vector = new Vector(); + int size = stream.readInt32(exception); + for (int a = 0; a < size; a++) { + TL_receivedNotifyMessage object = TL_receivedNotifyMessage.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return vector; + } + vector.objects.add(object); + } + return vector; + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(max_id); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(max_id); + } + } public static class TL_messages_setTyping extends TLObject { public static int constructor = 0x58943ee2; @@ -45579,20 +46233,20 @@ public class TLRPC { } } - public static class TL_messages_reportSpam extends TLObject { - public static int constructor = 0xcf1592db; + public static class TL_messages_reportSpam extends TLObject { + public static int constructor = 0xcf1592db; - public InputPeer peer; + public InputPeer peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + } + } public static class TL_messages_getPeerSettings extends TLObject { public static int constructor = 0xefd9a6a2; @@ -45744,27 +46398,27 @@ public class TLRPC { } } - public static class TL_messages_createChat extends TLObject { - public static int constructor = 0x9cb126e; + public static class TL_messages_createChat extends TLObject { + public static int constructor = 0x9cb126e; - public ArrayList users = new ArrayList<>(); - public String title; + public ArrayList users = new ArrayList<>(); + public String title; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - stream.writeString(title); - } - } + int count = users.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + users.get(a).serializeToStream(stream); + } + stream.writeString(title); + } + } public static class TL_messages_getSearchResultsCalendar extends TLObject { public static int constructor = 0x49f0bde9; @@ -45787,68 +46441,68 @@ public class TLRPC { } } - public static class TL_updates_getState extends TLObject { - public static int constructor = 0xedd4882a; + public static class TL_updates_getState extends TLObject { + public static int constructor = 0xedd4882a; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_updates_state.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_updates_state.TLdeserialize(stream, constructor, exception); + } public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + stream.writeInt32(constructor); + } + } - public static class TL_updates_getDifference extends TLObject { - public static int constructor = 0x25939651; + public static class TL_updates_getDifference extends TLObject { + public static int constructor = 0x25939651; - public int flags; - public int pts; - public int pts_total_limit; - public int date; - public int qts; + public int flags; + public int pts; + public int pts_total_limit; + public int date; + public int qts; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return updates_Difference.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return updates_Difference.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeInt32(pts); - if ((flags & 1) != 0) { - stream.writeInt32(pts_total_limit); - } - stream.writeInt32(date); - stream.writeInt32(qts); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeInt32(pts); + if ((flags & 1) != 0) { + stream.writeInt32(pts_total_limit); + } + stream.writeInt32(date); + stream.writeInt32(qts); + } + } - public static class TL_updates_getChannelDifference extends TLObject { - public static int constructor = 0x3173d78; + public static class TL_updates_getChannelDifference extends TLObject { + public static int constructor = 0x3173d78; - public int flags; - public boolean force; - public InputChannel channel; - public ChannelMessagesFilter filter; - public int pts; - public int limit; + public int flags; + public boolean force; + public InputChannel channel; + public ChannelMessagesFilter filter; + public int pts; + public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return updates_ChannelDifference.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return updates_ChannelDifference.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = force ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - channel.serializeToStream(stream); - filter.serializeToStream(stream); - stream.writeInt32(pts); - stream.writeInt32(limit); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = force ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + channel.serializeToStream(stream); + filter.serializeToStream(stream); + stream.writeInt32(pts); + stream.writeInt32(limit); + } + } public static class TL_photos_updateProfilePhoto extends TLObject { public static int constructor = 0x72d4742c; @@ -45892,30 +46546,30 @@ public class TLRPC { } } - public static class TL_photos_deletePhotos extends TLObject { - public static int constructor = 0x87cf7f2f; + public static class TL_photos_deletePhotos extends TLObject { + public static int constructor = 0x87cf7f2f; - public ArrayList id = new ArrayList<>(); + public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - vector.objects.add(stream.readInt64(exception)); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + Vector vector = new Vector(); + int size = stream.readInt32(exception); + for (int a = 0; a < size; a++) { + vector.objects.add(stream.readInt64(exception)); + } return vector; - } + } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { + int count = id.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { id.get(a).serializeToStream(stream); - } - } - } + } + } + } public static class TL_upload_getFile extends TLObject { public static int constructor = 0xb15a9afc; @@ -45942,46 +46596,46 @@ public class TLRPC { } } - public static class TL_help_getConfig extends TLObject { + public static class TL_help_getConfig extends TLObject { public static int constructor = 0xc4f9186b; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_config.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_config.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_help_getNearestDc extends TLObject { - public static int constructor = 0x1fb33026; + public static class TL_help_getNearestDc extends TLObject { + public static int constructor = 0x1fb33026; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_nearestDc.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_nearestDc.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_help_getAppUpdate extends TLObject { - public static int constructor = 0x522d5a7d; + public static class TL_help_getAppUpdate extends TLObject { + public static int constructor = 0x522d5a7d; - public String source; + public String source; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return help_AppUpdate.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return help_AppUpdate.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(source); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(source); + } + } public static class TL_help_getAppConfig extends TLObject { public static int constructor = 0x98914110; @@ -45996,133 +46650,133 @@ public class TLRPC { } } - public static class TL_help_saveAppLog extends TLObject { - public static int constructor = 0x6f02f748; + public static class TL_help_saveAppLog extends TLObject { + public static int constructor = 0x6f02f748; - public ArrayList events = new ArrayList<>(); + public ArrayList events = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = events.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - events.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = events.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + events.get(a).serializeToStream(stream); + } + } + } - public static class TL_help_getInviteText extends TLObject { - public static int constructor = 0x4d392343; + public static class TL_help_getInviteText extends TLObject { + public static int constructor = 0x4d392343; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_help_inviteText.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_help_inviteText.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_photos_getUserPhotos extends TLObject { - public static int constructor = 0x91cd32a8; + public static class TL_photos_getUserPhotos extends TLObject { + public static int constructor = 0x91cd32a8; - public InputUser user_id; - public int offset; - public long max_id; - public int limit; + public InputUser user_id; + public int offset; + public long max_id; + public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return photos_Photos.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return photos_Photos.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); user_id.serializeToStream(stream); - stream.writeInt32(offset); - stream.writeInt64(max_id); - stream.writeInt32(limit); - } - } + stream.writeInt32(offset); + stream.writeInt64(max_id); + stream.writeInt32(limit); + } + } - public static class TL_messages_forwardMessage extends TLObject { - public static int constructor = 0x33963bf9; + public static class TL_messages_forwardMessage extends TLObject { + public static int constructor = 0x33963bf9; - public InputPeer peer; - public int id; - public long random_id; + public InputPeer peer; + public int id; + public long random_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); } public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(id); - stream.writeInt64(random_id); - } - } + peer.serializeToStream(stream); + stream.writeInt32(id); + stream.writeInt64(random_id); + } + } - public static class TL_messages_getDhConfig extends TLObject { - public static int constructor = 0x26cf8950; + public static class TL_messages_getDhConfig extends TLObject { + public static int constructor = 0x26cf8950; - public int version; - public int random_length; + public int version; + public int random_length; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_DhConfig.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return messages_DhConfig.TLdeserialize(stream, constructor, exception); } public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(version); - stream.writeInt32(random_length); - } - } + stream.writeInt32(version); + stream.writeInt32(random_length); + } + } - public static class TL_messages_requestEncryption extends TLObject { - public static int constructor = 0xf64daf43; + public static class TL_messages_requestEncryption extends TLObject { + public static int constructor = 0xf64daf43; - public InputUser user_id; - public int random_id; - public byte[] g_a; + public InputUser user_id; + public int random_id; + public byte[] g_a; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return EncryptedChat.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return EncryptedChat.TLdeserialize(stream, constructor, exception); } public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - user_id.serializeToStream(stream); - stream.writeInt32(random_id); - stream.writeByteArray(g_a); - } - } + stream.writeInt32(constructor); + user_id.serializeToStream(stream); + stream.writeInt32(random_id); + stream.writeByteArray(g_a); + } + } - public static class TL_messages_acceptEncryption extends TLObject { - public static int constructor = 0x3dbc0415; + public static class TL_messages_acceptEncryption extends TLObject { + public static int constructor = 0x3dbc0415; - public TL_inputEncryptedChat peer; - public byte[] g_b; - public long key_fingerprint; + public TL_inputEncryptedChat peer; + public byte[] g_b; + public long key_fingerprint; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { return EncryptedChat.TLdeserialize(stream, constructor, exception); - } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeByteArray(g_b); - stream.writeInt64(key_fingerprint); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + stream.writeByteArray(g_b); + stream.writeInt64(key_fingerprint); + } + } public static class TL_messages_discardEncryption extends TLObject { public static int constructor = 0xf393aea0; @@ -46143,234 +46797,234 @@ public class TLRPC { } } - public static class TL_messages_setEncryptedTyping extends TLObject { - public static int constructor = 0x791451ed; + public static class TL_messages_setEncryptedTyping extends TLObject { + public static int constructor = 0x791451ed; - public TL_inputEncryptedChat peer; - public boolean typing; + public TL_inputEncryptedChat peer; + public boolean typing; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeBool(typing); - } - } - - public static class TL_messages_readEncryptedHistory extends TLObject { - public static int constructor = 0x7f4b690a; - - public TL_inputEncryptedChat peer; - public int max_date; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(max_date); - } - } - - public static class TL_messages_receivedQueue extends TLObject { - public static int constructor = 0x55a5bb66; - - public int max_qts; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - vector.objects.add(stream.readInt64(exception)); - } - return vector; - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(max_qts); - } - } + stream.writeInt32(constructor); + peer.serializeToStream(stream); + stream.writeBool(typing); + } + } - public static class TL_messages_reportEncryptedSpam extends TLObject { - public static int constructor = 0x4b0c8c0f; + public static class TL_messages_readEncryptedHistory extends TLObject { + public static int constructor = 0x7f4b690a; - public TL_inputEncryptedChat peer; + public TL_inputEncryptedChat peer; + public int max_date; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + stream.writeInt32(max_date); + } + } - public static class TL_help_getSupport extends TLObject { + public static class TL_messages_receivedQueue extends TLObject { + public static int constructor = 0x55a5bb66; + + public int max_qts; + + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + Vector vector = new Vector(); + int size = stream.readInt32(exception); + for (int a = 0; a < size; a++) { + vector.objects.add(stream.readInt64(exception)); + } + return vector; + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(max_qts); + } + } + + public static class TL_messages_reportEncryptedSpam extends TLObject { + public static int constructor = 0x4b0c8c0f; + + public TL_inputEncryptedChat peer; + + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + } + } + + public static class TL_help_getSupport extends TLObject { public static int constructor = 0x9cdf08cd; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_help_support.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_help_support.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_messages_readMessageContents extends TLObject { - public static int constructor = 0x36a73f77; + public static class TL_messages_readMessageContents extends TLObject { + public static int constructor = 0x36a73f77; - public ArrayList id = new ArrayList<>(); + public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_affectedMessages.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_messages_affectedMessages.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); - } - } - } + int count = id.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeInt32(id.get(a)); + } + } + } - public static class TL_account_checkUsername extends TLObject { - public static int constructor = 0x2714d86c; + public static class TL_account_checkUsername extends TLObject { + public static int constructor = 0x2714d86c; - public String username; + public String username; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(username); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(username); + } + } - public static class TL_account_updateUsername extends TLObject { - public static int constructor = 0x3e0bdd7c; + public static class TL_account_updateUsername extends TLObject { + public static int constructor = 0x3e0bdd7c; - public String username; + public String username; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return User.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return User.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(username); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(username); + } + } - public static class TL_contacts_search extends TLObject { - public static int constructor = 0x11f812d8; + public static class TL_contacts_search extends TLObject { + public static int constructor = 0x11f812d8; - public String q; - public int limit; + public String q; + public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_contacts_found.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_contacts_found.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(q); - stream.writeInt32(limit); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(q); + stream.writeInt32(limit); + } + } - public static class TL_account_getPrivacy extends TLObject { + public static class TL_account_getPrivacy extends TLObject { public static int constructor = 0xdadbc950; - public InputPrivacyKey key; + public InputPrivacyKey key; public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_account_privacyRules.TLdeserialize(stream, constructor, exception); - } + return TL_account_privacyRules.TLdeserialize(stream, constructor, exception); + } public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - key.serializeToStream(stream); - } - } + stream.writeInt32(constructor); + key.serializeToStream(stream); + } + } - public static class TL_account_setPrivacy extends TLObject { - public static int constructor = 0xc9f81ce8; + public static class TL_account_setPrivacy extends TLObject { + public static int constructor = 0xc9f81ce8; - public InputPrivacyKey key; - public ArrayList rules = new ArrayList<>(); + public InputPrivacyKey key; + public ArrayList rules = new ArrayList<>(); public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_account_privacyRules.TLdeserialize(stream, constructor, exception); - } + return TL_account_privacyRules.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - key.serializeToStream(stream); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + key.serializeToStream(stream); stream.writeInt32(0x1cb5c415); - int count = rules.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { + int count = rules.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { rules.get(a).serializeToStream(stream); - } - } - } + } + } + } public static class TL_account_deleteAccount extends TLObject { - public static int constructor = 0x418d4e0b; + public static int constructor = 0x418d4e0b; - public String reason; + public String reason; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(reason); - } - } - - public static class TL_account_getAccountTTL extends TLObject { - public static int constructor = 0x8fc711d; - - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_accountDaysTTL.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + stream.writeInt32(constructor); + stream.writeString(reason); + } + } - public static class TL_account_setAccountTTL extends TLObject { - public static int constructor = 0x2442485e; + public static class TL_account_getAccountTTL extends TLObject { + public static int constructor = 0x8fc711d; - public TL_accountDaysTTL ttl; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_accountDaysTTL.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - ttl.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_account_setAccountTTL extends TLObject { + public static int constructor = 0x2442485e; + + public TL_accountDaysTTL ttl; + + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + ttl.serializeToStream(stream); + } + } public static class TL_contacts_resolveUsername extends TLObject { public static int constructor = 0xf93ccba3; @@ -46424,22 +47078,22 @@ public class TLRPC { } } - public static class TL_contacts_resetTopPeerRating extends TLObject { - public static int constructor = 0x1ae373ac; + public static class TL_contacts_resetTopPeerRating extends TLObject { + public static int constructor = 0x1ae373ac; - public TopPeerCategory category; - public InputPeer peer; + public TopPeerCategory category; + public InputPeer peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - category.serializeToStream(stream); - peer.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + category.serializeToStream(stream); + peer.serializeToStream(stream); + } + } public static class TL_account_sendChangePhoneCode extends TLObject { public static int constructor = 0x82574ae5; @@ -46458,65 +47112,65 @@ public class TLRPC { } } - public static class TL_account_changePhone extends TLObject { + public static class TL_account_changePhone extends TLObject { public static int constructor = 0x70c32edb; - public String phone_number; - public String phone_code_hash; - public String phone_code; + public String phone_number; + public String phone_code_hash; + public String phone_code; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return User.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return User.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(phone_number); - stream.writeString(phone_code_hash); - stream.writeString(phone_code); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(phone_number); + stream.writeString(phone_code_hash); + stream.writeString(phone_code); + } + } - public static class TL_account_getWebAuthorizations extends TLObject { - public static int constructor = 0x182e6d6f; + public static class TL_account_getWebAuthorizations extends TLObject { + public static int constructor = 0x182e6d6f; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_account_webAuthorizations.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_account_webAuthorizations.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_account_resetWebAuthorization extends TLObject { - public static int constructor = 0x2d01b9ef; + public static class TL_account_resetWebAuthorization extends TLObject { + public static int constructor = 0x2d01b9ef; - public long hash; + public long hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(hash); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(hash); + } + } - public static class TL_account_resetWebAuthorizations extends TLObject { - public static int constructor = 0x682d2594; + public static class TL_account_resetWebAuthorizations extends TLObject { + public static int constructor = 0x682d2594; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_account_getMultiWallPapers extends TLObject { public static int constructor = 0x65ad71dc; @@ -46596,93 +47250,93 @@ public class TLRPC { } } - public static class TL_account_getAllSecureValues extends TLObject { - public static int constructor = 0xb288bc7d; + public static class TL_account_getAllSecureValues extends TLObject { + public static int constructor = 0xb288bc7d; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - TL_secureValue object = TL_secureValue.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + Vector vector = new Vector(); + int size = stream.readInt32(exception); + for (int a = 0; a < size; a++) { + TL_secureValue object = TL_secureValue.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return vector; + } + vector.objects.add(object); + } + return vector; + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_account_getSecureValue extends TLObject { - public static int constructor = 0x73665bc2; + public static class TL_account_getSecureValue extends TLObject { + public static int constructor = 0x73665bc2; - public ArrayList types = new ArrayList<>(); + public ArrayList types = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - TL_secureValue object = TL_secureValue.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + Vector vector = new Vector(); + int size = stream.readInt32(exception); + for (int a = 0; a < size; a++) { + TL_secureValue object = TL_secureValue.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return vector; + } + vector.objects.add(object); + } + return vector; + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = types.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - types.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = types.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + types.get(a).serializeToStream(stream); + } + } + } - public static class TL_account_saveSecureValue extends TLObject { - public static int constructor = 0x899fe31d; + public static class TL_account_saveSecureValue extends TLObject { + public static int constructor = 0x899fe31d; - public TL_inputSecureValue value; - public long secure_secret_id; + public TL_inputSecureValue value; + public long secure_secret_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_secureValue.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_secureValue.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - value.serializeToStream(stream); - stream.writeInt64(secure_secret_id); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + value.serializeToStream(stream); + stream.writeInt64(secure_secret_id); + } + } - public static class TL_account_deleteSecureValue extends TLObject { - public static int constructor = 0xb880bc4b; + public static class TL_account_deleteSecureValue extends TLObject { + public static int constructor = 0xb880bc4b; - public ArrayList types = new ArrayList<>(); + public ArrayList types = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = types.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - types.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = types.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + types.get(a).serializeToStream(stream); + } + } + } public static class TL_account_getAuthorizationForm extends TLObject { public static int constructor = 0xa929597a; @@ -46748,56 +47402,56 @@ public class TLRPC { } } - public static class TL_account_verifyPhone extends TLObject { - public static int constructor = 0x4dd3a7f6; + public static class TL_account_verifyPhone extends TLObject { + public static int constructor = 0x4dd3a7f6; - public String phone_number; - public String phone_code_hash; - public String phone_code; + public String phone_number; + public String phone_code_hash; + public String phone_code; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(phone_number); - stream.writeString(phone_code_hash); - stream.writeString(phone_code); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(phone_number); + stream.writeString(phone_code_hash); + stream.writeString(phone_code); + } + } - public static class TL_account_sendVerifyEmailCode extends TLObject { - public static int constructor = 0x7011509f; + public static class TL_account_sendVerifyEmailCode extends TLObject { + public static int constructor = 0x7011509f; - public String email; + public String email; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_account_sentEmailCode.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_account_sentEmailCode.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(email); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(email); + } + } - public static class TL_account_verifyEmail extends TLObject { - public static int constructor = 0xecba39db; + public static class TL_account_verifyEmail extends TLObject { + public static int constructor = 0xecba39db; - public String email; - public String code; + public String email; + public String code; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(email); - stream.writeString(code); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(email); + stream.writeString(code); + } + } public static class TL_account_confirmPasswordEmail extends TLObject { public static int constructor = 0x8fdf1920; @@ -47171,87 +47825,87 @@ public class TLRPC { } } - public static class TL_account_updateDeviceLocked extends TLObject { - public static int constructor = 0x38df3532; + public static class TL_account_updateDeviceLocked extends TLObject { + public static int constructor = 0x38df3532; - public int period; + public int period; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(period); - } - } + stream.writeInt32(constructor); + stream.writeInt32(period); + } + } - public static class TL_messages_getWebPagePreview extends TLObject { - public static int constructor = 0x8b68b0cc; + public static class TL_messages_getWebPagePreview extends TLObject { + public static int constructor = 0x8b68b0cc; - public int flags; - public String message; - public ArrayList entities = new ArrayList<>(); + public int flags; + public String message; + public ArrayList entities = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return MessageMedia.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeString(message); - if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - } - } - - public static class TL_account_getAuthorizations extends TLObject { - public static int constructor = 0xe320c158; - - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_account_authorizations.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return MessageMedia.TLdeserialize(stream, constructor, exception); + } public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeString(message); + if ((flags & 8) != 0) { + stream.writeInt32(0x1cb5c415); + int count = entities.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + entities.get(a).serializeToStream(stream); + } + } + } + } - public static class TL_account_resetAuthorization extends TLObject { - public static int constructor = 0xdf77f3bc; + public static class TL_account_getAuthorizations extends TLObject { + public static int constructor = 0xe320c158; - public long hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_account_authorizations.TLdeserialize(stream, constructor, exception); + } public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(hash); - } - } + stream.writeInt32(constructor); + } + } - public static class TL_account_getPassword extends TLObject { + public static class TL_account_resetAuthorization extends TLObject { + public static int constructor = 0xdf77f3bc; + + public long hash; + + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(hash); + } + } + + public static class TL_account_getPassword extends TLObject { public static int constructor = 0x548a30f5; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_account_password.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_account_password.TLdeserialize(stream, constructor, exception); + } public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + stream.writeInt32(constructor); + } + } public static class TL_account_getPasswordSettings extends TLObject { public static int constructor = 0x9cd4eaf9; @@ -47351,16 +48005,16 @@ public class TLRPC { } } - public static class TL_auth_requestPasswordRecovery extends TLObject { - public static int constructor = 0xd897bc66; + public static class TL_auth_requestPasswordRecovery extends TLObject { + public static int constructor = 0xd897bc66; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_auth_passwordRecovery.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_auth_passwordRecovery.TLdeserialize(stream, constructor, exception); + } public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); + stream.writeInt32(constructor); } } @@ -47385,39 +48039,39 @@ public class TLRPC { } } - public static class TL_auth_resendCode extends TLObject { - public static int constructor = 0x3ef1a9bf; + public static class TL_auth_resendCode extends TLObject { + public static int constructor = 0x3ef1a9bf; - public String phone_number; - public String phone_code_hash; + public String phone_number; + public String phone_code_hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_auth_sentCode.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_auth_sentCode.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(phone_number); - stream.writeString(phone_code_hash); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(phone_number); + stream.writeString(phone_code_hash); + } + } - public static class TL_auth_cancelCode extends TLObject { - public static int constructor = 0x1f040578; + public static class TL_auth_cancelCode extends TLObject { + public static int constructor = 0x1f040578; - public String phone_number; - public String phone_code_hash; + public String phone_number; + public String phone_code_hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(phone_number); - stream.writeString(phone_code_hash); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(phone_number); + stream.writeString(phone_code_hash); + } + } public static class TL_messages_exportChatInvite extends TLObject { public static int constructor = 0xa02ce5d5; @@ -47452,103 +48106,103 @@ public class TLRPC { } } - public static class TL_messages_checkChatInvite extends TLObject { - public static int constructor = 0x3eadb1bb; + public static class TL_messages_checkChatInvite extends TLObject { + public static int constructor = 0x3eadb1bb; - public String hash; + public String hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return ChatInvite.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(hash); - } - } - - public static class TL_messages_importChatInvite extends TLObject { - public static int constructor = 0x6c50051c; - - public String hash; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(hash); - } - } - - public static class TL_messages_getStickerSet extends TLObject { - public static int constructor = 0x2619a90e; - - public InputStickerSet stickerset; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_stickerSet.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stickerset.serializeToStream(stream); - } - } - - public static class TL_messages_installStickerSet extends TLObject { - public static int constructor = 0xc78fe460; - - public InputStickerSet stickerset; - public boolean archived; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_StickerSetInstallResult.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stickerset.serializeToStream(stream); - stream.writeBool(archived); - } - } - - public static class TL_messages_uninstallStickerSet extends TLObject { - public static int constructor = 0xf96e55de; - - public InputStickerSet stickerset; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return ChatInvite.TLdeserialize(stream, constructor, exception); + } public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stickerset.serializeToStream(stream); - } - } + stream.writeInt32(constructor); + stream.writeString(hash); + } + } - public static class TL_messages_startBot extends TLObject { - public static int constructor = 0xe6df7378; + public static class TL_messages_importChatInvite extends TLObject { + public static int constructor = 0x6c50051c; - public InputUser bot; - public InputPeer peer; - public long random_id; - public String start_param; + public String hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - bot.serializeToStream(stream); - peer.serializeToStream(stream); - stream.writeInt64(random_id); - stream.writeString(start_param); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(hash); + } + } + + public static class TL_messages_getStickerSet extends TLObject { + public static int constructor = 0x2619a90e; + + public InputStickerSet stickerset; + + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_messages_stickerSet.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stickerset.serializeToStream(stream); + } + } + + public static class TL_messages_installStickerSet extends TLObject { + public static int constructor = 0xc78fe460; + + public InputStickerSet stickerset; + public boolean archived; + + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return messages_StickerSetInstallResult.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stickerset.serializeToStream(stream); + stream.writeBool(archived); + } + } + + public static class TL_messages_uninstallStickerSet extends TLObject { + public static int constructor = 0xf96e55de; + + public InputStickerSet stickerset; + + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stickerset.serializeToStream(stream); + } + } + + public static class TL_messages_startBot extends TLObject { + public static int constructor = 0xe6df7378; + + public InputUser bot; + public InputPeer peer; + public long random_id; + public String start_param; + + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + bot.serializeToStream(stream); + peer.serializeToStream(stream); + stream.writeInt64(random_id); + stream.writeString(start_param); + } + } public static class TL_messages_getMessagesViews extends TLObject { public static int constructor = 0x5784d3e1; @@ -47589,49 +48243,49 @@ public class TLRPC { } } - public static class TL_messages_saveGif extends TLObject { - public static int constructor = 0x327a30cb; + public static class TL_messages_saveGif extends TLObject { + public static int constructor = 0x327a30cb; - public InputDocument id; - public boolean unsave; + public InputDocument id; + public boolean unsave; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - id.serializeToStream(stream); - stream.writeBool(unsave); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + id.serializeToStream(stream); + stream.writeBool(unsave); + } + } - public static class TL_messages_getInlineBotResults extends TLObject { - public static int constructor = 0x514e999d; + public static class TL_messages_getInlineBotResults extends TLObject { + public static int constructor = 0x514e999d; - public int flags; - public InputUser bot; - public InputPeer peer; - public InputGeoPoint geo_point; - public String query; - public String offset; + public int flags; + public InputUser bot; + public InputPeer peer; + public InputGeoPoint geo_point; + public String query; + public String offset; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_BotResults.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return messages_BotResults.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - bot.serializeToStream(stream); - peer.serializeToStream(stream); - if ((flags & 1) != 0) { - geo_point.serializeToStream(stream); - } - stream.writeString(query); - stream.writeString(offset); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + bot.serializeToStream(stream); + peer.serializeToStream(stream); + if ((flags & 1) != 0) { + geo_point.serializeToStream(stream); + } + stream.writeString(query); + stream.writeString(offset); + } + } public static class TL_messages_sendInlineBotResult extends TLObject { public static int constructor = 0x7aa11297; @@ -47676,22 +48330,22 @@ public class TLRPC { } } - public static class TL_messages_getMessageEditData extends TLObject { - public static int constructor = 0xfda68d36; + public static class TL_messages_getMessageEditData extends TLObject { + public static int constructor = 0xfda68d36; - public InputPeer peer; - public int id; + public InputPeer peer; + public int id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_messageEditData.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_messages_messageEditData.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(id); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + stream.writeInt32(id); + } + } public static class TL_messages_editMessage extends TLObject { public static int constructor = 0x48f71778; @@ -47768,101 +48422,101 @@ public class TLRPC { } } - public static class TL_messages_setBotCallbackAnswer extends TLObject { - public static int constructor = 0xd58f130a; + public static class TL_messages_setBotCallbackAnswer extends TLObject { + public static int constructor = 0xd58f130a; - public int flags; - public boolean alert; - public long query_id; - public String message; - public String url; - public int cache_time; + public int flags; + public boolean alert; + public long query_id; + public String message; + public String url; + public int cache_time; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = alert ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - stream.writeInt64(query_id); - if ((flags & 1) != 0) { - stream.writeString(message); - } - if ((flags & 4) != 0) { - stream.writeString(url); - } - stream.writeInt32(cache_time); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = alert ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + stream.writeInt64(query_id); + if ((flags & 1) != 0) { + stream.writeString(message); + } + if ((flags & 4) != 0) { + stream.writeString(url); + } + stream.writeInt32(cache_time); + } + } - public static class TL_messages_getPeerDialogs extends TLObject { - public static int constructor = 0xe470bcfd; + public static class TL_messages_getPeerDialogs extends TLObject { + public static int constructor = 0xe470bcfd; - public ArrayList peers = new ArrayList<>(); + public ArrayList peers = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_peerDialogs.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_messages_peerDialogs.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - peers.get(a).serializeToStream(stream); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = peers.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + peers.get(a).serializeToStream(stream); + } + } + } - public static class TL_messages_saveDraft extends TLObject { - public static int constructor = 0xbc39e14b; + public static class TL_messages_saveDraft extends TLObject { + public static int constructor = 0xbc39e14b; - public int flags; - public boolean no_webpage; - public int reply_to_msg_id; - public InputPeer peer; - public String message; - public ArrayList entities = new ArrayList<>(); + public int flags; + public boolean no_webpage; + public int reply_to_msg_id; + public InputPeer peer; + public String message; + public ArrayList entities = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = no_webpage ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - stream.writeInt32(reply_to_msg_id); - } - peer.serializeToStream(stream); - stream.writeString(message); - if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = no_webpage ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + stream.writeInt32(reply_to_msg_id); + } + peer.serializeToStream(stream); + stream.writeString(message); + if ((flags & 8) != 0) { + stream.writeInt32(0x1cb5c415); + int count = entities.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + entities.get(a).serializeToStream(stream); + } + } + } + } - public static class TL_messages_getAllDrafts extends TLObject { - public static int constructor = 0x6a3f8d65; + public static class TL_messages_getAllDrafts extends TLObject { + public static int constructor = 0x6a3f8d65; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_messages_getFeaturedStickers extends TLObject { public static int constructor = 0x64780b14; @@ -47879,25 +48533,25 @@ public class TLRPC { } } - public static class TL_messages_readFeaturedStickers extends TLObject { - public static int constructor = 0x5b118126; + public static class TL_messages_readFeaturedStickers extends TLObject { + public static int constructor = 0x5b118126; - public ArrayList id = new ArrayList<>(); + public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(id.get(a)); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(0x1cb5c415); + int count = id.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeInt64(id.get(a)); + } + } + } public static class TL_messages_getRecentStickers extends TLObject { public static int constructor = 0x9da9403b; @@ -47918,116 +48572,116 @@ public class TLRPC { } } - public static class TL_messages_saveRecentSticker extends TLObject { - public static int constructor = 0x392718f8; + public static class TL_messages_saveRecentSticker extends TLObject { + public static int constructor = 0x392718f8; - public int flags; - public boolean attached; - public InputDocument id; - public boolean unsave; + public int flags; + public boolean attached; + public InputDocument id; + public boolean unsave; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = attached ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - id.serializeToStream(stream); - stream.writeBool(unsave); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = attached ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + id.serializeToStream(stream); + stream.writeBool(unsave); + } + } - public static class TL_messages_clearRecentStickers extends TLObject { - public static int constructor = 0x8999602d; + public static class TL_messages_clearRecentStickers extends TLObject { + public static int constructor = 0x8999602d; - public int flags; - public boolean attached; + public int flags; + public boolean attached; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = attached ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = attached ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + } + } - public static class TL_messages_getArchivedStickers extends TLObject { - public static int constructor = 0x57f17692; + public static class TL_messages_getArchivedStickers extends TLObject { + public static int constructor = 0x57f17692; - public int flags; - public boolean masks; - public long offset_id; - public int limit; + public int flags; + public boolean masks; + public long offset_id; + public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_archivedStickers.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_messages_archivedStickers.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = masks ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeInt64(offset_id); - stream.writeInt32(limit); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = masks ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + stream.writeInt64(offset_id); + stream.writeInt32(limit); + } + } - public static class TL_messages_setGameScore extends TLObject { - public static int constructor = 0x8ef8ecc0; + public static class TL_messages_setGameScore extends TLObject { + public static int constructor = 0x8ef8ecc0; - public int flags; - public boolean edit_message; - public boolean force; - public InputPeer peer; - public int id; - public InputUser user_id; - public int score; + public int flags; + public boolean edit_message; + public boolean force; + public InputPeer peer; + public int id; + public InputUser user_id; + public int score; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = edit_message ? (flags | 1) : (flags &~ 1); - flags = force ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - peer.serializeToStream(stream); - stream.writeInt32(id); - user_id.serializeToStream(stream); - stream.writeInt32(score); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = edit_message ? (flags | 1) : (flags &~ 1); + flags = force ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + peer.serializeToStream(stream); + stream.writeInt32(id); + user_id.serializeToStream(stream); + stream.writeInt32(score); + } + } - public static class TL_messages_setInlineGameScore extends TLObject { - public static int constructor = 0x15ad9f64; + public static class TL_messages_setInlineGameScore extends TLObject { + public static int constructor = 0x15ad9f64; - public int flags; - public boolean edit_message; - public boolean force; - public TL_inputBotInlineMessageID id; - public InputUser user_id; - public int score; + public int flags; + public boolean edit_message; + public boolean force; + public TL_inputBotInlineMessageID id; + public InputUser user_id; + public int score; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = edit_message ? (flags | 1) : (flags &~ 1); - flags = force ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - id.serializeToStream(stream); - user_id.serializeToStream(stream); - stream.writeInt32(score); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = edit_message ? (flags | 1) : (flags &~ 1); + flags = force ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + id.serializeToStream(stream); + user_id.serializeToStream(stream); + stream.writeInt32(score); + } + } public static class TL_messages_getMaskStickers extends TLObject { public static int constructor = 0x640f82b8; @@ -48044,65 +48698,65 @@ public class TLRPC { } } - public static class TL_messages_getGameHighScores extends TLObject { - public static int constructor = 0xe822649d; + public static class TL_messages_getGameHighScores extends TLObject { + public static int constructor = 0xe822649d; - public InputPeer peer; - public int id; - public InputUser user_id; + public InputPeer peer; + public int id; + public InputUser user_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_highScores.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_messages_highScores.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(id); - user_id.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + stream.writeInt32(id); + user_id.serializeToStream(stream); + } + } - public static class TL_messages_getInlineGameHighScores extends TLObject { - public static int constructor = 0xf635e1b; + public static class TL_messages_getInlineGameHighScores extends TLObject { + public static int constructor = 0xf635e1b; - public TL_inputBotInlineMessageID id; - public InputUser user_id; + public TL_inputBotInlineMessageID id; + public InputUser user_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_highScores.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_messages_highScores.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - id.serializeToStream(stream); - user_id.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + id.serializeToStream(stream); + user_id.serializeToStream(stream); + } + } - public static class TL_messages_getAttachedStickers extends TLObject { - public static int constructor = 0xcc5b67cc; + public static class TL_messages_getAttachedStickers extends TLObject { + public static int constructor = 0xcc5b67cc; - public InputStickeredMedia media; + public InputStickeredMedia media; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - StickerSetCovered object = StickerSetCovered.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + Vector vector = new Vector(); + int size = stream.readInt32(exception); + for (int a = 0; a < size; a++) { + StickerSetCovered object = StickerSetCovered.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return vector; + } + vector.objects.add(object); + } + return vector; + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - media.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + media.serializeToStream(stream); + } + } public static class TL_messages_getCommonChats extends TLObject { public static int constructor = 0xe40ca104; @@ -48143,41 +48797,41 @@ public class TLRPC { } } - public static class TL_messages_getWebPage extends TLObject { - public static int constructor = 0x32ca8f91; + public static class TL_messages_getWebPage extends TLObject { + public static int constructor = 0x32ca8f91; - public String url; - public int hash; + public String url; + public int hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return WebPage.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return WebPage.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(url); - stream.writeInt32(hash); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(url); + stream.writeInt32(hash); + } + } - public static class TL_messages_toggleDialogPin extends TLObject { - public static int constructor = 0xa731e257; + public static class TL_messages_toggleDialogPin extends TLObject { + public static int constructor = 0xa731e257; - public int flags; - public boolean pinned; - public InputDialogPeer peer; + public int flags; + public boolean pinned; + public InputDialogPeer peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = pinned ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - peer.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = pinned ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + peer.serializeToStream(stream); + } + } public static class TL_messages_reorderPinnedDialogs extends TLObject { public static int constructor = 0x3b1adf37; @@ -48220,41 +48874,41 @@ public class TLRPC { } } - public static class TL_messages_uploadMedia extends TLObject { - public static int constructor = 0x519bc2b1; + public static class TL_messages_uploadMedia extends TLObject { + public static int constructor = 0x519bc2b1; - public InputPeer peer; - public InputMedia media; + public InputPeer peer; + public InputMedia media; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return MessageMedia.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return MessageMedia.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - media.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + media.serializeToStream(stream); + } + } - public static class TL_messages_sendScreenshotNotification extends TLObject { - public static int constructor = 0xc97df020; + public static class TL_messages_sendScreenshotNotification extends TLObject { + public static int constructor = 0xc97df020; - public InputPeer peer; - public int reply_to_msg_id; - public long random_id; + public InputPeer peer; + public int reply_to_msg_id; + public long random_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(reply_to_msg_id); - stream.writeInt64(random_id); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + stream.writeInt32(reply_to_msg_id); + stream.writeInt64(random_id); + } + } public static class TL_messages_getFavedStickers extends TLObject { public static int constructor = 0x4f1aaa9; @@ -48271,62 +48925,62 @@ public class TLRPC { } } - public static class TL_messages_faveSticker extends TLObject { - public static int constructor = 0xb9ffc55b; + public static class TL_messages_faveSticker extends TLObject { + public static int constructor = 0xb9ffc55b; - public InputDocument id; - public boolean unfave; + public InputDocument id; + public boolean unfave; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - id.serializeToStream(stream); - stream.writeBool(unfave); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + id.serializeToStream(stream); + stream.writeBool(unfave); + } + } - public static class TL_messages_getUnreadMentions extends TLObject { - public static int constructor = 0x46578472; + public static class TL_messages_getUnreadMentions extends TLObject { + public static int constructor = 0x46578472; - public InputPeer peer; - public int offset_id; - public int add_offset; - public int limit; - public int max_id; - public int min_id; + public InputPeer peer; + public int offset_id; + public int add_offset; + public int limit; + public int max_id; + public int min_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_Messages.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return messages_Messages.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(offset_id); - stream.writeInt32(add_offset); - stream.writeInt32(limit); - stream.writeInt32(max_id); - stream.writeInt32(min_id); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + stream.writeInt32(offset_id); + stream.writeInt32(add_offset); + stream.writeInt32(limit); + stream.writeInt32(max_id); + stream.writeInt32(min_id); + } + } - public static class TL_messages_readMentions extends TLObject { - public static int constructor = 0xf0189d3; + public static class TL_messages_readMentions extends TLObject { + public static int constructor = 0xf0189d3; - public InputPeer peer; + public InputPeer peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_affectedHistory.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_messages_affectedHistory.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + } + } public static class TL_messages_getRecentLocations extends TLObject { public static int constructor = 0x702a40e0; @@ -48389,18 +49043,18 @@ public class TLRPC { } } - public static class TL_messages_clearAllDrafts extends TLObject { - public static int constructor = 0x7e58ee9c; + public static class TL_messages_clearAllDrafts extends TLObject { + public static int constructor = 0x7e58ee9c; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_messages_updatePinnedMessage extends TLObject { public static int constructor = 0xd2aaf7ec; @@ -48880,6 +49534,73 @@ public class TLRPC { } } + public static class TL_messages_getMessageReactionsList extends TLObject { + public static int constructor = 0xe0ee6b77; + + public int flags; + public InputPeer peer; + public int id; + public String reaction; + public String offset; + public int limit; + + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_messages_messageReactionsList.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + peer.serializeToStream(stream); + stream.writeInt32(id); + if ((flags & 1) != 0) { + stream.writeString(reaction); + } + if ((flags & 2) != 0) { + stream.writeString(offset); + } + stream.writeInt32(limit); + } + } + + public static class TL_messages_setChatAvailableReactions extends TLObject { + public static int constructor = 0x14050ea6; + + public InputPeer peer; + public ArrayList available_reactions = new ArrayList<>(); + + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + stream.writeInt32(0x1cb5c415); + int count = available_reactions.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeString(available_reactions.get(a)); + } + } + } + + public static class TL_messages_getAvailableReactions extends TLObject { + public static int constructor = 0x18dea0ac; + + public int hash; + + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return messages_AvailableReactions.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(hash); + } + } + + public static class TL_messages_searchResultsCalendar extends TLObject { public static int constructor = 0x147ee23c; @@ -49015,35 +49736,6 @@ public class TLRPC { } } - public static class TL_messages_getMessageReactionsList extends TLObject { - public static int constructor = 0x15b1376a; - - public int flags; - public InputPeer peer; - public int id; - public String reaction; - public String offset; - public int limit; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messageReactionsList.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - peer.serializeToStream(stream); - stream.writeInt32(id); - if ((flags & 1) != 0) { - stream.writeString(reaction); - } - if ((flags & 2) != 0) { - stream.writeString(offset); - } - stream.writeInt32(limit); - } - } - public static class TL_messages_getPollVotes extends TLObject { public static int constructor = 0xb86e380e; @@ -49657,20 +50349,20 @@ public class TLRPC { } } - public static class TL_help_getAppChangelog extends TLObject { - public static int constructor = 0x9010ef6f; + public static class TL_help_getAppChangelog extends TLObject { + public static int constructor = 0x9010ef6f; - public String prev_app_version; + public String prev_app_version; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(prev_app_version); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(prev_app_version); + } + } public static class TL_messages_toggleStickerSets extends TLObject { public static int constructor = 0xb5052fea; @@ -49700,22 +50392,22 @@ public class TLRPC { } } - public static class TL_messages_uploadEncryptedFile extends TLObject { - public static int constructor = 0x5057c497; + public static class TL_messages_uploadEncryptedFile extends TLObject { + public static int constructor = 0x5057c497; - public TL_inputEncryptedChat peer; - public InputEncryptedFile file; + public TL_inputEncryptedChat peer; + public InputEncryptedFile file; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return EncryptedFile.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return EncryptedFile.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - file.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + file.serializeToStream(stream); + } + } public static class TL_messages_searchStickerSets extends TLObject { public static int constructor = 0x35705b8a; @@ -49738,24 +50430,24 @@ public class TLRPC { } } - public static class TL_messages_markDialogUnread extends TLObject { - public static int constructor = 0xc286d98f; + public static class TL_messages_markDialogUnread extends TLObject { + public static int constructor = 0xc286d98f; - public int flags; - public boolean unread; - public InputDialogPeer peer; + public int flags; + public boolean unread; + public InputDialogPeer peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - peer.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = unread ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + peer.serializeToStream(stream); + } + } public static class TL_messages_getDialogUnreadMarks extends TLObject { public static int constructor = 0x22e24e22; @@ -49779,97 +50471,97 @@ public class TLRPC { } } - public static class TL_help_setBotUpdatesStatus extends TLObject { - public static int constructor = 0xec22cfcd; + public static class TL_help_setBotUpdatesStatus extends TLObject { + public static int constructor = 0xec22cfcd; - public int pending_updates_count; - public String message; + public int pending_updates_count; + public String message; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(pending_updates_count); - stream.writeString(message); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(pending_updates_count); + stream.writeString(message); + } + } - public static class TL_messages_reorderStickerSets extends TLObject { - public static int constructor = 0x78337739; + public static class TL_messages_reorderStickerSets extends TLObject { + public static int constructor = 0x78337739; - public int flags; - public boolean masks; - public ArrayList order = new ArrayList<>(); + public int flags; + public boolean masks; + public ArrayList order = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = masks ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = order.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(order.get(a)); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = masks ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + stream.writeInt32(0x1cb5c415); + int count = order.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeInt64(order.get(a)); + } + } + } - public static class TL_messages_getDocumentByHash extends TLObject { - public static int constructor = 0x338e2464; + public static class TL_messages_getDocumentByHash extends TLObject { + public static int constructor = 0x338e2464; - public byte[] sha256; - public int size; - public String mime_type; + public byte[] sha256; + public int size; + public String mime_type; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Document.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Document.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(sha256); - stream.writeInt32(size); - stream.writeString(mime_type); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeByteArray(sha256); + stream.writeInt32(size); + stream.writeString(mime_type); + } + } - public static class TL_help_getRecentMeUrls extends TLObject { - public static int constructor = 0x3dc0f114; + public static class TL_help_getRecentMeUrls extends TLObject { + public static int constructor = 0x3dc0f114; - public String referer; + public String referer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_help_recentMeUrls.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_help_recentMeUrls.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(referer); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(referer); + } + } - public static class TL_help_getDeepLinkInfo extends TLObject { - public static int constructor = 0x3fedc75f; + public static class TL_help_getDeepLinkInfo extends TLObject { + public static int constructor = 0x3fedc75f; - public String path; + public String path; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return help_DeepLinkInfo.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return help_DeepLinkInfo.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(path); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(path); + } + } - public static class TL_channels_readHistory extends TLObject { + public static class TL_channels_readHistory extends TLObject { public static int constructor = 0xcc104937; public InputChannel channel; @@ -49886,55 +50578,55 @@ public class TLRPC { } } - public static class TL_channels_deleteMessages extends TLObject { - public static int constructor = 0x84c1fd4e; + public static class TL_channels_deleteMessages extends TLObject { + public static int constructor = 0x84c1fd4e; - public InputChannel channel; - public ArrayList id = new ArrayList<>(); + public InputChannel channel; + public ArrayList id = new ArrayList<>(); - public static TL_channels_deleteMessages TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_channels_deleteMessages.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_channels_deleteMessages", constructor)); - } else { - return null; - } - } - TL_channels_deleteMessages result = new TL_channels_deleteMessages(); - result.readParams(stream, exception); - return result; - } + public static TL_channels_deleteMessages TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_channels_deleteMessages.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_channels_deleteMessages", constructor)); + } else { + return null; + } + } + TL_channels_deleteMessages result = new TL_channels_deleteMessages(); + result.readParams(stream, exception); + return result; + } - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_affectedMessages.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_messages_affectedMessages.TLdeserialize(stream, constructor, exception); + } - public void readParams(AbstractSerializedData stream, boolean exception) { - channel = InputChannel.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - id.add(stream.readInt32(exception)); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + channel = InputChannel.TLdeserialize(stream, stream.readInt32(exception), exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + id.add(stream.readInt32(exception)); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - channel.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + channel.serializeToStream(stream); + stream.writeInt32(0x1cb5c415); + int count = id.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeInt32(id.get(a)); + } + } + } public static class TL_channels_deleteParticipantHistory extends TLObject { public static int constructor = 0x367544db; @@ -49953,29 +50645,29 @@ public class TLRPC { } } - public static class TL_channels_reportSpam extends TLObject { + public static class TL_channels_reportSpam extends TLObject { public static int constructor = 0xf44a8315; - public InputChannel channel; + public InputChannel channel; public InputPeer participant; - public ArrayList id = new ArrayList<>(); + public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - channel.serializeToStream(stream); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + channel.serializeToStream(stream); participant.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); - } - } - } + stream.writeInt32(0x1cb5c415); + int count = id.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeInt32(id.get(a)); + } + } + } public static class TL_channels_getMessages extends TLObject { public static int constructor = 0x93d7b347; @@ -50286,22 +50978,22 @@ public class TLRPC { } } - public static class TL_channels_toggleSignatures extends TLObject { - public static int constructor = 0x1f69b606; + public static class TL_channels_toggleSignatures extends TLObject { + public static int constructor = 0x1f69b606; - public InputChannel channel; - public boolean enabled; + public InputChannel channel; + public boolean enabled; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - channel.serializeToStream(stream); - stream.writeBool(enabled); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + channel.serializeToStream(stream); + stream.writeBool(enabled); + } + } public static class TL_channels_getAdminedPublicChannels extends TLObject { public static int constructor = 0xf8b036af; @@ -50341,82 +51033,82 @@ public class TLRPC { } } - public static class TL_channels_getAdminLog extends TLObject { - public static int constructor = 0x33ddf480; + public static class TL_channels_getAdminLog extends TLObject { + public static int constructor = 0x33ddf480; - public int flags; - public InputChannel channel; - public String q; - public TL_channelAdminLogEventsFilter events_filter; - public ArrayList admins = new ArrayList<>(); - public long max_id; - public long min_id; - public int limit; + public int flags; + public InputChannel channel; + public String q; + public TL_channelAdminLogEventsFilter events_filter; + public ArrayList admins = new ArrayList<>(); + public long max_id; + public long min_id; + public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_channels_adminLogResults.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_channels_adminLogResults.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - channel.serializeToStream(stream); - stream.writeString(q); - if ((flags & 1) != 0) { - events_filter.serializeToStream(stream); - } - if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = admins.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - admins.get(a).serializeToStream(stream); - } - } - stream.writeInt64(max_id); - stream.writeInt64(min_id); - stream.writeInt32(limit); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + channel.serializeToStream(stream); + stream.writeString(q); + if ((flags & 1) != 0) { + events_filter.serializeToStream(stream); + } + if ((flags & 2) != 0) { + stream.writeInt32(0x1cb5c415); + int count = admins.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + admins.get(a).serializeToStream(stream); + } + } + stream.writeInt64(max_id); + stream.writeInt64(min_id); + stream.writeInt32(limit); + } + } - public static class TL_channels_setStickers extends TLObject { - public static int constructor = 0xea8ca4f9; + public static class TL_channels_setStickers extends TLObject { + public static int constructor = 0xea8ca4f9; - public InputChannel channel; - public InputStickerSet stickerset; + public InputChannel channel; + public InputStickerSet stickerset; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - channel.serializeToStream(stream); - stickerset.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + channel.serializeToStream(stream); + stickerset.serializeToStream(stream); + } + } - public static class TL_channels_readMessageContents extends TLObject { - public static int constructor = 0xeab5dc38; + public static class TL_channels_readMessageContents extends TLObject { + public static int constructor = 0xeab5dc38; - public InputChannel channel; - public ArrayList id = new ArrayList<>(); + public InputChannel channel; + public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - channel.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + channel.serializeToStream(stream); + stream.writeInt32(0x1cb5c415); + int count = id.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeInt32(id.get(a)); + } + } + } public static class TL_channels_deleteHistory extends TLObject { public static int constructor = 0xaf369d42; @@ -51415,37 +52107,37 @@ public class TLRPC { } } - public static class TL_payments_getSavedInfo extends TLObject { - public static int constructor = 0x227d824b; + public static class TL_payments_getSavedInfo extends TLObject { + public static int constructor = 0x227d824b; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_payments_savedInfo.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_payments_savedInfo.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } - public static class TL_payments_clearSavedInfo extends TLObject { - public static int constructor = 0xd83d70c1; + public static class TL_payments_clearSavedInfo extends TLObject { + public static int constructor = 0xd83d70c1; - public int flags; - public boolean credentials; - public boolean info; + public int flags; + public boolean credentials; + public boolean info; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = credentials ? (flags | 1) : (flags &~ 1); - flags = info ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = credentials ? (flags | 1) : (flags &~ 1); + flags = info ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + } + } public static class TL_payments_getBankCardData extends TLObject { public static int constructor = 0x2e79d779; @@ -51462,51 +52154,51 @@ public class TLRPC { } } - public static class TL_langpack_getLangPack extends TLObject { - public static int constructor = 0x9ab5c58e; + public static class TL_langpack_getLangPack extends TLObject { + public static int constructor = 0x9ab5c58e; - public String lang_code; + public String lang_code; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_langPackDifference.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_langPackDifference.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(lang_code); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(lang_code); + } + } - public static class TL_langpack_getStrings extends TLObject { - public static int constructor = 0x2e1ee318; + public static class TL_langpack_getStrings extends TLObject { + public static int constructor = 0x2e1ee318; - public String lang_code; - public ArrayList keys = new ArrayList<>(); + public String lang_code; + public ArrayList keys = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - LangPackString object = LangPackString.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + Vector vector = new Vector(); + int size = stream.readInt32(exception); + for (int a = 0; a < size; a++) { + LangPackString object = LangPackString.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return vector; + } + vector.objects.add(object); + } + return vector; + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(lang_code); - stream.writeInt32(0x1cb5c415); - int count = keys.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(keys.get(a)); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(lang_code); + stream.writeInt32(0x1cb5c415); + int count = keys.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeString(keys.get(a)); + } + } + } public static class TL_langpack_getDifference extends TLObject { public static int constructor = 0xcd984aa5; @@ -51527,27 +52219,27 @@ public class TLRPC { } } - public static class TL_langpack_getLanguages extends TLObject { - public static int constructor = 0x800fd57d; + public static class TL_langpack_getLanguages extends TLObject { + public static int constructor = 0x800fd57d; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - TL_langPackLanguage object = TL_langPackLanguage.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + Vector vector = new Vector(); + int size = stream.readInt32(exception); + for (int a = 0; a < size; a++) { + TL_langPackLanguage object = TL_langPackLanguage.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return vector; + } + vector.objects.add(object); + } + return vector; + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static class TL_langpack_getLanguage extends TLObject { public static int constructor = 0x6a596502; @@ -51725,75 +52417,75 @@ public class TLRPC { } } - //RichText start - public static abstract class RichText extends TLObject { - public String url; - public long webpage_id; - public String email; - public ArrayList texts = new ArrayList<>(); - public RichText parentRichText; + //RichText start + public static abstract class RichText extends TLObject { + public String url; + public long webpage_id; + public String email; + public ArrayList texts = new ArrayList<>(); + public RichText parentRichText; - public static RichText TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - RichText result = null; - switch (constructor) { - case 0x1ccb966a: - result = new TL_textPhone(); - break; - case 0xc7fb5e01: - result = new TL_textSuperscript(); - break; - case 0x81ccf4f: - result = new TL_textImage(); - break; - case 0xc12622c4: - result = new TL_textUnderline(); - break; - case 0xed6a8504: - result = new TL_textSubscript(); - break; - case 0x3c2884c1: - result = new TL_textUrl(); - break; + public static RichText TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + RichText result = null; + switch (constructor) { + case 0x1ccb966a: + result = new TL_textPhone(); + break; + case 0xc7fb5e01: + result = new TL_textSuperscript(); + break; + case 0x81ccf4f: + result = new TL_textImage(); + break; + case 0xc12622c4: + result = new TL_textUnderline(); + break; + case 0xed6a8504: + result = new TL_textSubscript(); + break; + case 0x3c2884c1: + result = new TL_textUrl(); + break; case 0x35553762: result = new TL_textAnchor(); break; - case 0xdc3d824f: - result = new TL_textEmpty(); - break; - case 0xde5a0dd6: - result = new TL_textEmail(); - break; - case 0x744694e0: - result = new TL_textPlain(); - break; - case 0x6724abc4: - result = new TL_textBold(); - break; - case 0x9bf8bb95: - result = new TL_textStrike(); - break; - case 0x7e6260d7: - result = new TL_textConcat(); - break; - case 0xd912a59c: - result = new TL_textItalic(); - break; - case 0x34b8621: - result = new TL_textMarked(); - break; - case 0x6c3f19b9: - result = new TL_textFixed(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in RichText", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + case 0xdc3d824f: + result = new TL_textEmpty(); + break; + case 0xde5a0dd6: + result = new TL_textEmail(); + break; + case 0x744694e0: + result = new TL_textPlain(); + break; + case 0x6724abc4: + result = new TL_textBold(); + break; + case 0x9bf8bb95: + result = new TL_textStrike(); + break; + case 0x7e6260d7: + result = new TL_textConcat(); + break; + case 0xd912a59c: + result = new TL_textItalic(); + break; + case 0x34b8621: + result = new TL_textMarked(); + break; + case 0x6c3f19b9: + result = new TL_textFixed(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in RichText", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } public static class TL_pageBlockList_layer82 extends TL_pageBlockList { public static int constructor = 0x3a58c7f4; @@ -51832,7 +52524,7 @@ public class TLRPC { } } } - //RichText end + //RichText end public static class TL_channels_sendAsPeers extends TLObject { public static int constructor = 0x8356cda9; @@ -51925,223 +52617,223 @@ public class TLRPC { } } - //MessageMedia start - public static abstract class MessageMedia extends TLObject { - public byte[] bytes; - public Audio audio_unused; - public int flags; - public boolean shipping_address_requested; - public Photo photo; - public GeoPoint geo; + //MessageMedia start + public static abstract class MessageMedia extends TLObject { + public byte[] bytes; + public Audio audio_unused; + public int flags; + public boolean shipping_address_requested; + public Photo photo; + public GeoPoint geo; public int heading; - public String currency; - public String description; - public int receipt_msg_id; - public long total_amount; - public String start_param; - public String title; - public String address; - public String provider; - public String venue_id; - public Video video_unused; - public Document document; - public String captionLegacy; - public TL_game game; - public String phone_number; - public String first_name; - public String last_name; - public String vcard; + public String currency; + public String description; + public int receipt_msg_id; + public long total_amount; + public String start_param; + public String title; + public String address; + public String provider; + public String venue_id; + public Video video_unused; + public Document document; + public String captionLegacy; + public TL_game game; + public String phone_number; + public String first_name; + public String last_name; + public String vcard; public long user_id; - public WebPage webpage; - public String venue_type; - public boolean test; - public int period; + public WebPage webpage; + public String venue_type; + public boolean test; + public int period; public int ttl_seconds; public int proximity_notification_radius; - public static MessageMedia TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - MessageMedia result = null; - switch (constructor) { - case 0x29632a36: - result = new TL_messageMediaUnsupported_old(); - break; - case 0xc6b68300: - result = new TL_messageMediaAudio_layer45(); - break; - case 0xc8c45a2a: - result = new TL_messageMediaPhoto_old(); - break; - case 0x84551347: - result = new TL_messageMediaInvoice(); - break; - case 0x9f84f49e: - result = new TL_messageMediaUnsupported(); - break; - case 0x3ded6320: - result = new TL_messageMediaEmpty(); - break; - case 0x7912b71f: - result = new TL_messageMediaVenue_layer71(); - break; + public static MessageMedia TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + MessageMedia result = null; + switch (constructor) { + case 0x29632a36: + result = new TL_messageMediaUnsupported_old(); + break; + case 0xc6b68300: + result = new TL_messageMediaAudio_layer45(); + break; + case 0xc8c45a2a: + result = new TL_messageMediaPhoto_old(); + break; + case 0x84551347: + result = new TL_messageMediaInvoice(); + break; + case 0x9f84f49e: + result = new TL_messageMediaUnsupported(); + break; + case 0x3ded6320: + result = new TL_messageMediaEmpty(); + break; + case 0x7912b71f: + result = new TL_messageMediaVenue_layer71(); + break; case 0xb940c666: result = new TL_messageMediaGeoLive(); break; - case 0x7c3c2609: - result = new TL_messageMediaGeoLive_layer119(); - break; - case 0x2ec0533f: - result = new TL_messageMediaVenue(); - break; - case 0xa2d24290: - result = new TL_messageMediaVideo_old(); - break; - case 0x2fda2204: - result = new TL_messageMediaDocument_old(); - break; - case 0xf3e02ea8: - result = new TL_messageMediaDocument_layer68(); - break; - case 0xfdb19008: - result = new TL_messageMediaGame(); - break; + case 0x7c3c2609: + result = new TL_messageMediaGeoLive_layer119(); + break; + case 0x2ec0533f: + result = new TL_messageMediaVenue(); + break; + case 0xa2d24290: + result = new TL_messageMediaVideo_old(); + break; + case 0x2fda2204: + result = new TL_messageMediaDocument_old(); + break; + case 0xf3e02ea8: + result = new TL_messageMediaDocument_layer68(); + break; + case 0xfdb19008: + result = new TL_messageMediaGame(); + break; case 0x7c4414d3: result = new TL_messageMediaDocument_layer74(); break; - case 0x5e7d2f39: - result = new TL_messageMediaContact_layer81(); - break; - case 0x695150d7: - result = new TL_messageMediaPhoto(); - break; + case 0x5e7d2f39: + result = new TL_messageMediaContact_layer81(); + break; + case 0x695150d7: + result = new TL_messageMediaPhoto(); + break; case 0x4bd6e798: result = new TL_messageMediaPoll(); break; case 0xb5223b0f: result = new TL_messageMediaPhoto_layer74(); break; - case 0x3d8ce53d: - result = new TL_messageMediaPhoto_layer68(); - break; - case 0x5bcf1675: - result = new TL_messageMediaVideo_layer45(); - break; + case 0x3d8ce53d: + result = new TL_messageMediaPhoto_layer68(); + break; + case 0x5bcf1675: + result = new TL_messageMediaVideo_layer45(); + break; case 0x3f7ee58b: result = new TL_messageMediaDice(); break; case 0x638fe46b: result = new TL_messageMediaDice_layer111(); break; - case 0x56e0d474: - result = new TL_messageMediaGeo(); - break; - case 0xa32dd600: - result = new TL_messageMediaWebPage(); - break; - case 0x9cb070d7: - result = new TL_messageMediaDocument(); - break; - case 0xcbf24940: - result = new TL_messageMediaContact_layer131(); - break; + case 0x56e0d474: + result = new TL_messageMediaGeo(); + break; + case 0xa32dd600: + result = new TL_messageMediaWebPage(); + break; + case 0x9cb070d7: + result = new TL_messageMediaDocument(); + break; + case 0xcbf24940: + result = new TL_messageMediaContact_layer131(); + break; case 0x70322949: result = new TL_messageMediaContact(); break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in MessageMedia", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - if (result.video_unused != null) { - TL_messageMediaDocument mediaDocument = new TL_messageMediaDocument(); - if (result.video_unused instanceof TL_videoEncrypted) { - mediaDocument.document = new TL_documentEncrypted(); - mediaDocument.document.key = result.video_unused.key; - mediaDocument.document.iv = result.video_unused.iv; - } else { - mediaDocument.document = new TL_document(); - } + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in MessageMedia", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + if (result.video_unused != null) { + TL_messageMediaDocument mediaDocument = new TL_messageMediaDocument(); + if (result.video_unused instanceof TL_videoEncrypted) { + mediaDocument.document = new TL_documentEncrypted(); + mediaDocument.document.key = result.video_unused.key; + mediaDocument.document.iv = result.video_unused.iv; + } else { + mediaDocument.document = new TL_document(); + } mediaDocument.flags = 3; - mediaDocument.document.file_reference = new byte[0]; - mediaDocument.document.id = result.video_unused.id; - mediaDocument.document.access_hash = result.video_unused.access_hash; - mediaDocument.document.date = result.video_unused.date; - if (result.video_unused.mime_type != null) { - mediaDocument.document.mime_type = result.video_unused.mime_type; - } else { - mediaDocument.document.mime_type = "video/mp4"; - } - mediaDocument.document.size = result.video_unused.size; - mediaDocument.document.thumbs.add(result.video_unused.thumb); - mediaDocument.document.dc_id = result.video_unused.dc_id; - mediaDocument.captionLegacy = result.captionLegacy; - TL_documentAttributeVideo attributeVideo = new TL_documentAttributeVideo(); - attributeVideo.w = result.video_unused.w; - attributeVideo.h = result.video_unused.h; - attributeVideo.duration = result.video_unused.duration; - mediaDocument.document.attributes.add(attributeVideo); - result = mediaDocument; - if (mediaDocument.captionLegacy == null) { - mediaDocument.captionLegacy = ""; - } - } else if (result.audio_unused != null) { - TL_messageMediaDocument mediaDocument = new TL_messageMediaDocument(); - if (result.audio_unused instanceof TL_audioEncrypted) { - mediaDocument.document = new TL_documentEncrypted(); - mediaDocument.document.key = result.audio_unused.key; - mediaDocument.document.iv = result.audio_unused.iv; - } else { - mediaDocument.document = new TL_document(); - } + mediaDocument.document.file_reference = new byte[0]; + mediaDocument.document.id = result.video_unused.id; + mediaDocument.document.access_hash = result.video_unused.access_hash; + mediaDocument.document.date = result.video_unused.date; + if (result.video_unused.mime_type != null) { + mediaDocument.document.mime_type = result.video_unused.mime_type; + } else { + mediaDocument.document.mime_type = "video/mp4"; + } + mediaDocument.document.size = result.video_unused.size; + mediaDocument.document.thumbs.add(result.video_unused.thumb); + mediaDocument.document.dc_id = result.video_unused.dc_id; + mediaDocument.captionLegacy = result.captionLegacy; + TL_documentAttributeVideo attributeVideo = new TL_documentAttributeVideo(); + attributeVideo.w = result.video_unused.w; + attributeVideo.h = result.video_unused.h; + attributeVideo.duration = result.video_unused.duration; + mediaDocument.document.attributes.add(attributeVideo); + result = mediaDocument; + if (mediaDocument.captionLegacy == null) { + mediaDocument.captionLegacy = ""; + } + } else if (result.audio_unused != null) { + TL_messageMediaDocument mediaDocument = new TL_messageMediaDocument(); + if (result.audio_unused instanceof TL_audioEncrypted) { + mediaDocument.document = new TL_documentEncrypted(); + mediaDocument.document.key = result.audio_unused.key; + mediaDocument.document.iv = result.audio_unused.iv; + } else { + mediaDocument.document = new TL_document(); + } mediaDocument.flags = 3; - mediaDocument.document.file_reference = new byte[0]; - mediaDocument.document.id = result.audio_unused.id; - mediaDocument.document.access_hash = result.audio_unused.access_hash; - mediaDocument.document.date = result.audio_unused.date; - if (result.audio_unused.mime_type != null) { - mediaDocument.document.mime_type = result.audio_unused.mime_type; - } else { - mediaDocument.document.mime_type = "audio/ogg"; - } - mediaDocument.document.size = result.audio_unused.size; - TL_photoSizeEmpty thumb = new TL_photoSizeEmpty(); + mediaDocument.document.file_reference = new byte[0]; + mediaDocument.document.id = result.audio_unused.id; + mediaDocument.document.access_hash = result.audio_unused.access_hash; + mediaDocument.document.date = result.audio_unused.date; + if (result.audio_unused.mime_type != null) { + mediaDocument.document.mime_type = result.audio_unused.mime_type; + } else { + mediaDocument.document.mime_type = "audio/ogg"; + } + mediaDocument.document.size = result.audio_unused.size; + TL_photoSizeEmpty thumb = new TL_photoSizeEmpty(); thumb.type = "s"; - mediaDocument.document.thumbs.add(thumb); - mediaDocument.document.dc_id = result.audio_unused.dc_id; - mediaDocument.captionLegacy = result.captionLegacy; - TL_documentAttributeAudio attributeAudio = new TL_documentAttributeAudio(); - attributeAudio.duration = result.audio_unused.duration; - attributeAudio.voice = true; - mediaDocument.document.attributes.add(attributeAudio); - result = mediaDocument; - if (mediaDocument.captionLegacy == null) { - mediaDocument.captionLegacy = ""; - } - } - } - return result; - } - } - //MessageMedia end + mediaDocument.document.thumbs.add(thumb); + mediaDocument.document.dc_id = result.audio_unused.dc_id; + mediaDocument.captionLegacy = result.captionLegacy; + TL_documentAttributeAudio attributeAudio = new TL_documentAttributeAudio(); + attributeAudio.duration = result.audio_unused.duration; + attributeAudio.voice = true; + mediaDocument.document.attributes.add(attributeAudio); + result = mediaDocument; + if (mediaDocument.captionLegacy == null) { + mediaDocument.captionLegacy = ""; + } + } + } + return result; + } + } + //MessageMedia end - //PageBlock start - public static class TL_pageBlockAuthorDate_layer60 extends TL_pageBlockAuthorDate { - public static int constructor = 0x3d5b64f2; + //PageBlock start + public static class TL_pageBlockAuthorDate_layer60 extends TL_pageBlockAuthorDate { + public static int constructor = 0x3d5b64f2; - public void readParams(AbstractSerializedData stream, boolean exception) { - String authorString = stream.readString(exception); - author = new TL_textPlain(); - ((TL_textPlain) author).text = authorString; - published_date = stream.readInt32(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + String authorString = stream.readString(exception); + author = new TL_textPlain(); + ((TL_textPlain) author).text = authorString; + published_date = stream.readInt32(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(((TL_textPlain) author).text); - stream.writeInt32(published_date); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(((TL_textPlain) author).text); + stream.writeInt32(published_date); + } + } public static class TL_pageBlockEmbedPost_layer82 extends TL_pageBlockEmbedPost { public static int constructor = 0x292c7be9; @@ -52367,7 +53059,7 @@ public class TLRPC { caption.text.serializeToStream(stream); } } - //PageBlock end + //PageBlock end //EncryptedChat start public static abstract class EncryptedChat extends TLObject { @@ -52390,8 +53082,8 @@ public class TLRPC { public int layer; //custom public int seq_in; //custom public int seq_out; //custom - public int in_seq_no; //custom - public int mtproto_seq; //custom + public int in_seq_no; //custom + public int mtproto_seq; //custom public byte[] key_hash; //custom public short key_use_count_in; //custom public short key_use_count_out; //custom @@ -52462,28 +53154,28 @@ public class TLRPC { public String message; public MessageMedia media; public int flags; - public boolean mentioned; - public boolean media_unread; - public boolean out; - public boolean unread; + public boolean mentioned; + public boolean media_unread; + public boolean out; + public boolean unread; public ArrayList entities = new ArrayList<>(); - public String via_bot_name; + public String via_bot_name; public ReplyMarkup reply_markup; - public int views; + public int views; public int forwards; public MessageReplies replies; - public int edit_date; - public boolean silent; - public boolean post; + public int edit_date; + public boolean silent; + public boolean post; public boolean from_scheduled; public boolean legacy; public boolean edit_hide; public boolean pinned; - public MessageFwdHeader fwd_from; - public long via_bot_id; + public MessageFwdHeader fwd_from; + public long via_bot_id; public TL_messageReplyHeader reply_to; public String post_author; - public long grouped_id; + public long grouped_id; public TL_messageReactions reactions; public ArrayList restriction_reason = new ArrayList<>(); public int ttl_period; @@ -52491,7 +53183,7 @@ public class TLRPC { public int send_state = 0; //custom public int fwd_msg_id = 0; //custom public String attachPath = ""; //custom - public HashMap params; //custom + public HashMap params; //custom public long random_id; //custom public int local_id = 0; //custom public long dialog_id; //custom @@ -52500,9 +53192,9 @@ public class TLRPC { public int layer; //custom public int seq_in; //custom public int seq_out; //custom - public boolean with_my_score; + public boolean with_my_score; public Message replyMessage; //custom - public int reqId; //custom + public int reqId; //custom public int realId; //custom public int stickerVerified = 1; //custom public boolean isThreadMessage; //custom @@ -52522,36 +53214,36 @@ public class TLRPC { case 0xc3060325: result = new TL_message_old4(); break; - case 0x555555fa: - result = new TL_message_secret(); - break; - case 0x555555f9: - result = new TL_message_secret_layer72(); - break; + case 0x555555fa: + result = new TL_message_secret(); + break; + case 0x555555f9: + result = new TL_message_secret_layer72(); + break; case 0x90dddc11: result = new TL_message_layer72(); break; - case 0xc09be45f: - result = new TL_message_layer68(); - break; - case 0xc992e15c: - result = new TL_message_layer47(); - break; - case 0x5ba66c13: - result = new TL_message_old7(); - break; + case 0xc09be45f: + result = new TL_message_layer68(); + break; + case 0xc992e15c: + result = new TL_message_layer47(); + break; + case 0x5ba66c13: + result = new TL_message_old7(); + break; case 0xc06b9607: - result = new TL_messageService_layer48(); - break; + result = new TL_messageService_layer48(); + break; case 0x83e5de54: result = new TL_messageEmpty_layer122(); break; case 0x2bebfa86: result = new TL_message_old6(); break; - case 0x44f9b43d: - result = new TL_message_layer104(); - break; + case 0x44f9b43d: + result = new TL_message_layer104(); + break; case 0x90a6ca84: result = new TL_messageEmpty(); break; @@ -52592,23 +53284,26 @@ public class TLRPC { result = new TL_message_layer131(); break; case 0x85d6cbe2: + result = new TL_message_layer135(); + break; + case 0x38116ee0: result = new TL_message(); break; - case 0x9e19a1f6: - result = new TL_messageService_layer118(); - break; + case 0x9e19a1f6: + result = new TL_messageService_layer118(); + break; case 0x286fa604: result = new TL_messageService_layer123(); break; case 0x2b085862: result = new TL_messageService(); break; - case 0xf07814c8: - result = new TL_message_old5(); - break; + case 0xf07814c8: + result = new TL_message_old5(); + break; } if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in Message", constructor)); + throw new RuntimeException(String.format("can't parse magic %x in Message", constructor)); } if (result != null) { result.readParams(stream, exception); @@ -52620,28 +53315,28 @@ public class TLRPC { } public void readAttachPath(AbstractSerializedData stream, long currentUserId) { - boolean hasMedia = media != null && !(media instanceof TL_messageMediaEmpty) && !(media instanceof TL_messageMediaWebPage); - boolean fixCaption = !TextUtils.isEmpty(message) && - (media instanceof TL_messageMediaPhoto_old || - media instanceof TL_messageMediaPhoto_layer68 || - media instanceof TL_messageMediaPhoto_layer74 || - media instanceof TL_messageMediaDocument_old || - media instanceof TL_messageMediaDocument_layer68 || - media instanceof TL_messageMediaDocument_layer74) - && message.startsWith("-1"); - if ((out || peer_id != null && from_id != null && peer_id.user_id != 0 && peer_id.user_id == from_id.user_id && from_id.user_id == currentUserId) && (id < 0 || hasMedia || send_state == 3) || legacy) { - if (hasMedia && fixCaption) { - if (message.length() > 6 && message.charAt(2) == '_') { - params = new HashMap<>(); - params.put("ve", message); - } - if (params != null || message.length() == 2) { - message = ""; - } - } - if (stream.remaining() > 0) { - attachPath = stream.readString(false); - if (attachPath != null) { + boolean hasMedia = media != null && !(media instanceof TL_messageMediaEmpty) && !(media instanceof TL_messageMediaWebPage); + boolean fixCaption = !TextUtils.isEmpty(message) && + (media instanceof TL_messageMediaPhoto_old || + media instanceof TL_messageMediaPhoto_layer68 || + media instanceof TL_messageMediaPhoto_layer74 || + media instanceof TL_messageMediaDocument_old || + media instanceof TL_messageMediaDocument_layer68 || + media instanceof TL_messageMediaDocument_layer74) + && message.startsWith("-1"); + if ((out || peer_id != null && from_id != null && peer_id.user_id != 0 && peer_id.user_id == from_id.user_id && from_id.user_id == currentUserId) && (id < 0 || hasMedia || send_state == 3) || legacy) { + if (hasMedia && fixCaption) { + if (message.length() > 6 && message.charAt(2) == '_') { + params = new HashMap<>(); + params.put("ve", message); + } + if (params != null || message.length() == 2) { + message = ""; + } + } + if (stream.remaining() > 0) { + attachPath = stream.readString(false); + if (attachPath != null) { if ((id < 0 || send_state == 3 || legacy) && attachPath.startsWith("||")) { String args[] = attachPath.split("\\|\\|"); if (args.length > 0) { @@ -52663,15 +53358,15 @@ public class TLRPC { attachPath = attachPath.trim(); } } - } - } - if ((flags & MESSAGE_FLAG_FWD) != 0 && id < 0) { - fwd_msg_id = stream.readInt32(false); - } - } + } + } + if ((flags & MESSAGE_FLAG_FWD) != 0 && id < 0) { + fwd_msg_id = stream.readInt32(false); + } + } - protected void writeAttachPath(AbstractSerializedData stream) { - if (this instanceof TL_message_secret || this instanceof TL_message_secret_layer72) { + protected void writeAttachPath(AbstractSerializedData stream) { + if (this instanceof TL_message_secret || this instanceof TL_message_secret_layer72) { String path = attachPath != null ? attachPath : ""; if (send_state == 1 && params != null && params.size() > 0) { for (HashMap.Entry entry : params.entrySet()) { @@ -52680,43 +53375,43 @@ public class TLRPC { path = "||" + path; } stream.writeString(path); - } else { - String path = !TextUtils.isEmpty(attachPath) ? attachPath : " "; - if (legacy) { - if (params == null) { + } else { + String path = !TextUtils.isEmpty(attachPath) ? attachPath : " "; + if (legacy) { + if (params == null) { params = new HashMap<>(); } - layer = LAYER; + layer = LAYER; params.put("legacy_layer", "" + LAYER); } - if ((id < 0 || send_state == 3 || legacy) && params != null && params.size() > 0) { - for (HashMap.Entry entry : params.entrySet()) { - path = entry.getKey() + "|=|" + entry.getValue() + "||" + path; - } - path = "||" + path; - } - stream.writeString(path); - if ((flags & MESSAGE_FLAG_FWD) != 0 && id < 0) { - stream.writeInt32(fwd_msg_id); - } - } - } + if ((id < 0 || send_state == 3 || legacy) && params != null && params.size() > 0) { + for (HashMap.Entry entry : params.entrySet()) { + path = entry.getKey() + "|=|" + entry.getValue() + "||" + path; + } + path = "||" + path; + } + stream.writeString(path); + if ((flags & MESSAGE_FLAG_FWD) != 0 && id < 0) { + stream.writeInt32(fwd_msg_id); + } + } + } } - public static class TL_messageEmpty_layer122 extends TL_messageEmpty { - public static int constructor = 0x83e5de54; + public static class TL_messageEmpty_layer122 extends TL_messageEmpty { + public static int constructor = 0x83e5de54; - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - peer_id = new TL_peerUser(); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + peer_id = new TL_peerUser(); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(id); + } + } public static class TL_messageEmpty extends Message { public static int constructor = 0x90a6ca84; @@ -52741,39 +53436,39 @@ public class TLRPC { } } - public static class TL_messageService_old2 extends TL_messageService { - public static int constructor = 0x1d86f70e; + public static class TL_messageService_old2 extends TL_messageService { + public static int constructor = 0x1d86f70e; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - id = stream.readInt32(exception); + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + unread = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + id = stream.readInt32(exception); from_id = new TLRPC.TL_peerUser(); from_id.user_id = stream.readInt32(exception); peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - date = stream.readInt32(exception); - action = MessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); - flags |= MESSAGE_FLAG_HAS_FROM_ID; - } + date = stream.readInt32(exception); + action = MessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); + flags |= MESSAGE_FLAG_HAS_FROM_ID; + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt32(id); - stream.writeInt32((int) from_id.user_id); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = unread ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + stream.writeInt32(flags); + stream.writeInt32(id); + stream.writeInt32((int) from_id.user_id); peer_id.serializeToStream(stream); - stream.writeInt32(date); - action.serializeToStream(stream); - } - } + stream.writeInt32(date); + action.serializeToStream(stream); + } + } public static class TL_message_layer72 extends TL_message { public static int constructor = 0x90dddc11; @@ -52805,12 +53500,12 @@ public class TLRPC { message = stream.readString(exception); if ((flags & 512) != 0) { media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null) { - ttl = media.ttl_seconds; - } - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } + if (media != null) { + ttl = media.ttl_seconds; + } + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } } if ((flags & 64) != 0) { reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -52894,350 +53589,350 @@ public class TLRPC { } } - public static class TL_message_layer68 extends TL_message { - public static int constructor = 0xc09be45f; + public static class TL_message_layer68 extends TL_message { + public static int constructor = 0xc09be45f; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - silent = (flags & 8192) != 0; - post = (flags & 16384) != 0; - with_my_score = (flags & 1073741824) != 0; - id = stream.readInt32(exception); - if ((flags & 256) != 0) { + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + unread = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + silent = (flags & 8192) != 0; + post = (flags & 16384) != 0; + with_my_score = (flags & 1073741824) != 0; + id = stream.readInt32(exception); + if ((flags & 256) != 0) { from_id = new TLRPC.TL_peerUser(); from_id.user_id = stream.readInt32(exception); - } - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (from_id == null) { - from_id = peer_id; - } - if ((flags & 4) != 0) { - fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 2048) != 0) { - via_bot_id = stream.readInt32(exception); - } - if ((flags & 8) != 0) { - reply_to = new TLRPC.TL_messageReplyHeader(); - reply_to.reply_to_msg_id = stream.readInt32(exception); - } - date = stream.readInt32(exception); - message = stream.readString(exception); - if ((flags & 512) != 0) { - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } - } else { - media = new TL_messageMediaEmpty(); - } - if ((flags & 64) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - if ((flags & 1024) != 0) { - views = stream.readInt32(exception); - } - if ((flags & 32768) != 0) { - edit_date = stream.readInt32(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - flags = silent ? (flags | 8192) : (flags &~ 8192); - flags = post ? (flags | 16384) : (flags &~ 16384); - flags = with_my_score ? (flags | 1073741824) : (flags &~ 1073741824); - stream.writeInt32(flags); - stream.writeInt32(id); - if ((flags & 256) != 0) { - stream.writeInt32((int) from_id.user_id); - } - peer_id.serializeToStream(stream); - if ((flags & 4) != 0) { - fwd_from.serializeToStream(stream); - } - if ((flags & 2048) != 0) { - stream.writeInt32((int) via_bot_id); - } - if ((flags & 8) != 0) { - stream.writeInt32(reply_to.reply_to_msg_id); - } - stream.writeInt32(date); - stream.writeString(message); - if ((flags & 512) != 0) { - media.serializeToStream(stream); - } - if ((flags & 64) != 0) { - reply_markup.serializeToStream(stream); - } - if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 1024) != 0) { - stream.writeInt32(views); - } - if ((flags & 32768) != 0) { - stream.writeInt32(edit_date); - } - writeAttachPath(stream); - } - } - - public static class TL_message_layer47 extends TL_message { - public static int constructor = 0xc992e15c; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - id = stream.readInt32(exception); - if ((flags & 256) != 0) { - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); - } - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (from_id == null) { - from_id = peer_id; - } - if ((flags & 4) != 0) { - fwd_from = new TL_messageFwdHeader(); - Peer peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (peer != null) { - fwd_from.from_id = peer; - fwd_from.flags |= 1; - } - fwd_from.date = stream.readInt32(exception); - } - if ((flags & 2048) != 0) { - via_bot_id = stream.readInt32(exception); - } - if ((flags & 8) != 0) { - reply_to = new TLRPC.TL_messageReplyHeader(); - reply_to.reply_to_msg_id = stream.readInt32(exception); - } - date = stream.readInt32(exception); - message = stream.readString(exception); - if ((flags & 512) != 0) { - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } - } else { - media = new TL_messageMediaEmpty(); - } - if ((flags & 64) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - if ((flags & 1024) != 0) { - views = stream.readInt32(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt32(id); - if ((flags & 256) != 0) { - stream.writeInt32((int) from_id.user_id); - } - peer_id.serializeToStream(stream); - if ((flags & 4) != 0) { - if (fwd_from.from_id != null) { - fwd_from.from_id.serializeToStream(stream); - } - stream.writeInt32(fwd_from.date); - } - if ((flags & 2048) != 0) { - stream.writeInt32((int) via_bot_id); - } - if ((flags & 8) != 0) { - stream.writeInt32(reply_to.reply_to_msg_id); - } - stream.writeInt32(date); - stream.writeString(message); - if ((flags & 512) != 0) { - media.serializeToStream(stream); - } - if ((flags & 64) != 0) { - reply_markup.serializeToStream(stream); - } - if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 1024) != 0) { - stream.writeInt32(views); - } - writeAttachPath(stream); - } - } - - public static class TL_message_old7 extends TL_message { - public static int constructor = 0x5ba66c13; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - id = stream.readInt32(exception); - if ((flags & 256) != 0) { - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); - } + } peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); if (from_id == null) { from_id = peer_id; } - if ((flags & 4) != 0) { - fwd_from = new TL_messageFwdHeader(); - Peer peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (peer != null) { - fwd_from.from_id = peer; - fwd_from.flags |= 1; - } - fwd_from.date = stream.readInt32(exception); - } - if ((flags & 8) != 0) { + if ((flags & 4) != 0) { + fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 2048) != 0) { + via_bot_id = stream.readInt32(exception); + } + if ((flags & 8) != 0) { reply_to = new TLRPC.TL_messageReplyHeader(); reply_to.reply_to_msg_id = stream.readInt32(exception); - } - date = stream.readInt32(exception); - message = stream.readString(exception); - if ((flags & 512) != 0) { - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } - } else { - media = new TL_messageMediaEmpty(); - } + } + date = stream.readInt32(exception); + message = stream.readString(exception); + if ((flags & 512) != 0) { + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } + } else { + media = new TL_messageMediaEmpty(); + } if ((flags & 64) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - if ((flags & 1024) != 0) { - views = stream.readInt32(exception); - } - } + reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 128) != 0) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + entities.add(object); + } + } + if ((flags & 1024) != 0) { + views = stream.readInt32(exception); + } + if ((flags & 32768) != 0) { + edit_date = stream.readInt32(exception); + } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt32(id); - if ((flags & 256) != 0) { - stream.writeInt32((int) from_id.user_id); - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = unread ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = silent ? (flags | 8192) : (flags &~ 8192); + flags = post ? (flags | 16384) : (flags &~ 16384); + flags = with_my_score ? (flags | 1073741824) : (flags &~ 1073741824); + stream.writeInt32(flags); + stream.writeInt32(id); + if ((flags & 256) != 0) { + stream.writeInt32((int) from_id.user_id); + } peer_id.serializeToStream(stream); if ((flags & 4) != 0) { - if (fwd_from.from_id != null) { + fwd_from.serializeToStream(stream); + } + if ((flags & 2048) != 0) { + stream.writeInt32((int) via_bot_id); + } + if ((flags & 8) != 0) { + stream.writeInt32(reply_to.reply_to_msg_id); + } + stream.writeInt32(date); + stream.writeString(message); + if ((flags & 512) != 0) { + media.serializeToStream(stream); + } + if ((flags & 64) != 0) { + reply_markup.serializeToStream(stream); + } + if ((flags & 128) != 0) { + stream.writeInt32(0x1cb5c415); + int count = entities.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + entities.get(a).serializeToStream(stream); + } + } + if ((flags & 1024) != 0) { + stream.writeInt32(views); + } + if ((flags & 32768) != 0) { + stream.writeInt32(edit_date); + } + writeAttachPath(stream); + } + } + + public static class TL_message_layer47 extends TL_message { + public static int constructor = 0xc992e15c; + + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + unread = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + id = stream.readInt32(exception); + if ((flags & 256) != 0) { + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); + } + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if (from_id == null) { + from_id = peer_id; + } + if ((flags & 4) != 0) { + fwd_from = new TL_messageFwdHeader(); + Peer peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if (peer != null) { + fwd_from.from_id = peer; + fwd_from.flags |= 1; + } + fwd_from.date = stream.readInt32(exception); + } + if ((flags & 2048) != 0) { + via_bot_id = stream.readInt32(exception); + } + if ((flags & 8) != 0) { + reply_to = new TLRPC.TL_messageReplyHeader(); + reply_to.reply_to_msg_id = stream.readInt32(exception); + } + date = stream.readInt32(exception); + message = stream.readString(exception); + if ((flags & 512) != 0) { + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } + } else { + media = new TL_messageMediaEmpty(); + } + if ((flags & 64) != 0) { + reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 128) != 0) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + entities.add(object); + } + } + if ((flags & 1024) != 0) { + views = stream.readInt32(exception); + } + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = unread ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + stream.writeInt32(flags); + stream.writeInt32(id); + if ((flags & 256) != 0) { + stream.writeInt32((int) from_id.user_id); + } + peer_id.serializeToStream(stream); + if ((flags & 4) != 0) { + if (fwd_from.from_id != null) { fwd_from.from_id.serializeToStream(stream); - } - stream.writeInt32(fwd_from.date); - } - if ((flags & 8) != 0) { - stream.writeInt32(reply_to.reply_to_msg_id); - } - stream.writeInt32(date); - stream.writeString(message); - if ((flags & 512) != 0) { - media.serializeToStream(stream); - } - if ((flags & 64) != 0) { - reply_markup.serializeToStream(stream); - } - if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 1024) != 0) { - stream.writeInt32(views); - } - writeAttachPath(stream); - } - } + } + stream.writeInt32(fwd_from.date); + } + if ((flags & 2048) != 0) { + stream.writeInt32((int) via_bot_id); + } + if ((flags & 8) != 0) { + stream.writeInt32(reply_to.reply_to_msg_id); + } + stream.writeInt32(date); + stream.writeString(message); + if ((flags & 512) != 0) { + media.serializeToStream(stream); + } + if ((flags & 64) != 0) { + reply_markup.serializeToStream(stream); + } + if ((flags & 128) != 0) { + stream.writeInt32(0x1cb5c415); + int count = entities.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + entities.get(a).serializeToStream(stream); + } + } + if ((flags & 1024) != 0) { + stream.writeInt32(views); + } + writeAttachPath(stream); + } + } + + public static class TL_message_old7 extends TL_message { + public static int constructor = 0x5ba66c13; + + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + unread = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + id = stream.readInt32(exception); + if ((flags & 256) != 0) { + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); + } + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if (from_id == null) { + from_id = peer_id; + } + if ((flags & 4) != 0) { + fwd_from = new TL_messageFwdHeader(); + Peer peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if (peer != null) { + fwd_from.from_id = peer; + fwd_from.flags |= 1; + } + fwd_from.date = stream.readInt32(exception); + } + if ((flags & 8) != 0) { + reply_to = new TLRPC.TL_messageReplyHeader(); + reply_to.reply_to_msg_id = stream.readInt32(exception); + } + date = stream.readInt32(exception); + message = stream.readString(exception); + if ((flags & 512) != 0) { + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } + } else { + media = new TL_messageMediaEmpty(); + } + if ((flags & 64) != 0) { + reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 128) != 0) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + entities.add(object); + } + } + if ((flags & 1024) != 0) { + views = stream.readInt32(exception); + } + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = unread ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + stream.writeInt32(flags); + stream.writeInt32(id); + if ((flags & 256) != 0) { + stream.writeInt32((int) from_id.user_id); + } + peer_id.serializeToStream(stream); + if ((flags & 4) != 0) { + if (fwd_from.from_id != null) { + fwd_from.from_id.serializeToStream(stream); + } + stream.writeInt32(fwd_from.date); + } + if ((flags & 8) != 0) { + stream.writeInt32(reply_to.reply_to_msg_id); + } + stream.writeInt32(date); + stream.writeString(message); + if ((flags & 512) != 0) { + media.serializeToStream(stream); + } + if ((flags & 64) != 0) { + reply_markup.serializeToStream(stream); + } + if ((flags & 128) != 0) { + stream.writeInt32(0x1cb5c415); + int count = entities.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + entities.get(a).serializeToStream(stream); + } + } + if ((flags & 1024) != 0) { + stream.writeInt32(views); + } + writeAttachPath(stream); + } + } public static class TL_messageForwarded_old2 extends Message { public static int constructor = 0xa367e716; @@ -53245,34 +53940,34 @@ public class TLRPC { public void readParams(AbstractSerializedData stream, boolean exception) { flags = stream.readInt32(exception); - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; + unread = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; id = stream.readInt32(exception); - fwd_from = new TL_messageFwdHeader(); - fwd_from.from_id = new TLRPC.TL_peerUser(); - fwd_from.from_id.user_id = stream.readInt32(exception); - fwd_from.flags |= 1; - fwd_from.date = stream.readInt32(exception); + fwd_from = new TL_messageFwdHeader(); + fwd_from.from_id = new TLRPC.TL_peerUser(); + fwd_from.from_id.user_id = stream.readInt32(exception); + fwd_from.flags |= 1; + fwd_from.date = stream.readInt32(exception); from_id = new TLRPC.TL_peerUser(); from_id.user_id = stream.readInt32(exception); peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); date = stream.readInt32(exception); message = stream.readString(exception); flags |= MESSAGE_FLAG_FWD | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } - } + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } + } public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = unread ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); stream.writeInt32(flags); stream.writeInt32(id); stream.writeInt32((int) fwd_from.from_id.user_id); @@ -53286,6 +53981,187 @@ public class TLRPC { } public static class TL_message extends Message { + public static int constructor = 0x38116ee0; + + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + silent = (flags & 8192) != 0; + post = (flags & 16384) != 0; + from_scheduled = (flags & 262144) != 0; + legacy = (flags & 524288) != 0; + edit_hide = (flags & 2097152) != 0; + pinned = (flags & 16777216) != 0; + noforwards = (flags & 67108864) != 0; + id = stream.readInt32(exception); + if ((flags & 256) != 0) { + from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 4) != 0) { + fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 2048) != 0) { + via_bot_id = stream.readInt64(exception); + } + if ((flags & 8) != 0) { + reply_to = TL_messageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); + } + date = stream.readInt32(exception); + message = stream.readString(exception); + if ((flags & 512) != 0) { + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null) { + ttl = media.ttl_seconds; + } + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } + } + if ((flags & 64) != 0) { + reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 128) != 0) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + entities.add(object); + } + } + if ((flags & 1024) != 0) { + views = stream.readInt32(exception); + } + if ((flags & 1024) != 0) { + forwards = stream.readInt32(exception); + } + if ((flags & 8388608) != 0) { + replies = MessageReplies.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 32768) != 0) { + edit_date = stream.readInt32(exception); + } + if ((flags & 65536) != 0) { + post_author = stream.readString(exception); + } + if ((flags & 131072) != 0) { + grouped_id = stream.readInt64(exception); + } + if ((flags & 1048576) != 0) { + reactions = TL_messageReactions.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 4194304) != 0) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + restriction_reason.add(object); + } + } + if ((flags & 33554432) != 0) { + ttl_period = stream.readInt32(exception); + } + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = silent ? (flags | 8192) : (flags &~ 8192); + flags = post ? (flags | 16384) : (flags &~ 16384); + flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); + flags = legacy ? (flags | 524288) : (flags &~ 524288); + flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); + flags = pinned ? (flags | 16777216) : (flags &~ 16777216); + flags = noforwards ? (flags | 67108864) : (flags &~ 67108864); + stream.writeInt32(flags); + stream.writeInt32(id); + if ((flags & 256) != 0) { + from_id.serializeToStream(stream); + } + peer_id.serializeToStream(stream); + if ((flags & 4) != 0) { + fwd_from.serializeToStream(stream); + } + if ((flags & 2048) != 0) { + stream.writeInt64(via_bot_id); + } + if ((flags & 8) != 0) { + reply_to.serializeToStream(stream); + } + stream.writeInt32(date); + stream.writeString(message); + if ((flags & 512) != 0) { + media.serializeToStream(stream); + } + if ((flags & 64) != 0) { + reply_markup.serializeToStream(stream); + } + if ((flags & 128) != 0) { + stream.writeInt32(0x1cb5c415); + int count = entities.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + entities.get(a).serializeToStream(stream); + } + } + if ((flags & 1024) != 0) { + stream.writeInt32(views); + } + if ((flags & 1024) != 0) { + stream.writeInt32(forwards); + } + if ((flags & 8388608) != 0) { + replies.serializeToStream(stream); + } + if ((flags & 32768) != 0) { + stream.writeInt32(edit_date); + } + if ((flags & 65536) != 0) { + stream.writeString(post_author); + } + if ((flags & 131072) != 0) { + stream.writeInt64(grouped_id); + } + if ((flags & 1048576) != 0) { + reactions.serializeToStream(stream); + } + if ((flags & 4194304) != 0) { + stream.writeInt32(0x1cb5c415); + int count = restriction_reason.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + restriction_reason.get(a).serializeToStream(stream); + } + } + if ((flags & 33554432) != 0) { + stream.writeInt32(ttl_period); + } + } + } + + public static class TL_message_layer135 extends TL_message { public static int constructor = 0x85d6cbe2; @@ -54433,260 +55309,170 @@ public class TLRPC { } } - public static class TL_message_layer104 extends TL_message { - public static int constructor = 0x44f9b43d; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - silent = (flags & 8192) != 0; - post = (flags & 16384) != 0; - from_scheduled = (flags & 262144) != 0; - legacy = (flags & 524288) != 0; - id = stream.readInt32(exception); - if ((flags & 256) != 0) { - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); - } - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 4) != 0) { - fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 2048) != 0) { - via_bot_id = stream.readInt32(exception); - } - if ((flags & 8) != 0) { - reply_to = new TLRPC.TL_messageReplyHeader(); - reply_to.reply_to_msg_id = stream.readInt32(exception); - } - date = stream.readInt32(exception); - message = stream.readString(exception); - if ((flags & 512) != 0) { - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null) { - ttl = media.ttl_seconds; //custom - } - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } - } - if ((flags & 64) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - if ((flags & 1024) != 0) { - views = stream.readInt32(exception); - } - if ((flags & 32768) != 0) { - edit_date = stream.readInt32(exception); - } - if ((flags & 65536) != 0) { - post_author = stream.readString(exception); - } - if ((flags & 131072) != 0) { - grouped_id = stream.readInt64(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - flags = silent ? (flags | 8192) : (flags &~ 8192); - flags = post ? (flags | 16384) : (flags &~ 16384); - flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); - flags = legacy ? (flags | 524288) : (flags &~ 524288); - stream.writeInt32(flags); - stream.writeInt32(id); - if ((flags & 256) != 0) { - stream.writeInt32((int) from_id.user_id); - } - peer_id.serializeToStream(stream); - if ((flags & 4) != 0) { - fwd_from.serializeToStream(stream); - } - if ((flags & 2048) != 0) { - stream.writeInt32((int) via_bot_id); - } - if ((flags & 8) != 0) { - stream.writeInt32(reply_to.reply_to_msg_id); - } - stream.writeInt32(date); - stream.writeString(message); - if ((flags & 512) != 0) { - media.serializeToStream(stream); - } - if ((flags & 64) != 0) { - reply_markup.serializeToStream(stream); - } - if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 1024) != 0) { - stream.writeInt32(views); - } - if ((flags & 32768) != 0) { - stream.writeInt32(edit_date); - } - if ((flags & 65536) != 0) { - stream.writeString(post_author); - } - if ((flags & 131072) != 0) { - stream.writeInt64(grouped_id); - } - writeAttachPath(stream); - } - } - - public static class TL_message_old6 extends TL_message { - public static int constructor = 0x2bebfa86; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception) | MESSAGE_FLAG_HAS_FROM_ID; - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - id = stream.readInt32(exception); - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 4) != 0) { - fwd_from = new TL_messageFwdHeader(); - fwd_from.from_id = new TLRPC.TL_peerUser(); - fwd_from.from_id.user_id = stream.readInt32(exception); - fwd_from.flags |= 1; - fwd_from.date = stream.readInt32(exception); - } - if ((flags & 8) != 0) { - reply_to = new TLRPC.TL_messageReplyHeader(); - reply_to.reply_to_msg_id = stream.readInt32(exception); - } - date = stream.readInt32(exception); - message = stream.readString(exception); - if ((flags & 512) != 0) { - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } - } else { - media = new TL_messageMediaEmpty(); - } - if ((flags & 64) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt32(id); - stream.writeInt32((int) from_id.user_id); - peer_id.serializeToStream(stream); - if ((flags & 4) != 0) { - stream.writeInt32((int) fwd_from.from_id.user_id); - stream.writeInt32(fwd_from.date); - } - if ((flags & 8) != 0) { - stream.writeInt32(reply_to.reply_to_msg_id); - } - stream.writeInt32(date); - stream.writeString(message); - if ((flags & 512) != 0) { - media.serializeToStream(stream); - } - if ((flags & 64) != 0) { - reply_markup.serializeToStream(stream); - } - if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - writeAttachPath(stream); - } - } - - public static class TL_message_old5 extends TL_message { - public static int constructor = 0xf07814c8; - + public static class TL_message_layer104 extends TL_message { + public static int constructor = 0x44f9b43d; public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception) | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; + flags = stream.readInt32(exception); + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + silent = (flags & 8192) != 0; + post = (flags & 16384) != 0; + from_scheduled = (flags & 262144) != 0; + legacy = (flags & 524288) != 0; id = stream.readInt32(exception); - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); + if ((flags & 256) != 0) { + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); + } peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 4) != 0) { - fwd_from = new TL_messageFwdHeader(); - fwd_from.from_id = new TLRPC.TL_peerUser(); - fwd_from.from_id.user_id = stream.readInt32(exception); - fwd_from.flags |= 1; - fwd_from.date = stream.readInt32(exception); - } + if ((flags & 4) != 0) { + fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 2048) != 0) { + via_bot_id = stream.readInt32(exception); + } if ((flags & 8) != 0) { reply_to = new TLRPC.TL_messageReplyHeader(); reply_to.reply_to_msg_id = stream.readInt32(exception); } date = stream.readInt32(exception); message = stream.readString(exception); - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } + if ((flags & 512) != 0) { + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null) { + ttl = media.ttl_seconds; //custom + } + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } + } + if ((flags & 64) != 0) { + reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 128) != 0) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + entities.add(object); + } + } + if ((flags & 1024) != 0) { + views = stream.readInt32(exception); + } + if ((flags & 32768) != 0) { + edit_date = stream.readInt32(exception); + } + if ((flags & 65536) != 0) { + post_author = stream.readString(exception); + } + if ((flags & 131072) != 0) { + grouped_id = stream.readInt64(exception); + } + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = silent ? (flags | 8192) : (flags &~ 8192); + flags = post ? (flags | 16384) : (flags &~ 16384); + flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); + flags = legacy ? (flags | 524288) : (flags &~ 524288); + stream.writeInt32(flags); + stream.writeInt32(id); + if ((flags & 256) != 0) { + stream.writeInt32((int) from_id.user_id); + } + peer_id.serializeToStream(stream); + if ((flags & 4) != 0) { + fwd_from.serializeToStream(stream); + } + if ((flags & 2048) != 0) { + stream.writeInt32((int) via_bot_id); + } + if ((flags & 8) != 0) { + stream.writeInt32(reply_to.reply_to_msg_id); + } + stream.writeInt32(date); + stream.writeString(message); + if ((flags & 512) != 0) { + media.serializeToStream(stream); + } + if ((flags & 64) != 0) { + reply_markup.serializeToStream(stream); + } + if ((flags & 128) != 0) { + stream.writeInt32(0x1cb5c415); + int count = entities.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + entities.get(a).serializeToStream(stream); + } + } + if ((flags & 1024) != 0) { + stream.writeInt32(views); + } + if ((flags & 32768) != 0) { + stream.writeInt32(edit_date); + } + if ((flags & 65536) != 0) { + stream.writeString(post_author); + } + if ((flags & 131072) != 0) { + stream.writeInt64(grouped_id); + } + writeAttachPath(stream); + } + } + + public static class TL_message_old6 extends TL_message { + public static int constructor = 0x2bebfa86; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception) | MESSAGE_FLAG_HAS_FROM_ID; + unread = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + id = stream.readInt32(exception); + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 4) != 0) { + fwd_from = new TL_messageFwdHeader(); + fwd_from.from_id = new TLRPC.TL_peerUser(); + fwd_from.from_id.user_id = stream.readInt32(exception); + fwd_from.flags |= 1; + fwd_from.date = stream.readInt32(exception); + } + if ((flags & 8) != 0) { + reply_to = new TLRPC.TL_messageReplyHeader(); + reply_to.reply_to_msg_id = stream.readInt32(exception); + } + date = stream.readInt32(exception); + message = stream.readString(exception); + if ((flags & 512) != 0) { + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } + } else { + media = new TL_messageMediaEmpty(); + } if ((flags & 64) != 0) { reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); } @@ -54711,15 +55497,105 @@ public class TLRPC { public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = unread ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); stream.writeInt32(flags); stream.writeInt32(id); stream.writeInt32((int) from_id.user_id); peer_id.serializeToStream(stream); - if ((flags & 4) != 0) { + if ((flags & 4) != 0) { + stream.writeInt32((int) fwd_from.from_id.user_id); + stream.writeInt32(fwd_from.date); + } + if ((flags & 8) != 0) { + stream.writeInt32(reply_to.reply_to_msg_id); + } + stream.writeInt32(date); + stream.writeString(message); + if ((flags & 512) != 0) { + media.serializeToStream(stream); + } + if ((flags & 64) != 0) { + reply_markup.serializeToStream(stream); + } + if ((flags & 128) != 0) { + stream.writeInt32(0x1cb5c415); + int count = entities.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + entities.get(a).serializeToStream(stream); + } + } + writeAttachPath(stream); + } + } + + public static class TL_message_old5 extends TL_message { + public static int constructor = 0xf07814c8; + + + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception) | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; + unread = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + id = stream.readInt32(exception); + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 4) != 0) { + fwd_from = new TL_messageFwdHeader(); + fwd_from.from_id = new TLRPC.TL_peerUser(); + fwd_from.from_id.user_id = stream.readInt32(exception); + fwd_from.flags |= 1; + fwd_from.date = stream.readInt32(exception); + } + if ((flags & 8) != 0) { + reply_to = new TLRPC.TL_messageReplyHeader(); + reply_to.reply_to_msg_id = stream.readInt32(exception); + } + date = stream.readInt32(exception); + message = stream.readString(exception); + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } + if ((flags & 64) != 0) { + reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 128) != 0) { + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + entities.add(object); + } + } + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = unread ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + stream.writeInt32(flags); + stream.writeInt32(id); + stream.writeInt32((int) from_id.user_id); + peer_id.serializeToStream(stream); + if ((flags & 4) != 0) { stream.writeInt32((int) fwd_from.from_id.user_id); stream.writeInt32(fwd_from.date); } @@ -54740,53 +55616,53 @@ public class TLRPC { entities.get(a).serializeToStream(stream); } } - writeAttachPath(stream); + writeAttachPath(stream); } } - public static class TL_messageService_layer48 extends TL_messageService { - public static int constructor = 0xc06b9607; + public static class TL_messageService_layer48 extends TL_messageService { + public static int constructor = 0xc06b9607; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - silent = (flags & 8192) != 0; - post = (flags & 16384) != 0; - id = stream.readInt32(exception); - if ((flags & 256) != 0) { + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + unread = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + silent = (flags & 8192) != 0; + post = (flags & 16384) != 0; + id = stream.readInt32(exception); + if ((flags & 256) != 0) { from_id = new TLRPC.TL_peerUser(); from_id.user_id = stream.readInt32(exception); - } + } peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (from_id == null) { - from_id = peer_id; - } - date = stream.readInt32(exception); - action = MessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); - } + if (from_id == null) { + from_id = peer_id; + } + date = stream.readInt32(exception); + action = MessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - flags = silent ? (flags | 8192) : (flags &~ 8192); - flags = post ? (flags | 16384) : (flags &~ 16384); - stream.writeInt32(flags); - stream.writeInt32(id); - if ((flags & 256) != 0) { - stream.writeInt32((int) from_id.user_id); - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = unread ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = silent ? (flags | 8192) : (flags &~ 8192); + flags = post ? (flags | 16384) : (flags &~ 16384); + stream.writeInt32(flags); + stream.writeInt32(id); + if ((flags & 256) != 0) { + stream.writeInt32((int) from_id.user_id); + } peer_id.serializeToStream(stream); - stream.writeInt32(date); - action.serializeToStream(stream); - } - } + stream.writeInt32(date); + action.serializeToStream(stream); + } + } public static class TL_message_old4 extends TL_message { public static int constructor = 0xc3060325; @@ -54794,21 +55670,21 @@ public class TLRPC { public void readParams(AbstractSerializedData stream, boolean exception) { flags = stream.readInt32(exception) | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; + unread = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; id = stream.readInt32(exception); from_id = new TLRPC.TL_peerUser(); from_id.user_id = stream.readInt32(exception); peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 4) != 0) { - fwd_from = new TL_messageFwdHeader(); - fwd_from.from_id = new TLRPC.TL_peerUser(); - fwd_from.from_id.user_id = stream.readInt32(exception); - fwd_from.flags |= 1; - fwd_from.date = stream.readInt32(exception); - } + if ((flags & 4) != 0) { + fwd_from = new TL_messageFwdHeader(); + fwd_from.from_id = new TLRPC.TL_peerUser(); + fwd_from.from_id.user_id = stream.readInt32(exception); + fwd_from.flags |= 1; + fwd_from.date = stream.readInt32(exception); + } if ((flags & 8) != 0) { reply_to = new TLRPC.TL_messageReplyHeader(); reply_to.reply_to_msg_id = stream.readInt32(exception); @@ -54816,9 +55692,9 @@ public class TLRPC { date = stream.readInt32(exception); message = stream.readString(exception); media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } if ((flags & 64) != 0) { reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); } @@ -54826,10 +55702,10 @@ public class TLRPC { public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = unread ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); stream.writeInt32(flags); stream.writeInt32(id); stream.writeInt32((int) from_id.user_id); @@ -54847,7 +55723,7 @@ public class TLRPC { if ((flags & 64) != 0) { reply_markup.serializeToStream(stream); } - writeAttachPath(stream); + writeAttachPath(stream); } } @@ -54856,21 +55732,21 @@ public class TLRPC { public void readParams(AbstractSerializedData stream, boolean exception) { flags = stream.readInt32(exception) | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; + unread = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; id = stream.readInt32(exception); from_id = new TLRPC.TL_peerUser(); from_id.user_id = stream.readInt32(exception); peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 4) != 0) { - fwd_from = new TL_messageFwdHeader(); - fwd_from.from_id = new TLRPC.TL_peerUser(); - fwd_from.from_id.user_id = stream.readInt32(exception); - fwd_from.flags |= 1; - fwd_from.date = stream.readInt32(exception); - } + if ((flags & 4) != 0) { + fwd_from = new TL_messageFwdHeader(); + fwd_from.from_id = new TLRPC.TL_peerUser(); + fwd_from.from_id.user_id = stream.readInt32(exception); + fwd_from.flags |= 1; + fwd_from.date = stream.readInt32(exception); + } if ((flags & 8) != 0) { reply_to = new TLRPC.TL_messageReplyHeader(); reply_to.reply_to_msg_id = stream.readInt32(exception); @@ -54878,24 +55754,24 @@ public class TLRPC { date = stream.readInt32(exception); message = stream.readString(exception); media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } } public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = unread ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); stream.writeInt32(flags); stream.writeInt32(id); stream.writeInt32((int) from_id.user_id); peer_id.serializeToStream(stream); if ((flags & 4) != 0) { stream.writeInt32((int) fwd_from.from_id.user_id); - stream.writeInt32(fwd_from.date); + stream.writeInt32(fwd_from.date); } if ((flags & 8) != 0) { stream.writeInt32(reply_to.reply_to_msg_id); @@ -54903,7 +55779,7 @@ public class TLRPC { stream.writeInt32(date); stream.writeString(message); media.serializeToStream(stream); - writeAttachPath(stream); + writeAttachPath(stream); } } @@ -54913,10 +55789,10 @@ public class TLRPC { public void readParams(AbstractSerializedData stream, boolean exception) { flags = stream.readInt32(exception) | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; + unread = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; id = stream.readInt32(exception); from_id = new TLRPC.TL_peerUser(); from_id.user_id = stream.readInt32(exception); @@ -54924,17 +55800,17 @@ public class TLRPC { date = stream.readInt32(exception); message = stream.readString(exception); media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } } public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = unread ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); stream.writeInt32(flags); stream.writeInt32(id); stream.writeInt32((int) from_id.user_id); @@ -54955,8 +55831,8 @@ public class TLRPC { from_id = new TLRPC.TL_peerUser(); from_id.user_id = stream.readInt32(exception); peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - out = stream.readBool(exception); - unread = stream.readBool(exception); + out = stream.readBool(exception); + unread = stream.readBool(exception); flags |= MESSAGE_FLAG_HAS_FROM_ID; date = stream.readInt32(exception); action = MessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -54980,23 +55856,23 @@ public class TLRPC { public void readParams(AbstractSerializedData stream, boolean exception) { id = stream.readInt32(exception); - fwd_from = new TL_messageFwdHeader(); - fwd_from.from_id = new TLRPC.TL_peerUser(); - fwd_from.from_id.user_id = stream.readInt32(exception); - fwd_from.flags |= 1; - fwd_from.date = stream.readInt32(exception); + fwd_from = new TL_messageFwdHeader(); + fwd_from.from_id = new TLRPC.TL_peerUser(); + fwd_from.from_id.user_id = stream.readInt32(exception); + fwd_from.flags |= 1; + fwd_from.date = stream.readInt32(exception); from_id = new TLRPC.TL_peerUser(); from_id.user_id = stream.readInt32(exception); peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - out = stream.readBool(exception); - unread = stream.readBool(exception); + out = stream.readBool(exception); + unread = stream.readBool(exception); flags |= MESSAGE_FLAG_FWD | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; date = stream.readInt32(exception); message = stream.readString(exception); media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } } public void serializeToStream(AbstractSerializedData stream) { @@ -55006,8 +55882,8 @@ public class TLRPC { stream.writeInt32(fwd_from.date); stream.writeInt32((int) from_id.user_id); peer_id.serializeToStream(stream); - stream.writeBool(out); - stream.writeBool(unread); + stream.writeBool(out); + stream.writeBool(unread); stream.writeInt32(date); stream.writeString(message); media.serializeToStream(stream); @@ -55023,15 +55899,15 @@ public class TLRPC { from_id = new TLRPC.TL_peerUser(); from_id.user_id = stream.readInt32(exception); peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - out = stream.readBool(exception); - unread = stream.readBool(exception); + out = stream.readBool(exception); + unread = stream.readBool(exception); flags |= MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; date = stream.readInt32(exception); message = stream.readString(exception); media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } } public void serializeToStream(AbstractSerializedData stream) { @@ -55039,8 +55915,8 @@ public class TLRPC { stream.writeInt32(id); stream.writeInt32((int) from_id.user_id); peer_id.serializeToStream(stream); - stream.writeBool(out); - stream.writeBool(unread); + stream.writeBool(out); + stream.writeBool(unread); stream.writeInt32(date); stream.writeString(message); media.serializeToStream(stream); @@ -55048,169 +55924,15 @@ public class TLRPC { } } - public static class TL_message_secret extends TL_message { - public static int constructor = 0x555555fa; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - id = stream.readInt32(exception); - ttl = stream.readInt32(exception); - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - date = stream.readInt32(exception); - message = stream.readString(exception); - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - if ((flags & 2048) != 0) { - via_bot_name = stream.readString(exception); - } - if ((flags & 8) != 0) { - reply_to = new TL_messageReplyHeader(); - reply_to.reply_to_random_id = stream.readInt64(exception); - } - if ((flags & 131072) != 0) { - grouped_id = stream.readInt64(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt32(id); - stream.writeInt32(ttl); - stream.writeInt32((int) from_id.user_id); - peer_id.serializeToStream(stream); - stream.writeInt32(date); - stream.writeString(message); - media.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - if ((flags & 2048) != 0) { - stream.writeString(via_bot_name); - } - if ((flags & 8) != 0) { - stream.writeInt64(reply_to.reply_to_random_id); - } - if ((flags & 131072) != 0) { - stream.writeInt64(grouped_id); - } - writeAttachPath(stream); - } - } - - public static class TL_message_secret_layer72 extends TL_message { - public static int constructor = 0x555555f9; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - id = stream.readInt32(exception); - ttl = stream.readInt32(exception); - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - date = stream.readInt32(exception); - message = stream.readString(exception); - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - if ((flags & 2048) != 0) { - via_bot_name = stream.readString(exception); - } - if ((flags & 8) != 0) { - reply_to = new TL_messageReplyHeader(); - reply_to.reply_to_random_id = stream.readInt64(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt32(id); - stream.writeInt32(ttl); - stream.writeInt32((int) from_id.user_id); - peer_id.serializeToStream(stream); - stream.writeInt32(date); - stream.writeString(message); - media.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - if ((flags & 2048) != 0) { - stream.writeString(via_bot_name); - } - if ((flags & 8) != 0) { - stream.writeInt64(reply_to.reply_to_random_id); - } - writeAttachPath(stream); - } - } - - public static class TL_message_secret_old extends TL_message_secret { - public static int constructor = 0x555555F8; + public static class TL_message_secret extends TL_message { + public static int constructor = 0x555555fa; public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception) | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; + flags = stream.readInt32(exception); + unread = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; id = stream.readInt32(exception); ttl = stream.readInt32(exception); from_id = new TLRPC.TL_peerUser(); @@ -55219,17 +55941,171 @@ public class TLRPC { date = stream.readInt32(exception); message = stream.readString(exception); media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + entities.add(object); + } + if ((flags & 2048) != 0) { + via_bot_name = stream.readString(exception); + } + if ((flags & 8) != 0) { + reply_to = new TL_messageReplyHeader(); + reply_to.reply_to_random_id = stream.readInt64(exception); + } + if ((flags & 131072) != 0) { + grouped_id = stream.readInt64(exception); + } } public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = unread ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + stream.writeInt32(flags); + stream.writeInt32(id); + stream.writeInt32(ttl); + stream.writeInt32((int) from_id.user_id); + peer_id.serializeToStream(stream); + stream.writeInt32(date); + stream.writeString(message); + media.serializeToStream(stream); + stream.writeInt32(0x1cb5c415); + int count = entities.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + entities.get(a).serializeToStream(stream); + } + if ((flags & 2048) != 0) { + stream.writeString(via_bot_name); + } + if ((flags & 8) != 0) { + stream.writeInt64(reply_to.reply_to_random_id); + } + if ((flags & 131072) != 0) { + stream.writeInt64(grouped_id); + } + writeAttachPath(stream); + } + } + + public static class TL_message_secret_layer72 extends TL_message { + public static int constructor = 0x555555f9; + + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + unread = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + id = stream.readInt32(exception); + ttl = stream.readInt32(exception); + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + date = stream.readInt32(exception); + message = stream.readString(exception); + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + entities.add(object); + } + if ((flags & 2048) != 0) { + via_bot_name = stream.readString(exception); + } + if ((flags & 8) != 0) { + reply_to = new TL_messageReplyHeader(); + reply_to.reply_to_random_id = stream.readInt64(exception); + } + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = unread ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + stream.writeInt32(flags); + stream.writeInt32(id); + stream.writeInt32(ttl); + stream.writeInt32((int) from_id.user_id); + peer_id.serializeToStream(stream); + stream.writeInt32(date); + stream.writeString(message); + media.serializeToStream(stream); + stream.writeInt32(0x1cb5c415); + int count = entities.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + entities.get(a).serializeToStream(stream); + } + if ((flags & 2048) != 0) { + stream.writeString(via_bot_name); + } + if ((flags & 8) != 0) { + stream.writeInt64(reply_to.reply_to_random_id); + } + writeAttachPath(stream); + } + } + + public static class TL_message_secret_old extends TL_message_secret { + public static int constructor = 0x555555F8; + + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception) | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; + unread = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + id = stream.readInt32(exception); + ttl = stream.readInt32(exception); + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + date = stream.readInt32(exception); + message = stream.readString(exception); + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = unread ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); stream.writeInt32(flags); stream.writeInt32(id); stream.writeInt32(ttl); @@ -55341,55 +56217,55 @@ public class TLRPC { } } - public static class TL_messageService_layer118 extends TL_messageService { - public static int constructor = 0x9e19a1f6; + public static class TL_messageService_layer118 extends TL_messageService { + public static int constructor = 0x9e19a1f6; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - silent = (flags & 8192) != 0; - post = (flags & 16384) != 0; + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + unread = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + silent = (flags & 8192) != 0; + post = (flags & 16384) != 0; legacy = (flags & 524288) != 0; - id = stream.readInt32(exception); - if ((flags & 256) != 0) { + id = stream.readInt32(exception); + if ((flags & 256) != 0) { from_id = new TLRPC.TL_peerUser(); from_id.user_id = stream.readInt32(exception); - } + } peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 8) != 0) { + if ((flags & 8) != 0) { reply_to = new TLRPC.TL_messageReplyHeader(); reply_to.reply_to_msg_id = stream.readInt32(exception); - } - date = stream.readInt32(exception); - action = MessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); - } + } + date = stream.readInt32(exception); + action = MessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - flags = silent ? (flags | 8192) : (flags &~ 8192); - flags = post ? (flags | 16384) : (flags &~ 16384); + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = unread ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = silent ? (flags | 8192) : (flags &~ 8192); + flags = post ? (flags | 16384) : (flags &~ 16384); flags = legacy ? (flags | 524288) : (flags &~ 524288); - stream.writeInt32(flags); - stream.writeInt32(id); - if ((flags & 256) != 0) { - stream.writeInt32((int) from_id.user_id); - } + stream.writeInt32(flags); + stream.writeInt32(id); + if ((flags & 256) != 0) { + stream.writeInt32((int) from_id.user_id); + } peer_id.serializeToStream(stream); - if ((flags & 8) != 0) { - stream.writeInt32(reply_to.reply_to_msg_id); - } - stream.writeInt32(date); - action.serializeToStream(stream); + if ((flags & 8) != 0) { + stream.writeInt32(reply_to.reply_to_msg_id); + } + stream.writeInt32(date); + action.serializeToStream(stream); writeAttachPath(stream); - } - } + } + } //Message end //TL_dialog start @@ -55518,13 +56394,13 @@ public class TLRPC { } //TL_dialog end - //ChatParticipant start - public static class TL_chatChannelParticipant extends ChatParticipant { - public static int constructor = 0xc8d7493e; + //ChatParticipant start + public static class TL_chatChannelParticipant extends ChatParticipant { + public static int constructor = 0xc8d7493e; - public ChannelParticipant channelParticipant; - } - //ChatParticipant end + public ChannelParticipant channelParticipant; + } + //ChatParticipant end //Chat start public static class TL_chatEmpty extends Chat { @@ -55585,7 +56461,7 @@ public class TLRPC { return; } if (bytes != null) { - bytes.reuse(); + bytes.reuse(); bytes = null; } } @@ -55655,294 +56531,294 @@ public class TLRPC { } } - public static class TL_upload_getWebFile extends TLObject { - public static int constructor = 0x24e6818d; + public static class TL_upload_getWebFile extends TLObject { + public static int constructor = 0x24e6818d; - public InputWebFileLocation location; - public int offset; - public int limit; + public InputWebFileLocation location; + public int offset; + public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_upload_webFile.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_upload_webFile.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - location.serializeToStream(stream); - stream.writeInt32(offset); - stream.writeInt32(limit); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + location.serializeToStream(stream); + stream.writeInt32(offset); + stream.writeInt32(limit); + } + } - public static class TL_upload_getCdnFile extends TLObject { - public static int constructor = 0x2000bcc3; + public static class TL_upload_getCdnFile extends TLObject { + public static int constructor = 0x2000bcc3; - public byte[] file_token; - public int offset; - public int limit; + public byte[] file_token; + public int offset; + public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return upload_CdnFile.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return upload_CdnFile.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(file_token); - stream.writeInt32(offset); - stream.writeInt32(limit); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeByteArray(file_token); + stream.writeInt32(offset); + stream.writeInt32(limit); + } + } - public static class TL_upload_reuploadCdnFile extends TLObject { - public static int constructor = 0x9b2754a8; + public static class TL_upload_reuploadCdnFile extends TLObject { + public static int constructor = 0x9b2754a8; - public byte[] file_token; - public byte[] request_token; + public byte[] file_token; + public byte[] request_token; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - TL_fileHash object = TL_fileHash.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + Vector vector = new Vector(); + int size = stream.readInt32(exception); + for (int a = 0; a < size; a++) { + TL_fileHash object = TL_fileHash.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return vector; + } + vector.objects.add(object); + } + return vector; + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(file_token); - stream.writeByteArray(request_token); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeByteArray(file_token); + stream.writeByteArray(request_token); + } + } - public static class TL_upload_getCdnFileHashes extends TLObject { - public static int constructor = 0x4da54231; + public static class TL_upload_getCdnFileHashes extends TLObject { + public static int constructor = 0x4da54231; - public byte[] file_token; - public int offset; + public byte[] file_token; + public int offset; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - TL_fileHash object = TL_fileHash.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + Vector vector = new Vector(); + int size = stream.readInt32(exception); + for (int a = 0; a < size; a++) { + TL_fileHash object = TL_fileHash.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return vector; + } + vector.objects.add(object); + } + return vector; + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(file_token); - stream.writeInt32(offset); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeByteArray(file_token); + stream.writeInt32(offset); + } + } - public static class TL_upload_getFileHashes extends TLObject { - public static int constructor = 0xc7025931; + public static class TL_upload_getFileHashes extends TLObject { + public static int constructor = 0xc7025931; - public InputFileLocation location; - public int offset; + public InputFileLocation location; + public int offset; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - TL_fileHash object = TL_fileHash.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + Vector vector = new Vector(); + int size = stream.readInt32(exception); + for (int a = 0; a < size; a++) { + TL_fileHash object = TL_fileHash.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return vector; + } + vector.objects.add(object); + } + return vector; + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - location.serializeToStream(stream); - stream.writeInt32(offset); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + location.serializeToStream(stream); + stream.writeInt32(offset); + } + } - public static class TL_upload_webFile extends TLObject { - public static int constructor = 0x21e753bc; + public static class TL_upload_webFile extends TLObject { + public static int constructor = 0x21e753bc; - public int size; - public String mime_type; - public storage_FileType file_type; - public int mtime; - public NativeByteBuffer bytes; + public int size; + public String mime_type; + public storage_FileType file_type; + public int mtime; + public NativeByteBuffer bytes; - public static TL_upload_webFile TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_upload_webFile.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_upload_webFile", constructor)); - } else { - return null; - } - } - TL_upload_webFile result = new TL_upload_webFile(); - result.readParams(stream, exception); - return result; - } + public static TL_upload_webFile TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_upload_webFile.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_upload_webFile", constructor)); + } else { + return null; + } + } + TL_upload_webFile result = new TL_upload_webFile(); + result.readParams(stream, exception); + return result; + } - public void readParams(AbstractSerializedData stream, boolean exception) { - size = stream.readInt32(exception); - mime_type = stream.readString(exception); - file_type = storage_FileType.TLdeserialize(stream, stream.readInt32(exception), exception); - mtime = stream.readInt32(exception); - bytes = stream.readByteBuffer(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + size = stream.readInt32(exception); + mime_type = stream.readString(exception); + file_type = storage_FileType.TLdeserialize(stream, stream.readInt32(exception), exception); + mtime = stream.readInt32(exception); + bytes = stream.readByteBuffer(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(size); - stream.writeString(mime_type); - file_type.serializeToStream(stream); - stream.writeInt32(mtime); - stream.writeByteBuffer(bytes); - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(size); + stream.writeString(mime_type); + file_type.serializeToStream(stream); + stream.writeInt32(mtime); + stream.writeByteBuffer(bytes); + } - @Override - public void freeResources() { - if (disableFree) { - return; - } - if (bytes != null) { - bytes.reuse(); - bytes = null; - } - } - } + @Override + public void freeResources() { + if (disableFree) { + return; + } + if (bytes != null) { + bytes.reuse(); + bytes = null; + } + } + } - public static abstract class upload_File extends TLObject { - public storage_FileType type; - public int mtime; - public NativeByteBuffer bytes; - public int dc_id; - public byte[] file_token; - public byte[] encryption_key; - public byte[] encryption_iv; + public static abstract class upload_File extends TLObject { + public storage_FileType type; + public int mtime; + public NativeByteBuffer bytes; + public int dc_id; + public byte[] file_token; + public byte[] encryption_key; + public byte[] encryption_iv; public ArrayList file_hashes = new ArrayList<>(); - public static upload_File TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - upload_File result = null; - switch (constructor) { - case 0x96a18d5: - result = new TL_upload_file(); - break; + public static upload_File TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + upload_File result = null; + switch (constructor) { + case 0x96a18d5: + result = new TL_upload_file(); + break; case 0xf18cda44: result = new TL_upload_fileCdnRedirect(); break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in upload_File", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in upload_File", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static abstract class upload_CdnFile extends TLObject { - public NativeByteBuffer bytes; - public byte[] request_token; + public static abstract class upload_CdnFile extends TLObject { + public NativeByteBuffer bytes; + public byte[] request_token; - public static upload_CdnFile TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - upload_CdnFile result = null; - switch (constructor) { - case 0xa99fca4f: - result = new TL_upload_cdnFile(); - break; - case 0xeea8e46e: - result = new TL_upload_cdnFileReuploadNeeded(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in upload_CdnFile", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + public static upload_CdnFile TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + upload_CdnFile result = null; + switch (constructor) { + case 0xa99fca4f: + result = new TL_upload_cdnFile(); + break; + case 0xeea8e46e: + result = new TL_upload_cdnFileReuploadNeeded(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in upload_CdnFile", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public static class TL_upload_cdnFile extends upload_CdnFile { - public static int constructor = 0xa99fca4f; + public static class TL_upload_cdnFile extends upload_CdnFile { + public static int constructor = 0xa99fca4f; - public void readParams(AbstractSerializedData stream, boolean exception) { - bytes = stream.readByteBuffer(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + bytes = stream.readByteBuffer(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteBuffer(bytes); - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeByteBuffer(bytes); + } - @Override - public void freeResources() { - if (disableFree) { - return; - } - if (bytes != null) { - bytes.reuse(); - bytes = null; - } - } - } + @Override + public void freeResources() { + if (disableFree) { + return; + } + if (bytes != null) { + bytes.reuse(); + bytes = null; + } + } + } - public static class TL_upload_cdnFileReuploadNeeded extends upload_CdnFile { - public static int constructor = 0xeea8e46e; + public static class TL_upload_cdnFileReuploadNeeded extends upload_CdnFile { + public static int constructor = 0xeea8e46e; - public void readParams(AbstractSerializedData stream, boolean exception) { - request_token = stream.readByteArray(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + request_token = stream.readByteArray(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(request_token); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeByteArray(request_token); + } + } - public static class TL_upload_file extends upload_File { - public static int constructor = 0x96a18d5; + public static class TL_upload_file extends upload_File { + public static int constructor = 0x96a18d5; - public void readParams(AbstractSerializedData stream, boolean exception) { - type = storage_FileType.TLdeserialize(stream, stream.readInt32(exception), exception); - mtime = stream.readInt32(exception); - bytes = stream.readByteBuffer(exception); - } + public void readParams(AbstractSerializedData stream, boolean exception) { + type = storage_FileType.TLdeserialize(stream, stream.readInt32(exception), exception); + mtime = stream.readInt32(exception); + bytes = stream.readByteBuffer(exception); + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - type.serializeToStream(stream); - stream.writeInt32(mtime); - stream.writeByteBuffer(bytes); - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + type.serializeToStream(stream); + stream.writeInt32(mtime); + stream.writeByteBuffer(bytes); + } - @Override - public void freeResources() { - if (disableFree) { - return; - } - if (bytes != null) { - bytes.reuse(); - bytes = null; - } - } - } + @Override + public void freeResources() { + if (disableFree) { + return; + } + if (bytes != null) { + bytes.reuse(); + bytes = null; + } + } + } public static class TL_upload_fileCdnRedirect extends upload_File { public static int constructor = 0xf18cda44; @@ -55962,11 +56838,11 @@ public class TLRPC { } int count = stream.readInt32(exception); for (int a = 0; a < count; a++) { - TL_fileHash object = TL_fileHash.TLdeserialize(stream, stream.readInt32(exception), exception); + TL_fileHash object = TL_fileHash.TLdeserialize(stream, stream.readInt32(exception), exception); if (object == null) { return; } - file_hashes.add(object); + file_hashes.add(object); } } @@ -55980,7 +56856,7 @@ public class TLRPC { int count = file_hashes.size(); stream.writeInt32(count); for (int a = 0; a < count; a++) { - file_hashes.get(a).serializeToStream(stream); + file_hashes.get(a).serializeToStream(stream); } } } @@ -56107,25 +56983,25 @@ public class TLRPC { } } - public static class TL_messages_sendEncryptedMultiMedia extends TLObject { - public static int constructor = 0xcacacaca; + public static class TL_messages_sendEncryptedMultiMedia extends TLObject { + public static int constructor = 0xcacacaca; - public ArrayList messages = new ArrayList<>(); - public ArrayList files = new ArrayList<>(); + public ArrayList messages = new ArrayList<>(); + public ArrayList files = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_SentEncryptedMessage.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return messages_SentEncryptedMessage.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(AbstractSerializedData stream) { - } + } - @Override - public void freeResources() { + @Override + public void freeResources() { - } - } + } + } public static class TL_messages_sendEncrypted extends TLObject { public static int constructor = 0x44fa7a15; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBar.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBar.java index ed3faefc8..fa505cee1 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBar.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBar.java @@ -214,7 +214,7 @@ public class ActionBar extends FrameLayout { manualStart = true; if (snowflakesEffect == null) { fireworksEffect = null; - snowflakesEffect = new SnowflakesEffect(); + snowflakesEffect = new SnowflakesEffect(0); titleTextView[0].invalidate(); invalidate(); } else { @@ -270,7 +270,7 @@ public class ActionBar extends FrameLayout { } } else if (NekomuraConfig.actionBarDecoration.Int() == 1 || Theme.canStartHolidayAnimation()) { if (snowflakesEffect == null) { - snowflakesEffect = new SnowflakesEffect(); + snowflakesEffect = new SnowflakesEffect(0); } } else if (!manualStart) { if (snowflakesEffect != null) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java index c583e12fc..4893b78fd 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java @@ -24,14 +24,7 @@ import android.graphics.Rect; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Build; - -import androidx.annotation.Keep; - -import android.os.SystemClock; - -import androidx.core.graphics.ColorUtils; -import androidx.core.math.MathUtils; - +import android.util.Log; import android.view.Gravity; import android.view.HapticFeedbackConstants; import android.view.KeyEvent; @@ -44,14 +37,14 @@ import android.view.ViewOutlineProvider; import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.DecelerateInterpolator; import android.widget.FrameLayout; -import android.widget.LinearLayout; import androidx.annotation.Keep; -import com.google.android.exoplayer2.util.Log; +import androidx.annotation.Keep; +import androidx.core.graphics.ColorUtils; +import androidx.core.math.MathUtils; import org.telegram.messenger.AndroidUtilities; -import org.telegram.messenger.ApplicationLoader; import org.telegram.messenger.FileLog; import org.telegram.messenger.MessagesController; import org.telegram.messenger.R; @@ -1071,6 +1064,7 @@ public class ActionBarLayout extends FrameLayout { } public boolean presentFragment(final BaseFragment fragment, final boolean removeLast, boolean forceWithoutAnimation, boolean check, final boolean preview, View menu) { + Log.i("UI", "presenting Fragment " + fragment); if (fragment == null || checkTransitionAnimation() || delegate != null && check && !delegate.needPresentFragment(fragment, removeLast, forceWithoutAnimation, this) || !fragment.onFragmentCreate()) { return false; } @@ -1832,7 +1826,7 @@ public class ActionBarLayout extends FrameLayout { themeAnimatorSet = null; } boolean startAnimation = false; - int fragmentCount = settings.onlyTopFragment ? 1 : 2; + int fragmentCount = settings.onlyTopFragment ? 1 : fragmentsStack.size(); for (int i = 0; i < fragmentCount; i++) { BaseFragment fragment; if (i == 0) { @@ -1865,7 +1859,7 @@ public class ActionBarLayout extends FrameLayout { } if (i == 0) { if (settings.applyTheme) { - if (settings.accentId != -1) { + if (settings.accentId != -1 && settings.theme != null) { settings.theme.setCurrentAccentId(settings.accentId); Theme.saveThemeAccents(settings.theme, true, false, true, false); } @@ -1884,11 +1878,13 @@ public class ActionBarLayout extends FrameLayout { } } if (startAnimation) { - int count = fragmentsStack.size() - (inPreviewMode || transitionAnimationPreviewMode ? 2 : 1); - for (int a = 0; a < count; a++) { - BaseFragment fragment = fragmentsStack.get(a); - fragment.clearViews(); - fragment.setParentLayout(this); + if (!settings.onlyTopFragment) { + int count = fragmentsStack.size() - (inPreviewMode || transitionAnimationPreviewMode ? 2 : 1); + for (int a = 0; a < count; a++) { + BaseFragment fragment = fragmentsStack.get(a); + fragment.clearViews(); + fragment.setParentLayout(this); + } } if (settings.instant) { setThemeAnimationValue(1.0f); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenu.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenu.java index 1357ef5bd..5641922a6 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenu.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenu.java @@ -318,6 +318,17 @@ public class ActionBarMenu extends LinearLayout { return w; } + public int getVisibleItemsMeasuredWidth() { + int w = 0; + for (int i = 0, count = getChildCount(); i < count; i++) { + View view = getChildAt(i); + if (view instanceof ActionBarMenuItem && view.getVisibility() != View.GONE) { + w += view.getMeasuredWidth(); + } + } + return w; + } + public boolean searchFieldVisible() { int count = getChildCount(); for (int a = 0; a < count; a++) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenuItem.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenuItem.java index 3f409ba2c..4a736977c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenuItem.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenuItem.java @@ -1632,6 +1632,7 @@ public class ActionBarMenuItem extends FrameLayout { popupLayout.getItemAt(a).setVisibility(GONE); } measurePopup = true; + checkHideMenuItem(); } public boolean isSubItemVisible(int id) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarPopupWindow.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarPopupWindow.java index b2330a0e9..3a86660e1 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarPopupWindow.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarPopupWindow.java @@ -37,12 +37,16 @@ import android.widget.LinearLayout; import android.widget.PopupWindow; import android.widget.ScrollView; +import androidx.annotation.Keep; +import androidx.annotation.Nullable; + import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.FileLog; import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; import org.telegram.messenger.UserConfig; import org.telegram.ui.Components.LayoutHelper; +import org.telegram.ui.Components.PopupSwipeBackLayout; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -87,6 +91,7 @@ public class ActionBarPopupWindow extends PopupWindow { } public static class ActionBarPopupWindowLayout extends FrameLayout { + public final static int FLAG_USE_SWIPEBACK = 1; private OnDispatchKeyEventListener mOnDispatchKeyEventListener; private float backScaleX = 1; @@ -101,6 +106,7 @@ public class ActionBarPopupWindow extends PopupWindow { private int gapEndY = -1000000; private Rect bgPaddings = new Rect(); + private PopupSwipeBackLayout swipeBackLayout; private ScrollView scrollView; protected LinearLayout linearLayout; @@ -111,21 +117,18 @@ public class ActionBarPopupWindow extends PopupWindow { private final Theme.ResourcesProvider resourcesProvider; public ActionBarPopupWindowLayout(Context context) { - this(context, false); + this(context, null); } public ActionBarPopupWindowLayout(Context context, Theme.ResourcesProvider resourcesProvider) { - this(context, false, R.drawable.popup_fixed_alert2, resourcesProvider); + this(context, R.drawable.popup_fixed_alert2, resourcesProvider); } - public ActionBarPopupWindowLayout(Context context, boolean verticalScrollBarEnabled) { - this(context, verticalScrollBarEnabled, R.drawable.popup_fixed_alert2, null); - } public ActionBarPopupWindowLayout(Context context, int resId, Theme.ResourcesProvider resourcesProvider) { - this(context, false, resId, resourcesProvider); + this(context, resId, resourcesProvider, 0); } - public ActionBarPopupWindowLayout(Context context, boolean verticalScrollBarEnabled, int resId, Theme.ResourcesProvider resourcesProvider) { + public ActionBarPopupWindowLayout(Context context, int resId, Theme.ResourcesProvider resourcesProvider, int flags) { super(context); this.resourcesProvider = resourcesProvider; @@ -138,10 +141,17 @@ public class ActionBarPopupWindow extends PopupWindow { setPadding(AndroidUtilities.dp(8), AndroidUtilities.dp(8), AndroidUtilities.dp(8), AndroidUtilities.dp(8)); setWillNotDraw(false); + if ((flags & FLAG_USE_SWIPEBACK) > 0) { + swipeBackLayout = new PopupSwipeBackLayout(context, resourcesProvider); + addView(swipeBackLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT)); + } + try { scrollView = new ScrollView(context); - scrollView.setVerticalScrollBarEnabled(verticalScrollBarEnabled); - addView(scrollView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT)); +// scrollView.setVerticalScrollBarEnabled(verticalScrollBarEnabled); + if (swipeBackLayout != null) { + swipeBackLayout.addView(scrollView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT)); + } else addView(scrollView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT)); } catch (Throwable e) { FileLog.e(e); } @@ -191,11 +201,23 @@ public class ActionBarPopupWindow extends PopupWindow { linearLayout.setOrientation(LinearLayout.VERTICAL); if (scrollView != null) { scrollView.addView(linearLayout, new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); + } else if (swipeBackLayout != null) { + swipeBackLayout.addView(linearLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT)); } else { addView(linearLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT)); } } + @Nullable + public PopupSwipeBackLayout getSwipeBack() { + return swipeBackLayout; + } + + public int addViewToSwipeBack(View v) { + swipeBackLayout.addView(v); + return swipeBackLayout.getChildCount() - 1; + } + public void setFitItems(boolean value) { fitItems = value; } @@ -729,4 +751,4 @@ public class ActionBarPopupWindow extends PopupWindow { public void setEmptyOutAnimation(long time) { outEmptyTime = time; } -} +} \ No newline at end of file diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java index 5c65a88eb..1016b6c92 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java @@ -707,7 +707,7 @@ public abstract class BaseFragment { } public int getThemedColor(String key) { - return Theme.getColor(key); + return Theme.getColor(key, getResourceProvider()); } public Drawable getThemedDrawable(String key) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheet.java index dd77e295c..4ba3e23e8 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheet.java @@ -27,6 +27,14 @@ import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Bundle; + +import androidx.annotation.NonNull; +import androidx.annotation.RequiresApi; +import androidx.core.view.NestedScrollingParent; +import androidx.core.view.NestedScrollingParentHelper; +import androidx.core.view.ViewCompat; +import androidx.core.widget.NestedScrollView; + import android.text.TextUtils; import android.util.TypedValue; import android.view.Gravity; @@ -300,13 +308,15 @@ public class BottomSheet extends Dialog { } } - boolean processTouchEvent(MotionEvent ev, boolean intercept) { + private float y = 0f; + public boolean processTouchEvent(MotionEvent ev, boolean intercept) { if (dismissed) { return false; } if (onContainerTouchEvent(ev)) { return true; } + if (canDismissWithTouchOutside() && ev != null && (ev.getAction() == MotionEvent.ACTION_DOWN || ev.getAction() == MotionEvent.ACTION_MOVE) && (!startedTracking && !maybeStartTracking && ev.getPointerCount() == 1)) { startedTrackingX = (int) ev.getX(); startedTrackingY = (int) ev.getY(); @@ -314,6 +324,7 @@ public class BottomSheet extends Dialog { dismiss(); return true; } + onScrollUpBegin(y); startedTrackingPointerId = ev.getPointerId(0); maybeStartTracking = true; cancelCurrentAnimation(); @@ -326,6 +337,7 @@ public class BottomSheet extends Dialog { } float dx = Math.abs((int) (ev.getX() - startedTrackingX)); float dy = (int) ev.getY() - startedTrackingY; + boolean canScrollUp = onScrollUp(y + dy); velocityTracker.addMovement(ev); if (!disableScroll && maybeStartTracking && !startedTracking && (dy > 0 && dy / 3.0f > Math.abs(dx) && Math.abs(dy) >= touchSlop)) { startedTrackingY = (int) ev.getY(); @@ -333,12 +345,10 @@ public class BottomSheet extends Dialog { startedTracking = true; requestDisallowInterceptTouchEvent(true); } else if (startedTracking) { - float translationY = containerView.getTranslationY(); - translationY += dy; - if (translationY < 0) { - translationY = 0; - } - containerView.setTranslationY(translationY); + y += dy; + if (!canScrollUp) + y = Math.max(y, 0); + containerView.setTranslationY(Math.max(y, 0)); startedTrackingY = (int) ev.getY(); container.invalidate(); } @@ -347,14 +357,13 @@ public class BottomSheet extends Dialog { velocityTracker = VelocityTracker.obtain(); } velocityTracker.computeCurrentVelocity(1000); - float translationY = containerView.getTranslationY(); - if (startedTracking || translationY != 0) { + onScrollUpEnd(y); + if (startedTracking || y > 0) { checkDismiss(velocityTracker.getXVelocity(), velocityTracker.getYVelocity()); - startedTracking = false; } else { maybeStartTracking = false; - startedTracking = false; } + startedTracking = false; if (velocityTracker != null) { velocityTracker.recycle(); velocityTracker = null; @@ -1068,6 +1077,12 @@ public class BottomSheet extends Dialog { protected boolean onContainerTouchEvent(MotionEvent event) { return false; } + protected boolean onScrollUp(float translationY) { + return false; + } + protected void onScrollUpEnd(float translationY) { + } + protected void onScrollUpBegin(float translationY) {} public void setCustomView(View view) { customView = view; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/EmojiThemes.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/EmojiThemes.java index ab2c786d6..884710841 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/EmojiThemes.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/EmojiThemes.java @@ -29,7 +29,7 @@ import java.util.Map; public class EmojiThemes { public boolean showAsDefaultStub; - String emoji; + public String emoji; int currentIndex = 0; ArrayList items = new ArrayList<>(); @@ -186,6 +186,23 @@ public class EmojiThemes { return themeItem; } + public static EmojiThemes createHomeQrTheme() { + EmojiThemes themeItem = new EmojiThemes(); + themeItem.emoji = "\uD83C\uDFE0"; + + ThemeItem blue = new ThemeItem(); + blue.themeInfo = Theme.getTheme("Blue"); + blue.accentId = 99; + themeItem.items.add(blue); + + ThemeItem nightBlue = new ThemeItem(); + nightBlue.themeInfo = Theme.getTheme("Dark Blue"); + nightBlue.accentId = 0; + themeItem.items.add(nightBlue); + + return themeItem; + } + public void initColors() { getPreviewColors(0, 0); getPreviewColors(0, 1); @@ -202,7 +219,10 @@ public class EmojiThemes { public TLRPC.WallPaper getWallpaper(int index) { int settingsIndex = items.get(index).settingsIndex; if (settingsIndex >= 0) { - return getTlTheme(index).settings.get(settingsIndex).wallpaper; + TLRPC.TL_theme tlTheme = getTlTheme(index); + if (tlTheme != null) { + return tlTheme.settings.get(settingsIndex).wallpaper; + } } return null; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/SimpleTextView.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/SimpleTextView.java index b7631f80d..55248f44a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/SimpleTextView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/SimpleTextView.java @@ -12,13 +12,17 @@ import android.content.Context; import android.graphics.Canvas; import android.graphics.LinearGradient; import android.graphics.Paint; +import android.graphics.Path; import android.graphics.PorterDuff; import android.graphics.PorterDuffXfermode; +import android.graphics.Rect; +import android.graphics.Region; import android.graphics.Shader; import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.os.SystemClock; import android.text.Layout; +import android.text.Spannable; import android.text.SpannableStringBuilder; import android.text.StaticLayout; import android.text.TextPaint; @@ -34,6 +38,11 @@ import org.telegram.messenger.LocaleController; import org.telegram.ui.Cells.DialogCell; import org.telegram.ui.Components.EmptyStubSpan; import org.telegram.ui.Components.StaticLayoutEx; +import org.telegram.ui.Components.spoilers.SpoilerEffect; + +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; public class SimpleTextView extends View implements Drawable.Callback { @@ -91,6 +100,10 @@ public class SimpleTextView extends View implements Drawable.Callback { private int minusWidth; private int fullTextMaxLines = 3; + private List spoilers = new ArrayList<>(); + private Stack spoilersPool = new Stack<>(); + private Path path = new Path(); + public SimpleTextView(Context context) { super(context); textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); @@ -298,6 +311,13 @@ public class SimpleTextView extends View implements Drawable.Callback { }*/ layout = new StaticLayout(string, 0, string.length(), textPaint, scrollNonFitText ? AndroidUtilities.dp(2000) : width + AndroidUtilities.dp(8), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); } + + spoilersPool.addAll(spoilers); + spoilers.clear(); + if (layout != null && layout.getText() instanceof Spannable) { + SpoilerEffect.addSpoilers(this, layout, spoilersPool, spoilers); + } + calcOffset(width); } catch (Exception ignore) { @@ -706,13 +726,38 @@ public class SimpleTextView extends View implements Drawable.Callback { if (fullAlpha > 0 && fullLayoutLeftOffset != 0) { canvas.save(); canvas.translate(-fullLayoutLeftOffset * fullAlpha + fullLayoutLeftCharactersOffset * fullAlpha, 0); + + canvas.save(); + clipOutSpoilers(canvas); layout.draw(canvas); canvas.restore(); + + drawSpoilers(canvas); + canvas.restore(); } else { + canvas.save(); + clipOutSpoilers(canvas); layout.draw(canvas); + canvas.restore(); + + drawSpoilers(canvas); } } + private void clipOutSpoilers(Canvas canvas) { + path.rewind(); + for (SpoilerEffect eff : spoilers) { + Rect b = eff.getBounds(); + path.addRect(b.left, b.top, b.right, b.bottom, Path.Direction.CW); + } + canvas.clipPath(path, Region.Op.DIFFERENCE); + } + + private void drawSpoilers(Canvas canvas) { + for (SpoilerEffect eff : spoilers) + eff.draw(canvas); + } + private void updateScrollAnimation() { if (!scrollNonFitText || !textDoesNotFit && scrollingOffset == 0) { return; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java index d2e8cebe6..b50b9682c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java @@ -65,6 +65,11 @@ import android.view.View; import androidx.annotation.UiThread; import androidx.core.graphics.ColorUtils; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.UiThread; +import androidx.core.graphics.ColorUtils; + import org.json.JSONArray; import org.json.JSONObject; import org.telegram.messenger.AndroidUtilities; @@ -89,7 +94,6 @@ import org.telegram.messenger.time.SunDate; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.SerializedData; import org.telegram.tgnet.TLRPC; -import org.telegram.ui.Cells.ThemesHorizontalListCell; import org.telegram.ui.Components.AudioVisualizerDrawable; import org.telegram.ui.Components.BackgroundGradientDrawable; import org.telegram.ui.Components.ChatThemeBottomSheet; @@ -2425,7 +2429,7 @@ public class Theme { public boolean createBackground(File file, String toPath) { try { - Bitmap bitmap = ThemesHorizontalListCell.getScaledBitmap(AndroidUtilities.dp(640), AndroidUtilities.dp(360), file.getAbsolutePath(), null, 0); + Bitmap bitmap = AndroidUtilities.getScaledBitmap(AndroidUtilities.dp(640), AndroidUtilities.dp(360), file.getAbsolutePath(), null, 0); if (bitmap != null && patternBgColor != 0) { Bitmap finalBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), bitmap.getConfig()); Canvas canvas = new Canvas(finalBitmap); @@ -3686,6 +3690,14 @@ public class Theme { public final static String key_statisticChartLine_indigo = "statisticChartLine_indigo"; public final static String key_statisticChartLineEmpty = "statisticChartLineEmpty"; + public static final String key_chat_outReactionButtonBackground = "chat_outReactionButtonBackground"; + public static final String key_chat_inReactionButtonBackground = "chat_inReactionButtonBackground"; + public static final String key_chat_outReactionButtonText = "chat_outReactionButtonText"; + public static final String key_chat_inReactionButtonText = "chat_inReactionButtonText"; + public static final String key_chat_inReactionButtonTextSelected = "chat_inReactionButtonTextSelected"; + public static final String key_chat_outReactionButtonTextSelected = "chat_outReactionButtonTextSelected"; + + public static final String key_drawable_botInline = "drawableBotInline"; public static final String key_drawable_botLink = "drawableBotLink"; public static final String key_drawable_commentSticker = "drawableCommentSticker"; @@ -3732,6 +3744,8 @@ public class Theme { public static final String key_drawable_lockIconDrawable = "drawableLockIcon"; public static final String key_drawable_chat_pollHintDrawableOut = "drawable_chat_pollHintDrawableOut"; public static final String key_drawable_chat_pollHintDrawableIn = "drawable_chat_pollHintDrawableIn"; + + private static final HashMap defaultChatDrawables = new HashMap<>(); private static final HashMap defaultChatDrawableColorKeys = new HashMap<>(); @@ -4539,6 +4553,13 @@ public class Theme { defaultColors.put(key_voipgroup_windowBackgroundWhiteInputField, 0xffdbdbdb); defaultColors.put(key_voipgroup_windowBackgroundWhiteInputFieldActivated, 0xff37a9f0); + defaultColors.put(key_chat_outReactionButtonBackground, 0xff78c272); + defaultColors.put(key_chat_inReactionButtonBackground, 0xff72b5e8); + defaultColors.put(key_chat_inReactionButtonText, 0xff3a8ccf); + defaultColors.put(key_chat_outReactionButtonText, 0xff55ab4f); + defaultColors.put(key_chat_inReactionButtonTextSelected, 0xffffffff); + defaultColors.put(key_chat_outReactionButtonTextSelected, 0xffffffff); + fallbackKeys.put(key_chat_inAdminText, key_chat_inTimeText); fallbackKeys.put(key_chat_inAdminSelectedText, key_chat_inTimeSelectedText); @@ -4675,6 +4696,13 @@ public class Theme { fallbackKeys.put(key_returnToCallMutedBackground, key_windowBackgroundWhite); fallbackKeys.put(key_dialogSwipeRemove, key_avatar_backgroundRed); + fallbackKeys.put(key_chat_inReactionButtonBackground, key_chat_inLoader); + fallbackKeys.put(key_chat_outReactionButtonBackground, key_chat_outLoader); + fallbackKeys.put(key_chat_inReactionButtonText, key_chat_inPreviewInstantText); + fallbackKeys.put(key_chat_outReactionButtonText, key_chat_outPreviewInstantText); + fallbackKeys.put(key_chat_inReactionButtonTextSelected, key_windowBackgroundWhite); + fallbackKeys.put(key_chat_outReactionButtonTextSelected, key_windowBackgroundWhite); + themeAccentExclusionKeys.addAll(Arrays.asList(keys_avatar_background)); themeAccentExclusionKeys.addAll(Arrays.asList(keys_avatar_nameInMessage)); themeAccentExclusionKeys.add(key_chat_attachFileBackground); @@ -5545,7 +5573,7 @@ public class Theme { int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH); int minutes = calendar.get(Calendar.MINUTE); int hour = calendar.get(Calendar.HOUR_OF_DAY); - if (monthOfYear == 0 && dayOfMonth == 1 && minutes <= 10 && hour == 0) { + if (monthOfYear == 0 && dayOfMonth == 1 && hour <= 23) { canStartHolidayAnimation = true; } else { canStartHolidayAnimation = false; @@ -9172,7 +9200,7 @@ public class Theme { return colorInteger; } } - return getColor(key); + return getColor(key); } public static int getColor(String key) { return getColor(key, null, false); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/CacheControlActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/CacheControlActivity.java index 29fedd25a..90d4633db 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/CacheControlActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/CacheControlActivity.java @@ -10,9 +10,8 @@ package org.telegram.ui; import android.content.Context; import android.content.Intent; -import android.content.Intent; import android.content.SharedPreferences; -import android.net.Uri; +import android.content.pm.PackageManager; import android.os.Build; import android.os.Environment; import android.os.StatFs; @@ -26,7 +25,6 @@ import android.transition.TransitionSet; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; -import android.widget.CheckBox; import android.widget.FrameLayout; import android.widget.LinearLayout; @@ -83,11 +81,7 @@ import org.telegram.ui.Components.StroageUsageView; import org.telegram.ui.Components.UndoView; import java.io.File; -import java.nio.file.CopyOption; -import java.nio.file.Files; -import java.nio.file.Path; import java.util.ArrayList; -import java.util.stream.Stream; import cn.hutool.core.thread.ThreadUtil; import kotlin.Unit; @@ -132,7 +126,6 @@ public class CacheControlActivity extends BaseFragment { private boolean calculating = true; private volatile boolean canceled = false; - private boolean hasOldFolder; private View bottomSheetView; private BottomSheet bottomSheet; @@ -216,24 +209,6 @@ public class CacheControlActivity extends BaseFragment { }); fragmentCreateTime = System.currentTimeMillis(); - - if (Build.VERSION.SDK_INT >= 30) { - File path = Environment.getExternalStorageDirectory(); - if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(SharedConfig.storageCacheDir)) { - ArrayList dirs = AndroidUtilities.getRootDirs(); - if (dirs != null) { - for (int a = 0, N = dirs.size(); a < N; a++) { - File dir = dirs.get(a); - if (dir.getAbsolutePath().startsWith(SharedConfig.storageCacheDir)) { - path = dir; - break; - } - } - } - } - File oldDirectory = new File(path, "Telegram"); - hasOldFolder = oldDirectory.exists(); - } updateRows(); return true; } @@ -936,4 +911,21 @@ public class CacheControlActivity extends BaseFragment { arrayList.add(new ThemeDescription(bottomSheetView, 0, null, null, null, null, Theme.key_statisticChartLine_indigo)); return arrayList; } + + @Override + public void onRequestPermissionsResultFragment(int requestCode, String[] permissions, int[] grantResults) { + if (requestCode == 4) { + boolean allGranted = true; + for (int a = 0; a < grantResults.length; a++) { + if (grantResults[a] != PackageManager.PERMISSION_GRANTED) { + allGranted = false; + break; + } + } +// if (allGranted && Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && FilesMigrationService.filesMigrationBottomSheet != null) { +// FilesMigrationService.filesMigrationBottomSheet.migrateOldFolder(); +// } + + } + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/AvailableReactionCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/AvailableReactionCell.java new file mode 100644 index 000000000..cd114d622 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/AvailableReactionCell.java @@ -0,0 +1,128 @@ +package org.telegram.ui.Cells; + +import android.content.Context; +import android.graphics.Canvas; +import android.text.TextUtils; +import android.util.TypedValue; +import android.view.Gravity; +import android.view.View; +import android.widget.FrameLayout; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.DocumentObject; +import org.telegram.messenger.ImageLocation; +import org.telegram.messenger.LocaleController; +import org.telegram.messenger.SvgHelper; +import org.telegram.tgnet.TLRPC; +import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.Components.BackupImageView; +import org.telegram.ui.Components.CheckBox2; +import org.telegram.ui.Components.LayoutHelper; +import org.telegram.ui.Components.Switch; + +public class AvailableReactionCell extends FrameLayout { + private TextView textView; + private BackupImageView imageView; + private Switch switchView; + private CheckBox2 checkBox; + private View overlaySelectorView; + public TLRPC.TL_availableReaction react; + + public AvailableReactionCell(@NonNull Context context, boolean checkbox) { + super(context); + + textView = new TextView(context); + textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); + textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); + textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); + textView.setLines(1); + textView.setMaxLines(1); + textView.setSingleLine(true); + textView.setEllipsize(TextUtils.TruncateAt.END); + textView.setGravity(LayoutHelper.getAbsoluteGravityStart() | Gravity.CENTER_VERTICAL); + addView(textView, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.CENTER_VERTICAL, 81, 0, 91, 0)); + + imageView = new BackupImageView(context); + imageView.setAspectFit(true); + imageView.setLayerNum(1); + addView(imageView, LayoutHelper.createFrameRelatively(32, 32, Gravity.START | Gravity.CENTER_VERTICAL, 23, 0, 0, 0)); + + if (checkbox) { + checkBox = new CheckBox2(context, 26, null); + checkBox.setDrawUnchecked(false); + checkBox.setColor(null, null, Theme.key_radioBackgroundChecked); + checkBox.setDrawBackgroundAsArc(-1); + addView(checkBox, LayoutHelper.createFrameRelatively(26, 26, Gravity.END | Gravity.CENTER_VERTICAL, 0, 0, 22, 0)); + } else { + switchView = new Switch(context); + switchView.setColors(Theme.key_switchTrack, Theme.key_switchTrackChecked, Theme.key_switchTrackBlueThumb, Theme.key_switchTrackBlueThumbChecked); + addView(switchView, LayoutHelper.createFrameRelatively(37, 20, Gravity.END | Gravity.CENTER_VERTICAL, 0, 0, 22, 0)); + } + overlaySelectorView = new View(context); + overlaySelectorView.setBackground(Theme.getSelectorDrawable(false)); + addView(overlaySelectorView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); + setWillNotDraw(false); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec((int) (AndroidUtilities.dp(58) + Theme.dividerPaint.getStrokeWidth()), MeasureSpec.EXACTLY)); + } + + /** + * Binds reaction to the view + * @param react Reaction to bind + * @param checked If view should be checked + */ + public void bind(TLRPC.TL_availableReaction react, boolean checked) { + boolean animated = false; + if (react != null && this.react != null && react.reaction.equals(this.react.reaction)) { + animated = true; + } + this.react = react; + textView.setText(react.title); + SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(react.static_icon, Theme.key_windowBackgroundGray, 1.0f); + imageView.setImage(ImageLocation.getForDocument(react.static_icon), "50_50", "webp", svgThumb, react); + setChecked(checked, animated); + } + + /** + * Sets view checked + * @param checked If checked or not + */ + public void setChecked(boolean checked) { + setChecked(checked, false); + } + + /** + * Sets view checked + * @param checked If checked or not + * @param animated If we should animate change + */ + public void setChecked(boolean checked, boolean animated) { + if (switchView != null) { + switchView.setChecked(checked, animated); + } + if (checkBox != null) { + checkBox.setChecked(checked, animated); + } + } + + @Override + protected void onDraw(Canvas canvas) { + canvas.drawColor(Theme.getColor(Theme.key_windowBackgroundWhite)); + float w = Theme.dividerPaint.getStrokeWidth(); + int l = 0, r = 0; + int pad = AndroidUtilities.dp(81); + if (LocaleController.isRTL) { + r = pad; + } else { + l = pad; + } + + canvas.drawLine(getPaddingLeft() + l, getHeight() - w, getWidth() - getPaddingRight() - r, getHeight() - w, Theme.dividerPaint); + } +} \ No newline at end of file diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatActionCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatActionCell.java index 78dd6fcaf..0d6a16e08 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatActionCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatActionCell.java @@ -34,6 +34,7 @@ import org.telegram.messenger.ImageLocation; import org.telegram.messenger.ImageReceiver; import org.telegram.messenger.LocaleController; import org.telegram.messenger.MessageObject; +import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; import org.telegram.messenger.SharedConfig; import org.telegram.messenger.UserConfig; @@ -43,11 +44,28 @@ import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Components.AvatarDrawable; import org.telegram.ui.Components.URLSpanNoUnderline; +import org.telegram.ui.Components.spoilers.SpoilerEffect; import org.telegram.ui.PhotoViewer; import java.util.ArrayList; +import java.util.List; +import java.util.Stack; -public class ChatActionCell extends BaseCell implements DownloadController.FileDownloadProgressListener { +public class ChatActionCell extends BaseCell implements DownloadController.FileDownloadProgressListener, NotificationCenter.NotificationCenterDelegate { + + @Override + public void didReceivedNotification(int id, int account, Object... args) { + if (id == NotificationCenter.startSpoilers) { + setSpoilersSuppressed(false); + } else if (id == NotificationCenter.stopSpoilers) { + setSpoilersSuppressed(true); + } + } + + public void setSpoilersSuppressed(boolean s) { + for (SpoilerEffect eff : spoilers) + eff.setSuppressUpdates(s); + } private boolean canDrawInParent; @@ -92,6 +110,9 @@ public class ChatActionCell extends BaseCell implements DownloadController.FileD private int previousWidth; private boolean imagePressed; + public List spoilers = new ArrayList<>(); + private Stack spoilersPool = new Stack<>(); + TextPaint textPaint; private float viewTop; @@ -407,6 +428,12 @@ public class ChatActionCell extends BaseCell implements DownloadController.FileD int maxWidth = width - AndroidUtilities.dp(30); invalidatePath = true; textLayout = new StaticLayout(text, (TextPaint) getThemedPaint(Theme.key_paint_chatActionText), maxWidth, Layout.Alignment.ALIGN_CENTER, 1.0f, 0.0f, false); + + spoilersPool.addAll(spoilers); + spoilers.clear(); + if (text instanceof Spannable) + SpoilerEffect.addSpoilers(this, textLayout, (Spannable) text, spoilersPool, spoilers); + textHeight = 0; textWidth = 0; try { @@ -494,8 +521,17 @@ public class ChatActionCell extends BaseCell implements DownloadController.FileD if (textLayout.getPaint() != textPaint) { buildLayout(); } + canvas.save(); + SpoilerEffect.clipOutCanvas(canvas, spoilers); textLayout.draw(canvas); canvas.restore(); + + for (SpoilerEffect eff : spoilers) { + eff.setColor(textLayout.getPaint().getColor()); + eff.draw(canvas); + } + + canvas.restore(); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java index 281ac9c1a..0b4cb585b 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java @@ -88,6 +88,7 @@ import org.telegram.messenger.MediaController; import org.telegram.messenger.MediaDataController; import org.telegram.messenger.MessageObject; import org.telegram.messenger.MessagesController; +import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; import org.telegram.messenger.SendMessagesHelper; import org.telegram.messenger.SharedConfig; @@ -121,11 +122,14 @@ import org.telegram.ui.Components.MsgClockDrawable; import org.telegram.ui.Components.Point; import org.telegram.ui.Components.RLottieDrawable; import org.telegram.ui.Components.RadialProgress2; +import org.telegram.ui.Components.Reactions.ReactionsLayoutInBubble; +import org.telegram.ui.Components.RecyclerListView; import org.telegram.ui.Components.RoundVideoPlayingDrawable; import org.telegram.ui.Components.SeekBar; import org.telegram.ui.Components.SeekBarAccessibilityDelegate; import org.telegram.ui.Components.SeekBarWaveform; import org.telegram.ui.Components.SlotsDrawable; +import org.telegram.ui.Components.spoilers.SpoilerEffect; import org.telegram.ui.Components.StaticLayoutEx; import org.telegram.ui.Components.TextStyleSpan; import org.telegram.ui.Components.TimerParticles; @@ -144,11 +148,14 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; +import java.util.List; import java.util.Locale; +import java.util.Stack; +import java.util.concurrent.atomic.AtomicReference; import tw.nekomimi.nkmr.NekomuraConfig; -public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate, ImageReceiver.ImageReceiverDelegate, DownloadController.FileDownloadProgressListener, TextSelectionHelper.SelectableView { +public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate, ImageReceiver.ImageReceiverDelegate, DownloadController.FileDownloadProgressListener, TextSelectionHelper.SelectableView, NotificationCenter.NotificationCenterDelegate { public RadialProgress2 getRadialProgress() { return radialProgress; @@ -161,6 +168,82 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate invalidate(); } + public ReactionsLayoutInBubble.ReactionButton getReactionButton(String reaction) { + return reactionsLayoutInBubble.getReactionButton(reaction); + } + + // primary message for group + // contains caption, reactions etc for all group + public MessageObject getPrimaryMessageObject() { + MessageObject messageObject = null; + if (currentMessageObject != null && currentMessagesGroup != null && currentMessageObject.hasValidGroupId()) { + messageObject = currentMessagesGroup.findPrimaryMessageObject(); + } + if (messageObject != null) { + return messageObject; + } + return currentMessageObject; + } + + @Override + public void didReceivedNotification(int id, int account, Object... args) { + if (id == NotificationCenter.startSpoilers) { + setSpoilersSuppressed(false); + } else if (id == NotificationCenter.stopSpoilers) { + setSpoilersSuppressed(true); + } + } + + public void setSpoilersSuppressed(boolean s) { + for (SpoilerEffect eff : captionSpoilers) + eff.setSuppressUpdates(s); + for (SpoilerEffect eff : replySpoilers) + eff.setSuppressUpdates(s); + if (getMessageObject() != null && getMessageObject().textLayoutBlocks != null) { + for (MessageObject.TextLayoutBlock bl : getMessageObject().textLayoutBlocks) { + for (SpoilerEffect eff : bl.spoilers) { + eff.setSuppressUpdates(s); + } + } + } + } + + public boolean hasSpoilers() { + if (hasCaptionLayout() && !captionSpoilers.isEmpty() || replyTextLayout != null && !replySpoilers.isEmpty()) { + return true; + } + if (getMessageObject() != null && getMessageObject().textLayoutBlocks != null) { + for (MessageObject.TextLayoutBlock bl : getMessageObject().textLayoutBlocks) { + if (!bl.spoilers.isEmpty()) { + return true; + } + } + } + return false; + } + + private void updateSpoilersVisiblePart(int top, int bottom) { + if (hasCaptionLayout()) { + float off = -captionY; + for (SpoilerEffect eff : captionSpoilers) { + eff.setVisibleBounds(0, top + off, getWidth(), bottom + off); + } + } + if (replyTextLayout != null) { + float off = -replyStartY - replyTextLayout.getHeight(); + for (SpoilerEffect eff : replySpoilers) { + eff.setVisibleBounds(0, top + off, getWidth(), bottom + off); + } + } + if (getMessageObject() != null && getMessageObject().textLayoutBlocks != null) { + for (MessageObject.TextLayoutBlock bl : getMessageObject().textLayoutBlocks) { + for (SpoilerEffect eff : bl.spoilers) { + eff.setVisibleBounds(0, top - bl.textYOffset - textY, getWidth(), bottom - bl.textYOffset - textY); + } + } + } + } + public interface ChatMessageCellDelegate { default void didPressUserAvatar(ChatMessageCell cell, TLRPC.User user, float touchX, float touchY) { } @@ -212,7 +295,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate default void didPressBotButton(ChatMessageCell cell, TLRPC.KeyboardButton button) { } - default void didPressReaction(ChatMessageCell cell, TLRPC.TL_reactionCount reaction) { + default void didPressReaction(ChatMessageCell cell, TLRPC.TL_reactionCount reaction, boolean longpress) { } default void didPressVoteButtons(ChatMessageCell cell, ArrayList buttons, int showCount, int x, int y) { @@ -333,6 +416,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate private MessageObject.GroupedMessages currentMessagesGroup; private MessageObject.GroupedMessagePosition currentPosition; private boolean groupPhotoInvisible; + public final ReactionsLayoutInBubble reactionsLayoutInBubble = new ReactionsLayoutInBubble(this); + + private boolean invalidateSpoilersParent; private int textX; private int unmovedTextX; @@ -447,6 +533,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate private RectF instantButtonRect = new RectF(); private int[] pressedState = new int[]{android.R.attr.state_enabled, android.R.attr.state_pressed}; private float animatingLoadingProgressProgress; + CharSequence accessibilityText; private RoundVideoPlayingDrawable roundVideoPlayingDrawable; @@ -595,6 +682,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate private int widthForButtons; private int pressedBotButton; + private SpoilerEffect spoilerPressed; + private boolean isCaptionSpoilerPressed; + private boolean isSpoilerRevealing; + private MessageObject currentMessageObject; private MessageObject messageObjectToSet; private MessageObject.GroupedMessages groupedMessagesToSet; @@ -689,6 +780,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate public StaticLayout replyNameLayout; public StaticLayout replyTextLayout; + private AtomicReference spoilersPatchedReplyTextLayout = new AtomicReference<>(); public ImageReceiver replyImageReceiver; public int replyStartX; public int replyStartY; @@ -838,6 +930,15 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate private final Theme.ResourcesProvider resourcesProvider; private final boolean canDrawBackgroundInParent; + // Public for enter transition + public List replySpoilers = new ArrayList<>(); + private Stack replySpoilersPool = new Stack<>(); + private List captionSpoilers = new ArrayList<>(); + private Stack captionSpoilersPool = new Stack<>(); + private AtomicReference captionPatchedSpoilersLayout = new AtomicReference<>(); + private Path sPath = new Path(); + + // NekoX private boolean needHideMessage() { return currentMessageObject.messageOwner.hide || MessagesController.getInstance(currentAccount).blockePeers.indexOfKey(currentMessageObject.getFromChatId()) >= 0 && @@ -909,6 +1010,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } }; roundVideoPlayingDrawable = new RoundVideoPlayingDrawable(this, resourcesProvider); + setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES); } private void createPollUI() { @@ -2017,6 +2119,116 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate return result; } + private boolean checkSpoilersMotionEvent(MotionEvent event) { + if (isSpoilerRevealing) + return false; + + int x = (int) event.getX(); + int y = (int) event.getY(); + int act = event.getActionMasked(); + if (act == MotionEvent.ACTION_DOWN) { + if (x >= textX && y >= textY && x <= textX + currentMessageObject.textWidth && y <= textY + currentMessageObject.textHeight) { + List blocks = currentMessageObject.textLayoutBlocks; + for (int i = 0; i < blocks.size(); i++) { + if (blocks.get(i).textYOffset > y) { + break; + } + MessageObject.TextLayoutBlock block = blocks.get(i); + int offX = block.isRtl() ? (int) currentMessageObject.textXOffset : 0; + for (SpoilerEffect eff : block.spoilers) { + if (eff.getBounds().contains(x - textX + offX, (int) (y - textY - block.textYOffset))) { + spoilerPressed = eff; + isCaptionSpoilerPressed = false; + return true; + } + } + } + } + + if (hasCaptionLayout() && x >= captionX && y >= captionY && x <= captionX + captionLayout.getWidth() && y <= captionY + captionLayout.getHeight()) { + for (SpoilerEffect eff : captionSpoilers) { + if (eff.getBounds().contains((int)(x - captionX), (int)(y - captionY))) { + spoilerPressed = eff; + isCaptionSpoilerPressed = true; + return true; + } + } + } + } else if (act == MotionEvent.ACTION_UP && spoilerPressed != null) { + playSoundEffect(SoundEffectConstants.CLICK); + + sPath.rewind(); + if (isCaptionSpoilerPressed) { + for (SpoilerEffect eff : captionSpoilers) { + Rect b = eff.getBounds(); + sPath.addRect(b.left, b.top, b.right, b.bottom, Path.Direction.CW); + } + } else { + for (MessageObject.TextLayoutBlock block : currentMessageObject.textLayoutBlocks) { + for (SpoilerEffect eff : block.spoilers) { + Rect b = eff.getBounds(); + sPath.addRect(b.left, b.top + block.textYOffset, b.right, b.bottom + block.textYOffset, Path.Direction.CW); + } + } + } + sPath.computeBounds(rect, false); + float width = rect.width(), height = rect.height(); + float rad = (float) Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2)); + + isSpoilerRevealing = true; + spoilerPressed.setOnRippleEndCallback(()->post(()->{ + isSpoilerRevealing = false; + getMessageObject().isSpoilersRevealed = true; + if (isCaptionSpoilerPressed) { + captionSpoilers.clear(); + } else if (currentMessageObject.textLayoutBlocks != null) { + for (MessageObject.TextLayoutBlock block : currentMessageObject.textLayoutBlocks) { + block.spoilers.clear(); + } + } + invalidate(); + })); + if (isCaptionSpoilerPressed) { + for (SpoilerEffect eff : captionSpoilers) { + eff.startRipple(x - captionX, y - captionY, rad); + } + } else if (currentMessageObject.textLayoutBlocks != null) { + for (MessageObject.TextLayoutBlock block : currentMessageObject.textLayoutBlocks) { + int offX = block.isRtl() ? (int) currentMessageObject.textXOffset : 0; + for (SpoilerEffect eff : block.spoilers) { + eff.startRipple(x - textX + offX, y - block.textYOffset - textY, rad); + } + } + } + if (getParent() instanceof RecyclerListView) { + ViewGroup vg = (ViewGroup) getParent(); + for (int i = 0; i < vg.getChildCount(); i++) { + View ch = vg.getChildAt(i); + if (ch instanceof ChatMessageCell) { + ChatMessageCell cell = (ChatMessageCell) ch; + if (cell.getMessageObject() != null && cell.getMessageObject().getReplyMsgId() == getMessageObject().getId()) { + if (!cell.replySpoilers.isEmpty()) { + cell.replySpoilers.get(0).setOnRippleEndCallback(()->post(()->{ + cell.getMessageObject().replyMessageObject.isSpoilersRevealed = true; + cell.replySpoilers.clear(); + cell.invalidate(); + })); + for (SpoilerEffect eff : cell.replySpoilers) { + eff.startRipple(eff.getBounds().centerX(), eff.getBounds().centerY(), rad); + } + } + } + } + } + } + + spoilerPressed = null; + return true; + } + + return false; + } + private boolean checkBotButtonMotionEvent(MotionEvent event) { if (botButtons.isEmpty() || currentMessageObject.eventId != 0) { return false; @@ -2053,8 +2265,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate BotButton button = botButtons.get(pressedBotButton); if (button.button != null) { delegate.didPressBotButton(this, button.button); - } else if (button.reaction != null) { - delegate.didPressReaction(this, button.reaction); } } pressedBotButton = -1; @@ -2080,6 +2290,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate return true; } + if (chekReactionsTouchEvent(event)) { + return true; + } + if (videoPlayerRewinder != null && videoPlayerRewinder.rewindCount > 0) { if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL) { getParent().requestDisallowInterceptTouchEvent(false); @@ -2094,8 +2308,11 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate lastTouchY = event.getY(); backgroundDrawable.setTouchCoords(lastTouchX, lastTouchY); - boolean result = checkTextBlockMotionEvent(event); + boolean result = checkSpoilersMotionEvent(event); + if (!result) { + result = checkTextBlockMotionEvent(event); + } if (!result) { result = checkPinchToZoom(event); } @@ -2137,6 +2354,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } if (event.getAction() == MotionEvent.ACTION_CANCEL) { + spoilerPressed = null; + isCaptionSpoilerPressed = false; buttonPressed = 0; miniButtonPressed = 0; pressedBotButton = -1; @@ -2365,6 +2584,34 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate return result; } + private boolean chekReactionsTouchEvent(MotionEvent event) { + if (currentMessageObject.hasValidGroupId() && currentMessagesGroup != null && !currentMessagesGroup.isDocuments) { + ViewGroup parent = (ViewGroup) getParent(); + for (int i = 0; i < parent.getChildCount(); i++) { + View v = parent.getChildAt(i); + if (v instanceof ChatMessageCell) { + ChatMessageCell cell = (ChatMessageCell) v; + MessageObject.GroupedMessages group = cell.getCurrentMessagesGroup(); + MessageObject.GroupedMessagePosition position = cell.getCurrentPosition(); + if (group != null && group.groupId == currentMessagesGroup.groupId && + (position.flags & MessageObject.POSITION_FLAG_BOTTOM) != 0 && + (position.flags & MessageObject.POSITION_FLAG_LEFT) != 0) { + if (cell == this) { + return reactionsLayoutInBubble.chekTouchEvent(event); + } else { + event.offsetLocation(this.getLeft() - cell.getLeft(), this.getTop() - cell.getTop()); + boolean result = cell.reactionsLayoutInBubble.chekTouchEvent(event); + event.offsetLocation(-(this.getLeft() - cell.getLeft()), -(this.getTop() - cell.getTop())); + return result; + } + } + } + } + return false; + } + return reactionsLayoutInBubble.chekTouchEvent(event); + } + private boolean checkPinchToZoom(MotionEvent ev) { PinchToZoomHelper pinchToZoomHelper = delegate == null ? null : delegate.getPinchToZoomHelper(); @@ -2599,6 +2846,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate parentHeight = parentH; backgroundHeight = parentH; viewTop = visibleTop; + if (parent != parentHeight || parentOffset != this.parentViewTopOffset) { this.parentViewTopOffset = parentOffset; parentHeight = parent; @@ -2824,6 +3072,15 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate return null; } + private void updateCaptionSpoilers() { + captionSpoilersPool.addAll(captionSpoilers); + captionSpoilers.clear(); + + if (captionLayout != null && !getMessageObject().isSpoilersRevealed) { + SpoilerEffect.addSpoilers(this, captionLayout, captionSpoilersPool, captionSpoilers); + } + } + private boolean isUserDataChanged() { if (currentMessageObject != null && (!hasLinkPreview && currentMessageObject.messageOwner.media != null && currentMessageObject.messageOwner.media.webpage instanceof TLRPC.TL_webPage)) { return true; @@ -2927,6 +3184,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); + + NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.startSpoilers); + NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.stopSpoilers); + cancelShakeAnimation(); if (animationRunning) { return; @@ -2978,6 +3239,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate statusDrawableAnimator.removeAllListeners(); statusDrawableAnimator.cancel(); } + reactionsLayoutInBubble.onDetachFromWindow(); statusDrawableAnimationInProgress = false; } @@ -2985,6 +3247,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate public void onAttachedToWindow() { super.onAttachedToWindow(); + NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.startSpoilers); + NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.stopSpoilers); + if (currentMessageObject != null) { currentMessageObject.animateComments = false; } @@ -3057,6 +3322,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate boolean showSeekbar = MediaController.getInstance().isPlayingMessage(currentMessageObject); toSeekBarProgress = showSeekbar ? 1f : 0f; } + reactionsLayoutInBubble.onAttachToWindow(); } private boolean lastTranslated; @@ -3079,6 +3345,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate newReply != lastReplyMessage; boolean groupChanged = groupedMessages != currentMessagesGroup; boolean pollChanged = false; + if (dataChanged || messageChanged || messageIdChanged) { + accessibilityText = null; + } if (drawCommentButton || drawSideButton == 3 && !((hasDiscussion && messageObject.isLinkedToChat(linkedChatId) || isRepliesChat) && (currentPosition == null || currentPosition.siblingHeights == null && (currentPosition.flags & MessageObject.POSITION_FLAG_BOTTOM) != 0 || currentPosition.siblingHeights != null && (currentPosition.flags & MessageObject.POSITION_FLAG_TOP) == 0))) { dataChanged = true; } @@ -3174,6 +3443,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate isThreadPost = isThreadChat && messageObject.messageOwner.fwd_from != null && messageObject.messageOwner.fwd_from.channel_post != 0; isAvatarVisible = !isThreadPost && isChat && !messageObject.isOutOwner() && messageObject.needDrawAvatar() && (currentPosition == null || currentPosition.edge); boolean drawAvatar = isChat && !isThreadPost && !messageObject.isOutOwner() && messageObject.needDrawAvatar(); + if (messageObject.customAvatarDrawable != null) { + isAvatarVisible = true; + drawAvatar = true; + } wasLayout = false; groupPhotoInvisible = false; animatingDrawVideoImageButton = 0; @@ -3229,6 +3502,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } } } + spoilerPressed = null; + isCaptionSpoilerPressed = false; + isSpoilerRevealing = false; linkPreviewPressed = false; buttonPressed = 0; additionalTimeOffsetY = 0; @@ -3299,7 +3575,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } int captionNewLine = 0; availableTimeWidth = 0; - lastReactions = messageObject.messageOwner.reactions; + photoImage.setForceLoading(false); photoImage.setNeedsQualityThumb(false); photoImage.setShouldGenerateQualityThumb(false); @@ -3308,6 +3584,16 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate photoImage.setMediaStartEndTime(-1, -1); boolean canChangeRadius = true; + if (currentPosition == null || ((currentPosition.flags & MessageObject.POSITION_FLAG_BOTTOM) != 0)) { + if (currentPosition != null) { + reactionsLayoutInBubble.setMessage(groupedMessages.findPrimaryMessageObject(), !messageObject.shouldDrawReactionsInLayout(), resourcesProvider); + } else { + reactionsLayoutInBubble.setMessage(messageObject, !messageObject.shouldDrawReactionsInLayout(), resourcesProvider); + } + } else { + reactionsLayoutInBubble.setMessage(null, false, resourcesProvider); + } + if (messageChanged) { firstVisibleBlockNum = 0; lastVisibleBlockNum = 0; @@ -3418,8 +3704,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate if (messageObject.type == 0) { drawForwardedName = !isRepliesChat; - int maxWidth; + if (drawAvatar) { if (AndroidUtilities.isTablet()) { maxWidth = AndroidUtilities.getMinTabletSide() - AndroidUtilities.dp(122); @@ -3604,6 +3890,22 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate backgroundWidth = messageObject.textWidth + getExtraTextX() * 2 + (hasGamePreview || hasInvoicePreview ? AndroidUtilities.dp(10) : 0); totalHeight = messageObject.textHeight + AndroidUtilities.dp(19.5f) + namesOffset; + + if (!reactionsLayoutInBubble.isSmall) { + reactionsLayoutInBubble.measure(maxWidth); + if (!reactionsLayoutInBubble.isEmpty) { + reactionsLayoutInBubble.totalHeight = reactionsLayoutInBubble.height + AndroidUtilities.dp(8); + if (reactionsLayoutInBubble.width > backgroundWidth) { + backgroundWidth = reactionsLayoutInBubble.width; + } + + if ((hasLinkPreview || hasInvoicePreview) && !drawInstantView) { + reactionsLayoutInBubble.totalHeight += AndroidUtilities.dp(6); + reactionsLayoutInBubble.positionOffsetY += AndroidUtilities.dp(3); + } + totalHeight += reactionsLayoutInBubble.totalHeight; + } + } if (drawPinnedTop) { namesOffset -= AndroidUtilities.dp(1); } @@ -4515,28 +4817,58 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } } } + if (!reactionsLayoutInBubble.isSmall) { + if (!reactionsLayoutInBubble.isEmpty) { + reactionsLayoutInBubble.measure(backgroundWidth - AndroidUtilities.dp(32)); + reactionsLayoutInBubble.totalHeight = reactionsLayoutInBubble.height + AndroidUtilities.dp(12); + reactionsLayoutInBubble.positionOffsetY += -AndroidUtilities.dp(4); + if (backgroundWidth - AndroidUtilities.dp(32) - reactionsLayoutInBubble.lastLineX < timeWidth) { + reactionsLayoutInBubble.totalHeight += AndroidUtilities.dp(12); + reactionsLayoutInBubble.positionOffsetY += -AndroidUtilities.dp(12); + } + totalHeight += reactionsLayoutInBubble.totalHeight; + } + } } else if (messageObject.type == 2) { drawForwardedName = !isRepliesChat; drawName = messageObject.isFromGroup() && messageObject.isSupergroup() || messageObject.isImportedForward() && messageObject.messageOwner.fwd_from.from_id == null; + int maxWidth; if (AndroidUtilities.isTablet()) { - backgroundWidth = Math.min(AndroidUtilities.getMinTabletSide() - AndroidUtilities.dp(drawAvatar ? 102 : 50), AndroidUtilities.dp(270)); + backgroundWidth = maxWidth = Math.min(AndroidUtilities.getMinTabletSide() - AndroidUtilities.dp(drawAvatar ? 102 : 50), AndroidUtilities.dp(270)); } else { - backgroundWidth = Math.min(getParentWidth() - AndroidUtilities.dp(drawAvatar ? 102 : 50), AndroidUtilities.dp(270)); + backgroundWidth = maxWidth = Math.min(getParentWidth() - AndroidUtilities.dp(drawAvatar ? 102 : 50), AndroidUtilities.dp(270)); } createDocumentLayout(backgroundWidth, messageObject); + setMessageObjectInternal(messageObject); totalHeight = AndroidUtilities.dp(70) + namesOffset; if (drawPinnedTop) { namesOffset -= AndroidUtilities.dp(1); } + if (!reactionsLayoutInBubble.isSmall) { + reactionsLayoutInBubble.measure(maxWidth - AndroidUtilities.dp(24)); + if (!reactionsLayoutInBubble.isEmpty) { + reactionsLayoutInBubble.totalHeight = reactionsLayoutInBubble.height + AndroidUtilities.dp(12); + measureTime(messageObject); + if (reactionsLayoutInBubble.width > backgroundWidth) { + backgroundWidth = reactionsLayoutInBubble.width; + } + if (reactionsLayoutInBubble.lastLineX + timeWidth + AndroidUtilities.dp(24) > backgroundWidth) { + reactionsLayoutInBubble.totalHeight += AndroidUtilities.dp(12); + reactionsLayoutInBubble.positionOffsetY -= AndroidUtilities.dp(12); + } + totalHeight += reactionsLayoutInBubble.totalHeight; + } + } } else if (messageObject.type == 14) { drawName = (messageObject.isFromGroup() && messageObject.isSupergroup() || messageObject.isImportedForward() && messageObject.messageOwner.fwd_from.from_id == null) && (currentPosition == null || (currentPosition.flags & MessageObject.POSITION_FLAG_TOP) != 0); + int maxWidth; if (AndroidUtilities.isTablet()) { - backgroundWidth = Math.min(AndroidUtilities.getMinTabletSide() - AndroidUtilities.dp(drawAvatar ? 102 : 50), AndroidUtilities.dp(270)); + backgroundWidth = maxWidth = Math.min(AndroidUtilities.getMinTabletSide() - AndroidUtilities.dp(drawAvatar ? 102 : 50), AndroidUtilities.dp(270)); } else { - backgroundWidth = Math.min(getParentWidth() - AndroidUtilities.dp(drawAvatar ? 102 : 50), AndroidUtilities.dp(270)); + backgroundWidth = maxWidth = Math.min(getParentWidth() - AndroidUtilities.dp(drawAvatar ? 102 : 50), AndroidUtilities.dp(270)); } createDocumentLayout(backgroundWidth, messageObject); @@ -4556,6 +4888,24 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate if (drawPinnedTop) { namesOffset -= AndroidUtilities.dp(1); } + if (!reactionsLayoutInBubble.isSmall) { + reactionsLayoutInBubble.measure(maxWidth - AndroidUtilities.dp(24)); + if (!reactionsLayoutInBubble.isEmpty) { + reactionsLayoutInBubble.totalHeight = reactionsLayoutInBubble.height + AndroidUtilities.dp(12); + measureTime(messageObject); + if (reactionsLayoutInBubble.width > backgroundWidth) { + backgroundWidth = reactionsLayoutInBubble.width; + } + if (reactionsLayoutInBubble.lastLineX + timeWidth + AndroidUtilities.dp(24) > backgroundWidth) { + reactionsLayoutInBubble.totalHeight += AndroidUtilities.dp(12); + reactionsLayoutInBubble.positionOffsetY -= AndroidUtilities.dp(12); + } + if (!messageObject.isRestrictedMessage && messageObject.caption != null) { + reactionsLayoutInBubble.positionOffsetY += AndroidUtilities.dp(14); + } + totalHeight += reactionsLayoutInBubble.totalHeight; + } + } } else if (messageObject.type == MessageObject.TYPE_POLL) { if (timerParticles == null) { timerParticles = new TimerParticles(); @@ -4841,11 +5191,22 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate instantTextWidth = Math.max(instantTextWidth, (int) Math.ceil(Theme.chat_instantViewPaint.measureText(str))); } int timeWidthTotal = timeWidth + (messageObject.isOutOwner() ? AndroidUtilities.dp(20) : 0) + getExtraTimeX(); - if (timeWidthTotal >= (backgroundWidth - AndroidUtilities.dp(76) - instantTextWidth) / 2) { + if (!reactionsLayoutInBubble.isSmall && reactionsLayoutInBubble.isEmpty && timeWidthTotal >= (backgroundWidth - AndroidUtilities.dp(76) - instantTextWidth) / 2) { totalHeight += AndroidUtilities.dp(18); insantTextNewLine = true; } } + if (!reactionsLayoutInBubble.isSmall) { + if (!reactionsLayoutInBubble.isEmpty) { + reactionsLayoutInBubble.measure(maxWidth); + totalHeight += reactionsLayoutInBubble.height + AndroidUtilities.dp(12); + int timeWidthTotal = timeWidth + (messageObject.isOutOwner() ? AndroidUtilities.dp(20) : 0) + getExtraTimeX(); + if (timeWidthTotal >= (backgroundWidth - AndroidUtilities.dp(24) - reactionsLayoutInBubble.lastLineX)) { + totalHeight += AndroidUtilities.dp(16); + reactionsLayoutInBubble.positionOffsetY -= AndroidUtilities.dp(16); + } + } + } } else { drawForwardedName = messageObject.messageOwner.fwd_from != null && !(messageObject.isAnyKindOfSticker() && messageObject.isDice()); if (!messageObject.isAnyKindOfSticker() && messageObject.type != MessageObject.TYPE_ROUND_VIDEO) { @@ -4888,11 +5249,12 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate int maxWidth = backgroundWidth - AndroidUtilities.dp(86 + 52); int widthForCaption = 0; createDocumentLayout(maxWidth, messageObject); + int width = backgroundWidth - AndroidUtilities.dp(31); + widthForCaption = width - AndroidUtilities.dp(10) - getExtraTextX() * 2; + if (!messageObject.isRestrictedMessage && !TextUtils.isEmpty(messageObject.caption)) { try { currentCaption = messageObject.caption; - int width = backgroundWidth - AndroidUtilities.dp(31); - widthForCaption = width - AndroidUtilities.dp(10) - getExtraTextX() * 2; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { captionLayout = StaticLayout.Builder.obtain(messageObject.caption, 0, messageObject.caption.length(), Theme.chat_msgTextPaint, widthForCaption) .setBreakStrategy(StaticLayout.BREAK_STRATEGY_HIGH_QUALITY) @@ -4902,6 +5264,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } else { captionLayout = new StaticLayout(messageObject.caption, Theme.chat_msgTextPaint, widthForCaption, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); } + updateCaptionSpoilers(); } catch (Exception e) { FileLog.e(e); } @@ -4925,7 +5288,12 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } } } - + if (!reactionsLayoutInBubble.isSmall) { + reactionsLayoutInBubble.measure(widthForCaption); + if (!reactionsLayoutInBubble.isEmpty && reactionsLayoutInBubble.width + AndroidUtilities.dp(31) > maxTextWidth) { + maxTextWidth = reactionsLayoutInBubble.width + AndroidUtilities.dp(31); + } + } if (maxTextWidth > 0 && currentPosition == null) { backgroundWidth = maxTextWidth; maxWidth = maxTextWidth - AndroidUtilities.dp(31); @@ -4945,13 +5313,25 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate int lineCount = infoLayout.getLineCount(); measureTime(messageObject); int timeLeft = backgroundWidth - AndroidUtilities.dp(40 + 18 + 56 + 8) - infoWidth; - if (timeLeft < timeWidth) { + if (timeLeft < timeWidth && (reactionsLayoutInBubble.isSmall || reactionsLayoutInBubble.isEmpty)) { photoHeight += AndroidUtilities.dp(12); } else if (lineCount == 1) { photoHeight += AndroidUtilities.dp(4); } } } + if (!reactionsLayoutInBubble.isSmall && !reactionsLayoutInBubble.isEmpty) { + // reactionsLayoutInBubble.positionOffsetY += AndroidUtilities.dp(12); + reactionsLayoutInBubble.totalHeight = reactionsLayoutInBubble.height + AndroidUtilities.dp(8); + measureTime(messageObject); + int timeLeft = backgroundWidth - reactionsLayoutInBubble.lastLineX - AndroidUtilities.dp(24); + + if (timeLeft < timeWidth) { + reactionsLayoutInBubble.totalHeight += AndroidUtilities.dp(12); + reactionsLayoutInBubble.positionOffsetY -= AndroidUtilities.dp(12); + } + additionHeight += reactionsLayoutInBubble.totalHeight; + } } else if (messageObject.type == 4) { //geo TLRPC.GeoPoint point = messageObject.messageOwner.media.geo; double lat = point.lat; @@ -5109,6 +5489,16 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate photoImage.setImage(currentUrl, null, null, null, 0); } } + if (!reactionsLayoutInBubble.isSmall) { + reactionsLayoutInBubble.measure(backgroundWidth - AndroidUtilities.dp(16)); + reactionsLayoutInBubble.totalHeight = reactionsLayoutInBubble.height + AndroidUtilities.dp(14); + measureTime(messageObject); + if (reactionsLayoutInBubble.lastLineX + timeWidth + AndroidUtilities.dp(24) > backgroundWidth) { + reactionsLayoutInBubble.totalHeight += AndroidUtilities.dp(12); + reactionsLayoutInBubble.positionOffsetY -= AndroidUtilities.dp(12); + } + additionHeight += reactionsLayoutInBubble.totalHeight; + } } else if (messageObject.isAnyKindOfSticker()) { drawBackground = false; boolean isWebpSticker = messageObject.type == MessageObject.TYPE_STICKER; @@ -5124,11 +5514,13 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate photoWidth = photoHeight = 512; } float maxHeight; - float maxWidth; + int maxWidth; if (AndroidUtilities.isTablet()) { - maxHeight = maxWidth = AndroidUtilities.getMinTabletSide() * (0.4f + (NekomuraConfig.stickerSize.Float() - 14.0f) / 40); + maxHeight = AndroidUtilities.getMinTabletSide() * (0.4f + (NekomuraConfig.stickerSize.Float() - 14.0f) / 40); + maxWidth = (int) maxHeight; } else { - maxHeight = maxWidth = Math.min(getParentWidth(), AndroidUtilities.displaySize.y) * (0.5f + (NekomuraConfig.stickerSize.Float() - 14.0f) / 30); + maxHeight = Math.min(getParentWidth(), AndroidUtilities.displaySize.y) * (0.5f + (NekomuraConfig.stickerSize.Float() - 14.0f) / 30); + maxWidth = (int) maxHeight; } String filter; if (messageObject.isAnimatedEmoji() || messageObject.isDice()) { @@ -5140,7 +5532,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate photoHeight = (int) maxHeight; photoWidth = photoHeight + AndroidUtilities.dp(100); } - photoHeight *= maxWidth / photoWidth; + photoHeight *= maxWidth / (float) photoWidth; photoWidth = (int) maxWidth; if (photoHeight > maxHeight) { photoWidth *= maxHeight / photoHeight; @@ -5207,6 +5599,12 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate if (messageObject.useCustomPhoto) { photoImage.setImageBitmap(getResources().getDrawable(R.drawable.sticker)); } + if (!reactionsLayoutInBubble.isSmall) { + reactionsLayoutInBubble.measure(maxWidth); + reactionsLayoutInBubble.drawServiceShaderBackground = true; + additionHeight += reactionsLayoutInBubble.height + AndroidUtilities.dp(8); + reactionsLayoutInBubble.positionOffsetY += AndroidUtilities.dp(4); + } } else { currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, AndroidUtilities.getPhotoSize()); photoParentObject = messageObject.photoThumbsObject; @@ -5499,7 +5897,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } else { minCaptionWidth = (int) (Math.min(getParentWidth(), AndroidUtilities.displaySize.y) * 0.65f); } - if (!messageObject.needDrawBluredPreview() && currentCaption != null && photoWidth < minCaptionWidth) { + if (!messageObject.needDrawBluredPreview() && (currentCaption != null || (!reactionsLayoutInBubble.isEmpty && !reactionsLayoutInBubble.isSmall) && photoWidth < minCaptionWidth)) { widthForCaption = minCaptionWidth; fixPhotoWidth = true; } else { @@ -5524,6 +5922,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } else { captionLayout = new StaticLayout(currentCaption, Theme.chat_msgTextPaint, widthForCaption, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); } + updateCaptionSpoilers(); int lineCount = captionLayout.getLineCount(); if (lineCount > 0) { if (fixPhotoWidth) { @@ -5547,19 +5946,62 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate additionHeight += addedCaptionHeight; int widthToCheck = Math.max(captionWidth, photoWidth - AndroidUtilities.dp(10)); float lastLineWidth = captionLayout.getLineWidth(captionLayout.getLineCount() - 1) + captionLayout.getLineLeft(captionLayout.getLineCount() - 1); - if (!shouldDrawTimeOnMedia() && widthToCheck + AndroidUtilities.dp(2) - lastLineWidth < timeWidthTotal + getExtraTimeX()) { + if ((reactionsLayoutInBubble.isEmpty || reactionsLayoutInBubble.isSmall) && !shouldDrawTimeOnMedia() && widthToCheck + AndroidUtilities.dp(2) - lastLineWidth < timeWidthTotal + getExtraTimeX()) { additionHeight += AndroidUtilities.dp(14); addedCaptionHeight += AndroidUtilities.dp(14); captionNewLine = 1; } } else { captionLayout = null; + updateCaptionSpoilers(); } } } catch (Exception e) { FileLog.e(e); } } + if (!reactionsLayoutInBubble.isSmall) { + boolean useBackgroundWidth = backgroundWidth - AndroidUtilities.dp(24) > widthForCaption; + int maxWidth = Math.max(backgroundWidth - AndroidUtilities.dp(24), widthForCaption); + reactionsLayoutInBubble.measure(maxWidth); + if (!reactionsLayoutInBubble.isEmpty) { + if (shouldDrawTimeOnMedia()) { + reactionsLayoutInBubble.drawServiceShaderBackground = true; + } + int heightLocal = reactionsLayoutInBubble.height; + if (captionLayout == null) { + heightLocal += AndroidUtilities.dp(12); + heightLocal += AndroidUtilities.dp(4); + } else { + heightLocal += AndroidUtilities.dp(12); + reactionsLayoutInBubble.positionOffsetY += AndroidUtilities.dp(12); + } + reactionsLayoutInBubble.totalHeight = heightLocal; + additionHeight += reactionsLayoutInBubble.totalHeight; + + if (!shouldDrawTimeOnMedia()) { + + int widthToCheck = Math.min(maxWidth, reactionsLayoutInBubble.width + timeWidthTotal + getExtraTimeX() + AndroidUtilities.dp(2)); + float lastLineWidth = reactionsLayoutInBubble.lastLineX; + if (!shouldDrawTimeOnMedia() && widthToCheck - lastLineWidth < timeWidthTotal + getExtraTimeX()) { + additionHeight += AndroidUtilities.dp(14); + reactionsLayoutInBubble.totalHeight += AndroidUtilities.dp(14); + reactionsLayoutInBubble.positionOffsetY -= AndroidUtilities.dp(14); + captionNewLine = 1; + if (!useBackgroundWidth && captionWidth < reactionsLayoutInBubble.width) { + captionWidth = reactionsLayoutInBubble.width; + } + } else if (!useBackgroundWidth) { + if (reactionsLayoutInBubble.lastLineX + timeWidthTotal > captionWidth) { + captionWidth = reactionsLayoutInBubble.lastLineX + timeWidthTotal; + } + if (reactionsLayoutInBubble.width > captionWidth) { + captionWidth = reactionsLayoutInBubble.width; + } + } + } + } + } int minWidth = (int) (Theme.chat_infoPaint.measureText("100%") + AndroidUtilities.dp(100/*48*/)/* + timeWidth*/); if (currentMessagesGroup == null && (documentAttachType == DOCUMENT_ATTACH_TYPE_VIDEO || documentAttachType == DOCUMENT_ATTACH_TYPE_GIF) && photoWidth < minWidth) { @@ -5796,6 +6238,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate invalidate(); } + // if ((currentPosition == null || currentMessageObject.isMusic() || currentMessageObject.isDocument()) && !messageObject.isAnyKindOfSticker() && addedCaptionHeight == 0) { if (!messageObject.isRestrictedMessage && captionLayout == null && messageObject.caption != null) { try { @@ -5811,6 +6254,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } else { captionLayout = new StaticLayout(messageObject.caption, Theme.chat_msgTextPaint, widthForCaption, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); } + updateCaptionSpoilers(); } catch (Exception e) { FileLog.e(e); } @@ -5926,7 +6370,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate botButtonsByPosition.clear(); botButtonsLayout = null; } - if (!messageObject.isRestrictedMessage && currentPosition == null && (messageObject.messageOwner.reply_markup instanceof TLRPC.TL_replyInlineMarkup || messageObject.messageOwner.reactions != null && !messageObject.messageOwner.reactions.results.isEmpty())) { + if (!messageObject.isRestrictedMessage && currentPosition == null && (messageObject.messageOwner.reply_markup instanceof TLRPC.TL_replyInlineMarkup)) { int rows; if (messageObject.messageOwner.reply_markup instanceof TLRPC.TL_replyInlineMarkup) { @@ -6006,45 +6450,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } } } - } else { - int buttonsCount = messageObject.messageOwner.reactions.results.size(); - int buttonWidth = (widthForButtons - AndroidUtilities.dp(5) * (buttonsCount - 1) - AndroidUtilities.dp(2)) / buttonsCount; - for (int b = 0; b < buttonsCount; b++) { - TLRPC.TL_reactionCount reaction = messageObject.messageOwner.reactions.results.get(b); - BotButton botButton = new BotButton(); - botButton.reaction = reaction; - String key = reaction.reaction; - String position = 0 + "" + b; - BotButton oldButton; - if (oldByPosition != null) { - oldButton = oldByPosition.get(position); - } else { - oldButton = oldByData.get(key); - } - if (oldButton != null) { - botButton.progressAlpha = oldButton.progressAlpha; - botButton.angle = oldButton.angle; - botButton.lastUpdateTime = oldButton.lastUpdateTime; - } else { - botButton.lastUpdateTime = System.currentTimeMillis(); - } - botButtonsByData.put(key, botButton); - botButtonsByPosition.put(position, botButton); - botButton.x = b * (buttonWidth + AndroidUtilities.dp(5)); - botButton.y = AndroidUtilities.dp(5); - botButton.width = buttonWidth; - botButton.height = AndroidUtilities.dp(44); - - TextPaint botButtonPaint = (TextPaint) getThemedPaint(Theme.key_paint_chatBotButton); - CharSequence buttonText = Emoji.replaceEmoji(String.format("%d %s", reaction.count, reaction.reaction), botButtonPaint.getFontMetricsInt(), AndroidUtilities.dp(15), false); - buttonText = TextUtils.ellipsize(buttonText, botButtonPaint, buttonWidth - AndroidUtilities.dp(10), TextUtils.TruncateAt.END); - - botButton.title = new StaticLayout(buttonText, botButtonPaint, buttonWidth - AndroidUtilities.dp(10), Layout.Alignment.ALIGN_CENTER, 1.0f, 0.0f, false); - botButtons.add(botButton); - if (b == buttonsCount - 1) { - maxButtonsWidth = Math.max(maxButtonsWidth, botButton.x + botButton.width); - } - } } widthForButtons = maxButtonsWidth; } else { @@ -6399,6 +6804,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate invalidate(); } + public void setInvalidateSpoilersParent(boolean invalidateSpoilersParent) { + this.invalidateSpoilersParent = invalidateSpoilersParent; + } + public void setInvalidatesParent(boolean value) { invalidatesParent = value; } @@ -6684,17 +7093,25 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } private void calcBackgroundWidth(int maxWidth, int timeMore, int maxChildWidth) { - if (hasLinkPreview || hasOldCaptionPreview || hasGamePreview || hasInvoicePreview || maxWidth - currentMessageObject.lastLineWidth < timeMore || currentMessageObject.hasRtl) { + boolean newLineForTime; + int lastLineWidth = (reactionsLayoutInBubble.isEmpty || reactionsLayoutInBubble.isSmall) ? currentMessageObject.lastLineWidth : reactionsLayoutInBubble.lastLineX; + if (!reactionsLayoutInBubble.isEmpty && !reactionsLayoutInBubble.isSmall) { + newLineForTime = maxWidth - lastLineWidth < timeMore || currentMessageObject.hasRtl; + } else { + newLineForTime = hasLinkPreview || hasOldCaptionPreview || hasGamePreview || hasInvoicePreview || maxWidth - lastLineWidth < timeMore || currentMessageObject.hasRtl; + } + + if (newLineForTime) { totalHeight += AndroidUtilities.dp(14); hasNewLineForTime = true; - backgroundWidth = Math.max(maxChildWidth, currentMessageObject.lastLineWidth) + AndroidUtilities.dp(31); + backgroundWidth = Math.max(maxChildWidth, lastLineWidth) + AndroidUtilities.dp(31); backgroundWidth = Math.max(backgroundWidth, (currentMessageObject.isOutOwner() ? timeWidth + AndroidUtilities.dp(17) : timeWidth) + AndroidUtilities.dp(31)); } else { - int diff = maxChildWidth - getExtraTextX() - currentMessageObject.lastLineWidth; + int diff = maxChildWidth - getExtraTextX() - lastLineWidth; if (diff >= 0 && diff <= timeMore) { backgroundWidth = maxChildWidth + timeMore - diff + AndroidUtilities.dp(31); } else { - backgroundWidth = Math.max(maxChildWidth, currentMessageObject.lastLineWidth + timeMore) + AndroidUtilities.dp(31); + backgroundWidth = Math.max(maxChildWidth, lastLineWidth + timeMore) + AndroidUtilities.dp(31); } } } @@ -7463,10 +7880,16 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } private void drawContent(Canvas canvas) { - if (needNewVisiblePart && currentMessageObject.type == 0) { + boolean newPart = needNewVisiblePart && currentMessageObject.type == 0, hasSpoilers = hasSpoilers(); + if (newPart || hasSpoilers) { getLocalVisibleRect(scrollRect); - setVisiblePart(scrollRect.top, scrollRect.bottom - scrollRect.top, parentHeight, parentViewTopOffset, viewTop, parentWidth, backgroundHeight); - needNewVisiblePart = false; + if (hasSpoilers) { + updateSpoilersVisiblePart(scrollRect.top, scrollRect.bottom); + } + if (newPart) { + setVisiblePart(scrollRect.top, scrollRect.bottom - scrollRect.top, parentHeight, parentViewTopOffset, viewTop, parentWidth, backgroundHeight); + needNewVisiblePart = false; + } } float buttonX = this.buttonX; @@ -7843,7 +8266,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate if (captionLayout != null) { updateCaptionLayout(); } - if (!currentMessageObject.preview && (currentPosition == null || currentMessagesGroup != null && currentMessagesGroup.isDocuments) && !transitionParams.transformGroupToSingleMessage && !(enterTransitionInPorgress && currentMessageObject.isVoice())) { + updateReactionLayoutPosition(); + if (!currentMessageObject.preview && (currentPosition == null || currentMessagesGroup != null && currentMessagesGroup.isDocuments) && !transitionParams.animateBackgroundBoundsInner && !(enterTransitionInPorgress && currentMessageObject.isVoice())) { drawCaptionLayout(canvas, false, 1f); } @@ -8019,6 +8443,49 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate transitionParams.recordDrawingState(); } + private void updateReactionLayoutPosition() { + if (!reactionsLayoutInBubble.isEmpty && (currentPosition == null || ((currentPosition.flags & MessageObject.POSITION_FLAG_BOTTOM) != 0 && (currentPosition.flags & MessageObject.POSITION_FLAG_LEFT) != 0)) && !reactionsLayoutInBubble.isSmall) { + if (currentMessageObject.isOutOwner()) { + reactionsLayoutInBubble.x = getCurrentBackgroundLeft() + AndroidUtilities.dp(11); + } else { + reactionsLayoutInBubble.x = getCurrentBackgroundLeft() + AndroidUtilities.dp(!mediaBackground && drawPinnedBottom ? 11 : 17); + if (mediaBackground) { + reactionsLayoutInBubble.x -= AndroidUtilities.dp(9); + } + } + reactionsLayoutInBubble.y = getBackgroundDrawableBottom() - AndroidUtilities.dp(10) - reactionsLayoutInBubble.height; + reactionsLayoutInBubble.y -= (drawCommentButton ? AndroidUtilities.dp(43) : 0); + if (hasNewLineForTime) { + reactionsLayoutInBubble.y -= AndroidUtilities.dp(16); + } + if (captionLayout != null) { + reactionsLayoutInBubble.y -= AndroidUtilities.dp(14); + } + if (!botButtons.isEmpty() && currentMessageObject.type == 9) { + reactionsLayoutInBubble.y += AndroidUtilities.dp(10); + } + reactionsLayoutInBubble.y = reactionsLayoutInBubble.y + reactionsLayoutInBubble.positionOffsetY; + } + if (reactionsLayoutInBubble.isSmall && !reactionsLayoutInBubble.isEmpty) { + int timeYOffset; + if (shouldDrawTimeOnMedia()) { + timeYOffset = -(drawCommentButton ? AndroidUtilities.dp(41.3f) : 0); + } else { + if (currentMessageObject.isSponsored()) { + timeYOffset = -AndroidUtilities.dp(48); + if (hasNewLineForTime) { + timeYOffset -= AndroidUtilities.dp(16); + } + } else { + timeYOffset = -(drawCommentButton ? AndroidUtilities.dp(43) : 0); + } + } + reactionsLayoutInBubble.y = (int) (shouldDrawTimeOnMedia() ? photoImage.getImageY2() + additionalTimeOffsetY - AndroidUtilities.dp(7.3f) - timeLayout.getHeight() : layoutHeight - AndroidUtilities.dp(pinnedBottom || pinnedTop ? 7.5f : 6.5f) - timeLayout.getHeight() + timeYOffset); + reactionsLayoutInBubble.y += timeLayout.getHeight() / 2f - AndroidUtilities.dp(7); + reactionsLayoutInBubble.x = (int) timeX; + } + } + public void drawLinkPreview(Canvas canvas, float alpha) { if (!currentMessageObject.isSponsored() && !hasLinkPreview && !hasGamePreview && !hasInvoicePreview) { return; @@ -8488,6 +8955,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate restore = canvas.saveLayerAlpha(rect, (int) (alpha * 255), Canvas.ALL_SAVE_FLAG); } } + int spoilersColor = currentMessageObject.isOut() && !ChatObject.isChannelAndNotMegaGroup(currentMessageObject.getChatId(), currentAccount) ? getThemedColor(Theme.key_chat_outTimeText) : Theme.chat_msgTextPaint.getColor(); for (int a = firstVisibleBlockNum; a <= lastVisibleBlockNum; a++) { if (a >= textLayoutBlocks.size()) { break; @@ -8511,7 +8979,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } try { Emoji.emojiDrawingYOffset = -transitionYOffsetForDrawables; - block.textLayout.draw(canvas); + SpoilerEffect.renderWithRipple(this, invalidateSpoilersParent, spoilersColor, 0, block.spoilersPatchedTextLayout, block.textLayout, block.spoilers, canvas); Emoji.emojiDrawingYOffset = 0; } catch (Exception e) { FileLog.e(e); @@ -8555,6 +9023,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate if (drawCommentButton && drawSideButton != 3) { captionY -= AndroidUtilities.dp(shouldDrawTimeOnMedia() ? 41.3f : 43); } + if (!reactionsLayoutInBubble.isEmpty && !reactionsLayoutInBubble.isSmall) { + captionY -= reactionsLayoutInBubble.totalHeight; + } } captionX += getExtraTextX(); } @@ -9665,6 +10136,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate timeWidth += AndroidUtilities.dp(18); } } + if (reactionsLayoutInBubble.isSmall) { + reactionsLayoutInBubble.measure(Integer.MAX_VALUE); + timeWidth += reactionsLayoutInBubble.width; + } if (signString != null) { if (availableTimeWidth == 0) { availableTimeWidth = AndroidUtilities.dp(1000); @@ -9771,7 +10246,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate updateCurrentUserAndChat(); if (isAvatarVisible) { - if (currentUser != null) { + if (messageObject.customAvatarDrawable != null) { + avatarImage.setImageBitmap(messageObject.customAvatarDrawable); + } else if (currentUser != null) { if (currentUser.photo != null) { currentPhoto = currentUser.photo.photo_small; } else { @@ -9848,7 +10325,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate adminWidth = 0; } - if (needAuthorName) { + if (messageObject.customName != null) { + currentNameString = messageObject.customName; + } else if (needAuthorName) { currentNameString = getAuthorName(); } else { currentNameString = ""; @@ -10095,6 +10574,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate mess = mess.replace('\n', ' '); stringFinalText = Emoji.replaceEmoji(mess, Theme.chat_replyTextPaint.getFontMetricsInt(), AndroidUtilities.dp(14), false); stringFinalText = TextUtils.ellipsize(stringFinalText, Theme.chat_replyTextPaint, maxWidth, TextUtils.TruncateAt.END); + if (stringFinalText instanceof Spannable) { + MediaDataController.addTextStyleRuns(messageObject.replyMessageObject.messageOwner.entities, messageObject.replyMessageObject.caption, (Spannable) stringFinalText); + } } else if (messageObject.replyMessageObject.messageText != null && messageObject.replyMessageObject.messageText.length() > 0) { String mess = messageObject.replyMessageObject.messageText.toString(); if (mess.length() > 150) { @@ -10103,6 +10585,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate mess = mess.replace('\n', ' '); stringFinalText = Emoji.replaceEmoji(mess, Theme.chat_replyTextPaint.getFontMetricsInt(), AndroidUtilities.dp(14), false); stringFinalText = TextUtils.ellipsize(stringFinalText, Theme.chat_replyTextPaint, maxWidth, TextUtils.TruncateAt.END); + if (stringFinalText instanceof Spannable) { + MediaDataController.addTextStyleRuns(messageObject.replyMessageObject, (Spannable) stringFinalText); + } } } else { replyImageReceiver.setImageBitmap((Drawable) null); @@ -10163,11 +10648,20 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate try { replyTextWidth = AndroidUtilities.dp(4 + (needReplyImage ? 44 : 0)); if (stringFinalText != null) { - replyTextLayout = new StaticLayout(stringFinalText, Theme.chat_replyTextPaint, maxWidth + AndroidUtilities.dp(10), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); + SpannableStringBuilder sb = new SpannableStringBuilder(stringFinalText); + for (TextStyleSpan span : sb.getSpans(0, sb.length(), TextStyleSpan.class)) { + if ((span.getTextStyleRun().flags & TextStyleSpan.FLAG_STYLE_MONO) != 0) { + sb.removeSpan(span); + } + } + replyTextLayout = new StaticLayout(sb, Theme.chat_replyTextPaint, maxWidth + AndroidUtilities.dp(10), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); if (replyTextLayout.getLineCount() > 0) { replyTextWidth += (int) Math.ceil(replyTextLayout.getLineWidth(0)) + AndroidUtilities.dp(8); replyTextOffset = (int) replyTextLayout.getLineLeft(0); } + replySpoilers.clear(); + if (getMessageObject().replyMessageObject != null && !getMessageObject().replyMessageObject.isSpoilersRevealed) + SpoilerEffect.addSpoilers(this, replyTextLayout, replySpoilersPool, replySpoilers); } } catch (Exception e) { FileLog.e(e); @@ -10232,6 +10726,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate if (drawCommentButton) { h += AndroidUtilities.dp(shouldDrawTimeOnMedia() ? 41.3f : 43); } + if (!reactionsLayoutInBubble.isEmpty && currentMessageObject.shouldDrawReactionsInLayout()) { + h += reactionsLayoutInBubble.totalHeight; + } return h; } @@ -10574,6 +11071,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate parent.invalidate(); } } + if (restore != Integer.MIN_VALUE) { canvas.restoreToCount(restore); } @@ -10990,7 +11488,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } public void drawOutboundsContent(Canvas canvas) { - if (transitionParams.animateBackgroundBoundsInner) { + if (transitionParams.animateBackgroundWidth) { if (!transitionParams.transitionBotButtons.isEmpty()) { drawBotButtons(canvas, transitionParams.transitionBotButtons, 1f - transitionParams.animateChangeProgress); } @@ -11523,12 +12021,13 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate if (replyTextLayout != null) { canvas.save(); canvas.translate(forwardNameX, replyStartY + AndroidUtilities.dp(19)); - replyTextLayout.draw(canvas); + + int spoilersColor = currentMessageObject.isOut() && !ChatObject.isChannelAndNotMegaGroup(currentMessageObject.getChatId(), currentAccount) ? getThemedColor(Theme.key_chat_outTimeText) : replyTextLayout.getPaint().getColor(); + SpoilerEffect.renderWithRipple(this, invalidateSpoilersParent, spoilersColor, -AndroidUtilities.dp(2), spoilersPatchedReplyTextLayout, replyTextLayout, replySpoilers, canvas); canvas.restore(); } } } - if (restore != Integer.MIN_VALUE) { canvas.restoreToCount(restore); } @@ -11542,6 +12041,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate return drawCommentButton; } + public StaticLayout getCaptionLayout() { return captionLayout; } @@ -11643,12 +12143,33 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } else { drawCaptionLayout(canvas, captionLayout, selectionOnly, alpha); } + + if ((currentPosition == null || ((currentPosition.flags & MessageObject.POSITION_FLAG_BOTTOM) != 0 && (currentPosition.flags & MessageObject.POSITION_FLAG_LEFT) != 0)) && !reactionsLayoutInBubble.isSmall) { + if (reactionsLayoutInBubble.drawServiceShaderBackground) { + applyServiceShaderMatrix(getMeasuredWidth(), backgroundHeight, getX(), viewTop); + } + if (reactionsLayoutInBubble.drawServiceShaderBackground || !transitionParams.animateBackgroundBoundsInner || currentPosition != null) { + reactionsLayoutInBubble.draw(canvas, transitionParams.animateChange ? transitionParams.animateChangeProgress : 1f); + } else { + canvas.save(); + canvas.clipRect(0, 0, getMeasuredWidth(), getBackgroundDrawableBottom() + transitionParams.deltaBottom); + reactionsLayoutInBubble.draw(canvas, transitionParams.animateChange ? transitionParams.animateChangeProgress : 1f); + canvas.restore(); + } + + } } private void drawCaptionLayout(Canvas canvas, StaticLayout captionLayout, boolean selectionOnly, float alpha) { if (currentBackgroundDrawable != null && drawCommentButton && timeLayout != null) { int x; - float y = layoutHeight - AndroidUtilities.dp(18) - timeLayout.getHeight(); + float y = layoutHeight + transitionParams.deltaBottom - AndroidUtilities.dp(18) - timeLayout.getHeight(); + if (currentMessagesGroup != null) { + y += currentMessagesGroup.transitionParams.offsetBottom; + if (currentMessagesGroup.transitionParams.backgroundChangeBounds) { + y -= getTranslationY(); + } + } if (mediaBackground) { x = backgroundDrawableLeft + AndroidUtilities.dp(12) + getExtraTextX(); } else { @@ -11722,13 +12243,20 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } } } - if (!mediaBackground || captionLayout != null) { + if (!mediaBackground || captionLayout != null || (!reactionsLayoutInBubble.isEmpty && !reactionsLayoutInBubble.isSmall)) { if (isDrawSelectionBackground()) { Theme.chat_replyLinePaint.setColor(getThemedColor(currentMessageObject.isOutOwner() ? Theme.key_chat_outVoiceSeekbarSelected : Theme.key_chat_inVoiceSeekbarSelected)); } else { Theme.chat_replyLinePaint.setColor(getThemedColor(currentMessageObject.isOutOwner() ? Theme.key_chat_outVoiceSeekbar : Theme.key_chat_inVoiceSeekbar)); } float ly = layoutHeight - AndroidUtilities.dp(45.1f - h2); + ly += transitionParams.deltaBottom; + if (currentMessagesGroup != null) { + ly += currentMessagesGroup.transitionParams.offsetBottom; + if (currentMessagesGroup.transitionParams.backgroundChangeBounds) { + ly -= getTranslationY(); + } + } canvas.drawLine(x, ly, endX - AndroidUtilities.dp(14), ly, Theme.chat_replyLinePaint); } if (commentLayout != null && drawSideButton != 3) { @@ -11888,25 +12416,20 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate float captionY = this.captionY; float captionX = this.captionX; - if (currentMessagesGroup != null && currentMessagesGroup.transitionParams.backgroundChangeBounds) { - if (!transitionParams.animateReplaceCaptionLayout) { + + if (transitionParams.animateBackgroundBoundsInner) { + if (transitionParams.transformGroupToSingleMessage) { captionY -= getTranslationY(); - } - captionX += currentMessagesGroup.transitionParams.offsetLeft; - } else { - if (transitionParams.animateBackgroundBoundsInner) { - if (transitionParams.transformGroupToSingleMessage) { - captionY -= getTranslationY(); - captionX += transitionParams.deltaLeft; - } else if (transitionParams.moveCaption) { - captionX = this.captionX * transitionParams.animateChangeProgress + transitionParams.captionFromX * (1f - transitionParams.animateChangeProgress); - captionY = this.captionY * transitionParams.animateChangeProgress + transitionParams.captionFromY * (1f - transitionParams.animateChangeProgress); - } else { - captionX += transitionParams.deltaLeft; - } + captionX += transitionParams.deltaLeft; + } else if (transitionParams.moveCaption) { + captionX = this.captionX * transitionParams.animateChangeProgress + transitionParams.captionFromX * (1f - transitionParams.animateChangeProgress); + captionY = this.captionY * transitionParams.animateChangeProgress + transitionParams.captionFromY * (1f - transitionParams.animateChangeProgress); + } else { + captionX += transitionParams.deltaLeft; } } + int restore = Integer.MIN_VALUE; if (renderingAlpha != 1.0f) { rect.set(captionX, captionY, captionX + captionLayout.getWidth(), captionY + captionLayout.getHeight()); @@ -11944,7 +12467,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate getDelegate().getTextSelectionHelper().drawCaption(currentMessageObject.isOutOwner(), captionLayout, canvas); } Emoji.emojiDrawingYOffset = -transitionYOffsetForDrawables; - captionLayout.draw(canvas); + + int spoilersColor = currentMessageObject.isOut() && !ChatObject.isChannelAndNotMegaGroup(currentMessageObject.getChatId(), currentAccount) ? getThemedColor(Theme.key_chat_outTimeText) : captionLayout.getPaint().getColor(); + SpoilerEffect.renderWithRipple(this, invalidateSpoilersParent, spoilersColor, 0, captionPatchedSpoilersLayout, captionLayout, captionSpoilers, canvas); + Emoji.emojiDrawingYOffset = 0; } catch (Exception e) { FileLog.e(e); @@ -11964,7 +12490,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate if (overideShouldDrawTimeOnMedia != 0) { return overideShouldDrawTimeOnMedia == 1; } - return mediaBackground && captionLayout == null/* || isMedia && drawCommentButton && !isRepliesChat*/; + return mediaBackground && captionLayout == null && (reactionsLayoutInBubble.isEmpty || reactionsLayoutInBubble.isSmall || currentMessageObject.isAnyKindOfSticker() || currentMessageObject.isRoundVideo())/* || isMedia && drawCommentButton && !isRepliesChat*/; } public void drawTime(Canvas canvas, float alpha, boolean fromParent) { @@ -12064,6 +12590,14 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate if (transitionParams.animateBackgroundBoundsInner) { timeX += animationOffsetX; timeTitleTimeX += animationOffsetX; + + } + if (reactionsLayoutInBubble.isSmall) { + if (transitionParams.animateBackgroundBoundsInner && transitionParams.deltaRight != 0) { + timeTitleTimeX += reactionsLayoutInBubble.getCurrentWidth(1f); + } else { + timeTitleTimeX += reactionsLayoutInBubble.getCurrentWidth(transitionParams.animateChangeProgress); + } } int timeYOffset; @@ -12103,6 +12637,11 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate paint.setAlpha(oldAlpha); float additionalX = -timeLayout.getLineLeft(0); + if (reactionsLayoutInBubble.isSmall) { + updateReactionLayoutPosition(); + reactionsLayoutInBubble.draw(canvas, transitionParams.animateChangeProgress); + } + if (ChatObject.isChannel(currentChat) && !currentChat.megagroup || (currentMessageObject.messageOwner.flags & TLRPC.MESSAGE_FLAG_HAS_VIEWS) != 0 || repliesLayout != null || isPinned) { additionalX += this.timeWidth - timeLayout.getLineWidth(0); @@ -12166,8 +12705,15 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate timeYOffset = -(drawCommentButton ? AndroidUtilities.dp(43) : 0); } float additionalX = -timeLayout.getLineLeft(0); + if (reactionsLayoutInBubble.isSmall) { + updateReactionLayoutPosition(); + reactionsLayoutInBubble.draw(canvas, transitionParams.animateChangeProgress); + } if (ChatObject.isChannel(currentChat) && !currentChat.megagroup || (currentMessageObject.messageOwner.flags & TLRPC.MESSAGE_FLAG_HAS_VIEWS) != 0 || (repliesLayout != null || transitionParams.animateReplies) || (isPinned || transitionParams.animatePinned)) { additionalX += this.timeWidth - timeLayout.getLineWidth(0); + if (reactionsLayoutInBubble.isSmall && !reactionsLayoutInBubble.isEmpty) { + additionalX -= reactionsLayoutInBubble.width; + } int currentStatus = transitionParams.createStatusDrawableParams(); if (transitionParams.lastStatusDrawableParams >= 0 && transitionParams.lastStatusDrawableParams != currentStatus && !statusDrawableAnimationInProgress) { @@ -12212,6 +12758,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate ((View) getParent()).invalidate(); } } + canvas.save(); if (transitionParams.animateEditedEnter && transitionParams.animateChangeProgress != 1f) { if (transitionParams.animateEditedLayout != null) { @@ -12393,7 +12940,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate float scale = 0.5f + 0.5f * progress; alpha *= progress; - float offsetX = 0; + float offsetX = reactionsLayoutInBubble.isSmall ? reactionsLayoutInBubble.getCurrentWidth(1f) : 0; int timeAlpha = Theme.chat_timePaint.getAlpha(); float timeY = shouldDrawTimeOnMedia() ? photoImage.getImageY2() + additionalTimeOffsetY - AndroidUtilities.dp(7.3f) - timeLayout.getHeight() : layoutHeight - AndroidUtilities.dp(pinnedBottom || pinnedTop ? 7.5f : 6.5f) - timeLayout.getHeight() + timeYOffset; if (repliesLayout != null || transitionParams.animateReplies) { @@ -13503,7 +14050,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate if (drawInstantView) { int textX = (int) (photoImage.getImageX() - AndroidUtilities.dp(2)); - int instantY = currentBackgroundDrawable.getBounds().bottom - AndroidUtilities.dp(36 + 28); + int instantY = layoutHeight - AndroidUtilities.dp(36 + 30); + if (!reactionsLayoutInBubble.isEmpty && !reactionsLayoutInBubble.isSmall) { + instantY -= reactionsLayoutInBubble.totalHeight; + } Paint backPaint = Theme.chat_instantViewRectPaint; if (currentMessageObject.isOutOwner()) { Theme.chat_instantViewPaint.setColor(getThemedColor(Theme.key_chat_outPreviewInstantText)); @@ -13592,7 +14142,14 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } x1 = backgroundDrawableLeft + transitionParams.deltaLeft + AndroidUtilities.dp(8) + roundPlayingDrawableProgress + offsetX; - y1 = layoutHeight + transitionParams.deltaBottom - AndroidUtilities.dp(28 - (drawPinnedBottom ? 2 : 0)); + y1 = layoutHeight - AndroidUtilities.dp(28 - (drawPinnedBottom ? 2 : 0)); + if (!reactionsLayoutInBubble.isEmpty) { + y1 -= reactionsLayoutInBubble.totalHeight; + } + transitionParams.lastDrawRoundVideoDotY = y1; + if (transitionParams.animateRoundVideoDotY) { + y1 = transitionParams.animateFromRoundVideoDotY * (1f - transitionParams.animateChangeProgress) + y1 * transitionParams.animateChangeProgress; + } rect.set(x1, y1, x1 + timeWidthAudio + AndroidUtilities.dp(8 + 12 + 2), y1 + AndroidUtilities.dp(17)); int oldAlpha = getThemedPaint(Theme.key_paint_chatActionBackground).getAlpha(); @@ -14027,108 +14584,130 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate if (virtualViewId == HOST_VIEW_ID) { AccessibilityNodeInfo info = AccessibilityNodeInfo.obtain(ChatMessageCell.this); onInitializeAccessibilityNodeInfo(info); - StringBuilder sb = new StringBuilder(); - if (isChat && currentUser != null && !currentMessageObject.isOut()) { - sb.append(UserObject.getUserName(currentUser)); - sb.append('\n'); - } - if (drawForwardedName) { - for (int a = 0; a < 2; a++) { - if (forwardedNameLayout[a] != null) { - sb.append(forwardedNameLayout[a].getText()); - sb.append(a == 0 ? " " : "\n"); + if (accessibilityText == null) { + SpannableStringBuilder sb = new SpannableStringBuilder(); + if (isChat && currentUser != null && !currentMessageObject.isOut()) { + sb.append(UserObject.getUserName(currentUser)); + sb.append('\n'); + } + if (drawForwardedName) { + for (int a = 0; a < 2; a++) { + if (forwardedNameLayout[a] != null) { + sb.append(forwardedNameLayout[a].getText()); + sb.append(a == 0 ? " " : "\n"); + } } } - } - if (!TextUtils.isEmpty(currentMessageObject.messageText)) { - sb.append(currentMessageObject.messageText); - } - if (documentAttach != null && (documentAttachType == DOCUMENT_ATTACH_TYPE_DOCUMENT || documentAttachType == DOCUMENT_ATTACH_TYPE_GIF || documentAttachType == DOCUMENT_ATTACH_TYPE_VIDEO)) { - if (buttonState == 1 && loadingProgressLayout != null) { - sb.append("\n"); - final boolean sending = currentMessageObject.isSending(); - final String key = sending ? "AccDescrUploadProgress" : "AccDescrDownloadProgress"; - final int resId = sending ? R.string.AccDescrUploadProgress : R.string.AccDescrDownloadProgress; - sb.append(LocaleController.formatString(key, resId, AndroidUtilities.formatFileSize(currentMessageObject.loadedFileSize), AndroidUtilities.formatFileSize(lastLoadingSizeTotal))); - } else if (buttonState == 0 || documentAttachType == DOCUMENT_ATTACH_TYPE_DOCUMENT) { - sb.append(", "); - sb.append(AndroidUtilities.formatFileSize(documentAttach.size)); + if (!TextUtils.isEmpty(currentMessageObject.messageText)) { + sb.append(currentMessageObject.messageText); } - if (documentAttachType == DOCUMENT_ATTACH_TYPE_VIDEO) { + if (documentAttach != null && (documentAttachType == DOCUMENT_ATTACH_TYPE_DOCUMENT || documentAttachType == DOCUMENT_ATTACH_TYPE_GIF || documentAttachType == DOCUMENT_ATTACH_TYPE_VIDEO)) { + if (buttonState == 1 && loadingProgressLayout != null) { + sb.append("\n"); + final boolean sending = currentMessageObject.isSending(); + final String key = sending ? "AccDescrUploadProgress" : "AccDescrDownloadProgress"; + final int resId = sending ? R.string.AccDescrUploadProgress : R.string.AccDescrDownloadProgress; + sb.append(LocaleController.formatString(key, resId, AndroidUtilities.formatFileSize(currentMessageObject.loadedFileSize), AndroidUtilities.formatFileSize(lastLoadingSizeTotal))); + } else if (buttonState == 0 || documentAttachType == DOCUMENT_ATTACH_TYPE_DOCUMENT) { + sb.append(", "); + sb.append(AndroidUtilities.formatFileSize(documentAttach.size)); + } + if (documentAttachType == DOCUMENT_ATTACH_TYPE_VIDEO) { + sb.append(", "); + sb.append(LocaleController.formatDuration(currentMessageObject.getDuration())); + } + } + if (currentMessageObject.isMusic()) { + sb.append("\n"); + sb.append(LocaleController.formatString("AccDescrMusicInfo", R.string.AccDescrMusicInfo, currentMessageObject.getMusicAuthor(), currentMessageObject.getMusicTitle())); sb.append(", "); sb.append(LocaleController.formatDuration(currentMessageObject.getDuration())); - } - } - if (currentMessageObject.isMusic()) { - sb.append("\n"); - sb.append(LocaleController.formatString("AccDescrMusicInfo", R.string.AccDescrMusicInfo, currentMessageObject.getMusicAuthor(), currentMessageObject.getMusicTitle())); - sb.append(", "); - sb.append(LocaleController.formatDuration(currentMessageObject.getDuration())); - } else if (currentMessageObject.isVoice() || isRoundVideo) { - sb.append(", "); - sb.append(LocaleController.formatDuration(currentMessageObject.getDuration())); - if (currentMessageObject.isContentUnread()) { + } else if (currentMessageObject.isVoice() || isRoundVideo) { sb.append(", "); - sb.append(LocaleController.getString("AccDescrMsgNotPlayed", R.string.AccDescrMsgNotPlayed)); - } - } - if (lastPoll != null) { - sb.append(", "); - sb.append(lastPoll.question); - sb.append(", "); - String title; - if (pollClosed) { - title = LocaleController.getString("FinalResults", R.string.FinalResults); - } else { - if (lastPoll.quiz) { - if (lastPoll.public_voters) { - title = LocaleController.getString("QuizPoll", R.string.QuizPoll); - } else { - title = LocaleController.getString("AnonymousQuizPoll", R.string.AnonymousQuizPoll); - } - } else if (lastPoll.public_voters) { - title = LocaleController.getString("PublicPoll", R.string.PublicPoll); - } else { - title = LocaleController.getString("AnonymousPoll", R.string.AnonymousPoll); - } - } - sb.append(title); - } - if (currentMessageObject.messageOwner.media != null && !TextUtils.isEmpty(currentMessageObject.caption)) { - sb.append("\n"); - sb.append(currentMessageObject.caption); - } - if (currentMessageObject.isOut()) { - if (currentMessageObject.isSent()) { - sb.append("\n"); - if (currentMessageObject.scheduled) { - sb.append(LocaleController.formatString("AccDescrScheduledDate", R.string.AccDescrScheduledDate, currentTimeString)); - } else { - sb.append(LocaleController.formatString("AccDescrSentDate", R.string.AccDescrSentDate, LocaleController.getString("TodayAt", R.string.TodayAt) + " " + currentTimeString)); + sb.append(LocaleController.formatDuration(currentMessageObject.getDuration())); + if (currentMessageObject.isContentUnread()) { sb.append(", "); - sb.append(currentMessageObject.isUnread() ? LocaleController.getString("AccDescrMsgUnread", R.string.AccDescrMsgUnread) : LocaleController.getString("AccDescrMsgRead", R.string.AccDescrMsgRead)); + sb.append(LocaleController.getString("AccDescrMsgNotPlayed", R.string.AccDescrMsgNotPlayed)); } - } else if (currentMessageObject.isSending()) { - sb.append("\n"); - sb.append(LocaleController.getString("AccDescrMsgSending", R.string.AccDescrMsgSending)); - final float sendingProgress = radialProgress.getProgress(); - if (sendingProgress > 0f) { - sb.append(", ").append(Math.round(sendingProgress * 100)).append("%"); - } - } else if (currentMessageObject.isSendError()) { - sb.append("\n"); - sb.append(LocaleController.getString("AccDescrMsgSendingError", R.string.AccDescrMsgSendingError)); } - } else { + if (lastPoll != null) { + sb.append(", "); + sb.append(lastPoll.question); + sb.append(", "); + String title; + if (pollClosed) { + title = LocaleController.getString("FinalResults", R.string.FinalResults); + } else { + if (lastPoll.quiz) { + if (lastPoll.public_voters) { + title = LocaleController.getString("QuizPoll", R.string.QuizPoll); + } else { + title = LocaleController.getString("AnonymousQuizPoll", R.string.AnonymousQuizPoll); + } + } else if (lastPoll.public_voters) { + title = LocaleController.getString("PublicPoll", R.string.PublicPoll); + } else { + title = LocaleController.getString("AnonymousPoll", R.string.AnonymousPoll); + } + } + sb.append(title); + } + if (currentMessageObject.messageOwner.media != null && !TextUtils.isEmpty(currentMessageObject.caption)) { + sb.append("\n"); + sb.append(currentMessageObject.caption); + } + if (currentMessageObject.isOut()) { + if (currentMessageObject.isSent()) { + sb.append("\n"); + if (currentMessageObject.scheduled) { + sb.append(LocaleController.formatString("AccDescrScheduledDate", R.string.AccDescrScheduledDate, currentTimeString)); + } else { + sb.append(LocaleController.formatString("AccDescrSentDate", R.string.AccDescrSentDate, LocaleController.getString("TodayAt", R.string.TodayAt) + " " + currentTimeString)); + sb.append(", "); + sb.append(currentMessageObject.isUnread() ? LocaleController.getString("AccDescrMsgUnread", R.string.AccDescrMsgUnread) : LocaleController.getString("AccDescrMsgRead", R.string.AccDescrMsgRead)); + } + } else if (currentMessageObject.isSending()) { + sb.append("\n"); + sb.append(LocaleController.getString("AccDescrMsgSending", R.string.AccDescrMsgSending)); + final float sendingProgress = radialProgress.getProgress(); + if (sendingProgress > 0f) { + sb.append(", ").append(Integer.toString(Math.round(sendingProgress * 100))).append("%"); + } + } else if (currentMessageObject.isSendError()) { + sb.append("\n"); + sb.append(LocaleController.getString("AccDescrMsgSendingError", R.string.AccDescrMsgSendingError)); + } + } else { + sb.append("\n"); + sb.append(LocaleController.formatString("AccDescrReceivedDate", R.string.AccDescrReceivedDate, LocaleController.getString("TodayAt", R.string.TodayAt) + " " + currentTimeString)); + } + if ((currentMessageObject.messageOwner.flags & TLRPC.MESSAGE_FLAG_HAS_VIEWS) != 0) { + sb.append("\n"); + sb.append(LocaleController.formatPluralString("AccDescrNumberOfViews", currentMessageObject.messageOwner.views)); + } sb.append("\n"); - sb.append(LocaleController.formatString("AccDescrReceivedDate", R.string.AccDescrReceivedDate, LocaleController.getString("TodayAt", R.string.TodayAt) + " " + currentTimeString)); + + CharacterStyle[] links = sb.getSpans(0, sb.length(), ClickableSpan.class); + + for (CharacterStyle link : links) { + int start = sb.getSpanStart(link); + int end = sb.getSpanEnd(link); + sb.removeSpan(link); + + ClickableSpan underlineSpan = new ClickableSpan() { + @Override + public void onClick(View view) { + if (delegate != null) { + delegate.didPressUrl(ChatMessageCell.this, link, false); + } + } + }; + sb.setSpan(underlineSpan, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + } + accessibilityText = sb; } - if ((currentMessageObject.messageOwner.flags & TLRPC.MESSAGE_FLAG_HAS_VIEWS) != 0) { - sb.append("\n"); - sb.append(LocaleController.formatPluralString("AccDescrNumberOfViews", currentMessageObject.messageOwner.views)); - } - sb.append("\n"); - info.setContentDescription(sb.toString()); + + info.setText(accessibilityText); info.setEnabled(true); if (Build.VERSION.SDK_INT >= 19) { AccessibilityNodeInfo.CollectionItemInfo itemInfo = info.getCollectionItemInfo(); @@ -14176,26 +14755,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate seekBarAccessibilityDelegate.onInitializeAccessibilityNodeInfoInternal(info); } - int i; - if (currentMessageObject.messageText instanceof Spannable) { - Spannable buffer = (Spannable) currentMessageObject.messageText; - CharacterStyle[] links = buffer.getSpans(0, buffer.length(), ClickableSpan.class); - i = 0; - for (CharacterStyle link : links) { - info.addChild(ChatMessageCell.this, LINK_IDS_START + i); - i++; - } - } - if (currentMessageObject.caption instanceof Spannable && captionLayout != null) { - Spannable buffer = (Spannable) currentMessageObject.caption; - CharacterStyle[] links = buffer.getSpans(0, buffer.length(), ClickableSpan.class); - i = 0; - for (CharacterStyle link : links) { - info.addChild(ChatMessageCell.this, LINK_CAPTION_IDS_START + i); - i++; - } - } - i = 0; + int i = 0; for (BotButton button : botButtons) { info.addChild(ChatMessageCell.this, BOT_BUTTONS_START + i); i++; @@ -14496,8 +15056,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate if (delegate != null) { if (button.button != null) { delegate.didPressBotButton(ChatMessageCell.this, button.button); - } else if (button.reaction != null) { - delegate.didPressReaction(ChatMessageCell.this, button.reaction); } } sendAccessibilityEventForVirtualView(virtualViewId, AccessibilityEvent.TYPE_VIEW_CLICKED); @@ -14670,6 +15228,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate public StaticLayout lastDrawDocTitleLayout; public StaticLayout lastDrawInfoLayout; public boolean updatePhotoImageX; + public boolean animateRoundVideoDotY; + public float lastDrawRoundVideoDotY; + public float animateFromRoundVideoDotY; private boolean lastIsPinned; private boolean animatePinned; @@ -14722,6 +15283,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate public boolean wasDraw; public boolean animateBackgroundBoundsInner; + public boolean animateBackgroundWidth; public boolean ignoreAlpha; public boolean drawPinnedBottomBackground; public float changePinnedBottomProgress = 1f; @@ -14860,6 +15422,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate lastForwardNameX = forwardNameX; lastForwardedNamesOffset = namesOffset; lastForwardNameWidth = forwardedNameWidth; + + reactionsLayoutInBubble.recordDrawingState(); } public void recordDrawingStatePreview() { @@ -14870,6 +15434,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate lastForwardedNamesOffset = namesOffset; lastForwardNameWidth = forwardedNameWidth; } + public boolean animateChange() { if (!wasDraw) { return false; @@ -15012,7 +15577,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate animateTimeLayout = lastTimeLayout; animateTimeWidth = lastTimeWidth; changed = true; - } else if (timeDrawablesIsChanged || timeX != lastTimeX) { + } else if (timeDrawablesIsChanged || Math.abs(timeX - lastTimeX) > 1) { shouldAnimateTimeX = true; animateTimeWidth = lastTimeWidth; animateFromTimeX = lastTimeX; @@ -15051,6 +15616,22 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate changed = true; } } + updateReactionLayoutPosition(); + if (reactionsLayoutInBubble.animateChange()) { + changed = true; + } + if (currentMessageObject.isRoundVideo()) { + float y1 = layoutHeight - AndroidUtilities.dp(28 - (drawPinnedBottom ? 2 : 0)); + if (!reactionsLayoutInBubble.isEmpty) { + y1 -= reactionsLayoutInBubble.totalHeight; + } + if (y1 != lastDrawRoundVideoDotY) { + animateRoundVideoDotY = true; + animateFromRoundVideoDotY = lastDrawRoundVideoDotY; + changed = true; + } + } + return changed; } @@ -15062,6 +15643,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate animateChange = false; animatePinned = false; animateBackgroundBoundsInner = false; + animateBackgroundWidth = false; deltaLeft = 0; deltaRight = 0; deltaBottom = 0; @@ -15111,6 +15693,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate animateForwardedLayout = false; animatingForwardedNameLayout[0] = null; animatingForwardedNameLayout[1] = null; + animateRoundVideoDotY = false; + reactionsLayoutInBubble.resetAnimation(); } public boolean supportChangeAnimation() { @@ -15170,4 +15754,5 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate private boolean hasGradientService() { return resourcesProvider != null ? resourcesProvider.hasGradientService() : Theme.hasGradientService(); } + } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java index 081d64ee2..0286ff71d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java @@ -21,6 +21,7 @@ import android.graphics.drawable.Drawable; import android.os.Build; import android.os.SystemClock; import android.text.Layout; +import android.text.Spannable; import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.StaticLayout; @@ -38,6 +39,8 @@ import org.telegram.messenger.ChatObject; import org.telegram.messenger.ContactsController; import org.telegram.messenger.DialogObject; import org.telegram.messenger.ChatThemeController; +import org.telegram.messenger.ContactsController; +import org.telegram.messenger.DialogObject; import org.telegram.messenger.DownloadController; import org.telegram.messenger.Emoji; import org.telegram.messenger.FileLoader; @@ -66,11 +69,17 @@ import org.telegram.ui.Components.PullForegroundDrawable; import org.telegram.ui.Components.RLottieDrawable; import org.telegram.ui.Components.StaticLayoutEx; import org.telegram.ui.Components.StatusDrawable; +import org.telegram.ui.Components.SwipeGestureSettingsView; import org.telegram.ui.Components.TypefaceSpan; +import org.telegram.ui.Components.URLSpanNoUnderline; +import org.telegram.ui.Components.URLSpanNoUnderlineBold; +import org.telegram.ui.Components.spoilers.SpoilerEffect; import org.telegram.ui.DialogsActivity; import org.telegram.ui.Components.SwipeGestureSettingsView; import java.util.ArrayList; +import java.util.List; +import java.util.Stack; import tw.nekomimi.nekogram.MessageHelper; import tw.nekomimi.nkmr.NekomuraConfig; @@ -234,6 +243,9 @@ public class DialogCell extends BaseCell { private int messageLeft; private StaticLayout messageLayout; + private Stack spoilersPool = new Stack<>(); + private List spoilers = new ArrayList<>(); + private int messageNameTop; private int messageNameLeft; private StaticLayout messageNameLayout; @@ -650,7 +662,16 @@ public class DialogCell extends BaseCell { } } - lastMessageString = message != null ? message.messageText : null; + CharSequence msgText = message != null ? message.messageText : null; + if (msgText instanceof Spannable) { + Spannable sp = new SpannableStringBuilder(msgText); + for (Object span : sp.getSpans(0, sp.length(), URLSpanNoUnderlineBold.class)) + sp.removeSpan(span); + for (Object span : sp.getSpans(0, sp.length(), URLSpanNoUnderline.class)) + sp.removeSpan(span); + msgText = sp; + } + lastMessageString = msgText; if (customDialog != null) { if (customDialog.type == 2) { @@ -938,7 +959,10 @@ public class DialogCell extends BaseCell { if (mess.length() > 150) { mess = mess.substring(0, 150); } - SpannableStringBuilder stringBuilder = SpannableStringBuilder.valueOf(String.format(messageFormat, mess.replace('\n', ' '), messageNameString)); + Spannable messSpan = new SpannableStringBuilder(mess); + MediaDataController.addTextStyleRuns(draftMessage, messSpan); + + SpannableStringBuilder stringBuilder = AndroidUtilities.formatSpannable(messageFormat, AndroidUtilities.replaceNewLines(messSpan), messageNameString); if (!useForceThreeLines && !SharedConfig.useThreeLinesLayout) { stringBuilder.setSpan(new ForegroundColorSpanThemable(Theme.key_chats_draft, resourcesProvider), 0, messageNameString.length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } @@ -996,7 +1020,7 @@ public class DialogCell extends BaseCell { messageString = ""; showChecks = false; } else { - messageString = message.messageText; + messageString = msgText; } currentMessagePaint = Theme.dialogs_messagePrintingPaint[paintIndex]; } else { @@ -1052,9 +1076,9 @@ public class DialogCell extends BaseCell { if (!TextUtils.isEmpty(restrictionReason)) { stringBuilder = SpannableStringBuilder.valueOf(String.format(messageFormat, restrictionReason, messageNameString)); } else if (message.caption != null) { - String mess = message.caption.toString(); + CharSequence mess = message.caption.toString(); if (mess.length() > 150) { - mess = mess.substring(0, 150); + mess = mess.subSequence(0, 150); } String emoji; if (!needEmoji) { @@ -1070,7 +1094,9 @@ public class DialogCell extends BaseCell { } else { emoji = "\uD83D\uDCCE "; } - stringBuilder = SpannableStringBuilder.valueOf(String.format(messageFormat, emoji + mess.replace('\n', ' '), messageNameString)); + SpannableStringBuilder msgBuilder = new SpannableStringBuilder(mess); + MediaDataController.addTextStyleRuns(message.messageOwner.entities, message.caption, msgBuilder); + stringBuilder = AndroidUtilities.formatSpannable(messageFormat, new SpannableStringBuilder(emoji).append(AndroidUtilities.replaceNewLines(msgBuilder)), messageNameString); } else if (message.messageOwner.media != null && !message.isMediaEmpty()) { currentMessagePaint = Theme.dialogs_messagePrintingPaint[paintIndex]; String innerMessage; @@ -1096,17 +1122,17 @@ public class DialogCell extends BaseCell { innerMessage = String.format("\uD83C\uDFA7 %s - %s", message.getMusicAuthor(), message.getMusicTitle()); } } else { - innerMessage = message.messageText.toString(); + innerMessage = msgText.toString(); } innerMessage = innerMessage.replace('\n', ' '); - stringBuilder = SpannableStringBuilder.valueOf(String.format(messageFormat, innerMessage, messageNameString)); + stringBuilder = AndroidUtilities.formatSpannable(messageFormat, innerMessage, messageNameString); try { stringBuilder.setSpan(new ForegroundColorSpanThemable(Theme.key_chats_attachMessage, resourcesProvider), hasNameInMessage ? messageNameString.length() + 2 : 0, stringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } catch (Exception e) { FileLog.e(e); } } else if (message.messageOwner.message != null) { - String mess = message.messageOwner.message; + CharSequence mess = message.messageOwner.message; if (message.hasHighlightedWords()) { if (message.messageTrimmedToHighlight != null) { mess = message.messageTrimmedToHighlight; @@ -1123,11 +1149,13 @@ public class DialogCell extends BaseCell { } } else { if (mess.length() > 150) { - mess = mess.substring(0, 150); + mess = mess.subSequence(0, 150); } - mess = mess.replace('\n', ' ').trim(); + mess = AndroidUtilities.replaceNewLines(mess); } - stringBuilder = SpannableStringBuilder.valueOf(String.format(messageFormat, mess, messageNameString)); + mess = new SpannableStringBuilder(mess); + MediaDataController.addTextStyleRuns(message, (Spannable) mess); + stringBuilder = AndroidUtilities.formatSpannable(messageFormat, mess, messageNameString); } else { stringBuilder = SpannableStringBuilder.valueOf(""); } @@ -1195,7 +1223,9 @@ public class DialogCell extends BaseCell { } messageString = emoji + str; } else { - messageString = emoji + message.caption; + SpannableStringBuilder msgBuilder = new SpannableStringBuilder(message.caption); + MediaDataController.addTextStyleRuns(message.messageOwner.entities, message.caption, msgBuilder); + messageString = new SpannableStringBuilder(emoji).append(msgBuilder); } } else { if (message.messageOwner.media instanceof TLRPC.TL_messageMediaPoll) { @@ -1216,7 +1246,9 @@ public class DialogCell extends BaseCell { int w = getMeasuredWidth() - AndroidUtilities.dp(72 + 23 ); messageString = AndroidUtilities.ellipsizeCenterEnd(messageString, message.highlightedWords.get(0), w, currentMessagePaint, 130).toString(); } else { - messageString = message.messageText; + SpannableStringBuilder stringBuilder = new SpannableStringBuilder(msgText); + MediaDataController.addTextStyleRuns(message, stringBuilder); + messageString = stringBuilder; } AndroidUtilities.highlightText(messageString, message.highlightedWords, resourcesProvider); } @@ -1602,14 +1634,14 @@ public class DialogCell extends BaseCell { if (messageString == null) { messageString = ""; } - String mess = messageString.toString(); + CharSequence mess = messageString; if (mess.length() > 150) { - mess = mess.substring(0, 150); + mess = mess.subSequence(0, 150); } if (!useForceThreeLines && !SharedConfig.useThreeLinesLayout || messageNameString != null) { - mess = mess.replace('\n', ' '); + mess = AndroidUtilities.replaceNewLines(mess); } else { - mess = mess.replace("\n\n", "\n"); + mess = AndroidUtilities.replaceTwoNewLinesToOne(mess); } messageString = Emoji.replaceEmoji(mess, Theme.dialogs_messagePaint[paintIndex].getFontMetricsInt(), AndroidUtilities.dp(17), false); if (message != null) { @@ -1656,6 +1688,7 @@ public class DialogCell extends BaseCell { } else { messageStringFinal = messageString; } + if (useForceThreeLines || SharedConfig.useThreeLinesLayout) { if (hasMessageThumb && messageNameString != null) { messageWidth += AndroidUtilities.dp(6); @@ -1672,6 +1705,9 @@ public class DialogCell extends BaseCell { messageStringFinal = Emoji.replaceEmoji(messageStringFinal,currentMessagePaint.getFontMetricsInt(), AndroidUtilities.dp(12), false); messageLayout = new StaticLayout(messageStringFinal, currentMessagePaint, messageWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); } + spoilersPool.addAll(spoilers); + spoilers.clear(); + SpoilerEffect.addSpoilers(this, messageLayout, spoilersPool, spoilers); } catch (Exception e) { messageLayout = null; FileLog.e(e); @@ -2609,7 +2645,15 @@ public class DialogCell extends BaseCell { canvas.save(); canvas.translate(messageLeft, messageTop); try { + canvas.save(); + SpoilerEffect.clipOutCanvas(canvas, spoilers); messageLayout.draw(canvas); + canvas.restore(); + + for (SpoilerEffect eff : spoilers) { + eff.setColor(messageLayout.getPaint().getColor()); + eff.draw(canvas); + } } catch (Exception e) { FileLog.e(e); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerActionCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerActionCell.java index 90d23a0e0..33d0fb187 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerActionCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerActionCell.java @@ -16,6 +16,7 @@ import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.util.TypedValue; import android.view.Gravity; +import android.view.accessibility.AccessibilityNodeInfo; import android.widget.FrameLayout; import android.widget.TextView; @@ -97,4 +98,11 @@ public class DrawerActionCell extends FrameLayout { FileLog.e(e); } } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.addAction(AccessibilityNodeInfo.ACTION_CLICK); + info.addAction(AccessibilityNodeInfo.ACTION_LONG_CLICK); + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerProfileCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerProfileCell.java index 3ceaf0785..c387a1ed9 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerProfileCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerProfileCell.java @@ -253,7 +253,7 @@ public class DrawerProfileCell extends FrameLayout { addView(darkThemeView, LayoutHelper.createFrame(48, 48, Gravity.RIGHT | Gravity.BOTTOM, 0, 10, 6, 90)); if (Theme.getEventType() == 0 || NekomuraConfig.actionBarDecoration.Int() == 1) { - snowflakesEffect = new SnowflakesEffect(); + snowflakesEffect = new SnowflakesEffect(0); snowflakesEffect.setColorKey(Theme.key_chats_menuName); } else if (NekomuraConfig.actionBarDecoration.Int() == 2) { fireworksEffect = new FireworksEffect(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerUserCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerUserCell.java index 87b05f797..8c484c778 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerUserCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerUserCell.java @@ -14,6 +14,7 @@ import android.graphics.RectF; import android.text.TextUtils; import android.util.TypedValue; import android.view.Gravity; +import android.view.accessibility.AccessibilityNodeInfo; import android.widget.FrameLayout; import android.widget.TextView; @@ -124,4 +125,10 @@ public class DrawerUserCell extends FrameLayout { canvas.drawText(text, rect.left + (rect.width() - textWidth) / 2, countTop + AndroidUtilities.dp(16), Theme.dialogs_countTextPaint); } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.addAction(AccessibilityNodeInfo.ACTION_CLICK); + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SessionCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SessionCell.java index b19d86767..4ca39d676 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SessionCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SessionCell.java @@ -106,6 +106,16 @@ public class SessionCell extends FrameLayout { linearLayout.addView(onlineTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.RIGHT | Gravity.TOP, 0, 2, 0, 0)); } + int leftMargin; + int rightMargin; + if (LocaleController.isRTL) { + rightMargin = type == 0 ? 72 : 21; + leftMargin = 21; + } else { + leftMargin = type == 0 ? 72 : 21; + rightMargin = 21; + } + detailTextView = new TextView(context); detailTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); detailTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); @@ -114,7 +124,7 @@ public class SessionCell extends FrameLayout { //detailTextView.setSingleLine(true); //detailTextView.setEllipsize(TextUtils.TruncateAt.END); detailTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP); - addView(detailTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, type == 0 ? 72 : 21, 36, 21, 0)); + addView(detailTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, leftMargin, 36, rightMargin, 0)); detailExTextView = new TextView(context); detailExTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText3)); @@ -124,7 +134,7 @@ public class SessionCell extends FrameLayout { detailExTextView.setSingleLine(true); detailExTextView.setEllipsize(TextUtils.TruncateAt.END); detailExTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP); - addView(detailExTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, type == 0 ? 72 : 21, 59, 21, 0)); + addView(detailExTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, leftMargin, 59, rightMargin, 0)); } @Override @@ -137,11 +147,7 @@ public class SessionCell extends FrameLayout { if (object instanceof TLRPC.TL_authorization) { TLRPC.TL_authorization session = (TLRPC.TL_authorization) object; - - imageView.setImageDrawable(createDrawable(session)); - // nameTextView.setText(String.format(Locale.US, "%s %s", session.app_name, session.app_version)); - StringBuilder stringBuilder = new StringBuilder(); if (session.device_model.length() != 0) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SettingsSearchCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SettingsSearchCell.java index 0254b7c2f..9313fc71d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SettingsSearchCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SettingsSearchCell.java @@ -30,7 +30,7 @@ public class SettingsSearchCell extends FrameLayout { private boolean needDivider; private int left; - public class VerticalImageSpan extends ImageSpan { + public static class VerticalImageSpan extends ImageSpan { public VerticalImageSpan(Drawable drawable) { super(drawable); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedLinkCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedLinkCell.java index cd77ea940..91cd04919 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedLinkCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedLinkCell.java @@ -12,11 +12,18 @@ import android.annotation.SuppressLint; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; +import android.graphics.Path; +import android.graphics.Rect; +import android.graphics.Region; import android.net.Uri; import android.text.Layout; +import android.text.Spannable; +import android.text.SpannableString; +import android.text.SpannableStringBuilder; import android.text.StaticLayout; import android.text.TextPaint; import android.text.TextUtils; +import android.util.SparseArray; import android.view.Gravity; import android.view.HapticFeedbackConstants; import android.view.MotionEvent; @@ -29,6 +36,7 @@ import org.telegram.messenger.Emoji; import org.telegram.messenger.ImageLocation; import org.telegram.messenger.ImageReceiver; import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MediaDataController; import org.telegram.messenger.MessageObject; import org.telegram.messenger.FileLoader; import org.telegram.messenger.FileLog; @@ -38,14 +46,22 @@ import org.telegram.ui.Components.LayoutHelper; import org.telegram.ui.Components.LetterDrawable; import org.telegram.ui.Components.LinkPath; import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.Components.TextStyleSpan; +import org.telegram.ui.Components.spoilers.SpoilerEffect; import org.telegram.ui.FilteredSearchView; import java.util.ArrayList; +import java.util.List; import java.util.Locale; +import java.util.Stack; +import java.util.concurrent.atomic.AtomicReference; import tw.nekomimi.nkmr.NekomuraConfig; public class SharedLinkCell extends FrameLayout { + private final static int SPOILER_TYPE_LINK = 0, + SPOILER_TYPE_DESCRIPTION = 1, + SPOILER_TYPE_DESCRIPTION2 = 2; public interface SharedLinkCellDelegate { void needOpenWebView(TLRPC.WebPage webPage, MessageObject messageObject); @@ -78,7 +94,7 @@ public class SharedLinkCell extends FrameLayout { performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); } if (pressedLink >= 0) { - delegate.onLinkPress(links.get(pressedLink), true); + delegate.onLinkPress(links.get(pressedLink).toString(), true); } MotionEvent event = MotionEvent.obtain(0, 0, MotionEvent.ACTION_CANCEL, 0, 0, 0); onTouchEvent(event); @@ -121,18 +137,27 @@ public class SharedLinkCell extends FrameLayout { private boolean needDivider; - ArrayList links = new ArrayList<>(); + ArrayList links = new ArrayList<>(); private int linkY; private ArrayList linkLayout = new ArrayList<>(); + private SparseArray> linkSpoilers = new SparseArray<>(); + private List descriptionLayoutSpoilers = new ArrayList<>(); + private List descriptionLayout2Spoilers = new ArrayList<>(); + private Stack spoilersPool = new Stack<>(); + private Path path = new Path(); + private SpoilerEffect spoilerPressed; + private int spoilerTypePressed = -1; private int titleY = AndroidUtilities.dp(10); private StaticLayout titleLayout; private int descriptionY = AndroidUtilities.dp(30); private StaticLayout descriptionLayout; + private AtomicReference patchedDescriptionLayout = new AtomicReference<>(); private int description2Y = AndroidUtilities.dp(30); private StaticLayout descriptionLayout2; + private AtomicReference patchedDescriptionLayout2 = new AtomicReference<>(); private int captionY = AndroidUtilities.dp(30); private StaticLayout captionLayout; @@ -209,8 +234,8 @@ public class SharedLinkCell extends FrameLayout { int maxWidth = MeasureSpec.getSize(widthMeasureSpec) - AndroidUtilities.dp(AndroidUtilities.leftBaseline) - AndroidUtilities.dp(8); String title = null; - String description = null; - String description2 = null; + CharSequence description = null; + CharSequence description2 = null; String webPageLink = null; boolean hasPhoto = false; @@ -238,14 +263,18 @@ public class SharedLinkCell extends FrameLayout { if (a == 0 && webPageLink != null && !(entity.offset == 0 && entity.length == message.messageOwner.message.length())) { if (message.messageOwner.entities.size() == 1) { if (description == null) { - description2 = message.messageOwner.message; + SpannableStringBuilder st = SpannableStringBuilder.valueOf(message.messageOwner.message); + MediaDataController.addTextStyleRuns(message, st); + description2 = st; } } else { - description2 = message.messageOwner.message; + SpannableStringBuilder st = SpannableStringBuilder.valueOf(message.messageOwner.message); + MediaDataController.addTextStyleRuns(message, st); + description2 = st; } } try { - String link = null; + CharSequence link = null; if (entity instanceof TLRPC.TL_messageEntityTextUrl || entity instanceof TLRPC.TL_messageEntityUrl) { if (entity instanceof TLRPC.TL_messageEntityUrl) { link = message.messageOwner.message.substring(entity.offset, entity.offset + entity.length); @@ -253,11 +282,11 @@ public class SharedLinkCell extends FrameLayout { link = entity.url; } if (title == null || title.length() == 0) { - title = link; + title = link.toString(); Uri uri = Uri.parse(title); title = uri.getHost(); if (title == null) { - title = link; + title = link.toString(); } int index; if (title != null && (index = title.lastIndexOf('.')) >= 0) { @@ -268,7 +297,9 @@ public class SharedLinkCell extends FrameLayout { title = title.substring(0, 1).toUpperCase() + title.substring(1); } if (entity.offset != 0 || entity.length != message.messageOwner.message.length()) { - description = message.messageOwner.message; + SpannableStringBuilder st = SpannableStringBuilder.valueOf(message.messageOwner.message); + MediaDataController.addTextStyleRuns(message, st); + description = st; } } } else if (entity instanceof TLRPC.TL_messageEntityEmail) { @@ -276,16 +307,33 @@ public class SharedLinkCell extends FrameLayout { link = "mailto:" + message.messageOwner.message.substring(entity.offset, entity.offset + entity.length); title = message.messageOwner.message.substring(entity.offset, entity.offset + entity.length); if (entity.offset != 0 || entity.length != message.messageOwner.message.length()) { - description = message.messageOwner.message; + SpannableStringBuilder st = SpannableStringBuilder.valueOf(message.messageOwner.message); + MediaDataController.addTextStyleRuns(message, st); + description = st; } } } if (link != null) { - if (!link.contains("://") && link.toLowerCase().indexOf("http") != 0 && link.toLowerCase().indexOf("mailto") != 0) { - links.add("http://" + link); + CharSequence lobj; + int offset = 0; + if (!AndroidUtilities.charSequenceContains(link, "://") && link.toString().toLowerCase().indexOf("http") != 0 && link.toString().toLowerCase().indexOf("mailto") != 0) { + String prefix = "http://"; + lobj = prefix + link; + offset += prefix.length(); } else { - links.add(link); + lobj = link; } + SpannableString sb = SpannableString.valueOf(lobj); + int start = entity.offset, end = entity.offset + entity.length; + for (TLRPC.MessageEntity e : message.messageOwner.entities) { + int ss = e.offset, se = e.offset + e.length; + if (e instanceof TLRPC.TL_messageEntitySpoiler && start <= se && end >= ss) { + TextStyleSpan.TextStyleRun run = new TextStyleSpan.TextStyleRun(); + run.flags |= TextStyleSpan.FLAG_STYLE_SPOILER; + sb.setSpan(new TextStyleSpan(run), Math.max(start, ss), Math.min(end, se) + offset, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + } + } + links.add(sb); } } catch (Exception e) { FileLog.e(e); @@ -336,6 +384,10 @@ public class SharedLinkCell extends FrameLayout { if (descriptionLayout.getLineCount() > 0) { description2Y = descriptionY + descriptionLayout.getLineBottom(descriptionLayout.getLineCount() - 1) + AndroidUtilities.dp(5); } + spoilersPool.addAll(descriptionLayoutSpoilers); + descriptionLayoutSpoilers.clear(); + if (!message.isSpoilersRevealed) + SpoilerEffect.addSpoilers(this, descriptionLayout, spoilersPool, descriptionLayoutSpoilers); } catch (Exception e) { FileLog.e(e); } @@ -347,6 +399,10 @@ public class SharedLinkCell extends FrameLayout { if (descriptionLayout != null) { description2Y += AndroidUtilities.dp(10); } + spoilersPool.addAll(descriptionLayout2Spoilers); + descriptionLayout2Spoilers.clear(); + if (!message.isSpoilersRevealed) + SpoilerEffect.addSpoilers(this, descriptionLayout2, spoilersPool, descriptionLayout2Spoilers); } catch (Exception e) { FileLog.e(e); } @@ -368,16 +424,25 @@ public class SharedLinkCell extends FrameLayout { } if (!links.isEmpty()) { + for (int i = 0; i < linkSpoilers.size(); i++) + spoilersPool.addAll(linkSpoilers.get(i)); + linkSpoilers.clear(); for (int a = 0; a < links.size(); a++) { try { - String link = links.get(a); - int width = (int) Math.ceil(descriptionTextPaint.measureText(link)); - CharSequence linkFinal = TextUtils.ellipsize(link.replace('\n', ' '), descriptionTextPaint, Math.min(width, maxWidth), TextUtils.TruncateAt.MIDDLE); + CharSequence link = links.get(a); + int width = (int) Math.ceil(descriptionTextPaint.measureText(link, 0, link.length())); + CharSequence linkFinal = TextUtils.ellipsize(AndroidUtilities.replaceNewLines(SpannableStringBuilder.valueOf(link)), descriptionTextPaint, Math.min(width, maxWidth), TextUtils.TruncateAt.MIDDLE); StaticLayout layout = new StaticLayout(linkFinal, descriptionTextPaint, maxWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); linkY = description2Y; if (descriptionLayout2 != null && descriptionLayout2.getLineCount() != 0) { linkY += descriptionLayout2.getLineBottom(descriptionLayout2.getLineCount() - 1) + AndroidUtilities.dp(5); } + if (!message.isSpoilersRevealed) { + List l = new ArrayList<>(); + if (linkFinal instanceof Spannable) + SpoilerEffect.addSpoilers(this, layout, (Spannable) linkFinal, spoilersPool, l); + linkSpoilers.put(a, l); + } linkLayout.add(layout); } catch (Exception e) { FileLog.e(e); @@ -484,7 +549,7 @@ public class SharedLinkCell extends FrameLayout { public boolean onTouchEvent(MotionEvent event) { boolean result = false; if (message != null && !linkLayout.isEmpty() && delegate != null && delegate.canPerformActions()) { - if (event.getAction() == MotionEvent.ACTION_DOWN || linkPreviewPressed && event.getAction() == MotionEvent.ACTION_UP) { + if (event.getAction() == MotionEvent.ACTION_DOWN || (linkPreviewPressed || spoilerPressed != null) && event.getAction() == MotionEvent.ACTION_UP) { int x = (int) event.getX(); int y = (int) event.getY(); int offset = 0; @@ -498,35 +563,84 @@ public class SharedLinkCell extends FrameLayout { ok = true; if (event.getAction() == MotionEvent.ACTION_DOWN) { resetPressedLink(); - pressedLink = a; - linkPreviewPressed = true; - startCheckLongPress(); - try { - urlPath.setCurrentLayout(layout, 0, 0); - layout.getSelectionPath(0, layout.getText().length(), urlPath); - } catch (Exception e) { - FileLog.e(e); + + spoilerPressed = null; + if (linkSpoilers.get(a, null) != null) { + for (SpoilerEffect eff : linkSpoilers.get(a)) { + if (eff.getBounds().contains(x - linkPosX, y - linkY - offset)) { + spoilerPressed = eff; + spoilerTypePressed = SPOILER_TYPE_LINK; + break; + } + } + } + + if (spoilerPressed != null) { + result = true; + } else { + pressedLink = a; + linkPreviewPressed = true; + startCheckLongPress(); + try { + urlPath.setCurrentLayout(layout, 0, 0); + layout.getSelectionPath(0, layout.getText().length(), urlPath); + } catch (Exception e) { + FileLog.e(e); + } + result = true; } - result = true; } else if (linkPreviewPressed) { try { TLRPC.WebPage webPage = pressedLink == 0 && message.messageOwner.media != null ? message.messageOwner.media.webpage : null; if (webPage != null && webPage.embed_url != null && webPage.embed_url.length() != 0) { delegate.needOpenWebView(webPage, message); } else { - delegate.onLinkPress(links.get(pressedLink), false); + delegate.onLinkPress(links.get(pressedLink).toString(), false); } } catch (Exception e) { FileLog.e(e); } resetPressedLink(); result = true; + } else if (spoilerPressed != null) { + startSpoilerRipples(x, y, offset); + result = true; } break; } offset += height; } } + if (event.getAction() == MotionEvent.ACTION_DOWN) { + int offX = AndroidUtilities.dp(LocaleController.isRTL ? 8 : AndroidUtilities.leftBaseline); + if (descriptionLayout != null && x >= offX && x <= offX + descriptionLayout.getWidth() && y >= descriptionY && y <= descriptionY + descriptionLayout.getHeight()) { + for (SpoilerEffect eff : descriptionLayoutSpoilers) { + if (eff.getBounds().contains(x - offX, y - descriptionY)) { + spoilerPressed = eff; + spoilerTypePressed = SPOILER_TYPE_DESCRIPTION; + ok = true; + result = true; + break; + } + } + } + if (descriptionLayout2 != null && x >= offX && x <= offX + descriptionLayout2.getWidth() && y >= description2Y && y <= description2Y + descriptionLayout2.getHeight()) { + for (SpoilerEffect eff : descriptionLayout2Spoilers) { + if (eff.getBounds().contains(x - offX, y - description2Y)) { + spoilerPressed = eff; + spoilerTypePressed = SPOILER_TYPE_DESCRIPTION2; + ok = true; + result = true; + break; + } + } + } + } else if (event.getAction() == MotionEvent.ACTION_UP && spoilerPressed != null) { + startSpoilerRipples(x, y, 0); + ok = true; + result = true; + } + if (!ok) { resetPressedLink(); } @@ -539,11 +653,85 @@ public class SharedLinkCell extends FrameLayout { return result || super.onTouchEvent(event); } + private void startSpoilerRipples(int x, int y, int offset) { + int linkPosX = AndroidUtilities.dp(LocaleController.isRTL ? 8 : AndroidUtilities.leftBaseline); + resetPressedLink(); + SpoilerEffect eff = spoilerPressed; + eff.setOnRippleEndCallback(() -> post(() -> { + message.isSpoilersRevealed = true; + linkSpoilers.clear(); + descriptionLayoutSpoilers.clear(); + descriptionLayout2Spoilers.clear(); + invalidate(); + })); + + int nx = x - linkPosX; + float rad = (float) Math.sqrt(Math.pow(getWidth(), 2) + Math.pow(getHeight(), 2)); + float offY = 0; + switch (spoilerTypePressed) { + case SPOILER_TYPE_LINK: + for (int i = 0; i < linkLayout.size(); i++) { + Layout lt = linkLayout.get(i); + offY += lt.getLineBottom(lt.getLineCount() - 1); + for (SpoilerEffect e : linkSpoilers.get(i)) { + e.startRipple(nx, y - getYOffsetForType(SPOILER_TYPE_LINK) - offset + offY, rad); + } + } + break; + case SPOILER_TYPE_DESCRIPTION: + for (SpoilerEffect sp : descriptionLayoutSpoilers) + sp.startRipple(nx, y - getYOffsetForType(SPOILER_TYPE_DESCRIPTION), rad); + break; + case SPOILER_TYPE_DESCRIPTION2: + for (SpoilerEffect sp : descriptionLayout2Spoilers) + sp.startRipple(nx, y - getYOffsetForType(SPOILER_TYPE_DESCRIPTION2), rad); + break; + } + for (int i = SPOILER_TYPE_LINK; i <= SPOILER_TYPE_DESCRIPTION2; i++) { + if (i != spoilerTypePressed) { + switch (i) { + case SPOILER_TYPE_LINK: + for (int j = 0; j < linkLayout.size(); j++) { + Layout lt = linkLayout.get(j); + offY += lt.getLineBottom(lt.getLineCount() - 1); + for (SpoilerEffect e : linkSpoilers.get(j)) { + e.startRipple(e.getBounds().centerX(), e.getBounds().centerY(), rad); + } + } + break; + case SPOILER_TYPE_DESCRIPTION: + for (SpoilerEffect sp : descriptionLayoutSpoilers) + sp.startRipple(sp.getBounds().centerX(), sp.getBounds().centerY(), rad); + break; + case SPOILER_TYPE_DESCRIPTION2: + for (SpoilerEffect sp : descriptionLayout2Spoilers) + sp.startRipple(sp.getBounds().centerX(), sp.getBounds().centerY(), rad); + break; + } + } + } + + spoilerTypePressed = -1; + spoilerPressed = null; + } + + private int getYOffsetForType(int type) { + switch (type) { + default: + case SPOILER_TYPE_LINK: + return linkY; + case SPOILER_TYPE_DESCRIPTION: + return descriptionY; + case SPOILER_TYPE_DESCRIPTION2: + return description2Y; + } + } + public String getLink(int num) { if (num < 0 || num >= links.size()) { return null; } - return links.get(num); + return links.get(num).toString(); } protected void resetPressedLink() { @@ -593,7 +781,7 @@ public class SharedLinkCell extends FrameLayout { descriptionTextPaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); canvas.save(); canvas.translate(AndroidUtilities.dp(LocaleController.isRTL ? 8 : AndroidUtilities.leftBaseline), descriptionY); - descriptionLayout.draw(canvas); + SpoilerEffect.renderWithRipple(this, false, descriptionTextPaint.getColor(), -AndroidUtilities.dp(2), patchedDescriptionLayout, descriptionLayout, descriptionLayoutSpoilers, canvas); canvas.restore(); } @@ -601,7 +789,7 @@ public class SharedLinkCell extends FrameLayout { descriptionTextPaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); canvas.save(); canvas.translate(AndroidUtilities.dp(LocaleController.isRTL ? 8 : AndroidUtilities.leftBaseline), description2Y); - descriptionLayout2.draw(canvas); + SpoilerEffect.renderWithRipple(this, false, descriptionTextPaint.getColor(), -AndroidUtilities.dp(2), patchedDescriptionLayout2, descriptionLayout2, descriptionLayout2Spoilers, canvas); canvas.restore(); } @@ -610,14 +798,39 @@ public class SharedLinkCell extends FrameLayout { int offset = 0; for (int a = 0; a < linkLayout.size(); a++) { StaticLayout layout = linkLayout.get(a); + List spoilers = linkSpoilers.get(a); if (layout.getLineCount() > 0) { canvas.save(); canvas.translate(AndroidUtilities.dp(LocaleController.isRTL ? 8 : AndroidUtilities.leftBaseline), linkY + offset); - if (pressedLink == a) { - canvas.drawPath(urlPath, Theme.linkSelectionPaint); + + path.rewind(); + if (spoilers != null) { + for (SpoilerEffect eff : spoilers) { + Rect b = eff.getBounds(); + path.addRect(b.left, b.top, b.right, b.bottom, Path.Direction.CW); + } } + canvas.save(); + canvas.clipPath(path, Region.Op.DIFFERENCE); + if (pressedLink == a) canvas.drawPath(urlPath, Theme.linkSelectionPaint); layout.draw(canvas); canvas.restore(); + + canvas.save(); + canvas.clipPath(path); + path.rewind(); + if (spoilers != null && !spoilers.isEmpty()) + spoilers.get(0).getRipplePath(path); + canvas.clipPath(path); + + if (pressedLink == a) canvas.drawPath(urlPath, Theme.linkSelectionPaint); + layout.draw(canvas); + canvas.restore(); + + if (spoilers != null) + for (SpoilerEffect eff : spoilers) eff.draw(canvas); + + canvas.restore(); offset += layout.getLineBottom(layout.getLineCount() - 1); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextCell.java index 76713bcf3..881a0008d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextCell.java @@ -252,6 +252,7 @@ public class TextCell extends FrameLayout { info.setText(text); } } + info.addAction(AccessibilityNodeInfo.ACTION_CLICK); } public void setNeedDivider(boolean needDivider) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextCheckCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextCheckCell.java index a87272d8d..04980a371 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextCheckCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextCheckCell.java @@ -18,6 +18,7 @@ import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.Typeface; import android.graphics.drawable.Drawable; +import android.graphics.drawable.ColorDrawable; import android.text.TextUtils; import android.util.Property; import android.util.TypedValue; @@ -42,6 +43,7 @@ import org.telegram.ui.Components.ViewHelper; import java.util.ArrayList; public class TextCheckCell extends FrameLayout { + private boolean isAnimatingToThumbInsteadOfTouch; private TextView textView; private TextView valueTextView; @@ -129,6 +131,11 @@ public class TextCheckCell extends FrameLayout { return super.onTouchEvent(event); } + public void setDivider(boolean divider) { + needDivider = divider; + setWillNotDraw(!divider); + } + public void setTextAndCheck(String text, boolean checked, boolean divider) { textView.setText(text); isMultiline = false; @@ -275,18 +282,50 @@ public class TextCheckCell extends FrameLayout { private void setAnimationProgress(float value) { animationProgress = value; - float rad = Math.max(lastTouchX, getMeasuredWidth() - lastTouchX) + AndroidUtilities.dp(40); - float cx = lastTouchX; + float tx = getLastTouchX(); + float rad = Math.max(tx, getMeasuredWidth() - tx) + AndroidUtilities.dp(40); + float cx = tx; int cy = getMeasuredHeight() / 2; float animatedRad = rad * animationProgress; checkBox.setOverrideColorProgress(cx, cy, animatedRad); } + public void setBackgroundColorAnimatedReverse(int color) { + if (animator != null) { + animator.cancel(); + animator = null; + } + + int from = animatedColorBackground != 0 ? animatedColorBackground : getBackground() instanceof ColorDrawable ? ((ColorDrawable) getBackground()).getColor() : 0; + if (animationPaint == null) animationPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + animationPaint.setColor(from); + + setBackgroundColor(color); + checkBox.setOverrideColor(1); + animatedColorBackground = color; + animator = ObjectAnimator.ofFloat(this, ANIMATION_PROGRESS, 1, 0).setDuration(240); + animator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + setBackgroundColor(color); + animatedColorBackground = 0; + invalidate(); + } + }); + animator.setInterpolator(CubicBezierInterpolator.EASE_OUT); + animator.start(); + } + + private float getLastTouchX() { + return isAnimatingToThumbInsteadOfTouch ? (LocaleController.isRTL ? AndroidUtilities.dp(22) : getMeasuredWidth() - AndroidUtilities.dp(42)) : lastTouchX; + } + @Override protected void onDraw(Canvas canvas) { if (animatedColorBackground != 0) { - float rad = Math.max(lastTouchX, getMeasuredWidth() - lastTouchX) + AndroidUtilities.dp(40); - float cx = lastTouchX; + float tx = getLastTouchX(); + float rad = Math.max(tx, getMeasuredWidth() - tx) + AndroidUtilities.dp(40); + float cx = tx; int cy = getMeasuredHeight() / 2; float animatedRad = rad * animationProgress; canvas.drawCircle(cx, cy, animatedRad, animationPaint); @@ -296,6 +335,10 @@ public class TextCheckCell extends FrameLayout { } } + public void setAnimatingToThumbInsteadOfTouch(boolean animatingToThumbInsteadOfTouch) { + isAnimatingToThumbInsteadOfTouch = animatingToThumbInsteadOfTouch; + } + @Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); @@ -304,4 +347,4 @@ public class TextCheckCell extends FrameLayout { info.setChecked(isChecked()); info.setContentDescription(isChecked() ? LocaleController.getString("NotificationsOn", R.string.NotificationsOn) : LocaleController.getString("NotificationsOff", R.string.NotificationsOff)); } -} +} \ No newline at end of file diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextCheckbox2Cell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextCheckbox2Cell.java new file mode 100644 index 000000000..7c0c5f9cc --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextCheckbox2Cell.java @@ -0,0 +1,300 @@ +package org.telegram.ui.Cells; + +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ObjectAnimator; +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.Typeface; +import android.text.TextUtils; +import android.util.Property; +import android.util.TypedValue; +import android.view.Gravity; +import android.view.MotionEvent; +import android.view.accessibility.AccessibilityNodeInfo; +import android.widget.FrameLayout; +import android.widget.TextView; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.LocaleController; +import org.telegram.messenger.R; +import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.Components.AnimationProperties; +import org.telegram.ui.Components.CheckBox2; +import org.telegram.ui.Components.CubicBezierInterpolator; +import org.telegram.ui.Components.LayoutHelper; +import org.telegram.ui.Components.Switch; + +import java.util.ArrayList; + +public class TextCheckbox2Cell extends FrameLayout { + + private TextView textView; + private TextView valueTextView; + public CheckBox2 checkbox; + private boolean needDivider; + private boolean isMultiline; + private int height = 50; + private int animatedColorBackground; + private float animationProgress; + private Paint animationPaint; + private float lastTouchX; + private ObjectAnimator animator; + private boolean drawCheckRipple; + + public static final Property ANIMATION_PROGRESS = new AnimationProperties.FloatProperty("animationProgress") { + @Override + public void setValue(TextCheckbox2Cell object, float value) { + object.setAnimationProgress(value); + object.invalidate(); + } + + @Override + public Float get(TextCheckbox2Cell object) { + return object.animationProgress; + } + }; + + + public TextCheckbox2Cell(Context context) { + this(context, 21); + } + + public TextCheckbox2Cell(Context context, int padding) { + this(context, padding, false); + } + + public TextCheckbox2Cell(Context context, int padding, boolean dialog) { + super(context); + + textView = new TextView(context); + textView.setTextColor(Theme.getColor(dialog ? Theme.key_dialogTextBlack : Theme.key_windowBackgroundWhiteBlackText)); + textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); + textView.setLines(1); + textView.setMaxLines(1); + textView.setSingleLine(true); + textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL); + textView.setEllipsize(TextUtils.TruncateAt.END); + addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? padding : 64, 0, LocaleController.isRTL ? 64 : padding, 0)); + + valueTextView = new TextView(context); + valueTextView.setTextColor(Theme.getColor(dialog ? Theme.key_dialogIcon : Theme.key_windowBackgroundWhiteGrayText2)); + valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13); + valueTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); + valueTextView.setLines(1); + valueTextView.setMaxLines(1); + valueTextView.setSingleLine(true); + valueTextView.setPadding(0, 0, 0, 0); + valueTextView.setEllipsize(TextUtils.TruncateAt.END); + addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? padding : 64, 36, LocaleController.isRTL ? 64 : padding, 0)); + + checkbox = new CheckBox2(context, 21); + checkbox.setDrawUnchecked(true); + checkbox.setDrawBackgroundAsArc(10); + checkbox.setDuration(100); + checkbox.setColor(Theme.key_radioBackgroundChecked, Theme.key_checkboxDisabled, Theme.key_checkboxCheck); + addView(checkbox, LayoutHelper.createFrame(20, 20, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL, 22, 0, 22, 0)); + + setClipChildren(false); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + if (isMultiline) { + super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); + } else { + super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(valueTextView.getVisibility() == VISIBLE ? 64 : height) + (needDivider ? 1 : 0), MeasureSpec.EXACTLY)); + } + } + + @Override + public boolean onTouchEvent(MotionEvent event) { + lastTouchX = event.getX(); + return super.onTouchEvent(event); + } + + public void setTextAndCheck(String text, boolean checked, boolean divider) { + textView.setText(text); + isMultiline = false; + checkbox.setChecked(checked, false); + needDivider = divider; + valueTextView.setVisibility(GONE); + LayoutParams layoutParams = (LayoutParams) textView.getLayoutParams(); + layoutParams.height = LayoutParams.MATCH_PARENT; + layoutParams.topMargin = 0; + textView.setLayoutParams(layoutParams); + setWillNotDraw(!divider); + } + + public void setColors(String key, String switchKey, String switchKeyChecked, String switchThumb, String switchThumbChecked) { + textView.setTextColor(Theme.getColor(key)); +// checkbox.setColors(switchKey, switchKeyChecked, switchThumb, switchThumbChecked); + textView.setTag(key); + } + + public void setTypeface(Typeface typeface) { + textView.setTypeface(typeface); + } + + public void setHeight(int value) { + height = value; + } + +// public void setDrawCheckRipple(boolean value) { +// drawCheckRipple = value; +// } + + @Override + public void setPressed(boolean pressed) { +// if (drawCheckRipple) { +// checkBox.setDrawRipple(pressed); +// } + super.setPressed(pressed); + } + + public void setTextAndValue(String text, String value, boolean multiline, boolean divider) { + textView.setText(text); + valueTextView.setText(value); +// checkbox.setChecked(checked, false); + needDivider = divider; + valueTextView.setVisibility(VISIBLE); + isMultiline = multiline; + if (multiline) { + valueTextView.setLines(0); + valueTextView.setMaxLines(0); + valueTextView.setSingleLine(false); + valueTextView.setEllipsize(null); + valueTextView.setPadding(0, 0, 0, AndroidUtilities.dp(11)); + } else { + valueTextView.setLines(1); + valueTextView.setMaxLines(1); + valueTextView.setSingleLine(true); + valueTextView.setEllipsize(TextUtils.TruncateAt.END); + valueTextView.setPadding(0, 0, 0, 0); + } + LayoutParams layoutParams = (LayoutParams) textView.getLayoutParams(); + layoutParams.height = LayoutParams.WRAP_CONTENT; + layoutParams.topMargin = AndroidUtilities.dp(10); + textView.setLayoutParams(layoutParams); + setWillNotDraw(!divider); + } + public void setTextAndValueAndCheck(String text, String value, boolean checked, boolean multiline, boolean divider) { + textView.setText(text); + valueTextView.setText(value); + checkbox.setChecked(checked, false); + needDivider = divider; + valueTextView.setVisibility(VISIBLE); + isMultiline = multiline; + if (multiline) { + valueTextView.setLines(0); + valueTextView.setMaxLines(0); + valueTextView.setSingleLine(false); + valueTextView.setEllipsize(null); + valueTextView.setPadding(0, 0, 0, AndroidUtilities.dp(11)); + } else { + valueTextView.setLines(1); + valueTextView.setMaxLines(1); + valueTextView.setSingleLine(true); + valueTextView.setEllipsize(TextUtils.TruncateAt.END); + valueTextView.setPadding(0, 0, 0, 0); + } + LayoutParams layoutParams = (LayoutParams) textView.getLayoutParams(); + layoutParams.height = LayoutParams.WRAP_CONTENT; + layoutParams.topMargin = AndroidUtilities.dp(10); + textView.setLayoutParams(layoutParams); + setWillNotDraw(!divider); + } + + public void setEnabled(boolean value, ArrayList animators) { + super.setEnabled(value); + if (animators != null) { + animators.add(ObjectAnimator.ofFloat(textView, "alpha", value ? 1.0f : 0.5f)); + animators.add(ObjectAnimator.ofFloat(checkbox, "alpha", value ? 1.0f : 0.5f)); + if (valueTextView.getVisibility() == VISIBLE) { + animators.add(ObjectAnimator.ofFloat(valueTextView, "alpha", value ? 1.0f : 0.5f)); + } + } else { + textView.setAlpha(value ? 1.0f : 0.5f); + checkbox.setAlpha(value ? 1.0f : 0.5f); + if (valueTextView.getVisibility() == VISIBLE) { + valueTextView.setAlpha(value ? 1.0f : 0.5f); + } + } + } + + public void setChecked(boolean checked) { + checkbox.setChecked(checked, true); + } + + public boolean isChecked() { + return checkbox.isChecked(); + } + + @Override + public void setBackgroundColor(int color) { + clearAnimation(); + animatedColorBackground = 0; + super.setBackgroundColor(color); + } + + public void setBackgroundColorAnimated(boolean checked, int color) { + if (animator != null) { + animator.cancel(); + animator = null; + } + if (animatedColorBackground != 0) { + setBackgroundColor(animatedColorBackground); + } + if (animationPaint == null) { + animationPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + } +// checkbox.setOverrideColor(checked ? 1 : 2); + animatedColorBackground = color; + animationPaint.setColor(animatedColorBackground); + animationProgress = 0.0f; + animator = ObjectAnimator.ofFloat(this, ANIMATION_PROGRESS, 0.0f, 1.0f); + animator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + setBackgroundColor(animatedColorBackground); + animatedColorBackground = 0; + invalidate(); + } + }); + animator.setInterpolator(CubicBezierInterpolator.EASE_OUT); + animator.setDuration(240).start(); + } + + private void setAnimationProgress(float value) { + animationProgress = value; + float rad = Math.max(lastTouchX, getMeasuredWidth() - lastTouchX) + AndroidUtilities.dp(40); + float cx = lastTouchX; + int cy = getMeasuredHeight() / 2; + float animatedRad = rad * animationProgress; +// checkbox.setOverrideColorProgress(cx, cy, animatedRad); + } + + @Override + protected void onDraw(Canvas canvas) { + if (animatedColorBackground != 0) { + float rad = Math.max(lastTouchX, getMeasuredWidth() - lastTouchX) + AndroidUtilities.dp(40); + float cx = lastTouchX; + int cy = getMeasuredHeight() / 2; + float animatedRad = rad * animationProgress; + canvas.drawCircle(cx, cy, animatedRad, animationPaint); + } + if (needDivider) { + canvas.drawLine(LocaleController.isRTL ? 0 : AndroidUtilities.dp(64), getMeasuredHeight() - 1, getMeasuredWidth() - (LocaleController.isRTL ? AndroidUtilities.dp(64) : 0), getMeasuredHeight() - 1, Theme.dividerPaint); + } + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName("android.widget.checkbox"); + info.setCheckable(true); + info.setChecked(checkbox.isChecked()); + info.setContentDescription(checkbox.isChecked() ? LocaleController.getString("NotificationsOn", R.string.NotificationsOn) : LocaleController.getString("NotificationsOff", R.string.NotificationsOff)); + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextDetailCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextDetailCell.java index ad305579b..1dd22696d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextDetailCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextDetailCell.java @@ -10,11 +10,15 @@ package org.telegram.ui.Cells; import android.content.Context; import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.drawable.Drawable; import android.text.TextUtils; import android.util.TypedValue; import android.view.Gravity; +import android.view.View; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.FrameLayout; +import android.widget.ImageView; import android.widget.TextView; import org.telegram.messenger.AndroidUtilities; @@ -26,8 +30,9 @@ import org.telegram.ui.Components.LayoutHelper; public class TextDetailCell extends FrameLayout { - private TextView textView; - private TextView valueTextView; + private final TextView textView; + private final TextView valueTextView; + private final ImageView imageView; private boolean needDivider; private boolean contentDescriptionValueFirst; @@ -54,6 +59,10 @@ public class TextDetailCell extends FrameLayout { valueTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); valueTextView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO); addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, 23, 33, 23, 0)); + + imageView = new ImageView(context); + imageView.setScaleType(ImageView.ScaleType.CENTER); + addView(imageView, LayoutHelper.createFrameRelatively(48, 48, Gravity.END | Gravity.CENTER_VERTICAL, 0, 0, 12, 0)); } @Override @@ -68,6 +77,26 @@ public class TextDetailCell extends FrameLayout { setWillNotDraw(!needDivider); } + public void setImage(Drawable drawable) { + imageView.setImageDrawable(drawable); + if (drawable == null) { + imageView.setBackground(null); + } else { + imageView.setBackground(Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(48), Color.TRANSPARENT, Theme.getColor(Theme.key_listSelector))); + } + int margin = AndroidUtilities.dp(23) + (drawable == null ? 0 : AndroidUtilities.dp(48)); + if (LocaleController.isRTL) { + ((MarginLayoutParams) textView.getLayoutParams()).leftMargin = margin; + } else { + ((MarginLayoutParams) textView.getLayoutParams()).rightMargin = margin; + } + textView.requestLayout(); + } + + public void setImageClickListener(View.OnClickListener clickListener) { + imageView.setOnClickListener(clickListener); + } + public void setTextWithEmojiAndValue(String text, CharSequence value, boolean divider) { textView.setText(Emoji.replaceEmoji(text, textView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false)); valueTextView.setText(value); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextRadioCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextRadioCell.java new file mode 100644 index 000000000..1e0d4f668 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextRadioCell.java @@ -0,0 +1,272 @@ +package org.telegram.ui.Cells; + +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ObjectAnimator; +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.Typeface; +import android.text.TextUtils; +import android.util.Property; +import android.util.TypedValue; +import android.view.Gravity; +import android.view.MotionEvent; +import android.view.accessibility.AccessibilityNodeInfo; +import android.widget.FrameLayout; +import android.widget.TextView; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.LocaleController; +import org.telegram.messenger.R; +import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.Components.AnimationProperties; +import org.telegram.ui.Components.CubicBezierInterpolator; +import org.telegram.ui.Components.LayoutHelper; +import org.telegram.ui.Components.RadioButton; +import org.telegram.ui.Components.Switch; + +import java.util.ArrayList; + +public class TextRadioCell extends FrameLayout { + + private TextView textView; + private TextView valueTextView; + private RadioButton radioButton; + private boolean needDivider; + private boolean isMultiline; + private int height = 50; + private int animatedColorBackground; + private float animationProgress; + private Paint animationPaint; + private float lastTouchX; + private ObjectAnimator animator; + private boolean drawCheckRipple; + + public static final Property ANIMATION_PROGRESS = new AnimationProperties.FloatProperty("animationProgress") { + @Override + public void setValue(TextRadioCell object, float value) { + object.setAnimationProgress(value); + object.invalidate(); + } + + @Override + public Float get(TextRadioCell object) { + return object.animationProgress; + } + }; + + public TextRadioCell(Context context) { + this(context, 21); + } + + public TextRadioCell(Context context, int padding) { + this(context, padding, false); + } + + public TextRadioCell(Context context, int padding, boolean dialog) { + super(context); + + textView = new TextView(context); + textView.setTextColor(Theme.getColor(dialog ? Theme.key_dialogTextBlack : Theme.key_windowBackgroundWhiteBlackText)); + textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); + textView.setLines(1); + textView.setMaxLines(1); + textView.setSingleLine(true); + textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL); + textView.setEllipsize(TextUtils.TruncateAt.END); + addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? padding : 64, 0, LocaleController.isRTL ? 64 : padding, 0)); + + valueTextView = new TextView(context); + valueTextView.setTextColor(Theme.getColor(dialog ? Theme.key_dialogIcon : Theme.key_windowBackgroundWhiteGrayText2)); + valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13); + valueTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); + valueTextView.setLines(1); + valueTextView.setMaxLines(1); + valueTextView.setSingleLine(true); + valueTextView.setPadding(0, 0, 0, 0); + valueTextView.setEllipsize(TextUtils.TruncateAt.END); + addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? padding : 64, 36, LocaleController.isRTL ? 64 : padding, 0)); + + radioButton = new RadioButton(context); + radioButton.setSize(AndroidUtilities.dp(20)); +// radioButton.setColors(Theme.key_switchTrack, Theme.key_switchTrackChecked, Theme.key_windowBackgroundWhite, Theme.key_windowBackgroundWhite); + radioButton.setColor(Theme.getColor(Theme.key_radioBackground), Theme.getColor(Theme.key_radioBackgroundChecked)); + addView(radioButton, LayoutHelper.createFrame(20, 20, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL, 22, 0, 22, 0)); + + setClipChildren(false); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + if (isMultiline) { + super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); + } else { + super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(valueTextView.getVisibility() == VISIBLE ? 64 : height) + (needDivider ? 1 : 0), MeasureSpec.EXACTLY)); + } + } + + @Override + public boolean onTouchEvent(MotionEvent event) { + lastTouchX = event.getX(); + return super.onTouchEvent(event); + } + + public void setTextAndCheck(String text, boolean checked, boolean divider) { + textView.setText(text); + isMultiline = false; + radioButton.setChecked(checked, false); + needDivider = divider; + valueTextView.setVisibility(GONE); + LayoutParams layoutParams = (LayoutParams) textView.getLayoutParams(); + layoutParams.height = LayoutParams.MATCH_PARENT; + layoutParams.topMargin = 0; + textView.setLayoutParams(layoutParams); + setWillNotDraw(!divider); + } + + public void setColors(String key, String switchKey, String switchKeyChecked, String switchThumb, String switchThumbChecked) { + textView.setTextColor(Theme.getColor(key)); +// radioButton.setColors(switchKey, switchKeyChecked, switchThumb, switchThumbChecked); + textView.setTag(key); + } + + public void setTypeface(Typeface typeface) { + textView.setTypeface(typeface); + } + + public void setHeight(int value) { + height = value; + } + +// public void setDrawCheckRipple(boolean value) { +// drawCheckRipple = value; +// } + + @Override + public void setPressed(boolean pressed) { +// if (drawCheckRipple) { +// checkBox.setDrawRipple(pressed); +// } + super.setPressed(pressed); + } + + public void setTextAndValueAndCheck(String text, String value, boolean checked, boolean multiline, boolean divider) { + textView.setText(text); + valueTextView.setText(value); + radioButton.setChecked(checked, false); + needDivider = divider; + valueTextView.setVisibility(VISIBLE); + isMultiline = multiline; + if (multiline) { + valueTextView.setLines(0); + valueTextView.setMaxLines(0); + valueTextView.setSingleLine(false); + valueTextView.setEllipsize(null); + valueTextView.setPadding(0, 0, 0, AndroidUtilities.dp(11)); + } else { + valueTextView.setLines(1); + valueTextView.setMaxLines(1); + valueTextView.setSingleLine(true); + valueTextView.setEllipsize(TextUtils.TruncateAt.END); + valueTextView.setPadding(0, 0, 0, 0); + } + LayoutParams layoutParams = (LayoutParams) textView.getLayoutParams(); + layoutParams.height = LayoutParams.WRAP_CONTENT; + layoutParams.topMargin = AndroidUtilities.dp(10); + textView.setLayoutParams(layoutParams); + setWillNotDraw(!divider); + } + + public void setEnabled(boolean value, ArrayList animators) { + super.setEnabled(value); + if (animators != null) { + animators.add(ObjectAnimator.ofFloat(textView, "alpha", value ? 1.0f : 0.5f)); + animators.add(ObjectAnimator.ofFloat(radioButton, "alpha", value ? 1.0f : 0.5f)); + if (valueTextView.getVisibility() == VISIBLE) { + animators.add(ObjectAnimator.ofFloat(valueTextView, "alpha", value ? 1.0f : 0.5f)); + } + } else { + textView.setAlpha(value ? 1.0f : 0.5f); + radioButton.setAlpha(value ? 1.0f : 0.5f); + if (valueTextView.getVisibility() == VISIBLE) { + valueTextView.setAlpha(value ? 1.0f : 0.5f); + } + } + } + + public void setChecked(boolean checked) { + radioButton.setChecked(checked, true); + } + + public boolean isChecked() { + return radioButton.isChecked(); + } + + @Override + public void setBackgroundColor(int color) { + clearAnimation(); + animatedColorBackground = 0; + super.setBackgroundColor(color); + } + + public void setBackgroundColorAnimated(boolean checked, int color) { + if (animator != null) { + animator.cancel(); + animator = null; + } + if (animatedColorBackground != 0) { + setBackgroundColor(animatedColorBackground); + } + if (animationPaint == null) { + animationPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + } +// radioButton.setOverrideColor(checked ? 1 : 2); + animatedColorBackground = color; + animationPaint.setColor(animatedColorBackground); + animationProgress = 0.0f; + animator = ObjectAnimator.ofFloat(this, ANIMATION_PROGRESS, 0.0f, 1.0f); + animator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + setBackgroundColor(animatedColorBackground); + animatedColorBackground = 0; + invalidate(); + } + }); + animator.setInterpolator(CubicBezierInterpolator.EASE_OUT); + animator.setDuration(240).start(); + } + + private void setAnimationProgress(float value) { + animationProgress = value; + float rad = Math.max(lastTouchX, getMeasuredWidth() - lastTouchX) + AndroidUtilities.dp(40); + float cx = lastTouchX; + int cy = getMeasuredHeight() / 2; + float animatedRad = rad * animationProgress; +// radioButton.setOverrideColorProgress(cx, cy, animatedRad); + } + + @Override + protected void onDraw(Canvas canvas) { + if (animatedColorBackground != 0) { + float rad = Math.max(lastTouchX, getMeasuredWidth() - lastTouchX) + AndroidUtilities.dp(40); + float cx = lastTouchX; + int cy = getMeasuredHeight() / 2; + float animatedRad = rad * animationProgress; + canvas.drawCircle(cx, cy, animatedRad, animationPaint); + } + if (needDivider) { + canvas.drawLine(LocaleController.isRTL ? 0 : AndroidUtilities.dp(64), getMeasuredHeight() - 1, getMeasuredWidth() - (LocaleController.isRTL ? AndroidUtilities.dp(64) : 0), getMeasuredHeight() - 1, Theme.dividerPaint); + } + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName("android.widget.RadioButton"); + info.setCheckable(true); + info.setChecked(radioButton.isChecked()); + info.setContentDescription(radioButton.isChecked() ? LocaleController.getString("NotificationsOn", R.string.NotificationsOn) : LocaleController.getString("NotificationsOff", R.string.NotificationsOff)); + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextSettingsCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextSettingsCell.java index 11d807a2f..a74ed321e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextSettingsCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextSettingsCell.java @@ -12,7 +12,6 @@ import android.animation.Animator; import android.animation.ObjectAnimator; import android.content.Context; import android.graphics.Canvas; -import android.graphics.Color; import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; @@ -28,6 +27,7 @@ import android.widget.TextView; import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.LocaleController; import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.Components.BackupImageView; import org.telegram.ui.Components.LayoutHelper; import java.util.ArrayList; @@ -36,6 +36,7 @@ public class TextSettingsCell extends FrameLayout { private TextView textView; private TextView valueTextView; + private BackupImageView valueBackupImageView; private ImageView valueImageView; private boolean needDivider; private boolean canDisable; @@ -95,6 +96,10 @@ public class TextSettingsCell extends FrameLayout { if (valueImageView.getVisibility() == VISIBLE) { valueImageView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.EXACTLY)); } + + if (valueBackupImageView != null) { + valueBackupImageView.measure(MeasureSpec.makeMeasureSpec(valueBackupImageView.getLayoutParams().height, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(valueBackupImageView.getLayoutParams().width, MeasureSpec.EXACTLY)); + } if (valueTextView.getVisibility() == VISIBLE) { valueTextView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.EXACTLY)); width = availableWidth - valueTextView.getMeasuredWidth() - AndroidUtilities.dp(8); @@ -273,4 +278,12 @@ public class TextSettingsCell extends FrameLayout { } invalidate(); } + + public BackupImageView getValueBackupImageView() { + if (valueBackupImageView == null) { + valueBackupImageView = new BackupImageView(getContext()); + addView(valueBackupImageView, LayoutHelper.createFrame(24, 24, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, padding, 0, padding, 0)); + } + return valueBackupImageView; + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ThemePreviewMessagesCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ThemePreviewMessagesCell.java index 2f5519620..e3af3caf2 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ThemePreviewMessagesCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ThemePreviewMessagesCell.java @@ -1,5 +1,9 @@ package org.telegram.ui.Cells; +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ValueAnimator; +import android.annotation.SuppressLint; import android.content.Context; import android.graphics.Canvas; import android.graphics.Shader; @@ -7,23 +11,32 @@ import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.GradientDrawable; +import android.view.GestureDetector; import android.view.MotionEvent; +import android.view.ViewTreeObserver; import android.widget.LinearLayout; +import androidx.core.content.ContextCompat; + import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MediaDataController; import org.telegram.messenger.MessageObject; import org.telegram.messenger.R; import org.telegram.messenger.UserConfig; import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.ActionBarLayout; +import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Components.BackgroundGradientDrawable; import org.telegram.ui.Components.LayoutHelper; import org.telegram.ui.Components.MotionBackgroundDrawable; +import org.telegram.ui.Components.Reactions.ReactionsEffectOverlay; public class ThemePreviewMessagesCell extends LinearLayout { + public final static int TYPE_REACTIONS_DOUBLE_TAP = 2; + private final Runnable invalidateRunnable = this::invalidate; private BackgroundGradientDrawable.Disposable backgroundGradientDisposable; @@ -34,10 +47,15 @@ public class ThemePreviewMessagesCell extends LinearLayout { private ChatMessageCell[] cells = new ChatMessageCell[2]; private Drawable shadowDrawable; private ActionBarLayout parentLayout; + private final int type; + public BaseFragment fragment; + + @SuppressLint("ClickableViewAccessibility") public ThemePreviewMessagesCell(Context context, ActionBarLayout layout, int type) { super(context); - + this.type = type; + int currentAccount = UserConfig.selectedAccount; parentLayout = layout; setWillNotDraw(false); @@ -47,92 +65,180 @@ public class ThemePreviewMessagesCell extends LinearLayout { shadowDrawable = Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow); int date = (int) (System.currentTimeMillis() / 1000) - 60 * 60; - TLRPC.Message message = new TLRPC.TL_message(); - if (type == 0) { - message.message = LocaleController.getString("FontSizePreviewReply", R.string.FontSizePreviewReply); - } else { - message.message = LocaleController.getString("NewThemePreviewReply", R.string.NewThemePreviewReply); - } - message.date = date + 60; - message.dialog_id = 1; - message.flags = 259; - message.from_id = new TLRPC.TL_peerUser(); - message.from_id.user_id = UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId(); - message.id = 1; - message.media = new TLRPC.TL_messageMediaEmpty(); - message.out = true; - message.peer_id = new TLRPC.TL_peerUser(); - message.peer_id.user_id = 0; - MessageObject replyMessageObject = new MessageObject(UserConfig.selectedAccount, message, true, false); - message = new TLRPC.TL_message(); - if (type == 0) { - message.message = LocaleController.getString("FontSizePreviewLine2", R.string.FontSizePreviewLine2); + MessageObject message1 = null; + MessageObject message2 = null; + if (type == TYPE_REACTIONS_DOUBLE_TAP) { + TLRPC.Message message = new TLRPC.TL_message(); + message.message = LocaleController.getString("DoubleTapPreviewMessage", R.string.DoubleTapPreviewMessage); + message.date = date + 60; + message.dialog_id = 1; + message.flags = 259; + message.from_id = new TLRPC.TL_peerUser(); + message.from_id.user_id = UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId(); + message.id = 1; + message.media = new TLRPC.TL_messageMediaEmpty(); + message.out = false; + message.peer_id = new TLRPC.TL_peerUser(); + message.peer_id.user_id = 0; + + message1 = new MessageObject(UserConfig.selectedAccount, message, true, false); + message1.resetLayout(); + message1.eventId = 1; + message1.customName = LocaleController.getString("DoubleTapPreviewSenderName", R.string.DoubleTapPreviewSenderName); + message1.customAvatarDrawable = ContextCompat.getDrawable(context, R.drawable.dino_pic); } else { - String text = LocaleController.getString("NewThemePreviewLine3", R.string.NewThemePreviewLine3); - StringBuilder builder = new StringBuilder(text); - int index1 = text.indexOf('*'); - int index2 = text.lastIndexOf('*'); - if (index1 != -1 && index2 != -1) { - builder.replace(index2, index2 + 1, ""); - builder.replace(index1, index1 + 1, ""); - TLRPC.TL_messageEntityTextUrl entityUrl = new TLRPC.TL_messageEntityTextUrl(); - entityUrl.offset = index1; - entityUrl.length = index2 - index1 - 1; - entityUrl.url = "https://telegram.org"; - message.entities.add(entityUrl); + TLRPC.Message message = new TLRPC.TL_message(); + if (type == 0) { + message.message = LocaleController.getString("FontSizePreviewReply", R.string.FontSizePreviewReply); + } else { + message.message = LocaleController.getString("NewThemePreviewReply", R.string.NewThemePreviewReply); } - message.message = builder.toString(); - } - message.date = date + 960; - message.dialog_id = 1; - message.flags = 259; - message.from_id = new TLRPC.TL_peerUser(); - message.from_id.user_id = UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId(); - message.id = 1; - message.media = new TLRPC.TL_messageMediaEmpty(); - message.out = true; - message.peer_id = new TLRPC.TL_peerUser(); - message.peer_id.user_id = 0; - MessageObject message1 = new MessageObject(UserConfig.selectedAccount, message, true, false); - message1.resetLayout(); - message1.eventId = 1; + message.date = date + 60; + message.dialog_id = 1; + message.flags = 259; + message.from_id = new TLRPC.TL_peerUser(); + message.from_id.user_id = UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId(); + message.id = 1; + message.media = new TLRPC.TL_messageMediaEmpty(); + message.out = true; + message.peer_id = new TLRPC.TL_peerUser(); + message.peer_id.user_id = 0; + MessageObject replyMessageObject = new MessageObject(UserConfig.selectedAccount, message, true, false); - message = new TLRPC.TL_message(); - if (type == 0) { - message.message = LocaleController.getString("FontSizePreviewLine1", R.string.FontSizePreviewLine1); - } else { - message.message = LocaleController.getString("NewThemePreviewLine1", R.string.NewThemePreviewLine1); + message = new TLRPC.TL_message(); + if (type == 0) { + message.message = LocaleController.getString("FontSizePreviewLine2", R.string.FontSizePreviewLine2); + } else { + String text = LocaleController.getString("NewThemePreviewLine3", R.string.NewThemePreviewLine3); + StringBuilder builder = new StringBuilder(text); + int index1 = text.indexOf('*'); + int index2 = text.lastIndexOf('*'); + if (index1 != -1 && index2 != -1) { + builder.replace(index2, index2 + 1, ""); + builder.replace(index1, index1 + 1, ""); + TLRPC.TL_messageEntityTextUrl entityUrl = new TLRPC.TL_messageEntityTextUrl(); + entityUrl.offset = index1; + entityUrl.length = index2 - index1 - 1; + entityUrl.url = "https://telegram.org"; + message.entities.add(entityUrl); + } + message.message = builder.toString(); + } + message.date = date + 960; + message.dialog_id = 1; + message.flags = 259; + message.from_id = new TLRPC.TL_peerUser(); + message.from_id.user_id = UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId(); + message.id = 1; + message.media = new TLRPC.TL_messageMediaEmpty(); + message.out = true; + message.peer_id = new TLRPC.TL_peerUser(); + message.peer_id.user_id = 0; + message1 = new MessageObject(UserConfig.selectedAccount, message, true, false); + message1.resetLayout(); + message1.eventId = 1; + + message = new TLRPC.TL_message(); + if (type == 0) { + message.message = LocaleController.getString("FontSizePreviewLine1", R.string.FontSizePreviewLine1); + } else { + message.message = LocaleController.getString("NewThemePreviewLine1", R.string.NewThemePreviewLine1); + } + message.date = date + 60; + message.dialog_id = 1; + message.flags = 257 + 8; + message.from_id = new TLRPC.TL_peerUser(); + message.id = 1; + message.reply_to = new TLRPC.TL_messageReplyHeader(); + message.reply_to.reply_to_msg_id = 5; + message.media = new TLRPC.TL_messageMediaEmpty(); + message.out = false; + message.peer_id = new TLRPC.TL_peerUser(); + message.peer_id.user_id = UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId(); + message2 = new MessageObject(UserConfig.selectedAccount, message, true, false); + if (type == 0) { + message2.customReplyName = LocaleController.getString("FontSizePreviewName", R.string.FontSizePreviewName); + } else { + message2.customReplyName = LocaleController.getString("NewThemePreviewName", R.string.NewThemePreviewName); + } + message2.eventId = 1; + message2.resetLayout(); + message2.replyMessageObject = replyMessageObject; } - message.date = date + 60; - message.dialog_id = 1; - message.flags = 257 + 8; - message.from_id = new TLRPC.TL_peerUser(); - message.id = 1; - message.reply_to = new TLRPC.TL_messageReplyHeader(); - message.reply_to.reply_to_msg_id = 5; - message.media = new TLRPC.TL_messageMediaEmpty(); - message.out = false; - message.peer_id = new TLRPC.TL_peerUser(); - message.peer_id.user_id = UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId(); - MessageObject message2 = new MessageObject(UserConfig.selectedAccount, message, true, false); - if (type == 0) { - message2.customReplyName = LocaleController.getString("FontSizePreviewName", R.string.FontSizePreviewName); - } else { - message2.customReplyName = LocaleController.getString("NewThemePreviewName", R.string.NewThemePreviewName); - } - message2.eventId = 1; - message2.resetLayout(); - message2.replyMessageObject = replyMessageObject; for (int a = 0; a < cells.length; a++) { - cells[a] = new ChatMessageCell(context); + cells[a] = new ChatMessageCell(context) { + private GestureDetector gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() { + @Override + public boolean onDoubleTap(MotionEvent e) { + boolean added = getMessageObject().selectReaction(MediaDataController.getInstance(currentAccount).getDoubleTapReaction(), false); + setMessageObject(getMessageObject(), null, false, false); + requestLayout(); + ReactionsEffectOverlay.removeCurrent(false); + if (added) { + ReactionsEffectOverlay.show(fragment, null, cells[1], e.getX(), e.getY(), MediaDataController.getInstance(currentAccount).getDoubleTapReaction(), currentAccount); + ReactionsEffectOverlay.startAnimation(); + } + getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { + @Override + public boolean onPreDraw() { + getViewTreeObserver().removeOnPreDrawListener(this); + getTransitionParams().resetAnimation(); + getTransitionParams().animateChange(); + getTransitionParams().animateChange = true; + getTransitionParams().animateChangeProgress = 0f; + ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, 1f); + valueAnimator.addUpdateListener(valueAnimator1 -> { + getTransitionParams().animateChangeProgress = (float) valueAnimator1.getAnimatedValue(); + invalidate(); + }); + valueAnimator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + super.onAnimationEnd(animation); + getTransitionParams().resetAnimation(); + getTransitionParams().animateChange = false; + getTransitionParams().animateChangeProgress = 1f; + } + }); + valueAnimator.start(); + return false; + } + }); + + return true; + } + }); + + @Override + public boolean onTouchEvent(MotionEvent event) { + gestureDetector.onTouchEvent(event); + return true; + } + + @Override + protected void dispatchDraw(Canvas canvas) { + if (getAvatarImage() != null && getAvatarImage().getImageHeight() != 0) { + getAvatarImage().setImageCoords(getAvatarImage().getImageX(), getMeasuredHeight() - getAvatarImage().getImageHeight() - AndroidUtilities.dp(4), getAvatarImage().getImageWidth(), getAvatarImage().getImageHeight()); + getAvatarImage().setRoundRadius((int) (getAvatarImage().getImageHeight() / 2f)); + getAvatarImage().draw(canvas); + } else if (type == TYPE_REACTIONS_DOUBLE_TAP) { + invalidate(); + } + super.dispatchDraw(canvas); + } + }; cells[a].setDelegate(new ChatMessageCell.ChatMessageCellDelegate() { }); - cells[a].isChat = false; + cells[a].isChat = type == TYPE_REACTIONS_DOUBLE_TAP; cells[a].setFullyDraw(true); - cells[a].setMessageObject(a == 0 ? message2 : message1, null, false, false); + MessageObject messageObject = a == 0 ? message2 : message1; + if (messageObject == null) { + continue; + } + cells[a].setMessageObject(messageObject, null, false, false); addView(cells[a], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); } } @@ -232,11 +338,17 @@ public class ThemePreviewMessagesCell extends LinearLayout { @Override public boolean onInterceptTouchEvent(MotionEvent ev) { + if (type == TYPE_REACTIONS_DOUBLE_TAP) { + return super.onInterceptTouchEvent(ev); + } return false; } @Override public boolean dispatchTouchEvent(MotionEvent ev) { + if (type == TYPE_REACTIONS_DOUBLE_TAP) { + return super.dispatchTouchEvent(ev); + } return false; } @@ -247,6 +359,9 @@ public class ThemePreviewMessagesCell extends LinearLayout { @Override public boolean onTouchEvent(MotionEvent event) { + if (type == TYPE_REACTIONS_DOUBLE_TAP) { + return super.onTouchEvent(event); + } return false; } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ThemesHorizontalListCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ThemesHorizontalListCell.java index 9c00a0538..562d23138 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ThemesHorizontalListCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ThemesHorizontalListCell.java @@ -393,7 +393,7 @@ public class ThemesHorizontalListCell extends RecyclerListView implements Notifi backgroundDrawable = drawable; hsv = AndroidUtilities.rgbToHsv(Color.red(themeInfo.getPreviewBackgroundColor()), Color.green(themeInfo.getPreviewBackgroundColor()), Color.blue(themeInfo.getPreviewBackgroundColor())); } else if (themeInfo.previewWallpaperOffset > 0 || themeInfo.pathToWallpaper != null) { - Bitmap wallpaper = getScaledBitmap(AndroidUtilities.dp(76), AndroidUtilities.dp(97), themeInfo.pathToWallpaper, themeInfo.pathToFile, themeInfo.previewWallpaperOffset); + Bitmap wallpaper = AndroidUtilities.getScaledBitmap(AndroidUtilities.dp(76), AndroidUtilities.dp(97), themeInfo.pathToWallpaper, themeInfo.pathToFile, themeInfo.previewWallpaperOffset); if (wallpaper != null) { backgroundDrawable = new BitmapDrawable(wallpaper); bitmapShader = new BitmapShader(wallpaper, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); @@ -803,56 +803,6 @@ public class ThemesHorizontalListCell extends RecyclerListView implements Notifi } } - public static Bitmap getScaledBitmap(float w, float h, String path, String streamPath, int streamOffset) { - FileInputStream stream = null; - try { - BitmapFactory.Options options = new BitmapFactory.Options(); - options.inJustDecodeBounds = true; - - if (path != null) { - BitmapFactory.decodeFile(path, options); - } else { - stream = new FileInputStream(streamPath); - stream.getChannel().position(streamOffset); - BitmapFactory.decodeStream(stream, null, options); - } - if (options.outWidth > 0 && options.outHeight > 0) { - if (w > h && options.outWidth < options.outHeight) { - float temp = w; - w = h; - h = temp; - } - float scale = Math.min(options.outWidth / w, options.outHeight / h); - options.inSampleSize = 1; - if (scale > 1.0f) { - do { - options.inSampleSize *= 2; - } while (options.inSampleSize < scale); - } - options.inJustDecodeBounds = false; - Bitmap wallpaper; - if (path != null) { - wallpaper = BitmapFactory.decodeFile(path, options); - } else { - stream.getChannel().position(streamOffset); - wallpaper = BitmapFactory.decodeStream(stream, null, options); - } - return wallpaper; - } - } catch (Throwable e) { - FileLog.e(e); - } finally { - try { - if (stream != null) { - stream.close(); - } - } catch (Exception e2) { - FileLog.e(e2); - } - } - return null; - } - @Override public void setBackgroundColor(int color) { super.setBackgroundColor(color); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index 19708f6e9..52c65942d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -14,6 +14,7 @@ import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; +import android.annotation.SuppressLint; import android.annotation.TargetApi; import android.app.Activity; import android.app.DatePickerDialog; @@ -64,7 +65,6 @@ import android.text.TextUtils; import android.text.style.CharacterStyle; import android.text.style.ForegroundColorSpan; import android.text.style.URLSpan; -import android.util.Log; import android.util.Property; import android.util.SparseArray; import android.util.SparseIntArray; @@ -86,6 +86,7 @@ import android.view.animation.DecelerateInterpolator; import android.widget.DatePicker; import android.widget.EditText; import android.widget.FrameLayout; +import android.widget.HorizontalScrollView; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.Space; @@ -96,12 +97,16 @@ import androidx.collection.LongSparseArray; import androidx.core.content.ContextCompat; import androidx.core.content.FileProvider; import androidx.core.graphics.ColorUtils; +import androidx.dynamicanimation.animation.SpringAnimation; +import androidx.dynamicanimation.animation.SpringForce; import androidx.recyclerview.widget.ChatListItemAnimator; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.GridLayoutManagerFixed; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearSmoothScrollerCustom; import androidx.recyclerview.widget.RecyclerView; +import androidx.viewpager.widget.PagerAdapter; +import androidx.viewpager.widget.ViewPager; import com.google.android.exoplayer2.ui.AspectRatioFrameLayout; @@ -125,6 +130,7 @@ import org.telegram.messenger.FileLog; import org.telegram.messenger.ForwardingMessagesParams; import org.telegram.messenger.ImageLocation; import org.telegram.messenger.ImageReceiver; +//import org.telegram.messenger.LanguageDetector; import org.telegram.messenger.LocaleController; import org.telegram.messenger.MediaController; import org.telegram.messenger.MediaDataController; @@ -193,6 +199,7 @@ import org.telegram.ui.Components.ChatAttachAlertDocumentLayout; import org.telegram.ui.Components.ChatAvatarContainer; import org.telegram.ui.Components.ChatBigEmptyView; import org.telegram.ui.Components.ChatGreetingsView; +import org.telegram.ui.Components.ChatScrimPopupContainerLayout; import org.telegram.ui.Components.ChatThemeBottomSheet; import org.telegram.ui.Components.ChecksHintView; import org.telegram.ui.Components.ClearHistoryAlert; @@ -215,6 +222,7 @@ import org.telegram.ui.Components.HintView; import org.telegram.ui.Components.ImportingAlert; import org.telegram.ui.Components.InstantCameraView; import org.telegram.ui.Components.InviteMembersBottomSheet; +import org.telegram.ui.Components.JoinGroupAlert; import org.telegram.ui.Components.LayoutHelper; import org.telegram.ui.Components.MessageBackgroundDrawable; import org.telegram.ui.Components.MotionBackgroundDrawable; @@ -225,6 +233,12 @@ import org.telegram.ui.Components.PipRoundVideoView; import org.telegram.ui.Components.PollVotesAlert; import org.telegram.ui.Components.RLottieDrawable; import org.telegram.ui.Components.RadialProgressView; +import org.telegram.ui.Components.ReactedHeaderView; +import org.telegram.ui.Components.ReactedUsersListView; +import org.telegram.ui.Components.ReactionTabHolderView; +import org.telegram.ui.Components.Reactions.ReactionsEffectOverlay; +import org.telegram.ui.Components.Reactions.ReactionsLayoutInBubble; +import org.telegram.ui.Components.ReactionsContainerLayout; import org.telegram.ui.Components.RecyclerAnimationScrollHelper; import org.telegram.ui.Components.RecyclerListView; import org.telegram.ui.Components.ReportAlert; @@ -236,6 +250,7 @@ import org.telegram.ui.Components.SizeNotifierFrameLayout; import org.telegram.ui.Components.StickersAlert; import org.telegram.ui.Components.TextSelectionHint; import org.telegram.ui.Components.TextStyleSpan; +import org.telegram.ui.Components.TranslateAlert; import org.telegram.ui.Components.TrendingStickersAlert; import org.telegram.ui.Components.TypefaceSpan; import org.telegram.ui.Components.URLSpanBotCommand; @@ -264,6 +279,8 @@ import java.util.List; import java.util.Map; import java.util.Stack; import java.util.concurrent.CountDownLatch; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -520,6 +537,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not private int scrollToOffsetOnRecreate = 0; private ArrayList pollsToCheck = new ArrayList<>(10); + private ArrayList reactionsToCheck = new ArrayList<>(10); private int editTextStart; private int editTextEnd; @@ -724,7 +742,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not private int popupAnimationIndex = -1; private AnimatorSet scrimAnimatorSet; private ActionBarPopupWindow scrimPopupWindow; - private ActionBarPopupWindow mesageSeenUsersPopupWindow; private int scrimPopupX, scrimPopupY; private ActionBarMenuSubItem[] scrimPopupWindowItems; private ActionBarMenuSubItem menuDeleteItem; @@ -828,6 +845,37 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not private TLRPC.TL_channels_sendAsPeers sendAsPeersObj; + private final static int OPTION_RETRY = 0; + private final static int OPTION_DELETE = 1; + private final static int OPTION_FORWARD = 2; + private final static int OPTION_COPY = 3; + private final static int OPTION_SAVE_TO_GALLERY = 4; + private final static int OPTION_APPLY_LOCALIZATION_OR_THEME = 5; + private final static int OPTION_SHARE = 6; + private final static int OPTION_SAVE_TO_GALLERY2 = 7; + private final static int OPTION_REPLY = 8; + private final static int OPTION_ADD_TO_STICKERS_OR_MASKS = 9; + private final static int OPTION_SAVE_TO_DOWNLOADS_OR_MUSIC = 10; + private final static int OPTION_ADD_TO_GIFS = 11; + private final static int OPTION_EDIT = 12; + private final static int OPTION_PIN = 13; + private final static int OPTION_UNPIN = 14; + private final static int OPTION_ADD_CONTACT = 15; + private final static int OPTION_COPY_PHONE_NUMBER = 16; + private final static int OPTION_CALL = 17; + private final static int OPTION_CALL_AGAIN = 18; + private final static int OPTION_RATE_CALL = 19; + private final static int OPTION_ADD_STICKER_TO_FAVORITES = 20; + private final static int OPTION_DELETE_STICKER_FROM_FAVORITES = 21; + private final static int OPTION_COPY_LINK = 22; + private final static int OPTION_REPORT_CHAT = 23; + private final static int OPTION_CANCEL_SENDING = 24; + private final static int OPTION_UNVOTE = 25; + private final static int OPTION_STOP_POLL_OR_QUIZ = 26; + private final static int OPTION_VIEW_REPLIES_OR_THREAD = 27; + private final static int OPTION_SEND_NOW = 100; + private final static int OPTION_EDIT_SCHEDULE_TIME = 102; + private final static int[] allowedNotificationsDuringChatListAnimations = new int[]{ NotificationCenter.messagesRead, NotificationCenter.threadMessagesRead, @@ -1253,9 +1301,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not private final static int text_regular = 54; private final static int text_strike = 55; private final static int text_underline = 56; + private final static int text_spoiler = 57; // NekoX - private final static int text_mention = 57; - private final static int text_transalte = 58; + private final static int text_mention = 157; + private final static int text_transalte = 158; private final static int search = 40; @@ -1284,16 +1333,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } return true; } - - @Override - public void onLongClickRelease() { - - } - - @Override - public void onMove(float dx, float dy) { - - } }; private void startMultiselect(int position) { @@ -1425,6 +1464,54 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } createMenu(view, true, false, x, y); } + + @Override + public boolean hasDoubleTap(View view, int position) { + TLRPC.TL_availableReaction reaction = getMediaDataController().getReactionsMap().get(getMediaDataController().getDoubleTapReaction()); + if (reaction == null) { + return false; + } + boolean available = dialog_id >= 0; + if (!available && chatInfo != null) { + for (String s : chatInfo.available_reactions) { + if (s.equals(reaction.reaction)) { + available = true; + break; + } + } + } + if (!available) { + return false; + } + return (view instanceof ChatMessageCell) && ((ChatMessageCell)view).getMessageObject().type != 16 && !actionBar.isActionModeShowed() && !isSecretChat() && !isInScheduleMode(); + } + + @Override + public void onDoubleTap(View view, int position, float x, float y) { + if (!(view instanceof ChatMessageCell) || getParentActivity() == null || isSecretChat() || isInScheduleMode()) { + return; + } + ChatMessageCell cell = (ChatMessageCell) view; + MessageObject primaryMessage = cell.getPrimaryMessageObject(); + ReactionsEffectOverlay.removeCurrent(false); + TLRPC.TL_availableReaction reaction = getMediaDataController().getReactionsMap().get(getMediaDataController().getDoubleTapReaction()); + if (reaction == null) { + return; + } + boolean available = dialog_id >= 0; + if (!available && chatInfo != null) { + for (String s : chatInfo.available_reactions) { + if (s.equals(reaction.reaction)) { + available = true; + break; + } + } + } + if (!available) { + return; + } + selectReaction(primaryMessage, null, x, y, reaction, true); + } }; private final ChatScrollCallback chatScrollHelperCallback = new ChatScrollCallback(); @@ -1664,6 +1751,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not getNotificationCenter().addObserver(this, NotificationCenter.scheduledMessagesUpdated); getNotificationCenter().addObserver(this, NotificationCenter.diceStickersDidLoad); getNotificationCenter().addObserver(this, NotificationCenter.dialogDeleted); + getNotificationCenter().addObserver(this, NotificationCenter.chatAvailableReactionsUpdated); super.onFragmentCreate(); @@ -1865,17 +1953,14 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } } - /** - * Gets same chats index difference - * [..., other_same, this, ...] => -1 - * [..., this, other_same, ...] => 1 - * [..., this, ...] => 0 - * @return Other same chats index difference - */ public int getOtherSameChatsDiff() { + if (parentLayout == null || parentLayout.fragmentsStack == null) { + return 0; + } int cur = parentLayout.fragmentsStack.indexOf(this); - if (cur == -1) + if (cur == -1) { cur = parentLayout.fragmentsStack.size(); + } int i = cur; for (int a = 0; a < parentLayout.fragmentsStack.size(); a++) { BaseFragment fragment = parentLayout.fragmentsStack.get(a); @@ -1979,6 +2064,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not getNotificationCenter().removeObserver(this, NotificationCenter.scheduledMessagesUpdated); getNotificationCenter().removeObserver(this, NotificationCenter.diceStickersDidLoad); getNotificationCenter().removeObserver(this, NotificationCenter.dialogDeleted); + getNotificationCenter().removeObserver(this, NotificationCenter.chatAvailableReactionsUpdated); getNotificationCenter().removeObserver(this, NotificationCenter.didLoadSponsoredMessages); getNotificationCenter().removeObserver(this, NotificationCenter.didLoadSendAsPeers); if (currentEncryptedChat != null) { @@ -2276,7 +2362,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not showDialog(alert); return; } - final boolean isChat = DialogObject.isChatDialog(dialog_id); AlertsCreator.createClearOrDeleteDialogAlert(ChatActivity.this, id == clear_history, currentChat, currentUser, currentEncryptedChat != null, true, (param) -> { if (id == clear_history && ChatObject.isChannel(currentChat) && (!currentChat.megagroup || !TextUtils.isEmpty(currentChat.username))) { @@ -2371,6 +2456,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not chatActivityEnterView.getEditField().setSelectionOverride(editTextStart, editTextEnd); chatActivityEnterView.getEditField().makeSelectedItalic(); } + } else if (id == text_spoiler) { + if (chatActivityEnterView != null) { + chatActivityEnterView.getEditField().setSelectionOverride(editTextStart, editTextEnd); + chatActivityEnterView.getEditField().makeSelectedSpoiler(); + } } else if (id == text_mono) { if (chatActivityEnterView != null) { chatActivityEnterView.getEditField().setSelectionOverride(editTextStart, editTextEnd); @@ -2483,6 +2573,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not }); } }); + } else { + actionBar.setSubtitle(LocaleController.getString("NoMessagesForThisDay", R.string.NoMessagesForThisDay)); } } }); @@ -2532,7 +2624,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not AndroidUtilities.updateViewVisibilityAnimated(avatarContainer, true, 0.95f, true); if (editTextItem != null && editTextItem.getTag() != null) { if (headerItem != null) { - Log.d("kek", "2"); headerItem.setVisibility(View.GONE); } if (editTextItem != null) { @@ -2549,7 +2640,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } } else if (chatActivityEnterView.hasText() && TextUtils.isEmpty(chatActivityEnterView.getSlowModeTimer()) && (currentChat == null || ChatObject.canSendMessages(currentChat))) { if (headerItem != null) { - Log.d("kek", "3"); headerItem.setVisibility(View.GONE); } if (editTextItem != null) { @@ -2660,7 +2750,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not searchItemVisible = false; } - if (chatMode == 0 && threadMessageId == 0 && !UserObject.isReplyUser(currentUser) && reportType < 0) { + if (chatMode == 0 && threadMessageId == 0 && !UserObject.isReplyUser(currentUser) && reportType < 0 && !inMenuMode) { TLRPC.UserFull userFull = null; if (currentUser != null) { // audioCallIconItem = menu.addItem(call, R.drawable.ic_call, themeDelegate); @@ -2701,6 +2791,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not editTextItem.addSubItem(text_transalte, LocaleController.getString("Translate", R.string.Translate)); + editTextItem.addSubItem(text_spoiler, LocaleController.getString("Spoiler", R.string.Spoiler)); SpannableStringBuilder stringBuilder = new SpannableStringBuilder(LocaleController.getString("Bold", R.string.Bold)); stringBuilder.setSpan(new TypefaceSpan(AndroidUtilities.getTypeface("fonts/rmedium.ttf")), 0, stringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); editTextItem.addSubItem(text_bold, stringBuilder); @@ -2866,7 +2957,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } actionModeOtherItem.addSubItem(nkbtn_translate, R.drawable.ic_translate, LocaleController.getString("Translate", R.string.Translate)); - if (NekomuraConfig.showShareMessages.Bool()) + if (NekomuraConfig.showShareMessages.Bool()) actionModeOtherItem.addSubItem(nkbtn_sharemessage, R.drawable.baseline_share_24, LocaleController.getString("ShareMessages", R.string.ShareMessages)); actionModeOtherItem.addSubItem(nkbtn_unpin, R.drawable.deproko_baseline_pin_undo_24, LocaleController.getString("UnpinMessage", R.string.UnpinMessage)); if (!noforward) @@ -3005,6 +3096,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not pullingDownDrawable = null; } emojiAnimationsOverlay.onDetachedFromWindow(); + ReactionsEffectOverlay.removeCurrent(true); } @Override @@ -3181,7 +3273,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } else if (type == 1) { cell.drawNamesLayout(canvas, alpha); } else { - cell.drawCaptionLayout(canvas, (cell.getCurrentPosition().flags & MessageObject.POSITION_FLAG_LEFT) == 0, alpha); + cell.drawCaptionLayout(canvas, cell.getCurrentPosition() != null && (cell.getCurrentPosition().flags & MessageObject.POSITION_FLAG_LEFT) == 0, alpha); } cell.setInvalidatesParent(false); canvas.restore(); @@ -3340,7 +3432,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } } - if (position != null || cell != null && cell.getTransitionParams().animateBackgroundBoundsInner) { + if (position != null || (cell != null && cell.getTransitionParams().animateBackgroundBoundsInner)) { if (position == null || position.last || position.minX == 0 && position.minY == 0) { if (position == null || position.last) { drawTimeAfter.add(cell); @@ -3349,7 +3441,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not drawNamesAfter.add(cell); } } - if ((cell.hasCaptionLayout() || cell.hasCommentLayout()) && (position == null || (position.flags & MessageObject.POSITION_FLAG_BOTTOM) != 0)) { + if (position == null || (position.flags & MessageObject.POSITION_FLAG_BOTTOM) != 0) { drawCaptionAfter.add(cell); } } @@ -3373,7 +3465,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (size > 0) { for (int a = 0; a < size; a++) { ChatMessageCell cell = drawCaptionAfter.get(a); - if (cell.getCurrentPosition() == null) { + if (cell.getCurrentPosition() == null && !cell.getTransitionParams().animateBackgroundBoundsInner) { continue; } drawChildElement(canvas, listTop, cell, 2); @@ -4408,7 +4500,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } } - @Override protected void dispatchDraw(Canvas canvas) { drawLaterRoundProgressCell = null; @@ -4831,7 +4922,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not ); } canvas.translate(canvasOffsetX, canvasOffsetY); + cell.setInvalidatesParent(true); cell.drawCaptionLayout(canvas, selectionOnly, alpha); + cell.setInvalidatesParent(false); canvas.restore(); } drawCaptionAfter.clear(); @@ -4873,7 +4966,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } } } - if (position != null || chatMessageCell.getTransitionParams().transformGroupToSingleMessage) { + if (position != null || chatMessageCell.getTransitionParams().transformGroupToSingleMessage || chatMessageCell.getTransitionParams().animateBackgroundBoundsInner) { if (num == count - 1) { float alpha = chatMessageCell.shouldDrawAlphaLayer() ? chatMessageCell.getAlpha() : 1f; float canvasOffsetX = chatMessageCell.getLeft() + chatMessageCell.getNonAnimationTranslationX(false); @@ -4899,7 +4992,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not canvas.translate(canvasOffsetX, canvasOffsetY); if (position == null || (position.flags & MessageObject.POSITION_FLAG_BOTTOM) != 0) { boolean selectionOnly = position != null && (position.flags & MessageObject.POSITION_FLAG_LEFT) == 0; + chatMessageCell.setInvalidatesParent(true); chatMessageCell.drawCaptionLayout(canvas, selectionOnly, alpha); + chatMessageCell.setInvalidatesParent(false); } canvas.restore(); } else { @@ -5158,6 +5253,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (currentEncryptedChat != null && Build.VERSION.SDK_INT >= 19) { chatListView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS); } + chatListView.setAccessibilityEnabled(false); chatListView.setNestedScrollingEnabled(false); chatListView.setInstantClick(true); chatListView.setDisableHighlightState(true); @@ -5503,6 +5599,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_LOW) { NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.startAllHeavyOperations, 512); } + NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.startSpoilers); chatListView.setOverScrollMode(RecyclerView.OVER_SCROLL_ALWAYS); textSelectionHelper.stopScrolling(); updateVisibleRows(); @@ -5524,6 +5621,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_LOW) { NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.stopAllHeavyOperations, 512); } + NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.stopSpoilers); } } @@ -5612,6 +5710,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not invalidateMessagesVisiblePart(); textSelectionHelper.onParentScrolled(); emojiAnimationsOverlay.onScrolled(dy); + ReactionsEffectOverlay.onScrolled(dy); } }); @@ -7300,7 +7399,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (editTextItem.getTag() == null) { editTextItem.setTag(1); editTextItem.setVisibility(View.VISIBLE); - Log.d("kek", "4"); headerItem.setVisibility(View.GONE); attachItem.setVisibility(View.GONE); } @@ -7311,7 +7409,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not editTextItem.setTag(null); editTextItem.setVisibility(View.GONE); if (chatActivityEnterView.hasText() && TextUtils.isEmpty(chatActivityEnterView.getSlowModeTimer())) { - Log.d("kek", "5"); headerItem.setVisibility(View.GONE); attachItem.setVisibility(View.VISIBLE); } else { @@ -7373,7 +7470,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } if (TextUtils.isEmpty(chatActivityEnterView.getSlowModeTimer())) { if (headerItem != null) { - Log.d("kek", "6"); headerItem.setVisibility(View.GONE); } if (attachItem != null) { @@ -11213,7 +11309,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not mess = mess.substring(0, 150); } mess = mess.replace('\n', ' '); - replyObjectTextView.setText(mess); + Spannable cs = new SpannableStringBuilder(mess); + MediaDataController.addTextStyleRuns(messageObjectToEdit, cs); + replyObjectTextView.setText(cs); } } } else if (messageObjectToReply != null) { @@ -11259,17 +11357,24 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not replyIconImageView.setContentDescription(LocaleController.getString("AccDescrReplying", R.string.AccDescrReplying)); replyCloseImageView.setContentDescription(LocaleController.getString("AccDescrCancelReply", R.string.AccDescrCancelReply)); + CharSequence replyObjectText = null; if (!TextUtils.isEmpty(restrictionReason)) { - replyObjectTextView.setText(restrictionReason); + replyObjectText = restrictionReason; } else if (messageObjectToReply.messageOwner.media instanceof TLRPC.TL_messageMediaGame) { - replyObjectTextView.setText(messageObjectToReply.messageOwner.media.game.title); + replyObjectText = Emoji.replaceEmoji(messageObjectToReply.messageOwner.media.game.title, replyObjectTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false); } else if (messageObjectToReply.messageText != null || messageObjectToReply.caption != null) { String mess = messageObjectToReply.caption != null ? messageObjectToReply.caption.toString() : messageObjectToReply.messageText.toString(); if (mess.length() > 150) { mess = mess.substring(0, 150); } mess = mess.replace('\n', ' '); - replyObjectTextView.setText(mess); + replyObjectText = Emoji.replaceEmoji(mess, replyObjectTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false); + } + if (replyObjectText != null) { + if (replyObjectText instanceof Spannable) + MediaDataController.addTextStyleRuns(messageObjectToReply.messageOwner.entities, messageObjectToReply.caption != null ? messageObjectToReply.caption : messageObjectToReply.messageText, (Spannable) replyObjectText); + + replyObjectTextView.setText(replyObjectText); } } else if (messageObjectsToForward != null) { if (messageObjectsToForward.isEmpty()) { @@ -11426,13 +11531,14 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } else { if ((type == -1 || type == 0 || type == 10 || type == 11) && (messageObjectsToForward.size() == 1 && messageObjectsToForward.get(0).messageText != null)) { MessageObject messageObject = messageObjectsToForward.get(0); - String mess = messageObject.messageText.toString(); + CharSequence mess = SpannableStringBuilder.valueOf(messageObject.messageText); + MediaDataController.addTextStyleRuns(messageObjectsToForward.get(0), (Spannable) mess); if (mess.length() > 150) { - mess = mess.substring(0, 150); + mess = mess.subSequence(0, 150); } - mess = mess.replace('\n', ' '); - String finalString = LocaleController.formatString("ForwardingFromNameAndMessage", R.string.ForwardingFromNameAndMessage, userNames, mess); - replyObjectTextView.setText(Emoji.replaceEmoji(finalString, replyObjectTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false)); + mess = AndroidUtilities.replaceNewLines(mess); + Spannable formatted = AndroidUtilities.formatSpannableSimple(LocaleController.getString("ForwardingFromNameAndMessage", R.string.ForwardingFromNameAndMessage), userNames, mess); + replyObjectTextView.setText(Emoji.replaceEmoji(formatted, replyObjectTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false)); } else { replyObjectTextView.setText(LocaleController.formatString("ForwardingFromNames", R.string.ForwardingFromNames, userNames)); } @@ -11892,6 +11998,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not int maxUnreadDate = Integer.MIN_VALUE; int recyclerChatViewHeight = (contentView.getHeightWithKeyboard() - (inPreviewMode ? 0 : AndroidUtilities.dp(48)) - chatListView.getTop()); pollsToCheck.clear(); + reactionsToCheck.clear(); float cilpTop = chatListViewPaddingTop; for (int a = 0; a < count; a++) { View view = chatListView.getChildAt(a); @@ -11975,6 +12082,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (messageObject.type == MessageObject.TYPE_POLL && messageObject.getId() > 0) { pollsToCheck.add(messageObject); } + if (messageObject.getId() > 0 && messageObject.messageOwner.action == null) { + reactionsToCheck.add(messageObject); + } } if (bottom <= cilpTop) { if (view instanceof ChatActionCell && messageObject.isDateObject) { @@ -12038,6 +12148,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } } getMessagesController().addToPollsQueue(dialog_id, pollsToCheck); + getMessagesController().addToReactionsQueue(dialog_id, reactionsToCheck); if (videoPlayerContainer != null) { if (!foundTextureViewMessage) { MessageObject messageObject = MediaController.getInstance().getPlayingMessageObject(); @@ -14754,14 +14865,25 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } if (startLoadFromDate != 0) { int dateObjectIndex = -1; + int closeDateObjectIndex = -1; + int closeDateDiff = 0; for (int i = 0; i < messages.size(); i++) { if (messages.get(i).isDateObject && Math.abs(startLoadFromDate - messages.get(i).messageOwner.date) <= 100) { dateObjectIndex = i; break; } + if (messages.get(i).isDateObject) { + int timeDiff = Math.abs(startLoadFromDate - messages.get(i).messageOwner.date); + if (closeDateObjectIndex == -1 || timeDiff < closeDateDiff) { + closeDateDiff = timeDiff; + closeDateObjectIndex = i; + } + } } - if (dateObjectIndex > 0) { + if (dateObjectIndex >= 0) { chatLayoutManager.scrollToPositionWithOffset(chatAdapter.messagesStartRow + dateObjectIndex, (int) (AndroidUtilities.dp(4)), false); + } else if (closeDateObjectIndex >= 0) { + chatLayoutManager.scrollToPositionWithOffset(chatAdapter.messagesStartRow + closeDateObjectIndex, chatListView.getMeasuredHeight() / 2 - AndroidUtilities.dp(24), false); } } } @@ -15908,8 +16030,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not MessageObject messageObject = messagesDict[did == dialog_id ? 0 : 1].get(msgId); if (messageObject != null) { MessageObject.updateReactions(messageObject.messageOwner, (TLRPC.TL_messageReactions) args[2]); - messageObject.measureInlineBotButtons(); - chatAdapter.updateRowWithMessageObject(messageObject, true); + chatAdapter.notifyDataSetChanged(true); } } } else if (id == NotificationCenter.didVerifyMessagesStickers) { @@ -16640,6 +16761,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not themeDelegate.setCurrentTheme(themeDelegate.chatTheme, true, theme.isDark()); } } + } else if (id == NotificationCenter.chatAvailableReactionsUpdated) { + long chatId = (long) args[0]; + if (chatId == -dialog_id) { + chatInfo = getMessagesController().getChatFull(chatId); + } } else if (id == NotificationCenter.dialogsUnreadCounterChanged) { if (actionBar != null) {//Nekomura actionBar.unreadBadgeSetCount(getMessagesStorage().getMainUnreadCount()); @@ -18371,40 +18497,40 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (Build.VERSION.SDK_INT >= 23) { menu.removeItem(android.R.id.shareText); } - menu.clear(); + int order = 0; + menu.add(android.R.id.cut, android.R.id.cut, order++, android.R.string.cut); + menu.add(android.R.id.copy, android.R.id.copy, order++, android.R.string.copy); + menu.add(android.R.id.paste, android.R.id.paste, order++, android.R.string.paste); - menu.add(android.R.id.cut, android.R.id.cut, 0, android.R.string.cut); - menu.add(android.R.id.copy, android.R.id.copy, 1, android.R.string.copy); - menu.add(android.R.id.paste, android.R.id.paste, 2, android.R.string.paste); - - menu.add(R.id.menu_translate, R.id.menu_translate, 5, LocaleController.getString("Translate", R.string.Translate)); + menu.add(R.id.menu_translate, R.id.menu_translate, order++, LocaleController.getString("Translate", R.string.Translate)); SpannableStringBuilder stringBuilder = new SpannableStringBuilder(LocaleController.getString("Bold", R.string.Bold)); stringBuilder.setSpan(new TypefaceSpan(AndroidUtilities.getTypeface("fonts/rmedium.ttf")), 0, stringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - menu.add(R.id.menu_groupbolditalic, R.id.menu_bold, 6, stringBuilder); + menu.add(R.id.menu_groupbolditalic, R.id.menu_bold, order++, stringBuilder); stringBuilder = new SpannableStringBuilder(LocaleController.getString("Italic", R.string.Italic)); stringBuilder.setSpan(new TypefaceSpan(AndroidUtilities.getTypeface("fonts/ritalic.ttf")), 0, stringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - menu.add(R.id.menu_groupbolditalic, R.id.menu_italic, 7, stringBuilder); + menu.add(R.id.menu_groupbolditalic, R.id.menu_italic, order++, stringBuilder); stringBuilder = new SpannableStringBuilder(LocaleController.getString("Mono", R.string.Mono)); stringBuilder.setSpan(new TypefaceSpan(Typeface.MONOSPACE), 0, stringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - menu.add(R.id.menu_groupbolditalic, R.id.menu_mono, 8, stringBuilder); + menu.add(R.id.menu_groupbolditalic, R.id.menu_mono, order++, stringBuilder); if (currentEncryptedChat == null || AndroidUtilities.getPeerLayerVersion(currentEncryptedChat.layer) >= 101) { stringBuilder = new SpannableStringBuilder(LocaleController.getString("Strike", R.string.Strike)); TextStyleSpan.TextStyleRun run = new TextStyleSpan.TextStyleRun(); run.flags |= TextStyleSpan.FLAG_STYLE_STRIKE; stringBuilder.setSpan(new TextStyleSpan(run), 0, stringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - menu.add(R.id.menu_groupbolditalic, R.id.menu_strike, 9, stringBuilder); + menu.add(R.id.menu_groupbolditalic, R.id.menu_strike, order++, stringBuilder); stringBuilder = new SpannableStringBuilder(LocaleController.getString("Underline", R.string.Underline)); run = new TextStyleSpan.TextStyleRun(); run.flags |= TextStyleSpan.FLAG_STYLE_UNDERLINE; stringBuilder.setSpan(new TextStyleSpan(run), 0, stringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - menu.add(R.id.menu_groupbolditalic, R.id.menu_underline, 10, stringBuilder); + menu.add(R.id.menu_groupbolditalic, R.id.menu_underline, order++, stringBuilder); } - menu.add(R.id.menu_groupbolditalic, R.id.menu_link, 11, LocaleController.getString("CreateLink", R.string.CreateLink)); - menu.add(R.id.menu_groupbolditalic, R.id.menu_mention, 12, LocaleController.getString("CreateMention", R.string.CreateMention)); + // NekoX: Move Spoiler back + menu.add(R.id.menu_groupbolditalic, R.id.menu_spoiler, order++, LocaleController.getString("Spoiler", R.string.Spoiler)); + menu.add(R.id.menu_groupbolditalic, R.id.menu_link, order++, LocaleController.getString("CreateLink", R.string.CreateLink)); + menu.add(R.id.menu_groupbolditalic, R.id.menu_mention, order++, LocaleController.getString("CreateMention", R.string.CreateMention)); menu.add(R.id.menu_groupbolditalic, R.id.menu_regular, 13, LocaleController.getString("Regular", R.string.Regular)); - } private void updateScheduledInterface(boolean animated) { @@ -19063,8 +19189,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not pinnedCounterTextView.setNumber(Math.min(total - 1, Math.max(1, total - currentPinnedMessageIndex[0])), animated && pinnedCounterTextView.getTag() == null); } } + CharSequence pinnedText = null; if (pinnedMessageObject.type == 14) { - messageTextView.setText(String.format("%s - %s", pinnedMessageObject.getMusicAuthor(), pinnedMessageObject.getMusicTitle())); + pinnedText = String.format("%s - %s", pinnedMessageObject.getMusicAuthor(), pinnedMessageObject.getMusicTitle()); } else if (pinnedMessageObject.type == MessageObject.TYPE_POLL) { TLRPC.TL_messageMediaPoll poll = (TLRPC.TL_messageMediaPoll) pinnedMessageObject.messageOwner.media; String mess = poll.poll.question; @@ -19072,23 +19199,29 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not mess = mess.substring(0, 150); } mess = mess.replace('\n', ' '); - messageTextView.setText(mess); + pinnedText = mess; } else if (pinnedMessageObject.messageOwner.media instanceof TLRPC.TL_messageMediaGame) { - messageTextView.setText(pinnedMessageObject.messageOwner.media.game.title); + pinnedText = Emoji.replaceEmoji(pinnedMessageObject.messageOwner.media.game.title, messageTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false); } else if (!TextUtils.isEmpty(pinnedMessageObject.caption)) { String mess = pinnedMessageObject.caption.toString(); if (mess.length() > 150) { mess = mess.substring(0, 150); } mess = mess.replace('\n', ' '); - messageTextView.setText(mess); + pinnedText = Emoji.replaceEmoji(mess, messageTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false); } else if (pinnedMessageObject.messageText != null) { String mess = pinnedMessageObject.messageText.toString(); if (mess.length() > 150) { mess = mess.substring(0, 150); } mess = mess.replace('\n', ' '); - messageTextView.setText(mess); + pinnedText = Emoji.replaceEmoji(mess, messageTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false); + } + if (pinnedText != null) { + if (pinnedText instanceof Spannable) + MediaDataController.addTextStyleRuns(pinnedMessageObject, (Spannable) pinnedText); + + messageTextView.setText(pinnedText); } if (animateToNext != 0) { pinnedNextAnimation[0] = new AnimatorSet(); @@ -20068,6 +20201,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not MediaDataController.addStyleToText(new TextStyleSpan(run), entity.offset, entity.offset + entity.length, stringBuilder, true); } else if (entity instanceof TLRPC.TL_messageEntityTextUrl) { stringBuilder.setSpan(new URLSpanReplacement(entity.url), entity.offset, entity.offset + entity.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + } else if (entity instanceof TLRPC.TL_messageEntitySpoiler) { + TextStyleSpan.TextStyleRun run = new TextStyleSpan.TextStyleRun(); + run.flags |= TextStyleSpan.FLAG_STYLE_SPOILER; + MediaDataController.addStyleToText(new TextStyleSpan(run), entity.offset, entity.offset + entity.length, stringBuilder, true); } } message = stringBuilder; @@ -20370,17 +20507,34 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not return caption; } + private static boolean isEmoji(String message){ + return message.matches("(?:[\uD83C\uDF00-\uD83D\uDDFF]|[\uD83E\uDD00-\uD83E\uDDFF]|" + + "[\uD83D\uDE00-\uD83D\uDE4F]|[\uD83D\uDE80-\uD83D\uDEFF]|" + + "[\u2600-\u26FF]\uFE0F?|[\u2700-\u27BF]\uFE0F?|\u24C2\uFE0F?|" + + "[\uD83C\uDDE6-\uD83C\uDDFF]{1,2}|" + + "[\uD83C\uDD70\uD83C\uDD71\uD83C\uDD7E\uD83C\uDD7F\uD83C\uDD8E\uD83C\uDD91-\uD83C\uDD9A]\uFE0F?|" + + "[\u0023\u002A\u0030-\u0039]\uFE0F?\u20E3|[\u2194-\u2199\u21A9-\u21AA]\uFE0F?|[\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55]\uFE0F?|" + + "[\u2934\u2935]\uFE0F?|[\u3030\u303D]\uFE0F?|[\u3297\u3299]\uFE0F?|" + + "[\uD83C\uDE01\uD83C\uDE02\uD83C\uDE1A\uD83C\uDE2F\uD83C\uDE32-\uD83C\uDE3A\uD83C\uDE50\uD83C\uDE51]\uFE0F?|" + + "[\u203C\u2049]\uFE0F?|[\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE]\uFE0F?|" + + "[\u00A9\u00AE]\uFE0F?|[\u2122\u2139]\uFE0F?|\uD83C\uDC04\uFE0F?|\uD83C\uDCCF\uFE0F?|" + + "[\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA]\uFE0F?)+"); + } private void createMenu(View v, boolean single, boolean listView, float x, float y, boolean searchGroup) { if (actionBar.isActionModeShowed() || reportType >= 0) { return; } MessageObject message; + MessageObject primaryMessage; if (v instanceof ChatMessageCell) { message = ((ChatMessageCell) v).getMessageObject(); + primaryMessage = ((ChatMessageCell) v).getPrimaryMessageObject(); } else if (v instanceof ChatActionCell) { message = ((ChatActionCell) v).getMessageObject(); + primaryMessage = message; } else { + primaryMessage = null; message = null; } if (message == null) { @@ -20516,96 +20670,119 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not ArrayList items = new ArrayList<>(); final ArrayList options = new ArrayList<>(); + CharSequence messageText = null; if (type >= 0 || type == -1 && single && (message.isSending() || message.isEditing()) && currentEncryptedChat == null) { selectedObject = message; selectedObjectGroup = groupedMessages; + messageText = getMessageCaption(selectedObject, selectedObjectGroup); // used only in translations + if (messageText == null && selectedObject.isPoll()) { + try { + TLRPC.Poll poll = ((TLRPC.TL_messageMediaPoll) selectedObject.messageOwner.media).poll; + StringBuilder pollText = new StringBuilder(); + pollText = new StringBuilder(poll.question).append("\n"); + for (TLRPC.TL_pollAnswer answer : poll.answers) + pollText.append("\n\uD83D\uDD18 ").append(answer.text); + messageText = pollText.toString(); + } catch (Exception e) {} + } + if (messageText == null) + messageText = getMessageContent(selectedObject, 0, false); + if (messageText != null) { + if (isEmoji(messageText.toString())) + messageText = null; // message fully consists of emojis, do not translate + } if (type == -1) { if ((selectedObject.type == 0 || selectedObject.isAnimatedEmoji() || getMessageCaption(selectedObject, selectedObjectGroup) != null) && !getMessagesController().isChatNoForwards(currentChat)) { items.add(LocaleController.getString("Copy", R.string.Copy)); - options.add(3); + options.add(OPTION_COPY); icons.add(R.drawable.baseline_content_copy_24); } items.add(LocaleController.getString("CancelSending", R.string.CancelSending)); - options.add(24); + options.add(OPTION_CANCEL_SENDING); icons.add(R.drawable.baseline_delete_24); } else if (type == 0) { items.add(LocaleController.getString("Retry", R.string.Retry)); - options.add(0); + options.add(OPTION_RETRY); icons.add(R.drawable.baseline_replay_24); items.add(LocaleController.getString("Delete", R.string.Delete)); - options.add(1); + options.add(OPTION_DELETE); icons.add(selectedObject.messageOwner.ttl_period != 0 ? R.drawable.msg_delete_auto : R.drawable.baseline_delete_24); } else if (type == 1) { if (currentChat != null) { if (allowChatActions) { items.add(LocaleController.getString("Reply", R.string.Reply)); - options.add(8); + options.add(OPTION_REPLY); icons.add(R.drawable.baseline_reply_24); } if (!isThreadChat() && chatMode != MODE_SCHEDULED && message.hasReplies() && currentChat.megagroup && message.canViewThread()) { items.add(LocaleController.formatPluralString("ViewReplies", message.getRepliesCount())); - options.add(27); + options.add(OPTION_VIEW_REPLIES_OR_THREAD); icons.add(R.drawable.floating_message); } if (allowUnpin) { items.add(LocaleController.getString("UnpinMessage", R.string.UnpinMessage)); - options.add(14); + options.add(OPTION_UNPIN); icons.add(R.drawable.deproko_baseline_pin_undo_24); } else if (allowPin) { items.add(LocaleController.getString("PinMessage", R.string.PinMessage)); - options.add(13); + options.add(OPTION_PIN); icons.add(R.drawable.deproko_baseline_pin_24); } if (message.canEditMessage(currentChat)) { items.add(LocaleController.getString("Edit", R.string.Edit)); - options.add(12); + options.add(OPTION_EDIT); icons.add(R.drawable.baseline_edit_24); } + if (!selectedObject.isOutOwner() && (messageText != null && messageText.length() > 0 && !selectedObject.isAnimatedEmoji() && !selectedObject.isDice()) && MessagesController.getGlobalMainSettings().getBoolean("translate_button", false)) { + items.add(LocaleController.getString("TranslateMessage", R.string.TranslateMessage)); + options.add(29); + icons.add(R.drawable.msg_translate); + } if (NekomuraConfig.showReport.Bool() && selectedObject.contentType == 0 && !selectedObject.isMediaEmptyWebpage() && selectedObject.getId() > 0 && !selectedObject.isOut() && (currentChat != null || currentUser != null && currentUser.bot)) { items.add(LocaleController.getString("ReportChat", R.string.ReportChat)); - options.add(23); + options.add(OPTION_REPORT_CHAT); icons.add(R.drawable.baseline_report_24); } } else { if (selectedObject.getId() > 0 && allowChatActions) { items.add(LocaleController.getString("Reply", R.string.Reply)); - options.add(8); + options.add(OPTION_REPLY); icons.add(R.drawable.baseline_reply_24); } } if (message.canDeleteMessage(chatMode == MODE_SCHEDULED, currentChat) && (threadMessageObjects == null || !threadMessageObjects.contains(message))) { items.add(LocaleController.getString("Delete", R.string.Delete)); - options.add(1); + options.add(OPTION_DELETE); icons.add(selectedObject.messageOwner.ttl_period != 0 ? R.drawable.msg_delete_auto : R.drawable.baseline_delete_24); } } else if (type == 20) { items.add(LocaleController.getString("Retry", R.string.Retry)); - options.add(0); + options.add(OPTION_RETRY); icons.add(R.drawable.baseline_replay_24); if (!getMessagesController().isChatNoForwards(currentChat)) { items.add(LocaleController.getString("Copy", R.string.Copy)); - options.add(3); + options.add(OPTION_COPY); icons.add(R.drawable.baseline_content_copy_24); } items.add(LocaleController.getString("Delete", R.string.Delete)); - options.add(1); + options.add(OPTION_DELETE); icons.add(selectedObject.messageOwner.ttl_period != 0 ? R.drawable.msg_delete_auto : R.drawable.baseline_delete_24); } else { if (currentEncryptedChat == null) { if (chatMode == MODE_SCHEDULED) { items.add(LocaleController.getString("MessageScheduleSend", R.string.MessageScheduleSend)); - options.add(100); + options.add(OPTION_SEND_NOW); icons.add(R.drawable.deproko_baseline_send_24); } if (selectedObject.messageOwner.action instanceof TLRPC.TL_messageActionPhoneCall) { TLRPC.TL_messageActionPhoneCall call = (TLRPC.TL_messageActionPhoneCall) message.messageOwner.action; items.add((call.reason instanceof TLRPC.TL_phoneCallDiscardReasonMissed || call.reason instanceof TLRPC.TL_phoneCallDiscardReasonBusy) && !message.isOutOwner() ? LocaleController.getString("CallBack", R.string.CallBack) : LocaleController.getString("CallAgain", R.string.CallAgain)); - options.add(18); + options.add(OPTION_CALL_AGAIN); icons.add(R.drawable.baseline_call_24); if (VoIPHelper.canRateCall(call)) { items.add(LocaleController.getString("CallMessageReportProblem", R.string.CallMessageReportProblem)); - options.add(19); + options.add(OPTION_RATE_CALL); icons.add(R.drawable.baseline_star_24); } } @@ -20965,6 +21142,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not options.add(102); icons.add(R.drawable.baseline_date_range_24); } + if (!selectedObject.isOutOwner() && (messageText != null && messageText.length() > 0 && !selectedObject.isAnimatedEmoji() && !selectedObject.isDice()) && MessagesController.getGlobalMainSettings().getBoolean("translate_button", false)) { + items.add(LocaleController.getString("TranslateMessage", R.string.TranslateMessage)); + options.add(29); + icons.add(R.drawable.msg_translate); + } if (chatMode != MODE_SCHEDULED && selectedObject.contentType == 0 && selectedObject.getId() > 0 && !selectedObject.isOut() && (currentChat != null || currentUser != null && currentUser.bot)) { if (UserObject.isReplyUser(currentUser)) { items.add(LocaleController.getString("BlockContact", R.string.BlockContact)); @@ -21167,6 +21349,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } } } + if (options.isEmpty()) { return; } @@ -21181,13 +21364,332 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not Rect rect = new Rect(); - ActionBarPopupWindow.ActionBarPopupWindowLayout popupLayout = new ActionBarPopupWindow.ActionBarPopupWindowLayout(getParentActivity()); + List availableReacts = getMediaDataController().getEnabledReactionsList(); + boolean isReactionsViewAvailable = !isSecretChat() && !isInScheduleMode() && currentUser == null && message.hasReactions() && (!ChatObject.isChannel(currentChat) || currentChat.megagroup) && !availableReacts.isEmpty() && message.messageOwner.reactions.can_see_list; + boolean isReactionsAvailable = !isSecretChat() && !isInScheduleMode() && message.isReactionsAvailable() && (chatInfo != null && !chatInfo.available_reactions.isEmpty() || (chatInfo == null && !ChatObject.isChannel(currentChat)) || currentUser != null) && !availableReacts.isEmpty(); + boolean showMessageSeen = !isReactionsViewAvailable && !isInScheduleMode() && currentChat != null && message.isOutOwner() && message.isSent() && !message.isEditing() && !message.isSending() && !message.isSendError() && !message.isContentUnread() && !message.isUnread() && (ConnectionsManager.getInstance(currentAccount).getCurrentTime() - message.messageOwner.date < getMessagesController().chatReadMarkExpirePeriod) && (ChatObject.isMegagroup(currentChat) || !ChatObject.isChannel(currentChat)) && chatInfo != null && chatInfo.participants_count < getMessagesController().chatReadMarkSizeThreshold && !(message.messageOwner.action instanceof TLRPC.TL_messageActionChatJoinedByRequest) && (v instanceof ChatMessageCell); + + int flags = 0; + if (isReactionsViewAvailable || showMessageSeen) { + flags |= ActionBarPopupWindow.ActionBarPopupWindowLayout.FLAG_USE_SWIPEBACK; + } + + final AtomicBoolean waitForLangDetection = new AtomicBoolean(false); + final AtomicReference onLangDetectionDone = new AtomicReference(null); + + ActionBarPopupWindow.ActionBarPopupWindowLayout popupLayout = new ActionBarPopupWindow.ActionBarPopupWindowLayout(getParentActivity(), R.drawable.popup_fixed_alert, themeDelegate, flags); popupLayout.setMinimumWidth(AndroidUtilities.dp(200)); Rect backgroundPaddings = new Rect(); Drawable shadowDrawable = getParentActivity().getResources().getDrawable(R.drawable.popup_fixed_alert).mutate(); shadowDrawable.getPadding(backgroundPaddings); popupLayout.setBackgroundColor(getThemedColor(Theme.key_actionBarDefaultSubmenuBackground)); + if (isReactionsViewAvailable) { + ReactedHeaderView reactedView = new ReactedHeaderView(contentView.getContext(), currentAccount, message, dialog_id); + + int count = 0; + if (message.messageOwner.reactions != null) { + for (TLRPC.TL_reactionCount r : message.messageOwner.reactions.results) { + count += r.count; + } + } + boolean hasHeader = count > 10; + LinearLayout linearLayout = new LinearLayout(contentView.getContext()) { + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + int size = MeasureSpec.getSize(widthMeasureSpec); + if (size < AndroidUtilities.dp(240)) { + size = AndroidUtilities.dp(240); + } + super.onMeasure(MeasureSpec.makeMeasureSpec(size, MeasureSpec.EXACTLY), heightMeasureSpec); + } + }; + linearLayout.setOrientation(LinearLayout.VERTICAL); + linearLayout.setLayoutParams(new FrameLayout.LayoutParams(AndroidUtilities.dp(200), AndroidUtilities.dp(6 * 48 + (hasHeader ? 44 * 2 + 8 : 44)) + (!hasHeader ? 1 : 0))); + ActionBarMenuSubItem backCell = new ActionBarMenuSubItem(getParentActivity(), true, true, themeDelegate); + backCell.setItemHeight(44); + backCell.setTextAndIcon(LocaleController.getString("Back", R.string.Back), R.drawable.msg_arrow_back); + backCell.getTextView().setPadding(LocaleController.isRTL ? 0 : AndroidUtilities.dp(40), 0, LocaleController.isRTL ? AndroidUtilities.dp(40) : 0, 0); + backCell.setOnClickListener(v1 -> popupLayout.getSwipeBack().closeForeground()); + linearLayout.addView(backCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + + int[] foregroundIndex = new int[1]; + + if (hasHeader) { + List counters = message.messageOwner.reactions.results; + LinearLayout tabsView = new LinearLayout(contentView.getContext()); + tabsView.setOrientation(LinearLayout.HORIZONTAL); + ViewPager pager = new ViewPager(contentView.getContext()); + HorizontalScrollView tabsScrollView = new HorizontalScrollView(contentView.getContext()); + + AtomicBoolean suppressTabsScroll = new AtomicBoolean(); + int size = counters.size() + 1; + for (int i = 0; i < size; i++) { + ReactionTabHolderView hv = new ReactionTabHolderView(contentView.getContext()); + if (i == 0) { + hv.setCounter(count); + } else hv.setCounter(currentAccount, counters.get(i - 1)); + int finalI = i; + hv.setOnClickListener(v1 -> { + int from = pager.getCurrentItem(); + if (finalI == from) return; + + ReactionTabHolderView fv = (ReactionTabHolderView) tabsView.getChildAt(from); + suppressTabsScroll.set(true); + pager.setCurrentItem(finalI, true); + float fSX = tabsScrollView.getScrollX(), tSX = hv.getX() - (tabsScrollView.getWidth() - hv.getWidth()) / 2f; + ValueAnimator a = ValueAnimator.ofFloat(0, 1).setDuration(150); + a.setInterpolator(CubicBezierInterpolator.DEFAULT); + a.addUpdateListener(animation -> { + float f = (float) animation.getAnimatedValue(); + tabsScrollView.setScrollX((int) (fSX + (tSX - fSX) * f)); + fv.setOutlineProgress(1f - f); + hv.setOutlineProgress(f); + }); + a.start(); + }); + tabsView.addView(hv, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.CENTER_VERTICAL, i == 0 ? 6 : 0, 6, 6, 6)); + } + tabsScrollView.setHorizontalScrollBarEnabled(false); + tabsScrollView.addView(tabsView); + linearLayout.addView(tabsScrollView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 44)); + + View divider = new FrameLayout(contentView.getContext()); + divider.setBackgroundColor(Theme.getColor(Theme.key_graySection)); + linearLayout.addView(divider, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) Theme.dividerPaint.getStrokeWidth())); + + int head = AndroidUtilities.dp(44 * 2) + 1; + SparseArray cachedViews = new SparseArray<>(); + SparseIntArray cachedHeights = new SparseIntArray(); + for (int i = 0; i < counters.size() + 1; i++) + cachedHeights.put(i, head + AndroidUtilities.dp(ReactedUsersListView.ITEM_HEIGHT_DP * ReactedUsersListView.VISIBLE_ITEMS)); + pager.setAdapter(new PagerAdapter() { + @Override + public int getCount() { + return counters.size() + 1; + } + + @Override + public boolean isViewFromObject(View view, Object object) { + return view == object; + } + + @Override + public Object instantiateItem(ViewGroup container, int position) { + View cached = cachedViews.get(position); + if (cached != null) { + container.addView(cached); + return cached; + } + ReactedUsersListView v = new ReactedUsersListView(container.getContext(), themeDelegate, currentAccount, message, position == 0 ? null : counters.get(position - 1), true) + .setSeenUsers(reactedView.getSeenUsers()) + .setOnProfileSelectedListener((view, userId) -> { + Bundle args = new Bundle(); + args.putLong("user_id", userId); + ProfileActivity fragment = new ProfileActivity(args); + presentFragment(fragment); + if (scrimPopupWindow != null) { + scrimPopupWindow.dismiss(); + } + }).setOnHeightChangedListener((view, newHeight) -> { + cachedHeights.put(position, head + newHeight); + if (pager.getCurrentItem() == position) + popupLayout.getSwipeBack().setNewForegroundHeight(foregroundIndex[0], head + newHeight); + }); + if (position == 0) + reactedView.setSeenCallback(v::setSeenUsers); + + container.addView(v); + cachedViews.put(position, v); + return v; + } + + @Override + public void destroyItem(ViewGroup container, int position, Object object) { + container.removeView((View) object); + } + }); + pager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { + @Override + public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { + if (!suppressTabsScroll.get()) { + float fX = -1, tX = -1; + for (int i = 0; i < tabsView.getChildCount(); i++) { + ReactionTabHolderView ch = (ReactionTabHolderView) tabsView.getChildAt(i); + ch.setOutlineProgress(i == position ? 1f - positionOffset : i == (position + 1) % size ? positionOffset : 0); + if (i == position) { + fX = ch.getX() - (tabsScrollView.getWidth() - ch.getWidth()) / 2f; + } + if (i == position + 1) { + tX = ch.getX() - (tabsScrollView.getWidth() - ch.getWidth()) / 2f; + } + } + + if (fX != -1 && tX != -1) + tabsScrollView.setScrollX((int) (fX + (tX - fX) * positionOffset)); + } + } + + @Override + public void onPageSelected(int position) { + int h = cachedHeights.get(position); + popupLayout.getSwipeBack().setNewForegroundHeight(foregroundIndex[0], h); + } + + @Override + public void onPageScrollStateChanged(int state) { + if (state == ViewPager.SCROLL_STATE_IDLE) { + suppressTabsScroll.set(false); + } + } + }); + linearLayout.addView(pager, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 0, 1f)); + } else { + View gap = new FrameLayout(contentView.getContext()); + gap.setBackgroundColor(Theme.getColor(Theme.key_graySection)); + linearLayout.addView(gap, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 8)); + + ReactedUsersListView lv = new ReactedUsersListView(contentView.getContext(), themeDelegate, currentAccount, message, null, true) + .setSeenUsers(reactedView.getSeenUsers()) + .setOnProfileSelectedListener((view, userId) -> { + Bundle args = new Bundle(); + args.putLong("user_id", userId); + ProfileActivity fragment = new ProfileActivity(args); + presentFragment(fragment); + if (scrimPopupWindow != null) { + scrimPopupWindow.dismiss(); + } + }).setOnHeightChangedListener((view, newHeight) -> popupLayout.getSwipeBack().setNewForegroundHeight(foregroundIndex[0], AndroidUtilities.dp(44 + 8) + newHeight)); + reactedView.setSeenCallback(lv::setSeenUsers); + linearLayout.addView(lv, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 0, 1f)); + } + + foregroundIndex[0] = popupLayout.addViewToSwipeBack(linearLayout); + + reactedView.setOnClickListener(v1 -> { + popupLayout.getSwipeBack().openForeground(foregroundIndex[0]); + }); + popupLayout.addView(reactedView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48)); + + View gap = new FrameLayout(contentView.getContext()); + gap.setBackgroundColor(Theme.getColor(Theme.key_graySection)); + popupLayout.addView(gap, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 8)); + } + + MessageSeenView messageSeenView = null; + if (showMessageSeen) { + messageSeenView = new MessageSeenView(contentView.getContext(), currentAccount, message, currentChat); + FrameLayout messageSeenLayout = new FrameLayout(contentView.getContext()); + messageSeenLayout.addView(messageSeenView); + MessageSeenView finalMessageSeenView = messageSeenView; + + ActionBarMenuSubItem cell = new ActionBarMenuSubItem(getParentActivity(), true, true, themeDelegate); + cell.setItemHeight(44); + cell.setTextAndIcon(LocaleController.getString("Back", R.string.Back), R.drawable.msg_arrow_back); + cell.getTextView().setPadding(LocaleController.isRTL ? 0 : AndroidUtilities.dp(40), 0, LocaleController.isRTL ? AndroidUtilities.dp(40) : 0, 0); + + FrameLayout backContainer = new FrameLayout(contentView.getContext()); + + LinearLayout linearLayout = new LinearLayout(contentView.getContext()); + linearLayout.setBackgroundColor(getThemedColor(Theme.key_actionBarDefaultSubmenuBackground)); + linearLayout.setOrientation(LinearLayout.VERTICAL); + RecyclerListView listView2 = finalMessageSeenView.createListView(); + backContainer.addView(cell); + linearLayout.addView(backContainer); + backContainer.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + popupLayout.getSwipeBack().closeForeground(); + } + }); + + int[] foregroundIndex = new int[1]; + messageSeenView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + if (scrimPopupWindow == null || finalMessageSeenView.users.isEmpty()) { + return; + } + if (finalMessageSeenView.users.size() == 1) { + TLRPC.User user = finalMessageSeenView.users.get(0); + if (user == null) { + return; + } + Bundle args = new Bundle(); + args.putLong("user_id", user.id); + ProfileActivity fragment = new ProfileActivity(args); + presentFragment(fragment); + if (scrimPopupWindow != null) { + scrimPopupWindow.dismiss(); + } + return; + } + + int totalHeight = contentView.getHeightWithKeyboard(); + int availableHeight = totalHeight - scrimPopupY - AndroidUtilities.dp(46 + 16) - (isReactionsAvailable ? AndroidUtilities.dp(52) : 0); + + if (SharedConfig.messageSeenHintCount > 0 && contentView.getKeyboardHeight() < AndroidUtilities.dp(20)) { + availableHeight -= AndroidUtilities.dp(52); + Bulletin bulletin = BulletinFactory.of(ChatActivity.this).createErrorBulletin(AndroidUtilities.replaceTags(LocaleController.getString("MessageSeenTooltipMessage", R.string.MessageSeenTooltipMessage))); + bulletin.tag = 1; + bulletin.setDuration(4000); + bulletin.show(); + SharedConfig.updateMessageSeenHintCount(SharedConfig.messageSeenHintCount - 1); + } else if (contentView.getKeyboardHeight() > AndroidUtilities.dp(20)) { + availableHeight -=contentView.getKeyboardHeight() / 3f; + } + + int listViewTotalHeight = AndroidUtilities.dp(8) + AndroidUtilities.dp(44) * listView2.getAdapter().getItemCount(); + + if (listViewTotalHeight > availableHeight) { + if (availableHeight > AndroidUtilities.dp(620)) { + listView2.getLayoutParams().height = AndroidUtilities.dp(620); + } else { + listView2.getLayoutParams().height = availableHeight; + } + } else { + listView2.getLayoutParams().height = listViewTotalHeight; + } + linearLayout.getLayoutParams().height = AndroidUtilities.dp(44) + listView2.getLayoutParams().height; + listView2.requestLayout(); + linearLayout.requestLayout(); + listView2.getAdapter().notifyDataSetChanged(); + popupLayout.getSwipeBack().openForeground(foregroundIndex[0]); + } + }); + linearLayout.addView(listView2, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 320)); + + listView2.setOnItemClickListener((view1, position) -> { + TLRPC.User user = finalMessageSeenView.users.get(position); + if (user == null) { + return; + } + Bundle args = new Bundle(); + args.putLong("user_id", user.id); + ProfileActivity fragment = new ProfileActivity(args); + presentFragment(fragment); + }); + + foregroundIndex[0] = popupLayout.addViewToSwipeBack(linearLayout); + + popupLayout.addView(messageSeenLayout, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 44)); + + View gap = new FrameLayout(contentView.getContext()); + gap.setBackgroundColor(Theme.getColor(Theme.key_graySection)); + popupLayout.addView(gap, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 8)); + } + + if (popupLayout.getSwipeBack() != null) { + popupLayout.getSwipeBack().setOnClickListener(v1 -> { + if (scrimPopupWindow != null) { + scrimPopupWindow.dismiss(); + scrimPopupWindow = null; + menuDeleteItem = null; + scrimPopupWindowItems = null; + } + }); + } + scrimPopupWindowItems = new ActionBarMenuSubItem[items.size() + (selectedObject.isSponsored() ? 1 : 0)]; for (int a = 0, N = items.size(); a < N; a++) { if (a == 0 && selectedObject.isSponsored()) { @@ -21244,7 +21746,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not scrimPopupWindow.dismiss(); } }); - cell.setOnLongClickListener(v1 -> { + if (option == 29) { + // NekoX: Official Translation Removed + } + cell.setOnLongClickListener(v1 -> { if (selectedObject == null || i < 0 || i >= options.size()) { return false; } @@ -21260,7 +21765,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not }); } - LinearLayout scrimPopupContainerLayout = new LinearLayout(contentView.getContext()) { + ChatScrimPopupContainerLayout scrimPopupContainerLayout = new ChatScrimPopupContainerLayout(contentView.getContext()) { @Override public boolean dispatchKeyEvent(KeyEvent event) { if (event.getKeyCode() == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0 && scrimPopupWindow != null && scrimPopupWindow.isShowing()) { @@ -21292,181 +21797,59 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not return false; } }); - scrimPopupContainerLayout.setOrientation(LinearLayout.VERTICAL); - boolean showMessageSeen = !isInScheduleMode() && currentChat != null && message.isOutOwner() && message.isSent() && !message.isEditing() && !message.isSending() && !message.isSendError() && !message.isContentUnread() && !message.isUnread() && (ConnectionsManager.getInstance(currentAccount).getCurrentTime() - message.messageOwner.date < 7 * 86400) && (ChatObject.isMegagroup(currentChat) || !ChatObject.isChannel(currentChat)) && chatInfo != null && chatInfo.participants_count <= getMessagesController().chatReadMarkSizeThreshold && !(message.messageOwner.action instanceof TLRPC.TL_messageActionChatJoinedByRequest) && (v instanceof ChatMessageCell); - boolean showNoForwards = getMessagesController().isChatNoForwards(currentChat) && message.messageOwner.action == null && message.isSent() && !message.isEditing() && chatMode != MODE_SCHEDULED; - MessageSeenView messageSeenView = null; - if (showMessageSeen) { - messageSeenView = new MessageSeenView(contentView.getContext(), currentAccount, message, currentChat); - Drawable shadowDrawable2 = ContextCompat.getDrawable(contentView.getContext(), R.drawable.popup_fixed_alert).mutate(); - shadowDrawable2.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground), PorterDuff.Mode.MULTIPLY)); - FrameLayout messageSeenLayout = new FrameLayout(contentView.getContext()); - messageSeenLayout.addView(messageSeenView); - messageSeenLayout.setBackground(shadowDrawable2); - MessageSeenView finalMessageSeenView = messageSeenView; - messageSeenView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - if (scrimPopupWindow == null || finalMessageSeenView.users.isEmpty()) { - return; + // NekoX: Merge 8.4.1, remove showMessageSeen here + + ReactionsContainerLayout reactionsLayout = new ReactionsContainerLayout(contentView.getContext(), getResourceProvider()); + if (isReactionsAvailable) { + int pad = 22; + int sPad = 24; + reactionsLayout.setPadding(AndroidUtilities.dp(4) + (LocaleController.isRTL ? 0 : sPad), AndroidUtilities.dp(4), AndroidUtilities.dp(4) + (LocaleController.isRTL ? sPad : 0), AndroidUtilities.dp(pad)); + List l; + if (chatInfo != null) { + l = new ArrayList<>(chatInfo.available_reactions.size()); + for (String s : chatInfo.available_reactions) { + for (TLRPC.TL_availableReaction a : getMediaDataController().getEnabledReactionsList()) { + if (a.reaction.equals(s)) { + l.add(a); + break; + } } - int totalHeight = contentView.getHeightWithKeyboard(); - int availableHeight = totalHeight - scrimPopupY - AndroidUtilities.dp(46 + 16); - - if (SharedConfig.messageSeenHintCount > 0 && contentView.getKeyboardHeight() < AndroidUtilities.dp(20)) { - availableHeight -= AndroidUtilities.dp(52); - Bulletin bulletin = BulletinFactory.of(ChatActivity.this).createErrorBulletin(AndroidUtilities.replaceTags(LocaleController.getString("MessageSeenTooltipMessage", R.string.MessageSeenTooltipMessage))); - bulletin.tag = 1; - bulletin.setDuration(4000); - bulletin.show(); - SharedConfig.updateMessageSeenHintCount(SharedConfig.messageSeenHintCount - 1); - } else if (contentView.getKeyboardHeight() > AndroidUtilities.dp(20)) { - availableHeight -= contentView.getKeyboardHeight() / 3f; - } - View previousPopupContentView = scrimPopupWindow.getContentView(); - - ActionBarMenuSubItem cell = new ActionBarMenuSubItem(getParentActivity(), true, true, themeDelegate); - cell.setItemHeight(44); - cell.setTextAndIcon(LocaleController.getString("Back", R.string.Back), R.drawable.msg_arrow_back); - cell.getTextView().setPadding(LocaleController.isRTL ? 0 : AndroidUtilities.dp(40), 0, LocaleController.isRTL ? AndroidUtilities.dp(40) : 0, 0); - - Drawable shadowDrawable2 = ContextCompat.getDrawable(contentView.getContext(), R.drawable.popup_fixed_alert).mutate(); - shadowDrawable2.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground), PorterDuff.Mode.MULTIPLY)); - FrameLayout backContainer = new FrameLayout(contentView.getContext()); - backContainer.setBackground(shadowDrawable2); - - LinearLayout linearLayout = new LinearLayout(contentView.getContext()) { - @Override - protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - super.onMeasure(MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(260), MeasureSpec.AT_MOST), heightMeasureSpec); - setPivotX(getMeasuredWidth() - AndroidUtilities.dp(8)); - setPivotY(AndroidUtilities.dp(8)); - } - - @Override - public boolean dispatchKeyEvent(KeyEvent event) { - if (event.getKeyCode() == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0 && scrimPopupWindow != null && scrimPopupWindow.isShowing()) { - if (mesageSeenUsersPopupWindow != null) { - mesageSeenUsersPopupWindow.dismiss(); - } - } - return super.dispatchKeyEvent(event); - } - }; - linearLayout.setOnTouchListener(new View.OnTouchListener() { - - private int[] pos = new int[2]; - - @Override - public boolean onTouch(View v, MotionEvent event) { - if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { - if (mesageSeenUsersPopupWindow != null && mesageSeenUsersPopupWindow.isShowing()) { - View contentView = mesageSeenUsersPopupWindow.getContentView(); - contentView.getLocationInWindow(pos); - rect.set(pos[0], pos[1], pos[0] + contentView.getMeasuredWidth(), pos[1] + contentView.getMeasuredHeight()); - if (!rect.contains((int) event.getX(), (int) event.getY())) { - mesageSeenUsersPopupWindow.dismiss(); - } - } - } else if (event.getActionMasked() == MotionEvent.ACTION_OUTSIDE) { - if (mesageSeenUsersPopupWindow != null && mesageSeenUsersPopupWindow.isShowing()) { - mesageSeenUsersPopupWindow.dismiss(); - } - } - return false; - } - }); - linearLayout.setOrientation(LinearLayout.VERTICAL); - RecyclerListView listView = finalMessageSeenView.createListView(); - int listViewTotalHeight = AndroidUtilities.dp(8) + AndroidUtilities.dp(44) * listView.getAdapter().getItemCount() + AndroidUtilities.dp(16); - - backContainer.addView(cell); - linearLayout.addView(backContainer); - linearLayout.addView(listView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 320, 0, -8, 0, 0)); - - if (listViewTotalHeight > availableHeight) { - if (availableHeight > AndroidUtilities.dp(620)) { - listView.getLayoutParams().height = AndroidUtilities.dp(620); - } else { - listView.getLayoutParams().height = availableHeight; - } - } else { - listView.getLayoutParams().height = listViewTotalHeight; - } - - Drawable shadowDrawable3 = ContextCompat.getDrawable(contentView.getContext(), R.drawable.popup_fixed_alert).mutate(); - shadowDrawable3.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground), PorterDuff.Mode.MULTIPLY)); - listView.setBackground(shadowDrawable3); - boolean[] backButtonPressed = new boolean[1]; - - mesageSeenUsersPopupWindow = new ActionBarPopupWindow(linearLayout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT) { - @Override - public void dismiss(boolean animated) { - super.dismiss(animated); - if (backButtonPressed[0]) { - linearLayout.animate().alpha(0).scaleX(0).scaleY(0).setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT).setDuration(350); - previousPopupContentView.animate().alpha(1f).scaleX(1).scaleY(1).setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT).setDuration(350); - } else { - if (scrimPopupWindow != null) { - scrimPopupWindow.dismiss(); - - contentView.invalidate(); - chatListView.invalidate(); - } - } - if (Bulletin.getVisibleBulletin() != null && Bulletin.getVisibleBulletin().tag == 1) { - Bulletin.getVisibleBulletin().hide(); - } - mesageSeenUsersPopupWindow = null; - } - }; - mesageSeenUsersPopupWindow.setOutsideTouchable(true); - mesageSeenUsersPopupWindow.setClippingEnabled(true); - mesageSeenUsersPopupWindow.setFocusable(true); - mesageSeenUsersPopupWindow.setInputMethodMode(ActionBarPopupWindow.INPUT_METHOD_NOT_NEEDED); - mesageSeenUsersPopupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED); - mesageSeenUsersPopupWindow.getContentView().setFocusableInTouchMode(true); - - mesageSeenUsersPopupWindow.showAtLocation(chatListView, Gravity.LEFT | Gravity.TOP, scrimPopupX, scrimPopupY); - previousPopupContentView.setPivotX(AndroidUtilities.dp(8)); - previousPopupContentView.setPivotY(AndroidUtilities.dp(8)); - previousPopupContentView.animate().alpha(0).scaleX(0f).scaleY(0f).setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT).setDuration(350); - - linearLayout.setAlpha(0f); - linearLayout.setScaleX(0f); - linearLayout.setScaleY(0f); - linearLayout.animate().alpha(1f).scaleX(1f).scaleY(1f).setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT).setDuration(350); - - backContainer.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - if (mesageSeenUsersPopupWindow != null) { - mesageSeenUsersPopupWindow.setEmptyOutAnimation(250); - backButtonPressed[0] = true; - mesageSeenUsersPopupWindow.dismiss(true); - } - } - }); - - listView.setOnItemClickListener((view1, position) -> { - TLRPC.User user = finalMessageSeenView.users.get(position); - if (user == null) { - return; - } - Bundle args = new Bundle(); - args.putLong("user_id", user.id); - ProfileActivity fragment = new ProfileActivity(args); - presentFragment(fragment); - if (mesageSeenUsersPopupWindow != null) { - mesageSeenUsersPopupWindow.dismiss(); - } - }); } + } else { + l = getMediaDataController().getEnabledReactionsList(); + } + reactionsLayout.setReactionsList(l); + reactionsLayout.setDelegate((rView, reaction) -> { + selectReaction(primaryMessage, reactionsLayout, 0, 0, reaction, false); }); - scrimPopupContainerLayout.addView(messageSeenLayout, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 60)); - } - scrimPopupContainerLayout.addView(popupLayout, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 0, showMessageSeen ? -8 : 0, 0, showNoForwards ? -8 : 0)); + LinearLayout.LayoutParams params = LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 52 + pad, Gravity.RIGHT, 0, 0, 0, -20); + int size = params.height - reactionsLayout.getPaddingTop() - reactionsLayout.getPaddingBottom(); + if (size * l.size() < AndroidUtilities.dp(200)) + params.width = ViewGroup.LayoutParams.WRAP_CONTENT; + scrimPopupContainerLayout.addView(reactionsLayout, params); + scrimPopupContainerLayout.reactionsLayout = reactionsLayout; + + reactionsLayout.setTransitionProgress(0); + if (popupLayout.getSwipeBack() != null) { + popupLayout.getSwipeBack().setOnSwipeBackProgressListener((layout, toProgress, progress) -> { + if (toProgress == 0) { + reactionsLayout.setTransitionProgress(0); + reactionsLayout.setAlpha(1f); + new SpringAnimation(reactionsLayout, ReactionsContainerLayout.TRANSITION_PROGRESS_VALUE) + .setSpring(new SpringForce().setFinalPosition(100) + .setStiffness(240) + .setDampingRatio(0.7f)) + .start(); + } else if (toProgress == 1) + reactionsLayout.setAlpha(1f - progress); + }); + } + } + + boolean showNoForwards = getMessagesController().isChatNoForwards(currentChat) && message.messageOwner.action == null && message.isSent() && !message.isEditing() && chatMode != MODE_SCHEDULED; + scrimPopupContainerLayout.addView(popupLayout, LayoutHelper.createLinearRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START, isReactionsAvailable ? 16 : 0, 0, isReactionsAvailable ? 36 : 0, 0)); + scrimPopupContainerLayout.popupWindowLayout = popupLayout; if (showNoForwards) { popupLayout.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); boolean isChannel = ChatObject.isChannel(currentChat) && !currentChat.megagroup; @@ -21528,9 +21911,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (chatActivityEnterView != null) { chatActivityEnterView.getEditField().setAllowDrawCursor(true); } - if (mesageSeenUsersPopupWindow != null) { - mesageSeenUsersPopupWindow.dismiss(); - } } }; scrimPopupWindow.setPauseNotifications(true); @@ -21546,7 +21926,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not popupLayout.setFitItems(true); if (messageSeenView != null) { - messageSeenView.getLayoutParams().width = scrimPopupContainerLayout.getMeasuredWidth() - AndroidUtilities.dp(16); + messageSeenView.getLayoutParams().width = scrimPopupContainerLayout.getMeasuredWidth() - (isReactionsAvailable ? AndroidUtilities.dp(56) : 0) - AndroidUtilities.dp(16); } int popupX = v.getLeft() + (int) x - scrimPopupContainerLayout.getMeasuredWidth() + backgroundPaddings.left - AndroidUtilities.dp(28); if (popupX < AndroidUtilities.dp(6)) { @@ -21580,6 +21960,22 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not popupY = inBubbleMode ? 0 : AndroidUtilities.statusBarHeight; } scrimPopupWindow.showAtLocation(chatListView, Gravity.LEFT | Gravity.TOP, scrimPopupX = popupX, scrimPopupY = popupY); + if (isReactionsAvailable) { + reactionsLayout.setTransitionProgress(0); + new SpringAnimation(reactionsLayout, ReactionsContainerLayout.TRANSITION_PROGRESS_VALUE) + .setSpring(new SpringForce().setFinalPosition(100) + .setStiffness(240) + .setDampingRatio(0.7f)) + .start(); + } + final int finalPopupX = scrimPopupX = popupX; + final int finalPopupY = scrimPopupY = popupY; + Runnable showMenu = () -> scrimPopupWindow.showAtLocation(chatListView, Gravity.LEFT | Gravity.TOP, finalPopupX, finalPopupY); + if (waitForLangDetection.get()) { + onLangDetectionDone.set(showMenu); + } else { + showMenu.run(); + } chatListView.stopScroll(); chatLayoutManager.setCanScrollVertically(false); scrimView = v; @@ -21682,6 +22078,91 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } } + Runnable updateReactionRunnable; + private void selectReaction(MessageObject primaryMessage, ReactionsContainerLayout reactionsLayout, float x, float y, TLRPC.TL_availableReaction reaction, boolean fromDoubleTap) { + ReactionsEffectOverlay.removeCurrent(false); + boolean added = primaryMessage.selectReaction(reaction.reaction, fromDoubleTap); + int messageIdForCell = primaryMessage.getId(); + if (groupedMessagesMap.get(primaryMessage.getGroupId()) != null) { + MessageObject messageObject = groupedMessagesMap.get(primaryMessage.getGroupId()).findMessageWithFlags(MessageObject.POSITION_FLAG_BOTTOM | MessageObject.POSITION_FLAG_LEFT); + if (messageObject != null) { + messageIdForCell = messageObject.getId(); + } + } + + int finalMessageIdForCell = messageIdForCell; + + if (added && !fromDoubleTap) { + ChatMessageCell cell = findMessageCell(finalMessageIdForCell); + ReactionsEffectOverlay.show(ChatActivity.this, reactionsLayout, cell, x, y, reaction.reaction, currentAccount); + } + getSendMessagesHelper().sendReaction(primaryMessage, added ? reaction.reaction : null, ChatActivity.this, updateReactionRunnable = new Runnable() { + @Override + public void run() { + if (updateReactionRunnable != null) { + updateReactionRunnable = null; + if (fromDoubleTap) { + doOnIdle(() -> { + AndroidUtilities.runOnUIThread(() -> { + ChatMessageCell cell = findMessageCell(finalMessageIdForCell); + if (added) { + ReactionsEffectOverlay.show(ChatActivity.this, reactionsLayout, cell, x, y, reaction.reaction, currentAccount); + ReactionsEffectOverlay.startAnimation(); + } + }, 50); + }); + } else { + updateMessageAnimated(primaryMessage); + ReactionsEffectOverlay.startAnimation(); + } + + if (scrimPopupWindow != null) { + scrimPopupWindow.dismiss(); + } + } + } + }); + //updateReactionRunnable.run(); + + if (fromDoubleTap) { + updateMessageAnimated(primaryMessage); + updateReactionRunnable.run(); + } + AndroidUtilities.runOnUIThread(updateReactionRunnable, 50); + + + } + + @SuppressLint("NotifyDataSetChanged") + private void updateMessageAnimated(MessageObject message) { + if (chatAdapter == null) { + return; + } + getNotificationCenter().doOnIdle(() -> { + MessageObject.GroupedMessages group = groupedMessagesMap.get(message.getGroupId()); + if (group != null) { + if (chatListItemAnimator != null) { + chatListItemAnimator.groupWillChanged(group); + } + for (int i = 0; i < group.messages.size(); i++) { + group.messages.get(i).forceUpdate = true; + } + chatAdapter.notifyDataSetChanged(true); + } else { + chatAdapter.notifyItemChanged(chatAdapter.messagesStartRow + messages.indexOf(message)); + } + }); + } + + public ChatMessageCell findMessageCell(int id) { + for (int i = 0, n = chatListView.getChildCount(); i < n; i++) { + if (chatListView.getChildAt(i) instanceof ChatMessageCell && ((ChatMessageCell) chatListView.getChildAt(i)).getMessageObject().getId() == id) { + return (ChatMessageCell) chatListView.getChildAt(i); + } + } + return null; + } + private void startEditingMessageObject(MessageObject messageObject) { if (messageObject == null || getParentActivity() == null) { return; @@ -22862,9 +23343,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } else { cell.setHighlightedText(null); } + cell.setSpoilersSuppressed(chatListView.getScrollState() != RecyclerView.SCROLL_STATE_IDLE); } else if (view instanceof ChatActionCell) { ChatActionCell cell = (ChatActionCell) view; cell.setMessageObject(cell.getMessageObject()); + cell.setSpoilersSuppressed(chatListView.getScrollState() != RecyclerView.SCROLL_STATE_IDLE); } } if (lastVisibleItem != RecyclerView.NO_POSITION) { @@ -22934,7 +23417,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (!actionBar.isSearchFieldVisible()) { AndroidUtilities.updateViewVisibilityAnimated(avatarContainer, false, 0.95f, true); if (headerItem != null) { - Log.d("kek", "1"); headerItem.setVisibility(View.GONE); } if (attachItem != null) { @@ -23177,6 +23659,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not originalMessage.messageOwner.replies.replies = chatActivity.threadMessageObject.messageOwner.replies.replies; } presentFragment(chatActivity); + if (isKeyboardVisible() && !chatActivity.hideKeyboardOnShow()) { + chatActivity.chatActivityEnterView.getEditField().requestFocus(); + } chatOpened = true; if (history != null) { int fnid = 0; @@ -24019,480 +24504,664 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not view = new ChatMessageCell(mContext, true, themeDelegate); } ChatMessageCell chatMessageCell = (ChatMessageCell) view; - if (!inPreviewMode) { - chatMessageCell.setDelegate(new ChatMessageCell.ChatMessageCellDelegate() { + chatMessageCell.setDelegate(new ChatMessageCell.ChatMessageCellDelegate() { - @Override - public void didPressHint(ChatMessageCell cell, int type) { - if (type == 0) { - TLRPC.TL_messageMediaPoll media = (TLRPC.TL_messageMediaPoll) cell.getMessageObject().messageOwner.media; - showPollSolution(cell.getMessageObject(), media.results); - } else if (type == 1) { - MessageObject messageObject = cell.getMessageObject(); - if (messageObject.messageOwner.fwd_from == null || TextUtils.isEmpty(messageObject.messageOwner.fwd_from.psa_type)) { - return; - } - CharSequence text = LocaleController.getString("PsaMessageInfo_" + messageObject.messageOwner.fwd_from.psa_type); - if (TextUtils.isEmpty(text)) { - text = LocaleController.getString("PsaMessageInfoDefault", R.string.PsaMessageInfoDefault); - } - SpannableStringBuilder stringBuilder = new SpannableStringBuilder(text); - MessageObject.addLinks(false, stringBuilder); - MessageObject.GroupedMessages group = cell.getCurrentMessagesGroup(); - if (group != null) { - for (int a = 0, N = group.posArray.size(); a < N; a++) { - MessageObject.GroupedMessagePosition pos = group.posArray.get(a); - if ((pos.flags & MessageObject.POSITION_FLAG_LEFT) != 0) { - MessageObject m = group.messages.get(a); - if (m != messageObject) { - messageObject = m; - int count = chatListView.getChildCount(); - for (int b = 0; b < count; b++) { - View view = chatListView.getChildAt(b); - if (!(view instanceof ChatMessageCell)) { - continue; - } - ChatMessageCell c = (ChatMessageCell) view; - if (messageObject.equals(c.getMessageObject())) { - cell = c; - } + @Override + public void didPressHint(ChatMessageCell cell, int type) { + if (type == 0) { + TLRPC.TL_messageMediaPoll media = (TLRPC.TL_messageMediaPoll) cell.getMessageObject().messageOwner.media; + showPollSolution(cell.getMessageObject(), media.results); + } else if (type == 1) { + MessageObject messageObject = cell.getMessageObject(); + if (messageObject.messageOwner.fwd_from == null || TextUtils.isEmpty(messageObject.messageOwner.fwd_from.psa_type)) { + return; + } + CharSequence text = LocaleController.getString("PsaMessageInfo_" + messageObject.messageOwner.fwd_from.psa_type); + if (TextUtils.isEmpty(text)) { + text = LocaleController.getString("PsaMessageInfoDefault", R.string.PsaMessageInfoDefault); + } + SpannableStringBuilder stringBuilder = new SpannableStringBuilder(text); + MessageObject.addLinks(false, stringBuilder); + MessageObject.GroupedMessages group = cell.getCurrentMessagesGroup(); + if (group != null) { + for (int a = 0, N = group.posArray.size(); a < N; a++) { + MessageObject.GroupedMessagePosition pos = group.posArray.get(a); + if ((pos.flags & MessageObject.POSITION_FLAG_LEFT) != 0) { + MessageObject m = group.messages.get(a); + if (m != messageObject) { + messageObject = m; + int count = chatListView.getChildCount(); + for (int b = 0; b < count; b++) { + View view = chatListView.getChildAt(b); + if (!(view instanceof ChatMessageCell)) { + continue; + } + ChatMessageCell c = (ChatMessageCell) view; + if (messageObject.equals(c.getMessageObject())) { + cell = c; } } - break; } + break; } } - showInfoHint(messageObject, stringBuilder, 1); } - cell.showHintButton(false, true, type); + showInfoHint(messageObject, stringBuilder, 1); } + cell.showHintButton(false, true, type); + } - @Override - public boolean shouldDrawThreadProgress(ChatMessageCell cell) { - MessageObject.GroupedMessages group = cell.getCurrentMessagesGroup(); - MessageObject message; - if (group != null && !group.messages.isEmpty()) { - message = group.messages.get(0); + @Override + public boolean shouldDrawThreadProgress(ChatMessageCell cell) { + MessageObject.GroupedMessages group = cell.getCurrentMessagesGroup(); + MessageObject message; + if (group != null && !group.messages.isEmpty()) { + message = group.messages.get(0); + } else { + message = cell.getMessageObject(); + } + if (message == null) { + return false; + } + return message.getId() == commentLoadingMessageId; + } + + @Override + public void didPressSideButton(ChatMessageCell cell) { + if (getParentActivity() == null) { + return; + } + if (chatActivityEnterView != null) { + chatActivityEnterView.closeKeyboard(); + } + MessageObject messageObject = cell.getMessageObject(); + if (chatMode == MODE_PINNED) { + chatActivityDelegate.openReplyMessage(messageObject.getId()); + finishFragment(); + } else if ((UserObject.isReplyUser(currentUser) || UserObject.isUserSelf(currentUser)) && messageObject.messageOwner.fwd_from.saved_from_peer != null) { + if (UserObject.isReplyUser(currentUser) && messageObject.messageOwner.reply_to != null && messageObject.messageOwner.reply_to.reply_to_top_id != 0) { + openDiscussionMessageChat(messageObject.messageOwner.reply_to.reply_to_peer_id.channel_id, null, messageObject.messageOwner.reply_to.reply_to_top_id, 0, -1, messageObject.messageOwner.fwd_from.saved_from_msg_id, messageObject); } else { - message = cell.getMessageObject(); + openOriginalReplyChat(messageObject); } - if (message == null) { - return false; + } else { + ArrayList arrayList = null; + if (messageObject.getGroupId() != 0) { + MessageObject.GroupedMessages groupedMessages = groupedMessagesMap.get(messageObject.getGroupId()); + if (groupedMessages != null) { + arrayList = groupedMessages.messages; + } } - return message.getId() == commentLoadingMessageId; - } + if (arrayList == null) { + arrayList = new ArrayList<>(); + arrayList.add(messageObject); + } + showDialog(new ShareAlert(mContext, ChatActivity.this, arrayList, null, null, ChatObject.isChannel(currentChat), null, null, false, false, themeDelegate) { + @Override + public void dismissInternal() { + super.dismissInternal(); + AndroidUtilities.requestAdjustResize(getParentActivity(), classGuid); + if (chatActivityEnterView.getVisibility() == View.VISIBLE) { + fragmentView.requestLayout(); + } + } - @Override - public void didPressSideButton(ChatMessageCell cell) { + @Override + protected void onSend(LongSparseArray dids, int count) { + if (dids.size() == 1) { + undoView.showWithAction(dids.valueAt(0).id, UndoView.ACTION_FWD_MESSAGES, count); + } else { + undoView.showWithAction(0, UndoView.ACTION_FWD_MESSAGES, count, dids.size(), null, null); + } + } + }); + AndroidUtilities.setAdjustResizeToNothing(getParentActivity(), classGuid); + fragmentView.requestLayout(); + } + } + + @Override + public boolean needPlayMessage(MessageObject messageObject) { + if (messageObject.isVoice() || messageObject.isRoundVideo()) { + boolean result = MediaController.getInstance().playMessage(messageObject); + MediaController.getInstance().setVoiceMessagesPlaylist(result ? createVoiceMessagesPlaylist(messageObject, false) : null, false); + return result; + } else if (messageObject.isMusic()) { + return MediaController.getInstance().setPlaylist(messages, messageObject, mergeDialogId); + } + return false; + } + + @Override + public void videoTimerReached() { + showNoSoundHint(); + } + + @Override + public void didPressTime(ChatMessageCell cell) { + undoView.showWithAction(dialog_id, UndoView.ACTION_IMPORT_INFO, null); + } + + @Override + public void didPressChannelAvatar(ChatMessageCell cell, TLRPC.Chat chat, int postId, float touchX, float touchY) { + if (chat == null) { + return; + } + if (actionBar.isActionModeShowed() || reportType >= 0) { + processRowSelect(cell, true, touchX, touchY); + return; + } + openChat(cell, chat, postId); + } + + @Override + public void didPressHiddenForward(ChatMessageCell cell) { + if (cell.getMessageObject().isImportedForward()) { + didPressTime(cell); + return; + } + showForwardHint(cell); + } + + @Override + public void didPressOther(ChatMessageCell cell, float otherX, float otherY) { + MessageObject messageObject = cell.getMessageObject(); + if (messageObject.type == 16) { + if (currentUser != null) { + VoIPHelper.startCall(currentUser, messageObject.isVideoCall(), userInfo != null && userInfo.video_calls_available, getParentActivity(), getMessagesController().getUserFull(currentUser.id), getAccountInstance()); + } + } else { + createMenu(cell, true, false, otherX, otherY, messageObject.isMusic()); + } + } + + @Override + public void didPressUserAvatar(ChatMessageCell cell, TLRPC.User user, float touchX, float touchY) { + if (actionBar.isActionModeShowed() || reportType >= 0) { + processRowSelect(cell, true, touchX, touchY); + return; + } + openProfile(user); + } + + @Override + public boolean didLongPressUserAvatar(ChatMessageCell cell, TLRPC.User user, float touchX, float touchY) { + if (isAvatarPreviewerEnabled()) { + final boolean enableMention = currentChat != null && (bottomOverlayChat == null || bottomOverlayChat.getVisibility() != View.VISIBLE) && (bottomOverlay == null || bottomOverlay.getVisibility() != View.VISIBLE); + final AvatarPreviewer.MenuItem[] menuItems = new AvatarPreviewer.MenuItem[2 + (enableMention ? 1 : 0)]; + menuItems[0] = AvatarPreviewer.MenuItem.OPEN_PROFILE; + menuItems[1] = AvatarPreviewer.MenuItem.SEND_MESSAGE; + if (enableMention) { + menuItems[2] = AvatarPreviewer.MenuItem.MENTION; + } + final TLRPC.UserFull userFull = getMessagesController().getUserFull(user.id); + final AvatarPreviewer.Data data; + if (userFull != null) { + data = AvatarPreviewer.Data.of(userFull, menuItems); + } else { + data = AvatarPreviewer.Data.of(user, classGuid, menuItems); + } + if (AvatarPreviewer.canPreview(data)) { + AvatarPreviewer.getInstance().show((ViewGroup) fragmentView, data, item -> { + switch (item) { + case SEND_MESSAGE: + openDialog(cell, user); + break; + case OPEN_PROFILE: + openProfile(user); + break; + case MENTION: + appendMention(user); + break; + } + }); + return true; + } + } + return false; + } + + private void appendMention(TLRPC.User user) { + if (chatActivityEnterView != null) { + final SpannableStringBuilder sb = new SpannableStringBuilder(); + final CharSequence text = chatActivityEnterView.getFieldText(); + if (text != null) { + sb.append(text); + } + if (sb.length() > 0 && sb.charAt(sb.length() - 1) != ' ') { + sb.append(' '); + } + if (user.username != null) { + sb.append("@").append(user.username).append(" "); + } else { + String name = UserObject.getFirstName(user, false); + Spannable spannable = new SpannableString(name + " "); + spannable.setSpan(new URLSpanUserMention("" + user.id, 3), 0, spannable.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + sb.append(spannable); + } + chatActivityEnterView.setFieldText(sb); + AndroidUtilities.runOnUIThread(() -> chatActivityEnterView.openKeyboard(), 200); + } + } + + @Override + public boolean didLongPressChannelAvatar(ChatMessageCell cell, TLRPC.Chat chat, int postId, float touchX, float touchY) { + if (isAvatarPreviewerEnabled()) { + AvatarPreviewer.MenuItem[] menuItems = {AvatarPreviewer.MenuItem.OPEN_PROFILE}; + if (currentChat == null || currentChat.id != chat.id || isThreadChat()) { + menuItems = Arrays.copyOf(menuItems, 2); + menuItems[1] = chat.broadcast ? AvatarPreviewer.MenuItem.OPEN_CHANNEL : AvatarPreviewer.MenuItem.OPEN_GROUP; + } + final TLRPC.ChatFull chatFull = getMessagesController().getChatFull(chat.id); + final AvatarPreviewer.Data data; + if (chatFull != null) { + data = AvatarPreviewer.Data.of(chat, chatFull, menuItems); + } else { + data = AvatarPreviewer.Data.of(chat, classGuid, menuItems); + } + if (AvatarPreviewer.canPreview(data)) { + AvatarPreviewer.getInstance().show((ViewGroup) fragmentView, data, item -> { + switch (item) { + case OPEN_PROFILE: + openProfile(chat); + break; + case OPEN_GROUP: + case OPEN_CHANNEL: + openChat(cell, chat, 0); + break; + } + }); + return true; + } + } + return false; + } + + private void openProfile(TLRPC.User user) { + if (user != null && user.id != getUserConfig().getClientUserId()) { + Bundle args = new Bundle(); + args.putLong("user_id", user.id); + ProfileActivity fragment = new ProfileActivity(args); + fragment.setPlayProfileAnimation(currentUser != null && currentUser.id == user.id ? 1 : 0); + AndroidUtilities.setAdjustResizeToNothing(getParentActivity(), classGuid); + presentFragment(fragment); + } + } + + private void openProfile(TLRPC.Chat chat) { + if (chat != null) { + Bundle args = new Bundle(); + args.putLong("chat_id", chat.id); + presentFragment(new ProfileActivity(args)); + } + } + + private void openDialog(ChatMessageCell cell, TLRPC.User user) { + if (user != null) { + Bundle args = new Bundle(); + args.putLong("user_id", user.id); + if (getMessagesController().checkCanOpenChat(args, ChatActivity.this, cell.getMessageObject())) { + presentFragment(new ChatActivity(args)); + } + } + } + + private void openChat(ChatMessageCell cell, TLRPC.Chat chat, int postId) { + if (currentChat != null && chat.id == currentChat.id) { + scrollToMessageId(postId, cell.getMessageObject().getId(), true, 0, true, 0); + } else if (currentChat == null || chat.id != currentChat.id || isThreadChat()) { + Bundle args = new Bundle(); + args.putLong("chat_id", chat.id); + if (postId != 0) { + args.putInt("message_id", postId); + } + if (getMessagesController().checkCanOpenChat(args, ChatActivity.this, cell.getMessageObject())) { + presentFragment(new ChatActivity(args)); + } + } + } + + private boolean isAvatarPreviewerEnabled() { + return UserObject.isUserSelf(currentUser) || (currentChat != null && (!ChatObject.isChannel(currentChat) || currentChat.megagroup)); + } + + @Override + public void didPressBotButton(ChatMessageCell cell, TLRPC.KeyboardButton button) { + if (getParentActivity() == null || bottomOverlayChat.getVisibility() == View.VISIBLE && + !(button instanceof TLRPC.TL_keyboardButtonSwitchInline) && !(button instanceof TLRPC.TL_keyboardButtonCallback) && + !(button instanceof TLRPC.TL_keyboardButtonGame) && !(button instanceof TLRPC.TL_keyboardButtonUrl) && + !(button instanceof TLRPC.TL_keyboardButtonBuy) && !(button instanceof TLRPC.TL_keyboardButtonUrlAuth) && + !(button instanceof TLRPC.TL_keyboardButtonUserProfile)) { + return; + } + chatActivityEnterView.didPressedBotButton(button, cell.getMessageObject(), cell.getMessageObject()); + } + + @Override + public void didPressReaction(ChatMessageCell cell, TLRPC.TL_reactionCount reaction, boolean longpress) { + if (getParentActivity() == null) { + return; + } + if (longpress) { + if (!ChatObject.isChannelAndNotMegaGroup(currentChat)) { + cell.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + FrameLayout scrimPopupContainerLayout = new FrameLayout(getParentActivity()) { + @Override + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0 && scrimPopupWindow != null && scrimPopupWindow.isShowing()) { + scrimPopupWindow.dismiss(); + } + return super.dispatchKeyEvent(event); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + int h = Math.min(MeasureSpec.getSize(heightMeasureSpec), AndroidUtilities.dp(ReactedUsersListView.VISIBLE_ITEMS * ReactedUsersListView.ITEM_HEIGHT_DP)); + if (h == 0) { + h = AndroidUtilities.dp(ReactedUsersListView.VISIBLE_ITEMS * ReactedUsersListView.ITEM_HEIGHT_DP); + } + + super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(h, MeasureSpec.AT_MOST)); + } + }; + scrimPopupContainerLayout.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT)); + + Rect backgroundPaddings = new Rect(); + Drawable shadowDrawable2 = ContextCompat.getDrawable(getParentActivity(), R.drawable.popup_fixed_alert).mutate(); + shadowDrawable2.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground), PorterDuff.Mode.MULTIPLY)); + shadowDrawable2.getPadding(backgroundPaddings); + scrimPopupContainerLayout.setBackground(shadowDrawable2); + + int totalHeight = contentView.getHeight(); + int height = scrimPopupContainerLayout.getMeasuredHeight(); + int keyboardHeight = contentView.measureKeyboardHeight(); + if (keyboardHeight > AndroidUtilities.dp(20)) { + totalHeight += keyboardHeight; + } + ReactionsLayoutInBubble.ReactionButton button = cell.getReactionButton(reaction.reaction); + if (button == null) { + return; + } + float bottom = cell.reactionsLayoutInBubble.y + button.y + AndroidUtilities.dp(28); + float left = cell.reactionsLayoutInBubble.x + button.x; + int[] loc = new int[2]; + cell.getLocationInWindow(loc); + int finalTotalHeight = totalHeight; + scrimPopupContainerLayout.addView(new ReactedUsersListView(getParentActivity(), themeDelegate, currentAccount, cell.getPrimaryMessageObject(), reaction, false) + .setOnProfileSelectedListener((view1, userId) -> { + Bundle args = new Bundle(); + args.putLong("user_id", userId); + ProfileActivity fragment = new ProfileActivity(args); + presentFragment(fragment); + if (scrimPopupWindow != null) { + scrimPopupWindow.dismiss(); + } + }).setOnHeightChangedListener((view1, newHeight) -> { +// float delta = Math.max(0, loc[1] + bottom - scrimPopupY + backgroundPaddings.top); +// int h = scrimPopupContainerLayout.getHeight(); +// ValueAnimator anim = ValueAnimator.ofFloat(0, 1).setDuration(240); +// anim.setInterpolator(CubicBezierInterpolator.DEFAULT); +// anim.addUpdateListener(animation -> { +// float val = (float) animation.getAnimatedValue(); +// float f = Math.min(delta * val, finalTotalHeight - newHeight); +// scrimPopupContainerLayout.setTranslationY(f); +// scrimPopupWindow.setHeight((int) (h + f)); +// }); +// anim.start(); + }), LayoutHelper.createFrame(200, LayoutHelper.WRAP_CONTENT)); + + scrimPopupWindow = new ActionBarPopupWindow(scrimPopupContainerLayout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT) { + @Override + public void dismiss() { + super.dismiss(); + if (scrimPopupWindow != this) { + return; + } + scrimPopupWindow = null; + menuDeleteItem = null; + scrimPopupWindowItems = null; + if (scrimAnimatorSet != null) { + scrimAnimatorSet.cancel(); + scrimAnimatorSet = null; + } + if (scrimView instanceof ChatMessageCell) { + ChatMessageCell cell = (ChatMessageCell) scrimView; + cell.setInvalidatesParent(false); + } + chatLayoutManager.setCanScrollVertically(true); + scrimAnimatorSet = new AnimatorSet(); + ArrayList animators = new ArrayList<>(); + animators.add(ObjectAnimator.ofInt(scrimPaint, AnimationProperties.PAINT_ALPHA, 0)); + if (pagedownButton.getTag() != null) { + animators.add(ObjectAnimator.ofFloat(pagedownButton, View.ALPHA, 1.0f)); + } + if (mentiondownButton.getTag() != null) { + animators.add(ObjectAnimator.ofFloat(mentiondownButton, View.ALPHA, 1.0f)); + } + scrimAnimatorSet.playTogether(animators); + scrimAnimatorSet.setDuration(220); + scrimAnimatorSet.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + scrimView = null; + contentView.invalidate(); + chatListView.invalidate(); + } + }); + scrimAnimatorSet.start(); + if (chatActivityEnterView != null) { + chatActivityEnterView.getEditField().setAllowDrawCursor(true); + } + } + }; + scrimPopupWindow.setPauseNotifications(true); + scrimPopupWindow.setDismissAnimationDuration(220); + scrimPopupWindow.setOutsideTouchable(true); + scrimPopupWindow.setClippingEnabled(true); + scrimPopupWindow.setAnimationStyle(R.style.PopupContextAnimation); + scrimPopupWindow.setFocusable(true); + scrimPopupContainerLayout.measure(View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), View.MeasureSpec.AT_MOST), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), View.MeasureSpec.AT_MOST)); + scrimPopupWindow.setInputMethodMode(ActionBarPopupWindow.INPUT_METHOD_NOT_NEEDED); + scrimPopupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED); + scrimPopupWindow.getContentView().setFocusableInTouchMode(true); + + int popupX = (int) (left - AndroidUtilities.dp(28)); + popupX = Math.max(AndroidUtilities.dp(6), Math.min(chatListView.getMeasuredWidth() - AndroidUtilities.dp(6) - scrimPopupContainerLayout.getMeasuredWidth(), popupX)); + if (AndroidUtilities.isTablet()) { + int[] location = new int[2]; + fragmentView.getLocationInWindow(location); + popupX += location[0]; + } + int popupY; + if (height < totalHeight) { + popupY = (int) (chatListView.getY() + cell.getY() + cell.getHeight()); + if (height - backgroundPaddings.top - backgroundPaddings.bottom > AndroidUtilities.dp(240)) { + popupY += AndroidUtilities.dp(240) - height; + } + if (popupY < chatListView.getY() + AndroidUtilities.dp(24)) { + popupY = (int) (chatListView.getY() + AndroidUtilities.dp(24)); + } else if (popupY > totalHeight - height - AndroidUtilities.dp(8)) { + popupY = totalHeight - height - AndroidUtilities.dp(8); + } + } else { + popupY = inBubbleMode ? 0 : AndroidUtilities.statusBarHeight; + } + scrimPopupWindow.showAtLocation(chatListView, Gravity.LEFT | Gravity.TOP, scrimPopupX = popupX, scrimPopupY = popupY); + + chatListView.stopScroll(); + chatLayoutManager.setCanScrollVertically(false); + scrimView = cell; + cell.setInvalidatesParent(true); + restartSticker(cell); + contentView.invalidate(); + chatListView.invalidate(); + if (scrimAnimatorSet != null) { + scrimAnimatorSet.cancel(); + } + scrimAnimatorSet = new AnimatorSet(); + ArrayList animators = new ArrayList<>(); + animators.add(ObjectAnimator.ofInt(scrimPaint, AnimationProperties.PAINT_ALPHA, 0, 50)); + if (pagedownButton.getTag() != null) { + animators.add(ObjectAnimator.ofFloat(pagedownButton, View.ALPHA, 0)); + } + if (mentiondownButton.getTag() != null) { + animators.add(ObjectAnimator.ofFloat(mentiondownButton, View.ALPHA, 0)); + } + scrimAnimatorSet.playTogether(animators); + scrimAnimatorSet.setDuration(150); + scrimAnimatorSet.start(); + hideHints(false); + if (topUndoView != null) { + topUndoView.hide(true, 1); + } + if (undoView != null) { + undoView.hide(true, 1); + } + if (chatActivityEnterView != null) { + chatActivityEnterView.getEditField().setAllowDrawCursor(false); + } + } + } else { + selectReaction(cell.getPrimaryMessageObject(), null, 0, 0, getMediaDataController().getReactionsMap().get(reaction.reaction), false); + } + } + + @Override + public void didPressVoteButtons(ChatMessageCell cell, ArrayList buttons, int showCount, int x, int y) { + if (showCount >= 0 || buttons.isEmpty()) { if (getParentActivity() == null) { return; } - if (chatActivityEnterView != null) { - chatActivityEnterView.closeKeyboard(); - } - MessageObject messageObject = cell.getMessageObject(); - if (chatMode == MODE_PINNED) { - chatActivityDelegate.openReplyMessage(messageObject.getId()); - finishFragment(); - } else if ((UserObject.isReplyUser(currentUser) || UserObject.isUserSelf(currentUser)) && messageObject.messageOwner.fwd_from.saved_from_peer != null) { - if (UserObject.isReplyUser(currentUser) && messageObject.messageOwner.reply_to != null && messageObject.messageOwner.reply_to.reply_to_top_id != 0) { - openDiscussionMessageChat(messageObject.messageOwner.reply_to.reply_to_peer_id.channel_id, null, messageObject.messageOwner.reply_to.reply_to_top_id, 0, -1, messageObject.messageOwner.fwd_from.saved_from_msg_id, messageObject); - } else { - openOriginalReplyChat(messageObject); - } - } else { - ArrayList arrayList = null; - if (messageObject.getGroupId() != 0) { - MessageObject.GroupedMessages groupedMessages = groupedMessagesMap.get(messageObject.getGroupId()); - if (groupedMessages != null) { - arrayList = groupedMessages.messages; - } - } - if (arrayList == null) { - arrayList = new ArrayList<>(); - arrayList.add(messageObject); - } - showDialog(new ShareAlert(mContext, ChatActivity.this, arrayList, null, null, ChatObject.isChannel(currentChat), null, null, false, false, themeDelegate) { - @Override - public void dismissInternal() { - super.dismissInternal(); - AndroidUtilities.requestAdjustResize(getParentActivity(), classGuid); - if (chatActivityEnterView.getVisibility() == View.VISIBLE) { - fragmentView.requestLayout(); - } - } - - @Override - protected void onSend(LongSparseArray dids, int count) { - if (dids.size() == 1) { - undoView.showWithAction(dids.valueAt(0).id, UndoView.ACTION_FWD_MESSAGES, count); - } else { - undoView.showWithAction(0, UndoView.ACTION_FWD_MESSAGES, count, dids.size(), null, null); - } - } - }); - AndroidUtilities.setAdjustResizeToNothing(getParentActivity(), classGuid); - fragmentView.requestLayout(); - } - } - - @Override - public boolean needPlayMessage(MessageObject messageObject) { - if (messageObject.isVoice() || messageObject.isRoundVideo()) { - boolean result = MediaController.getInstance().playMessage(messageObject); - MediaController.getInstance().setVoiceMessagesPlaylist(result ? createVoiceMessagesPlaylist(messageObject, false) : null, false); - return result; - } else if (messageObject.isMusic()) { - return MediaController.getInstance().setPlaylist(messages, messageObject, mergeDialogId); - } - return false; - } - - @Override - public void videoTimerReached() { - showNoSoundHint(); - } - - @Override - public void didPressTime(ChatMessageCell cell) { - undoView.showWithAction(dialog_id, UndoView.ACTION_IMPORT_INFO, null); - } - - @Override - public void didPressChannelAvatar(ChatMessageCell cell, TLRPC.Chat chat, int postId, float touchX, float touchY) { - if (chat == null) { - return; - } - if (actionBar.isActionModeShowed() || reportType >= 0) { - processRowSelect(cell, true, touchX, touchY); - return; - } - openChat(cell, chat, postId); - } - - @Override - public void didPressHiddenForward(ChatMessageCell cell) { - if (cell.getMessageObject().isImportedForward()) { - didPressTime(cell); - return; - } - showForwardHint(cell); - } - - @Override - public void didPressOther(ChatMessageCell cell, float otherX, float otherY) { - MessageObject messageObject = cell.getMessageObject(); - if (messageObject.type == 16) { - if (currentUser != null) { - VoIPHelper.startCall(currentUser, messageObject.isVideoCall(), userInfo != null && userInfo.video_calls_available, getParentActivity(), getMessagesController().getUserFull(currentUser.id), getAccountInstance()); - } - } else { - createMenu(cell, true, false, otherX, otherY, messageObject.isMusic()); - } - } - - @Override - public void didPressUserAvatar(ChatMessageCell cell, TLRPC.User user, float touchX, float touchY) { - if (actionBar.isActionModeShowed() || reportType >= 0) { - processRowSelect(cell, true, touchX, touchY); - return; - } - openProfile(user); - } - - @Override - public boolean didLongPressUserAvatar(ChatMessageCell cell, TLRPC.User user, float touchX, float touchY) { - if (isAvatarPreviewerEnabled()) { - final boolean enableMention = currentChat != null && (bottomOverlayChat == null || bottomOverlayChat.getVisibility() != View.VISIBLE) && (bottomOverlay == null || bottomOverlay.getVisibility() != View.VISIBLE); - final AvatarPreviewer.MenuItem[] menuItems = new AvatarPreviewer.MenuItem[2 + (enableMention ? 1 : 0)]; - menuItems[0] = AvatarPreviewer.MenuItem.OPEN_PROFILE; - menuItems[1] = AvatarPreviewer.MenuItem.SEND_MESSAGE; - if (enableMention) { - menuItems[2] = AvatarPreviewer.MenuItem.MENTION; - } - final TLRPC.UserFull userFull = getMessagesController().getUserFull(user.id); - final AvatarPreviewer.Data data; - if (userFull != null) { - data = AvatarPreviewer.Data.of(userFull, menuItems); - } else { - data = AvatarPreviewer.Data.of(user, classGuid, menuItems); - } - if (AvatarPreviewer.canPreview(data)) { - AvatarPreviewer.getInstance().show((ViewGroup) fragmentView, data, item -> { - switch (item) { - case SEND_MESSAGE: - openDialog(cell, user); - break; - case OPEN_PROFILE: - openProfile(user); - break; - case MENTION: - appendMention(user); - break; - } - }); - return true; - } - } - return false; - } - - private void appendMention(TLRPC.User user) { - if (chatActivityEnterView != null) { - final SpannableStringBuilder sb = new SpannableStringBuilder(); - final CharSequence text = chatActivityEnterView.getFieldText(); - if (text != null) { - sb.append(text); - } - if (sb.length() > 0 && sb.charAt(sb.length() - 1) != ' ') { - sb.append(' '); - } - if (user.username != null) { - sb.append("@").append(user.username).append(" "); - } else { - String name = UserObject.getFirstName(user, false); - Spannable spannable = new SpannableString(name + " "); - spannable.setSpan(new URLSpanUserMention("" + user.id, 3), 0, spannable.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - sb.append(spannable); - } - chatActivityEnterView.setFieldText(sb); - AndroidUtilities.runOnUIThread(() -> chatActivityEnterView.openKeyboard(), 200); - } - } - - @Override - public boolean didLongPressChannelAvatar(ChatMessageCell cell, TLRPC.Chat chat, int postId, float touchX, float touchY) { - if (isAvatarPreviewerEnabled()) { - AvatarPreviewer.MenuItem[] menuItems = {AvatarPreviewer.MenuItem.OPEN_PROFILE}; - if (currentChat == null || currentChat.id != chat.id || isThreadChat()) { - menuItems = Arrays.copyOf(menuItems, 2); - menuItems[1] = chat.broadcast ? AvatarPreviewer.MenuItem.OPEN_CHANNEL : AvatarPreviewer.MenuItem.OPEN_GROUP; - } - final TLRPC.ChatFull chatFull = getMessagesController().getChatFull(chat.id); - final AvatarPreviewer.Data data; - if (chatFull != null) { - data = AvatarPreviewer.Data.of(chat, chatFull, menuItems); - } else { - data = AvatarPreviewer.Data.of(chat, classGuid, menuItems); - } - if (AvatarPreviewer.canPreview(data)) { - AvatarPreviewer.getInstance().show((ViewGroup) fragmentView, data, item -> { - switch (item) { - case OPEN_PROFILE: - openProfile(chat); - break; - case OPEN_GROUP: - case OPEN_CHANNEL: - openChat(cell, chat, 0); - break; - } - }); - return true; - } - } - return false; - } - - private void openProfile(TLRPC.User user) { - if (user != null && user.id != getUserConfig().getClientUserId()) { - Bundle args = new Bundle(); - args.putLong("user_id", user.id); - ProfileActivity fragment = new ProfileActivity(args); - fragment.setPlayProfileAnimation(currentUser != null && currentUser.id == user.id ? 1 : 0); - AndroidUtilities.setAdjustResizeToNothing(getParentActivity(), classGuid); - presentFragment(fragment); - } - } - - private void openProfile(TLRPC.Chat chat) { - if (chat != null) { - Bundle args = new Bundle(); - args.putLong("chat_id", chat.id); - presentFragment(new ProfileActivity(args)); - } - } - - private void openDialog(ChatMessageCell cell, TLRPC.User user) { - if (user != null) { - Bundle args = new Bundle(); - args.putLong("user_id", user.id); - if (getMessagesController().checkCanOpenChat(args, ChatActivity.this, cell.getMessageObject())) { - presentFragment(new ChatActivity(args)); - } - } - } - - private void openChat(ChatMessageCell cell, TLRPC.Chat chat, int postId) { - if (currentChat != null && chat.id == currentChat.id) { - scrollToMessageId(postId, cell.getMessageObject().getId(), true, 0, true, 0); - } else if (currentChat == null || chat.id != currentChat.id || isThreadChat()) { - Bundle args = new Bundle(); - args.putLong("chat_id", chat.id); - if (postId != 0) { - args.putInt("message_id", postId); - } - if (getMessagesController().checkCanOpenChat(args, ChatActivity.this, cell.getMessageObject())) { - presentFragment(new ChatActivity(args)); - } - } - } - - private boolean isAvatarPreviewerEnabled() { - return UserObject.isUserSelf(currentUser) || (currentChat != null && (!ChatObject.isChannel(currentChat) || currentChat.megagroup)); - } - - @Override - public void didPressBotButton(ChatMessageCell cell, TLRPC.KeyboardButton button) { - if (getParentActivity() == null || bottomOverlayChat.getVisibility() == View.VISIBLE && - !(button instanceof TLRPC.TL_keyboardButtonSwitchInline) && !(button instanceof TLRPC.TL_keyboardButtonCallback) && - !(button instanceof TLRPC.TL_keyboardButtonGame) && !(button instanceof TLRPC.TL_keyboardButtonUrl) && - !(button instanceof TLRPC.TL_keyboardButtonBuy) && !(button instanceof TLRPC.TL_keyboardButtonUrlAuth)) { - return; - } - chatActivityEnterView.didPressedBotButton(button, cell.getMessageObject(), cell.getMessageObject()); - } - - @Override - public void didPressReaction(ChatMessageCell cell, TLRPC.TL_reactionCount reaction) { - getSendMessagesHelper().sendReaction(cell.getMessageObject(), reaction.reaction, ChatActivity.this); - } - - @Override - public void didPressVoteButtons(ChatMessageCell cell, ArrayList buttons, int showCount, int x, int y) { - if (showCount >= 0 || buttons.isEmpty()) { - if (getParentActivity() == null) { + if (pollHintView == null) { + pollHintView = new HintView(getParentActivity(), HintView.TYPE_POLL_VOTE, themeDelegate); + pollHintView.setAlpha(0.0f); + pollHintView.setVisibility(View.INVISIBLE); + int index = contentView.indexOfChild(chatActivityEnterView); + if (index == -1) { return; } - if (pollHintView == null) { - pollHintView = new HintView(getParentActivity(), HintView.TYPE_POLL_VOTE, themeDelegate); - pollHintView.setAlpha(0.0f); - pollHintView.setVisibility(View.INVISIBLE); - int index = contentView.indexOfChild(chatActivityEnterView); - if (index == -1) { - return; - } - contentView.addView(pollHintView, index + 1, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 19, 0, 19, 0)); - } - if (buttons.isEmpty() && showCount < 0) { - ArrayList pollButtons = cell.getPollButtons(); - float lastDiff = 0; - for (int a = 0, N = pollButtons.size(); a < N; a++) { - ChatMessageCell.PollButton button = pollButtons.get(a); - lastDiff = cell.getY() + button.y - AndroidUtilities.dp(4) - chatListViewPaddingTop; - pollHintX = button.x + AndroidUtilities.dp(13.3f); - pollHintY = button.y - AndroidUtilities.dp(6) + y; - if (lastDiff > 0) { - lastDiff = 0; - x = pollHintX; - y = pollHintY; - break; - } - } - if (lastDiff != 0) { - chatListView.smoothScrollBy(0, (int) lastDiff); - pollHintCell = cell; - return; + contentView.addView(pollHintView, index + 1, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 19, 0, 19, 0)); + } + if (buttons.isEmpty() && showCount < 0) { + ArrayList pollButtons = cell.getPollButtons(); + float lastDiff = 0; + for (int a = 0, N = pollButtons.size(); a < N; a++) { + ChatMessageCell.PollButton button = pollButtons.get(a); + lastDiff = cell.getY() + button.y - AndroidUtilities.dp(4) - chatListViewPaddingTop; + pollHintX = button.x + AndroidUtilities.dp(13.3f); + pollHintY = button.y - AndroidUtilities.dp(6) + y; + if (lastDiff > 0) { + lastDiff = 0; + x = pollHintX; + y = pollHintY; + break; } } - pollHintView.showForMessageCell(cell, showCount, x, y, true); - } else { - getSendMessagesHelper().sendVote(cell.getMessageObject(), buttons, null); + if (lastDiff != 0) { + chatListView.smoothScrollBy(0, (int) lastDiff); + pollHintCell = cell; + return; + } } + pollHintView.showForMessageCell(cell, showCount, x, y, true); + } else { + getSendMessagesHelper().sendVote(cell.getMessageObject(), buttons, null); } + } - @Override - public void didPressCancelSendButton(ChatMessageCell cell) { - MessageObject message = cell.getMessageObject(); - if (message.messageOwner.send_state != 0) { - getSendMessagesHelper().cancelSendingMessage(message); - } + @Override + public void didPressCancelSendButton(ChatMessageCell cell) { + MessageObject message = cell.getMessageObject(); + if (message.messageOwner.send_state != 0) { + getSendMessagesHelper().cancelSendingMessage(message); } + } - @Override - public void didLongPress(ChatMessageCell cell, float x, float y) { + @Override + public void didLongPress(ChatMessageCell cell, float x, float y) { + createMenu(cell, false, false, x, y); + startMultiselect(chatListView.getChildAdapterPosition(cell)); + } + + @Override + public boolean canPerformActions() { + return actionBar != null && !actionBar.isActionModeShowed() && reportType < 0 || inPreviewMode; + } + + @Override + public void didPressUrl(ChatMessageCell cell, final CharacterStyle url, boolean longPress) { + didPressMessageUrl(url, longPress, cell.getMessageObject(), cell); + } + + @Override + public void needOpenWebView(MessageObject message, String url, String title, String description, String originalUrl, int w, int h) { + try { + EmbedBottomSheet.show(getParentActivity(), message, photoViewerProvider, title, description, originalUrl, url, w, h, isKeyboardVisible()); + } catch (Throwable e) { + FileLog.e(e); + } + } + + @Override + public void didPressReplyMessage(ChatMessageCell cell, int id) { + if (UserObject.isReplyUser(currentUser)) { + didPressSideButton(cell); + return; + } + MessageObject messageObject = cell.getMessageObject(); + if (chatMode == MODE_PINNED || chatMode == MODE_SCHEDULED) { + chatActivityDelegate.openReplyMessage(id); + finishFragment(); + } else { + scrollToMessageId(id, messageObject.getId(), true, messageObject.getDialogId() == mergeDialogId ? 1 : 0, true, 0); + } + } + + @Override + public void didPressViaBot(ChatMessageCell cell, String username) { + if (bottomOverlayChat != null && bottomOverlayChat.getVisibility() == View.VISIBLE || bottomOverlay != null && bottomOverlay.getVisibility() == View.VISIBLE) { + return; + } + if (chatActivityEnterView != null && username != null && username.length() > 0) { + chatActivityEnterView.setFieldText("@" + username + " "); + chatActivityEnterView.openKeyboard(); + } + } + + @Override + public void didStartVideoStream(MessageObject message) { + if (message.isVideo()) { + sendSecretMessageRead(message, true); + } + } + + @Override + public void needReloadPolls() { + invalidateMessagesVisiblePart(); + } + + @Override + public void didPressImage(ChatMessageCell cell, float x, float y) { + MessageObject message = cell.getMessageObject(); + if (message.isSendError()) { createMenu(cell, false, false, x, y); - startMultiselect(chatListView.getChildAdapterPosition(cell)); + return; + } else if (message.isSending()) { + return; } - - @Override - public boolean canPerformActions() { - return actionBar != null && !actionBar.isActionModeShowed() && reportType < 0; - } - - @Override - public void didPressUrl(ChatMessageCell cell, final CharacterStyle url, boolean longPress) { - didPressMessageUrl(url, longPress, cell.getMessageObject(), cell); - } - - @Override - public void needOpenWebView(MessageObject message, String url, String title, String description, String originalUrl, int w, int h) { - try { - EmbedBottomSheet.show(getParentActivity(), message, photoViewerProvider, title, description, originalUrl, url, w, h, isKeyboardVisible()); - } catch (Throwable e) { - FileLog.e(e); - } - } - - @Override - public void didPressReplyMessage(ChatMessageCell cell, int id) { - if (UserObject.isReplyUser(currentUser)) { - didPressSideButton(cell); - return; - } - MessageObject messageObject = cell.getMessageObject(); - if (chatMode == MODE_PINNED || chatMode == MODE_SCHEDULED) { - chatActivityDelegate.openReplyMessage(id); - finishFragment(); - } else { - scrollToMessageId(id, messageObject.getId(), true, messageObject.getDialogId() == mergeDialogId ? 1 : 0, true, 0); - } - } - - @Override - public void didPressViaBot(ChatMessageCell cell, String username) { - if (bottomOverlayChat != null && bottomOverlayChat.getVisibility() == View.VISIBLE || bottomOverlay != null && bottomOverlay.getVisibility() == View.VISIBLE) { - return; - } - if (chatActivityEnterView != null && username != null && username.length() > 0) { - chatActivityEnterView.setFieldText("@" + username + " "); - chatActivityEnterView.openKeyboard(); - } - } - - @Override - public void didStartVideoStream(MessageObject message) { - if (message.isVideo()) { - sendSecretMessageRead(message, true); - } - } - - @Override - public void needReloadPolls() { - invalidateMessagesVisiblePart(); - } - - @Override - public void didPressImage(ChatMessageCell cell, float x, float y) { - MessageObject message = cell.getMessageObject(); - if (message.isSendError()) { - createMenu(cell, false, false, x, y); - return; - } else if (message.isSending()) { - return; - } - if (message.isDice()) { - undoView.showWithAction(0, chatActivityEnterView.getVisibility() == View.VISIBLE && bottomOverlay.getVisibility() != View.VISIBLE ? UndoView.ACTION_DICE_INFO : UndoView.ACTION_DICE_NO_SEND_INFO, message.getDiceEmoji(), null, () -> getSendMessagesHelper().sendMessage(message.getDiceEmoji(), dialog_id, replyingMessageObject, getThreadMessage(), null, false, null, null, null, true, 0, null)); - } else if (message.isAnimatedEmoji()) { - restartSticker(cell); - emojiAnimationsOverlay.onTapItem(cell, ChatActivity.this); - chatListView.cancelClickRunnables(false); - } else if (message.needDrawBluredPreview()) { - Runnable action = sendSecretMessageRead(message, false); - cell.invalidate(); - SecretMediaViewer.getInstance().setParentActivity(getParentActivity()); - SecretMediaViewer.getInstance().openMedia(message, photoViewerProvider, action); - } else if (message.getInputStickerSet() != null) { - // In case we have a .webp file that is displayed as a sticker, but + if (message.isDice()) { + undoView.showWithAction(0, chatActivityEnterView.getVisibility() == View.VISIBLE && bottomOverlay.getVisibility() != View.VISIBLE ? UndoView.ACTION_DICE_INFO : UndoView.ACTION_DICE_NO_SEND_INFO, message.getDiceEmoji(), null, () -> getSendMessagesHelper().sendMessage(message.getDiceEmoji(), dialog_id, replyingMessageObject, getThreadMessage(), null, false, null, null, null, true, 0, null)); + } else if (message.isAnimatedEmoji()) { + restartSticker(cell); + emojiAnimationsOverlay.onTapItem(cell, ChatActivity.this); + chatListView.cancelClickRunnables(false); + } else if (message.needDrawBluredPreview()) { + Runnable action = sendSecretMessageRead(message, false); + cell.invalidate(); + SecretMediaViewer.getInstance().setParentActivity(getParentActivity()); + SecretMediaViewer.getInstance().openMedia(message, photoViewerProvider, action); + } else if (message.getInputStickerSet() != null) { + // In case we have a .webp file that is displayed as a sticker, but // that doesn't fit in 512x512, we assume it may be a regular large // .webp image and we allow to open it in media viewer. // Inspired by https://github.com/telegramdesktop/tdesktop/commit/baccec623d45dbfd1132d5f808192f0f3ad87647 @@ -24624,22 +25293,22 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not NekoSettingsActivity.importSettings(getParentActivity(), finalLocFile); } else { - boolean handled = false; - if (message.canPreviewDocument()) { - PhotoViewer.getInstance().setParentActivity(getParentActivity(), themeDelegate); - PhotoViewer.getInstance().openPhoto(message, ChatActivity.this, message.type != 0 ? dialog_id : 0, message.type != 0 ? mergeDialogId : 0, photoViewerProvider); - handled = true; - } - if (!handled) { - try { - AndroidUtilities.openForView(message, getParentActivity(), themeDelegate); - } catch (Exception e) { - FileLog.e(e); - alertUserOpenError(message); - } + boolean handled = false; + if (message.canPreviewDocument()) { + PhotoViewer.getInstance().setParentActivity(getParentActivity(), themeDelegate); + PhotoViewer.getInstance().openPhoto(message, ChatActivity.this, message.type != 0 ? dialog_id : 0, message.type != 0 ? mergeDialogId : 0, photoViewerProvider); + handled = true; + } + if (!handled) { + try { + AndroidUtilities.openForView(message, getParentActivity(), themeDelegate); + } catch (Exception e) { + FileLog.e(e); + alertUserOpenError(message); } } } + } } @@ -24663,7 +25332,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not openVCard(user, messageObject.messageOwner.media.vcard, messageObject.messageOwner.media.first_name, messageObject.messageOwner.media.last_name); } else { if (messageObject.isSponsored()) { - Bundle args = new Bundle(); + Bundle args = new Bundle();if (messageObject.sponsoredChatInvite != null) { + showDialog(new JoinGroupAlert(mContext, messageObject.sponsoredChatInvite, messageObject.sponsoredChatInviteHash, ChatActivity.this)); + } else { long peerId = MessageObject.getPeerId(messageObject.messageOwner.from_id); if (peerId < 0) { args.putLong("chat_id", -peerId); @@ -24679,93 +25350,89 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (getMessagesController().checkCanOpenChat(args, ChatActivity.this)) { presentFragment(new ChatActivity(args)); } - } else if (messageObject.messageOwner.media != null && messageObject.messageOwner.media.webpage != null) { - if (!openLinkInternally(messageObject.messageOwner.media.webpage.url, messageObject.getId())) { - Browser.openUrl(getParentActivity(), messageObject.messageOwner.media.webpage.url); - } + } + } else if (messageObject.messageOwner.media != null && messageObject.messageOwner.media.webpage != null) { + if (!openLinkInternally(messageObject.messageOwner.media.webpage.url, messageObject.getId())) { + Browser.openUrl(getParentActivity(), messageObject.messageOwner.media.webpage.url); } } } + } - @Override - public void didPressCommentButton(ChatMessageCell cell) { - MessageObject.GroupedMessages group = cell.getCurrentMessagesGroup(); - MessageObject message; - if (group != null && !group.messages.isEmpty()) { - message = group.messages.get(0); - } else { - message = cell.getMessageObject(); - } - int maxReadId; - long linkedChatId; - if (message.messageOwner.replies != null) { - maxReadId = message.messageOwner.replies.read_max_id; - linkedChatId = message.messageOwner.replies.channel_id; - } else { - maxReadId = -1; - linkedChatId = 0; - } - openDiscussionMessageChat(currentChat.id, message, message.getId(), linkedChatId, maxReadId, 0, null); + @Override + public void didPressCommentButton(ChatMessageCell cell) { + MessageObject.GroupedMessages group = cell.getCurrentMessagesGroup(); + MessageObject message; + if (group != null && !group.messages.isEmpty()) { + message = group.messages.get(0); + } else { + message = cell.getMessageObject(); } - - @Override - public String getAdminRank(long uid) { - if (ChatObject.isChannel(currentChat) && currentChat.megagroup) { - return getMessagesController().getAdminRank(currentChat.id, uid); - } - return null; + int maxReadId; + long linkedChatId; + if (message.messageOwner.replies != null) { + maxReadId = message.messageOwner.replies.read_max_id; + linkedChatId = message.messageOwner.replies.channel_id; + } else { + maxReadId = -1; + linkedChatId = 0; } + openDiscussionMessageChat(currentChat.id, message, message.getId(), linkedChatId, maxReadId, 0, null); + } - @Override - public boolean shouldRepeatSticker(MessageObject message) { - return !alreadyPlayedStickers.containsKey(message); + @Override + public String getAdminRank(long uid) { + if (ChatObject.isChannel(currentChat) && currentChat.megagroup) { + return getMessagesController().getAdminRank(currentChat.id, uid); } + return null; + } - @Override - public void setShouldNotRepeatSticker(MessageObject message) { - alreadyPlayedStickers.put(message, true); + @Override + public boolean shouldRepeatSticker(MessageObject message) { + return !alreadyPlayedStickers.containsKey(message); + } + + @Override + public void setShouldNotRepeatSticker(MessageObject message) { + alreadyPlayedStickers.put(message, true); + } + + @Override + public TextSelectionHelper.ChatListTextSelectionHelper getTextSelectionHelper() { + return textSelectionHelper; + } + + @Override + public boolean hasSelectedMessages() { + return selectedMessagesIds[0].size() + selectedMessagesIds[1].size() > 0; + } + + @Override + public void onDiceFinished() { + if (fireworksOverlay.isStarted()) { + return; } - - @Override - public TextSelectionHelper.ChatListTextSelectionHelper getTextSelectionHelper() { - return textSelectionHelper; - } - - @Override - public boolean hasSelectedMessages() { - return selectedMessagesIds[0].size() + selectedMessagesIds[1].size() > 0; - } - - @Override - public void onDiceFinished() { - if (fireworksOverlay.isStarted()) { - return; - } - fireworksOverlay.start(); - if (!NekomuraConfig.disableVibration.Bool()) { + fireworksOverlay.start(); + if (!NekomuraConfig.disableVibration.Bool()) { fireworksOverlay.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } } - @Override - public PinchToZoomHelper getPinchToZoomHelper() { - return pinchToZoomHelper; - } + @Override + public PinchToZoomHelper getPinchToZoomHelper() { + return pinchToZoomHelper; + } - @Override - public boolean keyboardIsOpened() { - return contentView.getKeyboardHeight() + chatEmojiViewPadding >= AndroidUtilities.dp(20); - } + @Override + public boolean keyboardIsOpened() { + return contentView.getKeyboardHeight() + chatEmojiViewPadding >= AndroidUtilities.dp(20); + } - public boolean isLandscape() { - return contentView.getMeasuredWidth() > contentView.getMeasuredHeight(); - } - }); - } else { - chatMessageCell.setDelegate(new ChatMessageCell.ChatMessageCellDelegate() { - - }); - } + public boolean isLandscape() { + return contentView.getMeasuredWidth() > contentView.getMeasuredHeight(); + } + }); if (currentEncryptedChat == null) { chatMessageCell.setAllowAssistant(true); } @@ -24830,7 +25497,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (getParentActivity() == null || bottomOverlayChat.getVisibility() == View.VISIBLE && !(button instanceof TLRPC.TL_keyboardButtonSwitchInline) && !(button instanceof TLRPC.TL_keyboardButtonCallback) && !(button instanceof TLRPC.TL_keyboardButtonGame) && !(button instanceof TLRPC.TL_keyboardButtonUrl) && - !(button instanceof TLRPC.TL_keyboardButtonBuy) && !(button instanceof TLRPC.TL_keyboardButtonUrlAuth)) { + !(button instanceof TLRPC.TL_keyboardButtonBuy) && !(button instanceof TLRPC.TL_keyboardButtonUrlAuth) && + !(button instanceof TLRPC.TL_keyboardButtonUserProfile)) { return; } chatActivityEnterView.didPressedBotButton(button, messageObject, messageObject); @@ -24934,7 +25602,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not int nextType = getItemViewType(nextPosition); int prevType = getItemViewType(prevPosition); - if (!message.hasReactions() && !(message.messageOwner.reply_markup instanceof TLRPC.TL_replyInlineMarkup) && nextType == holder.getItemViewType()) { + if (!(message.messageOwner.reply_markup instanceof TLRPC.TL_replyInlineMarkup) && nextType == holder.getItemViewType()) { MessageObject nextMessage = messages.get(nextPosition - messagesStartRow); pinnedBottom = nextMessage.isOutOwner() == message.isOutOwner() && Math.abs(nextMessage.messageOwner.date - message.messageOwner.date) <= 5 * 60; if (pinnedBottom) { @@ -24971,7 +25639,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } if (prevType == holder.getItemViewType()) { MessageObject prevMessage = messages.get(prevPosition - messagesStartRow); - pinnedTop = !prevMessage.hasReactions() && !(prevMessage.messageOwner.reply_markup instanceof TLRPC.TL_replyInlineMarkup) && prevMessage.isOutOwner() == message.isOutOwner() && Math.abs(prevMessage.messageOwner.date - message.messageOwner.date) <= 5 * 60; + pinnedTop = !(prevMessage.messageOwner.reply_markup instanceof TLRPC.TL_replyInlineMarkup) && prevMessage.isOutOwner() == message.isOutOwner() && Math.abs(prevMessage.messageOwner.date - message.messageOwner.date) <= 5 * 60; if (pinnedTop) { if (message.isImportedForward() || prevMessage.isImportedForward()) { if (message.isImportedForward() && prevMessage.isImportedForward()) { @@ -25014,6 +25682,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } messageCell.setMessageObject(message, groupedMessages, pinnedBottom, pinnedTop); + messageCell.setSpoilersSuppressed(chatListView.getScrollState() != RecyclerView.SCROLL_STATE_IDLE); messageCell.setHighlighted(highlightMessageId != Integer.MAX_VALUE && message.getId() == highlightMessageId); if (highlightMessageId != Integer.MAX_VALUE) { startMessageUnselect(); @@ -25247,6 +25916,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not ChatActionCell actionCell = (ChatActionCell) view; actionCell.setMessageObject(message); actionCell.setAlpha(1.0f); + actionCell.setSpoilersSuppressed(chatListView.getScrollState() != RecyclerView.SCROLL_STATE_IDLE); } else if (view instanceof ChatUnreadCell) { ChatUnreadCell unreadCell = (ChatUnreadCell) view; unreadCell.setText(LocaleController.getString("UnreadMessages", R.string.UnreadMessages)); @@ -26456,6 +27126,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_overlayAlertMutedByAdmin)); themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_overlayAlertMutedByAdmin2)); themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_windowBackgroundGray)); + themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_chat_outReactionButtonBackground)); + themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_chat_inReactionButtonBackground)); + themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_chat_inReactionButtonText)); + themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_chat_outReactionButtonText)); + themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_chat_inReactionButtonTextSelected)); + themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_chat_inReactionButtonTextSelected)); if (chatActivityEnterView != null) { themeDescriptions.add(new ThemeDescription(chatActivityEnterView.botCommandsMenuContainer.listView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{BotCommandsMenuView.BotCommandView.class}, new String[]{"description"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); @@ -27384,6 +28060,15 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not return !inPreviewMode; } + @Override + protected boolean hideKeyboardOnShow() { + if (threadMessageObject != null && threadMessageObject.getRepliesCount() == 0 && ChatObject.canSendMessages(currentChat)) { + return false; + } + return super.hideKeyboardOnShow(); + } + + private void nkbtn_onclick_actionbar(int id) { // from ActionBar & Header ( without text_* ) // should hide shit action bar after done diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatEditActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatEditActivity.java index 9ffdfe17d..bbc64be53 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatEditActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatEditActivity.java @@ -72,6 +72,8 @@ import org.telegram.ui.Components.SizeNotifierFrameLayout; import org.telegram.ui.Components.UndoView; import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import java.util.concurrent.CountDownLatch; import tw.nekomimi.nekogram.utils.VibrateUtil; @@ -102,6 +104,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image private TextDetailCell typeCell; private TextDetailCell linkedCell; private TextDetailCell historyCell; + private TextCell reactionsCell; private ShadowSectionCell settingsSectionCell; private TextCheckCell signCell; @@ -133,6 +136,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image private boolean isChannel; private boolean historyHidden; + private List availableReactions = Collections.emptyList(); private boolean createAfterUpload; private boolean donePressed; @@ -217,6 +221,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image signMessages = currentChat.signatures; NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.chatInfoDidLoad); NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.updateInterfaces); + NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.chatAvailableReactionsUpdated); if (info != null) { loadLinksCount(); @@ -247,6 +252,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image } NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.chatInfoDidLoad); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.updateInterfaces); + NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.chatAvailableReactionsUpdated); if (nameTextView != null) { nameTextView.onDestroy(); } @@ -794,7 +800,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image linearLayout1.addView(infoContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); blockCell = new TextCell(context); - blockCell.setBackgroundDrawable(Theme.getSelectorDrawable(false)); + blockCell.setBackground(Theme.getSelectorDrawable(false)); blockCell.setVisibility(ChatObject.isChannel(currentChat) || currentChat.creator || ChatObject.hasAdminRights(currentChat) && ChatObject.canChangeChatInfo(currentChat) ? View.VISIBLE : View.GONE); blockCell.setOnClickListener(v -> { Bundle args = new Bundle(); @@ -806,15 +812,25 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image }); inviteLinksCell = new TextCell(context); - inviteLinksCell.setBackgroundDrawable(Theme.getSelectorDrawable(false)); + inviteLinksCell.setBackground(Theme.getSelectorDrawable(false)); inviteLinksCell.setOnClickListener(v -> { ManageLinksActivity fragment = new ManageLinksActivity(chatId, 0, 0); fragment.setInfo(info, info.exported_invite); presentFragment(fragment); }); + reactionsCell = new TextCell(context); + reactionsCell.setBackground(Theme.getSelectorDrawable(false)); + reactionsCell.setOnClickListener(v -> { + Bundle args = new Bundle(); + args.putLong(ChatReactionsEditActivity.KEY_CHAT_ID, chatId); + ChatReactionsEditActivity reactionsEditActivity = new ChatReactionsEditActivity(args); + reactionsEditActivity.setInfo(info); + presentFragment(reactionsEditActivity); + }); + adminCell = new TextCell(context); - adminCell.setBackgroundDrawable(Theme.getSelectorDrawable(false)); + adminCell.setBackground(Theme.getSelectorDrawable(false)); adminCell.setOnClickListener(v -> { Bundle args = new Bundle(); args.putLong("chat_id", chatId); @@ -851,6 +867,8 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image logCell.setOnClickListener(v -> presentFragment(new ChannelAdminLogActivity(currentChat))); } + infoContainer.addView(reactionsCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + if (!isChannel && !currentChat.gigagroup) { infoContainer.addView(blockCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); } @@ -1017,6 +1035,15 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image if ((mask & MessagesController.UPDATE_MASK_AVATAR) != 0) { setAvatar(); } + } else if (id == NotificationCenter.chatAvailableReactionsUpdated) { + long chatId = (long) args[0]; + if (chatId == this.chatId) { + info = getMessagesController().getChatFull(chatId); + if (info != null) { + availableReactions = info.available_reactions; + } + updateReactionsCell(); + } } } @@ -1272,6 +1299,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image currentChat = getMessagesController().getChat(chatId); } historyHidden = !ChatObject.isChannel(currentChat) || info.hidden_prehistory; + availableReactions = info.available_reactions; } } @@ -1460,6 +1488,8 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image } adminCell.setTextAndIcon(LocaleController.getString("ChannelAdministrators", R.string.ChannelAdministrators), R.drawable.actions_addadmin, true); } + reactionsCell.setVisibility(ChatObject.canChangeChatInfo(currentChat) ? View.VISIBLE : View.GONE); + updateReactionsCell(); if (info == null || !ChatObject.canUserDoAdminAction(currentChat, ChatObject.ACTION_INVITE) || (!isPrivate && currentChat.creator)) { inviteLinksCell.setVisibility(View.GONE); } else { @@ -1480,6 +1510,19 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image } } + private void updateReactionsCell() { + int count = 0; + for (int i = 0; i < availableReactions.size(); i++) { + TLRPC.TL_availableReaction reaction = getMediaDataController().getReactionsMap().get(availableReactions.get(i)); + if (reaction != null && !reaction.inactive) { + count++; + } + } + int reacts = Math.min(getMediaDataController().getEnabledReactionsList().size(), count); + reactionsCell.setTextAndValueAndIcon(LocaleController.getString("Reactions", R.string.Reactions), reacts == 0 ? LocaleController.getString("ReactionsOff", R.string.ReactionsOff) : + LocaleController.formatString("ReactionsCount", R.string.ReactionsCount, reacts, getMediaDataController().getEnabledReactionsList().size()), R.drawable.actions_reactions, true); + } + @Override public ArrayList getThemeDescriptions() { ArrayList themeDescriptions = new ArrayList<>(); @@ -1581,6 +1624,10 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image themeDescriptions.add(new ThemeDescription(undoView, 0, new Class[]{UndoView.class}, new String[]{"progressPaint"}, null, null, null, Theme.key_undo_infoColor)); themeDescriptions.add(new ThemeDescription(undoView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{UndoView.class}, new String[]{"leftImageView"}, null, null, null, Theme.key_undo_infoColor)); + themeDescriptions.add(new ThemeDescription(reactionsCell, ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_listSelector)); + themeDescriptions.add(new ThemeDescription(reactionsCell, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{TextCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); + themeDescriptions.add(new ThemeDescription(reactionsCell, 0, new Class[]{TextCell.class}, new String[]{"imageView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayIcon)); + return themeDescriptions; } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatEditTypeActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatEditTypeActivity.java index 64f2c81ac..1a72bcd36 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatEditTypeActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatEditTypeActivity.java @@ -144,7 +144,7 @@ public class ChatEditTypeActivity extends BaseFragment implements NotificationCe } isPrivate = !isForcePublic && TextUtils.isEmpty(currentChat.username); isChannel = ChatObject.isChannel(currentChat) && !currentChat.megagroup; - isSaveRestricted = /*isPrivate && */currentChat.noforwards; + isSaveRestricted = currentChat.noforwards; if (isForcePublic && TextUtils.isEmpty(currentChat.username) || isPrivate && currentChat.creator) { TLRPC.TL_channels_checkUsername req = new TLRPC.TL_channels_checkUsername(); req.username = "1"; @@ -472,7 +472,7 @@ public class ChatEditTypeActivity extends BaseFragment implements NotificationCe } private void processDone() { - if (/*isPrivate && */currentChat.noforwards != isSaveRestricted) { + if (currentChat.noforwards != isSaveRestricted) { getMessagesController().toggleChatNoForwards(chatId, currentChat.noforwards = isSaveRestricted); } if (trySetUsername()) { @@ -615,7 +615,7 @@ public class ChatEditTypeActivity extends BaseFragment implements NotificationCe } publicContainer.setVisibility(isPrivate ? View.GONE : View.VISIBLE); privateContainer.setVisibility(isPrivate ? View.VISIBLE : View.GONE); - //saveContainer.setVisibility(isPrivate ? View.VISIBLE : View.GONE); + //saveContainer.setVisibility(View.VISIBLE); manageLinksTextView.setVisibility(View.VISIBLE); manageLinksInfoCell.setVisibility(View.VISIBLE); linkContainer.setPadding(0, 0, 0, isPrivate ? 0 : AndroidUtilities.dp(7)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatPullingDownDrawable.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatPullingDownDrawable.java index f62d94909..8e1d4f2fc 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatPullingDownDrawable.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatPullingDownDrawable.java @@ -5,7 +5,6 @@ import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ValueAnimator; import android.graphics.Canvas; -import android.graphics.Color; import android.graphics.Paint; import android.graphics.Path; import android.graphics.PorterDuff; @@ -80,7 +79,7 @@ public class ChatPullingDownDrawable implements NotificationCenter.NotificationC public long nextDialogId; View parentView; - CounterView.CounterDrawable counterDrawable = new CounterView.CounterDrawable(null, null); + CounterView.CounterDrawable counterDrawable = new CounterView.CounterDrawable(null, true, null); int params[] = new int[3]; private final int currentAccount; private final int folderId; @@ -156,10 +155,10 @@ public class ChatPullingDownDrawable implements NotificationCenter.NotificationC str2 = LocaleController.getString("ReleaseToGoNextArchive", R.string.ReleaseToGoNextArchive); } else if (drawFolderBackground) { str1 = LocaleController.getString("SwipeToGoNextFolder", R.string.SwipeToGoNextFolder); - str2 = LocaleController.getString("ReleaseToGoNextFolder", R.string.ReleaseToGoNextFolder); + str2 = LocaleController.getString("ReleaseToGoNextFolder", R.string.ReleaseToGoNextFolder); } else { str1 = LocaleController.getString("SwipeToGoNextChannel", R.string.SwipeToGoNextChannel); - str2 = LocaleController.getString("ReleaseToGoNextChannel", R.string.ReleaseToGoNextChannel); + str2 = LocaleController.getString("ReleaseToGoNextChannel", R.string.ReleaseToGoNextChannel); } layout1Width = (int) textPaint2.measureText(str1); layout1Width = Math.min(layout1Width, lastWidth - AndroidUtilities.dp(60)); @@ -489,7 +488,7 @@ public class ChatPullingDownDrawable implements NotificationCenter.NotificationC @Override public void didReceivedNotification(int id, int account, Object... args) { - if (nextDialogId !=0 ) { + if (nextDialogId != 0) { TLRPC.Dialog dialog = MessagesController.getInstance(currentAccount).dialogs_dict.get(nextDialogId); if (dialog != null) { counterDrawable.setCount(dialog.unread_count, true); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatReactionsEditActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatReactionsEditActivity.java new file mode 100644 index 000000000..127587bd3 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatReactionsEditActivity.java @@ -0,0 +1,267 @@ +package org.telegram.ui; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.os.Bundle; +import android.view.View; +import android.view.ViewGroup; +import android.widget.LinearLayout; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.ChatObject; +import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MessagesStorage; +import org.telegram.messenger.NotificationCenter; +import org.telegram.messenger.R; +import org.telegram.tgnet.TLRPC; +import org.telegram.ui.ActionBar.ActionBar; +import org.telegram.ui.ActionBar.BaseFragment; +import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.ActionBar.ThemeDescription; +import org.telegram.ui.Cells.AvailableReactionCell; +import org.telegram.ui.Cells.HeaderCell; +import org.telegram.ui.Cells.TextCheckCell; +import org.telegram.ui.Cells.TextInfoPrivacyCell; +import org.telegram.ui.Components.LayoutHelper; +import org.telegram.ui.Components.RecyclerListView; +import org.telegram.ui.Components.SimpleThemeDescription; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.CountDownLatch; + +public class ChatReactionsEditActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate { + private final static int TYPE_INFO = 0, TYPE_HEADER = 1, TYPE_REACTION = 2; + + public final static String KEY_CHAT_ID = "chat_id"; + + private TLRPC.Chat currentChat; + private TLRPC.ChatFull info; + private long chatId; + + private List chatReactions = new ArrayList<>(); + + private LinearLayout contentView; + private RecyclerListView listView; + private RecyclerView.Adapter listAdapter; + + private TextCheckCell enableReactionsCell; + private ArrayList availableReactions = new ArrayList(); + + public ChatReactionsEditActivity(Bundle args) { + super(args); + + chatId = args.getLong(KEY_CHAT_ID, 0); + } + + @Override + public boolean onFragmentCreate() { + currentChat = getMessagesController().getChat(chatId); + if (currentChat == null) { + currentChat = MessagesStorage.getInstance(currentAccount).getChatSync(chatId); + if (currentChat != null) { + getMessagesController().putChat(currentChat, true); + } else { + return false; + } + if (info == null) { + info = MessagesStorage.getInstance(currentAccount).loadChatInfo(chatId, ChatObject.isChannel(currentChat), new CountDownLatch(1), false, false); + if (info == null) { + return false; + } + } + } + getNotificationCenter().addObserver(this, NotificationCenter.reactionsDidLoad); + return super.onFragmentCreate(); + } + + @Override + public View createView(Context context) { + actionBar.setTitle(LocaleController.getString("Reactions", R.string.Reactions)); + actionBar.setBackButtonImage(R.drawable.ic_ab_back); + actionBar.setAllowOverlayTitle(true); + + actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() { + @Override + public void onItemClick(int id) { + if (id == -1) { + finishFragment(); + } + } + }); + + LinearLayout ll = new LinearLayout(context); + ll.setOrientation(LinearLayout.VERTICAL); + + availableReactions.addAll(getMediaDataController().getEnabledReactionsList()); + + enableReactionsCell = new TextCheckCell(context); + enableReactionsCell.setHeight(56); + enableReactionsCell.setTextAndCheck(LocaleController.getString("EnableReactions", R.string.EnableReactions), !chatReactions.isEmpty(), false); + enableReactionsCell.setBackgroundColor(Theme.getColor(enableReactionsCell.isChecked() ? Theme.key_windowBackgroundChecked : Theme.key_windowBackgroundUnchecked)); + enableReactionsCell.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); + enableReactionsCell.setAnimatingToThumbInsteadOfTouch(true); + enableReactionsCell.setOnClickListener(v -> { + boolean c = !enableReactionsCell.isChecked(); + enableReactionsCell.setChecked(c); + int clr = Theme.getColor(c ? Theme.key_windowBackgroundChecked : Theme.key_windowBackgroundUnchecked); + if (c) { + enableReactionsCell.setBackgroundColorAnimated(c, clr); + } else { + enableReactionsCell.setBackgroundColorAnimatedReverse(clr); + } + if (c) { + for (TLRPC.TL_availableReaction a : availableReactions) { + chatReactions.add(a.reaction); + } + listAdapter.notifyItemRangeInserted(1, 1 + availableReactions.size()); + } else { + chatReactions.clear(); + listAdapter.notifyItemRangeRemoved(1, 1 + availableReactions.size()); + } + }); + ll.addView(enableReactionsCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + + listView = new RecyclerListView(context); + listView.setLayoutManager(new LinearLayoutManager(context)); + listView.setAdapter(listAdapter = new RecyclerView.Adapter() { + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + switch (viewType) { + default: + case TYPE_REACTION: { + return new RecyclerListView.Holder(new AvailableReactionCell(context, false)); + } + case TYPE_INFO: { + TextInfoPrivacyCell infoCell = new TextInfoPrivacyCell(context); + return new RecyclerListView.Holder(infoCell); + } + case TYPE_HEADER: { + return new RecyclerListView.Holder(new HeaderCell(context, 23)); + } + } + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + switch (getItemViewType(position)) { + case TYPE_INFO: + TextInfoPrivacyCell infoCell = (TextInfoPrivacyCell) holder.itemView; + infoCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText4)); + infoCell.setText(ChatObject.isChannelAndNotMegaGroup(currentChat) ? LocaleController.getString("EnableReactionsChannelInfo", R.string.EnableReactionsChannelInfo) : + LocaleController.getString("EnableReactionsGroupInfo", R.string.EnableReactionsGroupInfo)); + break; + case TYPE_HEADER: + HeaderCell headerCell = (HeaderCell) holder.itemView; + headerCell.setText(LocaleController.getString("AvailableReactions", R.string.AvailableReactions)); + headerCell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); + break; + case TYPE_REACTION: + AvailableReactionCell reactionCell = (AvailableReactionCell) holder.itemView; + TLRPC.TL_availableReaction react = availableReactions.get(position - 2); + reactionCell.bind(react, chatReactions.contains(react.reaction)); + break; + } + } + + @Override + public int getItemCount() { + return 1 + (!chatReactions.isEmpty() ? 1 + availableReactions.size() : 0); + } + + @Override + public int getItemViewType(int position) { + return position == 0 ? TYPE_INFO : position == 1 ? TYPE_HEADER : TYPE_REACTION; + } + }); + listView.setOnItemClickListener((view, position) -> { + if (position <= 1) return; + + AvailableReactionCell cell = (AvailableReactionCell) view; + TLRPC.TL_availableReaction react = availableReactions.get(position - 2); + boolean nc = !chatReactions.contains(react.reaction); + if (nc) chatReactions.add(react.reaction); + else chatReactions.remove(react.reaction); + + cell.setChecked(nc, true); + }); + ll.addView(listView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 0, 1f)); + fragmentView = contentView = ll; + + updateColors(); + + return contentView; + } + + @Override + public void onFragmentDestroy() { + super.onFragmentDestroy(); + + boolean changed = true; + if (info != null) { + changed = !info.available_reactions.equals(chatReactions); + } + if (changed) { + getMessagesController().setChatReactions(chatId, chatReactions); + } + getNotificationCenter().removeObserver(this, NotificationCenter.reactionsDidLoad); + } + + + /** + * Sets chat full info + * @param info Info to use + */ + public void setInfo(TLRPC.ChatFull info) { + this.info = info; + if (info != null) { + if (currentChat == null) { + currentChat = getMessagesController().getChat(chatId); + } + + chatReactions = new ArrayList<>(info.available_reactions); + } + } + + @Override + public ArrayList getThemeDescriptions() { + return SimpleThemeDescription.createThemeDescriptions(this::updateColors, + Theme.key_windowBackgroundWhite, + Theme.key_windowBackgroundWhiteBlackText, + Theme.key_windowBackgroundWhiteGrayText2, + Theme.key_listSelector, + Theme.key_windowBackgroundGray, + Theme.key_windowBackgroundWhiteGrayText4, + Theme.key_windowBackgroundWhiteRedText4, + Theme.key_windowBackgroundChecked, + Theme.key_windowBackgroundCheckText, + Theme.key_switchTrackBlue, + Theme.key_switchTrackBlueChecked, + Theme.key_switchTrackBlueThumb, + Theme.key_switchTrackBlueThumbChecked + ); + } + + @SuppressLint("NotifyDataSetChanged") + private void updateColors() { + contentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray)); + enableReactionsCell.setColors(Theme.key_windowBackgroundCheckText, Theme.key_switchTrackBlue, Theme.key_switchTrackBlueChecked, Theme.key_switchTrackBlueThumb, Theme.key_switchTrackBlueThumbChecked); + listAdapter.notifyDataSetChanged(); + } + + @SuppressLint("NotifyDataSetChanged") + @Override + public void didReceivedNotification(int id, int account, Object... args) { + if (account != currentAccount) return; + if (id == NotificationCenter.reactionsDidLoad) { + availableReactions.clear(); + availableReactions.addAll(getMediaDataController().getEnabledReactionsList()); + listAdapter.notifyDataSetChanged(); + } + } +} \ No newline at end of file diff --git a/TMessagesProj/src/main/java/org/telegram/ui/CodeNumberField.java b/TMessagesProj/src/main/java/org/telegram/ui/CodeNumberField.java index f7dabf979..a94dbc786 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/CodeNumberField.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/CodeNumberField.java @@ -148,7 +148,7 @@ public class CodeNumberField extends EditTextBoldCursor { if (event.getAction() == MotionEvent.ACTION_UP && pressed) { if (isFocused() && codeFieldContainer != null) { ClipboardManager clipboard = ContextCompat.getSystemService(getContext(), ClipboardManager.class); - if (clipboard == null) { + if (clipboard == null || clipboard.getPrimaryClipDescription() == null) { return false; } clipboard.getPrimaryClipDescription().hasMimeType(ClipDescription.MIMETYPE_TEXT_PLAIN); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/AudioPlayerAlert.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/AudioPlayerAlert.java index 4f0bfa359..ce3fe99da 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/AudioPlayerAlert.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/AudioPlayerAlert.java @@ -41,6 +41,7 @@ import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; import android.view.ViewGroup; +import android.view.accessibility.AccessibilityNodeInfo; import android.widget.EditText; import android.widget.FrameLayout; import android.widget.ImageView; @@ -901,6 +902,12 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter. } return true; } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.addAction(AccessibilityNodeInfo.ACTION_CLICK); + } }; prevButton.setScaleType(ImageView.ScaleType.CENTER); prevButton.setAnimation(R.raw.player_prev, 20, 20); @@ -1020,6 +1027,12 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter. return true; } + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.addAction(AccessibilityNodeInfo.ACTION_CLICK); + } + }; nextButton.setScaleType(ImageView.ScaleType.CENTER); nextButton.setAnimation(R.raw.player_prev, 20, 20); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/AvatarsDarawable.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/AvatarsDarawable.java new file mode 100644 index 000000000..522d295e1 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/AvatarsDarawable.java @@ -0,0 +1,526 @@ +package org.telegram.ui.Components; + +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ValueAnimator; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffXfermode; +import android.graphics.drawable.Drawable; +import android.os.SystemClock; +import android.view.View; + +import androidx.core.graphics.ColorUtils; + +import org.telegram.messenger.AccountInstance; +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.DialogObject; +import org.telegram.messenger.ImageReceiver; +import org.telegram.messenger.MessageObject; +import org.telegram.messenger.MessagesController; +import org.telegram.messenger.UserConfig; +import org.telegram.messenger.voip.VoIPService; +import org.telegram.tgnet.ConnectionsManager; +import org.telegram.tgnet.TLObject; +import org.telegram.tgnet.TLRPC; +import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.Cells.GroupCallUserCell; + +import java.util.Random; + +public class AvatarsDarawable { + + public final static int STYLE_GROUP_CALL_TOOLTIP = 10; + public final static int STYLE_MESSAGE_SEEN = 11; + + DrawingState[] currentStates = new DrawingState[3]; + DrawingState[] animatingStates = new DrawingState[3]; + boolean wasDraw; + + float transitionProgress = 1f; + ValueAnimator transitionProgressAnimator; + boolean updateAfterTransition; + + private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); + private Paint xRefP = new Paint(Paint.ANTI_ALIAS_FLAG); + + Runnable updateDelegate; + int currentStyle; + boolean centered; + + private boolean isInCall; + public int count; + public int height; + public int width; + + View parent; + private int overrideSize; + private float overrideAlpha = 1f; + + public void commitTransition(boolean animated) { + if (!wasDraw || !animated) { + transitionProgress = 1f; + swapStates(); + return; + } + + DrawingState[] removedStates = new DrawingState[3]; + boolean changed = false; + for (int i = 0; i < 3; i++) { + removedStates[i] = currentStates[i]; + if (currentStates[i].id != animatingStates[i].id) { + changed = true; + } else { + currentStates[i].lastSpeakTime = animatingStates[i].lastSpeakTime; + } + } + if (!changed) { + transitionProgress = 1f; + return; + } + for (int i = 0; i < 3; i++) { + boolean found = false; + for (int j = 0; j < 3; j++) { + if (currentStates[j].id == animatingStates[i].id) { + found = true; + removedStates[j] = null; + if (i == j) { + animatingStates[i].animationType = DrawingState.ANIMATION_TYPE_NONE; + GroupCallUserCell.AvatarWavesDrawable wavesDrawable = animatingStates[i].wavesDrawable; + animatingStates[i].wavesDrawable = currentStates[i].wavesDrawable; + currentStates[i].wavesDrawable = wavesDrawable; + } else { + animatingStates[i].animationType = DrawingState.ANIMATION_TYPE_MOVE; + animatingStates[i].moveFromIndex = j; + } + break; + } + } + if (!found) { + animatingStates[i].animationType = DrawingState.ANIMATION_TYPE_IN; + } + } + + for (int i = 0; i < 3; i++) { + if (removedStates[i] != null) { + removedStates[i].animationType = DrawingState.ANIMATION_TYPE_OUT; + } + } + if (transitionProgressAnimator != null) { + transitionProgressAnimator.cancel(); + } + transitionProgress = 0; + transitionProgressAnimator = ValueAnimator.ofFloat(0, 1f); + transitionProgressAnimator.addUpdateListener(valueAnimator -> { + transitionProgress = (float) valueAnimator.getAnimatedValue(); + invalidate(); + }); + transitionProgressAnimator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + if (transitionProgressAnimator != null) { + transitionProgress = 1f; + swapStates(); + if (updateAfterTransition) { + updateAfterTransition = false; + if (updateDelegate != null) { + updateDelegate.run(); + } + } + invalidate(); + } + transitionProgressAnimator = null; + } + }); + transitionProgressAnimator.setDuration(220); + transitionProgressAnimator.setInterpolator(CubicBezierInterpolator.DEFAULT); + transitionProgressAnimator.start(); + invalidate(); + } + + private void swapStates() { + for (int i = 0; i < 3; i++) { + DrawingState state = currentStates[i]; + currentStates[i] = animatingStates[i]; + animatingStates[i] = state; + } + } + + public void updateAfterTransitionEnd() { + updateAfterTransition = true; + } + + public void setDelegate(Runnable delegate) { + updateDelegate = delegate; + } + + public void setStyle(int currentStyle) { + this.currentStyle = currentStyle; + invalidate(); + } + + private void invalidate() { + if (parent != null) { + parent.invalidate(); + } + } + + public void setSize(int size) { + overrideSize = size; + } + + public void animateFromState(AvatarsDarawable avatarsDarawable, int currentAccount) { + TLObject[] objects = new TLObject[3]; + for (int i = 0; i < 3; i++) { + objects[i] = currentStates[i].object; + setObject(i, currentAccount, avatarsDarawable.currentStates[i].object); + } + commitTransition(false); + for (int i = 0; i < 3; i++) { + setObject(i, currentAccount, objects[i]); + } + wasDraw = true; + commitTransition(true); + } + + public void setAlpha(float alpha) { + overrideAlpha = alpha; + } + + private static class DrawingState { + + public static final int ANIMATION_TYPE_NONE = -1; + public static final int ANIMATION_TYPE_IN = 0; + public static final int ANIMATION_TYPE_OUT = 1; + public static final int ANIMATION_TYPE_MOVE = 2; + + private AvatarDrawable avatarDrawable; + private GroupCallUserCell.AvatarWavesDrawable wavesDrawable; + private long lastUpdateTime; + private long lastSpeakTime; + private ImageReceiver imageReceiver; + TLRPC.TL_groupCallParticipant participant; + + private long id; + private TLObject object; + + private int animationType; + private int moveFromIndex; + } + + Random random = new Random(); + + public AvatarsDarawable(View parent, boolean inCall) { + this.parent = parent; + for (int a = 0; a < 3; a++) { + currentStates[a] = new DrawingState(); + currentStates[a].imageReceiver = new ImageReceiver(); + currentStates[a].imageReceiver.setRoundRadius(AndroidUtilities.dp(12)); + currentStates[a].avatarDrawable = new AvatarDrawable(); + currentStates[a].avatarDrawable.setTextSize(AndroidUtilities.dp(12)); + + animatingStates[a] = new DrawingState(); + animatingStates[a].imageReceiver = new ImageReceiver(); + animatingStates[a].imageReceiver.setRoundRadius(AndroidUtilities.dp(12)); + animatingStates[a].avatarDrawable = new AvatarDrawable(); + animatingStates[a].avatarDrawable.setTextSize(AndroidUtilities.dp(12)); + } + isInCall = inCall; + xRefP.setColor(0); + xRefP.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR)); + } + + public void setObject(int index, int account, TLObject object) { + animatingStates[index].id = 0; + animatingStates[index].participant = null; + if (object == null) { + animatingStates[index].imageReceiver.setImageBitmap((Drawable) null); + invalidate(); + return; + } + TLRPC.User currentUser = null; + TLRPC.Chat currentChat = null; + animatingStates[index].lastSpeakTime = -1; + animatingStates[index].object = object; + if (object instanceof TLRPC.TL_groupCallParticipant) { + TLRPC.TL_groupCallParticipant participant = (TLRPC.TL_groupCallParticipant) object; + animatingStates[index].participant = participant; + long id = MessageObject.getPeerId(participant.peer); + if (DialogObject.isUserDialog(id)) { + currentUser = MessagesController.getInstance(account).getUser(id); + animatingStates[index].avatarDrawable.setInfo(currentUser); + } else { + currentChat = MessagesController.getInstance(account).getChat(-id); + animatingStates[index].avatarDrawable.setInfo(currentChat); + } + if (currentStyle == 4) { + if (id == AccountInstance.getInstance(account).getUserConfig().getClientUserId()) { + animatingStates[index].lastSpeakTime = 0; + } else { + if (isInCall) { + animatingStates[index].lastSpeakTime = participant.lastActiveDate; + } else { + animatingStates[index].lastSpeakTime = participant.active_date; + } + } + } else { + animatingStates[index].lastSpeakTime = participant.active_date; + } + animatingStates[index].id = id; + } else if (object instanceof TLRPC.User) { + currentUser = (TLRPC.User) object; + animatingStates[index].avatarDrawable.setInfo(currentUser); + animatingStates[index].id = currentUser.id; + } else { + currentChat = (TLRPC.Chat) object; + animatingStates[index].avatarDrawable.setInfo(currentChat); + animatingStates[index].id = -currentChat.id; + } + if (currentUser != null) { + animatingStates[index].imageReceiver.setForUserOrChat(currentUser, animatingStates[index].avatarDrawable); + } else { + animatingStates[index].imageReceiver.setForUserOrChat(currentChat, animatingStates[index].avatarDrawable); + } + boolean bigAvatars = currentStyle == 4 || currentStyle == STYLE_GROUP_CALL_TOOLTIP; + animatingStates[index].imageReceiver.setRoundRadius(AndroidUtilities.dp(bigAvatars ? 16 : 12)); + int size = getSize(); + animatingStates[index].imageReceiver.setImageCoords(0, 0, size, size); + invalidate(); + } + + public void onDraw(Canvas canvas) { + wasDraw = true; + boolean bigAvatars = currentStyle == 4 || currentStyle == STYLE_GROUP_CALL_TOOLTIP; + int size = getSize(); + int toAdd; + if (currentStyle == STYLE_MESSAGE_SEEN) { + toAdd = AndroidUtilities.dp(12); + } else if (overrideSize != 0) { + toAdd = (int) (overrideSize * 0.8f); + } else { + toAdd = AndroidUtilities.dp(bigAvatars ? 24 : 20); + } + int drawCount = 0; + for (int i = 0; i < 3; i++) { + if (currentStates[i].id != 0) { + drawCount++; + } + } + int startPadding = (currentStyle == 0 || currentStyle == STYLE_GROUP_CALL_TOOLTIP || currentStyle == STYLE_MESSAGE_SEEN) ? 0 : AndroidUtilities.dp(10); + int ax = centered ? (width - drawCount * toAdd - AndroidUtilities.dp(bigAvatars ? 8 : 4)) / 2 : startPadding; + boolean isMuted = VoIPService.getSharedInstance() != null && VoIPService.getSharedInstance().isMicMute(); + if (currentStyle == 4) { + paint.setColor(Theme.getColor(Theme.key_inappPlayerBackground)); + } else if (currentStyle != 3) { + paint.setColor(Theme.getColor(isMuted ? Theme.key_returnToCallMutedBackground : Theme.key_returnToCallBackground)); + } + + int animateToDrawCount = 0; + for (int i = 0; i < 3; i++) { + if (animatingStates[i].id != 0) { + animateToDrawCount++; + } + } + boolean useAlphaLayer = currentStyle == 0 || currentStyle == 1 || currentStyle == 3 || currentStyle == 4 || currentStyle == 5 || currentStyle == STYLE_GROUP_CALL_TOOLTIP || currentStyle == STYLE_MESSAGE_SEEN; + if (useAlphaLayer) { + float padding = currentStyle == STYLE_GROUP_CALL_TOOLTIP ? AndroidUtilities.dp(16) : 0; + canvas.saveLayerAlpha(-padding, -padding, width + padding, height + padding, 255, Canvas.ALL_SAVE_FLAG); + } + for (int a = 2; a >= 0; a--) { + for (int k = 0; k < 2; k++) { + if (k == 0 && transitionProgress == 1f) { + continue; + } + DrawingState[] states = k == 0 ? animatingStates : currentStates; + + + if (k == 1 && transitionProgress != 1f && states[a].animationType != DrawingState.ANIMATION_TYPE_OUT) { + continue; + } + ImageReceiver imageReceiver = states[a].imageReceiver; + if (!imageReceiver.hasImageSet()) { + continue; + } + if (k == 0) { + int toAx = centered ? (width - animateToDrawCount * toAdd - AndroidUtilities.dp(bigAvatars ? 8 : 4)) / 2 : startPadding; + imageReceiver.setImageX(toAx + toAdd * a); + } else { + imageReceiver.setImageX(ax + toAdd * a); + } + + if (currentStyle == 0 || currentStyle == STYLE_GROUP_CALL_TOOLTIP || currentStyle == STYLE_MESSAGE_SEEN) { + imageReceiver.setImageY((height - size) / 2f); + } else { + imageReceiver.setImageY(AndroidUtilities.dp(currentStyle == 4 ? 8 : 6)); + } + + boolean needRestore = false; + float alpha = 1f; + if (transitionProgress != 1f) { + if (states[a].animationType == DrawingState.ANIMATION_TYPE_OUT) { + canvas.save(); + canvas.scale(1f - transitionProgress, 1f - transitionProgress, imageReceiver.getCenterX(), imageReceiver.getCenterY()); + needRestore = true; + alpha = 1f - transitionProgress; + } else if (states[a].animationType == DrawingState.ANIMATION_TYPE_IN) { + canvas.save(); + canvas.scale(transitionProgress, transitionProgress, imageReceiver.getCenterX(), imageReceiver.getCenterY()); + alpha = transitionProgress; + needRestore = true; + } else if (states[a].animationType == DrawingState.ANIMATION_TYPE_MOVE) { + int toAx = centered ? (width - animateToDrawCount * toAdd - AndroidUtilities.dp(bigAvatars ? 8 : 4)) / 2 : startPadding; + int toX = toAx + toAdd * a; + int fromX = ax + toAdd * states[a].moveFromIndex; + imageReceiver.setImageX((int) (toX * transitionProgress + fromX * (1f - transitionProgress))); + } else if (states[a].animationType == DrawingState.ANIMATION_TYPE_NONE && centered) { + int toAx = (width - animateToDrawCount * toAdd - AndroidUtilities.dp(bigAvatars ? 8 : 4)) / 2; + int toX = toAx + toAdd * a; + int fromX = ax + toAdd * a; + imageReceiver.setImageX((int) (toX * transitionProgress + fromX * (1f - transitionProgress))); + } + } + alpha *= overrideAlpha; + + float avatarScale = 1f; + if (a != states.length - 1) { + if (currentStyle == 1 || currentStyle == 3 || currentStyle == 5) { + canvas.drawCircle(imageReceiver.getCenterX(), imageReceiver.getCenterY(), AndroidUtilities.dp(13), xRefP); + if (states[a].wavesDrawable == null) { + if (currentStyle == 5) { + states[a].wavesDrawable = new GroupCallUserCell.AvatarWavesDrawable(AndroidUtilities.dp(14), AndroidUtilities.dp(16)); + } else { + states[a].wavesDrawable = new GroupCallUserCell.AvatarWavesDrawable(AndroidUtilities.dp(17), AndroidUtilities.dp(21)); + } + } + if (currentStyle == 5) { + states[a].wavesDrawable.setColor(ColorUtils.setAlphaComponent(Theme.getColor(Theme.key_voipgroup_speakingText), (int) (255 * 0.3f * alpha))); + } + if (states[a].participant != null && states[a].participant.amplitude > 0) { + states[a].wavesDrawable.setShowWaves(true, parent); + float amplitude = states[a].participant.amplitude * 15f; + states[a].wavesDrawable.setAmplitude(amplitude); + } else { + states[a].wavesDrawable.setShowWaves(false, parent); + } + if (currentStyle == 5 && (SystemClock.uptimeMillis() - states[a].participant.lastSpeakTime) > 500) { + updateDelegate.run(); + } + states[a].wavesDrawable.update(); + if (currentStyle == 5) { + states[a].wavesDrawable.draw(canvas, imageReceiver.getCenterX(), imageReceiver.getCenterY(), parent); + invalidate(); + } + avatarScale = states[a].wavesDrawable.getAvatarScale(); + } else if (currentStyle == 4 || currentStyle == STYLE_GROUP_CALL_TOOLTIP) { + canvas.drawCircle(imageReceiver.getCenterX(), imageReceiver.getCenterY(), AndroidUtilities.dp(17), xRefP); + if (states[a].wavesDrawable == null) { + states[a].wavesDrawable = new GroupCallUserCell.AvatarWavesDrawable(AndroidUtilities.dp(17), AndroidUtilities.dp(21)); + } + if (currentStyle == STYLE_GROUP_CALL_TOOLTIP) { + states[a].wavesDrawable.setColor(ColorUtils.setAlphaComponent(Theme.getColor(Theme.key_voipgroup_speakingText), (int) (255 * 0.3f * alpha))); + } else { + states[a].wavesDrawable.setColor(ColorUtils.setAlphaComponent(Theme.getColor(Theme.key_voipgroup_listeningText), (int) (255 * 0.3f * alpha))); + } + long currentTime = System.currentTimeMillis(); + if (currentTime - states[a].lastUpdateTime > 100) { + states[a].lastUpdateTime = currentTime; + if (currentStyle == STYLE_GROUP_CALL_TOOLTIP) { + if (states[a].participant != null && states[a].participant.amplitude > 0) { + states[a].wavesDrawable.setShowWaves(true, parent); + float amplitude = states[a].participant.amplitude * 15f; + states[a].wavesDrawable.setAmplitude(amplitude); + } else { + states[a].wavesDrawable.setShowWaves(false, parent); + } + } else { + if (ConnectionsManager.getInstance(UserConfig.selectedAccount).getCurrentTime() - states[a].lastSpeakTime <= 5) { + states[a].wavesDrawable.setShowWaves(true, parent); + states[a].wavesDrawable.setAmplitude(random.nextInt() % 100); + } else { + states[a].wavesDrawable.setShowWaves(false, parent); + states[a].wavesDrawable.setAmplitude(0); + } + } + } + states[a].wavesDrawable.update(); + states[a].wavesDrawable.draw(canvas, imageReceiver.getCenterX(), imageReceiver.getCenterY(), parent); + avatarScale = states[a].wavesDrawable.getAvatarScale(); + } else { + float rad = getSize() / 2f + AndroidUtilities.dp(2); + if (useAlphaLayer) { + canvas.drawCircle(imageReceiver.getCenterX(), imageReceiver.getCenterY(), rad, xRefP); + } else { + int paintAlpha = paint.getAlpha(); + if (alpha != 1f) { + paint.setAlpha((int) (paintAlpha * alpha)); + } + canvas.drawCircle(imageReceiver.getCenterX(), imageReceiver.getCenterY(), rad, paint); + if (alpha != 1f) { + paint.setAlpha(paintAlpha); + } + } + } + } + imageReceiver.setAlpha(alpha); + if (avatarScale != 1f) { + canvas.save(); + canvas.scale(avatarScale, avatarScale, imageReceiver.getCenterX(), imageReceiver.getCenterY()); + imageReceiver.draw(canvas); + canvas.restore(); + } else { + imageReceiver.draw(canvas); + } + if (needRestore) { + canvas.restore(); + } + } + } + if (useAlphaLayer) { + canvas.restore(); + } + } + + private int getSize() { + if (overrideSize != 0) { + return overrideSize; + } + boolean bigAvatars = currentStyle == 4 || currentStyle == STYLE_GROUP_CALL_TOOLTIP; + return AndroidUtilities.dp(bigAvatars ? 32 : 24); + } + + public void onDetachedFromWindow() { + wasDraw = false; + for (int a = 0; a < 3; a++) { + currentStates[a].imageReceiver.onDetachedFromWindow(); + animatingStates[a].imageReceiver.onDetachedFromWindow(); + } + if (currentStyle == 3) { + Theme.getFragmentContextViewWavesDrawable().setAmplitude(0); + } + } + + public void onAttachedToWindow() { + for (int a = 0; a < 3; a++) { + currentStates[a].imageReceiver.onAttachedToWindow(); + animatingStates[a].imageReceiver.onAttachedToWindow(); + } + } + + public void setCentered(boolean centered) { + this.centered = centered; + } + + public void setCount(int count) { + this.count = count; + if (parent != null) { + parent.requestLayout(); + } + } + + public void reset() { + for (int i = 0; i < animatingStates.length; ++i) { + setObject(0, 0, null); + } + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/AvatarsImageView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/AvatarsImageView.java index 12ececc40..f514f62eb 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/AvatarsImageView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/AvatarsImageView.java @@ -1,486 +1,77 @@ package org.telegram.ui.Components; -import android.animation.Animator; -import android.animation.AnimatorListenerAdapter; -import android.animation.ValueAnimator; -import android.annotation.SuppressLint; import android.content.Context; import android.graphics.Canvas; -import android.graphics.Paint; -import android.graphics.PorterDuff; -import android.graphics.PorterDuffXfermode; -import android.graphics.drawable.Drawable; -import android.os.SystemClock; -import android.widget.FrameLayout; +import android.view.View; -import androidx.core.graphics.ColorUtils; +import androidx.annotation.NonNull; -import org.telegram.messenger.AccountInstance; -import org.telegram.messenger.AndroidUtilities; -import org.telegram.messenger.DialogObject; -import org.telegram.messenger.ImageReceiver; -import org.telegram.messenger.MessageObject; -import org.telegram.messenger.MessagesController; -import org.telegram.messenger.UserConfig; -import org.telegram.messenger.voip.VoIPService; -import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; -import org.telegram.tgnet.TLRPC; -import org.telegram.ui.ActionBar.Theme; -import org.telegram.ui.Cells.GroupCallUserCell; -import java.util.Random; +public class AvatarsImageView extends View { -public class AvatarsImageView extends FrameLayout { + public final AvatarsDarawable avatarsDarawable; - public final static int STYLE_GROUP_CALL_TOOLTIP = 10; - public final static int STYLE_MESSAGE_SEEN = 11; - - DrawingState[] currentStates = new DrawingState[3]; - DrawingState[] animatingStates = new DrawingState[3]; - boolean wasDraw; - - float transitionProgress = 1f; - ValueAnimator transitionProgressAnimator; - boolean updateAfterTransition; - - private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); - private Paint xRefP = new Paint(Paint.ANTI_ALIAS_FLAG); - - Runnable updateDelegate; - int currentStyle; - boolean centered; - - private boolean isInCall; - protected int count; - - public void commitTransition(boolean animated) { - if (!wasDraw || !animated) { - transitionProgress = 1f; - swapStates(); - return; - } - - DrawingState[] removedStates = new DrawingState[3]; - boolean changed = false; - for (int i = 0; i < 3; i++) { - removedStates[i] = currentStates[i]; - if (currentStates[i].id != animatingStates[i].id) { - changed = true; - } else { - currentStates[i].lastSpeakTime = animatingStates[i].lastSpeakTime; - } - } - if (!changed) { - transitionProgress = 1f; - return; - } - for (int i = 0; i < 3; i++) { - boolean found = false; - for (int j = 0; j < 3; j++) { - if (currentStates[j].id == animatingStates[i].id) { - found = true; - removedStates[j] = null; - if (i == j) { - animatingStates[i].animationType = DrawingState.ANIMATION_TYPE_NONE; - GroupCallUserCell.AvatarWavesDrawable wavesDrawable = animatingStates[i].wavesDrawable; - animatingStates[i].wavesDrawable = currentStates[i].wavesDrawable; - currentStates[i].wavesDrawable = wavesDrawable; - } else { - animatingStates[i].animationType = DrawingState.ANIMATION_TYPE_MOVE; - animatingStates[i].moveFromIndex = j; - } - break; - } - } - if (!found) { - animatingStates[i].animationType = DrawingState.ANIMATION_TYPE_IN; - } - } - - for (int i = 0; i < 3; i++) { - if (removedStates[i] != null) { - removedStates[i].animationType = DrawingState.ANIMATION_TYPE_OUT; - } - } - if (transitionProgressAnimator != null) { - transitionProgressAnimator.cancel(); - } - transitionProgress = 0; - transitionProgressAnimator = ValueAnimator.ofFloat(0, 1f); - transitionProgressAnimator.addUpdateListener(valueAnimator -> { - transitionProgress = (float) valueAnimator.getAnimatedValue(); - invalidate(); - }); - transitionProgressAnimator.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animation) { - if (transitionProgressAnimator != null) { - transitionProgress = 1f; - swapStates(); - if (updateAfterTransition) { - updateAfterTransition = false; - if (updateDelegate != null) { - updateDelegate.run(); - } - } - invalidate(); - } - transitionProgressAnimator = null; - } - }); - transitionProgressAnimator.setDuration(220); - transitionProgressAnimator.setInterpolator(CubicBezierInterpolator.DEFAULT); - transitionProgressAnimator.start(); - invalidate(); - } - - private void swapStates() { - for (int i = 0; i < 3; i++) { - DrawingState state = currentStates[i]; - currentStates[i] = animatingStates[i]; - animatingStates[i] = state; - } - } - - public void updateAfterTransitionEnd() { - updateAfterTransition = true; - } - - public void setDelegate(Runnable delegate) { - updateDelegate = delegate; - } - - public void setStyle(int currentStyle) { - this.currentStyle = currentStyle; - invalidate(); - } - - private static class DrawingState { - - public static final int ANIMATION_TYPE_NONE = -1; - public static final int ANIMATION_TYPE_IN = 0; - public static final int ANIMATION_TYPE_OUT = 1; - public static final int ANIMATION_TYPE_MOVE = 2; - - private AvatarDrawable avatarDrawable; - private GroupCallUserCell.AvatarWavesDrawable wavesDrawable; - private long lastUpdateTime; - private long lastSpeakTime; - private ImageReceiver imageReceiver; - TLRPC.TL_groupCallParticipant participant; - - private long id; - - private int animationType; - private int moveFromIndex; - } - - Random random = new Random(); - - public AvatarsImageView(Context context, boolean inCall) { + public AvatarsImageView(@NonNull Context context, boolean inCall) { super(context); - for (int a = 0; a < 3; a++) { - currentStates[a] = new DrawingState(); - currentStates[a].imageReceiver = new ImageReceiver(this); - currentStates[a].imageReceiver.setRoundRadius(AndroidUtilities.dp(12)); - currentStates[a].avatarDrawable = new AvatarDrawable(); - currentStates[a].avatarDrawable.setTextSize(AndroidUtilities.dp(12)); - - animatingStates[a] = new DrawingState(); - animatingStates[a].imageReceiver = new ImageReceiver(this); - animatingStates[a].imageReceiver.setRoundRadius(AndroidUtilities.dp(12)); - animatingStates[a].avatarDrawable = new AvatarDrawable(); - animatingStates[a].avatarDrawable.setTextSize(AndroidUtilities.dp(12)); - } - isInCall = inCall; - setWillNotDraw(false); - xRefP.setColor(0); - xRefP.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR)); - } - - public void setObject(int index, int account, TLObject object) { - animatingStates[index].id = 0; - animatingStates[index].participant = null; - if (object == null) { - animatingStates[index].imageReceiver.setImageBitmap((Drawable) null); - invalidate(); - return; - } - TLRPC.User currentUser = null; - TLRPC.Chat currentChat = null; - animatingStates[index].lastSpeakTime = -1; - if (object instanceof TLRPC.TL_groupCallParticipant) { - TLRPC.TL_groupCallParticipant participant = (TLRPC.TL_groupCallParticipant) object; - animatingStates[index].participant = participant; - long id = MessageObject.getPeerId(participant.peer); - if (DialogObject.isUserDialog(id)) { - currentUser = MessagesController.getInstance(account).getUser(id); - animatingStates[index].avatarDrawable.setInfo(currentUser); - } else { - currentChat = MessagesController.getInstance(account).getChat(-id); - animatingStates[index].avatarDrawable.setInfo(currentChat); - } - if (currentStyle == 4) { - if (id == AccountInstance.getInstance(account).getUserConfig().getClientUserId()) { - animatingStates[index].lastSpeakTime = 0; - } else { - if (isInCall) { - animatingStates[index].lastSpeakTime = participant.lastActiveDate; - } else { - animatingStates[index].lastSpeakTime = participant.active_date; - } - } - } else { - animatingStates[index].lastSpeakTime = participant.active_date; - } - animatingStates[index].id = id; - } else if (object instanceof TLRPC.User) { - currentUser = (TLRPC.User) object; - animatingStates[index].avatarDrawable.setInfo(currentUser); - animatingStates[index].id = currentUser.id; - } else { - currentChat = (TLRPC.Chat) object; - animatingStates[index].avatarDrawable.setInfo(currentChat); - animatingStates[index].id = -currentChat.id; - } - if (currentUser != null) { - animatingStates[index].imageReceiver.setForUserOrChat(currentUser, animatingStates[index].avatarDrawable); - } else { - animatingStates[index].imageReceiver.setForUserOrChat(currentChat, animatingStates[index].avatarDrawable); - } - boolean bigAvatars = currentStyle == 4 || currentStyle == STYLE_GROUP_CALL_TOOLTIP; - animatingStates[index].imageReceiver.setRoundRadius(AndroidUtilities.dp(bigAvatars ? 16 : 12)); - int size = AndroidUtilities.dp(bigAvatars ? 32 : 24); - animatingStates[index].imageReceiver.setImageCoords(0, 0, size, size); - invalidate(); - } - - @SuppressLint("DrawAllocation") - @Override - protected void onDraw(Canvas canvas) { - wasDraw = true; - - boolean bigAvatars = currentStyle == 4 || currentStyle == STYLE_GROUP_CALL_TOOLTIP; - int size = AndroidUtilities.dp(bigAvatars ? 32 : 24); - int toAdd; - if (currentStyle == STYLE_MESSAGE_SEEN) { - toAdd = AndroidUtilities.dp(12); - } else { - toAdd = AndroidUtilities.dp(bigAvatars ? 24 : 20); - } - int drawCount = 0; - for (int i = 0; i < 3; i++) { - if (currentStates[i].id != 0) { - drawCount++; - } - } - int startPadding = (currentStyle == 0 || currentStyle == STYLE_GROUP_CALL_TOOLTIP || currentStyle == STYLE_MESSAGE_SEEN) ? 0 : AndroidUtilities.dp(10); - int ax = centered ? (getMeasuredWidth() - drawCount * toAdd - AndroidUtilities.dp(bigAvatars ? 8 : 4)) / 2 : startPadding; - boolean isMuted = VoIPService.getSharedInstance() != null && VoIPService.getSharedInstance().isMicMute(); - if (currentStyle == 4) { - paint.setColor(Theme.getColor(Theme.key_inappPlayerBackground)); - } else if (currentStyle != 3) { - paint.setColor(Theme.getColor(isMuted ? Theme.key_returnToCallMutedBackground : Theme.key_returnToCallBackground)); - } - - int animateToDrawCount = 0; - for (int i = 0; i < 3; i++) { - if (animatingStates[i].id != 0) { - animateToDrawCount++; - } - } - boolean useAlphaLayer = currentStyle == 0 || currentStyle == 1 || currentStyle == 3 || currentStyle == 4 || currentStyle == 5 || currentStyle == STYLE_GROUP_CALL_TOOLTIP || currentStyle == STYLE_MESSAGE_SEEN; - if (useAlphaLayer) { - float padding = currentStyle == STYLE_GROUP_CALL_TOOLTIP ? AndroidUtilities.dp(16) : 0; - canvas.saveLayerAlpha(-padding, -padding, getMeasuredWidth() + padding, getMeasuredHeight() + padding, 255, Canvas.ALL_SAVE_FLAG); - } - for (int a = 2; a >= 0; a--) { - for (int k = 0; k < 2; k++) { - if (k == 0 && transitionProgress == 1f) { - continue; - } - DrawingState[] states = k == 0 ? animatingStates : currentStates; - - - if (k == 1 && transitionProgress != 1f && states[a].animationType != DrawingState.ANIMATION_TYPE_OUT) { - continue; - } - ImageReceiver imageReceiver = states[a].imageReceiver; - if (!imageReceiver.hasImageSet()) { - continue; - } - if (k == 0) { - int toAx = centered ? (getMeasuredWidth() - animateToDrawCount * toAdd - AndroidUtilities.dp(bigAvatars ? 8 : 4)) / 2 : startPadding; - imageReceiver.setImageX(toAx + toAdd * a); - } else { - imageReceiver.setImageX(ax + toAdd * a); - } - - if (currentStyle == 0 || currentStyle == STYLE_GROUP_CALL_TOOLTIP || currentStyle == STYLE_MESSAGE_SEEN) { - imageReceiver.setImageY((getMeasuredHeight() - size) / 2f); - } else { - imageReceiver.setImageY(AndroidUtilities.dp(currentStyle == 4 ? 8 : 6)); - } - - boolean needRestore = false; - float alpha = 1f; - if (transitionProgress != 1f) { - if (states[a].animationType == DrawingState.ANIMATION_TYPE_OUT) { - canvas.save(); - canvas.scale(1f - transitionProgress, 1f - transitionProgress, imageReceiver.getCenterX(), imageReceiver.getCenterY()); - needRestore = true; - alpha = 1f - transitionProgress; - } else if (states[a].animationType == DrawingState.ANIMATION_TYPE_IN) { - canvas.save(); - canvas.scale(transitionProgress, transitionProgress, imageReceiver.getCenterX(), imageReceiver.getCenterY()); - alpha = transitionProgress; - needRestore = true; - } else if (states[a].animationType == DrawingState.ANIMATION_TYPE_MOVE) { - int toAx = centered ? (getMeasuredWidth() - animateToDrawCount * toAdd - AndroidUtilities.dp(bigAvatars ? 8 : 4)) / 2 : startPadding; - int toX = toAx + toAdd * a; - int fromX = ax + toAdd * states[a].moveFromIndex; - imageReceiver.setImageX((int) (toX * transitionProgress + fromX * (1f - transitionProgress))); - } else if (states[a].animationType == DrawingState.ANIMATION_TYPE_NONE && centered) { - int toAx = (getMeasuredWidth() - animateToDrawCount * toAdd - AndroidUtilities.dp(bigAvatars ? 8 : 4)) / 2; - int toX = toAx + toAdd * a; - int fromX = ax + toAdd * a; - imageReceiver.setImageX((int) (toX * transitionProgress + fromX * (1f - transitionProgress))); - } - } - - float avatarScale = 1f; - if (a != states.length - 1) { - if (currentStyle == 1 || currentStyle == 3 || currentStyle == 5) { - canvas.drawCircle(imageReceiver.getCenterX(), imageReceiver.getCenterY(), AndroidUtilities.dp(13), xRefP); - if (states[a].wavesDrawable == null) { - if (currentStyle == 5) { - states[a].wavesDrawable = new GroupCallUserCell.AvatarWavesDrawable(AndroidUtilities.dp(14), AndroidUtilities.dp(16)); - } else { - states[a].wavesDrawable = new GroupCallUserCell.AvatarWavesDrawable(AndroidUtilities.dp(17), AndroidUtilities.dp(21)); - } - } - if (currentStyle == 5) { - states[a].wavesDrawable.setColor(ColorUtils.setAlphaComponent(Theme.getColor(Theme.key_voipgroup_speakingText), (int) (255 * 0.3f * alpha))); - } - if (states[a].participant != null && states[a].participant.amplitude > 0) { - states[a].wavesDrawable.setShowWaves(true, this); - float amplitude = states[a].participant.amplitude * 15f; - states[a].wavesDrawable.setAmplitude(amplitude); - } else { - states[a].wavesDrawable.setShowWaves(false, this); - } - if (currentStyle == 5 && (SystemClock.uptimeMillis() - states[a].participant.lastSpeakTime) > 500) { - updateDelegate.run(); - } - states[a].wavesDrawable.update(); - if (currentStyle == 5) { - states[a].wavesDrawable.draw(canvas, imageReceiver.getCenterX(), imageReceiver.getCenterY(), this); - invalidate(); - } - avatarScale = states[a].wavesDrawable.getAvatarScale(); - } else if (currentStyle == 4 || currentStyle == STYLE_GROUP_CALL_TOOLTIP) { - canvas.drawCircle(imageReceiver.getCenterX(), imageReceiver.getCenterY(), AndroidUtilities.dp(17), xRefP); - if (states[a].wavesDrawable == null) { - states[a].wavesDrawable = new GroupCallUserCell.AvatarWavesDrawable(AndroidUtilities.dp(17), AndroidUtilities.dp(21)); - } - if (currentStyle == STYLE_GROUP_CALL_TOOLTIP) { - states[a].wavesDrawable.setColor(ColorUtils.setAlphaComponent(Theme.getColor(Theme.key_voipgroup_speakingText), (int) (255 * 0.3f * alpha))); - } else { - states[a].wavesDrawable.setColor(ColorUtils.setAlphaComponent(Theme.getColor(Theme.key_voipgroup_listeningText), (int) (255 * 0.3f * alpha))); - } - long currentTime = System.currentTimeMillis(); - if (currentTime - states[a].lastUpdateTime > 100) { - states[a].lastUpdateTime = currentTime; - if (currentStyle == STYLE_GROUP_CALL_TOOLTIP) { - if (states[a].participant != null && states[a].participant.amplitude > 0) { - states[a].wavesDrawable.setShowWaves(true, this); - float amplitude = states[a].participant.amplitude * 15f; - states[a].wavesDrawable.setAmplitude(amplitude); - } else { - states[a].wavesDrawable.setShowWaves(false, this); - } - } else { - if (ConnectionsManager.getInstance(UserConfig.selectedAccount).getCurrentTime() - states[a].lastSpeakTime <= 5) { - states[a].wavesDrawable.setShowWaves(true, this); - states[a].wavesDrawable.setAmplitude(random.nextInt() % 100); - } else { - states[a].wavesDrawable.setShowWaves(false, this); - states[a].wavesDrawable.setAmplitude(0); - } - } - } - states[a].wavesDrawable.update(); - states[a].wavesDrawable.draw(canvas, imageReceiver.getCenterX(), imageReceiver.getCenterY(), this); - avatarScale = states[a].wavesDrawable.getAvatarScale(); - } else { - if (useAlphaLayer) { - canvas.drawCircle(imageReceiver.getCenterX(), imageReceiver.getCenterY(), AndroidUtilities.dp(bigAvatars ? 17 : 13), xRefP); - } else { - int paintAlpha = paint.getAlpha(); - if (alpha != 1f) { - paint.setAlpha((int) (paintAlpha * alpha)); - } - canvas.drawCircle(imageReceiver.getCenterX(), imageReceiver.getCenterY(), AndroidUtilities.dp(bigAvatars ? 17 : 13), paint); - if (alpha != 1f) { - paint.setAlpha(paintAlpha); - } - } - } - } - imageReceiver.setAlpha(alpha); - if (avatarScale != 1f) { - canvas.save(); - canvas.scale(avatarScale, avatarScale, imageReceiver.getCenterX(), imageReceiver.getCenterY()); - imageReceiver.draw(canvas); - canvas.restore(); - } else { - imageReceiver.draw(canvas); - } - if (needRestore) { - canvas.restore(); - } - } - } - if (useAlphaLayer) { - canvas.restore(); - } + avatarsDarawable = new AvatarsDarawable(this, inCall); } @Override - protected void onDetachedFromWindow() { - super.onDetachedFromWindow(); - wasDraw = false; - for (int a = 0; a < 3; a++) { - currentStates[a].imageReceiver.onDetachedFromWindow(); - animatingStates[a].imageReceiver.onDetachedFromWindow(); - } - if (currentStyle == 3) { - Theme.getFragmentContextViewWavesDrawable().setAmplitude(0); - } + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + avatarsDarawable.width = getMeasuredWidth(); + avatarsDarawable.height = getMeasuredHeight(); } @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); - for (int a = 0; a < 3; a++) { - currentStates[a].imageReceiver.onAttachedToWindow(); - animatingStates[a].imageReceiver.onAttachedToWindow(); - } + avatarsDarawable.onAttachedToWindow(); } - public void setCentered(boolean centered) { - this.centered = centered; + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + avatarsDarawable.onDraw(canvas); } - public void setCount(int count) { - this.count = count; - requestLayout(); + @Override + protected void onDetachedFromWindow() { + super.onDetachedFromWindow(); + avatarsDarawable.onDetachedFromWindow(); + } + + + public void setStyle(int style) { + avatarsDarawable.setStyle(style); + } + + public void setDelegate(Runnable delegate) { + avatarsDarawable.setDelegate(delegate); + } + + public void setObject(int a, int currentAccount, TLObject object) { + avatarsDarawable.setObject(a, currentAccount, object); } public void reset() { - for (int i = 0; i < animatingStates.length; ++i) { - setObject(0, 0, null); - } + avatarsDarawable.reset(); + } + + public void setCount(int usersCount) { + avatarsDarawable.setCount(usersCount); + } + + public void commitTransition(boolean animated) { + avatarsDarawable.commitTransition(animated); + } + + public void updateAfterTransitionEnd() { + avatarsDarawable.updateAfterTransitionEnd(); + } + + public void setCentered(boolean centered) { + avatarsDarawable.setCentered(centered); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java index 3caa1abe5..ade34cc95 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java @@ -61,7 +61,6 @@ import android.text.style.ImageSpan; import android.util.Property; import android.util.TypedValue; import android.view.ActionMode; -import android.view.DisplayCutout; import android.view.Gravity; import android.view.HapticFeedbackConstants; import android.view.KeyEvent; @@ -144,6 +143,7 @@ import org.telegram.ui.DialogsActivity; import org.telegram.ui.GroupStickersActivity; import org.telegram.ui.LaunchActivity; import org.telegram.ui.PhotoViewer; +import org.telegram.ui.ProfileActivity; import org.telegram.ui.StickersActivity; import java.io.ByteArrayInputStream; @@ -1879,6 +1879,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe @Override public InputConnection onCreateInputConnection(EditorInfo editorInfo) { final InputConnection ic = super.onCreateInputConnection(editorInfo); + if (ic == null) { + return null; + } try { EditorInfoCompat.setContentMimeTypes(editorInfo, new String[]{"image/gif", "image/*", "image/jpg", "image/png", "image/webp"}); @@ -2015,46 +2018,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe ArrayList entries = new ArrayList<>(); entries.add(photoEntry); AndroidUtilities.runOnUIThread(() -> { - PhotoViewer.getInstance().setParentActivity(parentActivity, resourcesProvider); - PhotoViewer.getInstance().openPhotoForSelect(entries, 0, 2, false, new PhotoViewer.EmptyPhotoViewerProvider() { - boolean sending; - @Override - public void sendButtonPressed(int index, VideoEditedInfo videoEditedInfo, boolean notify, int scheduleDate, boolean forceDocument) { - ArrayList photos = new ArrayList<>(); - SendMessagesHelper.SendingMediaInfo info = new SendMessagesHelper.SendingMediaInfo(); - if (!photoEntry.isVideo && photoEntry.imagePath != null) { - info.path = photoEntry.imagePath; - } else if (photoEntry.path != null) { - info.path = photoEntry.path; - } - info.thumbPath = photoEntry.thumbPath; - info.isVideo = photoEntry.isVideo; - info.caption = photoEntry.caption != null ? photoEntry.caption.toString() : null; - info.entities = photoEntry.entities; - info.masks = photoEntry.stickers; - info.ttl = photoEntry.ttl; - info.videoEditedInfo = videoEditedInfo; - info.canDeleteAfter = true; - photos.add(info); - photoEntry.reset(); - sending = true; - SendMessagesHelper.prepareSendingMedia(accountInstance, photos, dialog_id, replyingMessageObject, getThreadMessage(), null, false, false, editingMessageObject, notify, scheduleDate); - if (delegate != null) { - delegate.onMessageSend(null, true, scheduleDate); - } - } - - @Override - public void willHidePhotoViewer() { - if (!sending) { - try { - file.delete(); - } catch (Throwable ignore) { - - } - } - } - }, parentFragment); + openPhotoViewerForEdit(entries, file); }); } catch (Throwable e) { e.printStackTrace(); @@ -2062,6 +2026,66 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe }); } + private void openPhotoViewerForEdit(ArrayList entries, File sourceFile) { + MediaController.PhotoEntry photoEntry = (MediaController.PhotoEntry) entries.get(0); + if (keyboardVisible) { + AndroidUtilities.hideKeyboard(messageEditText); + AndroidUtilities.runOnUIThread(new Runnable() { + @Override + public void run() { + openPhotoViewerForEdit(entries, sourceFile); + } + }, 100); + return; + } + + PhotoViewer.getInstance().setParentActivity(parentActivity, resourcesProvider); + PhotoViewer.getInstance().openPhotoForSelect(entries, 0, 2, false, new PhotoViewer.EmptyPhotoViewerProvider() { + boolean sending; + @Override + public void sendButtonPressed(int index, VideoEditedInfo videoEditedInfo, boolean notify, int scheduleDate, boolean forceDocument) { + ArrayList photos = new ArrayList<>(); + SendMessagesHelper.SendingMediaInfo info = new SendMessagesHelper.SendingMediaInfo(); + if (!photoEntry.isVideo && photoEntry.imagePath != null) { + info.path = photoEntry.imagePath; + } else if (photoEntry.path != null) { + info.path = photoEntry.path; + } + info.thumbPath = photoEntry.thumbPath; + info.isVideo = photoEntry.isVideo; + info.caption = photoEntry.caption != null ? photoEntry.caption.toString() : null; + info.entities = photoEntry.entities; + info.masks = photoEntry.stickers; + info.ttl = photoEntry.ttl; + info.videoEditedInfo = videoEditedInfo; + info.canDeleteAfter = true; + photos.add(info); + photoEntry.reset(); + sending = true; + SendMessagesHelper.prepareSendingMedia(accountInstance, photos, dialog_id, replyingMessageObject, getThreadMessage(), null, false, false, editingMessageObject, notify, scheduleDate); + if (delegate != null) { + delegate.onMessageSend(null, true, scheduleDate); + } + } + + @Override + public void willHidePhotoViewer() { + if (!sending) { + try { + sourceFile.delete(); + } catch (Throwable ignore) { + + } + } + } + + @Override + public boolean canCaptureMorePhotos() { + return false; + } + }, parentFragment); + } + @Override protected Theme.ResourcesProvider getResourcesProvider() { return resourcesProvider; @@ -2071,6 +2095,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe @Override public void onSpansChanged() { + messageEditText.invalidateEffects(); if (delegate != null) { delegate.onTextSpansChanged(messageEditText.getText()); } @@ -5374,7 +5399,6 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe messageEditText.setAlpha(1f); messageEditText.setTranslationX(0); messageEditText.requestFocus(); - updateSendAsButton(); } }); @@ -5504,7 +5528,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe CharSequence[] message = new CharSequence[]{AndroidUtilities.getTrimmedString(messageEditText.getText())}; ArrayList entities = MediaDataController.getInstance(currentAccount).getEntities(message, supportsSendingNewEntities()); - if (!TextUtils.equals(message[0], editingMessageObject.messageText) || entities != null && !entities.isEmpty() || entities == null && !editingMessageObject.messageOwner.entities.isEmpty() || editingMessageObject.messageOwner.media instanceof TLRPC.TL_messageMediaWebPage) { + if (!TextUtils.equals(message[0], editingMessageObject.messageText) || entities != null && !entities.isEmpty() || (entities == null || entities.isEmpty()) && !editingMessageObject.messageOwner.entities.isEmpty() || editingMessageObject.messageOwner.media instanceof TLRPC.TL_messageMediaWebPage) { editingMessageObject.editingMessage = message[0]; editingMessageObject.editingMessageEntities = entities; editingMessageObject.editingMessageSearchWebPage = messageWebPageSearch; @@ -7171,6 +7195,10 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe MediaDataController.addStyleToText(new TextStyleSpan(run), entity.offset, entity.offset + entity.length, stringBuilder, true); } else if (entity instanceof TLRPC.TL_messageEntityTextUrl) { stringBuilder.setSpan(new URLSpanReplacement(entity.url), entity.offset, entity.offset + entity.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + } else if (entity instanceof TLRPC.TL_messageEntitySpoiler) { + TextStyleSpan.TextStyleRun run = new TextStyleSpan.TextStyleRun(); + run.flags |= TextStyleSpan.FLAG_STYLE_SPOILER; + MediaDataController.addStyleToText(new TextStyleSpan(run), entity.offset, entity.offset + entity.length, stringBuilder, true); } } } catch (Exception e) { @@ -7598,7 +7626,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe } } boolean wasVisible = senderSelectView.getVisibility() == View.VISIBLE; - boolean isVisible = delegate.getSendAsPeers() != null && defPeer != null && delegate.getSendAsPeers().peers.size() > 1 && !isEditingMessage() && !isRecordingAudioVideo() && (recordedAudioPanel == null || recordedAudioPanel.getVisibility() == View.GONE); + boolean isVisible = delegate.getSendAsPeers() != null && defPeer != null && delegate.getSendAsPeers().peers.size() > 1 && !isEditingMessage() && !isRecordingAudioVideo(); int pad = AndroidUtilities.dp(2); MarginLayoutParams params = (MarginLayoutParams) senderSelectView.getLayoutParams(); float sA = isVisible ? 0 : 1; @@ -7614,8 +7642,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe } if (parentFragment.getOtherSameChatsDiff() == 0 && parentFragment.fragmentOpened) { - ValueAnimator anim = ValueAnimator.ofFloat(0, 1).setDuration(220); - anim.setInterpolator(CubicBezierInterpolator.DEFAULT); + ValueAnimator anim = ValueAnimator.ofFloat(0, 1).setDuration(150); anim.addUpdateListener(animation -> { float val = (float) animation.getAnimatedValue(); @@ -7945,6 +7972,13 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe }); parentFragment.presentFragment(fragment); } + } else if (button instanceof TLRPC.TL_keyboardButtonUserProfile) { + if (MessagesController.getInstance(currentAccount).getUser(button.user_id) != null) { + Bundle args = new Bundle(); + args.putLong("user_id", button.user_id); + ProfileActivity fragment = new ProfileActivity(args); + parentFragment.presentFragment(fragment); + } } return true; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlert.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlert.java index 71700b02d..cc23dddd4 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlert.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlert.java @@ -28,12 +28,14 @@ import android.graphics.Rect; import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.os.Build; +import android.os.Bundle; import android.os.Vibrator; import android.text.Editable; import android.text.TextPaint; import android.text.TextUtils; import android.text.TextWatcher; import android.text.style.ImageSpan; +import android.text.util.Linkify; import android.util.Property; import android.util.TypedValue; import android.view.Gravity; @@ -44,6 +46,7 @@ import android.view.View; import android.view.ViewGroup; import android.view.ViewOutlineProvider; import android.view.WindowManager; +import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.view.animation.DecelerateInterpolator; import android.view.animation.OvershootInterpolator; @@ -257,7 +260,7 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N } - void applyCaption(String text) { + void applyCaption(CharSequence text) { } @@ -430,6 +433,8 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N public AttachButton(Context context) { super(context); setWillNotDraw(false); + setFocusable(true); + setFocusableInTouchMode(true); imageView = new RLottieImageView(context) { @Override @@ -448,6 +453,7 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N textView.setTextColor(getThemedColor(Theme.key_dialogTextGray2)); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12); textView.setLineSpacing(-AndroidUtilities.dp(2), 1.0f); + textView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO); addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 0, 62, 0, 0)); } @@ -1847,7 +1853,7 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N if (commentTextView.length() <= 0) { return; } - currentAttachLayout.applyCaption(commentTextView.getText().toString()); + currentAttachLayout.applyCaption(commentTextView.getText()); } private void sendPressed(boolean notify, int scheduleDate) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertDocumentLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertDocumentLayout.java index 895d1e7b5..0802b7806 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertDocumentLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertDocumentLayout.java @@ -344,39 +344,11 @@ public class ChatAttachAlertDocumentLayout extends ChatAttachAlert.AttachAlertLa ListItem item = (ListItem) object; File file = item.file; boolean isExternalStorageManager = false; -// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { -// isExternalStorageManager = Environment.isExternalStorageManager(); -// } - if (!BuildVars.NO_SCOPED_STORAGE && (item.icon == R.drawable.files_storage || item.icon == R.drawable.files_internal)) { - //if (SharedConfig.dontAskManageStorage) { - delegate.startDocumentSelectActivity(); - /*} else { - AlertDialog.Builder builder = new AlertDialog.Builder(context); - builder.setTopImage(R.drawable.doc_big, Theme.getColor(Theme.key_dialogTopBackground)); - builder.setMessage(AndroidUtilities.replaceTags(LocaleController.getString("ManageAllFilesRational", R.string.ManageAllFilesRational))); - - TextCheckBoxCell textCheckBoxCell = new TextCheckBoxCell(context, true, true); - textCheckBoxCell.setTextAndCheck(LocaleController.getString("DontAskAgain", R.string.DontAskAgain), false, false); - textCheckBoxCell.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View view) { - textCheckBoxCell.setChecked(!textCheckBoxCell.isChecked()); - } - }); - builder.setView(textCheckBoxCell); - - builder.setPositiveButton(LocaleController.getString("Allow", R.string.Allow), (i1, i2) -> { - Uri uri = Uri.parse("package:" + BuildConfig.APPLICATION_ID); - context.startActivity(new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION, uri)); - }); - builder.setNegativeButton(LocaleController.getString("UseFileManger", R.string.UseFileManger), (i1, i2) -> { - if (textCheckBoxCell.isChecked()) { - SharedConfig.setDontAskManageStorage(true); - } - delegate.startDocumentSelectActivity(); - }); - builder.show(); - }*/ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + isExternalStorageManager = Environment.isExternalStorageManager(); + } + if (!BuildVars.NO_SCOPED_STORAGE && (item.icon == R.drawable.files_storage || item.icon == R.drawable.files_internal) && !isExternalStorageManager) { + delegate.startDocumentSelectActivity(); } else if (file == null) { if (item.icon == R.drawable.files_gallery) { HashMap selectedPhotos = new HashMap<>(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPhotoLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPhotoLayout.java index 2bad86dd8..c0f16d5a4 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPhotoLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPhotoLayout.java @@ -66,11 +66,13 @@ import org.telegram.messenger.FileLog; import org.telegram.messenger.ImageReceiver; import org.telegram.messenger.LocaleController; import org.telegram.messenger.MediaController; +import org.telegram.messenger.MediaDataController; import org.telegram.messenger.MessageObject; import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; import org.telegram.messenger.SendMessagesHelper; import org.telegram.messenger.SharedConfig; +import org.telegram.messenger.UserConfig; import org.telegram.messenger.Utilities; import org.telegram.messenger.VideoEditedInfo; import org.telegram.messenger.camera.CameraController; @@ -2530,15 +2532,17 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou } @Override - void applyCaption(String text) { + void applyCaption(CharSequence text) { int imageId = (Integer) selectedPhotosOrder.get(0); Object entry = selectedPhotos.get(imageId); if (entry instanceof MediaController.PhotoEntry) { MediaController.PhotoEntry photoEntry = (MediaController.PhotoEntry) entry; photoEntry.caption = text; + photoEntry.entities = MediaDataController.getInstance(UserConfig.selectedAccount).getEntities(new CharSequence[] {text}, false); } else if (entry instanceof MediaController.SearchImage) { MediaController.SearchImage searchImage = (MediaController.SearchImage) entry; searchImage.caption = text; + searchImage.entities = MediaDataController.getInstance(UserConfig.selectedAccount).getEntities(new CharSequence[] {text}, false); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatScrimPopupContainerLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatScrimPopupContainerLayout.java new file mode 100644 index 000000000..63da64b40 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatScrimPopupContainerLayout.java @@ -0,0 +1,30 @@ +package org.telegram.ui.Components; + +import android.content.Context; +import android.view.View; +import android.widget.LinearLayout; + +import org.telegram.ui.ActionBar.ActionBarPopupWindow; + +public class ChatScrimPopupContainerLayout extends LinearLayout { + + public View reactionsLayout; + public ActionBarPopupWindow.ActionBarPopupWindowLayout popupWindowLayout; + + public ChatScrimPopupContainerLayout(Context context) { + super(context); + setOrientation(LinearLayout.VERTICAL); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + if (reactionsLayout != null && popupWindowLayout != null && popupWindowLayout.getSwipeBack() != null && reactionsLayout.getLayoutParams().width != LayoutHelper.WRAP_CONTENT) { + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + int widthDiff = popupWindowLayout.getSwipeBack().getMeasuredWidth() - popupWindowLayout.getSwipeBack().getChildAt(0).getMeasuredWidth(); + ((LayoutParams)reactionsLayout.getLayoutParams()).rightMargin = widthDiff; + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + } else { + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + } + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatThemeBottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatThemeBottomSheet.java index d46506faf..9fd913d9b 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatThemeBottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatThemeBottomSheet.java @@ -5,6 +5,7 @@ import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.annotation.SuppressLint; import android.graphics.Bitmap; +import android.graphics.BitmapFactory; import android.graphics.BitmapShader; import android.graphics.Canvas; import android.graphics.Color; @@ -883,6 +884,7 @@ public class ChatThemeBottomSheet extends BottomSheet implements NotificationCen public int themeIndex; public boolean isSelected; public float animationProgress = 1f; + public Bitmap icon; public ChatThemeItem(EmojiThemes chatTheme) { this.chatTheme = chatTheme; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/CheckBox2.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/CheckBox2.java index d2e824e95..bf86ff1ea 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/CheckBox2.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/CheckBox2.java @@ -69,6 +69,10 @@ public class CheckBox2 extends View { checkBoxBase.onAttachedToWindow(); } + public void setDuration(long duration) { + checkBoxBase.animationDuration = duration; + } + @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/CheckBoxBase.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/CheckBoxBase.java index fbc0dd657..483e7622e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/CheckBoxBase.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/CheckBoxBase.java @@ -176,6 +176,7 @@ public class CheckBoxBase { } } + public long animationDuration = 200; private void animateToCheckedState(boolean newCheckedState) { checkAnimator = ObjectAnimator.ofFloat(this, "progress", newCheckedState ? 1 : 0); checkAnimator.addListener(new AnimatorListenerAdapter() { @@ -190,7 +191,7 @@ public class CheckBoxBase { } }); checkAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT); - checkAnimator.setDuration(200); + checkAnimator.setDuration(animationDuration); checkAnimator.start(); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/CounterView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/CounterView.java index c82fcf826..ee17c9e73 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/CounterView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/CounterView.java @@ -16,8 +16,6 @@ import android.view.Gravity; import android.view.View; import android.view.animation.OvershootInterpolator; -import com.google.android.exoplayer2.util.Log; - import org.telegram.messenger.AndroidUtilities; import org.telegram.ui.ActionBar.Theme; @@ -30,7 +28,7 @@ public class CounterView extends View { super(context); this.resourcesProvider = resourcesProvider; setVisibility(View.GONE); - counterDrawable = new CounterDrawable(this, resourcesProvider); + counterDrawable = new CounterDrawable(this, true, resourcesProvider); counterDrawable.updateVisibility = true; } @@ -77,7 +75,7 @@ public class CounterView extends View { int animationType = -1; - public Paint circlePaint = new Paint(Paint.ANTI_ALIAS_FLAG); + public Paint circlePaint; public TextPaint textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); public RectF rectF = new RectF(); public boolean addServiceGradient; @@ -85,7 +83,7 @@ public class CounterView extends View { int currentCount; private boolean countAnimationIncrement; private ValueAnimator countAnimator; - private float countChangeProgress = 1f; + public float countChangeProgress = 1f; private StaticLayout countLayout; private StaticLayout countOldLayout; private StaticLayout countAnimationStableLayout; @@ -107,21 +105,27 @@ public class CounterView extends View { private boolean reverseAnimation; public float horizontalPadding; + private boolean drawBackground = true; - boolean updateVisibility; + public boolean updateVisibility; private View parent; public final static int TYPE_DEFAULT = 0; public final static int TYPE_CHAT_PULLING_DOWN = 1; + public final static int TYPE_CHAT_REACTIONS = 2; int type = TYPE_DEFAULT; private final Theme.ResourcesProvider resourcesProvider; - public CounterDrawable(View parent, Theme.ResourcesProvider resourcesProvider) { + public CounterDrawable(View parent, boolean drawBackground, Theme.ResourcesProvider resourcesProvider) { this.parent = parent; this.resourcesProvider = resourcesProvider; - circlePaint.setColor(Color.BLACK); + this.drawBackground = drawBackground; + if (drawBackground) { + circlePaint = new Paint(Paint.ANTI_ALIAS_FLAG); + circlePaint.setColor(Color.BLACK); + } textPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); textPaint.setTextSize(AndroidUtilities.dp(13)); } @@ -141,9 +145,11 @@ public class CounterView extends View { float countTop = (lastH - AndroidUtilities.dp(23)) / 2f; updateX(countWidth); rectF.set(x, countTop, x + countWidth + AndroidUtilities.dp(11), countTop + AndroidUtilities.dp(23)); - canvas.drawRoundRect(rectF, 11.5f * AndroidUtilities.density, 11.5f * AndroidUtilities.density, circlePaint); - if (addServiceGradient && Theme.hasGradientService()) { - canvas.drawRoundRect(rectF, 11.5f * AndroidUtilities.density, 11.5f * AndroidUtilities.density, Theme.chat_actionBackgroundGradientDarkenPaint); + if (circlePaint != null && drawBackground) { + canvas.drawRoundRect(rectF, 11.5f * AndroidUtilities.density, 11.5f * AndroidUtilities.density, circlePaint); + if (addServiceGradient && Theme.hasGradientService()) { + canvas.drawRoundRect(rectF, 11.5f * AndroidUtilities.density, 11.5f * AndroidUtilities.density, Theme.chat_actionBackgroundGradientDarkenPaint); + } } if (countLayout != null) { canvas.save(); @@ -264,14 +270,14 @@ public class CounterView extends View { } public void draw(Canvas canvas) { - if (type != TYPE_CHAT_PULLING_DOWN) { + if (type != TYPE_CHAT_PULLING_DOWN && type != TYPE_CHAT_REACTIONS) { int textColor = getThemedColor(textColorKey); int circleColor = getThemedColor(circleColorKey); if (this.textColor != textColor) { this.textColor = textColor; textPaint.setColor(textColor); } - if (this.circleColor != circleColor) { + if (circlePaint != null && this.circleColor != circleColor) { this.circleColor = circleColor; circlePaint.setColor(circleColor); } @@ -313,9 +319,11 @@ public class CounterView extends View { rectF.set(x, countTop, x + countWidth + AndroidUtilities.dp(11), countTop + AndroidUtilities.dp(23)); canvas.save(); canvas.scale(scale, scale, rectF.centerX(), rectF.centerY()); - canvas.drawRoundRect(rectF, 11.5f * AndroidUtilities.density, 11.5f * AndroidUtilities.density, circlePaint); - if (addServiceGradient && Theme.hasGradientService()) { - canvas.drawRoundRect(rectF, 11.5f * AndroidUtilities.density, 11.5f * AndroidUtilities.density, Theme.chat_actionBackgroundGradientDarkenPaint); + if (drawBackground && circlePaint != null) { + canvas.drawRoundRect(rectF, 11.5f * AndroidUtilities.density, 11.5f * AndroidUtilities.density, circlePaint); + if (addServiceGradient && Theme.hasGradientService()) { + canvas.drawRoundRect(rectF, 11.5f * AndroidUtilities.density, 11.5f * AndroidUtilities.density, Theme.chat_actionBackgroundGradientDarkenPaint); + } } canvas.clipRect(rectF); @@ -386,19 +394,20 @@ public class CounterView extends View { } private void updateX(float countWidth) { + float padding = drawBackground ? AndroidUtilities.dp(5.5f) : 0f; if (gravity == Gravity.RIGHT) { - countLeft = width - AndroidUtilities.dp(5.5f); + countLeft = width - padding; if (horizontalPadding != 0) { countLeft -= Math.max(horizontalPadding + countWidth / 2f, countWidth); } else { countLeft -= countWidth; } } else if (gravity == Gravity.LEFT) { - countLeft = AndroidUtilities.dp(5.5f); + countLeft = padding; } else { countLeft = (int) ((width - countWidth) / 2f); } - x = countLeft - AndroidUtilities.dp(5.5f); + x = countLeft - padding; } public float getCenterX() { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/EditTextBoldCursor.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/EditTextBoldCursor.java index 0262166b1..c4095deb6 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/EditTextBoldCursor.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/EditTextBoldCursor.java @@ -54,7 +54,7 @@ import org.telegram.ui.ActionBar.Theme; import java.lang.reflect.Field; import java.lang.reflect.Method; -public class EditTextBoldCursor extends EditText { +public class EditTextBoldCursor extends EditTextEffects { private static Field mEditor; private static Field mShowCursorField; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/EditTextCaption.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/EditTextCaption.java index 4f259baaf..eb8334121 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/EditTextCaption.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/EditTextCaption.java @@ -136,6 +136,12 @@ public class EditTextCaption extends EditTextBoldCursor { applyTextStyleToSelection(new TextStyleSpan(run)); } + public void makeSelectedSpoiler() { + TextStyleSpan.TextStyleRun run = new TextStyleSpan.TextStyleRun(); + run.flags |= TextStyleSpan.FLAG_STYLE_SPOILER; + applyTextStyleToSelection(new TextStyleSpan(run)); + } + public void makeSelectedItalic() { TextStyleSpan.TextStyleRun run = new TextStyleSpan.TextStyleRun(); run.flags |= TextStyleSpan.FLAG_STYLE_ITALIC; @@ -512,7 +518,11 @@ public class EditTextCaption extends EditTextBoldCursor { } else if (itemId == R.id.menu_underline) { makeSelectedUnderline(); return true; + } else if (itemId == R.id.menu_spoiler) { + makeSelectedSpoiler(); + return true; } else if (itemId == R.id.menu_translate) { + // NekoX makeSelectedTranslate(); return true; } @@ -630,6 +640,7 @@ public class EditTextCaption extends EditTextBoldCursor { } } if (hasSelection()) { + infoCompat.addAction(new AccessibilityNodeInfoCompat.AccessibilityActionCompat(R.id.menu_spoiler, LocaleController.getString("Spoiler", R.string.Spoiler))); infoCompat.addAction(new AccessibilityNodeInfoCompat.AccessibilityActionCompat(R.id.menu_bold, LocaleController.getString("Bold", R.string.Bold))); infoCompat.addAction(new AccessibilityNodeInfoCompat.AccessibilityActionCompat(R.id.menu_italic, LocaleController.getString("Italic", R.string.Italic))); infoCompat.addAction(new AccessibilityNodeInfoCompat.AccessibilityActionCompat(R.id.menu_mono, LocaleController.getString("Mono", R.string.Mono))); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/EditTextEffects.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/EditTextEffects.java new file mode 100644 index 000000000..5a61d9152 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/EditTextEffects.java @@ -0,0 +1,273 @@ +package org.telegram.ui.Components; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Path; +import android.graphics.Rect; +import android.graphics.Region; +import android.text.Editable; +import android.text.Layout; +import android.text.Spannable; +import android.view.MotionEvent; +import android.widget.EditText; + +import org.telegram.ui.Components.spoilers.SpoilerEffect; +import org.telegram.ui.Components.spoilers.SpoilersClickDetector; + +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; + +public class EditTextEffects extends EditText { + private final static int SPOILER_TIMEOUT = 10000; + + private List spoilers = new ArrayList<>(); + private Stack spoilersPool = new Stack<>(); + private boolean isSpoilersRevealed; + private boolean shouldRevealSpoilersByTouch = true; + private SpoilersClickDetector clickDetector; + private boolean suppressOnTextChanged; + private Path path = new Path(); + private int selStart, selEnd; + private float lastRippleX, lastRippleY; + private boolean postedSpoilerTimeout; + private Runnable spoilerTimeout = () -> { + postedSpoilerTimeout = false; + isSpoilersRevealed = false; + invalidateSpoilers(); + if (spoilers.isEmpty()) + return; + + spoilers.get(0).setOnRippleEndCallback(() -> post(() -> setSpoilersRevealed(false, true))); + float rad = (float) Math.sqrt(Math.pow(getWidth(), 2) + Math.pow(getHeight(), 2)); + for (SpoilerEffect eff : spoilers) { + eff.startRipple(lastRippleX, lastRippleY, rad, true); + } + }; + private Rect rect = new Rect(); + + public EditTextEffects(Context context) { + super(context); + + clickDetector = new SpoilersClickDetector(this, spoilers, this::onSpoilerClicked); + } + + private void onSpoilerClicked(SpoilerEffect eff, float x, float y) { + if (isSpoilersRevealed) return; + + lastRippleX = x; + lastRippleY = y; + + postedSpoilerTimeout = false; + removeCallbacks(spoilerTimeout); + + setSpoilersRevealed(true, false); + eff.setOnRippleEndCallback(() -> post(() -> { + invalidateSpoilers(); + checkSpoilerTimeout(); + })); + + float rad = (float) Math.sqrt(Math.pow(getWidth(), 2) + Math.pow(getHeight(), 2)); + for (SpoilerEffect ef : spoilers) + ef.startRipple(x, y, rad); + } + + @Override + protected void onSelectionChanged(int selStart, int selEnd) { + super.onSelectionChanged(selStart, selEnd); + + if (suppressOnTextChanged) + return; + + this.selStart = selStart; + this.selEnd = selEnd; + + checkSpoilerTimeout(); + } + + /** + * Checks for spoiler timeout to be posted + */ + private void checkSpoilerTimeout() { + boolean onSpoiler = false; + CharSequence cs = getLayout() != null ? getLayout().getText() : null; + if (cs instanceof Spannable) { + Spannable e = (Spannable) cs; + TextStyleSpan[] spans = e.getSpans(0, e.length(), TextStyleSpan.class); + for (TextStyleSpan span : spans) { + int ss = e.getSpanStart(span), se = e.getSpanEnd(span); + if (span.isSpoiler()) { + if (ss > selStart && se < selEnd || selStart > ss && selStart < se || selEnd > ss && selEnd < se) { + onSpoiler = true; + removeCallbacks(spoilerTimeout); + postedSpoilerTimeout = false; + break; + } + } + } + } + + if (isSpoilersRevealed && !onSpoiler && !postedSpoilerTimeout) { + postedSpoilerTimeout = true; + postDelayed(spoilerTimeout, SPOILER_TIMEOUT); + } + } + + @Override + protected void onDetachedFromWindow() { + super.onDetachedFromWindow(); + + removeCallbacks(spoilerTimeout); + } + + @Override + protected void onSizeChanged(int w, int h, int oldw, int oldh) { + super.onSizeChanged(w, h, oldw, oldh); + invalidateEffects(); + } + + @Override + protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) { + super.onTextChanged(text, start, lengthBefore, lengthAfter); + if (!suppressOnTextChanged) { + invalidateEffects(); + + Layout layout = getLayout(); + if (text instanceof Spannable && layout != null) { + int line = layout.getLineForOffset(start); + int x = (int) layout.getPrimaryHorizontal(start); + int y = (int) ((layout.getLineTop(line) + layout.getLineBottom(line)) / 2f); + + for (SpoilerEffect eff : spoilers) { + if (eff.getBounds().contains(x, y)) { + int selOffset = lengthAfter - lengthBefore; + selStart += selOffset; + selEnd += selOffset; + onSpoilerClicked(eff, x, y); + break; + } + } + } + } + } + + @Override + public void setText(CharSequence text, BufferType type) { + if (!suppressOnTextChanged) { + isSpoilersRevealed = false; + if (spoilersPool != null) // Constructor check + spoilersPool.clear(); + } + super.setText(text, type); + } + + /** + * Sets if spoilers should be revealed by touch or not + */ + public void setShouldRevealSpoilersByTouch(boolean shouldRevealSpoilersByTouch) { + this.shouldRevealSpoilersByTouch = shouldRevealSpoilersByTouch; + } + + @Override + public boolean dispatchTouchEvent(MotionEvent event) { + boolean detector = false; + if (shouldRevealSpoilersByTouch && clickDetector.onTouchEvent(event)) { + int act = event.getActionMasked(); + if (act == MotionEvent.ACTION_UP) { + MotionEvent c = MotionEvent.obtain(0, 0, MotionEvent.ACTION_CANCEL, 0, 0, 0); + super.dispatchTouchEvent(c); + c.recycle(); + } + detector = true; + } + return super.dispatchTouchEvent(event) || detector; + } + + /** + * Sets if spoiler are already revealed or not + */ + public void setSpoilersRevealed(boolean spoilersRevealed, boolean notifyEffects) { + isSpoilersRevealed = spoilersRevealed; + Spannable text = getText(); + if (text != null) { + TextStyleSpan[] spans = text.getSpans(0, text.length(), TextStyleSpan.class); + for (TextStyleSpan span : spans) { + if (span.isSpoiler()) { + span.setSpoilerRevealed(spoilersRevealed); + } + } + } + suppressOnTextChanged = true; + setText(text, BufferType.EDITABLE); + setSelection(selStart, selEnd); + suppressOnTextChanged = false; + + if (notifyEffects) { + invalidateSpoilers(); + } + } + + @Override + protected void onDraw(Canvas canvas) { + canvas.save(); + path.rewind(); + for (SpoilerEffect eff : spoilers) { + Rect bounds = eff.getBounds(); + path.addRect(bounds.left, bounds.top, bounds.right, bounds.bottom, Path.Direction.CW); + } + canvas.clipPath(path, Region.Op.DIFFERENCE); + super.onDraw(canvas); + canvas.restore(); + + canvas.save(); + canvas.clipPath(path); + path.rewind(); + if (!spoilers.isEmpty()) + spoilers.get(0).getRipplePath(path); + canvas.clipPath(path); + canvas.translate(0, -getPaddingTop()); + super.onDraw(canvas); + canvas.restore(); + + rect.set(0, getScrollY(), getWidth(), getScrollY() + getHeight() - getPaddingBottom()); + canvas.save(); + canvas.clipRect(rect); + for (SpoilerEffect eff : spoilers) { + Rect b = eff.getBounds(); + if (rect.top <= b.bottom && rect.bottom >= b.top || b.top <= rect.bottom && b.bottom >= rect.top) { + eff.setColor(getPaint().getColor()); + eff.draw(canvas); + } + } + canvas.restore(); + } + + public void invalidateEffects() { + Editable text = getText(); + if (text != null) { + for (TextStyleSpan span : text.getSpans(0, text.length(), TextStyleSpan.class)) { + if (span.isSpoiler()) { + span.setSpoilerRevealed(isSpoilersRevealed); + } + } + } + invalidateSpoilers(); + } + + private void invalidateSpoilers() { + if (spoilers == null) return; // A null-check for super constructor, because it calls onTextChanged + spoilersPool.addAll(spoilers); + spoilers.clear(); + + if (isSpoilersRevealed) { + invalidate(); + return; + } + + Layout layout = getLayout(); + if (layout != null && layout.getText() instanceof Spannable) { + SpoilerEffect.addSpoilers(this, spoilersPool, spoilers); + } + invalidate(); + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/FlickerLoadingView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/FlickerLoadingView.java index b739436ed..91e4410b2 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/FlickerLoadingView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/FlickerLoadingView.java @@ -34,6 +34,8 @@ public class FlickerLoadingView extends View { public final static int MESSAGE_SEEN_TYPE = 13; public final static int CHAT_THEMES_TYPE = 14; public final static int MEMBER_REQUESTS_TYPE = 15; + public final static int REACTED_TYPE = 16; + public final static int QR_TYPE = 17; private int gradientWidth; private LinearGradient gradient; @@ -125,7 +127,6 @@ public class FlickerLoadingView extends View { @Override protected void onDraw(Canvas canvas) { - Paint paint = this.paint; if (globalGradientView != null) { if (getParent() != null) { @@ -441,7 +442,7 @@ public class FlickerLoadingView extends View { canvas.drawCircle(getMeasuredWidth() - AndroidUtilities.dp(8 + 24 + 12 + 12) + AndroidUtilities.dp(13) + AndroidUtilities.dp(12) * i, cy, AndroidUtilities.dp(13f), backgroundPaint); canvas.drawCircle(getMeasuredWidth() - AndroidUtilities.dp(8 + 24 + 12 + 12) + AndroidUtilities.dp(13) + AndroidUtilities.dp(12) * i, cy, AndroidUtilities.dp(12f), paint); } - } else if (getViewType() == CHAT_THEMES_TYPE) { + } else if (getViewType() == CHAT_THEMES_TYPE || getViewType() == QR_TYPE) { int x = AndroidUtilities.dp(12); int itemWidth = AndroidUtilities.dp(77); int INNER_RECT_SPACE = AndroidUtilities.dp(4); @@ -455,17 +456,26 @@ public class FlickerLoadingView extends View { backgroundPaint.setColor(Theme.getColor(Theme.key_dialogBackground)); } - float bubbleTop = INNER_RECT_SPACE + AndroidUtilities.dp(8); - float bubbleLeft = INNER_RECT_SPACE + AndroidUtilities.dp(22); AndroidUtilities.rectTmp.set(x + AndroidUtilities.dp(4), AndroidUtilities.dp(4), x + itemWidth - AndroidUtilities.dp(4), getMeasuredHeight() - AndroidUtilities.dp(4)); canvas.drawRoundRect(AndroidUtilities.rectTmp, AndroidUtilities.dp(6), AndroidUtilities.dp(6), paint); - rectF.set(x + bubbleLeft, bubbleTop, x + bubbleLeft + BUBBLE_WIDTH, bubbleTop + BUBBLE_HEIGHT); - canvas.drawRoundRect(rectF, rectF.height() * 0.5f, rectF.height() * 0.5f, backgroundPaint); - bubbleLeft = INNER_RECT_SPACE + AndroidUtilities.dp(5); - bubbleTop += BUBBLE_HEIGHT + AndroidUtilities.dp(4); - rectF.set(x + bubbleLeft, bubbleTop, x + bubbleLeft + BUBBLE_WIDTH, bubbleTop + BUBBLE_HEIGHT); - canvas.drawRoundRect(rectF, rectF.height() * 0.5f, rectF.height() * 0.5f, backgroundPaint); + if (getViewType() == CHAT_THEMES_TYPE) { + float bubbleTop = INNER_RECT_SPACE + AndroidUtilities.dp(8); + float bubbleLeft = INNER_RECT_SPACE + AndroidUtilities.dp(22); + rectF.set(x + bubbleLeft, bubbleTop, x + bubbleLeft + BUBBLE_WIDTH, bubbleTop + BUBBLE_HEIGHT); + canvas.drawRoundRect(rectF, rectF.height() * 0.5f, rectF.height() * 0.5f, backgroundPaint); + bubbleLeft = INNER_RECT_SPACE + AndroidUtilities.dp(5); + bubbleTop += BUBBLE_HEIGHT + AndroidUtilities.dp(4); + rectF.set(x + bubbleLeft, bubbleTop, x + bubbleLeft + BUBBLE_WIDTH, bubbleTop + BUBBLE_HEIGHT); + canvas.drawRoundRect(rectF, rectF.height() * 0.5f, rectF.height() * 0.5f, backgroundPaint); + } else if (getViewType() == QR_TYPE) { + float radius = AndroidUtilities.dp(5); + float squareSize = AndroidUtilities.dp(32); + float left = x + (itemWidth - squareSize) / 2; + int top = AndroidUtilities.dp(21); + AndroidUtilities.rectTmp.set(left, top, left + squareSize, top + AndroidUtilities.dp(32)); + canvas.drawRoundRect(AndroidUtilities.rectTmp, radius, radius, backgroundPaint); + } canvas.drawCircle(x + itemWidth / 2, getMeasuredHeight() - AndroidUtilities.dp(20), AndroidUtilities.dp(8), backgroundPaint); @@ -492,6 +502,27 @@ public class FlickerLoadingView extends View { break; } } + } else if (getViewType() == REACTED_TYPE) { + int k = 0; + while (h <= getMeasuredHeight()) { + int r = AndroidUtilities.dp(16); + canvas.drawCircle(checkRtl(paddingLeft + AndroidUtilities.dp(13) + r), h + AndroidUtilities.dp(24), r, paint); + + rectF.set(paddingLeft + AndroidUtilities.dp(53), h + AndroidUtilities.dp(20), getWidth() - AndroidUtilities.dp(53), h + AndroidUtilities.dp(28)); + checkRtl(rectF); + canvas.drawRoundRect(rectF, AndroidUtilities.dp(8), AndroidUtilities.dp(8), paint); + + if (k < 4) { + r = AndroidUtilities.dp(12); + canvas.drawCircle(checkRtl(getWidth() - AndroidUtilities.dp(12) - r), h + AndroidUtilities.dp(24), r, paint); + } + + h += getCellHeight(getMeasuredWidth()); + k++; + if (isSingleCell && k >= itemsCount) { + break; + } + } } invalidate(); } @@ -518,7 +549,7 @@ public class FlickerLoadingView extends View { height = getMeasuredHeight(); } lastUpdateTime = newUpdateTime; - if (isSingleCell || viewType == MESSAGE_SEEN_TYPE || getViewType() == CHAT_THEMES_TYPE) { + if (isSingleCell || viewType == MESSAGE_SEEN_TYPE || getViewType() == CHAT_THEMES_TYPE || getViewType() == QR_TYPE) { totalTranslation += dt * width / 400.0f; if (totalTranslation >= width * 2) { totalTranslation = -gradientWidth * 2; @@ -546,7 +577,7 @@ public class FlickerLoadingView extends View { if (this.color1 != color1 || this.color0 != color0) { this.color0 = color0; this.color1 = color1; - if (isSingleCell || viewType == MESSAGE_SEEN_TYPE || viewType == CHAT_THEMES_TYPE) { + if (isSingleCell || viewType == MESSAGE_SEEN_TYPE || viewType == CHAT_THEMES_TYPE || viewType == QR_TYPE) { gradient = new LinearGradient(0, 0, gradientWidth = AndroidUtilities.dp(200), 0, new int[]{color1, color0, color0, color1}, new float[]{0.0f, 0.4f, 0.6f, 1f}, Shader.TileMode.CLAMP); } else { gradient = new LinearGradient(0, 0, 0, gradientWidth = AndroidUtilities.dp(600), new int[]{color1, color0, color0, color1}, new float[]{0.0f, 0.4f, 0.6f, 1f}, Shader.TileMode.CLAMP); @@ -597,6 +628,8 @@ public class FlickerLoadingView extends View { return AndroidUtilities.dp(103); } else if (getViewType() == MEMBER_REQUESTS_TYPE) { return AndroidUtilities.dp(107); + } else if (getViewType() == REACTED_TYPE) { + return AndroidUtilities.dp(48); } return 0; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ForwardingPreviewView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ForwardingPreviewView.java index f5ee2d2fd..de2c40e00 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ForwardingPreviewView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ForwardingPreviewView.java @@ -977,6 +977,7 @@ public class ForwardingPreviewView extends FrameLayout { @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { ChatMessageCell cell = (ChatMessageCell) holder.itemView; + cell.setInvalidateSpoilersParent(forwardingMessagesParams.hasSpoilers); cell.setParentViewSize(chatListView.getMeasuredWidth(), chatListView.getMeasuredHeight()); int id = cell.getMessageObject() != null ? cell.getMessageObject().getId() : 0; cell.setMessageObject(forwardingMessagesParams.previewMessages.get(position), forwardingMessagesParams.groupedMessagesMap.get(forwardingMessagesParams.previewMessages.get(position).getGroupId()), true, true); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/FragmentContextView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/FragmentContextView.java index 03415a192..8a2848081 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/FragmentContextView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/FragmentContextView.java @@ -1866,7 +1866,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent frameLayout.invalidate(); } - updateAvatars(avatars.wasDraw && updateAnimated); + updateAvatars(avatars.avatarsDarawable.wasDraw && updateAnimated); } else { if (voIPService != null && voIPService.groupCall != null) { updateAvatars(currentStyle == 3); @@ -1925,14 +1925,14 @@ public class FragmentContextView extends FrameLayout implements NotificationCent private void updateAvatars(boolean animated) { if (!animated) { - if (avatars.transitionProgressAnimator != null) { - avatars.transitionProgressAnimator.cancel(); - avatars.transitionProgressAnimator = null; + if (avatars.avatarsDarawable.transitionProgressAnimator != null) { + avatars.avatarsDarawable.transitionProgressAnimator.cancel(); + avatars.avatarsDarawable.transitionProgressAnimator = null; } } ChatObject.Call call; TLRPC.User userCall; - if (avatars.transitionProgressAnimator == null) { + if (avatars.avatarsDarawable.transitionProgressAnimator == null) { int currentAccount; if (currentStyle == 4) { if (fragment instanceof ChatActivity) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/GestureDetectorFixDoubleTap.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/GestureDetectorFixDoubleTap.java new file mode 100644 index 000000000..076f4e96d --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/GestureDetectorFixDoubleTap.java @@ -0,0 +1,530 @@ +package org.telegram.ui.Components; + +import android.content.Context; +import android.os.Handler; +import android.os.Message; +import android.view.GestureDetector; +import android.view.GestureDetector.OnDoubleTapListener; +import android.view.GestureDetector.OnGestureListener; +import android.view.MotionEvent; +import android.view.VelocityTracker; +import android.view.ViewConfiguration; + +public class GestureDetectorFixDoubleTap { + interface GestureDetectorCompatImpl { + boolean isLongpressEnabled(); + boolean onTouchEvent(MotionEvent ev); + void setIsLongpressEnabled(boolean enabled); + void setOnDoubleTapListener(OnDoubleTapListener listener); + } + + static class GestureDetectorCompatImplBase implements GestureDetectorCompatImpl { + private int mTouchSlopSquare; + private int mDoubleTapSlopSquare; + private int mMinimumFlingVelocity; + private int mMaximumFlingVelocity; + + private static final int TAP_TIMEOUT = ViewConfiguration.getTapTimeout(); + private static final int DOUBLE_TAP_TIMEOUT = 220; + + // constants for Message.what used by GestureHandler below + private static final int SHOW_PRESS = 1; + private static final int LONG_PRESS = 2; + private static final int TAP = 3; + + private final Handler mHandler; + final OnGestureListener mListener; + OnDoubleTapListener mDoubleTapListener; + + boolean mStillDown; + boolean mDeferConfirmSingleTap; + private boolean mInLongPress; + private boolean mAlwaysInTapRegion; + private boolean mAlwaysInBiggerTapRegion; + + MotionEvent mCurrentDownEvent; + private MotionEvent mPreviousUpEvent; + + /** + * True when the user is still touching for the second tap (down, move, and + * up events). Can only be true if there is a double tap listener attached. + */ + private boolean mIsDoubleTapping; + + private float mLastFocusX; + private float mLastFocusY; + private float mDownFocusX; + private float mDownFocusY; + + private boolean mIsLongpressEnabled; + + /** + * Determines speed during touch scrolling + */ + private VelocityTracker mVelocityTracker; + + private class GestureHandler extends Handler { + @SuppressWarnings("deprecation") + GestureHandler() { + super(); + } + + GestureHandler(Handler handler) { + super(handler.getLooper()); + } + + @Override + public void handleMessage(Message msg) { + switch (msg.what) { + case SHOW_PRESS: + mListener.onShowPress(mCurrentDownEvent); + break; + + case LONG_PRESS: + dispatchLongPress(); + break; + + case TAP: + // If the user's finger is still down, do not count it as a tap + if (mDoubleTapListener != null) { + if (!mStillDown) { + mDoubleTapListener.onSingleTapConfirmed(mCurrentDownEvent); + } else { + mDeferConfirmSingleTap = true; + } + } + break; + + default: + throw new RuntimeException("Unknown message " + msg); //never + } + } + } + + /** + * Creates a GestureDetector with the supplied listener. + * You may only use this constructor from a UI thread (this is the usual situation). + * @see android.os.Handler#Handler() + * + * @param context the application's context + * @param listener the listener invoked for all the callbacks, this must + * not be null. + * @param handler the handler to use + * + * @throws NullPointerException if {@code listener} is null. + */ + GestureDetectorCompatImplBase(Context context, OnGestureListener listener, + Handler handler) { + if (handler != null) { + mHandler = new GestureHandler(handler); + } else { + mHandler = new GestureHandler(); + } + mListener = listener; + if (listener instanceof OnDoubleTapListener) { + setOnDoubleTapListener((OnDoubleTapListener) listener); + } + init(context); + } + + private void init(Context context) { + if (context == null) { + throw new IllegalArgumentException("Context must not be null"); + } + if (mListener == null) { + throw new IllegalArgumentException("OnGestureListener must not be null"); + } + mIsLongpressEnabled = true; + + final ViewConfiguration configuration = ViewConfiguration.get(context); + final int touchSlop = configuration.getScaledTouchSlop(); + final int doubleTapSlop = configuration.getScaledDoubleTapSlop(); + mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity(); + mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity(); + + mTouchSlopSquare = touchSlop * touchSlop; + mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop; + } + + /** + * Sets the listener which will be called for double-tap and related + * gestures. + * + * @param onDoubleTapListener the listener invoked for all the callbacks, or + * null to stop listening for double-tap gestures. + */ + @Override + public void setOnDoubleTapListener(OnDoubleTapListener onDoubleTapListener) { + mDoubleTapListener = onDoubleTapListener; + } + + /** + * Set whether longpress is enabled, if this is enabled when a user + * presses and holds down you get a longpress event and nothing further. + * If it's disabled the user can press and hold down and then later + * moved their finger and you will get scroll events. By default + * longpress is enabled. + * + * @param isLongpressEnabled whether longpress should be enabled. + */ + @Override + public void setIsLongpressEnabled(boolean isLongpressEnabled) { + mIsLongpressEnabled = isLongpressEnabled; + } + + /** + * @return true if longpress is enabled, else false. + */ + @Override + public boolean isLongpressEnabled() { + return mIsLongpressEnabled; + } + + /** + * Analyzes the given motion event and if applicable triggers the + * appropriate callbacks on the {@link OnGestureListener} supplied. + * + * @param ev The current motion event. + * @return true if the {@link OnGestureListener} consumed the event, + * else false. + */ + @Override + public boolean onTouchEvent(MotionEvent ev) { + final int action = ev.getAction(); + + if (mVelocityTracker == null) { + mVelocityTracker = VelocityTracker.obtain(); + } + mVelocityTracker.addMovement(ev); + + final boolean pointerUp = + (action & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_UP; + final int skipIndex = pointerUp ? ev.getActionIndex() : -1; + + // Determine focal point + float sumX = 0, sumY = 0; + final int count = ev.getPointerCount(); + for (int i = 0; i < count; i++) { + if (skipIndex == i) continue; + sumX += ev.getX(i); + sumY += ev.getY(i); + } + final int div = pointerUp ? count - 1 : count; + final float focusX = sumX / div; + final float focusY = sumY / div; + + boolean handled = false; + + switch (action & MotionEvent.ACTION_MASK) { + case MotionEvent.ACTION_POINTER_DOWN: + mDownFocusX = mLastFocusX = focusX; + mDownFocusY = mLastFocusY = focusY; + // Cancel long press and taps + cancelTaps(); + break; + + case MotionEvent.ACTION_POINTER_UP: + mDownFocusX = mLastFocusX = focusX; + mDownFocusY = mLastFocusY = focusY; + + // Check the dot product of current velocities. + // If the pointer that left was opposing another velocity vector, clear. + mVelocityTracker.computeCurrentVelocity(1000, mMaximumFlingVelocity); + final int upIndex = ev.getActionIndex(); + final int id1 = ev.getPointerId(upIndex); + final float x1 = mVelocityTracker.getXVelocity(id1); + final float y1 = mVelocityTracker.getYVelocity(id1); + for (int i = 0; i < count; i++) { + if (i == upIndex) continue; + + final int id2 = ev.getPointerId(i); + final float x = x1 * mVelocityTracker.getXVelocity(id2); + final float y = y1 * mVelocityTracker.getYVelocity(id2); + + final float dot = x + y; + if (dot < 0) { + mVelocityTracker.clear(); + break; + } + } + break; + + case MotionEvent.ACTION_DOWN: + if (mDoubleTapListener != null) { + boolean hadTapMessage = mHandler.hasMessages(TAP); + if (hadTapMessage) mHandler.removeMessages(TAP); + if ((mCurrentDownEvent != null) && (mPreviousUpEvent != null) + && hadTapMessage && isConsideredDoubleTap( + mCurrentDownEvent, mPreviousUpEvent, ev)) { + // This is a second tap + mIsDoubleTapping = true; + // Give a callback with the first tap of the double-tap + handled |= mDoubleTapListener.onDoubleTap(mCurrentDownEvent); + // Give a callback with down event of the double-tap + handled |= mDoubleTapListener.onDoubleTapEvent(ev); + } else { + // This is a first tap + mHandler.sendEmptyMessageDelayed(TAP, DOUBLE_TAP_TIMEOUT); + } + } + + mDownFocusX = mLastFocusX = focusX; + mDownFocusY = mLastFocusY = focusY; + if (mCurrentDownEvent != null) { + mCurrentDownEvent.recycle(); + } + mCurrentDownEvent = MotionEvent.obtain(ev); + mAlwaysInTapRegion = true; + mAlwaysInBiggerTapRegion = true; + mStillDown = true; + mInLongPress = false; + mDeferConfirmSingleTap = false; + + if (mIsLongpressEnabled) { + mHandler.removeMessages(LONG_PRESS); + mHandler.sendEmptyMessageAtTime(LONG_PRESS, mCurrentDownEvent.getDownTime() + + TAP_TIMEOUT + ViewConfiguration.getLongPressTimeout()); + } + mHandler.sendEmptyMessageAtTime(SHOW_PRESS, + mCurrentDownEvent.getDownTime() + TAP_TIMEOUT); + handled |= mListener.onDown(ev); + break; + + case MotionEvent.ACTION_MOVE: + if (mInLongPress) { + break; + } + final float scrollX = mLastFocusX - focusX; + final float scrollY = mLastFocusY - focusY; + if (mIsDoubleTapping) { + // Give the move events of the double-tap + handled |= mDoubleTapListener.onDoubleTapEvent(ev); + } else if (mAlwaysInTapRegion) { + final int deltaX = (int) (focusX - mDownFocusX); + final int deltaY = (int) (focusY - mDownFocusY); + int distance = (deltaX * deltaX) + (deltaY * deltaY); + if (distance > mTouchSlopSquare) { + handled = mListener.onScroll(mCurrentDownEvent, ev, scrollX, scrollY); + mLastFocusX = focusX; + mLastFocusY = focusY; + mAlwaysInTapRegion = false; + mHandler.removeMessages(TAP); + mHandler.removeMessages(SHOW_PRESS); + mHandler.removeMessages(LONG_PRESS); + } + if (distance > mTouchSlopSquare) { + mAlwaysInBiggerTapRegion = false; + } + } else if ((Math.abs(scrollX) >= 1) || (Math.abs(scrollY) >= 1)) { + handled = mListener.onScroll(mCurrentDownEvent, ev, scrollX, scrollY); + mLastFocusX = focusX; + mLastFocusY = focusY; + } + break; + + case MotionEvent.ACTION_UP: + mStillDown = false; + MotionEvent currentUpEvent = MotionEvent.obtain(ev); + if (mIsDoubleTapping) { + // Finally, give the up event of the double-tap + handled |= mDoubleTapListener.onDoubleTapEvent(ev); + } else if (mInLongPress) { + mHandler.removeMessages(TAP); + mInLongPress = false; + } else if (mAlwaysInTapRegion) { + handled = mListener.onSingleTapUp(ev); + if (mDeferConfirmSingleTap && mDoubleTapListener != null) { + mDoubleTapListener.onSingleTapConfirmed(ev); + } + } else { + // A fling must travel the minimum tap distance + final VelocityTracker velocityTracker = mVelocityTracker; + final int pointerId = ev.getPointerId(0); + velocityTracker.computeCurrentVelocity(1000, mMaximumFlingVelocity); + final float velocityY = velocityTracker.getYVelocity(pointerId); + final float velocityX = velocityTracker.getXVelocity(pointerId); + + if ((Math.abs(velocityY) > mMinimumFlingVelocity) + || (Math.abs(velocityX) > mMinimumFlingVelocity)) { + handled = mListener.onFling( + mCurrentDownEvent, ev, velocityX, velocityY); + } + } + if (mPreviousUpEvent != null) { + mPreviousUpEvent.recycle(); + } + // Hold the event we obtained above - listeners may have changed the original. + mPreviousUpEvent = currentUpEvent; + if (mVelocityTracker != null) { + // This may have been cleared when we called out to the + // application above. + mVelocityTracker.recycle(); + mVelocityTracker = null; + } + mIsDoubleTapping = false; + mDeferConfirmSingleTap = false; + mHandler.removeMessages(SHOW_PRESS); + mHandler.removeMessages(LONG_PRESS); + break; + + case MotionEvent.ACTION_CANCEL: + cancel(); + break; + } + + return handled; + } + + private void cancel() { + mHandler.removeMessages(SHOW_PRESS); + mHandler.removeMessages(LONG_PRESS); + mHandler.removeMessages(TAP); + mVelocityTracker.recycle(); + mVelocityTracker = null; + mIsDoubleTapping = false; + mStillDown = false; + mAlwaysInTapRegion = false; + mAlwaysInBiggerTapRegion = false; + mDeferConfirmSingleTap = false; + if (mInLongPress) { + mInLongPress = false; + } + } + + private void cancelTaps() { + mHandler.removeMessages(SHOW_PRESS); + mHandler.removeMessages(LONG_PRESS); + mHandler.removeMessages(TAP); + mIsDoubleTapping = false; + mAlwaysInTapRegion = false; + mAlwaysInBiggerTapRegion = false; + mDeferConfirmSingleTap = false; + if (mInLongPress) { + mInLongPress = false; + } + } + + private boolean isConsideredDoubleTap(MotionEvent firstDown, MotionEvent firstUp, + MotionEvent secondDown) { + if (!mAlwaysInBiggerTapRegion) { + return false; + } + + if (secondDown.getEventTime() - firstUp.getEventTime() > DOUBLE_TAP_TIMEOUT) { + return false; + } + + int deltaX = (int) firstDown.getX() - (int) secondDown.getX(); + int deltaY = (int) firstDown.getY() - (int) secondDown.getY(); + return (deltaX * deltaX + deltaY * deltaY < mDoubleTapSlopSquare); + } + + void dispatchLongPress() { + mHandler.removeMessages(TAP); + mDeferConfirmSingleTap = false; + mInLongPress = true; + mListener.onLongPress(mCurrentDownEvent); + } + } + + static class GestureDetectorCompatImplJellybeanMr2 implements GestureDetectorCompatImpl { + private final GestureDetector mDetector; + + GestureDetectorCompatImplJellybeanMr2(Context context, OnGestureListener listener, + Handler handler) { + mDetector = new GestureDetector(context, listener, handler); + } + + @Override + public boolean isLongpressEnabled() { + return mDetector.isLongpressEnabled(); + } + + @Override + public boolean onTouchEvent(MotionEvent ev) { + return mDetector.onTouchEvent(ev); + } + + @Override + public void setIsLongpressEnabled(boolean enabled) { + mDetector.setIsLongpressEnabled(enabled); + } + + @Override + public void setOnDoubleTapListener(OnDoubleTapListener listener) { + mDetector.setOnDoubleTapListener(listener); + } + } + + private final GestureDetectorCompatImpl mImpl; + + /** + * Creates a GestureDetectorCompat with the supplied listener. + * As usual, you may only use this constructor from a UI thread. + * @see android.os.Handler#Handler() + * + * @param context the application's context + * @param listener the listener invoked for all the callbacks, this must + * not be null. + */ + public GestureDetectorFixDoubleTap(Context context, OnGestureListener listener) { + this(context, listener, null); + } + + /** + * Creates a GestureDetectorCompat with the supplied listener. + * As usual, you may only use this constructor from a UI thread. + * @see android.os.Handler#Handler() + * + * @param context the application's context + * @param listener the listener invoked for all the callbacks, this must + * not be null. + * @param handler the handler that will be used for posting deferred messages + */ + public GestureDetectorFixDoubleTap(Context context, OnGestureListener listener, Handler handler) { + mImpl = new GestureDetectorCompatImplBase(context, listener, handler); + } + + /** + * @return true if longpress is enabled, else false. + */ + public boolean isLongpressEnabled() { + return mImpl.isLongpressEnabled(); + } + + /** + * Analyzes the given motion event and if applicable triggers the + * appropriate callbacks on the {@link OnGestureListener} supplied. + * + * @param event The current motion event. + * @return true if the {@link OnGestureListener} consumed the event, + * else false. + */ + public boolean onTouchEvent(MotionEvent event) { + return mImpl.onTouchEvent(event); + } + + /** + * Set whether longpress is enabled, if this is enabled when a user + * presses and holds down you get a longpress event and nothing further. + * If it's disabled the user can press and hold down and then later + * moved their finger and you will get scroll events. By default + * longpress is enabled. + * + * @param enabled whether longpress should be enabled. + */ + public void setIsLongpressEnabled(boolean enabled) { + mImpl.setIsLongpressEnabled(enabled); + } + + /** + * Sets the listener which will be called for double-tap and related + * gestures. + * + * @param listener the listener invoked for all the callbacks, or + * null to stop listening for double-tap gestures. + */ + public void setOnDoubleTapListener(OnDoubleTapListener listener) { + mImpl.setOnDoubleTapListener(listener); + } +} \ No newline at end of file diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/GroupCallPip.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/GroupCallPip.java index c0471f89e..fe1f4746e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/GroupCallPip.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/GroupCallPip.java @@ -676,7 +676,7 @@ public class GroupCallPip implements NotificationCenter.NotificationCenterDelega } private void updateAvatars(boolean animated) { - if (avatarsImageView.transitionProgressAnimator == null) { + if (avatarsImageView.avatarsDarawable.transitionProgressAnimator == null) { ChatObject.Call call; VoIPService voIPService = VoIPService.getSharedInstance(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/LerpedLayoutParams.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/LerpedLayoutParams.java new file mode 100644 index 000000000..c1f669f4f --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/LerpedLayoutParams.java @@ -0,0 +1,56 @@ +package org.telegram.ui.Components; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.ViewGroup; +import android.widget.FrameLayout; + +public class LerpedLayoutParams extends ViewGroup.MarginLayoutParams { + + private ViewGroup.LayoutParams from; + private ViewGroup.LayoutParams to; + public LerpedLayoutParams( + ViewGroup.LayoutParams from, + ViewGroup.LayoutParams to + ) { + super(from == null ? to : from); + this.from = from; + this.to = to; + } + + public void apply(float t) { + t = Math.min(Math.max(t, 0), 1); + + this.width = lerpSz(from.width, to.width, t); + this.height = lerpSz(from.height, to.height, t); + if (from instanceof ViewGroup.MarginLayoutParams && to instanceof ViewGroup.MarginLayoutParams) { + ViewGroup.MarginLayoutParams marginFrom = (ViewGroup.MarginLayoutParams) from; + ViewGroup.MarginLayoutParams marginTo = (ViewGroup.MarginLayoutParams) to; + this.topMargin = lerp(marginFrom.topMargin, marginTo.topMargin, t); + this.leftMargin = lerp(marginFrom.leftMargin, marginTo.leftMargin, t); + this.rightMargin = lerp(marginFrom.rightMargin, marginTo.rightMargin, t); + this.bottomMargin = lerp(marginFrom.bottomMargin, marginTo.bottomMargin, t); + } else if (from instanceof ViewGroup.MarginLayoutParams) { + ViewGroup.MarginLayoutParams marginFrom = (ViewGroup.MarginLayoutParams) from; + this.topMargin = marginFrom.topMargin; + this.leftMargin = marginFrom.leftMargin; + this.rightMargin = marginFrom.rightMargin; + this.bottomMargin = marginFrom.bottomMargin; + } else if (to instanceof ViewGroup.MarginLayoutParams) { + ViewGroup.MarginLayoutParams marginTo = (ViewGroup.MarginLayoutParams) to; + this.topMargin = marginTo.topMargin; + this.leftMargin = marginTo.leftMargin; + this.rightMargin = marginTo.rightMargin; + this.bottomMargin = marginTo.bottomMargin; + } + } + + private int lerp(int from, int to, float t) { + return (int) (from + (to - from) * t); + } + private int lerpSz(int from, int to, float t) { + if (from < 0 || to < 0) // MATCH_PARENT or WRAP_CONTENT + return t < .5f ? from : to; + return lerp(from, to, t); + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/MediaActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/MediaActivity.java index 2968b7cf8..ad3a88d81 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/MediaActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/MediaActivity.java @@ -104,7 +104,7 @@ public class MediaActivity extends BaseFragment implements SharedMediaLayout.Sha @Override public boolean dispatchTouchEvent(MotionEvent ev) { - if (sharedMediaLayout != null && sharedMediaLayout.isInFastScroll() && sharedMediaLayout.getY() == 0) { + if (sharedMediaLayout != null && sharedMediaLayout.isInFastScroll()) { return sharedMediaLayout.dispatchFastScrollEvent(ev); } if (sharedMediaLayout != null && sharedMediaLayout.checkPinchToZoom(ev)) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/MotionBackgroundDrawable.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/MotionBackgroundDrawable.java index 03da6b631..5046120bb 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/MotionBackgroundDrawable.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/MotionBackgroundDrawable.java @@ -57,7 +57,7 @@ public class MotionBackgroundDrawable extends Drawable { private boolean isPreview; - private float posAnimationProgress = 1.0f; + public float posAnimationProgress = 1.0f; private int phase; private RectF rect = new RectF(); @@ -103,6 +103,9 @@ public class MotionBackgroundDrawable extends Drawable { private ColorFilter legacyBitmapColorFilter; private int legacyBitmapColor; + private boolean isIndeterminateAnimation; + private Paint overrideBitmapPaint; + public MotionBackgroundDrawable() { super(); init(); @@ -440,7 +443,6 @@ public class MotionBackgroundDrawable extends Drawable { legacyBitmap2 = null; } try { - legacyBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); legacyCanvas = new Canvas(legacyBitmap); invalidateLegacy = true; @@ -588,7 +590,7 @@ public class MotionBackgroundDrawable extends Drawable { gradientDrawable.draw(canvas); } else { rect.set(x, y, x + width, y + height); - canvas.drawBitmap(currentBitmap, null, rect, paint); + canvas.drawBitmap(currentBitmap, null, rect, overrideBitmapPaint != null ? overrideBitmapPaint : paint); } } @@ -612,7 +614,7 @@ public class MotionBackgroundDrawable extends Drawable { updateAnimation(); } - private void updateAnimation() { + public void updateAnimation() { long newTime = SystemClock.elapsedRealtime(); long dt = newTime - lastUpdateTime; if (dt > 20) { @@ -623,79 +625,94 @@ public class MotionBackgroundDrawable extends Drawable { return; } + if (isIndeterminateAnimation && posAnimationProgress == 1.0f) { + posAnimationProgress = 0f; + } if (posAnimationProgress < 1.0f) { float progress; - if (rotatingPreview) { - int stageBefore; - float progressBefore = interpolator.getInterpolation(posAnimationProgress); - if (progressBefore <= 0.25f) { - stageBefore = 0; - } else if (progressBefore <= 0.5f) { - stageBefore = 1; - } else if (progressBefore <= 0.75f) { - stageBefore = 2; - } else { - stageBefore = 3; - } - posAnimationProgress += dt / (rotationBack ? 1000.0f : 2000.0f); - if (posAnimationProgress > 1.0f) { - posAnimationProgress = 1.0f; - } - progress = interpolator.getInterpolation(posAnimationProgress); - if (stageBefore == 0 && progress > 0.25f || - stageBefore == 1 && progress > 0.5f || - stageBefore == 2 && progress > 0.75f) { - if (rotationBack) { - phase++; - if (phase > 7) { - phase = 0; - } - } else { - phase--; - if (phase < 0) { - phase = 7; - } - } - } - if (progress <= 0.25f) { - progress /= 0.25f; - } else if (progress <= 0.5f) { - progress = (progress - 0.25f) / 0.25f; - } else if (progress <= 0.75f) { - progress = (progress - 0.5f) / 0.25f; - } else { - progress = (progress - 0.75f) / 0.25f; - } - if (rotationBack) { - float prevProgress = progress; - progress = 1.0f - progress; - if (posAnimationProgress >= 1.0f) { - phase++; - if (phase > 7) { - phase = 0; - } - progress = 1.0f; - } + boolean isNeedGenerateGradient = postInvalidateParent || rotatingPreview; + if (isIndeterminateAnimation) { + posAnimationProgress += dt / 12000f; + if (posAnimationProgress >= 1.0f) { + posAnimationProgress = 0.0f; } + float progressPerPhase = 1f / 8f; + phase = (int) (posAnimationProgress / progressPerPhase); + progress = 1f - (posAnimationProgress - phase * progressPerPhase) / progressPerPhase; + isNeedGenerateGradient = true; } else { - posAnimationProgress += dt / (fastAnimation ? 300.0f : 500.0f); - if (posAnimationProgress > 1.0f) { - posAnimationProgress = 1.0f; - } - progress = interpolator.getInterpolation(posAnimationProgress); - if (rotationBack) { - progress = 1.0f - progress; - if (posAnimationProgress >= 1.0f) { - phase++; - if (phase > 7) { - phase = 0; + if (rotatingPreview) { + int stageBefore; + float progressBefore = interpolator.getInterpolation(posAnimationProgress); + if (progressBefore <= 0.25f) { + stageBefore = 0; + } else if (progressBefore <= 0.5f) { + stageBefore = 1; + } else if (progressBefore <= 0.75f) { + stageBefore = 2; + } else { + stageBefore = 3; + } + posAnimationProgress += dt / (rotationBack ? 1000.0f : 2000.0f); + if (posAnimationProgress > 1.0f) { + posAnimationProgress = 1.0f; + } + progress = interpolator.getInterpolation(posAnimationProgress); + if (stageBefore == 0 && progress > 0.25f || + stageBefore == 1 && progress > 0.5f || + stageBefore == 2 && progress > 0.75f) { + if (rotationBack) { + phase++; + if (phase > 7) { + phase = 0; + } + } else { + phase--; + if (phase < 0) { + phase = 7; + } + } + } + if (progress <= 0.25f) { + progress /= 0.25f; + } else if (progress <= 0.5f) { + progress = (progress - 0.25f) / 0.25f; + } else if (progress <= 0.75f) { + progress = (progress - 0.5f) / 0.25f; + } else { + progress = (progress - 0.75f) / 0.25f; + } + if (rotationBack) { + float prevProgress = progress; + progress = 1.0f - progress; + if (posAnimationProgress >= 1.0f) { + phase++; + if (phase > 7) { + phase = 0; + } + progress = 1.0f; + } + } + } else { + posAnimationProgress += dt / (fastAnimation ? 300.0f : 500.0f); + if (posAnimationProgress > 1.0f) { + posAnimationProgress = 1.0f; + } + progress = interpolator.getInterpolation(posAnimationProgress); + if (rotationBack) { + progress = 1.0f - progress; + if (posAnimationProgress >= 1.0f) { + phase++; + if (phase > 7) { + phase = 0; + } + progress = 1.0f; } - progress = 1.0f; } } } - if (postInvalidateParent || rotatingPreview) { + if (isNeedGenerateGradient) { Utilities.generateGradient(currentBitmap, true, phase, progress, currentBitmap.getWidth(), currentBitmap.getHeight(), currentBitmap.getRowBytes(), colors); invalidateLegacy = true; } else { @@ -742,4 +759,12 @@ public class MotionBackgroundDrawable extends Drawable { public boolean isOneColor() { return colors[0] == colors[1] && colors[0] == colors[2] && colors[0] == colors[3]; } + + public void setIndeterminateAnimation(boolean isIndeterminateAnimation) { + this.isIndeterminateAnimation = isIndeterminateAnimation; + } + + public void setOverrideBitmapPaint(Paint overrideBitmapPaint) { + this.overrideBitmapPaint = overrideBitmapPaint; + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoPaintView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoPaintView.java index 306e91a7c..ae41afb51 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoPaintView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoPaintView.java @@ -916,6 +916,9 @@ public class PhotoPaintView extends FrameLayout implements EntityView.EntityView int w = view.getMeasuredWidth(); int h = view.getMeasuredHeight(); + if (w == 0 || h == 0) { + return; + } int tr = currentCropState.transformRotation; int fw = w, rotatedW = w; int fh = h, rotatedH = h; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoViewerCaptionEnterView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoViewerCaptionEnterView.java index 2c49d93e3..507bcc217 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoViewerCaptionEnterView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoViewerCaptionEnterView.java @@ -42,10 +42,10 @@ import androidx.core.graphics.ColorUtils; import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.Emoji; -import org.telegram.messenger.FileLog; import org.telegram.messenger.LocaleController; import org.telegram.messenger.MessagesController; import org.telegram.messenger.NotificationCenter; +import org.telegram.messenger.FileLog; import org.telegram.messenger.R; import org.telegram.messenger.SharedConfig; import org.telegram.messenger.UserConfig; @@ -199,6 +199,17 @@ public class PhotoViewerCaptionEnterView extends FrameLayout implements Notifica }; + messageEditText.setDelegate(new EditTextCaption.EditTextCaptionDelegate() { + @Override + public void onSpansChanged() { + messageEditText.invalidateEffects(); + } + + @Override + public long getCurrentChat() { + return 0; + } + }); messageEditText.setWindowView(windowView); messageEditText.setHint(LocaleController.getString("AddCaption", R.string.AddCaption)); messageEditText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/PopupSwipeBackLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/PopupSwipeBackLayout.java new file mode 100644 index 000000000..ce3373b96 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/PopupSwipeBackLayout.java @@ -0,0 +1,440 @@ +package org.telegram.ui.Components; + +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ValueAnimator; +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.Path; +import android.graphics.Rect; +import android.graphics.RectF; +import android.util.SparseIntArray; +import android.view.GestureDetector; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewConfiguration; +import android.view.ViewGroup; +import android.widget.FrameLayout; + +import androidx.annotation.NonNull; +import androidx.core.view.GestureDetectorCompat; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.NotificationCenter; +import org.telegram.messenger.UserConfig; +import org.telegram.ui.ActionBar.ActionBarPopupWindow; +import org.telegram.ui.ActionBar.Theme; + +public class PopupSwipeBackLayout extends FrameLayout { + private final static int DURATION = 300; + + SparseIntArray overrideHeightIndex = new SparseIntArray(); + private float transitionProgress; + private float toProgress = -1; + private GestureDetectorCompat detector; + private boolean isProcessingSwipe; + private boolean isAnimationInProgress; + private boolean isSwipeDisallowed; + private Paint overlayPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private Paint foregroundPaint = new Paint(); + + private Path mPath = new Path(); + private RectF mRect = new RectF(); + + private OnSwipeBackProgressListener onSwipeBackProgressListener; + private boolean isSwipeBackDisallowed; + + private float overrideForegroundHeight; + private ValueAnimator foregroundAnimator; + + private int currentForegroundIndex = -1; + private int notificationIndex; + Theme.ResourcesProvider resourcesProvider; + + private Rect hitRect = new Rect(); + + public PopupSwipeBackLayout(@NonNull Context context, Theme.ResourcesProvider resourcesProvider) { + super(context); + this.resourcesProvider = resourcesProvider; + + int touchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); + detector = new GestureDetectorCompat(context, new GestureDetector.SimpleOnGestureListener() { + @Override + public boolean onDown(MotionEvent e) { + return true; + } + + @Override + public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { + if (!isProcessingSwipe && !isSwipeDisallowed) { + if (!isSwipeBackDisallowed && transitionProgress == 1 && distanceX <= -touchSlop && Math.abs(distanceX) >= Math.abs(distanceY * 1.5f) && !isDisallowedView(e2, getChildAt(transitionProgress > 0.5f ? 1 : 0))) { + isProcessingSwipe = true; + + MotionEvent c = MotionEvent.obtain(0, 0, MotionEvent.ACTION_CANCEL, 0, 0, 0); + for (int i = 0; i < getChildCount(); i++) + getChildAt(i).dispatchTouchEvent(c); + c.recycle(); + } else isSwipeDisallowed = true; + } + + if (isProcessingSwipe) { + toProgress = -1; + transitionProgress = 1f - Math.max(0, Math.min(1, (e2.getX() - e1.getX()) / getWidth())); + invalidateTransforms(); + } + + return isProcessingSwipe; + } + + @Override + public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { + if (isAnimationInProgress || isSwipeDisallowed) + return false; + + if (velocityX >= 600) { + clearFlags(); + animateToState(0, velocityX / 6000f); + } + return false; + } + }); + overlayPaint.setColor(Color.BLACK); + } + + /** + * Sets if swipeback action should be disallowed + * + * @param swipeBackDisallowed If swipe should be disallowed + */ + public void setSwipeBackDisallowed(boolean swipeBackDisallowed) { + isSwipeBackDisallowed = swipeBackDisallowed; + } + + /** + * Sets new swipeback listener + * + * @param onSwipeBackProgressListener New progress listener + */ + public void setOnSwipeBackProgressListener(OnSwipeBackProgressListener onSwipeBackProgressListener) { + this.onSwipeBackProgressListener = onSwipeBackProgressListener; + } + + @Override + protected boolean drawChild(Canvas canvas, View child, long drawingTime) { + int i = indexOfChild(child); + int s = canvas.save(); + if (i != 0) { + foregroundPaint.setColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground, resourcesProvider)); + canvas.drawRect(child.getX(), 0, child.getX() + child.getMeasuredWidth(), getMeasuredHeight(), foregroundPaint); + } + boolean b = super.drawChild(canvas, child, drawingTime); + if (i == 0) { + overlayPaint.setAlpha((int) (transitionProgress * 0x40)); + canvas.drawRect(0, 0, getWidth(), getHeight(), overlayPaint); + } + canvas.restoreToCount(s); + return b; + } + + /** + * Invalidates transformations + */ + private void invalidateTransforms() { + + if (onSwipeBackProgressListener != null) { + onSwipeBackProgressListener.onSwipeBackProgress(this, toProgress, transitionProgress); + } + + View bg = getChildAt(0); + View fg = null; + if (currentForegroundIndex >= 0 && currentForegroundIndex < getChildCount()) { + fg = getChildAt(currentForegroundIndex); + } + bg.setTranslationX(-transitionProgress * getWidth() * 0.5f); + float bSc = 0.95f + (1f - transitionProgress) * 0.05f; + bg.setScaleX(bSc); + bg.setScaleY(bSc); + if (fg != null) { + fg.setTranslationX((1f - transitionProgress) * getWidth()); + } + invalidateVisibility(); + + float fW = bg.getMeasuredWidth(), fH = bg.getMeasuredHeight(); + float tW = 0; + float tH = 0; + if (fg != null) { + tW = fg.getMeasuredWidth(); + tH = overrideForegroundHeight != 0 ? overrideForegroundHeight : fg.getMeasuredHeight(); + } + if (bg.getMeasuredWidth() == 0 || bg.getMeasuredHeight() == 0) { + return; + } + + ActionBarPopupWindow.ActionBarPopupWindowLayout p = (ActionBarPopupWindow.ActionBarPopupWindowLayout) getParent(); + float w = fW + (tW - fW) * transitionProgress; + float h = fH + (tH - fH) * transitionProgress; + w += p.getPaddingLeft() + p.getPaddingRight(); + h += p.getPaddingTop() + p.getPaddingBottom(); + p.setBackScaleX(w / p.getMeasuredWidth()); + p.setBackScaleY(h / p.getMeasuredHeight()); + + for (int i = 0; i < getChildCount(); i++) { + View ch = getChildAt(i); + ch.setPivotX(0); + ch.setPivotY(0); + } + + invalidate(); + } + + @Override + public boolean dispatchTouchEvent(MotionEvent ev) { + if (processTouchEvent(ev)) + return true; + + if (currentForegroundIndex < 0 || currentForegroundIndex >= getChildCount()) { + return super.dispatchTouchEvent(ev); + } + + View bv = getChildAt(0); + View fv = getChildAt(currentForegroundIndex); + int act = ev.getActionMasked(); + if (act == MotionEvent.ACTION_DOWN && (ev.getX() > (bv.getMeasuredWidth() + (fv.getMeasuredWidth() - bv.getMeasuredWidth()) * transitionProgress) || + ev.getY() > (bv.getMeasuredHeight() + ((overrideForegroundHeight != 0 ? overrideForegroundHeight : fv.getMeasuredHeight()) - bv.getMeasuredHeight()) * transitionProgress))) { + callOnClick(); + return true; + } + + boolean b = (transitionProgress > 0.5f ? fv : bv).dispatchTouchEvent(ev); + if (!b && act == MotionEvent.ACTION_DOWN) { + return true; + } + return b || onTouchEvent(ev); + } + + @Override + protected void onSizeChanged(int w, int h, int oldw, int oldh) { + super.onSizeChanged(w, h, oldw, oldh); + invalidateTransforms(); + } + + /** + * Processes touch event and return true if processed + * + * @param ev Event to process + * @return If event is processed + */ + private boolean processTouchEvent(MotionEvent ev) { + int act = ev.getAction() & MotionEvent.ACTION_MASK; + if (isAnimationInProgress) + return true; + + if (!detector.onTouchEvent(ev)) { + switch (act) { + case MotionEvent.ACTION_DOWN: + break; + case MotionEvent.ACTION_CANCEL: + case MotionEvent.ACTION_UP: + if (isProcessingSwipe) { + clearFlags(); + animateToState(transitionProgress >= 0.5f ? 1 : 0, 0); + } else if (isSwipeDisallowed) clearFlags(); + return false; + } + } + return isProcessingSwipe; + } + + /** + * Animates transition value + * + * @param f End value + * @param flingVal Fling value(If from fling, zero otherwise) + */ + private void animateToState(float f, float flingVal) { + ValueAnimator val = ValueAnimator.ofFloat(transitionProgress, f).setDuration((long) (DURATION * Math.max(0.5f, Math.abs(transitionProgress - f) - Math.min(0.2f, flingVal)))); + val.setInterpolator(CubicBezierInterpolator.DEFAULT); + int selectedAccount = UserConfig.selectedAccount; + notificationIndex = NotificationCenter.getInstance(selectedAccount).setAnimationInProgress(notificationIndex, null); + val.addUpdateListener(animation -> { + transitionProgress = (float) animation.getAnimatedValue(); + invalidateTransforms(); + }); + val.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationStart(Animator animation) { + isAnimationInProgress = true; + toProgress = f; + } + + @Override + public void onAnimationEnd(Animator animation) { + NotificationCenter.getInstance(selectedAccount).onAnimationFinish(notificationIndex); + transitionProgress = f; + invalidateTransforms(); + isAnimationInProgress = false; + } + }); + val.start(); + } + + /** + * Clears touch flags + */ + private void clearFlags() { + isProcessingSwipe = false; + isSwipeDisallowed = false; + } + + /** + * Opens up foreground + */ + public void openForeground(int viewIndex) { + if (isAnimationInProgress) { + return; + } + currentForegroundIndex = viewIndex; + overrideForegroundHeight = overrideHeightIndex.get(viewIndex); + animateToState(1, 0); + } + + /** + * Closes foreground view + */ + public void closeForeground() { + if (isAnimationInProgress) return; + animateToState(0, 0); + } + + @Override + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { + for (int i = 0; i < getChildCount(); i++) { + View ch = getChildAt(i); + ch.layout(0, 0, ch.getMeasuredWidth(), ch.getMeasuredHeight()); + } + } + + @Override + public void addView(View child, int index, ViewGroup.LayoutParams params) { + super.addView(child, index, params); + invalidateTransforms(); + } + + @Override + protected void dispatchDraw(Canvas canvas) { + if (getChildCount() == 0) { + return; + } + View backgroundView = getChildAt(0); + float fW = backgroundView.getMeasuredWidth(), fH = backgroundView.getMeasuredHeight(); + float w, h; + if (currentForegroundIndex == -1 || currentForegroundIndex >= getChildCount()) { + w = fW; + h = fH; + } else { + View foregroundView = getChildAt(currentForegroundIndex); + float tW = foregroundView.getMeasuredWidth(), tH = overrideForegroundHeight != 0 ? overrideForegroundHeight : foregroundView.getMeasuredHeight(); + if (backgroundView.getMeasuredWidth() == 0 || backgroundView.getMeasuredHeight() == 0 || foregroundView.getMeasuredWidth() == 0 || foregroundView.getMeasuredHeight() == 0) { + w = fW; + h = fH; + } else { + w = fW + (tW - fW) * transitionProgress; + h = fH + (tH - fH) * transitionProgress; + } + } + + + int s = canvas.save(); + mPath.rewind(); + int rad = AndroidUtilities.dp(6); + mRect.set(0, 0, w, h); + mPath.addRoundRect(mRect, rad, rad, Path.Direction.CW); + canvas.clipPath(mPath); + super.dispatchDraw(canvas); + canvas.restoreToCount(s); + } + + /** + * @param e Motion event to check + * @param v View to check + * @return If we should ignore view + */ + private boolean isDisallowedView(MotionEvent e, View v) { + v.getHitRect(hitRect); + if (hitRect.contains((int) e.getX(), (int) e.getY()) && v.canScrollHorizontally(-1)) + return true; + if (v instanceof ViewGroup) { + ViewGroup vg = (ViewGroup) v; + for (int i = 0; i < vg.getChildCount(); i++) + if (isDisallowedView(e, vg.getChildAt(i))) + return true; + } + + return false; + } + + /** + * Invalidates view transforms + */ + private void invalidateVisibility() { + for (int i = 0; i < getChildCount(); i++) { + View child = getChildAt(i); + + if (i == 0) { + if (transitionProgress == 1 && child.getVisibility() != INVISIBLE) + child.setVisibility(INVISIBLE); + if (transitionProgress != 1 && child.getVisibility() != VISIBLE) + child.setVisibility(VISIBLE); + } else if (i == currentForegroundIndex) { + if (transitionProgress == 0 && child.getVisibility() != INVISIBLE) + child.setVisibility(INVISIBLE); + if (transitionProgress != 0 && child.getVisibility() != VISIBLE) + child.setVisibility(VISIBLE); + } else { + child.setVisibility(INVISIBLE); + } + } + } + + public void setNewForegroundHeight(int index, int height) { + overrideHeightIndex.put(index, height); + if (index != currentForegroundIndex) { + return; + } + if (currentForegroundIndex < 0 || currentForegroundIndex >= getChildCount()) { + return; + } + if (foregroundAnimator != null) { + foregroundAnimator.cancel(); + } + View fg = getChildAt(currentForegroundIndex); + float fromH = overrideForegroundHeight != 0 ? overrideForegroundHeight : fg.getMeasuredHeight(); + float toH = height; + + ValueAnimator animator = ValueAnimator.ofFloat(fromH, toH).setDuration(240); + animator.setInterpolator(Easings.easeInOutQuad); + animator.addUpdateListener(animation -> { + overrideForegroundHeight = (float) animation.getAnimatedValue(); + invalidateTransforms(); + }); + animator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + isAnimationInProgress = false; + } + + @Override + public void onAnimationStart(Animator animation) { + isAnimationInProgress = true; + } + }); + animator.start(); + foregroundAnimator = animator; + } + + public interface OnSwipeBackProgressListener { + void onSwipeBackProgress(PopupSwipeBackLayout layout, float toProgress, float progress); + } +} \ No newline at end of file diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/QRCodeBottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/QRCodeBottomSheet.java index d0dcf95a9..0ab4514b7 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/QRCodeBottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/QRCodeBottomSheet.java @@ -118,7 +118,7 @@ public class QRCodeBottomSheet extends BottomSheet { buttonTextView.setText(LocaleController.getString("ShareQrCode", R.string.ShareQrCode)); buttonTextView.setOnClickListener(view -> { - Uri uri = getImageUri(qrCode); + Uri uri = AndroidUtilities.getBitmapShareUri(qrCode, "qr_tmp.png", Bitmap.CompressFormat.PNG); if (uri != null) { Intent i = new Intent(Intent.ACTION_SEND); @@ -140,37 +140,13 @@ public class QRCodeBottomSheet extends BottomSheet { setCustomView(scrollView); } - public Uri getImageUri(Bitmap inImage) { - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - inImage.compress(Bitmap.CompressFormat.JPEG, 100, bytes); - - File cachePath = AndroidUtilities.getCacheDir(); - if (!cachePath.isDirectory()) { - try { - cachePath.mkdirs(); - } catch (Exception e) { - FileLog.e(e); - return null; - } - } - File file = new File(cachePath, "qr_tmp.png"); - try (FileOutputStream out = new FileOutputStream(file)) { - inImage.compress(Bitmap.CompressFormat.PNG, 100, out); - out.close(); - return FileProvider.getUriForFile(ApplicationLoader.applicationContext, BuildConfig.APPLICATION_ID + ".provider", file); - } catch (IOException e) { - FileLog.e(e); - } - return null; - } - public Bitmap createQR(Context context, String key, Bitmap oldBitmap) { try { HashMap hints = new HashMap<>(); hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M); hints.put(EncodeHintType.MARGIN, 0); QRCodeWriter writer = new QRCodeWriter(); - Bitmap bitmap = writer.encode(key, BarcodeFormat.QR_CODE, 768, 768, hints, oldBitmap, context); + Bitmap bitmap = writer.encode(key, 768, 768, hints, oldBitmap); imageSize = writer.getImageSize(); return bitmap; } catch (Exception e) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ReactedHeaderView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ReactedHeaderView.java new file mode 100644 index 000000000..0a1b2cfa9 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ReactedHeaderView.java @@ -0,0 +1,301 @@ +package org.telegram.ui.Components; + +import android.content.Context; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffColorFilter; +import android.graphics.drawable.Drawable; +import android.text.TextUtils; +import android.util.TypedValue; +import android.view.Gravity; +import android.view.View; +import android.widget.FrameLayout; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; +import androidx.core.util.Consumer; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.ChatObject; +import org.telegram.messenger.ImageLocation; +import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MediaDataController; +import org.telegram.messenger.MessageObject; +import org.telegram.messenger.MessagesController; +import org.telegram.messenger.R; +import org.telegram.tgnet.ConnectionsManager; +import org.telegram.tgnet.TLRPC; +import org.telegram.ui.ActionBar.Theme; + +import java.util.ArrayList; +import java.util.List; + +public class ReactedHeaderView extends FrameLayout { + private FlickerLoadingView flickerLoadingView; + private TextView titleView; + private AvatarsImageView avatarsImageView; + private ImageView iconView; + private BackupImageView reactView; + + private int currentAccount; + private boolean ignoreLayout; + private List seenUsers = new ArrayList<>(); + private List users = new ArrayList<>(); + private long dialogId; + private MessageObject message; + + private boolean isLoaded; + + private Consumer> seenCallback; + + public ReactedHeaderView(@NonNull Context context, int currentAccount, MessageObject message, long dialogId) { + super(context); + this.currentAccount = currentAccount; + this.message = message; + this.dialogId = dialogId; + + flickerLoadingView = new FlickerLoadingView(context); + flickerLoadingView.setColors(Theme.key_actionBarDefaultSubmenuBackground, Theme.key_listSelector, null); + flickerLoadingView.setViewType(FlickerLoadingView.MESSAGE_SEEN_TYPE); + flickerLoadingView.setIsSingleCell(false); + addView(flickerLoadingView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT)); + + titleView = new TextView(context); + titleView.setTextColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem)); + titleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); + titleView.setLines(1); + titleView.setEllipsize(TextUtils.TruncateAt.END); + addView(titleView, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.CENTER_VERTICAL, 40, 0, 62, 0)); + + avatarsImageView = new AvatarsImageView(context, false); + avatarsImageView.setStyle(AvatarsDarawable.STYLE_MESSAGE_SEEN); + addView(avatarsImageView, LayoutHelper.createFrameRelatively(24 + 12 + 12 + 8, LayoutHelper.MATCH_PARENT, Gravity.END | Gravity.CENTER_VERTICAL, 0, 0, 0, 0)); + + iconView = new ImageView(context); + addView(iconView, LayoutHelper.createFrameRelatively(24, 24, Gravity.START | Gravity.CENTER_VERTICAL, 11, 0, 0, 0)); + Drawable drawable = ContextCompat.getDrawable(context, R.drawable.msg_reactions).mutate(); + drawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_actionBarDefaultSubmenuItemIcon), PorterDuff.Mode.MULTIPLY)); + iconView.setImageDrawable(drawable); + iconView.setVisibility(View.GONE); + + reactView = new BackupImageView(context); + addView(reactView, LayoutHelper.createFrameRelatively(24, 24, Gravity.START | Gravity.CENTER_VERTICAL, 11, 0, 0, 0)); + + titleView.setAlpha(0); + avatarsImageView.setAlpha(0); + + setBackground(Theme.getSelectorDrawable(false)); + } + + public void setSeenCallback(Consumer> seenCallback) { + this.seenCallback = seenCallback; + } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + + if (!isLoaded) { + MessagesController ctrl = MessagesController.getInstance(currentAccount); + TLRPC.Chat chat = ctrl.getChat(message.getChatId()); + TLRPC.ChatFull chatInfo = ctrl.getChatFull(message.getChatId()); + boolean showSeen = chat != null && message.isOutOwner() && message.isSent() && !message.isEditing() && !message.isSending() && !message.isSendError() && !message.isContentUnread() && !message.isUnread() && (ConnectionsManager.getInstance(currentAccount).getCurrentTime() - message.messageOwner.date < 7 * 86400) && (ChatObject.isMegagroup(chat) || !ChatObject.isChannel(chat)) && chatInfo != null && chatInfo.participants_count < MessagesController.getInstance(currentAccount).chatReadMarkSizeThreshold && !(message.messageOwner.action instanceof TLRPC.TL_messageActionChatJoinedByRequest); + + if (showSeen) { + TLRPC.TL_messages_getMessageReadParticipants req = new TLRPC.TL_messages_getMessageReadParticipants(); + req.msg_id = message.getId(); + req.peer = MessagesController.getInstance(currentAccount).getInputPeer(message.getDialogId()); + long fromId = message.messageOwner.from_id != null ? message.messageOwner.from_id.user_id : 0; + ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> { + if (response instanceof TLRPC.Vector) { + List usersToRequest = new ArrayList<>(); + TLRPC.Vector v = (TLRPC.Vector) response; + for (Object obj : v.objects) { + if (obj instanceof Long) { + long l = (long) obj; + if (fromId != l) + usersToRequest.add(l); + } + } + usersToRequest.add(fromId); + + List usersRes = new ArrayList<>(); + Runnable callback = () -> { + seenUsers.addAll(usersRes); + for (TLRPC.User u : usersRes) { + boolean hasSame = false; + for (int i = 0; i < users.size(); i++) { + if (users.get(i).id == u.id) { + hasSame = true; + break; + } + } + if (!hasSame) { + users.add(u); + } + } + if (seenCallback != null) + seenCallback.accept(usersRes); + loadReactions(); + }; + if (ChatObject.isChannel(chat)) { + TLRPC.TL_channels_getParticipants usersReq = new TLRPC.TL_channels_getParticipants(); + usersReq.limit = MessagesController.getInstance(currentAccount).chatReadMarkSizeThreshold; + usersReq.offset = 0; + usersReq.filter = new TLRPC.TL_channelParticipantsRecent(); + usersReq.channel = MessagesController.getInstance(currentAccount).getInputChannel(chat.id); + ConnectionsManager.getInstance(currentAccount).sendRequest(usersReq, (response1, error1) -> AndroidUtilities.runOnUIThread(() -> { + if (response1 != null) { + TLRPC.TL_channels_channelParticipants users = (TLRPC.TL_channels_channelParticipants) response1; + for (int i = 0; i < users.users.size(); i++) { + TLRPC.User user = users.users.get(i); + MessagesController.getInstance(currentAccount).putUser(user, false); + if (!user.self && usersToRequest.contains(user.id)) + usersRes.add(user); + } + } + callback.run(); + })); + } else { + TLRPC.TL_messages_getFullChat usersReq = new TLRPC.TL_messages_getFullChat(); + usersReq.chat_id = chat.id; + ConnectionsManager.getInstance(currentAccount).sendRequest(usersReq, (response1, error1) -> AndroidUtilities.runOnUIThread(() -> { + if (response1 != null) { + TLRPC.TL_messages_chatFull chatFull = (TLRPC.TL_messages_chatFull) response1; + for (int i = 0; i < chatFull.users.size(); i++) { + TLRPC.User user = chatFull.users.get(i); + MessagesController.getInstance(currentAccount).putUser(user, false); + if (!user.self && usersToRequest.contains(user.id)) + usersRes.add(user); + } + } + callback.run(); + })); + } + } + }, ConnectionsManager.RequestFlagInvokeAfter); + } else loadReactions(); + } + } + + private void loadReactions() { + MessagesController ctrl = MessagesController.getInstance(currentAccount); + TLRPC.TL_messages_getMessageReactionsList getList = new TLRPC.TL_messages_getMessageReactionsList(); + getList.peer = ctrl.getInputPeer(dialogId); + getList.id = message.getId(); + getList.limit = 3; + ConnectionsManager.getInstance(currentAccount).sendRequest(getList, (response, error) -> { + if (response instanceof TLRPC.TL_messages_messageReactionsList) { + TLRPC.TL_messages_messageReactionsList list = (TLRPC.TL_messages_messageReactionsList) response; + int c = list.count; + post(() -> { + String str; + if (seenUsers.isEmpty() || seenUsers.size() < c) { + str = LocaleController.formatPluralString("ReactionsCount", c); + } else { + String countStr; + if (c == seenUsers.size()) { + countStr = String.valueOf(c); + } else { + countStr = c + "/" + seenUsers.size(); + } + str = String.format(LocaleController.getPluralString("Reacted", c), countStr); + } + titleView.setText(str); + boolean showIcon = true; + if (message.messageOwner.reactions != null && message.messageOwner.reactions.results.size() == 1 && !list.reactions.isEmpty()) { + for (TLRPC.TL_availableReaction r : MediaDataController.getInstance(currentAccount).getReactionsList()) { + if (r.reaction.equals(list.reactions.get(0).reaction)) { + reactView.setImage(ImageLocation.getForDocument(r.static_icon), "50_50", "webp", null, r); + reactView.setVisibility(VISIBLE); + reactView.setAlpha(0); + reactView.animate().alpha(1f).start(); + iconView.setVisibility(GONE); + showIcon = false; + break; + } + } + } + if (showIcon) { + iconView.setVisibility(VISIBLE); + iconView.setAlpha(0f); + iconView.animate().alpha(1f).start(); + } + for (TLRPC.User u : list.users) { + if (message.messageOwner.from_id != null && u.id != message.messageOwner.from_id.user_id) { + boolean hasSame = false; + for (int i = 0; i < users.size(); i++) { + if (users.get(i).id == u.id) { + hasSame = true; + break; + } + } + if (!hasSame) { + users.add(u); + } + } + } + + updateView(); + }); + } + }, ConnectionsManager.RequestFlagInvokeAfter); + } + + public List getSeenUsers() { + return seenUsers; + } + + private void updateView() { + setEnabled(users.size() > 0); + for (int i = 0; i < 3; i++) { + if (i < users.size()) { + avatarsImageView.setObject(i, currentAccount, users.get(i)); + } else { + avatarsImageView.setObject(i, currentAccount, null); + } + } + float tX; + switch (users.size()) { + case 1: + tX = AndroidUtilities.dp(24); + break; + case 2: + tX = AndroidUtilities.dp(12); + break; + default: + tX = 0; + } + avatarsImageView.setTranslationX(LocaleController.isRTL ? AndroidUtilities.dp(12) : tX); + + avatarsImageView.commitTransition(false); + titleView.animate().alpha(1f).setDuration(220).start(); + avatarsImageView.animate().alpha(1f).setDuration(220).start(); + flickerLoadingView.animate().alpha(0f).setDuration(220).setListener(new HideViewAfterAnimation(flickerLoadingView)).start(); + } + + @Override + public void requestLayout() { + if (ignoreLayout) { + return; + } + super.requestLayout(); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + if (flickerLoadingView.getVisibility() == View.VISIBLE) { + // Idk what is happening here, but this class is a clone of MessageSeenView, so this might help with something? + ignoreLayout = true; + flickerLoadingView.setVisibility(View.GONE); + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + flickerLoadingView.getLayoutParams().width = getMeasuredWidth(); + flickerLoadingView.setVisibility(View.VISIBLE); + ignoreLayout = false; + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + } else { + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + } + } +} \ No newline at end of file diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ReactedUsersListView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ReactedUsersListView.java new file mode 100644 index 000000000..260b8b3e6 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ReactedUsersListView.java @@ -0,0 +1,298 @@ +package org.telegram.ui.Components; + +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ValueAnimator; +import android.annotation.SuppressLint; +import android.content.Context; +import android.text.TextUtils; +import android.util.LongSparseArray; +import android.util.TypedValue; +import android.view.Gravity; +import android.view.View; +import android.view.ViewGroup; +import android.widget.FrameLayout; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.DocumentObject; +import org.telegram.messenger.ImageLocation; +import org.telegram.messenger.MediaDataController; +import org.telegram.messenger.MessageObject; +import org.telegram.messenger.MessagesController; +import org.telegram.messenger.SvgHelper; +import org.telegram.messenger.UserObject; +import org.telegram.tgnet.ConnectionsManager; +import org.telegram.tgnet.TLRPC; +import org.telegram.ui.ActionBar.Theme; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class ReactedUsersListView extends FrameLayout { + public final static int VISIBLE_ITEMS = 6; + public final static int ITEM_HEIGHT_DP = 48; + + private int currentAccount; + private MessageObject message; + private String filter; + + private RecyclerListView listView; + private RecyclerView.Adapter adapter; + + private FlickerLoadingView loadingView; + + private List userReactions = new ArrayList<>(); + private LongSparseArray users = new LongSparseArray<>(); + private String offset; + private boolean isLoading, isLoaded, canLoadMore = true; + private boolean onlySeenNow; + + private OnHeightChangedListener onHeightChangedListener; + private OnProfileSelectedListener onProfileSelectedListener; + + public ReactedUsersListView(Context context, Theme.ResourcesProvider resourcesProvider, int currentAccount, MessageObject message, TLRPC.TL_reactionCount reactionCount, boolean addPadding) { + super(context); + this.currentAccount = currentAccount; + this.message = message; + this.filter = reactionCount == null ? null : reactionCount.reaction; + + listView = new RecyclerListView(context, resourcesProvider) { + @Override + protected void onMeasure(int widthSpec, int heightSpec) { + super.onMeasure(widthSpec, heightSpec); + updateHeight(); + } + }; + LinearLayoutManager llm = new LinearLayoutManager(context); + listView.setLayoutManager(llm); + if (addPadding) { + listView.setPadding(0, 0, 0, AndroidUtilities.dp(8)); + listView.setClipToPadding(false); + } + listView.setAdapter(adapter = new RecyclerView.Adapter() { + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + return new RecyclerListView.Holder(new ReactedUserHolderView(context)); + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + ReactedUserHolderView rhv = (ReactedUserHolderView) holder.itemView; + rhv.setUserReaction(userReactions.get(position)); + } + + @Override + public int getItemCount() { + return userReactions.size(); + } + }); + listView.setOnItemClickListener((view, position) -> { + if (onProfileSelectedListener != null) + onProfileSelectedListener.onProfileSelected(this, userReactions.get(position).user_id); + }); + listView.addOnScrollListener(new RecyclerView.OnScrollListener() { + @Override + public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { + if (isLoaded && canLoadMore && !isLoading && llm.findLastVisibleItemPosition() >= adapter.getItemCount() - 1 - getLoadCount()) { + load(); + } + } + }); + listView.setVerticalScrollBarEnabled(true); + listView.setAlpha(0); + addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); + + loadingView = new FlickerLoadingView(context, resourcesProvider); + loadingView.setViewType(FlickerLoadingView.REACTED_TYPE); + loadingView.setIsSingleCell(true); + loadingView.setItemsCount(reactionCount == null ? VISIBLE_ITEMS : reactionCount.count); + addView(loadingView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); + } + + @SuppressLint("NotifyDataSetChanged") + public ReactedUsersListView setSeenUsers(List users) { + List nr = new ArrayList<>(users.size()); + for (TLRPC.User u : users) { + if (this.users.get(u.id) != null) continue; + this.users.put(u.id, u); + TLRPC.TL_messageUserReaction r = new TLRPC.TL_messageUserReaction(); + r.reaction = null; + r.user_id = u.id; + nr.add(r); + } + if (userReactions.isEmpty()) + onlySeenNow = true; + userReactions.addAll(nr); + adapter.notifyDataSetChanged(); + updateHeight(); + return this; + } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + if (!isLoaded && !isLoading) { + load(); + } + } + + @SuppressLint("NotifyDataSetChanged") + private void load() { + isLoading = true; + + MessagesController ctrl = MessagesController.getInstance(currentAccount); + TLRPC.TL_messages_getMessageReactionsList getList = new TLRPC.TL_messages_getMessageReactionsList(); + getList.peer = ctrl.getInputPeer(message.getDialogId()); + getList.id = message.getId(); + getList.limit = getLoadCount(); + getList.reaction = filter; + getList.offset = offset; + if (filter != null) + getList.flags |= 1; + if (offset != null) + getList.flags |= 2; + ConnectionsManager.getInstance(currentAccount).sendRequest(getList, (response, error) -> { + if (response instanceof TLRPC.TL_messages_messageReactionsList) { + TLRPC.TL_messages_messageReactionsList l = (TLRPC.TL_messages_messageReactionsList) response; + + for (TLRPC.User u : l.users) { + users.put(u.id, u); + } + + // It's safer to create a new list to prevent inconsistency + int prev = userReactions.size(); + List newReactions = new ArrayList<>(userReactions.size() + l.reactions.size()); + newReactions.addAll(userReactions); + newReactions.addAll(l.reactions); + + if (onlySeenNow) + Collections.sort(newReactions, (o1, o2) -> Integer.compare(o1.reaction != null ? 1 : 0, o2.reaction != null ? 1 : 0)); + + AndroidUtilities.runOnUIThread(()->{ + userReactions = newReactions; + if (onlySeenNow) { + onlySeenNow = false; + adapter.notifyDataSetChanged(); + } else adapter.notifyItemRangeInserted(prev, l.reactions.size()); + + if (!isLoaded) { + ValueAnimator anim = ValueAnimator.ofFloat(0, 1).setDuration(150); + anim.setInterpolator(CubicBezierInterpolator.DEFAULT); + anim.addUpdateListener(animation -> { + float val = (float) animation.getAnimatedValue(); + listView.setAlpha(val); + loadingView.setAlpha(1f - val); + }); + anim.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + loadingView.setVisibility(GONE); + } + }); + anim.start(); + + updateHeight(); + + isLoaded = true; + } + offset = l.next_offset; + if (offset == null) + canLoadMore = false; + isLoading = false; + }); + } else isLoading = false; + }, ConnectionsManager.RequestFlagInvokeAfter); + } + + private void updateHeight() { + if (onHeightChangedListener != null) { + int h; + if (listView.getMeasuredHeight() != 0) { + h = Math.min(listView.getMeasuredHeight(), AndroidUtilities.dp(ITEM_HEIGHT_DP * Math.min(userReactions.size(), VISIBLE_ITEMS))); + } else { + h = AndroidUtilities.dp(ITEM_HEIGHT_DP * Math.min(userReactions.size(), VISIBLE_ITEMS)); + } + onHeightChangedListener.onHeightChanged(ReactedUsersListView.this, h); + } + } + + private int getLoadCount() { + return filter == null ? 100 : 50; + } + + private final class ReactedUserHolderView extends FrameLayout { + BackupImageView avatarView; + TextView titleView; + BackupImageView reactView; + AvatarDrawable avatarDrawable = new AvatarDrawable(); + View overlaySelectorView; + + ReactedUserHolderView(@NonNull Context context) { + super(context); + setLayoutParams(new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, AndroidUtilities.dp(48))); + + avatarView = new BackupImageView(context); + avatarView.setRoundRadius(AndroidUtilities.dp(32)); + addView(avatarView, LayoutHelper.createFrameRelatively(36, 36, Gravity.START | Gravity.CENTER_VERTICAL, 8, 0, 0, 0)); + + titleView = new TextView(context); + titleView.setLines(1); + titleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); + titleView.setTextColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem)); + titleView.setEllipsize(TextUtils.TruncateAt.END); + addView(titleView, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.CENTER_VERTICAL, 65, 0, 44, 0)); + + reactView = new BackupImageView(context); + addView(reactView, LayoutHelper.createFrameRelatively(24, 24, Gravity.END | Gravity.CENTER_VERTICAL, 0, 0, 12, 0)); + + overlaySelectorView = new View(context); + overlaySelectorView.setBackground(Theme.getSelectorDrawable(false)); + addView(overlaySelectorView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); + } + + void setUserReaction(TLRPC.TL_messageUserReaction reaction) { + TLRPC.User u = users.get(reaction.user_id); + avatarDrawable.setInfo(u); + titleView.setText(UserObject.getUserName(u)); + avatarView.setImage(ImageLocation.getForUser(u, ImageLocation.TYPE_SMALL), "50_50", avatarDrawable, u); + + if (reaction.reaction != null) { + TLRPC.TL_availableReaction r = MediaDataController.getInstance(currentAccount).getReactionsMap().get(reaction.reaction); + if (r != null) { + SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(r.static_icon.thumbs, Theme.key_windowBackgroundGray, 1.0f); + reactView.setImage(ImageLocation.getForDocument(r.static_icon), "50_50", "webp", svgThumb, r); + } + } + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(ITEM_HEIGHT_DP), MeasureSpec.EXACTLY)); + } + } + + public ReactedUsersListView setOnProfileSelectedListener(OnProfileSelectedListener onProfileSelectedListener) { + this.onProfileSelectedListener = onProfileSelectedListener; + return this; + } + + public ReactedUsersListView setOnHeightChangedListener(OnHeightChangedListener onHeightChangedListener) { + this.onHeightChangedListener = onHeightChangedListener; + return this; + } + + public interface OnHeightChangedListener { + void onHeightChanged(ReactedUsersListView view, int newHeight); + } + + public interface OnProfileSelectedListener { + void onProfileSelected(ReactedUsersListView view, long userId); + } +} \ No newline at end of file diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ReactionTabHolderView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ReactionTabHolderView.java new file mode 100644 index 000000000..2e287bd52 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ReactionTabHolderView.java @@ -0,0 +1,115 @@ +package org.telegram.ui.Components; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.Path; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffColorFilter; +import android.graphics.RectF; +import android.graphics.drawable.Drawable; +import android.view.Gravity; +import android.view.View; +import android.widget.FrameLayout; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.DocumentObject; +import org.telegram.messenger.ImageLocation; +import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MediaDataController; +import org.telegram.messenger.R; +import org.telegram.messenger.SvgHelper; +import org.telegram.tgnet.TLRPC; +import org.telegram.ui.ActionBar.Theme; + +public class ReactionTabHolderView extends FrameLayout { + private Paint outlinePaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private Paint bgPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private Path path = new Path(); + private RectF rect = new RectF(); + private float radius = AndroidUtilities.dp(32); + + private BackupImageView reactView; + private ImageView iconView; + private TextView counterView; + + private float outlineProgress; + + public ReactionTabHolderView(@NonNull Context context) { + super(context); + + iconView = new ImageView(context); + Drawable drawable = ContextCompat.getDrawable(context, R.drawable.msg_reactions_filled).mutate(); + drawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_avatar_nameInMessageBlue), PorterDuff.Mode.MULTIPLY)); + iconView.setImageDrawable(drawable); + addView(iconView, LayoutHelper.createFrameRelatively(24, 24, Gravity.START | Gravity.CENTER_VERTICAL, 8, 0, 8, 0)); + + reactView = new BackupImageView(context); + addView(reactView, LayoutHelper.createFrameRelatively(24, 24, Gravity.START | Gravity.CENTER_VERTICAL, 8, 0, 8, 0)); + counterView = new TextView(context); + counterView.setTextColor(Theme.getColor(Theme.key_avatar_nameInMessageBlue)); + counterView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); + addView(counterView, LayoutHelper.createFrameRelatively(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.CENTER_VERTICAL, 40, 0, 8, 0)); + + outlinePaint.setStyle(Paint.Style.STROKE); + outlinePaint.setStrokeWidth(AndroidUtilities.dp(1)); + outlinePaint.setColor(Theme.getColor(Theme.key_avatar_nameInMessageBlue)); + + bgPaint.setColor(Theme.getColor(Theme.key_avatar_nameInMessageBlue)); + bgPaint.setAlpha(0x10); + + View overlaySelectorView = new View(context); + overlaySelectorView.setBackground(Theme.getSelectorDrawable(bgPaint.getColor(), false)); + addView(overlaySelectorView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); + + setWillNotDraw(false); + } + + public void setOutlineProgress(float outlineProgress) { + this.outlineProgress = outlineProgress; + invalidate(); + } + + public void setCounter(int count) { + counterView.setText(String.format("%s", LocaleController.formatShortNumber(count, null))); + iconView.setVisibility(VISIBLE); + reactView.setVisibility(GONE); + } + + public void setCounter(int currentAccount, TLRPC.TL_reactionCount counter) { + counterView.setText(String.format("%s", LocaleController.formatShortNumber(counter.count, null))); + String e = counter.reaction; + for (TLRPC.TL_availableReaction r : MediaDataController.getInstance(currentAccount).getReactionsList()) { + if (r.reaction.equals(e)) { + SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(r.static_icon, Theme.key_windowBackgroundGray, 1.0f); + reactView.setImage(ImageLocation.getForDocument(r.static_icon), "50_50", "webp", svgThumb, r); + reactView.setVisibility(VISIBLE); + iconView.setVisibility(GONE); + break; + } + } + } + + @Override + protected void dispatchDraw(Canvas canvas) { + int s = canvas.save(); + path.rewind(); + rect.set(0, 0, getWidth(), getHeight()); + path.addRoundRect(rect, radius, radius, Path.Direction.CW); + canvas.clipPath(path); + + canvas.drawRoundRect(rect, radius, radius, bgPaint); + super.dispatchDraw(canvas); + + outlinePaint.setAlpha((int) (outlineProgress * 0xFF)); + float w = outlinePaint.getStrokeWidth(); + rect.set(w, w, getWidth() - w, getHeight() - w); + canvas.drawRoundRect(rect, radius, radius, outlinePaint); + canvas.restoreToCount(s); + } +} \ No newline at end of file diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/ReactionsEffectOverlay.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/ReactionsEffectOverlay.java new file mode 100644 index 000000000..bb12d2072 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/ReactionsEffectOverlay.java @@ -0,0 +1,376 @@ +package org.telegram.ui.Components.Reactions; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.PixelFormat; +import android.view.View; +import android.view.WindowManager; +import android.widget.FrameLayout; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.ImageLocation; +import org.telegram.messenger.MediaDataController; +import org.telegram.tgnet.TLRPC; +import org.telegram.ui.ActionBar.BaseFragment; +import org.telegram.ui.Cells.ChatMessageCell; +import org.telegram.ui.ChatActivity; +import org.telegram.ui.Components.BackupImageView; +import org.telegram.ui.Components.CubicBezierInterpolator; +import org.telegram.ui.Components.ReactionsContainerLayout; + +public class ReactionsEffectOverlay { + + public static ReactionsEffectOverlay currentOverlay; + + private final AnimationView effectImageView; + private final AnimationView emojiImageView; + private final FrameLayout container; + boolean animateIn; + float animateInProgress; + float animateOutProgress; + + FrameLayout windowView; + BackupImageView backupImageView; + private static int unicPrefix; + + int[] loc = new int[2]; + private WindowManager windowManager; + private boolean dismissed; + private float dismissProgress; + private final int messageId; + private final long groupId; + private final String reaction; + private float lastDrawnToX; + private float lastDrawnToY; + private boolean started; + private ReactionsContainerLayout.ReactionHolderView holderView = null; + private boolean wasScrolled; + + + private ReactionsEffectOverlay(Context context, BaseFragment fragment, ReactionsContainerLayout reactionsLayout, ChatMessageCell cell, float x, float y, String reaction, int currentAccount) { + this.messageId = cell.getMessageObject().getId(); + this.groupId = cell.getMessageObject().getGroupId(); + this.reaction = reaction; + ReactionsLayoutInBubble.ReactionButton reactionButton = cell.getReactionButton(reaction); + float fromX, fromY, fromHeight, fromWidth; + if (reactionsLayout != null) { + for (int i = 0; i < reactionsLayout.recyclerListView.getChildCount(); i++) { + if (((ReactionsContainerLayout.ReactionHolderView) reactionsLayout.recyclerListView.getChildAt(i)).currentReaction.reaction.equals(reaction)) { + holderView = ((ReactionsContainerLayout.ReactionHolderView) reactionsLayout.recyclerListView.getChildAt(i)); + break; + } + } + } + boolean fromHolder = holderView != null || (x != 0 && y != 0); + if (holderView != null) { + reactionsLayout.getLocationOnScreen(loc); + fromX = loc[0] + holderView.getX() + holderView.backupImageView.getX() + AndroidUtilities.dp(16); + fromY = loc[1] + holderView.getY() + holderView.backupImageView.getY() + AndroidUtilities.dp(16); + fromHeight = holderView.backupImageView.getWidth(); + } else if (reactionButton != null) { + cell.getLocationInWindow(loc); + fromX = loc[0] + cell.reactionsLayoutInBubble.x + reactionButton.x + reactionButton.imageReceiver.getImageX(); + fromY = loc[1] + cell.reactionsLayoutInBubble.y + reactionButton.y + reactionButton.imageReceiver.getImageY(); + fromHeight = reactionButton.imageReceiver.getImageHeight(); + fromWidth = reactionButton.imageReceiver.getImageWidth(); + } else { + ((View) cell.getParent()).getLocationInWindow(loc); + fromX = loc[0] + x; + fromY = loc[1] + y; + fromHeight = 0; + fromWidth = 0; + } + + int size = Math.round(Math.min(AndroidUtilities.dp(350), Math.min(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y)) * 0.8f); + int sizeForFilter = (int) (2f * size / AndroidUtilities.density); + int emojiSize = size >> 1; + int emojiSizeForFilter = sizeForFilter >> 1; + + float fromScale = fromHeight / (float) emojiSize; + animateInProgress = 0f; + animateOutProgress = 0f; + + container = new FrameLayout(context); + windowView = new FrameLayout(context) { + + @Override + protected void dispatchDraw(Canvas canvas) { + if (dismissed) { + if (dismissProgress != 1f) { + dismissProgress += 16 / 150f; + if (dismissProgress > 1f) { + dismissProgress = 1f; + AndroidUtilities.runOnUIThread(() -> { + try { + windowManager.removeView(windowView); + } catch (Exception e) { + + } + }); + } + } + if (dismissProgress != 1f) { + setAlpha(1f - dismissProgress); + super.dispatchDraw(canvas); + } + invalidate(); + return; + } + if (!started) { + invalidate(); + return; + } else { + if (holderView != null) { + holderView.backupImageView.setAlpha(0); + } + } + ChatMessageCell drawingCell; + if (fragment instanceof ChatActivity) { + drawingCell = ((ChatActivity) fragment).findMessageCell(messageId); + } else { + drawingCell = cell; + } + float toX, toY; + if (drawingCell != null) { + cell.getLocationInWindow(loc); + + ReactionsLayoutInBubble.ReactionButton reactionButton = cell.getReactionButton(reaction); + toX = loc[0] + cell.reactionsLayoutInBubble.x; + toY = loc[1] + cell.reactionsLayoutInBubble.y; + if (reactionButton != null) { + toX += reactionButton.x + reactionButton.imageReceiver.getImageX(); + toY += reactionButton.y + reactionButton.imageReceiver.getImageY(); + } + + lastDrawnToX = toX; + lastDrawnToY = toY; + } else { + toX = lastDrawnToX; + toY = lastDrawnToY; + } + float previewX = toX - emojiSize / 2f; + float previewY = toY - emojiSize / 2f; + if (fragment.getParentActivity() != null && fragment.getFragmentView().getParent() != null && fragment.getFragmentView().getVisibility() == View.VISIBLE && fragment.getFragmentView() != null) { + fragment.getFragmentView().getLocationOnScreen(loc); + setAlpha(((View) fragment.getFragmentView().getParent()).getAlpha()); + } else { + return; + } + if (previewX < loc[0]) { + previewX = loc[0]; + } + if (previewX + emojiSize > loc[0] + getMeasuredWidth()) { + previewX = loc[0] + getMeasuredWidth() - emojiSize; + } + + float animateInProgressX, animateInProgressY; + if (fromHolder) { + animateInProgressX = CubicBezierInterpolator.EASE_OUT_QUINT.getInterpolation(animateInProgress); + animateInProgressY = CubicBezierInterpolator.DEFAULT.getInterpolation(animateInProgress); + } else { + animateInProgressX = animateInProgressY = animateInProgress; + } + + float scale = animateInProgressX + (1f - animateInProgressX) * fromScale; + + float toScale; + if (cell.getMessageObject().shouldDrawReactionsInLayout()) { + toScale = AndroidUtilities.dp(20) / (float) emojiSize; + } else { + toScale = AndroidUtilities.dp(14) / (float) emojiSize; + } + + + float x = fromX * (1f - animateInProgressX) + previewX * animateInProgressX; + float y = fromY * (1f - animateInProgressY) + previewY * animateInProgressY; + + effectImageView.setTranslationX(x); + effectImageView.setTranslationY(y); + effectImageView.setAlpha((1f - animateOutProgress)); + + if (animateOutProgress != 0) { + scale = scale * (1f - animateOutProgress) + toScale * animateOutProgress; + x = x * (1f - animateOutProgress) + toX * animateOutProgress; + y = y * (1f - animateOutProgress) + toY * animateOutProgress; + } + + container.setTranslationX(x); + container.setTranslationY(y); + + container.setScaleX(scale); + container.setScaleY(scale); + + super.dispatchDraw(canvas); + + if (emojiImageView.wasPlaying && animateInProgress != 1f) { + if (fromHolder) { + animateInProgress += 16f / 350f; + } else { + animateInProgress += 16f / 220f; + } + if (animateInProgress > 1f) { + animateInProgress = 1f; + } + } + + if (wasScrolled || (emojiImageView.wasPlaying && emojiImageView.getImageReceiver().getLottieAnimation() != null && !emojiImageView.getImageReceiver().getLottieAnimation().isRunning())) { + if (animateOutProgress != 1f) { + animateOutProgress += 16f / 220f; + if (animateOutProgress > 1f) { + animateOutProgress = 1f; + currentOverlay = null; + cell.invalidate(); + if (cell.getCurrentMessagesGroup() != null && cell.getParent() != null) { + ((View) cell.getParent()).invalidate(); + } + AndroidUtilities.runOnUIThread(() -> { + try { + windowManager.removeView(windowView); + } catch (Exception e) { + + } + }); + } + } + } + + invalidate(); + } + }; + effectImageView = new AnimationView(context); + emojiImageView = new AnimationView(context); + TLRPC.TL_availableReaction availableReaction = MediaDataController.getInstance(currentAccount).getReactionsMap().get(reaction); + if (availableReaction != null) { + TLRPC.Document document = availableReaction.effect_animation; + + effectImageView.getImageReceiver().setUniqKeyPrefix((unicPrefix++) + "_" + cell.getMessageObject().getId() + "_"); + effectImageView.setImage(ImageLocation.getForDocument(document), sizeForFilter + "_" + sizeForFilter + "_pcache", null, null, 0, null); + + effectImageView.getImageReceiver().setAutoRepeat(0); + effectImageView.getImageReceiver().setAllowStartAnimation(false); + + if (effectImageView.getImageReceiver().getLottieAnimation() != null) { + effectImageView.getImageReceiver().getLottieAnimation().setCurrentFrame(0, false); + effectImageView.getImageReceiver().getLottieAnimation().start(); + } + + document = availableReaction.activate_animation; + emojiImageView.getImageReceiver().setUniqKeyPrefix((unicPrefix++) + "_" + cell.getMessageObject().getId() + "_"); + emojiImageView.setImage(ImageLocation.getForDocument(document), emojiSizeForFilter + "_" + emojiSizeForFilter, null, null, 0, null); + + emojiImageView.getImageReceiver().setAutoRepeat(0); + emojiImageView.getImageReceiver().setAllowStartAnimation(false); + + if (emojiImageView.getImageReceiver().getLottieAnimation() != null) { + emojiImageView.getImageReceiver().getLottieAnimation().setCurrentFrame(0, false); + emojiImageView.getImageReceiver().getLottieAnimation().start(); + } + + int topOffset = (size - emojiSize) >> 1; + int leftOffset = size - emojiSize; + container.addView(emojiImageView); + emojiImageView.getLayoutParams().width = emojiSize; + emojiImageView.getLayoutParams().height = emojiSize; + ((FrameLayout.LayoutParams) emojiImageView.getLayoutParams()).topMargin = topOffset; + ((FrameLayout.LayoutParams) emojiImageView.getLayoutParams()).leftMargin = leftOffset; + + windowView.addView(container); + container.getLayoutParams().width = size; + container.getLayoutParams().height = size; + ((FrameLayout.LayoutParams) container.getLayoutParams()).topMargin = -topOffset; + ((FrameLayout.LayoutParams) container.getLayoutParams()).leftMargin = -leftOffset; + + windowView.addView(effectImageView); + effectImageView.getLayoutParams().width = size; + effectImageView.getLayoutParams().height = size; + + effectImageView.getLayoutParams().width = size; + effectImageView.getLayoutParams().height = size; + ((FrameLayout.LayoutParams) effectImageView.getLayoutParams()).topMargin = -topOffset; + ((FrameLayout.LayoutParams) effectImageView.getLayoutParams()).leftMargin = -leftOffset; + + container.setPivotX(leftOffset); + container.setPivotY(topOffset); + } + } + + public static void show(BaseFragment baseFragment, ReactionsContainerLayout reactionsLayout, ChatMessageCell cell, float x, float y, String reaction, int currentAccount) { + if (cell == null) { + return; + } + ReactionsEffectOverlay reactionsEffectOverlay = new ReactionsEffectOverlay(baseFragment.getParentActivity(), baseFragment, reactionsLayout, cell, x, y, reaction, currentAccount); + currentOverlay = reactionsEffectOverlay; + + WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); + lp.width = lp.height = WindowManager.LayoutParams.MATCH_PARENT; + lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL; + lp.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR; + lp.format = PixelFormat.TRANSLUCENT; + + reactionsEffectOverlay.windowManager = baseFragment.getParentActivity().getWindowManager(); + reactionsEffectOverlay.windowManager.addView(reactionsEffectOverlay.windowView, lp); + cell.invalidate(); + if (cell.getCurrentMessagesGroup() != null && cell.getParent() != null) { + ((View) cell.getParent()).invalidate(); + } + } + + public static void startAnimation() { + if (currentOverlay != null) { + currentOverlay.started = true; + } + } + + public static void removeCurrent(boolean instant) { + if (currentOverlay != null) { + if (instant) { + try { + currentOverlay.windowManager.removeView(currentOverlay.windowView); + } catch (Exception e) { + + } + } else { + currentOverlay.dismissed = true; + } + } + currentOverlay = null; + } + + public static boolean isPlaying(int messageId, long groupId, String reaction) { + if (currentOverlay != null) { + return ((currentOverlay.groupId != 0 && groupId == currentOverlay.groupId) || messageId == currentOverlay.messageId) && currentOverlay.reaction.equals(reaction); + } + return false; + } + + + private class AnimationView extends BackupImageView { + + public AnimationView(Context context) { + super(context); + } + + boolean wasPlaying; + + @Override + protected void onDraw(Canvas canvas) { + if (getImageReceiver().getLottieAnimation() != null && getImageReceiver().getLottieAnimation().isRunning()) { + wasPlaying = true; + } + if (!wasPlaying && getImageReceiver().getLottieAnimation() != null && !getImageReceiver().getLottieAnimation().isRunning()) { + getImageReceiver().getLottieAnimation().setCurrentFrame(0, false); + getImageReceiver().getLottieAnimation().start(); + } + super.onDraw(canvas); + } + } + + public static void onScrolled(int dy) { + if (currentOverlay != null) { + currentOverlay.lastDrawnToY -= dy; + if (dy != 0) { + currentOverlay.wasScrolled = true; + } + } + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/ReactionsLayoutInBubble.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/ReactionsLayoutInBubble.java new file mode 100644 index 000000000..cd6282cb4 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/ReactionsLayoutInBubble.java @@ -0,0 +1,625 @@ +package org.telegram.ui.Components.Reactions; + +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.text.TextPaint; +import android.view.Gravity; +import android.view.MotionEvent; +import android.view.ViewConfiguration; + +import androidx.core.graphics.ColorUtils; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.ApplicationLoader; +import org.telegram.messenger.DocumentObject; +import org.telegram.messenger.ImageLocation; +import org.telegram.messenger.ImageReceiver; +import org.telegram.messenger.MediaDataController; +import org.telegram.messenger.MessageObject; +import org.telegram.messenger.MessagesController; +import org.telegram.messenger.SvgHelper; +import org.telegram.messenger.UserConfig; +import org.telegram.tgnet.TLRPC; +import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.Cells.ChatMessageCell; +import org.telegram.ui.Components.AvatarsDarawable; +import org.telegram.ui.Components.CounterView; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; + +public class ReactionsLayoutInBubble { + + private final static int ANIMATION_TYPE_IN = 1; + private final static int ANIMATION_TYPE_OUT = 2; + private final static int ANIMATION_TYPE_MOVE = 3; + public boolean drawServiceShaderBackground; + + private static Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); + private static TextPaint textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); + public boolean isSmall; + + public int x; + public int y; + private float fromX; + private float fromY; + private float lastDrawnX; + private float lastDrawnY; + private boolean wasDrawn; + private boolean animateMove; + private boolean animateWidth; + public int positionOffsetY; + int currentAccount; + public int height; + public int totalHeight; + public int width; + public int fromWidth; + public boolean isEmpty; + private float touchSlop; + public int lastLineX; + ArrayList reactionButtons = new ArrayList<>(); + ArrayList outButtons = new ArrayList<>(); + HashMap lastDrawingReactionButtons = new HashMap<>(); + HashMap lastDrawingReactionButtonsTmp = new HashMap<>(); + ChatMessageCell parentView; + MessageObject messageObject; + Theme.ResourcesProvider resourcesProvider; + + int availableWidth; + private int lastDrawnWidth; + boolean attached; + + private final static ButtonsComparator comparator = new ButtonsComparator(); + + public ReactionsLayoutInBubble(ChatMessageCell parentView) { + this.parentView = parentView; + currentAccount = UserConfig.selectedAccount; + paint.setColor(Theme.getColor(Theme.key_chat_inLoader)); + textPaint.setColor(Theme.getColor(Theme.key_featuredStickers_buttonText)); + textPaint.setTextSize(AndroidUtilities.dp(12)); + textPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); + touchSlop = ViewConfiguration.get(ApplicationLoader.applicationContext).getScaledTouchSlop(); + } + + public void setMessage(MessageObject messageObject, boolean isSmall, Theme.ResourcesProvider resourcesProvider) { + this.resourcesProvider = resourcesProvider; + this.isSmall = isSmall; + this.messageObject = messageObject; + for (int i = 0; i < reactionButtons.size(); i++) { + reactionButtons.get(i).detach(); + } + reactionButtons.clear(); + if (messageObject != null) { + if (messageObject.messageOwner.reactions != null && messageObject.messageOwner.reactions.results != null) { + int totalCount = 0; + for (int i = 0; i < messageObject.messageOwner.reactions.results.size(); i++) { + totalCount += messageObject.messageOwner.reactions.results.get(i).count; + } + for (int i = 0; i < messageObject.messageOwner.reactions.results.size(); i++) { + TLRPC.TL_reactionCount reactionCount = messageObject.messageOwner.reactions.results.get(i); + ReactionButton button = new ReactionButton(reactionCount); + reactionButtons.add(button); + if (!isSmall && messageObject.messageOwner.reactions.recent_reactons != null) { + ArrayList users = null; + if (reactionCount.count <= 3 && totalCount <= 3) { + for (int j = 0; j < messageObject.messageOwner.reactions.recent_reactons.size(); j++) { + TLRPC.TL_messageUserReaction reccent = messageObject.messageOwner.reactions.recent_reactons.get(j); + if (reccent.reaction.equals(reactionCount.reaction) && MessagesController.getInstance(currentAccount).getUser(reccent.user_id) != null) { + if (users == null) { + users = new ArrayList<>(); + } + users.add(MessagesController.getInstance(currentAccount).getUser(reccent.user_id)); + } + } + button.setUsers(users); + if (users != null && !users.isEmpty()) { + button.count = 0; + button.counterDrawable.setCount(0, false); + } + } + } + if (isSmall && reactionCount.count > 1 && reactionCount.chosen) { + reactionButtons.add(new ReactionButton(reactionCount)); + reactionButtons.get(0).isSelected = false; + reactionButtons.get(1).isSelected = true; + break; + } + if (isSmall && i == 2) { + break; + } + if (attached) { + button.attach(); + } + } + } + comparator.currentAccount = currentAccount; + Collections.sort(reactionButtons, comparator); + } + isEmpty = reactionButtons.isEmpty(); + } + + public void measure(int availableWidth) { + height = 0; + width = 0; + positionOffsetY = 0; + if (isEmpty) { + return; + } + this.availableWidth = availableWidth; + int maxWidth = 0; + int currentX = 0; + int currentY = 0; + for (int i = 0; i < reactionButtons.size(); i++) { + ReactionButton button = reactionButtons.get(i); + if (isSmall) { + button.width = AndroidUtilities.dp(14); + button.height = AndroidUtilities.dp(14); + } else { + button.width = (int) (AndroidUtilities.dp(8) + AndroidUtilities.dp(20) + AndroidUtilities.dp(4)); + if (button.avatarsDarawable != null && button.users.size() > 0) { + button.users.size(); + int c1 = 1; + int c2 = button.users.size() > 1 ? button.users.size() - 1 : 0; + button.width += AndroidUtilities.dp(2) + c1 * AndroidUtilities.dp(20) + c2 * AndroidUtilities.dp(20) * 0.8f + AndroidUtilities.dp(1); + button.avatarsDarawable.height = AndroidUtilities.dp(26); + } else { + button.width += button.counterDrawable.textPaint.measureText(button.countText) + AndroidUtilities.dp(8); + } + button.height = AndroidUtilities.dp(26); + } + + if (currentX + button.width > availableWidth) { + currentX = 0; + currentY += button.height + AndroidUtilities.dp(4); + } + button.x = currentX; + button.y = currentY; + currentX += button.width + AndroidUtilities.dp(4); + if (currentX > maxWidth) { + maxWidth = currentX; + } + + } + lastLineX = currentX; + width = maxWidth; + height = currentY + (reactionButtons.size() == 0 ? 0 : AndroidUtilities.dp(26)); + + drawServiceShaderBackground = false; + } + + public void draw(Canvas canvas, float animationProgress) { + if (isEmpty && outButtons.isEmpty()) { + return; + } + float totalX = this.x; + float totalY = this.y; + if (isEmpty) { + totalX = lastDrawnX; + totalY = lastDrawnY; + } else if (animateMove) { + totalX = totalX * (animationProgress) + fromX * (1f - animationProgress); + totalY = totalY * (animationProgress) + fromY * (1f - animationProgress); + } + canvas.save(); + canvas.translate(totalX, totalY); + for (int i = 0; i < reactionButtons.size(); i++) { + ReactionButton reactionButton = reactionButtons.get(i); + canvas.save(); + float x = reactionButton.x; + float y = reactionButton.y; + if (animationProgress != 1f && reactionButton.animationType == ANIMATION_TYPE_MOVE) { + x = reactionButton.x * animationProgress + reactionButton.animateFromX * (1f - animationProgress); + y = reactionButton.y * animationProgress + reactionButton.animateFromY * (1f - animationProgress); + } + canvas.translate(x, y); + float alpha = 1f; + if (animationProgress != 1f && reactionButton.animationType == ANIMATION_TYPE_IN) { + float s = 0.5f + 0.5f * animationProgress; + alpha = animationProgress; + canvas.scale(s, s, reactionButton.width / 2f, reactionButton.height / 2f); + } + reactionButton.draw(canvas, reactionButton.animationType == ANIMATION_TYPE_IN ? 1f : animationProgress, alpha); + canvas.restore(); + } + + for (int i = 0; i < outButtons.size(); i++) { + ReactionButton reactionButton = outButtons.get(i); + canvas.save(); + canvas.translate(reactionButton.x, reactionButton.y); + float s = 0.5f + 0.5f * (1f - animationProgress); + canvas.scale(s, s, reactionButton.width / 2f, reactionButton.height / 2f); + outButtons.get(i).draw(canvas, 1f, (1f - animationProgress)); + canvas.restore(); + } + canvas.restore(); + } + + public void recordDrawingState() { + lastDrawingReactionButtons.clear(); + for (int i = 0; i < reactionButtons.size(); i++) { + lastDrawingReactionButtons.put(reactionButtons.get(i).reaction, reactionButtons.get(i)); + } + wasDrawn = !isEmpty; + lastDrawnX = x; + lastDrawnY = y; + lastDrawnWidth = width; + } + + public boolean animateChange() { + boolean changed = false; + lastDrawingReactionButtonsTmp.clear(); + for (int i = 0; i < outButtons.size(); i++) { + outButtons.get(i).detach(); + } + outButtons.clear(); + lastDrawingReactionButtonsTmp.putAll(lastDrawingReactionButtons); + for (int i = 0; i < reactionButtons.size(); i++) { + ReactionButton button = reactionButtons.get(i); + ReactionButton lastButton = lastDrawingReactionButtonsTmp.remove(button.reaction); + if (lastButton != null) { + if (button.animateFromX != lastButton.x || button.animateFromY != lastButton.y || button.animateFromWidth != lastButton.width || button.count != lastButton.count || button.backgroundColor != lastButton.backgroundColor) { + button.animateFromX = lastButton.x; + button.animateFromY = lastButton.y; + button.animateFromWidth = lastButton.width; + button.fromTextColor = lastButton.lastDrawnTextColor; + button.fromBackgroundColor = lastButton.lastDrawnBackgroundColor; + button.animationType = ANIMATION_TYPE_MOVE; + + if (button.count != lastButton.count) { + button.counterDrawable.setCount(lastButton.count, false); + button.counterDrawable.setCount(button.count, true); + } + if (button.avatarsDarawable != null || lastButton.avatarsDarawable != null) { + if (button.avatarsDarawable == null) { + button.setUsers(new ArrayList<>()); + } + if (lastButton.avatarsDarawable == null) { + lastButton.setUsers(new ArrayList<>()); + } + button.avatarsDarawable.animateFromState(lastButton.avatarsDarawable, currentAccount); + } + changed = true; + } else { + button.animationType = 0; + } + } else { + changed = true; + button.animationType = ANIMATION_TYPE_IN; + } + } + if (!lastDrawingReactionButtonsTmp.isEmpty()) { + changed = true; + outButtons.addAll(lastDrawingReactionButtonsTmp.values()); + for (int i = 0; i < outButtons.size(); i++) { + outButtons.get(i).drawImage = outButtons.get(i).lastImageDrawn; + outButtons.get(i).attach(); + } + } + + if (wasDrawn && (lastDrawnX != x || lastDrawnY != y)) { + animateMove = true; + fromX = lastDrawnX; + fromY = lastDrawnY; + changed = true; + } + + if (lastDrawnWidth != width) { + animateWidth = true; + fromWidth = lastDrawnWidth; + changed = true; + } + + return changed; + } + + public void resetAnimation() { + for (int i = 0; i < outButtons.size(); i++) { + outButtons.get(i).detach(); + } + outButtons.clear(); + animateMove = false; + animateWidth = false; + for (int i = 0; i < reactionButtons.size(); i++) { + reactionButtons.get(i).animationType = 0; + } + } + + public ReactionButton getReactionButton(String reaction) { + return lastDrawingReactionButtons.get(reaction); + } + + public class ReactionButton { + + private final TLRPC.TL_reactionCount reactionCount; + public int animationType; + public int animateFromX; + public int animateFromY; + public int animateFromWidth; + public int fromBackgroundColor; + public int fromTextColor; + public int realCount; + public boolean drawImage = true; + public boolean lastImageDrawn; + + String countText; + String reaction; + int count; + public int x; + public int y; + int width; + int height; + ImageReceiver imageReceiver = new ImageReceiver(); + CounterView.CounterDrawable counterDrawable = new CounterView.CounterDrawable(parentView, false, null); + int backgroundColor; + int textColor; + int serviceBackgroundColor; + int serviceTextColor; + + int lastDrawnTextColor; + int lastDrawnBackgroundColor; + boolean isSelected; + AvatarsDarawable avatarsDarawable; + ArrayList users; + + public ReactionButton(TLRPC.TL_reactionCount reactionCount) { + this.reactionCount = reactionCount; + this.reaction = reactionCount.reaction; + this.count = reactionCount.count; + this.realCount = reactionCount.count; + countText = Integer.toString(reactionCount.count); + imageReceiver.setParentView(parentView); + isSelected = reactionCount.chosen; + counterDrawable.updateVisibility = false; + if (reactionCount.chosen) { + backgroundColor = Theme.getColor(messageObject.isOutOwner() ? Theme.key_chat_outReactionButtonBackground : Theme.key_chat_inReactionButtonBackground, resourcesProvider); + textColor = Theme.getColor(messageObject.isOutOwner() ? Theme.key_chat_outReactionButtonTextSelected : Theme.key_chat_inReactionButtonTextSelected, resourcesProvider); + serviceTextColor = Theme.getColor(messageObject.isOutOwner() ? Theme.key_chat_outReactionButtonBackground : Theme.key_chat_inReactionButtonBackground, resourcesProvider); + serviceBackgroundColor = Theme.getColor(messageObject.isOutOwner() ? Theme.key_chat_outBubble : Theme.key_chat_inBubble); + } else { + textColor = Theme.getColor(messageObject.isOutOwner() ? Theme.key_chat_outReactionButtonText : Theme.key_chat_inReactionButtonText, resourcesProvider); + backgroundColor = Theme.getColor(messageObject.isOutOwner() ? Theme.key_chat_outReactionButtonBackground : Theme.key_chat_inReactionButtonBackground, resourcesProvider); + backgroundColor = ColorUtils.setAlphaComponent(backgroundColor, (int) (Color.alpha(backgroundColor) * 0.156f)); + serviceTextColor = Theme.getColor(Theme.key_chat_serviceText, resourcesProvider); + serviceBackgroundColor = Color.TRANSPARENT; + } + + + if (reaction != null) { + TLRPC.TL_availableReaction r = MediaDataController.getInstance(currentAccount).getReactionsMap().get(reaction); + if (r != null) { + SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(r.static_icon, Theme.key_windowBackgroundGray, 1.0f); + imageReceiver.setImage(ImageLocation.getForDocument(r.static_icon), "40_40", svgThumb, "webp", r, 1); + } + } + + counterDrawable.setSize(AndroidUtilities.dp(26), AndroidUtilities.dp(100)); + counterDrawable.textPaint = textPaint; + counterDrawable.setCount(count, false); + counterDrawable.setType(CounterView.CounterDrawable.TYPE_CHAT_REACTIONS); + counterDrawable.gravity = Gravity.LEFT; + } + + public void draw(Canvas canvas, float progress, float alpha) { + if (isSmall) { + imageReceiver.setAlpha(alpha); + imageReceiver.setImageCoords(0, 0, AndroidUtilities.dp(14), AndroidUtilities.dp(14)); + drawImage(canvas); + return; + } + if (drawServiceShaderBackground) { + textPaint.setColor(lastDrawnTextColor = ColorUtils.blendARGB(fromTextColor, serviceTextColor, progress)); + paint.setColor(lastDrawnBackgroundColor = ColorUtils.blendARGB(fromBackgroundColor, serviceBackgroundColor, progress)); + } else { + textPaint.setColor(lastDrawnTextColor = ColorUtils.blendARGB(fromTextColor, textColor, progress)); + paint.setColor(lastDrawnBackgroundColor = ColorUtils.blendARGB(fromBackgroundColor, backgroundColor, progress)); + } + + if (alpha != 1f) { + textPaint.setAlpha((int) (textPaint.getAlpha() * alpha)); + paint.setAlpha((int) (paint.getAlpha() * alpha)); + } + imageReceiver.setAlpha(alpha); + + int w = width; + if (progress != 1f && animationType == ANIMATION_TYPE_MOVE) { + w = (int) (width * progress + animateFromWidth * (1f - progress)); + } + AndroidUtilities.rectTmp.set(0, 0, w, height); + float rad = height / 2f; + if (drawServiceShaderBackground) { + Paint paint1 = getThemedPaint(Theme.key_paint_chatActionBackground); + Paint paint2 = Theme.chat_actionBackgroundGradientDarkenPaint; + int oldAlpha = paint1.getAlpha(); + int oldAlpha2 = paint2.getAlpha(); + paint1.setAlpha((int) (oldAlpha * alpha)); + paint2.setAlpha((int) (oldAlpha2 * alpha)); + canvas.drawRoundRect(AndroidUtilities.rectTmp, rad, rad, paint1); + if (hasGradientService()) { + canvas.drawRoundRect(AndroidUtilities.rectTmp, rad, rad, paint2); + } + paint1.setAlpha(oldAlpha); + paint2.setAlpha(oldAlpha2); + } + canvas.drawRoundRect(AndroidUtilities.rectTmp, rad, rad, paint); + + imageReceiver.setImageCoords(AndroidUtilities.dp(8), (height - AndroidUtilities.dp(20)) / 2f, AndroidUtilities.dp(20), AndroidUtilities.dp(20)); + drawImage(canvas); + + if (count != 0 || counterDrawable.countChangeProgress != 1f) { + canvas.save(); + canvas.translate(AndroidUtilities.dp(8) + AndroidUtilities.dp(20) + AndroidUtilities.dp(2), 0); + counterDrawable.draw(canvas); + canvas.restore(); + } + + if (avatarsDarawable != null) { + canvas.save(); + canvas.translate(AndroidUtilities.dp(10) + AndroidUtilities.dp(20) + AndroidUtilities.dp(2), 0); + avatarsDarawable.setAlpha(alpha); + avatarsDarawable.onDraw(canvas); + canvas.restore(); + } + } + + private void drawImage(Canvas canvas) { + if (drawImage && ((realCount > 1 || !ReactionsEffectOverlay.isPlaying(messageObject.getId(), messageObject.getGroupId(), reaction)) || !isSelected)) { + imageReceiver.draw(canvas); + lastImageDrawn = true; + } else { + imageReceiver.setAlpha(0); + imageReceiver.draw(canvas); + lastImageDrawn = false; + } + } + + public void setUsers(ArrayList users) { + this.users = users; + if (users != null) { + if (avatarsDarawable == null) { + avatarsDarawable = new AvatarsDarawable(parentView, false); + avatarsDarawable.setSize(AndroidUtilities.dp(20)); + avatarsDarawable.width = AndroidUtilities.dp(100); + avatarsDarawable.height = height; + if (attached) { + avatarsDarawable.onAttachedToWindow(); + } + } + for (int i = 0; i < users.size(); i++) { + if (i == 3) { + break; + } + avatarsDarawable.setObject(i, currentAccount, users.get(i)); + } + avatarsDarawable.commitTransition(false); + } + } + + + + public void attach() { + if (imageReceiver != null) { + imageReceiver.onAttachedToWindow(); + } + if (avatarsDarawable != null) { + avatarsDarawable.onAttachedToWindow(); + } + } + + public void detach() { + if (imageReceiver != null) { + imageReceiver.onDetachedFromWindow(); + } + if (avatarsDarawable != null) { + avatarsDarawable.onDetachedFromWindow(); + } + } + } + static int attachedCount; + + float lastX; + float lastY; + ReactionButton lastSelectedButton; + boolean pressed; + Runnable longPressRunnable; + + public boolean chekTouchEvent(MotionEvent event) { + if (isEmpty || messageObject == null || messageObject.messageOwner == null || messageObject.messageOwner.reactions == null) { + return false; + } + float x = event.getX() - this.x; + float y = event.getY() - this.y; + if (event.getAction() == MotionEvent.ACTION_DOWN) { + for (int i = 0, n = reactionButtons.size(); i < n; i++) { + if (x > reactionButtons.get(i).x && x < reactionButtons.get(i).x + reactionButtons.get(i).width && + y > reactionButtons.get(i).y && y < reactionButtons.get(i).y + reactionButtons.get(i).height) { + lastX = event.getX(); + lastY = event.getY(); + lastSelectedButton = reactionButtons.get(i); + if (longPressRunnable != null && messageObject.messageOwner.reactions.can_see_list) { + AndroidUtilities.cancelRunOnUIThread(longPressRunnable); + longPressRunnable = null; + } + + final ReactionButton selectedButtonFinal = lastSelectedButton; + AndroidUtilities.runOnUIThread(longPressRunnable = () -> { + parentView.getDelegate().didPressReaction(parentView, selectedButtonFinal.reactionCount, true); + longPressRunnable = null; + }, ViewConfiguration.getLongPressTimeout()); + pressed = true; + break; + } + } + } else if (event.getAction() == MotionEvent.ACTION_MOVE) { + if (pressed && Math.abs(event.getX() - lastX) > touchSlop || Math.abs(event.getY() - lastY) > touchSlop) { + pressed = false; + lastSelectedButton = null; + if (longPressRunnable != null) { + AndroidUtilities.cancelRunOnUIThread(longPressRunnable); + longPressRunnable = null; + } + } + } else if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL) { + if (longPressRunnable != null) { + AndroidUtilities.cancelRunOnUIThread(longPressRunnable); + longPressRunnable = null; + } + if (pressed && lastSelectedButton != null && event.getAction() == MotionEvent.ACTION_UP) { + if (parentView.getDelegate() != null) { + parentView.getDelegate().didPressReaction(parentView, lastSelectedButton.reactionCount, false); + } + } + pressed = false; + lastSelectedButton = null; + } + return pressed; + } + + private boolean hasGradientService() { + return resourcesProvider != null ? resourcesProvider.hasGradientService() : Theme.hasGradientService(); + } + + private Paint getThemedPaint(String paintKey) { + Paint paint = resourcesProvider != null ? resourcesProvider.getPaint(paintKey) : null; + return paint != null ? paint : Theme.getThemePaint(paintKey); + } + + public float getCurrentWidth(float transitionProgress) { + if (animateWidth) { + return fromWidth * (1f - transitionProgress) + width * transitionProgress; + } + return width; + } + + private static class ButtonsComparator implements Comparator { + + int currentAccount; + + @Override + public int compare(ReactionButton o1, ReactionButton o2) { + if (o1.realCount != o2.realCount) { + return o2.realCount - o1.realCount; + } + TLRPC.TL_availableReaction availableReaction1 = MediaDataController.getInstance(currentAccount).getReactionsMap().get(o1.reaction); + TLRPC.TL_availableReaction availableReaction2 = MediaDataController.getInstance(currentAccount).getReactionsMap().get(o2.reaction); + if (availableReaction1 != null && availableReaction2 != null) { + return availableReaction1.positionInList - availableReaction2.positionInList; + } + return 0; + } + } + + public void onAttachToWindow() { + for (int i = 0; i < reactionButtons.size(); i++) { + reactionButtons.get(i).attach(); + } + } + + public void onDetachFromWindow() { + for (int i = 0; i < reactionButtons.size(); i++) { + reactionButtons.get(i).detach(); + } + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ReactionsContainerLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ReactionsContainerLayout.java new file mode 100644 index 000000000..d8b1a5706 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ReactionsContainerLayout.java @@ -0,0 +1,432 @@ +package org.telegram.ui.Components; + +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ValueAnimator; +import android.annotation.SuppressLint; +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.LinearGradient; +import android.graphics.Paint; +import android.graphics.Path; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffColorFilter; +import android.graphics.Rect; +import android.graphics.RectF; +import android.graphics.Region; +import android.graphics.Shader; +import android.graphics.drawable.Drawable; +import android.view.Gravity; +import android.view.View; +import android.view.ViewGroup; +import android.widget.FrameLayout; + +import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; +import androidx.core.util.Consumer; +import androidx.dynamicanimation.animation.FloatPropertyCompat; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.DocumentObject; +import org.telegram.messenger.ImageLocation; +import org.telegram.messenger.LocaleController; +import org.telegram.messenger.R; +import org.telegram.messenger.SvgHelper; +import org.telegram.tgnet.TLRPC; +import org.telegram.ui.ActionBar.Theme; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Random; + +public class ReactionsContainerLayout extends FrameLayout { + public final static FloatPropertyCompat TRANSITION_PROGRESS_VALUE = new FloatPropertyCompat("transitionProgress") { + @Override + public float getValue(ReactionsContainerLayout object) { + return object.transitionProgress * 100f; + } + + @Override + public void setValue(ReactionsContainerLayout object, float value) { + object.setTransitionProgress(value / 100f); + } + }; + + private final static Random RANDOM = new Random(); + + private final static int ALPHA_DURATION = 150; + private final static float SIDE_SCALE = 0.6f; + private final static float SCALE_PROGRESS = 0.75f; + private final static float CLIP_PROGRESS = 0.25f; + public final RecyclerListView recyclerListView; + + private Paint bgPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private Paint leftShadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG), + rightShadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private float leftAlpha, rightAlpha; + private float transitionProgress = 1f; + private RectF rect = new RectF(); + private Path mPath = new Path(); + private float radius = AndroidUtilities.dp(72); + private float bigCircleRadius = AndroidUtilities.dp(8); + private float smallCircleRadius = bigCircleRadius / 2; + private int bigCircleOffset = AndroidUtilities.dp(36); + + private List reactionsList = Collections.emptyList(); + + private LinearLayoutManager linearLayoutManager; + private RecyclerView.Adapter listAdapter; + + private int[] location = new int[2]; + + private ReactionsContainerDelegate delegate; + + private Rect shadowPad = new Rect(); + private Drawable shadow; + + private List triggeredReactions = new ArrayList<>(); + Theme.ResourcesProvider resourcesProvider; + + public ReactionsContainerLayout(@NonNull Context context, Theme.ResourcesProvider resourcesProvider) { + super(context); + this.resourcesProvider = resourcesProvider; + + shadow = ContextCompat.getDrawable(context, R.drawable.reactions_bubble_shadow).mutate(); + shadowPad.left = shadowPad.top = shadowPad.right = shadowPad.bottom = AndroidUtilities.dp(7); + shadow.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_messagePanelShadow), PorterDuff.Mode.MULTIPLY)); + + recyclerListView = new RecyclerListView(context); + linearLayoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false); + recyclerListView.addItemDecoration(new RecyclerView.ItemDecoration() { + @Override + public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) { + super.getItemOffsets(outRect, view, parent, state); + int position = parent.getChildAdapterPosition(view); + if (position == 0) { + outRect.left = AndroidUtilities.dp(6); + } + outRect.right = AndroidUtilities.dp(4); + if (position == listAdapter.getItemCount() - 1) { + outRect.right = AndroidUtilities.dp(6); + } + } + }); + recyclerListView.setLayoutManager(linearLayoutManager); + recyclerListView.setOverScrollMode(View.OVER_SCROLL_NEVER); + recyclerListView.setAdapter(listAdapter = new RecyclerView.Adapter() { + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + ReactionHolderView hv = new ReactionHolderView(context); + int size = getLayoutParams().height - getPaddingTop() - getPaddingBottom(); + hv.setLayoutParams(new RecyclerView.LayoutParams(size - AndroidUtilities.dp(12), size)); + return new RecyclerListView.Holder(hv); + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + ReactionHolderView h = (ReactionHolderView) holder.itemView; + h.setScaleX(1); + h.setScaleY(1); + h.setReaction(reactionsList.get(position)); + } + + @Override + public int getItemCount() { + return reactionsList.size(); + } + }); + recyclerListView.setOnItemClickListener((view, position) -> { + ReactionHolderView h = (ReactionHolderView) view; + if (delegate != null) + delegate.onReactionClicked(h, h.currentReaction); + }); + recyclerListView.addOnScrollListener(new LeftRightShadowsListener()); + recyclerListView.addOnScrollListener(new RecyclerView.OnScrollListener() { + @Override + public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { + if (recyclerView.getChildCount() > 2) { + float sideDiff = 1f - SIDE_SCALE; + + recyclerView.getLocationInWindow(location); + int rX = location[0]; + + View ch1 = recyclerView.getChildAt(0); + ch1.getLocationInWindow(location); + int ch1X = location[0]; + + int dX1 = ch1X - rX; + float s1 = SIDE_SCALE + (1f - Math.min(1, -Math.min(dX1, 0f) / ch1.getWidth())) * sideDiff; + if (Float.isNaN(s1)) s1 = 1f; + ch1.setScaleX(s1); + ch1.setScaleY(s1); + + View ch2 = recyclerView.getChildAt(recyclerView.getChildCount() - 1); + ch2.getLocationInWindow(location); + int ch2X = location[0]; + + int dX2 = rX + recyclerView.getWidth() - (ch2X + ch2.getWidth()); + float s2 = SIDE_SCALE + (1f - Math.min(1, -Math.min(dX2, 0f) / ch2.getWidth())) * sideDiff; + if (Float.isNaN(s2)) s2 = 1f; + ch2.setScaleX(s2); + ch2.setScaleY(s2); + } + for (int i = 1; i < recyclerListView.getChildCount() - 1; i++) { + View ch = recyclerListView.getChildAt(i); + float sc = 1f; + ch.setScaleX(sc); + ch.setScaleY(sc); + } + invalidate(); + } + }); + recyclerListView.addItemDecoration(new RecyclerView.ItemDecoration() { + @Override + public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) { + int i = parent.getChildAdapterPosition(view); + if (i == 0) + outRect.left = AndroidUtilities.dp(8); + if (i == listAdapter.getItemCount() - 1) + outRect.right = AndroidUtilities.dp(8); + } + }); + addView(recyclerListView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); + invalidateShaders(); + + bgPaint.setColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground, resourcesProvider)); + } + + public void setDelegate(ReactionsContainerDelegate delegate) { + this.delegate = delegate; + } + + @SuppressLint("NotifyDataSetChanged") + public void setReactionsList(List reactionsList) { + this.reactionsList = reactionsList; + listAdapter.notifyDataSetChanged(); + } + + HashSet lastVisibleViews = new HashSet<>(); + HashSet lastVisibleViewsTmp = new HashSet<>(); + + @Override + protected void dispatchDraw(Canvas canvas) { + lastVisibleViewsTmp.clear(); + lastVisibleViewsTmp.addAll(lastVisibleViews); + lastVisibleViews.clear(); + if (transitionProgress != 0) { + int delay = 0; + for (int i = 0; i < recyclerListView.getChildCount(); i++) { + View view = recyclerListView.getChildAt(i); + if (view.getX() + view.getMeasuredWidth() > 0 && view.getX() < getWidth()) { + if (!lastVisibleViewsTmp.contains(view)) { + ((ReactionHolderView) view).play(delay); + delay += 50; + } + lastVisibleViews.add(view); + } + } + } + + float cPr = (Math.max(CLIP_PROGRESS, Math.min(transitionProgress, 1f)) - CLIP_PROGRESS) / (1f - CLIP_PROGRESS); + float br = bigCircleRadius * cPr, sr = smallCircleRadius * cPr; + + float cx = LocaleController.isRTL ? bigCircleOffset : getWidth() - bigCircleOffset, cy = getHeight() - getPaddingBottom(); + int sPad = AndroidUtilities.dp(3); + shadow.setBounds((int) (cx - br - sPad * cPr), (int) (cy - br - sPad * cPr), (int) (cx + br + sPad * cPr), (int) (cy + br + sPad * cPr)); + shadow.draw(canvas); + canvas.drawCircle(cx, cy, br, bgPaint); + + cx = LocaleController.isRTL ? bigCircleOffset - bigCircleRadius : getWidth() - bigCircleOffset + bigCircleRadius; + cy = getHeight() - smallCircleRadius - sPad; + sPad = -AndroidUtilities.dp(1); + shadow.setBounds((int) (cx - br - sPad * cPr), (int) (cy - br - sPad * cPr), (int) (cx + br + sPad * cPr), (int) (cy + br + sPad * cPr)); + shadow.draw(canvas); + canvas.drawCircle(cx, cy, sr, bgPaint); + + int s = canvas.save(); + mPath.rewind(); + mPath.addCircle(LocaleController.isRTL ? bigCircleOffset : getWidth() - bigCircleOffset, getHeight() - getPaddingBottom(), br, Path.Direction.CW); + canvas.clipPath(mPath, Region.Op.DIFFERENCE); + + float pivotX = LocaleController.isRTL ? getWidth() * 0.125f : getWidth() * 0.875f; + + if (transitionProgress <= SCALE_PROGRESS) { + float sc = transitionProgress / SCALE_PROGRESS; + canvas.scale(sc, sc, pivotX, getHeight() / 2f); + } + + float lt = 0, rt = 1; + if (LocaleController.isRTL) { + rt = Math.max(CLIP_PROGRESS, transitionProgress); + } else { + lt = (1f - Math.max(CLIP_PROGRESS, transitionProgress)); + } + rect.set(getPaddingLeft() + (getWidth() - getPaddingRight()) * lt, getPaddingTop(), (getWidth() - getPaddingRight()) * rt, getHeight() - getPaddingBottom()); + shadow.setBounds((int) (getPaddingLeft() + (getWidth() - getPaddingRight() + shadowPad.right) * lt - shadowPad.left), getPaddingTop() - shadowPad.top, (int) ((getWidth() - getPaddingRight() + shadowPad.right) * rt), getHeight() - getPaddingBottom() + shadowPad.bottom); + shadow.draw(canvas); + canvas.restoreToCount(s); + + s = canvas.save(); + if (transitionProgress <= SCALE_PROGRESS) { + float sc = transitionProgress / SCALE_PROGRESS; + canvas.scale(sc, sc, pivotX, getHeight() / 2f); + } + canvas.drawRoundRect(rect, radius, radius, bgPaint); + canvas.restoreToCount(s); + + mPath.rewind(); + mPath.addRoundRect(rect, radius, radius, Path.Direction.CW); + + s = canvas.save(); + if (transitionProgress <= SCALE_PROGRESS) { + float sc = transitionProgress / SCALE_PROGRESS; + canvas.scale(sc, sc, pivotX, getHeight() / 2f); + } + canvas.clipPath(mPath); + canvas.translate((LocaleController.isRTL ? -1 : 1) * getWidth() * (1f - transitionProgress), 0); + super.dispatchDraw(canvas); + + canvas.restoreToCount(s); + s = canvas.save(); + if (LocaleController.isRTL) rt = Math.max(CLIP_PROGRESS, Math.min(1, transitionProgress)); + else lt = 1f - Math.max(CLIP_PROGRESS, Math.min(1f, transitionProgress)); + rect.set(getPaddingLeft() + (getWidth() - getPaddingRight()) * lt, getPaddingTop(), (getWidth() - getPaddingRight()) * rt, getHeight() - getPaddingBottom()); + mPath.rewind(); + mPath.addRoundRect(rect, radius, radius, Path.Direction.CW); + canvas.clipPath(mPath); + if (leftShadowPaint != null) { + leftShadowPaint.setAlpha((int) (leftAlpha * transitionProgress * 0xFF)); + canvas.drawRect(rect, leftShadowPaint); + } + if (rightShadowPaint != null) { + rightShadowPaint.setAlpha((int) (rightAlpha * transitionProgress * 0xFF)); + canvas.drawRect(rect, rightShadowPaint); + } + canvas.restoreToCount(s); + + } + + @Override + protected void onSizeChanged(int w, int h, int oldw, int oldh) { + super.onSizeChanged(w, h, oldw, oldh); + invalidateShaders(); + } + + /** + * Invalidates shaders + */ + private void invalidateShaders() { + int dp = AndroidUtilities.dp(24); + float cy = getHeight() / 2f; + int clr = Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground); + leftShadowPaint.setShader(new LinearGradient(0, cy, dp, cy, clr, Color.TRANSPARENT, Shader.TileMode.CLAMP)); + rightShadowPaint.setShader(new LinearGradient(getWidth(), cy, getWidth() - dp, cy, clr, Color.TRANSPARENT, Shader.TileMode.CLAMP)); + invalidate(); + } + + public void setTransitionProgress(float transitionProgress) { + this.transitionProgress = transitionProgress; + invalidate(); + } + + private final class LeftRightShadowsListener extends RecyclerView.OnScrollListener { + private boolean leftVisible, rightVisible; + private ValueAnimator leftAnimator, rightAnimator; + + @Override + public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { + boolean l = linearLayoutManager.findFirstVisibleItemPosition() != 0; + if (l != leftVisible) { + if (leftAnimator != null) + leftAnimator.cancel(); + leftAnimator = startAnimator(leftAlpha, l ? 1 : 0, aFloat -> { + leftShadowPaint.setAlpha((int) ((leftAlpha = aFloat) * 0xFF)); + invalidate(); + }, () -> leftAnimator = null); + + leftVisible = l; + } + + boolean r = linearLayoutManager.findLastVisibleItemPosition() != listAdapter.getItemCount() - 1; + if (r != rightVisible) { + if (rightAnimator != null) + rightAnimator.cancel(); + rightAnimator = startAnimator(rightAlpha, r ? 1 : 0, aFloat -> { + rightShadowPaint.setAlpha((int) ((rightAlpha = aFloat) * 0xFF)); + invalidate(); + }, () -> rightAnimator = null); + + rightVisible = r; + } + } + + private ValueAnimator startAnimator(float fromAlpha, float toAlpha, Consumer callback, Runnable onEnd) { + ValueAnimator a = ValueAnimator.ofFloat(fromAlpha, toAlpha).setDuration((long) (Math.abs(toAlpha - fromAlpha) * ALPHA_DURATION)); + a.addUpdateListener(animation -> callback.accept((Float) animation.getAnimatedValue())); + a.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + onEnd.run(); + } + }); + a.start(); + return a; + } + } + + public final class ReactionHolderView extends FrameLayout { + public BackupImageView backupImageView; + public TLRPC.TL_availableReaction currentReaction; + + Runnable playRunnable = new Runnable() { + @Override + public void run() { + if (backupImageView.getImageReceiver().getLottieAnimation() != null && !backupImageView.getImageReceiver().getLottieAnimation().isRunning()) { + backupImageView.getImageReceiver().getLottieAnimation().start(); + } + } + }; + + + ReactionHolderView(Context context) { + super(context); + backupImageView = new BackupImageView(context); + backupImageView.getImageReceiver().setAutoRepeat(0); + addView(backupImageView, LayoutHelper.createFrame(34, 34, Gravity.CENTER)); + } + + private void setReaction(TLRPC.TL_availableReaction react) { + currentReaction = react; + SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(currentReaction.appear_animation, Theme.key_windowBackgroundGray, 1.0f); + backupImageView.getImageReceiver().setImage(ImageLocation.getForDocument(currentReaction.appear_animation), "80_80_nolimit", null, null, svgThumb, 0, "tgs", react, 0); + } + + public void play(int delay) { + AndroidUtilities.cancelRunOnUIThread(playRunnable); + if (backupImageView.getImageReceiver().getLottieAnimation() != null) { + backupImageView.getImageReceiver().getLottieAnimation().setCurrentFrame(0, false); + if (delay == 0) { + playRunnable.run(); + } else { + backupImageView.getImageReceiver().getLottieAnimation().stop(); + backupImageView.getImageReceiver().getLottieAnimation().setCurrentFrame(0, false); + AndroidUtilities.runOnUIThread(playRunnable, delay); + } + + } + + + } + + } + + public interface ReactionsContainerDelegate { + void onReactionClicked(View v, TLRPC.TL_availableReaction reaction); + } +} \ No newline at end of file diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/RecyclerListView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/RecyclerListView.java index 64b7d26a5..13e0243e7 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/RecyclerListView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/RecyclerListView.java @@ -25,6 +25,7 @@ import android.graphics.drawable.TransitionDrawable; import android.os.Build; import android.os.SystemClock; import android.text.Layout; +import android.text.SpannableStringBuilder; import android.text.StaticLayout; import android.text.TextPaint; import android.util.SparseIntArray; @@ -39,11 +40,17 @@ import android.view.ViewGroup; import android.view.ViewParent; import android.view.ViewPropertyAnimator; import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import android.widget.FrameLayout; +import androidx.core.content.ContextCompat; +import androidx.core.graphics.ColorUtils; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + import org.telegram.messenger.AndroidUtilities; -import org.telegram.messenger.LocaleController; import org.telegram.messenger.FileLog; +import org.telegram.messenger.LocaleController; import org.telegram.messenger.R; import org.telegram.ui.ActionBar.Theme; @@ -108,7 +115,7 @@ public class RecyclerListView extends RecyclerView { public boolean scrollingByUser; - private GestureDetector gestureDetector; + private GestureDetectorFixDoubleTap gestureDetector; private View currentChildView; private int currentChildPosition; private boolean interceptedByChild; @@ -150,6 +157,18 @@ public class RecyclerListView extends RecyclerView { protected final Theme.ResourcesProvider resourcesProvider; + private boolean accessibilityEnabled = true; + + private AccessibilityDelegate accessibilityDelegate = new AccessibilityDelegate() { + @Override + public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(host, info); + if (host.isEnabled()) { + info.addAction(AccessibilityNodeInfo.ACTION_CLICK); + } + } + }; + public FastScroll getFastScroll() { return fastScroll; } @@ -159,6 +178,14 @@ public class RecyclerListView extends RecyclerView { } public interface OnItemClickListenerExtended { + + default boolean hasDoubleTap(View view, int position) { + return false; + } + + default void onDoubleTap(View view, int position, float x, float y) { + } + void onItemClick(View view, int position, float x, float y); } @@ -168,8 +195,12 @@ public class RecyclerListView extends RecyclerView { public interface OnItemLongClickListenerExtended { boolean onItemClick(View view, int position, float x, float y); - void onMove(float dx, float dy); - void onLongClickRelease(); + + default void onMove(float dx, float dy) { + } + + default void onLongClickRelease() { + } } public interface OnInterceptTouchListener { @@ -186,10 +217,13 @@ public class RecyclerListView extends RecyclerView { public abstract static class FastScrollAdapter extends SelectionAdapter { public abstract String getLetter(int position); + public abstract void getPositionForScrollProgress(RecyclerListView listView, float progress, int[] position); + public void onStartFastScroll() { } + public void onFinishFastScroll(RecyclerListView listView) { } @@ -205,6 +239,7 @@ public class RecyclerListView extends RecyclerView { public boolean fastScrollIsVisible(RecyclerListView listView) { return true; } + public void onFastScrollSingleTap() { } @@ -338,11 +373,17 @@ public class RecyclerListView extends RecyclerView { } public abstract int getSectionCount(); + public abstract int getCountForSection(int section); + public abstract boolean isEnabled(ViewHolder holder, int section, int row); + public abstract int getItemViewType(int section, int position); + public abstract Object getItem(int section, int position); + public abstract void onBindViewHolder(int section, int position, ViewHolder holder); + public abstract View getSectionHeaderView(int section, View view); } @@ -367,6 +408,13 @@ public class RecyclerListView extends RecyclerView { private boolean pressed; private StaticLayout letterLayout; private StaticLayout oldLetterLayout; + private StaticLayout outLetterLayout; + private StaticLayout inLetterLayout; + private StaticLayout stableLetterLayout; + private float replaceLayoutProgress = 1f; + private boolean fromTop; + private float lastLetterY; + private float fromWidth; private TextPaint letterPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); private String currentLetter; private Path path = new Path(); @@ -387,6 +435,7 @@ public class RecyclerListView extends RecyclerView { float touchSlop; Drawable fastScrollShadowDrawable; Drawable fastScrollBackgroundDrawable; + boolean isRtl; Runnable hideFloatingDateRunnable = new Runnable() { @Override @@ -406,7 +455,9 @@ public class RecyclerListView extends RecyclerView { this.type = type; if (type == LETTER_TYPE) { letterPaint.setTextSize(AndroidUtilities.dp(45)); + isRtl = LocaleController.isRTL; } else { + isRtl = false; letterPaint.setTextSize(AndroidUtilities.dp(13)); letterPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); paint2.setColor(Theme.getColor(Theme.key_windowBackgroundWhite)); @@ -417,7 +468,7 @@ public class RecyclerListView extends RecyclerView { radii[a] = AndroidUtilities.dp(44); } - scrollX = LocaleController.isRTL ? AndroidUtilities.dp(10) : AndroidUtilities.dp((type == LETTER_TYPE ? 132 : 240) - 15); + scrollX = isRtl ? AndroidUtilities.dp(10) : AndroidUtilities.dp((type == LETTER_TYPE ? 132 : 240) - 15); updateColors(); setFocusableInTouchMode(true); ViewConfiguration vc = ViewConfiguration.get(context); @@ -455,11 +506,11 @@ public class RecyclerListView extends RecyclerView { float x = event.getX(); startY = lastY = event.getY(); float currentY = (float) Math.ceil((getMeasuredHeight() - AndroidUtilities.dp(24 + 30)) * progress) + AndroidUtilities.dp(12); - if (LocaleController.isRTL && x > AndroidUtilities.dp(25) || !LocaleController.isRTL && x < AndroidUtilities.dp(107) || lastY < currentY || lastY > currentY + AndroidUtilities.dp(30)) { + if (isRtl && x > AndroidUtilities.dp(25) || !isRtl && x < AndroidUtilities.dp(107) || lastY < currentY || lastY > currentY + AndroidUtilities.dp(30)) { return false; } if (type == DATE_TYPE && !floatingDateVisible) { - if (LocaleController.isRTL && x > AndroidUtilities.dp(25) || !LocaleController.isRTL && x < (getMeasuredWidth() - AndroidUtilities.dp(25)) || lastY < currentY || lastY > currentY + AndroidUtilities.dp(30)) { + if (isRtl && x > AndroidUtilities.dp(25) || !isRtl && x < (getMeasuredWidth() - AndroidUtilities.dp(25)) || lastY < currentY || lastY > currentY + AndroidUtilities.dp(30)) { return false; } } @@ -544,17 +595,47 @@ public class RecyclerListView extends RecyclerView { } letterLayout = null; } else if (!newLetter.equals(currentLetter)) { + currentLetter = newLetter; if (type == LETTER_TYPE) { letterLayout = new StaticLayout(newLetter, letterPaint, 1000, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); } else { + outLetterLayout = letterLayout; int w = ((int) letterPaint.measureText(newLetter)) + 1; letterLayout = new StaticLayout(newLetter, letterPaint, w, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); + if (outLetterLayout != null) { + String[] newSplits = newLetter.split(" "); + String[] oldSplits = outLetterLayout.getText().toString().split(" "); + if (newSplits != null && oldSplits != null && newSplits.length == 2 && oldSplits.length == 2 && newSplits[1].equals(oldSplits[1])) { + String oldText = outLetterLayout.getText().toString(); + SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(oldText); + spannableStringBuilder.setSpan(new EmptyStubSpan(), oldSplits[0].length(), oldText.length(), 0); + int oldW = ((int) letterPaint.measureText(oldText)) + 1; + outLetterLayout = new StaticLayout(spannableStringBuilder, letterPaint, oldW, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); + + spannableStringBuilder = new SpannableStringBuilder(newLetter); + spannableStringBuilder.setSpan(new EmptyStubSpan(), newSplits[0].length(), newLetter.length(), 0); + inLetterLayout = new StaticLayout(spannableStringBuilder, letterPaint, w, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); + + spannableStringBuilder = new SpannableStringBuilder(newLetter); + spannableStringBuilder.setSpan(new EmptyStubSpan(), 0, newSplits[0].length(), 0); + stableLetterLayout = new StaticLayout(spannableStringBuilder, letterPaint, w, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); + } else { + inLetterLayout = letterLayout; + stableLetterLayout = null; + } + + fromWidth = outLetterLayout.getWidth(); + replaceLayoutProgress = 0f; + fromTop = getProgress() > lastLetterY; + } + + lastLetterY = getProgress(); } oldLetterLayout = null; if (letterLayout.getLineCount() > 0) { float lWidth = letterLayout.getLineWidth(0); float lleft = letterLayout.getLineLeft(0); - if (LocaleController.isRTL) { + if (isRtl) { textX = AndroidUtilities.dp(10) + (AndroidUtilities.dp(88) - letterLayout.getLineWidth(0)) / 2 - letterLayout.getLineLeft(0); } else { textX = (AndroidUtilities.dp(88) - letterLayout.getLineWidth(0)) / 2 - letterLayout.getLineLeft(0); @@ -627,8 +708,8 @@ public class RecyclerListView extends RecyclerView { raduisBottom = AndroidUtilities.dp(44); raduisTop = AndroidUtilities.dp(4) + (1.0f - diff / AndroidUtilities.dp(29)) * AndroidUtilities.dp(40); } - if (LocaleController.isRTL && (radii[0] != raduisTop || radii[6] != raduisBottom) || !LocaleController.isRTL && (radii[2] != raduisTop || radii[4] != raduisBottom)) { - if (LocaleController.isRTL) { + if (isRtl && (radii[0] != raduisTop || radii[6] != raduisBottom) || !isRtl && (radii[2] != raduisTop || radii[4] != raduisBottom)) { + if (isRtl) { radii[0] = radii[1] = raduisTop; radii[6] = radii[7] = raduisBottom; } else { @@ -636,7 +717,7 @@ public class RecyclerListView extends RecyclerView { radii[4] = radii[5] = raduisBottom; } path.reset(); - rect.set(LocaleController.isRTL ? AndroidUtilities.dp(10) : 0, 0, AndroidUtilities.dp(LocaleController.isRTL ? 98 : 88), AndroidUtilities.dp(88)); + rect.set(isRtl ? AndroidUtilities.dp(10) : 0, 0, AndroidUtilities.dp(isRtl ? 98 : 88), AndroidUtilities.dp(88)); path.addRoundRect(rect, radii, Path.Direction.CW); path.close(); } @@ -659,19 +740,61 @@ public class RecyclerListView extends RecyclerView { float cy = rect.centerY(); float x = rect.left - AndroidUtilities.dp(30) * bubbleProgress - AndroidUtilities.dp(8); float r = letterLayout.getHeight() / 2f + AndroidUtilities.dp(6); - rect.set(x - letterLayout.getWidth() - AndroidUtilities.dp(36), cy - letterLayout.getHeight() / 2f - AndroidUtilities.dp(8), x - AndroidUtilities.dp(12), cy + letterLayout.getHeight() / 2f + AndroidUtilities.dp(8)); + float width = replaceLayoutProgress * letterLayout.getWidth() + fromWidth * (1f - replaceLayoutProgress); + rect.set(x - width - AndroidUtilities.dp(36), cy - letterLayout.getHeight() / 2f - AndroidUtilities.dp(8), x - AndroidUtilities.dp(12), cy + letterLayout.getHeight() / 2f + AndroidUtilities.dp(8)); int oldAlpha1 = paint2.getAlpha(); int oldAlpha2 = letterPaint.getAlpha(); paint2.setAlpha((int) (oldAlpha1 * floatingDateProgress)); - letterPaint.setAlpha((int) (oldAlpha2 * floatingDateProgress)); + fastScrollBackgroundDrawable.setBounds((int) rect.left, (int) rect.top, (int) rect.right, (int) rect.bottom); fastScrollBackgroundDrawable.setAlpha((int) (255 * floatingDateProgress)); fastScrollBackgroundDrawable.draw(canvas); - canvas.save(); - canvas.translate(x - letterLayout.getWidth() - AndroidUtilities.dp(24), cy - letterLayout.getHeight() / 2f); - letterLayout.draw(canvas); - canvas.restore(); + + if (replaceLayoutProgress != 1f) { + replaceLayoutProgress += 16f / 150f; + if (replaceLayoutProgress > 1f) { + replaceLayoutProgress = 1f; + } else { + invalidate(); + } + } + + if (replaceLayoutProgress != 1f) { + canvas.save(); + rect.inset(AndroidUtilities.dp(4), AndroidUtilities.dp(2)); + canvas.clipRect(rect); + if (outLetterLayout != null) { + letterPaint.setAlpha((int) (oldAlpha2 * floatingDateProgress * (1f - replaceLayoutProgress))); + canvas.save(); + canvas.translate(x - outLetterLayout.getWidth() - AndroidUtilities.dp(24), cy - outLetterLayout.getHeight() / 2f + (fromTop ? -1 : 1) * AndroidUtilities.dp(15) * replaceLayoutProgress); + outLetterLayout.draw(canvas); + canvas.restore(); + } + + if (inLetterLayout != null) { + letterPaint.setAlpha((int) (oldAlpha2 * floatingDateProgress * replaceLayoutProgress)); + canvas.save(); + canvas.translate(x - inLetterLayout.getWidth() - AndroidUtilities.dp(24), cy - inLetterLayout.getHeight() / 2f + (fromTop ? 1 : -1) * AndroidUtilities.dp(15) * (1f - replaceLayoutProgress)); + inLetterLayout.draw(canvas); + canvas.restore(); + } + + if (stableLetterLayout != null) { + letterPaint.setAlpha((int) (oldAlpha2 * floatingDateProgress)); + canvas.save(); + canvas.translate(x - stableLetterLayout.getWidth() - AndroidUtilities.dp(24), cy - stableLetterLayout.getHeight() / 2f); + stableLetterLayout.draw(canvas); + canvas.restore(); + } + canvas.restore(); + } else { + letterPaint.setAlpha((int) (oldAlpha2 * floatingDateProgress)); + canvas.save(); + canvas.translate(x - letterLayout.getWidth() - AndroidUtilities.dp(24), cy - letterLayout.getHeight() / 2f + AndroidUtilities.dp(15) * (1f - replaceLayoutProgress)); + letterLayout.draw(canvas); + canvas.restore(); + } paint2.setAlpha(oldAlpha1); letterPaint.setAlpha(oldAlpha2); @@ -787,14 +910,50 @@ public class RecyclerListView extends RecyclerView { private class RecyclerListViewItemClickListener implements OnItemTouchListener { public RecyclerListViewItemClickListener(Context context) { - gestureDetector = new GestureDetector(context, new GestureDetector.OnGestureListener() { + gestureDetector = new GestureDetectorFixDoubleTap(context, new GestureDetector.SimpleOnGestureListener() { + private View doubleTapView; + @Override public boolean onSingleTapUp(MotionEvent e) { - if (currentChildView != null && (onItemClickListener != null || onItemClickListenerExtended != null)) { + if (currentChildView != null) { + if (onItemClickListenerExtended != null && onItemClickListenerExtended.hasDoubleTap(currentChildView, currentChildPosition)) { + doubleTapView = currentChildView; + } else { + onPressItem(currentChildView, e); + return true; + } + } + return false; + } + + @Override + public boolean onSingleTapConfirmed(MotionEvent e) { + if (doubleTapView != null && onItemClickListenerExtended != null) { + if (onItemClickListenerExtended.hasDoubleTap(doubleTapView, currentChildPosition)) { + onPressItem(doubleTapView, e); + doubleTapView = null; + return true; + } + } + return false; + } + + @Override + public boolean onDoubleTap(MotionEvent e) { + if (doubleTapView != null && onItemClickListenerExtended != null && onItemClickListenerExtended.hasDoubleTap(doubleTapView, currentChildPosition)) { + onItemClickListenerExtended.onDoubleTap(doubleTapView, currentChildPosition, e.getX(), e.getY()); + doubleTapView = null; + return true; + } + return false; + } + + private void onPressItem(View cv, MotionEvent e) { + if (cv != null && (onItemClickListener != null || onItemClickListenerExtended != null)) { final float x = e.getX(); final float y = e.getY(); - onChildPressed(currentChildView, x, y, true); - final View view = currentChildView; + onChildPressed(cv, x, y, true); + final View view = cv; final int position = currentChildPosition; if (instantClick && position != -1) { view.playSoundEffect(SoundEffectConstants.CLICK); @@ -829,15 +988,13 @@ public class RecyclerListView extends RecyclerView { }, ViewConfiguration.getPressedStateDuration()); if (selectChildRunnable != null) { - View pressedChild = currentChildView; AndroidUtilities.cancelRunOnUIThread(selectChildRunnable); selectChildRunnable = null; currentChildView = null; interceptedByChild = false; - removeSelection(pressedChild, e); + removeSelection(cv, e); } } - return true; } @Override @@ -868,21 +1025,6 @@ public class RecyclerListView extends RecyclerView { public boolean onDown(MotionEvent e) { return false; } - - @Override - public void onShowPress(MotionEvent e) { - - } - - @Override - public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { - return false; - } - - @Override - public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { - return false; - } }); gestureDetector.setIsLongpressEnabled(false); } @@ -1231,7 +1373,7 @@ public class RecyclerListView extends RecyclerView { if (fastScroll != null) { selfOnLayout = true; t += getPaddingTop(); - if (LocaleController.isRTL) { + if (fastScroll.isRtl) { fastScroll.layout(0, t, fastScroll.getMeasuredWidth(), t + fastScroll.getMeasuredHeight()); } else { int x = getMeasuredWidth() - fastScroll.getMeasuredWidth(); @@ -1880,9 +2022,13 @@ public class RecyclerListView extends RecyclerView { ViewHolder holder = findContainingViewHolder(child); if (holder != null) { child.setEnabled(((SelectionAdapter) getAdapter()).isEnabled(holder)); + if (accessibilityEnabled) { + child.setAccessibilityDelegate(accessibilityDelegate); + } } } else { child.setEnabled(false); + child.setAccessibilityDelegate(null); } super.onChildAttachedToWindow(child); } @@ -2174,11 +2320,12 @@ public class RecyclerListView extends RecyclerView { y = event.getY(); onFocus = true; parent.requestDisallowInterceptTouchEvent(true); - } if (event.getAction() == MotionEvent.ACTION_MOVE) { + } + if (event.getAction() == MotionEvent.ACTION_MOVE) { float dx = (x - event.getX()); float dy = (y - event.getY()); float touchSlop = ViewConfiguration.get(v.getContext()).getScaledTouchSlop(); - if (onFocus && Math.sqrt(dx * dx + dy * dy) >touchSlop) { + if (onFocus && Math.sqrt(dx * dx + dy * dy) > touchSlop) { onFocus = false; parent.requestDisallowInterceptTouchEvent(false); } @@ -2218,7 +2365,7 @@ public class RecyclerListView extends RecyclerView { if (fastScroll != null && fastScroll.pressed) { return false; } - if (multiSelectionGesture && e.getAction() != MotionEvent.ACTION_DOWN &&e.getAction() != MotionEvent.ACTION_UP && e.getAction() != MotionEvent.ACTION_CANCEL) { + if (multiSelectionGesture && e.getAction() != MotionEvent.ACTION_DOWN && e.getAction() != MotionEvent.ACTION_UP && e.getAction() != MotionEvent.ACTION_CANCEL) { if (lastX == Float.MAX_VALUE && lastY == Float.MAX_VALUE) { lastX = e.getX(); lastY = e.getY(); @@ -2388,4 +2535,8 @@ public class RecyclerListView extends RecyclerView { public void setItemsEnterAnimator(RecyclerItemsEnterAnimator itemsEnterAnimator) { this.itemsEnterAnimator = itemsEnterAnimator; } -} + + public void setAccessibilityEnabled(boolean accessibilityEnabled) { + this.accessibilityEnabled = accessibilityEnabled; + } +} \ No newline at end of file diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/SeekBarWaveform.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/SeekBarWaveform.java index 93ed4a8ca..fc3069e93 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/SeekBarWaveform.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/SeekBarWaveform.java @@ -54,7 +54,6 @@ public class SeekBarWaveform { paintOuter.setStrokeWidth(AndroidUtilities.dpf2(2)); paintInner.setStrokeCap(Paint.Cap.ROUND); paintOuter.setStrokeCap(Paint.Cap.ROUND); - } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/SimpleThemeDescription.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/SimpleThemeDescription.java new file mode 100644 index 000000000..fe675b154 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/SimpleThemeDescription.java @@ -0,0 +1,17 @@ +package org.telegram.ui.Components; + +import org.telegram.ui.ActionBar.ThemeDescription; + +import java.util.ArrayList; + +public class SimpleThemeDescription { + private SimpleThemeDescription() {} + + public static ArrayList createThemeDescriptions(ThemeDescription.ThemeDescriptionDelegate del, String... keys) { + ArrayList l = new ArrayList<>(keys.length); + for (String k : keys) { + l.add(new ThemeDescription(null, 0, null, null, null, del, k)); + } + return l; + } +} \ No newline at end of file diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/SizeNotifierFrameLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/SizeNotifierFrameLayout.java index e9cc08861..48b1a6ff1 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/SizeNotifierFrameLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/SizeNotifierFrameLayout.java @@ -18,15 +18,10 @@ import android.graphics.drawable.Drawable; import android.graphics.drawable.GradientDrawable; import android.os.Build; import android.view.View; -import android.view.WindowInsets; import android.widget.FrameLayout; -import androidx.core.view.ViewCompat; -import androidx.core.view.WindowInsetsCompat; - -import com.google.android.exoplayer2.util.Log; - import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.SharedConfig; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarLayout; import org.telegram.ui.ActionBar.AdjustPanLayoutHelper; @@ -54,6 +49,7 @@ public class SizeNotifierFrameLayout extends FrameLayout { private float emojiOffset; private boolean animationInProgress; private boolean skipBackgroundDrawing; + SnowflakesEffect snowflakesEffect; public interface SizeNotifierFrameLayoutDelegate { void onSizeChanged(int keyboardHeight, boolean isWidthGreater); @@ -263,6 +259,7 @@ public class SizeNotifierFrameLayout extends FrameLayout { canvas.clipRect(0, actionBarHeight, width, getMeasuredHeight() - bottomClip); drawable.setBounds(x, y, x + width, y + height); drawable.draw(canvas); + checkSnowflake(canvas); canvas.restore(); } else { if (bottomClip != 0) { @@ -289,6 +286,7 @@ public class SizeNotifierFrameLayout extends FrameLayout { } drawable.setBounds(0, 0, getMeasuredWidth(), getRootView().getMeasuredHeight()); drawable.draw(canvas); + checkSnowflake(canvas); if (bottomClip != 0) { canvas.restore(); } @@ -299,6 +297,7 @@ public class SizeNotifierFrameLayout extends FrameLayout { } drawable.setBounds(0, backgroundTranslationY, getMeasuredWidth(), backgroundTranslationY + getRootView().getMeasuredHeight()); drawable.draw(canvas); + checkSnowflake(canvas); if (bottomClip != 0) { canvas.restore(); } @@ -310,6 +309,7 @@ public class SizeNotifierFrameLayout extends FrameLayout { canvas.scale(scale, scale); drawable.setBounds(0, 0, (int) Math.ceil(getMeasuredWidth() / scale), (int) Math.ceil(getRootView().getMeasuredHeight() / scale)); drawable.draw(canvas); + checkSnowflake(canvas); canvas.restore(); } else { int actionBarHeight = (isActionBarVisible() ? ActionBar.getCurrentActionBarHeight() : 0) + (Build.VERSION.SDK_INT >= 21 && occupyStatusBar ? AndroidUtilities.statusBarHeight : 0); @@ -325,6 +325,7 @@ public class SizeNotifierFrameLayout extends FrameLayout { canvas.clipRect(0, actionBarHeight, width, getMeasuredHeight() - bottomClip); drawable.setBounds(x, y, x + width, y + height); drawable.draw(canvas); + checkSnowflake(canvas); canvas.restore(); } } @@ -335,6 +336,15 @@ public class SizeNotifierFrameLayout extends FrameLayout { } } + private void checkSnowflake(Canvas canvas) { + if (SharedConfig.drawSnowInChat || Theme.canStartHolidayAnimation()) { + if (snowflakesEffect == null) { + snowflakesEffect = new SnowflakesEffect(1); + } + snowflakesEffect.onDraw(this, canvas); + } + } + protected boolean isActionBarVisible() { return true; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/SnowflakesEffect.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/SnowflakesEffect.java index aa5ea5597..0885a446c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/SnowflakesEffect.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/SnowflakesEffect.java @@ -8,6 +8,7 @@ package org.telegram.ui.Components; +import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Paint; import android.os.Build; @@ -23,7 +24,11 @@ public class SnowflakesEffect { private Paint particlePaint; private Paint particleThinPaint; + private Paint bitmapPaint = new Paint(); private String colorKey = Theme.key_actionBarDefaultTitle; + private int viewType; + + Bitmap particleBitmap; private long lastAnimationTime; @@ -50,31 +55,41 @@ public class SnowflakesEffect { } case 1: default: { - particleThinPaint.setAlpha((int) (255 * alpha)); - float angle = (float) -Math.PI / 2; - float px = AndroidUtilities.dpf2(2.0f) * 2 * scale; - float px1 = -AndroidUtilities.dpf2(0.57f) * 2 * scale; - float py1 = AndroidUtilities.dpf2(1.55f) * 2 * scale; - for (int a = 0; a < 6; a++) { - float x1 = (float) Math.cos(angle) * px; - float y1 = (float) Math.sin(angle) * px; - float cx = x1 * 0.66f; - float cy = y1 * 0.66f; - canvas.drawLine(x, y, x + x1, y + y1, particleThinPaint); + if (particleBitmap == null) { + particleThinPaint.setAlpha(255); + particleBitmap = Bitmap.createBitmap(AndroidUtilities.dp(16), AndroidUtilities.dp(16), Bitmap.Config.ARGB_8888); + Canvas bitmapCanvas = new Canvas(particleBitmap); + float px = AndroidUtilities.dpf2(2.0f) * 2; + float px1 = -AndroidUtilities.dpf2(0.57f) * 2; + float py1 = AndroidUtilities.dpf2(1.55f) * 2; + for (int a = 0; a < 6; a++) { + float x = AndroidUtilities.dp(8); + float y = AndroidUtilities.dp(8); + float x1 = (float) Math.cos(angle) * px; + float y1 = (float) Math.sin(angle) * px; + float cx = x1 * 0.66f; + float cy = y1 * 0.66f; + bitmapCanvas.drawLine(x, y, x + x1, y + y1, particleThinPaint); - float angle2 = (float) (angle - Math.PI / 2); - x1 = (float) (Math.cos(angle2) * px1 - Math.sin(angle2) * py1); - y1 = (float) (Math.sin(angle2) * px1 + Math.cos(angle2) * py1); - canvas.drawLine(x + cx, y + cy, x + x1, y + y1, particleThinPaint); + float angle2 = (float) (angle - Math.PI / 2); + x1 = (float) (Math.cos(angle2) * px1 - Math.sin(angle2) * py1); + y1 = (float) (Math.sin(angle2) * px1 + Math.cos(angle2) * py1); + bitmapCanvas.drawLine(x + cx, y + cy, x + x1, y + y1, particleThinPaint); - x1 = (float) (-Math.cos(angle2) * px1 - Math.sin(angle2) * py1); - y1 = (float) (-Math.sin(angle2) * px1 + Math.cos(angle2) * py1); - canvas.drawLine(x + cx, y + cy, x + x1, y + y1, particleThinPaint); + x1 = (float) (-Math.cos(angle2) * px1 - Math.sin(angle2) * py1); + y1 = (float) (-Math.sin(angle2) * px1 + Math.cos(angle2) * py1); + bitmapCanvas.drawLine(x + cx, y + cy, x + x1, y + y1, particleThinPaint); - angle += angleDiff; + angle += angleDiff; + } } + bitmapPaint.setAlpha((int) (255 * alpha)); + canvas.save(); + canvas.scale(scale, scale, x, y); + canvas.drawBitmap(particleBitmap, x, y, bitmapPaint); + canvas.restore(); break; } } @@ -87,7 +102,8 @@ public class SnowflakesEffect { private int color; - public SnowflakesEffect() { + public SnowflakesEffect(int viewType) { + this.viewType = viewType; particlePaint = new Paint(Paint.ANTI_ALIAS_FLAG); particlePaint.setStrokeWidth(AndroidUtilities.dp(1.5f)); particlePaint.setStrokeCap(Paint.Cap.ROUND); @@ -132,10 +148,18 @@ public class SnowflakesEffect { count--; continue; } - if (particle.currentTime < 200.0f) { - particle.alpha = AndroidUtilities.accelerateInterpolator.getInterpolation(particle.currentTime / 200.0f); + if (viewType == 0) { + if (particle.currentTime < 200.0f) { + particle.alpha = AndroidUtilities.accelerateInterpolator.getInterpolation(particle.currentTime / 200.0f); + } else { + particle.alpha = 1.0f - AndroidUtilities.decelerateInterpolator.getInterpolation((particle.currentTime - 200.0f) / (particle.lifeTime - 200.0f)); + } } else { - particle.alpha = 1.0f - AndroidUtilities.decelerateInterpolator.getInterpolation((particle.currentTime - 200.0f) / (particle.lifeTime - 200.0f)); + if (particle.currentTime < 200.0f) { + particle.alpha = AndroidUtilities.accelerateInterpolator.getInterpolation(particle.currentTime / 200.0f); + } else if (particle.lifeTime - particle.currentTime < 2000) { + particle.alpha = AndroidUtilities.decelerateInterpolator.getInterpolation((particle.lifeTime - particle.currentTime) / 2000); + } } particle.x += particle.vx * particle.velocity * dt / 500.0f; particle.y += particle.vy * particle.velocity * dt / 500.0f; @@ -153,38 +177,47 @@ public class SnowflakesEffect { Particle particle = particles.get(a); particle.draw(canvas); } + int maxCount = viewType == 0 ? 100 : 300; + int createPerFrame = viewType == 0 ? 1 : 10; + if (particles.size() < maxCount) { + for (int i = 0; i < createPerFrame; i++) { + if (particles.size() < maxCount && Utilities.random.nextFloat() > 0.7f) { + int statusBarHeight = (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0); + float cx = Utilities.random.nextFloat() * parent.getMeasuredWidth(); + float cy = statusBarHeight + Utilities.random.nextFloat() * (parent.getMeasuredHeight() - AndroidUtilities.dp(20) - statusBarHeight); - if (Utilities.random.nextFloat() > 0.7f && particles.size() < 100) { - int statusBarHeight = (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0); - float cx = Utilities.random.nextFloat() * parent.getMeasuredWidth(); - float cy = statusBarHeight + Utilities.random.nextFloat() * (parent.getMeasuredHeight() - AndroidUtilities.dp(20) - statusBarHeight); + int angle = Utilities.random.nextInt(40) - 20 + 90; + float vx = (float) Math.cos(Math.PI / 180.0 * angle); + float vy = (float) Math.sin(Math.PI / 180.0 * angle); - int angle = Utilities.random.nextInt(40) - 20 + 90; - float vx = (float) Math.cos(Math.PI / 180.0 * angle); - float vy = (float) Math.sin(Math.PI / 180.0 * angle); + Particle newParticle; + if (!freeParticles.isEmpty()) { + newParticle = freeParticles.get(0); + freeParticles.remove(0); + } else { + newParticle = new Particle(); + } + newParticle.x = cx; + newParticle.y = cy; - Particle newParticle; - if (!freeParticles.isEmpty()) { - newParticle = freeParticles.get(0); - freeParticles.remove(0); - } else { - newParticle = new Particle(); + newParticle.vx = vx; + newParticle.vy = vy; + + newParticle.alpha = 0.0f; + newParticle.currentTime = 0; + + newParticle.scale = Utilities.random.nextFloat() * 1.2f; + newParticle.type = Utilities.random.nextInt(2); + + if (viewType == 0) { + newParticle.lifeTime = 2000 + Utilities.random.nextInt(100); + } else { + newParticle.lifeTime = 3000 + Utilities.random.nextInt(2000); + } + newParticle.velocity = 20.0f + Utilities.random.nextFloat() * 4.0f; + particles.add(newParticle); + } } - newParticle.x = cx; - newParticle.y = cy; - - newParticle.vx = vx; - newParticle.vy = vy; - - newParticle.alpha = 0.0f; - newParticle.currentTime = 0; - - newParticle.scale = Utilities.random.nextFloat() * 1.2f; - newParticle.type = Utilities.random.nextInt(2); - - newParticle.lifeTime = 2000 + Utilities.random.nextInt(100); - newParticle.velocity = 20.0f + Utilities.random.nextFloat() * 4.0f; - particles.add(newParticle); } long newTime = System.currentTimeMillis(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/StaticLayoutEx.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/StaticLayoutEx.java index bb0a5e8f4..544851294 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/StaticLayoutEx.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/StaticLayoutEx.java @@ -172,7 +172,6 @@ public class StaticLayoutEx { .setAlignment(align) .setLineSpacing(spacingAdd, spacingMult) .setIncludePad(includePad) - .setEllipsize(TextUtils.TruncateAt.END) .setEllipsizedWidth(ellipsisWidth) .setMaxLines(maxLines) .setBreakStrategy(canContainUrl ? StaticLayout.BREAK_STRATEGY_HIGH_QUALITY : StaticLayout.BREAK_STRATEGY_SIMPLE) diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/StickerImageView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/StickerImageView.java new file mode 100644 index 000000000..557a0a283 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/StickerImageView.java @@ -0,0 +1,85 @@ +package org.telegram.ui.Components; + +import android.content.Context; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.DocumentObject; +import org.telegram.messenger.ImageLocation; +import org.telegram.messenger.MediaDataController; +import org.telegram.messenger.NotificationCenter; +import org.telegram.messenger.SvgHelper; +import org.telegram.tgnet.TLRPC; +import org.telegram.ui.ActionBar.Theme; + +public class StickerImageView extends BackupImageView implements NotificationCenter.NotificationCenterDelegate { + + int currentAccount; + int stickerNum; + String stickerPackName = AndroidUtilities.STICKERS_PLACEHOLDER_PACK_NAME; + + public StickerImageView(Context context, int currentAccount) { + super(context); + this.currentAccount = currentAccount; + } + + public void setStickerNum(int stickerNum) { + this.stickerNum = stickerNum; + } + + public void setStickerPackName(String stickerPackName) { + this.stickerPackName = stickerPackName; + } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + setSticker(); + NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.diceStickersDidLoad); + } + + @Override + protected void onDetachedFromWindow() { + super.onDetachedFromWindow(); + NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.diceStickersDidLoad); + } + + @Override + public void didReceivedNotification(int id, int account, Object... args) { + if (id == NotificationCenter.diceStickersDidLoad) { + String name = (String) args[0]; + if (stickerPackName.equals(name)) { + setSticker(); + } + } + } + + private void setSticker() { + String imageFilter = null; + TLRPC.Document document = null; + TLRPC.TL_messages_stickerSet set = null; + + set = MediaDataController.getInstance(currentAccount).getStickerSetByName(stickerPackName); + if (set == null) { + set = MediaDataController.getInstance(currentAccount).getStickerSetByEmojiOrName(stickerPackName); + } + if (set != null && set.documents.size() > stickerNum) { + document = set.documents.get(stickerNum); + } + imageFilter = "130_130"; + + SvgHelper.SvgDrawable svgThumb = null; + if (document != null) { + svgThumb = DocumentObject.getSvgThumb(document.thumbs, Theme.key_emptyListPlaceholder, 0.2f); + } + if (svgThumb != null) { + svgThumb.overrideWidthAndHeight(512, 512); + } + + if (document != null) { + ImageLocation imageLocation = ImageLocation.getForDocument(document); + setImage(imageLocation, imageFilter, "tgs", svgThumb, set); + } else { + MediaDataController.getInstance(currentAccount).loadStickersByEmojiOrName(stickerPackName, false, set == null); + } + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/TextStyleSpan.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/TextStyleSpan.java index aeee06202..748f98181 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/TextStyleSpan.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/TextStyleSpan.java @@ -15,6 +15,7 @@ import android.text.style.MetricAffectingSpan; import org.telegram.messenger.AndroidUtilities; import org.telegram.tgnet.TLRPC; +import org.telegram.ui.ActionBar.Theme; public class TextStyleSpan extends MetricAffectingSpan { @@ -67,6 +68,10 @@ public class TextStyleSpan extends MetricAffectingSpan { } else { p.setFlags(p.getFlags() &~ Paint.STRIKE_THRU_TEXT_FLAG); } + + if ((flags & FLAG_STYLE_SPOILER_REVEALED) != 0) { + p.bgColor = Theme.getColor(Theme.key_chats_archivePullDownBackground); + } } public Typeface getTypeface() { @@ -92,6 +97,8 @@ public class TextStyleSpan extends MetricAffectingSpan { public final static int FLAG_STYLE_QUOTE = 32; public final static int FLAG_STYLE_MENTION = 64; public final static int FLAG_STYLE_URL = 128; + public final static int FLAG_STYLE_SPOILER = 256; + public final static int FLAG_STYLE_SPOILER_REVEALED = 512; public TextStyleSpan(TextStyleRun run) { this(run, 0, 0); @@ -125,6 +132,16 @@ public class TextStyleSpan extends MetricAffectingSpan { color = value; } + public boolean isSpoiler() { + return (style.flags & FLAG_STYLE_SPOILER) > 0; + } + + public void setSpoilerRevealed(boolean b) { + if (b) + style.flags |= FLAG_STYLE_SPOILER_REVEALED; + else style.flags &= ~FLAG_STYLE_SPOILER_REVEALED; + } + public boolean isMono() { return style.getTypeface() == Typeface.MONOSPACE; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ThemeSmallPreviewView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ThemeSmallPreviewView.java index 7c29d026f..70e7d9c52 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ThemeSmallPreviewView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ThemeSmallPreviewView.java @@ -5,7 +5,6 @@ import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.content.Context; import android.graphics.Bitmap; -import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.LinearGradient; @@ -29,7 +28,6 @@ import org.telegram.messenger.ChatThemeController; import org.telegram.messenger.DocumentObject; import org.telegram.messenger.Emoji; import org.telegram.messenger.FileLoader; -import org.telegram.messenger.FileLog; import org.telegram.messenger.ImageLoader; import org.telegram.messenger.ImageLocation; import org.telegram.messenger.ImageReceiver; @@ -42,13 +40,13 @@ import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.EmojiThemes; import org.telegram.ui.ActionBar.Theme; -import java.io.FileInputStream; import java.util.List; public class ThemeSmallPreviewView extends FrameLayout implements NotificationCenter.NotificationCenterDelegate { public final static int TYPE_DEFAULT = 0; public final static int TYPE_GRID = 1; + public final static int TYPE_QR = 2; private final float STROKE_RADIUS = AndroidUtilities.dp(8); private final float INNER_RADIUS = AndroidUtilities.dp(6); @@ -89,7 +87,7 @@ public class ThemeSmallPreviewView extends FrameLayout implements NotificationCe backupImageView.getImageReceiver().setCrossfadeWithOldImage(true); backupImageView.getImageReceiver().setAllowStartLottieAnimation(false); backupImageView.getImageReceiver().setAutoRepeat(0); - if (currentType == TYPE_DEFAULT) { + if (currentType == TYPE_DEFAULT || currentType == TYPE_QR) { addView(backupImageView, LayoutHelper.createFrame(28, 28, Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM, 0, 0, 0, 12)); } else { addView(backupImageView, LayoutHelper.createFrame(36, 36, Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM, 0, 0, 0, 12)); @@ -107,8 +105,11 @@ public class ThemeSmallPreviewView extends FrameLayout implements NotificationCe int height = (int) (width * 1.2f); super.onMeasure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)); } else { - int height = MeasureSpec.getSize(heightMeasureSpec); int width = AndroidUtilities.dp(77); + int height = MeasureSpec.getSize(heightMeasureSpec); + if (height == 0) { + height = (int) (width * 1.35f); + } super.onMeasure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)); } @@ -433,7 +434,7 @@ public class ThemeSmallPreviewView extends FrameLayout implements NotificationCe } else if (color1 != 0) { drawable = new ColorDrawable(color1); } else if (item.themeInfo != null && (item.themeInfo.previewWallpaperOffset > 0 || item.themeInfo.pathToWallpaper != null)) { - Bitmap wallpaper = getScaledBitmap(AndroidUtilities.dp(76), AndroidUtilities.dp(97), item.themeInfo.pathToWallpaper, item.themeInfo.pathToFile, item.themeInfo.previewWallpaperOffset); + Bitmap wallpaper = AndroidUtilities.getScaledBitmap(AndroidUtilities.dp(76), AndroidUtilities.dp(97), item.themeInfo.pathToWallpaper, item.themeInfo.pathToFile, item.themeInfo.previewWallpaperOffset); if (wallpaper != null) { drawable = new BitmapDrawable(wallpaper); } @@ -494,56 +495,6 @@ public class ThemeSmallPreviewView extends FrameLayout implements NotificationCe } } - public static Bitmap getScaledBitmap(float w, float h, String path, String streamPath, int streamOffset) { - FileInputStream stream = null; - try { - BitmapFactory.Options options = new BitmapFactory.Options(); - options.inJustDecodeBounds = true; - - if (path != null) { - BitmapFactory.decodeFile(path, options); - } else { - stream = new FileInputStream(streamPath); - stream.getChannel().position(streamOffset); - BitmapFactory.decodeStream(stream, null, options); - } - if (options.outWidth > 0 && options.outHeight > 0) { - if (w > h && options.outWidth < options.outHeight) { - float temp = w; - w = h; - h = temp; - } - float scale = Math.min(options.outWidth / w, options.outHeight / h); - options.inSampleSize = 1; - if (scale > 1.0f) { - do { - options.inSampleSize *= 2; - } while (options.inSampleSize < scale); - } - options.inJustDecodeBounds = false; - Bitmap wallpaper; - if (path != null) { - wallpaper = BitmapFactory.decodeFile(path, options); - } else { - stream.getChannel().position(streamOffset); - wallpaper = BitmapFactory.decodeStream(stream, null, options); - } - return wallpaper; - } - } catch (Throwable e) { - FileLog.e(e); - } finally { - try { - if (stream != null) { - stream.close(); - } - } catch (Exception e2) { - FileLog.e(e2); - } - } - return null; - } - private class ThemeDrawable { private final Paint strokePaint = new Paint(Paint.ANTI_ALIAS_FLAG); @@ -590,7 +541,7 @@ public class ThemeSmallPreviewView extends FrameLayout implements NotificationCe } public void draw(Canvas canvas, float alpha) { - if (chatThemeItem.isSelected || strokeAlphaAnimator != null) { + if (isSelected || strokeAlphaAnimator != null) { EmojiThemes.ThemeItem themeItem = chatThemeItem.chatTheme.getThemeItem(chatThemeItem.themeIndex); int strokeColor = chatThemeItem.chatTheme.showAsDefaultStub ? getThemedColor(Theme.key_featuredStickers_addButton) @@ -613,45 +564,52 @@ public class ThemeSmallPreviewView extends FrameLayout implements NotificationCe textLayout.draw(canvas); canvas.restore(); } else { - float bubbleTop = INNER_RECT_SPACE + AndroidUtilities.dp(8); - float bubbleLeft = INNER_RECT_SPACE + AndroidUtilities.dp(22); - if (currentType == TYPE_DEFAULT) { - rectF.set(bubbleLeft, bubbleTop, bubbleLeft + BUBBLE_WIDTH, bubbleTop + BUBBLE_HEIGHT); + if (currentType == TYPE_QR) { + if (chatThemeItem.icon != null) { + float left = (getWidth() - chatThemeItem.icon.getWidth()) * 0.5f; + canvas.drawBitmap(chatThemeItem.icon, left, AndroidUtilities.dp(21), null); + } } else { - bubbleTop = getMeasuredHeight() * 0.12f; - bubbleLeft = getMeasuredWidth() - getMeasuredWidth() * 0.65f; - float bubbleRight = getMeasuredWidth() - getMeasuredWidth() * 0.1f; - float bubbleBottom = getMeasuredHeight() * 0.32f; - rectF.set(bubbleLeft, bubbleTop, bubbleRight, bubbleBottom); - } + float bubbleTop = INNER_RECT_SPACE + AndroidUtilities.dp(8); + float bubbleLeft = INNER_RECT_SPACE + AndroidUtilities.dp(22); + if (currentType == TYPE_DEFAULT) { + rectF.set(bubbleLeft, bubbleTop, bubbleLeft + BUBBLE_WIDTH, bubbleTop + BUBBLE_HEIGHT); + } else { + bubbleTop = getMeasuredHeight() * 0.12f; + bubbleLeft = getMeasuredWidth() - getMeasuredWidth() * 0.65f; + float bubbleRight = getMeasuredWidth() - getMeasuredWidth() * 0.1f; + float bubbleBottom = getMeasuredHeight() * 0.32f; + rectF.set(bubbleLeft, bubbleTop, bubbleRight, bubbleBottom); + } - Paint paint = outBubblePaintSecond; - if (currentType == TYPE_DEFAULT) { - canvas.drawRoundRect(rectF, rectF.height() * 0.5f, rectF.height() * 0.5f, paint); - } else { - messageDrawableOut.setBounds((int) rectF.left, (int) rectF.top - AndroidUtilities.dp(2), (int) rectF.right + AndroidUtilities.dp(4), (int) rectF.bottom + AndroidUtilities.dp(2)); - messageDrawableOut.setRoundRadius((int) (rectF.height() * 0.5f)); - messageDrawableOut.draw(canvas, paint); - } + Paint paint = outBubblePaintSecond; + if (currentType == TYPE_DEFAULT) { + canvas.drawRoundRect(rectF, rectF.height() * 0.5f, rectF.height() * 0.5f, paint); + } else { + messageDrawableOut.setBounds((int) rectF.left, (int) rectF.top - AndroidUtilities.dp(2), (int) rectF.right + AndroidUtilities.dp(4), (int) rectF.bottom + AndroidUtilities.dp(2)); + messageDrawableOut.setRoundRadius((int) (rectF.height() * 0.5f)); + messageDrawableOut.draw(canvas, paint); + } - if (currentType == TYPE_DEFAULT) { - bubbleLeft = INNER_RECT_SPACE + AndroidUtilities.dp(5); - bubbleTop += BUBBLE_HEIGHT + AndroidUtilities.dp(4); - rectF.set(bubbleLeft, bubbleTop, bubbleLeft + BUBBLE_WIDTH, bubbleTop + BUBBLE_HEIGHT); - } else { - bubbleTop = getMeasuredHeight() * 0.35f; - bubbleLeft = getMeasuredWidth() * 0.1f; - float bubbleRight = getMeasuredWidth() * 0.65f; - float bubbleBottom = getMeasuredHeight() * 0.55f; - rectF.set(bubbleLeft, bubbleTop, bubbleRight, bubbleBottom); - } + if (currentType == TYPE_DEFAULT) { + bubbleLeft = INNER_RECT_SPACE + AndroidUtilities.dp(5); + bubbleTop += BUBBLE_HEIGHT + AndroidUtilities.dp(4); + rectF.set(bubbleLeft, bubbleTop, bubbleLeft + BUBBLE_WIDTH, bubbleTop + BUBBLE_HEIGHT); + } else { + bubbleTop = getMeasuredHeight() * 0.35f; + bubbleLeft = getMeasuredWidth() * 0.1f; + float bubbleRight = getMeasuredWidth() * 0.65f; + float bubbleBottom = getMeasuredHeight() * 0.55f; + rectF.set(bubbleLeft, bubbleTop, bubbleRight, bubbleBottom); + } - if (currentType == TYPE_DEFAULT) { - canvas.drawRoundRect(rectF, rectF.height() * 0.5f, rectF.height() * 0.5f, inBubblePaint); - } else { - messageDrawableIn.setBounds((int) rectF.left - AndroidUtilities.dp(4), (int) rectF.top - AndroidUtilities.dp(2), (int) rectF.right, (int) rectF.bottom + AndroidUtilities.dp(2)); - messageDrawableIn.setRoundRadius((int) (rectF.height() * 0.5f)); - messageDrawableIn.draw(canvas, inBubblePaint); + if (currentType == TYPE_DEFAULT) { + canvas.drawRoundRect(rectF, rectF.height() * 0.5f, rectF.height() * 0.5f, inBubblePaint); + } else { + messageDrawableIn.setBounds((int) rectF.left - AndroidUtilities.dp(4), (int) rectF.top - AndroidUtilities.dp(2), (int) rectF.right, (int) rectF.bottom + AndroidUtilities.dp(2)); + messageDrawableIn.setRoundRadius((int) (rectF.height() * 0.5f)); + messageDrawableIn.draw(canvas, inBubblePaint); + } } } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/TranslateAlert.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/TranslateAlert.java new file mode 100644 index 000000000..40ed55b75 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/TranslateAlert.java @@ -0,0 +1,1588 @@ +package org.telegram.ui.Components; + +import static org.telegram.messenger.AndroidUtilities.dp; +import static org.telegram.messenger.AndroidUtilities.lerp; + +import android.animation.Animator; +import android.animation.ValueAnimator; +import android.app.Dialog; +import android.content.Context; +import android.content.res.Resources; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Insets; +import android.graphics.LinearGradient; +import android.graphics.Paint; +import android.graphics.Path; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffColorFilter; +import android.graphics.RectF; +import android.graphics.Rect; +import android.graphics.Region; +import android.graphics.Shader; +import android.graphics.drawable.ColorDrawable; +import android.graphics.drawable.Drawable; +import android.net.Uri; +import android.os.Build; +import android.os.Bundle; +import android.os.SystemClock; +import android.text.Layout; +import android.text.Spannable; +import android.text.SpannableStringBuilder; +import android.text.Spanned; +import android.text.StaticLayout; +import android.text.TextPaint; +import android.text.TextUtils; +import android.text.method.LinkMovementMethod; +import android.text.style.CharacterStyle; +import android.text.style.ClickableSpan; +import android.text.style.ForegroundColorSpan; +import android.text.style.URLSpan; +import android.text.util.Linkify; +import android.util.Log; +import android.util.TypedValue; +import android.view.ActionMode; +import android.view.Gravity; +import android.view.Menu; +import android.view.MenuItem; +import android.view.MotionEvent; +import android.view.VelocityTracker; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; +import android.view.WindowInsets; +import android.view.WindowManager; +import android.widget.FrameLayout; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.ScrollView; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.annotation.NonNull; +import androidx.core.graphics.ColorUtils; +import androidx.core.widget.NestedScrollView; + +//import com.google.android.gms.vision.Frame; + +import org.json.JSONArray; +import org.json.JSONObject; +import org.json.JSONTokener; +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.Emoji; +import org.telegram.messenger.FileLog; +import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MessageObject; +import org.telegram.messenger.R; +import org.telegram.messenger.browser.Browser; +import org.telegram.tgnet.TLRPC; +import org.telegram.ui.ActionBar.ActionBar; +import org.telegram.ui.ActionBar.BackDrawable; +import org.telegram.ui.ActionBar.BaseFragment; +import org.telegram.ui.ActionBar.BottomSheet; +import org.telegram.ui.ActionBar.Theme; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.Reader; +import java.lang.reflect.Field; +import java.net.HttpURLConnection; +import java.net.URI; +import java.net.URL; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; + +public class TranslateAlert extends Dialog { + private FrameLayout statusBar; + private FrameLayout contentView; + private FrameLayout container; + private TextView titleView; + private LinearLayout subtitleView; + private LoadingTextView subtitleFromView; + private ImageView subtitleArrowView; + private TextView subtitleToView; + private ImageView backButton; + private FrameLayout header; + private FrameLayout headerShadowView; + private boolean scrollViewScrollable = false; + private NestedScrollView scrollView; + private LinearLayout textsView; + private TextView translateMoreView; + private TextView buttonTextView; + private FrameLayout buttonView; + private FrameLayout buttonShadowView; + private TextView allTextsView; + private FrameLayout textsContainerView; + private FrameLayout allTextsContainer; + + private FrameLayout.LayoutParams titleLayout; + private FrameLayout.LayoutParams subtitleLayout; + private FrameLayout.LayoutParams backLayout; + private FrameLayout.LayoutParams headerLayout; + private FrameLayout.LayoutParams scrollViewLayout; + + private int blockIndex = 0; + private ArrayList textBlocks; + + private float containerOpenAnimationT = 0f; + private float openAnimationT = 0f; + private void openAnimation(float t) { + t = Math.min(Math.max(t, 0), 1); + containerOpenAnimationT = t; + container.forceLayout(); + + titleView.setScaleX(lerp(1f, 0.9473f, t)); + titleView.setScaleY(lerp(1f, 0.9473f, t)); + titleLayout.topMargin = dp(lerp(22, 8, t)); + titleLayout.leftMargin = dp(lerp(22, 72, t)); + titleView.setLayoutParams(titleLayout); +// +// statusBar.setAlpha(Math.max(0, (t - .8f) / .2f)); +// statusBar.setTranslationY(Math.max(0, (1f - (t - .9f) / .1f) * dp(48))); +// statusBar.setScaleY(Math.max(0, (t - .8f) / .2f)); + + subtitleLayout.topMargin = dp(lerp(47, 30, t)) - LoadingTextView.padVert; + subtitleLayout.leftMargin = dp(lerp(22, 72, t)) - LoadingTextView.padHorz; + subtitleView.setLayoutParams(subtitleLayout); + + backButton.setAlpha(t); + backButton.setScaleX(.75f + .25f * t); + backButton.setScaleY(.75f + .25f * t); + backButton.setClickable(t > .5f); + headerShadowView.setAlpha(scrollView.getScrollY() > 0 ? 1f : t); + + headerLayout.height = (int) lerp(dp(70), dp(56), t); + header.setLayoutParams(headerLayout); + + scrollViewLayout.topMargin = (int) lerp(dp(70), dp(56), t); + scrollView.setLayoutParams(scrollViewLayout); +// allTextsView.setTextIsSelectable(t >= 1f); +// for (int i = 0; i < textsView.getChildCount(); ++i) { +// View child = textsView.getChildAt(i); +// if (child instanceof LoadingTextView) +// ((LoadingTextView) child).setTextIsSelectable(t >= 1f); +// } + } + private boolean openAnimationToAnimatorPriority = false; + private ValueAnimator openAnimationToAnimator = null; + private void openAnimationTo(float to, boolean priority) { + if (openAnimationToAnimatorPriority && !priority) + return; + openAnimationToAnimatorPriority = priority; + to = Math.min(Math.max(to, 0), 1); + if (openAnimationToAnimator != null) + openAnimationToAnimator.cancel(); + openAnimationToAnimator = ValueAnimator.ofFloat(containerOpenAnimationT, to); + openAnimationToAnimator.addUpdateListener(a -> openAnimation((float) a.getAnimatedValue())); + openAnimationToAnimator.addListener(new Animator.AnimatorListener() { + @Override public void onAnimationStart(Animator animator) { } + @Override public void onAnimationRepeat(Animator animator) { } + + @Override + public void onAnimationEnd(Animator animator) { + openAnimationToAnimatorPriority = false; + } + + @Override + public void onAnimationCancel(Animator animator) { + openAnimationToAnimatorPriority = false; + } + }); + openAnimationToAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT); + openAnimationToAnimator.setDuration(220); + openAnimationToAnimator.start(); + if (to >= .5 && blockIndex <= 1) + fetchNext(); + } + + private int textsViewMinHeight = 0; + private int minHeight() { + return (textsView == null ? 0 : textsView.getMeasuredHeight()) + dp( + 66 + // header + 1 + // button separator + 16 + // button top padding + 48 + // button + 16 // button bottom padding + ); + } + private boolean canExpand() { + return ( + textsView.getChildCount() < textBlocks.size() || + minHeight() >= Math.min(dp(550), AndroidUtilities.displayMetrics.heightPixels / 2) //|| +// (scrollView.canScrollVertically(1) || scrollView.canScrollVertically(-1)) + ); + } + private void updateCanExpand() { + boolean canExpand = canExpand(); + if (containerOpenAnimationT > 0f && !canExpand) + openAnimationTo(0f, false); + + buttonShadowView.animate().alpha(canExpand ? 1f : 0f).setDuration((long) (Math.abs(buttonShadowView.getAlpha() - (canExpand ? 1f : 0f)) * 220)).start(); + } + + private int scrollShouldBe = -1; + private boolean allowScroll = true; + private ValueAnimator scrollerToBottom = null; + private String fromLanguage, toLanguage; + private CharSequence text; + private BaseFragment fragment; + private boolean noforwards; + public TranslateAlert(BaseFragment fragment, Context context, String fromLanguage, String toLanguage, CharSequence text, boolean noforwards) { + super(context, R.style.TransparentDialog); + + this.noforwards = noforwards; + this.fragment = fragment; + this.fromLanguage = fromLanguage != null && fromLanguage.equals("und") ? "auto" : fromLanguage; + this.toLanguage = toLanguage; + this.text = text; + this.textBlocks = cutInBlocks(text, 1024); + + if (Build.VERSION.SDK_INT >= 30) { + getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + } else if (Build.VERSION.SDK_INT >= 21) { + getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + } + + contentView = new FrameLayout(context); + contentView.setBackground(backDrawable); + contentView.setClipChildren(false); + contentView.setClipToPadding(false); + if (Build.VERSION.SDK_INT >= 21) { + contentView.setFitsSystemWindows(true); + if (Build.VERSION.SDK_INT >= 30) { + contentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION); + } else { + contentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); + } + } + +// statusBar = new FrameLayout(context) { +// @Override +// protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { +// int fullWidth = MeasureSpec.getSize(widthMeasureSpec); +// super.onMeasure( +// MeasureSpec.makeMeasureSpec( +// (int) Math.max(fullWidth * 0.8f, Math.min(dp(480), fullWidth)), +// MeasureSpec.getMode(widthMeasureSpec) +// ), +// heightMeasureSpec +// ); +// } +// }; +// statusBar.setBackgroundColor(Theme.getColor(Theme.key_chat_attachEmptyImage)); +// statusBar.setPivotY(AndroidUtilities.statusBarHeight); +// contentView.addView(statusBar, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, AndroidUtilities.statusBarHeight / AndroidUtilities.density, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, -AndroidUtilities.statusBarHeight / AndroidUtilities.density, 0, 0)); + + Paint containerPaint = new Paint(); + containerPaint.setColor(Theme.getColor(Theme.key_dialogBackground)); + containerPaint.setShadowLayer(dp(2), 0, dp(-0.66f), 0x1e000000); + container = new FrameLayout(context) { + private int contentHeight = Integer.MAX_VALUE; + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + int fullWidth = MeasureSpec.getSize(widthMeasureSpec); + int fullHeight = MeasureSpec.getSize(widthMeasureSpec); + boolean isPortrait = fullHeight > fullWidth; + int minHeight = (int) Math.min(dp(550), AndroidUtilities.displayMetrics.heightPixels * (isPortrait ? .5f : .85f)); + int fromHeight = Math.min(minHeight, minHeight()); + int height = (int) (fromHeight + (AndroidUtilities.displayMetrics.heightPixels - fromHeight) * containerOpenAnimationT); + updateCanExpand(); + super.onMeasure( + MeasureSpec.makeMeasureSpec( + (int) Math.max(fullWidth * 0.8f, Math.min(dp(480), fullWidth)), + MeasureSpec.getMode(widthMeasureSpec) + ), + MeasureSpec.makeMeasureSpec( + height, + MeasureSpec.EXACTLY + ) + ); + } + + @Override + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { + super.onLayout(changed, left, top, right, bottom); + contentHeight = Math.min(contentHeight, bottom - top); + } + + private Path containerPath = new Path(); + private RectF containerRect = new RectF(); + private RectF rectF = new RectF(); + @Override + protected void onDraw(Canvas canvas) { + int w = getWidth(), h = getHeight(), r = dp(12 * (1f - containerOpenAnimationT)); + canvas.clipRect(0, 0, w, h); + + containerRect.set(0, 0, w, h + r); + canvas.translate(0, (1f - openingT) * h); + +// containerPath.reset(); +// containerPath.moveTo(0, h); +// rectF.set(0, 0, r + r, r + r); +// containerPath.arcTo(rectF, 180, 90); +// rectF.set(w - r - r, 0, w, r + r); +// containerPath.arcTo(rectF, 270, 90); +// containerPath.lineTo(w, h); +// containerPath.close(); +// canvas.drawPath(containerPath, containerPaint); + + canvas.drawRoundRect(containerRect, r, r, containerPaint); + super.onDraw(canvas); + } + }; + container.setWillNotDraw(false); + + header = new FrameLayout(context); + + titleView = new TextView(context); + titleView.setPivotX(LocaleController.isRTL ? titleView.getWidth() : 0); + titleView.setPivotY(0); + titleView.setLines(1); + titleView.setText(LocaleController.getString("AutomaticTranslation", R.string.AutomaticTranslation)); + titleView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); + titleView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); + titleView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack)); + titleView.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp(19)); + header.addView(titleView, titleLayout = LayoutHelper.createFrame( + LayoutHelper.MATCH_PARENT, + LayoutHelper.WRAP_CONTENT, + Gravity.FILL_HORIZONTAL | Gravity.TOP, + 22, 22,22, 0 + )); + titleView.post(() -> { + titleView.setPivotX(LocaleController.isRTL ? titleView.getWidth() : 0); + }); + +// String from = languageName(fromLanguage); +// String to = languageName(toLanguage); +// String subtitleText = LocaleController.formatString("FromLanguageToLanguage", R.string.FromLanguageToLanguage, (from != null ? from : ""), (to != null ? to : "")); + subtitleView = new LinearLayout(context); + subtitleView.setOrientation(LinearLayout.HORIZONTAL); + if (Build.VERSION.SDK_INT >= 17) + subtitleView.setLayoutDirection(LocaleController.isRTL ? View.LAYOUT_DIRECTION_RTL : View.LAYOUT_DIRECTION_LTR); + subtitleView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); + subtitleView.setPadding(0, 0, LoadingTextView.padHorz, 0); + + String fromLanguageName = languageName(fromLanguage); + subtitleFromView = new LoadingTextView(context, fromLanguageName == null ? languageName(toLanguage) : fromLanguageName, false, true); + subtitleFromView.showLoadingText(false); + subtitleFromView.setLines(1); + subtitleFromView.setTextColor(Theme.getColor(Theme.key_player_actionBarSubtitle)); + subtitleFromView.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp(14)); + if (fromLanguageName != null) + subtitleFromView.setText(fromLanguageName); + subtitleView.addView(subtitleFromView, LayoutHelper.createLinear(0, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL)); + subtitleFromView.updateHeight(); + + subtitleArrowView = new ImageView(context); + subtitleArrowView.setImageResource(R.drawable.search_arrow); + subtitleArrowView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_player_actionBarSubtitle), PorterDuff.Mode.MULTIPLY)); + if (LocaleController.isRTL) + subtitleArrowView.setScaleX(-1f); + subtitleView.addView(subtitleArrowView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL, (int) (2 - LoadingTextView.padHorz / AndroidUtilities.density), 1, 3, 0)); + + subtitleToView = new TextView(context); + subtitleToView.setLines(1); + subtitleToView.setTextColor(Theme.getColor(Theme.key_player_actionBarSubtitle)); + subtitleToView.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp(14)); + subtitleToView.setText(languageName(toLanguage)); + subtitleView.addView(subtitleToView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL)); + + header.addView(subtitleView, subtitleLayout = LayoutHelper.createFrame( + LayoutHelper.MATCH_PARENT, + LayoutHelper.WRAP_CONTENT, + Gravity.TOP | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT), + 22 - LoadingTextView.padHorz / AndroidUtilities.density, + 47 - LoadingTextView.padVert / AndroidUtilities.density, + 22 - LoadingTextView.padHorz / AndroidUtilities.density, + 0 + )); + + backButton = new ImageView(context); + backButton.setImageResource(R.drawable.ic_ab_back); + backButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_dialogTextBlack), PorterDuff.Mode.MULTIPLY)); + backButton.setScaleType(ImageView.ScaleType.FIT_CENTER); + backButton.setPadding(AndroidUtilities.dp(16), 0, AndroidUtilities.dp(16), 0); + backButton.setBackground(Theme.createSelectorDrawable(Theme.getColor(Theme.key_dialogButtonSelector))); + backButton.setClickable(false); + backButton.setAlpha(0f); + backButton.setOnClickListener(e -> dismiss()); + header.addView(backButton, backLayout = LayoutHelper.createFrame(56, 56, Gravity.LEFT | Gravity.CENTER_HORIZONTAL)); + + headerShadowView = new FrameLayout(context); + headerShadowView.setBackgroundColor(Theme.getColor(Theme.key_dialogShadowLine)); + headerShadowView.setAlpha(0); + header.addView(headerShadowView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 1, Gravity.BOTTOM | Gravity.FILL_HORIZONTAL)); + + header.setClipChildren(false); + container.addView(header, headerLayout = LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 70, Gravity.FILL_HORIZONTAL | Gravity.TOP)); + + scrollView = new NestedScrollView(context) { + @Override + public boolean onInterceptTouchEvent(MotionEvent ev) { + return allowScroll && containerOpenAnimationT >= 1f && canExpand() && super.onInterceptTouchEvent(ev); + } + + @Override + public void onNestedScroll(@NonNull View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { + super.onNestedScroll(target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); + } + }; +// scrollView.setOnTouchListener(new View.OnTouchListener() { +// @Override +// public boolean onTouch(View view, MotionEvent motionEvent) { +// return allowScroll && containerOpenAnimationT >= 1f; +// } +// }); + scrollView.setClipChildren(true); + + textsView = new LinearLayout(context) { + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(9999999, MeasureSpec.AT_MOST)); + } + }; + textsView.setOrientation(LinearLayout.VERTICAL); + textsView.setPadding(dp(22) - LoadingTextView.padHorz, dp(12) - LoadingTextView.padVert, dp(22) - LoadingTextView.padHorz, dp(12) - LoadingTextView.padVert); + + translateMoreView = new TextView(context); + translateMoreView.setTextColor(Theme.getColor(Theme.key_dialogTextBlue)); + translateMoreView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); + translateMoreView.setText(LocaleController.getString("TranslateMore", R.string.TranslateMore)); + translateMoreView.setVisibility(textBlocks.size() > 1 ? View.INVISIBLE : View.GONE); + translateMoreView.getPaint().setAntiAlias(true); + translateMoreView.getPaint().setFlags(Paint.ANTI_ALIAS_FLAG); + translateMoreView.setBackgroundDrawable(Theme.createRadSelectorDrawable(Theme.getColor(Theme.key_dialogLinkSelection), dp(1), dp(1))); + translateMoreView.setOnClickListener(e -> { + boolean atBottom = (scrollView.getScrollY() >= scrollView.computeVerticalScrollRange() - scrollView.computeVerticalScrollExtent()); + + + openAnimationTo(1f, true); + fetchNext(); + + if (containerOpenAnimationT >= 1f && canExpand()/* && atBottom*/) { + if (scrollerToBottom != null) { + scrollerToBottom.cancel(); + scrollerToBottom = null; + } + allowScroll = false; + scrollView.stopNestedScroll(); + scrollerToBottom = ValueAnimator.ofFloat(0f, 1f); + int fromScroll = scrollView.getScrollY(); + scrollerToBottom.addUpdateListener(a -> { + scrollView.setScrollY((int) (fromScroll + dp(150) * (float) a.getAnimatedValue())); + }); + scrollerToBottom.addListener(new Animator.AnimatorListener() { + @Override public void onAnimationRepeat(Animator animator) {} + @Override public void onAnimationStart(Animator animator) {} + @Override public void onAnimationEnd(Animator animator) { + allowScroll = true; + } + @Override public void onAnimationCancel(Animator animator) { + allowScroll = true; + } + }); + scrollerToBottom.setDuration(220); + scrollerToBottom.start(); + } + }); + translateMoreView.setPadding(LoadingTextView.padHorz, LoadingTextView.padVert, LoadingTextView.padHorz, LoadingTextView.padVert); + textsView.addView(translateMoreView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT,0, 0, 0, 0)); + + Paint selectionPaint = new Paint(); + selectionPaint.setColor(Theme.getColor(Theme.key_chat_inTextSelectionHighlight)); + allTextsContainer = new FrameLayout(context) { + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(textsContainerView.getMeasuredHeight(), MeasureSpec.AT_MOST)); + } + }; + allTextsContainer.setClipChildren(false); + allTextsContainer.setClipToPadding(false); + allTextsContainer.setPadding(dp(22), dp(12), dp(22), dp(12)); + + allTextsView = new TextView(context) { + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(999999, MeasureSpec.AT_MOST)); + } + private Paint pressedLinkPaint = null; + private Path pressedLinkPath = new Path() { + private RectF rectF = new RectF(); + @Override + public void addRect(float left, float top, float right, float bottom, @NonNull Direction dir) { +// super.addRect(left, top, right, bottom, dir); + rectF.set(left - LoadingTextView.padHorz / 2, top - LoadingTextView.padVert, right + LoadingTextView.padHorz / 2, bottom + LoadingTextView.padVert); + addRoundRect(rectF, dp(4), dp(4), Direction.CW); + } + }; + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + if (pressedLink != null) { + try { + Layout layout = getLayout(); + int start = allTexts.getSpanStart(pressedLink); + int end = allTexts.getSpanEnd(pressedLink); + layout.getSelectionPath(start, end, pressedLinkPath); + + if (pressedLinkPaint == null) { + pressedLinkPaint = new Paint(); + pressedLinkPaint.setColor(Theme.getColor(Theme.key_chat_linkSelectBackground)); + } + canvas.drawPath(pressedLinkPath, pressedLinkPaint); + } catch (Exception e) { } + } + } + }; + allTextsView.setTextColor(0x00000000); + allTextsView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); + allTextsView.setTextIsSelectable(!noforwards); + allTextsView.setHighlightColor(Theme.getColor(Theme.key_chat_inTextSelectionHighlight)); + int handleColor = Theme.getColor(Theme.key_chat_TextSelectionCursor); + try { + if (Build.VERSION.SDK_INT >= 29) { + Drawable left = allTextsView.getTextSelectHandleLeft(); + left.setColorFilter(handleColor, PorterDuff.Mode.SRC_IN); + allTextsView.setTextSelectHandleLeft(left); + + Drawable right = allTextsView.getTextSelectHandleRight(); + right.setColorFilter(handleColor, PorterDuff.Mode.SRC_IN); + allTextsView.setTextSelectHandleRight(right); + } + } catch (Exception e) {} + allTextsView.setMovementMethod(new LinkMovementMethod()); + allTextsContainer.addView(allTextsView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); + + textsContainerView = new FrameLayout(context); + textsContainerView.addView(allTextsContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); + textsContainerView.addView(textsView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); + + scrollView.addView(textsContainerView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 1f)); + + container.addView(scrollView, scrollViewLayout = LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.FILL, 0, 70, 0, 81)); + + translateMoreView.bringToFront(); + fetchNext(); + + buttonShadowView = new FrameLayout(context); + buttonShadowView.setBackgroundColor(Theme.getColor(Theme.key_dialogShadowLine)); + container.addView(buttonShadowView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 1, Gravity.BOTTOM | Gravity.FILL_HORIZONTAL, 0, 0, 0, 80)); + + buttonTextView = new TextView(context); + buttonTextView.setLines(1); + buttonTextView.setSingleLine(true); + buttonTextView.setGravity(Gravity.CENTER_HORIZONTAL); + buttonTextView.setEllipsize(TextUtils.TruncateAt.END); + buttonTextView.setGravity(Gravity.CENTER); + buttonTextView.setTextColor(Theme.getColor(Theme.key_featuredStickers_buttonText)); + buttonTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); + buttonTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + buttonTextView.setText(LocaleController.getString("CloseTranslation", R.string.CloseTranslation)); + + buttonView = new FrameLayout(context); + buttonView.setBackground(Theme.createSimpleSelectorRoundRectDrawable(AndroidUtilities.dp(4), Theme.getColor(Theme.key_featuredStickers_addButton), Theme.getColor(Theme.key_featuredStickers_addButtonPressed))); + buttonView.addView(buttonTextView); + buttonView.setOnClickListener(e -> dismiss()); + + container.addView(buttonView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.BOTTOM, 16, 16, 16, 16)); + contentView.addView(container, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL)); + +// setUseLightStatusBar(true); + } + + + private void setScrollY(float t) { + openAnimation(t); + openingT = Math.max(Math.min(1f + t, 1), 0); + backDrawable.setAlpha((int) (openingT * 51)); + container.invalidate(); + } + private void scrollYTo(float t) { + openAnimationTo(t, false); + openTo(1f + t, false); + } + private float fromScrollY = 0; + private float getScrollY() { + return Math.max(Math.min(containerOpenAnimationT - (1 - openingT), 1), 0); + } + + private boolean hasSelection() { + return allTextsView.hasSelection(); + } + + private Rect containerRect = new Rect(); + private Rect textRect = new Rect(); + private Rect translateMoreRect = new Rect(); + private Rect buttonRect = new Rect(); + private Rect backRect = new Rect(); + private Rect scrollRect = new Rect(); + private float fromY = 0; + private boolean pressedOutside = false; + private boolean maybeScrolling = false; + private boolean scrolling = false; + private boolean fromScrollRect = false; + private boolean fromTranslateMoreView = false; + private float fromScrollViewY = 0; + private Spannable allTexts; + private ClickableSpan pressedLink; + @Override + public boolean dispatchTouchEvent(@NonNull MotionEvent event) { + try { + float x = event.getX(); + float y = event.getY(); + container.invalidate(); + + container.getGlobalVisibleRect(containerRect); + if (!containerRect.contains((int) x, (int) y)) { + if (event.getAction() == MotionEvent.ACTION_DOWN) { + pressedOutside = true; + return true; + } else if (event.getAction() == MotionEvent.ACTION_UP) { + if (pressedOutside) { + pressedOutside = false; + dismiss(); + return true; + } + } + } + + allTextsContainer.getGlobalVisibleRect(textRect); + if (textRect.contains((int) x, (int) y) && !scrolling) { + Layout allTextsLayout = allTextsView.getLayout(); + int tx = (int) (x - allTextsView.getLeft() - container.getLeft()), + ty = (int) (y - allTextsView.getTop() - container.getTop() - scrollView.getTop() + scrollView.getScrollY()); + final int line = allTextsLayout.getLineForVertical(ty); + final int off = allTextsLayout.getOffsetForHorizontal(line, tx); + + final float left = allTextsLayout.getLineLeft(line); + if (allTexts != null && allTexts instanceof Spannable && left <= tx && left + allTextsLayout.getLineWidth(line) >= tx) { + ClickableSpan[] links = allTexts.getSpans(off, off, ClickableSpan.class); + if (links != null && links.length >= 1) { + if (event.getAction() == MotionEvent.ACTION_UP && pressedLink == links[0]) { + pressedLink.onClick(allTextsView); + pressedLink = null; + allTextsView.setTextIsSelectable(!noforwards); + } else if (event.getAction() == MotionEvent.ACTION_DOWN) { + pressedLink = links[0]; + } + allTextsView.invalidate(); + // return super.dispatchTouchEvent(event) || true; + return true; + } else if (pressedLink != null) { + allTextsView.invalidate(); + pressedLink = null; + } + } else if (pressedLink != null) { + allTextsView.invalidate(); + pressedLink = null; + } + } else if (pressedLink != null) { + allTextsView.invalidate(); + pressedLink = null; + } + + scrollView.getGlobalVisibleRect(scrollRect); + backButton.getGlobalVisibleRect(backRect); + buttonView.getGlobalVisibleRect(buttonRect); + translateMoreView.getGlobalVisibleRect(translateMoreRect); + fromTranslateMoreView = translateMoreRect.contains((int) x, (int) y); + if (pressedLink == null && /*!(scrollRect.contains((int) x, (int) y) && !canExpand() && containerOpenAnimationT < .5f && !scrolling) &&*/ !fromTranslateMoreView && !hasSelection()) { + if ( + !backRect.contains((int) x, (int) y) && + !buttonRect.contains((int) x, (int) y) && + event.getAction() == MotionEvent.ACTION_DOWN + ) { + fromScrollRect = scrollRect.contains((int) x, (int) y) && (containerOpenAnimationT > 0 || !canExpand()); + maybeScrolling = true; + scrolling = false; + fromY = y; + fromScrollY = getScrollY(); + fromScrollViewY = scrollView.getScrollY(); + return super.dispatchTouchEvent(event) || true; + } else if (maybeScrolling && (event.getAction() == MotionEvent.ACTION_MOVE || event.getAction() == MotionEvent.ACTION_UP)) { + float dy = fromY - y; + if (fromScrollRect) { + dy = -Math.max(0, -(fromScrollViewY + dp(48)) - dy); + if (dy < 0) { + scrolling = true; + allTextsView.setTextIsSelectable(false); + } + } else if (Math.abs(dy) > dp(4) && !fromScrollRect) { + scrolling = true; + allTextsView.setTextIsSelectable(false); + scrollView.stopNestedScroll(); + allowScroll = false; + } + float fullHeight = AndroidUtilities.displayMetrics.heightPixels, + minHeight = Math.min(fullHeight, Math.min(dp(550), fullHeight * .5f)); + float scrollYPx = minHeight * (1f - -Math.min(Math.max(fromScrollY, -1), 0)) + + (fullHeight - minHeight) * Math.min(1, Math.max(fromScrollY, 0)) + dy; + float scrollY = scrollYPx > minHeight ? (scrollYPx - minHeight) / (fullHeight - minHeight) : -(1f - scrollYPx / minHeight); + if (!canExpand()) + scrollY = Math.min(scrollY, 0); + updateCanExpand(); + + if (scrolling) { + setScrollY(scrollY); + if (event.getAction() == MotionEvent.ACTION_UP) { + scrolling = false; + allTextsView.setTextIsSelectable(!noforwards); + maybeScrolling = false; + allowScroll = true; + scrollYTo( + Math.abs(dy) > dp(16) ? + /*fromScrollRect && Math.ceil(fromScrollY) >= 1f ? -1f :*/ Math.round(fromScrollY) + (scrollY > fromScrollY ? 1f : -1f) * (float) Math.ceil(Math.abs(fromScrollY - scrollY)) : + Math.round(fromScrollY) + ); + } + // if (fromScrollRect) + // return super.dispatchTouchEvent(event) || true; + return true; + } + } + } + if (hasSelection() && maybeScrolling) { + scrolling = false; + allTextsView.setTextIsSelectable(!noforwards); + maybeScrolling = false; + allowScroll = true; + scrollYTo(Math.round(fromScrollY)); + } + return super.dispatchTouchEvent(event); + } catch (Exception e) { + return super.dispatchTouchEvent(event); + } + } + + private LoadingTextView addBlock(CharSequence startText, boolean scaleFromZero) { + LoadingTextView textView = new LoadingTextView(getContext(), startText, scaleFromZero, false) { + @Override + protected void onLoadEnd() { + scrollView.postDelayed(() -> { + allTextsView.setText(allTexts); + }, textBlocks.size() > 1 ? 700 : 0); + } + }; + textView.setLines(0); + textView.setMaxLines(0); + textView.setSingleLine(false); + textView.setEllipsizeNull(); + textView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack)); + textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); + textView.setTextIsSelectable(false); + textView.setTranslationY((textsView.getChildCount() - 1) * (LoadingTextView.padVert * -4f + dp(.48f))); + textsView.addView(textView, textsView.getChildCount() - 1, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, 0, 0, 0, 0, 0)); + return textView; + } + + private float openingT = 0f; + private ValueAnimator openingAnimator; + +// protected boolean useLightStatusBar = true; +// protected boolean useLightNavBar; +// public void setUseLightStatusBar(boolean value) { +// useLightStatusBar = value; +// if (Build.VERSION.SDK_INT >= 23) { +// int color = Theme.getColor(Theme.key_actionBarDefault, null, true); +// int flags = contentView.getSystemUiVisibility(); +// if (useLightStatusBar && color == 0xffffffff) { +// flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; +// } else { +// flags &=~ View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; +// } +// contentView.setSystemUiVisibility(flags); +// } +// } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); +// +// if (useLightStatusBar && Build.VERSION.SDK_INT >= 23) { +// int color = Theme.getColor(Theme.key_actionBarDefault, null, true); +// if (color == 0xffffffff) { +// int flags = contentView.getSystemUiVisibility(); +// flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; +// contentView.setSystemUiVisibility(flags); +// } +// } +// if (useLightNavBar && Build.VERSION.SDK_INT >= 26) { +// AndroidUtilities.setLightNavigationBar(getWindow(), false); +// } + + contentView.setPadding(0, 0, 0, 0); + setContentView(contentView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); +// int flags = contentView.getSystemUiVisibility(); +// flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; +// contentView.setSystemUiVisibility(flags); + + Window window = getWindow(); + + window.setWindowAnimations(R.style.DialogNoAnimation); + WindowManager.LayoutParams params = window.getAttributes(); + params.width = ViewGroup.LayoutParams.MATCH_PARENT; + params.gravity = Gravity.TOP | Gravity.LEFT; + params.dimAmount = 0; + params.flags &= ~WindowManager.LayoutParams.FLAG_DIM_BEHIND; + params.flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; + if (Build.VERSION.SDK_INT >= 21) { + params.flags |= WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | + WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR | + WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS; + } + params.flags |= WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN; + params.height = ViewGroup.LayoutParams.MATCH_PARENT; +// if (Build.VERSION.SDK_INT >= 28) { +// params.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; +// } + window.setAttributes(params); + + + container.forceLayout(); + } + + protected ColorDrawable backDrawable = new ColorDrawable(0xff000000) { + @Override + public void setAlpha(int alpha) { + super.setAlpha(alpha); + container.invalidate(); + } + }; + @Override + public void show() { + super.show(); + + openAnimation(0); + openTo(1, true, true); + } + + private boolean dismissed = false; + @Override + public void dismiss() { + if (dismissed) + return; + dismissed = true; + + openTo(0, true); + } + private void openTo(float t, boolean priority) { + openTo(t, priority, false); + } + private void openTo(float t) { + openTo(t, false); + } + private boolean openingAnimatorPriority = false; + private void openTo(float t, boolean priority, boolean setAfter) { + final float T = Math.min(Math.max(t, 0), 1); + if (openingAnimatorPriority && !priority) + return; + openingAnimatorPriority = priority; + if (openingAnimator != null) + openingAnimator.cancel(); + openingAnimator = ValueAnimator.ofFloat(openingT, T); + backDrawable.setAlpha((int) (openingT * 51)); + openingAnimator.addUpdateListener(a -> { + openingT = (float) a.getAnimatedValue(); + container.invalidate(); + backDrawable.setAlpha((int) (openingT * 51)); + }); + openingAnimator.addListener(new Animator.AnimatorListener() { + @Override public void onAnimationCancel(Animator animator) { + if (T <= 0f) + dismissInternal(); + else if (setAfter) { + allTextsView.setTextIsSelectable(!noforwards); + allTextsView.invalidate(); + scrollView.stopNestedScroll(); + openAnimation(T - 1f); + } + openingAnimatorPriority = false; + } + @Override public void onAnimationEnd(Animator animator) { + if (T <= 0f) + dismissInternal(); + else if (setAfter) { + allTextsView.setTextIsSelectable(!noforwards); + allTextsView.invalidate(); + scrollView.stopNestedScroll(); + openAnimation(T - 1f); + } + openingAnimatorPriority = false; + } + @Override public void onAnimationRepeat(Animator animator) { } + @Override public void onAnimationStart(Animator animator) { } + }); + openingAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT); + openingAnimator.setDuration((long) (Math.abs(openingT - T) * (setAfter ? 380 : 200))); + openingAnimator.setStartDelay(setAfter ? 60 : 0); + openingAnimator.start(); + } + public void dismissInternal() { + try { + super.dismiss(); + } catch (Exception e) { + FileLog.e(e); + } + } + + public String languageName(String locale) { + if (locale == null || locale.equals("und") || locale.equals("auto")) + return null; +// if (locale != null && !locale.equals("und") && !locale.equals("auto")) { +// String passportLang = LocaleController.getString("PassportLanguage_" + locale.toUpperCase()); +// if (passportLang != null && passportLang.length() > 0) +// return passportLang; +// } + LocaleController.LocaleInfo localeInfo = LocaleController.getInstance().getLanguageByPlural(locale); + boolean isCurrentLanguageEnglish = false; + try { + isCurrentLanguageEnglish = LocaleController.getInstance().getCurrentLocaleInfo().pluralLangCode.equals("en"); + } catch (Exception e) {} + if (localeInfo != null && ((isCurrentLanguageEnglish && localeInfo.nameEnglish != null) || (!isCurrentLanguageEnglish && localeInfo.name != null))) + return isCurrentLanguageEnglish ? localeInfo.nameEnglish : localeInfo.name; + return null; + } + + public void updateSourceLanguage() { + if (languageName(fromLanguage) != null) { + subtitleView.setAlpha(1); + subtitleFromView.setText(languageName(fromLanguage)); + } else if (loaded) { + subtitleView.animate().alpha(0).setDuration(150).start(); + } + } + + private ArrayList cutInBlocks(CharSequence full, int maxBlockSize) { + ArrayList blocks = new ArrayList<>(); + if (full == null) + return blocks; + while (full.length() > maxBlockSize) { + String maxBlockStr = full.subSequence(0, maxBlockSize).toString(); + int n = -1; + if (n == -1) n = maxBlockStr.lastIndexOf("\n\n"); + if (n == -1) n = maxBlockStr.lastIndexOf("\n"); + if (n == -1) n = maxBlockStr.lastIndexOf(". "); + blocks.add(full.subSequence(0, n + 1)); + full = full.subSequence(n + 1, full.length()); + } + if (full.length() > 0) + blocks.add(full); + return blocks; + } + + + public void showTranslateMoreView(boolean show) { + translateMoreView.setClickable(show); + translateMoreView.setVisibility(textBlocks.size() > 1 ? View.VISIBLE : View.GONE); + translateMoreView + .animate() +// .translationX(show ? 0f : dp(4)) + .alpha(show ? 1f : 0f) + .withEndAction(() -> { + if (!show) + translateMoreView.setVisibility(textBlocks.size() > 1 ? View.INVISIBLE : View.GONE); + }) + .setInterpolator(CubicBezierInterpolator.EASE_OUT) + .setDuration((long) (Math.abs(translateMoreView.getAlpha() - (show ? 1f : 0f)) * 85)) + .start(); + } + + private boolean loading = false; + private boolean loaded = false; + private void fetchNext() { + if (loading) + return; + loading = true; + + showTranslateMoreView(false); + if (blockIndex >= textBlocks.size()) + return; + + CharSequence blockText = textBlocks.get(blockIndex); + LoadingTextView blockView = addBlock(blockText, blockIndex != 0); + + fetchTranslation( + blockText, + (String translatedText, String sourceLanguage) -> { + loaded = true; + Spannable spannable = new SpannableStringBuilder(translatedText); + try { + AndroidUtilities.addLinks(spannable, Linkify.WEB_URLS); + MessageObject.addUrlsByPattern(false, spannable, false, 0, 0, true); + URLSpan[] urlSpans = spannable.getSpans(0, spannable.length(), URLSpan.class); + for (int i = 0; i < urlSpans.length; ++i) { + URLSpan urlSpan = urlSpans[i]; + int start = spannable.getSpanStart(urlSpan), + end = spannable.getSpanEnd(urlSpan); + spannable.removeSpan(urlSpan); + spannable.setSpan( + new ClickableSpan() { + @Override + public void onClick(@NonNull View view) { + AlertsCreator.showOpenUrlAlert(fragment, urlSpan.getURL(), false, false); + } + + @Override + public void updateDrawState(@NonNull TextPaint ds) { + int alpha = Math.min(ds.getAlpha(), ds.getColor() >> 24 & 0xff); + ds.setUnderlineText(true); + ds.setColor(Theme.getColor(Theme.key_dialogTextLink)); + ds.setAlpha(alpha); + } + }, + start, end, + Spanned.SPAN_EXCLUSIVE_EXCLUSIVE + ); + } + } catch (Exception e) { + e.printStackTrace(); + } + blockView.setText(spannable); + allTexts = new SpannableStringBuilder(allTextsView.getText()).append(blockIndex == 0 ? "" : "\n").append(spannable); + + fromLanguage = sourceLanguage; + updateSourceLanguage(); + + blockIndex++; + showTranslateMoreView(blockIndex < textBlocks.size()); + loading = false; + + }, + (boolean rateLimit) -> { + if (rateLimit) + Toast.makeText(getContext(), LocaleController.getString("TranslationFailedAlert1", R.string.TranslationFailedAlert1), Toast.LENGTH_SHORT).show(); + else + Toast.makeText(getContext(), LocaleController.getString("TranslationFailedAlert2", R.string.TranslationFailedAlert2), Toast.LENGTH_SHORT).show(); + if (blockIndex == 0) + dismiss(); + } + ); + } + + private String[] userAgents = new String[] { + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36", // 13.5% + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36", // 6.6% + "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0", // 6.4% + "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0", // 6.2% + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36", // 5.2% + "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36" // 4.8% + }; + public interface OnTranslationSuccess { + public void run(String translated, String sourceLanguage); + } + public interface OnTranslationFail { + public void run(boolean rateLimit); + } + private long minFetchingDuration = 1000; + private void fetchTranslation(CharSequence text, OnTranslationSuccess onSuccess, OnTranslationFail onFail) { + new Thread() { + @Override + public void run() { + String uri = ""; + HttpURLConnection connection = null; + long start = SystemClock.elapsedRealtime(); + try { + uri = "https://translate.goo"; + uri += "gleapis.com/transl"; + uri += "ate_a"; + uri += "/singl"; + uri += "e?client=gtx&sl=" + Uri.encode(fromLanguage) + "&tl=" + Uri.encode(toLanguage) + "&dt=t" + "&ie=UTF-8&oe=UTF-8&otf=1&ssel=0&tsel=0&kc=7&dt=at&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&q="; + uri += Uri.encode(text.toString()); + connection = (HttpURLConnection) new URI(uri).toURL().openConnection(); + connection.setRequestMethod("GET"); + connection.setRequestProperty("User-Agent", userAgents[(int) Math.round(Math.random() * (userAgents.length - 1))]); + connection.setRequestProperty("Content-Type", "application/json"); + + StringBuilder textBuilder = new StringBuilder(); + try (Reader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), Charset.forName("UTF-8")))) { + int c = 0; + while ((c = reader.read()) != -1) { + textBuilder.append((char) c); + } + } + String jsonString = textBuilder.toString(); + + JSONTokener tokener = new JSONTokener(jsonString); + JSONArray array = new JSONArray(tokener); + JSONArray array1 = array.getJSONArray(0); + String sourceLanguage = null; + try { + sourceLanguage = array.getString(2); + } catch (Exception e2) {} + if (sourceLanguage != null && sourceLanguage.contains("-")) { + sourceLanguage = sourceLanguage.substring(0, sourceLanguage.indexOf("-")); + } + String result = ""; + for (int i = 0; i < array1.length(); ++i) { + String blockText = array1.getJSONArray(i).getString(0); + if (blockText != null && !blockText.equals("null")) + result += /*(i > 0 ? "\n" : "") +*/ blockText; + } + if (text.length() > 0 && text.charAt(0) == '\n') + result = "\n" + result; + final String finalResult = result; + final String finalSourceLanguage = sourceLanguage; + long elapsed = SystemClock.elapsedRealtime() - start; + if (elapsed < minFetchingDuration) + sleep(minFetchingDuration - elapsed); + AndroidUtilities.runOnUIThread(() -> { + if (onSuccess != null) + onSuccess.run(finalResult, finalSourceLanguage); + }); + } catch (Exception e) { + try { + Log.e("translate", "failed to translate a text " + (connection != null ? connection.getResponseCode() : null) + " " + (connection != null ? connection.getResponseMessage() : null)); + } catch (IOException ioException) { + ioException.printStackTrace(); + } + e.printStackTrace(); + + if (onFail != null && !dismissed) { + try { + final boolean rateLimit = connection != null && connection.getResponseCode() == 429; + AndroidUtilities.runOnUIThread(() -> { + onFail.run(rateLimit); + }); + } catch (Exception e2) { + AndroidUtilities.runOnUIThread(() -> { + onFail.run(false); + }); + } + } + } + } + }.start(); + } + + public static void showAlert(Context context, BaseFragment fragment, String fromLanguage, String toLanguage, CharSequence text, boolean noforwards) { + TranslateAlert alert = new TranslateAlert(fragment, context, fromLanguage, toLanguage, text, noforwards); + if (fragment != null) { + if (fragment.getParentActivity() != null) { + fragment.showDialog(alert); + } + } else { + alert.show(); + } + } + + private static class LoadingTextView extends FrameLayout { + private TextView loadingTextView; + public TextView textView; + + private CharSequence loadingString; + // private StaticLayout loadingLayout; +// private StaticLayout textLayout; + private Paint loadingPaint = new Paint(); + private Path loadingPath = new Path(); + private RectF fetchedPathRect = new RectF(); + public static int padHorz = dp(6), padVert = dp(1.5f); + private Path fetchPath = new Path() { + private boolean got = false; + + @Override + public void reset() { + super.reset(); + got = false; + } + + @Override + public void addRect(float left, float top, float right, float bottom, @NonNull Direction dir) { + if (!got) { + fetchedPathRect.set( + left - padHorz, + top - padVert, + right + padHorz, + bottom + padVert + ); + got = true; + } + } + }; + + public void resize() { + textView.forceLayout(); + loadingTextView.forceLayout(); + updateLoadingLayout(); + updateTextLayout(); + updateHeight(); + } + + @Override + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { + super.onLayout(changed, left, top, right, bottom); + LoadingTextView.this.resize(); + } + + private boolean animateWidth = false; + private boolean scaleFromZero = false; + private long scaleFromZeroStart = 0; + private final long scaleFromZeroDuration = 220l; + public LoadingTextView(Context context, CharSequence loadingString, boolean scaleFromZero, boolean animateWidth) { + super(context); + + this.animateWidth = animateWidth; + this.scaleFromZero = scaleFromZero; + this.scaleFromZeroStart = SystemClock.elapsedRealtime(); + + setPadding(padHorz, padVert, padHorz, padVert); + + loadingT = 0f; + loadingTextView = new TextView(context) { + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure( + animateWidth ? + MeasureSpec.makeMeasureSpec( + 999999, + MeasureSpec.AT_MOST + ) : widthMeasureSpec, + MeasureSpec.makeMeasureSpec( + MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST ? 999999 : MeasureSpec.getSize(heightMeasureSpec), + MeasureSpec.getMode(heightMeasureSpec) + ) + ); + } + }; + loadingString = Emoji.replaceEmoji(loadingString, loadingTextView.getPaint().getFontMetricsInt(), dp(14), false); + loadingTextView.setText(this.loadingString = loadingString); + loadingTextView.setVisibility(INVISIBLE); + loadingTextView.measure(MeasureSpec.makeMeasureSpec(animateWidth ? 999999 : getWidth(), MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(9999999, MeasureSpec.AT_MOST)); + addView(loadingTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP)); + + textView = new TextView(context) { + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure( + animateWidth ? + MeasureSpec.makeMeasureSpec( + 999999, + MeasureSpec.AT_MOST + ) : widthMeasureSpec, + MeasureSpec.makeMeasureSpec( + MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST ? 999999 : MeasureSpec.getSize(heightMeasureSpec), + MeasureSpec.getMode(heightMeasureSpec) + ) + ); + } + }; + addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + + int c1 = Theme.getColor(Theme.key_dialogBackground), + c2 = Theme.getColor(Theme.key_dialogBackgroundGray); + LinearGradient gradient = new LinearGradient(0, 0, gradientWidth, 0, new int[]{ c1, c2, c1 }, new float[] { 0, 0.67f, 1f }, Shader.TileMode.REPEAT); + loadingPaint.setShader(gradient); + + setWillNotDraw(false); + setClipChildren(false); + + updateLoadingLayout(); + } + + protected void scrollToBottom() {} + protected void onLoadEnd() {} + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + +// updateLoadingLayout(); +// updateTextLayout(); + updateHeight(); + } + + private void updateHeight() { +// int loadingHeight = loadingLayout != null ? loadingLayout.getHeight() : loadingTextView.getMeasuredHeight(); + int loadingHeight = loadingTextView.getMeasuredHeight(); + float scaleFromZeroT = scaleFromZero ? Math.max(Math.min((float) (SystemClock.elapsedRealtime() - scaleFromZeroStart) / (float) scaleFromZeroDuration, 1f), 0f) : 1f; + int height = ( + (int) ( + ( + padVert * 2 + + loadingHeight + ( + textView.getMeasuredHeight() - + loadingHeight + ) * loadingT + ) * scaleFromZeroT + ) + ); + ViewGroup.LayoutParams params = (ViewGroup.LayoutParams) getLayoutParams(); + boolean newHeight = false; + if (params == null) { + newHeight = true; + params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, height); + } else + newHeight = params.height != height; +// if (height > 0 || scaleFromZero) + params.height = height; + + if (animateWidth) { + int loadingWidth = loadingTextView.getMeasuredWidth() + padHorz * 2; + int textWidth = (textView.getMeasuredWidth() <= 0 ? loadingTextView.getMeasuredWidth() : textView.getMeasuredWidth()) + padHorz * 2; + params.width = (int) ((loadingWidth + (textWidth - loadingWidth) * loadingT) * scaleFromZeroT); + } + + this.setLayoutParams(params); + } + + // private TextPaint textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); +// private TextPaint loadingTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); + private float gradientWidth = dp(350f); + private void updateLoadingLayout() { + float textWidth = loadingTextView.getMeasuredWidth(); + if (textWidth > 0) { +// loadingTextPaint.setAntiAlias(true); +// loadingLayout = new StaticLayout( +// loadingString, +// loadingTextPaint, +// (int) textWidth, +// Layout.Alignment.ALIGN_NORMAL, +// 1f, 0f, false +// ); +// loadingPath.reset(); + Layout loadingLayout = loadingTextView.getLayout(); + for (int i = 0; i < loadingLayout.getLineCount(); ++i) { + int start = loadingLayout.getLineStart(i), end = loadingLayout.getLineEnd(i); + if (start + 1 == end) + continue; + loadingLayout.getSelectionPath(start, end, fetchPath); + loadingPath.addRoundRect(fetchedPathRect, dp(4), dp(4), Path.Direction.CW); + } + + updateHeight(); + } + + if (!loaded && loadingAnimator == null) { + loadingAnimator = ValueAnimator.ofFloat(0f, 1f); + loadingAnimator.addUpdateListener(a -> { + loadingT = 0f; + if (scaleFromZero && SystemClock.elapsedRealtime() < scaleFromZeroStart + scaleFromZeroDuration + 25) + updateHeight(); + invalidate(); + }); + loadingAnimator.setDuration(Long.MAX_VALUE); + loadingAnimator.start(); + } + } + private void updateTextLayout() { +// float textWidth = textView.getMeasuredWidth(); +// textPaint.setAntiAlias(true); +// if (textWidth > 0) { +// textLayout = new StaticLayout( +// textView.getText(), +// textPaint, +// (int) textWidth, +// Layout.Alignment.ALIGN_NORMAL, +// 1f, 0f, false +// ); +// } + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { +// float measureHeight = MeasureSpec.getSize(heightMeasureSpec); +// float loadingHeight = loadingLayout == null ? measureHeight : loadingLayout.getHeight(); +// float height = measureHeight + (loadingHeight - measureHeight) * (1f - loadingT); + super.onMeasure(widthMeasureSpec, heightMeasureSpec); +// updateLoadingLayout(); +// updateTextLayout(); + this.resize(); + } + + public boolean loaded = false; + private float loadingT = 0f; + private ValueAnimator loadingAnimator = null; + + public void setEllipsizeNull() { + loadingTextView.setEllipsize(null); + textView.setEllipsize(null); + } + public void setSingleLine(boolean singleLine) { + loadingTextView.setSingleLine(singleLine); + textView.setSingleLine(singleLine); + } + public void setLines(int lines) { + loadingTextView.setLines(lines); + textView.setLines(lines); + } + public void setGravity(int gravity) { + loadingTextView.setGravity(gravity); + textView.setGravity(gravity); + } + public void setMaxLines(int maxLines) { + loadingTextView.setMaxLines(maxLines); + textView.setMaxLines(maxLines); + } + public void setTextIsSelectable(boolean selectable) { + textView.setTextIsSelectable(selectable); + } + private boolean showLoadingTextValue = true; + public void showLoadingText(boolean show) { + showLoadingTextValue = show; + } + public void setTextColor(int textColor) { +// loadingTextPaint.setColor(multAlpha(textColor, showLoadingTextValue ? 0.08f : 0f)); +// loadingTextView.setTextColor(multAlpha(textColor, showLoadingTextValue ? 0.08f : 0f)); +// textPaint.setColor(textColor); + loadingTextView.setTextColor(textColor); + textView.setTextColor(textColor); + } + private float sz(int unit, float size) { + Context c = getContext(); + return TypedValue.applyDimension( + unit, size, (c == null ? Resources.getSystem() : c.getResources()).getDisplayMetrics() + ); + } + public void setTextSize(int size) { + loadingTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, size); + textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, size); +// loadingTextPaint.setTextSize(size); +// textPaint.setTextSize(size); + loadingTextView.setText(loadingString = Emoji.replaceEmoji(loadingString, loadingTextView.getPaint().getFontMetricsInt(), dp(14), false)); + loadingTextView.measure(MeasureSpec.makeMeasureSpec(animateWidth ? 999999 : getWidth(), MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(9999999, MeasureSpec.AT_MOST)); + textView.setText(Emoji.replaceEmoji(textView.getText(), textView.getPaint().getFontMetricsInt(), dp(14), false)); + updateLoadingLayout(); + } + public void setTextSize(int unit, float size) { + loadingTextView.setTextSize(unit, size); + textView.setTextSize(unit, size); +// loadingTextPaint.setTextSize(sz(unit, size)); +// textPaint.setTextSize(sz(unit, size)); + loadingTextView.setText(loadingString = Emoji.replaceEmoji(loadingString, loadingTextView.getPaint().getFontMetricsInt(), dp(14), false)); + loadingTextView.measure(MeasureSpec.makeMeasureSpec(animateWidth ? 999999 : getWidth(), MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(9999999, MeasureSpec.AT_MOST)); + textView.setText(Emoji.replaceEmoji(textView.getText(), textView.getPaint().getFontMetricsInt(), dp(14), false)); + updateLoadingLayout(); + } + public int multAlpha(int color, float mult) { + return (color & 0x00ffffff) | ((int) ((color >> 24 & 0xff) * mult) << 24); + } + boolean scrolled = false; + private ValueAnimator animator = null; + public void setText(CharSequence text) { + text = Emoji.replaceEmoji(text, textView.getPaint().getFontMetricsInt(), dp(14), false); + textView.setText(text); + textView.measure(MeasureSpec.makeMeasureSpec(animateWidth ? 999999 : getWidth(), MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(9999999, MeasureSpec.AT_MOST)); + updateTextLayout(); + + if (!loaded) { + loaded = true; + loadingT = 0f; + if (loadingAnimator != null) { + loadingAnimator.cancel(); + loadingAnimator = null; + } + if (animator != null) + animator.cancel(); + animator = ValueAnimator.ofFloat(0f, 1f); + animator.addUpdateListener(a -> { + loadingT = (float) a.getAnimatedValue(); + updateHeight(); + invalidate(); + }); + animator.addListener(new Animator.AnimatorListener() { + @Override + public void onAnimationStart(Animator animator) { + + } + + @Override + public void onAnimationEnd(Animator animator) { + onLoadEnd(); + } + + @Override + public void onAnimationCancel(Animator animator) { + onLoadEnd(); + } + + @Override + public void onAnimationRepeat(Animator animator) { + + } + }); + animator.setInterpolator(CubicBezierInterpolator.EASE_IN); + animator.setDuration(220); + animator.start(); + } else + updateHeight(); + } + + private long start = SystemClock.elapsedRealtime(); + private Path shadePath = new Path(); + private Path tempPath = new Path(); + private Path inPath = new Path(); + private RectF rect = new RectF(); + @Override + protected void onDraw(Canvas canvas) { + float w = getWidth(), h = getHeight(); + + float cx = LocaleController.isRTL ? Math.max(w / 2f, w - 8f) : Math.min(w / 2f, 8f), + cy = Math.min(h / 2f, 8f), + R = (float) Math.sqrt(Math.max( + Math.max(cx*cx + cy*cy, (w-cx)*(w-cx) + cy*cy), + Math.max(cx*cx + (h-cy)*(h-cy), (w-cx)*(w-cx) + (h-cy)*(h-cy)) + )), + r = loadingT * R; + inPath.reset(); + inPath.addCircle(cx, cy, r, Path.Direction.CW); + + canvas.save(); + canvas.clipPath(inPath, Region.Op.DIFFERENCE); + + loadingPaint.setAlpha((int) ((1f - loadingT) * 255)); + float dx = gradientWidth - (((SystemClock.elapsedRealtime() - start) / 1000f * gradientWidth) % gradientWidth); + shadePath.reset(); + shadePath.addRect(0, 0, w, h, Path.Direction.CW); + + canvas.translate(padHorz, padVert); + canvas.clipPath(loadingPath); + canvas.translate(-padHorz, -padVert); + canvas.translate(-dx, 0); + shadePath.offset(dx, 0f, tempPath); + canvas.drawPath(tempPath, loadingPaint); + canvas.translate(dx, 0); + canvas.restore(); + + canvas.save(); + rect.set(0, 0, w, h); + canvas.clipPath(inPath, Region.Op.DIFFERENCE); + canvas.translate(padHorz, padVert); + canvas.clipPath(loadingPath); +// if (loadingLayout != null) +// loadingLayout.draw(canvas); + canvas.saveLayerAlpha(rect, (int) (255 * (showLoadingTextValue ? 0.08f : 0f)), Canvas.ALL_SAVE_FLAG); +// loadingTextView.setAlpha(showLoadingTextValue ? 0.08f : 0f); + loadingTextView.draw(canvas); + canvas.restore(); + canvas.restore(); + +// canvas.save(); +// canvas.clipPath(inPath); +// canvas.translate(padHorz, padVert); +// textLayout.draw(canvas); +// canvas.restore(); + } + private Paint RED = new Paint(); + + @Override + protected boolean drawChild(Canvas canvas, View child, long drawingTime) { + if (child == textView) { + canvas.save(); + canvas.clipPath(inPath); + if (loadingT < 1f) { + rect.set(0, 0, getWidth(), getHeight()); + canvas.saveLayerAlpha(rect, (int) (255 * loadingT), Canvas.ALL_SAVE_FLAG); + } + boolean r = super.drawChild(canvas, child, drawingTime); + if (loadingT < 1f) + canvas.restore(); + canvas.restore(); + return r; + } + return false; + } + } +} \ No newline at end of file diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/UpdateAppAlertDialog.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/UpdateAppAlertDialog.java index c677e30a5..b1c2630ac 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/UpdateAppAlertDialog.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/UpdateAppAlertDialog.java @@ -19,6 +19,8 @@ import android.widget.FrameLayout; import android.widget.LinearLayout; import android.widget.TextView; +import androidx.core.widget.NestedScrollView; + import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.DocumentObject; import org.telegram.messenger.FileLoader; @@ -31,8 +33,6 @@ import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.BottomSheet; import org.telegram.ui.ActionBar.Theme; -import androidx.core.widget.NestedScrollView; - public class UpdateAppAlertDialog extends BottomSheet { private TLRPC.TL_help_appUpdate appUpdate; @@ -239,9 +239,9 @@ public class UpdateAppAlertDialog extends BottomSheet { ImageLocation imageLocation = ImageLocation.getForDocument(thumb, appUpdate.sticker); if (svgThumb != null) { - imageView.setImage(ImageLocation.getForDocument(appUpdate.sticker), "50_50", svgThumb, 0, "update"); + imageView.setImage(ImageLocation.getForDocument(appUpdate.sticker), "250_250", svgThumb, 0, "update"); } else { - imageView.setImage(ImageLocation.getForDocument(appUpdate.sticker), "50_50", imageLocation, null, 0, "update"); + imageView.setImage(ImageLocation.getForDocument(appUpdate.sticker), "250_250", imageLocation, null, 0, "update"); } linearLayout.addView(imageView, LayoutHelper.createLinear(160, 160, Gravity.CENTER_HORIZONTAL | Gravity.TOP, 17, 8, 17, 0)); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/spoilers/SpoilerEffect.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/spoilers/SpoilerEffect.java new file mode 100644 index 000000000..3ed6e1f95 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/spoilers/SpoilerEffect.java @@ -0,0 +1,824 @@ +package org.telegram.ui.Components.spoilers; + +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.TimeInterpolator; +import android.animation.ValueAnimator; +import android.annotation.SuppressLint; +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.ColorFilter; +import android.graphics.Paint; +import android.graphics.Path; +import android.graphics.PixelFormat; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffColorFilter; +import android.graphics.PorterDuffXfermode; +import android.graphics.Rect; +import android.graphics.RectF; +import android.graphics.Region; +import android.graphics.drawable.Drawable; +import android.os.Build; +import android.text.Layout; +import android.text.Spannable; +import android.text.SpannableStringBuilder; +import android.text.StaticLayout; +import android.text.TextPaint; +import android.text.style.ForegroundColorSpan; +import android.text.style.ReplacementSpan; +import android.text.style.URLSpan; +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.MainThread; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.core.graphics.ColorUtils; +import androidx.core.math.MathUtils; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.Emoji; +import org.telegram.messenger.LocaleController; +import org.telegram.messenger.SharedConfig; +import org.telegram.messenger.Utilities; +import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.Components.Easings; +import org.telegram.ui.Components.TextStyleSpan; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Stack; +import java.util.concurrent.atomic.AtomicReference; + +public class SpoilerEffect extends Drawable { + public final static int MAX_PARTICLES_PER_ENTITY = measureMaxParticlesCount(); + public final static int PARTICLES_PER_CHARACTER = measureParticlesPerCharacter(); + private final static float VERTICAL_PADDING_DP = 2.5f; + private final static int RAND_REPEAT = 14; + private final static float KEYPOINT_DELTA = 5f; + private final static int FPS = 30; + private final static int renderDelayMs = 1000 / FPS + 1; + public final static float[] ALPHAS = { + 0.3f, 0.6f, 1.0f + }; + private Paint[] particlePaints = new Paint[ALPHAS.length]; + + private Stack particlesPool = new Stack<>(); + private int maxParticles; + float[][] particlePoints = new float[ALPHAS.length][MAX_PARTICLES_PER_ENTITY * 2]; + private float[] particleRands = new float[RAND_REPEAT]; + private int[] renderCount = new int[ALPHAS.length]; + + private static Path tempPath = new Path(); + + private RectF visibleRect; + + private ArrayList particles = new ArrayList<>(); + private View mParent; + + private long lastDrawTime; + + private float rippleX, rippleY; + private float rippleMaxRadius; + private float rippleProgress = -1; + private boolean reverseAnimator; + private boolean shouldInvalidateColor; + private Runnable onRippleEndCallback; + private ValueAnimator rippleAnimator; + + private List spaces = new ArrayList<>(); + private List keyPoints; + private int mAlpha = 0xFF; + + private TimeInterpolator rippleInterpolator = input -> input; + + private boolean invalidateParent; + private boolean suppressUpdates; + private boolean isLowDevice; + private boolean enableAlpha; + + private int lastColor; + public boolean drawPoints; + private static Paint xRefPaint; + + private static int measureParticlesPerCharacter() { + switch (SharedConfig.getDevicePerformanceClass()) { + default: + case SharedConfig.PERFORMANCE_CLASS_LOW: + case SharedConfig.PERFORMANCE_CLASS_AVERAGE: + return 10; + case SharedConfig.PERFORMANCE_CLASS_HIGH: + return 30; + } + } + + private static int measureMaxParticlesCount() { + switch (SharedConfig.getDevicePerformanceClass()) { + default: + case SharedConfig.PERFORMANCE_CLASS_LOW: + case SharedConfig.PERFORMANCE_CLASS_AVERAGE: + return 100; + case SharedConfig.PERFORMANCE_CLASS_HIGH: + return 150; + } + } + + public SpoilerEffect() { + for (int i = 0; i < ALPHAS.length; i++) { + particlePaints[i] = new Paint(); + if (i == 0) { + particlePaints[i].setStrokeWidth(AndroidUtilities.dp(1.4f)); + particlePaints[i].setStyle(Paint.Style.STROKE); + particlePaints[i].setStrokeCap(Paint.Cap.ROUND); + } else { + particlePaints[i].setStrokeWidth(AndroidUtilities.dp(1.2f)); + particlePaints[i].setStyle(Paint.Style.STROKE); + particlePaints[i].setStrokeCap(Paint.Cap.ROUND); + } + } + + isLowDevice = SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_LOW; + enableAlpha = true; + setColor(Color.TRANSPARENT); + } + + /** + * Sets if we should suppress updates or not + */ + public void setSuppressUpdates(boolean suppressUpdates) { + this.suppressUpdates = suppressUpdates; + invalidateSelf(); + } + + /** + * Sets if we should invalidate parent instead + */ + public void setInvalidateParent(boolean invalidateParent) { + this.invalidateParent = invalidateParent; + } + + /** + * Updates max particles count + */ + public void updateMaxParticles() { + setMaxParticlesCount(MathUtils.clamp((getBounds().width() / AndroidUtilities.dp(6)) * PARTICLES_PER_CHARACTER, PARTICLES_PER_CHARACTER, MAX_PARTICLES_PER_ENTITY)); + } + + /** + * Sets callback to be run after ripple animation ends + */ + public void setOnRippleEndCallback(@Nullable Runnable onRippleEndCallback) { + this.onRippleEndCallback = onRippleEndCallback; + } + + /** + * Starts ripple + * + * @param rX Ripple center x + * @param rY Ripple center y + * @param radMax Max ripple radius + */ + public void startRipple(float rX, float rY, float radMax) { + startRipple(rX, rY, radMax, false); + } + + /** + * Starts ripple + * + * @param rX Ripple center x + * @param rY Ripple center y + * @param radMax Max ripple radius + * @param reverse If we should start reverse ripple + */ + public void startRipple(float rX, float rY, float radMax, boolean reverse) { + rippleX = rX; + rippleY = rY; + rippleMaxRadius = radMax; + rippleProgress = reverse ? 1 : 0; + reverseAnimator = reverse; + + if (rippleAnimator != null) + rippleAnimator.cancel(); + int startAlpha = reverseAnimator ? 0xFF : particlePaints[ALPHAS.length - 1].getAlpha(); + rippleAnimator = ValueAnimator.ofFloat(rippleProgress, reverse ? 0 : 1).setDuration((long) MathUtils.clamp(rippleMaxRadius * 0.3f, 250, 550)); + rippleAnimator.setInterpolator(rippleInterpolator); + rippleAnimator.addUpdateListener(animation -> { + rippleProgress = (float) animation.getAnimatedValue(); + setAlpha((int) (startAlpha * (1f - rippleProgress))); + shouldInvalidateColor = true; + invalidateSelf(); + }); + rippleAnimator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + Iterator it = particles.iterator(); + while (it.hasNext()) { + Particle p = it.next(); + if (particlesPool.size() < maxParticles) { + particlesPool.push(p); + } + it.remove(); + } + + if (onRippleEndCallback != null) { + onRippleEndCallback.run(); + onRippleEndCallback = null; + } + + rippleAnimator = null; + invalidateSelf(); + } + }); + rippleAnimator.start(); + + invalidateSelf(); + } + + /** + * Sets new ripple interpolator + * + * @param rippleInterpolator New interpolator + */ + public void setRippleInterpolator(@NonNull TimeInterpolator rippleInterpolator) { + this.rippleInterpolator = rippleInterpolator; + } + + /** + * Sets new keypoints + * + * @param keyPoints New keypoints + */ + public void setKeyPoints(List keyPoints) { + this.keyPoints = keyPoints; + invalidateSelf(); + } + + /** + * Gets ripple path + */ + public void getRipplePath(Path path) { + path.addCircle(rippleX, rippleY, rippleMaxRadius * MathUtils.clamp(rippleProgress, 0, 1), Path.Direction.CW); + } + + /** + * @return Current ripple progress + */ + public float getRippleProgress() { + return rippleProgress; + } + + /** + * @return If we should invalidate color + */ + public boolean shouldInvalidateColor() { + boolean b = shouldInvalidateColor; + shouldInvalidateColor = false; + return b; + } + + /** + * Sets new ripple progress + */ + public void setRippleProgress(float rippleProgress) { + this.rippleProgress = rippleProgress; + if (rippleProgress == -1 && rippleAnimator != null) { + rippleAnimator.cancel(); + } + shouldInvalidateColor = true; + } + + @Override + public void setBounds(int left, int top, int right, int bottom) { + super.setBounds(left, top, right, bottom); + Iterator it = particles.iterator(); + while (it.hasNext()) { + Particle p = it.next(); + if (!getBounds().contains((int) p.x, (int) p.y)) { + it.remove(); + } + if (particlesPool.size() < maxParticles) { + particlesPool.push(p); + } + } + } + + @Override + public void draw(@NonNull Canvas canvas) { + if (drawPoints) { + long curTime = System.currentTimeMillis(); + int dt = (int) Math.min(curTime - lastDrawTime, renderDelayMs); + boolean hasAnimator = false; + + + lastDrawTime = curTime; + + int left = getBounds().left, top = getBounds().top, right = getBounds().right, bottom = getBounds().bottom; + for (int i = 0; i < ALPHAS.length; i++) { + renderCount[i] = 0; + } + for (int i = 0; i < particles.size(); i++) { + Particle particle = particles.get(i); + + particle.currentTime = Math.min(particle.currentTime + dt, particle.lifeTime); + if (particle.currentTime >= particle.lifeTime || isOutOfBounds(left, top, right, bottom, particle.x, particle.y)) { + if (particlesPool.size() < maxParticles) { + particlesPool.push(particle); + } + particles.remove(i); + i--; + continue; + } + + float hdt = particle.velocity * dt / 500f; + particle.x += particle.vecX * hdt; + particle.y += particle.vecY * hdt; + + int alphaIndex = particle.alpha; + particlePoints[alphaIndex][renderCount[alphaIndex] * 2] = particle.x; + particlePoints[alphaIndex][renderCount[alphaIndex] * 2 + 1] = particle.y; + renderCount[alphaIndex]++; + } + + if (particles.size() < maxParticles) { + int np = maxParticles - particles.size(); + Arrays.fill(particleRands, -1); + for (int i = 0; i < np; i++) { + float rf = particleRands[i % RAND_REPEAT]; + if (rf == -1) { + particleRands[i % RAND_REPEAT] = rf = Utilities.fastRandom.nextFloat(); + } + + Particle newParticle = !particlesPool.isEmpty() ? particlesPool.pop() : new Particle(); + int attempts = 0; + do { + generateRandomLocation(newParticle, i); + attempts++; + } while (isOutOfBounds(left, top, right, bottom, newParticle.x, newParticle.y) && attempts < 4); + + + double angleRad = rf * Math.PI * 2 - Math.PI; + float vx = (float) Math.cos(angleRad); + float vy = (float) Math.sin(angleRad); + + newParticle.vecX = vx; + newParticle.vecY = vy; + + newParticle.currentTime = 0; + + newParticle.lifeTime = 1000 + Math.abs(Utilities.fastRandom.nextInt(2000)); // [1000;3000] + newParticle.velocity = 4 + rf * 6; + newParticle.alpha = Utilities.fastRandom.nextInt(ALPHAS.length); + particles.add(newParticle); + + int alphaIndex = newParticle.alpha; + particlePoints[alphaIndex][renderCount[alphaIndex] * 2] = newParticle.x; + particlePoints[alphaIndex][renderCount[alphaIndex] * 2 + 1] = newParticle.y; + renderCount[alphaIndex]++; + } + } + + for (int a = enableAlpha ? 0 : ALPHAS.length - 1; a < ALPHAS.length; a++) { + int renderCount = 0; + int off = 0; + for (int i = 0; i < particles.size(); i++) { + Particle p = particles.get(i); + + if (visibleRect != null && !visibleRect.contains(p.x, p.y) || p.alpha != a && enableAlpha) { + off++; + continue; + } + + particlePoints[a][(i - off) * 2] = p.x; + particlePoints[a][(i - off) * 2 + 1] = p.y; + renderCount += 2; + } + canvas.drawPoints(particlePoints[a], 0, renderCount, particlePaints[a]); + } + } else { + Paint shaderPaint = SpoilerEffectBitmapFactory.getInstance().getPaint(); + shaderPaint.setColorFilter(new PorterDuffColorFilter(lastColor, PorterDuff.Mode.SRC_IN)); + canvas.drawRect(getBounds().left, getBounds().top, getBounds().right, getBounds().bottom, SpoilerEffectBitmapFactory.getInstance().getPaint()); + invalidateSelf(); + + SpoilerEffectBitmapFactory.getInstance().checkUpdate(); + } + } + + /** + * Updates visible bounds to update particles + */ + public void setVisibleBounds(float left, float top, float right, float bottom) { + if (visibleRect == null) + visibleRect = new RectF(); + visibleRect.left = left; + visibleRect.top = top; + visibleRect.right = right; + visibleRect.bottom = bottom; + invalidateSelf(); + } + + private boolean isOutOfBounds(int left, int top, int right, int bottom, float x, float y) { + if (x < left || x > right || y < top + AndroidUtilities.dp(VERTICAL_PADDING_DP) || + y > bottom - AndroidUtilities.dp(VERTICAL_PADDING_DP)) + return true; + + for (int i = 0; i < spaces.size(); i++) { + if (spaces.get(i).contains(x, y)) { + return true; + } + } + return false; + } + + private void generateRandomLocation(Particle newParticle, int i) { + if (keyPoints != null && !keyPoints.isEmpty()) { + float rf = particleRands[i % RAND_REPEAT]; + long kp = keyPoints.get(Utilities.fastRandom.nextInt(keyPoints.size())); + newParticle.x = getBounds().left + (kp >> 16) + rf * AndroidUtilities.dp(KEYPOINT_DELTA) - AndroidUtilities.dp(KEYPOINT_DELTA / 2f); + newParticle.y = getBounds().top + (kp & 0xFFFF) + rf * AndroidUtilities.dp(KEYPOINT_DELTA) - AndroidUtilities.dp(KEYPOINT_DELTA / 2f); + } else { + newParticle.x = getBounds().left + Utilities.fastRandom.nextFloat() * getBounds().width(); + newParticle.y = getBounds().top + Utilities.fastRandom.nextFloat() * getBounds().height(); + } + } + + @Override + public void invalidateSelf() { + super.invalidateSelf(); + + if (mParent != null) { + View v = mParent; + if (v.getParent() != null && invalidateParent) { + ((View) v.getParent()).invalidate(); + } else { + v.invalidate(); + } + } + } + + /** + * Attaches to the parent view + * + * @param parentView Parent view + */ + public void setParentView(View parentView) { + this.mParent = parentView; + } + + /** + * @return Currently used parent view + */ + public View getParentView() { + return mParent; + } + + @Override + public void setAlpha(int alpha) { + mAlpha = alpha; + for (int i = 0; i < ALPHAS.length; i++) { + particlePaints[i].setAlpha((int) (ALPHAS[i] * alpha)); + } + } + + @Override + public void setColorFilter(@Nullable ColorFilter colorFilter) { + for (Paint p : particlePaints) { + p.setColorFilter(colorFilter); + } + } + + /** + * Sets particles color + * + * @param color New color + */ + public void setColor(int color) { + if (lastColor != color) { + for (int i = 0; i < ALPHAS.length; i++) { + particlePaints[i].setColor(ColorUtils.setAlphaComponent(color, (int) (mAlpha * ALPHAS[i]))); + } + lastColor = color; + } + } + + /** + * @return If effect has color + */ + public boolean hasColor() { + return lastColor != Color.TRANSPARENT; + } + + @Override + public int getOpacity() { + return PixelFormat.TRANSPARENT; + } + + /** + * @param textLayout Text layout to measure + * @return Measured key points + */ + public static synchronized List measureKeyPoints(Layout textLayout) { + int w = textLayout.getWidth(); + int h = textLayout.getHeight(); + + if (w == 0 || h == 0) + return Collections.emptyList(); + + Bitmap measureBitmap = Bitmap.createBitmap(Math.round(w), Math.round(h), Bitmap.Config.ARGB_4444); // We can use 4444 as we don't need accuracy here + Canvas measureCanvas = new Canvas(measureBitmap); + textLayout.draw(measureCanvas); + + int[] pixels = new int[measureBitmap.getWidth() * measureBitmap.getHeight()]; + measureBitmap.getPixels(pixels, 0, measureBitmap.getWidth(), 0, 0, w, h); + + int sX = -1; + ArrayList keyPoints = new ArrayList<>(pixels.length); + for (int x = 0; x < w; x++) { + for (int y = 0; y < h; y++) { + int clr = pixels[y * measureBitmap.getWidth() + x]; + if (Color.alpha(clr) >= 0x80) { + if (sX == -1) { + sX = x; + } + keyPoints.add(((long) (x - sX) << 16) + y); + } + } + } + keyPoints.trimToSize(); + measureBitmap.recycle(); + return keyPoints; + } + + /** + * @return Max particles count + */ + public int getMaxParticlesCount() { + return maxParticles; + } + + /** + * Sets new max particles count + */ + public void setMaxParticlesCount(int maxParticles) { + this.maxParticles = maxParticles; + while (particlesPool.size() + particles.size() < maxParticles) { + particlesPool.push(new Particle()); + } + } + + /** + * Alias for it's big bro + * + * @param tv Text view to use as a parent view + * @param spoilersPool Cached spoilers pool + * @param spoilers Spoilers list to populate + */ + public static void addSpoilers(TextView tv, @Nullable Stack spoilersPool, List spoilers) { + addSpoilers(tv, tv.getLayout(), (Spannable) tv.getText(), spoilersPool, spoilers); + } + + /** + * Alias for it's big bro + * + * @param v View to use as a parent view + * @param textLayout Text layout to measure + * @param spoilersPool Cached spoilers pool, could be null, but highly recommended + * @param spoilers Spoilers list to populate + */ + public static void addSpoilers(@Nullable View v, Layout textLayout, @Nullable Stack spoilersPool, List spoilers) { + if (textLayout.getText() instanceof Spannable){ + addSpoilers(v, textLayout, (Spannable) textLayout.getText(), spoilersPool, spoilers); + } + } + + /** + * Parses spoilers from spannable + * + * @param v View to use as a parent view + * @param textLayout Text layout to measure + * @param spannable Text to parse + * @param spoilersPool Cached spoilers pool, could be null, but highly recommended + * @param spoilers Spoilers list to populate + */ + public static void addSpoilers(@Nullable View v, Layout textLayout, Spannable spannable, @Nullable Stack spoilersPool, List spoilers) { + for (int line = 0; line < textLayout.getLineCount(); line++) { + float l = textLayout.getLineLeft(line), t = textLayout.getLineTop(line), r = textLayout.getLineRight(line), b = textLayout.getLineBottom(line); + int start = textLayout.getLineStart(line), end = textLayout.getLineEnd(line); + + for (TextStyleSpan span : spannable.getSpans(start, end, TextStyleSpan.class)) { + if (span.isSpoiler()) { + int ss = spannable.getSpanStart(span), se = spannable.getSpanEnd(span); + int realStart = Math.max(start, ss), realEnd = Math.min(end, se); + + int len = realEnd - realStart; + if (len == 0) continue; + addSpoilersInternal(v, spannable, textLayout, start, end, l, t, r, b, realStart, realEnd, spoilersPool, spoilers); + } + } + } + if (v instanceof TextView && spoilersPool != null) { + spoilersPool.clear(); + } + } + + @SuppressLint("WrongConstant") + private static void addSpoilersInternal(View v, Spannable spannable, Layout textLayout, int lineStart, + int lineEnd, float lineLeft, float lineTop, float lineRight, + float lineBottom, int realStart, int realEnd, Stack spoilersPool, + List spoilers) { + SpannableStringBuilder vSpan = SpannableStringBuilder.valueOf(AndroidUtilities.replaceNewLines(new SpannableStringBuilder(spannable, realStart, realEnd))); + for (TextStyleSpan styleSpan : vSpan.getSpans(0, vSpan.length(), TextStyleSpan.class)) + vSpan.removeSpan(styleSpan); + for (URLSpan urlSpan : vSpan.getSpans(0, vSpan.length(), URLSpan.class)) + vSpan.removeSpan(urlSpan); + int tLen = vSpan.toString().trim().length(); + if (tLen == 0) return; + int width = textLayout.getEllipsizedWidth() > 0 ? textLayout.getEllipsizedWidth() : textLayout.getWidth(); + TextPaint measurePaint = new TextPaint(textLayout.getPaint()); + measurePaint.setColor(Color.BLACK); + StaticLayout newLayout; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + newLayout = StaticLayout.Builder.obtain(vSpan, 0, vSpan.length(), measurePaint, width) + .setBreakStrategy(StaticLayout.BREAK_STRATEGY_HIGH_QUALITY) + .setHyphenationFrequency(StaticLayout.HYPHENATION_FREQUENCY_NONE) + .setAlignment(Layout.Alignment.ALIGN_NORMAL) + .setLineSpacing(textLayout.getSpacingAdd(), textLayout.getSpacingMultiplier()) + .build(); + } else + newLayout = new StaticLayout(vSpan, measurePaint, width, Layout.Alignment.ALIGN_NORMAL, textLayout.getSpacingMultiplier(), textLayout.getSpacingAdd(), false); + boolean rtlInNonRTL = (LocaleController.isRTLCharacter(vSpan.charAt(0)) || LocaleController.isRTLCharacter(vSpan.charAt(vSpan.length() - 1))) && !LocaleController.isRTL; + SpoilerEffect spoilerEffect = spoilersPool == null || spoilersPool.isEmpty() ? new SpoilerEffect() : spoilersPool.remove(0); + spoilerEffect.setRippleProgress(-1); + float ps = realStart == lineStart ? lineLeft : textLayout.getPrimaryHorizontal(realStart), + pe = realEnd == lineEnd || rtlInNonRTL && realEnd == lineEnd - 1 && spannable.charAt(lineEnd - 1) == '\u2026' ? lineRight : textLayout.getPrimaryHorizontal(realEnd); + spoilerEffect.setBounds((int) Math.min(ps, pe), (int) lineTop, (int) Math.max(ps, pe), (int) lineBottom); + spoilerEffect.setColor(textLayout.getPaint().getColor()); + spoilerEffect.setRippleInterpolator(Easings.easeInQuad); + if (!spoilerEffect.isLowDevice) + spoilerEffect.setKeyPoints(SpoilerEffect.measureKeyPoints(newLayout)); + spoilerEffect.updateMaxParticles(); + if (v != null) { + spoilerEffect.setParentView(v); + } + spoilerEffect.spaces.clear(); + for (int i = 0; i < vSpan.length(); i++) { + if (vSpan.charAt(i) == ' ') { + RectF r = new RectF(); + int off = realStart + i; + int line = textLayout.getLineForOffset(off); + r.top = textLayout.getLineTop(line); + r.bottom = textLayout.getLineBottom(line); + float lh = textLayout.getPrimaryHorizontal(off), rh = textLayout.getPrimaryHorizontal(off + 1); + r.left = (int) Math.min(lh, rh); // RTL + r.right = (int) Math.max(lh, rh); + if (Math.abs(lh - rh) <= AndroidUtilities.dp(20)) { + spoilerEffect.spaces.add(r); + } + } + } + spoilers.add(spoilerEffect); + } + + /** + * Clips out spoilers from canvas + */ + public static void clipOutCanvas(Canvas canvas, List spoilers) { + tempPath.rewind(); + for (SpoilerEffect eff : spoilers) { + Rect b = eff.getBounds(); + tempPath.addRect(b.left, b.top, b.right, b.bottom, Path.Direction.CW); + } + canvas.clipPath(tempPath, Region.Op.DIFFERENCE); + } + + /** + * Optimized version of text layout double-render + * + * @param v View to use as a parent view + * @param invalidateSpoilersParent Set to invalidate parent or not + * @param spoilersColor Spoilers' color + * @param verticalOffset Additional vertical offset + * @param patchedLayoutRef Patched layout reference + * @param textLayout Layout to render + * @param spoilers Spoilers list to render + * @param canvas Canvas to render + */ + @SuppressLint("WrongConstant") + @MainThread + public static void renderWithRipple(View v, boolean invalidateSpoilersParent, int spoilersColor, int verticalOffset, AtomicReference patchedLayoutRef, Layout textLayout, List spoilers, Canvas canvas) { + if (spoilers.isEmpty()) { + textLayout.draw(canvas); + } + Layout pl = patchedLayoutRef.get(); + + if (pl == null || !textLayout.getText().toString().equals(pl.getText().toString()) || textLayout.getWidth() != pl.getWidth() || textLayout.getHeight() != pl.getHeight()) { + SpannableStringBuilder sb = new SpannableStringBuilder(textLayout.getText()); + Spannable sp = (Spannable) textLayout.getText(); + for (TextStyleSpan ss : sp.getSpans(0, sp.length(), TextStyleSpan.class)) { + if (ss.isSpoiler()) { + int start = sp.getSpanStart(ss), end = sp.getSpanEnd(ss); + for (Emoji.EmojiSpan e : sp.getSpans(start, end, Emoji.EmojiSpan.class)) { + sb.setSpan(new ReplacementSpan() { + @Override + public int getSize(@NonNull Paint paint, CharSequence text, int start, int end, @Nullable Paint.FontMetricsInt fm) { + return e.getSize(paint, text, start, end, fm); + } + + @Override + public void draw(@NonNull Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, @NonNull Paint paint) { + } + }, start, end, sp.getSpanFlags(ss)); + sb.removeSpan(e); + } + + sb.setSpan(new ForegroundColorSpan(Color.TRANSPARENT), sp.getSpanStart(ss), sp.getSpanEnd(ss), sp.getSpanFlags(ss)); + sb.removeSpan(ss); + } + } + + Layout layout; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + layout = StaticLayout.Builder.obtain(sb, 0, sb.length(), textLayout.getPaint(), textLayout.getWidth()) + .setBreakStrategy(StaticLayout.BREAK_STRATEGY_HIGH_QUALITY) + .setHyphenationFrequency(StaticLayout.HYPHENATION_FREQUENCY_NONE) + .setAlignment(Layout.Alignment.ALIGN_NORMAL) + .setLineSpacing(textLayout.getSpacingAdd(), textLayout.getSpacingMultiplier()) + .build(); + } else + layout = new StaticLayout(sb, textLayout.getPaint(), textLayout.getWidth(), textLayout.getAlignment(), textLayout.getSpacingMultiplier(), textLayout.getSpacingAdd(), false); + patchedLayoutRef.set(pl = layout); + } + + if (!spoilers.isEmpty()) { + canvas.save(); + canvas.translate(0, verticalOffset); + pl.draw(canvas); + canvas.restore(); + } else { + textLayout.draw(canvas); + } + + if (!spoilers.isEmpty()) { + tempPath.rewind(); + for (SpoilerEffect eff : spoilers) { + Rect b = eff.getBounds(); + tempPath.addRect(b.left, b.top, b.right, b.bottom, Path.Direction.CW); + } + if (!spoilers.isEmpty() && spoilers.get(0).rippleProgress != -1) { + canvas.save(); + canvas.clipPath(tempPath); + tempPath.rewind(); + if (!spoilers.isEmpty()) { + spoilers.get(0).getRipplePath(tempPath); + } + canvas.clipPath(tempPath); + canvas.translate(0, -v.getPaddingTop()); + textLayout.draw(canvas); + canvas.restore(); + } + + + boolean useAlphaLayer = spoilers.get(0).rippleProgress != -1; + if (useAlphaLayer) { + canvas.saveLayer(0, 0, v.getMeasuredWidth(), v.getMeasuredHeight(), null, canvas.ALL_SAVE_FLAG); + } else { + canvas.save(); + } + canvas.translate(0, -v.getPaddingTop()); + for (SpoilerEffect eff : spoilers) { + eff.setInvalidateParent(invalidateSpoilersParent); + if (eff.getParentView() != v) eff.setParentView(v); + if (eff.shouldInvalidateColor()) { + eff.setColor(ColorUtils.blendARGB(spoilersColor, Theme.chat_msgTextPaint.getColor(), Math.max(0, eff.getRippleProgress()))); + } else { + eff.setColor(spoilersColor); + } + eff.draw(canvas); + } + + if (useAlphaLayer) { + tempPath.rewind(); + spoilers.get(0).getRipplePath(tempPath); + if (xRefPaint == null) { + xRefPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + xRefPaint.setColor(0xff000000); + xRefPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR)); + } + canvas.drawPath(tempPath, xRefPaint); + } + canvas.restore(); + } + } + + private static class Particle { + private float x, y; + private float vecX, vecY; + private float velocity; + private float lifeTime, currentTime; + private int alpha; + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/spoilers/SpoilerEffectBitmapFactory.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/spoilers/SpoilerEffectBitmapFactory.java new file mode 100644 index 000000000..6a5ae2f15 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/spoilers/SpoilerEffectBitmapFactory.java @@ -0,0 +1,120 @@ +package org.telegram.ui.Components.spoilers; + +import android.graphics.Bitmap; +import android.graphics.BitmapShader; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Matrix; +import android.graphics.Paint; +import android.graphics.Shader; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.DispatchQueue; +import org.telegram.messenger.SharedConfig; + +import java.util.ArrayList; + +public class SpoilerEffectBitmapFactory { + + private static SpoilerEffectBitmapFactory factory; + + public static SpoilerEffectBitmapFactory getInstance() { + if (factory == null) { + factory = new SpoilerEffectBitmapFactory(); + } + return factory; + } + + final DispatchQueue dispatchQueue = new DispatchQueue("SpoilerEffectBitmapFactory"); + private Bitmap shaderBitmap; + Bitmap bufferBitmap; + Bitmap backgroundBitmap; + Canvas shaderCanvas; + Paint shaderPaint; + long lastUpdateTime; + ArrayList shaderSpoilerEffects; + boolean isRunning; + Matrix localMatrix = new Matrix(); + int size; + + private SpoilerEffectBitmapFactory() { + int maxSize = SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_HIGH ? AndroidUtilities.dp(200) : AndroidUtilities.dp(150); + size = (int) Math.min(Math.min(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y) * 0.5f, maxSize); + if (size < AndroidUtilities.dp(100)) { + size = AndroidUtilities.dp(100); + } + } + + + Paint getPaint() { + if (shaderBitmap == null) { + shaderBitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888); + shaderCanvas = new Canvas(shaderBitmap); + shaderPaint = new Paint(); + shaderSpoilerEffects = new ArrayList<>(10 * 10); + shaderPaint.setShader(new BitmapShader(shaderBitmap, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT)); + int step = (int) (size / 10f); + int particleCount = (int) (60 * (size / (float) AndroidUtilities.dp(200))); + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 10; j++) { + SpoilerEffect shaderSpoilerEffect = new SpoilerEffect(); + shaderSpoilerEffect.setBounds(step * i, step * j - AndroidUtilities.dp(5), step * i + step + AndroidUtilities.dp(3), step * j + step + AndroidUtilities.dp(5)); + shaderSpoilerEffect.drawPoints = true; + shaderSpoilerEffect.particlePoints = new float[SpoilerEffect.ALPHAS.length][particleCount * 2]; + shaderSpoilerEffect.setMaxParticlesCount(particleCount); + shaderSpoilerEffect.setColor(Color.WHITE); + shaderSpoilerEffects.add(shaderSpoilerEffect); + } + } + + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 10; j++) { + shaderSpoilerEffects.get(j + i * 10).draw(shaderCanvas); + } + } + shaderPaint.setShader(new BitmapShader(shaderBitmap, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT)); + lastUpdateTime = System.currentTimeMillis(); + } + + return shaderPaint; + } + + public void checkUpdate() { + long time = System.currentTimeMillis(); + if (time - lastUpdateTime > 32 && !isRunning) { + lastUpdateTime = System.currentTimeMillis(); + isRunning = true; + Bitmap bufferBitmapFinall = bufferBitmap; + dispatchQueue.postRunnable(() -> { + Bitmap bitmap = bufferBitmapFinall; + if (bitmap == null) { + bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888); + } + if (backgroundBitmap == null) { + backgroundBitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888); + } else { + backgroundBitmap.eraseColor(Color.TRANSPARENT); + } + Canvas shaderCanvas = new Canvas(bitmap); + Canvas backgroundCanvas = new Canvas(backgroundBitmap); + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 10; j++) { + shaderSpoilerEffects.get(j + i * 10).draw(backgroundCanvas); + } + } + bitmap.eraseColor(Color.TRANSPARENT); + shaderCanvas.drawBitmap(backgroundBitmap, 0, 0, null); + Bitmap finalBitmap = bitmap; + AndroidUtilities.runOnUIThread(() -> { + bufferBitmap = shaderBitmap; + shaderBitmap = finalBitmap; + shaderPaint.setShader(new BitmapShader(shaderBitmap, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT)); + isRunning = false; + }); + }); + } + + } + + +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/spoilers/SpoilersClickDetector.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/spoilers/SpoilersClickDetector.java new file mode 100644 index 000000000..9d9919bf4 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/spoilers/SpoilersClickDetector.java @@ -0,0 +1,70 @@ +package org.telegram.ui.Components.spoilers; + +import android.view.GestureDetector; +import android.view.MotionEvent; +import android.view.SoundEffectConstants; +import android.view.View; + +import androidx.core.view.GestureDetectorCompat; + +import java.util.List; + +public class SpoilersClickDetector { + private GestureDetectorCompat gestureDetector; + private boolean trackingTap; + + public SpoilersClickDetector(View v, List spoilers, OnSpoilerClickedListener clickedListener) { + this(v, spoilers, true, clickedListener); + } + + public SpoilersClickDetector(View v, List spoilers, boolean offsetPadding, OnSpoilerClickedListener clickedListener) { + gestureDetector = new GestureDetectorCompat(v.getContext(), new GestureDetector.SimpleOnGestureListener() { + @Override + public boolean onDown(MotionEvent e) { + int x = (int) e.getX(), y = (int) e.getY(); + y += v.getScrollY(); + if (offsetPadding) { + x -= v.getPaddingLeft(); + y -= v.getPaddingTop(); + } + for (SpoilerEffect eff : spoilers) { + if (eff.getBounds().contains(x, y)) { + trackingTap = true; + return true; + } + } + return false; + } + + @Override + public boolean onSingleTapUp(MotionEvent e) { + if (trackingTap) { + v.playSoundEffect(SoundEffectConstants.CLICK); + + trackingTap = false; + int x = (int) e.getX(), y = (int) e.getY(); + y += v.getScrollY(); + if (offsetPadding) { + x -= v.getPaddingLeft(); + y -= v.getPaddingTop(); + } + for (SpoilerEffect eff : spoilers) { + if (eff.getBounds().contains(x, y)) { + clickedListener.onSpoilerClicked(eff, x, y); + return true; + } + } + } + return false; + } + }); + } + + public boolean onTouchEvent(MotionEvent ev) { + return gestureDetector.onTouchEvent(ev); + } + + public interface OnSpoilerClickedListener { + void onSpoilerClicked(SpoilerEffect spoiler, float x, float y); + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/spoilers/SpoilersTextView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/spoilers/SpoilersTextView.java new file mode 100644 index 000000000..d51d4bff1 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/spoilers/SpoilersTextView.java @@ -0,0 +1,139 @@ +package org.telegram.ui.Components.spoilers; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.Path; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffXfermode; +import android.graphics.Rect; +import android.graphics.Region; +import android.text.Layout; +import android.text.Spannable; +import android.view.MotionEvent; +import android.widget.TextView; + +import org.telegram.messenger.AndroidUtilities; + +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; + +public class SpoilersTextView extends TextView { + private SpoilersClickDetector clickDetector; + private List spoilers = new ArrayList<>(); + private Stack spoilersPool = new Stack<>(); + private boolean isSpoilersRevealed; + private Path path = new Path(); + private Paint xRefPaint; + + public SpoilersTextView(Context context) { + super(context); + + clickDetector = new SpoilersClickDetector(this, spoilers, (eff, x, y) -> { + if (isSpoilersRevealed) return; + + eff.setOnRippleEndCallback(()->post(()->{ + isSpoilersRevealed = true; + invalidateSpoilers(); + })); + + float rad = (float) Math.sqrt(Math.pow(getWidth(), 2) + Math.pow(getHeight(), 2)); + for (SpoilerEffect ef : spoilers) + ef.startRipple(x, y, rad); + }); + } + + @Override + public boolean dispatchTouchEvent(MotionEvent event) { + if (clickDetector.onTouchEvent(event)) + return true; + return super.dispatchTouchEvent(event); + } + + @Override + public void setText(CharSequence text, BufferType type) { + isSpoilersRevealed = false; + super.setText(text, type); + } + + @Override + protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) { + super.onTextChanged(text, start, lengthBefore, lengthAfter); + invalidateSpoilers(); + } + + @Override + protected void onSizeChanged(int w, int h, int oldw, int oldh) { + super.onSizeChanged(w, h, oldw, oldh); + invalidateSpoilers(); + } + + @Override + protected void onDraw(Canvas canvas) { + int pl = getPaddingLeft(), pt = getPaddingTop(); + + canvas.save(); + path.rewind(); + for (SpoilerEffect eff : spoilers) { + Rect bounds = eff.getBounds(); + path.addRect(bounds.left + pl, bounds.top + pt, bounds.right + pl, bounds.bottom + pt, Path.Direction.CW); + } + canvas.clipPath(path, Region.Op.DIFFERENCE); + super.onDraw(canvas); + canvas.restore(); + + canvas.save(); + canvas.clipPath(path); + path.rewind(); + if (!spoilers.isEmpty()) { + spoilers.get(0).getRipplePath(path); + } + canvas.clipPath(path); + super.onDraw(canvas); + canvas.restore(); + + if (!spoilers.isEmpty()) { + boolean useAlphaLayer = spoilers.get(0).getRippleProgress() != -1; + if (useAlphaLayer) { + canvas.saveLayer(0, 0, getMeasuredWidth(), getMeasuredHeight(), null, canvas.ALL_SAVE_FLAG); + } else { + canvas.save(); + } + canvas.translate(getPaddingLeft(), getPaddingTop() + AndroidUtilities.dp(2)); + for (SpoilerEffect eff : spoilers) { + eff.setColor(getPaint().getColor()); + eff.draw(canvas); + } + + if (useAlphaLayer) { + path.rewind(); + spoilers.get(0).getRipplePath(path); + if (xRefPaint == null) { + xRefPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + xRefPaint.setColor(0xff000000); + xRefPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR)); + } + canvas.drawPath(path, xRefPaint); + } + canvas.restore(); + } + } + + private void invalidateSpoilers() { + if (spoilers == null) return; // Check for a super constructor + spoilersPool.addAll(spoilers); + spoilers.clear(); + + if (isSpoilersRevealed) { + invalidate(); + return; + } + + Layout layout = getLayout(); + if (layout != null && getText() instanceof Spannable) { + SpoilerEffect.addSpoilers(this, spoilersPool, spoilers); + } + invalidate(); + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/voip/GroupCallRenderersContainer.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/voip/GroupCallRenderersContainer.java index fd88eead9..c3c275665 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/voip/GroupCallRenderersContainer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/voip/GroupCallRenderersContainer.java @@ -1,5 +1,8 @@ package org.telegram.ui.Components.voip; +import static org.telegram.ui.GroupCallActivity.TRANSITION_DURATION; +import static org.telegram.ui.GroupCallActivity.isLandscapeMode; + import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; @@ -42,6 +45,7 @@ import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.BackDrawable; import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.Components.AvatarsDarawable; import org.telegram.ui.Components.AvatarsImageView; import org.telegram.ui.Components.CrossOutDrawable; import org.telegram.ui.Components.CubicBezierInterpolator; @@ -53,9 +57,6 @@ import org.telegram.ui.GroupCallActivity; import java.util.ArrayList; -import static org.telegram.ui.GroupCallActivity.TRANSITION_DURATION; -import static org.telegram.ui.GroupCallActivity.isLandscapeMode; - @SuppressLint("ViewConstructor") public class GroupCallRenderersContainer extends FrameLayout { @@ -287,7 +288,7 @@ public class GroupCallRenderersContainer extends FrameLayout { }; speakingMembersAvatars = new AvatarsImageView(context, true); - speakingMembersAvatars.setStyle(AvatarsImageView.STYLE_GROUP_CALL_TOOLTIP); + speakingMembersAvatars.setStyle(AvatarsDarawable.STYLE_GROUP_CALL_TOOLTIP); speakingMembersToast.setClipChildren(false); speakingMembersToast.setClipToPadding(false); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/DefaultThemesPreviewCell.java b/TMessagesProj/src/main/java/org/telegram/ui/DefaultThemesPreviewCell.java index bcd39b86c..ca6c22aea 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/DefaultThemesPreviewCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/DefaultThemesPreviewCell.java @@ -112,7 +112,7 @@ public class DefaultThemesPreviewCell extends LinearLayout { } } - NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.needSetDayNightTheme, info, true, null, accentId); + NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.needSetDayNightTheme, info, false, null, accentId); selectedPosition = position; for (int i = 0; i < adapter.items.size(); i++) { @@ -248,7 +248,7 @@ public class DefaultThemesPreviewCell extends LinearLayout { if (!Theme.isCurrentThemeDay()) { darkThemeDrawable.setCurrentFrame(darkThemeDrawable.getFramesCount() - 1); - dayNightCell.setTextAndIcon(LocaleController.getString("SettingsSwitchToDaytMode", R.string.SettingsSwitchToDayMode), darkThemeDrawable, true); + dayNightCell.setTextAndIcon(LocaleController.getString("SettingsSwitchToDayMode", R.string.SettingsSwitchToDayMode), darkThemeDrawable, true); } else { dayNightCell.setTextAndIcon(LocaleController.getString("SettingsSwitchToNightMode", R.string.SettingsSwitchToNightMode), darkThemeDrawable, true); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Delegates/ChatActivityMemberRequestsDelegate.java b/TMessagesProj/src/main/java/org/telegram/ui/Delegates/ChatActivityMemberRequestsDelegate.java index 50ab37044..ff5ee7d8a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Delegates/ChatActivityMemberRequestsDelegate.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Delegates/ChatActivityMemberRequestsDelegate.java @@ -78,7 +78,7 @@ public class ChatActivityMemberRequestsDelegate { avatarsView = new AvatarsImageView(fragment.getParentActivity(), false) { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - int width = count == 0 ? 0 : (20 * (count - 1) + 24); + int width = avatarsDarawable.count == 0 ? 0 : (20 * (avatarsDarawable.count - 1) + 24); super.onMeasure(MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(width), MeasureSpec.EXACTLY), heightMeasureSpec); } }; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java index ae3d37b4e..79c7ea3fd 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java @@ -1883,6 +1883,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter. accountInstance.getMediaDataController().loadRecents(MediaDataController.TYPE_FAVE, false, true, false); accountInstance.getMediaDataController().loadRecents(MediaDataController.TYPE_GREETINGS, false, true, false); accountInstance.getMediaDataController().checkFeaturedStickers(); + accountInstance.getMediaDataController().checkReactions(); for (String emoji : messagesController.diceEmojies) { accountInstance.getMediaDataController().loadStickersByEmojiOrName(emoji, true, true); } @@ -2595,6 +2596,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter. viewPage.addView(viewPage.progressView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER)); viewPage.listView = new DialogsRecyclerView(context, viewPage); + viewPage.listView.setAccessibilityEnabled(false); viewPage.listView.setAnimateEmptyView(true, 0); viewPage.listView.setClipToPadding(false); viewPage.listView.setPivotY(0); @@ -6472,6 +6474,18 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter. askingForPermissions = false; showFiltersHint(); } + } else if (requestCode == 4) { + boolean allGranted = true; + for (int a = 0; a < grantResults.length; a++) { + if (grantResults[a] != PackageManager.PERMISSION_GRANTED) { + allGranted = false; + break; + } + } +// if (allGranted && Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && FilesMigrationService.filesMigrationBottomSheet != null) { +// FilesMigrationService.filesMigrationBottomSheet.migrateOldFolder(); +// } + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/EmojiAnimationsOverlay.java b/TMessagesProj/src/main/java/org/telegram/ui/EmojiAnimationsOverlay.java index cccdd4e49..13bfc7b50 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/EmojiAnimationsOverlay.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/EmojiAnimationsOverlay.java @@ -1,7 +1,7 @@ package org.telegram.ui; import android.graphics.Canvas; -import android.util.Log; +import android.text.TextUtils; import android.view.HapticFeedbackConstants; import android.view.View; import android.widget.FrameLayout; @@ -10,7 +10,6 @@ import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.telegram.messenger.AndroidUtilities; -import org.telegram.messenger.Emoji; import org.telegram.messenger.EmojiData; import org.telegram.messenger.FileLog; import org.telegram.messenger.ImageLocation; @@ -26,7 +25,6 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; import org.telegram.ui.Cells.ChatMessageCell; import org.telegram.ui.Components.Bulletin; -import org.telegram.ui.Components.BulletinFactory; import org.telegram.ui.Components.RecyclerListView; import org.telegram.ui.Components.StickerSetBulletinLayout; @@ -326,8 +324,10 @@ public class EmojiAnimationsOverlay implements NotificationCenter.NotificationCe return false; } + emoji = unwrapEmoji(emoji); + if (supportedEmoji.contains(emoji)) { - ArrayList arrayList = emojiInteractionsStickersMap.get(view.getMessageObject().getStickerEmoji()); + ArrayList arrayList = emojiInteractionsStickersMap.get(emoji); if (arrayList != null && !arrayList.isEmpty()) { int sameAnimationsCount = 0; for (int i = 0; i < drawingObjects.size(); i++) { @@ -411,6 +411,23 @@ public class EmojiAnimationsOverlay implements NotificationCenter.NotificationCe return false; } + private String unwrapEmoji(String emoji) { + CharSequence fixedEmoji = emoji; + int length = emoji.length(); + for (int a = 0; a < length; a++) { + if (a < length - 1 && (fixedEmoji.charAt(a) == 0xD83C && fixedEmoji.charAt(a + 1) >= 0xDFFB && fixedEmoji.charAt(a + 1) <= 0xDFFF || fixedEmoji.charAt(a) == 0x200D && (fixedEmoji.charAt(a + 1) == 0x2640 || fixedEmoji.charAt(a + 1) == 0x2642))) { + fixedEmoji = TextUtils.concat(fixedEmoji.subSequence(0, a), fixedEmoji.subSequence(a + 2, fixedEmoji.length())); + length -= 2; + a--; + } else if (fixedEmoji.charAt(a) == 0xfe0f) { + fixedEmoji = TextUtils.concat(fixedEmoji.subSequence(0, a), fixedEmoji.subSequence(a + 1, fixedEmoji.length())); + length--; + a--; + } + } + return fixedEmoji.toString(); + } + private void sendCurrentTaps() { if (lastTappedMsgId == 0) { return; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LanguageSelectActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LanguageSelectActivity.java index 5af95fc07..3c6cad8b7 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LanguageSelectActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LanguageSelectActivity.java @@ -8,18 +8,28 @@ package org.telegram.ui; +import android.animation.ValueAnimator; import android.content.Context; +import android.content.DialogInterface; +import android.content.SharedPreferences; +import android.content.res.Configuration; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.FrameLayout; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import android.widget.LinearLayout; +import android.widget.TextView; + import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.FileLog; import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MessagesController; import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; import org.telegram.messenger.Utilities; @@ -28,12 +38,22 @@ import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenu; import org.telegram.ui.ActionBar.ActionBarMenuItem; +import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.ActionBar.ThemeDescription; import org.telegram.ui.Cells.LanguageCell; +import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.ActionBar.ThemeDescription; +import org.telegram.ui.Cells.HeaderCell; +import org.telegram.ui.Cells.LanguageCell; import org.telegram.ui.Cells.ShadowSectionCell; import org.telegram.ui.Components.AlertsCreator; +import org.telegram.ui.Cells.TextCheckCell; +import org.telegram.ui.Cells.TextInfoPrivacyCell; +import org.telegram.ui.Cells.TextRadioCell; +import org.telegram.ui.Cells.TextSettingsCell; +import org.telegram.ui.Components.CubicBezierInterpolator; import org.telegram.ui.Components.EmptyTextProgressView; import org.telegram.ui.Components.LayoutHelper; import org.telegram.ui.Components.RecyclerListView; @@ -41,6 +61,7 @@ import org.telegram.ui.Components.RecyclerListView; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +import java.util.HashSet; import java.util.Timer; import java.util.TimerTask; @@ -123,6 +144,13 @@ public class LanguageSelectActivity extends BaseFragment implements Notification if (listView != null) { listView.setAdapter(searchListViewAdapter); } + } else { + searching = false; + searchWas = false; + if (listView != null) { + emptyView.setVisibility(View.GONE); + listView.setAdapter(listAdapter); + } } } }); @@ -167,6 +195,7 @@ public class LanguageSelectActivity extends BaseFragment implements Notification finishFragment(); }); + // NekoX: Merge 8.4.1, Remove offcial changes listView.setOnItemLongClickListener((view, position) -> { if (getParentActivity() == null || parentLayout == null || !(view instanceof LanguageCell)) { return false; @@ -240,7 +269,7 @@ public class LanguageSelectActivity extends BaseFragment implements Notification if (id == NotificationCenter.suggestedLangpack) { if (listAdapter != null) { fillLanguages(); - listAdapter.notifyDataSetChanged(); + AndroidUtilities.runOnUIThread(() -> { listAdapter.notifyDataSetChanged(); }); } } } @@ -289,28 +318,33 @@ public class LanguageSelectActivity extends BaseFragment implements Notification public void search(final String query) { if (query == null) { + searching = false; searchResult = null; - } else { - try { - if (searchTimer != null) { - searchTimer.cancel(); - } - } catch (Exception e) { - FileLog.e(e); + if (listView != null) { + emptyView.setVisibility(View.GONE); + listView.setAdapter(listAdapter); } - searchTimer = new Timer(); - searchTimer.schedule(new TimerTask() { - @Override - public void run() { - try { - searchTimer.cancel(); - searchTimer = null; - } catch (Exception e) { - FileLog.e(e); - } - processSearch(query); - } - }, 100, 300); + } else { +// try { +// if (searchTimer != null) { +// searchTimer.cancel(); +// } +// } catch (Exception e) { +// FileLog.e(e); +// } +// searchTimer = new Timer(); +// searchTimer.schedule(new TimerTask() { +// @Override +// public void run() { +// try { +// searchTimer.cancel(); +// searchTimer = null; +// } catch (Exception e) { +// FileLog.e(e); +// } + processSearch(query); +// } +// }, 100, 300); } } @@ -393,6 +427,8 @@ public class LanguageSelectActivity extends BaseFragment implements Notification }); } + // NekoX: Merge 8.4.1, remove TranslateSettings + private class ListAdapter extends RecyclerListView.SelectionAdapter { private Context mContext; @@ -433,9 +469,20 @@ public class LanguageSelectActivity extends BaseFragment implements Notification switch (viewType) { case 0: { view = new LanguageCell(mContext, false); +// view = new TextRadioCell(mContext); view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); break; } +// case 2: +// TranslateSettings translateSettings = new TranslateSettings(mContext); +// view = translateSettings; +// break; +// case 3: +// HeaderCell header = new HeaderCell(mContext); +// header.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); +// header.setText(LocaleController.getString("Language", R.string.Language)); +// view = header; +// break; case 1: default: { view = new ShadowSectionCell(mContext); @@ -450,6 +497,7 @@ public class LanguageSelectActivity extends BaseFragment implements Notification switch (holder.getItemViewType()) { case 0: { LanguageCell textSettingsCell = (LanguageCell) holder.itemView; +// TextRadioCell textSettingsCell = (TextRadioCell) holder.itemView; LocaleController.LocaleInfo localeInfo; boolean last; if (search) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java index bfa43ce22..f27c14a4d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java @@ -2029,12 +2029,12 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa String msgID = data.getQueryParameter("message_id"); if (userID != null) { try { - push_user_id = Integer.parseInt(userID); + push_user_id = Long.parseLong(userID); } catch (NumberFormatException ignore) { } } else if (chatID != null) { try { - push_chat_id = Integer.parseInt(chatID); + push_chat_id = Long.parseLong(chatID); } catch (NumberFormatException ignore) { } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LoginActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LoginActivity.java index 64cd98cc8..b89a583f9 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LoginActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LoginActivity.java @@ -1213,6 +1213,9 @@ public class LoginActivity extends BaseFragment implements NotificationCenter.No return; } if (showDoneAnimation[currentDoneType] != null) { + if (animated) { + showDoneAnimation[currentDoneType].removeAllListeners(); + } showDoneAnimation[currentDoneType].cancel(); } doneButtonVisible[currentDoneType] = show; @@ -1220,7 +1223,10 @@ public class LoginActivity extends BaseFragment implements NotificationCenter.No showDoneAnimation[currentDoneType] = new AnimatorSet(); if (show) { if (floating) { - floatingButtonContainer.setVisibility(View.VISIBLE); + if (floatingButtonContainer.getVisibility() != View.VISIBLE) { + floatingButtonContainer.setTranslationY(AndroidUtilities.dpf2(70f)); + floatingButtonContainer.setVisibility(View.VISIBLE); + } showDoneAnimation[currentDoneType].play(ObjectAnimator.ofFloat(floatingButtonContainer, View.TRANSLATION_Y, 0f)); } else { doneItem.setVisibility(View.VISIBLE); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/MediaCalendarActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/MediaCalendarActivity.java new file mode 100644 index 000000000..4b6d57f30 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/MediaCalendarActivity.java @@ -0,0 +1,642 @@ +package org.telegram.ui; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.drawable.Drawable; +import android.os.Bundle; +import android.text.TextPaint; +import android.util.Log; +import android.util.SparseArray; +import android.view.Gravity; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewGroup; +import android.widget.FrameLayout; + +import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; +import androidx.core.graphics.ColorUtils; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.DownloadController; +import org.telegram.messenger.FileLoader; +import org.telegram.messenger.ImageLocation; +import org.telegram.messenger.ImageReceiver; +import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MessageObject; +import org.telegram.messenger.MessagesController; +import org.telegram.messenger.R; +import org.telegram.messenger.SharedConfig; +import org.telegram.tgnet.ConnectionsManager; +import org.telegram.tgnet.TLRPC; +import org.telegram.ui.ActionBar.ActionBar; +import org.telegram.ui.ActionBar.BaseFragment; +import org.telegram.ui.ActionBar.SimpleTextView; +import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.ActionBar.ThemeDescription; +import org.telegram.ui.Components.FlickerLoadingView; +import org.telegram.ui.Components.LayoutHelper; +import org.telegram.ui.Components.RecyclerListView; +import org.telegram.ui.Components.SharedMediaLayout; + +import java.time.DayOfWeek; +import java.time.YearMonth; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Random; + +public class MediaCalendarActivity extends BaseFragment { + + FrameLayout contentView; + + RecyclerListView listView; + LinearLayoutManager layoutManager; + TextPaint textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); + TextPaint activeTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); + TextPaint textPaint2 = new TextPaint(Paint.ANTI_ALIAS_FLAG); + + Paint blackoutPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + + private long dialogId; + private boolean loading; + private boolean checkEnterItems; + + + int startFromYear; + int startFromMonth; + int monthCount; + + CalendarAdapter adapter; + Callback callback; + + + SparseArray> messagesByYearMounth = new SparseArray<>(); + boolean endReached; + int startOffset = 0; + int lastId; + int minMontYear; + private int photosVideosTypeFilter; + private boolean isOpened; + int selectedYear; + int selectedMonth; + + public MediaCalendarActivity(Bundle args, int photosVideosTypeFilter, int selectedDate) { + super(args); + this.photosVideosTypeFilter = photosVideosTypeFilter; + + if (selectedDate != 0) { + Calendar calendar = Calendar.getInstance(); + calendar.setTimeInMillis(selectedDate * 1000L); + selectedYear = calendar.get(Calendar.YEAR); + selectedMonth = calendar.get(Calendar.MONTH); + } + } + + @Override + public boolean onFragmentCreate() { + dialogId = getArguments().getLong("dialog_id"); + return super.onFragmentCreate(); + } + + @Override + public View createView(Context context) { + textPaint.setTextSize(AndroidUtilities.dp(16)); + textPaint.setTextAlign(Paint.Align.CENTER); + + textPaint2.setTextSize(AndroidUtilities.dp(11)); + textPaint2.setTextAlign(Paint.Align.CENTER); + textPaint2.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); + + activeTextPaint.setTextSize(AndroidUtilities.dp(16)); + activeTextPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); + activeTextPaint.setTextAlign(Paint.Align.CENTER); + + contentView = new FrameLayout(context); + createActionBar(context); + contentView.addView(actionBar); + actionBar.setTitle(LocaleController.getString("Calendar", R.string.Calendar)); + actionBar.setCastShadows(false); + + listView = new RecyclerListView(context) { + @Override + protected void dispatchDraw(Canvas canvas) { + super.dispatchDraw(canvas); + checkEnterItems = false; + } + }; + listView.setLayoutManager(layoutManager = new LinearLayoutManager(context)); + layoutManager.setReverseLayout(true); + listView.setAdapter(adapter = new CalendarAdapter()); + listView.addOnScrollListener(new RecyclerView.OnScrollListener() { + @Override + public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { + super.onScrolled(recyclerView, dx, dy); + checkLoadNext(); + } + }); + + contentView.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, 0, 0, 36, 0, 0)); + + final String[] daysOfWeek = new String[]{ + LocaleController.getString("CalendarWeekNameShortMonday", R.string.CalendarWeekNameShortMonday), + LocaleController.getString("CalendarWeekNameShortTuesday", R.string.CalendarWeekNameShortTuesday), + LocaleController.getString("CalendarWeekNameShortWednesday", R.string.CalendarWeekNameShortWednesday), + LocaleController.getString("CalendarWeekNameShortThursday", R.string.CalendarWeekNameShortThursday), + LocaleController.getString("CalendarWeekNameShortFriday", R.string.CalendarWeekNameShortFriday), + LocaleController.getString("CalendarWeekNameShortSaturday", R.string.CalendarWeekNameShortSaturday), + LocaleController.getString("CalendarWeekNameShortSunday", R.string.CalendarWeekNameShortSunday), + }; + + Drawable headerShadowDrawable = ContextCompat.getDrawable(context, R.drawable.header_shadow).mutate(); + + View calendarSignatureView = new View(context) { + + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + float xStep = getMeasuredWidth() / 7f; + for (int i = 0; i < 7; i++) { + float cx = xStep * i + xStep / 2f; + float cy = (getMeasuredHeight() - AndroidUtilities.dp(2)) / 2f; + canvas.drawText(daysOfWeek[i], cx, cy + AndroidUtilities.dp(5), textPaint2); + } + headerShadowDrawable.setBounds(0, getMeasuredHeight() - AndroidUtilities.dp(3), getMeasuredWidth(), getMeasuredHeight()); + headerShadowDrawable.draw(canvas); + } + }; + + contentView.addView(calendarSignatureView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 38, 0, 0, 0, 0, 0)); + actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() { + @Override + public void onItemClick(int id) { + if (id == -1) { + finishFragment(); + } + } + }); + + fragmentView = contentView; + + Calendar calendar = Calendar.getInstance(); + startFromYear = calendar.get(Calendar.YEAR); + startFromMonth = calendar.get(Calendar.MONTH); + + if (selectedYear != 0) { + monthCount = (startFromYear - selectedYear) * 12 + startFromMonth - selectedMonth + 1; + layoutManager.scrollToPositionWithOffset(monthCount - 1, AndroidUtilities.dp(120)); + } + if (monthCount < 3) { + monthCount = 3; + } + + + loadNext(); + updateColors(); + activeTextPaint.setColor(Color.WHITE); + actionBar.setBackButtonImage(R.drawable.ic_ab_back); + return fragmentView; + } + + private void updateColors() { + actionBar.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); + activeTextPaint.setColor(Color.WHITE); + textPaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); + textPaint2.setColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); + actionBar.setTitleColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); + actionBar.setBackButtonImage(R.drawable.ic_ab_back); + actionBar.setItemsColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText), false); + actionBar.setItemsBackgroundColor(Theme.getColor(Theme.key_listSelector), false); + } + + private void loadNext() { + if (loading || endReached) { + return; + } + loading = true; + TLRPC.TL_messages_getSearchResultsCalendar req = new TLRPC.TL_messages_getSearchResultsCalendar(); + if (photosVideosTypeFilter == SharedMediaLayout.FILTER_PHOTOS_ONLY) { + req.filter = new TLRPC.TL_inputMessagesFilterPhotos(); + } else if (photosVideosTypeFilter == SharedMediaLayout.FILTER_VIDEOS_ONLY) { + req.filter = new TLRPC.TL_inputMessagesFilterVideo(); + } else { + req.filter = new TLRPC.TL_inputMessagesFilterPhotoVideo(); + } + + req.peer = MessagesController.getInstance(currentAccount).getInputPeer(dialogId); + req.offset_id = lastId; + + Calendar calendar = Calendar.getInstance(); + listView.setItemAnimator(null); + getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { + if (error == null) { + TLRPC.TL_messages_searchResultsCalendar res = (TLRPC.TL_messages_searchResultsCalendar) response; + + for (int i = 0; i < res.periods.size(); i++) { + TLRPC.TL_searchResultsCalendarPeriod period = res.periods.get(i); + calendar.setTimeInMillis(period.date * 1000L); + int month = calendar.get(Calendar.YEAR) * 100 + calendar.get(Calendar.MONTH); + SparseArray messagesByDays = messagesByYearMounth.get(month); + if (messagesByDays == null) { + messagesByDays = new SparseArray<>(); + messagesByYearMounth.put(month, messagesByDays); + } + PeriodDay periodDay = new PeriodDay(); + MessageObject messageObject = new MessageObject(currentAccount, res.messages.get(i), false, false); + periodDay.messageObject = messageObject; + startOffset += res.periods.get(i).count; + periodDay.startOffset = startOffset; + int index = calendar.get(Calendar.DAY_OF_MONTH) - 1; + if (messagesByDays.get(index, null) == null) { + messagesByDays.put(index, periodDay); + } + if (month < minMontYear || minMontYear == 0) { + minMontYear = month; + } + + } + + loading = false; + if (!res.messages.isEmpty()) { + lastId = res.messages.get(res.messages.size() - 1).id; + endReached = false; + checkLoadNext(); + } else { + endReached = true; + } + if (isOpened) { + checkEnterItems = true; + } + listView.invalidate(); + int newMonthCount = (int) (((calendar.getTimeInMillis() / 1000) - res.min_date) / 2629800) + 1; + adapter.notifyItemRangeChanged(0, monthCount); + if (newMonthCount > monthCount) { + adapter.notifyItemRangeInserted(monthCount + 1, newMonthCount); + monthCount = newMonthCount; + } + if (endReached) { + resumeDelayedFragmentAnimation(); + } + } + })); + } + + private void checkLoadNext() { + if (loading || endReached) { + return; + } + int listMinMonth = Integer.MAX_VALUE; + for (int i = 0; i < listView.getChildCount(); i++) { + View child = listView.getChildAt(i); + if (child instanceof MonthView) { + int currentMonth = ((MonthView) child).currentYear * 100 + ((MonthView) child).currentMonthInYear; + if (currentMonth < listMinMonth) { + listMinMonth = currentMonth; + } + } + }; + int min1 = (minMontYear / 100 * 12) + minMontYear % 100; + int min2 = (listMinMonth / 100 * 12) + listMinMonth % 100; + if (min1 + 3 >= min2) { + loadNext(); + } + } + + private class CalendarAdapter extends RecyclerView.Adapter { + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + return new RecyclerListView.Holder(new MonthView(parent.getContext())); + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + MonthView monthView = (MonthView) holder.itemView; + + int year = startFromYear - position / 12; + int month = startFromMonth - position % 12; + if (month < 0) { + month += 12; + year--; + } + boolean animated = monthView.currentYear == year && monthView.currentMonthInYear == month; + monthView.setDate(year, month, messagesByYearMounth.get(year * 100 + month), animated); + } + + @Override + public long getItemId(int position) { + int year = startFromYear - position / 12; + int month = startFromMonth - position % 12; + return year * 100L + month; + } + + @Override + public int getItemCount() { + return monthCount; + } + } + + private class MonthView extends FrameLayout { + + SimpleTextView titleView; + int currentYear; + int currentMonthInYear; + int daysInMonth; + int startDayOfWeek; + int cellCount; + int startMonthTime; + + SparseArray messagesByDays = new SparseArray<>(); + SparseArray imagesByDays = new SparseArray<>(); + + SparseArray animatedFromMessagesByDays = new SparseArray<>(); + SparseArray animatedFromImagesByDays = new SparseArray<>(); + + boolean attached; + float animationProgress = 1f; + + public MonthView(Context context) { + super(context); + setWillNotDraw(false); + titleView = new SimpleTextView(context); + titleView.setTextSize(15); + titleView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); + titleView.setGravity(Gravity.CENTER); + titleView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); + addView(titleView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 28, 0, 0, 12, 0, 4)); + } + + public void setDate(int year, int monthInYear, SparseArray messagesByDays, boolean animated) { + boolean dateChanged = year != currentYear && monthInYear != currentMonthInYear; + currentYear = year; + currentMonthInYear = monthInYear; + this.messagesByDays = messagesByDays; + + if (dateChanged) { + if (imagesByDays != null) { + for (int i = 0; i < imagesByDays.size(); i++) { + imagesByDays.valueAt(i).onDetachedFromWindow(); + imagesByDays.valueAt(i).setParentView(null); + } + imagesByDays = null; + } + } + if (messagesByDays != null) { + if (imagesByDays == null) { + imagesByDays = new SparseArray<>(); + } + + for (int i = 0; i < messagesByDays.size(); i++) { + int key = messagesByDays.keyAt(i); + if (imagesByDays.get(key, null) != null) { + continue; + } + ImageReceiver receiver = new ImageReceiver(); + receiver.setParentView(this); + PeriodDay periodDay = messagesByDays.get(key); + MessageObject messageObject = periodDay.messageObject; + if (messageObject != null) { + if (messageObject.isVideo()) { + TLRPC.Document document = messageObject.getDocument(); + TLRPC.PhotoSize thumb = FileLoader.getClosestPhotoSizeWithSize(document.thumbs, 50); + TLRPC.PhotoSize qualityThumb = FileLoader.getClosestPhotoSizeWithSize(document.thumbs, 320); + if (thumb == qualityThumb) { + qualityThumb = null; + } + if (thumb != null) { + if (messageObject.strippedThumb != null) { + receiver.setImage(ImageLocation.getForDocument(qualityThumb, document), "44_44", messageObject.strippedThumb, null, messageObject, 0); + } else { + receiver.setImage(ImageLocation.getForDocument(qualityThumb, document), "44_44", ImageLocation.getForDocument(thumb, document), "b", (String) null, messageObject, 0); + } + } + } else if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaPhoto && messageObject.messageOwner.media.photo != null && !messageObject.photoThumbs.isEmpty()) { + TLRPC.PhotoSize currentPhotoObjectThumb = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, 50); + TLRPC.PhotoSize currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, 320, false, currentPhotoObjectThumb, false); + if (messageObject.mediaExists || DownloadController.getInstance(currentAccount).canDownloadMedia(messageObject)) { + if (currentPhotoObject == currentPhotoObjectThumb) { + currentPhotoObjectThumb = null; + } + if (messageObject.strippedThumb != null) { + receiver.setImage(ImageLocation.getForObject(currentPhotoObject, messageObject.photoThumbsObject), "44_44", null, null, messageObject.strippedThumb, currentPhotoObject != null ? currentPhotoObject.size : 0, null, messageObject, messageObject.shouldEncryptPhotoOrVideo() ? 2 : 1); + } else { + receiver.setImage(ImageLocation.getForObject(currentPhotoObject, messageObject.photoThumbsObject), "44_44", ImageLocation.getForObject(currentPhotoObjectThumb, messageObject.photoThumbsObject), "b", currentPhotoObject != null ? currentPhotoObject.size : 0, null, messageObject, messageObject.shouldEncryptPhotoOrVideo() ? 2 : 1); + } + } else { + if (messageObject.strippedThumb != null) { + receiver.setImage(null, null, messageObject.strippedThumb, null, messageObject, 0); + } else { + receiver.setImage(null, null, ImageLocation.getForObject(currentPhotoObjectThumb, messageObject.photoThumbsObject), "b", (String) null, messageObject, 0); + } + } + } + receiver.setRoundRadius(AndroidUtilities.dp(22)); + imagesByDays.put(key, receiver); + } + } + } + + YearMonth yearMonthObject = YearMonth.of(year, monthInYear + 1); + daysInMonth = yearMonthObject.lengthOfMonth(); + + Calendar calendar = Calendar.getInstance(); + calendar.set(year, monthInYear, 0); + startDayOfWeek = (calendar.get(Calendar.DAY_OF_WEEK) + 6) % 7; + startMonthTime= (int) (calendar.getTimeInMillis() / 1000L); + + int totalColumns = daysInMonth + startDayOfWeek; + cellCount = (int) (totalColumns / 7f) + (totalColumns % 7 == 0 ? 0 : 1); + calendar.set(year, monthInYear + 1, 0); + titleView.setText(LocaleController.formatYearMont(calendar.getTimeInMillis() / 1000, true)); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(cellCount * (44 + 8) + 44), MeasureSpec.EXACTLY)); + } + + boolean pressed; + float pressedX; + float pressedY; + + @Override + public boolean onTouchEvent(MotionEvent event) { + if (event.getAction() == MotionEvent.ACTION_DOWN) { + pressed = true; + pressedX = event.getX(); + pressedY = event.getY(); + } else if (event.getAction() == MotionEvent.ACTION_UP) { + if (pressed) { + for (int i = 0; i < imagesByDays.size(); i++) { + if (imagesByDays.valueAt(i).getDrawRegion().contains(pressedX, pressedY)) { + if (callback != null) { + PeriodDay periodDay = messagesByDays.valueAt(i); + callback.onDateSelected(periodDay.messageObject.getId(), periodDay.startOffset); + finishFragment(); + break; + } + } + } + } + pressed = false; + } else if (event.getAction() == MotionEvent.ACTION_CANCEL) { + pressed = false; + } + return pressed; + } + + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + + int currentCell = 0; + int currentColumn = startDayOfWeek; + + float xStep = getMeasuredWidth() / 7f; + float yStep = AndroidUtilities.dp(44 + 8); + for (int i = 0; i < daysInMonth; i++) { + float cx = xStep * currentColumn + xStep / 2f; + float cy = yStep * currentCell + yStep / 2f + AndroidUtilities.dp(44); + int nowTime = (int) (System.currentTimeMillis() / 1000L); + if (nowTime < startMonthTime + (i + 1) * 86400) { + int oldAlpha = textPaint.getAlpha(); + textPaint.setAlpha((int) (oldAlpha * 0.3f)); + canvas.drawText(Integer.toString(i + 1), cx, cy + AndroidUtilities.dp(5), textPaint); + textPaint.setAlpha(oldAlpha); + } else if (messagesByDays != null && messagesByDays.get(i, null) != null) { + float alpha = 1f; + if (imagesByDays.get(i) != null) { + if (checkEnterItems && !messagesByDays.get(i).wasDrawn) { + messagesByDays.get(i).enterAlpha = 0f; + messagesByDays.get(i).startEnterDelay = (cy + getY()) / listView.getMeasuredHeight() * 150; + } + if (messagesByDays.get(i).startEnterDelay > 0) { + messagesByDays.get(i).startEnterDelay -= 16; + if (messagesByDays.get(i).startEnterDelay < 0) { + messagesByDays.get(i).startEnterDelay = 0; + } else { + invalidate(); + } + } + if (messagesByDays.get(i).startEnterDelay == 0 && messagesByDays.get(i).enterAlpha != 1f) { + messagesByDays.get(i).enterAlpha += 16 / 220f; + if (messagesByDays.get(i).enterAlpha > 1f) { + messagesByDays.get(i).enterAlpha = 1f; + } else { + invalidate(); + } + } + alpha = messagesByDays.get(i).enterAlpha; + if (alpha != 1f) { + canvas.save(); + float s = 0.8f + 0.2f * alpha; + canvas.scale(s, s,cx, cy); + } + imagesByDays.get(i).setAlpha(messagesByDays.get(i).enterAlpha); + imagesByDays.get(i).setImageCoords(cx - AndroidUtilities.dp(44) / 2f, cy - AndroidUtilities.dp(44) / 2f, AndroidUtilities.dp(44), AndroidUtilities.dp(44)); + imagesByDays.get(i).draw(canvas); + blackoutPaint.setColor(ColorUtils.setAlphaComponent(Color.BLACK, (int) (messagesByDays.get(i).enterAlpha * 80))); + canvas.drawCircle(cx, cy, AndroidUtilities.dp(44) / 2f, blackoutPaint); + messagesByDays.get(i).wasDrawn = true; + if (alpha != 1f) { + canvas.restore(); + } + } + if (alpha != 1f) { + int oldAlpha = textPaint.getAlpha(); + textPaint.setAlpha((int) (oldAlpha * (1f - alpha))); + canvas.drawText(Integer.toString(i + 1), cx, cy + AndroidUtilities.dp(5), textPaint); + textPaint.setAlpha(oldAlpha); + + oldAlpha = textPaint.getAlpha(); + activeTextPaint.setAlpha((int) (oldAlpha * alpha)); + canvas.drawText(Integer.toString(i + 1), cx, cy + AndroidUtilities.dp(5), activeTextPaint); + activeTextPaint.setAlpha(oldAlpha); + } else { + canvas.drawText(Integer.toString(i + 1), cx, cy + AndroidUtilities.dp(5), activeTextPaint); + } + + } else { + canvas.drawText(Integer.toString(i + 1), cx, cy + AndroidUtilities.dp(5), textPaint); + } + + currentColumn++; + if (currentColumn >= 7) { + currentColumn = 0; + currentCell++; + } + } + } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + attached = true; + if (imagesByDays != null) { + for (int i = 0; i < imagesByDays.size(); i++) { + imagesByDays.valueAt(i).onAttachedToWindow(); + } + } + } + + @Override + protected void onDetachedFromWindow() { + super.onDetachedFromWindow(); + attached = false; + if (imagesByDays != null) { + for (int i = 0; i < imagesByDays.size(); i++) { + imagesByDays.valueAt(i).onDetachedFromWindow(); + } + } + } + } + + public void setCallback(Callback callback) { + this.callback = callback; + } + + public interface Callback { + void onDateSelected(int messageId, int startOffset); + } + + private class PeriodDay { + MessageObject messageObject; + int startOffset; + float enterAlpha = 1f; + float startEnterDelay = 1f; + boolean wasDrawn; + } + + @Override + public ArrayList getThemeDescriptions() { + + ThemeDescription.ThemeDescriptionDelegate descriptionDelegate = new ThemeDescription.ThemeDescriptionDelegate() { + @Override + public void didSetColor() { + updateColors(); + } + }; + ArrayList themeDescriptions = new ArrayList<>(); + new ThemeDescription(null, 0, null, null, null, descriptionDelegate, Theme.key_windowBackgroundWhite); + new ThemeDescription(null, 0, null, null, null, descriptionDelegate, Theme.key_windowBackgroundWhiteBlackText); + new ThemeDescription(null, 0, null, null, null, descriptionDelegate, Theme.key_listSelector); + + + return super.getThemeDescriptions(); + } + + @Override + public boolean needDelayOpenAnimation() { + return true; + } + + @Override + protected void onTransitionAnimationStart(boolean isOpen, boolean backward) { + super.onTransitionAnimationStart(isOpen, backward); + isOpened = true; + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/MessageSeenView.java b/TMessagesProj/src/main/java/org/telegram/ui/MessageSeenView.java index 9b9b41e56..1ea79f546 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/MessageSeenView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/MessageSeenView.java @@ -1,8 +1,6 @@ package org.telegram.ui; import android.content.Context; -import android.graphics.Canvas; -import android.graphics.ColorFilter; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.Rect; @@ -21,23 +19,19 @@ import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import com.google.android.exoplayer2.util.Log; - import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.ChatObject; import org.telegram.messenger.ContactsController; -import org.telegram.messenger.FileLog; import org.telegram.messenger.ImageLocation; import org.telegram.messenger.LocaleController; import org.telegram.messenger.MessageObject; import org.telegram.messenger.MessagesController; import org.telegram.messenger.R; import org.telegram.tgnet.ConnectionsManager; -import org.telegram.tgnet.RequestDelegate; -import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Components.AvatarDrawable; +import org.telegram.ui.Components.AvatarsDarawable; import org.telegram.ui.Components.AvatarsImageView; import org.telegram.ui.Components.BackupImageView; import org.telegram.ui.Components.FlickerLoadingView; @@ -47,7 +41,6 @@ import org.telegram.ui.Components.RecyclerListView; import java.util.ArrayList; import java.util.HashMap; -import java.util.Vector; public class MessageSeenView extends FrameLayout { @@ -79,7 +72,7 @@ public class MessageSeenView extends FrameLayout { addView(titleView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL, 40, 0, 62, 0)); avatarsImageView = new AvatarsImageView(context, false); - avatarsImageView.setStyle(AvatarsImageView.STYLE_MESSAGE_SEEN); + avatarsImageView.setStyle(AvatarsDarawable.STYLE_MESSAGE_SEEN); addView(avatarsImageView, LayoutHelper.createFrame(24 + 12 + 12 + 8, LayoutHelper.MATCH_PARENT, Gravity.RIGHT | Gravity.CENTER_VERTICAL, 0, 0, 0, 0)); titleView.setTextColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem)); @@ -102,7 +95,6 @@ public class MessageSeenView extends FrameLayout { } long finalFromId = fromId; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { - FileLog.e("MessageSeenView request completed"); if (error == null) { TLRPC.Vector vector = (TLRPC.Vector) response; ArrayList unknownUsers = new ArrayList<>(); @@ -227,7 +219,11 @@ public class MessageSeenView extends FrameLayout { if (peerIds.size() == 1 && users.get(0) != null) { titleView.setText(ContactsController.formatName(users.get(0).first_name, users.get(0).last_name)); } else { - titleView.setText(LocaleController.formatPluralString(isVoice ? "MessagePlayed" : "MessageSeen", peerIds.size())); + if (peerIds.size() == 0) { + titleView.setText(LocaleController.getString(LocaleController.getString("NobodyViewed", R.string.NobodyViewed))); + } else { + titleView.setText(LocaleController.formatPluralString(isVoice ? "MessagePlayed" : "MessageSeen", peerIds.size())); + } } titleView.animate().alpha(1f).setDuration(220).start(); avatarsImageView.animate().alpha(1f).setDuration(220).start(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java index 1818410c8..1c093e987 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java @@ -255,6 +255,7 @@ import org.telegram.ui.Components.VideoPlayerSeekBar; import org.telegram.ui.Components.VideoSeekPreviewImage; import org.telegram.ui.Components.VideoTimelinePlayView; import org.telegram.ui.Components.ViewHelper; +import org.telegram.ui.Components.spoilers.SpoilersTextView; import java.io.ByteArrayInputStream; import java.io.File; @@ -6333,7 +6334,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat } private TextView createCaptionTextView(LinkMovementMethod linkMovementMethod) { - TextView textView = new TextView(activityContext) { + TextView textView = new SpoilersTextView(activityContext) { private boolean handleClicks; @@ -10240,6 +10241,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat } else { menuItem.hideSubItem(gallery_menu_delete); } + menuItem.checkHideMenuItem(); boolean noforwards = MessagesController.getInstance(UserConfig.selectedAccount).isChatNoForwards(newMessageObject.getChatId()); if (isEmbedVideo) { menuItem.showSubItem(gallery_menu_openin); @@ -10266,9 +10268,11 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat } else { menuItem.hideSubItem(gallery_menu_masks2); } + menuItem.checkHideMenuItem(); } else { speedGap.setVisibility(View.GONE); menuItem.hideSubItem(gallery_menu_openin); + menuItem.checkHideMenuItem(); final boolean pipItemVisible = pipItem.getVisibility() == View.VISIBLE; final boolean shouldMasksItemBeVisible = newMessageObject.hasAttachedStickers() && !DialogObject.isEncryptedDialog(newMessageObject.getDialogId()); if (pipItemVisible) { @@ -10505,9 +10509,11 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat actionBar.setTitle(LocaleController.formatString("Of", R.string.Of, switchingToIndex + 1, imagesArrLocations.size())); } boolean noforwards = avatarsDialogId != 0 && MessagesController.getInstance(currentAccount).isChatNoForwards(-avatarsDialogId); - if (noforwards) + if (noforwards) { menuItem.hideSubItem(gallery_menu_save); - else menuItem.showSubItem(gallery_menu_save); + } else { + menuItem.showSubItem(gallery_menu_save); + } menuItem.showSubItem(gallery_menu_scan); allowShare = !noforwards; shareButton.setVisibility(allowShare ? View.VISIBLE : View.GONE); @@ -10517,6 +10523,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat } else { menuItem.showSubItem(gallery_menu_share); } + menuItem.checkHideMenuItem(); groupedPhotosListView.fillList(); } else if (!imagesArrLocals.isEmpty()) { if (index < 0 || index >= imagesArrLocals.size()) { @@ -10724,7 +10731,10 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat if (isVideo) { if (!MessagesController.getInstance(UserConfig.selectedAccount).isChatNoForwards(-currentDialogId)) menuItem.showSubItem(gallery_menu_openin); - else menuItem.hideSubItem(gallery_menu_openin); + else { + menuItem.hideSubItem(gallery_menu_openin); + } + menuItem.checkHideMenuItem(); if (!pipAvailable) { pipItem.setEnabled(false); @@ -10751,9 +10761,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat } else { menuItem.hideSubItem(gallery_menu_savegif); } + menuItem.checkHideMenuItem(); actionBar.setTitle(LocaleController.getString("AttachGif", R.string.AttachGif)); } else { - menuItem.setVisibility(View.VISIBLE); if (size == 1) { if (isVideo) { actionBar.setTitle(LocaleController.getString("AttachVideo", R.string.AttachVideo)); @@ -10765,6 +10775,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat } menuItem.showSubItem(gallery_menu_save); menuItem.hideSubItem(gallery_menu_savegif); + menuItem.checkHideMenuItem(); } groupedPhotosListView.fillList(); pageBlocksAdapter.updateSlideshowCell(pageBlock); @@ -11329,7 +11340,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat Theme.createChatResources(null, true); CharSequence str; if (messageObject != null && !messageObject.messageOwner.entities.isEmpty()) { - Spannable spannableString = SpannableString.valueOf(caption.toString()); + Spannable spannableString = SpannableString.valueOf(caption); messageObject.addEntitiesToText(spannableString, true, false); if (messageObject.isVideo()) { MessageObject.addUrlsByPattern(messageObject.isOutOwner(), spannableString, false, 3, messageObject.getDuration(), false); @@ -12571,7 +12582,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat disableShowCheck = false; object.imageReceiver.setVisible(false, true); }; - if (parentChatActivity != null) { + if (parentChatActivity != null && parentChatActivity.getFragmentView() != null) { parentChatActivity.getUndoView().hide(false, 1); parentChatActivity.getFragmentView().invalidate(); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java index ed6c09335..fe76235e8 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java @@ -45,6 +45,7 @@ import android.text.Spanned; import android.text.TextPaint; import android.text.TextUtils; import android.text.style.ForegroundColorSpan; +import android.util.Log; import android.util.Property; import android.util.SparseIntArray; import android.util.TypedValue; @@ -82,7 +83,6 @@ import androidx.viewpager.widget.ViewPager; import com.jakewharton.processphoenix.ProcessPhoenix; import org.apache.commons.lang3.StringUtils; -import com.google.android.exoplayer2.util.Log; import org.telegram.PhoneFormat.PhoneFormat; import org.telegram.messenger.AndroidUtilities; @@ -211,6 +211,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. private SimpleTextView idTextView; private RLottieImageView writeButton; private AnimatorSet writeButtonAnimation; +// private AnimatorSet qrItemAnimation; private Drawable lockIconDrawable; private Drawable verifiedDrawable; private Drawable verifiedCheckDrawable; @@ -262,6 +263,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. private ActionBarMenuItem editItem; private ActionBarMenuItem otherItem; private ActionBarMenuItem searchItem; +// private ActionBarMenuItem qrItem; protected float headerShadowAlpha = 1.0f; private TopView topView; private long userId; @@ -369,6 +371,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. private final static int edit_avatar = 34; private final static int delete_avatar = 35; private final static int add_photo = 36; + private final static int qr_button = 37; private Rect rect = new Rect(); @@ -450,6 +453,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. private boolean firstLayout = true; private boolean invalidateScroll = true; + private boolean isQrItemVisible; PinchToZoomHelper pinchToZoomHelper; @@ -1933,7 +1937,12 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. } } else if (id == add_photo) { onWriteButtonClick(); - } + } /*else if (id == qr_button) { + Bundle args = new Bundle(); + args.putLong("chat_id", chatId); + args.putLong("user_id", userId); + presentFragment(new QrActivity(args)); + }*/ } }); @@ -1977,6 +1986,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. videoCallItem.setVisibility(expanded || !videoCallItemVisible ? GONE : INVISIBLE); editItem.setVisibility(expanded || !editItemVisible ? GONE : INVISIBLE); otherItem.setVisibility(expanded ? GONE : INVISIBLE); +// if (qrItem != null) { +// qrItem.setVisibility(expanded ? GONE : INVISIBLE); +// } } @Override @@ -2135,6 +2147,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. if (searchItem != null) { searchItem.setAlpha(0.0f); searchItem.setEnabled(false); + searchItem.setVisibility(GONE); } nameTextView[1].setTextColor(Color.WHITE); onlineTextView[1].setTextColor(Color.argb(179, 255, 255, 255)); @@ -2679,6 +2692,14 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. BottomBuilder builder = new BottomBuilder(getParentActivity()); builder.addTitle("@" + username); + builder.addItem(LocaleController.getString("QrCode", R.string.QrCode), R.drawable.wallet_qr, __ -> { + Bundle args = new Bundle(); + args.putLong("chat_id", chatId); + args.putLong("user_id", userId); + presentFragment(new QrActivity(args)); + return Unit.INSTANCE; + }); + if (chatInfo != null && chatInfo.can_set_username) { builder.addItem(LocaleController.getString("Edit", R.string.Edit), R.drawable.baseline_edit_24, __ -> { ChatEditTypeActivity fragment = new ChatEditTypeActivity(chatId, chatInfo.can_set_location); @@ -2791,6 +2812,16 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. BottomBuilder builder = new BottomBuilder(getParentActivity()); builder.addTitle("@" + user.username); + if (userId == getUserConfig().clientUserId && isQrNeedVisible()) { + builder.addItem(LocaleController.getString("QrCode", R.string.QrCode), R.drawable.wallet_qr, __ -> { + Bundle args = new Bundle(); + args.putLong("chat_id", chatId); + args.putLong("user_id", userId); + presentFragment(new QrActivity(args)); + return Unit.INSTANCE; + }); + } + builder.addItem(LocaleController.getString("Edit", R.string.Edit), R.drawable.baseline_edit_24, __ -> { presentFragment(new ChangeUsernameActivity()); return Unit.INSTANCE; @@ -3072,6 +3103,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. BuildVars.DEBUG_PRIVATE_VERSION ? "Clean app update" : null, BuildVars.DEBUG_PRIVATE_VERSION ? "Reset suggestions" : null, "Reset all notification channels", + SharedConfig.drawSnowInChat ? "Hide snow in chat" : "Show snow in chat" }; builder.setItems(items, (dialog, which) -> { if (which == 0) { @@ -3170,6 +3202,8 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. getNotificationCenter().postNotificationName(NotificationCenter.newSuggestionsAvailable); } else if (which == 18) { getNotificationsController().cleanupNotificationChannels(); + } else if (which == 18) { + SharedConfig.toggleDrawSnowInChat(); } }); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); @@ -3604,6 +3638,13 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. avatarImage.setRoundRadius((int) AndroidUtilities.lerp(AndroidUtilities.dpf2(21f), 0f, value)); if (searchItem != null) { searchItem.setAlpha(1.0f - value); + searchItem.setScaleY(1.0f - value); + searchItem.setVisibility(searchItem.getAlpha() == 0f ? View.GONE : View.VISIBLE); +// if (qrItem != null && searchItem.getVisibility() == View.VISIBLE) { +// float translation = AndroidUtilities.dp(48) * value; +// qrItem.setTranslationX(translation); +// avatarsViewPagerIndicatorView.setTranslationX(translation - AndroidUtilities.dp(48)); +// } } if (extraHeight > AndroidUtilities.dp(88f) && expandProgress < 0.33f) { @@ -4544,6 +4585,47 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. writeButton.setAlpha(setVisible ? 1.0f : 0.0f); } } + +// if (qrItem != null) { +// boolean setQrVisible = diff > 0.5f; +// if (setQrVisible != isQrItemVisible) { +// isQrItemVisible = setQrVisible; +// if (qrItemAnimation != null) { +// qrItemAnimation.cancel(); +// qrItemAnimation = null; +// } +// if (animated) { +// qrItemAnimation = new AnimatorSet(); +// if (setQrVisible) { +// qrItemAnimation.setInterpolator(new DecelerateInterpolator()); +// qrItemAnimation.playTogether( +// ObjectAnimator.ofFloat(qrItem, View.ALPHA, 1.0f), +// ObjectAnimator.ofFloat(qrItem, View.SCALE_Y, 1f), +// ObjectAnimator.ofFloat(avatarsViewPagerIndicatorView, View.TRANSLATION_X, -AndroidUtilities.dp(48)) +// ); +// } else { +// qrItemAnimation.setInterpolator(new AccelerateInterpolator()); +// qrItemAnimation.playTogether( +// ObjectAnimator.ofFloat(qrItem, View.ALPHA, 0.0f), +// ObjectAnimator.ofFloat(qrItem, View.SCALE_Y, 0f), +// ObjectAnimator.ofFloat(avatarsViewPagerIndicatorView, View.TRANSLATION_X, 0) +// ); +// } +// qrItemAnimation.setDuration(150); +// qrItemAnimation.addListener(new AnimatorListenerAdapter() { +// @Override +// public void onAnimationEnd(Animator animation) { +// qrItemAnimation = null; +// } +// }); +// qrItemAnimation.start(); +// } else { +// qrItem.setAlpha(setQrVisible ? 1.0f : 0.0f); +// qrItem.setTranslationX(setQrVisible ? 0f : AndroidUtilities.dp(48f)); +// avatarsViewPagerIndicatorView.setTranslationX(setQrVisible ? 0f : -AndroidUtilities.dp(48f)); +// } +// } +// } } } @@ -5287,6 +5369,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. } else { transitionIndex = getNotificationCenter().setAnimationInProgress(transitionIndex, new int[]{NotificationCenter.dialogsNeedReload, NotificationCenter.closeChats, NotificationCenter.mediaCountDidLoad, NotificationCenter.mediaCountsDidLoad}); } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && !backward && getParentActivity() != null) { + navigationBarAnimationColorFrom = getParentActivity().getWindow().getNavigationBarColor(); + } } transitionAnimationInProress = true; } @@ -6378,6 +6463,10 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. builder.show(); }); } + +// if (qrItem != null) { +// qrItem.setVisibility(isQrNeedVisible() ? View.VISIBLE : View.GONE); +// } } private void createActionBarMenu(boolean animated) { @@ -6713,10 +6802,14 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. idTextView.setVisibility(View.VISIBLE); actionBar.onSearchFieldVisibilityChanged(searchTransitionProgress > 0.5f); + int itemVisibility = searchTransitionProgress > 0.5f ? View.VISIBLE : View.GONE; if (otherItem != null) { - otherItem.setVisibility(searchTransitionProgress > 0.5f ? View.VISIBLE : View.GONE); + otherItem.setVisibility(itemVisibility); } - searchItem.setVisibility(searchTransitionProgress > 0.5f ? View.VISIBLE : View.GONE); +// if (qrItem != null) { +// qrItem.setVisibility(isQrNeedVisible() && searchTransitionProgress > 0.5f ? View.VISIBLE : View.GONE); +// } + searchItem.setVisibility(itemVisibility); searchItem.getSearchContainer().setVisibility(searchTransitionProgress > 0.5f ? View.GONE : View.VISIBLE); searchListView.setEmptyView(emptyView); @@ -6761,10 +6854,16 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. } searchItem.getSearchContainer().setVisibility(searchTransitionProgress < 0.5f ? View.VISIBLE : View.GONE); + int visibility = searchTransitionProgress > 0.5f ? View.VISIBLE : View.GONE; if (otherItem != null) { - otherItem.setVisibility(searchTransitionProgress > 0.5f ? View.VISIBLE : View.GONE); + otherItem.setVisibility(visibility); + otherItem.setAlpha(progressHalf); } - searchItem.setVisibility(searchTransitionProgress > 0.5f ? View.VISIBLE : View.GONE); +// if (qrItem != null) { +// qrItem.setAlpha(progressHalf); +// qrItem.setVisibility(searchTransitionProgress > 0.5f && isQrNeedVisible() ? View.VISIBLE : View.GONE); +// } + searchItem.setVisibility(visibility); actionBar.onSearchFieldVisibilityChanged(searchTransitionProgress < 0.5f); @@ -6827,6 +6926,10 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. otherItem.setAlpha(1f); otherItem.setVisibility(hide); } +// if (qrItem != null) { +// qrItem.setAlpha(1f); +// qrItem.setVisibility(enter || !isQrNeedVisible() ? View.GONE : View.VISIBLE); +// } searchItem.setVisibility(hide); avatarContainer.setAlpha(1f); @@ -7038,6 +7141,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. case 2: { final TextDetailCell textDetailCell = new TextDetailCell(mContext); textDetailCell.setContentDescriptionValueFirst(true); +// textDetailCell.setImageClickListener(ProfileActivity.this::onTextDetailCellImageClicked); view = textDetailCell; break; } @@ -7225,6 +7329,13 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. break; case 2: TextDetailCell detailCell = (TextDetailCell) holder.itemView; +// if (position == usernameRow) { +// Drawable drawable = ContextCompat.getDrawable(detailCell.getContext(), R.drawable.msg_qr_mini); +// drawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_switch2TrackChecked), PorterDuff.Mode.SRC_IN)); +// detailCell.setImage(drawable); +// } else { +// detailCell.setImage(null); +// } if (position == phoneRow) { String text; final TLRPC.User user = getMessagesController().getUser(userId); @@ -7279,6 +7390,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. detailCell.setTextAndValue(value, LocaleController.getString("Username", R.string.Username), true); detailCell.setContentDescriptionValueFirst(true); } + detailCell.setTag(position); break; case 3: AboutLinkCell aboutLinkCell = (AboutLinkCell) holder.itemView; @@ -8375,6 +8487,20 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. layoutManager.scrollToPositionWithOffset(sharedMediaRow, -listView.getPaddingTop()); } + private void onTextDetailCellImageClicked(View view) { + View parent = (View) view.getParent(); + if (parent.getTag() != null && ((int) parent.getTag()) == usernameRow) { + Bundle args = new Bundle(); + args.putLong("chat_id", chatId); + args.putLong("user_id", userId); + presentFragment(new QrActivity(args)); + } + } + + private boolean isQrNeedVisible() { + return !TextUtils.isEmpty(getUserConfig().getCurrentUser().username); + } + private class DiffCallback extends DiffUtil.Callback { int oldRowCount; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/QrActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/QrActivity.java new file mode 100644 index 000000000..bce485e9e --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/QrActivity.java @@ -0,0 +1,1304 @@ +package org.telegram.ui; + +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ValueAnimator; +import android.annotation.SuppressLint; +import android.content.ActivityNotFoundException; +import android.content.Context; +import android.content.Intent; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.BitmapShader; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Matrix; +import android.graphics.Paint; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffColorFilter; +import android.graphics.PorterDuffXfermode; +import android.graphics.Rect; +import android.graphics.RectF; +import android.graphics.Shader; +import android.graphics.drawable.Drawable; +import android.net.Uri; +import android.os.Bundle; +import android.text.Layout; +import android.text.SpannableStringBuilder; +import android.text.Spanned; +import android.text.StaticLayout; +import android.text.TextPaint; +import android.text.TextUtils; +import android.util.TypedValue; +import android.view.Gravity; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; +import android.widget.FrameLayout; +import android.widget.ImageView; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.annotation.NonNull; +import androidx.collection.ArrayMap; +import androidx.core.content.ContextCompat; +import androidx.core.graphics.ColorUtils; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.LinearSmoothScroller; +import androidx.recyclerview.widget.RecyclerView; + +import com.google.zxing.EncodeHintType; +import com.google.zxing.qrcode.QRCodeWriter; +import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.ApplicationLoader; +import org.telegram.messenger.ChatThemeController; +import org.telegram.messenger.ImageLocation; +import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MessagesController; +import org.telegram.messenger.NotificationCenter; +import org.telegram.messenger.R; +import org.telegram.messenger.SvgHelper; +import org.telegram.tgnet.ResultCallback; +import org.telegram.tgnet.TLRPC; +import org.telegram.ui.ActionBar.ActionBarLayout; +import org.telegram.ui.ActionBar.BaseFragment; +import org.telegram.ui.ActionBar.EmojiThemes; +import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.ActionBar.ThemeDescription; +import org.telegram.ui.Cells.SettingsSearchCell; +import org.telegram.ui.Components.AvatarDrawable; +import org.telegram.ui.Components.BackupImageView; +import org.telegram.ui.Components.ChatThemeBottomSheet; +import org.telegram.ui.Components.Easings; +import org.telegram.ui.Components.FlickerLoadingView; +import org.telegram.ui.Components.HideViewAfterAnimation; +import org.telegram.ui.Components.LayoutHelper; +import org.telegram.ui.Components.MotionBackgroundDrawable; +import org.telegram.ui.Components.RLottieDrawable; +import org.telegram.ui.Components.RLottieImageView; +import org.telegram.ui.Components.RecyclerListView; +import org.telegram.ui.Components.StaticLayoutEx; +import org.telegram.ui.Components.ThemeSmallPreviewView; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +public class QrActivity extends BaseFragment { + + private static final ArrayMap qrColorsMap = new ArrayMap<>(); + private static List cachedThemes; + + static { + qrColorsMap.put("\uD83C\uDFE0d", new int[]{ 0xFF71B654, 0xFF2C9077, 0xFF9ABB3E, 0xFF68B55E }); + qrColorsMap.put("\uD83D\uDC25d", new int[]{ 0xFF43A371, 0xFF8ABD4C, 0xFF9DB139, 0xFF85B950 }); + qrColorsMap.put("⛄d", new int[]{ 0xFF66A1FF, 0xFF59B5EE, 0xFF41BAD2, 0xFF8A97FF }); + qrColorsMap.put("\uD83D\uDC8Ed", new int[]{ 0xFF5198F5, 0xFF4BB7D2, 0xFFAD79FB, 0xFFDF86C7 }); + qrColorsMap.put("\uD83D\uDC68\u200D\uD83C\uDFEBd", new int[]{ 0xFF9AB955, 0xFF48A896, 0xFF369ADD, 0xFF5DC67B }); + qrColorsMap.put("\uD83C\uDF37d", new int[]{ 0xFFEE8044, 0xFFE19B23, 0xFFE55D93, 0xFFCB75D7 }); + qrColorsMap.put("\uD83D\uDC9Cd", new int[]{ 0xFFEE597E, 0xFFE35FB2, 0xFFAD69F2, 0xFFFF9257 }); + qrColorsMap.put("\uD83C\uDF84d", new int[]{ 0xFFEC7046, 0xFFF79626, 0xFFE3761C, 0xFFF4AA2A }); + qrColorsMap.put("\uD83C\uDFAEd", new int[]{ 0xFF19B3D2, 0xFFDC62F4, 0xFFE64C73, 0xFFECA222 }); + qrColorsMap.put("\uD83C\uDFE0n", new int[]{ 0xFF157FD1, 0xFF4A6CF2, 0xFF1876CD, 0xFF2CA6CE }); + qrColorsMap.put("\uD83D\uDC25n", new int[]{ 0xFF57A518, 0xFF1E7650, 0xFF6D9B17, 0xFF3FAB55 }); + qrColorsMap.put("⛄n", new int[]{ 0xFF2B6EDA, 0xFF2F7CB6, 0xFF1DA6C9, 0xFF6B7CFF }); + qrColorsMap.put("\uD83D\uDC8En", new int[]{ 0xFFB256B8, 0xFF6F52FF, 0xFF249AC2, 0xFF347AD5 }); + qrColorsMap.put("\uD83D\uDC68\u200D\uD83C\uDFEBn", new int[]{ 0xFF238B68, 0xFF73A163, 0xFF15AC7F, 0xFF0E8C95 }); + qrColorsMap.put("\uD83C\uDF37n", new int[]{ 0xFFD95454, 0xFFD2770F, 0xFFCE4661, 0xFFAC5FC8 }); + qrColorsMap.put("\uD83D\uDC9Cn", new int[]{ 0xFFD058AA, 0xFFE0743E, 0xFFD85568, 0xFFA369D3 }); + qrColorsMap.put("\uD83C\uDF84n", new int[]{ 0xFFD6681F, 0xFFCE8625, 0xFFCE6D30, 0xFFC98A1D }); + qrColorsMap.put("\uD83C\uDFAEn", new int[]{ 0xFFC74343, 0xFFEC7F36, 0xFF06B0F9, 0xFFA347FF }); + } + + private final ThemeResourcesProvider resourcesProvider = new ThemeResourcesProvider(); + private final EmojiThemes homeTheme = EmojiThemes.createHomeQrTheme(); + private final Rect logoRect = new Rect(); + private final ArrayMap emojiThemeDarkIcons = new ArrayMap<>(); + private final int[] prevQrColors = new int[4]; + + private ThemeListViewController themesViewController; + private MotionBackgroundDrawable currMotionDrawable = new MotionBackgroundDrawable(); + private MotionBackgroundDrawable prevMotionDrawable; + private MotionBackgroundDrawable tempMotionDrawable; + private ValueAnimator patternAlphaAnimator; + private ValueAnimator patternIntensityAnimator; + + private View backgroundView; + private FrameLayout themeLayout; + private BackupImageView avatarImageView; + private QrView qrView; + private RLottieImageView logoImageView; + private ImageView closeImageView; + + private Bitmap emojiThemeIcon; + private EmojiThemes currentTheme = homeTheme; + private boolean isCurrentThemeDark; + private long userId; + private long chatId; + private int prevSystemUiVisibility; + private int selectedPosition = -1; + + public QrActivity(Bundle args) { + super(args); + } + + @Override + public boolean onFragmentCreate() { + userId = arguments.getLong("user_id"); + chatId = arguments.getLong("chat_id"); + return super.onFragmentCreate(); + } + + @Override + public View createView(Context context) { + homeTheme.loadPreviewColors(currentAccount); + isCurrentThemeDark = Theme.getActiveTheme().isDark(); + actionBar.setAddToContainer(false); + actionBar.setBackground(null); + actionBar.setItemsColor(0xffffffff, false); + + FrameLayout rootLayout = new FrameLayout(context) { + + private boolean prevIsPortrait; + + @Override + public boolean dispatchTouchEvent(MotionEvent ev) { + super.dispatchTouchEvent(ev); + return true; + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + int width = MeasureSpec.getSize(widthMeasureSpec); + int height = MeasureSpec.getSize(heightMeasureSpec); + boolean isPortrait = width < height; + avatarImageView.setVisibility(isPortrait ? View.VISIBLE : View.GONE); + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + if (isPortrait) { + themeLayout.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST)); + qrView.measure(MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(260), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(330), MeasureSpec.EXACTLY)); + } else { + themeLayout.measure(MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(256), MeasureSpec.EXACTLY), heightMeasureSpec); + qrView.measure(MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(260), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(310), MeasureSpec.EXACTLY)); + } + if (prevIsPortrait != isPortrait) { + qrView.onSizeChanged(qrView.getMeasuredWidth(), qrView.getMeasuredHeight(), 0, 0); + } + prevIsPortrait = isPortrait; + } + + @Override + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { + boolean isPortrait = getWidth() < getHeight(); + + backgroundView.layout(0, 0, getWidth(), getHeight()); + + int themeLayoutHeight = 0; + if (themeLayout.getVisibility() == View.VISIBLE) { + themeLayoutHeight = themeLayout.getMeasuredHeight(); + } + + int qrLeft = isPortrait + ? (getWidth() - qrView.getMeasuredWidth()) / 2 + : (getWidth() - themeLayout.getMeasuredWidth() - qrView.getMeasuredWidth()) / 2; + int qrTop = isPortrait + ? (getHeight() - themeLayoutHeight - qrView.getMeasuredHeight() - AndroidUtilities.dp(48)) / 2 + AndroidUtilities.dp(48 + 4) + : (getHeight() - qrView.getMeasuredHeight()) / 2; + qrView.layout(qrLeft, qrTop, qrLeft + qrView.getMeasuredWidth(), qrTop + qrView.getMeasuredHeight()); + + if (isPortrait) { + int avatarLeft = (getWidth() - avatarImageView.getMeasuredWidth()) / 2; + int avatarTop = qrTop - AndroidUtilities.dp(48); + avatarImageView.layout(avatarLeft, avatarTop, avatarLeft + avatarImageView.getMeasuredWidth(), avatarTop + avatarImageView.getMeasuredHeight()); + } + + if (themeLayout.getVisibility() == View.VISIBLE) { + if (isPortrait) { + int themeLayoutLeft = (getWidth() - themeLayout.getMeasuredWidth()) / 2; + themeLayout.layout(themeLayoutLeft, bottom - themeLayoutHeight, themeLayoutLeft + themeLayout.getMeasuredWidth(), bottom); + } else { + int themeLayoutTop = (getHeight() - themeLayout.getMeasuredHeight()) / 2; + themeLayout.layout(right - themeLayout.getMeasuredWidth(), themeLayoutTop, right, themeLayoutTop + themeLayout.getMeasuredHeight()); + } + } + + logoImageView.layout(qrLeft + logoRect.left, qrTop + logoRect.top, qrLeft + logoRect.right, qrTop + logoRect.bottom); + + int closeLeft = isPortrait ? AndroidUtilities.dp(14) : AndroidUtilities.dp(17); + int closeTop = AndroidUtilities.statusBarHeight + (isPortrait ? AndroidUtilities.dp(10) : AndroidUtilities.dp(5)); + closeImageView.layout(closeLeft, closeTop, closeLeft + closeImageView.getMeasuredWidth(), closeTop + closeImageView.getMeasuredHeight()); + } + }; + + backgroundView = new View(context) { + @Override + protected void onDraw(Canvas canvas) { + if (prevMotionDrawable != null) { + prevMotionDrawable.setBounds(0, 0, getWidth(), getHeight()); + prevMotionDrawable.draw(canvas); + } + currMotionDrawable.setBounds(0, 0, getWidth(), getHeight()); + currMotionDrawable.draw(canvas); + super.onDraw(canvas); + } + }; + rootLayout.addView(backgroundView); + + AvatarDrawable avatarDrawable = null; + String username = null; + ImageLocation imageLocationSmall = null; + ImageLocation imageLocation = null; + if (userId != 0) { + TLRPC.User user = getMessagesController().getUser(userId); + if (user != null) { + username = user.username; + avatarDrawable = new AvatarDrawable(user); + imageLocationSmall = ImageLocation.getForUser(user, ImageLocation.TYPE_SMALL); + imageLocation = ImageLocation.getForUser(user, ImageLocation.TYPE_BIG); + } + } else if (chatId != 0) { + TLRPC.Chat chat = getMessagesController().getChat(chatId); + if (chat != null) { + username = chat.username; + avatarDrawable = new AvatarDrawable(chat); + imageLocationSmall = ImageLocation.getForChat(chat, ImageLocation.TYPE_SMALL); + imageLocation = ImageLocation.getForChat(chat, ImageLocation.TYPE_BIG); + } + } + + String link = "https://" + MessagesController.getInstance(currentAccount).linkPrefix + "/" + username; + qrView = new QrView(context); + qrView.setColors(0xFF71B654, 0xFF2C9077, 0xFF9ABB3E, 0xFF68B55E); + qrView.setData(link, username); + qrView.setCenterChangedListener((left, top, right, bottom) -> { + logoRect.set(left, top, right, bottom); + qrView.requestLayout(); + }); + rootLayout.addView(qrView); + + logoImageView = new RLottieImageView(context); + logoImageView.setAutoRepeat(true); + logoImageView.setAnimation(R.raw.qr_code_logo_2, 60, 60); + logoImageView.playAnimation(); + rootLayout.addView(logoImageView); + + avatarImageView = new BackupImageView(context); + avatarImageView.setRoundRadius(AndroidUtilities.dp(42)); + avatarImageView.setSize(AndroidUtilities.dp(84), AndroidUtilities.dp(84)); + rootLayout.addView(avatarImageView, LayoutHelper.createFrame(84, 84, Gravity.LEFT | Gravity.TOP)); + avatarImageView.setImage(imageLocation, "84_84", imageLocationSmall, "50_50", avatarDrawable, null, null, 0, null); + + closeImageView = new ImageView(context); + closeImageView.setBackground(Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(34), 0x28000000, 0x28ffffff)); + closeImageView.setImageResource(R.drawable.ic_ab_back); + closeImageView.setScaleType(ImageView.ScaleType.CENTER); + closeImageView.setOnClickListener(v -> finishFragment()); + rootLayout.addView(closeImageView, LayoutHelper.createFrame(34, 34)); + + emojiThemeIcon = Bitmap.createBitmap(AndroidUtilities.dp(32), AndroidUtilities.dp(32), Bitmap.Config.ARGB_8888); + Canvas canvas = new Canvas(emojiThemeIcon); + AndroidUtilities.rectTmp.set(0f, 0f, emojiThemeIcon.getWidth(), emojiThemeIcon.getHeight()); + Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); + paint.setColor(Color.WHITE); + canvas.drawRoundRect(AndroidUtilities.rectTmp, AndroidUtilities.dp(5), AndroidUtilities.dp(5), paint); + paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT)); + Bitmap bitmap = BitmapFactory.decodeResource(ApplicationLoader.applicationContext.getResources(), R.drawable.msg_qr_mini); + canvas.drawBitmap(bitmap, (emojiThemeIcon.getWidth() - bitmap.getWidth()) * 0.5f, (emojiThemeIcon.getHeight() - bitmap.getHeight()) * 0.5f, paint); + canvas.setBitmap(null); + + themesViewController = new ThemeListViewController(this, getParentActivity().getWindow()) { + @Override + protected void setDarkTheme(boolean isDark) { + super.setDarkTheme(isDark); + isCurrentThemeDark = isDark; + onItemSelected(currentTheme, selectedPosition, false); + } + }; + themeLayout = themesViewController.rootLayout; + + themesViewController.onCreate(); + themesViewController.setItemSelectedListener((theme, position) -> QrActivity.this.onItemSelected(theme, position, true)); + themesViewController.titleView.setText(LocaleController.getString("QrCode", R.string.QrCode)); + themesViewController.progressView.setViewType(FlickerLoadingView.QR_TYPE); + themesViewController.shareButton.setOnClickListener(v -> { + themesViewController.shareButton.setClickable(false); + performShare(); + }); + rootLayout.addView(themeLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM)); + + currMotionDrawable.setIndeterminateAnimation(true); + + fragmentView = rootLayout; + onItemSelected(currentTheme, 0, false); + + if (cachedThemes == null || cachedThemes.isEmpty()) { + ChatThemeController.requestAllChatThemes(new ResultCallback>() { + @Override + public void onComplete(List result) { + onDataLoaded(result); + cachedThemes = result; + } + @Override + public void onError(TLRPC.TL_error error) { + Toast.makeText(getParentActivity(), error.text, Toast.LENGTH_SHORT).show(); + } + }, true); + } else { + onDataLoaded(cachedThemes); + } + + prevSystemUiVisibility = getParentActivity().getWindow().getDecorView().getSystemUiVisibility(); + applyScreenSettings(); + return fragmentView; + } + + @SuppressLint("SourceLockedOrientationActivity") + @Override + public void onResume() { + super.onResume(); + applyScreenSettings(); + } + + @Override + public void onPause() { + restoreScreenSettings(); + super.onPause(); + } + + @Override + public void onFragmentDestroy() { + themesViewController.onDestroy(); + themesViewController = null; + emojiThemeIcon.recycle(); + emojiThemeIcon = null; + for (int i = 0; i < emojiThemeDarkIcons.size(); ++i) { + Bitmap bitmap = emojiThemeDarkIcons.valueAt(i); + if (bitmap != null) { + bitmap.recycle(); + } + } + emojiThemeDarkIcons.clear(); + restoreScreenSettings(); + super.onFragmentDestroy(); + } + + private void applyScreenSettings() { + if (getParentActivity() != null) { + getParentActivity().getWindow().getDecorView().setSystemUiVisibility(prevSystemUiVisibility | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_FULLSCREEN); + } + } + + private void restoreScreenSettings() { + if (getParentActivity() != null) { + getParentActivity().getWindow().getDecorView().setSystemUiVisibility(prevSystemUiVisibility); + } + } + + @Override + public int getNavigationBarColor() { + return getThemedColor(Theme.key_windowBackgroundGray); + } + + @Override + public Theme.ResourcesProvider getResourceProvider() { + return resourcesProvider; + } + + private void onDataLoaded(List result) { + if (result == null || result.isEmpty() || themesViewController == null) { + return; + } + result.set(0, homeTheme); + List items = new ArrayList<>(result.size()); + for (int i = 0; i < result.size(); ++i) { + EmojiThemes chatTheme = result.get(i); + chatTheme.loadPreviewColors(currentAccount); + ChatThemeBottomSheet.ChatThemeItem item = new ChatThemeBottomSheet.ChatThemeItem(chatTheme); + item.themeIndex = isCurrentThemeDark ? 1 : 0; + item.icon = getEmojiThemeIcon(chatTheme, isCurrentThemeDark); + items.add(item); + } + themesViewController.adapter.setItems(items); + + int selectedPosition = -1; + for (int i = 0; i != items.size(); ++i) { + if (items.get(i).chatTheme.getEmoticon().equals(currentTheme.getEmoticon())) { + themesViewController.selectedItem = items.get(i); + selectedPosition = i; + break; + } + } + if (selectedPosition != -1) { + themesViewController.setSelectedPosition(selectedPosition); + } + + themesViewController.onDataLoaded(); + } + + private Bitmap getEmojiThemeIcon(EmojiThemes theme, boolean isDark) { + if (isDark) { + Bitmap bitmap = emojiThemeDarkIcons.get(theme.emoji); + if (bitmap == null) { + bitmap = Bitmap.createBitmap(emojiThemeIcon.getWidth(), emojiThemeIcon.getHeight(), Bitmap.Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + int[] colors = qrColorsMap.get(theme.emoji + "n"); + if (colors != null) { + if (tempMotionDrawable == null) { + tempMotionDrawable = new MotionBackgroundDrawable(0, 0, 0, 0, true); + } + tempMotionDrawable.setColors(colors[0], colors[1], colors[2], colors[3]); + tempMotionDrawable.setBounds(AndroidUtilities.dp(6), AndroidUtilities.dp(6), canvas.getWidth() - AndroidUtilities.dp(6), canvas.getHeight() - AndroidUtilities.dp(6)); + tempMotionDrawable.draw(canvas); + } + canvas.drawBitmap(emojiThemeIcon, 0, 0, null); + canvas.setBitmap(null); + emojiThemeDarkIcons.put(theme.emoji, bitmap); + } + return bitmap; + } else { + return emojiThemeIcon; + } + } + + private void onPatternLoaded(Bitmap bitmap, int intensity, boolean withAnimation) { + if (bitmap != null) { + currMotionDrawable.setPatternBitmap(intensity, bitmap); + if (patternIntensityAnimator != null) { + patternIntensityAnimator.cancel(); + } + if (withAnimation) { + patternIntensityAnimator = ValueAnimator.ofFloat(0, 1f); + patternIntensityAnimator.addUpdateListener(animator -> currMotionDrawable.setPatternAlpha((float) animator.getAnimatedValue())); + patternIntensityAnimator.setDuration(250); + patternIntensityAnimator.start(); + } else { + currMotionDrawable.setPatternAlpha(1f); + } + } + } + + private void onItemSelected(EmojiThemes newTheme, int position, boolean withAnimation) { + selectedPosition = position; + final EmojiThemes prevTheme = currentTheme; + final boolean isDarkTheme = isCurrentThemeDark; + currentTheme = newTheme; + EmojiThemes.ThemeItem themeItem = currentTheme.getThemeItem(isDarkTheme ? 1 : 0); + + prevMotionDrawable = currMotionDrawable; + prevMotionDrawable.setIndeterminateAnimation(false); + + currMotionDrawable = new MotionBackgroundDrawable(); + currMotionDrawable.setCallback(backgroundView); + currMotionDrawable.setColors(themeItem.patternBgColor, themeItem.patternBgGradientColor1, themeItem.patternBgGradientColor2, themeItem.patternBgGradientColor3); + currMotionDrawable.setParentView(backgroundView); + currMotionDrawable.setPatternAlpha(1f); + currMotionDrawable.setIndeterminateAnimation(true); + currMotionDrawable.posAnimationProgress = prevMotionDrawable.posAnimationProgress; + qrView.setPosAnimationProgress(currMotionDrawable.posAnimationProgress); + + TLRPC.WallPaper wallPaper = currentTheme.getWallpaper(isDarkTheme ? 1 : 0); + if (wallPaper != null) { + currMotionDrawable.setPatternBitmap(wallPaper.settings.intensity); + currentTheme.loadWallpaper(isDarkTheme ? 1 : 0, pair -> { + if (pair != null && currentTheme.getTlTheme(isDarkTheme ? 1 : 0) != null) { + final long themeId = pair.first; + final Bitmap bitmap = pair.second; + if (themeId == currentTheme.getTlTheme(isDarkTheme ? 1 : 0).id && bitmap != null) { + onPatternLoaded(bitmap, currMotionDrawable.getIntensity(), withAnimation); + } + } + }); + } else { + currMotionDrawable.setPatternBitmap(34, SvgHelper.getBitmap(R.raw.default_pattern, backgroundView.getWidth(), backgroundView.getHeight(), Color.BLACK)); + } + currMotionDrawable.setPatternColorFilter(currMotionDrawable.getPatternColor()); + + float from = 0; + if (patternAlphaAnimator != null) { + from = (float) patternAlphaAnimator.getAnimatedValue(); + patternAlphaAnimator.cancel(); + } + + int[] newQrColors = qrColorsMap.get(newTheme.emoji + (isDarkTheme ? "n" : "d")); + if (withAnimation) { + currMotionDrawable.setAlpha(0); + patternAlphaAnimator = ValueAnimator.ofFloat(from, 1f); + patternAlphaAnimator.addUpdateListener(animation -> { + float progress = (float) animation.getAnimatedValue(); + if (prevMotionDrawable != null) { + prevMotionDrawable.setPatternAlpha(1f - progress); + } + currMotionDrawable.setAlpha((int) (255f * progress)); + if (newQrColors != null) { + int color1 = ColorUtils.blendARGB(prevQrColors[0], newQrColors[0], progress); + int color2 = ColorUtils.blendARGB(prevQrColors[1], newQrColors[1], progress); + int color3 = ColorUtils.blendARGB(prevQrColors[2], newQrColors[2], progress); + int color4 = ColorUtils.blendARGB(prevQrColors[3], newQrColors[3], progress); + qrView.setColors(color1, color2, color3, color4); + } + backgroundView.invalidate(); + }); + patternAlphaAnimator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + super.onAnimationEnd(animation); + if (newQrColors != null) { + System.arraycopy(newQrColors, 0, prevQrColors, 0, 4); + } + prevMotionDrawable = null; + patternAlphaAnimator = null; + } + }); + patternAlphaAnimator.setDuration(250); + patternAlphaAnimator.start(); + } else { + if (newQrColors != null) { + qrView.setColors(newQrColors[0], newQrColors[1], newQrColors[2], newQrColors[3]); + System.arraycopy(newQrColors, 0, prevQrColors, 0, 4); + } + prevMotionDrawable = null; + backgroundView.invalidate(); + } + + Theme.ThemeInfo currentThemeInfo = isCurrentThemeDark ? Theme.getCurrentNightTheme() : Theme.getCurrentTheme(); + ActionBarLayout.ThemeAnimationSettings animationSettings = new ActionBarLayout.ThemeAnimationSettings(null, currentThemeInfo.currentAccentId, isCurrentThemeDark, !withAnimation); + animationSettings.applyTheme = false; + animationSettings.onlyTopFragment = true; + animationSettings.resourcesProvider = getResourceProvider(); + animationSettings.duration = 250; + if (withAnimation) { + resourcesProvider.initColors(prevTheme, isCurrentThemeDark); + } else { + resourcesProvider.initColors(currentTheme, isCurrentThemeDark); + } + animationSettings.afterStartDescriptionsAddedRunnable = () -> { + resourcesProvider.initColors(currentTheme, isCurrentThemeDark); + }; + parentLayout.animateThemedValues(animationSettings); + } + + private void performShare() { + int width = Math.min(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y); + int height = Math.max(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y); + if (height * 1f / width > 1.92f) { + height = (int)(width * 1.92f); + } + Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + + themeLayout.setVisibility(View.GONE); + closeImageView.setVisibility(View.GONE); + logoImageView.stopAnimation(); + RLottieDrawable drawable = logoImageView.getAnimatedDrawable(); + int currentFrame = drawable.getCurrentFrame(); + drawable.setCurrentFrame(33, false); + + fragmentView.measure(View.MeasureSpec.makeMeasureSpec(width, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(height, View.MeasureSpec.EXACTLY)); + fragmentView.layout(0, 0, width, height); + fragmentView.draw(canvas); + canvas.setBitmap(null); + + themeLayout.setVisibility(View.VISIBLE); + closeImageView.setVisibility(View.VISIBLE); + drawable.setCurrentFrame(currentFrame, false); + logoImageView.playAnimation(); + + ViewGroup parent = (ViewGroup) fragmentView.getParent(); + fragmentView.layout(0, 0, parent.getWidth(), parent.getHeight()); + + Uri uri = AndroidUtilities.getBitmapShareUri(bitmap, "qr_tmp.jpg", Bitmap.CompressFormat.JPEG); + if (uri != null) { + Intent intent = new Intent(Intent.ACTION_SEND) + .setType("image/*") + .putExtra(Intent.EXTRA_STREAM, uri); + try { + Intent chooserIntent = Intent.createChooser(intent, LocaleController.getString("InviteByQRCode", R.string.InviteByQRCode)); + getParentActivity().startActivityForResult(chooserIntent, 500); + } catch (ActivityNotFoundException ex) { + ex.printStackTrace(); + } + } + AndroidUtilities.runOnUIThread(() -> themesViewController.shareButton.setClickable(true), 500); + } + + @Override + public ArrayList getThemeDescriptions() { + ArrayList themeDescriptions = super.getThemeDescriptions(); + themeDescriptions.addAll(themesViewController.getThemeDescriptions()); + ThemeDescription.ThemeDescriptionDelegate delegate = () -> setNavigationBarColor(getThemedColor(Theme.key_windowBackgroundGray)); + themeDescriptions.add(new ThemeDescription(themesViewController.shareButton, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, delegate, Theme.key_featuredStickers_addButton)); + themeDescriptions.add(new ThemeDescription(themesViewController.shareButton, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_featuredStickers_addButtonPressed)); + for (ThemeDescription description : themeDescriptions) { + description.resourcesProvider = getResourceProvider(); + } + return themeDescriptions; + } + + + private class ThemeResourcesProvider implements Theme.ResourcesProvider { + + private HashMap colors; + + void initColors(EmojiThemes theme, boolean isDark) { + colors = theme.createColors(currentAccount, isDark ? 1 : 0); + } + + @Override + public Integer getColor(String key) { + return colors != null ? colors.get(key) : null; + } + } + + + private static class QrView extends View { + + private static final float SHADOW_SIZE = AndroidUtilities.dp(2); + private static final float RADIUS = AndroidUtilities.dp(20); + + private final MotionBackgroundDrawable gradientDrawable = new MotionBackgroundDrawable(); + private final Paint bitmapGradientPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private final BitmapShader gradientShader; + private QrCenterChangedListener centerChangedListener; + private Bitmap backgroundBitmap; + private Bitmap contentBitmap; + private String username; + private String link; + + QrView(Context context) { + super(context); + gradientDrawable.setIndeterminateAnimation(true); + gradientDrawable.setParentView(this); + gradientShader = new BitmapShader(gradientDrawable.getBitmap(), Shader.TileMode.MIRROR, Shader.TileMode.MIRROR); + bitmapGradientPaint.setShader(gradientShader); + } + + @Override + protected void onSizeChanged(int w, int h, int oldw, int oldh) { + super.onSizeChanged(w, h, oldw, oldh); + if (w != oldw || h != oldh) { + if (backgroundBitmap != null) { + backgroundBitmap.recycle(); + backgroundBitmap = null; + } + Paint backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + backgroundPaint.setColor(Color.WHITE); + backgroundPaint.setShadowLayer(AndroidUtilities.dp(4), 0f, SHADOW_SIZE, 0x0F000000); + backgroundBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); + Canvas canvas = new Canvas(backgroundBitmap); + RectF rect = new RectF(SHADOW_SIZE, SHADOW_SIZE, w - SHADOW_SIZE, getHeight() - SHADOW_SIZE); + canvas.drawRoundRect(rect, RADIUS, RADIUS, backgroundPaint); + prepareContent(w, h); + + float xScale = getWidth() * 1f / gradientDrawable.getBitmap().getWidth(); + float yScale = getHeight() * 1f / gradientDrawable.getBitmap().getHeight(); + float maxScale = Math.max(xScale, yScale); + Matrix matrix = new Matrix(); + matrix.setScale(maxScale, maxScale); + gradientShader.setLocalMatrix(matrix); + } + } + + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + if (backgroundBitmap != null) { + canvas.drawBitmap(backgroundBitmap, 0f, 0f, null); + } + if (contentBitmap != null) { + canvas.drawBitmap(contentBitmap, 0f, 0f, bitmapGradientPaint); + gradientDrawable.updateAnimation(); + } + } + + void setCenterChangedListener(QrCenterChangedListener centerChangedListener) { + this.centerChangedListener = centerChangedListener; + } + + void setData(String link, String username) { + this.username = username; + this.link = link; + prepareContent(getWidth(), getHeight()); + invalidate(); + } + + void setColors(int c1, int c2, int c3, int c4) { + gradientDrawable.setColors(c1, c2, c3, c4); + invalidate(); + } + + void setPosAnimationProgress(float progress) { + gradientDrawable.posAnimationProgress = progress; + } + + private void prepareContent(int w, int h) { + if (TextUtils.isEmpty(username) || TextUtils.isEmpty(link) || w == 0 || h == 0) { + return; + } + + if (contentBitmap != null) { + contentBitmap.recycle(); + } + contentBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); + + int qrColor = 0xff000000; + int backgroundColor = 0x00ffffff; + TextPaint textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.LINEAR_TEXT_FLAG); + textPaint.setColor(qrColor); + textPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rcondensedbold.ttf")); + StaticLayout staticLayout = null; + Drawable drawable; + int attemptsCount = 2; + final int textMaxWidth = contentBitmap.getWidth() - AndroidUtilities.dp(20) * 2; + for (int i = 0; i <= attemptsCount; ++i) { + if (i == 0) { + drawable = ContextCompat.getDrawable(getContext(), R.drawable.qr_at_large); + textPaint.setTextSize(AndroidUtilities.dp(30)); + } else if (i == 1) { + drawable = ContextCompat.getDrawable(getContext(), R.drawable.qr_at_medium); + textPaint.setTextSize(AndroidUtilities.dp(25)); + } else { + drawable = ContextCompat.getDrawable(getContext(), R.drawable.qr_at_small); + textPaint.setTextSize(AndroidUtilities.dp(19)); + } + if (drawable != null) { + drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); + drawable.setColorFilter(new PorterDuffColorFilter(qrColor, PorterDuff.Mode.SRC_IN)); + } + + SpannableStringBuilder string = new SpannableStringBuilder(" " + username.toUpperCase()); + string.setSpan(new SettingsSearchCell.VerticalImageSpan(drawable), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + float textWidth = textPaint.measureText(string, 1, string.length()) + drawable.getBounds().width(); + if (i <= 1 && textWidth > textMaxWidth) { + continue; + } + int linesCount = textWidth > textMaxWidth ? 2 : 1; + int layoutWidth = textMaxWidth; + if (linesCount > 1) { + layoutWidth = (int)(textWidth + drawable.getBounds().width()) / 2 + AndroidUtilities.dp(2); + } + if (layoutWidth > textMaxWidth) { + linesCount = 3; + layoutWidth = (int)(textWidth + drawable.getBounds().width()) / 3 + AndroidUtilities.dp(4); + } + staticLayout = StaticLayoutEx.createStaticLayout(string, textPaint, layoutWidth, Layout.Alignment.ALIGN_CENTER, 1f, 0f, false, null, Math.min(layoutWidth + AndroidUtilities.dp(10), contentBitmap.getWidth()), linesCount); + + break; + } + float lineHeight = textPaint.descent() - textPaint.ascent(); + float textHeight = lineHeight * staticLayout.getLineCount(); + + Bitmap qrBitmap = null; + int imageSize = 0; + int qrBitmapSize = w - AndroidUtilities.dp(30) * 2; + HashMap hints = new HashMap<>(); + hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M); + hints.put(EncodeHintType.MARGIN, 0); + QRCodeWriter writer = new QRCodeWriter(); + int version; + for (version = 3; version < 5; ++version) { + try { + hints.put(EncodeHintType.QR_VERSION, version); + qrBitmap = writer.encode(link, qrBitmapSize, qrBitmapSize, hints, null, 0.75f, backgroundColor, qrColor); + imageSize = writer.getImageSize(); + } catch (Exception e) { + // ignore + } + if (qrBitmap != null) { + break; + } + } + if (qrBitmap == null) { + return; + } + + Canvas canvas = new Canvas(contentBitmap); + canvas.drawColor(backgroundColor); + + float left = (w - qrBitmap.getWidth()) / 2f; + float qrTop = h * 0.15f; + if (staticLayout.getLineCount() == 3) { + qrTop = h * 0.13f; + } + boolean isPortrait = ((ViewGroup) getParent()).getMeasuredWidth() < ((ViewGroup) getParent()).getMeasuredHeight(); + if (!isPortrait) { + qrTop = h * 0.09f; + } + canvas.drawBitmap(qrBitmap, left, qrTop, new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG)); + + Paint circlePaint = new Paint(Paint.ANTI_ALIAS_FLAG); + circlePaint.setColor(qrColor); + float xCenter = left + qrBitmap.getWidth() * 0.5f; + float yCenter = qrTop + qrBitmap.getWidth() * 0.5f; + canvas.drawCircle(xCenter, yCenter, imageSize * 0.5f, circlePaint); + if (centerChangedListener != null) { + centerChangedListener.onCenterChanged((int) (xCenter - imageSize * 0.5f), (int) (yCenter - imageSize * 0.5f), (int) (xCenter + imageSize * 0.5f), (int) (yCenter + imageSize * 0.5f)); + } + + float xTranslate = (canvas.getWidth() - staticLayout.getWidth()) * 0.5f; + float yTranslate = qrTop + qrBitmap.getHeight() + (canvas.getHeight() - (qrTop + qrBitmap.getHeight()) - textHeight) * 0.5f - AndroidUtilities.dp(4); + canvas.save(); + canvas.translate(xTranslate, yTranslate); + staticLayout.draw(canvas); + canvas.restore(); + qrBitmap.recycle(); + + Bitmap oldBitmap = contentBitmap; + contentBitmap = contentBitmap.extractAlpha(); + oldBitmap.recycle(); + } + + public interface QrCenterChangedListener { + + void onCenterChanged(int left, int top, int right, int bottom); + } + } + + + private class ThemeListViewController implements NotificationCenter.NotificationCenterDelegate { + + private final Paint backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + public final ChatThemeBottomSheet.Adapter adapter; + private final LinearSmoothScroller scroller; + private final BaseFragment fragment; + private final Window window; + private final Drawable backgroundDrawable; + + public final FrameLayout rootLayout; + public final TextView titleView; + public final FlickerLoadingView progressView; + public final TextView shareButton; + private final RecyclerListView recyclerView; + private final RLottieDrawable darkThemeDrawable; + private final RLottieImageView darkThemeView; + private LinearLayoutManager layoutManager; + private final View topShadow; + private final View bottomShadow; + + private OnItemSelectedListener itemSelectedListener; + public ChatThemeBottomSheet.ChatThemeItem selectedItem; + public int prevSelectedPosition = -1; + private boolean forceDark; + private ValueAnimator changeDayNightViewAnimator; + private View changeDayNightView; + private float changeDayNightViewProgress; + protected boolean isLightDarkChangeAnimation; + private boolean prevIsPortrait; + + public ThemeListViewController(BaseFragment fragment, Window window) { + this.fragment = fragment; + this.window = window; + + Context context = fragment.getParentActivity(); + scroller = new LinearSmoothScroller(context) { + @Override + protected int calculateTimeForScrolling(int dx) { + return super.calculateTimeForScrolling(dx) * 6; + } + }; + + backgroundDrawable = context.getResources().getDrawable(R.drawable.sheet_shadow_round).mutate(); + backgroundDrawable.setColorFilter(new PorterDuffColorFilter(fragment.getThemedColor(Theme.key_dialogBackground), PorterDuff.Mode.MULTIPLY)); + rootLayout = new FrameLayout(context) { + + private final Rect backgroundPadding = new Rect(); + + { + backgroundPaint.setColor(fragment.getThemedColor(Theme.key_windowBackgroundWhite)); + backgroundDrawable.setCallback(this); + backgroundDrawable.getPadding(backgroundPadding); + setPadding(0, backgroundPadding.top + AndroidUtilities.dp(8), 0, backgroundPadding.bottom); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + boolean isPortrait = AndroidUtilities.displaySize.x < AndroidUtilities.displaySize.y; + int recyclerPadding = AndroidUtilities.dp(12); + if (isPortrait) { + recyclerView.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 104, Gravity.START, 0, 44, 0, 0)); + recyclerView.setPadding(recyclerPadding, 0, recyclerPadding, 0); + shareButton.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.START, 16, 162, 16, 16)); + } else { + recyclerView.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.START, 0, 44, 0, 80)); + recyclerView.setPadding(recyclerPadding, recyclerPadding / 2, recyclerPadding, recyclerPadding); + shareButton.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.BOTTOM, 16, 0, 16, 16)); + } + if (isPortrait) { + bottomShadow.setVisibility(View.GONE); + topShadow.setVisibility(View.GONE); + } else { + bottomShadow.setVisibility(View.VISIBLE); + bottomShadow.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, AndroidUtilities.dp(2), Gravity.BOTTOM, 0, 0, 0, 80)); + topShadow.setVisibility(View.VISIBLE); + topShadow.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, AndroidUtilities.dp(2), Gravity.TOP, 0, 44, 0, 0)); + } + if (prevIsPortrait != isPortrait) { + recyclerView.setLayoutManager(layoutManager = getLayoutManager(isPortrait)); + recyclerView.requestLayout(); + if (prevSelectedPosition != -1) { + setSelectedPosition(prevSelectedPosition); + } + prevIsPortrait = isPortrait; + } + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + } + + @Override + protected void dispatchDraw(Canvas canvas) { + if (prevIsPortrait) { + backgroundDrawable.setBounds(-backgroundPadding.left, 0, getWidth() + backgroundPadding.right, getHeight()); + backgroundDrawable.draw(canvas); + } else { + AndroidUtilities.rectTmp.set(0, 0, getWidth() + AndroidUtilities.dp(14), getHeight()); + canvas.drawRoundRect(AndroidUtilities.rectTmp, AndroidUtilities.dp(14), AndroidUtilities.dp(14), backgroundPaint); + } + super.dispatchDraw(canvas); + } + + @Override + protected boolean verifyDrawable(@NonNull Drawable who) { + return who == backgroundDrawable || super.verifyDrawable(who); + } + }; + + titleView = new TextView(context); + titleView.setEllipsize(TextUtils.TruncateAt.MIDDLE); + titleView.setLines(1); + titleView.setSingleLine(true); + titleView.setTextColor(fragment.getThemedColor(Theme.key_dialogTextBlack)); + titleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); + titleView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); + titleView.setPadding(AndroidUtilities.dp(21), AndroidUtilities.dp(6), AndroidUtilities.dp(21), AndroidUtilities.dp(8)); + rootLayout.addView(titleView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.START, 0, 0, 62, 0)); + + int drawableColor = fragment.getThemedColor(Theme.key_featuredStickers_addButton); + int drawableSize = AndroidUtilities.dp(28); + darkThemeDrawable = new RLottieDrawable(R.raw.sun_outline, "" + R.raw.sun_outline, drawableSize, drawableSize, true, null); + darkThemeDrawable.setPlayInDirectionOfCustomEndFrame(true); + darkThemeDrawable.beginApplyLayerColors(); + setDarkButtonColor(drawableColor); + darkThemeDrawable.commitApplyLayerColors(); + + darkThemeView = new RLottieImageView(context); + darkThemeView.setAnimation(darkThemeDrawable); + darkThemeView.setScaleType(ImageView.ScaleType.CENTER); + darkThemeView.setOnClickListener(view -> { + if (changeDayNightViewAnimator != null) { + return; + } + setupLightDarkTheme(!forceDark); + }); + darkThemeView.setVisibility(View.INVISIBLE); + rootLayout.addView(darkThemeView, LayoutHelper.createFrame(44, 44, Gravity.TOP | Gravity.END, 0, 0, 7, 0)); + forceDark = !Theme.getActiveTheme().isDark(); + setForceDark(Theme.getActiveTheme().isDark(), false); + + progressView = new FlickerLoadingView(context, fragment.getResourceProvider()); + progressView.setVisibility(View.VISIBLE); + rootLayout.addView(progressView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 104, Gravity.START, 0, 44, 0, 0)); + + prevIsPortrait = AndroidUtilities.displaySize.x < AndroidUtilities.displaySize.y; + recyclerView = new RecyclerListView(context); + recyclerView.setAdapter(adapter = new ChatThemeBottomSheet.Adapter(currentAccount, resourcesProvider, ThemeSmallPreviewView.TYPE_QR)); + recyclerView.setClipChildren(false); + recyclerView.setClipToPadding(false); + recyclerView.setItemAnimator(null); + recyclerView.setNestedScrollingEnabled(false); + recyclerView.setLayoutManager(layoutManager = getLayoutManager(prevIsPortrait)); + recyclerView.setOnItemClickListener(this::onItemClicked); + recyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() { + private int yScroll = 0; + @Override + public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { + super.onScrolled(recyclerView, dx, dy); + yScroll += dy; + topShadow.setAlpha(yScroll * 1f / AndroidUtilities.dp(6)); + } + }); + rootLayout.addView(recyclerView); + + topShadow = new View(context); + topShadow.setAlpha(0f); + topShadow.setBackground(ContextCompat.getDrawable(context, R.drawable.shadowdown)); + topShadow.setRotation(180); + rootLayout.addView(topShadow); + + bottomShadow = new View(context); + bottomShadow.setBackground(ContextCompat.getDrawable(context, R.drawable.shadowdown)); + rootLayout.addView(bottomShadow); + + shareButton = new TextView(context); + shareButton.setBackground(Theme.createSimpleSelectorRoundRectDrawable(AndroidUtilities.dp(6), fragment.getThemedColor(Theme.key_featuredStickers_addButton), fragment.getThemedColor(Theme.key_featuredStickers_addButtonPressed))); + shareButton.setEllipsize(TextUtils.TruncateAt.END); + shareButton.setGravity(Gravity.CENTER); + shareButton.setLines(1); + shareButton.setSingleLine(true); + shareButton.setText(LocaleController.getString("ShareQrCode", R.string.ShareQrCode)); + shareButton.setTextColor(fragment.getThemedColor(Theme.key_featuredStickers_buttonText)); + shareButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15); + shareButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); + rootLayout.addView(shareButton); + } + + public void onCreate() { + ChatThemeController.preloadAllWallpaperThumbs(true); + ChatThemeController.preloadAllWallpaperThumbs(false); + ChatThemeController.preloadAllWallpaperImages(true); + ChatThemeController.preloadAllWallpaperImages(false); + NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.emojiLoaded); + } + + @SuppressLint("NotifyDataSetChanged") + @Override + public void didReceivedNotification(int id, int account, Object... args) { + if (id == NotificationCenter.emojiLoaded) { + adapter.notifyDataSetChanged(); + } + } + + public void onDestroy() { + NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.emojiLoaded); + } + + public void setItemSelectedListener(OnItemSelectedListener itemSelectedListener) { + this.itemSelectedListener = itemSelectedListener; + } + + public void onDataLoaded() { + darkThemeView.setVisibility(View.VISIBLE); + progressView.animate().alpha(0f).setListener(new HideViewAfterAnimation(progressView)).setDuration(150).start(); + recyclerView.setAlpha(0f); + recyclerView.animate().alpha(1f).setDuration(150).start(); + } + + public void setSelectedPosition(int selectedPosition) { + prevSelectedPosition = selectedPosition; + adapter.setSelectedItem(selectedPosition); + if (selectedPosition > 0 && selectedPosition < adapter.items.size() / 2) { + selectedPosition -= 1; + } + int finalSelectedPosition = Math.min(selectedPosition, adapter.items.size() - 1); + layoutManager.scrollToPositionWithOffset(finalSelectedPosition, 0); + } + + protected void onItemClicked(View view, int position) { + if (adapter.items.get(position) == selectedItem || changeDayNightView != null) { + return; + } + isLightDarkChangeAnimation = false; + selectedItem = adapter.items.get(position); + adapter.setSelectedItem(position); + rootLayout.postDelayed(() -> { + RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager(); + if (layoutManager != null) { + final int targetPosition = position > prevSelectedPosition + ? Math.min(position + 1, adapter.items.size() - 1) + : Math.max(position - 1, 0); + scroller.setTargetPosition(targetPosition); + layoutManager.startSmoothScroll(scroller); + } + prevSelectedPosition = position; + }, 100); + for (int i = 0; i < recyclerView.getChildCount(); i++) { + ThemeSmallPreviewView child = (ThemeSmallPreviewView) recyclerView.getChildAt(i); + if (child != view) { + child.cancelAnimation(); + } + } + if (!adapter.items.get(position).chatTheme.showAsDefaultStub) { + ((ThemeSmallPreviewView) view).playEmojiAnimation(); + } + if (itemSelectedListener != null) { + itemSelectedListener.onItemSelected(selectedItem.chatTheme, position); + } + } + + @SuppressLint("NotifyDataSetChanged") + private void setupLightDarkTheme(boolean isDark) { + if (changeDayNightViewAnimator != null) { + changeDayNightViewAnimator.cancel(); + } + FrameLayout decorView1 = (FrameLayout) fragment.getParentActivity().getWindow().getDecorView(); + FrameLayout decorView2 = (FrameLayout) window.getDecorView(); + Bitmap bitmap = Bitmap.createBitmap(decorView2.getWidth(), decorView2.getHeight(), Bitmap.Config.ARGB_8888); + Canvas bitmapCanvas = new Canvas(bitmap); + darkThemeView.setAlpha(0f); + decorView1.draw(bitmapCanvas); + decorView2.draw(bitmapCanvas); + darkThemeView.setAlpha(1f); + + Paint xRefPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + xRefPaint.setColor(0xff000000); + xRefPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR)); + + Paint bitmapPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + bitmapPaint.setFilterBitmap(true); + int[] position = new int[2]; + darkThemeView.getLocationInWindow(position); + float x = position[0]; + float y = position[1]; + float cx = x + darkThemeView.getMeasuredWidth() / 2f; + float cy = y + darkThemeView.getMeasuredHeight() / 2f; + + float r = Math.max(bitmap.getHeight(), bitmap.getWidth()) * 0.9f; + + Shader bitmapShader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); + bitmapPaint.setShader(bitmapShader); + changeDayNightView = new View(fragment.getParentActivity()) { + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + if (isDark) { + if (changeDayNightViewProgress > 0f) { + bitmapCanvas.drawCircle(cx, cy, r * changeDayNightViewProgress, xRefPaint); + } + canvas.drawBitmap(bitmap, 0, 0, bitmapPaint); + } else { + canvas.drawCircle(cx, cy, r * (1f - changeDayNightViewProgress), bitmapPaint); + } + canvas.save(); + canvas.translate(x, y); + darkThemeView.draw(canvas); + canvas.restore(); + } + }; + changeDayNightViewProgress = 0f; + changeDayNightViewAnimator = ValueAnimator.ofFloat(0, 1f); + changeDayNightViewAnimator.addUpdateListener(valueAnimator -> { + changeDayNightViewProgress = (float) valueAnimator.getAnimatedValue(); + changeDayNightView.invalidate(); + }); + changeDayNightViewAnimator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + if (changeDayNightView != null) { + if (changeDayNightView.getParent() != null) { + ((ViewGroup) changeDayNightView.getParent()).removeView(changeDayNightView); + } + changeDayNightView = null; + } + changeDayNightViewAnimator = null; + super.onAnimationEnd(animation); + } + }); + changeDayNightViewAnimator.setDuration(400); + changeDayNightViewAnimator.setInterpolator(Easings.easeInOutQuad); + changeDayNightViewAnimator.start(); + + decorView2.addView(changeDayNightView, new ViewGroup.LayoutParams(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); + + AndroidUtilities.runOnUIThread(() -> { + if (adapter == null || adapter.items == null) { + return; + } + setForceDark(isDark, true); + if (selectedItem != null) { + isLightDarkChangeAnimation = true; + setDarkTheme(isDark); + } + if (adapter.items != null) { + for (int i = 0; i < adapter.items.size(); i++) { + adapter.items.get(i).themeIndex = isDark ? 1 : 0; + adapter.items.get(i).icon = getEmojiThemeIcon(adapter.items.get(i).chatTheme, isDark); + } + tempMotionDrawable = null; + adapter.notifyDataSetChanged(); + } + }); + } + + protected void setDarkTheme(boolean isDark) { } + + public void setForceDark(boolean isDark, boolean playAnimation) { + if (forceDark == isDark) { + return; + } + forceDark = isDark; + if (playAnimation) { + darkThemeDrawable.setCustomEndFrame(isDark ? darkThemeDrawable.getFramesCount() : 0); + darkThemeView.playAnimation(); + } else { + darkThemeDrawable.setCurrentFrame(isDark ? darkThemeDrawable.getFramesCount() - 1 : 0, false, true); + darkThemeView.invalidate(); + } + } + + public void setDarkButtonColor(int color) { + darkThemeDrawable.setLayerColor("Sunny.**", color); + darkThemeDrawable.setLayerColor("Path.**", color); + darkThemeDrawable.setLayerColor("Path 10.**", color); + darkThemeDrawable.setLayerColor("Path 11.**", color); + } + + private LinearLayoutManager getLayoutManager(boolean isPortrait) { + return isPortrait + ? new LinearLayoutManager(fragment.getParentActivity(), LinearLayoutManager.HORIZONTAL, false) + : new GridLayoutManager(fragment.getParentActivity(), 3, LinearLayoutManager.VERTICAL, false); + } + + private void onAnimationStart() { + if (adapter != null && adapter.items != null) { + for (ChatThemeBottomSheet.ChatThemeItem item : adapter.items) { + item.themeIndex = forceDark ? 1 : 0; + } + } + if (!isLightDarkChangeAnimation) { + setItemsAnimationProgress(1.0f); + } + } + + private void setItemsAnimationProgress(float progress) { + for (int i = 0; i < adapter.getItemCount(); ++i) { + adapter.items.get(i).animationProgress = progress; + } + } + + private void onAnimationEnd() { + isLightDarkChangeAnimation = false; + } + + public ArrayList getThemeDescriptions() { + ThemeDescription.ThemeDescriptionDelegate descriptionDelegate = new ThemeDescription.ThemeDescriptionDelegate() { + + private boolean isAnimationStarted = false; + + @Override + public void onAnimationProgress(float progress) { + if (progress == 0f && !isAnimationStarted) { + onAnimationStart(); + isAnimationStarted = true; + } + setDarkButtonColor(fragment.getThemedColor(Theme.key_featuredStickers_addButton)); + if (isLightDarkChangeAnimation) { + setItemsAnimationProgress(progress); + } + if (progress == 1f && isAnimationStarted) { + isLightDarkChangeAnimation = false; + onAnimationEnd(); + isAnimationStarted = false; + } + } + + @Override + public void didSetColor() {} + }; + ArrayList themeDescriptions = new ArrayList<>(); + themeDescriptions.add(new ThemeDescription(null, ThemeDescription.FLAG_BACKGROUND, null, backgroundPaint, null, null, Theme.key_dialogBackground)); + themeDescriptions.add(new ThemeDescription(null, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, new Drawable[]{ backgroundDrawable }, descriptionDelegate, Theme.key_dialogBackground)); + themeDescriptions.add(new ThemeDescription(titleView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_dialogTextBlack)); + themeDescriptions.add(new ThemeDescription(recyclerView, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[]{ThemeSmallPreviewView.class}, null, null, null, Theme.key_dialogBackgroundGray)); + for (ThemeDescription description : themeDescriptions) { + description.resourcesProvider = fragment.getResourceProvider(); + } + return themeDescriptions; + } + } + + interface OnItemSelectedListener { + + void onItemSelected(EmojiThemes theme, int position); + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ReactionsDoubleTapManageActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ReactionsDoubleTapManageActivity.java new file mode 100644 index 000000000..a782dceb9 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/ReactionsDoubleTapManageActivity.java @@ -0,0 +1,195 @@ +package org.telegram.ui; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.os.Build; +import android.view.View; +import android.view.ViewGroup; +import android.widget.LinearLayout; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MediaDataController; +import org.telegram.messenger.NotificationCenter; +import org.telegram.messenger.R; +import org.telegram.tgnet.TLRPC; +import org.telegram.ui.ActionBar.ActionBar; +import org.telegram.ui.ActionBar.BaseFragment; +import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.ActionBar.ThemeDescription; +import org.telegram.ui.Cells.AvailableReactionCell; +import org.telegram.ui.Cells.TextInfoPrivacyCell; +import org.telegram.ui.Cells.ThemePreviewMessagesCell; +import org.telegram.ui.Components.LayoutHelper; +import org.telegram.ui.Components.RecyclerListView; +import org.telegram.ui.Components.SimpleThemeDescription; + +import java.util.ArrayList; +import java.util.List; + +public class ReactionsDoubleTapManageActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate { + + private LinearLayout contentView; + private RecyclerListView listView; + private RecyclerView.Adapter listAdapter; + + int previewRow; + int infoRow; + int reactionsStartRow; + int rowCount; + + public ReactionsDoubleTapManageActivity() { + super(); + } + + @Override + public boolean onFragmentCreate() { + getNotificationCenter().addObserver(this, NotificationCenter.reactionsDidLoad); + return super.onFragmentCreate(); + } + + @Override + public View createView(Context context) { + actionBar.setTitle(LocaleController.getString("Reactions", R.string.Reactions)); + actionBar.setBackButtonImage(R.drawable.ic_ab_back); + actionBar.setAllowOverlayTitle(true); + + actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() { + @Override + public void onItemClick(int id) { + if (id == -1) { + finishFragment(); + } + } + }); + + LinearLayout linaerLayout = new LinearLayout(context); + linaerLayout.setOrientation(LinearLayout.VERTICAL); + + listView = new RecyclerListView(context); + listView.setLayoutManager(new LinearLayoutManager(context)); + listView.setAdapter(listAdapter = new RecyclerView.Adapter() { + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view; + switch (viewType) { + case 0: + ThemePreviewMessagesCell messagesCell = new ThemePreviewMessagesCell(context, parentLayout, ThemePreviewMessagesCell.TYPE_REACTIONS_DOUBLE_TAP); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + messagesCell.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS); + } + messagesCell.fragment = ReactionsDoubleTapManageActivity.this; + view = messagesCell; + break; + case 2: + TextInfoPrivacyCell cell = new TextInfoPrivacyCell(context); + cell.setText(LocaleController.getString("DoubleTapPreviewRational", R.string.DoubleTapPreviewRational)); + view = cell; + break; + default: + case 1: { + view = new AvailableReactionCell(context, true); + } + break; + } + return new RecyclerListView.Holder(view); + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + switch (getItemViewType(position)) { + case 1: + AvailableReactionCell reactionCell = (AvailableReactionCell) holder.itemView; + TLRPC.TL_availableReaction react = getAvailableReactions().get(position - reactionsStartRow); + reactionCell.bind(react, react.reaction.contains(MediaDataController.getInstance(currentAccount).getDoubleTapReaction())); + break; + } + } + + @Override + public int getItemCount() { + return getAvailableReactions().size(); + } + + @Override + public int getItemViewType(int position) { + if (position == previewRow) { + return 0; + } + if (position == infoRow) { + return 2; + } + return 1; + } + }); + listView.setOnItemClickListener((view, position) -> { + if (view instanceof AvailableReactionCell) { + MediaDataController.getInstance(currentAccount).setDoubleTapReaction(((AvailableReactionCell) view).react.reaction); + AndroidUtilities.updateVisibleRows(listView); + } + }); + linaerLayout.addView(listView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); + fragmentView = contentView = linaerLayout; + + updateColors(); + updateRows(); + + return contentView; + } + + private void updateRows() { + rowCount = 0; + previewRow = rowCount++; + infoRow = rowCount++; + reactionsStartRow = rowCount++; + } + + @Override + public void onFragmentDestroy() { + super.onFragmentDestroy(); + getNotificationCenter().removeObserver(this, NotificationCenter.reactionsDidLoad); + } + + private List getAvailableReactions() { + return getMediaDataController().getEnabledReactionsList(); + } + + @Override + public ArrayList getThemeDescriptions() { + return SimpleThemeDescription.createThemeDescriptions(this::updateColors, + Theme.key_windowBackgroundWhite, + Theme.key_windowBackgroundWhiteBlackText, + Theme.key_windowBackgroundWhiteGrayText2, + Theme.key_listSelector, + Theme.key_windowBackgroundGray, + Theme.key_windowBackgroundWhiteGrayText4, + Theme.key_windowBackgroundWhiteRedText4, + Theme.key_windowBackgroundChecked, + Theme.key_windowBackgroundCheckText, + Theme.key_switchTrackBlue, + Theme.key_switchTrackBlueChecked, + Theme.key_switchTrackBlueThumb, + Theme.key_switchTrackBlueThumbChecked + ); + } + + @SuppressLint("NotifyDataSetChanged") + private void updateColors() { + contentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray)); + listAdapter.notifyDataSetChanged(); + } + + @SuppressLint("NotifyDataSetChanged") + @Override + public void didReceivedNotification(int id, int account, Object... args) { + if (account != currentAccount) return; + if (id == NotificationCenter.reactionsDidLoad) { + listAdapter.notifyDataSetChanged(); + } + } +} \ No newline at end of file diff --git a/TMessagesProj/src/main/java/org/telegram/ui/RestrictedLanguagesSelectActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/RestrictedLanguagesSelectActivity.java new file mode 100644 index 000000000..15b832c42 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/RestrictedLanguagesSelectActivity.java @@ -0,0 +1,561 @@ +/* + * This is the source code of Telegram for Android v. 1.3.x. + * 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-2018. + */ + +package org.telegram.ui; + +import android.animation.ValueAnimator; +import android.content.Context; +import android.content.DialogInterface; +import android.content.SharedPreferences; +import android.view.View; +import android.view.ViewGroup; +import android.widget.EditText; +import android.widget.FrameLayout; +import android.widget.LinearLayout; +import android.widget.TextView; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.FileLog; +import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MessagesController; +import org.telegram.messenger.NotificationCenter; +import org.telegram.messenger.R; +import org.telegram.messenger.Utilities; +import org.telegram.ui.ActionBar.AlertDialog; +import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.ActionBar.ThemeDescription; +import org.telegram.ui.Cells.CheckBoxCell; +import org.telegram.ui.Cells.HeaderCell; +import org.telegram.ui.Cells.LanguageCell; +import org.telegram.ui.ActionBar.ActionBar; +import org.telegram.ui.ActionBar.ActionBarMenu; +import org.telegram.ui.ActionBar.ActionBarMenuItem; +import org.telegram.ui.ActionBar.BaseFragment; +import org.telegram.ui.Cells.ShadowSectionCell; +import org.telegram.ui.Cells.TextCheckbox2Cell; +import org.telegram.ui.Cells.TextCheckCell; +import org.telegram.ui.Cells.TextInfoPrivacyCell; +import org.telegram.ui.Cells.TextRadioCell; +import org.telegram.ui.Cells.TextSettingsCell; +import org.telegram.ui.Components.CubicBezierInterpolator; +import org.telegram.ui.Components.EmptyTextProgressView; +import org.telegram.ui.Components.LayoutHelper; +import org.telegram.ui.Components.RecyclerListView; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashSet; +import java.util.Set; +import java.util.Timer; +import java.util.TimerTask; + +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +public class RestrictedLanguagesSelectActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate { + + private ListAdapter listAdapter; + private RecyclerListView listView; + private ListAdapter searchListViewAdapter; + private EmptyTextProgressView emptyView; + + private boolean searchWas; + private boolean searching; + + private Timer searchTimer; + private ArrayList searchResult; + private ArrayList sortedLanguages; +// private ArrayList unofficialLanguages; + + private SharedPreferences preferences; + private SharedPreferences.OnSharedPreferenceChangeListener listener; + private HashSet selectedLanguages = null; + + public static HashSet getRestrictedLanguages() { +// String currentLangCode = LocaleController.getInstance().getCurrentLocaleInfo().pluralLangCode; +// String[] onlyCurrentLang = new String[] { currentLangCode }; + return new HashSet<>(MessagesController.getGlobalMainSettings().getStringSet("translate_button_restricted_languages", new HashSet(/*Arrays.asList(onlyCurrentLang)*/))); + } + + @Override + public boolean onFragmentCreate() { + preferences = MessagesController.getGlobalMainSettings(); + selectedLanguages = getRestrictedLanguages(); + preferences.registerOnSharedPreferenceChangeListener(listener = new SharedPreferences.OnSharedPreferenceChangeListener() { + public int langPos(String lng) { + if (lng == null) + return -1; + ArrayList arr = (searching ? searchResult : sortedLanguages); + if (arr == null) + return -1; + for (int i = 0; i < arr.size(); ++i) + if (lng.equals(arr.get(i).pluralLangCode)) + return i; + return -1; + } + + @Override + public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String s) { + preferences = sharedPreferences; + HashSet newSelectedLanguages = getRestrictedLanguages(); + if (listView != null && listView.getAdapter() != null) { + RecyclerView.Adapter adapter = listView.getAdapter(); + int offset = !searching ? 1 : 0; + for (String lng : selectedLanguages) + if (!newSelectedLanguages.contains(lng)) + adapter.notifyItemChanged(langPos(lng) + offset); + for (String lng : newSelectedLanguages) + if (!selectedLanguages.contains(lng)) + adapter.notifyItemChanged(langPos(lng) + offset); + } + selectedLanguages = newSelectedLanguages; + } + }); + + fillLanguages(); + LocaleController.getInstance().loadRemoteLanguages(currentAccount); + NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.suggestedLangpack); + return super.onFragmentCreate(); + } + + @Override + public void onFragmentDestroy() { + super.onFragmentDestroy(); + preferences.unregisterOnSharedPreferenceChangeListener(listener); + NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.suggestedLangpack); + } + + @Override + public View createView(Context context) { + searching = false; + searchWas = false; + + actionBar.setBackButtonImage(R.drawable.ic_ab_back); + actionBar.setAllowOverlayTitle(true); + actionBar.setTitle(LocaleController.getString("DoNotTranslate", R.string.DoNotTranslate)); + + actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() { + @Override + public void onItemClick(int id) { + if (id == -1) { + finishFragment(); + } + } + }); + + ActionBarMenu menu = actionBar.createMenu(); + ActionBarMenuItem item = menu.addItem(0, R.drawable.ic_ab_search).setIsSearchField(true).setActionBarMenuItemSearchListener(new ActionBarMenuItem.ActionBarMenuItemSearchListener() { + @Override + public void onSearchExpand() { + searching = true; + } + + @Override + public void onSearchCollapse() { + search(null); + searching = false; + searchWas = false; + if (listView != null) { + emptyView.setVisibility(View.GONE); + listView.setAdapter(listAdapter); + } + } + + @Override + public void onTextChanged(EditText editText) { + String text = editText.getText().toString(); + search(text); + if (text.length() != 0) { + searchWas = true; + if (listView != null) { + listView.setAdapter(searchListViewAdapter); + } + } else { + searching = false; + searchWas = false; + if (listView != null) { + emptyView.setVisibility(View.GONE); + listView.setAdapter(listAdapter); + } + } + } + }); + item.setSearchFieldHint(LocaleController.getString("Search", R.string.Search)); + + listAdapter = new ListAdapter(context, false); + searchListViewAdapter = new ListAdapter(context, true); + + fragmentView = new FrameLayout(context); + fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray)); + FrameLayout frameLayout = (FrameLayout) fragmentView; + + emptyView = new EmptyTextProgressView(context); + emptyView.setText(LocaleController.getString("NoResult", R.string.NoResult)); + emptyView.showTextView(); + emptyView.setShowAtCenter(true); + frameLayout.addView(emptyView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); + + listView = new RecyclerListView(context); + listView.setEmptyView(emptyView); + listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)); + listView.setVerticalScrollBarEnabled(false); + listView.setAdapter(listAdapter); + frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); + + listView.setOnItemClickListener((view, position) -> { + if (getParentActivity() == null || parentLayout == null || !(view instanceof TextCheckbox2Cell)) { + return; + } + boolean search = listView.getAdapter() == searchListViewAdapter; + if (!search) + position--; + LocaleController.LocaleInfo localeInfo; + if (search) { + localeInfo = searchResult.get(position); + } else { + localeInfo = sortedLanguages.get(position); + } + if (localeInfo != null) { + LocaleController.LocaleInfo currentLocaleInfo = LocaleController.getInstance().getCurrentLocaleInfo(); + String langCode = localeInfo.pluralLangCode; + if (langCode != null && langCode.equals(currentLocaleInfo.pluralLangCode)) { + AndroidUtilities.shakeView(((TextCheckbox2Cell) view).checkbox, 2, 0); + return; + } + boolean value = selectedLanguages.contains(langCode); + HashSet newSelectedLanguages = new HashSet(selectedLanguages); + if (value) + newSelectedLanguages.removeIf(s -> s != null && s.equals(langCode)); + else + newSelectedLanguages.add(langCode); + if (newSelectedLanguages.size() == 1 && newSelectedLanguages.contains(currentLocaleInfo.pluralLangCode)) + preferences.edit().remove("translate_button_restricted_languages").apply(); + else + preferences.edit().putStringSet("translate_button_restricted_languages", newSelectedLanguages).apply(); + } + }); + + listView.setOnItemLongClickListener((view, position) -> { + if (getParentActivity() == null || parentLayout == null || !(view instanceof TextCheckbox2Cell)) { + return false; + } + boolean search = listView.getAdapter() == searchListViewAdapter; + if (!search) + position--; + LocaleController.LocaleInfo localeInfo; + if (search) { + localeInfo = searchResult.get(position); + } else { + localeInfo = sortedLanguages.get(position); + } + if (localeInfo == null || localeInfo.pathToFile == null || localeInfo.isRemote() && localeInfo.serverIndex != Integer.MAX_VALUE) { + return false; + } + final LocaleController.LocaleInfo finalLocaleInfo = localeInfo; + AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); + builder.setTitle(LocaleController.getString("DeleteLocalizationTitle", R.string.DeleteLocalizationTitle)); + builder.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("DeleteLocalizationText", R.string.DeleteLocalizationText, localeInfo.name))); + builder.setPositiveButton(LocaleController.getString("Delete", R.string.Delete), (dialogInterface, i) -> { + if (LocaleController.getInstance().deleteLanguage(finalLocaleInfo, currentAccount)) { + fillLanguages(); + if (searchResult != null) { + searchResult.remove(finalLocaleInfo); + } + if (listAdapter != null) { + listAdapter.notifyDataSetChanged(); + } + if (searchListViewAdapter != null) { + searchListViewAdapter.notifyDataSetChanged(); + } + } + }); + builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); + AlertDialog alertDialog = builder.create(); + showDialog(alertDialog); + TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE); + if (button != null) { + button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2)); + } + return true; + }); + + listView.setOnScrollListener(new RecyclerView.OnScrollListener() { + @Override + public void onScrollStateChanged(RecyclerView recyclerView, int newState) { + if (newState == RecyclerView.SCROLL_STATE_DRAGGING) { + AndroidUtilities.hideKeyboard(getParentActivity().getCurrentFocus()); + } + } + }); + + return fragmentView; + } + + @Override + public void didReceivedNotification(int id, int account, Object... args) { + if (id == NotificationCenter.suggestedLangpack) { + if (listAdapter != null) { + fillLanguages(); + listAdapter.notifyDataSetChanged(); + } + } + } + + private void fillLanguages() { + final LocaleController.LocaleInfo currentLocale = LocaleController.getInstance().getCurrentLocaleInfo(); + Comparator comparator = (o, o2) -> { + if (o == currentLocale) { + return -1; + } else if (o2 == currentLocale) { + return 1; + } else if (o.serverIndex == o2.serverIndex) { + return o.name.compareTo(o2.name); + } + if (o.serverIndex > o2.serverIndex) { + return 1; + } else if (o.serverIndex < o2.serverIndex) { + return -1; + } + return 0; + }; + + sortedLanguages = new ArrayList<>(); + + ArrayList arrayList = LocaleController.getInstance().languages; + for (int a = 0, size = arrayList.size(); a < size; a++) { + LocaleController.LocaleInfo info = arrayList.get(a); + if (info != null && info.serverIndex != Integer.MAX_VALUE/* && (info.pluralLangCode == null || !info.pluralLangCode.equals(currentLocale.pluralLangCode))*/) { + sortedLanguages.add(info); + } + } + Collections.sort(sortedLanguages, comparator); + } + + @Override + public void onResume() { + super.onResume(); + if (listAdapter != null) { + listAdapter.notifyDataSetChanged(); + } + } + + public void search(final String query) { + if (query == null) { + searchResult = null; + } else { + try { + if (searchTimer != null) { + searchTimer.cancel(); + } + } catch (Exception e) { + FileLog.e(e); + } +// searchTimer = new Timer(); +// searchTimer.schedule(new TimerTask() { +// @Override +// public void run() { +// try { +// searchTimer.cancel(); +// searchTimer = null; +// } catch (Exception e) { +// FileLog.e(e); +// } + processSearch(query); +// } +// }, 100, 300); + } + } + + private void processSearch(final String query) { +// Utilities.searchQueue.postRunnable(() -> { + + String q = query.trim().toLowerCase(); + if (q.length() == 0) { + updateSearchResults(new ArrayList<>()); + return; + } + long time = System.currentTimeMillis(); + ArrayList resultArray = new ArrayList<>(); + +// for (int a = 0, N = unofficialLanguages.size(); a < N; a++) { +// LocaleController.LocaleInfo c = unofficialLanguages.get(a); +// if (c.name.toLowerCase().startsWith(query) || c.nameEnglish.toLowerCase().startsWith(query)) { +// resultArray.add(c); +// } +// } + + for (int a = 0, N = sortedLanguages.size(); a < N; a++) { + LocaleController.LocaleInfo c = sortedLanguages.get(a); + if (c.name.toLowerCase().startsWith(query) || c.nameEnglish.toLowerCase().startsWith(query)) { + resultArray.add(c); + } + } + + updateSearchResults(resultArray); +// }); + } + + private void updateSearchResults(final ArrayList arrCounties) { + AndroidUtilities.runOnUIThread(() -> { + searchResult = arrCounties; + searchListViewAdapter.notifyDataSetChanged(); + }); + } + + private class ListAdapter extends RecyclerListView.SelectionAdapter { + + private Context mContext; + private boolean search; + + public ListAdapter(Context context, boolean isSearch) { + mContext = context; + search = isSearch; + } + + @Override + public boolean isEnabled(RecyclerView.ViewHolder holder) { + return holder.getItemViewType() == 0; + } + + @Override + public int getItemCount() { + if (search) { + if (searchResult == null) { + return 0; + } + return searchResult.size(); + } else { + int count = sortedLanguages.size(); + return 1 + count; + } + } + + @Override + public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + View view; + switch (viewType) { + case 0: { + view = new TextCheckbox2Cell(mContext); + view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); + break; + } + case 2: + HeaderCell header = new HeaderCell(mContext); + header.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); + header.setText(LocaleController.getString("ChooseLanguages", R.string.ChooseLanguages)); + view = header; + break; + case 1: + default: { + view = new ShadowSectionCell(mContext); + break; + } + } + return new RecyclerListView.Holder(view); + } + + @Override + public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { + switch (holder.getItemViewType()) { + case 0: { + if (!search) + position--; +// LanguageCell textSettingsCell = (LanguageCell) holder.itemView; + TextCheckbox2Cell textSettingsCell = (TextCheckbox2Cell) holder.itemView; + LocaleController.LocaleInfo localeInfo; + boolean last; + if (search) { + localeInfo = searchResult.get(position); + last = position == searchResult.size() - 1; + } /*else if (!unofficialLanguages.isEmpty() && position >= 0 && position < unofficialLanguages.size()) { + localeInfo = unofficialLanguages.get(position); + last = position == unofficialLanguages.size() - 1; + } */else { +// if (!unofficialLanguages.isEmpty()) { +// position -= unofficialLanguages.size() + 1; +// } + localeInfo = sortedLanguages.get(position); + last = position == sortedLanguages.size() - 1; + } + String langCode = localeInfo.pluralLangCode; + boolean value = selectedLanguages.contains(langCode); + if (localeInfo.isLocal()) { + textSettingsCell.setTextAndValue(String.format("%1$s (%2$s)", localeInfo.name, LocaleController.getString("LanguageCustom", R.string.LanguageCustom)), localeInfo.nameEnglish, false, !last); + } else { + textSettingsCell.setTextAndValue(localeInfo.name, localeInfo.nameEnglish, false, !last); + } + + boolean isCurrent = langCode != null && langCode.equals(LocaleController.getInstance().getCurrentLocaleInfo().pluralLangCode); + textSettingsCell.setChecked(value || isCurrent); + break; + } + case 1: { + if (!search) + position--; + ShadowSectionCell sectionCell = (ShadowSectionCell) holder.itemView; +// if (!unofficialLanguages.isEmpty() && position == unofficialLanguages.size()) { +// sectionCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); +// } else { + sectionCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); +// } + break; + } + case 2: { + + } + } + } + + @Override + public int getItemViewType(int i) { + if (!search) + i--; + if (i == -1) + return 2; + if (search) { + return 0; + } +// if (!unofficialLanguages.isEmpty() && (i == unofficialLanguages.size() || i == unofficialLanguages.size() + sortedLanguages.size() + 1) || unofficialLanguages.isEmpty() && i == sortedLanguages.size()) { +// return 1; +// } + return 0; + } + } + + @Override + public ArrayList getThemeDescriptions() { + ArrayList themeDescriptions = new ArrayList<>(); + + themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[]{LanguageCell.class}, null, null, null, Theme.key_windowBackgroundWhite)); + themeDescriptions.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundGray)); + + themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_actionBarDefault)); + themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefault)); + themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarDefaultIcon)); + themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, null, null, null, null, Theme.key_actionBarDefaultTitle)); + themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarDefaultSelector)); + themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SEARCH, null, null, null, null, Theme.key_actionBarDefaultSearch)); + themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SEARCHPLACEHOLDER, null, null, null, null, Theme.key_actionBarDefaultSearchPlaceholder)); + + themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_listSelector)); + + themeDescriptions.add(new ThemeDescription(emptyView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_emptyListPlaceholder)); + + themeDescriptions.add(new ThemeDescription(listView, 0, new Class[]{View.class}, Theme.dividerPaint, null, null, Theme.key_divider)); + + themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ShadowSectionCell.class}, null, null, null, Theme.key_windowBackgroundGrayShadow)); + + themeDescriptions.add(new ThemeDescription(listView, 0, new Class[]{LanguageCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); + themeDescriptions.add(new ThemeDescription(listView, 0, new Class[]{LanguageCell.class}, new String[]{"textView2"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText3)); + themeDescriptions.add(new ThemeDescription(listView, 0, new Class[]{LanguageCell.class}, new String[]{"checkImage"}, null, null, null, Theme.key_featuredStickers_addedIcon)); + + return themeDescriptions; + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/SessionBottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/SessionBottomSheet.java index 5b2f8352f..a510d2fc6 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/SessionBottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/SessionBottomSheet.java @@ -378,17 +378,19 @@ public class SessionBottomSheet extends BottomSheet { LinearLayout linearLayout = new LinearLayout(context); linearLayout.setOrientation(LinearLayout.VERTICAL); - addView(linearLayout, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 64, 4, 0, 4)); + addView(linearLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 64, 4, 0, 4)); valueText = new TextView(context); valueText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16); + valueText.setGravity(Gravity.LEFT); valueText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); - linearLayout.addView(valueText, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 0, 0, 0, 0)); + linearLayout.addView(valueText, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 0, 0, needSwitch ? 46 : 0, 0)); descriptionText = new TextView(context); descriptionText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13); + descriptionText.setGravity(Gravity.LEFT); descriptionText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText)); - linearLayout.addView(descriptionText, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 0, 4, 0, 0)); + linearLayout.addView(descriptionText, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 0, 4, needSwitch ? 46 : 0, 0)); setPadding(0, AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4)); if (needSwitch) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/TextMessageEnterTransition.java b/TMessagesProj/src/main/java/org/telegram/ui/TextMessageEnterTransition.java index 202551db2..9d95a7cec 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/TextMessageEnterTransition.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/TextMessageEnterTransition.java @@ -41,9 +41,9 @@ import org.telegram.ui.Components.ChatActivityEnterView; import org.telegram.ui.Components.CubicBezierInterpolator; import org.telegram.ui.Components.EmptyStubSpan; import org.telegram.ui.Components.RecyclerListView; +import org.telegram.ui.Components.spoilers.SpoilerEffect; public class TextMessageEnterTransition implements MessageEnterTransitionContainer.Transition { - float fromRadius; float progress; @@ -561,8 +561,18 @@ public class TextMessageEnterTransition implements MessageEnterTransitionContain if (messageView.replyTextLayout != null) { canvas.save(); canvas.translate(replyMessageX, replyY + AndroidUtilities.dp(19)); + + canvas.save(); + SpoilerEffect.clipOutCanvas(canvas, messageView.replySpoilers); messageView.replyTextLayout.draw(canvas); canvas.restore(); + + for (SpoilerEffect eff : messageView.replySpoilers) { + if (eff.shouldInvalidateColor()) eff.setColor(messageView.replyTextLayout.getPaint().getColor()); + eff.draw(canvas); + } + + canvas.restore(); } canvas.restore(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ThemeActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ThemeActivity.java index 004d1f5ab..db20fe5f4 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ThemeActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ThemeActivity.java @@ -28,13 +28,6 @@ import android.location.LocationManager; import android.net.Uri; import android.os.Build; import android.os.Bundle; - -import androidx.annotation.Keep; -import androidx.core.content.FileProvider; -import androidx.recyclerview.widget.DefaultItemAnimator; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - import android.text.TextPaint; import android.text.TextUtils; import android.util.SparseArray; @@ -47,19 +40,29 @@ import android.widget.Button; import android.widget.FrameLayout; import android.widget.TextView; +import androidx.annotation.Keep; +import androidx.core.content.FileProvider; +import androidx.recyclerview.widget.DefaultItemAnimator; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.ApplicationLoader; import org.telegram.messenger.BuildConfig; -import org.telegram.messenger.MediaDataController; +import org.telegram.messenger.DocumentObject; import org.telegram.messenger.FileLoader; import org.telegram.messenger.FileLog; +import org.telegram.messenger.ImageLocation; import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MediaDataController; import org.telegram.messenger.MessagesController; import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; import org.telegram.messenger.SharedConfig; +import org.telegram.messenger.SvgHelper; import org.telegram.messenger.Utilities; import org.telegram.messenger.time.SunDate; +import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenu; import org.telegram.ui.ActionBar.ActionBarMenuItem; @@ -92,7 +95,6 @@ import org.telegram.ui.Components.ThemeEditorView; import java.io.File; import java.io.FileOutputStream; -import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; @@ -172,6 +174,7 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No private int themeListRow2; private int themeAccentListRow; private int themeInfoRow; + private int reactionsDoubleTapRow; private int swipeGestureHeaderRow; private int swipeGestureRow; @@ -493,6 +496,7 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No chatListHeaderRow = -1; chatListRow = -1; chatListInfoRow = -1; + reactionsDoubleTapRow = -1; textSizeRow = -1; backgroundRow = -1; @@ -602,6 +606,7 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No sendByEnterRow = rowCount++; saveToGalleryRow = -1; distanceRow = rowCount++; + reactionsDoubleTapRow = rowCount++; settings2Row = rowCount++; stickersRow = rowCount++; stickersSection2Row = rowCount++; @@ -1056,6 +1061,8 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No showDialog(builder.create()); } else if (position == stickersRow) { presentFragment(new StickersActivity(MediaDataController.TYPE_IMAGE)); + } else if (position == reactionsDoubleTapRow) { + presentFragment(new ReactionsDoubleTapManageActivity()); } else if (position == emojiRow) { SharedConfig.toggleBigEmoji(); if (view instanceof TextCheckCell) { @@ -1628,7 +1635,7 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No @Override public boolean isEnabled(RecyclerView.ViewHolder holder) { int type = holder.getItemViewType(); - return type == 0 || type == 1 || type == 4 || type == 7 || type == 10 || type == 11 || type == 12 || type == 14; + return type == 0 || type == 1 || type == 4 || type == 7 || type == 10 || type == 11 || type == 12 || type == 14 || type == 18; } private void showOptionsForTheme(Theme.ThemeInfo themeInfo) { @@ -2006,6 +2013,9 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No cell.setFocusable(false); view.setLayoutParams(new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); break; + case 18: + view = new TextSettingsCell(mContext); + break; } return new RecyclerListView.Holder(view); } @@ -2056,7 +2066,7 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No } else { value = LocaleController.getString("DistanceUnitsMiles", R.string.DistanceUnitsMiles); } - cell.setTextAndValue(LocaleController.getString("DistanceUnits", R.string.DistanceUnits), value, false); + cell.setTextAndValue(LocaleController.getString("DistanceUnits", R.string.DistanceUnits), value, true); } break; } @@ -2204,6 +2214,19 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No cell.updateDayNightMode(); break; } + case 18:{ + TextSettingsCell settingsCell = (TextSettingsCell) holder.itemView; + settingsCell.setText(LocaleController.getString("DoubleTapSetting", R.string.DoubleTapSetting), false); + String reaction = MediaDataController.getInstance(currentAccount).getDoubleTapReaction(); + if (reaction != null) { + TLRPC.TL_availableReaction availableReaction = MediaDataController.getInstance(currentAccount).getReactionsMap().get(reaction); + if (availableReaction != null) { + SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(availableReaction.static_icon.thumbs, Theme.key_windowBackgroundGray, 1.0f); + settingsCell.getValueBackupImageView().getImageReceiver().setImage(ImageLocation.getForDocument(availableReaction.static_icon), "100_100", svgThumb, "webp", availableReaction, 1); + } + } + break; + } } } @@ -2262,6 +2285,8 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No return 16; } else if (position == themeListRow2) { return 17; + } else if (position == reactionsDoubleTapRow) { + return 18; } return 1; } diff --git a/TMessagesProj/src/main/res/drawable-hdpi/actions_reactions.png b/TMessagesProj/src/main/res/drawable-hdpi/actions_reactions.png new file mode 100644 index 000000000..e7c01332f Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/actions_reactions.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/msg_qr_mini.png b/TMessagesProj/src/main/res/drawable-hdpi/msg_qr_mini.png new file mode 100644 index 000000000..4ca349fe9 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/msg_qr_mini.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/msg_reactions.png b/TMessagesProj/src/main/res/drawable-hdpi/msg_reactions.png new file mode 100644 index 000000000..4d057421e Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/msg_reactions.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/msg_reactions_filled.png b/TMessagesProj/src/main/res/drawable-hdpi/msg_reactions_filled.png new file mode 100644 index 000000000..a976dd718 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/msg_reactions_filled.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/msg_translate.png b/TMessagesProj/src/main/res/drawable-hdpi/msg_translate.png new file mode 100644 index 000000000..38251c33e Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/msg_translate.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/qr_at_large.png b/TMessagesProj/src/main/res/drawable-hdpi/qr_at_large.png new file mode 100644 index 000000000..8001ab532 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/qr_at_large.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/qr_at_medium.png b/TMessagesProj/src/main/res/drawable-hdpi/qr_at_medium.png new file mode 100644 index 000000000..a18b3ab87 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/qr_at_medium.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/qr_at_small.png b/TMessagesProj/src/main/res/drawable-hdpi/qr_at_small.png new file mode 100644 index 000000000..6d1aaea98 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/qr_at_small.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/reactions_bubble_shadow.9.png b/TMessagesProj/src/main/res/drawable-hdpi/reactions_bubble_shadow.9.png new file mode 100644 index 000000000..2dac44605 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/reactions_bubble_shadow.9.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/actions_reactions.png b/TMessagesProj/src/main/res/drawable-mdpi/actions_reactions.png new file mode 100644 index 000000000..d275024c7 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/actions_reactions.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/msg_qr_mini.png b/TMessagesProj/src/main/res/drawable-mdpi/msg_qr_mini.png new file mode 100644 index 000000000..b26188bcd Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/msg_qr_mini.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/msg_reactions.png b/TMessagesProj/src/main/res/drawable-mdpi/msg_reactions.png new file mode 100644 index 000000000..e22c6de93 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/msg_reactions.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/msg_reactions_filled.png b/TMessagesProj/src/main/res/drawable-mdpi/msg_reactions_filled.png new file mode 100644 index 000000000..ce518bd55 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/msg_reactions_filled.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/msg_translate.png b/TMessagesProj/src/main/res/drawable-mdpi/msg_translate.png new file mode 100644 index 000000000..420003382 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/msg_translate.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/qr_at_large.png b/TMessagesProj/src/main/res/drawable-mdpi/qr_at_large.png new file mode 100644 index 000000000..005ccb04c Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/qr_at_large.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/qr_at_medium.png b/TMessagesProj/src/main/res/drawable-mdpi/qr_at_medium.png new file mode 100644 index 000000000..31038e80c Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/qr_at_medium.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/qr_at_small.png b/TMessagesProj/src/main/res/drawable-mdpi/qr_at_small.png new file mode 100644 index 000000000..480c30497 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/qr_at_small.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/reactions_bubble_shadow.9.png b/TMessagesProj/src/main/res/drawable-mdpi/reactions_bubble_shadow.9.png new file mode 100644 index 000000000..531c44598 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/reactions_bubble_shadow.9.png differ diff --git a/TMessagesProj/src/main/res/drawable-nodpi/dino_pic.jpg b/TMessagesProj/src/main/res/drawable-nodpi/dino_pic.jpg new file mode 100644 index 000000000..5bfe7c8c9 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-nodpi/dino_pic.jpg differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/actions_reactions.png b/TMessagesProj/src/main/res/drawable-xhdpi/actions_reactions.png new file mode 100644 index 000000000..b90a51cc1 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/actions_reactions.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/msg_qr_mini.png b/TMessagesProj/src/main/res/drawable-xhdpi/msg_qr_mini.png new file mode 100644 index 000000000..e3e3992d2 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/msg_qr_mini.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/msg_reactions.png b/TMessagesProj/src/main/res/drawable-xhdpi/msg_reactions.png new file mode 100644 index 000000000..5905cc14e Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/msg_reactions.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/msg_reactions_filled.png b/TMessagesProj/src/main/res/drawable-xhdpi/msg_reactions_filled.png new file mode 100644 index 000000000..401e13df2 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/msg_reactions_filled.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/msg_translate.png b/TMessagesProj/src/main/res/drawable-xhdpi/msg_translate.png new file mode 100644 index 000000000..6e1b2ed09 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/msg_translate.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/qr_at_large.png b/TMessagesProj/src/main/res/drawable-xhdpi/qr_at_large.png new file mode 100644 index 000000000..39d79e414 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/qr_at_large.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/qr_at_medium.png b/TMessagesProj/src/main/res/drawable-xhdpi/qr_at_medium.png new file mode 100644 index 000000000..34f0977fa Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/qr_at_medium.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/qr_at_small.png b/TMessagesProj/src/main/res/drawable-xhdpi/qr_at_small.png new file mode 100644 index 000000000..9436d20be Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/qr_at_small.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/reactions_bubble_shadow.9.png b/TMessagesProj/src/main/res/drawable-xhdpi/reactions_bubble_shadow.9.png new file mode 100644 index 000000000..69c5ad827 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/reactions_bubble_shadow.9.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/actions_reactions.png b/TMessagesProj/src/main/res/drawable-xxhdpi/actions_reactions.png new file mode 100644 index 000000000..7223c8a13 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/actions_reactions.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/msg_qr_mini.png b/TMessagesProj/src/main/res/drawable-xxhdpi/msg_qr_mini.png new file mode 100644 index 000000000..46074860a Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/msg_qr_mini.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/msg_reactions.png b/TMessagesProj/src/main/res/drawable-xxhdpi/msg_reactions.png new file mode 100644 index 000000000..88424cb0d Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/msg_reactions.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/msg_reactions_filled.png b/TMessagesProj/src/main/res/drawable-xxhdpi/msg_reactions_filled.png new file mode 100644 index 000000000..390b547a4 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/msg_reactions_filled.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/msg_translate.png b/TMessagesProj/src/main/res/drawable-xxhdpi/msg_translate.png new file mode 100644 index 000000000..05d0f1867 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/msg_translate.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/qr_at_large.png b/TMessagesProj/src/main/res/drawable-xxhdpi/qr_at_large.png new file mode 100644 index 000000000..e71c7601a Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/qr_at_large.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/qr_at_medium.png b/TMessagesProj/src/main/res/drawable-xxhdpi/qr_at_medium.png new file mode 100644 index 000000000..fa8518dcf Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/qr_at_medium.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/qr_at_small.png b/TMessagesProj/src/main/res/drawable-xxhdpi/qr_at_small.png new file mode 100644 index 000000000..3bb05e8cf Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/qr_at_small.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/reactions_bubble_shadow.9.png b/TMessagesProj/src/main/res/drawable-xxhdpi/reactions_bubble_shadow.9.png new file mode 100644 index 000000000..f14abf25b Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/reactions_bubble_shadow.9.png differ diff --git a/TMessagesProj/src/main/res/raw/qr_code_logo_2.tgs b/TMessagesProj/src/main/res/raw/qr_code_logo_2.tgs new file mode 100644 index 000000000..71c1521c8 --- /dev/null +++ b/TMessagesProj/src/main/res/raw/qr_code_logo_2.tgs @@ -0,0 +1 @@ +{"layers":[{"ddd":0,"ty":3,"nm":"Null 2","sr":1,"ks":{"p":{"a":1,"k":[{"t":20,"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"s":[253.375,252.125,0],"ti":[0,0,0],"to":[0,0,0]},{"t":24,"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"s":[260.5,258.625,0],"ti":[0,0,0],"to":[0,0,0]},{"t":28,"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"s":[253.375,252.125,0],"ti":[0,0,0],"to":[0,0,0]},{"t":33,"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"s":[260.5,258.625,0],"ti":[0,0,0],"to":[0,0,0]},{"t":38,"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"s":[253.375,252.125,0],"ti":[0,0,0],"to":[0,0,0]},{"t":42,"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"s":[260.5,258.625,0],"ti":[0,0,0],"to":[0,0,0]},{"t":47,"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"s":[253.375,252.125,0],"ti":[0,0,0],"to":[0,0,0]},{"t":51,"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"s":[260.5,258.625,0],"ti":[0,0,0],"to":[0,0,0]},{"t":55,"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"s":[253.375,252.125,0],"ti":[0,0,0],"to":[0,0,0]},{"t":60,"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"s":[260.5,258.625,0],"ti":[0,0,0],"to":[0,0,0]},{"t":64,"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"s":[253.375,252.125,0],"ti":[0,0,0],"to":[0,0,0]},{"t":69,"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"s":[260.5,258.625,0],"ti":[0,0,0],"to":[0,0,0]},{"t":73,"s":[253.375,252.125,0]}]},"o":{"k":0,"a":0}},"ao":0,"ip":0,"op":180,"st":0,"bm":0,"ind":1},{"ddd":0,"ty":3,"nm":"Null 1","parent":1,"sr":1,"ks":{"p":{"a":1,"k":[{"t":20,"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"s":[-1,-22.5,0],"ti":[8.25,-6.75,0],"to":[11,-5.75,0]},{"t":42.084,"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"s":[19,1.25,0],"ti":[5,7,0],"to":[-8.25,6.75,0]},{"t":52.684,"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"s":[0,0,0],"ti":[-11,5.75,0],"to":[-5,-7,0]},{"t":73,"s":[-1,-22.5,0]}]},"o":{"k":0,"a":0}},"ao":0,"ip":0,"op":180,"st":0,"bm":0,"ind":2},{"ddd":0,"ty":4,"nm":"Plane","parent":2,"sr":1,"ks":{"a":{"k":[12.637,41.19,0],"a":0},"p":{"a":1,"k":[{"t":20,"i":{"x":[0.69],"y":[0.452]},"o":{"x":[0.31],"y":[0]},"s":[13.035,0.078,0],"ti":[0,0,0],"to":[0,0,0]},{"t":42,"i":{"x":[0.69],"y":[1]},"o":{"x":[0.31],"y":[0.253]},"s":[15.045,-3.387,0],"ti":[0,0,0],"to":[0,0,0]},{"t":68,"i":{"x":[0.69],"y":[1]},"o":{"x":[0.31],"y":[0]},"s":[10.025,5.541,0],"ti":[0,0,0],"to":[0,0,0]},{"t":73,"s":[13.035,0.078,0]}]},"r":{"k":[{"t":22,"i":{"x":[0.69],"y":[1]},"o":{"x":[0.31],"y":[0]},"s":[-52]},{"t":47,"i":{"x":[0.69],"y":[1]},"o":{"x":[0.31],"y":[0]},"s":[-46]},{"t":73,"s":[-52]}],"a":1}},"ao":0,"ip":0,"op":180,"st":0,"bm":0,"ind":3,"shapes":[{"hd":false,"nm":"Group 1","ty":"gr","bm":0,"it":[{"hd":false,"nm":"Path 1","ty":"sh","ks":{"k":[{"t":20,"i":{"x":[0.5],"y":[1]},"o":{"x":[0.5],"y":[0]},"s":[{"c":true,"i":[[-9.785,-2.748],[0,0],[10.073,-3.525],[0,0],[2.014,8.701],[0,0],[-10.841,-0.565],[0,0],[4.226,0.677],[0,0],[4.908,4.225],[5.646,8.06]],"o":[[0,0],[10.58,2.999],[0,0],[-12.974,4.687],[0,0],[-0.722,-6.213],[0,0],[4.378,0.17],[0,0],[-8.58,-1.284],[-8.728,-7.514],[-4.055,-5.788]],"v":[[-86.852,-21.107],[121.04,37.828],[121.043,49.217],[-1.939,95.039],[-35.635,89.169],[-66.913,39.948],[-49.277,27.303],[43.295,34.291],[44.526,30.201],[-61.21,11.74],[-83.062,5.284],[-99.928,-14.021]]}]},{"t":44.732,"i":{"x":[0.5],"y":[1]},"o":{"x":[0.5],"y":[0]},"s":[{"c":true,"i":[[-9.785,-5.623],[0,0],[10.073,-7.212],[0,0],[2.014,17.803],[0,0],[-10.841,-1.157],[0,0],[4.225,1.386],[0,0],[4.908,8.645],[4.363,17.802]],"o":[[0,0],[10.58,6.137],[0,0],[-12.974,9.59],[0,0],[1.88,-12.095],[0,0],[4.378,0.348],[0,0],[-8.58,-2.628],[-8.728,-15.375],[-2.98,-12.157]],"v":[[-80.291,-79.452],[116.546,26.896],[117.812,56.207],[-25.252,167.906],[-57.833,157.377],[-63.507,81.884],[-38.439,58.15],[33.696,48.095],[32.959,37.461],[-54.013,17.63],[-75.012,0.191],[-96.665,-61.799]]}]},{"t":73,"s":[{"c":true,"i":[[-9.785,-2.748],[0,0],[10.073,-3.525],[0,0],[2.014,8.701],[0,0],[-10.841,-0.565],[0,0],[4.226,0.677],[0,0],[4.908,4.225],[5.646,8.06]],"o":[[0,0],[10.58,2.999],[0,0],[-12.974,4.687],[0,0],[-0.722,-6.213],[0,0],[4.378,0.17],[0,0],[-8.58,-1.284],[-8.728,-7.514],[-4.055,-5.788]],"v":[[-86.852,-21.107],[121.04,37.828],[121.043,49.217],[-1.939,95.039],[-35.635,89.169],[-66.913,39.948],[-49.277,27.303],[43.295,34.291],[44.526,30.201],[-61.21,11.74],[-83.062,5.284],[-99.928,-14.021]]}]}],"a":1},"ind":0},{"hd":false,"nm":"Fill 1","ty":"fl","bm":0,"o":{"k":100,"a":0},"c":{"k":[0.996,1,0.992,1],"a":0},"r":1},{"nm":"Transform","ty":"tr","a":{"k":[0,0],"a":0},"p":{"k":[0,0],"a":0},"s":{"k":[100,100],"a":0},"r":{"k":0,"a":0},"o":{"k":100,"a":0},"sk":{"k":0,"a":0},"sa":{"k":0,"a":0}}]}]}],"v":"5.5.2","fr":60,"ip":20,"op":74,"w":512,"h":512,"nm":"4","ddd":0,"assets":[]} \ No newline at end of file diff --git a/TMessagesProj/src/main/res/values/ids.xml b/TMessagesProj/src/main/res/values/ids.xml index d57b82fba..0db9acf1e 100644 --- a/TMessagesProj/src/main/res/values/ids.xml +++ b/TMessagesProj/src/main/res/values/ids.xml @@ -1,4 +1,5 @@ + diff --git a/TMessagesProj/src/main/res/values/strings.xml b/TMessagesProj/src/main/res/values/strings.xml index 7527845ef..f152d9eb6 100644 --- a/TMessagesProj/src/main/res/values/strings.xml +++ b/TMessagesProj/src/main/res/values/strings.xml @@ -233,6 +233,7 @@ Mark all as read Hide above the list Pin in the list + Spoiler Bold Italic Mono @@ -1019,6 +1020,12 @@ Do you want to unpin this message? Ban user Report spam + Translate + Automatic Translation + Translate more... + Close Translation + Translation failed. Try again later. + Translation failed. Delete all from %1$s Clear recent emoji? Smileys and people @@ -1903,6 +1910,18 @@ Events Contact joined Telegram Pinned Messages + Translate Messages + Show Translate Button + Do Not Translate + %1$d Languages + %1$d Language + %1$d Languages + %1$d Languages + %1$d Languages + %1$d Languages + Choose languages + The ‘Translate’ button will appear when you make a single tap on a text message. + Google may have access to the messages you translate. Language Custom Change language? @@ -4890,4 +4909,71 @@ You received this message because you requested to join **%1$s** on %2$s un1 sent this message: Get code on this phone + Migration + Move Files Now + Migrate Files to Scoped Storage + Due to a change made by **Google**, we need to move the files you downloaded using **Telegram** to a new folder.\n\nThis may take a few moments. You can continue using the app while the files are moved. + Migrating files + + %1$d reactions + %1$d reactions + %1$d reaction + %1$d reactions + %1$d reactions + %1$d reactions + %1$s Reacted + %1$s Reacted + %1$s Reacted + %1$s Reacted + %1$s Reacted + %1$s Reacted + + Reactions + Off + %1$s/%2$s + Enable Reactions + Allow subscribers to react to channel posts. + Allow participants to react to group messages. + Available reactions + I hope you\'re enjoying your day as much as I am. + Dino + Quick Reactions + Double tap this message for a quck reaction. + Snow in chat + un1 changed chat reactions \nfrom: %1$s \nto: %2$s + Nobody viewed + QR Code + + %1$s: %2$s to your "%3$s" + %1$s: %2$s to your message + %1$s: %2$s to your photo + %1$s: %2$s to your video + %1$s: %2$s to your video message + %1$s: %2$s to your file + %1$s: %2$s to your %3$s sticker + %1$s: %2$s to your voice message + %1$s: %2$s to your contact %3$s + %1$s: %2$s to your map + %1$s: %2$s to your live location + %1$s: %2$s to your poll %3$s + %1$s: %2$s to your quiz %3$s + %1$s: %2$s to your game + %1$s: %2$s to your invoice + %1$s: %2$s to your GIF + %1$s: %3$s in %2$s to your "%4$s" + %1$s: %3$s to your message in %2$s + %1$s: %3$s to your photo in %2$s + %1$s: %3$s to your video in %2$s + %1$s: %3$s to your video message in %2$s + %1$s: %3$s to your file in %2$s + %1$s: %3$s to your %4$s sticker in %2$s + %1$s: %3$s to your voice message in %2$s + %1$s: %3$s to your contact %4$s in %2$s + %1$s: %3$s to your map in %2$s + %1$s: %3$s to your live location in %2$s + %1$s: %3$s to your poll %4$s in %2$s + %1$s: %3$s to your quiz %4$s in %2$s + %1$s: %3$s to your game in %2$s + %1$s: %3$s to your invoice in %2$s + %1$s: %3$s to your GIF in %2$s