diff --git a/TMessagesProj/src/main/AndroidManifest.xml b/TMessagesProj/src/main/AndroidManifest.xml index 0d40f1db6..ffa573f55 100644 --- a/TMessagesProj/src/main/AndroidManifest.xml +++ b/TMessagesProj/src/main/AndroidManifest.xml @@ -67,9 +67,7 @@ - - - + diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java b/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java index 4d236416d..fa1c171c6 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java @@ -38,7 +38,6 @@ import android.graphics.Typeface; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; -import android.media.MediaScannerConnection; import android.net.Uri; import android.os.Build; import android.os.Environment; @@ -48,12 +47,6 @@ import android.provider.CallLog; import android.provider.DocumentsContract; import android.provider.MediaStore; import android.provider.Settings; - -import androidx.core.content.FileProvider; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; -import androidx.viewpager.widget.ViewPager; - import android.telephony.TelephonyManager; import android.text.Layout; import android.text.Selection; @@ -72,8 +65,8 @@ import android.util.StateSet; import android.util.TypedValue; import android.view.ContextThemeWrapper; import android.view.Display; -import android.view.MotionEvent; import android.view.Gravity; +import android.view.MotionEvent; import android.view.Surface; import android.view.View; import android.view.ViewGroup; @@ -95,8 +88,12 @@ import android.widget.ListView; import android.widget.ScrollView; import android.widget.TextView; +import androidx.core.content.FileProvider; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import androidx.viewpager.widget.ViewPager; + import com.android.internal.telephony.ITelephony; -import com.google.android.exoplayer2.util.Log; import com.google.android.gms.auth.api.phone.SmsRetriever; import com.google.android.gms.auth.api.phone.SmsRetrieverClient; import com.google.android.gms.tasks.Task; @@ -2254,6 +2251,10 @@ public class AndroidUtilities { } + public static void appCenterLog(Throwable e) { + + } + public static void addToClipboard(CharSequence str) { try { android.content.ClipboardManager clipboard = (android.content.ClipboardManager) ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java index 524e5ef94..ae6a40c46 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java @@ -15,16 +15,22 @@ import android.os.Build; public class BuildVars { public static boolean DEBUG_VERSION = false; - public static boolean DEBUG_PRIVATE_VERSION = false; public static boolean LOGS_ENABLED = false; public static boolean USE_CLOUD_STRINGS = true; public static boolean CHECK_UPDATES = true; public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29; - public static int BUILD_VERSION = 2470; - public static String BUILD_VERSION_STRING = "8.2.7"; + public static int BUILD_VERSION = 2493; + public static String BUILD_VERSION_STRING = "8.3.0"; public static int APP_ID = 4; public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103"; - + public static String APPCENTER_HASH = "a5b5c4f5-51da-dedc-9918-d9766a22ca7c"; + // PUBLIC + public static boolean DEBUG_PRIVATE_VERSION = false; + // public static String APPCENTER_HASH_DEBUG = "f9726602-67c9-48d2-b5d0-4761f1c1a8f3"; + // PRIVATE + //public static boolean DEBUG_PRIVATE_VERSION = true; + //public static String APPCENTER_HASH_DEBUG = DEBUG_PRIVATE_VERSION ? "29d0a6f1-b92f-493a-9fce-445681d767ec" : "f9726602-67c9-48d2-b5d0-4761f1c1a8f3"; + // public static String SMS_HASH = isStandaloneApp() ? "w0lkcmTZkKh" : (DEBUG_VERSION ? "O2P2z+/jBpJ" : "oLeq9AcOZkT"); public static String PLAYSTORE_APP_URL = "https://play.google.com/store/apps/details?id=org.telegram.messenger"; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ChatObject.java b/TMessagesProj/src/main/java/org/telegram/messenger/ChatObject.java index 8455dc42b..60b0a33e1 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ChatObject.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ChatObject.java @@ -1478,6 +1478,10 @@ public class ChatObject { return chat == null || chat instanceof TLRPC.TL_chatEmpty || chat instanceof TLRPC.TL_chatForbidden || chat instanceof TLRPC.TL_channelForbidden || chat.left || chat.kicked || chat.deactivated; } + public static boolean canSendAsPeers(TLRPC.Chat chat) { + return ChatObject.isChannel(chat) && chat.megagroup && (!TextUtils.isEmpty(chat.username) || chat.has_geo || chat.has_link); + } + public static boolean isChannel(TLRPC.Chat chat) { return chat instanceof TLRPC.TL_channel || chat instanceof TLRPC.TL_channelForbidden; } @@ -1551,6 +1555,21 @@ public class ChatObject { return chat != null && chat.admin_rights != null && chat.admin_rights.anonymous; } + public static long getSendAsPeerId(TLRPC.Chat chat, TLRPC.ChatFull chatFull) { + return getSendAsPeerId(chat, chatFull, false); + } + + public static long getSendAsPeerId(TLRPC.Chat chat, TLRPC.ChatFull chatFull, boolean invertChannel) { + if (chat != null && chatFull != null && chatFull.default_send_as != null) { + TLRPC.Peer p = chatFull.default_send_as; + return p.user_id != 0 ? p.user_id : invertChannel ? -p.channel_id : p.channel_id; + } + if (chat != null && chat.admin_rights != null && chat.admin_rights.anonymous) { + return invertChannel ? -chat.id : chat.id; + } + return UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId(); + } + public static boolean canAddBotsToChat(TLRPC.Chat chat) { if (isChannel(chat)) { if (chat.megagroup && (chat.admin_rights != null && (chat.admin_rights.post_messages || chat.admin_rights.add_admins) || chat.creator)) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ChatThemeController.java b/TMessagesProj/src/main/java/org/telegram/messenger/ChatThemeController.java index 42a2f774b..9a5d37123 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ChatThemeController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ChatThemeController.java @@ -25,7 +25,6 @@ public class ChatThemeController extends BaseController { private static final long reloadTimeoutMs = 2 * 60 * 60 * 1000; public static volatile DispatchQueue chatThemeQueue = new DispatchQueue("chatThemeQueue"); - //private static final HashMap themeIdWallpaperMap = new HashMap<>(); private static final HashMap themeIdWallpaperThumbMap = new HashMap<>(); private static List allChatThemes; private static volatile long themesHash; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/FileLog.java b/TMessagesProj/src/main/java/org/telegram/messenger/FileLog.java index d91a002fe..239cdd71f 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/FileLog.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/FileLog.java @@ -11,6 +11,7 @@ package org.telegram.messenger; import android.util.Log; import org.telegram.messenger.time.FastDateFormat; +import org.telegram.messenger.video.MediaCodecVideoConvertor; import java.io.File; import java.io.FileOutputStream; @@ -158,9 +159,16 @@ public class FileLog { } public static void e(final Throwable e) { + e(e, true); + } + + public static void e(final Throwable e, boolean logToAppCenter) { if (!BuildVars.LOGS_ENABLED) { return; } + if (BuildVars.DEBUG_VERSION && needSent(e)) { + AndroidUtilities.appCenterLog(e); + } ensureInitied(); e.printStackTrace(); if (getInstance().streamWriter != null) { @@ -181,6 +189,13 @@ public class FileLog { } } + private static boolean needSent(Throwable e) { + if (e instanceof InterruptedException || e instanceof MediaCodecVideoConvertor.ConversionCanceledException) { + return false; + } + return true; + } + public static void d(final String message) { if (!BuildVars.LOGS_ENABLED) { return; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java b/TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java index fdbaca2a2..5d041f190 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java @@ -407,7 +407,7 @@ public class ImageLoader { } else if (e instanceof FileNotFoundException) { canRetry = false; } - FileLog.e(e); + FileLog.e(e, false); } finally { try { if (httpConnection != null) { @@ -521,20 +521,25 @@ public class ImageLoader { fileOutputStream = new RandomAccessFile(cacheImage.tempFilePath, "rws"); } } catch (Throwable e) { + boolean sentLogs = true; if (e instanceof SocketTimeoutException) { if (ApplicationLoader.isNetworkOnline()) { canRetry = false; } + sentLogs = false; } else if (e instanceof UnknownHostException) { canRetry = false; + sentLogs = false; } else if (e instanceof SocketException) { if (e.getMessage() != null && e.getMessage().contains("ECONNRESET")) { canRetry = false; } + sentLogs = false; } else if (e instanceof FileNotFoundException) { canRetry = false; + sentLogs = false; } - FileLog.e(e); + FileLog.e(e, sentLogs); } } @@ -840,6 +845,7 @@ public class ImageLoader { int autoRepeat = 1; int[] colors = null; String diceEmoji = null; + int fitzModifier = 0; if (cacheImage.filter != null) { String[] args = cacheImage.filter.split("_"); if (args.length >= 2) { @@ -871,15 +877,15 @@ public class ImageLoader { } if (args.length >= 5) { if ("c1".equals(args[4])) { - colors = new int[]{0xf77e41, 0xcb7b55, 0xffb139, 0xf6b689, 0xffd140, 0xffcda7, 0xffdf79, 0xffdfc5}; + fitzModifier = 12; } else if ("c2".equals(args[4])) { - colors = new int[]{0xf77e41, 0xa45a38, 0xffb139, 0xdf986b, 0xffd140, 0xedb183, 0xffdf79, 0xf4c3a0}; + fitzModifier = 3; } else if ("c3".equals(args[4])) { - colors = new int[]{0xf77e41, 0x703a17, 0xffb139, 0xab673d, 0xffd140, 0xc37f4e, 0xffdf79, 0xd89667}; + fitzModifier = 4; } else if ("c4".equals(args[4])) { - colors = new int[]{0xf77e41, 0x4a2409, 0xffb139, 0x7d3e0e, 0xffd140, 0x965529, 0xffdf79, 0xa96337}; + fitzModifier = 5; } else if ("c5".equals(args[4])) { - colors = new int[]{0xf77e41, 0x200f0a, 0xffb139, 0x412924, 0xffd140, 0x593d37, 0xffdf79, 0x63453f}; + fitzModifier = 6; } } } @@ -918,9 +924,9 @@ public class ImageLoader { } } if (compressed) { - lottieDrawable = new RLottieDrawable(cacheImage.finalFilePath, decompressGzip(cacheImage.finalFilePath), w, h, precache, limitFps, colors); + lottieDrawable = new RLottieDrawable(cacheImage.finalFilePath, decompressGzip(cacheImage.finalFilePath), w, h, precache, limitFps, null, fitzModifier); } else { - lottieDrawable = new RLottieDrawable(cacheImage.finalFilePath, w, h, precache, limitFps, colors); + lottieDrawable = new RLottieDrawable(cacheImage.finalFilePath, w, h, precache, limitFps, null, fitzModifier); } } lottieDrawable.setAutoRepeat(autoRepeat); @@ -1153,7 +1159,11 @@ public class ImageLoader { } } } catch (Throwable e) { - FileLog.e(e); + boolean sentLog = true; + if (e instanceof FileNotFoundException) { + sentLog = false; + } + FileLog.e(e, sentLog); } if (cacheImage.type == ImageReceiver.TYPE_THUMB) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/LocationController.java b/TMessagesProj/src/main/java/org/telegram/messenger/LocationController.java index e46091c38..05768b8d6 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/LocationController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/LocationController.java @@ -915,7 +915,7 @@ public class LocationController extends BaseController implements NotificationCe LocationServices.FusedLocationApi.removeLocationUpdates(googleApiClient, fusedLocationListener); googleApiClient.disconnect(); } catch (Throwable e) { - FileLog.e(e); + FileLog.e(e, false); } } locationManager.removeUpdates(gpsLocationListener); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java index 4a9cdd5da..0507a0f75 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java @@ -61,6 +61,7 @@ import android.widget.FrameLayout; import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.ExoPlayer; import com.google.android.exoplayer2.ui.AspectRatioFrameLayout; +import com.google.android.exoplayer2.util.Log; import org.telegram.messenger.audioinfo.AudioInfo; import org.telegram.messenger.video.MediaCodecVideoConvertor; @@ -3923,6 +3924,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener, new Thread(() -> { try { + boolean result = true; if (Build.VERSION.SDK_INT >= 29) { try { @@ -3944,10 +3946,8 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener, } if (selectedType == 0) { uriToInsert = MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - File dirDest = new File(Environment.DIRECTORY_PICTURES, "Telegram"); - contentValues.put(MediaStore.MediaColumns.RELATIVE_PATH, dirDest + File.separator); - } + File dirDest = new File(Environment.DIRECTORY_PICTURES, "Telegram"); + 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) { @@ -4823,6 +4823,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener, MediaCodecVideoConvertor videoConvertor = new MediaCodecVideoConvertor(); boolean error = videoConvertor.convertVideo(videoPath, cacheFile, rotationValue, isSecret, + originalWidth, originalHeight, resultWidth, resultHeight, framerate, bitrate, originalBitrate, startTime, endTime, avatarStartTime, diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java index 043f319f0..cf06cdaa0 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java @@ -140,6 +140,8 @@ public class MediaDataController extends BaseController { //igonre } } + + loadStickersByEmojiOrName(AndroidUtilities.STICKERS_PLACEHOLDER_PACK_NAME, false, true); } public static final int TYPE_IMAGE = 0; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java index 4c8361665..90839e32b 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java @@ -1784,6 +1784,22 @@ public class MessageObject { } else if (event.action instanceof TLRPC.TL_channelAdminLogEventActionParticipantJoinByInvite) { TLRPC.TL_channelAdminLogEventActionParticipantJoinByInvite action = (TLRPC.TL_channelAdminLogEventActionParticipantJoinByInvite) event.action; messageText = replaceWithLink(LocaleController.getString("ActionInviteUser", R.string.ActionInviteUser), "un1", fromUser); + } else if (event.action instanceof TLRPC.TL_channelAdminLogEventActionToggleNoForwards) { + TLRPC.TL_channelAdminLogEventActionToggleNoForwards action = (TLRPC.TL_channelAdminLogEventActionToggleNoForwards) event.action; + boolean isChannel = ChatObject.isChannel(chat) && !chat.megagroup; + if (action.new_value) { + if (isChannel) { + messageText = replaceWithLink(LocaleController.getString("ActionForwardsRestrictedChannel", R.string.ActionForwardsRestrictedChannel), "un1", fromUser); + } else { + messageText = replaceWithLink(LocaleController.getString("ActionForwardsRestrictedGroup", R.string.ActionForwardsRestrictedGroup), "un1", fromUser); + } + } else { + if (isChannel) { + messageText = replaceWithLink(LocaleController.getString("ActionForwardsEnabledChannel", R.string.ActionForwardsEnabledChannel), "un1", fromUser); + } else { + messageText = replaceWithLink(LocaleController.getString("ActionForwardsEnabledGroup", R.string.ActionForwardsEnabledGroup), "un1", fromUser); + } + } } else if (event.action instanceof TLRPC.TL_channelAdminLogEventActionExportedInviteDelete) { TLRPC.TL_channelAdminLogEventActionExportedInviteDelete action = (TLRPC.TL_channelAdminLogEventActionExportedInviteDelete) event.action; messageText = replaceWithLink(LocaleController.formatString("ActionDeletedInviteLinkClickable", R.string.ActionDeletedInviteLinkClickable), "un1", fromUser); @@ -1841,6 +1857,9 @@ public class MessageObject { messageText = replaceWithLink(LocaleController.getString("JoinedViaInviteLinkApproved", R.string.JoinedViaInviteLinkApproved), "un1", fromUser); messageText = replaceWithLink(messageText, "un2", action.invite); messageText = replaceWithLink(messageText, "un3", MessagesController.getInstance(currentAccount).getUser(action.approved_by)); + } 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 { messageText = "unsupported " + event.action; } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java index a1b7595da..3572033d7 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java @@ -21,7 +21,6 @@ import android.os.SystemClock; import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.Base64; -import android.util.Log; import android.util.SparseArray; import android.util.SparseBooleanArray; import android.util.SparseIntArray; @@ -29,6 +28,8 @@ import android.util.SparseIntArray; import androidx.collection.LongSparseArray; import androidx.core.app.NotificationManagerCompat; +import com.google.android.exoplayer2.util.Log; + import org.telegram.SQLite.SQLiteCursor; import org.telegram.messenger.support.LongSparseIntArray; import org.telegram.messenger.support.LongSparseLongArray; @@ -41,6 +42,7 @@ 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; @@ -54,6 +56,7 @@ 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; @@ -174,6 +177,7 @@ public class MessagesController extends BaseController implements NotificationCe private SparseIntArray migratedChats = new SparseIntArray(); private LongSparseArray sponsoredMessages = new LongSparseArray<>(); + private LongSparseArray sendAsPeers = new LongSparseArray<>(); private HashMap> reloadingWebpages = new HashMap<>(); private LongSparseArray> reloadingWebpagesPending = new LongSparseArray<>(); @@ -332,6 +336,12 @@ public class MessagesController extends BaseController implements NotificationCe private boolean loading; } + private class SendAsPeersInfo { + private TLRPC.TL_channels_sendAsPeers sendAsPeers; + private long loadTime; + private boolean loading; + } + public static class FaqSearchResult { public String title; @@ -469,16 +479,16 @@ public class MessagesController extends BaseController implements NotificationCe public TLRPC.SendMessageAction action; } - public static int DIALOG_FILTER_FLAG_CONTACTS = 0x00000001; - public static int DIALOG_FILTER_FLAG_NON_CONTACTS = 0x00000002; - public static int DIALOG_FILTER_FLAG_GROUPS = 0x00000004; - public static int DIALOG_FILTER_FLAG_CHANNELS = 0x00000008; - public static int DIALOG_FILTER_FLAG_BOTS = 0x00000010; - public static int DIALOG_FILTER_FLAG_EXCLUDE_MUTED = 0x00000020; - public static int DIALOG_FILTER_FLAG_EXCLUDE_READ = 0x00000040; - public static int DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED = 0x00000080; - public static int DIALOG_FILTER_FLAG_ONLY_ARCHIVED = 0x00000100; - public static int DIALOG_FILTER_FLAG_ALL_CHATS = DIALOG_FILTER_FLAG_CONTACTS | DIALOG_FILTER_FLAG_NON_CONTACTS | DIALOG_FILTER_FLAG_GROUPS | DIALOG_FILTER_FLAG_CHANNELS | DIALOG_FILTER_FLAG_BOTS; + public static int DIALOG_FILTER_FLAG_CONTACTS = 0x00000001; + public static int DIALOG_FILTER_FLAG_NON_CONTACTS = 0x00000002; + public static int DIALOG_FILTER_FLAG_GROUPS = 0x00000004; + public static int DIALOG_FILTER_FLAG_CHANNELS = 0x00000008; + public static int DIALOG_FILTER_FLAG_BOTS = 0x00000010; + public static int DIALOG_FILTER_FLAG_EXCLUDE_MUTED = 0x00000020; + public static int DIALOG_FILTER_FLAG_EXCLUDE_READ = 0x00000040; + public static int DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED = 0x00000080; + public static int DIALOG_FILTER_FLAG_ONLY_ARCHIVED = 0x00000100; + public static int DIALOG_FILTER_FLAG_ALL_CHATS = DIALOG_FILTER_FLAG_CONTACTS | DIALOG_FILTER_FLAG_NON_CONTACTS | DIALOG_FILTER_FLAG_GROUPS | DIALOG_FILTER_FLAG_CHANNELS | DIALOG_FILTER_FLAG_BOTS; public static class DialogFilter { public int id; @@ -658,6 +668,7 @@ public class MessagesController extends BaseController implements NotificationCe }; private static volatile MessagesController[] Instance = new MessagesController[UserConfig.MAX_ACCOUNT_COUNT]; + public static MessagesController getInstance(int num) { MessagesController localInstance = Instance[num]; if (localInstance == null) { @@ -1284,11 +1295,11 @@ public class MessagesController extends BaseController implements NotificationCe } TLRPC.TL_messages_getDialogFilters req = new TLRPC.TL_messages_getDialogFilters(); getConnectionsManager().sendRequest(req, (response, error) -> { - if (response instanceof TLRPC.Vector) { - getMessagesStorage().checkLoadedRemoteFilters((TLRPC.Vector) response); - } else { - AndroidUtilities.runOnUIThread(() -> loadingRemoteFilters = false); - } + if (response instanceof TLRPC.Vector) { + getMessagesStorage().checkLoadedRemoteFilters((TLRPC.Vector) response); + } else { + AndroidUtilities.runOnUIThread(() -> loadingRemoteFilters = false); + } }); } @@ -1473,7 +1484,7 @@ public class MessagesController extends BaseController implements NotificationCe } break; } - case "autologin_domains" : { + case "autologin_domains": { HashSet newDomains = new HashSet<>(); if (value.value instanceof TLRPC.TL_jsonArray) { TLRPC.TL_jsonArray array = (TLRPC.TL_jsonArray) value.value; @@ -1492,7 +1503,7 @@ public class MessagesController extends BaseController implements NotificationCe } break; } - case "autologin_token" : { + case "autologin_token": { if (value.value instanceof TLRPC.TL_jsonString) { TLRPC.TL_jsonString string = (TLRPC.TL_jsonString) value.value; if (!string.value.equals(autologinToken)) { @@ -2553,6 +2564,7 @@ public class MessagesController extends BaseController implements NotificationCe reloadingScheduledWebpages.clear(); reloadingScheduledWebpagesPending.clear(); sponsoredMessages.clear(); + sendAsPeers.clear(); dialogs_dict.clear(); dialogs_read_inbox_max.clear(); loadingPinnedDialogs.clear(); @@ -2702,6 +2714,20 @@ public class MessagesController extends BaseController implements NotificationCe getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload); } + public boolean isChatNoForwards(TLRPC.Chat chat) { + if (chat == null) return false; + if (chat.migrated_to != null) { + TLRPC.Chat migratedTo = getChat(chat.migrated_to.channel_id); + if (migratedTo != null) + return migratedTo.noforwards; + } + return chat.noforwards; + } + + public boolean isChatNoForwards(long chatId) { + return isChatNoForwards(getChat(chatId)); + } + public TLRPC.User getUser(Long id) { if (id == 0) { return UserConfig.getInstance(currentAccount).getCurrentUser(); @@ -2940,7 +2966,7 @@ public class MessagesController extends BaseController implements NotificationCe oldChat.username = chat.username; oldChat.flags |= 64; } else { - oldChat.flags = oldChat.flags &~ 64; + oldChat.flags = oldChat.flags & ~64; oldChat.username = null; } if (chat.participants_count != 0) { @@ -2969,19 +2995,19 @@ public class MessagesController extends BaseController implements NotificationCe int newFlags2 = chat.default_banned_rights != null ? chat.default_banned_rights.flags : 0; oldChat.default_banned_rights = chat.default_banned_rights; if (oldChat.default_banned_rights == null) { - oldChat.flags &=~ 262144; + oldChat.flags &= ~262144; } else { oldChat.flags |= 262144; } oldChat.banned_rights = chat.banned_rights; if (oldChat.banned_rights == null) { - oldChat.flags &=~ 32768; + oldChat.flags &= ~32768; } else { oldChat.flags |= 32768; } oldChat.admin_rights = chat.admin_rights; if (oldChat.admin_rights == null) { - oldChat.flags &=~ 16384; + oldChat.flags &= ~16384; } else { oldChat.flags |= 16384; } @@ -3015,7 +3041,7 @@ public class MessagesController extends BaseController implements NotificationCe chat.username = oldChat.username; chat.flags |= 64; } else { - chat.flags = chat.flags &~ 64; + chat.flags = chat.flags & ~64; chat.username = null; } if (oldChat.participants_count != 0 && chat.participants_count == 0) { @@ -3445,7 +3471,11 @@ public class MessagesController extends BaseController implements NotificationCe } int reqId = getConnectionsManager().sendRequest(req, (response, error) -> { if (error == null) { - TLRPC.UserFull userFull = (TLRPC.UserFull) response; + TLRPC.TL_users_userFull res = (TLRPC.TL_users_userFull) response; + TLRPC.UserFull userFull = res.full_user; + putUsers(res.users, false); + putChats(res.chats, false); + res.full_user.user = getUser(res.full_user.id); getMessagesStorage().updateUserInfo(userFull, false); AndroidUtilities.runOnUIThread(() -> { @@ -3681,7 +3711,7 @@ public class MessagesController extends BaseController implements NotificationCe SharedPreferences.Editor editor = notificationsPreferences.edit(); boolean bar_hidden = !settings.report_spam && !settings.add_contact && !settings.block_contact && !settings.share_contact && !settings.report_geo && !settings.invite_members; if (BuildVars.LOGS_ENABLED) { - FileLog.d("peer settings loaded for " + dialogId + " add = " + settings.add_contact + " block = " + settings.block_contact + " spam = " + settings.report_spam + " share = " + settings.share_contact + " geo = " + settings.report_geo + " hide = " + bar_hidden + " distance = " + settings.geo_distance + " invite = " + settings.invite_members); + FileLog.d("peer settings loaded for " + dialogId + " add = " + settings.add_contact + " block = " + settings.block_contact + " spam = " + settings.report_spam + " share = " + settings.share_contact + " geo = " + settings.report_geo + " hide = " + bar_hidden + " distance = " + settings.geo_distance + " invite = " + settings.invite_members); } editor.putInt("dialog_bar_vis3" + dialogId, bar_hidden ? 1 : 2); editor.putBoolean("dialog_bar_share" + dialogId, settings.share_contact); @@ -3692,6 +3722,9 @@ public class MessagesController extends BaseController implements NotificationCe editor.putBoolean("dialog_bar_location" + dialogId, settings.report_geo); editor.putBoolean("dialog_bar_archived" + dialogId, settings.autoarchived); editor.putBoolean("dialog_bar_invite" + dialogId, settings.invite_members); + editor.putString("dialog_bar_chat_with_admin_title" + dialogId, settings.request_chat_title); + editor.putBoolean("dialog_bar_chat_with_channel" + dialogId, settings.request_chat_broadcast); + editor.putInt("dialog_bar_chat_with_date" + dialogId, settings.request_chat_date); if (notificationsPreferences.getInt("dialog_bar_distance" + dialogId, -1) != -2) { if ((settings.flags & 64) != 0) { editor.putInt("dialog_bar_distance" + dialogId, settings.geo_distance); @@ -3736,7 +3769,12 @@ public class MessagesController extends BaseController implements NotificationCe getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { loadingPeerSettings.remove(dialogId); if (response != null) { - savePeerSettings(dialogId, (TLRPC.TL_peerSettings) response, false); + TLRPC.TL_messages_peerSettings res = (TLRPC.TL_messages_peerSettings) response; + TLRPC.TL_peerSettings settings = res.settings; + putUsers(res.users, false); + putChats(res.chats, false); + + savePeerSettings(dialogId, settings, false); } })); } @@ -4688,9 +4726,9 @@ public class MessagesController extends BaseController implements NotificationCe if (offset == 0) { getMessagesStorage().deleteUserChatHistory(-chat.id, user.id); } - TLRPC.TL_channels_deleteUserHistory req = new TLRPC.TL_channels_deleteUserHistory(); + TLRPC.TL_channels_deleteParticipantHistory req = new TLRPC.TL_channels_deleteParticipantHistory(); req.channel = getInputChannel(chat); - req.user_id = getInputUser(user); + req.participant = getInputPeer(user); getConnectionsManager().sendRequest(req, (response, error) -> { if (error == null) { TLRPC.TL_messages_affectedHistory res = (TLRPC.TL_messages_affectedHistory) response; @@ -4891,6 +4929,24 @@ public class MessagesController extends BaseController implements NotificationCe getMessagesStorage().deleteDialog(did, onlyHistory); return; } + for (int i = 0; i < sendAsPeers.size(); i++) { + SendAsPeersInfo sendAsInfo = sendAsPeers.valueAt(i); + if (sendAsInfo.sendAsPeers != null) { + for (int j = 0; j < sendAsInfo.sendAsPeers.chats.size(); j++) { + if (sendAsInfo.sendAsPeers.chats.get(j).id == -did) { + sendAsInfo.sendAsPeers.chats.remove(j); + break; + } + } + for (int j = 0; j < sendAsInfo.sendAsPeers.peers.size(); j++) { + if (sendAsInfo.sendAsPeers.peers.get(j).channel_id == -did || sendAsInfo.sendAsPeers.peers.get(j).chat_id == -did) { + sendAsInfo.sendAsPeers.peers.remove(j); + break; + } + } + } + } + sendAsPeers.remove(did); if (first == 1 && max_id == 0) { TLRPC.InputPeer peerFinal = peer; getMessagesStorage().getDialogMaxMessageId(did, (param) -> { @@ -5956,7 +6012,7 @@ public class MessagesController extends BaseController implements NotificationCe String emoji = ((TLRPC.TL_sendMessageEmojiInteractionSeen) pu.action).emoticon; String printingString; if (key < 0 && !isEncryptedChat) { - printingString= LocaleController.formatString("IsEnjoyngAnimations", R.string.IsEnjoyngAnimations, getUserNameForTyping(user), emoji); + printingString = LocaleController.formatString("IsEnjoyngAnimations", R.string.IsEnjoyngAnimations, getUserNameForTyping(user), emoji); } else { printingString = LocaleController.formatString("EnjoyngAnimations", R.string.EnjoyngAnimations, emoji); } @@ -6040,12 +6096,13 @@ public class MessagesController extends BaseController implements NotificationCe public boolean sendTyping(long dialogId, int threadMsgId, int action, int classGuid) { return sendTyping(dialogId, threadMsgId, action, null, classGuid); } + public boolean sendTyping(long dialogId, int threadMsgId, int action, String emojicon, int classGuid) { if (action < 0 || action >= sendingTypings.length || dialogId == 0) { return false; } if (dialogId < 0) { - if (ChatObject.shouldSendAnonymously(getChat(-dialogId))) { + if (ChatObject.getSendAsPeerId(getChat(-dialogId), getChatFull(-dialogId)) != UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId()) { return false; } } else { @@ -6390,7 +6447,7 @@ public class MessagesController extends BaseController implements NotificationCe } public void processLoadedMessages(TLRPC.messages_Messages messagesRes, int resCount, long dialogId, long mergeDialogId, int count, int max_id, int offset_date, boolean isCache, int classGuid, - int first_unread, int last_message_id, int unread_count, int last_date, int load_type, boolean isEnd, int mode, int threadMessageId, int loadIndex, boolean queryFromServer, int mentionsCount, boolean needProcess) { + int first_unread, int last_message_id, int unread_count, int last_date, int load_type, boolean isEnd, int mode, int threadMessageId, int loadIndex, boolean queryFromServer, int mentionsCount, boolean needProcess) { if (BuildVars.LOGS_ENABLED) { FileLog.d("processLoadedMessages size " + messagesRes.messages.size() + " in chat " + dialogId + " count " + count + " max_id " + max_id + " cache " + isCache + " guid " + classGuid + " load_type " + load_type + " last_message_id " + last_message_id + " index " + loadIndex + " firstUnread " + first_unread + " unread_count " + unread_count + " last_date " + last_date + " queryFromServer " + queryFromServer); } @@ -7879,7 +7936,7 @@ public class MessagesController extends BaseController implements NotificationCe allDialogs.add(dialog); } sortDialogs(migrate ? chatsDict : null); - + putAllNeededDraftDialogs(); if (loadType != DIALOGS_LOAD_TYPE_CHANNEL && loadType != DIALOGS_LOAD_TYPE_UNKNOWN) { @@ -9090,6 +9147,39 @@ public class MessagesController extends BaseController implements NotificationCe }); } + public void setDefaultSendAs(long chatId, long newPeer) { + TLRPC.ChatFull cachedFull = getChatFull(-chatId); + if (cachedFull != null) { + cachedFull.default_send_as = getPeer(newPeer); + getMessagesStorage().updateChatInfo(cachedFull, false); + getNotificationCenter().postNotificationName(NotificationCenter.updateDefaultSendAsPeer, chatId, cachedFull.default_send_as); + } + + TLRPC.TL_messages_saveDefaultSendAs req = new TLRPC.TL_messages_saveDefaultSendAs(); + req.peer = getInputPeer(chatId); + req.send_as = getInputPeer(newPeer); + getConnectionsManager().sendRequest(req, (response, error) -> { + if (response instanceof TLRPC.TL_boolTrue) { + TLRPC.ChatFull full = getChatFull(-chatId); + if (full == null) loadFullChat(-chatId, 0, true); + } else if (error != null && error.code == 400) { + loadFullChat(-chatId, 0, true); + } + }, ConnectionsManager.RequestFlagInvokeAfter); + } + + public void toggleChatNoForwards(long chatId, boolean enabled) { + TLRPC.TL_messages_toggleNoForwards req = new TLRPC.TL_messages_toggleNoForwards(); + req.peer = getInputPeer(-chatId); + req.enabled = enabled; + getConnectionsManager().sendRequest(req, (response, error) -> { + if (response != null) { + processUpdates((TLRPC.Updates) response, false); + AndroidUtilities.runOnUIThread(() -> getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, UPDATE_MASK_CHAT)); + } + }, ConnectionsManager.RequestFlagInvokeAfter); + } + public void toogleChannelSignatures(long chatId, boolean enabled) { TLRPC.TL_channels_toggleSignatures req = new TLRPC.TL_channels_toggleSignatures(); req.channel = getInputChannel(chatId); @@ -9468,7 +9558,21 @@ public class MessagesController extends BaseController implements NotificationCe if (type == 1) { unregistedPush(); TLRPC.TL_auth_logOut req = new TLRPC.TL_auth_logOut(); - getConnectionsManager().sendRequest(req, (response, error) -> getConnectionsManager().cleanup(false)); + getConnectionsManager().sendRequest(req, (response, error) -> { + getConnectionsManager().cleanup(false); + AndroidUtilities.runOnUIThread(() -> { + if (response instanceof TLRPC.TL_auth_loggedOut) { + TLRPC.TL_auth_loggedOut res = (TLRPC.TL_auth_loggedOut) response; + if (((TLRPC.TL_auth_loggedOut) response).future_auth_token != null) { + SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("saved_tokens", Context.MODE_PRIVATE); + int count = preferences.getInt("count", 0); + SerializedData data = new SerializedData(response.getObjectSize()); + res.serializeToStream(data); + preferences.edit().putString("log_out_token_" + count, Utilities.bytesToHex(data.toByteArray())).putInt("count", count + 1).apply(); + } + } + }); + }); } else { getConnectionsManager().cleanup(type == 2); } @@ -9506,7 +9610,51 @@ public class MessagesController extends BaseController implements NotificationCe getContactsController().deleteUnknownAppAccounts(); } + public static ArrayList getSavedLogOutTokens() { + SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("saved_tokens", Context.MODE_PRIVATE); + int count = preferences.getInt("count", 0); + if (count == 0) { + return null; + } + + ArrayList tokens = new ArrayList<>(); + for (int i = 0; i < count; i++) { + String value = preferences.getString("log_out_token_" + i, ""); + SerializedData serializedData = new SerializedData(Utilities.hexToBytes(value)); + // try { + TLRPC.TL_auth_loggedOut token = TLRPC.TL_auth_loggedOut.TLdeserialize(serializedData, serializedData.readInt32(true), true); + if (token != null) { + tokens.add(token); + } +// } catch (Throwable e) { +// FileLog.e(e); +// } + } + return tokens; + } + + public static void saveLogOutTokens(ArrayList tokens) { + SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("saved_tokens", Context.MODE_PRIVATE); + ArrayList activeTokens = new ArrayList<>(); + preferences.edit().clear().apply(); + int date = (int) (System.currentTimeMillis() / 1000L); + for (int i = 0; i < Math.min(20, tokens.size()); i++) { + activeTokens.add(tokens.get(i)); + } + if (activeTokens.size() > 0) { + SharedPreferences.Editor editor = preferences.edit(); + editor.putInt("count", activeTokens.size()); + for (int i = 0; i < activeTokens.size(); i++) { + SerializedData data = new SerializedData(activeTokens.get(i).getObjectSize()); + activeTokens.get(i).serializeToStream(data); + editor.putString("log_out_token_" + i, Utilities.bytesToHex(data.toByteArray())); + } + editor.apply(); + } + } + private boolean gettingAppChangelog; + public void generateUpdateMessage() { if (gettingAppChangelog || BuildVars.DEBUG_VERSION || SharedConfig.lastUpdateVersion == null || SharedConfig.lastUpdateVersion.equals(BuildVars.BUILD_VERSION_STRING)) { return; @@ -13139,7 +13287,7 @@ public class MessagesController extends BaseController implements NotificationCe chat.default_banned_rights = update.default_banned_rights; AndroidUtilities.runOnUIThread(() -> getNotificationCenter().postNotificationName(NotificationCenter.channelRightsUpdated, chat)); } - } else if (baseUpdate instanceof TLRPC.TL_updateBotCommands) { + } else if (baseUpdate instanceof TLRPC.TL_updateBotCommands) { TLRPC.TL_updateBotCommands update = (TLRPC.TL_updateBotCommands) baseUpdate; getMediaDataController().updateBotInfo(MessageObject.getPeerId(update.peer), update); } else if (baseUpdate instanceof TLRPC.TL_updateStickerSets) { @@ -13371,7 +13519,7 @@ public class MessagesController extends BaseController implements NotificationCe if (userFull != null) { userFull.ttl_period = updatePeerHistoryTTL.ttl_period; if (userFull.ttl_period == 0) { - userFull.flags &=~ 16384; + userFull.flags &= ~16384; } else { userFull.flags |= 16384; } @@ -13852,6 +14000,61 @@ public class MessagesController extends BaseController implements NotificationCe return null; } + public TLRPC.TL_channels_sendAsPeers getSendAsPeers(long dialogId) { + SendAsPeersInfo info = sendAsPeers.get(dialogId); + if (info != null && (info.loading || Math.abs(SystemClock.elapsedRealtime() - info.loadTime) <= 5 * 60 * 1000)) { + return info.sendAsPeers; + } + TLRPC.Chat chat = getChat(-dialogId); + if (chat == null || !ChatObject.canSendAsPeers(chat)) { + return null; + } + info = new SendAsPeersInfo(); + info.loading = true; + sendAsPeers.put(dialogId, info); + SendAsPeersInfo infoFinal = info; + TLRPC.TL_channels_getSendAs req = new TLRPC.TL_channels_getSendAs(); + req.peer = getInputPeer(dialogId); + getConnectionsManager().sendRequest(req, (response, error) -> { + TLRPC.TL_channels_sendAsPeers result; + if (response != null) { + TLRPC.TL_channels_sendAsPeers res = (TLRPC.TL_channels_sendAsPeers) response; + if (res.peers.isEmpty()) { + result = null; + } else { + result = res; + AndroidUtilities.runOnUIThread(() -> { + putUsers(res.users, false); + putChats(res.chats, false); + }); + final LongSparseArray usersDict = new LongSparseArray<>(); + final LongSparseArray chatsDict = new LongSparseArray<>(); + + for (int a = 0; a < res.users.size(); a++) { + TLRPC.User u = res.users.get(a); + usersDict.put(u.id, u); + } + for (int a = 0; a < res.chats.size(); a++) { + TLRPC.Chat c = res.chats.get(a); + chatsDict.put(c.id, c); + } + } + } else { + result = null; + } + AndroidUtilities.runOnUIThread(() -> { + if (result == null) { + sendAsPeers.remove(dialogId); + } else { + infoFinal.loadTime = SystemClock.elapsedRealtime(); + infoFinal.sendAsPeers = result; + getNotificationCenter().postNotificationName(NotificationCenter.didLoadSendAsPeers, dialogId, result); + } + }); + }); + return null; + } + public CharSequence getPrintingString(long dialogId, int threadId, boolean isDialog) { if (isDialog && DialogObject.isUserDialog(dialogId)) { TLRPC.User user = getUser(dialogId); @@ -14613,8 +14816,38 @@ public class MessagesController extends BaseController implements NotificationCe } } + public void deleteMessagesRange(long dialogId, long channelId, int minDate, int maxDate, boolean forAll, Runnable callback) { + TLRPC.TL_messages_deleteHistory req = new TLRPC.TL_messages_deleteHistory(); + req.peer = getInputPeer(dialogId); + req.flags = (1 << 2) | (1 << 3); + req.min_date = minDate; + req.max_date = maxDate; + req.revoke = forAll; + + getConnectionsManager().sendRequest(req, (response, error) -> { + if (error == null) { + TLRPC.TL_messages_affectedHistory res = (TLRPC.TL_messages_affectedHistory) response; + processNewDifferenceParams(-1, res.pts, -1, res.pts_count); + getMessagesStorage().getStorageQueue().postRunnable(() -> { + ArrayList dbMessages = getMessagesStorage().getCachedMessagesInRange(dialogId, minDate, maxDate); + getMessagesStorage().markMessagesAsDeleted(dialogId, dbMessages, false, true, false); + getMessagesStorage().updateDialogsWithDeletedMessages(dialogId, 0, dbMessages, null, false); + AndroidUtilities.runOnUIThread(() -> { + getNotificationCenter().postNotificationName(NotificationCenter.messagesDeleted, dbMessages, channelId, false); + callback.run(); + }); + }); + } else { + AndroidUtilities.runOnUIThread(() -> { + callback.run(); + }); + } + }); + } + public interface MessagesLoadedCallback { void onMessagesLoaded(boolean fromCache); + void onError(); } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java index 0e8fbda65..dc59684e8 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java @@ -50,6 +50,25 @@ import androidx.collection.LongSparseArray; public class MessagesStorage extends BaseController { + public ArrayList getCachedMessagesInRange(long dialogId, int minDate, int maxDate) { + ArrayList messageIds = new ArrayList<>(); + try { + SQLiteCursor cursor = database.queryFinalized(String.format(Locale.US, "SELECT mid FROM messages_v2 WHERE uid = %d AND date >= %d AND date <= %d", dialogId, minDate, maxDate)); + try { + while (cursor.next()) { + int mid = cursor.intValue(0); + messageIds.add(mid); + } + } catch (Exception e) { + FileLog.e(e); + } + cursor.dispose(); + } catch (Exception e) { + FileLog.e(e); + } + return messageIds; + } + public interface IntCallback { void run(int param); } @@ -10571,7 +10590,7 @@ public class MessagesStorage extends BaseController { try { database.executeFast(String.format(Locale.US, "UPDATE media_holes_v2 SET end = %d WHERE uid = %d AND type = %d AND start = %d AND end = %d", minId, did, hole.type, hole.start, hole.end)).stepThis().dispose(); } catch (Exception e) { - FileLog.e(e); + FileLog.e(e, false); } } } else if (minId <= hole.start + 1) { @@ -10579,7 +10598,7 @@ public class MessagesStorage extends BaseController { try { database.executeFast(String.format(Locale.US, "UPDATE media_holes_v2 SET start = %d WHERE uid = %d AND type = %d AND start = %d AND end = %d", maxId, did, hole.type, hole.start, hole.end)).stepThis().dispose(); } catch (Exception e) { - FileLog.e(e); + FileLog.e(e, false); } } } else { @@ -10633,7 +10652,7 @@ public class MessagesStorage extends BaseController { try { database.executeFast(String.format(Locale.US, "UPDATE " + table + " SET end = %d WHERE uid = %d AND start = %d AND end = %d", minId, did, hole.start, hole.end)).stepThis().dispose(); } catch (Exception e) { - FileLog.e(e); + FileLog.e(e, false); } } } else if (minId <= hole.start + 1) { @@ -10641,7 +10660,7 @@ public class MessagesStorage extends BaseController { try { database.executeFast(String.format(Locale.US, "UPDATE " + table + " SET start = %d WHERE uid = %d AND start = %d AND end = %d", maxId, did, hole.start, hole.end)).stepThis().dispose(); } catch (Exception e) { - FileLog.e(e); + FileLog.e(e, false); } } } else { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/NotificationCenter.java b/TMessagesProj/src/main/java/org/telegram/messenger/NotificationCenter.java index 31491f40a..54d978597 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/NotificationCenter.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/NotificationCenter.java @@ -33,6 +33,8 @@ public class NotificationCenter { public static final int changeRepliesCounter = totalEvents++; public static final int messagesDidLoad = totalEvents++; public static final int didLoadSponsoredMessages = totalEvents++; + public static final int didLoadSendAsPeers = totalEvents++; + public static final int updateDefaultSendAsPeer = totalEvents++; public static final int messagesDidLoadWithoutProcess = totalEvents++; public static final int loadingMessagesFailed = totalEvents++; public static final int messageReceivedByAck = totalEvents++; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/NotificationsController.java b/TMessagesProj/src/main/java/org/telegram/messenger/NotificationsController.java index 94d5c394b..0f87754db 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/NotificationsController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/NotificationsController.java @@ -1221,13 +1221,13 @@ public class NotificationsController extends BaseController { try { for (int i = 0, N = MessagesController.getInstance(a).allDialogs.size(); i < N; i++) { TLRPC.Dialog dialog = MessagesController.getInstance(a).allDialogs.get(i); - if (DialogObject.isChatDialog(dialog.id)) { + if (dialog != null && DialogObject.isChatDialog(dialog.id)) { TLRPC.Chat chat = getMessagesController().getChat(-dialog.id); if (ChatObject.isNotInChat(chat)) { continue; } } - if (dialog.unread_count != 0) { + if (dialog != null && dialog.unread_count != 0) { count += dialog.unread_count; } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java b/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java index 9d06b00ab..be0277a12 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java @@ -1881,16 +1881,20 @@ public class SendMessagesHelper extends BaseController implements NotificationCe newMsg.from_id = peer_id; } newMsg.post = true; - } else if (ChatObject.shouldSendAnonymously(chat)) { - newMsg.from_id = peer_id; - if (rank != null) { - newMsg.post_author = rank; - newMsg.flags |= 65536; - } } else { - newMsg.from_id = new TLRPC.TL_peerUser(); - newMsg.from_id.user_id = myId; - newMsg.flags |= TLRPC.MESSAGE_FLAG_HAS_FROM_ID; + long fromPeerId = ChatObject.getSendAsPeerId(chat, getMessagesController().getChatFull(-peer), true); + + if (fromPeerId == myId) { + newMsg.from_id = new TLRPC.TL_peerUser(); + newMsg.from_id.user_id = myId; + newMsg.flags |= TLRPC.MESSAGE_FLAG_HAS_FROM_ID; + } else { + newMsg.from_id = getMessagesController().getPeer(fromPeerId); + if (rank != null) { + newMsg.post_author = rank; + newMsg.flags |= 65536; + } + } } if (newMsg.random_id == 0) { newMsg.random_id = getNextRandomId(); @@ -3016,6 +3020,10 @@ public class SendMessagesHelper extends BaseController implements NotificationCe request.random_id = random_id != 0 ? random_id : getNextRandomId(); request.message = ""; request.media = game; + long fromId = ChatObject.getSendAsPeerId(getMessagesController().getChat(peer.chat_id), getMessagesController().getChatFull(peer.chat_id)); + if (fromId != UserConfig.getInstance(currentAccount).getClientUserId()) { + request.send_as = getMessagesController().getInputPeer(fromId); + } final long newTaskId; if (taskId == 0) { NativeByteBuffer data = null; @@ -3100,7 +3108,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe int type = -1; boolean isChannel = false; boolean forceNoSoundVideo = false; - boolean anonymously = false; + TLRPC.Peer fromPeer = null; String rank = null; long linkedToGroup = 0; TLRPC.EncryptedChat encryptedChat = null; @@ -3119,14 +3127,12 @@ public class SendMessagesHelper extends BaseController implements NotificationCe } } else if (sendToPeer instanceof TLRPC.TL_inputPeerChannel) { TLRPC.Chat chat = getMessagesController().getChat(sendToPeer.channel_id); + TLRPC.ChatFull chatFull = getMessagesController().getChatFull(chat.id); isChannel = chat != null && !chat.megagroup; - if (isChannel && chat.has_link) { - TLRPC.ChatFull chatFull = getMessagesController().getChatFull(chat.id); - if (chatFull != null) { - linkedToGroup = chatFull.linked_chat_id; - } + if (isChannel && chat.has_link && chatFull != null) { + linkedToGroup = chatFull.linked_chat_id; } - anonymously = ChatObject.shouldSendAnonymously(chat); + fromPeer = getMessagesController().getPeer(ChatObject.getSendAsPeerId(chat, chatFull, true)); } try { @@ -3426,8 +3432,8 @@ public class SendMessagesHelper extends BaseController implements NotificationCe if (isChannel && sendToPeer != null) { newMsg.from_id = new TLRPC.TL_peerChannel(); newMsg.from_id.channel_id = sendToPeer.channel_id; - } else if (anonymously) { - newMsg.from_id = getMessagesController().getPeer(peer); + } else if (fromPeer != null) { + newMsg.from_id = fromPeer; if (rank != null) { newMsg.post_author = rank; newMsg.flags |= 65536; @@ -3637,6 +3643,9 @@ public class SendMessagesHelper extends BaseController implements NotificationCe reqSend.silent = newMsg.silent; reqSend.peer = sendToPeer; reqSend.random_id = newMsg.random_id; + if (newMsg.from_id != null) { + reqSend.send_as = getMessagesController().getInputPeer(newMsg.from_id); + } if (newMsg.reply_to != null && newMsg.reply_to.reply_to_msg_id != 0) { reqSend.flags |= 1; reqSend.reply_to_msg_id = newMsg.reply_to.reply_to_msg_id; @@ -3996,6 +4005,9 @@ public class SendMessagesHelper extends BaseController implements NotificationCe request.reply_to_msg_id = newMsg.reply_to.reply_to_msg_id; } request.random_id = newMsg.random_id; + if (newMsg.from_id != null) { + request.send_as = getMessagesController().getInputPeer(newMsg.from_id); + } request.media = inputMedia; request.message = caption; if (entities != null && !entities.isEmpty()) { @@ -4371,6 +4383,9 @@ public class SendMessagesHelper extends BaseController implements NotificationCe TLRPC.TL_messages_sendInlineBotResult reqSend = new TLRPC.TL_messages_sendInlineBotResult(); reqSend.peer = sendToPeer; reqSend.random_id = newMsg.random_id; + if (newMsg.from_id != null) { + reqSend.send_as = getMessagesController().getInputPeer(newMsg.from_id); + } reqSend.hide_via = !params.containsKey("bot"); if (newMsg.reply_to != null && newMsg.reply_to.reply_to_msg_id != 0) { reqSend.flags |= 1; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/SharedConfig.java b/TMessagesProj/src/main/java/org/telegram/messenger/SharedConfig.java index 323f9933f..11ccbd1a8 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/SharedConfig.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/SharedConfig.java @@ -136,6 +136,7 @@ public class SharedConfig { public static int distanceSystemType; public static int mediaColumnsCount = 3; public static int fastScrollHintCount = 3; + public static boolean dontAskManageStorage; static { loadConfig(); @@ -375,6 +376,7 @@ public class SharedConfig { dayNightThemeSwitchHintCount = preferences.getInt("dayNightThemeSwitchHintCount", 3); mediaColumnsCount = preferences.getInt("mediaColumnsCount", 3); fastScrollHintCount = preferences.getInt("fastScrollHintCount", 3); + dontAskManageStorage = preferences.getBoolean("dontAskManageStorage", false); preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); showNotificationsForAllAccounts = preferences.getBoolean("AllAccounts", true); @@ -1161,4 +1163,9 @@ public class SharedConfig { ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE).edit().putInt("fastScrollHintCount", fastScrollHintCount).apply(); } } + + public static void setDontAskManageStorage(boolean b) { + dontAskManageStorage = b; + ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE).edit().putBoolean("dontAskManageStorage", dontAskManageStorage).apply(); + } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/SvgHelper.java b/TMessagesProj/src/main/java/org/telegram/messenger/SvgHelper.java index a01bb348e..65f2aa53d 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/SvgHelper.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/SvgHelper.java @@ -142,7 +142,6 @@ public class SvgHelper { height = h; } - @Override public void draw(Canvas canvas) { if (currentColorKey != null) { @@ -287,11 +286,15 @@ public class SvgHelper { } public static Bitmap getBitmap(int res, int width, int height, int color) { + return getBitmap(res, width, height, color, 1f); + } + + public static Bitmap getBitmap(int res, int width, int height, int color, float scale) { try (InputStream stream = ApplicationLoader.applicationContext.getResources().openRawResource(res)) { SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); XMLReader xr = sp.getXMLReader(); - SVGHandler handler = new SVGHandler(width, height, color, false); + SVGHandler handler = new SVGHandler(width, height, color, false, scale); xr.setContentHandler(handler); xr.parse(new InputSource(stream)); return handler.getBitmap(); @@ -306,7 +309,7 @@ public class SvgHelper { SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); XMLReader xr = sp.getXMLReader(); - SVGHandler handler = new SVGHandler(width, height, white ? 0xffffffff : null, false); + SVGHandler handler = new SVGHandler(width, height, white ? 0xffffffff : null, false, 1f); xr.setContentHandler(handler); xr.parse(new InputSource(stream)); return handler.getBitmap(); @@ -321,7 +324,7 @@ public class SvgHelper { SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); XMLReader xr = sp.getXMLReader(); - SVGHandler handler = new SVGHandler(width, height, white ? 0xffffffff : null, false); + SVGHandler handler = new SVGHandler(width, height, white ? 0xffffffff : null, false, 1f); xr.setContentHandler(handler); xr.parse(new InputSource(new StringReader(xml))); return handler.getBitmap(); @@ -336,7 +339,7 @@ public class SvgHelper { SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); XMLReader xr = sp.getXMLReader(); - SVGHandler handler = new SVGHandler(0, 0, null, true); + SVGHandler handler = new SVGHandler(0, 0, null, true, 1f); xr.setContentHandler(handler); xr.parse(new InputSource(new StringReader(xml))); return handler.getDrawable(); @@ -351,7 +354,7 @@ public class SvgHelper { SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); XMLReader xr = sp.getXMLReader(); - SVGHandler handler = new SVGHandler(0, 0, color, true); + SVGHandler handler = new SVGHandler(0, 0, color, true, 1f); xr.setContentHandler(handler); xr.parse(new InputSource(ApplicationLoader.applicationContext.getResources().openRawResource(resId))); return handler.getDrawable(); @@ -948,12 +951,14 @@ public class SvgHelper { private RectF rect = new RectF(); private RectF rectTmp = new RectF(); private Integer paintColor; + private float globalScale = 1f; boolean pushed = false; private HashMap globalStyles = new HashMap<>(); - private SVGHandler(int dw, int dh, Integer color, boolean asDrawable) { + private SVGHandler(int dw, int dh, Integer color, boolean asDrawable, float scale) { + globalScale = scale; desiredWidth = dw; desiredHeight = dh; paintColor = color; @@ -1114,7 +1119,7 @@ public class SvgHelper { bitmap.eraseColor(0); canvas = new Canvas(bitmap); if (scale != 0) { - canvas.scale(scale, scale); + canvas.scale(globalScale * scale, globalScale * scale); } } else { drawable.width = width; 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 2a1abfd08..042bca03b 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/video/MediaCodecVideoConvertor.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/video/MediaCodecVideoConvertor.java @@ -1,11 +1,17 @@ package org.telegram.messenger.video; import android.annotation.TargetApi; +import android.graphics.Matrix; +import android.graphics.SurfaceTexture; import android.media.MediaCodec; import android.media.MediaCodecInfo; import android.media.MediaExtractor; import android.media.MediaFormat; +import android.opengl.EGL14; +import android.opengl.GLES11Ext; +import android.opengl.GLES20; import android.os.Build; +import android.view.Surface; import com.google.android.exoplayer2.util.Log; @@ -25,8 +31,16 @@ import org.telegram.ui.LaunchActivity; import java.io.File; import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.FloatBuffer; import java.util.ArrayList; +import javax.microedition.khronos.egl.EGL10; +import javax.microedition.khronos.egl.EGLConfig; +import javax.microedition.khronos.egl.EGLContext; +import javax.microedition.khronos.egl.EGLDisplay; +import javax.microedition.khronos.egl.EGLSurface; + public class MediaCodecVideoConvertor { private MP4Builder mediaMuxer; @@ -48,6 +62,7 @@ public class MediaCodecVideoConvertor { public boolean convertVideo(String videoPath, File cacheFile, int rotationValue, boolean isSecret, + int originalWidth, int originalHeight, int resultWidth, int resultHeight, int framerate, int bitrate, int originalBitrate, long startTime, long endTime, long avatarStartTime, @@ -59,7 +74,7 @@ public class MediaCodecVideoConvertor { MediaController.CropState cropState, MediaController.VideoConvertorListener callback) { this.callback = callback; - return convertVideoInternal(videoPath, cacheFile, rotationValue, isSecret, + return convertVideoInternal(videoPath, cacheFile, rotationValue, isSecret, originalWidth, originalHeight, resultWidth, resultHeight, framerate, bitrate, originalBitrate, startTime, endTime, avatarStartTime, duration, needCompress, false, savedFilterState, paintPath, mediaEntities, isPhoto, cropState); } @@ -70,6 +85,7 @@ public class MediaCodecVideoConvertor { @TargetApi(18) private boolean convertVideoInternal(String videoPath, File cacheFile, int rotationValue, boolean isSecret, + int originalWidth, int originalHeight, int resultWidth, int resultHeight, int framerate, int bitrate, int originalBitrate, long startTime, long endTime, long avatarStartTime, @@ -141,8 +157,8 @@ public class MediaCodecVideoConvertor { MediaFormat outputFormat = MediaFormat.createVideoFormat(MediaController.VIDEO_MIME_TYPE, resultWidth, resultHeight); outputFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT, MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface); outputFormat.setInteger(MediaFormat.KEY_BIT_RATE, bitrate); - outputFormat.setInteger(MediaFormat.KEY_FRAME_RATE, framerate); - outputFormat.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 2); + outputFormat.setInteger(MediaFormat.KEY_FRAME_RATE, 30); + outputFormat.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 1); encoder = MediaCodec.createEncoderByType(MediaController.VIDEO_MIME_TYPE); encoder.configure(outputFormat, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE); @@ -150,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; @@ -406,6 +422,7 @@ public class MediaCodecVideoConvertor { decoder = MediaCodec.createDecoderByType(videoFormat.getString(MediaFormat.KEY_MIME)); outputSurface = new OutputSurface(savedFilterState, null, paintPath, mediaEntities, cropState, resultWidth, resultHeight, rotationValue, framerate, false); + outputSurface.changeFragmentShader(createFragmentShader(originalWidth, originalHeight, resultWidth, resultHeight)); decoder.configure(videoFormat, outputSurface.getSurface(), null, 0); decoder.start(); @@ -681,7 +698,7 @@ public class MediaCodecVideoConvertor { inputDone = false; decoderDone = false; doRender = false; - info.flags &=~ MediaCodec.BUFFER_FLAG_END_OF_STREAM; + info.flags &= ~MediaCodec.BUFFER_FLAG_END_OF_STREAM; decoder.flush(); flushed = true; } @@ -791,6 +808,7 @@ public class MediaCodecVideoConvertor { if (repeatWithIncreasedTimeout) { return convertVideoInternal(videoPath, cacheFile, rotationValue, isSecret, + originalWidth, originalHeight, resultWidth, resultHeight, framerate, bitrate, originalBitrate, startTime, endTime, avatarStartTime, duration, needCompress, true, savedFilterState, paintPath, mediaEntities, isPhoto, cropState); @@ -958,6 +976,52 @@ public class MediaCodecVideoConvertor { private void checkConversionCanceled() { if (callback != null && callback.checkConversionCanceled()) - throw new RuntimeException("canceled conversion"); + throw new ConversionCanceledException(); } + + private static String createFragmentShader( + final int srcWidth, + final int srcHeight, + final int dstWidth, + final int dstHeight) { + final float kernelSizeX = Math.max(2f, (float) srcWidth / (float) dstWidth); + final float kernelSizeY = Math.max(2f, (float) srcHeight / (float) dstHeight); + + final String shader; + + final int kernelRadiusX = (int) Math.ceil(kernelSizeX - .1f) / 2; + final int kernelRadiusY = (int) Math.ceil(kernelSizeY - .1f) / 2; + final float stepX = kernelSizeX / (1 + 2 * kernelRadiusX) * (1f / srcWidth); + final float stepY = kernelSizeY / (1 + 2 * kernelRadiusY) * (1f / srcHeight); + final float sum = (1 + 2 * kernelRadiusX) * (1 + 2 * kernelRadiusY); + final StringBuilder colorLoop = new StringBuilder(); + for (int i = -kernelRadiusX; i <= kernelRadiusX; i++) { + for (int j = -kernelRadiusY; j <= kernelRadiusY; j++) { + if (i != 0 || j != 0) { + colorLoop.append(" + texture2D(sTexture, vTextureCoord.xy + vec2(") + .append(i * stepX).append(", ").append(j * stepY).append("))\n"); + } + } + } + shader = + "#extension GL_OES_EGL_image_external : require\n" + + "precision mediump float;\n" + // highp here doesn't seem to matter + "varying vec2 vTextureCoord;\n" + + "uniform samplerExternalOES sTexture;\n" + + "void main() {\n" + + " gl_FragColor = (texture2D(sTexture, vTextureCoord)\n" + + colorLoop.toString() + + " ) / " + sum + ";\n" + + "}\n"; + + return shader; + } + + public class ConversionCanceledException extends RuntimeException{ + + public ConversionCanceledException() { + super("canceled conversion"); + } + } + } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/video/OutputSurface.java b/TMessagesProj/src/main/java/org/telegram/messenger/video/OutputSurface.java index 96e049124..e7cd82422 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/video/OutputSurface.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/video/OutputSurface.java @@ -165,4 +165,8 @@ public class OutputSurface implements SurfaceTexture.OnFrameAvailableListener { throw new RuntimeException("EGL error encountered (see log)"); } } + + public void changeFragmentShader(String fragmentShader) { + mTextureRender.changeFragmentShader(fragmentShader); + } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/video/TextureRenderer.java b/TMessagesProj/src/main/java/org/telegram/messenger/video/TextureRenderer.java index 40ff01b95..aac09a31e 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/video/TextureRenderer.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/video/TextureRenderer.java @@ -604,7 +604,7 @@ public class TextureRenderer { if (entity.type == 0) { if ((entity.subType & 1) != 0) { entity.metadata = new int[3]; - entity.ptr = RLottieDrawable.create(entity.text, null, 512, 512, entity.metadata, false, null, false); + entity.ptr = RLottieDrawable.create(entity.text, null, 512, 512, entity.metadata, false, null, false, 0); entity.framesPerDraw = entity.metadata[1] / videoFps; } else { if (Build.VERSION.SDK_INT >= 19) { @@ -714,4 +714,9 @@ public class TextureRenderer { } } } + + public void changeFragmentShader(String fragmentShader) { + GLES20.glDeleteProgram(mProgram[0]); + mProgram[0] = createProgram(VERTEX_SHADER, fragmentShader); + } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/voip/Instance.java b/TMessagesProj/src/main/java/org/telegram/messenger/voip/Instance.java index bd6cc5346..32c0a86f4 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/voip/Instance.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/voip/Instance.java @@ -15,7 +15,7 @@ import java.util.List; public final class Instance { - public static final List AVAILABLE_VERSIONS = Build.VERSION.SDK_INT >= 18 ? Arrays.asList(/*"3.0.0", */"2.7.7", "2.4.4") : Arrays.asList("2.4.4"); + public static final List AVAILABLE_VERSIONS = Build.VERSION.SDK_INT >= 18 ? Arrays.asList("3.0.0", "2.7.7", "2.4.4") : Arrays.asList("2.4.4"); public static final int AUDIO_STATE_MUTED = 0; public static final int AUDIO_STATE_ACTIVE = 1; diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/ConnectionsManager.java b/TMessagesProj/src/main/java/org/telegram/tgnet/ConnectionsManager.java index f42520d8f..36d12943d 100644 --- a/TMessagesProj/src/main/java/org/telegram/tgnet/ConnectionsManager.java +++ b/TMessagesProj/src/main/java/org/telegram/tgnet/ConnectionsManager.java @@ -10,6 +10,7 @@ import android.os.SystemClock; import android.text.TextUtils; import android.util.Base64; +import com.google.android.exoplayer2.util.Log; import com.google.firebase.remoteconfig.FirebaseRemoteConfig; import org.json.JSONArray; @@ -1017,7 +1018,7 @@ public class ConnectionsManager extends BaseController { buffer.writeBytes(bytes); return buffer; } catch (Throwable e) { - FileLog.e(e); + FileLog.e(e, false); } finally { try { if (httpConnectionStream != null) { diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java b/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java index bd8e360f0..7e5e3de46 100644 --- a/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java +++ b/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java @@ -66,7 +66,7 @@ public class TLRPC { public static final int MESSAGE_FLAG_HAS_BOT_ID = 0x00000800; public static final int MESSAGE_FLAG_EDITED = 0x00008000; - public static final int LAYER = 134; + public static final int LAYER = 135; public static class TL_stats_megagroupStats extends TLObject { public static int constructor = 0xef7ff916; @@ -2269,7 +2269,7 @@ public class TLRPC { case 0x44747e9a: result = new TL_auth_authorizationSignUpRequired(); break; - case 0xcd050916: + case 0x33fb7bb8: result = new TL_auth_authorization(); break; } @@ -2306,14 +2306,20 @@ public class TLRPC { } public static class TL_auth_authorization extends auth_Authorization { - public static int constructor = 0xcd050916; + public static int constructor = 0x33fb7bb8; public int flags; + public boolean setup_password_required; + public int otherwise_relogin_days; public int tmp_sessions; public User user; public void readParams(AbstractSerializedData stream, boolean exception) { flags = stream.readInt32(exception); + setup_password_required = (flags & 2) != 0; + if ((flags & 2) != 0) { + otherwise_relogin_days = stream.readInt32(exception); + } if ((flags & 1) != 0) { tmp_sessions = stream.readInt32(exception); } @@ -2322,7 +2328,11 @@ public class TLRPC { public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); + flags = setup_password_required ? (flags | 2) : (flags &~ 2); stream.writeInt32(flags); + if ((flags & 2) != 0) { + stream.writeInt32(otherwise_relogin_days); + } if ((flags & 1) != 0) { stream.writeInt32(tmp_sessions); } @@ -4397,6 +4407,8 @@ public class TLRPC { public boolean current; public boolean official_app; public boolean password_pending; + public boolean encrypted_requests_disabled; + public boolean call_requests_disabled; public long hash; public String device_model; public String platform; @@ -4428,6 +4440,8 @@ public class TLRPC { current = (flags & 1) != 0; official_app = (flags & 2) != 0; password_pending = (flags & 4) != 0; + encrypted_requests_disabled = (flags & 8) != 0; + call_requests_disabled = (flags & 16) != 0; hash = stream.readInt64(exception); device_model = stream.readString(exception); platform = stream.readString(exception); @@ -4447,6 +4461,8 @@ public class TLRPC { flags = current ? (flags | 1) : (flags &~ 1); flags = official_app ? (flags | 2) : (flags &~ 2); flags = password_pending ? (flags | 4) : (flags &~ 4); + flags = encrypted_requests_disabled ? (flags | 8) : (flags &~ 8); + flags = call_requests_disabled ? (flags | 16) : (flags &~ 16); stream.writeInt32(flags); stream.writeInt64(hash); stream.writeString(device_model); @@ -6088,6 +6104,7 @@ public class TLRPC { 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; @@ -6101,6 +6118,9 @@ public class TLRPC { case 0xab03c6d9: result = new TL_auth_sentCodeTypeFlashCall(); break; + case 0x82006484: + result = new TL_auth_sentCodeTypeMissedCall(); + break; case 0xc000bba2: result = new TL_auth_sentCodeTypeSms(); break; @@ -6157,6 +6177,21 @@ public class TLRPC { } } + public static class TL_auth_sentCodeTypeMissedCall extends auth_SentCodeType { + public static int constructor = 0x82006484; + + public void readParams(AbstractSerializedData stream, boolean exception) { + prefix = stream.readString(exception); + length = stream.readInt32(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(prefix); + stream.writeInt32(length); + } + } + public static class TL_auth_sentCodeTypeSms extends auth_SentCodeType { public static int constructor = 0xc000bba2; @@ -6237,7 +6272,7 @@ public class TLRPC { } public static class TL_peerSettings extends TLObject { - public static int constructor = 0x733f2961; + public static int constructor = 0xa518110d; public int flags; public boolean report_spam; @@ -6248,7 +6283,10 @@ public class TLRPC { public boolean report_geo; public boolean autoarchived; public boolean invite_members; + public boolean request_chat_broadcast; public int geo_distance; + public String request_chat_title; + public int request_chat_date; public static TL_peerSettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { if (TL_peerSettings.constructor != constructor) { @@ -6273,9 +6311,16 @@ public class TLRPC { report_geo = (flags & 32) != 0; autoarchived = (flags & 128) != 0; invite_members = (flags & 256) != 0; + request_chat_broadcast = (flags & 1024) != 0; if ((flags & 64) != 0) { geo_distance = stream.readInt32(exception); } + if ((flags & 512) != 0) { + request_chat_title = stream.readString(exception); + } + if ((flags & 512) != 0) { + request_chat_date = stream.readInt32(exception); + } } public void serializeToStream(AbstractSerializedData stream) { @@ -6288,10 +6333,17 @@ public class TLRPC { flags = report_geo ? (flags | 32) : (flags &~ 32); flags = autoarchived ? (flags | 128) : (flags &~ 128); flags = invite_members ? (flags | 256) : (flags &~ 256); + flags = request_chat_broadcast ? (flags | 1024) : (flags &~ 1024); stream.writeInt32(flags); if ((flags & 64) != 0) { stream.writeInt32(geo_distance); } + if ((flags & 512) != 0) { + stream.writeString(request_chat_title); + } + if ((flags & 512) != 0) { + stream.writeInt32(request_chat_date); + } } } @@ -8567,77 +8619,94 @@ public class TLRPC { } } - public static class TL_messages_stickerSet extends TLObject { - public static int constructor = 0xb60a24a6; + public static abstract class messages_StickerSet extends TLObject { - public StickerSet set; - public ArrayList packs = new ArrayList<>(); - public ArrayList documents = new ArrayList<>(); + public StickerSet set; + public ArrayList packs = new ArrayList<>(); + public ArrayList documents = new ArrayList<>(); - public static TL_messages_stickerSet TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messages_stickerSet.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_stickerSet", constructor)); - } else { - return null; - } - } - TL_messages_stickerSet result = new TL_messages_stickerSet(); - result.readParams(stream, exception); - return result; - } + public static TL_messages_stickerSet TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + TL_messages_stickerSet result = null; + switch (constructor) { + case 0xb60a24a6: + result = new TL_messages_stickerSet(); + break; + case 0xd3f924eb: + result = new TL_messages_stickerSetNotModified(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in messages_StickerSet", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - 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++) { - TL_stickerPack object = TL_stickerPack.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - packs.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++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - documents.add(object); - } - } + public static class TL_messages_stickerSet extends messages_StickerSet { + public static int constructor = 0xb60a24a6; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - set.serializeToStream(stream); + 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++) { + TL_stickerPack object = TL_stickerPack.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + packs.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++) { + Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + documents.add(object); + } + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + set.serializeToStream(stream); stream.writeInt32(0x1cb5c415); - int count = packs.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - packs.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = documents.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - documents.get(a).serializeToStream(stream); - } - } - } + int count = packs.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + packs.get(a).serializeToStream(stream); + } + stream.writeInt32(0x1cb5c415); + count = documents.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + documents.get(a).serializeToStream(stream); + } + } + } + + public static class TL_messages_stickerSetNotModified extends TL_messages_stickerSet { + public static int constructor = 0xd3f924eb; + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } public static abstract class InputGeoPoint extends TLObject { @@ -10461,6 +10530,7 @@ public class TLRPC { public ArrayList recent_requesters = new ArrayList<>(); public String theme_emoticon; public int requests_pending; + public Peer default_send_as; public long inviterId; //custom public int invitesCount; //custom @@ -10470,9 +10540,12 @@ public class TLRPC { case 0x46a6ffb4: result = new TL_chatFull(); break; - case 0x59cff963: + case 0x56662e2e: result = new TL_channelFull(); break; + case 0x59cff963: + result = new TL_channelFull_layer134(); + break; case 0x1c87a71a: result = new TL_channelFull_layer98(); break; @@ -11910,6 +11983,252 @@ public class TLRPC { } public static class TL_channelFull extends ChatFull { + public static int constructor = 0x56662e2e; + + 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); + } + } + + 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); + } + } + } + + public static class TL_channelFull_layer134 extends ChatFull { public static int constructor = 0x59cff963; public void readParams(AbstractSerializedData stream, boolean exception) { @@ -14691,12 +15010,14 @@ public class TLRPC { } public static class TL_codeSettings extends TLObject { - public static int constructor = 0xdebebe83; + public static int constructor = 0x8a6469c2; public int flags; public boolean allow_flashcall; public boolean current_number; public boolean allow_app_hash; + public boolean allow_missed_call; + public ArrayList logout_tokens = new ArrayList<>(); public static TL_codeSettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { if (TL_codeSettings.constructor != constructor) { @@ -14716,6 +15037,20 @@ public class TLRPC { allow_flashcall = (flags & 1) != 0; current_number = (flags & 2) != 0; allow_app_hash = (flags & 16) != 0; + allow_missed_call = (flags & 32) != 0; + 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++) { + logout_tokens.add(stream.readByteArray(exception)); + } + } } public void serializeToStream(AbstractSerializedData stream) { @@ -14723,7 +15058,16 @@ public class TLRPC { flags = allow_flashcall ? (flags | 1) : (flags &~ 1); flags = current_number ? (flags | 2) : (flags &~ 2); flags = allow_app_hash ? (flags | 16) : (flags &~ 16); + flags = allow_missed_call ? (flags | 32) : (flags &~ 32); stream.writeInt32(flags); + if ((flags & 64) != 0) { + stream.writeInt32(0x1cb5c415); + int count = logout_tokens.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeByteArray(logout_tokens.get(a)); + } + } } } @@ -15522,56 +15866,64 @@ public class TLRPC { public String fwd_text; public boolean quiz; public boolean requires_password; + public long user_id; + public InputUser inputUser; - public static KeyboardButton TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - KeyboardButton result = null; - switch (constructor) { - case 0xb16a6c29: - result = new TL_keyboardButtonRequestPhone(); - break; - case 0x50f41ccf: - result = new TL_keyboardButtonGame(); - break; - case 0x258aff05: - result = new TL_keyboardButtonUrl(); - break; - case 0x568a748: - result = new TL_keyboardButtonSwitchInline(); - break; - case 0xfc796b3f: - result = new TL_keyboardButtonRequestGeoLocation(); - break; - case 0x10b78d29: - result = new TL_keyboardButtonUrlAuth(); - break; + 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(); + break; + case 0x50f41ccf: + result = new TL_keyboardButtonGame(); + break; + case 0x683a5e46: + result = new TL_keyboardButtonCallback_layer117(); + break; + case 0x568a748: + result = new TL_keyboardButtonSwitchInline(); + break; + case 0xb16a6c29: + result = new TL_keyboardButtonRequestPhone(); + break; + case 0x10b78d29: + result = new TL_keyboardButtonUrlAuth(); + 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 0xafd93fbb: + result = new TL_keyboardButtonBuy(); + 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)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in KeyboardButton", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } public static class TL_keyboardButtonRequestPhone extends KeyboardButton { public static int constructor = 0xb16a6c29; @@ -15727,6 +16079,36 @@ public class TLRPC { } } + public static class TL_inputKeyboardButtonUserProfile extends KeyboardButton { + public static int constructor = 0xe988037b; + + public void readParams(AbstractSerializedData stream, boolean exception) { + text = stream.readString(exception); + inputUser = InputUser.TLdeserialize(stream, stream.readInt32(exception), exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(text); + inputUser.serializeToStream(stream); + } + } + + public static class TL_keyboardButtonUserProfile extends KeyboardButton { + public static int constructor = 0x308660c1; + + public void readParams(AbstractSerializedData stream, boolean exception) { + text = stream.readString(exception); + user_id = stream.readInt64(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(text); + stream.writeInt64(user_id); + } + } + public static class TL_keyboardButtonBuy extends KeyboardButton { public static int constructor = 0xafd93fbb; @@ -22729,6 +23111,78 @@ public class TLRPC { } } + public static class TL_users_userFull extends TLObject { + public static int constructor = 0x3b6d152e; + + public UserFull full_user; + public ArrayList chats = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); + + public static TL_users_userFull TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_users_userFull.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_users_userFull", constructor)); + } else { + return null; + } + } + TL_users_userFull result = new TL_users_userFull(); + result.readParams(stream, exception); + return result; + } + + public void readParams(AbstractSerializedData stream, boolean exception) { + full_user = UserFull.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_user.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_shippingOption extends TLObject { public static int constructor = 0xb6213cdf; @@ -25950,6 +26404,78 @@ public class TLRPC { } } + public static class TL_messages_peerSettings extends TLObject { + public static int constructor = 0x6880b94d; + + public TL_peerSettings settings; + public ArrayList chats = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); + + public static TL_messages_peerSettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_messages_peerSettings.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_messages_peerSettings", constructor)); + } else { + return null; + } + } + TL_messages_peerSettings result = new TL_messages_peerSettings(); + result.readParams(stream, exception); + return result; + } + + public void readParams(AbstractSerializedData stream, boolean exception) { + settings = TL_peerSettings.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); + settings.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_messages_checkedHistoryImportPeer extends TLObject { public static int constructor = 0xa24de717; @@ -28323,7 +28849,7 @@ public class TLRPC { public TL_messages_stickerSet stickerset; public void readParams(AbstractSerializedData stream, boolean exception) { - stickerset = TL_messages_stickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); + stickerset = messages_StickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); } public void serializeToStream(AbstractSerializedData stream) { @@ -29280,6 +29806,41 @@ public class TLRPC { } } + public static class TL_auth_loggedOut extends TLObject { + public static int constructor = 0xc3a2835f; + + public int flags; + public byte[] future_auth_token; + + public static TL_auth_loggedOut TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_auth_loggedOut.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_auth_loggedOut", constructor)); + } else { + return null; + } + } + TL_auth_loggedOut result = new TL_auth_loggedOut(); + result.readParams(stream, exception); + return result; + } + + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + if ((flags & 1) != 0) { + future_auth_token = stream.readByteArray(exception); + } + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + stream.writeByteArray(future_auth_token); + } + } + } + public static abstract class UserProfilePhoto extends TLObject { public int flags; @@ -35897,6 +36458,9 @@ public class TLRPC { case 0x50c7ac8: result = new TL_channelAdminLogEventActionChangeLinkedChat(); break; + case 0x278f2868: + result = new TL_channelAdminLogEventActionSendMessage(); + break; case 0x1b7907ae: result = new TL_channelAdminLogEventActionToggleInvites(); break; @@ -35912,6 +36476,9 @@ public class TLRPC { case 0x6e941a38: result = new TL_channelAdminLogEventActionChangeHistoryTTL(); break; + case 0xcb2ac766: + result = new TL_channelAdminLogEventActionToggleNoForwards(); + break; } if (result == null && exception) { throw new RuntimeException(String.format("can't parse magic %x in ChannelAdminLogEventAction", constructor)); @@ -36388,6 +36955,21 @@ public class TLRPC { } } + public static class TL_channelAdminLogEventActionSendMessage extends ChannelAdminLogEventAction { + public static int constructor = 0x278f2868; + + public Message message; + + public void readParams(AbstractSerializedData stream, boolean exception) { + message = Message.TLdeserialize(stream, stream.readInt32(exception), exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + message.serializeToStream(stream); + } + } + public static class TL_channelAdminLogEventActionToggleInvites extends ChannelAdminLogEventAction { public static int constructor = 0x1b7907ae; @@ -36469,6 +37051,21 @@ public class TLRPC { } } + public static class TL_channelAdminLogEventActionToggleNoForwards extends ChannelAdminLogEventAction { + public static int constructor = 0xcb2ac766; + + public boolean new_value; + + public void readParams(AbstractSerializedData stream, boolean exception) { + new_value = stream.readBool(exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeBool(new_value); + } + } + public static abstract class InputWebFileLocation extends TLObject { public static InputWebFileLocation TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { @@ -36884,6 +37481,7 @@ public class TLRPC { public boolean call_not_empty; public boolean fake; public boolean gigagroup; + public boolean noforwards; public ArrayList restriction_reason = new ArrayList<>(); public TL_channelAdminRights_layer92 admin_rights_layer92; public TL_channelBannedRights_layer92 banned_rights_layer92; @@ -37075,6 +37673,7 @@ public class TLRPC { deactivated = (flags & 32) != 0; call_active = (flags & 8388608) != 0; call_not_empty = (flags & 16777216) != 0; + noforwards = (flags & 33554432) != 0; id = stream.readInt64(exception); title = stream.readString(exception); photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -37100,6 +37699,7 @@ public class TLRPC { flags = deactivated ? (flags | 32) : (flags &~ 32); flags = call_active ? (flags | 8388608) : (flags &~ 8388608); flags = call_not_empty ? (flags | 16777216) : (flags &~ 16777216); + flags = noforwards ? (flags | 33554432) : (flags &~ 33554432); stream.writeInt32(flags); stream.writeInt64(id); stream.writeString(title); @@ -37354,6 +37954,7 @@ public class TLRPC { call_not_empty = (flags & 16777216) != 0; fake = (flags & 33554432) != 0; gigagroup = (flags & 67108864) != 0; + noforwards = (flags & 134217728) != 0; id = stream.readInt64(exception); if ((flags & 8192) != 0) { access_hash = stream.readInt64(exception); @@ -37413,6 +38014,7 @@ public class TLRPC { flags = call_not_empty ? (flags | 16777216) : (flags &~ 16777216); flags = fake ? (flags | 33554432) : (flags &~ 33554432); flags = gigagroup ? (flags | 67108864) : (flags &~ 67108864); + flags = noforwards ? (flags | 134217728) : (flags &~ 134217728); stream.writeInt32(flags); stream.writeInt64(id); if ((flags & 8192) != 0) { @@ -38690,6 +39292,9 @@ public class TLRPC { 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)); @@ -38728,6 +39333,15 @@ public class TLRPC { } } + public static class TL_auth_codeTypeMissedCall extends auth_CodeType { + public static int constructor = 0xd61ad6ee; + + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + } + } + public static abstract class MessagesFilter extends TLObject { public int flags; public boolean missed; @@ -40490,13 +41104,18 @@ public class TLRPC { public int ttl_period; public TL_peerSettings settings; public String theme_emoticon; + public long id; + public String private_forward_name; public static UserFull TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { UserFull result = null; switch (constructor) { - case 0xd697ff05: + case 0xcf366521: result = new TL_userFull(); break; + case 0xd697ff05: + result = new TL_userFull_layer134(); + break; case 0x139a9a77: result = new TL_userFull_layer131(); break; @@ -40521,6 +41140,87 @@ public class TLRPC { } public static class TL_userFull extends UserFull { + public static int constructor = 0xcf366521; + + public void readParams(AbstractSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + blocked = (flags & 1) != 0; + phone_calls_available = (flags & 16) != 0; + phone_calls_private = (flags & 32) != 0; + can_pin_message = (flags & 128) != 0; + has_scheduled = (flags & 4096) != 0; + video_calls_available = (flags & 8192) != 0; + id = stream.readInt64(exception); + if ((flags & 2) != 0) { + about = stream.readString(exception); + } + settings = TL_peerSettings.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 4) != 0) { + profile_photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + } + notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 8) != 0) { + bot_info = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 64) != 0) { + pinned_msg_id = stream.readInt32(exception); + } + common_chats_count = stream.readInt32(exception); + if ((flags & 2048) != 0) { + folder_id = stream.readInt32(exception); + } + if ((flags & 16384) != 0) { + ttl_period = stream.readInt32(exception); + } + if ((flags & 32768) != 0) { + theme_emoticon = stream.readString(exception); + } + if ((flags & 65536) != 0) { + private_forward_name = stream.readString(exception); + } + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = blocked ? (flags | 1) : (flags &~ 1); + flags = phone_calls_available ? (flags | 16) : (flags &~ 16); + flags = phone_calls_private ? (flags | 32) : (flags &~ 32); + flags = can_pin_message ? (flags | 128) : (flags &~ 128); + flags = has_scheduled ? (flags | 4096) : (flags &~ 4096); + flags = video_calls_available ? (flags | 8192) : (flags &~ 8192); + stream.writeInt32(flags); + stream.writeInt64(id); + if ((flags & 2) != 0) { + stream.writeString(about); + } + settings.serializeToStream(stream); + if ((flags & 4) != 0) { + profile_photo.serializeToStream(stream); + } + notify_settings.serializeToStream(stream); + if ((flags & 8) != 0) { + bot_info.serializeToStream(stream); + } + if ((flags & 64) != 0) { + stream.writeInt32(pinned_msg_id); + } + stream.writeInt32(common_chats_count); + if ((flags & 2048) != 0) { + stream.writeInt32(folder_id); + } + if ((flags & 16384) != 0) { + stream.writeInt32(ttl_period); + } + if ((flags & 32768) != 0) { + stream.writeString(theme_emoticon); + } + if ((flags & 65536) != 0) { + stream.writeString(private_forward_name); + } + } + } + + public static class TL_userFull_layer134 extends TL_userFull { public static int constructor = 0xd697ff05; @@ -43194,52 +43894,55 @@ public class TLRPC { } } - public static class TL_account_authorizations extends TLObject { - public static int constructor = 0x1250abde; + public static class TL_account_authorizations extends TLObject { + public static int constructor = 0x4bff8ea0; - public ArrayList authorizations = new ArrayList<>(); + public int authorization_ttl_days; + public ArrayList authorizations = new ArrayList<>(); - public static TL_account_authorizations TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_account_authorizations.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_account_authorizations", constructor)); - } else { - return null; - } + public static TL_account_authorizations TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_account_authorizations.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_account_authorizations", constructor)); + } else { + return null; + } } TL_account_authorizations result = new TL_account_authorizations(); - result.readParams(stream, exception); - return result; - } + 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_authorization object = TL_authorization.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - authorizations.add(object); - } - } + public void readParams(AbstractSerializedData stream, boolean exception) { + authorization_ttl_days = 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_authorization object = TL_authorization.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + authorizations.add(object); + } + } - 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); - } - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(authorization_ttl_days); + stream.writeInt32(0x1cb5c415); + int count = authorizations.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + authorizations.get(a).serializeToStream(stream); + } + } + } public static class TL_paymentRequestedInfo extends TLObject { public static int constructor = 0x909c3f94; @@ -43358,18 +44061,18 @@ public class TLRPC { } } - public static class TL_auth_logOut extends TLObject { - public static int constructor = 0x5717da40; + public static class TL_auth_logOut extends TLObject { + public static int constructor = 0x3e72ba19; - 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_auth_loggedOut.TLdeserialize(stream, constructor, exception); + } public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + stream.writeInt32(constructor); + } + } public static class TL_auth_resetAuthorizations extends TLObject { public static int constructor = 0x9fab0d1a; @@ -43732,20 +44435,60 @@ public class TLRPC { } } - public static class TL_users_getFullUser extends TLObject { - public static int constructor = 0xca30a5b1; + public static class TL_account_setAuthorizationTTL extends TLObject { + public static int constructor = 0xbf899aa0; - public InputUser id; + public int authorization_ttl_days; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return UserFull.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); + stream.writeInt32(authorization_ttl_days); + } + } + + public static class TL_account_changeAuthorizationSettings extends TLObject { + public static int constructor = 0x40f48462; + + public int flags; + public long hash; + public boolean encrypted_requests_disabled; + public boolean call_requests_disabled; + + 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(flags); + stream.writeInt64(hash); + if ((flags & 1) != 0) { + stream.writeBool(encrypted_requests_disabled); + } + if ((flags & 2) != 0) { + stream.writeBool(call_requests_disabled); + } + } + } + + public static class TL_users_getFullUser extends TLObject { + public static int constructor = 0xb60f5918; + + public InputUser id; + + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_users_userFull.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + id.serializeToStream(stream); + } + } public static class TL_contacts_getStatuses extends TLObject { public static int constructor = 0xc4a353ee; @@ -44630,7 +45373,7 @@ public class TLRPC { } public static class TL_messages_sendMessage extends TLObject { - public static int constructor = 0x520c3870; + public static int constructor = 0xd9d75a4; public int flags; public boolean no_webpage; @@ -44644,6 +45387,7 @@ public class TLRPC { public ReplyMarkup reply_markup; public ArrayList entities = new ArrayList<>(); public int schedule_date; + public InputPeer send_as; public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); @@ -44676,11 +45420,14 @@ public class TLRPC { if ((flags & 1024) != 0) { stream.writeInt32(schedule_date); } + if ((flags & 8192) != 0) { + send_as.serializeToStream(stream); + } } } public static class TL_messages_sendMedia extends TLObject { - public static int constructor = 0x3491eba9; + public static int constructor = 0xe25ff8e0; public int flags; public boolean silent; @@ -44694,6 +45441,7 @@ public class TLRPC { public ReplyMarkup reply_markup; public ArrayList entities = new ArrayList<>(); public int schedule_date; + public InputPeer send_as; public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); @@ -44726,11 +45474,14 @@ public class TLRPC { if ((flags & 1024) != 0) { stream.writeInt32(schedule_date); } + if ((flags & 8192) != 0) { + send_as.serializeToStream(stream); + } } } public static class TL_messages_forwardMessages extends TLObject { - public static int constructor = 0xd9fee60e; + public static int constructor = 0xcc30290b; public int flags; public boolean silent; @@ -44743,6 +45494,7 @@ public class TLRPC { public ArrayList random_id = new ArrayList<>(); public InputPeer to_peer; public int schedule_date; + public InputPeer send_as; public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); @@ -44773,6 +45525,9 @@ public class TLRPC { if ((flags & 1024) != 0) { stream.writeInt32(schedule_date); } + if ((flags & 8192) != 0) { + send_as.serializeToStream(stream); + } } } @@ -44791,20 +45546,20 @@ public class TLRPC { } } - public static class TL_messages_getPeerSettings extends TLObject { - public static int constructor = 0x3672e09c; + public static class TL_messages_getPeerSettings extends TLObject { + public static int constructor = 0xefd9a6a2; - public InputPeer peer; + public InputPeer peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_peerSettings.TLdeserialize(stream, constructor, exception); - } + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_messages_peerSettings.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_report extends TLObject { public static int constructor = 0x8953ab4e; @@ -46831,7 +47586,7 @@ public class TLRPC { } public static class TL_messages_sendInlineBotResult extends TLObject { - public static int constructor = 0x220815b0; + public static int constructor = 0x7aa11297; public int flags; public boolean silent; @@ -46844,6 +47599,7 @@ public class TLRPC { public long query_id; public String id; public int schedule_date; + public InputPeer send_as; public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); @@ -46866,6 +47622,9 @@ public class TLRPC { if ((flags & 1024) != 0) { stream.writeInt32(schedule_date); } + if ((flags & 8192) != 0) { + send_as.serializeToStream(stream); + } } } @@ -47541,7 +48300,7 @@ public class TLRPC { } public static class TL_messages_sendMultiMedia extends TLObject { - public static int constructor = 0xcc0110cb; + public static int constructor = 0xf803138f; public int flags; public boolean silent; @@ -47551,6 +48310,7 @@ public class TLRPC { public int reply_to_msg_id; public ArrayList multi_media = new ArrayList<>(); public int schedule_date; + public InputPeer send_as; public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); @@ -47575,6 +48335,9 @@ public class TLRPC { if ((flags & 1024) != 0) { stream.writeInt32(schedule_date); } + if ((flags & 8192) != 0) { + send_as.serializeToStream(stream); + } } } @@ -48636,6 +49399,63 @@ public class TLRPC { } } + public static class TL_messages_hideAllChatJoinRequests extends TLObject { + public static int constructor = 0xe085f4ea; + + public int flags; + public boolean approved; + public InputPeer peer; + public String link; + + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + flags = approved ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + peer.serializeToStream(stream); + if ((flags & 2) != 0) { + stream.writeString(link); + } + } + } + + public static class TL_messages_toggleNoForwards extends TLObject { + public static int constructor = 0xb11eafa2; + + public InputPeer peer; + public boolean enabled; + + 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.writeBool(enabled); + } + } + + public static class TL_messages_saveDefaultSendAs extends TLObject { + public static int constructor = 0xccfddf96; + + public InputPeer peer; + public InputPeer send_as; + + 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); + send_as.serializeToStream(stream); + } + } + public static class TL_messages_setHistoryTTL extends TLObject { public static int constructor = 0xb80e5fe4; @@ -49068,22 +49888,22 @@ public class TLRPC { } } - public static class TL_channels_deleteUserHistory extends TLObject { - public static int constructor = 0xd10dd71b; + public static class TL_channels_deleteParticipantHistory extends TLObject { + public static int constructor = 0x367544db; - public InputChannel channel; - public InputUser user_id; + public InputChannel channel; + public InputPeer participant; - 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); - channel.serializeToStream(stream); - user_id.serializeToStream(stream); - } - } + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + channel.serializeToStream(stream); + participant.serializeToStream(stream); + } + } public static class TL_channels_reportSpam extends TLObject { public static int constructor = 0xfe087810; @@ -49667,6 +50487,21 @@ public class TLRPC { } } + public static class TL_channels_getSendAs extends TLObject { + public static int constructor = 0xdc770ee; + + public InputPeer peer; + + public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + return TL_channels_sendAsPeers.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(AbstractSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + } + } + public static class TL_stickers_createStickerSet extends TLObject { public static int constructor = 0x9021ab67; @@ -50951,6 +51786,97 @@ public class TLRPC { } //RichText end + public static class TL_channels_sendAsPeers extends TLObject { + public static int constructor = 0x8356cda9; + + public ArrayList peers = new ArrayList<>(); + public ArrayList chats = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); + + public static TL_channels_sendAsPeers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_channels_sendAsPeers.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_channels_sendAsPeers", constructor)); + } else { + return null; + } + } + TL_channels_sendAsPeers result = new TL_channels_sendAsPeers(); + 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; + } + peers.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 = peers.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + peers.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); + } + } + } + //MessageMedia start public static abstract class MessageMedia extends TLObject { public byte[] bytes; @@ -51513,6 +52439,7 @@ public class TLRPC { public TL_messageReactions reactions; public ArrayList restriction_reason = new ArrayList<>(); public int ttl_period; + public boolean noforwards; public int send_state = 0; //custom public int fwd_msg_id = 0; //custom public String attachPath = ""; //custom @@ -52322,6 +53249,7 @@ public class TLRPC { 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); @@ -52418,6 +53346,7 @@ public class TLRPC { 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) { 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 2d6a9fb8a..6d5e79ba3 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java @@ -44,6 +44,7 @@ import android.view.ViewOutlineProvider; import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.DecelerateInterpolator; import android.widget.FrameLayout; +import android.widget.LinearLayout; import com.google.android.exoplayer2.util.Log; @@ -191,12 +192,13 @@ public class ActionBarLayout extends FrameLayout { @Override public boolean dispatchTouchEvent(MotionEvent ev) { - if ((inPreviewMode || transitionAnimationPreviewMode) && (ev.getActionMasked() == MotionEvent.ACTION_DOWN || ev.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN)) { + boolean passivePreview = inPreviewMode && previewMenu == null; + if ((passivePreview || transitionAnimationPreviewMode) && (ev.getActionMasked() == MotionEvent.ACTION_DOWN || ev.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN)) { return false; } // try { - return (!inPreviewMode || this != containerView) && super.dispatchTouchEvent(ev); + return (!passivePreview || this != containerView) && super.dispatchTouchEvent(ev); } catch (Throwable e) { FileLog.e(e); } @@ -261,7 +263,7 @@ public class ActionBarLayout extends FrameLayout { private boolean previewOpenAnimationInProgress; private ColorDrawable previewBackgroundDrawable; - private LayoutContainer containerView; + public LayoutContainer containerView; /* Contest: private -> public temp hack bc I don't know how to blur action bar otherwise */ private LayoutContainer containerViewBack; private DrawerLayoutContainer drawerLayoutContainer; private ActionBar currentActionBar; @@ -269,6 +271,9 @@ public class ActionBarLayout extends FrameLayout { private BaseFragment newFragment; private BaseFragment oldFragment; + /* Contest */ + private View previewMenu; + private AnimatorSet currentAnimation; private DecelerateInterpolator decelerateInterpolator = new DecelerateInterpolator(1.5f); private AccelerateDecelerateInterpolator accelerateDecelerateInterpolator = new AccelerateDecelerateInterpolator(); @@ -580,10 +585,12 @@ public class ActionBarLayout extends FrameLayout { if (view != null) { previewBackgroundDrawable.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight()); previewBackgroundDrawable.draw(canvas); - int x = (getMeasuredWidth() - AndroidUtilities.dp(24)) / 2; - int y = (int) (view.getTop() + containerView.getTranslationY() - AndroidUtilities.dp(12 + (Build.VERSION.SDK_INT < 21 ? 20 : 0))); - Theme.moveUpDrawable.setBounds(x, y, x + AndroidUtilities.dp(24), y + AndroidUtilities.dp(24)); - Theme.moveUpDrawable.draw(canvas); + if (previewMenu == null) { + int x = (getMeasuredWidth() - AndroidUtilities.dp(24)) / 2; + int y = (int) (view.getTop() + containerView.getTranslationY() - AndroidUtilities.dp(12 + (Build.VERSION.SDK_INT < 21 ? 20 : 0))); + Theme.moveUpDrawable.setBounds(x, y, x + AndroidUtilities.dp(24), y + AndroidUtilities.dp(24)); + Theme.moveUpDrawable.draw(canvas); + } } } @@ -941,15 +948,19 @@ public class ActionBarLayout extends FrameLayout { } public boolean presentFragmentAsPreview(BaseFragment fragment) { - return presentFragment(fragment, false, false, true, true); + return presentFragment(fragment, false, false, true, true, null); + } + + public boolean presentFragmentAsPreviewWithMenu(BaseFragment fragment, View menu) { + return presentFragment(fragment, false, false, true, true, menu); } public boolean presentFragment(BaseFragment fragment) { - return presentFragment(fragment, false, false, true, false); + return presentFragment(fragment, false, false, true, false, null); } public boolean presentFragment(BaseFragment fragment, boolean removeLast) { - return presentFragment(fragment, removeLast, false, true, false); + return presentFragment(fragment, removeLast, false, true, false, null); } private void startLayoutAnimation(final boolean open, final boolean first, final boolean preview) { @@ -1038,11 +1049,25 @@ public class ActionBarLayout extends FrameLayout { return inPreviewMode || transitionAnimationPreviewMode; } + public boolean isInPassivePreviewMode() { + return (inPreviewMode && previewMenu == null) || transitionAnimationPreviewMode; + } + + public boolean isInPreviewMenuMode() { + return isInPreviewMode() && previewMenu != null; + } + + public boolean presentFragment(final BaseFragment fragment, final boolean removeLast, boolean forceWithoutAnimation, boolean check, final boolean preview) { + return presentFragment(fragment, removeLast, forceWithoutAnimation, check, preview, null); + } + + public boolean presentFragment(final BaseFragment fragment, final boolean removeLast, boolean forceWithoutAnimation, boolean check, final boolean preview, View menu) { if (fragment == null || checkTransitionAnimation() || delegate != null && check && !delegate.needPresentFragment(fragment, removeLast, forceWithoutAnimation, this) || !fragment.onFragmentCreate()) { return false; } fragment.setInPreviewMode(preview); + fragment.setInMenuMode(menu != null); if (parentActivity.getCurrentFocus() != null && fragment.hideKeyboardOnShow() && !preview) { AndroidUtilities.hideKeyboard(parentActivity.getCurrentFocus()); } @@ -1061,8 +1086,20 @@ public class ActionBarLayout extends FrameLayout { parent.removeView(fragmentView); } } - containerViewBack.addView(fragmentView); - FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) fragmentView.getLayoutParams(); + View wrappedView = fragmentView; + containerViewBack.addView(wrappedView); + int menuHeight = 0; + if (menu != null) { + containerViewBack.addView(menu); + menu.measure(MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.AT_MOST)); + menuHeight = menu.getMeasuredHeight() + AndroidUtilities.dp(24); + FrameLayout.LayoutParams menuParams = (FrameLayout.LayoutParams) menu.getLayoutParams(); + menuParams.width = LayoutHelper.WRAP_CONTENT; + menuParams.height = LayoutHelper.WRAP_CONTENT; + menuParams.topMargin = getMeasuredHeight() - menuHeight - AndroidUtilities.dp(6); + menu.setLayoutParams(menuParams); + } + FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) wrappedView.getLayoutParams(); layoutParams.width = LayoutHelper.MATCH_PARENT; layoutParams.height = LayoutHelper.MATCH_PARENT; if (preview) { @@ -1072,14 +1109,17 @@ public class ActionBarLayout extends FrameLayout { layoutParams.height = height; layoutParams.topMargin = statusBarHeight + (getMeasuredHeight() - statusBarHeight - height) / 2; } else { - layoutParams.topMargin = layoutParams.bottomMargin = AndroidUtilities.dp(46); + layoutParams.topMargin = layoutParams.bottomMargin = AndroidUtilities.dp(menu != null ? 0 : 46); layoutParams.topMargin += AndroidUtilities.statusBarHeight; } + if (menu != null) { + layoutParams.bottomMargin += menuHeight + AndroidUtilities.dp(8); + } layoutParams.rightMargin = layoutParams.leftMargin = AndroidUtilities.dp(8); } else { layoutParams.topMargin = layoutParams.bottomMargin = layoutParams.rightMargin = layoutParams.leftMargin = 0; } - fragmentView.setLayoutParams(layoutParams); + wrappedView.setLayoutParams(layoutParams); if (fragment.actionBar != null && fragment.actionBar.shouldAddToContainer()) { if (removeActionBarExtraHeight) { fragment.actionBar.setOccupyStatusBar(false); @@ -1179,6 +1219,7 @@ public class ActionBarLayout extends FrameLayout { onOpenAnimationEndRunnable = () -> { if (preview) { inPreviewMode = true; + previewMenu = menu; transitionAnimationPreviewMode = false; containerView.setScaleX(1.0f); containerView.setScaleY(1.0f); @@ -1346,7 +1387,7 @@ public class ActionBarLayout extends FrameLayout { } public void movePreviewFragment(float dy) { - if (!inPreviewMode || transitionAnimationPreviewMode) { + if (!inPreviewMode || transitionAnimationPreviewMode || previewMenu != null) { return; } float currentTranslation = containerView.getTranslationY(); @@ -1486,10 +1527,21 @@ public class ActionBarLayout extends FrameLayout { layoutToIgnore = containerView; final BaseFragment previousFragmentFinal = previousFragment; onCloseAnimationEndRunnable = () -> { + if (previewMenu != null) { + ViewGroup parent = (ViewGroup) previewMenu.getParent(); + if (parent != null) { + //ViewGroup grandparent = (ViewGroup) parent.getParent(); + parent.removeView(previewMenu); + /*if (grandparent != null) { + grandparent.removeView(parent); + }*/ + } + } if (inPreviewMode || transitionAnimationPreviewMode) { containerViewBack.setScaleX(1.0f); containerViewBack.setScaleY(1.0f); inPreviewMode = false; + previewMenu = null; transitionAnimationPreviewMode = false; } else { containerViewBack.setTranslationX(0); @@ -2088,4 +2140,4 @@ public class ActionBarLayout extends FrameLayout { } } } -} +} \ No newline at end of file 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 fefac3a21..e3b25c574 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenuItem.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenuItem.java @@ -1593,6 +1593,23 @@ public class ActionBarMenuItem extends FrameLayout { } } + /** + * Hides this menu item if no subitems are available + */ + public void checkHideMenuItem() { + boolean isVisible = false; + for (int i = 0; i < popupLayout.getItemsCount(); i++) { + if (popupLayout.getItemAt(i).getVisibility() == VISIBLE) { + isVisible = true; + break; + } + } + int v = isVisible ? VISIBLE : GONE; + if (v != getVisibility()) { + setVisibility(v); + } + } + public void hideAllSubItems() { if (popupLayout == null) { return; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/AlertDialog.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/AlertDialog.java index e5982c48f..4685fb50a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/AlertDialog.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/AlertDialog.java @@ -88,6 +88,7 @@ public class AlertDialog extends Dialog implements Drawable.Callback { private int topResId; private View topView; private int topAnimationId; + private int topAnimationSize; private int topHeight = 132; private Drawable topDrawable; private int topBackgroundColor; @@ -138,6 +139,7 @@ public class AlertDialog extends Dialog implements Drawable.Callback { private float aspectRatio; private boolean dimEnabled = true; private final Theme.ResourcesProvider resourcesProvider; + private boolean topAnimationAutoRepeat = true; public static class AlertDialogCell extends FrameLayout { @@ -461,8 +463,8 @@ public class AlertDialog extends Dialog implements Drawable.Callback { } else if (topResId != 0) { topImageView.setImageResource(topResId); } else { - topImageView.setAutoRepeat(true); - topImageView.setAnimation(topAnimationId, 94, 94); + topImageView.setAutoRepeat(topAnimationAutoRepeat); + topImageView.setAnimation(topAnimationId, topAnimationSize, topAnimationSize); topImageView.playAnimation(); } topImageView.setScaleType(ImageView.ScaleType.CENTER); @@ -1059,7 +1061,11 @@ public class AlertDialog extends Dialog implements Drawable.Callback { } public void setTopAnimation(int resId, int backgroundColor) { + setTopAnimation(resId, 94, backgroundColor); + } + public void setTopAnimation(int resId, int size, int backgroundColor) { topAnimationId = resId; + topAnimationSize = size; topBackgroundColor = backgroundColor; } @@ -1273,11 +1279,16 @@ public class AlertDialog extends Dialog implements Drawable.Callback { return this; } - public Builder setTopAnimation(int resId, int backgroundColor) { + public Builder setTopAnimation(int resId, int size, boolean autoRepeat, int backgroundColor) { alertDialog.topAnimationId = resId; + alertDialog.topAnimationSize = size; + alertDialog.topAnimationAutoRepeat = autoRepeat; alertDialog.topBackgroundColor = backgroundColor; return this; } + public Builder setTopAnimation(int resId, int backgroundColor) { + return setTopAnimation(resId, 94, true, backgroundColor); + } public Builder setTopImage(Drawable drawable, int backgroundColor) { alertDialog.topDrawable = drawable; 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 cca31bc25..377108284 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java @@ -61,6 +61,7 @@ public abstract class BaseFragment { protected ActionBarLayout parentLayout; protected ActionBar actionBar; protected boolean inPreviewMode; + protected boolean inMenuMode; protected boolean inBubbleMode; protected int classGuid; protected Bundle arguments; @@ -122,6 +123,14 @@ public abstract class BaseFragment { return inBubbleMode; } + public boolean getInPreviewMode() { + return inPreviewMode; + } + + public boolean getInPassivePreviewMode() { + return parentLayout != null && parentLayout.isInPassivePreviewMode(); + } + protected void setInPreviewMode(boolean value) { inPreviewMode = value; if (actionBar != null) { @@ -133,6 +142,10 @@ public abstract class BaseFragment { } } + protected void setInMenuMode(boolean value) { + inMenuMode = value; + } + protected void onPreviewOpenAnimationEnd() { } @@ -361,19 +374,23 @@ public abstract class BaseFragment { } public boolean presentFragmentAsPreview(BaseFragment fragment) { - return parentLayout != null && parentLayout.presentFragmentAsPreview(fragment); + return allowPresentFragment() && parentLayout != null && parentLayout.presentFragmentAsPreview(fragment); + } + + public boolean presentFragmentAsPreviewWithMenu(BaseFragment fragment, View menu) { + return allowPresentFragment() && parentLayout != null && parentLayout.presentFragmentAsPreviewWithMenu(fragment, menu); } public boolean presentFragment(BaseFragment fragment) { - return parentLayout != null && parentLayout.presentFragment(fragment); + return allowPresentFragment() && parentLayout != null && parentLayout.presentFragment(fragment); } public boolean presentFragment(BaseFragment fragment, boolean removeLast) { - return parentLayout != null && parentLayout.presentFragment(fragment, removeLast); + return allowPresentFragment() && parentLayout != null && parentLayout.presentFragment(fragment, removeLast); } public boolean presentFragment(BaseFragment fragment, boolean removeLast, boolean forceWithoutAnimation) { - return parentLayout != null && parentLayout.presentFragment(fragment, removeLast, forceWithoutAnimation, true, false); + return allowPresentFragment() && parentLayout != null && parentLayout.presentFragment(fragment, removeLast, forceWithoutAnimation, true, false, null); } public Activity getParentActivity() { @@ -713,4 +730,9 @@ public abstract class BaseFragment { public Theme.ResourcesProvider getResourceProvider() { return null; } -} + + protected boolean allowPresentFragment() { + return true; + } + +} \ No newline at end of file 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 c55136a4a..adafad47e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheet.java @@ -165,6 +165,7 @@ public class BottomSheet extends Dialog { private ValueAnimator keyboardContentAnimator; protected boolean smoothKeyboardAnimationEnabled; + private boolean openNoDelay; protected class ContainerView extends FrameLayout implements NestedScrollingParent { @@ -1024,7 +1025,7 @@ public class BottomSheet extends Dialog { startAnimationRunnable = null; startOpenAnimation(); } - }, 150); + }, openNoDelay ? 0 : 150); } else { startOpenAnimation(); } @@ -1540,4 +1541,8 @@ public class BottomSheet extends Dialog { Integer color = resourcesProvider != null ? resourcesProvider.getColor(key) : null; return color != null ? color : Theme.getColor(key); } + + public void setOpenNoDelay(boolean openNoDelay) { + this.openNoDelay = openNoDelay; + } } 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 3801ad080..ab2c786d6 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/EmojiThemes.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/EmojiThemes.java @@ -7,8 +7,6 @@ import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import android.util.Pair; -import com.google.android.exoplayer2.util.Log; - import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.ApplicationLoader; import org.telegram.messenger.ChatThemeController; @@ -21,7 +19,6 @@ import org.telegram.messenger.SharedConfig; import org.telegram.messenger.Utilities; import org.telegram.tgnet.ResultCallback; import org.telegram.tgnet.TLRPC; -import org.telegram.ui.Components.ChatThemeBottomSheet; import java.io.File; import java.io.FileOutputStream; @@ -36,6 +33,17 @@ public class EmojiThemes { int currentIndex = 0; ArrayList items = new ArrayList<>(); + private static final String[] previewColorKeys = new String[]{ + Theme.key_chat_inBubble, + Theme.key_chat_outBubble, + Theme.key_featuredStickers_addButton, + Theme.key_chat_wallpaper, + Theme.key_chat_wallpaper_gradient_to1, + Theme.key_chat_wallpaper_gradient_to2, + Theme.key_chat_wallpaper_gradient_to3, + Theme.key_chat_wallpaper_gradient_rotation + }; + private EmojiThemes() { } @@ -98,8 +106,20 @@ public class EmojiThemes { Theme.ThemeInfo themeInfo = Theme.getTheme(lastDayCustomTheme); if (themeInfo == null) { lastDayCustomTheme = "Blue"; + dayAccentId = 99; + } else { + dayAccentId = themeInfo.currentAccentId; } preferences.edit().putString("lastDayCustomTheme", lastDayCustomTheme).apply(); + } else { + if (dayAccentId == -1) { + dayAccentId = Theme.getTheme(lastDayCustomTheme).lastAccentId; + } + } + + if (dayAccentId == -1) { + lastDayCustomTheme = "Blue"; + dayAccentId = 99; } String lastDarkCustomTheme = preferences.getString("lastDarkCustomTheme", null); @@ -109,10 +129,21 @@ public class EmojiThemes { Theme.ThemeInfo themeInfo = Theme.getTheme(lastDarkCustomTheme); if (themeInfo == null) { lastDarkCustomTheme = "Dark Blue"; + darkAccentId = 0; + } else { + darkAccentId = themeInfo.currentAccentId; } preferences.edit().putString("lastDarkCustomTheme", lastDarkCustomTheme).apply(); + } else { + if (darkAccentId == -1) { + darkAccentId = Theme.getTheme(lastDayCustomTheme).lastAccentId; + } } + if (darkAccentId == -1) { + lastDarkCustomTheme = "Dark Blue"; + darkAccentId = 0; + } ThemeItem lightTheme = new ThemeItem(); lightTheme.themeInfo = Theme.getTheme(lastDayCustomTheme); @@ -156,8 +187,8 @@ public class EmojiThemes { } public void initColors() { - getCurrentColors(0, 0); - getCurrentColors(0, 1); + getPreviewColors(0, 0); + getPreviewColors(0, 1); } public String getEmoticon() { @@ -184,8 +215,8 @@ public class EmojiThemes { return items.get(index).settingsIndex; } - public HashMap getCurrentColors(int currentAccount, int index) { - HashMap currentColors = items.get(index).currentColors; + public HashMap getPreviewColors(int currentAccount, int index) { + HashMap currentColors = items.get(index).currentPreviewColors; if (currentColors != null) { return currentColors; } @@ -215,9 +246,64 @@ public class EmojiThemes { items.get(index).wallpaperLink = wallpaperLink[0]; - currentColors = new HashMap<>(currentColorsNoAccent); if (accent != null) { + currentColors = new HashMap<>(currentColorsNoAccent); accent.fillAccentColors(currentColorsNoAccent, currentColors); + currentColorsNoAccent.clear(); + } else { + currentColors = currentColorsNoAccent; + } + + HashMap fallbackKeys = Theme.getFallbackKeys(); + items.get(index).currentPreviewColors = new HashMap<>(); + for (int i = 0; i < previewColorKeys.length; i++) { + String key = previewColorKeys[i]; + items.get(index).currentPreviewColors.put(key, currentColors.get(key)); + + if (!items.get(index).currentPreviewColors.containsKey(key)) { + Integer color = currentColors.get(fallbackKeys.get(key)); + currentColors.put(key, color); + } + } + currentColors.clear(); + + return items.get(index).currentPreviewColors; + } + + public HashMap createColors(int currentAccount, int index) { + HashMap currentColors; + + Theme.ThemeInfo themeInfo = getThemeInfo(index); + Theme.ThemeAccent accent = null; + if (themeInfo == null) { + int settingsIndex = getSettingsIndex(index); + TLRPC.TL_theme tlTheme = getTlTheme(index); + Theme.ThemeInfo baseTheme = Theme.getTheme(Theme.getBaseThemeKey(tlTheme.settings.get(settingsIndex))); + themeInfo = new Theme.ThemeInfo(baseTheme); + accent = themeInfo.createNewAccent(tlTheme, currentAccount, true, settingsIndex); + themeInfo.setCurrentAccentId(accent.id); + } else { + if (themeInfo.themeAccentsMap != null) { + accent = themeInfo.themeAccentsMap.get(items.get(index).accentId); + } + } + + HashMap currentColorsNoAccent = new HashMap<>(); + String[] wallpaperLink = new String[1]; + if (themeInfo.pathToFile != null) { + currentColorsNoAccent.putAll(Theme.getThemeFileValues(new File(themeInfo.pathToFile), null, wallpaperLink)); + } else if (themeInfo.assetName != null) { + currentColorsNoAccent.putAll(Theme.getThemeFileValues(null, themeInfo.assetName, wallpaperLink)); + } + + items.get(index).wallpaperLink = wallpaperLink[0]; + + if (accent != null) { + currentColors = new HashMap<>(currentColorsNoAccent); + accent.fillAccentColors(currentColorsNoAccent, currentColors); + currentColorsNoAccent.clear(); + } else { + currentColors = currentColorsNoAccent; } HashMap fallbackKeys = Theme.getFallbackKeys(); @@ -234,7 +320,6 @@ public class EmojiThemes { currentColors.put(entry.getKey(), entry.getValue()); } } - items.get(index).currentColors = currentColors; return currentColors; } @@ -313,6 +398,12 @@ public class EmojiThemes { return; } + if (wallpaper.document == null) { + if (callback != null) { + callback.onComplete(new Pair<>(themeId, null)); + } + return; + } final TLRPC.PhotoSize thumbSize = FileLoader.getClosestPhotoSizeWithSize(wallpaper.document.thumbs, 120); ImageLocation imageLocation = ImageLocation.getForDocument(thumbSize, wallpaper.document); ImageReceiver imageReceiver = new ImageReceiver(); @@ -379,7 +470,7 @@ public class EmojiThemes { } } - public static HashMap getCurrentColors(Theme.ThemeInfo themeInfo) { + public static HashMap getPreviewColors(Theme.ThemeInfo themeInfo) { HashMap currentColorsNoAccent = new HashMap<>(); if (themeInfo.pathToFile != null) { currentColorsNoAccent.putAll(Theme.getThemeFileValues(new File(themeInfo.pathToFile), null, null)); @@ -403,7 +494,7 @@ public class EmojiThemes { if (items.get(i) == null) { continue; } - HashMap colorsMap = getCurrentColors(currentAccount, i); + HashMap colorsMap = getPreviewColors(currentAccount, i); Integer color = colorsMap.get(Theme.key_chat_inBubble); if (color == null) { color = Theme.getDefaultColor(Theme.key_chat_inBubble); @@ -443,6 +534,12 @@ public class EmojiThemes { } else { items.get(i).patternBgGradientColor3 = color; } + color = colorsMap.get(Theme.key_chat_wallpaper_gradient_rotation); + if (color == null) { + items.get(i).patternBgRotation = 0; + } else { + items.get(i).patternBgRotation = color; + } if (items.get(i).themeInfo != null && items.get(i).themeInfo.getKey().equals("Blue")) { int accentId = items.get(i).accentId >= 0 ? items.get(i).accentId : items.get(i).themeInfo.currentAccentId; if (accentId == 99) { @@ -490,13 +587,14 @@ public class EmojiThemes { .putInt(accentKey, accentId) .apply(); } + public static class ThemeItem { public Theme.ThemeInfo themeInfo; TLRPC.TL_theme tlTheme; int settingsIndex; public int accentId = -1; - public HashMap currentColors; + public HashMap currentPreviewColors; private String wallpaperLink; public int inBubbleColor; @@ -506,5 +604,6 @@ public class EmojiThemes { public int patternBgGradientColor1; public int patternBgGradientColor2; public int patternBgGradientColor3; + public int patternBgRotation; } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/MenuDrawable.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/MenuDrawable.java index ca1a0a1a1..2b9d63c66 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/MenuDrawable.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/MenuDrawable.java @@ -52,6 +52,8 @@ public class MenuDrawable extends Drawable { public static int TYPE_UDPATE_AVAILABLE = 1; public static int TYPE_UDPATE_DOWNLOADING = 2; + private int alpha = 255; + public MenuDrawable() { this(TYPE_DEFAULT); } @@ -71,6 +73,10 @@ public class MenuDrawable extends Drawable { rotateToBack = value; } + public float getCurrentRotation() { + return currentRotation; + } + public void setRotation(float rotation, boolean animated) { lastFrameTime = 0; if (currentRotation == 1) { @@ -164,6 +170,7 @@ public class MenuDrawable extends Drawable { if (rotateToBack) { canvas.rotate(currentRotation * (reverseAngle ? -180 : 180), AndroidUtilities.dp(9), 0); paint.setColor(color1); + paint.setAlpha(alpha); canvas.drawLine(0, 0, AndroidUtilities.dp(18) - AndroidUtilities.dp(3.0f) * currentRotation - diffMiddle, 0, paint); endYDiff = AndroidUtilities.dp(5) * (1 - Math.abs(currentRotation)) - AndroidUtilities.dp(0.5f) * Math.abs(currentRotation); endXDiff = AndroidUtilities.dp(18) - AndroidUtilities.dp(2.5f) * Math.abs(currentRotation); @@ -173,6 +180,7 @@ public class MenuDrawable extends Drawable { canvas.rotate(currentRotation * (reverseAngle ? -225 : 135), AndroidUtilities.dp(9), 0); if (miniIcon) { paint.setColor(color1); + paint.setAlpha(alpha); canvas.drawLine(AndroidUtilities.dpf2(2) * (1 - Math.abs(currentRotation)) + AndroidUtilities.dp(1) * currentRotation, 0, AndroidUtilities.dpf2(16) * (1f - currentRotation) + AndroidUtilities.dp(17) * currentRotation - diffMiddle, 0, paint); endYDiff = AndroidUtilities.dpf2(5) * (1 - Math.abs(currentRotation)) - AndroidUtilities.dpf2(0.5f) * Math.abs(currentRotation); endXDiff = AndroidUtilities.dpf2(16) * (1 - Math.abs(currentRotation)) + (AndroidUtilities.dpf2(9)) * Math.abs(currentRotation); @@ -184,6 +192,7 @@ public class MenuDrawable extends Drawable { int backColor2 = Theme.getColor(Theme.key_actionBarActionModeDefault); backColor1 = AndroidUtilities.getOffsetColor(backColor1, backColor2, currentRotation, 1.0f); paint.setColor(AndroidUtilities.getOffsetColor(color1, color2, currentRotation, 1.0f)); + paint.setAlpha(alpha); canvas.drawLine(AndroidUtilities.dp(1) * currentRotation, 0, AndroidUtilities.dp(18) - AndroidUtilities.dp(1) * currentRotation - diffMiddle, 0, paint); endYDiff = AndroidUtilities.dp(5) * (1 - Math.abs(currentRotation)) - AndroidUtilities.dp(0.5f) * Math.abs(currentRotation); endXDiff = AndroidUtilities.dp(18) - AndroidUtilities.dp(9) * Math.abs(currentRotation); @@ -207,13 +216,14 @@ public class MenuDrawable extends Drawable { rad *= (1.0f - typeAnimationProgress); } backPaint.setColor(backColor1); + backPaint.setAlpha(alpha); canvas.drawCircle(cx, cy, rad, paint); if (type == TYPE_UDPATE_AVAILABLE || previousType == TYPE_UDPATE_AVAILABLE) { backPaint.setStrokeWidth(AndroidUtilities.density * 1.66f); if (previousType == TYPE_UDPATE_AVAILABLE) { - backPaint.setAlpha((int) (255 * (1.0f - typeAnimationProgress))); + backPaint.setAlpha((int) (alpha * (1.0f - typeAnimationProgress))); } else { - backPaint.setAlpha(255); + backPaint.setAlpha(alpha); } canvas.drawLine(cx, cy - AndroidUtilities.dp(2), cx, cy, backPaint); canvas.drawPoint(cx, cy + AndroidUtilities.dp(2.5f), backPaint); @@ -221,9 +231,9 @@ public class MenuDrawable extends Drawable { if (type == TYPE_UDPATE_DOWNLOADING || previousType == TYPE_UDPATE_DOWNLOADING) { backPaint.setStrokeWidth(AndroidUtilities.dp(2)); if (previousType == TYPE_UDPATE_DOWNLOADING) { - backPaint.setAlpha((int) (255 * (1.0f - typeAnimationProgress))); + backPaint.setAlpha((int) (alpha * (1.0f - typeAnimationProgress))); } else { - backPaint.setAlpha(255); + backPaint.setAlpha(alpha); } float arcRad = Math.max(4, 360 * animatedDownloadProgress); rect.set(cx - AndroidUtilities.dp(3), cy - AndroidUtilities.dp(3), cx + AndroidUtilities.dp(3), cy + AndroidUtilities.dp(3)); @@ -266,7 +276,12 @@ public class MenuDrawable extends Drawable { @Override public void setAlpha(int alpha) { - + if (this.alpha != alpha) { + this.alpha = alpha; + paint.setAlpha(alpha); + backPaint.setAlpha(alpha); + invalidateSelf(); + } } @Override 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 750bd1ee0..fd875e8fe 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java @@ -67,7 +67,6 @@ import org.telegram.messenger.ApplicationLoader; import org.telegram.messenger.Bitmaps; import org.telegram.messenger.BuildVars; import org.telegram.messenger.ChatThemeController; -import org.telegram.messenger.Emoji; import org.telegram.messenger.FileLoader; import org.telegram.messenger.FileLog; import org.telegram.messenger.ImageLocation; @@ -120,7 +119,6 @@ import java.util.Calendar; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Locale; import java.util.Map; import java.util.concurrent.CountDownLatch; @@ -207,6 +205,7 @@ public class Theme { private Shader crosfadeFromBitmapShader; PathDrawParams pathDrawCacheParams; + private int overrideRoundRadius; public MessageDrawable(int type, boolean out, boolean selected) { this(type, out, selected, null); @@ -658,7 +657,10 @@ public class Theme { int padding = dp(2); int rad; int nearRad; - if (currentType == TYPE_PREVIEW) { + if (overrideRoundRadius != 0) { + rad = overrideRoundRadius; + nearRad = overrideRoundRadius; + } else if (currentType == TYPE_PREVIEW) { rad = dp(6); nearRad = dp(6); } else { @@ -866,6 +868,10 @@ public class Theme { } } + public void setRoundRadius(int radius) { + this.overrideRoundRadius = radius; + } + public static class PathDrawParams { Path path = new Path(); Rect lastRect = new Rect(); @@ -1519,7 +1525,7 @@ public class Theme { if (id < 100) { return !TextUtils.isEmpty(patternSlug) ? new File(ApplicationLoader.getFilesDirFixed(), String.format(Locale.US, "%s_%d_%s_v5.jpg", parentTheme.getKey(), id, patternSlug)) : null; } else { - return !TextUtils.isEmpty(patternSlug) ? new File(ApplicationLoader.getFilesDirFixed(), String.format(Locale.US, "%s_%d_%s_v8_dubug.jpg", parentTheme.getKey(), id, patternSlug)) : null; + return !TextUtils.isEmpty(patternSlug) ? new File(ApplicationLoader.getFilesDirFixed(), String.format(Locale.US, "%s_%d_%s_v8_debug.jpg", parentTheme.getKey(), id, patternSlug)) : null; } } @@ -2140,6 +2146,9 @@ public class Theme { for (int a = 0; a < accent.length; a++) { ThemeAccent themeAccent = new ThemeAccent(); themeAccent.id = ids != null ? ids[a] : a; + if (isHome(themeAccent)) { + themeAccent.isDefault = true; + } themeAccent.accentColor = accent[a]; themeAccent.parentTheme = this; if (myMessages != null) { @@ -2356,6 +2365,7 @@ public class Theme { themeAccent.account = account; themeAccentsMap.put(id, themeAccent); themeAccents.add(0, themeAccent); + sortAccents(this); accentsByThemeId.put(info.id, themeAccent); return themeAccent; } @@ -2393,6 +2403,7 @@ public class Theme { overrideWallpaper = themeAccent.overrideWallpaper; themeAccentsMap.put(id, themeAccent); themeAccents.add(0, themeAccent); + sortAccents(this); return themeAccent; } else { return accent; @@ -4839,6 +4850,7 @@ public class Theme { new int[] { 0, 180, 45, 0, 45, 180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, new int[] { 0, 52, 46, 57, 45, 64, 52, 35, 36, 41, 50, 50, 35, 38, 37, 30 } ); + sortAccents(themeInfo); themes.add(currentDayTheme = currentTheme = defaultTheme = themeInfo); themesDict.put("Blue", themeInfo); @@ -4862,6 +4874,7 @@ public class Theme { new int[] { 225, 45, 225, 135, 45, 225, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, new int[] { 40, 40, 31, 50, 25, 34, 35, 35, 38, 29, 24, 34, 34, 31, 29, 37, 21, 38 } ); + sortAccents(themeInfo); themes.add(themeInfo); themesDict.put("Dark Blue", currentNightTheme = themeInfo); @@ -4885,6 +4898,7 @@ public class Theme { new int[] { 315, 315, 225, 315, 0, 180, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, new int[] { 50, 50, 58, 47, 46, 50, 49, 46, 51, 50, 49, 34, 54, 50, 40 } ); + sortAccents(themeInfo); themes.add(themeInfo); themesDict.put("Arctic Blue", themeInfo); @@ -4908,6 +4922,7 @@ public class Theme { new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } ); + sortAccents(themeInfo); themes.add(themeInfo); themesDict.put("Day", themeInfo); @@ -4931,15 +4946,21 @@ public class Theme { new int[] { 45, 135, 0, 180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, new int[] { 34, 47, 52, 48, 54, 50, 37, 56, 48, 49, 40, 64, 38, 48 } ); + sortAccents(themeInfo); themes.add(themeInfo); themesDict.put("Night", themeInfo); String themesString = themeConfig.getString("themes2", null); - for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) { - remoteThemesHash[a] = themeConfig.getLong("2remoteThemesHash" + (a != 0 ? a : ""), 0); - lastLoadingThemesTime[a] = themeConfig.getInt("lastLoadingThemesTime" + (a != 0 ? a : ""), 0); + int remoteVersion = themeConfig.getInt("remote_version", 0); + int appRemoteThemesVersion = 1; + if (remoteVersion == appRemoteThemesVersion) { + for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) { + remoteThemesHash[a] = themeConfig.getLong("2remoteThemesHash" + (a != 0 ? a : ""), 0); + lastLoadingThemesTime[a] = themeConfig.getInt("lastLoadingThemesTime" + (a != 0 ? a : ""), 0); + } } + themeConfig.edit().putInt("remote_version", appRemoteThemesVersion).apply(); if (!TextUtils.isEmpty(themesString)) { try { JSONArray jsonArray = new JSONArray(themesString); @@ -5150,15 +5171,8 @@ public class Theme { } } if (!newAccents.isEmpty()) { - Collections.sort(newAccents, (o1, o2) -> { - if (o1.id > o2.id) { - return -1; - } else if (o1.id < o2.id) { - return 1; - } - return 0; - }); info.themeAccents.addAll(0, newAccents); + sortAccents(info); } if (info.themeAccentsMap != null && info.themeAccentsMap.get(info.currentAccentId) == null) { info.currentAccentId = info.firstAccentIsDefault ? DEFALT_THEME_ACCENT_ID : 0; @@ -5252,7 +5266,10 @@ public class Theme { SerializedData serializedData = new SerializedData(Utilities.hexToBytes(value)); try { TLRPC.TL_theme theme = TLRPC.Theme.TLdeserialize(serializedData, serializedData.readInt32(true), true); - previewItems.add(new ChatThemeBottomSheet.ChatThemeItem(EmojiThemes.createPreviewFullTheme(theme))); + EmojiThemes fullTheme = EmojiThemes.createPreviewFullTheme(theme); + if (fullTheme.items.size() >= 4) { + previewItems.add(new ChatThemeBottomSheet.ChatThemeItem(fullTheme)); + } ChatThemeController.chatThemeQueue.postRunnable(new Runnable() { @Override @@ -5263,7 +5280,6 @@ public class Theme { AndroidUtilities.runOnUIThread(() -> { defaultEmojiThemes.clear(); defaultEmojiThemes.addAll(previewItems); - NotificationCenter.getInstance(0).postNotificationName(NotificationCenter.emojiPreviewThemesChanged); }); } }); @@ -5273,6 +5289,42 @@ public class Theme { } } + private static void sortAccents(ThemeInfo info) { + Collections.sort(info.themeAccents, (o1, o2) -> { + if (isHome(o1)) { + return -1; + } + if (isHome(o2)) { + return 1; + } + int i1 = o1.isDefault ? 1 : 0; + int i2 = o2.isDefault ? 1 : 0; + + if (i1 == i2) { + if (o1.isDefault) { + if (o1.id > o2.id) { + return 1; + } else if (o1.id < o2.id) { + return -1; + } + } else { + if (o1.id > o2.id) { + return -1; + } else if (o1.id < o2.id) { + return 1; + } + } + } else { + if (i1 > i2) { + return -1; + } else { + return 1; + } + } + return 0; + }); + } + private static Method StateListDrawable_getStateDrawableMethod; private static Field BitmapDrawable_mColorFilter; @@ -7112,7 +7164,7 @@ public class Theme { } public static void loadRemoteThemes(final int currentAccount, boolean force) { - if (loadingRemoteThemes[currentAccount]) { + if (loadingRemoteThemes[currentAccount] || !force && Math.abs(System.currentTimeMillis() / 1000 - lastLoadingThemesTime[currentAccount]) < 60 * 60 || !UserConfig.getInstance(currentAccount).isClientActivated()) { return; } loadingRemoteThemes[currentAccount] = true; @@ -7143,15 +7195,13 @@ public class Theme { boolean loadPatterns = false; boolean added = false; for (int a = 0, N = res.themes.size(); a < N; a++) { - TLRPC.Theme t = res.themes.get(a); + TLRPC.TL_theme t = res.themes.get(a); if (!(t instanceof TLRPC.TL_theme)) { continue; } - TLRPC.TL_theme theme = (TLRPC.TL_theme) t; + TLRPC.TL_theme theme = t; if (theme.isDefault) { - //TODO new emoji themes - continue; - //emojiPreviewThemes.add(theme); + emojiPreviewThemes.add(theme); } if (theme.settings != null && theme.settings.size() > 0) { for (int i = 0; i < theme.settings.size(); i++) { @@ -7183,7 +7233,7 @@ public class Theme { accent.patternMotion = settings.wallpaper != null && settings.wallpaper.settings != null && settings.wallpaper.settings.motion; oldServerThemes.remove(accent); } else { - accent = info.createNewAccent(theme, currentAccount); + accent = info.createNewAccent(theme, currentAccount, false, i); if (!TextUtils.isEmpty(accent.patternSlug)) { loadPatterns = true; } @@ -7262,7 +7312,6 @@ public class Theme { SerializedData data = new SerializedData(tlChatTheme.getObjectSize()); tlChatTheme.serializeToStream(data); editor.putString("theme_" + i, Utilities.bytesToHex(data.toByteArray())); - EmojiThemes chatTheme = new EmojiThemes(tlChatTheme, false); } editor.apply(); @@ -7273,7 +7322,9 @@ public class Theme { TLRPC.TL_theme theme = emojiPreviewThemes.get(i); EmojiThemes chatTheme = EmojiThemes.createPreviewFullTheme(theme); ChatThemeBottomSheet.ChatThemeItem item = new ChatThemeBottomSheet.ChatThemeItem(chatTheme); - previewItems.add(item); + if (chatTheme.items.size() >= 4) { + previewItems.add(item); + } } ChatThemeController.chatThemeQueue.postRunnable(new Runnable() { @Override @@ -7284,13 +7335,13 @@ public class Theme { AndroidUtilities.runOnUIThread(() -> { defaultEmojiThemes.clear(); defaultEmojiThemes.addAll(previewItems); - NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.emojiPreviewThemesChanged); + NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.emojiPreviewThemesChanged); }); } }); } else { defaultEmojiThemes.clear(); - NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.emojiPreviewThemesChanged); + NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.emojiPreviewThemesChanged); } } @@ -9438,6 +9489,7 @@ public class Theme { Integer gradientToColor2 = currentColors.get(key_chat_wallpaper_gradient_to2); gradientToColor2 = currentColors.get(key_chat_wallpaper_gradient_to2); Integer gradientToColor1 = currentColors.get(key_chat_wallpaper_gradient_to1); + if (wallpaperFile != null && wallpaperFile.exists()) { try { if (backgroundColor != null && gradientToColor1 != null && gradientToColor2 != null) { @@ -9972,4 +10024,19 @@ public class Theme { public static boolean isCurrentThemeDay() { return !getActiveTheme().isDark(); } + + public static boolean isHome(ThemeAccent accent) { + if (accent.parentTheme != null) { + if (accent.parentTheme.getKey().equals("Blue") && accent.id == 99) { + return true; + } + if (accent.parentTheme.getKey().equals("Day") && accent.id == 9) { + return true; + } + if ((accent.parentTheme.getKey().equals("Night") || accent.parentTheme.getKey().equals("Dark Blue")) && accent.id == 0) { + return true; + } + } + return false; + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionIntroActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionIntroActivity.java index caf0a1ab9..d4ad964f9 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionIntroActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionIntroActivity.java @@ -80,6 +80,7 @@ public class ActionIntroActivity extends BaseFragment implements LocationControl private String currentGroupCreateAddress; private String currentGroupCreateDisplayAddress; private Location currentGroupCreateLocation; + private boolean showingAsBottomSheet; private ActionIntroQRLoginDelegate qrLoginDelegate; @@ -103,23 +104,26 @@ public class ActionIntroActivity extends BaseFragment implements LocationControl @Override public View createView(Context context) { - actionBar.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); - actionBar.setBackButtonImage(R.drawable.ic_ab_back); - actionBar.setItemsColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2), false); - actionBar.setItemsBackgroundColor(Theme.getColor(Theme.key_actionBarWhiteSelector), false); - actionBar.setCastShadows(false); - actionBar.setAddToContainer(false); - if (!AndroidUtilities.isTablet()) { - actionBar.showActionModeTop(); - } - actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() { - @Override - public void onItemClick(int id) { - if (id == -1) { - finishFragment(); - } + if (actionBar != null) { + actionBar.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); + + actionBar.setBackButtonImage(R.drawable.ic_ab_back); + actionBar.setItemsColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2), false); + actionBar.setItemsBackgroundColor(Theme.getColor(Theme.key_actionBarWhiteSelector), false); + actionBar.setCastShadows(false); + actionBar.setAddToContainer(false); + if (!AndroidUtilities.isTablet()) { + actionBar.showActionModeTop(); } - }); + actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() { + @Override + public void onItemClick(int id) { + if (id == -1) { + finishFragment(); + } + } + }); + } fragmentView = new ViewGroup(context) { @@ -128,8 +132,9 @@ public class ActionIntroActivity extends BaseFragment implements LocationControl int width = MeasureSpec.getSize(widthMeasureSpec); int height = MeasureSpec.getSize(heightMeasureSpec); - actionBar.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), heightMeasureSpec); - + if (actionBar != null) { + actionBar.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), heightMeasureSpec); + } switch (currentType) { case ACTION_TYPE_CHANNEL_CREATE: { if (width > height) { @@ -146,7 +151,13 @@ public class ActionIntroActivity extends BaseFragment implements LocationControl break; } case ACTION_TYPE_QR_LOGIN: { - if (width > height) { + if (showingAsBottomSheet) { + imageView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec((int) (height * 0.32f), MeasureSpec.EXACTLY)); + titleTextView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(height, MeasureSpec.UNSPECIFIED)); + descriptionLayout.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(height, MeasureSpec.UNSPECIFIED)); + buttonTextView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(42), MeasureSpec.EXACTLY)); + height = imageView.getMeasuredHeight() + titleTextView.getMeasuredHeight() + AndroidUtilities.dp(20) + titleTextView.getMeasuredHeight() + descriptionLayout.getMeasuredHeight() + buttonTextView.getMeasuredHeight(); + } else if (width > height) { imageView.measure(MeasureSpec.makeMeasureSpec((int) (width * 0.45f), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec((int) (height * 0.68f), MeasureSpec.EXACTLY)); titleTextView.measure(MeasureSpec.makeMeasureSpec((int) (width * 0.6f), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(height, MeasureSpec.UNSPECIFIED)); descriptionLayout.measure(MeasureSpec.makeMeasureSpec((int) (width * 0.6f), MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(height, MeasureSpec.UNSPECIFIED)); @@ -214,7 +225,9 @@ public class ActionIntroActivity extends BaseFragment implements LocationControl @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { - actionBar.layout(0, 0, r, actionBar.getMeasuredHeight()); + if (actionBar != null) { + actionBar.layout(0, 0, r, actionBar.getMeasuredHeight()); + } int width = r - l; int height = b - t; @@ -247,7 +260,21 @@ public class ActionIntroActivity extends BaseFragment implements LocationControl break; } case ACTION_TYPE_QR_LOGIN: { - if (r > b) { + if (showingAsBottomSheet) { + int y; + + y = 0; + imageView.layout(0, y, imageView.getMeasuredWidth(), y + imageView.getMeasuredHeight()); + y = (int) (height * 0.403f); + titleTextView.layout(0, y, titleTextView.getMeasuredWidth(), y + titleTextView.getMeasuredHeight()); + y = (int) (height * 0.631f); + + int x = (getMeasuredWidth() - descriptionLayout.getMeasuredWidth()) / 2; + descriptionLayout.layout(x, y, x + descriptionLayout.getMeasuredWidth(), y + descriptionLayout.getMeasuredHeight()); + x = (width - buttonTextView.getMeasuredWidth()) / 2; + y = (int) (height * 0.853f); + buttonTextView.layout(x, y, x + buttonTextView.getMeasuredWidth(), y + buttonTextView.getMeasuredHeight()); + } else if (r > b) { int y = (height - imageView.getMeasuredHeight()) / 2; imageView.layout(0, y, imageView.getMeasuredWidth(), y + imageView.getMeasuredHeight()); int x = (int) (width * 0.4f); @@ -383,7 +410,9 @@ public class ActionIntroActivity extends BaseFragment implements LocationControl ViewGroup viewGroup = (ViewGroup) fragmentView; viewGroup.setOnTouchListener((v, event) -> true); - viewGroup.addView(actionBar); + if (actionBar != null) { + viewGroup.addView(actionBar); + } imageView = new RLottieImageView(context); viewGroup.addView(imageView); @@ -796,7 +825,7 @@ public class ActionIntroActivity extends BaseFragment implements LocationControl } private void processOpenQrReader() { - CameraScanActivity.showAsSheet(this, false, new CameraScanActivity.CameraScanActivityDelegate() { + CameraScanActivity.showAsSheet(this, false, CameraScanActivity.TYPE_QR, new CameraScanActivity.CameraScanActivityDelegate() { @Override public void didFindQr(String text) { finishFragment(false); @@ -809,6 +838,10 @@ public class ActionIntroActivity extends BaseFragment implements LocationControl return currentType; } + public void setShowingAsBottomSheet(boolean showingAsBottomSheet) { + this.showingAsBottomSheet = showingAsBottomSheet; + } + @Override public ArrayList getThemeDescriptions() { ArrayList themeDescriptions = new ArrayList<>(); @@ -817,9 +850,11 @@ public class ActionIntroActivity extends BaseFragment implements LocationControl themeDescriptions.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_BACKGROUND, null, null, null, delegate, Theme.key_windowBackgroundWhite)); - themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite)); - themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText2)); - themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarWhiteSelector)); + if (actionBar != null) { + themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite)); + themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText2)); + themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarWhiteSelector)); + } themeDescriptions.add(new ThemeDescription(titleTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, delegate, Theme.key_windowBackgroundWhiteBlackText)); themeDescriptions.add(new ThemeDescription(subtitleTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/CacheControlActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/CacheControlActivity.java index 4d5b90e16..cca5ae1d6 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/CacheControlActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/CacheControlActivity.java @@ -10,10 +10,13 @@ package org.telegram.ui; import android.content.Context; import android.content.DialogInterface; +import android.content.Intent; import android.content.SharedPreferences; +import android.net.Uri; import android.os.Build; import android.os.Environment; import android.os.StatFs; +import android.provider.Settings; import android.text.TextUtils; import android.transition.ChangeBounds; import android.transition.Fade; @@ -22,18 +25,25 @@ 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; import android.widget.TextView; +import androidx.annotation.RequiresApi; import androidx.core.widget.NestedScrollView; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import com.google.android.exoplayer2.util.Log; + import org.telegram.SQLite.SQLiteCursor; import org.telegram.SQLite.SQLiteDatabase; import org.telegram.SQLite.SQLitePreparedStatement; import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.ApplicationLoader; +import org.telegram.messenger.BuildConfig; +import org.telegram.messenger.BuildVars; import org.telegram.messenger.DialogObject; import org.telegram.messenger.FileLoader; import org.telegram.messenger.FileLog; @@ -69,7 +79,11 @@ 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; public class CacheControlActivity extends BaseFragment { @@ -99,10 +113,12 @@ public class CacheControlActivity extends BaseFragment { private long totalSize = -1; private long totalDeviceSize = -1; private long totalDeviceFreeSize = -1; + private long migrateOldFolderRow = -1; private StorageDiagramView.ClearViewData[] clearViewData = new StorageDiagramView.ClearViewData[7]; private boolean calculating = true; private volatile boolean canceled = false; + private boolean hasOldFolder; private View bottomSheetView; private BottomSheet bottomSheet; @@ -116,18 +132,6 @@ public class CacheControlActivity extends BaseFragment { public boolean onFragmentCreate() { super.onFragmentCreate(); - rowCount = 0; - - keepMediaHeaderRow = rowCount++; - keepMediaChooserRow = rowCount++; - keepMediaInfoRow = rowCount++; - deviseStorageHeaderRow = rowCount++; - storageUsageRow = rowCount++; - - cacheInfoRow = rowCount++; - databaseRow = rowCount++; - databaseInfoRow = rowCount++; - databaseSize = MessagesStorage.getInstance(currentAccount).getDatabaseSize(); Utilities.globalQueue.postRunnable(() -> { @@ -209,9 +213,45 @@ 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; } + private void updateRows() { + rowCount = 0; + + keepMediaHeaderRow = rowCount++; + keepMediaChooserRow = rowCount++; + keepMediaInfoRow = rowCount++; + deviseStorageHeaderRow = rowCount++; + storageUsageRow = rowCount++; + + cacheInfoRow = rowCount++; + databaseRow = rowCount++; + databaseInfoRow = rowCount++; +// if (hasOldFolder) { +// migrateOldFolderRow = rowCount++; +// } + } + private void updateStorageUsageRow() { View view = layoutManager.findViewByPosition(storageUsageRow); if (view instanceof StroageUsageView) { @@ -406,7 +446,9 @@ public class CacheControlActivity extends BaseFragment { if (getParentActivity() == null) { return; } - if (position == databaseRow) { + if (position == migrateOldFolderRow) { + migrateOldFolder(); + } else if (position == databaseRow) { clearDatabase(); } else if (position == storageUsageRow) { if (totalSize <= 0 || getParentActivity() == null) { @@ -525,6 +567,115 @@ public class CacheControlActivity extends BaseFragment { return fragmentView; } + @RequiresApi(api = Build.VERSION_CODES.R) + private void migrateOldFolder() { + boolean isExternalStorageManager = Environment.isExternalStorageManager(); + + if (!BuildVars.NO_SCOPED_STORAGE && !isExternalStorageManager) { + AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); + builder.setTitle(LocaleController.getString("MigrateOldFolder", R.string.MigrateOldFolder)); + builder.setMessage(LocaleController.getString("ManageAllFilesRational2", R.string.ManageAllFilesRational2)); + builder.setPositiveButton(LocaleController.getString("Allow", R.string.Allow), (i1, i2) -> { + Uri uri = Uri.parse("package:" + BuildConfig.APPLICATION_ID); + getParentActivity().startActivity(new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION, uri)); + }); + builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), (i1, i2) -> { + + }); + builder.show(); + return; + } + + Thread thread = new Thread() { + + int totalFilesCount; + int movedFilesCount; + @Override + public void run() { + super.run(); + 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 newPath = ApplicationLoader.applicationContext.getExternalFilesDir(null); + File telegramPath = new File(newPath, "Telegram"); + File oldPath = new File(path, "Telegram"); + + totalFilesCount = getFilesCount(oldPath); + + long moveStart = System.currentTimeMillis(); + moveDirectory(oldPath, telegramPath); + long dt = System.currentTimeMillis() - moveStart; + FileLog.d("move time = " + dt); + } + + private int getFilesCount(File source) { + if (!source.exists()) { + return 0; + } + int count = 0; + File[] fileList = source.listFiles(); + for (int i = 0; i < fileList.length; i++) { + if (fileList[i].isDirectory()) { + count += getFilesCount(fileList[i]); + } else { + count++; + } + } + return count; + } + + private void moveDirectory(File source, File target) { + if (!source.exists() || (!target.exists() && !target.mkdir())) { + return; + } + try (Stream files = Files.list(source.toPath())) { + files.forEach(path -> { + File dest = new File(target, path.getFileName().toString()); + if (Files.isDirectory(path)) { + moveDirectory(path.toFile(), dest); + } else { + try { + Files.move(path, dest.toPath()); + } catch (Exception e) { + FileLog.e(e); + try { + path.toFile().delete(); + } catch (Exception e1) { + FileLog.e(e1); + } + } + movedFilesCount++; + updateProgress(); + } + }); + } catch (Exception e) { + FileLog.e(e); + } + try { + source.delete(); + } catch (Exception e) { + FileLog.e(e); + } + } + + private void updateProgress() { + float p = movedFilesCount / (float) totalFilesCount; + } + }; + thread.start(); + } + private void clearDatabase() { AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setTitle(LocaleController.getString("LocalDatabaseClearTextTitle", R.string.LocalDatabaseClearTextTitle)); @@ -657,7 +808,7 @@ public class CacheControlActivity extends BaseFragment { @Override public boolean isEnabled(RecyclerView.ViewHolder holder) { int position = holder.getAdapterPosition(); - return position == databaseRow || (position == storageUsageRow && (totalSize > 0) && !calculating); + return position == migrateOldFolderRow || position == databaseRow || (position == storageUsageRow && (totalSize > 0) && !calculating); } @Override @@ -721,6 +872,8 @@ public class CacheControlActivity extends BaseFragment { TextSettingsCell textCell = (TextSettingsCell) holder.itemView; if (position == databaseRow) { textCell.setTextAndValue(LocaleController.getString("ClearLocalDatabase", R.string.ClearLocalDatabase), AndroidUtilities.formatFileSize(databaseSize), false); + } else if (position == migrateOldFolderRow) { + textCell.setTextAndValue(LocaleController.getString("MigrateOldFolder", R.string.MigrateOldFolder), null, false); } break; case 1: diff --git a/TMessagesProj/src/main/java/org/telegram/ui/CalendarActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/CalendarActivity.java new file mode 100644 index 000000000..e70961ae7 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/CalendarActivity.java @@ -0,0 +1,1424 @@ +package org.telegram.ui; + +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ValueAnimator; +import android.annotation.SuppressLint; +import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.Drawable; +import android.os.Bundle; +import android.text.TextPaint; +import android.util.SparseArray; +import android.util.TypedValue; +import android.view.GestureDetector; +import android.view.Gravity; +import android.view.HapticFeedbackConstants; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewGroup; +import android.widget.FrameLayout; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; +import androidx.core.graphics.ColorUtils; +import androidx.core.view.GestureDetectorCompat; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.ChatObject; +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.MessagesStorage; +import org.telegram.messenger.R; +import org.telegram.messenger.Utilities; +import org.telegram.tgnet.TLRPC; +import org.telegram.ui.ActionBar.ActionBar; +import org.telegram.ui.ActionBar.ActionBarMenuSubItem; +import org.telegram.ui.ActionBar.ActionBarPopupWindow; +import org.telegram.ui.ActionBar.BackDrawable; +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.AlertsCreator; +import org.telegram.ui.Components.BulletinFactory; +import org.telegram.ui.Components.CubicBezierInterpolator; +import org.telegram.ui.Components.Easings; +import org.telegram.ui.Components.HideViewAfterAnimation; +import org.telegram.ui.Components.HintView; +import org.telegram.ui.Components.LayoutHelper; +import org.telegram.ui.Components.RecyclerListView; +import org.telegram.ui.Components.SharedMediaLayout; +import org.telegram.ui.Components.Tooltip; + +import java.time.YearMonth; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; + +public class CalendarActivity extends BaseFragment { + + public final static int TYPE_CHAT_ACTIVITY = 0; + public final static int TYPE_MEDIA_CALENDAR = 1; + + 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); + + TextView selectDaysButton; + TextView removeDaysButton; + + private Paint selectOutlinePaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private Paint selectPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private View blurredView; + + Paint blackoutPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + + private long dialogId; + private boolean loading; + private boolean checkEnterItems; + private boolean inSelectionMode; + BackDrawable backDrawable; + + int startFromYear; + int startFromMonth; + int monthCount; + + CalendarAdapter adapter; + Callback callback; + + HintView selectDaysHint; + + + private int dateSelectedStart; + private int dateSelectedEnd; + private ValueAnimator selectionAnimator; + + SparseArray> messagesByYearMounth = new SparseArray<>(); + boolean endReached; + int startOffset = 0; + int lastId; + int minMontYear; + private int photosVideosTypeFilter; + private boolean isOpened; + int selectedYear; + int selectedMonth; + private FrameLayout bottomBar; + private int minDate; + private boolean canClearHistory; + + private int calendarType; + + public CalendarActivity(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); + } + + selectOutlinePaint.setStyle(Paint.Style.STROKE); + selectOutlinePaint.setStrokeCap(Paint.Cap.ROUND); + selectOutlinePaint.setStrokeWidth(AndroidUtilities.dp(2)); + } + + @Override + public boolean onFragmentCreate() { + dialogId = getArguments().getLong("dialog_id"); + calendarType = getArguments().getInt("type"); + + if (dialogId >= 0) { + canClearHistory = true; + } else { + canClearHistory = false; + } + 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) { + int lastSize; + + @Override + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { + super.onLayout(changed, left, top, right, bottom); + int size = getMeasuredHeight() + getMeasuredWidth() << 16; + if (lastSize != size) { + lastSize = size; + adapter.notifyDataSetChanged(); + } + } + }; + 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(); + } + }); + + boolean showBottomPanel = calendarType == TYPE_CHAT_ACTIVITY && canClearHistory; + contentView.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, 0, 0, 36, 0, showBottomPanel ? 48 : 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) { + if (dateSelectedStart != 0 || dateSelectedEnd != 0 || inSelectionMode) { + inSelectionMode = false; + dateSelectedStart = 0; + dateSelectedEnd = 0; + updateTitle(); + animateSelection(); + } else { + 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; + } + + backDrawable = new BackDrawable(false); + actionBar.setBackButtonDrawable(backDrawable); + backDrawable.setRotation(0f, false); + + loadNext(); + updateColors(); + activeTextPaint.setColor(Color.WHITE); + + if (showBottomPanel) { + bottomBar = new FrameLayout(context) { + @Override + public void onDraw(Canvas canvas) { + canvas.drawRect(0, 0, getMeasuredWidth(), AndroidUtilities.getShadowHeight(), Theme.dividerPaint); + } + }; + bottomBar.setWillNotDraw(false); + bottomBar.setPadding(0, AndroidUtilities.getShadowHeight(), 0, 0); + bottomBar.setClipChildren(false); + selectDaysButton = new TextView(context); + selectDaysButton.setGravity(Gravity.CENTER); + selectDaysButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15); + selectDaysButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); + selectDaysButton.setOnClickListener(view -> { + inSelectionMode = true; + updateTitle(); + }); + selectDaysButton.setText(LocaleController.getString("SelectDays", R.string.SelectDays)); + selectDaysButton.setAllCaps(true); + bottomBar.addView(selectDaysButton, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, 0, 0, 0f, 0, 0)); + + removeDaysButton = new TextView(context); + removeDaysButton.setGravity(Gravity.CENTER); + removeDaysButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15); + removeDaysButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); + removeDaysButton.setOnClickListener(view -> { + if (lastDaysSelected == 0) { + if (selectDaysHint == null) { + selectDaysHint = new HintView(contentView.getContext(), 8); + selectDaysHint.setExtraTranslationY(AndroidUtilities.dp(24)); + contentView.addView(selectDaysHint, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 19, 0, 19, 0)); + selectDaysHint.setText(LocaleController.getString("SelectDaysTooltip", R.string.SelectDaysTooltip)); + } + selectDaysHint.showForView(bottomBar, true); + return; + } + AlertsCreator.createClearDaysDialogAlert(this, lastDaysSelected, getMessagesController().getUser(dialogId), new MessagesStorage.BooleanCallback() { + @Override + public void run(boolean forAll) { + finishFragment(); + + if (parentLayout.fragmentsStack.size() >= 2) { + BaseFragment fragment = parentLayout.fragmentsStack.get(parentLayout.fragmentsStack.size() - 2); + if (fragment instanceof ChatActivity) { + ((ChatActivity) fragment).deleteHistory(dateSelectedStart, dateSelectedEnd + 86400, forAll); + } + } + } + }, null); + }); + removeDaysButton.setAllCaps(true); + + removeDaysButton.setVisibility(View.GONE); + bottomBar.addView(removeDaysButton, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, 0, 0, 0f, 0, 0)); + contentView.addView(bottomBar, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.BOTTOM, 0, 0, 0, 0)); + + + selectDaysButton.setBackground(Theme.createSelectorDrawable(ColorUtils.setAlphaComponent(Theme.getColor(Theme.key_chat_fieldOverlayText), (int) (0.2f * 255)), 2)); + removeDaysButton.setBackground(Theme.createSelectorDrawable(ColorUtils.setAlphaComponent(Theme.getColor(Theme.key_dialogTextRed), (int) (0.2f * 255)), 2)); + selectDaysButton.setTextColor(Theme.getColor(Theme.key_chat_fieldOverlayText)); + removeDaysButton.setTextColor(Theme.getColor(Theme.key_dialogTextRed)); + } + + 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)); + backDrawable.setColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); + 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; + periodDay.date = (int) (calendar.getTimeInMillis() / 1000L); + 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.get(index, null).hasImage) { + messagesByDays.put(index, periodDay); + } + if (month < minMontYear || minMontYear == 0) { + minMontYear = month; + } + } + + int maxDate = (int) (System.currentTimeMillis() / 1000L); + minDate = res.min_date; + + for (int date = res.min_date; date < maxDate; date += 86400) { + calendar.setTimeInMillis(date * 1000L); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + + 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); + } + int index = calendar.get(Calendar.DAY_OF_MONTH) - 1; + if (messagesByDays.get(index, null) == null) { + PeriodDay periodDay = new PeriodDay(); + periodDay.hasImage = false; + periodDay.date = (int) (calendar.getTimeInMillis() / 1000L); + messagesByDays.put(index, periodDay); + } + } + + 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); + monthView.startSelectionAnimation(dateSelectedStart, dateSelectedEnd); + monthView.setSelectionValue(1f); + updateRowSelections(monthView, false); + } + + @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<>(); + + boolean attached; + + GestureDetectorCompat gestureDetector; + + public MonthView(Context context) { + super(context); + setWillNotDraw(false); + titleView = new SimpleTextView(context); + if (calendarType == TYPE_CHAT_ACTIVITY && canClearHistory) { + titleView.setOnLongClickListener(view -> { + if (messagesByDays == null) { + return false; + } + int start = -1; + int end = -1; + for (int i = 0; i < daysInMonth; i++) { + PeriodDay day = messagesByDays.get(i, null); + if (day != null) { + if (start == -1) { + start = day.date; + } + end = day.date; + } + } + + if (start >= 0 && end >= 0) { + inSelectionMode = true; + dateSelectedStart = start; + dateSelectedEnd = end; + updateTitle(); + animateSelection(); + } + + return false; + }); + titleView.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + if (messagesByDays == null) { + return; + } + if (inSelectionMode) { + int start = -1; + int end = -1; + for (int i = 0; i < daysInMonth; i++) { + PeriodDay day = messagesByDays.get(i, null); + if (day != null) { + if (start == -1) { + start = day.date; + } + end = day.date; + } + } + + if (start >= 0 && end >= 0) { + dateSelectedStart = start; + dateSelectedEnd = end; + updateTitle(); + animateSelection(); + } + } + } + }); + } + titleView.setBackground(Theme.createSelectorDrawable(Theme.getColor(Theme.key_listSelector), 2)); + 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)); + + gestureDetector = new GestureDetectorCompat(context, new GestureDetector.SimpleOnGestureListener() { + + @Override + public boolean onDown(MotionEvent e) { + return true; + } + + + @SuppressLint("NotifyDataSetChanged") + @Override + public boolean onSingleTapUp(MotionEvent e) { + if (calendarType == TYPE_MEDIA_CALENDAR && messagesByDays != null) { + PeriodDay day = getDayAtCoord(e.getX(), e.getY()); + if (day != null && day.messageObject != null && callback != null) { + callback.onDateSelected(day.messageObject.getId(), day.startOffset); + finishFragment(); + } + } + if (messagesByDays != null) { + if (inSelectionMode) { + PeriodDay day = getDayAtCoord(e.getX(), e.getY()); + if (day != null) { + if (selectionAnimator != null) { + selectionAnimator.cancel(); + selectionAnimator = null; + } + if (dateSelectedStart != 0 || dateSelectedEnd != 0) { + if (dateSelectedStart == day.date && dateSelectedEnd == day.date) { + dateSelectedStart = dateSelectedEnd = 0; + } else if (dateSelectedStart == day.date) { + dateSelectedStart = dateSelectedEnd; + } else if (dateSelectedEnd == day.date) { + dateSelectedEnd = dateSelectedStart; + } else if (dateSelectedStart == dateSelectedEnd) { + if (day.date > dateSelectedEnd) { + dateSelectedEnd = day.date; + } else { + dateSelectedStart = day.date; + } + } else { + dateSelectedStart = dateSelectedEnd = day.date; + } + } else { + dateSelectedStart = dateSelectedEnd = day.date; + + } + updateTitle(); + animateSelection(); + } + } else { + PeriodDay day = getDayAtCoord(e.getX(), e.getY()); + if (parentLayout.fragmentsStack.size() >= 2) { + BaseFragment fragment = parentLayout.fragmentsStack.get(parentLayout.fragmentsStack.size() - 2); + if (fragment instanceof ChatActivity) { + finishFragment(); + ((ChatActivity) fragment).jumpToDate(day.date); + } + } + } + } + return false; + } + + private PeriodDay getDayAtCoord(float pressedX, float pressedY) { + if (messagesByDays == null) { + return null; + } + int currentCell = 0; + int currentColumn = startDayOfWeek; + + float xStep = getMeasuredWidth() / 7f; + float yStep = AndroidUtilities.dp(44 + 8); + int hrad = AndroidUtilities.dp(44) / 2; + for (int i = 0; i < daysInMonth; i++) { + float cx = xStep * currentColumn + xStep / 2f; + float cy = yStep * currentCell + yStep / 2f + AndroidUtilities.dp(44); + + if (pressedX >= cx - hrad && pressedX <= cx + hrad && pressedY >= cy - hrad && pressedY <= cy + hrad) { + PeriodDay day = messagesByDays.get(i, null); + if (day != null) { + return day; + } + } + + currentColumn++; + if (currentColumn >= 7) { + currentColumn = 0; + currentCell++; + } + } + return null; + } + + @Override + public void onLongPress(MotionEvent e) { + super.onLongPress(e); + if (calendarType != TYPE_CHAT_ACTIVITY) { + return; + } + PeriodDay periodDay = getDayAtCoord(e.getX(), e.getY()); + + if (periodDay != null) { + performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + + Bundle bundle = new Bundle(); + if (dialogId > 0) { + bundle.putLong("user_id", dialogId); + } else { + bundle.putLong("chat_id", -dialogId); + } + bundle.putInt("start_from_date", periodDay.date); + bundle.putBoolean("need_remove_previous_same_chat_activity", false); + ChatActivity chatActivity = new ChatActivity(bundle); + + ActionBarPopupWindow.ActionBarPopupWindowLayout previewMenu = new ActionBarPopupWindow.ActionBarPopupWindowLayout(getParentActivity(), R.drawable.popup_fixed_alert, getResourceProvider()); + previewMenu.setBackgroundColor(getThemedColor(Theme.key_actionBarDefaultSubmenuBackground)); + + ActionBarMenuSubItem cellJump = new ActionBarMenuSubItem(getParentActivity(), true, false); + cellJump.setTextAndIcon(LocaleController.getString("JumpToDate", R.string.JumpToDate), R.drawable.msg_message); + cellJump.setMinimumWidth(160); + cellJump.setOnClickListener(view -> { + if (parentLayout.fragmentsStack.size() >= 3) { + BaseFragment fragment = parentLayout.fragmentsStack.get(parentLayout.fragmentsStack.size() - 3); + if (fragment instanceof ChatActivity) { + AndroidUtilities.runOnUIThread(() -> { + finishFragment(); + ((ChatActivity) fragment).jumpToDate(periodDay.date); + }, 300); + } + } + finishPreviewFragment(); + }); + previewMenu.addView(cellJump); + + if (canClearHistory) { + ActionBarMenuSubItem cellSelect = new ActionBarMenuSubItem(getParentActivity(), false, false); + cellSelect.setTextAndIcon(LocaleController.getString("SelectThisDay", R.string.SelectThisDay), R.drawable.msg_select); + cellSelect.setMinimumWidth(160); + cellSelect.setOnClickListener(view -> { + dateSelectedStart = dateSelectedEnd = periodDay.date; + inSelectionMode = true; + updateTitle(); + animateSelection(); + finishPreviewFragment(); + }); + previewMenu.addView(cellSelect); + + ActionBarMenuSubItem cellDelete = new ActionBarMenuSubItem(getParentActivity(), false, true); + cellDelete.setTextAndIcon(LocaleController.getString("ClearHistory", R.string.ClearHistory), R.drawable.msg_delete); + cellDelete.setMinimumWidth(160); + cellDelete.setOnClickListener(view -> { + if (parentLayout.fragmentsStack.size() >= 3) { + BaseFragment fragment = parentLayout.fragmentsStack.get(parentLayout.fragmentsStack.size() - 3); + if (fragment instanceof ChatActivity) { + AlertsCreator.createClearDaysDialogAlert(CalendarActivity.this, 1, getMessagesController().getUser(dialogId), new MessagesStorage.BooleanCallback() { + @Override + public void run(boolean forAll) { + finishFragment(); + ((ChatActivity) fragment).deleteHistory(dateSelectedStart, dateSelectedEnd + 86400, forAll); + } + }, null); + } + } + finishPreviewFragment(); + }); + previewMenu.addView(cellDelete); + } + previewMenu.setFitItems(true); + + + blurredView = new View(context) { + @Override + public void setAlpha(float alpha) { + super.setAlpha(alpha); + if (fragmentView != null) { + fragmentView.invalidate(); + } + } + }; + blurredView.setOnClickListener(view -> { + finishPreviewFragment(); + }); + blurredView.setVisibility(View.GONE); + blurredView.setFitsSystemWindows(true); + parentLayout.containerView.addView(blurredView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); + prepareBlurBitmap(); + + presentFragmentAsPreviewWithMenu(chatActivity, previewMenu); + + } + } + }); + gestureDetector.setIsLongpressEnabled(calendarType == TYPE_CHAT_ACTIVITY); + } + + private void startSelectionAnimation(int fromDate, int toDate) { + if (messagesByDays != null) { + for (int i = 0; i < daysInMonth; i++) { + PeriodDay day = messagesByDays.get(i, null); + if (day != null) { + day.fromSelProgress = day.selectProgress; + day.toSelProgress = day.date >= fromDate && day.date <= toDate ? 1 : 0; + + day.fromSelSEProgress = day.selectStartEndProgress; + if (day.date == fromDate || day.date == toDate) + day.toSelSEProgress = 1; + else day.toSelSEProgress = 0; + } + } + } + } + + private void setSelectionValue(float f) { + if (messagesByDays != null) { + for (int i = 0; i < daysInMonth; i++) { + PeriodDay day = messagesByDays.get(i, null); + if (day != null) { + day.selectProgress = day.fromSelProgress + (day.toSelProgress - day.fromSelProgress) * f; + day.selectStartEndProgress = day.fromSelSEProgress + (day.toSelSEProgress - day.fromSelSEProgress) * f; + } + } + } + invalidate(); + } + + private SparseArray rowAnimators = new SparseArray<>(); + private SparseArray rowSelectionPos = new SparseArray<>(); + + public void dismissRowAnimations(boolean animate) { + for (int i = 0; i < rowSelectionPos.size(); i++) { + animateRow(rowSelectionPos.keyAt(i), 0, 0, false, animate); + } + } + + public void animateRow(int row, int startColumn, int endColumn, boolean appear, boolean animate) { + ValueAnimator a = rowAnimators.get(row); + if (a != null) a.cancel(); + + float xStep = getMeasuredWidth() / 7f; + + float cxFrom1, cxFrom2, fromAlpha; + RowAnimationValue p = rowSelectionPos.get(row); + if (p != null) { + cxFrom1 = p.startX; + cxFrom2 = p.endX; + fromAlpha = p.alpha; + } else { + cxFrom1 = xStep * startColumn + xStep / 2f; + cxFrom2 = xStep * startColumn + xStep / 2f; + fromAlpha = 0; + } + float cxTo1 = appear ? xStep * startColumn + xStep / 2f : cxFrom1; + float cxTo2 = appear ? xStep * endColumn + xStep / 2f : cxFrom2; + float toAlpha = appear ? 1 : 0; + + RowAnimationValue pr = new RowAnimationValue(cxFrom1, cxFrom2); + rowSelectionPos.put(row, pr); + + if (animate) { + ValueAnimator anim = ValueAnimator.ofFloat(0, 1).setDuration(300); + anim.setInterpolator(Easings.easeInOutQuad); + anim.addUpdateListener(animation -> { + float val = (float) animation.getAnimatedValue(); + pr.startX = cxFrom1 + (cxTo1 - cxFrom1) * val; + pr.endX = cxFrom2 + (cxTo2 - cxFrom2) * val; + pr.alpha = fromAlpha + (toAlpha - fromAlpha) * val; + invalidate(); + }); + anim.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationCancel(Animator animation) { + pr.startX = cxTo1; + pr.endX = cxTo2; + pr.alpha = toAlpha; + invalidate(); + } + + @Override + public void onAnimationEnd(Animator animation) { + rowAnimators.remove(row); + if (!appear) + rowSelectionPos.remove(row); + } + }); + anim.start(); + rowAnimators.put(row, anim); + } else { + pr.startX = cxTo1; + pr.endX = cxTo2; + pr.alpha = toAlpha; + invalidate(); + } + } + + @SuppressLint("ClickableViewAccessibility") + @Override + public boolean onTouchEvent(MotionEvent event) { + return gestureDetector.onTouchEvent(event); + } + + 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 || !messagesByDays.get(key).hasImage) { + 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)); + + updateRowSelections(this, false); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(cellCount * (44 + 8) + 44), MeasureSpec.EXACTLY)); + } + + @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); + + int selSize = AndroidUtilities.dp(44); + for (int row = 0; row < Math.ceil((startDayOfWeek + daysInMonth) / 7f); row++) { + float cy = yStep * row + yStep / 2f + AndroidUtilities.dp(44); + RowAnimationValue v = rowSelectionPos.get(row); + if (v != null) { + selectPaint.setColor(Theme.getColor(Theme.key_chat_messagePanelVoiceBackground)); + selectPaint.setAlpha((int) (v.alpha * (255 * 0.16f))); + AndroidUtilities.rectTmp.set(v.startX - selSize / 2f, cy - selSize / 2f, v.endX + selSize / 2f, cy + selSize / 2f); + int dp = AndroidUtilities.dp(32); + canvas.drawRoundRect(AndroidUtilities.rectTmp, dp, dp, selectPaint); + } + } + 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); + + PeriodDay day = messagesByDays != null ? messagesByDays.get(i, null) : null; + if (nowTime < startMonthTime + (i + 1) * 86400 || (minDate > 0 && minDate > startMonthTime + (i + 2) * 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 (day != null && day.hasImage) { + float alpha = 1f; + if (imagesByDays.get(i) != null) { + if (checkEnterItems && !day.wasDrawn) { + day.enterAlpha = 0f; + day.startEnterDelay = Math.max(0, (cy + getY()) / listView.getMeasuredHeight() * 150); + } + if (day.startEnterDelay > 0) { + day.startEnterDelay -= 16; + if (day.startEnterDelay < 0) { + day.startEnterDelay = 0; + } else { + invalidate(); + } + } + if (day.startEnterDelay >= 0 && day.enterAlpha != 1f) { + day.enterAlpha += 16 / 220f; + if (day.enterAlpha > 1f) { + day.enterAlpha = 1f; + } else { + invalidate(); + } + } + alpha = day.enterAlpha; + if (alpha != 1f) { + canvas.save(); + float s = 0.8f + 0.2f * alpha; + canvas.scale(s, s, cx, cy); + } + int pad = (int) (AndroidUtilities.dp(7f) * day.selectProgress); + if (day.selectStartEndProgress >= 0.01f) { + selectPaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhite)); + selectPaint.setAlpha((int) (day.selectStartEndProgress * 0xFF)); + canvas.drawCircle(cx, cy, AndroidUtilities.dp(44) / 2f, selectPaint); + + selectOutlinePaint.setColor(Theme.getColor(Theme.key_chat_messagePanelVoiceBackground)); + AndroidUtilities.rectTmp.set(cx - AndroidUtilities.dp(44) / 2f, cy - AndroidUtilities.dp(44) / 2f, cx + AndroidUtilities.dp(44) / 2f, cy + AndroidUtilities.dp(44) / 2f); + canvas.drawArc(AndroidUtilities.rectTmp, -90, day.selectStartEndProgress * 360, false, selectOutlinePaint); + } + + imagesByDays.get(i).setAlpha(day.enterAlpha); + imagesByDays.get(i).setImageCoords(cx - (AndroidUtilities.dp(44) - pad) / 2f, cy - (AndroidUtilities.dp(44) - pad) / 2f, AndroidUtilities.dp(44) - pad, AndroidUtilities.dp(44) - pad); + imagesByDays.get(i).draw(canvas); + + blackoutPaint.setColor(ColorUtils.setAlphaComponent(Color.BLACK, (int) (day.enterAlpha * 80))); + canvas.drawCircle(cx, cy, (AndroidUtilities.dp(44) - pad) / 2f, blackoutPaint); + day.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 { + if (day != null && day.selectStartEndProgress >= 0.01f) { + selectPaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhite)); + selectPaint.setAlpha((int) (day.selectStartEndProgress * 0xFF)); + canvas.drawCircle(cx, cy, AndroidUtilities.dp(44) / 2f, selectPaint); + + selectOutlinePaint.setColor(Theme.getColor(Theme.key_chat_messagePanelVoiceBackground)); + AndroidUtilities.rectTmp.set(cx - AndroidUtilities.dp(44) / 2f, cy - AndroidUtilities.dp(44) / 2f, cx + AndroidUtilities.dp(44) / 2f, cy + AndroidUtilities.dp(44) / 2f); + canvas.drawArc(AndroidUtilities.rectTmp, -90, day.selectStartEndProgress * 360, false, selectOutlinePaint); + + int pad = (int) (AndroidUtilities.dp(7f) * day.selectStartEndProgress); + selectPaint.setColor(Theme.getColor(Theme.key_chat_messagePanelVoiceBackground)); + selectPaint.setAlpha((int) (day.selectStartEndProgress * 0xFF)); + canvas.drawCircle(cx, cy, (AndroidUtilities.dp(44) - pad) / 2f, selectPaint); + + float alpha = day.selectStartEndProgress; + 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(); + } + } + } + } + + int lastDaysSelected; + boolean lastInSelectionMode; + + private void updateTitle() { + if (!canClearHistory) { + actionBar.setTitle(LocaleController.getString("Calendar", R.string.Calendar)); + backDrawable.setRotation(0f, true); + return; + } + int daysSelected; + if (dateSelectedStart == dateSelectedEnd && dateSelectedStart == 0) { + daysSelected = 0; + } else { + daysSelected = 1 + (Math.abs(dateSelectedStart - dateSelectedEnd) / 86400); + } + boolean oldInSelectionMode = lastInSelectionMode; + if (daysSelected != lastDaysSelected || lastInSelectionMode != inSelectionMode) { + boolean fromBottom = lastDaysSelected > daysSelected; + lastDaysSelected = daysSelected; + lastInSelectionMode = inSelectionMode; + String title; + if (daysSelected > 0) { + title = LocaleController.formatPluralString("Days", daysSelected); + backDrawable.setRotation(1f, true); + } else if (inSelectionMode) { + title = LocaleController.getString("SelectDays", R.string.SelectDays); + backDrawable.setRotation(1f, true); + } else { + title = LocaleController.getString("Calendar", R.string.Calendar); + backDrawable.setRotation(0f, true); + } + if (daysSelected > 1) { + removeDaysButton.setText(LocaleController.formatString("ClearHistoryForTheseDays", R.string.ClearHistoryForTheseDays)); + } else if (daysSelected > 0 || inSelectionMode) { + removeDaysButton.setText(LocaleController.formatString("ClearHistoryForThisDay", R.string.ClearHistoryForThisDay)); + } + actionBar.setTitleAnimated(title, fromBottom, 150); + + + if ((!inSelectionMode || daysSelected > 0) && selectDaysHint != null) { + selectDaysHint.hide(); + } + if (daysSelected > 0 || inSelectionMode) { + if (removeDaysButton.getVisibility() == View.GONE) { + removeDaysButton.setAlpha(0f); + removeDaysButton.setTranslationY(-AndroidUtilities.dp(20)); + } + removeDaysButton.setVisibility(View.VISIBLE); + selectDaysButton.animate().setListener(null).cancel(); + removeDaysButton.animate().setListener(null).cancel(); + selectDaysButton.animate().alpha(0f).translationY(AndroidUtilities.dp(20)).setDuration(150).setListener(new HideViewAfterAnimation(selectDaysButton)).start(); + removeDaysButton.animate().alpha(daysSelected == 0 ? 0.5f : 1f).translationY(0).start(); + selectDaysButton.setEnabled(false); + removeDaysButton.setEnabled(true); + } else { + if (selectDaysButton.getVisibility() == View.GONE) { + selectDaysButton.setAlpha(0f); + selectDaysButton.setTranslationY(AndroidUtilities.dp(20)); + } + selectDaysButton.setVisibility(View.VISIBLE); + selectDaysButton.animate().setListener(null).cancel(); + removeDaysButton.animate().setListener(null).cancel(); + selectDaysButton.animate().alpha(1f).translationY(0).start(); + removeDaysButton.animate().alpha(0f).translationY(-AndroidUtilities.dp(20)).setDuration(150).setListener(new HideViewAfterAnimation(removeDaysButton)).start(); + selectDaysButton.setEnabled(true); + removeDaysButton.setEnabled(false); + } + } + + } + + 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; + boolean hasImage = true; + int date; + + float selectStartEndProgress; + float fromSelSEProgress; + float toSelSEProgress; + + float selectProgress; + float fromSelProgress; + float toSelProgress; + } + + @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; + } + + @Override + protected void onTransitionAnimationProgress(boolean isOpen, float progress) { + super.onTransitionAnimationProgress(isOpen, progress); + if (blurredView != null && blurredView.getVisibility() == View.VISIBLE) { + if (isOpen) { + blurredView.setAlpha(1.0f - progress); + } else { + blurredView.setAlpha(progress); + } + } + } + + @Override + protected void onTransitionAnimationEnd(boolean isOpen, boolean backward) { + if (isOpen && blurredView != null && blurredView.getVisibility() == View.VISIBLE) { + blurredView.setVisibility(View.GONE); + blurredView.setBackground(null); + } + } + + private void animateSelection() { + ValueAnimator a = ValueAnimator.ofFloat(0f, 1f).setDuration(300); + a.setInterpolator(CubicBezierInterpolator.DEFAULT); + a.addUpdateListener(animation -> { + float selectProgress = (float) animation.getAnimatedValue(); + for (int j = 0; j < listView.getChildCount(); j++) { + MonthView m = (MonthView) listView.getChildAt(j); + m.setSelectionValue(selectProgress); + } + }); + a.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationStart(Animator animation) { + for (int j = 0; j < listView.getChildCount(); j++) { + MonthView m = (MonthView) listView.getChildAt(j); + m.startSelectionAnimation(dateSelectedStart, dateSelectedEnd); + } + } + }); + a.start(); + selectionAnimator = a; + + int minIndex = Integer.MAX_VALUE; + int maxIndex = -1; + for (int j = 0; j < listView.getChildCount(); j++) { + MonthView m = (MonthView) listView.getChildAt(j); + updateRowSelections(m, true); + } + + for (int j = 0; j < listView.getCachedChildCount(); j++) { + MonthView m = (MonthView) listView.getCachedChildAt(j); + updateRowSelections(m, false); + m.startSelectionAnimation(dateSelectedStart, dateSelectedEnd); + m.setSelectionValue(1f); + } + for (int j = 0; j < listView.getHiddenChildCount(); j++) { + MonthView m = (MonthView) listView.getHiddenChildAt(j); + updateRowSelections(m, false); + m.startSelectionAnimation(dateSelectedStart, dateSelectedEnd); + m.setSelectionValue(1f); + } + for (int j = 0; j < listView.getAttachedScrapChildCount(); j++) { + MonthView m = (MonthView) listView.getAttachedScrapChildAt(j); + updateRowSelections(m, false); + m.startSelectionAnimation(dateSelectedStart, dateSelectedEnd); + m.setSelectionValue(1f); + } + } + + private void updateRowSelections(MonthView m, boolean animate) { + if (dateSelectedStart == 0 || dateSelectedEnd == 0) { + m.dismissRowAnimations(animate); + } else { + if (m.messagesByDays == null) { + return; + } + if (!animate) { + m.dismissRowAnimations(false); + } + + int row = 0; + int dayInRow = m.startDayOfWeek; + int sDay = -1, eDay = -1; + for (int i = 0; i < m.daysInMonth; i++) { + PeriodDay day = m.messagesByDays.get(i, null); + if (day != null) { + if (day.date >= dateSelectedStart && day.date <= dateSelectedEnd) { + if (sDay == -1) + sDay = dayInRow; + eDay = dayInRow; + } + } + + dayInRow++; + if (dayInRow >= 7) { + dayInRow = 0; + if (sDay != -1 && eDay != -1) { + m.animateRow(row, sDay, eDay, true, animate); + } else m.animateRow(row, 0, 0, false, animate); + + row++; + sDay = -1; + eDay = -1; + } + } + if (sDay != -1 && eDay != -1) { + m.animateRow(row, sDay, eDay, true, animate); + } else { + m.animateRow(row, 0, 0, false, animate); + } + } + } + + private final static class RowAnimationValue { + float startX, endX; + float alpha; + + RowAnimationValue(float s, float e) { + startX = s; + endX = e; + } + } + + private void prepareBlurBitmap() { + if (blurredView == null) { + return; + } + int w = (int) (parentLayout.getMeasuredWidth() / 6.0f); + int h = (int) (parentLayout.getMeasuredHeight() / 6.0f); + Bitmap bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + canvas.scale(1.0f / 6.0f, 1.0f / 6.0f); + parentLayout.draw(canvas); + Utilities.stackBlurBitmap(bitmap, Math.max(7, Math.max(w, h) / 180)); + blurredView.setBackground(new BitmapDrawable(bitmap)); + blurredView.setAlpha(0.0f); + blurredView.setVisibility(View.VISIBLE); + } + + @Override + public boolean onBackPressed() { + if (inSelectionMode) { + inSelectionMode = false; + dateSelectedStart = dateSelectedEnd = 0; + updateTitle(); + animateSelection(); + return false; + } + return super.onBackPressed(); + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/CameraScanActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/CameraScanActivity.java index 1b92f9417..0dbeb62b9 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/CameraScanActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/CameraScanActivity.java @@ -13,6 +13,7 @@ import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.graphics.Canvas; +import android.graphics.Color; import android.graphics.ImageFormat; import android.graphics.Paint; import android.graphics.Path; @@ -24,6 +25,8 @@ import android.net.Uri; import android.os.Build; import android.os.Handler; import android.os.HandlerThread; +import android.text.SpannableStringBuilder; +import android.text.Spanned; import android.text.TextUtils; import android.util.SparseArray; import android.util.TypedValue; @@ -33,6 +36,8 @@ import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; +import androidx.core.graphics.ColorUtils; + import com.google.android.gms.vision.Frame; import com.google.android.gms.vision.barcode.Barcode; import com.google.android.gms.vision.barcode.BarcodeDetector; @@ -65,6 +70,10 @@ import org.telegram.ui.ActionBar.ThemeDescription; import org.telegram.ui.Components.AnimationProperties; import org.telegram.ui.Components.CubicBezierInterpolator; import org.telegram.ui.Components.LayoutHelper; +import org.telegram.ui.Components.LinkPath; +import org.telegram.ui.Components.TextPaintWebpageUrlSpan; +import org.telegram.ui.Components.TypefaceSpan; +import org.telegram.ui.Components.URLSpanNoUnderline; import java.nio.ByteBuffer; import java.util.ArrayList; @@ -97,6 +106,7 @@ public class CameraScanActivity extends BaseFragment implements Camera.PreviewCa public static final int TYPE_MRZ = 0; public static final int TYPE_QR = 1; + public static final int TYPE_QR_LOGIN = 2; public interface CameraScanActivityDelegate { default void didFindMrzInfo(MrzRecognizer.Result result) { @@ -108,7 +118,7 @@ public class CameraScanActivity extends BaseFragment implements Camera.PreviewCa } } - public static ActionBarLayout[] showAsSheet(BaseFragment parentFragment, boolean gallery, CameraScanActivityDelegate delegate) { + public static ActionBarLayout[] showAsSheet(BaseFragment parentFragment, boolean gallery, int type, CameraScanActivityDelegate delegate) { if (parentFragment == null || parentFragment.getParentActivity() == null) { return null; } @@ -116,7 +126,7 @@ public class CameraScanActivity extends BaseFragment implements Camera.PreviewCa BottomSheet bottomSheet = new BottomSheet(parentFragment.getParentActivity(), false) { { actionBarLayout[0].init(new ArrayList<>()); - CameraScanActivity fragment = new CameraScanActivity(TYPE_QR) { + CameraScanActivity fragment = new CameraScanActivity(type) { @Override public void finishFragment() { dismiss(); @@ -171,7 +181,7 @@ public class CameraScanActivity extends BaseFragment implements Camera.PreviewCa // } }); currentType = type; - if (currentType == TYPE_QR) { + if (isQr()) { qrReader = new QRCodeReader(); visionQrReader = new BarcodeDetector.Builder(ApplicationLoader.applicationContext).setBarcodeFormats(Barcode.QR_CODE).build(); } @@ -200,7 +210,7 @@ public class CameraScanActivity extends BaseFragment implements Camera.PreviewCa actionBar.setItemsColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2), false); actionBar.setItemsBackgroundColor(Theme.getColor(Theme.key_actionBarWhiteSelector), false); actionBar.setCastShadows(false); - if (!AndroidUtilities.isTablet() && currentType != TYPE_QR) { + if (!AndroidUtilities.isTablet() && !isQr()) { actionBar.showActionModeTop(); } actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() { @@ -235,7 +245,7 @@ public class CameraScanActivity extends BaseFragment implements Camera.PreviewCa } flashButton.measure(MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(60), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(60), MeasureSpec.EXACTLY)); } - titleTextView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(height, MeasureSpec.UNSPECIFIED)); + titleTextView.measure(MeasureSpec.makeMeasureSpec(width - AndroidUtilities.dp(72), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(height, MeasureSpec.UNSPECIFIED)); descriptionText.measure(MeasureSpec.makeMeasureSpec((int) (width * 0.9f), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(height, MeasureSpec.UNSPECIFIED)); setMeasuredDimension(width, height); @@ -250,15 +260,19 @@ public class CameraScanActivity extends BaseFragment implements Camera.PreviewCa if (currentType == TYPE_MRZ) { cameraView.layout(0, y, cameraView.getMeasuredWidth(), y + cameraView.getMeasuredHeight()); y = (int) (height * 0.65f); - titleTextView.layout(0, y, titleTextView.getMeasuredWidth(), y + titleTextView.getMeasuredHeight()); + titleTextView.layout(AndroidUtilities.dp(36), y, AndroidUtilities.dp(36) + titleTextView.getMeasuredWidth(), y + titleTextView.getMeasuredHeight()); recognizedMrzView.setTextSize(TypedValue.COMPLEX_UNIT_PX, cameraView.getMeasuredHeight() / 22); recognizedMrzView.setPadding(0, 0, 0, cameraView.getMeasuredHeight() / 15); } else { actionBar.layout(0, 0, actionBar.getMeasuredWidth(), actionBar.getMeasuredHeight()); cameraView.layout(0, 0, cameraView.getMeasuredWidth(), cameraView.getMeasuredHeight()); int size = (int) (Math.min(cameraView.getWidth(), cameraView.getHeight()) / 1.5f); - y = (cameraView.getMeasuredHeight() - size) / 2 - titleTextView.getMeasuredHeight() - AndroidUtilities.dp(30); - titleTextView.layout(0, y, titleTextView.getMeasuredWidth(), y + titleTextView.getMeasuredHeight()); + if (currentType == TYPE_QR) { + y = (cameraView.getMeasuredHeight() - size) / 2 - titleTextView.getMeasuredHeight() - AndroidUtilities.dp(30); + } else { + y = (cameraView.getMeasuredHeight() - size) / 2 - titleTextView.getMeasuredHeight() - AndroidUtilities.dp(64); + } + titleTextView.layout(AndroidUtilities.dp(36), y, AndroidUtilities.dp(36) + titleTextView.getMeasuredWidth(), y + titleTextView.getMeasuredHeight()); recognizedMrzView.layout(0, getMeasuredHeight() - recognizedMrzView.getMeasuredHeight(), getMeasuredWidth(), getMeasuredHeight()); int x; @@ -284,7 +298,7 @@ public class CameraScanActivity extends BaseFragment implements Camera.PreviewCa @Override protected boolean drawChild(Canvas canvas, View child, long drawingTime) { boolean result = super.drawChild(canvas, child, drawingTime); - if (currentType == TYPE_QR && child == cameraView) { + if (isQr() && child == cameraView) { int size = (int) (Math.min(child.getWidth(), child.getHeight()) / 1.5f); int x = (child.getWidth() - size) / 2; int y = (child.getHeight() - size) / 2; @@ -351,9 +365,48 @@ public class CameraScanActivity extends BaseFragment implements Camera.PreviewCa viewGroup.addView(actionBar); } - titleTextView = new TextView(context); + if (currentType == TYPE_QR_LOGIN) { + actionBar.setTitle(LocaleController.getString("AuthAnotherClientScan", R.string.AuthAnotherClientScan)); + } + + Paint selectionPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + selectionPaint.setColor(ColorUtils.setAlphaComponent(Color.WHITE, 100)); + titleTextView = new TextView(context) { + LinkPath textPath; + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + if (getText() instanceof Spanned) { + Spanned spanned = (Spanned) getText(); + URLSpanNoUnderline[] innerSpans = spanned.getSpans(0, spanned.length(), URLSpanNoUnderline.class); + if (innerSpans != null && innerSpans.length > 0) { + textPath = new LinkPath(true); + textPath.setAllowReset(false); + for (int a = 0; a < innerSpans.length; a++) { + int start = spanned.getSpanStart(innerSpans[a]); + int end = spanned.getSpanEnd(innerSpans[a]); + textPath.setCurrentLayout(getLayout(), start, 0); + int shift = getText() != null ? getPaint().baselineShift : 0; + textPath.setBaselineShift(shift != 0 ? shift + AndroidUtilities.dp(shift > 0 ? 5 : -2) : 0); + getLayout().getSelectionPath(start, end, textPath); + } + textPath.setAllowReset(true); + } + } + } + + @Override + protected void onDraw(Canvas canvas) { + if (textPath != null) { + canvas.drawPath(textPath, selectionPaint); + } + super.onDraw(canvas); + } + }; titleTextView.setGravity(Gravity.CENTER_HORIZONTAL); titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 24); + viewGroup.addView(titleTextView); descriptionText = new TextView(context); @@ -377,7 +430,45 @@ public class CameraScanActivity extends BaseFragment implements Camera.PreviewCa if (needGalleryButton) { //titleTextView.setText(LocaleController.getString("WalletScanCode", R.string.WalletScanCode)); } else { - titleTextView.setText(LocaleController.getString("AuthAnotherClientScan", R.string.AuthAnotherClientScan)); + if (currentType == TYPE_QR) { + titleTextView.setText(LocaleController.getString("AuthAnotherClientScan", R.string.AuthAnotherClientScan)); + } else { + String text = LocaleController.getString("AuthAnotherClientInfo5", R.string.AuthAnotherClientInfo5); + SpannableStringBuilder spanned = new SpannableStringBuilder(text); + int index1 = text.indexOf('*'); + int index2 = text.indexOf('*', index1 + 1); + + if (index1 != -1 && index2 != -1 && index1 != index2) { + titleTextView.setMovementMethod(new AndroidUtilities.LinkMovementMethodMy()); + spanned.replace(index2, index2 + 1, " "); + spanned.replace(index1, index1 + 1, " "); + index1 += 1; + index2 += 1; + spanned.setSpan(new URLSpanNoUnderline(LocaleController.getString("AuthAnotherClientDownloadClientUrl", R.string.AuthAnotherClientDownloadClientUrl)), index1, index2 - 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + spanned.setSpan(new TypefaceSpan(AndroidUtilities.getTypeface("fonts/rmedium.ttf")), index1, index2 - 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + } + + text = spanned.toString(); + index1 = text.indexOf('*'); + index2 = text.indexOf('*', index1 + 1); + + if (index1 != -1 && index2 != -1 && index1 != index2) { + spanned.replace(index2, index2 + 1, " "); + spanned.replace(index1, index1 + 1, " "); + index1 += 1; + index2 += 1; + spanned.setSpan(new URLSpanNoUnderline(LocaleController.getString("AuthAnotherWebClientUrl", R.string.AuthAnotherWebClientUrl)), index1, index2 - 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + spanned.setSpan(new TypefaceSpan(AndroidUtilities.getTypeface("fonts/rmedium.ttf")), index1, index2 - 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + } + + titleTextView.setLinkTextColor(Color.WHITE); + titleTextView.setHighlightColor(Theme.getColor(Theme.key_windowBackgroundWhiteLinkSelection)); + + titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); + titleTextView.setLineSpacing(AndroidUtilities.dp(2), 1.0f); + titleTextView.setPadding(0, 0, 0, 0); + titleTextView.setText(spanned); + } } titleTextView.setTextColor(0xffffffff); recognizedMrzView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); @@ -650,10 +741,15 @@ public class CameraScanActivity extends BaseFragment implements Camera.PreviewCa return null; } + + private boolean isQr() { + return currentType == TYPE_QR || currentType == TYPE_QR_LOGIN; + } + @Override public ArrayList getThemeDescriptions() { ArrayList themeDescriptions = new ArrayList<>(); - if (currentType == TYPE_QR) { + if (isQr()) { return themeDescriptions; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/CancelAccountDeletionActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/CancelAccountDeletionActivity.java index e189298ce..31102f6eb 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/CancelAccountDeletionActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/CancelAccountDeletionActivity.java @@ -150,7 +150,7 @@ public class CancelAccountDeletionActivity extends BaseFragment { @Override public void onItemClick(int id) { if (id == done_button) { - views[currentViewNum].onNextPressed(); + views[currentViewNum].onNextPressed(null); } else if (id == -1) { finishFragment(); } @@ -337,7 +337,7 @@ public class CancelAccountDeletionActivity extends BaseFragment { } @Override - public void onNextPressed() { + public void onNextPressed(String code) { if (getParentActivity() == null || nextPressed) { return; } @@ -392,7 +392,7 @@ public class CancelAccountDeletionActivity extends BaseFragment { @Override public void onShow() { super.onShow(); - onNextPressed(); + onNextPressed(null); } } @@ -556,7 +556,7 @@ public class CancelAccountDeletionActivity extends BaseFragment { Intent mailer = new Intent(Intent.ACTION_SENDTO); mailer.setData(Uri.parse("mailto:")); - mailer.putExtra(Intent.EXTRA_EMAIL, new String[]{"reports@stel.com"}); + mailer.putExtra(Intent.EXTRA_EMAIL, new String[]{"sms@telegram.org"}); mailer.putExtra(Intent.EXTRA_SUBJECT, "Android cancel account deletion issue " + version + " " + phone); mailer.putExtra(Intent.EXTRA_TEXT, "Phone: " + phone + "\nApp version: " + version + "\nOS version: SDK " + Build.VERSION.SDK_INT + "\nDevice Name: " + Build.MANUFACTURER + Build.MODEL + "\nLocale: " + Locale.getDefault() + "\nError: " + lastError); getContext().startActivity(Intent.createChooser(mailer, "Send email...")); @@ -744,7 +744,7 @@ public class CancelAccountDeletionActivity extends BaseFragment { codeField[num + 1].requestFocus(); } if ((num == length - 1 || num == length - 2 && len >= 2) && getCode().length() == length) { - onNextPressed(); + onNextPressed(null); } } } @@ -760,7 +760,7 @@ public class CancelAccountDeletionActivity extends BaseFragment { }); codeField[a].setOnEditorActionListener((textView, i, keyEvent) -> { if (i == EditorInfo.IME_ACTION_NEXT) { - onNextPressed(); + onNextPressed(null); return true; } return false; @@ -965,11 +965,13 @@ public class CancelAccountDeletionActivity extends BaseFragment { } @Override - public void onNextPressed() { + public void onNextPressed(String code) { if (nextPressed) { return; } - String code = getCode(); + if (code == null) { + code = getCode(); + } if (TextUtils.isEmpty(code)) { AndroidUtilities.shakeView(codeFieldContainer, 2, 0); return; @@ -1070,7 +1072,7 @@ public class CancelAccountDeletionActivity extends BaseFragment { } if (id == NotificationCenter.didReceiveSmsCode) { codeField[0].setText("" + args[0]); - onNextPressed(); + onNextPressed(null); } else if (id == NotificationCenter.didReceiveCall) { String num = "" + args[0]; if (!AndroidUtilities.checkPhonePattern(pattern, num)) { @@ -1079,7 +1081,7 @@ public class CancelAccountDeletionActivity extends BaseFragment { ignoreOnTextChange = true; codeField[0].setText(num); ignoreOnTextChange = false; - onNextPressed(); + onNextPressed(null); } } } 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 f98dd1cf3..5b5e7a595 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java @@ -2369,7 +2369,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate private boolean checkTextSelection(MotionEvent event) { TextSelectionHelper.ChatListTextSelectionHelper textSelectionHelper = delegate.getTextSelectionHelper(); - if (textSelectionHelper == null) { + if (textSelectionHelper == null || MessagesController.getInstance(currentAccount).isChatNoForwards(currentMessageObject.getChatId())) { return false; } boolean hasTextBlocks = currentMessageObject.textLayoutBlocks != null && !currentMessageObject.textLayoutBlocks.isEmpty(); @@ -2434,7 +2434,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } private void updateSelectionTextPosition() { - if (getDelegate().getTextSelectionHelper() != null && getDelegate().getTextSelectionHelper().isSelected(currentMessageObject)) { + if (getDelegate() != null && getDelegate().getTextSelectionHelper() != null && getDelegate().getTextSelectionHelper().isSelected(currentMessageObject)) { int textSelectionType = getDelegate().getTextSelectionHelper().getTextSelectionType(this); if (textSelectionType == TextSelectionHelper.ChatListTextSelectionHelper.TYPE_DESCRIPTION) { int linkX; @@ -2969,7 +2969,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } DownloadController.getInstance(currentAccount).removeLoadingFileObserver(this); - if (getDelegate().getTextSelectionHelper() != null) { + if (getDelegate() != null && getDelegate().getTextSelectionHelper() != null) { getDelegate().getTextSelectionHelper().onChatMessageCellDetached(this); } @@ -3053,7 +3053,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate animatingDrawVideoImageButtonProgress = (documentAttachType == DOCUMENT_ATTACH_TYPE_VIDEO || documentAttachType == DOCUMENT_ATTACH_TYPE_GIF) && drawVideoSize ? 1.0f : 0.0f; } - if (getDelegate().getTextSelectionHelper() != null) { + if (getDelegate() != null && getDelegate().getTextSelectionHelper() != null) { getDelegate().getTextSelectionHelper().onChatMessageCellAttached(this); } @@ -3177,9 +3177,13 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate drawVideoSize = false; canStreamVideo = false; animatingNoSound = 0; - drawSideButton = !isRepliesChat && checkNeedDrawShareButton(messageObject) && (currentPosition == null || currentPosition.last) ? 1 : 0; - if (isPinnedChat || drawSideButton == 1 && messageObject.messageOwner.fwd_from != null && !messageObject.isOutOwner() && messageObject.messageOwner.fwd_from.saved_from_peer != null && messageObject.getDialogId() == UserConfig.getInstance(currentAccount).getClientUserId()) { - drawSideButton = 2; + if (MessagesController.getInstance(currentAccount).isChatNoForwards(messageObject.getChatId())) { + drawSideButton = 0; + } else { + drawSideButton = !isRepliesChat && checkNeedDrawShareButton(messageObject) && (currentPosition == null || currentPosition.last) ? 1 : 0; + if (isPinnedChat || drawSideButton == 1 && messageObject.messageOwner.fwd_from != null && !messageObject.isOutOwner() && messageObject.messageOwner.fwd_from.saved_from_peer != null && messageObject.getDialogId() == UserConfig.getInstance(currentAccount).getClientUserId()) { + drawSideButton = 2; + } } replyNameLayout = null; adminLayout = null; @@ -8118,7 +8122,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate canvas.drawPath(urlPath.get(b), Theme.chat_urlPaint); } } - if (delegate.getTextSelectionHelper() != null && getDelegate().getTextSelectionHelper().isSelected(currentMessageObject)) { + if (delegate != null && delegate.getTextSelectionHelper() != null && getDelegate().getTextSelectionHelper().isSelected(currentMessageObject)) { delegate.getTextSelectionHelper().drawDescription(currentMessageObject.isOutOwner(), descriptionLayout, canvas); } descriptionLayout.draw(canvas); @@ -8146,7 +8150,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate imageDrawn = true; drawTime = true; } else { - if (delegate == null || delegate.getPinchToZoomHelper() == null || !delegate.getPinchToZoomHelper().isInOverlayModeFor(this)) { + if (delegate == null || delegate.getPinchToZoomHelper() == null || !delegate.getPinchToZoomHelper().isInOverlayModeFor(this) && drawInstantViewType != 11) { if (alpha != 1f) { photoImage.setAlpha(alpha); imageDrawn = photoImage.draw(canvas); @@ -11105,7 +11109,13 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate Theme.chat_namePaint.setColor(getThemedColor(AvatarDrawable.getNameColorNameForId(currentUser.id))); } } else if (currentChat != null) { - if (ChatObject.isChannel(currentChat) && !currentChat.megagroup) { + if (currentMessageObject.isOutOwner() && ChatObject.isChannel(currentChat)) { + if (currentBackgroundDrawable != null && currentBackgroundDrawable.hasGradient()) { + Theme.chat_namePaint.setColor(getThemedColor(Theme.key_chat_messageTextOut)); + } else { + Theme.chat_namePaint.setColor(getThemedColor(Theme.key_chat_outForwardedNameText)); + } + } else if (ChatObject.isChannel(currentChat) && !currentChat.megagroup) { Theme.chat_namePaint.setColor(Theme.changeColorAccent(getThemedColor(AvatarDrawable.getNameColorNameForId(5)))); } else if (currentMessageObject.isOutOwner()) { Theme.chat_namePaint.setColor(getThemedColor(Theme.key_chat_outForwardedNameText)); @@ -11844,7 +11854,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } if (!selectionOnly) { try { - if (getDelegate().getTextSelectionHelper() != null && getDelegate().getTextSelectionHelper().isSelected(currentMessageObject)) { + if (getDelegate() != null && getDelegate().getTextSelectionHelper() != null && getDelegate().getTextSelectionHelper().isSelected(currentMessageObject)) { getDelegate().getTextSelectionHelper().drawCaption(currentMessageObject.isOutOwner(), captionLayout, canvas); } Emoji.emojiDrawingYOffset = -transitionYOffsetForDrawables; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/PatternCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/PatternCell.java index f15f61abc..05306832d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/PatternCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/PatternCell.java @@ -195,7 +195,7 @@ public class PatternCell extends BackupImageView implements DownloadController.F if (backgroundGradientColor2 != 0) { gradientShader = null; if (backgroundDrawable != null) { - backgroundDrawable.setColors(backgroundColor, backgroundGradientColor1, backgroundGradientColor2, backgroundGradientColor3, false); + backgroundDrawable.setColors(backgroundColor, backgroundGradientColor1, backgroundGradientColor2, backgroundGradientColor3, 0, false); } else { backgroundDrawable = new MotionBackgroundDrawable(backgroundColor, backgroundGradientColor1, backgroundGradientColor2, backgroundGradientColor3, true); backgroundDrawable.setRoundRadius(AndroidUtilities.dp(6)); 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 f18ed80fe..61a170e7d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SessionCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SessionCell.java @@ -10,14 +10,22 @@ package org.telegram.ui.Cells; import android.content.Context; import android.graphics.Canvas; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffColorFilter; +import android.graphics.drawable.Drawable; +import android.text.SpannableStringBuilder; import android.text.TextUtils; import android.util.TypedValue; import android.view.Gravity; +import android.view.View; import android.widget.FrameLayout; import android.widget.LinearLayout; import android.widget.TextView; +import androidx.core.content.ContextCompat; + import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.ApplicationLoader; import org.telegram.messenger.ImageLocation; import org.telegram.messenger.LocaleController; import org.telegram.messenger.MessagesController; @@ -29,6 +37,9 @@ import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Components.AvatarDrawable; import org.telegram.ui.Components.BackupImageView; +import org.telegram.ui.Components.CombinedDrawable; +import org.telegram.ui.Components.DotDividerSpan; +import org.telegram.ui.Components.FlickerLoadingView; import org.telegram.ui.Components.LayoutHelper; import java.util.Locale; @@ -42,13 +53,16 @@ public class SessionCell extends FrameLayout { private BackupImageView imageView; private AvatarDrawable avatarDrawable; private boolean needDivider; + private boolean showStub; + FlickerLoadingView globalGradient; + LinearLayout linearLayout; private int currentAccount = UserConfig.selectedAccount; public SessionCell(Context context, int type) { super(context); - LinearLayout linearLayout = new LinearLayout(context); + linearLayout = new LinearLayout(context); linearLayout.setOrientation(LinearLayout.HORIZONTAL); linearLayout.setWeightSum(1); @@ -57,14 +71,18 @@ public class SessionCell extends FrameLayout { avatarDrawable = new AvatarDrawable(); avatarDrawable.setTextSize(AndroidUtilities.dp(10)); - imageView = new BackupImageView(context); imageView.setRoundRadius(AndroidUtilities.dp(10)); addView(imageView, LayoutHelper.createFrame(20, 20, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, (LocaleController.isRTL ? 0 : 21), 13, (LocaleController.isRTL ? 21 : 0), 0)); } else { - addView(linearLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 30, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, (LocaleController.isRTL ? 15 : 21), 11, (LocaleController.isRTL ? 21 : 15), 0)); + imageView = new BackupImageView(context); + imageView.setRoundRadius(AndroidUtilities.dp(10)); + addView(imageView, LayoutHelper.createFrame(42, 42, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, (LocaleController.isRTL ? 0 : 16), 13, (LocaleController.isRTL ? 16 : 0), 0)); + + addView(linearLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 30, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, (LocaleController.isRTL ? 15 : 72), 11, (LocaleController.isRTL ? 72 : 15), 0)); } + nameTextView = new TextView(context); nameTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); @@ -95,7 +113,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, 21, 36, 21, 0)); + 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)); detailExTextView = new TextView(context); detailExTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText3)); @@ -105,7 +123,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, 21, 59, 21, 0)); + 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)); } @Override @@ -118,41 +136,17 @@ public class SessionCell extends FrameLayout { if (object instanceof TLRPC.TL_authorization) { TLRPC.TL_authorization session = (TLRPC.TL_authorization) object; - nameTextView.setText(String.format(Locale.US, "%s %s", session.app_name, session.app_version)); - if ((session.flags & 1) != 0) { - setTag(Theme.key_windowBackgroundWhiteValueText); - onlineTextView.setText(LocaleController.getString("Online", R.string.Online)); - onlineTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteValueText)); - } else { - setTag(Theme.key_windowBackgroundWhiteGrayText3); - onlineTextView.setText(LocaleController.stringForMessageListDate(session.date_active)); - onlineTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText3)); - } + + + imageView.setImageDrawable(createDrawable(session)); + // nameTextView.setText(String.format(Locale.US, "%s %s", session.app_name, session.app_version)); + StringBuilder stringBuilder = new StringBuilder(); - if (session.ip.length() != 0) { - stringBuilder.append(session.ip); - } - if (session.country.length() != 0) { - if (stringBuilder.length() != 0) { - stringBuilder.append(" "); - } - stringBuilder.append("— "); - stringBuilder.append(session.country); - } - detailExTextView.setText(stringBuilder); - - stringBuilder = new StringBuilder(); if (session.device_model.length() != 0) { - if (stringBuilder.length() != 0) { - stringBuilder.append(", "); - } stringBuilder.append(session.device_model); } - if (session.system_version.length() != 0 || session.platform.length() != 0) { - if (stringBuilder.length() != 0) { - stringBuilder.append(", "); - } + if (stringBuilder.length() == 0) { if (session.platform.length() != 0) { stringBuilder.append(session.platform); } @@ -163,17 +157,33 @@ public class SessionCell extends FrameLayout { stringBuilder.append(session.system_version); } } + nameTextView.setText(stringBuilder); - if (!session.official_app) { - if (stringBuilder.length() != 0) { - stringBuilder.append(", "); - } - stringBuilder.append(LocaleController.getString("UnofficialApp", R.string.UnofficialApp)); - stringBuilder.append(" (ID: "); - stringBuilder.append(session.api_id); - stringBuilder.append(")"); + String timeText; + if ((session.flags & 1) != 0) { + setTag(Theme.key_windowBackgroundWhiteValueText); + timeText = LocaleController.getString("Online", R.string.Online); + } else { + setTag(Theme.key_windowBackgroundWhiteGrayText3); + timeText = LocaleController.stringForMessageListDate(session.date_active); } + SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(); + if (session.country.length() != 0) { + spannableStringBuilder.append(session.country); + } + if (spannableStringBuilder.length() != 0) { + DotDividerSpan dotDividerSpan = new DotDividerSpan(); + dotDividerSpan.setTopPadding(AndroidUtilities.dp(1.5f)); + spannableStringBuilder.append(" . ").setSpan(dotDividerSpan, spannableStringBuilder.length() - 2, spannableStringBuilder.length() - 1, 0); + } + spannableStringBuilder.append(timeText); + detailExTextView.setText(spannableStringBuilder); + + stringBuilder = new StringBuilder(); + stringBuilder.append(session.app_name); + stringBuilder.append(" ").append(session.app_version); + detailTextView.setText(stringBuilder); } else if (object instanceof TLRPC.TL_webAuthorization) { TLRPC.TL_webAuthorization session = (TLRPC.TL_webAuthorization) object; @@ -224,12 +234,111 @@ public class SessionCell extends FrameLayout { detailTextView.setText(stringBuilder); } + + if (showStub) { + showStub = false; + invalidate(); + } + } + + public static Drawable createDrawable(TLRPC.TL_authorization session) { + String platform = session.platform.toLowerCase(); + if (platform.isEmpty()) { + platform = session.system_version.toLowerCase(); + } + String deviceModel = session.device_model.toLowerCase(); + int iconId; + String colorKey; + if (deviceModel.contains("safari")) { + iconId = R.drawable.device_web_safari; + colorKey = Theme.key_avatar_backgroundPink; + } else if (deviceModel.contains("edge")) { + iconId = R.drawable.device_web_edge; + colorKey = Theme.key_avatar_backgroundPink; + } else if (deviceModel.contains("chrome")) { + iconId = R.drawable.device_web_chrome; + colorKey = Theme.key_avatar_backgroundPink; + } else if (deviceModel.contains("opera")) { + iconId = R.drawable.device_web_opera; + colorKey = Theme.key_avatar_backgroundPink; + } else if (deviceModel.contains("firefox")) { + iconId = R.drawable.device_web_firefox; + colorKey = Theme.key_avatar_backgroundPink; + } else if (deviceModel.contains("vivaldi")) { + iconId = R.drawable.device_web_other; + colorKey = Theme.key_avatar_backgroundPink; + } else if (platform.contains("ios")) { + iconId = deviceModel.contains("ipad") ? R.drawable.device_tablet_ios : R.drawable.device_phone_ios; + colorKey = Theme.key_avatar_backgroundBlue; + } else if (platform.contains("windows")) { + iconId = R.drawable.device_desktop_win; + colorKey = Theme.key_avatar_backgroundCyan; + } else if (platform.contains("macos")) { + iconId = R.drawable.device_desktop_osx; + colorKey = Theme.key_avatar_backgroundCyan; + } else if (platform.contains("android")) { + iconId = deviceModel.contains("tab") ? R.drawable.device_tablet_android : R.drawable.device_phone_android; + colorKey = Theme.key_avatar_backgroundGreen; + } else { + if (session.app_name.toLowerCase().contains("desktop")) { + iconId = R.drawable.device_desktop_other; + colorKey = Theme.key_avatar_backgroundCyan; + } else { + iconId = R.drawable.device_web_other; + colorKey = Theme.key_avatar_backgroundPink; + } + } + Drawable iconDrawable = ContextCompat.getDrawable(ApplicationLoader.applicationContext, iconId).mutate(); + iconDrawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_avatar_text), PorterDuff.Mode.SRC_IN)); + CombinedDrawable combinedDrawable = new CombinedDrawable(Theme.createCircleDrawable(AndroidUtilities.dp(42), Theme.getColor(colorKey)), iconDrawable); + return combinedDrawable; } @Override protected void onDraw(Canvas canvas) { + if (showStub && globalGradient != null) { + globalGradient.updateColors(); + globalGradient.updateGradient(); + if (getParent() != null) { + View parent = (View) getParent(); + globalGradient.setParentSize(parent.getMeasuredWidth(), parent.getMeasuredHeight(), -getX()); + } + float y = linearLayout.getTop() + nameTextView.getTop() + AndroidUtilities.dp(12); + float x = linearLayout.getX(); + + AndroidUtilities.rectTmp.set(x, y - AndroidUtilities.dp(4), x + getMeasuredWidth() * 0.2f, y + AndroidUtilities.dp(4)); + canvas.drawRoundRect(AndroidUtilities.rectTmp, AndroidUtilities.dp(4), AndroidUtilities.dp(4), globalGradient.getPaint()); + + y = linearLayout.getTop() + detailTextView.getTop() - AndroidUtilities.dp(1); + x = linearLayout.getX(); + + AndroidUtilities.rectTmp.set(x, y - AndroidUtilities.dp(4), x + getMeasuredWidth() * 0.4f, y + AndroidUtilities.dp(4)); + canvas.drawRoundRect(AndroidUtilities.rectTmp, AndroidUtilities.dp(4), AndroidUtilities.dp(4), globalGradient.getPaint()); + + y = linearLayout.getTop() + detailExTextView.getTop() - AndroidUtilities.dp(1); + x = linearLayout.getX(); + + AndroidUtilities.rectTmp.set(x, y - AndroidUtilities.dp(4), x + getMeasuredWidth() * 0.3f, y + AndroidUtilities.dp(4)); + canvas.drawRoundRect(AndroidUtilities.rectTmp, AndroidUtilities.dp(4), AndroidUtilities.dp(4), globalGradient.getPaint()); + invalidate(); + } if (needDivider) { canvas.drawLine(LocaleController.isRTL ? 0 : AndroidUtilities.dp(20), getMeasuredHeight() - 1, getMeasuredWidth() - (LocaleController.isRTL ? AndroidUtilities.dp(20) : 0), getMeasuredHeight() - 1, Theme.dividerPaint); } } + + public void showStub(FlickerLoadingView globalGradient) { + this.globalGradient = globalGradient; + showStub = true; + + Drawable iconDrawable = ContextCompat.getDrawable(ApplicationLoader.applicationContext, AndroidUtilities.isTablet() ? R.drawable.device_tablet_android : R.drawable.device_phone_android).mutate(); + iconDrawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_avatar_text), PorterDuff.Mode.SRC_IN)); + CombinedDrawable combinedDrawable = new CombinedDrawable(Theme.createCircleDrawable(AndroidUtilities.dp(42), Theme.getColor(Theme.key_avatar_backgroundGreen)), iconDrawable); + imageView.setImageDrawable(combinedDrawable); + invalidate(); + } + + public boolean isStub() { + return showStub; + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextCheckBoxCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextCheckBoxCell.java index 8f3f0f22b..257e2b7c0 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextCheckBoxCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextCheckBoxCell.java @@ -30,12 +30,17 @@ public class TextCheckBoxCell extends FrameLayout { private boolean needDivider; public TextCheckBoxCell(Context context) { - this(context, false); + this(context, false, false); } - public TextCheckBoxCell(Context context, boolean dialog) { + public TextCheckBoxCell(Context context, boolean dialog, boolean revereLayout) { super(context); + boolean isRtl = LocaleController.isRTL; + if (revereLayout) { + isRtl = !isRtl; + } + textView = new TextView(context); textView.setTextColor(Theme.getColor(dialog ? Theme.key_dialogTextBlack : Theme.key_windowBackgroundWhiteBlackText)); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); @@ -44,14 +49,15 @@ public class TextCheckBoxCell extends FrameLayout { 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 ? 66 : 21, 0, LocaleController.isRTL ? 21 : 66, 0)); + + addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (isRtl ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, isRtl ? 66 : 21, 0, isRtl ? 21 : 66, 0)); checkBox = new CheckBoxSquare(context, dialog); checkBox.setDuplicateParentStateEnabled(false); checkBox.setFocusable(false); checkBox.setFocusableInTouchMode(false); checkBox.setClickable(false); - addView(checkBox, LayoutHelper.createFrame(18, 18, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, 21, 0, 21, 0)); + addView(checkBox, LayoutHelper.createFrame(18, 18, (isRtl ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, 21, 0, 21, 0)); } @Override diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChangePhoneActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChangePhoneActivity.java index b3ac23512..60f0d1b00 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChangePhoneActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChangePhoneActivity.java @@ -153,7 +153,7 @@ public class ChangePhoneActivity extends BaseFragment { @Override public void onItemClick(int id) { if (id == done_button) { - views[currentViewNum].onNextPressed(); + views[currentViewNum].onNextPressed(null); } else if (id == -1) { finishFragment(); } @@ -211,7 +211,7 @@ public class ChangePhoneActivity extends BaseFragment { if (requestCode == 6) { checkPermissions = false; if (currentViewNum == 0) { - views[currentViewNum].onNextPressed(); + views[currentViewNum].onNextPressed(null); } } } @@ -594,7 +594,7 @@ public class ChangePhoneActivity extends BaseFragment { }); phoneField.setOnEditorActionListener((textView, i, keyEvent) -> { if (i == EditorInfo.IME_ACTION_NEXT) { - onNextPressed(); + onNextPressed(null); return true; } return false; @@ -712,7 +712,7 @@ public class ChangePhoneActivity extends BaseFragment { } @Override - public void onNextPressed() { + public void onNextPressed(String code) { if (getParentActivity() == null || nextPressed) { return; } @@ -985,7 +985,7 @@ public class ChangePhoneActivity extends BaseFragment { Intent mailer = new Intent(Intent.ACTION_SENDTO); mailer.setData(Uri.parse("mailto:")); - mailer.putExtra(Intent.EXTRA_EMAIL, new String[]{"reports@stel.com"}); + mailer.putExtra(Intent.EXTRA_EMAIL, new String[]{"sms@telegram.org"}); mailer.putExtra(Intent.EXTRA_SUBJECT, "Android registration/login issue " + version + " " + emailPhone); mailer.putExtra(Intent.EXTRA_TEXT, "Phone: " + requestPhone + "\nApp version: " + version + "\nOS version: SDK " + Build.VERSION.SDK_INT + "\nDevice Name: " + Build.MANUFACTURER + Build.MODEL + "\nLocale: " + Locale.getDefault() + "\nError: " + lastError); getContext().startActivity(Intent.createChooser(mailer, "Send email...")); @@ -1178,7 +1178,7 @@ public class ChangePhoneActivity extends BaseFragment { codeField[num + 1].requestFocus(); } if ((num == length - 1 || num == length - 2 && len >= 2) && getCode().length() == length) { - onNextPressed(); + onNextPressed(null); } } } @@ -1194,7 +1194,7 @@ public class ChangePhoneActivity extends BaseFragment { }); codeField[a].setOnEditorActionListener((textView, i, keyEvent) -> { if (i == EditorInfo.IME_ACTION_NEXT) { - onNextPressed(); + onNextPressed(null); return true; } return false; @@ -1398,11 +1398,11 @@ public class ChangePhoneActivity extends BaseFragment { } @Override - public void onNextPressed() { + public void onNextPressed(String code) { if (nextPressed) { return; } - String code = getCode(); + code = getCode(); if (TextUtils.isEmpty(code)) { AndroidUtilities.shakeView(codeFieldContainer, 2, 0); return; @@ -1550,7 +1550,7 @@ public class ChangePhoneActivity extends BaseFragment { } if (id == NotificationCenter.didReceiveSmsCode) { codeField[0].setText("" + args[0]); - onNextPressed(); + onNextPressed(null); } else if (id == NotificationCenter.didReceiveCall) { String num = "" + args[0]; if (!AndroidUtilities.checkPhonePattern(pattern, num)) { @@ -1559,7 +1559,7 @@ public class ChangePhoneActivity extends BaseFragment { ignoreOnTextChange = true; codeField[0].setText(num); ignoreOnTextChange = false; - onNextPressed(); + onNextPressed(null); } } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index 82c7b4d3d..892bc3555 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -60,6 +60,7 @@ 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; @@ -98,7 +99,6 @@ import androidx.recyclerview.widget.LinearSmoothScrollerCustom; import androidx.recyclerview.widget.RecyclerView; import com.google.android.exoplayer2.ui.AspectRatioFrameLayout; -import com.google.android.exoplayer2.util.Log; import org.telegram.PhoneFormat.PhoneFormat; import org.telegram.messenger.AccountInstance; @@ -220,6 +220,7 @@ import org.telegram.ui.Components.RecyclerListView; import org.telegram.ui.Components.ReportAlert; import org.telegram.ui.Components.SearchCounterView; import org.telegram.ui.Components.ShareAlert; +import org.telegram.ui.Components.SharedMediaLayout; import org.telegram.ui.Components.Size; import org.telegram.ui.Components.SizeNotifierFrameLayout; import org.telegram.ui.Components.StickersAlert; @@ -265,7 +266,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not private ArrayList chatMessageCellsCache = new ArrayList<>(); - private HashMap alredyPlayedStickers = new HashMap<>(); + private HashMap alreadyPlayedStickers = new HashMap<>(); private Dialog closeChatDialog; private boolean showCloseChatDialogLater; @@ -342,6 +343,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not private boolean addToContactsButtonArchive; private TextView reportSpamButton; private ImageView closeReportSpam; + private TextView chatWithAdminTextView; private FragmentContextView fragmentContextView; private FragmentContextView fragmentLocationContextView; private View replyLineView; @@ -351,6 +353,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not private HintView searchAsListHint; private HintView scheduledOrNoSoundHint; private boolean searchAsListHintShown; + private HintView fwdRestrictedTopHint; + private HintView fwdRestrictedBottomHint; private HintView slowModeHint; private HintView pollHintView; private HintView timerHintView; @@ -538,7 +542,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not private boolean clearingHistory; public boolean openAnimationEnded; - private boolean fragmentOpened; + public boolean fragmentOpened; private long openAnimationStartTime; private boolean scrollToTopOnResume; @@ -592,6 +596,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not private boolean showScrollToMessageError; private int startLoadFromMessageId; + private int startLoadFromDate; private int startLoadFromMessageIdSaved; private int startLoadFromMessageOffset = Integer.MAX_VALUE; private int startFromVideoTimestamp = -1; @@ -752,6 +757,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not private ThemeDelegate themeDelegate; private ChatActivityMemberRequestsDelegate pendingRequestsDelegate; + private TLRPC.TL_channels_sendAsPeers sendAsPeersObj; + private final static int[] allowedNotificationsDuringChatListAnimations = new int[]{ NotificationCenter.messagesRead, NotificationCenter.threadMessagesRead, @@ -764,6 +771,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not NotificationCenter.updateMentionsCount, NotificationCenter.didUpdateConnectionState, NotificationCenter.updateInterfaces, + NotificationCenter.updateDefaultSendAsPeer, NotificationCenter.closeChats, NotificationCenter.chatInfoCantLoad, NotificationCenter.userInfoDidLoad, @@ -804,6 +812,37 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not private PinchToZoomHelper pinchToZoomHelper; private EmojiAnimationsOverlay emojiAnimationsOverlay; + public void deleteHistory(int dateSelectedStart, int dateSelectedEnd, boolean forAll) { + chatAdapter.frozenMessages.clear(); + for (int i = 0; i < messages.size(); i++) { + MessageObject messageObject = messages.get(i); + if (messageObject.messageOwner.date <= dateSelectedStart || messageObject.messageOwner.date >= dateSelectedEnd) { + chatAdapter.frozenMessages.add(messageObject); + } + } + if (chatListView != null) { + chatListView.setEmptyView(null); + } + if (chatAdapter.frozenMessages.isEmpty()) { + showProgressView(true); + } + chatAdapter.isFrozen = true; + chatAdapter.notifyDataSetChanged(true); + getUndoView().showWithAction(dialog_id, UndoView.ACTION_CLEAR_DATES, () -> { + getMessagesController().deleteMessagesRange(dialog_id, ChatObject.isChannel(currentChat) ? dialog_id : 0, dateSelectedStart, dateSelectedEnd, forAll, () -> { + chatAdapter.frozenMessages.clear(); + chatAdapter.isFrozen = false; + chatAdapter.notifyDataSetChanged(true); + showProgressView(false); + }); + }, () -> { + chatAdapter.frozenMessages.clear(); + chatAdapter.isFrozen = false; + chatAdapter.notifyDataSetChanged(true); + showProgressView(false); + }); + } + private interface ChatActivityDelegate { default void openReplyMessage(int mid) { @@ -1151,7 +1190,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not RecyclerListView.OnItemLongClickListenerExtended onItemLongClickListener = new RecyclerListView.OnItemLongClickListenerExtended() { @Override public boolean onItemClick(View view, int position, float x, float y) { - if (textSelectionHelper.isTryingSelect() || textSelectionHelper.isSelectionMode()) { + if (textSelectionHelper.isTryingSelect() || textSelectionHelper.isSelectionMode() || inPreviewMode) { return false; } wasManualScroll = true; @@ -1283,7 +1322,19 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not RecyclerListView.OnItemClickListenerExtended onItemClickListener = new RecyclerListView.OnItemClickListenerExtended() { @Override public void onItemClick(View view, int position, float x, float y) { + if (inPreviewMode) { + return; + } wasManualScroll = true; + if (view instanceof ChatActionCell && ((ChatActionCell) view).getMessageObject().isDateObject) { + Bundle bundle = new Bundle(); + int date = ((ChatActionCell) view).getMessageObject().messageOwner.date; + bundle.putLong("dialog_id", dialog_id); + bundle.putInt("type", CalendarActivity.TYPE_CHAT_ACTIVITY); + CalendarActivity calendarActivity = new CalendarActivity(bundle, SharedMediaLayout.FILTER_PHOTOS_AND_VIDEOS, date); + presentFragment(calendarActivity); + return; + } if (actionBar.isActionModeShowed() || reportType >= 0) { boolean outside = false; if (view instanceof ChatMessageCell) { @@ -1337,6 +1388,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not inlineReturn = arguments.getLong("inline_return", 0); String inlineQuery = arguments.getString("inline_query"); startLoadFromMessageId = arguments.getInt("message_id", 0); + startLoadFromDate = arguments.getInt("start_from_date", 0); startFromVideoTimestamp = arguments.getInt("video_timestamp", -1); threadUnreadMessagesCount = arguments.getInt("unread_count", 0); if (startFromVideoTimestamp >= 0) { @@ -1489,12 +1541,14 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.invalidateMotionBackground); getNotificationCenter().addObserver(this, NotificationCenter.didUpdateConnectionState); getNotificationCenter().addObserver(this, NotificationCenter.updateInterfaces); + getNotificationCenter().addObserver(this, NotificationCenter.updateDefaultSendAsPeer); if (chatMode != MODE_PINNED) { getNotificationCenter().addObserver(this, NotificationCenter.didReceiveNewMessages); } if (chatMode == 0) { getNotificationCenter().addObserver(this, NotificationCenter.didLoadSponsoredMessages); } + getNotificationCenter().addObserver(this, NotificationCenter.didLoadSendAsPeers); getNotificationCenter().addObserver(this, NotificationCenter.closeChats); getNotificationCenter().addObserver(this, NotificationCenter.messagesDeleted); getNotificationCenter().addObserver(this, NotificationCenter.historyCleared); @@ -1612,7 +1666,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } if (chatMode != MODE_PINNED && !forceHistoryEmpty) { waitingForLoad.add(lastLoadIndex); - if (startLoadFromMessageId != 0 && (!isThreadChat() || startLoadFromMessageId == highlightMessageId)) { + if (startLoadFromDate != 0) { + getMessagesController().loadMessages(dialog_id, mergeDialogId, false, 30, 0, startLoadFromDate, true, 0, classGuid, 4, 0, chatMode, threadMessageId, replyMaxReadId, lastLoadIndex++); + } else if (startLoadFromMessageId != 0 && (!isThreadChat() || startLoadFromMessageId == highlightMessageId)) { startLoadFromMessageIdSaved = startLoadFromMessageId; if (migrated_to != 0) { mergeDialogId = migrated_to; @@ -1730,6 +1786,31 @@ 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() { + int cur = parentLayout.fragmentsStack.indexOf(this); + 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); + if (fragment != this && fragment instanceof ChatActivity) { + ChatActivity chatActivity = (ChatActivity) fragment; + if (chatActivity.dialog_id == dialog_id) { + i = a; + break; + } + } + } + return i - cur; + } + @Override public void onFragmentDestroy() { super.onFragmentDestroy(); @@ -1760,6 +1841,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.invalidateMotionBackground); getNotificationCenter().removeObserver(this, NotificationCenter.didUpdateConnectionState); getNotificationCenter().removeObserver(this, NotificationCenter.updateInterfaces); + getNotificationCenter().removeObserver(this, NotificationCenter.updateDefaultSendAsPeer); getNotificationCenter().removeObserver(this, NotificationCenter.didReceiveNewMessages); getNotificationCenter().removeObserver(this, NotificationCenter.closeChats); getNotificationCenter().removeObserver(this, NotificationCenter.messagesRead); @@ -1819,6 +1901,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not getNotificationCenter().removeObserver(this, NotificationCenter.diceStickersDidLoad); getNotificationCenter().removeObserver(this, NotificationCenter.dialogDeleted); getNotificationCenter().removeObserver(this, NotificationCenter.didLoadSponsoredMessages); + getNotificationCenter().removeObserver(this, NotificationCenter.didLoadSendAsPeers); if (currentEncryptedChat != null) { getNotificationCenter().removeObserver(this, NotificationCenter.didVerifyMessagesStickers); } @@ -1830,9 +1913,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (currentUser != null) { MediaController.getInstance().stopMediaObserver(); } - if (currentEncryptedChat != null) { + + if (getOtherSameChatsDiff() == 0) { try { - if (Build.VERSION.SDK_INT >= 23 && (SharedConfig.passcodeHash.length() == 0 || SharedConfig.allowScreenCapture)) { + if (Build.VERSION.SDK_INT >= 23) { AndroidUtilities.setFlagSecure(this, false); } } catch (Throwable e) { @@ -2004,7 +2088,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } createDeleteMessagesAlert(null, null); } else if (id == forward) { - openForward(); + openForward(true); } else if (id == save_to) { ArrayList messageObjects = new ArrayList<>(); for (int a = 1; a >= 0; a--) { @@ -2217,6 +2301,53 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not actionBar.setTitle(LocaleController.getString("ReportChatPornography", R.string.ReportChatPornography)); } actionBar.setSubtitle(LocaleController.getString("ReportSelectMessages", R.string.ReportSelectMessages)); + } else if (startLoadFromDate != 0) { + final int date = startLoadFromDate; + actionBar.setOnClickListener((v) -> { + jumpToDate(date); + }); + actionBar.setTitle(LocaleController.formatDateChat(startLoadFromDate, false)); + actionBar.setSubtitle(LocaleController.getString("Loading", R.string.Loading)); + + TLRPC.TL_messages_getHistory gh1 = new TLRPC.TL_messages_getHistory(); + gh1.peer = getMessagesController().getInputPeer(dialog_id); + gh1.offset_date = startLoadFromDate; + gh1.limit = 1; + gh1.add_offset = -1; + + int req = getConnectionsManager().sendRequest(gh1, (response, error) -> { + if (response instanceof TLRPC.messages_Messages) { + List l = ((TLRPC.messages_Messages) response).messages; + if (!l.isEmpty()) { + + TLRPC.TL_messages_getHistory gh2 = new TLRPC.TL_messages_getHistory(); + gh2.peer = getMessagesController().getInputPeer(dialog_id); + gh2.offset_date = startLoadFromDate + 60 * 60 * 24; + gh2.limit = 1; + + getConnectionsManager().sendRequest(gh2, (response1, error1) -> { + if (response1 instanceof TLRPC.messages_Messages) { + List l2 = ((TLRPC.messages_Messages) response1).messages; + int count = 0; + if (!l2.isEmpty()) { + count = ((TLRPC.messages_Messages) response).offset_id_offset - ((TLRPC.messages_Messages) response1).offset_id_offset; + } else { + count = ((TLRPC.messages_Messages) response).offset_id_offset; + } + int finalCount = count; + AndroidUtilities.runOnUIThread(() -> { + if (finalCount != 0) { + AndroidUtilities.runOnUIThread(() -> actionBar.setSubtitle(LocaleController.formatPluralString("messages", finalCount))); + } else { + actionBar.setSubtitle(LocaleController.getString("NoMessagesForThisDay", R.string.NoMessagesForThisDay)); + } + }); + } + }); + } + } + }); + getConnectionsManager().bindRequestToGuid(req, classGuid); } else { actionBar.addView(avatarContainer, 0, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT, !inPreviewMode ? 56 : (chatMode == MODE_PINNED ? 10 : 0), 0, 40, 0)); } @@ -2257,6 +2388,7 @@ 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) { @@ -2273,6 +2405,7 @@ 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) { @@ -2538,7 +2671,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not actionModeViews.add(actionMode.addItemWithWidth(delete, R.drawable.msg_delete, AndroidUtilities.dp(54), LocaleController.getString("Delete", R.string.Delete))); } actionMode.getItem(edit).setVisibility(canEditMessagesCount == 1 && selectedMessagesIds[0].size() + selectedMessagesIds[1].size() == 1 ? View.VISIBLE : View.GONE); - actionMode.getItem(copy).setVisibility(selectedMessagesCanCopyIds[0].size() + selectedMessagesCanCopyIds[1].size() != 0 ? View.VISIBLE : View.GONE); + actionMode.getItem(copy).setVisibility(!getMessagesController().isChatNoForwards(currentChat) && selectedMessagesCanCopyIds[0].size() + selectedMessagesCanCopyIds[1].size() != 0 ? View.VISIBLE : View.GONE); actionMode.getItem(star).setVisibility(selectedMessagesCanStarIds[0].size() + selectedMessagesCanStarIds[1].size() != 0 ? View.VISIBLE : View.GONE); actionMode.getItem(delete).setVisibility(cantDeleteMessagesCount == 0 ? View.VISIBLE : View.GONE); checkActionBarMenu(false); @@ -2577,6 +2710,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } } + @Override + protected void onTransitionEnd() { + if (chatActivityEnterView != null) { + chatActivityEnterView.onAdjustPanTransitionEnd(); + } + } + @Override protected void onPanTranslationUpdate(float y, float progress, boolean keyboardVisible) { if (getParentLayout() != null && getParentLayout().isPreviewOpenAnimationInProgress()) { @@ -3804,7 +3944,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (e != null) { wasManualScroll = true; } - if (e != null && e.getAction() == MotionEvent.ACTION_DOWN && !startedTrackingSlidingView && !maybeStartTrackingSlidingView && slidingView == null) { + if (e != null && e.getAction() == MotionEvent.ACTION_DOWN && !startedTrackingSlidingView && !maybeStartTrackingSlidingView && slidingView == null && !inPreviewMode) { View view = getPressedChildView(); if (view instanceof ChatMessageCell) { if (slidingView != null) { @@ -3909,7 +4049,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (pullingDownDrawable != null && pullingDownDrawable.emptyStub && (System.currentTimeMillis() - pullingDownDrawable.lastShowingReleaseTime) < 500 && pullingDownDrawable.animateSwipeToRelease) { AnimatorSet animatorSet = new AnimatorSet(); pullingDownBackAnimator = animatorSet; - pullingDownDrawable.showBottomPanel(false); + if (pullingDownDrawable != null) { + pullingDownDrawable.showBottomPanel(false); + } ValueAnimator animator = ValueAnimator.ofFloat(pullingDownOffset, AndroidUtilities.dp(111)); animator.addUpdateListener(valueAnimator -> { pullingDownOffset = (float) valueAnimator.getAnimatedValue(); @@ -3932,7 +4074,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } else { ValueAnimator animator = ValueAnimator.ofFloat(pullingDownOffset, 0); pullingDownBackAnimator = animator; - pullingDownDrawable.showBottomPanel(false); + if (pullingDownDrawable != null) { + pullingDownDrawable.showBottomPanel(false); + } animator.addUpdateListener(valueAnimator -> { pullingDownOffset = (float) valueAnimator.getAnimatedValue(); chatListView.invalidate(); @@ -6507,17 +6651,23 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not mentiondownButton.addView(mentiondownButtonCounter, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 23, Gravity.TOP | Gravity.CENTER_HORIZONTAL)); mentiondownButton.setContentDescription(LocaleController.getString("AccDescrMentionDown", R.string.AccDescrMentionDown)); - contentView.addView(fragmentLocationContextView = new FragmentContextView(context, this, true, themeDelegate), LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 38, Gravity.TOP | Gravity.LEFT, 0, -36, 0, 0)); - contentView.addView(fragmentContextView = new FragmentContextView(context, this, false, themeDelegate) { - @Override - protected void playbackSpeedChanged(float value) { - if (Math.abs(value - 1.0f) < 0.001f || Math.abs(value - 1.8f) < 0.001f) { - undoView.showWithAction(0, Math.abs(value - 1.0f) > 0.001f ? UndoView.ACTION_PLAYBACK_SPEED_ENABLED : UndoView.ACTION_PLAYBACK_SPEED_DISABLED, value, null, null); + + if (!inMenuMode) { + fragmentLocationContextView = new FragmentContextView(context, this, true, themeDelegate); + fragmentContextView = new FragmentContextView(context, this, false, themeDelegate) { + @Override + protected void playbackSpeedChanged(float value) { + if (Math.abs(value - 1.0f) < 0.001f || Math.abs(value - 1.8f) < 0.001f) { + undoView.showWithAction(0, Math.abs(value - 1.0f) > 0.001f ? UndoView.ACTION_PLAYBACK_SPEED_ENABLED : UndoView.ACTION_PLAYBACK_SPEED_DISABLED, value, null, null); + } } - } - }, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 38, Gravity.TOP | Gravity.LEFT, 0, -36, 0, 0)); - fragmentContextView.setAdditionalContextView(fragmentLocationContextView); - fragmentLocationContextView.setAdditionalContextView(fragmentContextView); + }; + contentView.addView(fragmentLocationContextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 38, Gravity.TOP | Gravity.LEFT, 0, -36, 0, 0)); + contentView.addView(fragmentContextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 38, Gravity.TOP | Gravity.LEFT, 0, -36, 0, 0)); + + fragmentContextView.setAdditionalContextView(fragmentLocationContextView); + fragmentLocationContextView.setAdditionalContextView(fragmentContextView); + } if (chatMode != 0) { fragmentContextView.setSupportsCalls(false); @@ -6748,6 +6898,21 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not int lastSize; + @Override + public int getContentViewHeight() { + return contentView.getHeight(); + } + + @Override + public int measureKeyboardHeight() { + return contentView.measureKeyboardHeight(); + } + + @Override + public TLRPC.TL_channels_sendAsPeers getSendAsPeers() { + return sendAsPeersObj; + } + @Override public void onMessageSend(CharSequence message, boolean notify, int scheduleDate) { if (chatListItemAnimator != null) { @@ -6807,6 +6972,7 @@ 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); } @@ -6817,6 +6983,7 @@ 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 { @@ -6878,6 +7045,7 @@ 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) { @@ -7454,7 +7622,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not return; } AndroidUtilities.hideKeyboard(searchItem.getSearchField()); - showDialog(AlertsCreator.createCalendarPickerDialog(getParentActivity(), 1375315200000L, this::jumpToDate, themeDelegate).create()); + showDialog(AlertsCreator.createCalendarPickerDialog(getParentActivity(), 1375315200000L, new MessagesStorage.IntCallback() { + @Override + public void run(int param) { + jumpToDate(param); + } + }, themeDelegate).create()); }); searchCalendarButton.setContentDescription(LocaleController.getString("JumpToDate", R.string.JumpToDate)); @@ -7656,7 +7829,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not image = context.getResources().getDrawable(R.drawable.input_forward).mutate(); image.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_actionBarActionModeDefaultIcon), PorterDuff.Mode.MULTIPLY)); forwardButton.setCompoundDrawablesWithIntrinsicBounds(image, null, null, null); - forwardButton.setOnClickListener(v -> openForward()); + forwardButton.setOnClickListener(v -> openForward(false)); bottomMessagesActionContainer.addView(forwardButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.RIGHT | Gravity.TOP)); contentView.addView(searchContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 51, Gravity.BOTTOM)); @@ -7693,7 +7866,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not chatScrollHelper.setAnimationCallback(chatScrollHelperCallback); try { - if (currentEncryptedChat != null && Build.VERSION.SDK_INT >= 23 && (SharedConfig.passcodeHash.length() == 0 || SharedConfig.allowScreenCapture)) { + if (currentEncryptedChat != null && Build.VERSION.SDK_INT >= 23 && (SharedConfig.passcodeHash.length() == 0 || SharedConfig.allowScreenCapture) || + getMessagesController().isChatNoForwards(currentChat) && getOtherSameChatsDiff() >= 0) { AndroidUtilities.setFlagSecure(this, true); } } catch (Throwable e) { @@ -8336,7 +8510,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (progressView == null) { return; } - if (fragmentOpened && BuildVars.DEBUG_VERSION) { + if (fragmentOpened) { if (show == animateTo) { return; } @@ -8697,7 +8871,44 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not contentView.removeView(videoPlayerContainer); } - private void openForward() { + private void openForward(boolean fromActionBar) { + if (getMessagesController().isChatNoForwards(currentChat)) { + // We should update text if user changed locale without re-opening chat activity + String str = ChatObject.isChannel(currentChat) && !currentChat.megagroup ? LocaleController.getString("ForwardsRestrictedInfoChannel", R.string.ForwardsRestrictedInfoChannel) : + LocaleController.getString("ForwardsRestrictedInfoGroup", R.string.ForwardsRestrictedInfoGroup); + if (fromActionBar) { + if (fwdRestrictedTopHint == null) { + SizeNotifierFrameLayout frameLayout = (SizeNotifierFrameLayout) fragmentView; + int index = frameLayout.indexOfChild(chatActivityEnterView); + if (index == -1) { + return; + } + fwdRestrictedTopHint = new HintView(getParentActivity(), 7, true); + frameLayout.addView(fwdRestrictedTopHint, index + 1, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 12, 0, 12, 0)); + fwdRestrictedTopHint.setAlpha(0.0f); + fwdRestrictedTopHint.setVisibility(View.INVISIBLE); + } + + fwdRestrictedTopHint.setText(str); + fwdRestrictedTopHint.showForView(actionBar.getActionMode().getItem(forward), true); + } else { + if (fwdRestrictedBottomHint == null) { + SizeNotifierFrameLayout frameLayout = (SizeNotifierFrameLayout) fragmentView; + int index = frameLayout.indexOfChild(chatActivityEnterView); + if (index == -1) { + return; + } + fwdRestrictedBottomHint = new HintView(getParentActivity(), 9); + frameLayout.addView(fwdRestrictedBottomHint, index + 1, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 12, 0, 12, 0)); + fwdRestrictedBottomHint.setAlpha(0.0f); + fwdRestrictedBottomHint.setVisibility(View.INVISIBLE); + } + + fwdRestrictedBottomHint.setText(str); + fwdRestrictedBottomHint.showForView(forwardButton, true); + } + return; + } int hasPoll = 0; boolean hasInvoice = false; for (int a = 0; a < 2; a++) { @@ -8879,7 +9090,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not return groupedMessages; } - private void jumpToDate(int date) { + public void jumpToDate(int date) { if (messages.isEmpty()) { return; } @@ -9389,6 +9600,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not scheduledOrNoSoundHint.hide(); } } + if (fwdRestrictedBottomHint != null) { + fwdRestrictedBottomHint.hide(); + } + if (fwdRestrictedTopHint != null) { + fwdRestrictedTopHint.hide(); + } if (noSoundHintView != null) { noSoundHintView.hide(); } @@ -9598,7 +9815,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } private void showTextSelectionHint(MessageObject messageObject) { - if (getParentActivity() == null) { + if (getParentActivity() == null || getMessagesController().isChatNoForwards(messageObject.getChatId())) { return; } CharSequence text; @@ -9990,7 +10207,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } private void checkScrollForLoad(boolean scroll) { - if (chatLayoutManager == null || paused) { + if (chatLayoutManager == null || paused || chatAdapter.isFrozen) { return; } int firstVisibleItem = chatLayoutManager.findFirstVisibleItemPosition(); @@ -10563,7 +10780,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (ChatObject.isChannel(currentChat) && currentChat.megagroup && messageObjectToReply.isForwardedChannelPost()) { chat = getMessagesController().getChat(messageObjectToReply.messageOwner.fwd_from.from_id.channel_id); } else { - chat = getMessagesController().getChat(messageObjectToReply.messageOwner.peer_id.channel_id); + chat = getMessagesController().getChat(-messageObjectToReply.getSenderId()); } if (chat == null) { return; @@ -11335,7 +11552,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } } currentPinnedMessageId = findClosest(pinnedMessageIds, forceNextPinnedMessageId != 0 ? forceNextPinnedMessageId : maxVisibleId, currentPinnedMessageIndex); - if (!loadingPinnedMessagesList && !pinnedEndReached && !pinnedMessageIds.isEmpty() && currentPinnedMessageIndex[0] > pinnedMessageIds.size() - 2) { + if (!inMenuMode && !loadingPinnedMessagesList && !pinnedEndReached && !pinnedMessageIds.isEmpty() && currentPinnedMessageIndex[0] > pinnedMessageIds.size() - 2) { getMediaDataController().loadPinnedMessages(dialog_id, pinnedMessageIds.get(pinnedMessageIds.size() - 1), 0); loadingPinnedMessagesList = true; } @@ -12307,14 +12524,15 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (!messageObject.canDeleteMessage(chatMode == MODE_SCHEDULED, currentChat)) { cantDeleteMessagesCount--; } - if (chatMode == MODE_SCHEDULED || !messageObject.canForwardMessage()) { + boolean noforwards = getMessagesController().isChatNoForwards(currentChat); + if (chatMode == MODE_SCHEDULED || !messageObject.canForwardMessage() || noforwards) { cantForwardMessagesCount--; } else { canForwardMessagesCount--; } - if (messageObject.isMusic()) { + if (messageObject.isMusic() && !noforwards) { canSaveMusicCount--; - } else if (messageObject.isDocument()) { + } else if (messageObject.isDocument() && !noforwards) { canSaveDocumentsCount--; } else { cantSaveMessagesCount--; @@ -12343,14 +12561,15 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (!messageObject.canDeleteMessage(chatMode == MODE_SCHEDULED, currentChat)) { cantDeleteMessagesCount++; } - if (chatMode == MODE_SCHEDULED || !messageObject.canForwardMessage()) { + boolean noforwards = getMessagesController().isChatNoForwards(currentChat); + if (chatMode == MODE_SCHEDULED || !messageObject.canForwardMessage() || noforwards) { cantForwardMessagesCount++; } else { canForwardMessagesCount++; } - if (messageObject.isMusic()) { + if (messageObject.isMusic() && !noforwards) { canSaveMusicCount++; - } else if (messageObject.isDocument()) { + } else if (messageObject.isDocument() && !noforwards) { canSaveDocumentsCount++; } else { cantSaveMessagesCount++; @@ -12377,15 +12596,27 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not ActionBarMenuItem editItem = actionBar.createActionMode().getItem(edit); ActionBarMenuItem forwardItem = actionBar.createActionMode().getItem(forward); + boolean noforwards = getMessagesController().isChatNoForwards(currentChat); if (prevCantForwardCount == 0 && cantForwardMessagesCount != 0 || prevCantForwardCount != 0 && cantForwardMessagesCount == 0) { forwardButtonAnimation = new AnimatorSet(); ArrayList animators = new ArrayList<>(); if (forwardItem != null) { - forwardItem.setEnabled(cantForwardMessagesCount == 0); + forwardItem.setEnabled(cantForwardMessagesCount == 0 || noforwards); animators.add(ObjectAnimator.ofFloat(forwardItem, View.ALPHA, cantForwardMessagesCount == 0 ? 1.0f : 0.5f)); + + if (noforwards) { + if (forwardItem.getBackground() != null) forwardItem.setBackground(null); + } else if (forwardItem.getBackground() == null) { + forwardItem.setBackground(Theme.createSelectorDrawable(getThemedColor(Theme.key_actionBarActionModeDefaultSelector), 5)); + } } if (forwardButton != null) { - forwardButton.setEnabled(cantForwardMessagesCount == 0); + forwardButton.setEnabled(cantForwardMessagesCount == 0 || noforwards); + if (noforwards) { + if (forwardButton.getBackground() != null) forwardButton.setBackground(null); + } else if (forwardButton.getBackground() == null) { + forwardButton.setBackground(Theme.createSelectorDrawable(getThemedColor(Theme.key_actionBarActionModeDefaultSelector), 3)); + } animators.add(ObjectAnimator.ofFloat(forwardButton, View.ALPHA, cantForwardMessagesCount == 0 ? 1.0f : 0.5f)); } forwardButtonAnimation.playTogether(animators); @@ -12399,11 +12630,21 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not forwardButtonAnimation.start(); } else { if (forwardItem != null) { - forwardItem.setEnabled(cantForwardMessagesCount == 0); + forwardItem.setEnabled(cantForwardMessagesCount == 0 || noforwards); forwardItem.setAlpha(cantForwardMessagesCount == 0 ? 1.0f : 0.5f); + if (noforwards) { + if (forwardItem.getBackground() != null) forwardButton.setBackground(null); + } else if (forwardItem.getBackground() == null) { + forwardItem.setBackground(Theme.createSelectorDrawable(getThemedColor(Theme.key_actionBarActionModeDefaultSelector), 3)); + } } if (forwardButton != null) { - forwardButton.setEnabled(cantForwardMessagesCount == 0); + forwardButton.setEnabled(cantForwardMessagesCount == 0 || noforwards); + if (noforwards) { + if (forwardButton.getBackground() != null) forwardButton.setBackground(null); + } else if (forwardButton.getBackground() == null) { + forwardButton.setBackground(Theme.createSelectorDrawable(getThemedColor(Theme.key_actionBarActionModeDefaultSelector), 3)); + } forwardButton.setAlpha(cantForwardMessagesCount == 0 ? 1.0f : 0.5f); } } @@ -12414,7 +12655,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not int copyVisible = copyItem.getVisibility(); int starVisible = starItem.getVisibility(); - copyItem.setVisibility(selectedMessagesCanCopyIds[0].size() + selectedMessagesCanCopyIds[1].size() != 0 ? View.VISIBLE : View.GONE); + copyItem.setVisibility(!noforwards && selectedMessagesCanCopyIds[0].size() + selectedMessagesCanCopyIds[1].size() != 0 ? View.VISIBLE : View.GONE); starItem.setVisibility(getMediaDataController().canAddStickerToFavorites() && (selectedMessagesCanStarIds[0].size() + selectedMessagesCanStarIds[1].size()) == selectedCount ? View.VISIBLE : View.GONE); int newCopyVisible = copyItem.getVisibility(); int newStarVisible = starItem.getVisibility(); @@ -13089,15 +13330,17 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not forwardEndReached[0] = forwardEndReached[1] = true; firstLoading = false; showProgressView(false); - if (!fragmentOpened) { - chatListView.setAnimateEmptyView(false, 1); - chatListView.setEmptyView(emptyViewContainer); - chatListView.setAnimateEmptyView(true, 1); - } else { - chatListView.setEmptyView(emptyViewContainer); + if (chatListView != null) { + if (!fragmentOpened) { + chatListView.setAnimateEmptyView(false, 1); + chatListView.setEmptyView(emptyViewContainer); + chatListView.setAnimateEmptyView(true, 1); + } else { + chatListView.setEmptyView(emptyViewContainer); + } + chatAdapter.notifyDataSetChanged(); } - chatAdapter.notifyDataSetChanged(); resumeDelayedFragmentAnimation(); MessageObject messageObject = messArr.get(0); getMessagesController().markDialogAsRead(dialog_id, messageObject.getId(), messageObject.getId(), messageObject.messageOwner.date, false, 0, 0, true, 0); @@ -13778,6 +14021,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } if (scrollToMessage != null) { addSponsoredMessages(!isFirstLoading); + loadSendAsPeers(); int yOffset; boolean bottom = true; if (startLoadFromMessageOffset != Integer.MAX_VALUE) { @@ -13925,6 +14169,18 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (isThreadChat()) { invalidateMessagesVisiblePart(); } + if (startLoadFromDate != 0) { + int dateObjectIndex = -1; + 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 (dateObjectIndex > 0) { + chatLayoutManager.scrollToPositionWithOffset(chatAdapter.messagesStartRow + dateObjectIndex, (int) (AndroidUtilities.dp(4)), false); + } + } } if (messages.isEmpty() && currentEncryptedChat == null && currentUser != null && currentUser.bot && botUser == null) { botUser = ""; @@ -13950,6 +14206,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not showFloatingDateView(false); } addSponsoredMessages(!isFirstLoading); + loadSendAsPeers(); checkScrollForLoad(false); if (postponedScroll) { @@ -14063,6 +14320,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not avatarContainer.updateOnlineCount(); avatarContainer.updateSubtitle(); } + } else if (id == NotificationCenter.updateDefaultSendAsPeer) { + long chatId = (long) args[0]; + if (chatId == dialog_id) { + chatActivityEnterView.updateSendAsButton(); + } } else if (id == NotificationCenter.updateInterfaces) { int updateMask = (Integer) args[0]; if ((updateMask & MessagesController.UPDATE_MASK_NAME) != 0 || (updateMask & MessagesController.UPDATE_MASK_CHAT_NAME) != 0) { @@ -14094,16 +14356,32 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not updateSubtitle = true; } if ((updateMask & MessagesController.UPDATE_MASK_CHAT) != 0 && currentChat != null) { + boolean fwdBefore = getMessagesController().isChatNoForwards(currentChat); TLRPC.Chat chat = getMessagesController().getChat(currentChat.id); if (chat == null) { return; } currentChat = chat; + boolean fwdChanged = getMessagesController().isChatNoForwards(currentChat) != fwdBefore; updateSubtitle = !isThreadChat(); updateBottomOverlay(); if (chatActivityEnterView != null) { chatActivityEnterView.setDialogId(dialog_id, currentAccount); } + + if (fwdChanged) { + try { + if (Build.VERSION.SDK_INT >= 23) { + if (currentEncryptedChat != null && SharedConfig.passcodeHash.length() == 0) { + AndroidUtilities.setFlagSecure(this, true); + } else if (getOtherSameChatsDiff() >= 0) { + AndroidUtilities.setFlagSecure(this, (getMessagesController().isChatNoForwards(currentChat))); + } + } + } catch (Throwable e) { + FileLog.e(e); + } + } } if (avatarContainer != null && updateSubtitle) { avatarContainer.updateSubtitle(true); @@ -14134,6 +14412,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } checkWaitingForReplies(); } + } else if (id == NotificationCenter.didLoadSendAsPeers) { + loadSendAsPeers(); } else if (id == NotificationCenter.didLoadSponsoredMessages) { addSponsoredMessages(true); } else if (id == NotificationCenter.closeChats) { @@ -14179,14 +14459,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not Integer count = (Integer) args[2]; obj.messageOwner.replies.replies += count; if (count > 0) { - TLRPC.Peer peer; - if (ChatObject.shouldSendAnonymously(currentChat)) { - peer = new TLRPC.TL_peerChannel(); - peer.channel_id = currentChat.id; - } else { - peer = new TLRPC.TL_peerUser(); - peer.user_id = getUserConfig().getClientUserId(); - } + TLRPC.Peer peer = getMessagesController().getPeer(ChatObject.getSendAsPeerId(currentChat, getMessagesController().getChatFull(currentChat.id))); for (int c = 0, N = obj.messageOwner.replies.recent_repliers.size(); c < N; c++) { if (MessageObject.getPeerId(obj.messageOwner.replies.recent_repliers.get(c)) == MessageObject.getPeerId(peer)) { obj.messageOwner.replies.recent_repliers.remove(c); @@ -14557,6 +14830,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (ChatObject.isChannel(currentChat) && currentChat.megagroup && fragmentContextView != null) { fragmentContextView.checkCall(openAnimationStartTime == 0 || SystemClock.elapsedRealtime() < openAnimationStartTime + 150); } + if (chatActivityEnterView != null) { + chatActivityEnterView.updateSendAsButton(); + chatActivityEnterView.updateFieldHint(false); + } + if (chatAdapter != null) { + chatAdapter.notifyDataSetChanged(); + } if (prevLinkedChatId != chatInfo.linked_chat_id) { if (prevLinkedChatId != 0) { TLRPC.Chat chat = getMessagesController().getChat(prevLinkedChatId); @@ -14586,7 +14866,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not avatarContainer.updateOnlineCount(); avatarContainer.updateSubtitle(); } - if (!loadingPinnedMessagesList && !pinnedMessageIds.isEmpty() && chatInfo.pinned_msg_id > pinnedMessageIds.get(0)) { + if (!inMenuMode && !loadingPinnedMessagesList && !pinnedMessageIds.isEmpty() && chatInfo.pinned_msg_id > pinnedMessageIds.get(0)) { getMediaDataController().loadPinnedMessages(dialog_id, 0, chatInfo.pinned_msg_id); loadingPinnedMessagesList = true; } @@ -15566,7 +15846,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not getMediaDataController().loadReplyMessagesForMessages(new ArrayList<>(pinnedMessageObjects.values()), dialog_id, false, null); - if (!loadingPinnedMessagesList && totalPinnedMessagesCount == 0 && !pinnedEndReached) { + if (!inMenuMode && !loadingPinnedMessagesList && totalPinnedMessagesCount == 0 && !pinnedEndReached) { getMediaDataController().loadPinnedMessages(dialog_id, 0, pinnedMessageIds.isEmpty() ? 0 : pinnedMessageIds.get(0)); loadingPinnedMessagesList = true; } @@ -15604,7 +15884,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } } checkActionBarMenu(false); - if (!loadingPinnedMessagesList && !pinnedMessageIds.isEmpty() && userInfo.pinned_msg_id > pinnedMessageIds.get(0)) { + if (!inMenuMode && !loadingPinnedMessagesList && !pinnedMessageIds.isEmpty() && userInfo.pinned_msg_id > pinnedMessageIds.get(0)) { getMediaDataController().loadPinnedMessages(dialog_id, 0, userInfo.pinned_msg_id); loadingPinnedMessagesList = true; } @@ -15776,6 +16056,16 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not }, true, themeDelegate); } + private void loadSendAsPeers() { + if (sendAsPeersObj != null || currentChat == null || !ChatObject.canSendAsPeers(currentChat) || chatActivityEnterView == null) { + return; + } + sendAsPeersObj = getMessagesController().getSendAsPeers(dialog_id); + if (sendAsPeersObj != null) { + chatActivityEnterView.updateSendAsButton(); + } + } + private boolean sponsoredMessagesAdded; private void addSponsoredMessages(boolean animated) { if (sponsoredMessagesAdded || chatMode != 0 || !ChatObject.isChannel(currentChat) || currentChat.megagroup || currentChat.gigagroup || !forwardEndReached[0]) { @@ -17861,7 +18151,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } private void updatePinnedListButton(boolean animated) { - if (isThreadChat() || pinnedListButton == null) { + if (isThreadChat() || pinnedListButton == null || inMenuMode) { return; } boolean show = pinnedMessageIds.size() > 1; @@ -17943,7 +18233,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } private void updatePinnedMessageView(boolean animated, int animateToNext) { - if (pinnedMessageView == null || chatMode != 0) { + if (pinnedMessageView == null || chatMode != 0 || inMenuMode) { return; } int pinned_msg_id; @@ -18454,7 +18744,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } private void updateTopPanel(boolean animated) { - if (topChatPanelView == null || chatMode != 0) { + if (topChatPanelView == null || chatMode != 0 || inMenuMode) { return; } @@ -18477,6 +18767,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not boolean showAdd = preferences.getBoolean("dialog_bar_add" + did, false); boolean showArchive = preferences.getBoolean("dialog_bar_archived" + dialog_id, false); boolean showGeo = preferences.getBoolean("dialog_bar_location" + did, false); + String chatWithAdmin = preferences.getString("dialog_bar_chat_with_admin_title" + did, null); + boolean chatWithAdminChannel = preferences.getBoolean("dialog_bar_chat_with_channel" + did, false); + int chatWithAdminDate = preferences.getInt("dialog_bar_chat_with_date" + did, 0); boolean showAddMembersToGroup = preferences.getBoolean("dialog_bar_invite" + did, false); if (showAddMembersToGroup) { @@ -18491,7 +18784,34 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not addToContactsButtonArchive = false; TLRPC.User user = currentUser != null ? getMessagesController().getUser(currentUser.id) : null; - if (showAddMembersToGroup) { + boolean isChatWithAdmin = false; + if (user != null && !TextUtils.isEmpty(chatWithAdmin)) { + isChatWithAdmin = true; + if (chatWithAdminTextView == null) { + chatWithAdminTextView = new TextView(topChatPanelView.getContext()); + chatWithAdminTextView.setGravity(Gravity.CENTER_VERTICAL); + chatWithAdminTextView.setPadding(AndroidUtilities.dp(14), 0, AndroidUtilities.dp(46), 0); + chatWithAdminTextView.setBackground(Theme.createSelectorDrawable(getThemedColor(Theme.key_listSelector), 2)); + topChatPanelView.addView(chatWithAdminTextView, 0, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, 0, 0, 0, 0, 1)); + chatWithAdminTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); + chatWithAdminTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + chatWithAdminTextView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + AlertsCreator.showChatWithAdmin(ChatActivity.this, user, chatWithAdmin, chatWithAdminChannel, chatWithAdminDate); + } + }); + } + String str; + if (chatWithAdminChannel) { + str = LocaleController.formatString("ChatWithGroupAdmin", R.string.ChatWithGroupAdmin, user.first_name, chatWithAdmin); + } else { + str = LocaleController.formatString("ChatWithChannelAdmin", R.string.ChatWithChannelAdmin, user.first_name, chatWithAdmin); + } + reportSpamButton.setVisibility(View.GONE); + addToContactsButton.setVisibility(View.GONE); + chatWithAdminTextView.setText(AndroidUtilities.replaceTags(str)); + } else if (showAddMembersToGroup) { String str = LocaleController.getString("GroupAddMembers", R.string.GroupAddMembers); if (str != null) { str = str.toUpperCase(); @@ -18574,7 +18894,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not addContactItem.setVisibility(View.GONE); } } - if (userBlocked || addToContactsButton.getVisibility() == View.GONE && reportSpamButton.getVisibility() == View.GONE) { + + if (chatWithAdminTextView != null) { + chatWithAdminTextView.setVisibility(isChatWithAdmin ? View.VISIBLE : View.GONE); + } + if (userBlocked || (addToContactsButton.getVisibility() == View.GONE && reportSpamButton.getVisibility() == View.GONE && (chatWithAdminTextView == null || chatWithAdminTextView.getVisibility() == View.GONE))) { show = false; } @@ -19563,7 +19887,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not selectedObjectGroup = groupedMessages; if (type == -1) { - if (selectedObject.type == 0 || selectedObject.isAnimatedEmoji() || getMessageCaption(selectedObject, selectedObjectGroup) != null) { + if ((selectedObject.type == 0 || selectedObject.isAnimatedEmoji() || getMessageCaption(selectedObject, selectedObjectGroup) != null) && !getMessagesController().isChatNoForwards(currentChat)) { items.add(LocaleController.getString("Copy", R.string.Copy)); options.add(3); icons.add(R.drawable.msg_copy); @@ -19625,9 +19949,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not items.add(LocaleController.getString("Retry", R.string.Retry)); options.add(0); icons.add(R.drawable.msg_retry); - items.add(LocaleController.getString("Copy", R.string.Copy)); - options.add(3); - icons.add(R.drawable.msg_copy); + if (!getMessagesController().isChatNoForwards(currentChat)) { + items.add(LocaleController.getString("Copy", R.string.Copy)); + options.add(3); + icons.add(R.drawable.msg_copy); + } items.add(LocaleController.getString("Delete", R.string.Delete)); options.add(1); icons.add(selectedObject.messageOwner.ttl_period != 0 ? R.drawable.msg_delete_auto : R.drawable.msg_delete); @@ -19654,7 +19980,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not options.add(8); icons.add(R.drawable.msg_reply); } - if (selectedObject.type == 0 || selectedObject.isDice() || selectedObject.isAnimatedEmoji() || getMessageCaption(selectedObject, selectedObjectGroup) != null) { + if ((selectedObject.type == 0 || selectedObject.isDice() || selectedObject.isAnimatedEmoji() || getMessageCaption(selectedObject, selectedObjectGroup) != null) && !getMessagesController().isChatNoForwards(currentChat)) { items.add(LocaleController.getString("Copy", R.string.Copy)); options.add(3); icons.add(R.drawable.msg_copy); @@ -19692,79 +20018,85 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not options.add(26); icons.add(R.drawable.msg_pollstop); } - } else if (selectedObject.isMusic()) { + } else if (selectedObject.isMusic() && !getMessagesController().isChatNoForwards(currentChat)) { items.add(LocaleController.getString("SaveToMusic", R.string.SaveToMusic)); options.add(10); icons.add(R.drawable.msg_download); - } else if (selectedObject.isDocument()) { + } else if (selectedObject.isDocument() && !getMessagesController().isChatNoForwards(currentChat)) { items.add(LocaleController.getString("SaveToDownloads", R.string.SaveToDownloads)); options.add(10); icons.add(R.drawable.msg_download); } } - } else if (type == 3) { + } else if (type == 3 && !getMessagesController().isChatNoForwards(currentChat)) { if (selectedObject.messageOwner.media instanceof TLRPC.TL_messageMediaWebPage && MessageObject.isNewGifDocument(selectedObject.messageOwner.media.webpage.document)) { items.add(LocaleController.getString("SaveToGIFs", R.string.SaveToGIFs)); options.add(11); icons.add(R.drawable.msg_gif); } } else if (type == 4) { - if (selectedObject.isVideo()) { - if (!selectedObject.needDrawBluredPreview()) { - items.add(LocaleController.getString("SaveToGallery", R.string.SaveToGallery)); - options.add(4); - icons.add(R.drawable.msg_gallery); + if (!getMessagesController().isChatNoForwards(currentChat)) { + if (selectedObject.isVideo()) { + if (!selectedObject.needDrawBluredPreview()) { + items.add(LocaleController.getString("SaveToGallery", R.string.SaveToGallery)); + options.add(4); + icons.add(R.drawable.msg_gallery); + items.add(LocaleController.getString("ShareFile", R.string.ShareFile)); + options.add(6); + icons.add(R.drawable.msg_shareout); + } + } else if (selectedObject.isMusic()) { + items.add(LocaleController.getString("SaveToMusic", R.string.SaveToMusic)); + options.add(10); + icons.add(R.drawable.msg_download); items.add(LocaleController.getString("ShareFile", R.string.ShareFile)); options.add(6); icons.add(R.drawable.msg_shareout); - } - } else if (selectedObject.isMusic()) { - items.add(LocaleController.getString("SaveToMusic", R.string.SaveToMusic)); - options.add(10); - icons.add(R.drawable.msg_download); - items.add(LocaleController.getString("ShareFile", R.string.ShareFile)); - options.add(6); - icons.add(R.drawable.msg_shareout); - } else if (selectedObject.getDocument() != null) { - if (MessageObject.isNewGifDocument(selectedObject.getDocument())) { - items.add(LocaleController.getString("SaveToGIFs", R.string.SaveToGIFs)); - options.add(11); - icons.add(R.drawable.msg_gif); - } - items.add(LocaleController.getString("SaveToDownloads", R.string.SaveToDownloads)); - options.add(10); - icons.add(R.drawable.msg_download); - items.add(LocaleController.getString("ShareFile", R.string.ShareFile)); - options.add(6); - icons.add(R.drawable.msg_shareout); - } else { - if (!selectedObject.needDrawBluredPreview()) { - items.add(LocaleController.getString("SaveToGallery", R.string.SaveToGallery)); - options.add(4); - icons.add(R.drawable.msg_gallery); + } else if (selectedObject.getDocument() != null) { + if (MessageObject.isNewGifDocument(selectedObject.getDocument())) { + items.add(LocaleController.getString("SaveToGIFs", R.string.SaveToGIFs)); + options.add(11); + icons.add(R.drawable.msg_gif); + } + items.add(LocaleController.getString("SaveToDownloads", R.string.SaveToDownloads)); + options.add(10); + icons.add(R.drawable.msg_download); + items.add(LocaleController.getString("ShareFile", R.string.ShareFile)); + options.add(6); + icons.add(R.drawable.msg_shareout); + } else { + if (!selectedObject.needDrawBluredPreview()) { + items.add(LocaleController.getString("SaveToGallery", R.string.SaveToGallery)); + options.add(4); + icons.add(R.drawable.msg_gallery); + } } } } else if (type == 5) { items.add(LocaleController.getString("ApplyLocalizationFile", R.string.ApplyLocalizationFile)); options.add(5); icons.add(R.drawable.msg_language); - items.add(LocaleController.getString("SaveToDownloads", R.string.SaveToDownloads)); - options.add(10); - icons.add(R.drawable.msg_download); - items.add(LocaleController.getString("ShareFile", R.string.ShareFile)); - options.add(6); - icons.add(R.drawable.msg_shareout); + if (!getMessagesController().isChatNoForwards(currentChat)) { + items.add(LocaleController.getString("SaveToDownloads", R.string.SaveToDownloads)); + options.add(10); + icons.add(R.drawable.msg_download); + items.add(LocaleController.getString("ShareFile", R.string.ShareFile)); + options.add(6); + icons.add(R.drawable.msg_shareout); + } } else if (type == 10) { items.add(LocaleController.getString("ApplyThemeFile", R.string.ApplyThemeFile)); options.add(5); icons.add(R.drawable.msg_theme); - items.add(LocaleController.getString("SaveToDownloads", R.string.SaveToDownloads)); - options.add(10); - icons.add(R.drawable.msg_download); - items.add(LocaleController.getString("ShareFile", R.string.ShareFile)); - options.add(6); - icons.add(R.drawable.msg_shareout); - } else if (type == 6) { + if (!getMessagesController().isChatNoForwards(currentChat)) { + items.add(LocaleController.getString("SaveToDownloads", R.string.SaveToDownloads)); + options.add(10); + icons.add(R.drawable.msg_download); + items.add(LocaleController.getString("ShareFile", R.string.ShareFile)); + options.add(6); + icons.add(R.drawable.msg_shareout); + } + } else if (type == 6 && !getMessagesController().isChatNoForwards(currentChat)) { items.add(LocaleController.getString("SaveToGallery", R.string.SaveToGallery)); options.add(7); icons.add(R.drawable.msg_gallery); @@ -19808,9 +20140,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not icons.add(R.drawable.msg_addcontact); } if (!TextUtils.isEmpty(selectedObject.messageOwner.media.phone_number)) { - items.add(LocaleController.getString("Copy", R.string.Copy)); - options.add(16); - icons.add(R.drawable.msg_copy); + if (!getMessagesController().isChatNoForwards(currentChat)) { + items.add(LocaleController.getString("Copy", R.string.Copy)); + options.add(16); + icons.add(R.drawable.msg_copy); + } items.add(LocaleController.getString("Call", R.string.Call)); options.add(17); icons.add(R.drawable.msg_callback); @@ -19829,7 +20163,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not icons.add(R.drawable.msg_unfave); } } - if (!selectedObject.isSponsored() && chatMode != MODE_SCHEDULED && !selectedObject.needDrawBluredPreview() && !selectedObject.isLiveLocation() && selectedObject.type != 16) { + if (!selectedObject.isSponsored() && chatMode != MODE_SCHEDULED && !selectedObject.needDrawBluredPreview() && !selectedObject.isLiveLocation() && selectedObject.type != 16 && !getMessagesController().isChatNoForwards(currentChat)) { items.add(LocaleController.getString("Forward", R.string.Forward)); options.add(2); icons.add(R.drawable.msg_forward); @@ -19875,7 +20209,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not options.add(8); icons.add(R.drawable.msg_reply); } - if (selectedObject.type == 0 || selectedObject.isAnimatedEmoji() || getMessageCaption(selectedObject, selectedObjectGroup) != null) { + if ((selectedObject.type == 0 || selectedObject.isAnimatedEmoji() || getMessageCaption(selectedObject, selectedObjectGroup) != null) && !getMessagesController().isChatNoForwards(currentChat)) { items.add(LocaleController.getString("Copy", R.string.Copy)); options.add(3); icons.add(R.drawable.msg_copy); @@ -19889,7 +20223,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not options.add(27); icons.add(R.drawable.msg_viewreplies); } - if (type == 4) { + if (type == 4 && !getMessagesController().isChatNoForwards(currentChat)) { if (selectedObject.isVideo()) { items.add(LocaleController.getString("SaveToGallery", R.string.SaveToGallery)); options.add(4); @@ -19940,9 +20274,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not icons.add(R.drawable.msg_addcontact); } if (!TextUtils.isEmpty(selectedObject.messageOwner.media.phone_number)) { - items.add(LocaleController.getString("Copy", R.string.Copy)); - options.add(16); - icons.add(R.drawable.msg_copy); + if (!getMessagesController().isChatNoForwards(currentChat)) { + items.add(LocaleController.getString("Copy", R.string.Copy)); + options.add(16); + icons.add(R.drawable.msg_copy); + } items.add(LocaleController.getString("Call", R.string.Call)); options.add(17); icons.add(R.drawable.msg_callback); @@ -20066,7 +20402,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } }); scrimPopupContainerLayout.setOrientation(LinearLayout.VERTICAL); - boolean showMessageSeen = 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 < 50 && !(message.messageOwner.action instanceof TLRPC.TL_messageActionChatJoinedByRequest); + 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 < 50 && !(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); @@ -20237,7 +20574,27 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not }); 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, 0)); + scrimPopupContainerLayout.addView(popupLayout, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 0, showMessageSeen ? -8 : 0, 0, showNoForwards ? -8 : 0)); + + 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; + TextView tv = new TextView(contentView.getContext()); + tv.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + tv.setTextColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem)); + tv.setText(isChannel ? LocaleController.getString("ForwardsRestrictedInfoChannel", R.string.ForwardsRestrictedInfoChannel) : + LocaleController.getString("ForwardsRestrictedInfoGroup", R.string.ForwardsRestrictedInfoGroup)); + tv.setMaxWidth(popupLayout.getMeasuredWidth() - AndroidUtilities.dp(38)); + + 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 fl = new FrameLayout(contentView.getContext()); + fl.setBackground(shadowDrawable2); + fl.addView(tv, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 11, 11, 11, 11)); + scrimPopupContainerLayout.addView(fl, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + } + scrimPopupWindow = new ActionBarPopupWindow(scrimPopupContainerLayout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT) { @Override public void dismiss() { @@ -21544,6 +21901,7 @@ 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) { @@ -22163,8 +22521,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not return; } if (url instanceof URLSpanMono) { - ((URLSpanMono) url).copyToClipboard(); - getUndoView().showWithAction(0, UndoView.ACTION_TEXT_COPIED, null); + if (!getMessagesController().isChatNoForwards(currentChat)) { + ((URLSpanMono) url).copyToClipboard(); + getUndoView().showWithAction(0, UndoView.ACTION_TEXT_COPIED, null); + } } else if (url instanceof URLSpanUserMention) { TLRPC.User user = getMessagesController().getUser(Utilities.parseLong(((URLSpanUserMention) url).getURL())); if (user != null) { @@ -22279,7 +22639,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not final int finalTimestamp = timestamp; ChatMessageCell finalCell = cell; MessageObject finalMessageObject = messageObject; - builder.setItems(new CharSequence[]{LocaleController.getString("Open", R.string.Open), LocaleController.getString("Copy", R.string.Copy)}, (dialog, which) -> { + builder.setItems(getMessagesController().isChatNoForwards(currentChat) ? new CharSequence[] {LocaleController.getString("Open", R.string.Open)} : new CharSequence[]{LocaleController.getString("Open", R.string.Open), LocaleController.getString("Copy", R.string.Copy)}, (dialog, which) -> { if (which == 0) { if (str.startsWith("video?")) { didPressMessageUrl(url, false, finalMessageObject, finalCell); @@ -22345,7 +22705,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (longPress) { BottomSheet.Builder builder = new BottomSheet.Builder(getParentActivity(), false, themeDelegate); builder.setTitle(urlFinal); - builder.setItems(new CharSequence[]{LocaleController.getString("Open", R.string.Open), LocaleController.getString("Copy", R.string.Copy)}, (dialog, which) -> { + builder.setItems(getMessagesController().isChatNoForwards(currentChat) ? new CharSequence[] {LocaleController.getString("Open", R.string.Open)} : new CharSequence[]{LocaleController.getString("Open", R.string.Open), LocaleController.getString("Copy", R.string.Copy)}, (dialog, which) -> { if (which == 0) { processExternalUrl(1, urlFinal, false); } else if (which == 1) { @@ -22497,6 +22857,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not private int messagesStartRow; private int messagesEndRow; + public boolean isFrozen; + public ArrayList frozenMessages = new ArrayList<>(); + public ChatActivityAdapter(Context context) { mContext = context; isBot = currentUser != null && currentUser.bot; @@ -22520,6 +22883,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not private void updateRowsInternal() { rowCount = 0; + ArrayList messages = isFrozen ? frozenMessages : ChatActivity.this.messages; if (!messages.isEmpty()) { if (!forwardEndReached[0] || mergeDialogId != 0 && !forwardEndReached[1]) { loadingDownRow = rowCount++; @@ -22575,6 +22939,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not return 1; } } + ArrayList messages = isFrozen ? frozenMessages : ChatActivity.this.messages; + if (position >= messagesStartRow && position < messagesEndRow) { return messages.get(position - messagesStartRow).stableId; } else if (position == botInfoRow || position == botInfoEmptyRow) { @@ -22598,674 +22964,681 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not view = new ChatMessageCell(mContext, true, themeDelegate); } ChatMessageCell chatMessageCell = (ChatMessageCell) view; - chatMessageCell.setDelegate(new ChatMessageCell.ChatMessageCellDelegate() { + if (!inPreviewMode) { + 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); } - showInfoHint(messageObject, stringBuilder, 1); + cell.showHintButton(false, true, type); } - 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); - } 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); + @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 { - openOriginalReplyChat(messageObject); + message = cell.getMessageObject(); } - } else { - ArrayList arrayList = null; - if (messageObject.getGroupId() != 0) { - MessageObject.GroupedMessages groupedMessages = groupedMessagesMap.get(messageObject.getGroupId()); - if (groupedMessages != null) { - arrayList = groupedMessages.messages; - } + if (message == null) { + return false; } - 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(); + return message.getId() == commentLoadingMessageId; } - } - @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()) { + @Override + public void didPressSideButton(ChatMessageCell cell) { if (getParentActivity() == null) { 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 (chatActivityEnterView != null) { + chatActivityEnterView.closeKeyboard(); } - 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; + 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 (lastDiff != 0) { - chatListView.smoothScrollBy(0, (int) lastDiff); - pollHintCell = cell; - return; + 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(); } - 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 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; - } - - @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) { - StickersAlert alert = new StickersAlert(getParentActivity(), ChatActivity.this, message.getInputStickerSet(), null, bottomOverlayChat.getVisibility() != View.VISIBLE && (currentChat == null || ChatObject.canSendStickers(currentChat)) ? chatActivityEnterView : null, themeDelegate); - alert.setCalcMandatoryInsets(isKeyboardVisible()); - showDialog(alert); - } else if (message.isVideo() || message.type == 1 || message.type == 0 && !message.isWebpageDocument() || message.isGif()) { - openPhotoViewerForMessage(cell, message); - } else if (message.type == 3) { - sendSecretMessageRead(message, true); - try { - File f = null; - if (message.messageOwner.attachPath != null && message.messageOwner.attachPath.length() != 0) { - f = new File(message.messageOwner.attachPath); - } - if (f == null || !f.exists()) { - f = FileLoader.getPathToMessage(message.messageOwner); - } - Intent intent = new Intent(Intent.ACTION_VIEW); - if (Build.VERSION.SDK_INT >= 24) { - intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - intent.setDataAndType(FileProvider.getUriForFile(getParentActivity(), BuildConfig.APPLICATION_ID + ".provider", f), "video/mp4"); - } else { - intent.setDataAndType(Uri.fromFile(f), "video/mp4"); - } - getParentActivity().startActivityForResult(intent, 500); - } catch (Exception e) { - FileLog.e(e); - alertUserOpenError(message); + @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); } - } else if (message.type == 4) { - if (!AndroidUtilities.isGoogleMapsInstalled(ChatActivity.this)) { + 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 (message.isLiveLocation()) { - LocationActivity fragment = new LocationActivity(currentChat == null || ChatObject.canSendMessages(currentChat) || currentChat.megagroup ? 2 : LocationActivity.LOCATION_TYPE_LIVE_VIEW); - fragment.setDelegate(ChatActivity.this); - fragment.setMessageObject(message); - presentFragment(fragment); + 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 { - LocationActivity fragment = new LocationActivity(currentEncryptedChat == null ? 3 : 0); - fragment.setDelegate(ChatActivity.this); - fragment.setMessageObject(message); + 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); } - } else if (message.type == 9 || message.type == 0) { - if (message.getDocumentName().toLowerCase().endsWith("attheme")) { - File locFile = null; - if (message.messageOwner.attachPath != null && message.messageOwner.attachPath.length() != 0) { - File f = new File(message.messageOwner.attachPath); - if (f.exists()) { - locFile = f; - } + } + + 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)); } - if (locFile == null) { - File f = FileLoader.getPathToMessage(message.messageOwner); - if (f.exists()) { - locFile = f; - } + } + } + + 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); } - Theme.ThemeInfo themeInfo = Theme.applyThemeFile(locFile, message.getDocumentName(), null, true); - if (themeInfo != null) { - presentFragment(new ThemePreviewActivity(themeInfo)); + 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) { return; - } else { - scrollToPositionOnRecreate = -1; } + 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; + } + } + pollHintView.showForMessageCell(cell, showCount, x, y, true); + } else { + getSendMessagesHelper().sendVote(cell.getMessageObject(), buttons, null); } - 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; + } + + @Override + public void didPressCancelSendButton(ChatMessageCell cell) { + MessageObject message = cell.getMessageObject(); + if (message.messageOwner.send_state != 0) { + getSendMessagesHelper().cancelSendingMessage(message); } - if (!handled) { + } + + @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; + } + + @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) { + StickersAlert alert = new StickersAlert(getParentActivity(), ChatActivity.this, message.getInputStickerSet(), null, bottomOverlayChat.getVisibility() != View.VISIBLE && (currentChat == null || ChatObject.canSendStickers(currentChat)) ? chatActivityEnterView : null, themeDelegate); + alert.setCalcMandatoryInsets(isKeyboardVisible()); + showDialog(alert); + } else if (message.isVideo() || message.type == 1 || message.type == 0 && !message.isWebpageDocument() || message.isGif()) { + openPhotoViewerForMessage(cell, message); + } else if (message.type == 3) { + sendSecretMessageRead(message, true); try { - AndroidUtilities.openForView(message, getParentActivity(), themeDelegate); + File f = null; + if (message.messageOwner.attachPath != null && message.messageOwner.attachPath.length() != 0) { + f = new File(message.messageOwner.attachPath); + } + if (f == null || !f.exists()) { + f = FileLoader.getPathToMessage(message.messageOwner); + } + Intent intent = new Intent(Intent.ACTION_VIEW); + if (Build.VERSION.SDK_INT >= 24) { + intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + intent.setDataAndType(FileProvider.getUriForFile(getParentActivity(), BuildConfig.APPLICATION_ID + ".provider", f), "video/mp4"); + } else { + intent.setDataAndType(Uri.fromFile(f), "video/mp4"); + } + getParentActivity().startActivityForResult(intent, 500); } catch (Exception e) { FileLog.e(e); alertUserOpenError(message); } - } - } - } - @Override - public void didPressInstantButton(ChatMessageCell cell, int type) { - MessageObject messageObject = cell.getMessageObject(); - if (type == 8) { - PollVotesAlert.showForPoll(ChatActivity.this, messageObject); - } else if (type == 0) { - if (messageObject.messageOwner.media != null && messageObject.messageOwner.media.webpage != null && messageObject.messageOwner.media.webpage.cached_page != null) { - ArticleViewer.getInstance().setParentActivity(getParentActivity(), ChatActivity.this); - ArticleViewer.getInstance().open(messageObject); - } - } else if (type == 5) { - long uid = messageObject.messageOwner.media.user_id; - TLRPC.User user = null; - if (uid != 0) { - user = MessagesController.getInstance(currentAccount).getUser(uid); - } - openVCard(user, messageObject.messageOwner.media.vcard, messageObject.messageOwner.media.first_name, messageObject.messageOwner.media.last_name); - } else { - if (messageObject.isSponsored()) { - Bundle args = new Bundle(); - long peerId = MessageObject.getPeerId(messageObject.messageOwner.from_id); - if (peerId < 0) { - args.putLong("chat_id", -peerId); + } else if (message.type == 4) { + if (!AndroidUtilities.isGoogleMapsInstalled(ChatActivity.this)) { + return; + } + if (message.isLiveLocation()) { + LocationActivity fragment = new LocationActivity(currentChat == null || ChatObject.canSendMessages(currentChat) || currentChat.megagroup ? 2 : LocationActivity.LOCATION_TYPE_LIVE_VIEW); + fragment.setDelegate(ChatActivity.this); + fragment.setMessageObject(message); + presentFragment(fragment); } else { - args.putLong("user_id", peerId); + LocationActivity fragment = new LocationActivity(currentEncryptedChat == null ? 3 : 0); + fragment.setDelegate(ChatActivity.this); + fragment.setMessageObject(message); + presentFragment(fragment); } - if (messageObject.sponsoredChannelPost != 0) { - args.putInt("message_id", messageObject.sponsoredChannelPost); + } else if (message.type == 9 || message.type == 0) { + if (message.getDocumentName().toLowerCase().endsWith("attheme")) { + File locFile = null; + if (message.messageOwner.attachPath != null && message.messageOwner.attachPath.length() != 0) { + File f = new File(message.messageOwner.attachPath); + if (f.exists()) { + locFile = f; + } + } + if (locFile == null) { + File f = FileLoader.getPathToMessage(message.messageOwner); + if (f.exists()) { + locFile = f; + } + } + Theme.ThemeInfo themeInfo = Theme.applyThemeFile(locFile, message.getDocumentName(), null, true); + if (themeInfo != null) { + presentFragment(new ThemePreviewActivity(themeInfo)); + return; + } else { + scrollToPositionOnRecreate = -1; + } } - if (messageObject.botStartParam != null) { - args.putString("inline_query", messageObject.botStartParam); + 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 (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); + if (!handled) { + try { + AndroidUtilities.openForView(message, getParentActivity(), themeDelegate); + } catch (Exception e) { + FileLog.e(e); + alertUserOpenError(message); + } } } } - } - @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 void didPressInstantButton(ChatMessageCell cell, int type) { + MessageObject messageObject = cell.getMessageObject(); + if (type == 8) { + PollVotesAlert.showForPoll(ChatActivity.this, messageObject); + } else if (type == 0) { + if (messageObject.messageOwner.media != null && messageObject.messageOwner.media.webpage != null && messageObject.messageOwner.media.webpage.cached_page != null) { + ArticleViewer.getInstance().setParentActivity(getParentActivity(), ChatActivity.this); + ArticleViewer.getInstance().open(messageObject); + } + } else if (type == 5) { + long uid = messageObject.messageOwner.media.user_id; + TLRPC.User user = null; + if (uid != 0) { + user = MessagesController.getInstance(currentAccount).getUser(uid); + } + openVCard(user, messageObject.messageOwner.media.vcard, messageObject.messageOwner.media.first_name, messageObject.messageOwner.media.last_name); + } else { + if (messageObject.isSponsored()) { + Bundle args = new Bundle(); + long peerId = MessageObject.getPeerId(messageObject.messageOwner.from_id); + if (peerId < 0) { + args.putLong("chat_id", -peerId); + } else { + args.putLong("user_id", peerId); + } + if (messageObject.sponsoredChannelPost != 0) { + args.putInt("message_id", messageObject.sponsoredChannelPost); + } + if (messageObject.botStartParam != null) { + args.putString("inline_query", messageObject.botStartParam); + } + 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); + } + } + } } - 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; + + @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); } - openDiscussionMessageChat(currentChat.id, message, message.getId(), linkedChatId, maxReadId, 0, null); - } - @Override - public String getAdminRank(long uid) { - if (ChatObject.isChannel(currentChat) && currentChat.megagroup) { - return getMessagesController().getAdminRank(currentChat.id, uid); + @Override + public String getAdminRank(long uid) { + if (ChatObject.isChannel(currentChat) && currentChat.megagroup) { + return getMessagesController().getAdminRank(currentChat.id, uid); + } + return null; } - return null; - } - @Override - public boolean shouldRepeatSticker(MessageObject message) { - return !alredyPlayedStickers.containsKey(message); - } - - @Override - public void setShouldNotRepeatSticker(MessageObject message) { - alredyPlayedStickers.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 boolean shouldRepeatSticker(MessageObject message) { + return !alreadyPlayedStickers.containsKey(message); } - fireworksOverlay.start(); - fireworksOverlay.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); - } - @Override - public PinchToZoomHelper getPinchToZoomHelper() { - return pinchToZoomHelper; - } + @Override + public void setShouldNotRepeatSticker(MessageObject message) { + alreadyPlayedStickers.put(message, true); + } - @Override - public boolean keyboardIsOpened() { - return contentView.getKeyboardHeight() + chatEmojiViewPadding >= AndroidUtilities.dp(20); - } + @Override + public TextSelectionHelper.ChatListTextSelectionHelper getTextSelectionHelper() { + return textSelectionHelper; + } - public boolean isLandscape() { - return contentView.getMeasuredWidth() > contentView.getMeasuredHeight(); - } - }); + @Override + public boolean hasSelectedMessages() { + return selectedMessagesIds[0].size() + selectedMessagesIds[1].size() > 0; + } + + @Override + public void onDiceFinished() { + if (fireworksOverlay.isStarted()) { + return; + } + fireworksOverlay.start(); + fireworksOverlay.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } + + @Override + public PinchToZoomHelper getPinchToZoomHelper() { + return pinchToZoomHelper; + } + + @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() { + + }); + } if (currentEncryptedChat == null) { chatMessageCell.setAllowAssistant(true); } @@ -23376,6 +23749,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not ChatLoadingCell loadingCell = (ChatLoadingCell) holder.itemView; loadingCell.setProgressVisible(loadsCount > 1); } else if (position >= messagesStartRow && position < messagesEndRow) { + ArrayList messages = isFrozen ? frozenMessages : ChatActivity.this.messages; + MessageObject message = messages.get(position - messagesStartRow); View view = holder.itemView; @@ -23757,6 +24132,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } } if (position >= messagesStartRow && position < messagesEndRow) { + ArrayList messages = isFrozen ? frozenMessages : ChatActivity.this.messages; return messages.get(position - messagesStartRow).contentType; } else if (position == botInfoRow) { return 3; @@ -23854,6 +24230,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not int position = holder.getAdapterPosition(); if (position >= messagesStartRow && position < messagesEndRow) { + ArrayList messages = isFrozen ? frozenMessages : ChatActivity.this.messages; + MessageObject message = messages.get(position - messagesStartRow); View view = holder.itemView; if (message != null && message.messageOwner != null && message.messageOwner.media_unread && message.messageOwner.mentioned) { @@ -23889,6 +24267,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } int lastVisibleItem = RecyclerView.NO_POSITION; int top = 0; + ArrayList messages = isFrozen ? frozenMessages : ChatActivity.this.messages; + if (!wasManualScroll && unreadMessageObject != null) { int n = chatListView.getChildCount(); for (int i = 0; i < n; i++) { @@ -23937,6 +24317,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } } } + ArrayList messages = isFrozen ? frozenMessages : ChatActivity.this.messages; + int index = messages.indexOf(messageObject); if (index == -1) { return null; @@ -24670,10 +25052,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not themeDescriptions.add(new ThemeDescription(chatActivityEnterView, ThemeDescription.FLAG_HINTTEXTCOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"messageEditText"}, null, null, null, Theme.key_chat_messagePanelHint)); themeDescriptions.add(new ThemeDescription(chatActivityEnterView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"sendButton"}, null, null, null, Theme.key_chat_messagePanelSend)); themeDescriptions.add(new ThemeDescription(chatActivityEnterView, ThemeDescription.FLAG_USEBACKGROUNDDRAWABLE | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, new Class[]{ChatActivityEnterView.class}, new String[]{"sendButton"}, null, null, 24, null, Theme.key_chat_messagePanelSend)); - themeDescriptions.add(new ThemeDescription(chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"emojiButton1"}, null, null, null, Theme.key_chat_messagePanelIcons)); - themeDescriptions.add(new ThemeDescription(chatActivityEnterView, ThemeDescription.FLAG_USEBACKGROUNDDRAWABLE | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, new Class[]{ChatActivityEnterView.class}, new String[]{"emojiButton1"}, null, null, null, Theme.key_listSelector)); - themeDescriptions.add(new ThemeDescription(chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"emojiButton2"}, null, null, null, Theme.key_chat_messagePanelIcons)); - themeDescriptions.add(new ThemeDescription(chatActivityEnterView, ThemeDescription.FLAG_USEBACKGROUNDDRAWABLE | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, new Class[]{ChatActivityEnterView.class}, new String[]{"emojiButton2"}, null, null, null, Theme.key_listSelector)); themeDescriptions.add(new ThemeDescription(chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"botButton"}, null, null, null, Theme.key_chat_messagePanelIcons)); themeDescriptions.add(new ThemeDescription(chatActivityEnterView, ThemeDescription.FLAG_USEBACKGROUNDDRAWABLE | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, new Class[]{ChatActivityEnterView.class}, new String[]{"botButton"}, null, null, null, Theme.key_listSelector)); themeDescriptions.add(new ThemeDescription(chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"notifyButton"}, null, null, null, Theme.key_chat_messagePanelIcons)); @@ -25414,7 +25792,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not Theme.applyTheme(activeTheme, false, isDark); } else { - currentColors = chatTheme.getCurrentColors(currentAccount, isDark ? 1 : 0); + currentColors = chatTheme.createColors(currentAccount, isDark ? 1 : 0); backgroundDrawable = getBackgroundDrawableFromTheme(chatTheme, prevPhase); if (patternAlphaAnimator != null) { @@ -25678,7 +26056,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not Drawable drawable; if (chatTheme.showAsDefaultStub) { Theme.ThemeInfo themeInfo = EmojiThemes.getDefaultThemeInfo(isDark); - HashMap currentColors = chatTheme.getCurrentColors(currentAccount, isDark ? 1 : 0); + HashMap currentColors = chatTheme.getPreviewColors(currentAccount, isDark ? 1 : 0); String wallpaperLink = chatTheme.getWallpaperLink(isDark ? 1 : 0); Theme.BackgroundDrawableSettings settings = Theme.createBackgroundDrawable(themeInfo, currentColors, wallpaperLink, prevPhase); drawable = settings.wallpaper; @@ -25693,7 +26071,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not MotionBackgroundDrawable motionDrawable = new MotionBackgroundDrawable(); motionDrawable.setPatternBitmap(chatTheme.getWallpaper(isDark ? 1 : 0).settings.intensity); - motionDrawable.setColors(backgroundColor, gradientColor1, gradientColor2, gradientColor3, true); + motionDrawable.setColors(backgroundColor, gradientColor1, gradientColor2, gradientColor3, 0,true); motionDrawable.setPhase(prevPhase); int patternColor = motionDrawable.getPatternColor(); final boolean isDarkTheme = isDark; @@ -25732,4 +26110,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not return color; } } + + @Override + protected boolean allowPresentFragment() { + return !inPreviewMode; + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatEditActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatEditActivity.java index bd8117181..91dc0d96a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatEditActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatEditActivity.java @@ -1343,10 +1343,11 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image typeCell.setTextAndValue(LocaleController.getString("TypeLocationGroup", R.string.TypeLocationGroup), link, historyCell != null && historyCell.getVisibility() == View.VISIBLE || linkedCell != null && linkedCell.getVisibility() == View.VISIBLE); } else { String type; + boolean isRestricted = currentChat.noforwards; if (isChannel) { - type = isPrivate ? LocaleController.getString("TypePrivate", R.string.TypePrivate) : LocaleController.getString("TypePublic", R.string.TypePublic); + type = isPrivate ? isRestricted ? LocaleController.getString("TypePrivateRestrictedForwards", R.string.TypePrivateRestrictedForwards) : LocaleController.getString("TypePrivate", R.string.TypePrivate) : LocaleController.getString("TypePublic", R.string.TypePublic); } else { - type = isPrivate ? LocaleController.getString("TypePrivateGroup", R.string.TypePrivateGroup) : LocaleController.getString("TypePublicGroup", R.string.TypePublicGroup); + type = isPrivate ? isRestricted ? LocaleController.getString("TypePrivateGroupRestrictedForwards", R.string.TypePrivateGroupRestrictedForwards) : LocaleController.getString("TypePrivateGroup", R.string.TypePrivateGroup) : LocaleController.getString("TypePublicGroup", R.string.TypePublicGroup); } if (isChannel) { typeCell.setTextAndValue(LocaleController.getString("ChannelType", R.string.ChannelType), type, historyCell != null && historyCell.getVisibility() == View.VISIBLE || linkedCell != null && linkedCell.getVisibility() == View.VISIBLE); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatEditTypeActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatEditTypeActivity.java index ec6c659b6..bb5ae288c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatEditTypeActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatEditTypeActivity.java @@ -21,6 +21,7 @@ import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import android.widget.LinearLayout; import android.widget.ScrollView; +import android.widget.Toast; import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.ChatObject; @@ -43,6 +44,7 @@ import org.telegram.ui.Cells.LoadingCell; import org.telegram.ui.Cells.RadioButtonCell; import org.telegram.ui.Cells.ShadowSectionCell; import org.telegram.ui.Cells.TextCell; +import org.telegram.ui.Cells.TextCheckCell; import org.telegram.ui.Cells.TextInfoPrivacyCell; import org.telegram.ui.Cells.TextSettingsCell; import org.telegram.ui.Components.EditTextBoldCursor; @@ -81,12 +83,19 @@ public class ChatEditTypeActivity extends BaseFragment implements NotificationCe private TextSettingsCell textCell; private TextSettingsCell textCell2; + // Saving content restrictions block + private LinearLayout saveContainer; + private HeaderCell saveHeaderCell; + private TextCheckCell saveRestrictCell; + private TextInfoPrivacyCell saveRestrictInfoCell; + private boolean isPrivate; private TLRPC.Chat currentChat; private TLRPC.ChatFull info; private long chatId; private boolean isChannel; + private boolean isSaveRestricted; private boolean canCreatePublic = true; private boolean loadingAdminedChannels; @@ -133,6 +142,7 @@ public class ChatEditTypeActivity extends BaseFragment implements NotificationCe } isPrivate = !isForcePublic && TextUtils.isEmpty(currentChat.username); isChannel = ChatObject.isChannel(currentChat) && !currentChat.megagroup; + isSaveRestricted = isPrivate && currentChat.noforwards; if (isForcePublic && TextUtils.isEmpty(currentChat.username) || isPrivate && currentChat.creator) { TLRPC.TL_channels_checkUsername req = new TLRPC.TL_channels_checkUsername(); req.username = "1"; @@ -399,6 +409,32 @@ public class ChatEditTypeActivity extends BaseFragment implements NotificationCe manageLinksInfoCell = new TextInfoPrivacyCell(context); linearLayout.addView(manageLinksInfoCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + saveContainer = new LinearLayout(context); + saveContainer.setOrientation(LinearLayout.VERTICAL); + linearLayout.addView(saveContainer); + + saveHeaderCell = new HeaderCell(context, 23); + saveHeaderCell.setHeight(46); + saveHeaderCell.setText(LocaleController.getString("SavingContentTitle", R.string.SavingContentTitle)); + saveHeaderCell.setBackgroundDrawable(Theme.getSelectorDrawable(true)); + saveContainer.addView(saveHeaderCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + saveRestrictCell = new TextCheckCell(context); + saveRestrictCell.setBackgroundDrawable(Theme.getSelectorDrawable(true)); + saveRestrictCell.setTextAndCheck(LocaleController.getString("RestrictSavingContent", R.string.RestrictSavingContent), isSaveRestricted, false); + saveRestrictCell.setOnClickListener(v -> { + isSaveRestricted = !isSaveRestricted; + ((TextCheckCell) v).setChecked(isSaveRestricted); + }); + saveContainer.addView(saveRestrictCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + saveRestrictInfoCell = new TextInfoPrivacyCell(context); + if (isChannel && !ChatObject.isMegagroup(currentChat)) { + saveRestrictInfoCell.setText(LocaleController.getString("RestrictSavingContentInfoChannel", R.string.RestrictSavingContentInfoChannel)); + } else { + saveRestrictInfoCell.setText(LocaleController.getString("RestrictSavingContentInfoGroup", R.string.RestrictSavingContentInfoGroup)); + } + + saveContainer.addView(saveRestrictInfoCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + if (!isPrivate && currentChat.username != null) { ignoreTextChanges = true; usernameTextView.setText(currentChat.username); @@ -434,6 +470,9 @@ public class ChatEditTypeActivity extends BaseFragment implements NotificationCe } private void processDone() { + if (isPrivate && currentChat.noforwards != isSaveRestricted) { + getMessagesController().toggleChatNoForwards(chatId, currentChat.noforwards = isSaveRestricted); + } if (trySetUsername()) { finishFragment(); } @@ -577,6 +616,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); manageLinksTextView.setVisibility(View.VISIBLE); manageLinksInfoCell.setVisibility(View.VISIBLE); linkContainer.setPadding(0, 0, 0, isPrivate ? 0 : AndroidUtilities.dp(7)); @@ -769,9 +809,15 @@ public class ChatEditTypeActivity extends BaseFragment implements NotificationCe themeDescriptions.add(new ThemeDescription(linkContainer, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite)); themeDescriptions.add(new ThemeDescription(headerCell, 0, new Class[]{HeaderCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlueHeader)); themeDescriptions.add(new ThemeDescription(headerCell2, 0, new Class[]{HeaderCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlueHeader)); + themeDescriptions.add(new ThemeDescription(saveHeaderCell, 0, new Class[]{HeaderCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlueHeader)); themeDescriptions.add(new ThemeDescription(editText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); themeDescriptions.add(new ThemeDescription(editText, ThemeDescription.FLAG_HINTTEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteHintText)); + themeDescriptions.add(new ThemeDescription(saveRestrictCell, ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_listSelector)); + themeDescriptions.add(new ThemeDescription(saveRestrictCell, 0, new Class[]{TextCheckCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); + themeDescriptions.add(new ThemeDescription(saveRestrictCell, 0, new Class[]{TextCheckCell.class}, new String[]{"checkBox"}, null, null, null, Theme.key_switchTrack)); + themeDescriptions.add(new ThemeDescription(saveRestrictCell, 0, new Class[]{TextCheckCell.class}, new String[]{"checkBox"}, null, null, null, Theme.key_switchTrackChecked)); + themeDescriptions.add(new ThemeDescription(checkTextView, ThemeDescription.FLAG_CHECKTAG, new Class[]{TextInfoPrivacyCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteRedText4)); themeDescriptions.add(new ThemeDescription(checkTextView, ThemeDescription.FLAG_CHECKTAG, new Class[]{TextInfoPrivacyCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText8)); themeDescriptions.add(new ThemeDescription(checkTextView, ThemeDescription.FLAG_CHECKTAG, new Class[]{TextInfoPrivacyCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteGreenText)); @@ -784,6 +830,10 @@ public class ChatEditTypeActivity extends BaseFragment implements NotificationCe themeDescriptions.add(new ThemeDescription(manageLinksInfoCell, ThemeDescription.FLAG_CHECKTAG, new Class[]{TextInfoPrivacyCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText4)); themeDescriptions.add(new ThemeDescription(manageLinksInfoCell, ThemeDescription.FLAG_CHECKTAG, new Class[]{TextInfoPrivacyCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteRedText4)); + themeDescriptions.add(new ThemeDescription(saveRestrictInfoCell, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{TextInfoPrivacyCell.class}, null, null, null, Theme.key_windowBackgroundGrayShadow)); + themeDescriptions.add(new ThemeDescription(saveRestrictInfoCell, ThemeDescription.FLAG_CHECKTAG, new Class[]{TextInfoPrivacyCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText4)); + themeDescriptions.add(new ThemeDescription(saveRestrictInfoCell, ThemeDescription.FLAG_CHECKTAG, new Class[]{TextInfoPrivacyCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteRedText4)); + themeDescriptions.add(new ThemeDescription(adminedInfoCell, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{TextInfoPrivacyCell.class}, null, null, null, Theme.key_windowBackgroundGrayShadow)); themeDescriptions.add(new ThemeDescription(adminnedChannelsLayout, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite)); themeDescriptions.add(new ThemeDescription(loadingAdminedCell, 0, new Class[]{LoadingCell.class}, new String[]{"progressBar"}, null, null, null, Theme.key_progressCircle)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatLinkActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatLinkActivity.java index d956f7ddf..f3a2162a5 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatLinkActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatLinkActivity.java @@ -120,7 +120,7 @@ public class ChatLinkActivity extends BaseFragment implements NotificationCenter } private void setSticker() { - TLRPC.TL_messages_stickerSet set = MediaDataController.getInstance(currentAccount).getStickerSetByName(stickerSetName); + TLRPC.messages_StickerSet set = MediaDataController.getInstance(currentAccount).getStickerSetByName(stickerSetName); if (set == null) { set = MediaDataController.getInstance(currentAccount).getStickerSetByEmojiOrName(stickerSetName); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java index a3f1d21a0..f81833a9c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java @@ -2828,9 +2828,11 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente peerObject = object; } else if (object instanceof TLRPC.ChannelParticipant) { long peerId = MessageObject.getPeerId(((TLRPC.ChannelParticipant) object).peer); - if (peerId > 0) { + if (peerId >= 0) { TLRPC.User user = getMessagesController().getUser(peerId); - un = user.username; + if (user != null) { + un = user.username; + } peerObject = user; } else { TLRPC.Chat chat = getMessagesController().getChat(-peerId); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/CodeFieldContainer.java b/TMessagesProj/src/main/java/org/telegram/ui/CodeFieldContainer.java new file mode 100644 index 000000000..631ae6c91 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/CodeFieldContainer.java @@ -0,0 +1,287 @@ +package org.telegram.ui; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.text.Editable; +import android.text.InputType; +import android.text.TextWatcher; +import android.util.TypedValue; +import android.view.Gravity; +import android.view.KeyEvent; +import android.view.View; +import android.view.inputmethod.EditorInfo; +import android.widget.LinearLayout; + +import androidx.core.graphics.ColorUtils; + +import org.telegram.PhoneFormat.PhoneFormat; +import org.telegram.messenger.AndroidUtilities; +import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.Components.EditTextBoldCursor; +import org.telegram.ui.Components.LayoutHelper; + +public class CodeFieldContainer extends LinearLayout { + + Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); + Paint bitmapPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + float strokeWidth; + public boolean ignoreOnTextChange; + + public CodeNumberField[] codeField; + + public CodeFieldContainer(Context context) { + super(context); + paint.setStyle(Paint.Style.STROKE); + setOrientation(HORIZONTAL); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + paint.setStrokeWidth(strokeWidth = AndroidUtilities.dp(1.5f)); + } + + @Override + protected void dispatchDraw(Canvas canvas) { + for (int i = 0; i < getChildCount(); i++) { + View child = getChildAt(i); + if (child instanceof CodeNumberField) { + CodeNumberField codeField = (CodeNumberField) child; + if (child.isFocused() && codeField.focusedProgress != 1f) { + codeField.focusedProgress += 16f / 150f; + if (codeField.focusedProgress > 1f) { + codeField.focusedProgress = 1f; + } else { + invalidate(); + } + } else if (!child.isFocused() && codeField.focusedProgress != 0) { + codeField.focusedProgress -= 16f / 150f; + if (codeField.focusedProgress < 0f) { + codeField.focusedProgress = 0f; + } else { + invalidate(); + } + } + paint.setColor(ColorUtils.blendARGB(Theme.getColor(Theme.key_windowBackgroundWhiteInputField), Theme.getColor(Theme.key_windowBackgroundWhiteInputFieldActivated), codeField.focusedProgress)); + AndroidUtilities.rectTmp.set(child.getLeft(), child.getTop(), child.getRight(), child.getBottom()); + AndroidUtilities.rectTmp.inset(strokeWidth, strokeWidth); + canvas.drawRoundRect(AndroidUtilities.rectTmp, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint); + } + } + super.dispatchDraw(canvas); + } + + @Override + protected boolean drawChild(Canvas canvas, View child, long drawingTime) { + if (child instanceof CodeNumberField) { + CodeNumberField field = (CodeNumberField) child; + canvas.save(); + float progress = ((CodeNumberField) child).enterAnimation; + AndroidUtilities.rectTmp.set(child.getX(), child.getY(), child.getX() + child.getMeasuredWidth(), child.getY() + child.getMeasuredHeight()); + AndroidUtilities.rectTmp.inset(strokeWidth, strokeWidth); + canvas.clipRect(AndroidUtilities.rectTmp); + if (field.replaceAnimation) { + float s = progress * 0.5f + 0.5f; + child.setAlpha(progress); + canvas.scale(s, s, field.getX() + field.getMeasuredWidth() / 2f, field.getY() + field.getMeasuredHeight() / 2f); + } else { + child.setAlpha(1f); + canvas.translate(0, child.getMeasuredHeight() * (1f - progress)); + } + super.drawChild(canvas, child, drawingTime); + canvas.restore(); + + float exitProgress = field.exitAnimation; + if (exitProgress < 1f) { + canvas.save(); + float s = (1f - exitProgress) * 0.5f + 0.5f; + canvas.scale(s, s, field.getX() + field.getMeasuredWidth() / 2f, field.getY() + field.getMeasuredHeight() / 2f); + bitmapPaint.setAlpha((int) (255 * (1f - exitProgress))); + canvas.drawBitmap(field.exitBitmap, field.getX(), field.getY(), bitmapPaint); + canvas.restore(); + } + return true; + } + return super.drawChild(canvas, child, drawingTime); + } + + public void setNumbersCount(int length, int currentType) { + if (codeField == null || codeField.length != length) { + codeField = new CodeNumberField[length]; + for (int a = 0; a < length; a++) { + final int num = a; + codeField[a] = new CodeNumberField(getContext()) { + @Override + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + int keyCode = event.getKeyCode(); + if (event.getAction() == KeyEvent.ACTION_UP) { + if (keyCode == KeyEvent.KEYCODE_DEL && codeField[num].length() == 1) { + codeField[num].startExitAnimation(); + codeField[num].setText(""); + return true; + } else if (keyCode == KeyEvent.KEYCODE_DEL && codeField[num].length() == 0 && num > 0) { + codeField[num - 1].setSelection(codeField[num - 1].length()); + for (int i = 0; i < num; i++) { + if (i == num - 1) { + codeField[num - 1].requestFocus(); + } else { + codeField[i].clearFocus(); + } + } + codeField[num - 1].startExitAnimation(); + codeField[num - 1].setText(""); + return true; + } else { + if (keyCode >= KeyEvent.KEYCODE_0 && keyCode <= KeyEvent.KEYCODE_9) { + String str = Integer.toString(keyCode - KeyEvent.KEYCODE_0); + if (codeField[num].getText() != null && str.equals(codeField[num].getText().toString())) { + if (num >= length - 1) { + processNextPressed(); + } else { + codeField[num + 1].requestFocus(); + } + return true; + } + if (codeField[num].length() > 0) { + codeField[num].startExitAnimation(); + } + codeField[num].setText(str); + } + return true; + } + } else { + return isFocused(); + } + } + }; + + codeField[a].setImeOptions(EditorInfo.IME_ACTION_NEXT | EditorInfo.IME_FLAG_NO_EXTRACT_UI); + codeField[a].setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); + codeField[a].setMaxLines(1); + codeField[a].setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); + codeField[a].setPadding(0, 0, 0, 0); + codeField[a].setGravity(Gravity.CENTER); + if (currentType == 3) { + codeField[a].setEnabled(false); + codeField[a].setInputType(InputType.TYPE_NULL); + codeField[a].setVisibility(GONE); + } else { + codeField[a].setInputType(InputType.TYPE_CLASS_PHONE); + } + int width; + int height; + int gapSize; + if (currentType == LoginActivity.AUTH_TYPE_MISSED_CALL) { + width = 28; + height = 34; + gapSize = 5; + } else { + width = 34; + height = 42; + gapSize = 7; + } + addView(codeField[a], LayoutHelper.createLinear(width, height, Gravity.CENTER_HORIZONTAL, 0, 0, a != length - 1 ? gapSize: 0, 0)); + codeField[a].addTextChangedListener(new TextWatcher() { + + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + + } + + @Override + public void afterTextChanged(Editable s) { + if (ignoreOnTextChange) { + return; + } + int len = s.length(); + if (len >= 1) { + boolean next = false; + int n = num; + if (len > 1) { + String text = s.toString(); + ignoreOnTextChange = true; + for (int a = 0; a < Math.min(length - num, len); a++) { + if (a == 0) { + s.replace(0, len, text.substring(a, a + 1)); + } else { + n++; + codeField[num + a].setText(text.substring(a, a + 1)); + } + } + ignoreOnTextChange = false; + } + + + if (n != length - 1) { + codeField[n + 1].setSelection(codeField[n + 1].length()); + codeField[n + 1].requestFocus(); + } + if ((n == length - 1 || n == length - 2 && len >= 2) && getCode().length() == length) { + processNextPressed(); + } + } + } + }); + codeField[a].setOnEditorActionListener((textView, i, keyEvent) -> { + if (i == EditorInfo.IME_ACTION_NEXT) { + processNextPressed(); + return true; + } + return false; + }); + } + } else { + for (int a = 0; a < codeField.length; a++) { + codeField[a].setText(""); + } + } + } + + protected void processNextPressed() { + + } + + public String getCode() { + if (codeField == null) { + return ""; + } + StringBuilder codeBuilder = new StringBuilder(); + for (int a = 0; a < codeField.length; a++) { + codeBuilder.append(PhoneFormat.stripExceptNumbers(codeField[a].getText().toString())); + } + return codeBuilder.toString(); + } + + public void setCode(String savedCode) { + codeField[0].setText(savedCode); + } + + public void setText(String code) { + setText(code, false); + } + + public void setText(String code, boolean fromPaste) { + int startFrom = 0; + if (fromPaste) { + for (int i = 0; i < codeField.length; i++) { + if (codeField[i].isFocused()) { + startFrom = i; + break; + } + } + } + for (int i = startFrom; i < Math.min(codeField.length, startFrom + code.length()); i++) { + codeField[i].setText(Character.toString(code.charAt(i - startFrom))); + } + } + +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/CodeNumberField.java b/TMessagesProj/src/main/java/org/telegram/ui/CodeNumberField.java new file mode 100644 index 000000000..f7dabf979 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/CodeNumberField.java @@ -0,0 +1,238 @@ +package org.telegram.ui; + +import android.animation.ValueAnimator; +import android.content.ClipData; +import android.content.ClipDescription; +import android.content.ClipboardManager; +import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.Rect; +import android.text.Editable; +import android.text.Layout; +import android.text.StaticLayout; +import android.text.TextWatcher; +import android.view.ActionMode; +import android.view.Menu; +import android.view.MenuItem; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewGroup; +import android.view.animation.OvershootInterpolator; +import android.widget.TextView; + +import androidx.core.content.ContextCompat; + +import org.checkerframework.checker.regex.qual.Regex; +import org.telegram.messenger.AndroidUtilities; +import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.Components.EditTextBoldCursor; +import org.telegram.ui.Components.StaticLayoutEx; + +public class CodeNumberField extends EditTextBoldCursor { + + float focusedProgress; + float enterAnimation = 1f; + float exitAnimation = 1f; + boolean replaceAnimation; + Bitmap exitBitmap; + Canvas exitCanvas; + + ValueAnimator enterAnimator; + ValueAnimator exitAnimator; + + ActionMode actionMode; + + public CodeNumberField(Context context) { + super(context); + setBackground(null); + setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); + setMovementMethod(null); + addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + startEnterAnimation(charSequence.length() != 0); + hideActionMode(); + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void afterTextChanged(Editable editable) { + + } + }); + + } + + public void startExitAnimation() { + if (getMeasuredHeight() == 0 || getMeasuredWidth() == 0 || getLayout() == null) { + return; + } + if (exitBitmap == null || exitBitmap.getHeight() != getMeasuredHeight() || exitBitmap.getWidth() != getMeasuredWidth()) { + if (exitBitmap != null) { + exitBitmap.recycle(); + } + exitBitmap = Bitmap.createBitmap(getMeasuredWidth(), getMeasuredHeight(), Bitmap.Config.ARGB_8888); + exitCanvas = new Canvas(exitBitmap); + } + exitBitmap.eraseColor(Color.TRANSPARENT); + + StaticLayout staticLayout = new StaticLayout(getText(), getLayout().getPaint(), (int) Math.ceil(getLayout().getPaint().measureText(String.valueOf(getText()))), Layout.Alignment.ALIGN_NORMAL, getLineSpacingMultiplier(), getLineSpacingExtra(), getIncludeFontPadding()); + exitCanvas.save(); + exitCanvas.translate((getMeasuredWidth() - staticLayout.getWidth()) / 2f, (getMeasuredHeight() - staticLayout.getHeight()) / 2f); + staticLayout.draw(exitCanvas); + exitCanvas.restore(); + + exitAnimation = 0f; + exitAnimator = ValueAnimator.ofFloat(exitAnimation, 1f); + exitAnimator.addUpdateListener(valueAnimator1 -> { + exitAnimation = (float) valueAnimator1.getAnimatedValue(); + invalidate(); + if (getParent() != null) { + ((ViewGroup) getParent()).invalidate(); + } + }); + exitAnimator.setDuration(220); + exitAnimator.start(); + } + + public void startEnterAnimation(boolean replace) { + replaceAnimation = replace; + enterAnimation = 0f; + enterAnimator = ValueAnimator.ofFloat(enterAnimation, 1f); + enterAnimator.addUpdateListener(valueAnimator1 -> { + enterAnimation = (float) valueAnimator1.getAnimatedValue(); + invalidate(); + if (getParent() != null) { + ((ViewGroup) getParent()).invalidate(); + } + }); + if (!replaceAnimation) { + enterAnimator.setInterpolator(new OvershootInterpolator(1.5f)); + enterAnimator.setDuration(350); + } else { + enterAnimator.setDuration(220); + } + enterAnimator.start(); + } + + @Override + public boolean requestFocus(int direction, Rect previouslyFocusedRect) { + ((ViewGroup) getParent()).invalidate(); + return super.requestFocus(direction, previouslyFocusedRect); + } + + + boolean pressed = false; + float startX = 0; + float startY = 0; + + @Override + public boolean onTouchEvent(MotionEvent event) { + if (event.getAction() == MotionEvent.ACTION_DOWN) { + pressed = true; + startX = event.getX(); + startY = event.getY(); + } + if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL) { + CodeFieldContainer codeFieldContainer = null; + if (getParent() instanceof CodeFieldContainer) { + codeFieldContainer = (CodeFieldContainer) getParent(); + } + if (event.getAction() == MotionEvent.ACTION_UP && pressed) { + if (isFocused() && codeFieldContainer != null) { + ClipboardManager clipboard = ContextCompat.getSystemService(getContext(), ClipboardManager.class); + if (clipboard == null) { + return false; + } + clipboard.getPrimaryClipDescription().hasMimeType(ClipDescription.MIMETYPE_TEXT_PLAIN); + ClipData.Item item = clipboard.getPrimaryClip().getItemAt(0); + int i = -1; + String text = item.getText().toString(); + try { + i = Integer.parseInt(text); + } catch (Exception e) { + + } + + if (i > 0) { + startActionMode(new ActionMode.Callback() { + + @Override + public boolean onCreateActionMode(ActionMode mode, Menu menu) { + menu.add(Menu.NONE, android.R.id.paste, 0, android.R.string.paste); + return true; + } + + @Override + public boolean onPrepareActionMode(ActionMode mode, Menu menu) { + return true; + } + + @Override + public boolean onActionItemClicked(ActionMode mode, MenuItem item) { + switch (item.getItemId()) { + case android.R.id.paste: + pasteFromClipboard(); + hideActionMode(); + return true; + } + return true; + } + + @Override + public void onDestroyActionMode(ActionMode mode) { + + } + }); + } + } else { + requestFocus(); + } + setSelection(0); + AndroidUtilities.showKeyboard(this); + } + pressed = false; + } + return pressed; + } + + private void pasteFromClipboard() { + CodeFieldContainer codeFieldContainer = null; + if (getParent() instanceof CodeFieldContainer) { + codeFieldContainer = (CodeFieldContainer) getParent(); + } + if (codeFieldContainer != null) { + ClipboardManager clipboard = ContextCompat.getSystemService(getContext(), ClipboardManager.class); + if (clipboard == null) { + return; + } + clipboard.getPrimaryClipDescription().hasMimeType(ClipDescription.MIMETYPE_TEXT_PLAIN); + ClipData.Item item = clipboard.getPrimaryClip().getItemAt(0); + int i = -1; + String text = item.getText().toString(); + try { + i = Integer.parseInt(text); + } catch (Exception e) { + + } + if (i > 0) { + codeFieldContainer.setText(text, true); + } + } + } + + @Override + protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) { + super.onFocusChanged(focused, direction, previouslyFocusedRect); + if (!isFocused()) { + hideActionMode(); + } + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/AlertsCreator.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/AlertsCreator.java index 3fc1b225d..c1c4edc23 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/AlertsCreator.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/AlertsCreator.java @@ -1487,6 +1487,80 @@ public class AlertsCreator { } } + public static void createClearDaysDialogAlert(BaseFragment fragment, int days, TLRPC.User user, MessagesStorage.BooleanCallback onProcessRunnable, Theme.ResourcesProvider resourcesProvider) { + if (fragment == null || fragment.getParentActivity() == null || user == null) { + return; + } + int account = fragment.getCurrentAccount(); + + Context context = fragment.getParentActivity(); + AlertDialog.Builder builder = new AlertDialog.Builder(context, resourcesProvider); + long selfUserId = UserConfig.getInstance(account).getClientUserId(); + + CheckBoxCell[] cell = new CheckBoxCell[1]; + + TextView messageTextView = new TextView(context); + messageTextView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack)); + messageTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); + messageTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP); + + FrameLayout frameLayout = new FrameLayout(context) { + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + if (cell[0] != null) { + setMeasuredDimension(getMeasuredWidth(), getMeasuredHeight() + cell[0].getMeasuredHeight()); + } + } + }; + builder.setView(frameLayout); + + TextView textView = new TextView(context); + textView.setTextColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem)); + textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); + textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); + 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); + + textView.setText(LocaleController.formatPluralString("DeleteDays", days)); + + frameLayout.addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 24, 11, 24, 0)); + frameLayout.addView(messageTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 24, 48, 24, 18)); + + messageTextView.setText(LocaleController.getString("DeleteHistoryByDaysMessage", R.string.DeleteHistoryByDaysMessage)); + final boolean[] deleteForAll = new boolean[]{false}; + + if (user.id != selfUserId) { + cell[0] = new CheckBoxCell(context, 1, resourcesProvider); + cell[0].setBackgroundDrawable(Theme.getSelectorDrawable(false)); + cell[0].setText(LocaleController.formatString("DeleteMessagesOptionAlso", R.string.DeleteMessagesOptionAlso, UserObject.getFirstName(user)), "", false, false); + + cell[0].setPadding(LocaleController.isRTL ? AndroidUtilities.dp(16) : AndroidUtilities.dp(8), 0, LocaleController.isRTL ? AndroidUtilities.dp(8) : AndroidUtilities.dp(16), 0); + frameLayout.addView(cell[0], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.BOTTOM | Gravity.LEFT, 0, 0, 0, 0)); + + cell[0].setChecked(false, false); + cell[0].setOnClickListener(v -> { + CheckBoxCell cell1 = (CheckBoxCell) v; + deleteForAll[0] = !deleteForAll[0]; + cell1.setChecked(deleteForAll[0], true); + }); + } + + builder.setPositiveButton(LocaleController.getString("Delete", R.string.Delete), (dialogInterface, i) -> { + onProcessRunnable.run(deleteForAll[0]); + }); + builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); + AlertDialog alertDialog = builder.create(); + fragment.showDialog(alertDialog); + TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE); + if (button != null) { + button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2)); + } + } + public static void createCallDialogAlert(BaseFragment fragment, TLRPC.User user, boolean videoCall) { if (fragment == null || fragment.getParentActivity() == null || user == null || UserObject.isDeleted(user) || UserConfig.getInstance(fragment.getCurrentAccount()).getClientUserId() == user.id) { return; @@ -1831,6 +1905,43 @@ public class AlertsCreator { } + public static void showChatWithAdmin(BaseFragment fragment, TLRPC.User user, String chatWithAdmin, boolean isChannel, int chatWithAdminDate) { + if (fragment.getParentActivity() == null) { + return; + } + BottomSheet.Builder builder = new BottomSheet.Builder(fragment.getParentActivity()); + builder.setTitle(isChannel ? LocaleController.getString("ChatWithAdminChannelTitle", R.string.ChatWithAdminChannelTitle) : LocaleController.getString("ChatWithAdminGroupTitle", R.string.ChatWithAdminGroupTitle), true); + LinearLayout linearLayout = new LinearLayout(fragment.getParentActivity()); + linearLayout.setOrientation(LinearLayout.VERTICAL); + TextView messageTextView = new TextView(fragment.getParentActivity()); + linearLayout.addView(messageTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, 0, 24, 16, 24, 24)); + messageTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); + messageTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); + + messageTextView.setText(AndroidUtilities.replaceTags(LocaleController.formatString("ChatWithAdminMessage", R.string.ChatWithAdminMessage, chatWithAdmin, LocaleController.formatDateAudio(chatWithAdminDate, false)))); + + + TextView buttonTextView = new TextView(fragment.getParentActivity()); + buttonTextView.setPadding(AndroidUtilities.dp(34), 0, AndroidUtilities.dp(34), 0); + buttonTextView.setGravity(Gravity.CENTER); + buttonTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + buttonTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); + buttonTextView.setText(LocaleController.getString("IUnderstand", R.string.IUnderstand)); + + buttonTextView.setTextColor(Theme.getColor(Theme.key_featuredStickers_buttonText)); + buttonTextView.setBackgroundDrawable(Theme.createSimpleSelectorRoundRectDrawable(AndroidUtilities.dp(6), Theme.getColor(Theme.key_featuredStickers_addButton), Theme.getColor(Theme.key_featuredStickers_addButtonPressed))); + + linearLayout.addView(buttonTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48, 0, 24, 15, 16, 24)); + + + builder.setCustomView(linearLayout); + BottomSheet bottomSheet = builder.show(); + + buttonTextView.setOnClickListener((v) -> { + bottomSheet.dismiss(); + }); + } + public interface BlockDialogCallback { void run(boolean report, boolean delete); } 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 355318046..1f3de449a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/AudioPlayerAlert.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/AudioPlayerAlert.java @@ -1857,6 +1857,18 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter. } else { optionsButton.setVisibility(View.VISIBLE); } + if (MessagesController.getInstance(currentAccount).isChatNoForwards(messageObject.getChatId())) { + optionsButton.hideSubItem(1); + optionsButton.hideSubItem(2); + optionsButton.hideSubItem(5); + optionsButton.setAdditionalYOffset(-AndroidUtilities.dp(16)); + } else { + optionsButton.showSubItem(1); + optionsButton.showSubItem(2); + optionsButton.showSubItem(5); + optionsButton.setAdditionalYOffset(-AndroidUtilities.dp(157)); + } + checkIfMusicDownloaded(messageObject); updateProgress(messageObject, !sameMessageObject); updateCover(messageObject, !sameMessageObject); 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 71b6628d9..82eccf8c0 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java @@ -16,12 +16,14 @@ import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.annotation.SuppressLint; import android.app.Activity; +import android.app.Dialog; import android.content.ClipData; import android.content.ClipDescription; import android.content.ClipboardManager; import android.content.Context; import android.content.SharedPreferences; import android.content.pm.PackageManager; +import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; @@ -34,6 +36,7 @@ import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.Rect; import android.graphics.RectF; +import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.media.AudioManager; import android.net.Uri; @@ -55,6 +58,7 @@ 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; @@ -63,6 +67,8 @@ import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; import android.view.ViewGroup; +import android.view.ViewTreeObserver; +import android.view.WindowInsets; import android.view.WindowManager; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; @@ -92,6 +98,7 @@ import androidx.core.view.inputmethod.InputContentInfoCompat; import androidx.customview.widget.ExploreByTouchHelper; import androidx.recyclerview.widget.ChatListItemAnimator; import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import org.telegram.messenger.AccountInstance; import org.telegram.messenger.AndroidUtilities; @@ -138,6 +145,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Locale; +import java.util.concurrent.atomic.AtomicReference; public class ChatActivityEnterView extends FrameLayout implements NotificationCenter.NotificationCenterDelegate, SizeNotifierFrameLayout.SizeNotifierFrameLayoutDelegate, StickersAlert.StickersAlertDelegate { @@ -211,6 +219,28 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe default boolean hasForwardingMessages() { return false; } + + /** + * @return Height of the content view + */ + default int getContentViewHeight() { + return 0; + } + + /** + * @return Measured keyboard height + */ + default int measureKeyboardHeight() { + return 0; + } + + /** + * @return A list of available peers to send messages as + */ + @Nullable + default TLRPC.TL_channels_sendAsPeers getSendAsPeers() { + return null; + } } private final static int RECORD_STATE_ENTER = 0; @@ -244,6 +274,13 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe public BotCommandsMenuContainer botCommandsMenuContainer; private BotCommandsMenuView.BotCommandsAdapter botCommandsAdapter; + // Send as... stuff + private SenderSelectView senderSelectView; + private ActionBarPopupWindow senderSelectPopupWindow; + private Runnable onEmojiSearchClosed; + private int popupX, popupY; + private Runnable onKeyboardClosed; + private ValueAnimator searchAnimator; private float searchToOpenProgress; @@ -325,10 +362,6 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe private ActionBarPopupWindow.ActionBarPopupWindowLayout sendPopupLayout; private ImageView cancelBotButton; private ImageView[] emojiButton = new ImageView[2]; - @SuppressWarnings("FieldCanBeLocal") - private ImageView emojiButton1; - @SuppressWarnings("FieldCanBeLocal") - private ImageView emojiButton2; private ImageView expandStickersButton; private EmojiView emojiView; private AnimatorSet panelAnimation; @@ -1777,9 +1810,6 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe emojiButton[a].setAlpha(0.0f); emojiButton[a].setScaleX(0.1f); emojiButton[a].setScaleY(0.1f); - emojiButton2 = emojiButton[a]; - } else { - emojiButton1 = emojiButton[a]; } } setEmojiButtonImage(false, false); @@ -2412,6 +2442,527 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe attachButton.setContentDescription(LocaleController.getString("AccDescrAttachButton", R.string.AccDescrAttachButton)); } + senderSelectView = new SenderSelectView(getContext()); + senderSelectView.setOnClickListener(v -> { + if (getTranslationY() != 0) { + onEmojiSearchClosed = () -> senderSelectView.callOnClick(); + hidePopup(true, true); + return; + } + if (delegate.measureKeyboardHeight() > AndroidUtilities.dp(20)) { + int totalHeight = delegate.getContentViewHeight(); + int keyboard = delegate.measureKeyboardHeight(); + if (keyboard <= AndroidUtilities.dp(20)) { + totalHeight += keyboard; + } + if (emojiViewVisible) { + totalHeight -= getEmojiPadding(); + } + + if (totalHeight < AndroidUtilities.dp(200)) { + onKeyboardClosed = () -> senderSelectView.callOnClick(); + closeKeyboard(); + return; + } + } + if (delegate.getSendAsPeers() != null) { + if (senderSelectPopupWindow != null) { + senderSelectPopupWindow.setPauseNotifications(false); + senderSelectPopupWindow.dismiss(); + return; + } + MessagesController controller = MessagesController.getInstance(currentAccount); + TLRPC.ChatFull chatFull = controller.getChatFull(-dialog_id); + if (chatFull == null) { + return; + } + + List peers = delegate.getSendAsPeers().peers; + + ViewGroup fl = parentFragment.getParentLayout(); + FrameLayout scrimPopupContainerLayout = new FrameLayout(getContext()) { + @Override + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0 && senderSelectPopupWindow != null && senderSelectPopupWindow.isShowing()) { + senderSelectPopupWindow.dismiss(); + } + return super.dispatchKeyEvent(event); + } + }; + scrimPopupContainerLayout.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT)); + Drawable shadowDrawable2 = ContextCompat.getDrawable(getContext(), R.drawable.popup_fixed_alert).mutate(); + shadowDrawable2.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground), PorterDuff.Mode.MULTIPLY)); + scrimPopupContainerLayout.setBackground(shadowDrawable2); + + View dim = new View(getContext()); + dim.setBackgroundColor(0x33000000); + + int maxHeight = AndroidUtilities.dp(450); + LinearLayout rc = new LinearLayout(getContext()) { + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(Math.min(MeasureSpec.getSize(heightMeasureSpec), maxHeight), MeasureSpec.getMode(heightMeasureSpec))); + } + }; + rc.setOrientation(LinearLayout.VERTICAL); + TextView headerText = new TextView(parent.getContext()); + headerText.setTextColor(Theme.getColor(Theme.key_dialogTextBlue)); + headerText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15); + headerText.setText(LocaleController.getString("SendMessageAsTitle", R.string.SendMessageAsTitle)); + headerText.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"), Typeface.BOLD); + int dp = AndroidUtilities.dp(18); + headerText.setPadding(dp, AndroidUtilities.dp(13), dp, AndroidUtilities.dp(13)); + rc.addView(headerText); + + View shadow = new View(getContext()); + shadow.setAlpha(0); + FrameLayout rfl = new FrameLayout(getContext()); + RecyclerListView rv = new RecyclerListView(getContext()); + LinearLayoutManager llm = new LinearLayoutManager(getContext()); + AtomicReference animatorUpdateListenerRef = new AtomicReference<>(); + AtomicReference animatorListenerRef = new AtomicReference<>(); + AtomicReference animatorForSetRef = new AtomicReference<>(); + rv.setLayoutManager(llm); + rv.setAdapter(new RecyclerListView.SelectionAdapter() { + @Override + public boolean isEnabled(RecyclerView.ViewHolder holder) { + return true; + } + + final Object avatar = new Object(), title = new Object(), subtitle = new Object(); + + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + FrameLayout fl = new FrameLayout(parent.getContext()); + LinearLayout ll = new LinearLayout(parent.getContext()); + ll.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + ll.setOrientation(LinearLayout.HORIZONTAL); + ll.setGravity(Gravity.CENTER_VERTICAL); + int dp = AndroidUtilities.dp(14); + ll.setPadding(dp, dp / 2, dp, dp / 2); + + SimpleAvatarView avatar = new SimpleAvatarView(parent.getContext()); + avatar.setTag(this.avatar); + ll.addView(avatar, LayoutHelper.createLinear(44, 44)); + + LinearLayout ll2 = new LinearLayout(ll.getContext()); + ll2.setOrientation(LinearLayout.VERTICAL); + + TextView title = new TextView(parent.getContext()); + title.setTextColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem)); + title.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); + title.setTag(this.title); + title.setMaxLines(1); + title.setEllipsize(TextUtils.TruncateAt.END); + ll2.addView(title); + + TextView subtitle = new TextView(parent.getContext()); + subtitle.setTextColor(ColorUtils.setAlphaComponent(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem), 0x66)); + subtitle.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + subtitle.setTag(this.subtitle); + subtitle.setMaxLines(1); + subtitle.setEllipsize(TextUtils.TruncateAt.END); + ll2.addView(subtitle); + + ll.addView(ll2, LayoutHelper.createLinear(0, LayoutHelper.MATCH_PARENT, 1f, 12, 0, 0, 0)); + + View v = new View(parent.getContext()); + fl.addView(ll); + fl.addView(v); + + return new RecyclerListView.Holder(fl); + } + + @SuppressLint("SetTextI18n") + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + TLRPC.Peer peer = peers.get(position); + long peerId = 0; + + if (peer.channel_id != 0) { + peerId = -peer.channel_id; + } + if (peerId == 0 && peer.user_id != 0) { + peerId = peer.user_id; + } + + SimpleAvatarView avatar = holder.itemView.findViewWithTag(this.avatar); + TextView title = holder.itemView.findViewWithTag(this.title); + TextView subtitle = holder.itemView.findViewWithTag(this.subtitle); + + if (peerId < 0) { + TLRPC.Chat chat = controller.getChat(-peerId); + if (chat != null) { + title.setText(chat.title); + subtitle.setText(LocaleController.formatPluralString(ChatObject.isChannel(chat) && !chat.megagroup ? "Subscribers" : "Members", chat.participants_count)); + avatar.setAvatar(chat); + } + avatar.setSelected(chatFull.default_send_as != null && chatFull.default_send_as.channel_id == peer.channel_id, false); + } else { + TLRPC.User user = controller.getUser(peerId); + if (user != null) { + title.setText(user.first_name + (user.last_name != null ? " " + user.last_name : "")); + subtitle.setText(LocaleController.getString("VoipGroupPersonalAccount", R.string.VoipGroupPersonalAccount)); + avatar.setAvatar(user); + } + avatar.setSelected(chatFull.default_send_as != null && chatFull.default_send_as.user_id == peer.user_id, false); + } + } + + @Override + public int getItemCount() { + return peers.size(); + } + }); + rv.setOnItemClickListener((view, position) -> { + if (senderSelectPopupWindow == null) + return; + TLRPC.Peer peer = peers.get(position); + if (chatFull != null) { + chatFull.default_send_as = peer; + updateSendAsButton(); + } + + parentFragment.getMessagesController().setDefaultSendAs(dialog_id, peer.user_id != 0 ? peer.user_id : -peer.channel_id); + + int[] loc = new int[2]; + SimpleAvatarView sAvatar = (SimpleAvatarView) ((ViewGroup)((ViewGroup) view).getChildAt(0)).getChildAt(0); + boolean wasSelected = sAvatar.isSelected(); + sAvatar.getLocationInWindow(loc); + sAvatar.setSelected(true, true); + + SimpleAvatarView avatar = new SimpleAvatarView(getContext()); + if (peer.channel_id != 0) { + TLRPC.Chat chat = controller.getChat(peer.channel_id); + if (chat != null) { + avatar.setAvatar(chat); + } + } else if (peer.user_id != 0) { + TLRPC.User user = controller.getUser(peer.user_id); + if (user != null) { + avatar.setAvatar(user); + } + } + for (int i = 0; i < rv.getChildCount(); i++) { + View ch = rv.getChildAt(i); + if (i != position) { + ((SimpleAvatarView) ((ViewGroup)((ViewGroup) ch).getChildAt(0)).getChildAt(0)).setSelected(false, true); + } + } + + Dialog d = new Dialog(getContext(), R.style.TransparentDialogNoAnimation); + FrameLayout aFrame = new FrameLayout(getContext()); + aFrame.addView(avatar, LayoutHelper.createFrame(44, 44, Gravity.LEFT)); + d.setContentView(aFrame); + d.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + d.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); + d.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); + d.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); + d.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + d.getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); + d.getWindow().addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); + d.getWindow().getAttributes().windowAnimations = 0; + d.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION); + d.getWindow().setStatusBarColor(0); + d.getWindow().setNavigationBarColor(0); + + int color = Theme.getColor(Theme.key_actionBarDefault, null, true); + AndroidUtilities.setLightStatusBar(d.getWindow(), color == Color.WHITE); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + int color2 = Theme.getColor(Theme.key_windowBackgroundGray, null, true); + float brightness = AndroidUtilities.computePerceivedBrightness(color2); + AndroidUtilities.setLightNavigationBar(d.getWindow(), brightness >= 0.721f); + } + } + float offX = 0, offY = 0; + if (AndroidUtilities.isTablet()) { + parentFragment.getFragmentView().getLocationInWindow(location); + popupX += location[0]; + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + WindowInsets wi = getRootWindowInsets(); + popupX += wi.getSystemWindowInsetLeft(); + } + + senderSelectView.getLocationInWindow(location); + float eX = location[0], eY = location[1]; + + float off = wasSelected ? AndroidUtilities.dp(5) : 0; + float sX = loc[0] + popupX + off + AndroidUtilities.dp(4) + offX, sY = loc[1] + popupY + off + offY; + avatar.setTranslationX(sX); + avatar.setTranslationY(sY); + + float sSc = wasSelected ? 34f / 44f : 1, eSc = senderSelectView.getLayoutParams().width / (float)AndroidUtilities.dp(44); + avatar.setPivotX(0); + avatar.setPivotY(0); + avatar.setScaleX(sSc); + avatar.setScaleY(sSc); + + animatorListenerRef.set(new AnimatorListenerAdapter() { + @Override + public void onAnimationStart(Animator animation) { + avatar.getViewTreeObserver().addOnDrawListener(new ViewTreeObserver.OnDrawListener() { + @Override + public void onDraw() { + avatar.post(()->{ + avatar.getViewTreeObserver().removeOnDrawListener(this); + sAvatar.setHideAvatar(true); + }); + } + }); + d.show(); + } + + @Override + public void onAnimationEnd(Animator animation) { + senderSelectView.setProgress(0, false); + senderSelectView.setScaleX(1); + senderSelectView.setScaleY(1); + senderSelectView.setAlpha(1); + senderSelectView.getViewTreeObserver().addOnDrawListener(new ViewTreeObserver.OnDrawListener() { + @Override + public void onDraw() { + senderSelectView.post(()->{ + senderSelectView.getViewTreeObserver().removeOnDrawListener(this); + d.dismiss(); + }); + } + }); + } + + @Override + public void onAnimationCancel(Animator animation) { + onAnimationEnd(animation); + } + }); + animatorUpdateListenerRef.set(animation -> { + float f = (float) animation.getAnimatedValue(); + + float selSc = 0.5f + f * 0.5f; + senderSelectView.setScaleX(selSc); + senderSelectView.setScaleY(selSc); + senderSelectView.setAlpha(f); + }); + ValueAnimator anim = ValueAnimator.ofFloat(0, 1).setDuration(350); + float pos = (rv.getY() + rv.getMeasuredHeight() - loc[1]) / (float)AndroidUtilities.dp(58); + float mAmplitude = 0.18f - pos * 0.009f, + mFrequency = 5.7f - pos * 0.325f; + anim.setInterpolator(time -> (float) (-1 * Math.pow(Math.E, -time / mAmplitude) * + Math.cos(mFrequency * time) + 1)); + anim.addUpdateListener(animation -> { + float val = (float) animation.getAnimatedValue(); + avatar.setTranslationX(sX + (eX - sX) * val); + avatar.setTranslationY(sY + (eY - sY) * val); + float sc = sSc + (eSc - sSc) * val; + avatar.setScaleX(sc); + avatar.setScaleY(sc); + }); + animatorForSetRef.set(anim); + + senderSelectPopupWindow.dismiss(); + }); + int shadowDuration = 150; + rv.addOnScrollListener(new RecyclerView.OnScrollListener() { + Boolean isVisible; + + @Override + public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { + boolean v = llm.findFirstCompletelyVisibleItemPosition() == 0; + if (isVisible == null || v != isVisible) { + shadow.animate().cancel(); + if (v) { + shadow.animate().alpha(0).setDuration(shadowDuration).start(); + } else { + shadow.animate().alpha(1).setDuration(shadowDuration).start(); + } + isVisible = v; + } + } + }); + rv.setOverScrollMode(OVER_SCROLL_NEVER); + rfl.addView(rv); + + Drawable d = Theme.getThemedDrawable(getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow); + shadow.setBackground(d); + rfl.addView(shadow, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 4)); + + rc.addView(rfl, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); + scrimPopupContainerLayout.addView(rc); + + senderSelectPopupWindow = new ActionBarPopupWindow(scrimPopupContainerLayout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT) { + private void dismissSuper() { + super.dismiss(); + } + + @Override + public void dismiss() { + if (senderSelectPopupWindow != this) { + fl.removeView(dim); + super.dismiss(); + return; + } + + float scStart = 0.25f; + + scrimPopupContainerLayout.setPivotX(AndroidUtilities.dp(8)); + scrimPopupContainerLayout.setPivotY(scrimPopupContainerLayout.getMeasuredHeight() - AndroidUtilities.dp(8)); + rc.setPivotX(0); + rc.setPivotY(0); + + scrimPopupContainerLayout.setScaleX(1); + scrimPopupContainerLayout.setScaleY(1); + rc.setAlpha(1); + + dim.setAlpha(1); + AnimatorSet animatorSet = new AnimatorSet(); + ValueAnimator anim = ValueAnimator.ofFloat(1, 0).setDuration(220); + anim.setInterpolator(CubicBezierInterpolator.EASE_OUT); + anim.addUpdateListener(animation -> { + float val = (float) animation.getAnimatedValue(); + float sc = scStart + (1f - scStart) * val; + scrimPopupContainerLayout.setScaleX(sc); + scrimPopupContainerLayout.setScaleY(sc); + scrimPopupContainerLayout.setAlpha(val); + rc.setScaleX(1f / sc); + rc.setScaleY(1f / sc); + rc.setAlpha(sc); + + dim.setAlpha(val); + }); + animatorSet.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + fl.removeView(dim); + dismissSuper(); + } + }); + + ValueAnimator anim2 = ValueAnimator.ofFloat(1, 0).setDuration(350); + anim2.setInterpolator(Easings.easeOutSine); + ValueAnimator.AnimatorUpdateListener l = animatorUpdateListenerRef.get(); + if (l != null) { + anim2.addUpdateListener(l); + } + Animator.AnimatorListener l2 = animatorListenerRef.get(); + if (l2 != null) { + anim2.addListener(l2); + } + + animatorSet.playTogether(anim, anim2); + + senderSelectPopupWindow = null; + if (l == null && l2 == null) senderSelectView.setProgress(0); + + Animator secAnim = animatorForSetRef.get(); + if (secAnim != null) { + animatorSet.playTogether(secAnim); + } + animatorSet.start(); + } + }; + senderSelectPopupWindow.setPauseNotifications(true); + senderSelectPopupWindow.setDismissAnimationDuration(220); + senderSelectPopupWindow.setOutsideTouchable(true); + senderSelectPopupWindow.setClippingEnabled(true); + senderSelectPopupWindow.setFocusable(true); + scrimPopupContainerLayout.measure(View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), View.MeasureSpec.AT_MOST), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), View.MeasureSpec.AT_MOST)); + senderSelectPopupWindow.setInputMethodMode(ActionBarPopupWindow.INPUT_METHOD_NOT_NEEDED); + senderSelectPopupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED); + senderSelectPopupWindow.getContentView().setFocusableInTouchMode(true); + senderSelectPopupWindow.setAnimationEnabled(false); + + TLRPC.Peer defPeer = chatFull.default_send_as != null ? chatFull.default_send_as : null; + if (defPeer != null) { + int itemHeight = AndroidUtilities.dp(14 + 44); + int totalRecyclerHeight = peers.size() * itemHeight; + for (int i = 0; i < peers.size(); i++) { + TLRPC.Peer p = peers.get(i); + if (p.channel_id != 0 && p.channel_id == defPeer.channel_id || p.user_id != 0 && p.user_id == defPeer.user_id || + p.chat_id != 0 && p.chat_id == defPeer.chat_id) { + int off = 0; + if (i != peers.size() - 1 && rv.getMeasuredHeight() < totalRecyclerHeight) { + off = rv.getMeasuredHeight() % itemHeight; + } + + llm.scrollToPositionWithOffset(i, off + AndroidUtilities.dp(7) + (totalRecyclerHeight - (peers.size() - 2) * itemHeight)); + if (rv.computeVerticalScrollOffset() > 0) { + shadow.animate().cancel(); + shadow.animate().alpha(1).setDuration(shadowDuration).start(); + } + break; + } + } + } + + int pad = -AndroidUtilities.dp(4); + int[] location = new int[2]; + int popupX = pad; + if (AndroidUtilities.isTablet()) { + parentFragment.getFragmentView().getLocationInWindow(location); + popupX += location[0]; + } + int totalHeight = delegate.getContentViewHeight(); + int height = scrimPopupContainerLayout.getMeasuredHeight(); + int keyboard = delegate.measureKeyboardHeight(); + if (keyboard <= AndroidUtilities.dp(20)) { + totalHeight += keyboard; + } + if (emojiViewVisible) { + totalHeight -= getEmojiPadding(); + } + + int shadowPad = AndroidUtilities.dp(1); + int popupY; + if (height < totalHeight + pad * 2 - (parentFragment.isInBubbleMode() ? 0 : AndroidUtilities.statusBarHeight) - headerText.getMeasuredHeight()) { + ChatActivityEnterView.this.getLocationInWindow(location); + popupY = location[1] - height - pad - AndroidUtilities.dp(2); + fl.addView(dim, new FrameLayout.LayoutParams(LayoutHelper.MATCH_PARENT, popupY + pad + height + shadowPad + AndroidUtilities.dp(2))); + } else { + popupY = parentFragment.isInBubbleMode() ? 0 : AndroidUtilities.statusBarHeight; + int off = AndroidUtilities.dp(14); + rc.getLayoutParams().height = totalHeight - popupY - off - getHeightWithTopView(); + fl.addView(dim, new FrameLayout.LayoutParams(LayoutHelper.MATCH_PARENT, off + popupY + rc.getLayoutParams().height + shadowPad)); + } + + float scStart = 0.25f; + + scrimPopupContainerLayout.setPivotX(AndroidUtilities.dp(8)); + scrimPopupContainerLayout.setPivotY(scrimPopupContainerLayout.getMeasuredHeight() - AndroidUtilities.dp(8)); + rc.setPivotX(0); + rc.setPivotY(0); + + scrimPopupContainerLayout.setScaleX(scStart); + scrimPopupContainerLayout.setScaleY(scStart); + rc.setAlpha(scStart); + + dim.setAlpha(0); + + ValueAnimator anim = ValueAnimator.ofFloat(0, 1).setDuration(220); + anim.setInterpolator(CubicBezierInterpolator.EASE_OUT); + anim.addUpdateListener(animation -> { + float val = (float) animation.getAnimatedValue(); + float sc = scStart + (1f - scStart) * val; + scrimPopupContainerLayout.setScaleX(sc); + scrimPopupContainerLayout.setScaleY(sc); + rc.setScaleX(1f / sc); + rc.setScaleY(1f / sc); + rc.setAlpha(sc); + + dim.setAlpha(val); + }); + anim.start(); + + senderSelectPopupWindow.showAtLocation(v, Gravity.LEFT | Gravity.TOP, this.popupX = popupX, this.popupY = popupY); + senderSelectView.setProgress(1); + } + }); + senderSelectView.setVisibility(GONE); + frameLayout.addView(senderSelectView, LayoutHelper.createFrame(32, 32, Gravity.BOTTOM | Gravity.LEFT, 10, 8, 10, 8)); + recordedAudioPanel = new FrameLayout(context); recordedAudioPanel.setVisibility(audioToSend == null ? GONE : VISIBLE); recordedAudioPanel.setFocusable(true); @@ -3585,6 +4136,13 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe return topView != null && topView.getVisibility() == VISIBLE; } + public void onAdjustPanTransitionEnd() { + if (onKeyboardClosed != null) { + onKeyboardClosed.run(); + onKeyboardClosed = null; + } + } + public void onAdjustPanTransitionStart(boolean keyboardVisible) { if (keyboardVisible && showTopViewRunnable != null) { AndroidUtilities.cancelRunOnUIThread(showTopViewRunnable); @@ -3682,6 +4240,10 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe if (sizeNotifierLayout != null) { sizeNotifierLayout.setDelegate(null); } + if (senderSelectPopupWindow != null) { + senderSelectPopupWindow.setPauseNotifications(false); + senderSelectPopupWindow.dismiss(); + } } public void checkChannelRights() { @@ -3704,10 +4266,23 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe } } + @Override + protected void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + if (senderSelectPopupWindow != null){ + senderSelectPopupWindow.setPauseNotifications(false); + senderSelectPopupWindow.dismiss(); + } + } + private Runnable hideKeyboardRunnable; public void onPause() { isPaused = true; + if (senderSelectPopupWindow != null) { + senderSelectPopupWindow.setPauseNotifications(false); + senderSelectPopupWindow.dismiss(); + } if (keyboardVisible) { showKeyboardOnResume = true; } @@ -3781,6 +4356,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe updateScheduleButton(false); checkRoundVideo(); updateFieldHint(false); + updateSendAsButton(); } public void setChatInfo(TLRPC.ChatFull chatInfo) { @@ -3832,7 +4408,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe return hasRecordVideo; } - private void updateFieldHint(boolean animated) { + public void updateFieldHint(boolean animated) { if (replyingMessageObject != null && replyingMessageObject.messageOwner.reply_markup != null && !TextUtils.isEmpty(replyingMessageObject.messageOwner.reply_markup.placeholder)) { messageEditText.setHintText(replyingMessageObject.messageOwner.reply_markup.placeholder, animated); } else if (editingMessageObject != null) { @@ -3844,8 +4420,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe boolean anonymously = false; if (DialogObject.isChatDialog(dialog_id)) { TLRPC.Chat chat = accountInstance.getMessagesController().getChat(-dialog_id); + TLRPC.ChatFull chatFull = accountInstance.getMessagesController().getChatFull(-dialog_id); isChannel = ChatObject.isChannel(chat) && !chat.megagroup; - anonymously = ChatObject.shouldSendAnonymously(chat); + anonymously = ChatObject.getSendAsPeerId(chat, chatFull) == chat.id; } if (anonymously) { messageEditText.setHintText(LocaleController.getString("SendAnonymously", R.string.SendAnonymously)); @@ -4082,6 +4659,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe messageEditText.setAlpha(1f); messageEditText.setTranslationX(0); messageEditText.requestFocus(); + updateSendAsButton(); } }); @@ -5678,6 +6256,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe slideText.setCancelToProgress(0f); delegate.onAudioVideoInterfaceUpdated(); + updateSendAsButton(); } } }); @@ -5685,6 +6264,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe recordTimerView.stop(); } delegate.onAudioVideoInterfaceUpdated(); + updateSendAsButton(); } @Override @@ -5926,6 +6506,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe updateFieldRight(1); } updateFieldHint(false); + updateSendAsButton(); } public ImageView getAttachButton() { @@ -5949,9 +6530,6 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe } public void updateColors() { - if (emojiView != null) { - emojiView.updateColors(); - } if (sendPopupLayout != null) { for (int a = 0, count = sendPopupLayout.getChildCount(); a < count; a++) { final View view = sendPopupLayout.getChildAt(a); @@ -5992,7 +6570,11 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe } for (int i = 0; i < 2; ++i) { emojiButton[i].setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_chat_messagePanelIcons), PorterDuff.Mode.MULTIPLY)); + if (Build.VERSION.SDK_INT >= 21) { + emojiButton[i].setBackgroundDrawable(Theme.createSelectorDrawable(getThemedColor(Theme.key_listSelector))); + } } + } private void updateRecordedDeleteIconColors() { @@ -6215,6 +6797,108 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe } } + public void updateSendAsButton() { + if (parentFragment == null) { + return; + } + TLRPC.ChatFull full = parentFragment.getMessagesController().getChatFull(-dialog_id); + TLRPC.Peer defPeer = full != null ? full.default_send_as : null; + if (defPeer == null && delegate.getSendAsPeers() != null && !delegate.getSendAsPeers().peers.isEmpty()) { + defPeer = delegate.getSendAsPeers().peers.get(0); + } + if (defPeer != null) { + if (defPeer.channel_id != 0) { + TLRPC.Chat ch = MessagesController.getInstance(currentAccount).getChat(defPeer.channel_id); + if (ch != null) senderSelectView.setAvatar(ch); + } else { + TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(defPeer.user_id); + if (user != null) senderSelectView.setAvatar(user); + } + } + 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); + int pad = AndroidUtilities.dp(2); + MarginLayoutParams params = (MarginLayoutParams) senderSelectView.getLayoutParams(); + float sA = isVisible ? 0 : 1; + float sX = isVisible ? -senderSelectView.getLayoutParams().width - params.leftMargin - pad : 0; + float eA = isVisible ? 1 : 0; + float eX = isVisible ? 0 : -senderSelectView.getLayoutParams().width - params.leftMargin - pad; + + if (wasVisible != isVisible) { + ValueAnimator a = (ValueAnimator) senderSelectView.getTag(); + if (a != null) { + a.cancel(); + senderSelectView.setTag(null); + } + + if (parentFragment.getOtherSameChatsDiff() == 0 && parentFragment.fragmentOpened) { + ValueAnimator anim = ValueAnimator.ofFloat(0, 1).setDuration(220); + anim.setInterpolator(CubicBezierInterpolator.DEFAULT); + anim.addUpdateListener(animation -> { + float val = (float) animation.getAnimatedValue(); + + senderSelectView.setAlpha(sA + (eA - sA) * val); + senderSelectView.setTranslationX(sX + (eX - sX) * val); + for (ImageView emoji : emojiButton) + emoji.setTranslationX(senderSelectView.getTranslationX()); + messageEditText.setTranslationX(senderSelectView.getTranslationX()); + }); + anim.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationStart(Animator animation) { + if (isVisible) + senderSelectView.setVisibility(VISIBLE); + senderSelectView.setAlpha(sA); + senderSelectView.setTranslationX(sX); + for (ImageView emoji : emojiButton) + emoji.setTranslationX(senderSelectView.getTranslationX()); + messageEditText.setTranslationX(senderSelectView.getTranslationX()); + + if (botCommandsMenuButton.getTag() == null) { + animationParamsX.clear(); + } + } + + @Override + public void onAnimationEnd(Animator animation) { + if (!isVisible) { + senderSelectView.setVisibility(GONE); + for (ImageView emoji : emojiButton) + emoji.setTranslationX(0); + messageEditText.setTranslationX(0); + } + } + + @Override + public void onAnimationCancel(Animator animation) { + if (isVisible) { + senderSelectView.setVisibility(VISIBLE); + } else { + senderSelectView.setVisibility(GONE); + } + senderSelectView.setAlpha(eA); + senderSelectView.setTranslationX(eX); + for (ImageView emoji : emojiButton) + emoji.setTranslationX(senderSelectView.getTranslationX()); + messageEditText.setTranslationX(senderSelectView.getTranslationX()); + + requestLayout(); + } + }); + anim.start(); + senderSelectView.setTag(anim); + } else { + senderSelectView.setVisibility(isVisible ? VISIBLE : GONE); + senderSelectView.setTranslationX(eX); + for (ImageView emoji : emojiButton) + emoji.setTranslationX(eX); + messageEditText.setTranslationX(eX); + senderSelectView.setAlpha(eA); + senderSelectView.setTag(null); + } + } + } + private void updateBotButton(boolean animated) { if (botButton == null) { return; @@ -7160,12 +7844,16 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe } public void hidePopup(boolean byBackButton) { + hidePopup(byBackButton, false); + } + + public void hidePopup(boolean byBackButton, boolean forceAnimate) { if (isPopupShowing()) { if (currentPopupContentType == 1 && byBackButton && botButtonsMessageObject != null) { SharedPreferences preferences = MessagesController.getMainSettings(currentAccount); preferences.edit().putInt("hidekeyboard_" + dialog_id, botButtonsMessageObject.getId()).commit(); } - if (byBackButton && searchingType != 0) { + if (byBackButton && searchingType != 0 || forceAnimate) { setSearchingTypeInternal(0, true); if (emojiView != null) { emojiView.closeSearch(true); @@ -7804,6 +8492,10 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe if (keyboardVisible && isPopupShowing()) { showPopup(0, currentPopupContentType); } + if (onEmojiSearchClosed != null) { + onEmojiSearchClosed.run(); + onEmojiSearchClosed = null; + } NotificationCenter.getInstance(currentAccount).onAnimationFinish(notificationsIndex); } }); @@ -8406,6 +9098,12 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe ((MarginLayoutParams) emojiButton[i].getLayoutParams()).leftMargin = AndroidUtilities.dp(10) + botCommandsMenuButton.getMeasuredWidth(); } ((MarginLayoutParams) messageEditText.getLayoutParams()).leftMargin = AndroidUtilities.dp(57) + botCommandsMenuButton.getMeasuredWidth(); + } else if (senderSelectView != null && senderSelectView.getVisibility() == View.VISIBLE) { + senderSelectView.measure(widthMeasureSpec, heightMeasureSpec); + for (int i = 0; i < emojiButton.length; i++) { + ((MarginLayoutParams) emojiButton[i].getLayoutParams()).leftMargin = AndroidUtilities.dp(16) + senderSelectView.getLayoutParams().width; + } + ((MarginLayoutParams) messageEditText.getLayoutParams()).leftMargin = AndroidUtilities.dp(63) + senderSelectView.getLayoutParams().width; } else { for (int i = 0; i < emojiButton.length; i++) { ((MarginLayoutParams) emojiButton[i].getLayoutParams()).leftMargin = AndroidUtilities.dp(3); 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 da3dd4329..6c6f4bdcf 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertDocumentLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertDocumentLayout.java @@ -13,14 +13,20 @@ import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.annotation.SuppressLint; +import android.app.Application; +import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; +import android.net.Uri; +import android.os.Build; import android.os.Environment; import android.os.StatFs; +import android.os.storage.StorageManager; +import android.provider.Settings; import android.text.TextUtils; import android.util.SparseArray; import android.view.Gravity; @@ -29,10 +35,12 @@ import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.widget.EditText; import android.widget.FrameLayout; +import android.widget.TextView; import org.telegram.messenger.AccountInstance; import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.ApplicationLoader; +import org.telegram.messenger.BuildConfig; import org.telegram.messenger.BuildVars; import org.telegram.messenger.FileLoader; import org.telegram.messenger.FileLog; @@ -57,6 +65,7 @@ import org.telegram.ui.Cells.GraySectionCell; import org.telegram.ui.Cells.HeaderCell; import org.telegram.ui.Cells.ShadowSectionCell; import org.telegram.ui.Cells.SharedDocumentCell; +import org.telegram.ui.Cells.TextCheckBoxCell; import org.telegram.ui.ChatActivity; import org.telegram.ui.FilteredSearchView; import org.telegram.ui.PhotoPickerActivity; @@ -327,10 +336,40 @@ public class ChatAttachAlertDocumentLayout extends ChatAttachAlert.AttachAlertLa ListItem item = (ListItem) object; File file = item.file; boolean isExternalStorageManager = false; - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.R) { - isExternalStorageManager = Environment.isExternalStorageManager(); - } - if (file == null) { +// 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(); + }*/ + } else if (file == null) { if (item.icon == R.drawable.files_gallery) { HashMap selectedPhotos = new HashMap<>(); ArrayList selectedPhotosOrder = new ArrayList<>(); @@ -373,8 +412,6 @@ public class ChatAttachAlertDocumentLayout extends ChatAttachAlert.AttachAlertLa if (delegate != null) { delegate.startMusicSelectActivity(); } - } else if (!BuildVars.NO_SCOPED_STORAGE && item.icon == R.drawable.files_storage && !isExternalStorageManager) { - delegate.startDocumentSelectActivity(); } else { int top = getTopForScroll(); HistoryEntry he = history.remove(history.size() - 1); @@ -950,13 +987,13 @@ public class ChatAttachAlertDocumentLayout extends ChatAttachAlert.AttachAlertLa if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.R) { isExternalStorageManager = Environment.isExternalStorageManager(); } - if (!BuildVars.NO_SCOPED_STORAGE && !isExternalStorageManager) { - ListItem ext = new ListItem(); - ext.title = LocaleController.getString("InternalStorage", R.string.InternalStorage); - ext.icon = R.drawable.files_storage; - ext.subtitle = LocaleController.getString("InternalFolderInfo", R.string.InternalFolderInfo); - items.add(ext); - } else { +// if (!BuildVars.NO_SCOPED_STORAGE && !isExternalStorageManager) { +// ListItem ext = new ListItem(); +// ext.title = LocaleController.getString("InternalStorage", R.string.InternalStorage); +// ext.icon = R.drawable.files_storage; +// ext.subtitle = LocaleController.getString("InternalFolderInfo", R.string.InternalFolderInfo); +// items.add(ext); +// } else { String defaultPath = Environment.getExternalStorageDirectory().getPath(); String defaultPathState = Environment.getExternalStorageState(); if (defaultPathState.equals(Environment.MEDIA_MOUNTED) || defaultPathState.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) { @@ -1031,7 +1068,7 @@ public class ChatAttachAlertDocumentLayout extends ChatAttachAlert.AttachAlertLa } } } - } + //} ListItem fs; try { 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 d51ac2c46..d46506faf 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatThemeBottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatThemeBottomSheet.java @@ -4,27 +4,17 @@ import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.annotation.SuppressLint; -import android.content.Context; import android.graphics.Bitmap; -import android.graphics.BitmapFactory; import android.graphics.BitmapShader; 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.PorterDuffXfermode; -import android.graphics.RectF; import android.graphics.Shader; -import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; -import android.text.Layout; -import android.text.StaticLayout; -import android.text.TextPaint; import android.text.TextUtils; import android.util.TypedValue; import android.view.Gravity; @@ -44,11 +34,8 @@ import androidx.recyclerview.widget.RecyclerView; import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.ApplicationLoader; 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.ImageLocation; import org.telegram.messenger.LocaleController; import org.telegram.messenger.MediaDataController; import org.telegram.messenger.NotificationCenter; @@ -63,6 +50,7 @@ import org.telegram.ui.ActionBar.BottomSheet; import org.telegram.ui.ActionBar.EmojiThemes; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.ActionBar.ThemeDescription; +import org.telegram.ui.Cells.DrawerProfileCell; import org.telegram.ui.Cells.ThemesHorizontalListCell; import org.telegram.ui.ChatActivity; @@ -107,7 +95,7 @@ public class ChatThemeBottomSheet extends BottomSheet implements NotificationCen this.themeDelegate = themeDelegate; this.originalTheme = themeDelegate.getCurrentTheme(); this.originalIsDark = Theme.getActiveTheme().isDark(); - adapter = new Adapter(currentAccount, themeDelegate, Adapter.TYPE_DEFAULT); + adapter = new Adapter(currentAccount, themeDelegate, ThemeSmallPreviewView.TYPE_DEFAULT); setDimBehind(false); setCanDismissWithSwipe(false); setApplyBottomPadding(false); @@ -196,13 +184,13 @@ public class ChatThemeBottomSheet extends BottomSheet implements NotificationCen } }, 100); for (int i = 0; i < recyclerView.getChildCount(); i++) { - Adapter.ChatThemeView child = (Adapter.ChatThemeView) recyclerView.getChildAt(i); + ThemeSmallPreviewView child = (ThemeSmallPreviewView) recyclerView.getChildAt(i); if (child != view) { child.cancelAnimation(); } } if (!adapter.items.get(position).chatTheme.showAsDefaultStub) { - ((Adapter.ChatThemeView) view).playEmojiAnimation(); + ((ThemeSmallPreviewView) view).playEmojiAnimation(); } }); @@ -363,7 +351,7 @@ public class ChatThemeBottomSheet extends BottomSheet implements NotificationCen ArrayList themeDescriptions = new ArrayList<>(); themeDescriptions.add(new ThemeDescription(null, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, new Drawable[]{shadowDrawable}, 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[]{Adapter.ChatThemeView.class}, null, null, null, Theme.key_dialogBackgroundGray)); + themeDescriptions.add(new ThemeDescription(recyclerView, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[]{ThemeSmallPreviewView.class}, null, null, null, Theme.key_dialogBackgroundGray)); themeDescriptions.add(new ThemeDescription(applyButton, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_featuredStickers_addButton)); themeDescriptions.add(new ThemeDescription(applyButton, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_featuredStickers_addButtonPressed)); for (ThemeDescription description : themeDescriptions) { @@ -657,21 +645,19 @@ public class ChatThemeBottomSheet extends BottomSheet implements NotificationCen @SuppressLint("NotifyDataSetChanged") public static class Adapter extends RecyclerView.Adapter { - public final static int TYPE_DEFAULT = 0; - public final static int TYPE_GRID = 1; private final Theme.ResourcesProvider resourcesProvider; public List items; - private WeakReference selectedViewRef; + private WeakReference selectedViewRef; private int selectedItemPosition = -1; private final int currentAccount; - private final int currentType; + private final int currentViewType; private HashMap loadingThemes = new HashMap<>(); private HashMap loadingWallpapers = new HashMap<>(); public Adapter(int currentAccount, Theme.ResourcesProvider resourcesProvider, int type) { - this.currentType = type; + this.currentViewType = type; this.resourcesProvider = resourcesProvider; this.currentAccount = currentAccount; } @@ -679,12 +665,12 @@ public class ChatThemeBottomSheet extends BottomSheet implements NotificationCen @NonNull @Override public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - return new RecyclerListView.Holder(new ChatThemeView(parent.getContext(), currentAccount, resourcesProvider, currentType)); + return new RecyclerListView.Holder(new ThemeSmallPreviewView(parent.getContext(), currentAccount, resourcesProvider, currentViewType)); } @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { - ChatThemeView view = (ChatThemeView) holder.itemView; + ThemeSmallPreviewView view = (ThemeSmallPreviewView) holder.itemView; Theme.ThemeInfo themeInfo = items.get(position).chatTheme.getThemeInfo(items.get(position).themeIndex); if (themeInfo != null && themeInfo.pathToFile != null && !themeInfo.previewParsed) { File file = new File(themeInfo.pathToFile); @@ -693,9 +679,14 @@ public class ChatThemeBottomSheet extends BottomSheet implements NotificationCen parseTheme(themeInfo); } } + boolean animated = true; + ChatThemeItem newItem = items.get(position); + if (view.chatThemeItem == null || !view.chatThemeItem.chatTheme.getEmoticon().equals(newItem.chatTheme.getEmoticon()) || DrawerProfileCell.switchingTheme || view.lastThemeIndex != newItem.themeIndex) { + animated = false; + } - view.setItem(items.get(position)); - view.setSelected(position == selectedItemPosition); + view.setItem(newItem, animated); + view.setSelected(position == selectedItemPosition, animated); if (position == selectedItemPosition) { selectedViewRef = new WeakReference<>(view); } @@ -874,7 +865,7 @@ public class ChatThemeBottomSheet extends BottomSheet implements NotificationCen } if (selectedItemPosition >= 0) { notifyItemChanged(selectedItemPosition); - ChatThemeView view = selectedViewRef == null ? null : selectedViewRef.get(); + ThemeSmallPreviewView view = selectedViewRef == null ? null : selectedViewRef.get(); if (view != null) { view.setSelected(false); } @@ -883,437 +874,6 @@ public class ChatThemeBottomSheet extends BottomSheet implements NotificationCen notifyItemChanged(selectedItemPosition); } - - public static class ChatThemeView extends FrameLayout implements Animator.AnimatorListener, ValueAnimator.AnimatorUpdateListener { - - private final float STROKE_RADIUS = AndroidUtilities.dp(8); - private final float INNER_RADIUS = AndroidUtilities.dp(6); - private final float INNER_RECT_SPACE = AndroidUtilities.dp(4); - private final float BUBBLE_HEIGHT = AndroidUtilities.dp(21); - private final float BUBBLE_WIDTH = AndroidUtilities.dp(41); - - private final Paint backgroundFillPaint = new Paint(Paint.ANTI_ALIAS_FLAG); - private final Paint strokePaint = new Paint(Paint.ANTI_ALIAS_FLAG); - private final Paint outBubblePaintFirst = new Paint(Paint.ANTI_ALIAS_FLAG); - private final Paint outBubblePaintSecond = new Paint(Paint.ANTI_ALIAS_FLAG); - private final Paint inBubblePaint = new Paint(Paint.ANTI_ALIAS_FLAG); - private final RectF rectF = new RectF(); - private final Path clipPath = new Path(); - private final Theme.ResourcesProvider resourcesProvider; - - private ValueAnimator strokeAlphaAnimator; - private TextPaint noThemeTextPaint; - private StaticLayout textLayout; - private ChatThemeItem chatThemeItem; - private BackupImageView backupImageView; - private boolean hasAnimatedEmoji; - private final int currentAccount; - Runnable animationCancelRunnable; - private int currentType; - int patternColor; - - public ChatThemeView(Context context, int currentAccount, Theme.ResourcesProvider resourcesProvider, int currentType) { - super(context); - this.currentType = currentType; - this.currentAccount = currentAccount; - this.resourcesProvider = resourcesProvider; - strokePaint.setStyle(Paint.Style.STROKE); - strokePaint.setStrokeWidth(AndroidUtilities.dp(2)); - setBackgroundColor(getThemedColor(Theme.key_dialogBackgroundGray)); - backupImageView = new BackupImageView(context); - backupImageView.getImageReceiver().setCrossfadeWithOldImage(true); - backupImageView.getImageReceiver().setAllowStartLottieAnimation(false); - backupImageView.getImageReceiver().setAutoRepeat(0); - if (currentType == TYPE_DEFAULT) { - 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)); - } - - } - - @Override - protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - if (currentType == TYPE_GRID) { - int width = MeasureSpec.getSize(widthMeasureSpec); - 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); - super.onMeasure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)); - } - - backupImageView.setPivotY(backupImageView.getMeasuredHeight()); - backupImageView.setPivotX(backupImageView.getMeasuredWidth() / 2f); - } - - @Override - protected void onSizeChanged(int w, int h, int oldw, int oldh) { - super.onSizeChanged(w, h, oldw, oldh); - if (w == oldw && h == oldh) { - return; - } - rectF.set(INNER_RECT_SPACE, INNER_RECT_SPACE, w - INNER_RECT_SPACE, h - INNER_RECT_SPACE); - clipPath.reset(); - clipPath.addRoundRect(rectF, INNER_RADIUS, INNER_RADIUS, Path.Direction.CW); - } - - @Override - protected void dispatchDraw(Canvas canvas) { - if (chatThemeItem == null) { - super.dispatchDraw(canvas); - return; - } - if (chatThemeItem.isSelected || strokeAlphaAnimator != null) { - float rectSpace = strokePaint.getStrokeWidth() * 0.5f; - rectF.set(rectSpace, rectSpace, getWidth() - rectSpace, getHeight() - rectSpace); - canvas.drawRoundRect(rectF, STROKE_RADIUS, STROKE_RADIUS, strokePaint); - } - rectF.set(INNER_RECT_SPACE, INNER_RECT_SPACE, getWidth() - INNER_RECT_SPACE, getHeight() - INNER_RECT_SPACE); - if (chatThemeItem.chatTheme == null || chatThemeItem.chatTheme.showAsDefaultStub) { - canvas.drawRoundRect(rectF, INNER_RADIUS, INNER_RADIUS, backgroundFillPaint); - canvas.save(); - StaticLayout textLayout = getNoThemeStaticLayout(); - canvas.translate((getWidth() - textLayout.getWidth()) * 0.5f, AndroidUtilities.dp(18)); - textLayout.draw(canvas); - canvas.restore(); - } else { - if (chatThemeItem.previewDrawable != null) { - canvas.save(); - canvas.clipPath(clipPath); - if (chatThemeItem.previewDrawable instanceof BitmapDrawable) { - int drawableW = chatThemeItem.previewDrawable.getIntrinsicWidth(); - int drawableH = chatThemeItem.previewDrawable.getIntrinsicHeight(); - if (drawableW / (float) drawableH > getWidth() / (float) getHeight()) { - int w = (int) (getWidth() * (float) drawableH / drawableW); - int padding = (w - getWidth()) / 2; - chatThemeItem.previewDrawable.setBounds(padding, 0, padding + w , getHeight()); - } else { - int h = (int) (getHeight() * (float) drawableH / drawableW); - int padding = (getHeight() - h) / 2; - chatThemeItem.previewDrawable.setBounds(0, padding, getWidth(), padding + h); - } - } else { - chatThemeItem.previewDrawable.setBounds(0, 0, getWidth(), getHeight()); - } - chatThemeItem.previewDrawable.draw(canvas); - canvas.restore(); - } else { - canvas.drawRoundRect(rectF, INNER_RADIUS, INNER_RADIUS, backgroundFillPaint); - } - 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.6f; - float bubbleRight = getMeasuredWidth() - getMeasuredWidth() * 0.1f; - float bubbleBottom = getMeasuredHeight() * 0.32f; - rectF.set(bubbleLeft, bubbleTop, bubbleRight, bubbleBottom); - } - canvas.drawRoundRect(rectF, rectF.height() * 0.5f, rectF.height() * 0.5f, outBubblePaintFirst); - canvas.drawRoundRect(rectF, rectF.height() * 0.5f, rectF.height() * 0.5f, outBubblePaintSecond); - - 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.6f; - float bubbleBottom = getMeasuredHeight() * 0.55f; - rectF.set(bubbleLeft, bubbleTop, bubbleRight, bubbleBottom); - } - - canvas.drawRoundRect(rectF, rectF.height() * 0.5f, rectF.height() * 0.5f, inBubblePaint); - } - super.dispatchDraw(canvas); - } - - int lastThemeIndex; - public void setItem(ChatThemeItem item) { - boolean itemChanged = chatThemeItem != item; - boolean darkModeChanged = lastThemeIndex != item.themeIndex; - lastThemeIndex = item.themeIndex; - this.chatThemeItem = item; - hasAnimatedEmoji = false; - TLRPC.Document document = null; - if (item.chatTheme.getEmoticon() != null) { - document = MediaDataController.getInstance(currentAccount).getEmojiAnimatedSticker(item.chatTheme.getEmoticon()); - } - if (itemChanged) { - if (animationCancelRunnable != null) { - AndroidUtilities.cancelRunOnUIThread(animationCancelRunnable); - animationCancelRunnable = null; - } - backupImageView.animate().cancel(); - backupImageView.setScaleX(1f); - backupImageView.setScaleY(1f); - } - if (itemChanged) { - Drawable thumb = null; - if (document != null) { - thumb = DocumentObject.getSvgThumb(document, Theme.key_emptyListPlaceholder, 0.2f); - } - if (thumb == null) { - thumb = Emoji.getEmojiDrawable(item.chatTheme.getEmoticon()); - } - backupImageView.setImage(ImageLocation.getForDocument(document), "50_50", thumb, null); - } - - if (itemChanged || darkModeChanged) { - updatePreviewBackground(); - TLRPC.TL_theme theme = item.chatTheme.getTlTheme(lastThemeIndex); - if (theme != null) { - final long themeId = theme.id; - TLRPC.WallPaper wallPaper = item.chatTheme.getWallpaper(lastThemeIndex); - if (wallPaper != null) { - final int intensity = wallPaper.settings.intensity; - int index = item.chatTheme.getSettingsIndex(lastThemeIndex); - item.chatTheme.loadWallpaperThumb(lastThemeIndex, result -> { - if (result != null && result.first == themeId) { - if (item.previewDrawable instanceof MotionBackgroundDrawable) { - MotionBackgroundDrawable motionBackgroundDrawable = (MotionBackgroundDrawable) item.previewDrawable; - motionBackgroundDrawable.setPatternBitmap(intensity >= 0 ? 100 : -100, result.second); - motionBackgroundDrawable.setPatternColorFilter(patternColor); - } - invalidate(); - } - }); - } - } - } - } - - @Override - public void setSelected(boolean selected) { - super.setSelected(selected); - if (chatThemeItem.isSelected != selected) { - if (strokeAlphaAnimator != null) { - strokeAlphaAnimator.cancel(); - } - if (selected) { - strokePaint.setAlpha(0); - } - strokeAlphaAnimator = ValueAnimator.ofInt(selected ? 0 : 255, selected ? 255 : 0); - strokeAlphaAnimator.addUpdateListener(this); - strokeAlphaAnimator.addListener(this); - strokeAlphaAnimator.setDuration(350); - strokeAlphaAnimator.start(); - } - chatThemeItem.isSelected = selected; - } - - @Override - public void setBackgroundColor(int color) { - backgroundFillPaint.setColor(getThemedColor(Theme.key_dialogBackgroundGray)); - if (noThemeTextPaint != null) { - noThemeTextPaint.setColor(getThemedColor(Theme.key_chat_emojiPanelTrendingDescription)); - } - invalidate(); - } - - private void fillOutBubblePaint(Paint paint, List messageColors) { - if (messageColors.size() > 1) { - int[] colors = new int[messageColors.size()]; - for (int i = 0; i != messageColors.size(); ++i) { - colors[i] = messageColors.get(i); - } - float top = INNER_RECT_SPACE + AndroidUtilities.dp(8); - paint.setShader(new LinearGradient(0f, top, 0f, top + BUBBLE_HEIGHT, colors, null, Shader.TileMode.CLAMP)); - } else { - paint.setShader(null); - } - } - - public void updatePreviewBackground() { - if (chatThemeItem == null || chatThemeItem.chatTheme == null) { - return; - } - EmojiThemes.ThemeItem themeItem = chatThemeItem.chatTheme.getThemeItem(chatThemeItem.themeIndex); - int color = themeItem.inBubbleColor; - inBubblePaint.setColor(color); - color = themeItem.outBubbleColor; - outBubblePaintSecond.setColor(color); - - int strokeColor = chatThemeItem.chatTheme.showAsDefaultStub - ? getThemedColor(Theme.key_featuredStickers_addButton) - : themeItem.outLineColor; - int strokeAlpha = strokePaint.getAlpha(); - strokePaint.setColor(strokeColor); - strokePaint.setAlpha(strokeAlpha); - - - TLRPC.TL_theme tlTheme = chatThemeItem.chatTheme.getTlTheme(chatThemeItem.themeIndex); - - if (tlTheme != null) { - int index = chatThemeItem.chatTheme.getSettingsIndex(chatThemeItem.themeIndex); - TLRPC.ThemeSettings themeSettings = tlTheme.settings.get(index); - fillOutBubblePaint(outBubblePaintSecond, themeSettings.message_colors); - - outBubblePaintSecond.setAlpha(255); - getPreviewDrawable(tlTheme, index); - } else { - EmojiThemes.ThemeItem item = chatThemeItem.chatTheme.getThemeItem(chatThemeItem.themeIndex); - getPreviewDrawable(item); - } - - - invalidate(); - } - - private Drawable getPreviewDrawable(TLRPC.TL_theme theme, int settingsIndex) { - if (chatThemeItem == null) { - return null; - } - - int color1 = 0; - int color2 = 0; - int color3 = 0; - int color4 = 0; - - Drawable drawable; - if (settingsIndex >= 0) { - TLRPC.ThemeSettings themeSettings = theme.settings.get(settingsIndex); - TLRPC.WallPaperSettings wallPaperSettings = themeSettings.wallpaper.settings; - color1 = wallPaperSettings.background_color; - color2 = wallPaperSettings.second_background_color; - color3 = wallPaperSettings.third_background_color; - color4 = wallPaperSettings.fourth_background_color; - } - if (color2 != 0) { - MotionBackgroundDrawable motionBackgroundDrawable = new MotionBackgroundDrawable(color1, color2, color3, color4, true); - patternColor = motionBackgroundDrawable.getPatternColor(); - drawable = motionBackgroundDrawable; - } else { - drawable = new MotionBackgroundDrawable(color1, color1, color1, color1, true); - patternColor = Color.BLACK; - } - chatThemeItem.previewDrawable = drawable; - - return drawable; - } - - private Drawable getPreviewDrawable(EmojiThemes.ThemeItem item) { - if (chatThemeItem == null) { - return null; - } - Drawable drawable = null; - - int color1 = item.patternBgColor; - int color2 = item.patternBgGradientColor1; - int color3 = item.patternBgGradientColor2; - int color4 = item.patternBgGradientColor3; - - if (item.themeInfo.getAccent(false) != null) { - if (color2 != 0) { - MotionBackgroundDrawable motionBackgroundDrawable = new MotionBackgroundDrawable(color1, color2, color3, color4, true); - patternColor = motionBackgroundDrawable.getPatternColor(); - drawable = motionBackgroundDrawable; - } else { - drawable = new MotionBackgroundDrawable(color1, color1, color1, color1, true); - patternColor = Color.BLACK; - } - } else { - if (color1 != 0 && color2 != 0) { - drawable = new MotionBackgroundDrawable(color1, color2, color3, color4, true); - } 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); - if (wallpaper != null) { - drawable = new BitmapDrawable(wallpaper); - } - } else { - drawable = new MotionBackgroundDrawable(0xffdbddbb, 0xff6ba587, 0xffd5d88d, 0xff88b884, true); - } - } - - chatThemeItem.previewDrawable = drawable; - - return drawable; - } - - private StaticLayout getNoThemeStaticLayout() { - if (textLayout != null) { - return textLayout; - } - noThemeTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG + TextPaint.SUBPIXEL_TEXT_FLAG); - noThemeTextPaint.setColor(getThemedColor(Theme.key_chat_emojiPanelTrendingDescription)); - noThemeTextPaint.setTextSize(AndroidUtilities.dp(14)); - noThemeTextPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); - textLayout = StaticLayoutEx.createStaticLayout2( - LocaleController.getString("ChatNoTheme", R.string.ChatNoTheme), - noThemeTextPaint, - AndroidUtilities.dp(52), - Layout.Alignment.ALIGN_CENTER, - 1f, 0f, true, - TextUtils.TruncateAt.END, AndroidUtilities.dp(52), 3 - ); - return textLayout; - } - - private int getThemedColor(String key) { - Integer color = resourcesProvider != null ? resourcesProvider.getColor(key) : null; - return color != null ? color : Theme.getColor(key); - } - - @Override - public void onAnimationUpdate(ValueAnimator valueAnimator) { - EmojiThemes.ThemeItem themeItem = chatThemeItem.chatTheme.getThemeItem(chatThemeItem.themeIndex); - int strokeColor = chatThemeItem.chatTheme.showAsDefaultStub - ? getThemedColor(Theme.key_featuredStickers_addButton) - : themeItem.outLineColor; - strokePaint.setColor(strokeColor); - strokePaint.setAlpha((int) valueAnimator.getAnimatedValue()); - invalidate(); - } - - @Override - public void onAnimationEnd(Animator animator) { - strokeAlphaAnimator = null; - invalidate(); - } - - @Override - public void onAnimationCancel(Animator animator) { - strokeAlphaAnimator = null; - invalidate(); - } - - @Override - public void onAnimationStart(Animator animator) { - } - - @Override - public void onAnimationRepeat(Animator animator) { - } - - public void playEmojiAnimation() { - if (backupImageView.getImageReceiver().getLottieAnimation() != null) { - AndroidUtilities.cancelRunOnUIThread(animationCancelRunnable); - backupImageView.setVisibility(View.VISIBLE); - backupImageView.getImageReceiver().getLottieAnimation().setCurrentFrame(0, false); - backupImageView.getImageReceiver().getLottieAnimation().start(); - backupImageView.animate().scaleX(2f).scaleY(2f).setDuration(300).setInterpolator(AndroidUtilities.overshootInterpolator).start(); - - AndroidUtilities.runOnUIThread(animationCancelRunnable = () -> { - animationCancelRunnable = null; - backupImageView.animate().scaleX(1f).scaleY(1f).setDuration(150).setInterpolator(CubicBezierInterpolator.DEFAULT).start(); - }, 2500); - } - } - - public void cancelAnimation() { - if (animationCancelRunnable != null) { - AndroidUtilities.cancelRunOnUIThread(animationCancelRunnable); - animationCancelRunnable.run(); - } - } - } } public static class ChatThemeItem { @@ -1334,54 +894,4 @@ public class ChatThemeBottomSheet extends BottomSheet implements NotificationCen super.show(); resetTextView.setText(themeDelegate.getCurrentTheme() == null ? LocaleController.getString("DoNoSetTheme", R.string.DoNoSetTheme) : LocaleController.getString("ChatResetTheme", R.string.ChatResetTheme)); } - - 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; - } } 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 45166cf92..0262166b1 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/EditTextBoldCursor.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/EditTextBoldCursor.java @@ -119,7 +119,7 @@ public class EditTextBoldCursor extends EditText { private ViewTreeObserver.OnPreDrawListener listenerFixer; private FloatingToolbar floatingToolbar; - private FloatingActionMode floatingActionMode; + public FloatingActionMode floatingActionMode; private ViewTreeObserver.OnPreDrawListener floatingToolbarPreDrawListener; private View windowView; private View attachedToWindow; 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 4989d8740..b739436ed 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/FlickerLoadingView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/FlickerLoadingView.java @@ -531,7 +531,9 @@ public class FlickerLoadingView extends View { } matrix.setTranslate(parentXOffset, totalTranslation); } - gradient.setLocalMatrix(matrix); + if (gradient != null) { + gradient.setLocalMatrix(matrix); + } } public void updateColors() { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/HintView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/HintView.java index 53782c916..ee444e4c1 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/HintView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/HintView.java @@ -30,6 +30,7 @@ import org.telegram.ui.Cells.ChatMessageCell; public class HintView extends FrameLayout { public static final int TYPE_SEARCH_AS_LIST = 3; + public static final int TYPE_COMMON = 4; public static final int TYPE_POLL_VOTE = 5; private TextView textView; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/InstantCameraView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/InstantCameraView.java index 76c57fca1..13ceb10ea 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/InstantCameraView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/InstantCameraView.java @@ -2609,7 +2609,9 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter if (zoom > 0f) { finishZoomTransition = ValueAnimator.ofFloat(zoom, 0); finishZoomTransition.addUpdateListener(valueAnimator -> { - cameraSession.setZoom((float) valueAnimator.getAnimatedValue()); + if (cameraSession != null) { + cameraSession.setZoom((float) valueAnimator.getAnimatedValue()); + } }); finishZoomTransition.addListener(new AnimatorListenerAdapter() { @Override diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/LinkPath.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/LinkPath.java index af712e469..28263bfdc 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/LinkPath.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/LinkPath.java @@ -11,13 +11,14 @@ package org.telegram.ui.Components; import android.graphics.Path; import android.graphics.RectF; import android.os.Build; +import android.text.Layout; import android.text.StaticLayout; import org.telegram.messenger.AndroidUtilities; public class LinkPath extends Path { - private StaticLayout currentLayout; + private Layout currentLayout; private int currentLine; private float lastTop = -1; private float heightOffset; @@ -36,7 +37,7 @@ public class LinkPath extends Path { useRoundRect = roundRect; } - public void setCurrentLayout(StaticLayout layout, int start, float yOffset) { + public void setCurrentLayout(Layout layout, int start, float yOffset) { currentLayout = layout; currentLine = layout.getLineForOffset(start); lastTop = -1; 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 e3daf838c..2968b7cf8 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/MediaActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/MediaActivity.java @@ -213,7 +213,7 @@ public class MediaActivity extends BaseFragment implements SharedMediaLayout.Sha } }; - + sharedMediaLayout.setPinnedToTop(true); sharedMediaLayout.getSearchItem().setTranslationY(0); sharedMediaLayout.photoVideoOptionsItem.setTranslationY(0); 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 38b79abfe..03da6b631 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/MotionBackgroundDrawable.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/MotionBackgroundDrawable.java @@ -18,6 +18,7 @@ import android.graphics.Rect; import android.graphics.RectF; import android.graphics.Shader; import android.graphics.drawable.Drawable; +import android.graphics.drawable.GradientDrawable; import android.os.Build; import android.os.SystemClock; import android.view.View; @@ -83,6 +84,7 @@ public class MotionBackgroundDrawable extends Drawable { private Bitmap legacyBitmap; private Canvas legacyCanvas2; private Bitmap legacyBitmap2; + private GradientDrawable gradientDrawable = new GradientDrawable(); private boolean invalidateLegacy; private boolean rotationBack; @@ -107,12 +109,13 @@ public class MotionBackgroundDrawable extends Drawable { } public MotionBackgroundDrawable(int c1, int c2, int c3, int c4, boolean preview) { + this(c1, c2, c3 ,c4, 0, preview); + } + + public MotionBackgroundDrawable(int c1, int c2, int c3, int c4, int rotation, boolean preview) { super(); - colors[0] = c1; - colors[1] = c2; - colors[2] = c3; - colors[3] = c4; isPreview = preview; + setColors(c1, c2, c3, c4, rotation, false); init(); } @@ -298,7 +301,7 @@ public class MotionBackgroundDrawable extends Drawable { } public void setColors(int c1, int c2, int c3, int c4) { - setColors(c1, c2, c3, c4, true); + setColors(c1, c2, c3, c4, 0, true); } public void setColors(int c1, int c2, int c3, int c4, Bitmap bitmap) { @@ -309,14 +312,21 @@ public class MotionBackgroundDrawable extends Drawable { Utilities.generateGradient(bitmap, true, phase, interpolator.getInterpolation(posAnimationProgress), currentBitmap.getWidth(), currentBitmap.getHeight(), currentBitmap.getRowBytes(), colors); } - public void setColors(int c1, int c2, int c3, int c4, boolean invalidate) { + public void setColors(int c1, int c2, int c3, int c4, int rotation, boolean invalidate) { + if (isPreview && c3 == 0 && c4 == 0) { + gradientDrawable = new GradientDrawable(BackgroundGradientDrawable.getGradientOrientation(rotation), new int[]{c1, c2}); + } else { + gradientDrawable = null; + } colors[0] = c1; colors[1] = c2; colors[2] = c3; colors[3] = c4; - Utilities.generateGradient(currentBitmap, true, phase, interpolator.getInterpolation(posAnimationProgress), currentBitmap.getWidth(), currentBitmap.getHeight(), currentBitmap.getRowBytes(), colors); - if (invalidate) { - invalidateParent(); + if (currentBitmap != null) { + Utilities.generateGradient(currentBitmap, true, phase, interpolator.getInterpolation(posAnimationProgress), currentBitmap.getWidth(), currentBitmap.getHeight(), currentBitmap.getRowBytes(), colors); + if (invalidate) { + invalidateParent(); + } } } @@ -573,8 +583,13 @@ public class MotionBackgroundDrawable extends Drawable { canvas.drawRoundRect(rect, roundRadius, roundRadius, paint); } else { canvas.translate(0, tr); - rect.set(x, y, x + width, y + height); - canvas.drawBitmap(currentBitmap, null, rect, paint); + if (gradientDrawable != null) { + gradientDrawable.setBounds((int) x, (int) y, (int) (x + width), (int) (y + height)); + gradientDrawable.draw(canvas); + } else { + rect.set(x, y, x + width, y + height); + canvas.drawBitmap(currentBitmap, null, rect, paint); + } } if (patternBitmap != null) { @@ -723,4 +738,8 @@ public class MotionBackgroundDrawable extends Drawable { public int getOpacity() { return PixelFormat.TRANSPARENT; } + + public boolean isOneColor() { + return colors[0] == colors[1] && colors[0] == colors[2] && colors[0] == colors[3]; + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/NumberTextView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/NumberTextView.java index 15105be3a..358316546 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/NumberTextView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/NumberTextView.java @@ -40,16 +40,25 @@ public class NumberTextView extends View { private float textWidth; private float oldTextWidth; + private OnTextWidthProgressChangedListener onTextWidthProgressChangedListener; + public NumberTextView(Context context) { super(context); } + public void setOnTextWidthProgressChangedListener(OnTextWidthProgressChangedListener onTextWidthProgressChangedListener) { + this.onTextWidthProgressChangedListener = onTextWidthProgressChangedListener; + } + @Keep public void setProgress(float value) { if (progress == value) { return; } progress = value; + if (onTextWidthProgressChangedListener != null) { + onTextWidthProgressChangedListener.onTextWidthProgress(oldTextWidth, textWidth, progress); + } invalidate(); } @@ -86,9 +95,9 @@ public class NumberTextView extends View { forwardAnimation = number > currentNumber; } boolean replace = false; + textWidth = textPaint.measureText(text); + oldTextWidth = textPaint.measureText(oldText); if (center) { - textWidth = textPaint.measureText(text); - oldTextWidth = textPaint.measureText(oldText); if (textWidth != oldTextWidth) { replace = true; } @@ -121,6 +130,8 @@ public class NumberTextView extends View { } }); animator.start(); + } else if (onTextWidthProgressChangedListener != null) { + onTextWidthProgressChangedListener.onTextWidthProgress(oldTextWidth, textWidth, progress); } invalidate(); } @@ -213,4 +224,22 @@ public class NumberTextView extends View { } canvas.restore(); } + + public float getOldTextWidth() { + return oldTextWidth; + } + + public float getTextWidth() { + return textWidth; + } + + public interface OnTextWidthProgressChangedListener { + /** + * Notifies layout that text width has changed + * @param fromWidth Old text width value + * @param toWidth New text width value + * @param progress Progress for the animation + */ + void onTextWidthProgress(float fromWidth, float toWidth, float progress); + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/RLottieDrawable.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/RLottieDrawable.java index 326b89d7b..ae313783d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/RLottieDrawable.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/RLottieDrawable.java @@ -42,7 +42,7 @@ import java.util.concurrent.TimeUnit; public class RLottieDrawable extends BitmapDrawable implements Animatable { - public static native long create(String src, String json, int w, int h, int[] params, boolean precache, int[] colorReplacement, boolean limitFps); + public static native long create(String src, String json, int w, int h, int[] params, boolean precache, int[] colorReplacement, boolean limitFps, int fitzModifier); protected static native long createWithJson(String json, String name, int[] params, int[] colorReplacement); public static native void destroy(long ptr); private static native void setLayerColor(long ptr, String layer, int color); @@ -355,16 +355,16 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable { }; public RLottieDrawable(File file, int w, int h, boolean precache, boolean limitFps) { - this(file, w, h, precache, limitFps, null); + this(file, w, h, precache, limitFps, null, 0); } - public RLottieDrawable(File file, int w, int h, boolean precache, boolean limitFps, int[] colorReplacement) { + public RLottieDrawable(File file, int w, int h, boolean precache, boolean limitFps, int[] colorReplacement, int fitzModifier) { width = w; height = h; shouldLimitFps = limitFps; getPaint().setFlags(Paint.FILTER_BITMAP_FLAG); - nativePtr = create(file.getAbsolutePath(), null, w, h, metaData, precache, colorReplacement, shouldLimitFps); + nativePtr = create(file.getAbsolutePath(), null, w, h, metaData, precache, colorReplacement, shouldLimitFps, fitzModifier); if (precache && lottieCacheGenerateQueue == null) { lottieCacheGenerateQueue = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>()); } @@ -377,13 +377,13 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable { timeBetweenFrames = Math.max(shouldLimitFps ? 33 : 16, (int) (1000.0f / metaData[1])); } - public RLottieDrawable(File file, String json, int w, int h, boolean precache, boolean limitFps, int[] colorReplacement) { + public RLottieDrawable(File file, String json, int w, int h, boolean precache, boolean limitFps, int[] colorReplacement, int fitzModifier) { width = w; height = h; shouldLimitFps = limitFps; getPaint().setFlags(Paint.FILTER_BITMAP_FLAG); - nativePtr = create(file.getAbsolutePath(), json, w, h, metaData, precache, colorReplacement, shouldLimitFps); + nativePtr = create(file.getAbsolutePath(), json, w, h, metaData, precache, colorReplacement, shouldLimitFps, fitzModifier); if (precache && lottieCacheGenerateQueue == null) { lottieCacheGenerateQueue = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>()); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/RecyclerItemsEnterAnimator.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/RecyclerItemsEnterAnimator.java index e97242d51..421ec1194 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/RecyclerItemsEnterAnimator.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/RecyclerItemsEnterAnimator.java @@ -21,6 +21,7 @@ public class RecyclerItemsEnterAnimator { HashSet ignoreView = new HashSet<>(); boolean invalidateAlpha; boolean alwaysCheckItemsAlpha; + public boolean animateAlphaProgressView = true; ArrayList currentAnimations = new ArrayList<>(); ArrayList preDrawListeners = new ArrayList<>(); @@ -28,6 +29,7 @@ public class RecyclerItemsEnterAnimator { public RecyclerItemsEnterAnimator(RecyclerListView listView, boolean alwaysCheckItemsAlpha) { this.listView = listView; this.alwaysCheckItemsAlpha = alwaysCheckItemsAlpha; + listView.setItemsEnterAnimator(this); } public void dispatchDraw() { @@ -49,22 +51,19 @@ public class RecyclerItemsEnterAnimator { } public void showItemsAnimated(int from) { - int n = listView.getChildCount(); - View progressView = null; - for (int i = 0; i < n; i++) { - View child = listView.getChildAt(i); - if (listView.getChildAdapterPosition(child) >= 0 && child instanceof FlickerLoadingView) { - progressView = child; - } - } - final View finalProgressView = progressView; + final View finalProgressView = getProgressView(); RecyclerView.LayoutManager layoutManager = listView.getLayoutManager(); - if (progressView != null && layoutManager != null) { - listView.removeView(progressView); + if (finalProgressView != null && layoutManager != null) { + listView.removeView(finalProgressView); ignoreView.add(finalProgressView); listView.addView(finalProgressView); layoutManager.ignoreView(finalProgressView); - Animator animator = ObjectAnimator.ofFloat(finalProgressView, View.ALPHA, finalProgressView.getAlpha(), 0); + Animator animator; + if (animateAlphaProgressView) { + animator = ObjectAnimator.ofFloat(finalProgressView, View.ALPHA, finalProgressView.getAlpha(), 0f); + } else { + animator = ValueAnimator.ofFloat(0f, 1f); + } animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { @@ -135,6 +134,18 @@ public class RecyclerItemsEnterAnimator { listView.getViewTreeObserver().addOnPreDrawListener(preDrawListener); } + public View getProgressView() { + View progressView = null; + int n = listView.getChildCount(); + for (int i = 0; i < n; i++) { + View child = listView.getChildAt(i); + if (listView.getChildAdapterPosition(child) >= 0 && child instanceof FlickerLoadingView) { + progressView = child; + } + } + return progressView; + } + public void onDetached() { cancel(); } 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 34eb7dd1d..359095900 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/RecyclerListView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/RecyclerListView.java @@ -144,6 +144,7 @@ public class RecyclerListView extends RecyclerView { float lastY = Float.MAX_VALUE; int[] listPaddings; HashSet selectedPositions; + RecyclerItemsEnterAnimator itemsEnterAnimator; protected final Theme.ResourcesProvider resourcesProvider; @@ -367,6 +368,7 @@ public class RecyclerListView extends RecyclerView { private TextPaint letterPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); private String currentLetter; private Path path = new Path(); + private Path arrowPath = new Path(); private float[] radii = new float[8]; private float textX; private float textY; @@ -381,7 +383,7 @@ public class RecyclerListView extends RecyclerView { private int[] positionWithOffset = new int[2]; boolean isVisible; float touchSlop; - + Drawable fastScrollShadowDrawable; Drawable fastScrollBackgroundDrawable; Runnable hideFloatingDateRunnable = new Runnable() { @@ -407,7 +409,7 @@ public class RecyclerListView extends RecyclerView { letterPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); paint2.setColor(Theme.getColor(Theme.key_windowBackgroundWhite)); fastScrollBackgroundDrawable = ContextCompat.getDrawable(context, R.drawable.calendar_date).mutate(); - fastScrollBackgroundDrawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhite), PorterDuff.Mode.MULTIPLY)); + fastScrollBackgroundDrawable.setColorFilter(new PorterDuffColorFilter(ColorUtils.blendARGB(Theme.getColor(Theme.key_windowBackgroundWhite), Color.WHITE, 0.1f), PorterDuff.Mode.MULTIPLY)); } for (int a = 0; a < 8; a++) { radii[a] = AndroidUtilities.dp(44); @@ -418,6 +420,7 @@ public class RecyclerListView extends RecyclerView { setFocusableInTouchMode(true); ViewConfiguration vc = ViewConfiguration.get(context); touchSlop = vc.getScaledTouchSlop(); + fastScrollShadowDrawable = ContextCompat.getDrawable(context, R.drawable.fast_scroll_shadow); } private void updateColors() { @@ -436,6 +439,8 @@ public class RecyclerListView extends RecyclerView { float startY; boolean isMoving; long startTime; + float visibilityAlpha; + float viewAlpha; @Override public boolean onTouchEvent(MotionEvent event) { @@ -451,6 +456,11 @@ public class RecyclerListView extends RecyclerView { if (LocaleController.isRTL && x > AndroidUtilities.dp(25) || !LocaleController.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)) { + return false; + } + } startDy = lastY - currentY; startTime = System.currentTimeMillis(); pressed = true; @@ -558,14 +568,42 @@ public class RecyclerListView extends RecyclerView { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { setMeasuredDimension(AndroidUtilities.dp(type == LETTER_TYPE ? 132 : 240), MeasureSpec.getSize(heightMeasureSpec)); + + arrowPath.reset(); + arrowPath.setLastPoint(0, 0); + arrowPath.lineTo(AndroidUtilities.dp(4), -AndroidUtilities.dp(4)); + arrowPath.lineTo(-AndroidUtilities.dp(4), -AndroidUtilities.dp(4)); + arrowPath.close(); + } @Override protected void onDraw(Canvas canvas) { - paint.setColor(ColorUtils.blendARGB(inactiveColor, activeColor, bubbleProgress)); int y = (int) Math.ceil((getMeasuredHeight() - AndroidUtilities.dp(24 + 30)) * progress); rect.set(scrollX, AndroidUtilities.dp(12) + y, scrollX + AndroidUtilities.dp(5), AndroidUtilities.dp(12 + 30) + y); - canvas.drawRoundRect(rect, AndroidUtilities.dp(2), AndroidUtilities.dp(2), paint); + if (type == LETTER_TYPE) { + paint.setColor(ColorUtils.blendARGB(inactiveColor, activeColor, bubbleProgress)); + canvas.drawRoundRect(rect, AndroidUtilities.dp(2), AndroidUtilities.dp(2), paint); + } else { + paint.setColor(ColorUtils.blendARGB(Theme.getColor(Theme.key_windowBackgroundWhite), Color.WHITE, 0.1f)); + + float cy = y + AndroidUtilities.dp(12 + 15); + fastScrollShadowDrawable.setBounds(getMeasuredWidth() - fastScrollShadowDrawable.getIntrinsicWidth(), (int) (cy - fastScrollShadowDrawable.getIntrinsicHeight() / 2), getMeasuredWidth(), (int) (cy + fastScrollShadowDrawable.getIntrinsicHeight() / 2)); + fastScrollShadowDrawable.draw(canvas); + canvas.drawCircle(scrollX + AndroidUtilities.dp(8), y + AndroidUtilities.dp(12 + 15), AndroidUtilities.dp(24), paint); + + paint.setColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); + canvas.save(); + canvas.translate(scrollX + AndroidUtilities.dp(4), y + AndroidUtilities.dp(12 + 15 + 2 + 5) + AndroidUtilities.dp(2) * bubbleProgress); + canvas.drawPath(arrowPath, paint); + canvas.restore(); + + canvas.save(); + canvas.translate(scrollX + AndroidUtilities.dp(4), y + AndroidUtilities.dp(12 + 15 + 2 - 5) - AndroidUtilities.dp(2) * bubbleProgress); + canvas.rotate(180, 0, -AndroidUtilities.dp(2)); + canvas.drawPath(arrowPath, paint); + canvas.restore(); + } if (type == LETTER_TYPE) { if ((isMoving || bubbleProgress != 0)) { paint.setAlpha((int) (255 * bubbleProgress)); @@ -617,7 +655,7 @@ public class RecyclerListView extends RecyclerView { canvas.scale(s, s, rect.right - AndroidUtilities.dp(12), rect.centerY()); float cy = rect.centerY(); - float x = rect.left - AndroidUtilities.dp(30) * bubbleProgress; + 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)); @@ -626,6 +664,7 @@ public class RecyclerListView extends RecyclerView { 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); @@ -702,12 +741,35 @@ public class RecyclerListView extends RecyclerView { invalidate(); } AndroidUtilities.cancelRunOnUIThread(hideFloatingDateRunnable); - AndroidUtilities.runOnUIThread(hideFloatingDateRunnable, 4000); + AndroidUtilities.runOnUIThread(hideFloatingDateRunnable, 2000); } public void setIsVisible(boolean visible) { - this.isVisible = visible; - setAlpha(visible ? 1f : 0f); + if (isVisible != visible) { + this.isVisible = visible; + visibilityAlpha = visible ? 1f : 0f; + super.setAlpha(viewAlpha * visibilityAlpha); + } + } + + public void setVisibilityAlpha(float v) { + if (visibilityAlpha != v) { + visibilityAlpha = v; + super.setAlpha(viewAlpha * visibilityAlpha); + } + } + + @Override + public void setAlpha(float alpha) { + if (viewAlpha != alpha) { + viewAlpha = alpha; + super.setAlpha(viewAlpha * visibilityAlpha); + } + } + + @Override + public float getAlpha() { + return viewAlpha; } public int getScrollBarY() { @@ -717,6 +779,7 @@ public class RecyclerListView extends RecyclerView { public float getProgress() { return progress; } + } private class RecyclerListViewItemClickListener implements OnItemTouchListener { @@ -1963,6 +2026,10 @@ public class RecyclerListView extends RecyclerView { @Override protected void dispatchDraw(Canvas canvas) { + if (itemsEnterAnimator != null) { + itemsEnterAnimator.dispatchDraw(); + } + if (drawSelectorBehind && !selectorRect.isEmpty()) { selectorDrawable.setBounds(selectorRect); selectorDrawable.draw(canvas); @@ -2026,6 +2093,9 @@ public class RecyclerListView extends RecyclerView { super.onDetachedFromWindow(); selectorPosition = NO_POSITION; selectorRect.setEmpty(); + if (itemsEnterAnimator != null) { + itemsEnterAnimator.onDetached(); + } } public void addOverlayView(View view, FrameLayout.LayoutParams layoutParams) { @@ -2308,4 +2378,8 @@ public class RecyclerListView extends RecyclerView { void getPaddings(int paddings[]); void scrollBy(int dy); } + + public void setItemsEnterAnimator(RecyclerItemsEnterAnimator itemsEnterAnimator) { + this.itemsEnterAnimator = itemsEnterAnimator; + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/SearchViewPager.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/SearchViewPager.java index 73a3176b5..53ffe2e8a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/SearchViewPager.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/SearchViewPager.java @@ -104,19 +104,7 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie } }; - searchListView = new RecyclerListView(context) { - @Override - protected void dispatchDraw(Canvas canvas) { - itemsEnterAnimator.dispatchDraw(); - super.dispatchDraw(canvas); - } - - @Override - protected void onDetachedFromWindow() { - super.onDetachedFromWindow(); - itemsEnterAnimator.onDetached(); - } - }; + searchListView = new RecyclerListView(context); searchListView.setPivotY(0); searchListView.setAdapter(dialogsSearchAdapter); searchListView.setVerticalScrollBarEnabled(true); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/SenderSelectView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/SenderSelectView.java new file mode 100644 index 000000000..0d5c0a67d --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/SenderSelectView.java @@ -0,0 +1,161 @@ +package org.telegram.ui.Components; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.RectF; +import android.graphics.drawable.Drawable; +import android.util.AttributeSet; +import android.view.View; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.ImageReceiver; +import org.telegram.tgnet.TLObject; +import org.telegram.ui.ActionBar.MenuDrawable; +import org.telegram.ui.ActionBar.Theme; + +public class SenderSelectView extends View { + private ImageReceiver avatarImage = new ImageReceiver(this); + private AvatarDrawable avatarDrawable = new AvatarDrawable(); + private MenuDrawable menuDrawable = new MenuDrawable() { + @Override + public void invalidateSelf() { + super.invalidateSelf(); + invalidate(); + } + }; + private Drawable selectorDrawable; + private Paint backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private RectF mTempRect = new RectF(); + + public SenderSelectView(Context context) { + super(context); + } + + public SenderSelectView(Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + } + + public SenderSelectView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + { + avatarImage.setRoundRadius(AndroidUtilities.dp(28)); + menuDrawable.setMiniIcon(true); + menuDrawable.setRotateToBack(false); + menuDrawable.setRotation(0f, false); + menuDrawable.setRoundCap(); + menuDrawable.setCallback(this); + updateColors(); + } + + /** + * Updates theme colors + */ + private void updateColors() { + backgroundPaint.setColor(Theme.getColor(Theme.key_chat_messagePanelVoiceBackground)); + int textColor = Theme.getColor(Theme.key_chat_messagePanelVoicePressed); + menuDrawable.setBackColor(textColor); + menuDrawable.setIconColor(textColor); + selectorDrawable = Theme.createSimpleSelectorRoundRectDrawable(AndroidUtilities.dp(16), Color.TRANSPARENT, Theme.getColor(Theme.key_windowBackgroundWhite)); + selectorDrawable.setCallback(this); + } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + + avatarImage.onAttachedToWindow(); + } + + @Override + protected void onDetachedFromWindow() { + super.onDetachedFromWindow(); + + avatarImage.onDetachedFromWindow(); + } + + @Override + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { + super.onLayout(changed, left, top, right, bottom); + + avatarImage.setImageCoords(0, 0, getWidth(), getHeight()); + } + + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + + avatarImage.draw(canvas); + + int alpha = (int) (menuDrawable.getCurrentRotation() * 0xFF); + backgroundPaint.setAlpha(alpha); + mTempRect.set(0, 0, getWidth(), getHeight()); + canvas.drawRoundRect(mTempRect, AndroidUtilities.dp(16), AndroidUtilities.dp(16), backgroundPaint); + + canvas.save(); + canvas.translate(AndroidUtilities.dp(4), AndroidUtilities.dp(4)); + menuDrawable.setAlpha(alpha); + menuDrawable.setBounds(0, 0, getWidth(), getHeight()); + menuDrawable.draw(canvas); + canvas.restore(); + + selectorDrawable.setBounds(0, 0, getWidth(), getHeight()); + selectorDrawable.draw(canvas); + } + + /** + * Sets new User or Chat to be bound as the avatar + * @param obj User or chat + */ + public void setAvatar(TLObject obj) { + avatarDrawable.setInfo(obj); + avatarImage.setForUserOrChat(obj, avatarDrawable); + } + + /** + * Sets new animation progress + * @param progress New progress + */ + public void setProgress(float progress) { + setProgress(progress, true); + } + + /** + * Sets new animation progress + * @param progress New progress + * @param animate If we should animate + */ + public void setProgress(float progress, boolean animate) { + menuDrawable.setRotation(progress, animate); + } + + /** + * @return Current animation progress + */ + public float getProgress() { + return menuDrawable.getCurrentRotation(); + } + + @Override + protected boolean verifyDrawable(@NonNull Drawable who) { + return super.verifyDrawable(who) || selectorDrawable == who; + } + + @Override + protected void drawableStateChanged() { + super.drawableStateChanged(); + selectorDrawable.setState(getDrawableState()); + } + + @Override + public void jumpDrawablesToCurrentState() { + super.jumpDrawablesToCurrentState(); + selectorDrawable.jumpToCurrentState(); + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ShareAlert.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ShareAlert.java index 4ec672f70..df09d180f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ShareAlert.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ShareAlert.java @@ -962,18 +962,6 @@ public class ShareAlert extends BottomSheet implements NotificationCenter.Notifi searchGridView = new RecyclerListView(context, resourcesProvider) { - @Override - protected void dispatchDraw(Canvas canvas) { - recyclerItemsEnterAnimator.dispatchDraw(); - super.dispatchDraw(canvas); - } - - @Override - protected void onDetachedFromWindow() { - super.onDetachedFromWindow(); - recyclerItemsEnterAnimator.onDetached(); - } - @Override protected boolean allowSelectChildAtPosition(float x, float y) { return y >= AndroidUtilities.dp(darkTheme && linkToCopy[1] != null ? 111 : 58) + (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/SharedMediaLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/SharedMediaLayout.java index 24c97940e..948477101 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/SharedMediaLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/SharedMediaLayout.java @@ -1,7 +1,6 @@ package org.telegram.ui.Components; import static org.telegram.messenger.MediaDataController.MEDIA_PHOTOVIDEO; -import static org.telegram.messenger.MediaDataController.getMediaType; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -73,6 +72,7 @@ import org.telegram.messenger.MessagesController; import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; import org.telegram.messenger.SharedConfig; +import org.telegram.messenger.UserConfig; import org.telegram.messenger.UserObject; import org.telegram.messenger.Utilities; import org.telegram.messenger.browser.Browser; @@ -107,7 +107,7 @@ import org.telegram.ui.Cells.SharedPhotoVideoCell2; import org.telegram.ui.Cells.UserCell; import org.telegram.ui.ChatActivity; import org.telegram.ui.DialogsActivity; -import org.telegram.ui.MediaCalendarActivity; +import org.telegram.ui.CalendarActivity; import org.telegram.ui.PhotoViewer; import org.telegram.ui.ProfileActivity; @@ -146,6 +146,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter boolean isInPinchToZoomTouchMode; boolean maybePinchToZoomTouchMode; boolean maybePinchToZoomTouchMode2; + boolean isPinnedToTop; private int pointerId1, pointerId2; @@ -310,8 +311,23 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter return sharedMediaData[0].filterType; } + public boolean isPinnedToTop() { + return isPinnedToTop; + } + + public void setPinnedToTop(boolean pinnedToTop) { + if (isPinnedToTop != pinnedToTop) { + isPinnedToTop = pinnedToTop; + for (int i = 0; i < mediaPages.length; i++) { + updateFastScrollVisibility(mediaPages[i], true); + } + } + } + private static class MediaPage extends FrameLayout { public long lastCheckScrollTime; + public boolean fastScrollEnabled; + public ObjectAnimator fastScrollAnimator; private RecyclerListView listView; private RecyclerListView animationSupportingListView; private GridLayoutManager animationSupportingLayoutManager; @@ -363,6 +379,43 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter } } } + + } + + public void updateFastScrollVisibility(MediaPage mediaPage, boolean animated) { + boolean show = mediaPage.fastScrollEnabled && isPinnedToTop; + View view = mediaPage.listView.getFastScroll(); + if (mediaPage.fastScrollAnimator != null) { + mediaPage.fastScrollAnimator.removeAllListeners(); + mediaPage.fastScrollAnimator.cancel(); + } + if (!animated) { + view.animate().setListener(null).cancel(); + view.setVisibility(show ? View.VISIBLE : View.GONE); + view.setTag(show ? 1 : null); + view.setAlpha(1f); + view.setScaleX(1f); + view.setScaleY(1f); + } else if (show && view.getTag() == null) { + view.animate().setListener(null).cancel(); + if (view.getVisibility() != View.VISIBLE) { + view.setVisibility(View.VISIBLE); + view.setAlpha(0f); + } + ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view, View.ALPHA, view.getAlpha(), 1f); + mediaPage.fastScrollAnimator = objectAnimator; + objectAnimator.setDuration(150).start(); + view.setTag(1); + } else if (!show && view.getTag() != null) { + + ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view, View.ALPHA, view.getAlpha(), 0f); + objectAnimator.addListener(new HideViewAfterAnimation(view)); + mediaPage.fastScrollAnimator = objectAnimator; + objectAnimator.setDuration(150).start(); + view.animate().setListener(null).cancel(); + + view.setTag(null); + } } private ActionBar actionBar; @@ -1068,6 +1121,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter private boolean isActionModeShowed; final Delegate delegate; + private HintView fwdRestrictedHint; public SharedMediaLayout(Context context, long did, SharedMediaPreloader preloader, int commonGroupsCount, ArrayList sortedUsers, TLRPC.ChatFull chatInfo, boolean membersFirst, BaseFragment parent, Delegate delegate, int viewType) { super(context); @@ -1423,7 +1477,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter gotoItem.setDuplicateParentStateEnabled(false); actionModeLayout.addView(gotoItem, new LinearLayout.LayoutParams(AndroidUtilities.dp(54), ViewGroup.LayoutParams.MATCH_PARENT)); actionModeViews.add(gotoItem); - gotoItem.setOnClickListener(v -> onActionBarItemClick(gotochat)); + gotoItem.setOnClickListener(v -> onActionBarItemClick(v, gotochat)); forwardItem = new ActionBarMenuItem(context, null, Theme.getColor(Theme.key_actionBarActionModeDefaultSelector), Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2), false); forwardItem.setIcon(R.drawable.msg_forward); @@ -1431,7 +1485,15 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter forwardItem.setDuplicateParentStateEnabled(false); actionModeLayout.addView(forwardItem, new LinearLayout.LayoutParams(AndroidUtilities.dp(54), ViewGroup.LayoutParams.MATCH_PARENT)); actionModeViews.add(forwardItem); - forwardItem.setOnClickListener(v -> onActionBarItemClick(forward)); + forwardItem.setOnClickListener(v -> onActionBarItemClick(v, forward)); + + boolean noforwards = profileActivity.getMessagesController().isChatNoForwards(-dialog_id); + forwardItem.setAlpha(noforwards ? 0.5f : 1f); + if (noforwards) { + if (forwardItem.getBackground() != null) forwardItem.setBackground(null); + } else if (forwardItem.getBackground() == null) { + forwardItem.setBackground(Theme.createSelectorDrawable(Theme.getColor(Theme.key_actionBarActionModeDefaultSelector), 5)); + } } deleteItem = new ActionBarMenuItem(context, null, Theme.getColor(Theme.key_actionBarActionModeDefaultSelector), Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2), false); deleteItem.setIcon(R.drawable.msg_delete); @@ -1439,7 +1501,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter deleteItem.setDuplicateParentStateEnabled(false); actionModeLayout.addView(deleteItem, new LinearLayout.LayoutParams(AndroidUtilities.dp(54), ViewGroup.LayoutParams.MATCH_PARENT)); actionModeViews.add(deleteItem); - deleteItem.setOnClickListener(v -> onActionBarItemClick(delete)); + deleteItem.setOnClickListener(v -> onActionBarItemClick(v, delete)); photoVideoAdapter = new SharedPhotoVideoAdapter(context) { @Override @@ -1668,13 +1730,13 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter } drawingViews.addAll(animationSupportingSortedCells); FastScroll fastScroll = getFastScroll(); - if (fastScroll != null) { + if (fastScroll != null && fastScroll.getTag() != null) { float p1 = photoVideoAdapter.getScrollProgress(mediaPage.listView); float p2 = animationSupportingPhotoVideoAdapter.getScrollProgress(mediaPage.animationSupportingListView); float a1 = photoVideoAdapter.fastScrollIsVisible(mediaPage.listView) ? 1f : 0f; float a2 = animationSupportingPhotoVideoAdapter.fastScrollIsVisible(mediaPage.animationSupportingListView) ? 1f : 0f; fastScroll.setProgress(p1 * (1f - photoVideoChangeColumnsProgress) + p2 * photoVideoChangeColumnsProgress); - fastScroll.setAlpha(a1 * (1f - photoVideoChangeColumnsProgress) + a2 * photoVideoChangeColumnsProgress); + fastScroll.setVisibilityAlpha(a1 * (1f - photoVideoChangeColumnsProgress) + a2 * photoVideoChangeColumnsProgress); } } @@ -1913,6 +1975,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter mediaPages[a].addView(mediaPages[a].animationSupportingListView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); mediaPages[a].animationSupportingListView.setVisibility(View.GONE); + mediaPages[a].listView.addItemDecoration(new RecyclerView.ItemDecoration() { @Override public void getItemOffsets(android.graphics.Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { @@ -2143,6 +2206,10 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter } } + public void setForwardRestrictedHint(HintView hintView) { + fwdRestrictedHint = hintView; + } + private int getMessageId(View child) { if (child instanceof SharedPhotoVideoCell2) { return ((SharedPhotoVideoCell2) child).getMessageId(); @@ -2262,8 +2329,9 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter } } } - MediaCalendarActivity calendarActivity = new MediaCalendarActivity(bundle, sharedMediaData[0].filterType, date); - calendarActivity.setCallback(new MediaCalendarActivity.Callback() { + bundle.putInt("type", CalendarActivity.TYPE_MEDIA_CALENDAR); + CalendarActivity calendarActivity = new CalendarActivity(bundle, sharedMediaData[0].filterType, date); + calendarActivity.setCallback(new CalendarActivity.Callback() { @Override public void onDateSelected(int messageId, int startOffset) { int index = -1; @@ -2346,7 +2414,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter if (photoVideoAdapter.getItemCount() == oldItemCount) { AndroidUtilities.updateVisibleRows(mediaPage.listView); } else { - updatePhotosAdapter(); + photoVideoAdapter.notifyDataSetChanged(); } if (pinchCenterPosition >= 0) { @@ -2396,7 +2464,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter if (photoVideoAdapter.getItemCount() == oldItemCount) { AndroidUtilities.updateVisibleRows(finalMediaPage.listView); } else { - updatePhotosAdapter(); + photoVideoAdapter.notifyDataSetChanged(); } } finalMediaPage.animationSupportingListView.setVisibility(View.GONE); @@ -2465,7 +2533,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter if (photoVideoAdapter.getItemCount() == oldItemCount) { AndroidUtilities.updateVisibleRows(finalMediaPage.listView); } else { - updatePhotosAdapter(); + photoVideoAdapter.notifyDataSetChanged(); } finalMediaPage.animationSupportingListView.setVisibility(View.GONE); saveScrollPosition(); @@ -2932,40 +3000,17 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter if (!sharedMediaData[type].fastScrollPeriods.isEmpty()) { for (int i = 0; i < mediaPages.length; i++) { if (mediaPages[i].selectedType == type) { - mediaPages[i].listView.setFastScrollVisible(true); - mediaPages[i].listView.getFastScroll().setAlpha(0); - mediaPages[i].listView.getFastScroll().animate().alpha(1f).setDuration(100).start(); - mediaPages[i].listView.checkSection(true); + mediaPages[i].fastScrollEnabled = true; + updateFastScrollVisibility(mediaPages[i], true); } } } - updatePhotosAdapter(); + photoVideoAdapter.notifyDataSetChanged(); })); ConnectionsManager.getInstance(profileActivity.getCurrentAccount()).bindRequestToGuid(reqId, profileActivity.getClassGuid()); } } - private void updatePhotosAdapter() { -// MediaPage mediaPage = getMediaPage(0); -// if (mediaPage != null) { -// for (int i = 0; i < mediaPage.listView.getChildCount(); i++) { -// View child = mediaPage.listView.getChildAt(i); -// if (child instanceof SharedPhotoVideoCell2) { -// ((SharedPhotoVideoCell2) child).moveImageToFront(); -// } -// } -// if (mediaPage.animationSupportingListView.getVisibility() == View.VISIBLE) { -// for (int i = 0; i < mediaPage.animationSupportingListView.getChildCount(); i++) { -// View child = mediaPage.animationSupportingListView.getChildAt(i); -// if (child instanceof SharedPhotoVideoCell2) { -// ((SharedPhotoVideoCell2) child).moveImageToFront(); -// } -// } -// } -// } - photoVideoAdapter.notifyDataSetChanged(); - } - private static void showFastScrollHint(MediaPage mediaPage, SharedMediaData[] sharedMediaData, boolean show) { if (show) { @@ -3012,7 +3057,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter checkCurrentTabValid(); } - public void onActionBarItemClick(int id) { + public void onActionBarItemClick(View v, int id) { if (id == delete) { TLRPC.Chat currentChat = null; TLRPC.User currentUser = null; @@ -3030,6 +3075,18 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter cantDeleteMessagesCount = 0; }, null); } else if (id == forward) { + if (info != null) { + TLRPC.Chat chat = profileActivity.getMessagesController().getChat(info.id); + if (profileActivity.getMessagesController().isChatNoForwards(chat)) { + if (fwdRestrictedHint != null) { + fwdRestrictedHint.setText(ChatObject.isChannel(chat) && !chat.megagroup ? LocaleController.getString("ForwardsRestrictedInfoChannel", R.string.ForwardsRestrictedInfoChannel) : + LocaleController.getString("ForwardsRestrictedInfoGroup", R.string.ForwardsRestrictedInfoGroup)); + fwdRestrictedHint.showForView(v, true); + } + return; + } + } + Bundle args = new Bundle(); args.putBoolean("onlySelect", true); args.putInt("dialogsType", 3); @@ -3242,6 +3299,10 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter velocityTracker = VelocityTracker.obtain(); } velocityTracker.addMovement(ev); + + if (fwdRestrictedHint != null) { + fwdRestrictedHint.hide(); + } } if (ev != null && ev.getAction() == MotionEvent.ACTION_DOWN && !startedTracking && !maybeStartTracking && ev.getY() >= AndroidUtilities.dp(48)) { startedTrackingPointerId = ev.getPointerId(0); @@ -3581,7 +3642,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter if (photoVideoAdapter.getItemCount() == oldItemCount) { AndroidUtilities.updateVisibleRows(listView); } else { - updatePhotosAdapter(); + photoVideoAdapter.notifyDataSetChanged(); } } else { adapter.notifyDataSetChanged(); @@ -3679,7 +3740,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter if (updated) { scrolling = true; if (photoVideoAdapter != null) { - updatePhotosAdapter(); + photoVideoAdapter.notifyDataSetChanged(); } if (documentsAdapter != null) { documentsAdapter.notifyDataSetChanged(); @@ -3745,7 +3806,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter } if (adapter != null) { int count = adapter.getItemCount(); - updatePhotosAdapter(); + photoVideoAdapter.notifyDataSetChanged(); documentsAdapter.notifyDataSetChanged(); voiceAdapter.notifyDataSetChanged(); linksAdapter.notifyDataSetChanged(); @@ -3830,6 +3891,9 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter } if (messageId != 0) { int index = -1; + if (mediaPages[k].selectedType < 0 || mediaPages[k].selectedType >= sharedMediaData.length) { + continue; + } for (int i = 0; i < sharedMediaData[mediaPages[k].selectedType].messages.size(); i++) { if (messageId == sharedMediaData[mediaPages[k].selectedType].messages.get(i).getId()) { index = i; @@ -3941,7 +4005,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter public void onResume() { scrolling = true; if (photoVideoAdapter != null) { - updatePhotosAdapter(); + photoVideoAdapter.notifyDataSetChanged(); } if (documentsAdapter != null) { documentsAdapter.notifyDataSetChanged(); @@ -3996,7 +4060,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter public void updateAdapters() { if (photoVideoAdapter != null) { - updatePhotosAdapter(); + photoVideoAdapter.notifyDataSetChanged(); } if (documentsAdapter != null) { documentsAdapter.notifyDataSetChanged(); @@ -4396,7 +4460,8 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter } mediaPages[a].listView.setVisibility(View.VISIBLE); } - mediaPages[a].listView.setFastScrollVisible(fastScrollVisible); + mediaPages[a].fastScrollEnabled = fastScrollVisible; + updateFastScrollVisibility(mediaPages[a], false); mediaPages[a].layoutManager.setSpanCount(spanCount); mediaPages[a].listView.setRecycledViewPool(viewPool); mediaPages[a].animationSupportingListView.setRecycledViewPool(viewPool); @@ -4607,7 +4672,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter } } if (num == 0) { - updatePhotosAdapter(); + photoVideoAdapter.notifyDataSetChanged(); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/SimpleAvatarView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/SimpleAvatarView.java new file mode 100644 index 000000000..701c84103 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/SimpleAvatarView.java @@ -0,0 +1,127 @@ +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.Paint; +import android.util.AttributeSet; +import android.view.View; + +import androidx.annotation.Nullable; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.ImageReceiver; +import org.telegram.tgnet.TLObject; +import org.telegram.ui.ActionBar.Theme; + +public class SimpleAvatarView extends View { + private ImageReceiver avatarImage = new ImageReceiver(this); + private AvatarDrawable avatarDrawable = new AvatarDrawable(); + private Paint selectPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private float selectProgress; + private boolean isAvatarHidden; + private ValueAnimator animator; + + public SimpleAvatarView(Context context) { + super(context); + } + + public SimpleAvatarView(Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + } + + public SimpleAvatarView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + { + avatarImage.setRoundRadius(AndroidUtilities.dp(28)); + selectPaint.setStrokeWidth(AndroidUtilities.dp(2)); + selectPaint.setStyle(Paint.Style.STROKE); + } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + + avatarImage.onAttachedToWindow(); + } + + @Override + protected void onDetachedFromWindow() { + super.onDetachedFromWindow(); + + avatarImage.onDetachedFromWindow(); + } + + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + + selectPaint.setColor(Theme.getColor(Theme.key_dialogTextBlue)); + canvas.drawCircle(getWidth() / 2f, getHeight() / 2f, Math.min(getWidth(), getHeight()) / 2f - selectPaint.getStrokeWidth(), selectPaint); + if (!isAvatarHidden) { + float pad = selectPaint.getStrokeWidth() * 2.5f * selectProgress; + avatarImage.setImageCoords(pad, pad, getWidth() - pad * 2, getHeight() - pad * 2); + avatarImage.draw(canvas); + } + } + + /** + * Sets new User or Chat to be bound as the avatar + * @param obj User or chat + */ + public void setAvatar(TLObject obj) { + avatarDrawable.setInfo(obj); + avatarImage.setForUserOrChat(obj, avatarDrawable); + } + + /** + * @return If avatar is currently selected + */ + public boolean isSelected() { + return selectProgress == 1; + } + + /** + * Sets avatar selected value + * @param s If avatar is selected + * @param animate If we should animate status change + */ + public void setSelected(boolean s, boolean animate) { + if (animate) { + if (animator != null) + animator.cancel(); + float to = s ? 1 : 0; + ValueAnimator anim = ValueAnimator.ofFloat(selectProgress, to).setDuration((long) (350 * Math.abs(to - selectProgress))); + anim.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT); + anim.addUpdateListener(animation -> { + selectProgress = (float) animation.getAnimatedValue(); + invalidate(); + }); + anim.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + if (animator == animation) + animator = null; + } + }); + anim.start(); + animator = anim; + } else { + selectProgress = s ? 1 : 0; + invalidate(); + } + } + + /** + * Sets avatar hidden + * @param h If we should hide avatar from view + */ + public void setHideAvatar(boolean h) { + isAvatarHidden = h; + invalidate(); + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/SlideView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/SlideView.java index ad2f85334..a6e815f18 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/SlideView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/SlideView.java @@ -38,7 +38,7 @@ public class SlideView extends LinearLayout { } - public void onNextPressed() { + public void onNextPressed(String code) { } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ThemeSmallPreviewView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ThemeSmallPreviewView.java new file mode 100644 index 000000000..7c29d026f --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ThemeSmallPreviewView.java @@ -0,0 +1,678 @@ +package org.telegram.ui.Components; + +import android.animation.Animator; +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; +import android.graphics.Paint; +import android.graphics.Path; +import android.graphics.RectF; +import android.graphics.Shader; +import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.ColorDrawable; +import android.graphics.drawable.Drawable; +import android.text.Layout; +import android.text.StaticLayout; +import android.text.TextPaint; +import android.text.TextUtils; +import android.view.Gravity; +import android.view.View; +import android.widget.FrameLayout; + +import org.telegram.messenger.AndroidUtilities; +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; +import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MediaDataController; +import org.telegram.messenger.NotificationCenter; +import org.telegram.messenger.R; +import org.telegram.messenger.SvgHelper; +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; + + private final float STROKE_RADIUS = AndroidUtilities.dp(8); + private final float INNER_RADIUS = AndroidUtilities.dp(6); + private final float INNER_RECT_SPACE = AndroidUtilities.dp(4); + private final float BUBBLE_HEIGHT = AndroidUtilities.dp(21); + private final float BUBBLE_WIDTH = AndroidUtilities.dp(41); + + ThemeDrawable themeDrawable = new ThemeDrawable(); + ThemeDrawable animateOutThemeDrawable; + private float changeThemeProgress = 1f; + + Paint outlineBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private final Paint backgroundFillPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + + private final RectF rectF = new RectF(); + private final Path clipPath = new Path(); + private final Theme.ResourcesProvider resourcesProvider; + + private ValueAnimator strokeAlphaAnimator; + private TextPaint noThemeTextPaint; + private StaticLayout textLayout; + public ChatThemeBottomSheet.ChatThemeItem chatThemeItem; + private BackupImageView backupImageView; + private boolean hasAnimatedEmoji; + private final int currentAccount; + Runnable animationCancelRunnable; + private int currentType; + int patternColor; + private float selectionProgress; + + public ThemeSmallPreviewView(Context context, int currentAccount, Theme.ResourcesProvider resourcesProvider, int currentType) { + super(context); + this.currentType = currentType; + this.currentAccount = currentAccount; + this.resourcesProvider = resourcesProvider; + setBackgroundColor(getThemedColor(Theme.key_dialogBackgroundGray)); + backupImageView = new BackupImageView(context); + backupImageView.getImageReceiver().setCrossfadeWithOldImage(true); + backupImageView.getImageReceiver().setAllowStartLottieAnimation(false); + backupImageView.getImageReceiver().setAutoRepeat(0); + if (currentType == TYPE_DEFAULT) { + 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)); + } + + outlineBackgroundPaint.setStrokeWidth(AndroidUtilities.dp(2)); + outlineBackgroundPaint.setStyle(Paint.Style.STROKE); + outlineBackgroundPaint.setColor(0xFFE3E3E3); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + if (currentType == TYPE_GRID) { + int width = MeasureSpec.getSize(widthMeasureSpec); + 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); + super.onMeasure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)); + } + + backupImageView.setPivotY(backupImageView.getMeasuredHeight()); + backupImageView.setPivotX(backupImageView.getMeasuredWidth() / 2f); + } + + @Override + protected void onSizeChanged(int w, int h, int oldw, int oldh) { + super.onSizeChanged(w, h, oldw, oldh); + if (w == oldw && h == oldh) { + return; + } + rectF.set(INNER_RECT_SPACE, INNER_RECT_SPACE, w - INNER_RECT_SPACE, h - INNER_RECT_SPACE); + clipPath.reset(); + clipPath.addRoundRect(rectF, INNER_RADIUS, INNER_RADIUS, Path.Direction.CW); + } + + Theme.MessageDrawable messageDrawableOut = new Theme.MessageDrawable(Theme.MessageDrawable.TYPE_TEXT, true, false); + Theme.MessageDrawable messageDrawableIn = new Theme.MessageDrawable(Theme.MessageDrawable.TYPE_TEXT, false, false); + + @Override + protected void dispatchDraw(Canvas canvas) { + if (chatThemeItem == null) { + super.dispatchDraw(canvas); + return; + } + if (changeThemeProgress != 1 && animateOutThemeDrawable != null) { + animateOutThemeDrawable.drawBackground(canvas, 1f); + } + if (changeThemeProgress != 0) { + themeDrawable.drawBackground(canvas, changeThemeProgress); + } + if (changeThemeProgress != 1 && animateOutThemeDrawable != null) { + animateOutThemeDrawable.draw(canvas, 1f); + } + if (changeThemeProgress != 0) { + themeDrawable.draw(canvas, changeThemeProgress); + } + if (changeThemeProgress != 1f) { + changeThemeProgress += 16 / 150f; + if (changeThemeProgress >= 1f) { + changeThemeProgress = 1f; + } + invalidate(); + } + super.dispatchDraw(canvas); + } + + public int lastThemeIndex; + public void setItem(ChatThemeBottomSheet.ChatThemeItem item, boolean animated) { + boolean itemChanged = chatThemeItem != item; + boolean darkModeChanged = lastThemeIndex != item.themeIndex; + lastThemeIndex = item.themeIndex; + this.chatThemeItem = item; + hasAnimatedEmoji = false; + TLRPC.Document document = null; + if (item.chatTheme.getEmoticon() != null) { + document = MediaDataController.getInstance(currentAccount).getEmojiAnimatedSticker(item.chatTheme.getEmoticon()); + } + if (itemChanged) { + if (animationCancelRunnable != null) { + AndroidUtilities.cancelRunOnUIThread(animationCancelRunnable); + animationCancelRunnable = null; + } + backupImageView.animate().cancel(); + backupImageView.setScaleX(1f); + backupImageView.setScaleY(1f); + } + if (itemChanged) { + Drawable thumb = null; + if (document != null) { + thumb = DocumentObject.getSvgThumb(document, Theme.key_emptyListPlaceholder, 0.2f); + } + if (thumb == null) { + Emoji.preloadEmoji(item.chatTheme.getEmoticon()); + thumb = Emoji.getEmojiDrawable(item.chatTheme.getEmoticon()); + } + backupImageView.setImage(ImageLocation.getForDocument(document), "50_50", thumb, null); + } + + if (itemChanged || darkModeChanged) { + if (animated) { + changeThemeProgress = 0f; + animateOutThemeDrawable = themeDrawable; + themeDrawable = new ThemeDrawable(); + invalidate(); + } else { + changeThemeProgress = 1f; + } + updatePreviewBackground(themeDrawable); + TLRPC.TL_theme theme = item.chatTheme.getTlTheme(lastThemeIndex); + if (theme != null) { + final long themeId = theme.id; + TLRPC.WallPaper wallPaper = item.chatTheme.getWallpaper(lastThemeIndex); + if (wallPaper != null) { + final int intensity = wallPaper.settings.intensity; + item.chatTheme.loadWallpaperThumb(lastThemeIndex, result -> { + if (result != null && result.first == themeId) { + if (item.previewDrawable instanceof MotionBackgroundDrawable) { + MotionBackgroundDrawable motionBackgroundDrawable = (MotionBackgroundDrawable) item.previewDrawable; + motionBackgroundDrawable.setPatternBitmap(intensity >= 0 ? 100 : -100, result.second); + motionBackgroundDrawable.setPatternColorFilter(patternColor); + } + invalidate(); + } + }); + } + } else { + Theme.ThemeInfo themeInfo = item.chatTheme.getThemeInfo(lastThemeIndex); + Theme.ThemeAccent accent = null; + + if (themeInfo.themeAccentsMap != null) { + accent = themeInfo.themeAccentsMap.get(item.chatTheme.getAccentId(lastThemeIndex)); + } + + if (accent != null && accent.info != null && accent.info.settings.size() > 0) { + TLRPC.WallPaper wallPaper = accent.info.settings.get(0).wallpaper; + + if (wallPaper != null && wallPaper.document != null) { + TLRPC.Document wallpaperDocument = wallPaper.document; + final TLRPC.PhotoSize thumbSize = FileLoader.getClosestPhotoSizeWithSize(wallpaperDocument.thumbs, 120); + ImageLocation imageLocation = ImageLocation.getForDocument(thumbSize, wallpaperDocument); + ImageReceiver imageReceiver = new ImageReceiver(); + imageReceiver.setImage(imageLocation, "120_80", null, null, null, 1); + imageReceiver.setDelegate((receiver, set, thumb, memCache) -> { + ImageReceiver.BitmapHolder holder = receiver.getBitmapSafe(); + if (!set || holder == null) { + return; + } + Bitmap resultBitmap = holder.bitmap; + if (resultBitmap != null) { + if (item.previewDrawable instanceof MotionBackgroundDrawable) { + MotionBackgroundDrawable motionBackgroundDrawable = (MotionBackgroundDrawable) item.previewDrawable; + motionBackgroundDrawable.setPatternBitmap(wallPaper.settings == null || wallPaper.settings.intensity >= 0 ? 100 : -100, resultBitmap); + motionBackgroundDrawable.setPatternColorFilter(patternColor); + + invalidate(); + } + } + }); + ImageLoader.getInstance().loadImageForImageReceiver(imageReceiver); + } + } else if (accent != null && accent.info == null) { + ChatThemeController.chatThemeQueue.postRunnable(() -> { + Bitmap bitmap = SvgHelper.getBitmap(R.raw.default_pattern, AndroidUtilities.dp(80), AndroidUtilities.dp(120), Color.BLACK, 3f); + AndroidUtilities.runOnUIThread(() -> { + if (item.previewDrawable instanceof MotionBackgroundDrawable) { + MotionBackgroundDrawable motionBackgroundDrawable = (MotionBackgroundDrawable) item.previewDrawable; + motionBackgroundDrawable.setPatternBitmap(100, bitmap); + motionBackgroundDrawable.setPatternColorFilter(patternColor); + invalidate(); + } + }); + }); + } + } + } + + if (!animated) { + backupImageView.animate().cancel();; + backupImageView.setScaleX(1f); + backupImageView.setScaleY(1f); + AndroidUtilities.cancelRunOnUIThread(animationCancelRunnable); + if (backupImageView.getImageReceiver().getLottieAnimation() != null) { + backupImageView.getImageReceiver().getLottieAnimation().stop(); + backupImageView.getImageReceiver().getLottieAnimation().setCurrentFrame(0, false); + } + } + } + + boolean isSelected; + + + public void setSelected(boolean selected, boolean animated) { + if (!animated) { + if (strokeAlphaAnimator != null) { + strokeAlphaAnimator.cancel(); + } + isSelected = selected; + selectionProgress = selected ? 1f : 0; + invalidate(); + return; + } + if (isSelected != selected) { + float currentProgress = selectionProgress; + if (strokeAlphaAnimator != null) { + strokeAlphaAnimator.cancel(); + } + strokeAlphaAnimator = ValueAnimator.ofFloat(currentProgress, selected ? 1f : 0); + strokeAlphaAnimator.addUpdateListener(valueAnimator -> { + selectionProgress = (float) valueAnimator.getAnimatedValue(); + invalidate(); + }); + strokeAlphaAnimator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + super.onAnimationEnd(animation); + selectionProgress = selected ? 1f : 0; + invalidate(); + } + }); + strokeAlphaAnimator.setDuration(250); + strokeAlphaAnimator.start(); + } + isSelected = selected; + } + + @Override + public void setBackgroundColor(int color) { + backgroundFillPaint.setColor(getThemedColor(Theme.key_dialogBackgroundGray)); + if (noThemeTextPaint != null) { + noThemeTextPaint.setColor(getThemedColor(Theme.key_chat_emojiPanelTrendingDescription)); + } + invalidate(); + } + + private void fillOutBubblePaint(Paint paint, List messageColors) { + if (messageColors.size() > 1) { + int[] colors = new int[messageColors.size()]; + for (int i = 0; i != messageColors.size(); ++i) { + colors[i] = messageColors.get(i); + } + float top = INNER_RECT_SPACE + AndroidUtilities.dp(8); + paint.setShader(new LinearGradient(0f, top, 0f, top + BUBBLE_HEIGHT, colors, null, Shader.TileMode.CLAMP)); + } else { + paint.setShader(null); + } + } + + public void updatePreviewBackground(ThemeDrawable themeDrawable) { + if (chatThemeItem == null || chatThemeItem.chatTheme == null) { + return; + } + EmojiThemes.ThemeItem themeItem = chatThemeItem.chatTheme.getThemeItem(chatThemeItem.themeIndex); + int color = themeItem.inBubbleColor; + themeDrawable.inBubblePaint.setColor(color); + color = themeItem.outBubbleColor; + themeDrawable.outBubblePaintSecond.setColor(color); + + int strokeColor = chatThemeItem.chatTheme.showAsDefaultStub + ? getThemedColor(Theme.key_featuredStickers_addButton) + : themeItem.outLineColor; + int strokeAlpha = themeDrawable.strokePaint.getAlpha(); + themeDrawable.strokePaint.setColor(strokeColor); + themeDrawable.strokePaint.setAlpha(strokeAlpha); + + + TLRPC.TL_theme tlTheme = chatThemeItem.chatTheme.getTlTheme(chatThemeItem.themeIndex); + + if (tlTheme != null) { + int index = chatThemeItem.chatTheme.getSettingsIndex(chatThemeItem.themeIndex); + TLRPC.ThemeSettings themeSettings = tlTheme.settings.get(index); + fillOutBubblePaint(themeDrawable.outBubblePaintSecond, themeSettings.message_colors); + + themeDrawable.outBubblePaintSecond.setAlpha(255); + getPreviewDrawable(tlTheme, index); + } else { + EmojiThemes.ThemeItem item = chatThemeItem.chatTheme.getThemeItem(chatThemeItem.themeIndex); + getPreviewDrawable(item); + } + themeDrawable.previewDrawable = chatThemeItem.previewDrawable; + invalidate(); + } + + private Drawable getPreviewDrawable(TLRPC.TL_theme theme, int settingsIndex) { + if (chatThemeItem == null) { + return null; + } + + int color1 = 0; + int color2 = 0; + int color3 = 0; + int color4 = 0; + + Drawable drawable; + if (settingsIndex >= 0) { + TLRPC.ThemeSettings themeSettings = theme.settings.get(settingsIndex); + TLRPC.WallPaperSettings wallPaperSettings = themeSettings.wallpaper.settings; + color1 = wallPaperSettings.background_color; + color2 = wallPaperSettings.second_background_color; + color3 = wallPaperSettings.third_background_color; + color4 = wallPaperSettings.fourth_background_color; + } + if (color2 != 0) { + MotionBackgroundDrawable motionBackgroundDrawable = new MotionBackgroundDrawable(color1, color2, color3, color4, true); + patternColor = motionBackgroundDrawable.getPatternColor(); + drawable = motionBackgroundDrawable; + } else { + drawable = new MotionBackgroundDrawable(color1, color1, color1, color1, true); + patternColor = Color.BLACK; + } + chatThemeItem.previewDrawable = drawable; + + return drawable; + } + + private Drawable getPreviewDrawable(EmojiThemes.ThemeItem item) { + if (chatThemeItem == null) { + return null; + } + Drawable drawable = null; + + int color1 = item.patternBgColor; + int color2 = item.patternBgGradientColor1; + int color3 = item.patternBgGradientColor2; + int color4 = item.patternBgGradientColor3; + int rotation = item.patternBgRotation; + + if (item.themeInfo.getAccent(false) != null) { + if (color2 != 0) { + MotionBackgroundDrawable motionBackgroundDrawable = new MotionBackgroundDrawable(color1, color2, color3, color4, rotation, true); + patternColor = motionBackgroundDrawable.getPatternColor(); + drawable = motionBackgroundDrawable; + } else { + drawable = new MotionBackgroundDrawable(color1, color1, color1, color1, rotation, true); + patternColor = Color.BLACK; + } + } else { + if (color1 != 0 && color2 != 0) { + drawable = new MotionBackgroundDrawable(color1, color2, color3, color4, rotation, true); + } 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); + if (wallpaper != null) { + drawable = new BitmapDrawable(wallpaper); + } + } else { + drawable = new MotionBackgroundDrawable(0xffdbddbb, 0xff6ba587, 0xffd5d88d, 0xff88b884, true); + } + } + + chatThemeItem.previewDrawable = drawable; + + return drawable; + } + + private StaticLayout getNoThemeStaticLayout() { + if (textLayout != null) { + return textLayout; + } + noThemeTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG + TextPaint.SUBPIXEL_TEXT_FLAG); + noThemeTextPaint.setColor(getThemedColor(Theme.key_chat_emojiPanelTrendingDescription)); + noThemeTextPaint.setTextSize(AndroidUtilities.dp(14)); + noThemeTextPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); + textLayout = StaticLayoutEx.createStaticLayout2( + LocaleController.getString("ChatNoTheme", R.string.ChatNoTheme), + noThemeTextPaint, + AndroidUtilities.dp(52), + Layout.Alignment.ALIGN_CENTER, + 1f, 0f, true, + TextUtils.TruncateAt.END, AndroidUtilities.dp(52), 3 + ); + return textLayout; + } + + private int getThemedColor(String key) { + Integer color = resourcesProvider != null ? resourcesProvider.getColor(key) : null; + return color != null ? color : Theme.getColor(key); + } + + + public void playEmojiAnimation() { + if (backupImageView.getImageReceiver().getLottieAnimation() != null) { + AndroidUtilities.cancelRunOnUIThread(animationCancelRunnable); + backupImageView.setVisibility(View.VISIBLE); + backupImageView.getImageReceiver().getLottieAnimation().setCurrentFrame(0, false); + backupImageView.getImageReceiver().getLottieAnimation().start(); + backupImageView.animate().scaleX(2f).scaleY(2f).setDuration(300).setInterpolator(AndroidUtilities.overshootInterpolator).start(); + + AndroidUtilities.runOnUIThread(animationCancelRunnable = () -> { + animationCancelRunnable = null; + backupImageView.animate().scaleX(1f).scaleY(1f).setDuration(150).setInterpolator(CubicBezierInterpolator.DEFAULT).start(); + }, 2500); + } + } + + public void cancelAnimation() { + if (animationCancelRunnable != null) { + AndroidUtilities.cancelRunOnUIThread(animationCancelRunnable); + animationCancelRunnable.run(); + } + } + + 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); + private final Paint outBubblePaintSecond = new Paint(Paint.ANTI_ALIAS_FLAG); + private final Paint inBubblePaint = new Paint(Paint.ANTI_ALIAS_FLAG); + Drawable previewDrawable; + + ThemeDrawable() { + strokePaint.setStyle(Paint.Style.STROKE); + strokePaint.setStrokeWidth(AndroidUtilities.dp(2)); + } + + public void drawBackground(Canvas canvas, float alpha) { + if (previewDrawable != null) { + canvas.save(); + canvas.clipPath(clipPath); + if (previewDrawable instanceof BitmapDrawable) { + int drawableW = previewDrawable.getIntrinsicWidth(); + int drawableH = previewDrawable.getIntrinsicHeight(); + if (drawableW / (float) drawableH > getWidth() / (float) getHeight()) { + int w = (int) (getWidth() * (float) drawableH / drawableW); + int padding = (w - getWidth()) / 2; + previewDrawable.setBounds(padding, 0, padding + w , getHeight()); + } else { + int h = (int) (getHeight() * (float) drawableH / drawableW); + int padding = (getHeight() - h) / 2; + previewDrawable.setBounds(0, padding, getWidth(), padding + h); + } + } else { + previewDrawable.setBounds(0, 0, getWidth(), getHeight()); + } + previewDrawable.setAlpha((int) (255 * alpha)); + previewDrawable.draw(canvas); + if (previewDrawable instanceof ColorDrawable || (previewDrawable instanceof MotionBackgroundDrawable && ((MotionBackgroundDrawable) previewDrawable).isOneColor())) { + outlineBackgroundPaint.setAlpha((int) (255 * alpha)); + float padding = INNER_RECT_SPACE; + AndroidUtilities.rectTmp.set(padding, padding, getWidth() - padding, getHeight() - padding); + canvas.drawRoundRect(AndroidUtilities.rectTmp, INNER_RADIUS, INNER_RADIUS, outlineBackgroundPaint); + } + canvas.restore(); + } else { + canvas.drawRoundRect(rectF, INNER_RADIUS, INNER_RADIUS, backgroundFillPaint); + } + } + + public void draw(Canvas canvas, float alpha) { + if (chatThemeItem.isSelected || strokeAlphaAnimator != null) { + EmojiThemes.ThemeItem themeItem = chatThemeItem.chatTheme.getThemeItem(chatThemeItem.themeIndex); + int strokeColor = chatThemeItem.chatTheme.showAsDefaultStub + ? getThemedColor(Theme.key_featuredStickers_addButton) + : themeItem.outLineColor; + strokePaint.setColor(strokeColor); + strokePaint.setAlpha((int) (selectionProgress * alpha * 255)); + float rectSpace = strokePaint.getStrokeWidth() * 0.5f + AndroidUtilities.dp(4) * (1f - selectionProgress); + rectF.set(rectSpace, rectSpace, getWidth() - rectSpace, getHeight() - rectSpace); + canvas.drawRoundRect(rectF, STROKE_RADIUS, STROKE_RADIUS, strokePaint); + } + outBubblePaintSecond.setAlpha((int) (255 * alpha)); + inBubblePaint.setAlpha((int) (255 * alpha)); + rectF.set(INNER_RECT_SPACE, INNER_RECT_SPACE, getWidth() - INNER_RECT_SPACE, getHeight() - INNER_RECT_SPACE); + + if (chatThemeItem.chatTheme == null || chatThemeItem.chatTheme.showAsDefaultStub) { + canvas.drawRoundRect(rectF, INNER_RADIUS, INNER_RADIUS, backgroundFillPaint); + canvas.save(); + StaticLayout textLayout = getNoThemeStaticLayout(); + canvas.translate((getWidth() - textLayout.getWidth()) * 0.5f, AndroidUtilities.dp(18)); + 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); + } 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); + } + + 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); + } + } + } + } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.emojiLoaded); + } + + @Override + protected void onDetachedFromWindow() { + super.onDetachedFromWindow(); + NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.emojiLoaded); + } + + @Override + public void didReceivedNotification(int id, int account, Object... args) { + if (id == NotificationCenter.emojiLoaded) { + invalidate(); + } + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Tooltip.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Tooltip.java index e4a50601b..52a94a9c9 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Tooltip.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Tooltip.java @@ -29,6 +29,7 @@ public class Tooltip extends TextView { animator.start(); }; + public Tooltip(Context context, ViewGroup parentView, int backgroundColor, int textColor) { super(context); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/UndoView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/UndoView.java index 6bbb42941..fa119c202 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/UndoView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/UndoView.java @@ -171,6 +171,7 @@ public class UndoView extends FrameLayout { public final static int ACTION_PIN_DIALOGS = 78; public final static int ACTION_UNPIN_DIALOGS = 79; public final static int ACTION_EMAIL_COPIED = 80; + public final static int ACTION_CLEAR_DATES = 81; private CharSequence infoText; private int hideAnimationType = 1; @@ -1312,7 +1313,7 @@ public class UndoView extends FrameLayout { subinfoTextView.setVisibility(GONE); leftImageView.setVisibility(GONE); - if (currentAction == ACTION_CLEAR || currentAction == ACTION_CLEAR_FEW) { + if (currentAction == ACTION_CLEAR_DATES || currentAction == ACTION_CLEAR || currentAction == ACTION_CLEAR_FEW) { infoTextView.setText(LocaleController.getString("HistoryClearedUndo", R.string.HistoryClearedUndo)); } else if (currentAction == ACTION_DELETE_FEW) { infoTextView.setText(LocaleController.getString("ChatsDeletedUndo", R.string.ChatsDeletedUndo)); @@ -1328,8 +1329,10 @@ public class UndoView extends FrameLayout { infoTextView.setText(LocaleController.getString("ChatDeletedUndo", R.string.ChatDeletedUndo)); } } - for (int a = 0; a < dialogIds.size(); a++) { - MessagesController.getInstance(currentAccount).addDialogAction(dialogIds.get(a), currentAction == ACTION_CLEAR || currentAction == ACTION_CLEAR_FEW); + if (currentAction != ACTION_CLEAR_DATES) { + for (int a = 0; a < dialogIds.size(); a++) { + MessagesController.getInstance(currentAccount).addDialogAction(dialogIds.get(a), currentAction == ACTION_CLEAR || currentAction == ACTION_CLEAR_FEW); + } } } @@ -1423,7 +1426,7 @@ public class UndoView extends FrameLayout { backgroundDrawable.draw(canvas); } - if (currentAction == ACTION_DELETE || currentAction == ACTION_CLEAR || currentAction == ACTION_DELETE_FEW || currentAction == ACTION_CLEAR_FEW) { + if (currentAction == ACTION_DELETE || currentAction == ACTION_CLEAR || currentAction == ACTION_DELETE_FEW || currentAction == ACTION_CLEAR_FEW || currentAction == ACTION_CLEAR_DATES) { int newSeconds = timeLeft > 0 ? (int) Math.ceil(timeLeft / 1000.0f) : 0; if (prevSeconds != newSeconds) { prevSeconds = newSeconds; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/DataAutoDownloadActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/DataAutoDownloadActivity.java index f9b494991..5ab42e9e7 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/DataAutoDownloadActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/DataAutoDownloadActivity.java @@ -316,7 +316,7 @@ public class DataAutoDownloadActivity extends BaseFragment { TextCheckBoxCell[] cells = new TextCheckBoxCell[4]; for (int a = 0; a < 4; a++) { - TextCheckBoxCell checkBoxCell = cells[a] = new TextCheckBoxCell(getParentActivity(), true); + TextCheckBoxCell checkBoxCell = cells[a] = new TextCheckBoxCell(getParentActivity(), true, false); if (a == 0) { cells[a].setTextAndCheck(LocaleController.getString("AutodownloadContacts", R.string.AutodownloadContacts), (currentPreset.mask[DownloadController.PRESET_NUM_CONTACT] & type) != 0, true); } else if (a == 1) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/DefaultThemesPreviewCell.java b/TMessagesProj/src/main/java/org/telegram/ui/DefaultThemesPreviewCell.java index 629bb6c36..bcd39b86c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/DefaultThemesPreviewCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/DefaultThemesPreviewCell.java @@ -1,16 +1,21 @@ package org.telegram.ui; +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ValueAnimator; import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; -import android.graphics.Paint; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffColorFilter; import android.text.TextUtils; import android.view.Gravity; import android.view.View; import android.widget.FrameLayout; import android.widget.LinearLayout; +import androidx.core.graphics.ColorUtils; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager; @@ -23,8 +28,10 @@ import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.EmojiThemes; import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.Cells.DrawerProfileCell; import org.telegram.ui.Cells.TextCell; import org.telegram.ui.Components.ChatThemeBottomSheet; +import org.telegram.ui.Components.ThemeSmallPreviewView; import org.telegram.ui.Components.FlickerLoadingView; import org.telegram.ui.Components.LayoutHelper; import org.telegram.ui.Components.RLottieDrawable; @@ -57,7 +64,7 @@ public class DefaultThemesPreviewCell extends LinearLayout { addView(frameLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); - adapter = new ChatThemeBottomSheet.Adapter(parentFragment.getCurrentAccount(), null, currentType == ThemeActivity.THEME_TYPE_BASIC ? ChatThemeBottomSheet.Adapter.TYPE_DEFAULT : ChatThemeBottomSheet.Adapter.TYPE_GRID); + adapter = new ChatThemeBottomSheet.Adapter(parentFragment.getCurrentAccount(), null, currentType == ThemeActivity.THEME_TYPE_BASIC ? ThemeSmallPreviewView.TYPE_DEFAULT : ThemeSmallPreviewView.TYPE_GRID); recyclerView = new RecyclerListView(getContext()); recyclerView.setAdapter(adapter); recyclerView.setClipChildren(false); @@ -79,12 +86,13 @@ public class DefaultThemesPreviewCell extends LinearLayout { recyclerView.setLayoutManager(layoutManager = gridLayoutManager); } + recyclerView.setFocusable(false); recyclerView.setPadding(AndroidUtilities.dp(12), 0, AndroidUtilities.dp(12), 0); recyclerView.setOnItemClickListener((view, position) -> { ChatThemeBottomSheet.ChatThemeItem chatTheme = adapter.items.get(position); Theme.ThemeInfo info = chatTheme.chatTheme.getThemeInfo(themeIndex); int accentId = -1; - if (chatTheme.chatTheme.getEmoticon().equals("\uD83C\uDFE0")) { + if (chatTheme.chatTheme.getEmoticon().equals("\uD83C\uDFE0") || chatTheme.chatTheme.getEmoticon().equals("\uD83C\uDFA8")) { accentId = chatTheme.chatTheme.getAccentId(themeIndex); } if (info == null) { @@ -104,18 +112,28 @@ public class DefaultThemesPreviewCell extends LinearLayout { } } - NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.needSetDayNightTheme, info, false, null, accentId); + NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.needSetDayNightTheme, info, true, null, accentId); selectedPosition = position; + for (int i = 0; i < adapter.items.size(); i++) { + adapter.items.get(i).isSelected = i == selectedPosition; + } adapter.setSelectedItem(selectedPosition); for (int i = 0; i < recyclerView.getChildCount(); i++) { - ChatThemeBottomSheet.Adapter.ChatThemeView child = (ChatThemeBottomSheet.Adapter.ChatThemeView) recyclerView.getChildAt(i); + ThemeSmallPreviewView child = (ThemeSmallPreviewView) recyclerView.getChildAt(i); if (child != view) { child.cancelAnimation(); } } - ((ChatThemeBottomSheet.Adapter.ChatThemeView) view).playEmojiAnimation(); + ((ThemeSmallPreviewView) view).playEmojiAnimation(); + + if (info != null) { + SharedPreferences.Editor editor = ApplicationLoader.applicationContext.getSharedPreferences("themeconfig", Activity.MODE_PRIVATE).edit(); + editor.putString(currentType == ThemeActivity.THEME_TYPE_NIGHT || info.isDark() ? "lastDarkTheme" : "lastDayTheme", info.getKey()); + editor.commit(); + } + }); progressView = new FlickerLoadingView(getContext(), null); @@ -141,7 +159,6 @@ public class DefaultThemesPreviewCell extends LinearLayout { darkThemeDrawable.commitApplyLayerColors(); dayNightCell = new TextCell(context); - dayNightCell.setTextAndIcon(LocaleController.getString("SettingsSwitchToNightMode", R.string.SettingsSwitchToNightMode), darkThemeDrawable, true); dayNightCell.imageLeft = 21; addView(dayNightCell, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); @@ -154,6 +171,11 @@ public class DefaultThemesPreviewCell extends LinearLayout { @SuppressLint("NotifyDataSetChanged") @Override public void onClick(View view) { + if (DrawerProfileCell.switchingTheme) { + return; + } + int iconOldColor = Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4); + DrawerProfileCell.switchingTheme = true; SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("themeconfig", Activity.MODE_PRIVATE); String dayThemeName = preferences.getString("lastDayTheme", "Blue"); if (Theme.getTheme(dayThemeName) == null || Theme.getTheme(dayThemeName).isDark()) { @@ -190,6 +212,32 @@ public class DefaultThemesPreviewCell extends LinearLayout { updateDayNightMode(); updateSelectedPosition(); + + int iconNewColor = Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4); + darkThemeDrawable.setColorFilter(new PorterDuffColorFilter(iconNewColor, PorterDuff.Mode.SRC_IN)); + ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, 1f); + valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { + @Override + public void onAnimationUpdate(ValueAnimator valueAnimator) { + int color = ColorUtils.blendARGB(iconOldColor, iconNewColor, (Float) valueAnimator.getAnimatedValue()); + darkThemeDrawable.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN)); + } + }); + valueAnimator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + darkThemeDrawable.setColorFilter(new PorterDuffColorFilter(iconNewColor, PorterDuff.Mode.SRC_IN)); + super.onAnimationEnd(animation); + } + }); + valueAnimator.setDuration(350); + valueAnimator.start(); + + if (Theme.isCurrentThemeDay()) { + dayNightCell.setTextAndIcon(LocaleController.getString("SettingsSwitchToNightMode", R.string.SettingsSwitchToNightMode), darkThemeDrawable, true); + } else { + dayNightCell.setTextAndIcon(LocaleController.getString("SettingsSwitchToDayMode", R.string.SettingsSwitchToDayMode), darkThemeDrawable, true); + } } }); @@ -200,12 +248,14 @@ public class DefaultThemesPreviewCell extends LinearLayout { if (!Theme.isCurrentThemeDay()) { darkThemeDrawable.setCurrentFrame(darkThemeDrawable.getFramesCount() - 1); + dayNightCell.setTextAndIcon(LocaleController.getString("SettingsSwitchToDaytMode", R.string.SettingsSwitchToDayMode), darkThemeDrawable, true); + } else { + dayNightCell.setTextAndIcon(LocaleController.getString("SettingsSwitchToNightMode", R.string.SettingsSwitchToNightMode), darkThemeDrawable, true); } } if (!Theme.defaultEmojiThemes.isEmpty()) { - ArrayList themes = new ArrayList<>(); - themes.addAll(Theme.defaultEmojiThemes); + ArrayList themes = new ArrayList<>(Theme.defaultEmojiThemes); if (currentType == ThemeActivity.THEME_TYPE_BASIC) { EmojiThemes chatTheme = EmojiThemes.createPreviewCustom(); @@ -263,20 +313,36 @@ public class DefaultThemesPreviewCell extends LinearLayout { selectedPosition = -1; for (int i = 0; i < adapter.items.size(); i++) { TLRPC.TL_theme theme = adapter.items.get(i).chatTheme.getTlTheme(themeIndex); + Theme.ThemeInfo themeInfo = adapter.items.get(i).chatTheme.getThemeInfo(themeIndex); if (theme != null) { int settingsIndex = adapter.items.get(i).chatTheme.getSettingsIndex(themeIndex); String key = Theme.getBaseThemeKey(theme.settings.get(settingsIndex)); - if (Theme.getCurrentTheme().name.equals(key)) { - Theme.ThemeAccent accent = Theme.getCurrentTheme().accentsByThemeId.get(theme.id); - if (accent != null && accent.id == Theme.getCurrentTheme().currentAccentId) { + if (Theme.getActiveTheme().name.equals(key)) { + if (Theme.getActiveTheme().accentsByThemeId == null) { selectedPosition = i; + break; + } else { + Theme.ThemeAccent accent = Theme.getActiveTheme().accentsByThemeId.get(theme.id); + if (accent != null && accent.id == Theme.getActiveTheme().currentAccentId) { + selectedPosition = i; + break; + } } } + } else if (themeInfo != null) { + String key = themeInfo.getKey(); + if (Theme.getActiveTheme().name.equals(key) && adapter.items.get(i).chatTheme.getAccentId(themeIndex) == Theme.getActiveTheme().currentAccentId) { + selectedPosition = i; + break; + } } } - if (selectedPosition == -1) { + if (selectedPosition == -1 && currentType != ThemeActivity.THEME_TYPE_THEMES_BROWSER) { selectedPosition = adapter.items.size() - 1; } + for (int i = 0; i < adapter.items.size(); i++) { + adapter.items.get(i).isSelected = i == selectedPosition; + } adapter.setSelectedItem(selectedPosition); } @@ -300,7 +366,7 @@ public class DefaultThemesPreviewCell extends LinearLayout { } Theme.setCurrentNightTheme(themeInfo); } else { - if (themeInfo == Theme.getCurrentTheme()) { + if (themeInfo == Theme.getActiveTheme()) { return; } NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.needSetDayNightTheme, themeInfo, false, null, -1); @@ -318,10 +384,7 @@ public class DefaultThemesPreviewCell extends LinearLayout { public void updateColors() { if (currentType == ThemeActivity.THEME_TYPE_BASIC) { - darkThemeDrawable.setLayerColor("Sunny.**", Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4)); - darkThemeDrawable.setLayerColor("Path.**", Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4)); - darkThemeDrawable.setLayerColor("Path 10.**", Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4)); - darkThemeDrawable.setLayerColor("Path 11.**", Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4)); + darkThemeDrawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4), PorterDuff.Mode.SRC_IN)); dayNightCell.setBackground(Theme.createSelectorWithBackgroundDrawable(Theme.getColor(Theme.key_windowBackgroundWhite), Theme.getColor(Theme.key_listSelector))); browseThemesCell.setBackground(Theme.createSelectorWithBackgroundDrawable(Theme.getColor(Theme.key_windowBackgroundWhite), Theme.getColor(Theme.key_listSelector))); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java index f99edc203..e6edaac55 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java @@ -337,6 +337,8 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter. private boolean allowSwitchAccount; private boolean checkCanWrite; private boolean afterSignup; + private boolean showSetPasswordConfirm; + private int otherwiseReloginDays; private FrameLayout updateLayout; private AnimatorSet updateLayoutAnimator; @@ -1191,7 +1193,6 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter. @Override protected void dispatchDraw(Canvas canvas) { - parentPage.recyclerItemsEnterAnimator.dispatchDraw(); super.dispatchDraw(canvas); if (drawMovingViewsOverlayed()) { paint.setColor(Theme.getColor(Theme.key_windowBackgroundWhite)); @@ -1233,9 +1234,6 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter. @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); - if (parentPage != null && parentPage.recyclerItemsEnterAnimator != null) { - parentPage.recyclerItemsEnterAnimator.onDetached(); - } } @Override @@ -1784,6 +1782,8 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter. messagesCount = arguments.getInt("messagesCount", 0); hasPoll = arguments.getInt("hasPoll", 0); hasInvoice = arguments.getBoolean("hasInvoice", false); + showSetPasswordConfirm = arguments.getBoolean("showSetPasswordConfirm", showSetPasswordConfirm); + otherwiseReloginDays = arguments.getInt("otherwiseRelogin"); } if (initialDialogsType == 0) { @@ -4155,6 +4155,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter. AndroidUtilities.requestAdjustResize(getParentActivity(), classGuid); } updateVisibleRows(0, false); + } @Override diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LoginActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LoginActivity.java index b0dba751b..324244074 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LoginActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LoginActivity.java @@ -23,6 +23,7 @@ import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.graphics.Canvas; +import android.graphics.Color; import android.graphics.Outline; import android.graphics.Paint; import android.graphics.Path; @@ -66,6 +67,8 @@ import android.widget.ScrollView; import android.widget.TextView; import android.widget.Toast; +import com.google.android.exoplayer2.util.Log; + import org.telegram.PhoneFormat.PhoneFormat; import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.ApplicationLoader; @@ -113,6 +116,7 @@ import org.telegram.ui.Components.VerticalPositionAutoAnimator; import java.io.BufferedReader; import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -126,8 +130,13 @@ import java.util.TimerTask; @SuppressLint("HardwareIds") public class LoginActivity extends BaseFragment { + public final static int AUTH_TYPE_SMS = 2; + public final static int AUTH_TYPE_FLASH_CALL = 3; + public final static int AUTH_TYPE_CALL = 4; + public final static int AUTH_TYPE_MISSED_CALL = 11; + private int currentViewNum; - private SlideView[] views = new SlideView[11]; + private SlideView[] views = new SlideView[12]; private boolean restoringState; @@ -331,6 +340,7 @@ public class LoginActivity extends BaseFragment { views[8] = new LoginActivityResetWaitView(context); views[9] = new LoginActivityNewPasswordView(context, 0); views[10] = new LoginActivityNewPasswordView(context, 1); + views[11] = new LoginActivitySmsView(context, 11); for (int a = 0; a < views.length; a++) { views[a].setVisibility(a == 0 ? View.VISIBLE : View.GONE); @@ -486,7 +496,7 @@ public class LoginActivity extends BaseFragment { if (requestCode == 6) { checkPermissions = false; if (currentViewNum == 0) { - views[currentViewNum].onNextPressed(); + views[currentViewNum].onNextPressed(null); } } else if (requestCode == 7) { checkShowPermissions = false; @@ -599,7 +609,7 @@ public class LoginActivity extends BaseFragment { } else if (currentViewNum == 7 || currentViewNum == 8) { views[currentViewNum].onBackPressed(true); setPage(6, true, null, true); - } else if (currentViewNum >= 1 && currentViewNum <= 4) { + } else if ((currentViewNum >= 1 && currentViewNum <= 4) || currentViewNum == AUTH_TYPE_MISSED_CALL) { if (views[currentViewNum].onBackPressed(false)) { setPage(0, true, null, true); } @@ -608,7 +618,7 @@ public class LoginActivity extends BaseFragment { } else if (currentViewNum == 9) { views[currentViewNum].onBackPressed(true); setPage(7, true, null, true); - } else if (currentViewNum == 10 || currentViewNum == 11) { + } else if (currentViewNum == 10) { views[currentViewNum].onBackPressed(true); setPage(9, true, null, true); } @@ -664,7 +674,7 @@ public class LoginActivity extends BaseFragment { Intent mailer = new Intent(Intent.ACTION_SENDTO); mailer.setData(Uri.parse("mailto:")); - mailer.putExtra(Intent.EXTRA_EMAIL, new String[]{"login@stel.com"}); + mailer.putExtra(Intent.EXTRA_EMAIL, new String[]{banned ? "recover@telegram.org" : "login@stel.com"}); if (banned) { mailer.putExtra(Intent.EXTRA_SUBJECT, "Banned phone number: " + phoneNumber); mailer.putExtra(Intent.EXTRA_TEXT, "I'm trying to use my mobile phone number: " + phoneNumber + "\nBut Telegram says it's banned. Please help.\n\nApp version: " + version + "\nOS version: SDK " + Build.VERSION.SDK_INT + "\nDevice Name: " + Build.MANUFACTURER + Build.MODEL + "\nLocale: " + Locale.getDefault()); @@ -798,10 +808,10 @@ public class LoginActivity extends BaseFragment { }); showDialog(builder.create()); } else { - views[currentViewNum].onNextPressed(); + views[currentViewNum].onNextPressed(null); } } - + private void showEditDoneProgress(final boolean show, boolean animated) { if (doneItemAnimation != null) { doneItemAnimation.cancel(); @@ -1039,7 +1049,7 @@ public class LoginActivity extends BaseFragment { } } - private void needFinishActivity(boolean afterSignup) { + private void needFinishActivity(boolean afterSignup, boolean showSetPasswordConfirm, int otherwiseRelogin) { clearCurrentState(); if (getParentActivity() instanceof LaunchActivity) { if (newAccount) { @@ -1047,9 +1057,18 @@ public class LoginActivity extends BaseFragment { ((LaunchActivity) getParentActivity()).switchToAccount(currentAccount, false); finishFragment(); } else { - final Bundle args = new Bundle(); - args.putBoolean("afterSignup", afterSignup); - presentFragment(new DialogsActivity(args), true); + + if (afterSignup && showSetPasswordConfirm) { + TwoStepVerificationSetupActivity twoStepVerification = new TwoStepVerificationSetupActivity(TwoStepVerificationSetupActivity.TYPE_INTRO, null); + twoStepVerification.setBlockingAlert(otherwiseRelogin); + presentFragment(twoStepVerification, true); + } else { + final Bundle args = new Bundle(); + args.putBoolean("afterSignup", afterSignup); + DialogsActivity dialogsActivity = new DialogsActivity(args); + presentFragment(dialogsActivity, true); + } + NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.mainUserInfoChanged); } } else if (getParentActivity() instanceof ExternalActionActivity) { @@ -1076,17 +1095,19 @@ public class LoginActivity extends BaseFragment { ContactsController.getInstance(currentAccount).checkAppAccount(); MessagesController.getInstance(currentAccount).checkPromoInfo(true); ConnectionsManager.getInstance(currentAccount).updateDcSettings(); - needFinishActivity(afterSignup); + needFinishActivity(afterSignup, res.setup_password_required, res.otherwise_relogin_days); } private void fillNextCodeParams(Bundle params, TLRPC.TL_auth_sentCode res) { params.putString("phoneHash", res.phone_code_hash); if (res.next_type instanceof TLRPC.TL_auth_codeTypeCall) { - params.putInt("nextType", 4); + params.putInt("nextType", AUTH_TYPE_CALL); } else if (res.next_type instanceof TLRPC.TL_auth_codeTypeFlashCall) { - params.putInt("nextType", 3); + params.putInt("nextType", AUTH_TYPE_FLASH_CALL); } else if (res.next_type instanceof TLRPC.TL_auth_codeTypeSms) { - params.putInt("nextType", 2); + params.putInt("nextType", AUTH_TYPE_SMS); + } else if (res.next_type instanceof TLRPC.TL_auth_codeTypeMissedCall) { + params.putInt("nextType", AUTH_TYPE_MISSED_CALL); } if (res.type instanceof TLRPC.TL_auth_sentCodeTypeApp) { params.putInt("type", 1); @@ -1109,6 +1130,11 @@ public class LoginActivity extends BaseFragment { params.putInt("type", 2); params.putInt("length", res.type.length); setPage(2, true, params, false); + } else if (res.type instanceof TLRPC.TL_auth_sentCodeTypeMissedCall) { + params.putInt("type", AUTH_TYPE_MISSED_CALL); + params.putInt("length", res.type.length); + params.putString("prefix", res.type.prefix); + setPage(AUTH_TYPE_MISSED_CALL, true, params, false); } } } @@ -1271,6 +1297,18 @@ public class LoginActivity extends BaseFragment { }); phoneField = new HintEditText(context) { + + @Override + public boolean onKeyDown(int keyCode, KeyEvent event) { + if (keyCode == KeyEvent.KEYCODE_DEL && phoneField.length() == 0) { + codeField.requestFocus(); + codeField.setSelection(codeField.length()); + codeField.dispatchKeyEvent(event); + } + return super.onKeyDown(keyCode, event); + } + + @Override public boolean onTouchEvent(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { @@ -1371,16 +1409,7 @@ public class LoginActivity extends BaseFragment { }); phoneField.setOnEditorActionListener((textView, i, keyEvent) -> { if (i == EditorInfo.IME_ACTION_NEXT) { - onNextPressed(); - return true; - } - return false; - }); - phoneField.setOnKeyListener((v, keyCode, event) -> { - if (keyCode == KeyEvent.KEYCODE_DEL && phoneField.length() == 0) { - codeField.requestFocus(); - codeField.setSelection(codeField.length()); - codeField.dispatchKeyEvent(event); + onNextPressed(null); return true; } return false; @@ -1582,7 +1611,7 @@ public class LoginActivity extends BaseFragment { } @Override - public void onNextPressed() { + public void onNextPressed(String code) { if (getParentActivity() == null || nextPressed) { return; } @@ -1623,15 +1652,20 @@ public class LoginActivity extends BaseFragment { if (preferences.getBoolean("firstlogin", true) || getParentActivity().shouldShowRequestPermissionRationale(Manifest.permission.READ_PHONE_STATE) || getParentActivity().shouldShowRequestPermissionRationale(Manifest.permission.READ_CALL_LOG)) { preferences.edit().putBoolean("firstlogin", false).commit(); AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); - builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); - builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null); + + builder.setPositiveButton(LocaleController.getString("Contin", R.string.Continue), null); + int resId; if (!allowCall && (!allowCancelCall || !allowReadCallLog)) { builder.setMessage(LocaleController.getString("AllowReadCallAndLog", R.string.AllowReadCallAndLog)); + resId = R.raw.calls_log; } else if (!allowCancelCall || !allowReadCallLog) { builder.setMessage(LocaleController.getString("AllowReadCallLog", R.string.AllowReadCallLog)); + resId = R.raw.calls_log; } else { builder.setMessage(LocaleController.getString("AllowReadCall", R.string.AllowReadCall)); + resId = R.raw.incoming_calls; } + builder.setTopAnimation(resId, 46, false, Theme.getColor(Theme.key_dialogTopBackground)); permissionsDialog = showDialog(builder.create()); } else { try { @@ -1700,7 +1734,21 @@ public class LoginActivity extends BaseFragment { req.phone_number = phone; req.settings = new TLRPC.TL_codeSettings(); req.settings.allow_flashcall = simcardAvailable && allowCall && allowCancelCall && allowReadCallLog; + req.settings.allow_missed_call = simcardAvailable && allowCall; req.settings.allow_app_hash = ApplicationLoader.hasPlayServices; + ArrayList tokens = MessagesController.getSavedLogOutTokens(); + if (tokens != null) { + for (int i = 0; i < tokens.size(); i++) { + if (req.settings.logout_tokens == null) { + req.settings.logout_tokens = new ArrayList<>(); + } + req.settings.logout_tokens.add(tokens.get(i).future_auth_token); + } + MessagesController.saveLogOutTokens(tokens); + } + if (req.settings.logout_tokens != null) { + req.settings.flags |= 64; + } SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE); if (req.settings.allow_app_hash) { preferences.edit().putString("sms_hash", BuildVars.SMS_HASH).commit(); @@ -1743,7 +1791,27 @@ public class LoginActivity extends BaseFragment { fillNextCodeParams(params, (TLRPC.TL_auth_sentCode) response); } else { if (error.text != null) { - if (error.text.contains("PHONE_NUMBER_INVALID")) { + if (error.text.contains("SESSION_PASSWORD_NEEDED")) { + TLRPC.TL_account_getPassword req2 = new TLRPC.TL_account_getPassword(); + ConnectionsManager.getInstance(currentAccount).sendRequest(req2, (response1, error1) -> AndroidUtilities.runOnUIThread(() -> { + nextPressed = false; + showDoneButton(false, true); + if (error1 == null) { + TLRPC.TL_account_password password = (TLRPC.TL_account_password) response1; + if (!TwoStepVerificationActivity.canHandleCurrentPassword(password, true)) { + AlertsCreator.showUpdateAppAlert(getParentActivity(), LocaleController.getString("UpdateAppAlert", R.string.UpdateAppAlert), true); + return; + } + Bundle bundle = new Bundle(); + SerializedData data = new SerializedData(password.getObjectSize()); + password.serializeToStream(data); + bundle.putString("password", Utilities.bytesToHex(data.toByteArray())); + setPage(6, true, bundle, false); + } else { + needShowAlert(LocaleController.getString("AppName", R.string.AppName), error1.text); + } + }), ConnectionsManager.RequestFlagFailOnServerErrors | ConnectionsManager.RequestFlagWithoutLogin); + } else if (error.text.contains("PHONE_NUMBER_INVALID")) { needShowInvalidAlert(LoginActivity.this, req.phone_number, false); } else if (error.text.contains("PHONE_PASSWORD_FLOOD")) { needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("FloodWait", R.string.FloodWait)); @@ -1776,20 +1844,28 @@ public class LoginActivity extends BaseFragment { TelephonyManager tm = (TelephonyManager) ApplicationLoader.applicationContext.getSystemService(Context.TELEPHONY_SERVICE); if (tm.getSimState() != TelephonyManager.SIM_STATE_ABSENT && tm.getPhoneType() != TelephonyManager.PHONE_TYPE_NONE) { boolean allowCall = true; + boolean allowReadPhoneNumbers = true; if (Build.VERSION.SDK_INT >= 23) { allowCall = getParentActivity().checkSelfPermission(Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED; - if (checkShowPermissions && !allowCall) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + allowReadPhoneNumbers = getParentActivity().checkSelfPermission(Manifest.permission.READ_PHONE_NUMBERS) == PackageManager.PERMISSION_GRANTED; + } + if (checkShowPermissions && (!allowCall || !allowReadPhoneNumbers)) { permissionsShowItems.clear(); if (!allowCall) { permissionsShowItems.add(Manifest.permission.READ_PHONE_STATE); } + if (!allowReadPhoneNumbers) { + permissionsShowItems.add(Manifest.permission.READ_PHONE_NUMBERS); + } if (!permissionsShowItems.isEmpty()) { SharedPreferences preferences = MessagesController.getGlobalMainSettings(); if (preferences.getBoolean("firstloginshow", true) || getParentActivity().shouldShowRequestPermissionRationale(Manifest.permission.READ_PHONE_STATE)) { preferences.edit().putBoolean("firstloginshow", false).commit(); AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); - builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); - builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null); + + builder.setTopAnimation(R.raw.incoming_calls, 46, false, Theme.getColor(Theme.key_dialogTopBackground)); + builder.setPositiveButton(LocaleController.getString("Continue", R.string.Continue), null); builder.setMessage(LocaleController.getString("AllowFillNumber", R.string.AllowFillNumber)); permissionsShowDialog = showDialog(builder.create()); needRequestPermissions = true; @@ -1801,7 +1877,7 @@ public class LoginActivity extends BaseFragment { } } numberFilled = true; - if (!newAccount && allowCall) { + if (!newAccount && allowCall && allowReadPhoneNumbers) { String number = PhoneFormat.stripExceptNumbers(tm.getLine1Number()); String textToSet = null; boolean ok = false; @@ -1897,8 +1973,7 @@ public class LoginActivity extends BaseFragment { private String phoneHash; private String requestPhone; private String emailPhone; - private LinearLayout codeFieldContainer; - private EditTextBoldCursor[] codeField; + private CodeFieldContainer codeFieldContainer; private TextView confirmTextView; private TextView titleTextView; private ImageView blackImageView; @@ -1907,6 +1982,7 @@ public class LoginActivity extends BaseFragment { private TextView problemText; private Bundle currentParams; private ProgressView progressView; + private TextView prefixTextView; RLottieDrawable hintDrawable; @@ -1925,6 +2001,7 @@ public class LoginActivity extends BaseFragment { private int currentType; private int nextType; private String pattern = "*"; + private String prefix = ""; private String catchedPhone; private int length; @@ -1947,7 +2024,65 @@ public class LoginActivity extends BaseFragment { titleTextView.setLineSpacing(AndroidUtilities.dp(2), 1.0f); titleTextView.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL); - if (currentType == 3) { + if (currentType == AUTH_TYPE_MISSED_CALL) { + titleTextView.setText(LocaleController.getString("MissedCallDescriptionTitle", R.string.MissedCallDescriptionTitle)); + + FrameLayout frameLayout = new FrameLayout(context); + ImageView iconView1 = new ImageView(context); + ImageView iconView2 = new ImageView(context); + frameLayout.addView(iconView1); + frameLayout.addView(iconView2); + + iconView1.setImageResource(R.drawable.login_arrow1); + iconView1.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteInputFieldActivated), PorterDuff.Mode.SRC_IN)); + iconView2.setImageResource(R.drawable.login_phone1); + iconView2.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText), PorterDuff.Mode.SRC_IN)); + + addView(frameLayout, LayoutHelper.createLinear(64, 64, Gravity.CENTER_HORIZONTAL, 0, 0, 0, 0)); + addView(titleTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL | Gravity.TOP, 0, 8, 0, 0)); + + TextView subtitleTextView2 = new TextView(context); + subtitleTextView2.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText)); + subtitleTextView2.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + subtitleTextView2.setGravity(Gravity.CENTER_HORIZONTAL); + subtitleTextView2.setLineSpacing(AndroidUtilities.dp(2), 1.0f); + subtitleTextView2.setText(AndroidUtilities.replaceTags(LocaleController.getString("MissedCallDescriptionSubtitle", R.string.MissedCallDescriptionSubtitle))); + + addView(subtitleTextView2, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL | Gravity.TOP, 36, 16, 36, 0)); + + codeFieldContainer = new CodeFieldContainer(context) { + @Override + protected void processNextPressed() { + onNextPressed(null); + } + }; + + LinearLayout linearLayout = new LinearLayout(context); + linearLayout.setOrientation(LinearLayout.HORIZONTAL); + prefixTextView = new TextView(context); + prefixTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); + prefixTextView.setMaxLines(1); + prefixTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); + prefixTextView.setPadding(0, 0, 0, 0); + prefixTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); + prefixTextView.setGravity(Gravity.CENTER_VERTICAL); + + linearLayout.addView(prefixTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.CENTER_VERTICAL, 0, 0, 4, 0)); + linearLayout.addView(codeFieldContainer, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT)); + + addView(linearLayout, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, 34, Gravity.CENTER_HORIZONTAL, 0, 28, 0, 0)); + + subtitleTextView2 = new TextView(context); + subtitleTextView2.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText)); + subtitleTextView2.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + subtitleTextView2.setGravity(Gravity.CENTER_HORIZONTAL); + subtitleTextView2.setLineSpacing(AndroidUtilities.dp(2), 1.0f); + subtitleTextView2.setText(AndroidUtilities.replaceTags(LocaleController.getString("MissedCallDescriptionSubtitle2", R.string.MissedCallDescriptionSubtitle2))); + + addView(subtitleTextView2, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL | Gravity.TOP, 36, 28, 36, 12)); + + + } else if (currentType == 3) { confirmTextView.setGravity(Gravity.TOP | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT)); FrameLayout frameLayout = new FrameLayout(context); addView(frameLayout, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT)); @@ -1991,10 +2126,16 @@ public class LoginActivity extends BaseFragment { addView(titleTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL | Gravity.TOP, 0, 18, 0, 0)); addView(confirmTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL | Gravity.TOP, 0, 17, 0, 0)); } + if (currentType != AUTH_TYPE_MISSED_CALL) { + codeFieldContainer = new CodeFieldContainer(context) { + @Override + protected void processNextPressed() { + onNextPressed(null); + } + }; - codeFieldContainer = new LinearLayout(context); - codeFieldContainer.setOrientation(HORIZONTAL); - addView(codeFieldContainer, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, 36, Gravity.CENTER_HORIZONTAL)); + addView(codeFieldContainer, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, 42, Gravity.CENTER_HORIZONTAL)); + } if (currentType == 3) { codeFieldContainer.setVisibility(GONE); } @@ -2033,7 +2174,11 @@ public class LoginActivity extends BaseFragment { problemText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15); problemText.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.TOP); if (currentType == 1) { - problemText.setText(LocaleController.getString("DidNotGetTheCodeSms", R.string.DidNotGetTheCodeSms)); + if (nextType == AUTH_TYPE_FLASH_CALL || nextType == AUTH_TYPE_CALL || nextType == AUTH_TYPE_MISSED_CALL) { + problemText.setText(LocaleController.getString("DidNotGetTheCodPhone", R.string.DidNotGetTheCodePhone)); + } else { + problemText.setText(LocaleController.getString("DidNotGetTheCodeSms", R.string.DidNotGetTheCodeSms)); + } } else { problemText.setText(LocaleController.getString("DidNotGetTheCode", R.string.DidNotGetTheCode)); } @@ -2055,7 +2200,7 @@ public class LoginActivity extends BaseFragment { Intent mailer = new Intent(Intent.ACTION_SENDTO); mailer.setData(Uri.parse("mailto:")); - mailer.putExtra(Intent.EXTRA_EMAIL, new String[]{"reports@stel.com"}); + mailer.putExtra(Intent.EXTRA_EMAIL, new String[]{"sms@telegram.org"}); mailer.putExtra(Intent.EXTRA_SUBJECT, "Android registration/login issue " + version + " " + emailPhone); mailer.putExtra(Intent.EXTRA_TEXT, "Phone: " + requestPhone + "\nApp version: " + version + "\nOS version: SDK " + Build.VERSION.SDK_INT + "\nDevice Name: " + Build.MANUFACTURER + Build.MODEL + "\nLocale: " + Locale.getDefault() + "\nError: " + lastError); getContext().startActivity(Intent.createChooser(mailer, "Send email...")); @@ -2147,12 +2292,12 @@ public class LoginActivity extends BaseFragment { } needHideProgress(false); }), ConnectionsManager.RequestFlagFailOnServerErrors | ConnectionsManager.RequestFlagWithoutLogin); - needShowProgress(0); + needShowProgress(reqId); } @Override public String getHeaderName() { - if (currentType == 1) { + if (currentType == 1 || currentType == AUTH_TYPE_MISSED_CALL) { return phone; } else { return LocaleController.getString("YourCode", R.string.YourCode); @@ -2187,103 +2332,13 @@ public class LoginActivity extends BaseFragment { openTime = (int) (System.currentTimeMillis() / 1000); nextType = params.getInt("nextType"); pattern = params.getString("pattern"); + prefix = params.getString("prefix"); length = params.getInt("length"); if (length == 0) { length = 5; } - if (codeField == null || codeField.length != length) { - codeField = new EditTextBoldCursor[length]; - for (int a = 0; a < length; a++) { - final int num = a; - codeField[a] = new EditTextBoldCursor(getContext()); - codeField[a].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); - codeField[a].setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); - codeField[a].setCursorSize(AndroidUtilities.dp(20)); - codeField[a].setCursorWidth(1.5f); - - Drawable pressedDrawable = getResources().getDrawable(R.drawable.search_dark_activated).mutate(); - pressedDrawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteInputFieldActivated), PorterDuff.Mode.MULTIPLY)); - - codeField[a].setBackgroundDrawable(pressedDrawable); - codeField[a].setImeOptions(EditorInfo.IME_ACTION_NEXT | EditorInfo.IME_FLAG_NO_EXTRACT_UI); - codeField[a].setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); - codeField[a].setMaxLines(1); - codeField[a].setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); - codeField[a].setPadding(0, 0, 0, 0); - codeField[a].setGravity(Gravity.CENTER_HORIZONTAL | Gravity.TOP); - if (currentType == 3) { - codeField[a].setEnabled(false); - codeField[a].setInputType(InputType.TYPE_NULL); - codeField[a].setVisibility(GONE); - } else { - codeField[a].setInputType(InputType.TYPE_CLASS_PHONE); - } - codeFieldContainer.addView(codeField[a], LayoutHelper.createLinear(34, 36, Gravity.CENTER_HORIZONTAL, 0, 0, a != length - 1 ? 7 : 0, 0)); - codeField[a].addTextChangedListener(new TextWatcher() { - - @Override - public void beforeTextChanged(CharSequence s, int start, int count, int after) { - - } - - @Override - public void onTextChanged(CharSequence s, int start, int before, int count) { - - } - - @Override - public void afterTextChanged(Editable s) { - if (ignoreOnTextChange) { - return; - } - int len = s.length(); - if (len >= 1) { - if (len > 1) { - String text = s.toString(); - ignoreOnTextChange = true; - for (int a = 0; a < Math.min(length - num, len); a++) { - if (a == 0) { - s.replace(0, len, text.substring(a, a + 1)); - } else { - codeField[num + a].setText(text.substring(a, a + 1)); - } - } - ignoreOnTextChange = false; - } - - if (num != length - 1) { - codeField[num + 1].setSelection(codeField[num + 1].length()); - codeField[num + 1].requestFocus(); - } - if ((num == length - 1 || num == length - 2 && len >= 2) && getCode().length() == length) { - onNextPressed(); - } - } - } - }); - codeField[a].setOnKeyListener((v, keyCode, event) -> { - if (keyCode == KeyEvent.KEYCODE_DEL && codeField[num].length() == 0 && num > 0) { - codeField[num - 1].setSelection(codeField[num - 1].length()); - codeField[num - 1].requestFocus(); - codeField[num - 1].dispatchKeyEvent(event); - return true; - } - return false; - }); - codeField[a].setOnEditorActionListener((textView, i, keyEvent) -> { - if (i == EditorInfo.IME_ACTION_NEXT) { - onNextPressed(); - return true; - } - return false; - }); - } - } else { - for (int a = 0; a < codeField.length; a++) { - codeField[a].setText(""); - } - } + codeFieldContainer.setNumbersCount(length, currentType); if (progressView != null) { progressView.setVisibility(nextType != 0 ? VISIBLE : GONE); @@ -2307,10 +2362,10 @@ public class LoginActivity extends BaseFragment { confirmTextView.setText(str); if (currentType != 3) { - AndroidUtilities.showKeyboard(codeField[0]); - codeField[0].requestFocus(); + AndroidUtilities.showKeyboard(codeFieldContainer.codeField[0]); + codeFieldContainer.codeField[0].requestFocus(); } else { - AndroidUtilities.hideKeyboard(codeField[0]); + AndroidUtilities.hideKeyboard(codeFieldContainer.codeField[0]); } destroyTimer(); @@ -2330,15 +2385,9 @@ public class LoginActivity extends BaseFragment { } String callLogNumber = restore ? AndroidUtilities.obtainLoginPhoneCall(pattern) : null; if (callLogNumber != null) { - ignoreOnTextChange = true; - codeField[0].setText(callLogNumber); - ignoreOnTextChange = false; - onNextPressed(); + onNextPressed(callLogNumber); } else if (catchedPhone != null) { - ignoreOnTextChange = true; - codeField[0].setText(catchedPhone); - ignoreOnTextChange = false; - onNextPressed(); + onNextPressed(catchedPhone); } else { createTimer(); } @@ -2359,8 +2408,8 @@ public class LoginActivity extends BaseFragment { } } if (savedCode != null) { - codeField[0].setText(savedCode); - onNextPressed(); + codeFieldContainer.setCode(savedCode); + onNextPressed(null); } else { createTimer(); } @@ -2374,6 +2423,23 @@ public class LoginActivity extends BaseFragment { problemText.setVisibility(GONE); createCodeTimer(); } + + if (currentType == AUTH_TYPE_MISSED_CALL) { + String pref = prefix; + for (int i = 0; i < length; i++) { + pref += "0"; + } + pref = PhoneFormat.getInstance().format("+" + pref); + for (int i = 0; i < length; i++) { + int index = pref.lastIndexOf("0"); + if (index >= 0) { + pref = pref.substring(0, index); + } + } + pref = pref.replaceAll("\\)", ""); + pref = pref.replaceAll("\\(", ""); + prefixTextView.setText(pref); + } } private void createCodeTimer() { @@ -2495,24 +2561,22 @@ public class LoginActivity extends BaseFragment { } } - private String getCode() { - if (codeField == null) { - return ""; - } - StringBuilder codeBuilder = new StringBuilder(); - for (int a = 0; a < codeField.length; a++) { - codeBuilder.append(PhoneFormat.stripExceptNumbers(codeField[a].getText().toString())); - } - return codeBuilder.toString(); - } @Override - public void onNextPressed() { - if (nextPressed || currentViewNum < 1 || currentViewNum > 4) { - return; + public void onNextPressed(String code) { + if (currentViewNum == AUTH_TYPE_MISSED_CALL) { + if (nextPressed) { + return; + } + } else { + if (nextPressed || currentViewNum < 1 || currentViewNum > 4) { + return; + } } - String code = getCode(); + if (code == null) { + code = codeFieldContainer.getCode(); + } if (TextUtils.isEmpty(code)) { onFieldError(codeFieldContainer); return; @@ -2533,6 +2597,7 @@ public class LoginActivity extends BaseFragment { destroyTimer(); int reqId = ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { boolean ok = false; + if (error == null) { nextPressed = false; ok = true; @@ -2599,10 +2664,10 @@ public class LoginActivity extends BaseFragment { needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("InvalidPhoneNumber", R.string.InvalidPhoneNumber)); } else if (error.text.contains("PHONE_CODE_EMPTY") || error.text.contains("PHONE_CODE_INVALID")) { needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("InvalidCode", R.string.InvalidCode)); - for (int a = 0; a < codeField.length; a++) { - codeField[a].setText(""); + for (int a = 0; a < codeFieldContainer.codeField.length; a++) { + codeFieldContainer.codeField[a].setText(""); } - codeField[0].requestFocus(); + codeFieldContainer.codeField[0].requestFocus(); } else if (error.text.contains("PHONE_CODE_EXPIRED")) { onBackPressed(true); setPage(0, true, null, true); @@ -2687,12 +2752,12 @@ public class LoginActivity extends BaseFragment { hintDrawable.setCurrentFrame(0); } AndroidUtilities.runOnUIThread(() -> { - if (codeField != null) { - for (int a = codeField.length - 1; a >= 0; a--) { - if (a == 0 || codeField[a].length() != 0) { - codeField[a].requestFocus(); - codeField[a].setSelection(codeField[a].length()); - AndroidUtilities.showKeyboard(codeField[a]); + if (codeFieldContainer.codeField != null) { + for (int a = codeFieldContainer.codeField.length - 1; a >= 0; a--) { + if (a == 0 || codeFieldContainer.codeField[a].length() != 0) { + codeFieldContainer.codeField[a].requestFocus(); + codeFieldContainer.codeField[a].setSelection(codeFieldContainer.codeField[a].length()); + AndroidUtilities.showKeyboard(codeFieldContainer.codeField[a]); break; } } @@ -2705,12 +2770,12 @@ public class LoginActivity extends BaseFragment { @Override public void didReceivedNotification(int id, int account, Object... args) { - if (!waitingForEvent || codeField == null) { + if (!waitingForEvent || codeFieldContainer.codeField == null) { return; } if (id == NotificationCenter.didReceiveSmsCode) { - codeField[0].setText("" + args[0]); - onNextPressed(); + codeFieldContainer.setText("" + args[0]); + onNextPressed(null); } else if (id == NotificationCenter.didReceiveCall) { String num = "" + args[0]; if (!AndroidUtilities.checkPhonePattern(pattern, num)) { @@ -2720,16 +2785,13 @@ public class LoginActivity extends BaseFragment { catchedPhone = num; AndroidUtilities.endIncomingCall(); } - ignoreOnTextChange = true; - codeField[0].setText(num); - ignoreOnTextChange = false; - onNextPressed(); + onNextPressed(num); } } @Override public void saveStateParams(Bundle bundle) { - String code = getCode(); + String code = codeFieldContainer.getCode(); if (code.length() != 0) { bundle.putString("smsview_code_" + currentType, code); } @@ -2758,8 +2820,8 @@ public class LoginActivity extends BaseFragment { catchedPhone = catched; } String code = bundle.getString("smsview_code_" + currentType); - if (code != null && codeField != null) { - codeField[0].setText(code); + if (code != null && codeFieldContainer.codeField != null) { + codeFieldContainer.setText(code); } int t = bundle.getInt("time"); if (t != 0) { @@ -2820,7 +2882,7 @@ public class LoginActivity extends BaseFragment { addView(codeField, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 36, Gravity.CENTER_HORIZONTAL, 0, 20, 0, 0)); codeField.setOnEditorActionListener((textView, i, keyEvent) -> { if (i == EditorInfo.IME_ACTION_NEXT) { - onNextPressed(); + onNextPressed(null); return true; } return false; @@ -2995,7 +3057,7 @@ public class LoginActivity extends BaseFragment { } @Override - public void onNextPressed() { + public void onNextPressed(String code) { if (nextPressed) { return; } @@ -3030,7 +3092,7 @@ public class LoginActivity extends BaseFragment { ConnectionsManager.getInstance(currentAccount).sendRequest(getPasswordReq, (response2, error2) -> AndroidUtilities.runOnUIThread(() -> { if (error2 == null) { currentPassword = (TLRPC.TL_account_password) response2; - onNextPressed(); + onNextPressed(null); } }), ConnectionsManager.RequestFlagWithoutLogin); return; @@ -3333,7 +3395,7 @@ public class LoginActivity extends BaseFragment { addView(codeField, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 36, Gravity.CENTER_HORIZONTAL, 0, 20, 0, 0)); codeField.setOnEditorActionListener((textView, i, keyEvent) -> { if (i == EditorInfo.IME_ACTION_NEXT) { - onNextPressed(); + onNextPressed(null); return true; } return false; @@ -3404,12 +3466,12 @@ public class LoginActivity extends BaseFragment { } @Override - public void onNextPressed() { + public void onNextPressed(String code) { if (nextPressed) { return; } - String code = codeField.getText().toString(); + code = codeField.getText().toString(); if (code.length() == 0) { onPasscodeError(false); return; @@ -3418,12 +3480,13 @@ public class LoginActivity extends BaseFragment { needShowProgress(0); TLRPC.TL_auth_checkRecoveryPassword req = new TLRPC.TL_auth_checkRecoveryPassword(); req.code = code; + String finalCode = code; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { needHideProgress(false); nextPressed = false; if (response instanceof TLRPC.TL_boolTrue) { Bundle params = new Bundle(); - params.putString("emailCode", code); + params.putString("emailCode", finalCode); params.putString("password", passwordString); setPage(9, true, params, false); } else { @@ -3542,7 +3605,7 @@ public class LoginActivity extends BaseFragment { codeField[1].requestFocus(); return true; } else if (i == EditorInfo.IME_ACTION_NEXT) { - onNextPressed(); + onNextPressed(null); return true; } return false; @@ -3631,12 +3694,12 @@ public class LoginActivity extends BaseFragment { } @Override - public void onNextPressed() { + public void onNextPressed(String code) { if (nextPressed) { return; } - String code = codeField[0].getText().toString(); + code = codeField[0].getText().toString(); if (code.length() == 0) { onPasscodeError(false, 0); return; @@ -3824,7 +3887,7 @@ public class LoginActivity extends BaseFragment { if (needAccept) { builder.setPositiveButton(LocaleController.getString("Accept", R.string.Accept), (dialog, which) -> { currentTermsOfService.popup = false; - onNextPressed(); + onNextPressed(null); }); builder.setNegativeButton(LocaleController.getString("Decline", R.string.Decline), (dialog, which) -> { AlertDialog.Builder builder1 = new AlertDialog.Builder(getParentActivity()); @@ -3832,7 +3895,7 @@ public class LoginActivity extends BaseFragment { builder1.setMessage(LocaleController.getString("TosDecline", R.string.TosDecline)); builder1.setPositiveButton(LocaleController.getString("SignUp", R.string.SignUp), (dialog1, which1) -> { currentTermsOfService.popup = false; - onNextPressed(); + onNextPressed(null); }); builder1.setNegativeButton(LocaleController.getString("Decline", R.string.Decline), (dialog12, which12) -> { onBackPressed(true); @@ -4003,7 +4066,7 @@ public class LoginActivity extends BaseFragment { editTextContainer.addView(lastNameField, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 36, Gravity.TOP | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT), LocaleController.isRTL ? 0 : 85, 51, LocaleController.isRTL ? 85 : 0, 0)); lastNameField.setOnEditorActionListener((textView, i, keyEvent) -> { if (i == EditorInfo.IME_ACTION_DONE || i == EditorInfo.IME_ACTION_NEXT) { - onNextPressed(); + onNextPressed(null); return true; } return false; @@ -4189,7 +4252,7 @@ public class LoginActivity extends BaseFragment { } @Override - public void onNextPressed() { + public void onNextPressed(String code) { if (nextPressed) { return; } @@ -4393,10 +4456,10 @@ public class LoginActivity extends BaseFragment { arrayList.add(new ThemeDescription(smsView1.confirmTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6)); arrayList.add(new ThemeDescription(smsView1.titleTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); - if (smsView1.codeField != null) { - for (int a = 0; a < smsView1.codeField.length; a++) { - arrayList.add(new ThemeDescription(smsView1.codeField[a], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); - arrayList.add(new ThemeDescription(smsView1.codeField[a], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated)); + if (smsView1.codeFieldContainer.codeField != null) { + for (int a = 0; a < smsView1.codeFieldContainer.codeField.length; a++) { + arrayList.add(new ThemeDescription(smsView1.codeFieldContainer.codeField[a], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); + arrayList.add(new ThemeDescription(smsView1.codeFieldContainer.codeField[a], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated)); } } arrayList.add(new ThemeDescription(smsView1.timeText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6)); @@ -4408,10 +4471,10 @@ public class LoginActivity extends BaseFragment { arrayList.add(new ThemeDescription(smsView2.confirmTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6)); arrayList.add(new ThemeDescription(smsView2.titleTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); - if (smsView2.codeField != null) { - for (int a = 0; a < smsView2.codeField.length; a++) { - arrayList.add(new ThemeDescription(smsView2.codeField[a], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); - arrayList.add(new ThemeDescription(smsView2.codeField[a], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated)); + if (smsView2.codeFieldContainer.codeField != null) { + for (int a = 0; a < smsView2.codeFieldContainer.codeField.length; a++) { + arrayList.add(new ThemeDescription(smsView2.codeFieldContainer.codeField[a], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); + arrayList.add(new ThemeDescription(smsView2.codeFieldContainer.codeField[a], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated)); } } arrayList.add(new ThemeDescription(smsView2.timeText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6)); @@ -4423,10 +4486,10 @@ public class LoginActivity extends BaseFragment { arrayList.add(new ThemeDescription(smsView3.confirmTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6)); arrayList.add(new ThemeDescription(smsView3.titleTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); - if (smsView3.codeField != null) { - for (int a = 0; a < smsView3.codeField.length; a++) { - arrayList.add(new ThemeDescription(smsView3.codeField[a], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); - arrayList.add(new ThemeDescription(smsView3.codeField[a], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated)); + if (smsView3.codeFieldContainer.codeField != null) { + for (int a = 0; a < smsView3.codeFieldContainer.codeField.length; a++) { + arrayList.add(new ThemeDescription(smsView3.codeFieldContainer.codeField[a], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); + arrayList.add(new ThemeDescription(smsView3.codeFieldContainer.codeField[a], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated)); } } arrayList.add(new ThemeDescription(smsView3.timeText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6)); @@ -4438,10 +4501,10 @@ public class LoginActivity extends BaseFragment { arrayList.add(new ThemeDescription(smsView4.confirmTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6)); arrayList.add(new ThemeDescription(smsView4.titleTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); - if (smsView4.codeField != null) { - for (int a = 0; a < smsView4.codeField.length; a++) { - arrayList.add(new ThemeDescription(smsView4.codeField[a], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); - arrayList.add(new ThemeDescription(smsView4.codeField[a], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated)); + if (smsView4.codeFieldContainer.codeField != null) { + for (int a = 0; a < smsView4.codeFieldContainer.codeField.length; a++) { + arrayList.add(new ThemeDescription(smsView4.codeFieldContainer.codeField[a], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); + arrayList.add(new ThemeDescription(smsView4.codeFieldContainer.codeField[a], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated)); } } arrayList.add(new ThemeDescription(smsView4.timeText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ManageLinksActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ManageLinksActivity.java index ff0b533ff..1b7bc509e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ManageLinksActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ManageLinksActivity.java @@ -547,19 +547,7 @@ public class ManageLinksActivity extends BaseFragment { FrameLayout frameLayout = (FrameLayout) fragmentView; - listView = new RecyclerListView(context) { - @Override - protected void dispatchDraw(Canvas canvas) { - recyclerItemsEnterAnimator.dispatchDraw(); - super.dispatchDraw(canvas); - } - - @Override - protected void onDetachedFromWindow() { - super.onDetachedFromWindow(); - recyclerItemsEnterAnimator.onDetached(); - } - }; + listView = new RecyclerListView(context); LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false) { @Override public boolean supportsPredictiveItemAnimations() { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/MediaCalendarActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/MediaCalendarActivity.java deleted file mode 100644 index 4b6d57f30..000000000 --- a/TMessagesProj/src/main/java/org/telegram/ui/MediaCalendarActivity.java +++ /dev/null @@ -1,642 +0,0 @@ -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/PassportActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/PassportActivity.java index 5a9beecbd..b8f6adc25 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PassportActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PassportActivity.java @@ -1145,7 +1145,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter return; } if (currentActivityType == TYPE_PHONE_VERIFICATION) { - views[currentViewNum].onNextPressed(); + views[currentViewNum].onNextPressed(null); } else { final Runnable finishRunnable = () -> finishFragment(); final ErrorRunnable errorRunnable = new ErrorRunnable() { @@ -7385,7 +7385,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter Intent mailer = new Intent(Intent.ACTION_SENDTO); mailer.setData(Uri.parse("mailto:")); - mailer.putExtra(Intent.EXTRA_EMAIL, new String[]{"reports@stel.com"}); + mailer.putExtra(Intent.EXTRA_EMAIL, new String[]{"sms@telegram.org"}); mailer.putExtra(Intent.EXTRA_SUBJECT, "Android registration/login issue " + version + " " + phone); mailer.putExtra(Intent.EXTRA_TEXT, "Phone: " + phone + "\nApp version: " + version + "\nOS version: SDK " + Build.VERSION.SDK_INT + "\nDevice Name: " + Build.MANUFACTURER + Build.MODEL + "\nLocale: " + Locale.getDefault() + "\nError: " + lastError); getContext().startActivity(Intent.createChooser(mailer, "Send email...")); @@ -7565,7 +7565,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter codeField[num + 1].requestFocus(); } if ((num == length - 1 || num == length - 2 && len >= 2) && getCode().length() == length) { - onNextPressed(); + onNextPressed(null); } } } @@ -7581,7 +7581,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter }); codeField[a].setOnEditorActionListener((textView, i, keyEvent) -> { if (i == EditorInfo.IME_ACTION_NEXT) { - onNextPressed(); + onNextPressed(null); return true; } return false; @@ -7780,11 +7780,13 @@ public class PassportActivity extends BaseFragment implements NotificationCenter } @Override - public void onNextPressed() { + public void onNextPressed(String code) { if (nextPressed) { return; } - String code = getCode(); + if (code == null) { + code = getCode(); + } if (TextUtils.isEmpty(code)) { AndroidUtilities.shakeView(codeFieldContainer, 2, 0); return; @@ -7915,7 +7917,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter } if (id == NotificationCenter.didReceiveSmsCode) { codeField[0].setText("" + args[0]); - onNextPressed(); + onNextPressed(null); } else if (id == NotificationCenter.didReceiveCall) { String num = "" + args[0]; if (!AndroidUtilities.checkPhonePattern(pattern, num)) { @@ -7924,7 +7926,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter ignoreOnTextChange = true; codeField[0].setText(num); ignoreOnTextChange = false; - onNextPressed(); + onNextPressed(null); } } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java index fa49254d7..12bf8a79a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java @@ -9802,12 +9802,13 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat bottomLayout.setVisibility(View.GONE); } if (slideshowMessageId == 0) { + boolean noforwards = MessagesController.getInstance(UserConfig.selectedAccount).isChatNoForwards(messageObject.getChatId()); imagesArr.add(messageObject); if (messageObject.eventId != 0) { needSearchImageInArr = false; } else if (currentAnimation != null) { needSearchImageInArr = false; - if (messageObject.canForwardMessage()) { + if (messageObject.canForwardMessage() && !noforwards) { setItemVisible(sendItem, true, false); } } else if (!messageObject.scheduled && !(messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaInvoice) && !(messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaWebPage) && (messageObject.messageOwner.action == null || messageObject.messageOwner.action instanceof TLRPC.TL_messageActionEmpty)) { @@ -9817,7 +9818,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat menuItem.showSubItem(gallery_menu_showinchat); menuItem.showSubItem(gallery_menu_showall); } - setItemVisible(sendItem, true, false); + setItemVisible(sendItem, !noforwards, false); } else if (isEmbedVideo && messageObject.eventId == 0) { setItemVisible(sendItem, true, false); } @@ -9869,7 +9870,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat startOffset = object.starOffset; } menuItem.showSubItem(gallery_menu_showinchat); - if (openingObject.canForwardMessage()) { + if (openingObject.canForwardMessage() && !MessagesController.getInstance(UserConfig.selectedAccount).isChatNoForwards(openingObject.getChatId())) { setItemVisible(sendItem, true, false); } if (openingObject.canPreviewDocument()) { @@ -10061,7 +10062,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat nameTextView.setText(""); dateTextView.setText(""); } else { - if (newMessageObject.isNewGif()) { + if (newMessageObject.isNewGif() && allowShare) { menuItem.showSubItem(gallery_menu_savegif); } if (newMessageObject.canDeleteMessage(parentChatActivity != null && parentChatActivity.isInScheduleMode(), null) && slideshowMessageId == 0) { @@ -10069,11 +10070,17 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat } else { menuItem.hideSubItem(gallery_menu_delete); } + boolean noforwards = MessagesController.getInstance(UserConfig.selectedAccount).isChatNoForwards(newMessageObject.getChatId()); if (isEmbedVideo) { menuItem.showSubItem(gallery_menu_openin); setItemVisible(pipItem, true, false); } else if (isVideo) { - menuItem.showSubItem(gallery_menu_openin); + if (!noforwards || (slideshowMessageId == 0 ? newMessageObject.messageOwner.media.webpage != null && newMessageObject.messageOwner.media.webpage.url != null : + imagesArr.get(0).messageOwner.media.webpage != null && imagesArr.get(0).messageOwner.media.webpage.url != null)) { + menuItem.showSubItem(gallery_menu_openin); + } else { + menuItem.hideSubItem(gallery_menu_openin); + } final boolean masksItemVisible = masksItem.getVisibility() == View.VISIBLE; if (masksItemVisible) { setItemVisible(masksItem, false, false); @@ -10090,6 +10097,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat menuItem.hideSubItem(gallery_menu_masks2); } } else { + speedGap.setVisibility(View.GONE); menuItem.hideSubItem(gallery_menu_openin); final boolean pipItemVisible = pipItem.getVisibility() == View.VISIBLE; final boolean shouldMasksItemBeVisible = newMessageObject.hasAttachedStickers() && !DialogObject.isEncryptedDialog(newMessageObject.getDialogId()); @@ -10114,7 +10122,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat nameTextView.setText("", animatedLocal); } } else { - TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(newMessageObject.getChatId()); + TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-newMessageObject.getSenderId()); if (ChatObject.isChannel(chat) && chat.megagroup && newMessageObject.isForwardedChannelPost()) { chat = MessagesController.getInstance(currentAccount).getChat(newMessageObject.messageOwner.fwd_from.from_id.channel_id); } @@ -10155,9 +10163,11 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat if (!newMessageObject.canDeleteMessage(parentChatActivity != null && parentChatActivity.isInScheduleMode(), null)) { menuItem.hideSubItem(gallery_menu_delete); } - allowShare = true; + allowShare = !MessagesController.getInstance(UserConfig.selectedAccount).isChatNoForwards(-currentDialogId); bottomButtonsLayout.setVisibility(View.VISIBLE); paintButton.setVisibility(View.GONE); + shareItem.setVisibility(allowShare ? View.VISIBLE : View.GONE); + shareButton.setVisibility(allowShare ? View.VISIBLE : View.GONE); actionBar.setTitle(LocaleController.getString("AttachGif", R.string.AttachGif)); } else { if (totalImagesCount + totalImagesCountMerge != 0 && !needSearchImageInArr) { @@ -10228,10 +10238,11 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat } else if (newMessageObject.getDocument() != null) { actionBar.setTitle(LocaleController.getString("AttachDocument", R.string.AttachDocument)); } - if (DialogObject.isEncryptedDialog(currentDialogId) && !isEmbedVideo) { + if (DialogObject.isEncryptedDialog(currentDialogId) && !isEmbedVideo || + MessagesController.getInstance(currentAccount).isChatNoForwards(newMessageObject.getChatId())) { setItemVisible(sendItem, false, false); } - if (isEmbedVideo || newMessageObject.messageOwner.ttl != 0 && newMessageObject.messageOwner.ttl < 60 * 60) { + if (isEmbedVideo || newMessageObject.messageOwner.ttl != 0 && newMessageObject.messageOwner.ttl < 60 * 60 || MessagesController.getInstance(UserConfig.selectedAccount).isChatNoForwards(newMessageObject.getChatId())) { allowShare = false; menuItem.hideSubItem(gallery_menu_save); bottomButtonsLayout.setVisibility(View.GONE); @@ -10293,8 +10304,13 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat } else { actionBar.setTitle(LocaleController.formatString("Of", R.string.Of, switchingToIndex + 1, imagesArrLocations.size())); } - menuItem.showSubItem(gallery_menu_save); - allowShare = true; + boolean noforwards = avatarsDialogId != 0 && MessagesController.getInstance(currentAccount).isChatNoForwards(-avatarsDialogId); + if (noforwards) + menuItem.hideSubItem(gallery_menu_save); + else menuItem.showSubItem(gallery_menu_save); + allowShare = !noforwards; + shareButton.setVisibility(allowShare ? View.VISIBLE : View.GONE); + bottomButtonsLayout.setVisibility(!videoPlayerControlVisible ? View.VISIBLE : View.GONE); if (bottomButtonsLayout.getVisibility() == View.VISIBLE) { menuItem.hideSubItem(gallery_menu_share); @@ -10506,7 +10522,10 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat caption = pageBlocksAdapter.getCaption(switchingToIndex); isVideo = pageBlocksAdapter.isVideo(switchingToIndex); if (isVideo) { - menuItem.showSubItem(gallery_menu_openin); + if (!MessagesController.getInstance(UserConfig.selectedAccount).isChatNoForwards(-currentDialogId)) + menuItem.showSubItem(gallery_menu_openin); + else menuItem.hideSubItem(gallery_menu_openin); + if (!pipAvailable) { pipItem.setEnabled(false); setItemVisible(pipItem, true, true, 0.5f); @@ -10522,13 +10541,16 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat } bottomLayout.setTag(null); - allowShare = true; - shareItem.setVisibility(View.VISIBLE); + allowShare = !MessagesController.getInstance(UserConfig.selectedAccount).isChatNoForwards(-currentDialogId); + shareItem.setVisibility(allowShare ? View.VISIBLE : View.GONE); if (currentAnimation != null) { - menuItem.setVisibility(View.VISIBLE); menuItem.hideSubItem(gallery_menu_save); - menuItem.showSubItem(gallery_menu_savegif); + if (allowShare) { + menuItem.showSubItem(gallery_menu_savegif); + } else { + menuItem.hideSubItem(gallery_menu_savegif); + } actionBar.setTitle(LocaleController.getString("AttachGif", R.string.AttachGif)); } else { menuItem.setVisibility(View.VISIBLE); @@ -10642,7 +10664,11 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat isVideo = newMessageObject.isVideo(); if (sharedMediaType == MediaDataController.MEDIA_FILE) { if (canZoom = newMessageObject.canPreviewDocument()) { - menuItem.showSubItem(gallery_menu_save); + if (allowShare) { + menuItem.showSubItem(gallery_menu_save); + } else { + menuItem.hideSubItem(gallery_menu_save); + } setDoubleTapEnabled(true); } else { menuItem.hideSubItem(gallery_menu_save); @@ -10650,10 +10676,12 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat } } if (isVideo || isEmbedVideo) { - menuItem.showSubItem(gallery_menu_speed); speedGap.setVisibility(View.VISIBLE); + menuItem.showSubItem(gallery_menu_speed); } else { menuItem.hideSubItem(gallery_menu_speed); + speedGap.setVisibility(View.GONE); + menuItem.checkHideMenuItem(); } } else if (!secureDocuments.isEmpty()) { if (index < 0 || index >= secureDocuments.size()) { @@ -11994,7 +12022,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat } else { windowLayoutParams.flags = WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; } - if (chatActivity != null && chatActivity.getCurrentEncryptedChat() != null) { + if (chatActivity != null && chatActivity.getCurrentEncryptedChat() != null || + avatarsDialogId != 0 && MessagesController.getInstance(currentAccount).isChatNoForwards(-avatarsDialogId) || + messageObject != null && MessagesController.getInstance(currentAccount).isChatNoForwards(messageObject.getChatId())) { windowLayoutParams.flags |= WindowManager.LayoutParams.FLAG_SECURE; } else { windowLayoutParams.flags &=~ WindowManager.LayoutParams.FLAG_SECURE; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java index af95ed943..e90bfb4d7 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java @@ -148,6 +148,7 @@ import org.telegram.ui.Components.CombinedDrawable; import org.telegram.ui.Components.CrossfadeDrawable; import org.telegram.ui.Components.CubicBezierInterpolator; import org.telegram.ui.Components.FragmentContextView; +import org.telegram.ui.Components.HintView; import org.telegram.ui.Components.IdenticonDrawable; import org.telegram.ui.Components.ImageUpdater; import org.telegram.ui.Components.LayoutHelper; @@ -207,6 +208,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. private RLottieDrawable cameraDrawable; + private HintView fwdRestrictedHint; private FrameLayout avatarContainer; private FrameLayout avatarContainer2; private AvatarImageView avatarImage; @@ -1999,7 +2001,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. if (pinchToZoomHelper.isInOverlayMode()) { return pinchToZoomHelper.onTouchEvent(ev); } - if (sharedMediaLayout != null && sharedMediaLayout.isInFastScroll() && sharedMediaLayout.getY() == 0) { + if (sharedMediaLayout != null && sharedMediaLayout.isInFastScroll() && sharedMediaLayout.isPinnedToTop()) { return sharedMediaLayout.dispatchFastScrollEvent(ev); } if (sharedMediaLayout != null && sharedMediaLayout.checkPinchToZoom(ev)) { @@ -2087,7 +2089,11 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. allowPullingDown = true; isPulledDown = true; if (otherItem != null) { - otherItem.showSubItem(gallery_menu_save); + if (!getMessagesController().isChatNoForwards(currentChat)) { + otherItem.showSubItem(gallery_menu_save); + } else { + otherItem.hideSubItem(gallery_menu_save); + } if (imageUpdater != null) { otherItem.showSubItem(edit_avatar); otherItem.showSubItem(delete_avatar); @@ -3190,10 +3196,14 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { + if (fwdRestrictedHint != null) { + fwdRestrictedHint.hide(); + } checkListViewScroll(); if (participantsMap != null && !usersEndReached && layoutManager.findLastVisibleItemPosition() > membersEndRow - 8) { getChannelParticipants(false); } + sharedMediaLayout.setPinnedToTop(sharedMediaLayout.getY() == 0); } }); @@ -3297,6 +3307,10 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. updateSelectedMediaTabText(); + fwdRestrictedHint = new HintView(getParentActivity(), 9); + fwdRestrictedHint.setAlpha(0); + frameLayout.addView(fwdRestrictedHint, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 12, 0, 12, 0)); + sharedMediaLayout.setForwardRestrictedHint(fwdRestrictedHint); ViewGroup decorView; if (Build.VERSION.SDK_INT >= 21) { @@ -4269,7 +4283,11 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. if (allowPullingDown && (openingAvatar || expandProgress >= 0.33f)) { if (!isPulledDown) { if (otherItem != null) { - otherItem.showSubItem(gallery_menu_save); + if (!getMessagesController().isChatNoForwards(currentChat)) { + otherItem.showSubItem(gallery_menu_save); + } else { + otherItem.hideSubItem(gallery_menu_save); + } if (imageUpdater != null) { otherItem.showSubItem(add_photo); otherItem.showSubItem(edit_avatar); @@ -6137,6 +6155,10 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. } else { otherItem.addSubItem(gallery_menu_save, R.drawable.msg_gallery, LocaleController.getString("SaveToGallery", R.string.SaveToGallery)); } + if (getMessagesController().isChatNoForwards(currentChat)) { + otherItem.hideSubItem(gallery_menu_save); + } + if (selfUser) { otherItem.addSubItem(logout, R.drawable.msg_leave, LocaleController.getString("LogOut", R.string.LogOut)); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/SessionBottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/SessionBottomSheet.java new file mode 100644 index 000000000..5b2f8352f --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/SessionBottomSheet.java @@ -0,0 +1,419 @@ +package org.telegram.ui; + +import android.content.Context; +import android.content.DialogInterface; +import android.graphics.Canvas; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffColorFilter; +import android.graphics.drawable.Drawable; +import android.util.TypedValue; +import android.view.Gravity; +import android.view.View; +import android.widget.FrameLayout; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.ScrollView; +import android.widget.TextView; + +import androidx.core.content.ContextCompat; +import androidx.core.graphics.ColorUtils; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.ApplicationLoader; +import org.telegram.messenger.LocaleController; +import org.telegram.messenger.R; +import org.telegram.tgnet.ConnectionsManager; +import org.telegram.tgnet.TLRPC; +import org.telegram.ui.ActionBar.AlertDialog; +import org.telegram.ui.ActionBar.BaseFragment; +import org.telegram.ui.ActionBar.BottomSheet; +import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.Cells.TextCheckCell2; +import org.telegram.ui.Components.BulletinFactory; +import org.telegram.ui.Components.LayoutHelper; +import org.telegram.ui.Components.RLottieImageView; +import org.telegram.ui.Components.Switch; + +public class SessionBottomSheet extends BottomSheet { + + TLRPC.TL_authorization session; + BaseFragment parentFragment; + RLottieImageView imageView; + + public SessionBottomSheet(BaseFragment fragment, TLRPC.TL_authorization session, boolean isCurrentSession, Callback callback) { + super(fragment.getParentActivity(), false); + setOpenNoDelay(true); + Context context = fragment.getParentActivity(); + this.session = session; + this.parentFragment = fragment; + + LinearLayout linearLayout = new LinearLayout(context); + linearLayout.setOrientation(LinearLayout.VERTICAL); + + imageView = new RLottieImageView(context); + imageView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + if (!imageView.isPlaying() && imageView.getAnimatedDrawable() != null) { + imageView.getAnimatedDrawable().setCurrentFrame(40); + imageView.playAnimation(); + } + } + }); + imageView.setScaleType(ImageView.ScaleType.CENTER); + linearLayout.addView(imageView, LayoutHelper.createLinear(70, 70, Gravity.CENTER_HORIZONTAL, 0, 16, 0, 0)); + + TextView nameView = new TextView(context); + nameView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20); + nameView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); + nameView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); + nameView.setGravity(Gravity.CENTER); + linearLayout.addView(nameView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 21, 12, 21, 0)); + + TextView timeView = new TextView(context); + timeView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText)); + timeView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13); + timeView.setGravity(Gravity.CENTER); + linearLayout.addView(timeView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 21, 4, 21, 21)); + + + String timeText; + if ((session.flags & 1) != 0) { + timeText = LocaleController.getString("Online", R.string.Online); + } else { + timeText = LocaleController.stringForMessageListDate(session.date_active); + } + timeView.setText(timeText); + + StringBuilder stringBuilder = new StringBuilder(); + if (session.device_model.length() != 0) { + stringBuilder.append(session.device_model); + } + if (stringBuilder.length() == 0) { + if (session.platform.length() != 0) { + stringBuilder.append(session.platform); + } + if (session.system_version.length() != 0) { + if (session.platform.length() != 0) { + stringBuilder.append(" "); + } + stringBuilder.append(session.system_version); + } + } + nameView.setText(stringBuilder); + setAnimation(session, imageView); + + ItemView applicationItemView = new ItemView(context, false); + stringBuilder = new StringBuilder(); + stringBuilder.append(session.app_name); + stringBuilder.append(" ").append(session.app_version); + applicationItemView.valueText.setText(stringBuilder); + Drawable drawable = ContextCompat.getDrawable(context, R.drawable.menu_devices).mutate(); + drawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteGrayIcon), PorterDuff.Mode.SRC_IN)); + applicationItemView.iconView.setImageDrawable(drawable); + applicationItemView.descriptionText.setText(LocaleController.getString("Application", R.string.Application)); + + linearLayout.addView(applicationItemView); + + ItemView prevItem = applicationItemView; + if (session.country.length() != 0) { + ItemView locationItemView = new ItemView(context, false); + locationItemView.valueText.setText(session.country); + drawable = ContextCompat.getDrawable(context, R.drawable.menu_location).mutate(); + drawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteGrayIcon), PorterDuff.Mode.SRC_IN)); + locationItemView.iconView.setImageDrawable(drawable); + locationItemView.descriptionText.setText(LocaleController.getString("Location", R.string.Location)); + + locationItemView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + copyText(session.country); + } + }); + locationItemView.setOnLongClickListener(new View.OnLongClickListener() { + @Override + public boolean onLongClick(View view) { + copyText(session.country); + return true; + } + }); + locationItemView.setBackground(Theme.createSelectorDrawable(Theme.getColor(Theme.key_listSelector), 2)); + + linearLayout.addView(locationItemView); + if (prevItem != null) { + prevItem.needDivider = true; + } + prevItem = locationItemView; + } + + if (session.ip.length() != 0) { + ItemView locationItemView = new ItemView(context, false); + locationItemView.valueText.setText(session.ip); + drawable = ContextCompat.getDrawable(context, R.drawable.menu_language).mutate(); + drawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteGrayIcon), PorterDuff.Mode.SRC_IN)); + locationItemView.iconView.setImageDrawable(drawable); + locationItemView.descriptionText.setText(LocaleController.getString("IpAddress", R.string.IpAddress)); + + + locationItemView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + copyText(session.ip); + } + }); + locationItemView.setOnLongClickListener(new View.OnLongClickListener() { + @Override + public boolean onLongClick(View view) { + copyText(session.country); + return true; + } + }); + + locationItemView.setBackground(Theme.createSelectorDrawable(Theme.getColor(Theme.key_listSelector), 2)); + + linearLayout.addView(locationItemView); + + if (prevItem != null) { + prevItem.needDivider = true; + } + prevItem = locationItemView; + } + + if (secretChatsEnabled(session)) { + ItemView acceptSecretChats = new ItemView(context, true); + acceptSecretChats.valueText.setText(LocaleController.getString("AcceptSecretChats", R.string.AcceptSecretChats)); + drawable = ContextCompat.getDrawable(context, R.drawable.menu_secret).mutate(); + drawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteGrayIcon), PorterDuff.Mode.SRC_IN)); + acceptSecretChats.iconView.setImageDrawable(drawable); + acceptSecretChats.switchView.setChecked(!session.encrypted_requests_disabled, false); + acceptSecretChats.setBackground(Theme.createSelectorDrawable(Theme.getColor(Theme.key_listSelector), 7)); + acceptSecretChats.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + acceptSecretChats.switchView.setChecked(!acceptSecretChats.switchView.isChecked(), true); + session.encrypted_requests_disabled = !acceptSecretChats.switchView.isChecked(); + uploadSessionSettings(); + } + }); + + if (prevItem != null) { + prevItem.needDivider = true; + } + acceptSecretChats.descriptionText.setText(LocaleController.getString("AcceptSecretChatsDescription", R.string.AcceptSecretChatsDescription)); + linearLayout.addView(acceptSecretChats); + prevItem = acceptSecretChats; + } + + ItemView acceptCalls = new ItemView(context, true); + acceptCalls.valueText.setText(LocaleController.getString("AcceptCalls", R.string.AcceptCalls)); + drawable = ContextCompat.getDrawable(context, R.drawable.menu_calls).mutate(); + drawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteGrayIcon), PorterDuff.Mode.SRC_IN)); + acceptCalls.iconView.setImageDrawable(drawable); + acceptCalls.switchView.setChecked(!session.call_requests_disabled, false); + acceptCalls.setBackground(Theme.createSelectorDrawable(Theme.getColor(Theme.key_listSelector), 7)); + acceptCalls.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + acceptCalls.switchView.setChecked(!acceptCalls.switchView.isChecked(), true); + session.call_requests_disabled = !acceptCalls.switchView.isChecked(); + uploadSessionSettings(); + } + }); + + if (prevItem != null) { + prevItem.needDivider = true; + } + acceptCalls.descriptionText.setText(LocaleController.getString("AcceptCallsChatsDescription", R.string.AcceptCallsChatsDescription)); + linearLayout.addView(acceptCalls); + + if (!isCurrentSession) { + TextView buttonTextView = new TextView(context); + buttonTextView.setPadding(AndroidUtilities.dp(34), 0, AndroidUtilities.dp(34), 0); + buttonTextView.setGravity(Gravity.CENTER); + buttonTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + buttonTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); + buttonTextView.setText(LocaleController.getString("TerminateSession", R.string.TerminateSession)); + + buttonTextView.setTextColor(Theme.getColor(Theme.key_featuredStickers_buttonText)); + buttonTextView.setBackgroundDrawable(Theme.createSimpleSelectorRoundRectDrawable(AndroidUtilities.dp(6), Theme.getColor(Theme.key_chat_attachAudioBackground), ColorUtils.setAlphaComponent(Theme.getColor(Theme.key_windowBackgroundWhite), 120))); + + linearLayout.addView(buttonTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, 0, 16, 15, 16, 16)); + + buttonTextView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + AlertDialog.Builder builder = new AlertDialog.Builder(parentFragment.getParentActivity()); + final boolean[] param = new boolean[1]; + String buttonText; + builder.setMessage(LocaleController.getString("TerminateSessionText", R.string.TerminateSessionText)); + builder.setTitle(LocaleController.getString("AreYouSureSessionTitle", R.string.AreYouSureSessionTitle)); + buttonText = LocaleController.getString("Terminate", R.string.Terminate); + + builder.setPositiveButton(buttonText, (dialogInterface, option) -> { + callback.onSessionTerminated(session); + dismiss(); + }); + builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); + AlertDialog alertDialog = builder.create(); + fragment.showDialog(alertDialog); + TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE); + if (button != null) { + button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2)); + } + } + }); + } + + ScrollView scrollView = new ScrollView(context); + scrollView.addView(linearLayout); + setCustomView(scrollView); + } + + private boolean secretChatsEnabled(TLRPC.TL_authorization session) { + if (session.api_id == 2040 || session.api_id == 2496) { + return false; + } + return true; + } + + private void uploadSessionSettings() { + TLRPC.TL_account_changeAuthorizationSettings req = new TLRPC.TL_account_changeAuthorizationSettings(); + req.encrypted_requests_disabled = session.encrypted_requests_disabled; + req.call_requests_disabled = session.call_requests_disabled; + req.flags = 1 | 2; + req.hash = session.hash; + ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> { + + }); + } + + private void copyText(String text) { + AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); + builder.setItems(new CharSequence[]{LocaleController.getString("Copy", R.string.Copy)}, (dialogInterface, i) -> { + android.content.ClipboardManager clipboard = (android.content.ClipboardManager) ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE); + android.content.ClipData clip = android.content.ClipData.newPlainText("label", text); + clipboard.setPrimaryClip(clip); + BulletinFactory.of(getContainer(), null).createCopyBulletin(LocaleController.getString("TextCopied", R.string.TextCopied)).show(); + }); + builder.show(); + + } + + private void setAnimation(TLRPC.TL_authorization session, RLottieImageView imageView) { + String platform = session.platform.toLowerCase(); + if (platform.isEmpty()) { + platform = session.system_version.toLowerCase(); + } + String deviceModel = session.device_model.toLowerCase(); + int iconId; + String colorKey; + boolean animation = true; + + + if (deviceModel.contains("safari")) { + iconId = R.raw.safari_30; + colorKey = Theme.key_avatar_backgroundPink; + } else if (deviceModel.contains("edge")) { + iconId = R.raw.edge_30; + colorKey = Theme.key_avatar_backgroundPink; + } else if (deviceModel.contains("chrome")) { + iconId = R.raw.chrome_30; + colorKey = Theme.key_avatar_backgroundPink; + } else if (deviceModel.contains("opera") || deviceModel.contains("firefox") || deviceModel.contains("vivaldi")) { + animation = false; + if (deviceModel.contains("opera")) { + iconId = R.drawable.device_web_opera; + } else if (deviceModel.contains("firefox")) { + iconId = R.drawable.device_web_firefox; + } else { + iconId = R.drawable.device_web_other; + } + colorKey = Theme.key_avatar_backgroundPink; + } else if (platform.contains("ubuntu")) { + iconId = R.raw.ubuntu_30; + colorKey = Theme.key_avatar_backgroundBlue; + } else if (platform.contains("ios")) { + iconId = deviceModel.contains("ipad") ? R.raw.ipad_30 : R.raw.iphone_30; + colorKey = Theme.key_avatar_backgroundBlue; + } else if (platform.contains("windows")) { + iconId = R.raw.windows_30; + colorKey = Theme.key_avatar_backgroundCyan; + } else if (platform.contains("macos")) { + iconId = R.raw.mac_30; + colorKey = Theme.key_avatar_backgroundCyan; + } else if (platform.contains("android")) { + iconId = R.raw.android_30; + colorKey = Theme.key_avatar_backgroundGreen; + } else { + if (session.app_name.toLowerCase().contains("desktop")) { + iconId = R.raw.windows_30; + colorKey = Theme.key_avatar_backgroundCyan; + } else { + iconId = R.raw.chrome_30; + colorKey = Theme.key_avatar_backgroundPink; + } + } + + imageView.setBackground(Theme.createCircleDrawable(AndroidUtilities.dp(42), Theme.getColor(colorKey))); + if (animation) { + int[] colors = new int[]{0x000000, Theme.getColor(colorKey)}; + imageView.setAnimation(iconId, 50, 50, colors); + } else { + imageView.setImageDrawable(ContextCompat.getDrawable(getContext(), iconId)); + } + } + + private static class ItemView extends FrameLayout { + + ImageView iconView; + TextView valueText; + TextView descriptionText; + Switch switchView; + boolean needDivider = false; + + public ItemView(Context context, boolean needSwitch) { + super(context); + iconView = new ImageView(context); + addView(iconView, LayoutHelper.createFrame(28, 28, 0, 16, 8, 0, 0)); + + LinearLayout linearLayout = new LinearLayout(context); + linearLayout.setOrientation(LinearLayout.VERTICAL); + addView(linearLayout, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 64, 4, 0, 4)); + + valueText = new TextView(context); + valueText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16); + valueText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); + linearLayout.addView(valueText, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 0, 0, 0, 0)); + + descriptionText = new TextView(context); + descriptionText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13); + descriptionText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText)); + linearLayout.addView(descriptionText, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 0, 4, 0, 0)); + setPadding(0, AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4)); + + if (needSwitch) { + switchView = new Switch(context); + switchView.setDrawIconType(1); + addView(switchView, LayoutHelper.createFrame(37, 40, Gravity.RIGHT | Gravity.CENTER_VERTICAL, 21, 0, 21, 0)); + } + } + + @Override + protected void dispatchDraw(Canvas canvas) { + super.dispatchDraw(canvas); + if (needDivider) { + canvas.drawRect(AndroidUtilities.dp(64), getMeasuredHeight() - 1, getMeasuredWidth(), getMeasuredHeight(), Theme.dividerPaint); + } + } + } + + public interface Callback { + void onSessionTerminated(TLRPC.TL_authorization session); + } + + @Override + public void show() { + super.show(); + imageView.playAnimation(); + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/SessionsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/SessionsActivity.java index 86f252656..070d7a50a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/SessionsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/SessionsActivity.java @@ -8,11 +8,19 @@ package org.telegram.ui; +import android.Manifest; import android.content.Context; import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.pm.PackageManager; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; +import android.net.Uri; import android.os.Build; +import android.text.SpannableStringBuilder; +import android.text.Spanned; +import android.text.style.ImageSpan; import android.util.Base64; import android.util.TypedValue; import android.view.Gravity; @@ -26,12 +34,17 @@ import android.widget.TextView; import android.widget.Toast; import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.ApplicationLoader; +import org.telegram.messenger.DocumentObject; +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.FileLog; import org.telegram.messenger.R; import org.telegram.messenger.SharedConfig; +import org.telegram.messenger.SvgHelper; import org.telegram.messenger.UserObject; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; @@ -44,17 +57,29 @@ 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.RadioColorCell; import org.telegram.ui.Cells.SessionCell; +import org.telegram.ui.Cells.TextCell; import org.telegram.ui.Cells.TextInfoPrivacyCell; import org.telegram.ui.Cells.TextSettingsCell; import org.telegram.ui.Components.AlertsCreator; +import org.telegram.ui.Components.BackupImageView; +import org.telegram.ui.Components.ColoredImageSpan; import org.telegram.ui.Components.EmptyTextProgressView; +import org.telegram.ui.Components.FlickerLoadingView; import org.telegram.ui.Components.LayoutHelper; +import org.telegram.ui.Components.RLottieImageView; +import org.telegram.ui.Components.RecyclerItemsEnterAnimator; import org.telegram.ui.Components.RecyclerListView; +import org.telegram.ui.Components.ReplaceableIconDrawable; +import org.telegram.ui.Components.SlideChooseView; +import org.telegram.ui.Components.URLSpanNoUnderline; import org.telegram.ui.Components.UndoView; import java.util.ArrayList; +import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -66,14 +91,16 @@ public class SessionsActivity extends BaseFragment implements NotificationCenter private TextView textView1; private TextView textView2; private EmptyTextProgressView emptyView; + private FlickerLoadingView globalFlickerLoadingView; private ArrayList sessions = new ArrayList<>(); private ArrayList passwordSessions = new ArrayList<>(); private TLRPC.TL_authorization currentSession; private boolean loading; private LinearLayout emptyLayout; - private UndoView undoView; + private RecyclerItemsEnterAnimator itemsEnterAnimator; + private int ttlDays; private int currentType; @@ -91,7 +118,11 @@ public class SessionsActivity extends BaseFragment implements NotificationCenter private int otherSessionsTerminateDetail; private int noOtherSessionsRow; private int qrCodeRow; + private int qrCodeDividerRow; private int rowCount; + private int ttlHeaderRow; + private int ttlRow; + private int ttlDivideRow; public SessionsActivity(int type) { currentType = type; @@ -113,7 +144,10 @@ public class SessionsActivity extends BaseFragment implements NotificationCenter } @Override - public View createView(Context context) { + public View createView(Context context) { + globalFlickerLoadingView = new FlickerLoadingView(context); + globalFlickerLoadingView.setIsSingleCell(true); + actionBar.setBackButtonImage(R.drawable.ic_ab_back); actionBar.setAllowOverlayTitle(true); if (currentType == 0) { @@ -183,44 +217,71 @@ public class SessionsActivity extends BaseFragment implements NotificationCenter listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)); listView.setVerticalScrollBarEnabled(false); listView.setEmptyView(emptyView); + listView.setAnimateEmptyView(true, 0); frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); listView.setAdapter(listAdapter); listView.setOnItemClickListener((view, position) -> { - if (position == qrCodeRow) { - ActionIntroActivity fragment = new ActionIntroActivity(ActionIntroActivity.ACTION_TYPE_QR_LOGIN); - fragment.setQrLoginDelegate(code -> { - AlertDialog progressDialog = new AlertDialog(getParentActivity(), 3); - progressDialog.setCanCacnel(false); - progressDialog.show(); - byte[] token = Base64.decode(code.substring("tg://login?token=".length()), Base64.URL_SAFE); - TLRPC.TL_auth_acceptLoginToken req = new TLRPC.TL_auth_acceptLoginToken(); - req.token = token; - getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { - try { - progressDialog.dismiss(); - } catch (Exception ignore) { + if (position == ttlRow) { + if (getParentActivity() == null) { + return; + } + int selected; + if (ttlDays <= 7) { + selected = 0; + } else if (ttlDays <= 93) { + selected = 1; + } else if (ttlDays <= 183) { + selected = 2; + } else { + selected = 3; + } + AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); + builder.setTitle(LocaleController.getString("SessionsSelfDestruct", R.string.SessionsSelfDestruct)); + String[] items = new String[]{ + LocaleController.formatPluralString("Weeks", 1), + LocaleController.formatPluralString("Months", 3), + LocaleController.formatPluralString("Months", 6), + LocaleController.formatPluralString("Years", 1) + }; + final LinearLayout linearLayout = new LinearLayout(getParentActivity()); + linearLayout.setOrientation(LinearLayout.VERTICAL); + builder.setView(linearLayout); + for (int a = 0; a < items.length; a++) { + RadioColorCell cell = new RadioColorCell(getParentActivity()); + cell.setPadding(AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4), 0); + cell.setTag(a); + cell.setCheckColor(Theme.getColor(Theme.key_radioBackground), Theme.getColor(Theme.key_dialogRadioBackgroundChecked)); + cell.setTextAndValue(items[a], selected == a); + linearLayout.addView(cell); + cell.setOnClickListener(v -> { + builder.getDismissRunnable().run(); + Integer which = (Integer) v.getTag(); + + int value = 0; + if (which == 0) { + value = 7; + } else if (which == 1) { + value = 90; + } else if (which == 2) { + value = 183; + } else if (which == 3) { + value = 365; } - if (response instanceof TLRPC.TL_authorization) { - TLRPC.TL_authorization authorization = (TLRPC.TL_authorization) response; - sessions.add(0, authorization); - updateRows(); + + final TLRPC.TL_account_setAuthorizationTTL req = new TLRPC.TL_account_setAuthorizationTTL(); + req.authorization_ttl_days = value; + ttlDays = value; + if (listAdapter != null) { listAdapter.notifyDataSetChanged(); - undoView.showWithAction(0, UndoView.ACTION_QR_SESSION_ACCEPTED, response); - } else { - AndroidUtilities.runOnUIThread(() -> { - final String text; - if (error.text.equals("AUTH_TOKEN_EXCEPTION")) { - text = LocaleController.getString("AccountAlreadyLoggedIn", R.string.AccountAlreadyLoggedIn); - } else { - text = LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred) + "\n" + error.text; - } - AlertsCreator.showSimpleAlert(SessionsActivity.this, LocaleController.getString("AuthAnotherClient", R.string.AuthAnotherClient), text); - }); } - })); - }); - presentFragment(fragment); + getConnectionsManager().sendRequest(req, (response, error) -> { + + }); + }); + } + builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); + showDialog(builder.create()); } else if (position == terminateAllSessionsRow) { if (getParentActivity() == null) { return; @@ -286,10 +347,24 @@ public class SessionsActivity extends BaseFragment implements NotificationCenter if (button != null) { button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2)); } - } else if (position >= otherSessionsStartRow && position < otherSessionsEndRow || position >= passwordSessionsStartRow && position < passwordSessionsEndRow) { + } else if (position >= otherSessionsStartRow && position < otherSessionsEndRow || position >= passwordSessionsStartRow && position < passwordSessionsEndRow || position == currentSessionRow) { if (getParentActivity() == null) { return; } + if (currentType == 0) { + final TLRPC.TL_authorization authorization; + boolean isCurrentSession = false; + if (position == currentSessionRow) { + authorization = currentSession; + isCurrentSession = true; + } else if (position >= otherSessionsStartRow && position < otherSessionsEndRow) { + authorization = (TLRPC.TL_authorization) sessions.get(position - otherSessionsStartRow); + } else { + authorization = (TLRPC.TL_authorization) passwordSessions.get(position - passwordSessionsStartRow); + } + showSessionBottomSheet(authorization, isCurrentSession); + return; + } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); final boolean[] param = new boolean[1]; String buttonText; @@ -421,9 +496,50 @@ public class SessionsActivity extends BaseFragment implements NotificationCenter frameLayout.addView(undoView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM | Gravity.LEFT, 8, 0, 8, 8)); } + itemsEnterAnimator = new RecyclerItemsEnterAnimator(listView, true) { + @Override + public View getProgressView() { + View progressView = null; + for (int i = 0; i < listView.getChildCount(); i++) { + View child = listView.getChildAt(i); + if (listView.getChildAdapterPosition(child) >= 0 && child instanceof SessionCell && ((SessionCell) child).isStub()) { + progressView = child; + } + } + return progressView; + } + }; + itemsEnterAnimator.animateAlphaProgressView = false; + + updateRows(); return fragmentView; } + + private void showSessionBottomSheet(TLRPC.TL_authorization authorization, boolean isCurrentSession) { + if (authorization == null) { + return; + } + SessionBottomSheet bottomSheet = new SessionBottomSheet(this, authorization, isCurrentSession, new SessionBottomSheet.Callback() { + @Override + public void onSessionTerminated(TLRPC.TL_authorization authorization) { + sessions.remove(authorization); + passwordSessions.remove(authorization); + updateRows(); + if (listAdapter != null) { + listAdapter.notifyDataSetChanged(); + } + TLRPC.TL_account_resetAuthorization req = new TLRPC.TL_account_resetAuthorization(); + req.hash = authorization.hash; + ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { + + })); + } + }); + bottomSheet.show(); + + } + @Override public void onPause() { super.onPause(); @@ -465,6 +581,7 @@ public class SessionsActivity extends BaseFragment implements NotificationCenter TLRPC.TL_account_getAuthorizations req = new TLRPC.TL_account_getAuthorizations(); int reqId = ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { loading = false; + int oldItemsCount = listAdapter.getItemCount(); if (error == null) { sessions.clear(); passwordSessions.clear(); @@ -479,8 +596,10 @@ public class SessionsActivity extends BaseFragment implements NotificationCenter sessions.add(authorization); } } + ttlDays = res.authorization_ttl_days; updateRows(); } + itemsEnterAnimator.showItemsAnimated(oldItemsCount + 1); if (listAdapter != null) { listAdapter.notifyDataSetChanged(); } @@ -497,6 +616,7 @@ public class SessionsActivity extends BaseFragment implements NotificationCenter sessions.addAll(res.authorizations); updateRows(); } + itemsEnterAnimator.showItemsAnimated(0); if (listAdapter != null) { listAdapter.notifyDataSetChanged(); } @@ -507,15 +627,43 @@ public class SessionsActivity extends BaseFragment implements NotificationCenter private void updateRows() { rowCount = 0; + currentSessionSectionRow = -1; + currentSessionRow = -1; + terminateAllSessionsRow = -1; + terminateAllSessionsDetailRow = -1; + passwordSessionsSectionRow = -1; + passwordSessionsStartRow = -1; + passwordSessionsEndRow = -1; + passwordSessionsDetailRow = -1; + otherSessionsSectionRow = -1; + otherSessionsStartRow = -1; + otherSessionsEndRow = -1; + otherSessionsTerminateDetail = -1; + noOtherSessionsRow = -1; qrCodeRow = -1; + qrCodeDividerRow = -1; + ttlHeaderRow = -1; + ttlRow = -1; + ttlDivideRow = -1; + + boolean hasQr = currentType == 0 && getMessagesController().qrLoginCamera; + if (hasQr) { + qrCodeRow = rowCount++; + qrCodeDividerRow = rowCount++; + } + if (loading) { + if (currentType == 0) { + currentSessionSectionRow = rowCount++; + currentSessionRow = rowCount++; + } + return; + } if (currentSession != null) { currentSessionSectionRow = rowCount++; currentSessionRow = rowCount++; - } else { - currentSessionRow = -1; - currentSessionSectionRow = -1; } - boolean hasQr = currentType == 0 && getMessagesController().qrLoginCamera; + + if (!passwordSessions.isEmpty() || !sessions.isEmpty()) { terminateAllSessionsRow = rowCount++; terminateAllSessionsDetailRow = rowCount++; @@ -523,42 +671,32 @@ public class SessionsActivity extends BaseFragment implements NotificationCenter } else { terminateAllSessionsRow = -1; terminateAllSessionsDetailRow = -1; - if (hasQr) { - qrCodeRow = rowCount++; - } if (currentType == 1 || currentSession != null) { noOtherSessionsRow = rowCount++; } else { noOtherSessionsRow = -1; } } - if (passwordSessions.isEmpty()) { - passwordSessionsDetailRow = -1; - passwordSessionsEndRow = -1; - passwordSessionsStartRow = -1; - passwordSessionsSectionRow = -1; - } else { + if (!passwordSessions.isEmpty()) { passwordSessionsSectionRow = rowCount++; passwordSessionsStartRow = rowCount; rowCount += passwordSessions.size(); passwordSessionsEndRow = rowCount; passwordSessionsDetailRow = rowCount++; } - if (sessions.isEmpty()) { - otherSessionsSectionRow = -1; - otherSessionsStartRow = -1; - otherSessionsEndRow = -1; - otherSessionsTerminateDetail = -1; - } else { + if (!sessions.isEmpty()) { otherSessionsSectionRow = rowCount++; - if (hasQr) { - qrCodeRow = rowCount++; - } otherSessionsStartRow = rowCount; otherSessionsEndRow = rowCount + sessions.size(); rowCount += sessions.size(); otherSessionsTerminateDetail = rowCount++; } + + if (ttlDays > 0) { + ttlHeaderRow = rowCount++; + ttlRow = rowCount++; + ttlDivideRow = rowCount++; + } } private class ListAdapter extends RecyclerListView.SelectionAdapter { @@ -572,12 +710,12 @@ public class SessionsActivity extends BaseFragment implements NotificationCenter @Override public boolean isEnabled(RecyclerView.ViewHolder holder) { int position = holder.getAdapterPosition(); - return position == terminateAllSessionsRow || position == qrCodeRow || position >= otherSessionsStartRow && position < otherSessionsEndRow || position >= passwordSessionsStartRow && position < passwordSessionsEndRow; + return position == terminateAllSessionsRow || position >= otherSessionsStartRow && position < otherSessionsEndRow || position >= passwordSessionsStartRow && position < passwordSessionsEndRow || position == currentSessionRow || position == ttlRow; } @Override public int getItemCount() { - return loading ? 0 : rowCount; + return rowCount; } @Override @@ -585,7 +723,7 @@ public class SessionsActivity extends BaseFragment implements NotificationCenter View view; switch (viewType) { case 0: - view = new TextSettingsCell(mContext); + view = new TextCell(mContext); view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); break; case 1: @@ -598,6 +736,13 @@ public class SessionsActivity extends BaseFragment implements NotificationCenter case 3: view = emptyLayout; break; + case 5: + view = new ScanQRCodeView(mContext); + break; + case 6: + view = new TextSettingsCell(mContext); + view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); + break; default: view = new SessionCell(mContext, currentType); view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); @@ -610,23 +755,24 @@ public class SessionsActivity extends BaseFragment implements NotificationCenter public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { switch (holder.getItemViewType()) { case 0: - TextSettingsCell textCell = (TextSettingsCell) holder.itemView; + TextCell textCell = (TextCell) holder.itemView; if (position == terminateAllSessionsRow) { - textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText2)); + textCell.setColors(Theme.key_windowBackgroundWhiteRedText2, Theme.key_windowBackgroundWhiteRedText2); textCell.setTag(Theme.key_windowBackgroundWhiteRedText2); if (currentType == 0) { - textCell.setText(LocaleController.getString("TerminateAllSessions", R.string.TerminateAllSessions), false); + textCell.setTextAndIcon(LocaleController.getString("TerminateAllSessions", R.string.TerminateAllSessions), R.drawable.msg_block2, false); } else { - textCell.setText(LocaleController.getString("TerminateAllWebSessions", R.string.TerminateAllWebSessions), false); + textCell.setTextAndIcon(LocaleController.getString("TerminateAllWebSessions", R.string.TerminateAllWebSessions), R.drawable.msg_block2, false); } } else if (position == qrCodeRow) { - textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4)); + textCell.setColors(Theme.key_windowBackgroundWhiteBlueText4, Theme.key_windowBackgroundWhiteBlueText4); textCell.setTag(Theme.key_windowBackgroundWhiteBlueText4); - textCell.setText(LocaleController.getString("AuthAnotherClient", R.string.AuthAnotherClient), !sessions.isEmpty()); + textCell.setTextAndIcon(LocaleController.getString("AuthAnotherClient", R.string.AuthAnotherClient), R.drawable.msg_qrcode, !sessions.isEmpty()); } break; case 1: TextInfoPrivacyCell privacyCell = (TextInfoPrivacyCell) holder.itemView; + privacyCell.setFixedSize(0); if (position == terminateAllSessionsDetailRow) { if (currentType == 0) { privacyCell.setText(LocaleController.getString("ClearOtherSessionsHelp", R.string.ClearOtherSessionsHelp)); @@ -639,7 +785,7 @@ public class SessionsActivity extends BaseFragment implements NotificationCenter if (sessions.isEmpty()) { privacyCell.setText(""); } else { - privacyCell.setText(LocaleController.getString("TerminateSessionInfo", R.string.TerminateSessionInfo)); + privacyCell.setText(LocaleController.getString("SessionsListInfo", R.string.SessionsListInfo)); } } else { privacyCell.setText(LocaleController.getString("TerminateWebSessionInfo", R.string.TerminateWebSessionInfo)); @@ -652,6 +798,10 @@ public class SessionsActivity extends BaseFragment implements NotificationCenter } else { privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } + } else if (position == qrCodeDividerRow || position == ttlDivideRow || position == noOtherSessionsRow) { + privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + privacyCell.setText(""); + privacyCell.setFixedSize(12); } break; case 2: @@ -666,6 +816,8 @@ public class SessionsActivity extends BaseFragment implements NotificationCenter } } else if (position == passwordSessionsSectionRow) { headerCell.setText(LocaleController.getString("LoginAttempts", R.string.LoginAttempts)); + } else if (position == ttlHeaderRow) { + headerCell.setText(LocaleController.getString("TerminateOldSessionHeader", R.string.TerminateOldSessionHeader)); } break; case 3: @@ -675,10 +827,28 @@ public class SessionsActivity extends BaseFragment implements NotificationCenter emptyLayout.setLayoutParams(layoutParams); } break; + case 5: + break; + case 6: + TextSettingsCell textSettingsCell = (TextSettingsCell) holder.itemView; + String value; + if (ttlDays > 30 && ttlDays <= 183) { + value = LocaleController.formatPluralString("Months", ttlDays / 30); + } else if (ttlDays == 365) { + value = LocaleController.formatPluralString("Years", ttlDays / 365); + } else { + value = LocaleController.formatPluralString("Weeks", ttlDays / 7); + } + textSettingsCell.setTextAndValue(LocaleController.getString("IfInactiveFor", R.string.IfInactiveFor), value, false); + break; default: SessionCell sessionCell = (SessionCell) holder.itemView; if (position == currentSessionRow) { - sessionCell.setSession(currentSession, !sessions.isEmpty() || !passwordSessions.isEmpty() || qrCodeRow != -1); + if (currentSession == null) { + sessionCell.showStub(globalFlickerLoadingView); + } else { + sessionCell.setSession(currentSession, !sessions.isEmpty() || !passwordSessions.isEmpty() || qrCodeRow != -1); + } } else if (position >= otherSessionsStartRow && position < otherSessionsEndRow) { sessionCell.setSession(sessions.get(position - otherSessionsStartRow), position != otherSessionsEndRow - 1); } else if (position >= passwordSessionsStartRow && position < passwordSessionsEndRow) { @@ -690,21 +860,221 @@ public class SessionsActivity extends BaseFragment implements NotificationCenter @Override public int getItemViewType(int position) { - if (position == terminateAllSessionsRow || position == qrCodeRow) { + if (position == terminateAllSessionsRow) { return 0; - } else if (position == terminateAllSessionsDetailRow || position == otherSessionsTerminateDetail || position == passwordSessionsDetailRow) { + } else if (position == terminateAllSessionsDetailRow || position == otherSessionsTerminateDetail || position == passwordSessionsDetailRow || position == qrCodeDividerRow || position == ttlDivideRow || position == noOtherSessionsRow) { return 1; - } else if (position == currentSessionSectionRow || position == otherSessionsSectionRow || position == passwordSessionsSectionRow) { + } else if (position == currentSessionSectionRow || position == otherSessionsSectionRow || position == passwordSessionsSectionRow || position == ttlHeaderRow) { return 2; - } else if (position == noOtherSessionsRow) { - return 3; } else if (position == currentSessionRow || position >= otherSessionsStartRow && position < otherSessionsEndRow || position >= passwordSessionsStartRow && position < passwordSessionsEndRow) { return 4; + } else if (position == qrCodeRow) { + return 5; + } else if (position == ttlRow) { + return 6; } return 0; } } + private class ScanQRCodeView extends FrameLayout implements NotificationCenter.NotificationCenterDelegate { + + BackupImageView imageView; + TextView textView; + + public ScanQRCodeView(@NonNull Context context) { + super(context); + imageView = new BackupImageView(context); + addView(imageView, LayoutHelper.createFrame(120, 120, Gravity.CENTER_HORIZONTAL, 0, 16, 0, 0)); + + imageView.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + if (imageView.getImageReceiver().getLottieAnimation() != null && !imageView.getImageReceiver().getLottieAnimation().isRunning()) { + imageView.getImageReceiver().getLottieAnimation().setCurrentFrame(0, false); + imageView.getImageReceiver().getLottieAnimation().restart(); + } + } + }); + int[] colors = new int[8]; + colors[0] = 0x333333; + colors[1] = Theme.getColor(Theme.key_windowBackgroundWhiteBlackText); + + colors[2] = 0xffffff; + colors[3] = Theme.getColor(Theme.key_windowBackgroundWhite); + + colors[4] = 0x50a7ea; + colors[5] = Theme.getColor(Theme.key_featuredStickers_addButton); + + colors[6] = 0x212020; + colors[7] = Theme.getColor(Theme.key_windowBackgroundWhite); + +// imageView.replaceColors(colors); +// imageView.setAnimation(R.raw.qr_login, 230, 230, colors); +// imageView.setScaleType(ImageView.ScaleType.CENTER); +// imageView.playAnimation(); + + textView = new TextView(context); + addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 36, 152, 36, 0)); + textView.setGravity(Gravity.CENTER_HORIZONTAL); + textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); + textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15); + textView.setLinkTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteLinkText)); + textView.setHighlightColor(Theme.getColor(Theme.key_windowBackgroundWhiteLinkSelection)); + setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); + + String text = LocaleController.getString("AuthAnotherClientInfo4", R.string.AuthAnotherClientInfo4); + SpannableStringBuilder spanned = new SpannableStringBuilder(text); + int index1 = text.indexOf('*'); + int index2 = text.indexOf('*', index1 + 1); + + if (index1 != -1 && index2 != -1 && index1 != index2) { + textView.setMovementMethod(new AndroidUtilities.LinkMovementMethodMy()); + spanned.replace(index2, index2 + 1, ""); + spanned.replace(index1, index1 + 1, ""); + spanned.setSpan(new URLSpanNoUnderline(LocaleController.getString("AuthAnotherClientDownloadClientUrl", R.string.AuthAnotherClientDownloadClientUrl)), index1, index2 - 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + } + + text = spanned.toString(); + index1 = text.indexOf('*'); + index2 = text.indexOf('*', index1 + 1); + + if (index1 != -1 && index2 != -1 && index1 != index2) { + textView.setMovementMethod(new AndroidUtilities.LinkMovementMethodMy()); + spanned.replace(index2, index2 + 1, ""); + spanned.replace(index1, index1 + 1, ""); + spanned.setSpan(new URLSpanNoUnderline(LocaleController.getString("AuthAnotherWebClientUrl", R.string.AuthAnotherWebClientUrl)), index1, index2 - 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + } + + textView.setText(spanned); + + TextView buttonTextView = new TextView(context); + buttonTextView.setPadding(AndroidUtilities.dp(34), 0, AndroidUtilities.dp(34), 0); + buttonTextView.setGravity(Gravity.CENTER); + buttonTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + buttonTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); + + SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(); + spannableStringBuilder.append(". ").append(LocaleController.getString("LinkDesktopDevice", R.string.LinkDesktopDevice)); + spannableStringBuilder.setSpan(new ColoredImageSpan(ContextCompat.getDrawable(getContext(), R.drawable.msg_mini_qr)), 0, 1, 0); + buttonTextView.setText(spannableStringBuilder); + + buttonTextView.setTextColor(Theme.getColor(Theme.key_featuredStickers_buttonText)); + buttonTextView.setBackgroundDrawable(Theme.createSimpleSelectorRoundRectDrawable(AndroidUtilities.dp(6), Theme.getColor(Theme.key_featuredStickers_addButton), Theme.getColor(Theme.key_featuredStickers_addButtonPressed))); + + buttonTextView.setOnClickListener(view -> { + if (getParentActivity() == null) { + return; + } + if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission(Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { + getParentActivity().requestPermissions(new String[]{Manifest.permission.CAMERA}, ActionIntroActivity.CAMERA_PERMISSION_REQUEST_CODE); + return; + } + CameraScanActivity.showAsSheet(SessionsActivity.this, false, CameraScanActivity.TYPE_QR_LOGIN, new CameraScanActivity.CameraScanActivityDelegate() { + @Override + public void didFindQr(String text) { + proccessQrCode(text); + } + }); + }); + addView(buttonTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.BOTTOM, 16, 15, 16, 16)); + + setSticker(); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(276), MeasureSpec.EXACTLY)); + } + + @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 (AndroidUtilities.STICKERS_PLACEHOLDER_PACK_NAME.equals(name)) { + setSticker(); + } + } + } + + private void setSticker() { + String imageFilter = null; + TLRPC.Document document = null; + TLRPC.TL_messages_stickerSet set = null; + + set = MediaDataController.getInstance(currentAccount).getStickerSetByName(AndroidUtilities.STICKERS_PLACEHOLDER_PACK_NAME); + if (set == null) { + set = MediaDataController.getInstance(currentAccount).getStickerSetByEmojiOrName(AndroidUtilities.STICKERS_PLACEHOLDER_PACK_NAME); + } + if (set != null && set.documents.size() > 6) { + document = set.documents.get(6); + } + 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); + imageView.setImage(imageLocation, imageFilter, "tgs", svgThumb, set); + imageView.getImageReceiver().setAutoRepeat(2); + } else { + MediaDataController.getInstance(currentAccount).loadStickersByEmojiOrName(AndroidUtilities.STICKERS_PLACEHOLDER_PACK_NAME, false, set == null); + } + } + } + + private void proccessQrCode(String code) { + AlertDialog progressDialog = new AlertDialog(getParentActivity(), 3); + progressDialog.setCanCacnel(false); + progressDialog.show(); + byte[] token = Base64.decode(code.substring("tg://login?token=".length()), Base64.URL_SAFE); + TLRPC.TL_auth_acceptLoginToken req = new TLRPC.TL_auth_acceptLoginToken(); + req.token = token; + getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { + try { + progressDialog.dismiss(); + } catch (Exception ignore) { + + } + if (response instanceof TLRPC.TL_authorization) { + TLRPC.TL_authorization authorization = (TLRPC.TL_authorization) response; + sessions.add(0, authorization); + updateRows(); + listAdapter.notifyDataSetChanged(); + undoView.showWithAction(0, UndoView.ACTION_QR_SESSION_ACCEPTED, response); + } else { + AndroidUtilities.runOnUIThread(() -> { + final String text; + if (error.text.equals("AUTH_TOKEN_EXCEPTION")) { + text = LocaleController.getString("AccountAlreadyLoggedIn", R.string.AccountAlreadyLoggedIn); + } else { + text = LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred) + "\n" + error.text; + } + AlertsCreator.showSimpleAlert(SessionsActivity.this, LocaleController.getString("AuthAnotherClient", R.string.AuthAnotherClient), text); + }); + } + })); + } + @Override public ArrayList getThemeDescriptions() { ArrayList themeDescriptions = new ArrayList<>(); @@ -751,4 +1121,21 @@ public class SessionsActivity extends BaseFragment implements NotificationCenter return themeDescriptions; } + + @Override + public void onRequestPermissionsResultFragment(int requestCode, String[] permissions, int[] grantResults) { + if (getParentActivity() == null) { + return; + } + if (requestCode == ActionIntroActivity.CAMERA_PERMISSION_REQUEST_CODE) { + if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { + CameraScanActivity.showAsSheet(SessionsActivity.this, false, CameraScanActivity.TYPE_QR_LOGIN, new CameraScanActivity.CameraScanActivityDelegate() { + @Override + public void didFindQr(String text) { + proccessQrCode(text); + } + }); + } + } + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/TextMessageEnterTransition.java b/TMessagesProj/src/main/java/org/telegram/ui/TextMessageEnterTransition.java index 8098a8484..202551db2 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/TextMessageEnterTransition.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/TextMessageEnterTransition.java @@ -111,7 +111,7 @@ public class TextMessageEnterTransition implements MessageEnterTransitionContain public TextMessageEnterTransition(ChatMessageCell messageView, ChatActivity chatActivity, RecyclerListView listView, MessageEnterTransitionContainer container, Theme.ResourcesProvider resourcesProvider) { this.resourcesProvider = resourcesProvider; currentAccount = UserConfig.selectedAccount; - if (messageView.getMessageObject().textLayoutBlocks.size() > 1 || messageView.getMessageObject().textLayoutBlocks.get(0).textLayout.getLineCount() > 10) { + if (messageView.getMessageObject().textLayoutBlocks.size() > 1 || messageView.getMessageObject().textLayoutBlocks.isEmpty() || messageView.getMessageObject().textLayoutBlocks.get(0).textLayout.getLineCount() > 10) { return; } this.messageView = messageView; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ThemeActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ThemeActivity.java index d91320505..6a3bc9e4c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ThemeActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ThemeActivity.java @@ -563,16 +563,17 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No backgroundRow = rowCount++; newThemeInfoRow = rowCount++; themeHeaderRow = rowCount++; - // TODO - //themeListRow2 = rowCount++; - themeListRow = rowCount++; - hasThemeAccents = Theme.getCurrentTheme().hasAccentColors(); - if (themesHorizontalListCell != null) { - themesHorizontalListCell.setDrawDivider(hasThemeAccents); - } - if (hasThemeAccents) { - themeAccentListRow = rowCount++; - } + + themeListRow2 = rowCount++; + // +// themeListRow = rowCount++; +// hasThemeAccents = Theme.getCurrentTheme().hasAccentColors(); +// if (themesHorizontalListCell != null) { +// themesHorizontalListCell.setDrawDivider(hasThemeAccents); +// } +// if (hasThemeAccents) { +// themeAccentListRow = rowCount++; +// } // themeInfoRow = rowCount++; @@ -729,6 +730,7 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.emojiLoaded); NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.needShareTheme); NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.needSetDayNightTheme); + NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.emojiPreviewThemesChanged); getNotificationCenter().addObserver(this, NotificationCenter.themeUploadedToServer); getNotificationCenter().addObserver(this, NotificationCenter.themeUploadError); if (currentType == THEME_TYPE_BASIC) { @@ -749,6 +751,7 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.emojiLoaded); NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.needShareTheme); NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.needSetDayNightTheme); + NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.emojiPreviewThemesChanged); getNotificationCenter().removeObserver(this, NotificationCenter.themeUploadedToServer); getNotificationCenter().removeObserver(this, NotificationCenter.themeUploadError); Theme.saveAutoNightThemeConfig(); @@ -801,6 +804,10 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No } else if (id == NotificationCenter.needSetDayNightTheme) { updateMenuItem(); checkCurrentDayNight(); + } else if (id == NotificationCenter.emojiPreviewThemesChanged) { + if (themeListRow2 >= 0) { + listAdapter.notifyItemChanged(themeListRow2); + } } } @@ -1902,7 +1909,7 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No return false; } Theme.ThemeAccent accent = accentsAdapter.themeAccents.get(position); - if (accent.id >= 100) { + if (accent.id >= 100 && !accent.isDefault) { AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); CharSequence[] items = new CharSequence[]{ LocaleController.getString("OpenInEditor", R.string.OpenInEditor), @@ -1988,6 +1995,7 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No case 17: DefaultThemesPreviewCell cell = new DefaultThemesPreviewCell(mContext, ThemeActivity.this, currentType); view = cell; + cell.setFocusable(false); view.setLayoutParams(new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); break; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ThemePreviewActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ThemePreviewActivity.java index 37be135ba..41494e37e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ThemePreviewActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ThemePreviewActivity.java @@ -2349,10 +2349,26 @@ public class ThemePreviewActivity extends BaseFragment implements DownloadContro Drawable background = backgroundImage.getBackground(); Bitmap bitmap = backgroundImage.getImageReceiver().getBitmap(); + if (background instanceof MotionBackgroundDrawable) { + FileOutputStream stream = new FileOutputStream(toFile); + bitmap.compress(Bitmap.CompressFormat.PNG, 87, stream); + stream.close(); + } else { + Bitmap dst = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888); + Canvas canvas = new Canvas(dst); + background.setBounds(0, 0, bitmap.getWidth(), bitmap.getHeight()); + background.draw(canvas); + + Paint paint = new Paint(Paint.FILTER_BITMAP_FLAG); + paint.setColorFilter(new PorterDuffColorFilter(patternColor, blendMode)); + paint.setAlpha((int) (255 * currentIntensity)); + canvas.drawBitmap(bitmap, 0, 0, paint); + + FileOutputStream stream = new FileOutputStream(toFile); + dst.compress(Bitmap.CompressFormat.JPEG, 87, stream); + stream.close(); + } - FileOutputStream stream = new FileOutputStream(toFile); - bitmap.compress(background instanceof MotionBackgroundDrawable ? Bitmap.CompressFormat.PNG : Bitmap.CompressFormat.JPEG, 87, stream); - stream.close(); } catch (Throwable e) { FileLog.e(e); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/TwoStepVerificationActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/TwoStepVerificationActivity.java index 093904236..a7aa73da4 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/TwoStepVerificationActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/TwoStepVerificationActivity.java @@ -11,6 +11,7 @@ package org.telegram.ui; import android.content.Context; import android.content.DialogInterface; import android.graphics.Typeface; +import android.os.Bundle; import android.os.Vibrator; import android.text.InputType; import android.text.TextUtils; @@ -101,6 +102,7 @@ public class TwoStepVerificationActivity extends BaseFragment implements Notific private int rowCount; private boolean forgotPasswordOnShow; + int otherwiseReloginDays = -1; private TwoStepVerificationActivityDelegate delegate; @@ -169,7 +171,11 @@ public class TwoStepVerificationActivity extends BaseFragment implements Notific @Override public void onItemClick(int id) { if (id == -1) { - finishFragment(); + if (otherwiseReloginDays >= 0) { + showSetForcePasswordAlert(); + } else { + finishFragment(); + } } else if (id == done_button) { processDone(); } @@ -1103,4 +1109,43 @@ public class TwoStepVerificationActivity extends BaseFragment implements Notific return themeDescriptions; } + + @Override + public boolean onBackPressed() { + if (otherwiseReloginDays >= 0) { + showSetForcePasswordAlert(); + return false; + } + return super.onBackPressed(); + } + + private void showSetForcePasswordAlert() { + AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); + builder.setTitle(LocaleController.getString("Warning", R.string.Warning)); + builder.setMessage(LocaleController.formatPluralString("ForceSetPasswordAlertMessage", otherwiseReloginDays)); + builder.setPositiveButton(LocaleController.getString("ForceSetPasswordContinue", R.string.ForceSetPasswordContinue), (a1, a2) -> { + + }); + + builder.setNegativeButton(LocaleController.getString("ForceSetPasswordCancel", R.string.ForceSetPasswordCancel), (a1, a2) -> { + finishFragment(); + }); + AlertDialog alertDialog = builder.show(); + ((TextView)alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE)).setTextColor(Theme.getColor(Theme.key_dialogTextRed2)); + } + + public void setBlockingAlert(int otherwiseRelogin) { + otherwiseReloginDays = otherwiseRelogin; + } + + @Override + public void finishFragment() { + if (otherwiseReloginDays >= 0) { + final Bundle args = new Bundle(); + args.putBoolean("afterSignup", true); + presentFragment(new DialogsActivity(args), true); + } else { + super.finishFragment(); + } + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/TwoStepVerificationSetupActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/TwoStepVerificationSetupActivity.java index 3aec2acb5..427403faf 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/TwoStepVerificationSetupActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/TwoStepVerificationSetupActivity.java @@ -22,6 +22,7 @@ import android.graphics.PorterDuffColorFilter; import android.graphics.Rect; import android.graphics.Typeface; import android.os.Build; +import android.os.Bundle; import android.os.Vibrator; import android.text.Editable; import android.text.InputType; @@ -33,6 +34,7 @@ import android.view.ActionMode; import android.view.Gravity; import android.view.Menu; import android.view.MenuItem; +import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.accessibility.AccessibilityNodeInfo; @@ -44,6 +46,8 @@ import android.widget.ScrollView; import android.widget.TextView; import android.widget.Toast; +import com.google.android.exoplayer2.util.Log; + import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.FileLog; import org.telegram.messenger.LocaleController; @@ -84,7 +88,8 @@ public class TwoStepVerificationSetupActivity extends BaseFragment { private ScrollView scrollView; private View actionBarBackground; private ImageView showPasswordButton; - + private int otherwiseReloginDays = -1; + private AnimatorSet buttonAnimation; private ArrayList fragmentsToClose = new ArrayList<>(); @@ -221,7 +226,11 @@ public class TwoStepVerificationSetupActivity extends BaseFragment { @Override public void onItemClick(int id) { if (id == -1) { - finishFragment(); + if (otherwiseReloginDays >= 0 && parentLayout.fragmentsStack.size() == 1) { + showSetForcePasswordAlert(); + } else { + finishFragment(); + } } else if (id == item_resend) { TLRPC.TL_account_resendPasswordEmail req = new TLRPC.TL_account_resendPasswordEmail(); ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> { @@ -357,6 +366,7 @@ public class TwoStepVerificationSetupActivity extends BaseFragment { TwoStepVerificationActivity fragment = new TwoStepVerificationActivity(); fragment.setForgotPasswordOnShow(); fragment.setPassword(currentPassword); + fragment.setBlockingAlert(otherwiseReloginDays); presentFragment(fragment, true); } }); @@ -382,6 +392,7 @@ public class TwoStepVerificationSetupActivity extends BaseFragment { } TwoStepVerificationSetupActivity fragment = new TwoStepVerificationSetupActivity(currentAccount, TYPE_ENTER_FIRST, currentPassword); fragment.closeAfterSet = closeAfterSet; + fragment.setBlockingAlert(otherwiseReloginDays); presentFragment(fragment, true); break; } @@ -391,6 +402,7 @@ public class TwoStepVerificationSetupActivity extends BaseFragment { } else { TwoStepVerificationActivity fragment = new TwoStepVerificationActivity(); fragment.setCurrentPasswordParams(currentPassword, currentPasswordHash, currentSecretId, currentSecret); + fragment.setBlockingAlert(otherwiseReloginDays); presentFragment(fragment, true); } break; @@ -429,7 +441,9 @@ public class TwoStepVerificationSetupActivity extends BaseFragment { needHideProgress(); currentPasswordHash = x_bytes; getMessagesController().removeSuggestion(0, "VALIDATE_PASSWORD"); - presentFragment(new TwoStepVerificationSetupActivity(TYPE_VERIFY_OK, currentPassword), true); + TwoStepVerificationSetupActivity fragment = new TwoStepVerificationSetupActivity(TYPE_VERIFY_OK, currentPassword); + fragment.setBlockingAlert(otherwiseReloginDays); + presentFragment(fragment, true); }); } else { AndroidUtilities.runOnUIThread(() -> { @@ -497,6 +511,7 @@ public class TwoStepVerificationSetupActivity extends BaseFragment { fragment.fragmentsToClose.addAll(fragmentsToClose); fragment.fragmentsToClose.add(this); fragment.closeAfterSet = closeAfterSet; + fragment.setBlockingAlert(otherwiseReloginDays); presentFragment(fragment); break; } @@ -517,6 +532,7 @@ public class TwoStepVerificationSetupActivity extends BaseFragment { fragment.fragmentsToClose.addAll(fragmentsToClose); fragment.fragmentsToClose.add(this); fragment.closeAfterSet = closeAfterSet; + fragment.setBlockingAlert(otherwiseReloginDays); presentFragment(fragment); break; } @@ -557,6 +573,7 @@ public class TwoStepVerificationSetupActivity extends BaseFragment { fragment.fragmentsToClose.addAll(fragmentsToClose); fragment.addFragmentToClose(TwoStepVerificationSetupActivity.this); fragment.setCurrentEmailCode(code); + fragment.setBlockingAlert(otherwiseReloginDays); presentFragment(fragment, true); } else { if (error == null || error.text.startsWith("CODE_INVALID")) { @@ -602,6 +619,7 @@ public class TwoStepVerificationSetupActivity extends BaseFragment { currentPassword.has_recovery = true; currentPassword.email_unconfirmed_pattern = ""; fragment.setCurrentPasswordParams(currentPassword, currentPasswordHash, currentSecretId, currentSecret); + fragment.setBlockingAlert(otherwiseReloginDays); presentFragment(fragment, true); NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.didSetOrRemoveTwoStepPassword, currentPassword); }); @@ -627,6 +645,7 @@ public class TwoStepVerificationSetupActivity extends BaseFragment { fragment.setCurrentPasswordParams(currentPasswordHash, currentSecretId, currentSecret, emailOnly); fragment.fragmentsToClose.addAll(fragmentsToClose); fragment.closeAfterSet = closeAfterSet; + fragment.setBlockingAlert(otherwiseReloginDays); presentFragment(fragment, true); NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.twoStepPasswordChanged, currentPasswordHash, currentPassword.new_algo, currentPassword.new_secure_algo, currentPassword.secure_random, email, hint, null, firstPassword); NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.didSetOrRemoveTwoStepPassword, currentPassword); @@ -1303,6 +1322,7 @@ public class TwoStepVerificationSetupActivity extends BaseFragment { fragment.fragmentsToClose.addAll(fragmentsToClose); fragment.fragmentsToClose.add(this); fragment.closeAfterSet = closeAfterSet; + fragment.setBlockingAlert(otherwiseReloginDays); presentFragment(fragment); } else { email = ""; @@ -1486,6 +1506,7 @@ public class TwoStepVerificationSetupActivity extends BaseFragment { currentPassword.has_recovery = false; currentPassword.email_unconfirmed_pattern = ""; fragment.setCurrentPasswordParams(currentPassword, currentPasswordHash, currentSecretId, currentSecret); + fragment.setBlockingAlert(otherwiseReloginDays); presentFragment(fragment, true); NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.didRemoveTwoStepPassword); } @@ -1605,6 +1626,7 @@ public class TwoStepVerificationSetupActivity extends BaseFragment { currentPassword.has_recovery = !TextUtils.isEmpty(currentPassword.email_unconfirmed_pattern); } fragment.setCurrentPasswordParams(currentPassword, newPasswordHash != null ? newPasswordHash : currentPasswordHash, currentSecretId, currentSecret); + fragment.setBlockingAlert(otherwiseReloginDays); presentFragment(fragment, true); NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.didSetOrRemoveTwoStepPassword, currentPassword); }); @@ -1633,6 +1655,7 @@ public class TwoStepVerificationSetupActivity extends BaseFragment { TwoStepVerificationSetupActivity fragment = new TwoStepVerificationSetupActivity(TYPE_PASSWORD_SET, currentPassword); fragment.setCurrentPasswordParams(newPasswordHash != null ? newPasswordHash : currentPasswordHash, currentSecretId, currentSecret, emailOnly); fragment.closeAfterSet = closeAfterSet; + fragment.setBlockingAlert(otherwiseReloginDays); presentFragment(fragment, true); NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.didSetOrRemoveTwoStepPassword, currentPassword); } @@ -1648,6 +1671,7 @@ public class TwoStepVerificationSetupActivity extends BaseFragment { TwoStepVerificationSetupActivity fragment = new TwoStepVerificationSetupActivity(TwoStepVerificationSetupActivity.TYPE_EMAIL_CONFIRM, currentPassword); fragment.setCurrentPasswordParams(newPasswordHash != null ? newPasswordHash : currentPasswordHash, currentSecretId, currentSecret, emailOnly); fragment.closeAfterSet = closeAfterSet; + fragment.setBlockingAlert(otherwiseReloginDays); presentFragment(fragment, true); } else { if ("EMAIL_INVALID".equals(error.text)) { @@ -1759,4 +1783,51 @@ public class TwoStepVerificationSetupActivity extends BaseFragment { return themeDescriptions; } + + @Override + public boolean isSwipeBackEnabled(MotionEvent event) { + if (otherwiseReloginDays >= 0 && parentLayout.fragmentsStack.size() == 1) { + return false; + } + return super.isSwipeBackEnabled(event); + } + + @Override + public boolean onBackPressed() { + if (otherwiseReloginDays >= 0 && parentLayout.fragmentsStack.size() == 1) { + showSetForcePasswordAlert(); + return false; + } + return super.onBackPressed(); + } + + private void showSetForcePasswordAlert() { + AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); + builder.setTitle(LocaleController.getString("Warning", R.string.Warning)); + builder.setMessage(LocaleController.formatPluralString("ForceSetPasswordAlertMessage", otherwiseReloginDays)); + builder.setPositiveButton(LocaleController.getString("ForceSetPasswordContinue", R.string.ForceSetPasswordContinue), (a1, a2) -> { + + }); + + builder.setNegativeButton(LocaleController.getString("ForceSetPasswordCancel", R.string.ForceSetPasswordCancel), (a1, a2) -> { + finishFragment(); + }); + AlertDialog alertDialog = builder.show(); + ((TextView)alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE)).setTextColor(Theme.getColor(Theme.key_dialogTextRed2)); + } + + public void setBlockingAlert(int otherwiseRelogin) { + otherwiseReloginDays = otherwiseRelogin; + } + + @Override + public void finishFragment() { + if (otherwiseReloginDays >= 0 && parentLayout.fragmentsStack.size() == 1) { + final Bundle args = new Bundle(); + args.putBoolean("afterSignup", true); + presentFragment(new DialogsActivity(args), true); + } else { + super.finishFragment(); + } + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/VoIPFragment.java b/TMessagesProj/src/main/java/org/telegram/ui/VoIPFragment.java index 80070efc2..f582e0306 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/VoIPFragment.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/VoIPFragment.java @@ -1706,6 +1706,7 @@ public class VoIPFragment implements VoIPService.StateListener, NotificationCent byte[] sha256 = Utilities.computeSHA256(auth_key, 0, auth_key.length); String[] emoji = EncryptionKeyEmojifier.emojifyForCall(sha256); for (int i = 0; i < 4; i++) { + Emoji.preloadEmoji(emoji[i]); Emoji.EmojiDrawable drawable = Emoji.getEmojiDrawable(emoji[i]); if (drawable != null) { drawable.setBounds(0, 0, AndroidUtilities.dp(22), AndroidUtilities.dp(22)); diff --git a/TMessagesProj/src/main/res/drawable-hdpi/device_desktop_osx.png b/TMessagesProj/src/main/res/drawable-hdpi/device_desktop_osx.png new file mode 100644 index 000000000..01127c643 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/device_desktop_osx.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/device_desktop_other.png b/TMessagesProj/src/main/res/drawable-hdpi/device_desktop_other.png new file mode 100644 index 000000000..c42b092c7 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/device_desktop_other.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/device_desktop_win.png b/TMessagesProj/src/main/res/drawable-hdpi/device_desktop_win.png new file mode 100644 index 000000000..80a77c625 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/device_desktop_win.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/device_phone_android.png b/TMessagesProj/src/main/res/drawable-hdpi/device_phone_android.png new file mode 100644 index 000000000..8a96504d0 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/device_phone_android.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/device_phone_ios.png b/TMessagesProj/src/main/res/drawable-hdpi/device_phone_ios.png new file mode 100644 index 000000000..dcc8bbfdb Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/device_phone_ios.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/device_phone_windows.png b/TMessagesProj/src/main/res/drawable-hdpi/device_phone_windows.png new file mode 100644 index 000000000..25be94d2a Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/device_phone_windows.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/device_tablet_android.png b/TMessagesProj/src/main/res/drawable-hdpi/device_tablet_android.png new file mode 100644 index 000000000..7a7426e82 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/device_tablet_android.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/device_tablet_ios.png b/TMessagesProj/src/main/res/drawable-hdpi/device_tablet_ios.png new file mode 100644 index 000000000..e1270952b Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/device_tablet_ios.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/device_web_chrome.png b/TMessagesProj/src/main/res/drawable-hdpi/device_web_chrome.png new file mode 100644 index 000000000..19473d3bc Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/device_web_chrome.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/device_web_edge.png b/TMessagesProj/src/main/res/drawable-hdpi/device_web_edge.png new file mode 100644 index 000000000..0586a986c Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/device_web_edge.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/device_web_firefox.png b/TMessagesProj/src/main/res/drawable-hdpi/device_web_firefox.png new file mode 100644 index 000000000..46ea2e6ee Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/device_web_firefox.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/device_web_opera.png b/TMessagesProj/src/main/res/drawable-hdpi/device_web_opera.png new file mode 100644 index 000000000..97693369f Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/device_web_opera.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/device_web_other.png b/TMessagesProj/src/main/res/drawable-hdpi/device_web_other.png new file mode 100644 index 000000000..b80a5b684 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/device_web_other.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/device_web_safari.png b/TMessagesProj/src/main/res/drawable-hdpi/device_web_safari.png new file mode 100644 index 000000000..8d3de2aba Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/device_web_safari.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/fast_scroll_shadow.png b/TMessagesProj/src/main/res/drawable-hdpi/fast_scroll_shadow.png new file mode 100644 index 000000000..529005b73 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/fast_scroll_shadow.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/login_arrow1.png b/TMessagesProj/src/main/res/drawable-hdpi/login_arrow1.png new file mode 100644 index 000000000..cfa1b52ea Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/login_arrow1.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/login_phone1.png b/TMessagesProj/src/main/res/drawable-hdpi/login_phone1.png new file mode 100644 index 000000000..93e7eda1c Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/login_phone1.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/menu_devices.png b/TMessagesProj/src/main/res/drawable-hdpi/menu_devices.png index c1a09ea75..4a8003c9b 100644 Binary files a/TMessagesProj/src/main/res/drawable-hdpi/menu_devices.png and b/TMessagesProj/src/main/res/drawable-hdpi/menu_devices.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/msg_mini_qr.png b/TMessagesProj/src/main/res/drawable-hdpi/msg_mini_qr.png new file mode 100644 index 000000000..3a97c287e Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/msg_mini_qr.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/msg_qrcode.png b/TMessagesProj/src/main/res/drawable-hdpi/msg_qrcode.png index 1cad471a9..b8c0ae4e5 100644 Binary files a/TMessagesProj/src/main/res/drawable-hdpi/msg_qrcode.png and b/TMessagesProj/src/main/res/drawable-hdpi/msg_qrcode.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/msg_select.png b/TMessagesProj/src/main/res/drawable-hdpi/msg_select.png new file mode 100644 index 000000000..f36e5d9bc Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/msg_select.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/device_desktop_osx.png b/TMessagesProj/src/main/res/drawable-mdpi/device_desktop_osx.png new file mode 100644 index 000000000..c85505188 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/device_desktop_osx.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/device_desktop_other.png b/TMessagesProj/src/main/res/drawable-mdpi/device_desktop_other.png new file mode 100644 index 000000000..9bbf7489c Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/device_desktop_other.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/device_desktop_win.png b/TMessagesProj/src/main/res/drawable-mdpi/device_desktop_win.png new file mode 100644 index 000000000..64363b2fb Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/device_desktop_win.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/device_phone_android.png b/TMessagesProj/src/main/res/drawable-mdpi/device_phone_android.png new file mode 100644 index 000000000..66953a7e8 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/device_phone_android.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/device_phone_ios.png b/TMessagesProj/src/main/res/drawable-mdpi/device_phone_ios.png new file mode 100644 index 000000000..74243c6ce Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/device_phone_ios.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/device_phone_windows.png b/TMessagesProj/src/main/res/drawable-mdpi/device_phone_windows.png new file mode 100644 index 000000000..22158de8f Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/device_phone_windows.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/device_tablet_android.png b/TMessagesProj/src/main/res/drawable-mdpi/device_tablet_android.png new file mode 100644 index 000000000..54afe7690 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/device_tablet_android.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/device_tablet_ios.png b/TMessagesProj/src/main/res/drawable-mdpi/device_tablet_ios.png new file mode 100644 index 000000000..c1b8038fd Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/device_tablet_ios.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/device_web_chrome.png b/TMessagesProj/src/main/res/drawable-mdpi/device_web_chrome.png new file mode 100644 index 000000000..3d02b5ebd Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/device_web_chrome.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/device_web_edge.png b/TMessagesProj/src/main/res/drawable-mdpi/device_web_edge.png new file mode 100644 index 000000000..c8935db07 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/device_web_edge.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/device_web_firefox.png b/TMessagesProj/src/main/res/drawable-mdpi/device_web_firefox.png new file mode 100644 index 000000000..907691f83 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/device_web_firefox.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/device_web_opera.png b/TMessagesProj/src/main/res/drawable-mdpi/device_web_opera.png new file mode 100644 index 000000000..319ce5687 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/device_web_opera.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/device_web_other.png b/TMessagesProj/src/main/res/drawable-mdpi/device_web_other.png new file mode 100644 index 000000000..081c7a625 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/device_web_other.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/device_web_safari.png b/TMessagesProj/src/main/res/drawable-mdpi/device_web_safari.png new file mode 100644 index 000000000..f783086ac Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/device_web_safari.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/fast_scroll_shadow.png b/TMessagesProj/src/main/res/drawable-mdpi/fast_scroll_shadow.png new file mode 100644 index 000000000..386d02678 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/fast_scroll_shadow.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/login_arrow1.png b/TMessagesProj/src/main/res/drawable-mdpi/login_arrow1.png new file mode 100644 index 000000000..73fba76ee Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/login_arrow1.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/login_phone1.png b/TMessagesProj/src/main/res/drawable-mdpi/login_phone1.png new file mode 100644 index 000000000..c1bbebf34 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/login_phone1.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/menu_devices.png b/TMessagesProj/src/main/res/drawable-mdpi/menu_devices.png index 3783a7a1e..d2143f03a 100644 Binary files a/TMessagesProj/src/main/res/drawable-mdpi/menu_devices.png and b/TMessagesProj/src/main/res/drawable-mdpi/menu_devices.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/msg_mini_qr.png b/TMessagesProj/src/main/res/drawable-mdpi/msg_mini_qr.png new file mode 100644 index 000000000..0679eb464 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/msg_mini_qr.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/msg_qrcode.png b/TMessagesProj/src/main/res/drawable-mdpi/msg_qrcode.png index 7ca846156..4928dc659 100644 Binary files a/TMessagesProj/src/main/res/drawable-mdpi/msg_qrcode.png and b/TMessagesProj/src/main/res/drawable-mdpi/msg_qrcode.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/msg_select.png b/TMessagesProj/src/main/res/drawable-mdpi/msg_select.png new file mode 100644 index 000000000..5d9d2a7c8 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/msg_select.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/device_desktop_osx.png b/TMessagesProj/src/main/res/drawable-xhdpi/device_desktop_osx.png new file mode 100644 index 000000000..1d6bc0bf4 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/device_desktop_osx.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/device_desktop_other.png b/TMessagesProj/src/main/res/drawable-xhdpi/device_desktop_other.png new file mode 100644 index 000000000..28b168d04 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/device_desktop_other.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/device_desktop_win.png b/TMessagesProj/src/main/res/drawable-xhdpi/device_desktop_win.png new file mode 100644 index 000000000..0a163d686 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/device_desktop_win.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/device_phone_android.png b/TMessagesProj/src/main/res/drawable-xhdpi/device_phone_android.png new file mode 100644 index 000000000..68509224e Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/device_phone_android.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/device_phone_ios.png b/TMessagesProj/src/main/res/drawable-xhdpi/device_phone_ios.png new file mode 100644 index 000000000..83e70eeb7 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/device_phone_ios.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/device_phone_windows.png b/TMessagesProj/src/main/res/drawable-xhdpi/device_phone_windows.png new file mode 100644 index 000000000..ff6b70ab8 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/device_phone_windows.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/device_tablet_android.png b/TMessagesProj/src/main/res/drawable-xhdpi/device_tablet_android.png new file mode 100644 index 000000000..5a984f687 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/device_tablet_android.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/device_tablet_ios.png b/TMessagesProj/src/main/res/drawable-xhdpi/device_tablet_ios.png new file mode 100644 index 000000000..c42267278 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/device_tablet_ios.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/device_web_chrome.png b/TMessagesProj/src/main/res/drawable-xhdpi/device_web_chrome.png new file mode 100644 index 000000000..48c76cbed Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/device_web_chrome.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/device_web_edge.png b/TMessagesProj/src/main/res/drawable-xhdpi/device_web_edge.png new file mode 100644 index 000000000..850ba347b Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/device_web_edge.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/device_web_firefox.png b/TMessagesProj/src/main/res/drawable-xhdpi/device_web_firefox.png new file mode 100644 index 000000000..9931425b1 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/device_web_firefox.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/device_web_opera.png b/TMessagesProj/src/main/res/drawable-xhdpi/device_web_opera.png new file mode 100644 index 000000000..009ffad93 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/device_web_opera.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/device_web_other.png b/TMessagesProj/src/main/res/drawable-xhdpi/device_web_other.png new file mode 100644 index 000000000..4810a1eb7 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/device_web_other.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/device_web_safari.png b/TMessagesProj/src/main/res/drawable-xhdpi/device_web_safari.png new file mode 100644 index 000000000..fbedfffbb Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/device_web_safari.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/fast_scroll_shadow.png b/TMessagesProj/src/main/res/drawable-xhdpi/fast_scroll_shadow.png new file mode 100644 index 000000000..81deef97f Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/fast_scroll_shadow.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/login_arrow1.png b/TMessagesProj/src/main/res/drawable-xhdpi/login_arrow1.png new file mode 100644 index 000000000..91840c04b Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/login_arrow1.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/login_phone1.png b/TMessagesProj/src/main/res/drawable-xhdpi/login_phone1.png new file mode 100644 index 000000000..cfb717306 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/login_phone1.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/menu_devices.png b/TMessagesProj/src/main/res/drawable-xhdpi/menu_devices.png index 3b142cbbf..50c5d6b2b 100644 Binary files a/TMessagesProj/src/main/res/drawable-xhdpi/menu_devices.png and b/TMessagesProj/src/main/res/drawable-xhdpi/menu_devices.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/msg_mini_qr.png b/TMessagesProj/src/main/res/drawable-xhdpi/msg_mini_qr.png new file mode 100644 index 000000000..e6832037e Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/msg_mini_qr.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/msg_qrcode.png b/TMessagesProj/src/main/res/drawable-xhdpi/msg_qrcode.png index 9cb54810e..948fc8bc6 100644 Binary files a/TMessagesProj/src/main/res/drawable-xhdpi/msg_qrcode.png and b/TMessagesProj/src/main/res/drawable-xhdpi/msg_qrcode.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/msg_select.png b/TMessagesProj/src/main/res/drawable-xhdpi/msg_select.png new file mode 100644 index 000000000..c25d5ce12 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/msg_select.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/device_desktop_osx.png b/TMessagesProj/src/main/res/drawable-xxhdpi/device_desktop_osx.png new file mode 100644 index 000000000..8d6e9770c Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/device_desktop_osx.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/device_desktop_other.png b/TMessagesProj/src/main/res/drawable-xxhdpi/device_desktop_other.png new file mode 100644 index 000000000..9b1fc9ded Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/device_desktop_other.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/device_desktop_win.png b/TMessagesProj/src/main/res/drawable-xxhdpi/device_desktop_win.png new file mode 100644 index 000000000..7ce5b5ec0 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/device_desktop_win.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/device_phone_android.png b/TMessagesProj/src/main/res/drawable-xxhdpi/device_phone_android.png new file mode 100644 index 000000000..1cd5aacbb Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/device_phone_android.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/device_phone_ios.png b/TMessagesProj/src/main/res/drawable-xxhdpi/device_phone_ios.png new file mode 100644 index 000000000..0f19aed0b Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/device_phone_ios.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/device_phone_windows.png b/TMessagesProj/src/main/res/drawable-xxhdpi/device_phone_windows.png new file mode 100644 index 000000000..557ce5d57 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/device_phone_windows.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/device_tablet_android.png b/TMessagesProj/src/main/res/drawable-xxhdpi/device_tablet_android.png new file mode 100644 index 000000000..c2de55724 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/device_tablet_android.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/device_tablet_ios.png b/TMessagesProj/src/main/res/drawable-xxhdpi/device_tablet_ios.png new file mode 100644 index 000000000..5bde48400 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/device_tablet_ios.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/device_web_chrome.png b/TMessagesProj/src/main/res/drawable-xxhdpi/device_web_chrome.png new file mode 100644 index 000000000..73a487ecf Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/device_web_chrome.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/device_web_edge.png b/TMessagesProj/src/main/res/drawable-xxhdpi/device_web_edge.png new file mode 100644 index 000000000..84d404c3b Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/device_web_edge.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/device_web_firefox.png b/TMessagesProj/src/main/res/drawable-xxhdpi/device_web_firefox.png new file mode 100644 index 000000000..9f356bab3 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/device_web_firefox.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/device_web_opera.png b/TMessagesProj/src/main/res/drawable-xxhdpi/device_web_opera.png new file mode 100644 index 000000000..fb8cbe5b9 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/device_web_opera.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/device_web_other.png b/TMessagesProj/src/main/res/drawable-xxhdpi/device_web_other.png new file mode 100644 index 000000000..e145e382a Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/device_web_other.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/device_web_safari.png b/TMessagesProj/src/main/res/drawable-xxhdpi/device_web_safari.png new file mode 100644 index 000000000..fc5929383 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/device_web_safari.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/fast_scroll_shadow.png b/TMessagesProj/src/main/res/drawable-xxhdpi/fast_scroll_shadow.png new file mode 100644 index 000000000..d43c5db56 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/fast_scroll_shadow.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/login_arrow1.png b/TMessagesProj/src/main/res/drawable-xxhdpi/login_arrow1.png new file mode 100644 index 000000000..d8fdda403 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/login_arrow1.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/login_phone1.png b/TMessagesProj/src/main/res/drawable-xxhdpi/login_phone1.png new file mode 100644 index 000000000..a49f7e0b8 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/login_phone1.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/menu_devices.png b/TMessagesProj/src/main/res/drawable-xxhdpi/menu_devices.png index 8bf5deb66..bcdf446f8 100644 Binary files a/TMessagesProj/src/main/res/drawable-xxhdpi/menu_devices.png and b/TMessagesProj/src/main/res/drawable-xxhdpi/menu_devices.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/msg_mini_qr.png b/TMessagesProj/src/main/res/drawable-xxhdpi/msg_mini_qr.png new file mode 100644 index 000000000..85c921831 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/msg_mini_qr.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/msg_qrcode.png b/TMessagesProj/src/main/res/drawable-xxhdpi/msg_qrcode.png index 67ba5b409..ea64e34f1 100644 Binary files a/TMessagesProj/src/main/res/drawable-xxhdpi/msg_qrcode.png and b/TMessagesProj/src/main/res/drawable-xxhdpi/msg_qrcode.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/msg_select.png b/TMessagesProj/src/main/res/drawable-xxhdpi/msg_select.png new file mode 100644 index 000000000..b4f5db3c3 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/msg_select.png differ diff --git a/TMessagesProj/src/main/res/raw/android_30.json b/TMessagesProj/src/main/res/raw/android_30.json new file mode 100644 index 000000000..8c5214467 --- /dev/null +++ b/TMessagesProj/src/main/res/raw/android_30.json @@ -0,0 +1 @@ +{"v":"5.7.4","fr":60,"ip":0,"op":180,"w":30,"h":30,"nm":"android_30","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Eye L","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[10.5,16,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":60,"s":[16.667,16.667,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":70,"s":[20,5,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":80,"s":[16.667,16.667,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":90,"s":[20,5,100]},{"t":100,"s":[16.667,16.667,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[3,3],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Контур эллипса 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Заливка 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Eye L","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":-60,"op":238,"st":50,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Eye R","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[19.5,16,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":60,"s":[16.667,16.667,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":70,"s":[20,5,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":80,"s":[16.667,16.667,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":90,"s":[20,5,100]},{"t":100,"s":[16.667,16.667,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[3,3],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Контур эллипса 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Заливка 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Eye R","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":-60,"op":238,"st":50,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Face","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[15,15.5,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[16.667,16.667,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-0.335,1.25],[-4.973,0],[-1.361,-5.079],[0.382,-0.702],[0.129,-0.123],[1.573,0],[0,0],[0.579,0.551],[0.085,0.157]],"o":[[1.361,-5.079],[4.973,0],[0.335,1.25],[-0.085,0.157],[-0.579,0.551],[0,0],[-1.573,0],[-0.129,-0.123],[-0.382,-0.702]],"v":[[-10.536,2.379],[0,-6],[10.536,2.379],[10.657,4.957],[10.279,5.449],[7.34,6],[-7.34,6],[-10.279,5.449],[-10.657,4.957]],"c":true},"ix":2},"nm":"Контур 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Заливка 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Face","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":-60,"op":234,"st":50,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"Ri","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[20.75,9.75,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[16.667,16.667,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":1,"y":0},"t":60,"s":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[1.25,-2.25],[-1.25,2.25]],"c":false}]},{"i":{"x":0.833,"y":1},"o":{"x":0.333,"y":0},"t":70,"s":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[2.5,-1],[-1.25,2.25]],"c":false}]},{"i":{"x":0.667,"y":1},"o":{"x":1,"y":0},"t":80,"s":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[1.25,-2.25],[-1.25,2.25]],"c":false}]},{"i":{"x":0,"y":1},"o":{"x":0.333,"y":0},"t":90,"s":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[2.5,-1],[-1.25,2.25]],"c":false}]},{"t":100,"s":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[1.25,-2.25],[-1.25,2.25]],"c":false}]}],"ix":2},"nm":"Контур 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":1.66,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Обводка 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Ri","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":-60,"op":234,"st":50,"bm":0},{"ddd":0,"ind":5,"ty":4,"nm":"Le","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[9.25,9.75,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[16.667,16.667,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":1,"y":0},"t":60,"s":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[-1.25,-2.25],[1.25,2.25]],"c":false}]},{"i":{"x":0.833,"y":1},"o":{"x":0.333,"y":0},"t":70,"s":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[-2.5,-1],[1.25,2.25]],"c":false}]},{"i":{"x":0.667,"y":1},"o":{"x":1,"y":0},"t":80,"s":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[-1.25,-2.25],[1.25,2.25]],"c":false}]},{"i":{"x":0,"y":1},"o":{"x":0.333,"y":0},"t":90,"s":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[-2.5,-1],[1.25,2.25]],"c":false}]},{"t":100,"s":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[-1.25,-2.25],[1.25,2.25]],"c":false}]}],"ix":2},"nm":"Контур 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":1.66,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Обводка 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Le","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":-60,"op":234,"st":50,"bm":0}],"markers":[]} \ No newline at end of file diff --git a/TMessagesProj/src/main/res/raw/calls_log.json b/TMessagesProj/src/main/res/raw/calls_log.json new file mode 100644 index 000000000..d9e0f73df --- /dev/null +++ b/TMessagesProj/src/main/res/raw/calls_log.json @@ -0,0 +1 @@ +{"v":"4.8.0","meta":{"g":"LottieFiles AE 1.0.0","a":"","k":"","d":"","tc":""},"fr":60,"ip":0,"op":120,"w":192,"h":168,"nm":"permissions calls copy 2","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":15,"s":[111,84,0],"to":[2.5,0,0],"ti":[0,0,0]},{"t":35,"s":[126,84,0]}],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":15,"s":[46,46,100]},{"t":35,"s":[100,100,100]}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":15,"s":[{"i":[[0,0],[0,-8.28],[8.28,0],[0,0],[0,8.28],[-8.28,0]],"o":[[8.28,0],[0,8.28],[0,0],[-8.28,0],[0,-8.28],[0,0]],"v":[[70.098,-15],[85.098,0],[70.098,15],[-68.739,15],[-83.739,0],[-68.739,-15]],"c":true}]},{"t":35,"s":[{"i":[[0,0],[0,-8.28],[8.28,0],[0,0],[0,8.28],[-8.28,0]],"o":[[8.28,0],[0,8.28],[0,0],[-8.28,0],[0,-8.28],[0,0]],"v":[[47,-15],[62,0],[47,15],[-47,15],[-62,0],[-47,-15]],"c":true}]}],"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ind":1,"ty":"sh","ix":2,"ks":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":15,"s":[{"i":[[0.279,0.056],[0,-0.442],[-0.391,0],[0.007,0.255]],"o":[[-0.595,0],[0,0.374],[0.424,0],[0,-0.442]],"v":[[-41.821,0.012],[-42.4,0.594],[-41.986,0.887],[-41.515,0.594]],"c":true}]},{"t":35,"s":[{"i":[[3.31,0],[0,-3.31],[-3.31,0],[0,3.31]],"o":[[-3.31,0],[0,3.31],[3.31,0],[0,-3.31]],"v":[[-42,-6],[-48,0],[-42,6],[-36,0]],"c":true}]}],"ix":2},"nm":"Path 2","mn":"ADBE Vector Shape - Group","hd":false},{"ind":2,"ty":"sh","ix":3,"ks":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":15,"s":[{"i":[[0.492,0],[0,-0.442],[-0.391,0],[0,0.476]],"o":[[-0.595,0],[0,0.374],[0.424,0],[0,-0.442]],"v":[[-30.358,0.012],[-30.937,0.594],[-30.523,0.887],[-30.053,0.594]],"c":true}]},{"t":35,"s":[{"i":[[3.31,0],[0,-3.31],[-3.31,0],[0,3.31]],"o":[[-3.31,0],[0,3.31],[3.31,0],[0,-3.31]],"v":[[-21,-6],[-27,0],[-21,6],[-15,0]],"c":true}]}],"ix":2},"nm":"Path 3","mn":"ADBE Vector Shape - Group","hd":false},{"ind":3,"ty":"sh","ix":4,"ks":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":15,"s":[{"i":[[0.492,0],[0,-0.442],[-0.391,0],[0,0.476]],"o":[[-0.595,0],[0,0.374],[0.424,0],[0,-0.442]],"v":[[-14.647,0.012],[-15.226,0.594],[-14.812,0.887],[-14.342,0.594]],"c":true}]},{"t":35,"s":[{"i":[[3.31,0],[0,-3.31],[-3.31,0],[0,3.31]],"o":[[-3.31,0],[0,3.31],[3.31,0],[0,-3.31]],"v":[[0,-6],[-6,0],[0,6],[6,0]],"c":true}]}],"ix":2},"nm":"Path 4","mn":"ADBE Vector Shape - Group","hd":false},{"ind":4,"ty":"sh","ix":5,"ks":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":15,"s":[{"i":[[0.492,0],[0,-0.442],[-0.391,0],[0,0.476]],"o":[[-0.595,0],[0,0.374],[0.424,0],[0,-0.442]],"v":[[4.375,0.012],[3.796,0.594],[4.21,0.887],[4.68,0.594]],"c":true}]},{"t":35,"s":[{"i":[[3.31,0],[0,-3.31],[-3.31,0],[0,3.31]],"o":[[-3.31,0],[0,3.31],[3.31,0],[0,-3.31]],"v":[[21,-6],[15,0],[21,6],[27,0]],"c":true}]}],"ix":2},"nm":"Path 5","mn":"ADBE Vector Shape - Group","hd":false},{"ind":5,"ty":"sh","ix":6,"ks":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":15,"s":[{"i":[[0.492,0],[0,-0.442],[-0.391,0],[0,0.476]],"o":[[-0.595,0],[0,0.374],[0.424,0],[0,-0.442]],"v":[[27.472,0.012],[26.894,0.594],[27.308,0.887],[27.778,0.594]],"c":true}]},{"t":35,"s":[{"i":[[3.31,0],[0,-3.31],[-3.31,0],[0,3.31]],"o":[[-3.31,0],[0,3.31],[3.31,0],[0,-3.31]],"v":[[42,-6],[36,0],[42,6],[48,0]],"c":true}]}],"ix":2},"nm":"Path 6","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":1,"nm":"Merge Paths 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape","np":8,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":0,"cix":2,"bm":0,"ix":2,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":120,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Shape","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":15,"s":[51,84,0],"to":[-3.833,0,0],"ti":[3.833,0,0]},{"t":33,"s":[28,84,0]}],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[0.748,0.748,1.785]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":15,"s":[34,34,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[-3.421,-3.421,-0.314]},"t":30,"s":[102,102,100]},{"t":36,"s":[100,100,100]}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-13.25,0],[0,-13.25],[13.25,0],[0,13.25]],"o":[[13.25,0],[0,13.25],[-13.25,0],[0,-13.25]],"v":[[0,-24],[24,0],[0,24],[-24,0]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ind":1,"ty":"sh","ix":2,"ks":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.167,"y":0.167},"t":15,"s":[{"i":[[0.01,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,-0.02],[-0.02,-0.01],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[-0.01,-0.01],[0,0],[-0.01,0],[-0.03,0.02],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[-0.01,-0.01],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[-0.04,-0.04],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[-0.03,0],[-0.02,0.08],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0.01],[0,0.01],[0.01,0.01]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[-0.04,0.02],[0,0.02],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0.01,0],[0,0],[0.03,0.01],[0.03,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0.01,-0.01],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[-0.02,0.03],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0.04,0.02],[0.03,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,-0.01],[0,-0.02],[0,-0.01],[-0.01,-0.01]],"v":[[0.45,-0.5],[0.45,-0.5],[0.45,-0.5],[0.44,-0.5],[0.44,-0.5],[0.43,-0.5],[0.43,-0.5],[0.42,-0.5],[0.42,-0.5],[0.41,-0.49],[0.41,-0.49],[0.41,-0.49],[0.41,-0.49],[0.39,-0.48],[0.39,-0.48],[0.37,-0.48],[0.37,-0.48],[0.33,-0.46],[0.33,-0.46],[0.29,-0.44],[0.29,-0.44],[0.21,-0.4],[0.21,-0.4],[0.1,-0.35],[0.1,-0.35],[-0.01,-0.29],[-0.01,-0.29],[-0.2,-0.19],[-0.2,-0.19],[-0.43,-0.07],[-0.43,-0.07],[-0.5,-0.01],[-0.47,0.04],[-0.46,0.04],[-0.46,0.04],[-0.45,0.05],[-0.45,0.05],[-0.43,0.05],[-0.43,0.05],[-0.38,0.07],[-0.38,0.07],[-0.36,0.08],[-0.34,0.09],[-0.32,0.09],[-0.26,0.11],[-0.17,0.07],[0.09,-0.13],[0.09,-0.13],[0.18,-0.21],[0.18,-0.21],[0.21,-0.23],[0.21,-0.23],[0.23,-0.24],[0.23,-0.24],[0.23,-0.24],[0.23,-0.24],[0.26,-0.23],[0.26,-0.2],[0.26,-0.19],[0.25,-0.18],[0.25,-0.18],[0.25,-0.18],[0.25,-0.18],[0.24,-0.17],[0.24,-0.17],[0.23,-0.15],[0.23,-0.15],[0.2,-0.13],[0.2,-0.13],[0.17,-0.09],[0.17,-0.09],[0.02,0.06],[0.02,0.06],[0.01,0.07],[0.01,0.07],[0,0.07],[0,0.07],[0,0.08],[0,0.08],[-0.03,0.11],[-0.03,0.11],[-0.04,0.13],[-0.04,0.13],[-0.05,0.13],[-0.05,0.13],[-0.05,0.14],[-0.03,0.24],[0.02,0.28],[0.02,0.28],[0.05,0.3],[0.05,0.3],[0.12,0.36],[0.12,0.36],[0.15,0.39],[0.15,0.39],[0.19,0.42],[0.19,0.42],[0.21,0.44],[0.21,0.44],[0.23,0.46],[0.33,0.5],[0.4,0.39],[0.41,0.31],[0.41,0.31],[0.42,0.22],[0.42,0.22],[0.44,0.1],[0.44,0.1],[0.45,-0.01],[0.45,-0.01],[0.46,-0.06],[0.46,-0.06],[0.47,-0.14],[0.47,-0.14],[0.48,-0.21],[0.48,-0.21],[0.48,-0.26],[0.48,-0.26],[0.49,-0.3],[0.49,-0.3],[0.49,-0.34],[0.49,-0.34],[0.5,-0.38],[0.5,-0.41],[0.5,-0.46],[0.48,-0.49]],"c":true}]},{"t":36,"s":[{"i":[[0.21,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0.05,-0.46],[-0.58,-0.26],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[-0.2,-0.06],[0,0],[-0.43,-0.01],[-0.93,0.59],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[-0.01,0],[-0.15,-0.13],[0.01,-0.07],[0.07,-0.09],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[-1.39,-0.95],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[-1.02,0.09],[-0.36,1.91],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[-0.02,0.23],[0.04,0.19],[0.26,0.21]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[-1.22,0.48],[-0.06,0.48],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0.19,0.06],[0,0],[0.67,0.16],[0.77,0.01],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0.01,0],[0.16,-0.03],[0.15,0.14],[-0.01,0.04],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[-0.58,0.72],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0.9,0.62],[0.69,-0.06],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0.03,-0.26],[0.03,-0.35],[-0.03,-0.2],[-0.31,-0.25]],"v":[[10.671,-10.182],[10.561,-10.182],[10.561,-10.182],[10.401,-10.162],[10.401,-10.162],[10.221,-10.142],[10.221,-10.142],[9.941,-10.092],[9.941,-10.092],[9.701,-10.032],[9.701,-10.032],[9.431,-9.962],[9.431,-9.962],[9.021,-9.832],[9.021,-9.832],[8.391,-9.622],[8.391,-9.622],[7.461,-9.282],[7.461,-9.282],[6.301,-8.832],[6.301,-8.832],[4.041,-7.932],[4.041,-7.932],[0.871,-6.642],[0.871,-6.642],[-2.199,-5.362],[-2.199,-5.362],[-7.439,-3.132],[-7.439,-3.132],[-13.989,-0.322],[-13.989,-0.322],[-15.899,1.088],[-15.029,2.118],[-14.739,2.238],[-14.739,2.238],[-14.419,2.348],[-14.419,2.348],[-14.069,2.458],[-14.069,2.458],[-12.569,2.928],[-12.569,2.928],[-11.989,3.098],[-11.399,3.268],[-10.819,3.418],[-9.109,3.698],[-6.569,2.838],[0.511,-1.762],[0.511,-1.762],[3.141,-3.442],[3.141,-3.442],[4.051,-4.002],[4.051,-4.002],[4.451,-4.242],[4.451,-4.242],[4.581,-4.302],[4.601,-4.312],[5.301,-4.062],[5.441,-3.252],[5.311,-3.062],[5.171,-2.912],[5.171,-2.912],[4.991,-2.742],[4.991,-2.742],[4.781,-2.532],[4.781,-2.532],[4.391,-2.182],[4.391,-2.182],[3.781,-1.652],[3.781,-1.652],[2.721,-0.752],[2.721,-0.752],[-1.359,2.598],[-1.359,2.598],[-1.679,2.858],[-1.679,2.858],[-1.769,2.938],[-1.769,2.938],[-1.999,3.168],[-1.999,3.168],[-2.779,3.908],[-2.779,3.908],[-3.039,4.158],[-3.039,4.158],[-3.199,4.328],[-3.199,4.328],[-3.349,4.498],[-2.609,6.868],[-1.489,7.618],[-1.489,7.618],[-0.619,8.188],[-0.619,8.188],[1.441,9.568],[1.441,9.568],[2.331,10.158],[2.331,10.158],[3.541,10.948],[3.541,10.948],[3.981,11.248],[3.981,11.248],[4.611,11.698],[7.391,12.718],[9.161,10.108],[9.481,8.368],[9.481,8.368],[9.851,6.318],[9.851,6.318],[10.341,3.468],[10.341,3.468],[10.741,1.078],[10.741,1.078],[10.941,-0.122],[10.941,-0.122],[11.221,-1.892],[11.221,-1.892],[11.481,-3.592],[11.481,-3.592],[11.631,-4.662],[11.631,-4.662],[11.771,-5.672],[11.771,-5.672],[11.901,-6.602],[11.901,-6.602],[12.001,-7.452],[12.081,-8.192],[12.031,-9.192],[11.671,-9.882]],"c":true}]}],"ix":2},"nm":"Path 2","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":1,"nm":"Merge Paths 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape","np":4,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":120,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Rectangle Copy 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":15,"s":[111,118,0],"to":[0,1.333,0],"ti":[0,-1.333,0]},{"t":35,"s":[111,126,0]}],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-3.87,0],[0,0],[0,-3.87],[3.87,0],[0,0],[0,3.87]],"o":[[0,0],[3.87,0],[0,3.87],[0,0],[-3.87,0],[0,-3.87]],"v":[[-32,-7],[32,-7],[39,0],[32,7],[-32,7],[-39,0]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Rectangle Copy 2","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":120,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"Rectangle","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":15,"s":[111,50,0],"to":[0,-1.333,0],"ti":[0,1.333,0]},{"t":35,"s":[111,42,0]}],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-3.87,0],[0,0],[0,-3.87],[3.87,0],[0,0],[0,3.87]],"o":[[0,0],[3.87,0],[0,3.87],[0,0],[-3.87,0],[0,-3.87]],"v":[[-32,-7],[32,-7],[39,0],[32,7],[-32,7],[-39,0]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Rectangle","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":120,"st":0,"bm":0},{"ddd":0,"ind":5,"ty":4,"nm":"Oval Copy 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":15,"s":[51,118,0],"to":[0,1.333,0],"ti":[0,-1.333,0]},{"t":35,"s":[51,126,0]}],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-4.97,0],[0,4.97],[4.97,0],[0,-4.97]],"o":[[4.97,0],[0,-4.97],[-4.97,0],[0,4.97]],"v":[[0,9],[9,0],[0,-9],[-9,0]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Oval Copy 2","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":120,"st":0,"bm":0},{"ddd":0,"ind":6,"ty":4,"nm":"Oval","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":15,"s":[51,50,0],"to":[0,-1.333,0],"ti":[0,1.333,0]},{"t":35,"s":[51,42,0]}],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-4.97,0],[0,4.97],[4.97,0],[0,-4.97]],"o":[[4.97,0],[0,-4.97],[-4.97,0],[0,4.97]],"v":[[0,9],[9,0],[0,-9],[-9,0]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Oval","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":120,"st":0,"bm":0}],"markers":[]} \ No newline at end of file diff --git a/TMessagesProj/src/main/res/raw/chrome_30.json b/TMessagesProj/src/main/res/raw/chrome_30.json new file mode 100644 index 000000000..ff936eb63 --- /dev/null +++ b/TMessagesProj/src/main/res/raw/chrome_30.json @@ -0,0 +1 @@ +{"v":"5.7.4","fr":60,"ip":0,"op":180,"w":30,"h":30,"nm":"chrome_30","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Vector 20","parent":5,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[-38.383,-12.48,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[-100,-100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.333,"y":0},"t":60,"s":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[5,0],[-5,0]],"c":false}]},{"i":{"x":0.667,"y":1},"o":{"x":0.167,"y":0.167},"t":70,"s":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[5,0],[-5.252,2.02]],"c":false}]},{"t":80,"s":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[5,0],[-5,0]],"c":false}]}],"ix":2},"nm":"Контур 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":1.66,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Обводка 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":60,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Vector 20","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":-60,"op":230,"st":50,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Vector 20","parent":5,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[8.383,39.481,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[-100,-100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.333,"y":0},"t":60,"s":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[5,0],[-5,0]],"c":false}]},{"i":{"x":0.667,"y":1},"o":{"x":0.167,"y":0.167},"t":70,"s":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[5,0],[-5.879,2.144]],"c":false}]},{"t":80,"s":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[5,0],[-5,0]],"c":false}]}],"ix":2},"nm":"Контур 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":1.66,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Обводка 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":-60,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Vector 20","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":-60,"op":230,"st":50,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Vector 20","parent":5,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[30,-27,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.333,"y":0},"t":60,"s":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[5,0],[-5,0]],"c":false}]},{"i":{"x":0.667,"y":1},"o":{"x":0.167,"y":0.167},"t":70,"s":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[5,0],[-5.333,2]],"c":false}]},{"t":80,"s":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[5,0],[-5,0]],"c":false}]}],"ix":2},"nm":"Контур 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":1.66,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Обводка 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Vector 20","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":-60,"op":230,"st":50,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"Ellipse 18","parent":5,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[0,0,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":1,"k":[{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":60,"s":[9,9]},{"i":{"x":[0.667,0.667],"y":[1,1]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"t":70,"s":[5,5]},{"t":80,"s":[9,9]}],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Контур эллипса 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":1.66,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Обводка 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Ellipse 18","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":-60,"op":230,"st":50,"bm":0},{"ddd":0,"ind":5,"ty":4,"nm":"Ellipse 3","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":60,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":80,"s":[-245]},{"t":90,"s":[-240]}],"ix":10},"p":{"a":0,"k":[15,15,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[16.667,16.667,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[20,20],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Контур эллипса 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Заливка 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Ellipse 3","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":-60,"op":230,"st":50,"bm":0}],"markers":[]} \ No newline at end of file diff --git a/TMessagesProj/src/main/res/raw/edge_30.json b/TMessagesProj/src/main/res/raw/edge_30.json new file mode 100644 index 000000000..69fa2ca9d --- /dev/null +++ b/TMessagesProj/src/main/res/raw/edge_30.json @@ -0,0 +1 @@ +{"v":"5.7.4","fr":60,"ip":0,"op":180,"w":30,"h":30,"nm":"edge_30","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Union","parent":2,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[0,0.003,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":60,"s":[{"i":[[-0.082,0.078],[-0.014,0.019],[0,0.42],[0.001,0.035],[0,0],[0,0],[0,0.009],[0.002,0.03],[0.293,0.391],[0.348,0.176],[0.39,0.003],[0.247,-0.117],[0,0],[0,0],[0.009,-0.004],[0.226,-0.375],[0.005,-0.438],[-3.697,0],[-0.897,0.336],[-0.267,0.139],[-0.069,-0.011],[-0.048,-0.051],[-0.007,-0.069],[0.037,-0.059],[2.152,-0.744],[0,0],[0.253,-0.054],[-0.228,0.072],[2.252,0.966],[1.04,2.219],[-0.014,1.51],[-0.03,0.216],[0.003,-0.209],[-1.868,1.842],[-2.628,0],[-1.655,-3.238],[-0.012,-0.024],[-0.003,-0.006],[0.019,-1.66],[0.417,-0.725],[0.722,-0.422],[0.832,-0.002],[0.001,0],[1.105,0.768],[0,0.204]],"o":[[0.024,-0.023],[0.395,-0.514],[0,-0.029],[0,0],[0,0],[0,-0.009],[-0.001,-0.027],[-0.029,-0.486],[-0.233,-0.313],[-0.348,-0.176],[-0.533,-0.01],[0,0],[0,0],[-0.009,0.004],[-0.384,0.209],[-0.226,0.375],[0,3.263],[0.958,0.002],[0.282,-0.106],[0.061,-0.034],[0.069,0.011],[0.048,0.051],[0.007,0.069],[-1.215,1.926],[0,0],[-0.193,0.061],[0.234,-0.044],[-2.325,0.775],[-2.252,-0.966],[-0.636,-1.37],[0,-0.213],[-0.033,0.203],[0.041,-2.622],[1.871,-1.845],[3.886,0],[0.011,0.022],[0.003,0.006],[0.283,0.552],[-0.002,0.836],[-0.417,0.725],[-0.716,0.425],[0,0],[-0.073,0.003],[-0.236,-0.165],[0,-0.191]],"v":[[1.84,1.691],[1.9,1.628],[2.509,0.073],[2.508,-0.023],[2.508,-0.022],[2.508,-0.021],[2.507,-0.048],[2.504,-0.134],[2.011,-1.479],[1.127,-2.223],[0.004,-2.495],[-1.181,-2.196],[-1.181,-2.196],[-1.183,-2.195],[-1.21,-2.182],[-2.142,-1.29],[-2.493,-0.049],[4.423,5.757],[7.228,5.252],[8.051,4.885],[8.251,4.849],[8.43,4.943],[8.514,5.128],[8.467,5.325],[3.264,9.45],[3.162,9.484],[2.478,9.66],[3.171,9.487],[-3.935,9.19],[-9.045,4.245],[-9.991,-0.13],[-9.945,-0.774],[-10,-0.156],[-7.022,-7.122],[-0.001,-10.001],[9.114,-4.9],[9.149,-4.832],[9.157,-4.815],[10,-1.47],[9.361,0.912],[7.622,2.661],[5.258,3.314],[5.256,3.314],[2.011,2.635],[1.642,2.071]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":100,"s":[{"i":[[-0.082,0.078],[-0.014,0.019],[0,0.42],[0.001,0.035],[0,0],[0,0],[0,0.009],[0.002,0.03],[0.293,0.391],[0.348,0.176],[0.39,0.003],[0.247,-0.117],[0,0],[0,0],[0.009,-0.004],[0.226,-0.375],[0.005,-0.438],[-3.279,0.493],[-0.897,0.336],[-0.267,0.139],[-0.069,-0.011],[-0.048,-0.051],[-0.007,-0.069],[0.037,-0.059],[2.152,-0.744],[0,0],[0.253,-0.054],[-0.228,0.072],[2.252,0.966],[1.04,2.219],[-0.014,1.51],[-0.03,0.216],[0.003,-0.209],[-1.868,1.842],[-2.628,0],[-1.655,-3.238],[-0.012,-0.024],[-0.003,-0.006],[0.019,-1.66],[0.417,-0.725],[0.722,-0.422],[0.832,-0.002],[0.001,0],[1.105,0.768],[0,0.204]],"o":[[0.024,-0.023],[0.395,-0.514],[0,-0.029],[0,0],[0,0],[0,-0.009],[-0.001,-0.027],[-0.029,-0.486],[-0.233,-0.313],[-0.348,-0.176],[-0.533,-0.01],[0,0],[0,0],[-0.009,0.004],[-0.384,0.209],[-0.226,0.375],[0,3.263],[1.152,-0.173],[0.282,-0.106],[0.061,-0.034],[0.069,0.011],[0.048,0.051],[0.007,0.069],[-1.215,1.926],[0,0],[-0.193,0.061],[0.234,-0.044],[-2.325,0.775],[-2.252,-0.966],[-0.636,-1.37],[0,-0.213],[-0.033,0.203],[0.041,-2.622],[1.871,-1.845],[3.886,0],[0.011,0.022],[0.003,0.006],[0.283,0.552],[-0.002,0.836],[-0.417,0.725],[-0.716,0.425],[0,0],[-0.073,0.003],[-0.236,-0.165],[0,-0.191]],"v":[[1.319,2.836],[1.379,2.774],[2.509,0.073],[2.508,-0.023],[2.508,-0.022],[2.508,-0.021],[2.507,-0.048],[2.504,-0.134],[2.011,-1.479],[1.127,-2.223],[0.004,-2.495],[-1.181,-2.196],[-1.181,-2.196],[-1.183,-2.195],[-1.21,-2.182],[-2.142,-1.29],[-2.493,-0.049],[4.423,5.757],[6.189,5.293],[7.114,4.78],[7.313,4.745],[7.493,4.839],[7.577,5.024],[7.529,5.221],[3.264,9.45],[3.162,9.484],[2.478,9.66],[3.171,9.487],[-3.935,9.19],[-9.045,4.245],[-9.991,-0.13],[-9.945,-0.774],[-10,-0.156],[-7.022,-7.122],[-0.001,-10.001],[9.114,-4.9],[9.149,-4.832],[9.157,-4.815],[10,-1.47],[8.84,2.058],[7.102,3.807],[4.737,4.459],[4.735,4.459],[1.49,3.781],[1.121,3.216]],"c":true}]},{"t":110,"s":[{"i":[[-0.082,0.078],[-0.014,0.019],[0,0.42],[0.001,0.035],[0,0],[0,0],[0,0.009],[0.002,0.03],[0.293,0.391],[0.348,0.176],[0.39,0.003],[0.247,-0.117],[0,0],[0,0],[0.009,-0.004],[0.226,-0.375],[0.005,-0.438],[-3.697,0],[-0.897,0.336],[-0.267,0.139],[-0.069,-0.011],[-0.048,-0.051],[-0.007,-0.069],[0.037,-0.059],[2.152,-0.744],[0,0],[0.253,-0.054],[-0.228,0.072],[2.252,0.966],[1.04,2.219],[-0.014,1.51],[-0.03,0.216],[0.003,-0.209],[-1.868,1.842],[-2.628,0],[-1.655,-3.238],[-0.012,-0.024],[-0.003,-0.006],[0.019,-1.66],[0.417,-0.725],[0.722,-0.422],[0.832,-0.002],[0.001,0],[1.105,0.768],[0,0.204]],"o":[[0.024,-0.023],[0.395,-0.514],[0,-0.029],[0,0],[0,0],[0,-0.009],[-0.001,-0.027],[-0.029,-0.486],[-0.233,-0.313],[-0.348,-0.176],[-0.533,-0.01],[0,0],[0,0],[-0.009,0.004],[-0.384,0.209],[-0.226,0.375],[0,3.263],[0.958,0.002],[0.282,-0.106],[0.061,-0.034],[0.069,0.011],[0.048,0.051],[0.007,0.069],[-1.215,1.926],[0,0],[-0.193,0.061],[0.234,-0.044],[-2.325,0.775],[-2.252,-0.966],[-0.636,-1.37],[0,-0.213],[-0.033,0.203],[0.041,-2.622],[1.871,-1.845],[3.886,0],[0.011,0.022],[0.003,0.006],[0.283,0.552],[-0.002,0.836],[-0.417,0.725],[-0.716,0.425],[0,0],[-0.073,0.003],[-0.236,-0.165],[0,-0.191]],"v":[[1.84,1.691],[1.9,1.628],[2.509,0.073],[2.508,-0.023],[2.508,-0.022],[2.508,-0.021],[2.507,-0.048],[2.504,-0.134],[2.011,-1.479],[1.127,-2.223],[0.004,-2.495],[-1.181,-2.196],[-1.181,-2.196],[-1.183,-2.195],[-1.21,-2.182],[-2.142,-1.29],[-2.493,-0.049],[4.423,5.757],[7.228,5.252],[8.051,4.885],[8.251,4.849],[8.43,4.943],[8.514,5.128],[8.467,5.325],[3.264,9.45],[3.162,9.484],[2.478,9.66],[3.171,9.487],[-3.935,9.19],[-9.045,4.245],[-9.991,-0.13],[-9.945,-0.774],[-10,-0.156],[-7.022,-7.122],[-0.001,-10.001],[9.114,-4.9],[9.149,-4.832],[9.157,-4.815],[10,-1.47],[9.361,0.912],[7.622,2.661],[5.258,3.314],[5.256,3.314],[2.011,2.635],[1.642,2.071]],"c":true}]}],"ix":2},"nm":"Контур 1","mn":"ADBE Vector Shape - Group","hd":false},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[0,0],[0,0.005]],"o":[[0,-0.005],[0,0]],"v":[[-10,-0.142],[-10,-0.156]],"c":false},"ix":2},"nm":"Контур 2","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":1,"nm":"Объединить контуры 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Заливка 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Union","np":4,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":180,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":3,"nm":"Ellipse 3","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":60,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":100,"s":[1090]},{"t":110,"s":[1080]}],"ix":10},"p":{"a":0,"k":[15,15,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":60,"s":[16.667,16.667,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":80,"s":[11.667,11.667,100]},{"t":100,"s":[16.667,16.667,100]}],"ix":6,"l":2}},"ao":0,"ip":0,"op":180,"st":0,"bm":0}],"markers":[]} \ No newline at end of file diff --git a/TMessagesProj/src/main/res/raw/firefox_30.json b/TMessagesProj/src/main/res/raw/firefox_30.json new file mode 100644 index 000000000..cd60a75aa --- /dev/null +++ b/TMessagesProj/src/main/res/raw/firefox_30.json @@ -0,0 +1 @@ +{"v":"5.7.4","fr":60,"ip":0,"op":180,"w":30,"h":30,"nm":"firefox_30","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Vector","parent":2,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[-0.974,-1.629,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":60,"s":[{"i":[[0,0],[-0.03,-0.196],[0.001,-0.315],[0,-0.044],[0.784,-1.26],[0.037,-0.059],[0.129,-0.308],[0.711,-0.509],[0.55,-0.259],[0,0],[0,0],[0.07,-0.029],[0.18,-0.163],[3.652,0],[0.988,0.296],[-0.036,-0.014],[0.11,0.04],[0.723,0.489],[0.845,1.898],[-0.075,1.505],[0.08,-0.373],[-0.467,1.186],[0.175,-0.384],[-0.528,0.892],[-0.21,0.229],[0,0],[-0.018,0.121],[-0.293,0.65],[0,0],[0,-0.031],[-0.004,0.014],[-0.041,0.083],[-0.067,0.076],[-0.005,0.007],[0.006,-0.047],[0,0.004],[-0.041,0.093],[-0.224,0.154],[0,0],[-0.14,-0.364],[0,0],[-0.016,0],[0,-0.005],[-0.039,-0.068],[-0.052,-0.077],[0,0],[0,0],[-0.157,-0.134],[0,0],[-0.764,-0.289],[-0.118,0.088],[0.005,-0.039],[-0.257,0.109],[-0.001,-0.033],[-0.368,0.071],[0.068,-0.058],[-0.176,0.009],[0.062,-0.026],[0.117,-0.057],[0.035,-0.028],[0.261,-0.684],[0,0],[0,0],[-0.485,-0.077],[-0.041,-0.152],[0,0],[0.006,-0.04],[0.233,-0.198],[0.07,-0.045],[0.28,-0.123],[0.316,-0.196],[0.045,-0.044],[0,-0.005],[-0.011,-0.056],[-0.036,-0.068],[0.009,-0.115],[0.083,-0.192],[0.101,0.051],[0,0],[-0.046,-0.118],[0,0],[0.09,0.05],[0.113,0.049],[0.012,-0.004],[0,0],[0.129,0.064],[0.093,-0.166],[-0.179,-0.324],[-0.259,-0.177],[-0.015,-0.012],[-0.218,-0.109],[-0.068,-0.039],[-0.064,-0.034],[-0.763,0.111],[-0.451,-0.592],[0.366,0.116],[0,0],[0.762,-0.423],[0.818,0.173],[0.199,0.069],[0,0],[0,0],[-0.562,-0.34],[-0.416,-0.078],[-1.148,0.914],[-0.001,1.467],[0.272,0.642],[-0.488,-0.931],[1.067,0.88],[0.381,1.005],[0,0],[-1.363,-1.273],[-0.526,-0.531],[-0.141,0.387],[-0.334,-0.559],[-0.386,-0.63],[-0.079,-0.119],[-0.165,-0.347],[-0.16,-0.563],[-0.039,-0.466]],"o":[[0,0],[0.055,0.31],[0,0.04],[-0.062,1.483],[-0.04,0.067],[0.117,0.313],[-0.218,0.847],[-0.474,0.382],[0,0],[0,0],[-0.072,0.033],[-0.104,0.22],[-0.111,0.139],[-1.032,-0.001],[0.036,0.016],[-0.114,-0.038],[-0.834,-0.257],[-1.778,-1.076],[-0.63,-1.369],[-0.123,0.361],[0,-1.275],[-0.241,0.346],[0.247,-1.007],[0.158,-0.267],[0,0],[-0.004,-0.122],[0.065,-0.71],[0,0],[0.006,-0.012],[0,0.031],[0.026,-0.089],[0.045,-0.091],[0.005,-0.007],[0.005,-0.007],[0,0.017],[0.027,-0.051],[0.09,-0.257],[0,0],[-0.013,0.39],[0,0],[0.014,0.02],[0.003,0.001],[0.04,0.082],[0.055,0.097],[0,0],[0,0],[0.115,0.18],[0,0],[0.797,-0.161],[0.095,-0.112],[0,0.039],[0.171,-0.221],[-0.014,0.03],[0.323,-0.19],[0.048,0],[0.162,-0.07],[0.288,-0.03],[-0.122,0.044],[-0.035,0.029],[-0.613,0.401],[0,0],[0,0],[0.108,0.479],[1.373,0.129],[0,0],[-0.002,0.04],[-0.056,0.301],[-0.062,0.056],[-0.047,0.027],[-0.344,0.141],[-0.053,0.035],[-0.016,0.017],[0.025,0.051],[-0.063,-0.071],[0.04,0.108],[0.007,0.209],[-0.091,-0.068],[0,0],[0.106,0.069],[0.034,0.095],[-0.059,-0.084],[-0.132,-0.078],[-0.012,0.007],[0.032,0.057],[0,0],[-0.171,0.083],[-0.151,0.338],[0.174,0.261],[0.016,0.012],[0.2,0.14],[0.066,0.044],[0.061,0.04],[1,0.525],[0.733,-0.129],[0.261,0.371],[0,0],[-0.374,-0.124],[-0.755,0.359],[-0.207,-0.04],[0,0],[0,0],[0.383,0.533],[0.377,0.192],[1.431,0.327],[1.148,-0.914],[0.004,-0.698],[0.904,0.537],[-0.606,-1.77],[-0.858,-0.646],[-1.103,-2.96],[0,0],[0.276,0.257],[0.074,-0.405],[0.11,0.642],[0.512,0.728],[0.083,0.112],[0.221,0.314],[0.262,0.523],[0.128,0.45],[0.127,-0.167]],"v":[[10.333,-1.238],[10.393,-0.927],[10.475,0.011],[10.475,0.135],[9.184,4.32],[9.068,4.509],[9.048,5.476],[7.611,7.575],[6.069,8.54],[5.987,8.579],[5.942,8.599],[5.729,8.692],[5.298,9.271],[0.329,10.801],[-2.718,10.353],[-2.614,10.398],[-2.948,10.281],[-5.296,9.156],[-9.325,4.587],[-10.17,0.211],[-10.475,1.314],[-9.767,-2.41],[-10.394,-1.312],[-9.224,-4.176],[-8.671,-4.921],[-8.671,-4.932],[-8.65,-5.296],[-8.109,-7.351],[-8.094,-7.38],[-8.094,-7.305],[-8.094,-7.261],[-7.992,-7.52],[-7.822,-7.772],[-7.809,-7.791],[-7.831,-7.656],[-7.831,-7.632],[-7.736,-7.827],[-7.253,-8.459],[-7.242,-8.464],[-7.05,-7.322],[-7.05,-7.318],[-7.009,-7.374],[-7,-7.366],[-6.881,-7.137],[-6.721,-6.875],[-6.708,-6.86],[-6.697,-6.863],[-6.282,-6.389],[-6.275,-6.383],[-3.888,-6.184],[-3.568,-6.485],[-3.575,-6.367],[-2.922,-6.871],[-2.942,-6.776],[-1.898,-7.171],[-2.121,-7.035],[-1.609,-7.156],[-1.058,-7.036],[-1.416,-6.884],[-1.311,-6.863],[-2.655,-5.193],[-2.655,-5.182],[-2.655,-5.188],[-1.674,-4.268],[0.003,-3.872],[0.003,-3.801],[-0.009,-3.681],[-0.456,-2.909],[-0.654,-2.756],[-1.214,-2.513],[-2.206,-2.008],[-2.352,-1.889],[-2.404,-1.82],[-2.351,-1.658],[-2.434,-1.635],[-2.387,-1.296],[-2.502,-0.687],[-2.791,-0.866],[-2.802,-0.866],[-2.567,-0.579],[-2.579,-0.462],[-2.806,-0.665],[-3.301,-0.919],[-3.334,-0.912],[-3.244,-0.746],[-3.453,-0.858],[-3.859,-0.476],[-3.814,0.576],[-3.159,1.239],[-3.294,1.203],[-2.666,1.578],[-2.815,1.564],[-2.628,1.674],[-0.165,1.546],[1.763,2.299],[1.37,2.908],[1.363,2.908],[-0.235,3.521],[-2.661,3.807],[-3.27,3.644],[-3.355,3.613],[-3.349,3.624],[-1.917,4.948],[-0.722,5.354],[3.358,4.425],[5.176,0.656],[4.77,-1.375],[6.898,0.87],[4.076,-2.472],[2.181,-4.999],[3.623,-10.801],[4.828,-8.868],[6.088,-7.703],[6.41,-8.892],[7.081,-7.074],[8.422,-5.33],[8.665,-4.985],[9.245,-3.991],[9.879,-2.359],[10.13,-0.982]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":80,"s":[{"i":[[0,0],[-0.03,-0.196],[0.001,-0.315],[0,-0.044],[0.784,-1.26],[0.037,-0.059],[0.129,-0.308],[0.711,-0.509],[0.55,-0.259],[0,0],[0,0],[0.07,-0.029],[0.18,-0.163],[3.652,0],[0.988,0.296],[-0.036,-0.014],[0.11,0.04],[0.723,0.489],[0.845,1.898],[-0.075,1.505],[0.08,-0.373],[-0.467,1.186],[0.175,-0.384],[-0.528,0.892],[-0.21,0.229],[0,0],[-0.018,0.121],[-0.293,0.65],[0,0],[0,-0.031],[-0.004,0.014],[-0.041,0.083],[-0.067,0.076],[-0.005,0.007],[0.006,-0.047],[0,0.004],[-0.041,0.093],[-0.224,0.154],[0,0],[-0.14,-0.364],[0,0],[-0.016,0],[0,-0.005],[-0.039,-0.068],[-0.052,-0.077],[0,0],[0,0],[-0.157,-0.134],[0,0],[-0.764,-0.289],[-0.118,0.088],[0.005,-0.039],[-0.257,0.109],[-0.001,-0.033],[-0.368,0.071],[0.068,-0.058],[-0.176,0.009],[0.062,-0.026],[0.117,-0.057],[0.035,-0.028],[0.261,-0.684],[0,0],[0,0],[-0.485,-0.077],[-0.041,-0.152],[0,0],[0.006,-0.04],[0.233,-0.198],[0.07,-0.045],[0.28,-0.123],[0.316,-0.196],[0.045,-0.044],[0,-0.005],[-0.011,-0.056],[-0.036,-0.068],[0.009,-0.115],[0.083,-0.192],[0.101,0.051],[0,0],[-0.046,-0.118],[0,0],[0.09,0.05],[0.113,0.049],[0.012,-0.004],[0,0],[0.129,0.064],[0.093,-0.166],[-0.179,-0.324],[-0.259,-0.177],[-0.015,-0.012],[-0.218,-0.109],[-0.068,-0.039],[-0.017,-0.071],[-0.427,-0.474],[-0.451,-0.592],[0.366,0.116],[0,0],[0.762,-0.423],[0.818,0.173],[0.199,0.069],[0,0],[0,0],[-0.562,-0.34],[-0.416,-0.078],[-1.148,0.914],[-0.001,1.467],[0.272,0.642],[-0.488,-0.931],[1.067,0.88],[0.381,1.005],[0,0],[0.043,-1.277],[-0.03,-0.651],[-0.141,0.387],[-0.334,-0.559],[-0.386,-0.63],[-0.079,-0.119],[-0.165,-0.347],[-0.16,-0.563],[-0.039,-0.466]],"o":[[0,0],[0.055,0.31],[0,0.04],[-0.062,1.483],[-0.04,0.067],[0.117,0.313],[-0.218,0.847],[-0.474,0.382],[0,0],[0,0],[-0.072,0.033],[-0.104,0.22],[-0.111,0.139],[-1.032,-0.001],[0.036,0.016],[-0.114,-0.038],[-0.834,-0.257],[-1.778,-1.076],[-0.63,-1.369],[-0.123,0.361],[0,-1.275],[-0.241,0.346],[0.247,-1.007],[0.158,-0.267],[0,0],[-0.004,-0.122],[0.065,-0.71],[0,0],[0.006,-0.012],[0,0.031],[0.026,-0.089],[0.045,-0.091],[0.005,-0.007],[0.005,-0.007],[0,0.017],[0.027,-0.051],[0.09,-0.257],[0,0],[-0.013,0.39],[0,0],[0.014,0.02],[0.003,0.001],[0.04,0.082],[0.055,0.097],[0,0],[0,0],[0.115,0.18],[0,0],[0.797,-0.161],[0.095,-0.112],[0,0.039],[0.171,-0.221],[-0.014,0.03],[0.323,-0.19],[0.048,0],[0.162,-0.07],[0.288,-0.03],[-0.122,0.044],[-0.035,0.029],[-0.613,0.401],[0,0],[0,0],[0.108,0.479],[1.373,0.129],[0,0],[-0.002,0.04],[-0.056,0.301],[-0.062,0.056],[-0.047,0.027],[-0.344,0.141],[-0.053,0.035],[-0.016,0.017],[0.025,0.051],[-0.063,-0.071],[0.04,0.108],[0.007,0.209],[-0.091,-0.068],[0,0],[0.106,0.069],[0.034,0.095],[-0.059,-0.084],[-0.132,-0.078],[-0.012,0.007],[0.032,0.057],[0,0],[-0.171,0.083],[-0.151,0.338],[0.174,0.261],[0.016,0.012],[0.2,0.14],[0.066,0.044],[0.061,0.04],[0.332,1.348],[0.786,0.559],[0.261,0.371],[0,0],[-0.374,-0.124],[-0.603,-0.499],[-0.344,-0.557],[0,0],[0,0],[0.383,0.533],[0.377,0.192],[1.431,0.327],[1.148,-0.914],[0.004,-0.698],[0.904,0.537],[-0.606,-1.77],[-0.858,-0.646],[-1.103,-2.96],[0,0],[0.293,0.889],[0.074,-0.405],[0.11,0.642],[0.512,0.728],[0.083,0.112],[0.221,0.314],[0.262,0.523],[0.128,0.45],[0.127,-0.167]],"v":[[10.333,-1.238],[10.393,-0.927],[10.475,0.011],[10.475,0.135],[9.184,4.32],[9.068,4.509],[9.048,5.476],[7.611,7.575],[6.069,8.54],[5.987,8.579],[5.942,8.599],[5.729,8.692],[5.298,9.271],[0.329,10.801],[-2.718,10.353],[-2.614,10.398],[-2.948,10.281],[-5.296,9.156],[-9.325,4.587],[-10.17,0.211],[-10.162,1.314],[-9.767,-2.41],[-10.185,-1.312],[-9.224,-4.176],[-8.671,-4.921],[-8.671,-4.932],[-8.65,-5.296],[-8.109,-6.934],[-8.094,-6.963],[-8.094,-6.888],[-8.094,-6.845],[-7.992,-7.103],[-7.822,-7.355],[-7.809,-7.375],[-7.831,-7.239],[-7.831,-7.216],[-7.736,-7.41],[-7.253,-8.042],[-7.242,-8.048],[-7.05,-6.906],[-7.05,-6.901],[-7.009,-6.957],[-7,-6.949],[-6.881,-6.72],[-6.721,-6.458],[-6.708,-6.443],[-6.697,-6.446],[-6.282,-6.389],[-6.275,-6.383],[-3.888,-6.184],[-3.568,-6.485],[-3.575,-6.367],[-2.922,-6.662],[-2.942,-6.568],[-1.898,-6.676],[-2.121,-6.54],[-1.609,-6.661],[-1.058,-6.541],[-1.416,-6.389],[-1.311,-6.368],[-2.655,-5.193],[-2.655,-5.182],[-2.655,-5.188],[-1.674,-4.268],[-0.31,-3.872],[-0.31,-3.801],[-0.321,-3.681],[-0.768,-2.909],[-0.967,-2.756],[-1.526,-2.513],[-2.206,-2.008],[-2.352,-1.889],[-2.404,-1.82],[-2.351,-1.658],[-2.434,-1.635],[-2.387,-1.296],[-1.761,-0.752],[-2.049,-0.931],[-2.06,-0.931],[-1.826,-0.644],[-1.838,-0.527],[-2.064,-0.73],[-1.967,-1.036],[-2,-1.028],[-1.909,-0.863],[-2.119,-0.975],[-2.525,-0.593],[-2.48,0.459],[-2.346,1.122],[-2.481,1.087],[-2.135,1.462],[-2.284,1.447],[-2.097,1.557],[-1.721,2.102],[-0.49,2.763],[-0.883,3.372],[-0.889,3.372],[-1.895,2.891],[-2.101,2.604],[-2.066,2.045],[-2.151,2.014],[-2.144,2.025],[-1.357,2.808],[-0.162,3.214],[2.435,2.414],[3.385,0.876],[2.979,-1.155],[4.378,1.091],[2.001,-2.291],[2.181,-4.999],[4.248,-10.801],[5.453,-8.868],[5.359,-7.703],[5.264,-8.892],[7.081,-7.074],[8.422,-5.33],[8.665,-4.985],[9.245,-3.991],[9.879,-2.359],[10.13,-0.982]],"c":true}]},{"i":{"x":0,"y":1},"o":{"x":0.333,"y":0},"t":97,"s":[{"i":[[0,0],[-0.03,-0.196],[0.001,-0.315],[0,-0.044],[0.784,-1.26],[0.037,-0.059],[0.129,-0.308],[0.711,-0.509],[0.55,-0.259],[0,0],[0,0],[0.07,-0.029],[0.18,-0.163],[3.652,0],[0.988,0.296],[-0.036,-0.014],[0.11,0.04],[0.723,0.489],[0.845,1.898],[-0.075,1.505],[0.08,-0.373],[-0.467,1.186],[0.175,-0.384],[-0.528,0.892],[-0.21,0.229],[0,0],[-0.018,0.121],[-0.293,0.65],[0,0],[0,-0.031],[-0.004,0.014],[-0.041,0.083],[-0.067,0.076],[-0.005,0.007],[0.006,-0.047],[0,0.004],[-0.041,0.093],[-0.224,0.154],[0,0],[-0.14,-0.364],[0,0],[-0.016,0],[0,-0.005],[-0.039,-0.068],[-0.052,-0.077],[0,0],[0,0],[-0.157,-0.134],[0,0],[-0.764,-0.289],[-0.118,0.088],[0.005,-0.039],[-0.257,0.109],[-0.001,-0.033],[-0.368,0.071],[0.068,-0.058],[-0.176,0.009],[0.062,-0.026],[0.117,-0.057],[0.035,-0.028],[0.261,-0.684],[0,0],[0,0],[-0.485,-0.077],[-0.041,-0.152],[0,0],[0.006,-0.04],[0.233,-0.198],[0.07,-0.045],[0.28,-0.123],[0.316,-0.196],[0.045,-0.044],[0,-0.005],[-0.011,-0.056],[-0.036,-0.068],[0.009,-0.115],[0.083,-0.192],[0.101,0.051],[0,0],[-0.046,-0.118],[0,0],[0.09,0.05],[0.113,0.049],[0.012,-0.004],[0,0],[0.129,0.064],[0.093,-0.166],[-0.179,-0.324],[-0.259,-0.177],[-0.015,-0.012],[-0.218,-0.109],[-0.068,-0.039],[-0.017,-0.071],[-0.427,-0.474],[-0.451,-0.592],[0.366,0.116],[0,0],[0.762,-0.423],[0.818,0.173],[0.199,0.069],[0,0],[0,0],[-0.562,-0.34],[-0.416,-0.078],[-1.148,0.914],[-0.001,1.467],[0.272,0.642],[-0.488,-0.931],[1.067,0.88],[0.381,1.005],[0,0],[0.043,-1.277],[-0.03,-0.651],[-0.141,0.387],[-0.334,-0.559],[-0.386,-0.63],[-0.079,-0.119],[-0.165,-0.347],[-0.16,-0.563],[-0.039,-0.466]],"o":[[0,0],[0.055,0.31],[0,0.04],[-0.062,1.483],[-0.04,0.067],[0.117,0.313],[-0.218,0.847],[-0.474,0.382],[0,0],[0,0],[-0.072,0.033],[-0.104,0.22],[-0.111,0.139],[-1.032,-0.001],[0.036,0.016],[-0.114,-0.038],[-0.834,-0.257],[-1.778,-1.076],[-0.63,-1.369],[-0.123,0.361],[0,-1.275],[-0.241,0.346],[0.247,-1.007],[0.158,-0.267],[0,0],[-0.004,-0.122],[0.065,-0.71],[0,0],[0.006,-0.012],[0,0.031],[0.026,-0.089],[0.045,-0.091],[0.005,-0.007],[0.005,-0.007],[0,0.017],[0.027,-0.051],[0.09,-0.257],[0,0],[-0.013,0.39],[0,0],[0.014,0.02],[0.003,0.001],[0.04,0.082],[0.055,0.097],[0,0],[0,0],[0.115,0.18],[0,0],[0.797,-0.161],[0.095,-0.112],[0,0.039],[0.171,-0.221],[-0.014,0.03],[0.323,-0.19],[0.048,0],[0.162,-0.07],[0.288,-0.03],[-0.122,0.044],[-0.035,0.029],[-0.613,0.401],[0,0],[0,0],[0.108,0.479],[1.373,0.129],[0,0],[-0.002,0.04],[-0.056,0.301],[-0.062,0.056],[-0.047,0.027],[-0.344,0.141],[-0.053,0.035],[-0.016,0.017],[0.025,0.051],[-0.063,-0.071],[0.04,0.108],[0.007,0.209],[-0.091,-0.068],[0,0],[0.106,0.069],[0.034,0.095],[-0.059,-0.084],[-0.132,-0.078],[-0.012,0.007],[0.032,0.057],[0,0],[-0.171,0.083],[-0.151,0.338],[0.174,0.261],[0.016,0.012],[0.2,0.14],[0.066,0.044],[0.061,0.04],[0.332,1.348],[0.786,0.559],[0.261,0.371],[0,0],[-0.374,-0.124],[-0.603,-0.499],[-0.344,-0.557],[0,0],[0,0],[0.383,0.533],[0.377,0.192],[1.431,0.327],[1.148,-0.914],[0.004,-0.698],[0.904,0.537],[-0.606,-1.77],[-0.858,-0.646],[-1.103,-2.96],[0,0],[0.293,0.889],[0.074,-0.405],[0.11,0.642],[0.512,0.728],[0.083,0.112],[0.221,0.314],[0.262,0.523],[0.128,0.45],[0.127,-0.167]],"v":[[10.333,-1.238],[10.393,-0.927],[10.475,0.011],[10.475,0.135],[9.184,4.32],[9.068,4.509],[9.048,5.476],[7.611,7.575],[6.069,8.54],[5.987,8.579],[5.942,8.599],[5.729,8.692],[5.298,9.271],[0.329,10.801],[-2.718,10.353],[-2.614,10.398],[-2.948,10.281],[-5.296,9.156],[-9.325,4.587],[-10.17,0.211],[-10.162,1.314],[-9.767,-2.41],[-10.185,-1.312],[-9.224,-4.176],[-8.671,-4.921],[-8.671,-4.932],[-8.65,-5.296],[-8.109,-6.934],[-8.094,-6.963],[-8.094,-6.888],[-8.094,-6.845],[-7.992,-7.103],[-7.822,-7.355],[-7.809,-7.375],[-7.831,-7.239],[-7.831,-7.216],[-7.736,-7.41],[-7.253,-8.042],[-7.242,-8.048],[-7.05,-6.906],[-7.05,-6.901],[-7.009,-6.957],[-7,-6.949],[-6.881,-6.72],[-6.721,-6.458],[-6.708,-6.443],[-6.697,-6.446],[-6.282,-6.389],[-6.275,-6.383],[-3.888,-6.184],[-3.568,-6.485],[-3.575,-6.367],[-2.922,-6.662],[-2.942,-6.568],[-1.898,-6.676],[-2.121,-6.54],[-1.609,-6.661],[-1.058,-6.541],[-1.416,-6.389],[-1.311,-6.368],[-2.655,-5.193],[-2.655,-5.182],[-2.655,-5.188],[-1.674,-4.268],[-0.31,-3.872],[-0.31,-3.801],[-0.321,-3.681],[-0.768,-2.909],[-0.967,-2.756],[-1.526,-2.513],[-2.206,-2.008],[-2.352,-1.889],[-2.404,-1.82],[-2.351,-1.658],[-2.434,-1.635],[-2.387,-1.296],[-1.761,-0.752],[-2.049,-0.931],[-2.06,-0.931],[-1.826,-0.644],[-1.838,-0.527],[-2.064,-0.73],[-1.967,-1.036],[-2,-1.028],[-1.909,-0.863],[-2.119,-0.975],[-2.525,-0.593],[-2.48,0.459],[-2.346,1.122],[-2.481,1.087],[-2.135,1.462],[-2.284,1.447],[-2.097,1.557],[-1.721,2.102],[-0.49,2.763],[-0.883,3.372],[-0.889,3.372],[-1.895,2.891],[-2.101,2.604],[-2.066,2.045],[-2.151,2.014],[-2.144,2.025],[-1.357,2.808],[-0.162,3.214],[2.435,2.414],[3.385,0.876],[2.979,-1.155],[4.378,1.091],[2.001,-2.291],[2.181,-4.999],[4.248,-10.801],[5.453,-8.868],[5.359,-7.703],[5.264,-8.892],[7.081,-7.074],[8.422,-5.33],[8.665,-4.985],[9.245,-3.991],[9.879,-2.359],[10.13,-0.982]],"c":true}]},{"t":120,"s":[{"i":[[0,0],[-0.03,-0.196],[0.001,-0.315],[0,-0.044],[0.784,-1.26],[0.037,-0.059],[0.129,-0.308],[0.711,-0.509],[0.55,-0.259],[0,0],[0,0],[0.07,-0.029],[0.18,-0.163],[3.652,0],[0.988,0.296],[-0.036,-0.014],[0.11,0.04],[0.723,0.489],[0.845,1.898],[-0.075,1.505],[0.08,-0.373],[-0.467,1.186],[0.175,-0.384],[-0.528,0.892],[-0.21,0.229],[0,0],[-0.018,0.121],[-0.293,0.65],[0,0],[0,-0.031],[-0.004,0.014],[-0.041,0.083],[-0.067,0.076],[-0.005,0.007],[0.006,-0.047],[0,0.004],[-0.041,0.093],[-0.224,0.154],[0,0],[-0.14,-0.364],[0,0],[-0.016,0],[0,-0.005],[-0.039,-0.068],[-0.052,-0.077],[0,0],[0,0],[-0.157,-0.134],[0,0],[-0.764,-0.289],[-0.118,0.088],[0.005,-0.039],[-0.257,0.109],[-0.001,-0.033],[-0.368,0.071],[0.068,-0.058],[-0.176,0.009],[0.062,-0.026],[0.117,-0.057],[0.035,-0.028],[0.261,-0.684],[0,0],[0,0],[-0.485,-0.077],[-0.041,-0.152],[0,0],[0.006,-0.04],[0.233,-0.198],[0.07,-0.045],[0.28,-0.123],[0.316,-0.196],[0.045,-0.044],[0,-0.005],[-0.011,-0.056],[-0.036,-0.068],[0.009,-0.115],[0.083,-0.192],[0.101,0.051],[0,0],[-0.046,-0.118],[0,0],[0.09,0.05],[0.113,0.049],[0.012,-0.004],[0,0],[0.129,0.064],[0.093,-0.166],[-0.179,-0.324],[-0.259,-0.177],[-0.015,-0.012],[-0.218,-0.109],[-0.068,-0.039],[-0.064,-0.034],[-0.763,0.111],[-0.451,-0.592],[0.366,0.116],[0,0],[0.762,-0.423],[0.818,0.173],[0.199,0.069],[0,0],[0,0],[-0.562,-0.34],[-0.416,-0.078],[-1.148,0.914],[-0.001,1.467],[0.272,0.642],[-0.488,-0.931],[1.067,0.88],[0.381,1.005],[0,0],[-1.363,-1.273],[-0.526,-0.531],[-0.141,0.387],[-0.334,-0.559],[-0.386,-0.63],[-0.079,-0.119],[-0.165,-0.347],[-0.16,-0.563],[-0.039,-0.466]],"o":[[0,0],[0.055,0.31],[0,0.04],[-0.062,1.483],[-0.04,0.067],[0.117,0.313],[-0.218,0.847],[-0.474,0.382],[0,0],[0,0],[-0.072,0.033],[-0.104,0.22],[-0.111,0.139],[-1.032,-0.001],[0.036,0.016],[-0.114,-0.038],[-0.834,-0.257],[-1.778,-1.076],[-0.63,-1.369],[-0.123,0.361],[0,-1.275],[-0.241,0.346],[0.247,-1.007],[0.158,-0.267],[0,0],[-0.004,-0.122],[0.065,-0.71],[0,0],[0.006,-0.012],[0,0.031],[0.026,-0.089],[0.045,-0.091],[0.005,-0.007],[0.005,-0.007],[0,0.017],[0.027,-0.051],[0.09,-0.257],[0,0],[-0.013,0.39],[0,0],[0.014,0.02],[0.003,0.001],[0.04,0.082],[0.055,0.097],[0,0],[0,0],[0.115,0.18],[0,0],[0.797,-0.161],[0.095,-0.112],[0,0.039],[0.171,-0.221],[-0.014,0.03],[0.323,-0.19],[0.048,0],[0.162,-0.07],[0.288,-0.03],[-0.122,0.044],[-0.035,0.029],[-0.613,0.401],[0,0],[0,0],[0.108,0.479],[1.373,0.129],[0,0],[-0.002,0.04],[-0.056,0.301],[-0.062,0.056],[-0.047,0.027],[-0.344,0.141],[-0.053,0.035],[-0.016,0.017],[0.025,0.051],[-0.063,-0.071],[0.04,0.108],[0.007,0.209],[-0.091,-0.068],[0,0],[0.106,0.069],[0.034,0.095],[-0.059,-0.084],[-0.132,-0.078],[-0.012,0.007],[0.032,0.057],[0,0],[-0.171,0.083],[-0.151,0.338],[0.174,0.261],[0.016,0.012],[0.2,0.14],[0.066,0.044],[0.061,0.04],[1,0.525],[0.733,-0.129],[0.261,0.371],[0,0],[-0.374,-0.124],[-0.755,0.359],[-0.207,-0.04],[0,0],[0,0],[0.383,0.533],[0.377,0.192],[1.431,0.327],[1.148,-0.914],[0.004,-0.698],[0.904,0.537],[-0.606,-1.77],[-0.858,-0.646],[-1.103,-2.96],[0,0],[0.276,0.257],[0.074,-0.405],[0.11,0.642],[0.512,0.728],[0.083,0.112],[0.221,0.314],[0.262,0.523],[0.128,0.45],[0.127,-0.167]],"v":[[10.333,-1.238],[10.393,-0.927],[10.475,0.011],[10.475,0.135],[9.184,4.32],[9.068,4.509],[9.048,5.476],[7.611,7.575],[6.069,8.54],[5.987,8.579],[5.942,8.599],[5.729,8.692],[5.298,9.271],[0.329,10.801],[-2.718,10.353],[-2.614,10.398],[-2.948,10.281],[-5.296,9.156],[-9.325,4.587],[-10.17,0.211],[-10.475,1.314],[-9.767,-2.41],[-10.394,-1.312],[-9.224,-4.176],[-8.671,-4.921],[-8.671,-4.932],[-8.65,-5.296],[-8.109,-7.351],[-8.094,-7.38],[-8.094,-7.305],[-8.094,-7.261],[-7.992,-7.52],[-7.822,-7.772],[-7.809,-7.791],[-7.831,-7.656],[-7.831,-7.632],[-7.736,-7.827],[-7.253,-8.459],[-7.242,-8.464],[-7.05,-7.322],[-7.05,-7.318],[-7.009,-7.374],[-7,-7.366],[-6.881,-7.137],[-6.721,-6.875],[-6.708,-6.86],[-6.697,-6.863],[-6.282,-6.389],[-6.275,-6.383],[-3.888,-6.184],[-3.568,-6.485],[-3.575,-6.367],[-2.922,-6.871],[-2.942,-6.776],[-1.898,-7.171],[-2.121,-7.035],[-1.609,-7.156],[-1.058,-7.036],[-1.416,-6.884],[-1.311,-6.863],[-2.655,-5.193],[-2.655,-5.182],[-2.655,-5.188],[-1.674,-4.268],[0.003,-3.872],[0.003,-3.801],[-0.009,-3.681],[-0.456,-2.909],[-0.654,-2.756],[-1.214,-2.513],[-2.206,-2.008],[-2.352,-1.889],[-2.404,-1.82],[-2.351,-1.658],[-2.434,-1.635],[-2.387,-1.296],[-2.502,-0.687],[-2.791,-0.866],[-2.802,-0.866],[-2.567,-0.579],[-2.579,-0.462],[-2.806,-0.665],[-3.301,-0.919],[-3.334,-0.912],[-3.244,-0.746],[-3.453,-0.858],[-3.859,-0.476],[-3.814,0.576],[-3.159,1.239],[-3.294,1.203],[-2.666,1.578],[-2.815,1.564],[-2.628,1.674],[-0.165,1.546],[1.763,2.299],[1.37,2.908],[1.363,2.908],[-0.235,3.521],[-2.661,3.807],[-3.27,3.644],[-3.355,3.613],[-3.349,3.624],[-1.917,4.948],[-0.722,5.354],[3.358,4.425],[5.176,0.656],[4.77,-1.375],[6.898,0.87],[4.076,-2.472],[2.181,-4.999],[3.623,-10.801],[4.828,-8.868],[6.088,-7.703],[6.41,-8.892],[7.081,-7.074],[8.422,-5.33],[8.665,-4.985],[9.245,-3.991],[9.879,-2.359],[10.13,-0.982]],"c":true}]}],"ix":2},"nm":"Контур 1","mn":"ADBE Vector Shape - Group","hd":false},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[0,0],[-0.02,0.05]],"o":[[0.018,-0.051],[0,0]],"v":[[-2.71,-5.03],[-2.655,-5.182]],"c":false},"ix":2},"nm":"Контур 2","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":1,"nm":"Объединить контуры 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Заливка 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Vector","np":4,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":180,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":3,"nm":"Ellipse 3","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":60,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":100,"s":[1090]},{"t":110,"s":[1080]}],"ix":10},"p":{"a":0,"k":[15,15,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":60,"s":[16.667,16.667,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":80,"s":[11.667,11.667,100]},{"t":100,"s":[16.667,16.667,100]}],"ix":6,"l":2}},"ao":0,"ip":0,"op":180,"st":0,"bm":0}],"markers":[]} \ No newline at end of file diff --git a/TMessagesProj/src/main/res/raw/incoming_calls.json b/TMessagesProj/src/main/res/raw/incoming_calls.json new file mode 100644 index 000000000..d1741eeab --- /dev/null +++ b/TMessagesProj/src/main/res/raw/incoming_calls.json @@ -0,0 +1 @@ +{"v":"4.8.0","meta":{"g":"LottieFiles AE 1.0.0","a":"","k":"","d":"","tc":""},"fr":60,"ip":0,"op":90,"w":144,"h":144,"nm":"Comp 1","ddd":0,"assets":[{"id":"comp_0","layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Arrow","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[24.913,41.018,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[-0.55,0],[0,0],[0,0]],"o":[[0,0],[0,0.55],[0,0],[0,0],[0,0]],"v":[[-16.582,-16.513],[-16.582,15.517],[-15.582,16.517],[16.578,16.517],[16.578,16.517]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":8,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Path 5","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.833],"y":[1]},"o":{"x":[0.167],"y":[0]},"t":15,"s":[100]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0]},"t":23,"s":[90]},{"t":34,"s":[50]}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.833],"y":[1]},"o":{"x":[0.167],"y":[0]},"t":15,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0]},"t":23,"s":[10]},{"t":34,"s":[50]}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":92,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Long","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[-25.517,91.351,0],"ix":2},"a":{"a":0,"k":[-41.75,41.75,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[-36.197,36.193],[36.193,-36.197]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":8,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[120,120],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Path 4","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":15,"s":[100]},{"t":32,"s":[47]}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.833],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":15,"s":[47]},{"t":32,"s":[47]}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":92,"st":0,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Check","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[99.053,42.791,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":32,"s":[80,80,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":40,"s":[104,104,100]},{"t":46,"s":[100,100,100]}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[-0.78,0.78],[-0.01,0.01],[0,0],[0,0]],"o":[[0,0],[0.78,0.78],[0.01,0],[0,0],[0,0],[0,0]],"v":[[-26.181,2.855],[-11.451,17.585],[-8.621,17.585],[-8.601,17.565],[26.179,-18.175],[26.179,-18.175]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":8,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,5],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[120,120],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Path 6","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":32,"s":[0]},{"t":46,"s":[6]}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":32,"s":[0]},{"t":46,"s":[86]}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":92,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":0,"nm":"Comp 2","refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":15,"s":[104.25,39,0],"to":[-6.125,6.125,0],"ti":[6.125,-6.125,0]},{"t":30,"s":[67.5,75.75,0]}],"ix":2},"a":{"a":0,"k":[33,32.5,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":15,"s":[100,100,100]},{"t":30,"s":[90,90,100]}],"ix":6}},"ao":0,"w":66,"h":65,"ip":0,"op":90,"st":0,"bm":0},{"ddd":0,"ind":5,"ty":4,"nm":"Phone","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":5,"s":[5]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":10,"s":[-5]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":15,"s":[5]},{"i":{"x":[0.833],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":20,"s":[-5]},{"i":{"x":[0.833],"y":[1]},"o":{"x":[0.167],"y":[0]},"t":25,"s":[5]},{"i":{"x":[0.833],"y":[1]},"o":{"x":[0.167],"y":[0]},"t":30,"s":[-5]},{"i":{"x":[0.57],"y":[0.898]},"o":{"x":[0.175],"y":[0]},"t":35,"s":[5]},{"i":{"x":[0.839],"y":[1]},"o":{"x":[0.397],"y":[-0.236]},"t":39,"s":[-5]},{"t":44,"s":[0]}],"ix":10},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":27,"s":[65.747,78.253,0],"to":[-0.667,0.667,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":1},"o":{"x":0.333,"y":0},"t":33,"s":[61.747,82.253,0],"to":[0,0,0],"ti":[-0.667,0.667,0]},{"t":44,"s":[65.747,78.253,0]}],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[5.37,0.64],[0,0],[2.28,-2.29],[0,0],[0.689,0.376],[7.338,13.139],[0,0],[0,0],[0.37,3.24],[0,0],[5.42,0],[0,0],[-0.37,-6],[-45.34,-2.82],[0,6.01],[0,0]],"o":[[0,0],[-3.25,-0.37],[0,0],[0,0],[-13.183,-7.199],[-0.512,-0.917],[0,0],[2.28,-2.28],[0,0],[-0.64,-5.37],[0,0],[-6.01,0],[2.82,45.4],[6.01,0.37],[0,0],[0.06,-5.37]],"v":[[38.393,17.373],[24.893,15.833],[16.173,18.863],[7.958,27.078],[4.307,27.544],[-27.165,-3.604],[-26.827,-8.208],[-18.807,-16.227],[-15.777,-24.937],[-17.317,-38.337],[-27.897,-47.747],[-37.097,-47.747],[-47.727,-36.747],[36.743,47.733],[47.743,37.093],[47.743,27.903]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Path","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":93,"st":0,"bm":0}],"markers":[]} \ No newline at end of file diff --git a/TMessagesProj/src/main/res/raw/ipad_30.json b/TMessagesProj/src/main/res/raw/ipad_30.json new file mode 100644 index 000000000..22579ec6f --- /dev/null +++ b/TMessagesProj/src/main/res/raw/ipad_30.json @@ -0,0 +1 @@ +{"v":"5.7.4","fr":60,"ip":0,"op":180,"w":30,"h":30,"nm":"ipad_30","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"apple","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[14.841,14.333,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0,0,0.667],"y":[1,1,1]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0]},"t":70,"s":[0,13.333,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,1]},"o":{"x":[1,1,0.333],"y":[0,0,0]},"t":80,"s":[15,15,100]},{"t":90,"s":[0,13.333,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-0.31,0.445],[-0.161,0.375],[-0.056,0.176],[0.222,0.21],[0.009,0.704],[-0.829,0.5],[0.927,0.074],[0.494,-0.176],[0.093,0],[0.431,0.162],[0.264,0],[0.409,-0.246],[0.242,-0.418],[0,-0.737],[-0.236,-0.686],[-0.359,-0.515],[-0.213,-0.185],[-0.334,0.014],[-0.357,0.144],[-0.344,0.006],[-0.307,-0.133],[-0.25,0],[-0.306,0.278]],"o":[[0.234,-0.334],[0.07,-0.162],[-0.28,-0.122],[-0.5,-0.463],[-0.009,-0.899],[-0.463,-0.658],[-0.34,-0.028],[-0.524,0.19],[-0.12,0],[-0.431,-0.162],[-0.477,0.005],[-0.414,0.248],[-0.32,0.533],[0,0.644],[0.201,0.594],[0.32,0.449],[0.334,0.31],[0.222,-0.009],[0.317,-0.135],[0.335,0.007],[0.352,0.148],[0.347,-0.009],[0.195,-0.171]],"v":[[3.848,4.137],[4.441,3.071],[4.631,2.566],[3.871,2.066],[3.107,0.315],[4.334,-1.789],[2.249,-2.887],[0.998,-2.665],[0.076,-2.377],[-0.753,-2.623],[-1.8,-2.868],[-3.153,-2.484],[-4.154,-1.469],[-4.631,0.435],[-4.274,2.427],[-3.431,4.1],[-2.634,5.054],[-1.633,5.499],[-0.767,5.272],[0.234,5.059],[1.207,5.272],[2.11,5.49],[3.088,5.059]],"c":true},"ix":2},"nm":"Контур 1","mn":"ADBE Vector Shape - Group","hd":false},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[-0.482,0.565],[0,0.551],[0.005,0.074],[0.277,-0.142],[0.217,-0.246],[0,-0.528],[-0.01,-0.069]],"o":[[0.403,-0.473],[0,-0.074],[-0.31,0.023],[-0.297,0.139],[-0.408,0.463],[0,0.07],[0.63,0.051]],"v":[[1.717,-3.739],[2.319,-5.278],[2.31,-5.5],[1.42,-5.25],[0.642,-4.666],[0.002,-3.109],[0.016,-2.901]],"c":true},"ix":2},"nm":"Контур 2","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":1,"nm":"Объединить контуры 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Заливка 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"apple","np":4,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":-60,"op":184,"st":-60,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Rectangle 21","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[15,15,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[16.667,16.667,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.333,"y":0},"t":60,"s":[{"i":[[0.192,-0.376],[0,-1.12],[0,0],[-0.218,-0.428],[-0.376,-0.192],[-1.12,0],[0,0],[-0.428,0.218],[-0.192,0.376],[0,1.12],[0,0],[0.218,0.428],[0.376,0.192],[1.12,0],[0,0],[0.428,-0.218]],"o":[[-0.218,0.428],[0,0],[0,1.12],[0.192,0.376],[0.428,0.218],[0,0],[1.12,0],[0.376,-0.192],[0.218,-0.428],[0,0],[0,-1.12],[-0.192,-0.376],[-0.428,-0.218],[0,0],[-1.12,0],[-0.376,0.192]],"v":[[-7.782,-8.908],[-8,-6.8],[-8,6.8],[-7.782,8.908],[-6.908,9.782],[-4.8,10],[4.8,10],[6.908,9.782],[7.782,8.908],[8,6.8],[8,-6.8],[7.782,-8.908],[6.908,-9.782],[4.8,-10],[-4.8,-10],[-6.908,-9.782]],"c":true}]},{"i":{"x":0,"y":1},"o":{"x":0.167,"y":0.167},"t":70,"s":[{"i":[[0.012,-0.376],[0,-1.12],[0,0],[-0.014,-0.428],[-0.024,-0.192],[-0.07,0],[0,0],[-0.027,0.218],[-0.012,0.376],[0,1.12],[0,0],[0.014,0.428],[0.024,0.192],[0.07,0],[0,0],[0.027,-0.218]],"o":[[-0.014,0.428],[0,0],[0,1.12],[0.012,0.376],[0.027,0.218],[0,0],[0.07,0],[0.024,-0.192],[0.014,-0.428],[0,0],[0,-1.12],[-0.012,-0.376],[-0.027,-0.218],[0,0],[-0.07,0],[-0.024,0.192]],"v":[[-0.486,-8.908],[-0.5,-6.8],[-0.5,6.8],[-0.486,8.908],[-0.432,9.782],[-0.3,10],[0.3,10],[0.432,9.782],[0.486,8.908],[0.5,6.8],[0.5,-6.8],[0.486,-8.908],[0.432,-9.782],[0.3,-10],[-0.3,-10],[-0.432,-9.782]],"c":true}]},{"i":{"x":0.833,"y":0.833},"o":{"x":1,"y":0},"t":80,"s":[{"i":[[0.192,-0.376],[0,-1.12],[0,0],[-0.218,-0.428],[-0.376,-0.192],[-1.12,0],[0,0],[-0.428,0.218],[-0.192,0.376],[0,1.12],[0,0],[0.218,0.428],[0.376,0.192],[1.12,0],[0,0],[0.428,-0.218]],"o":[[-0.218,0.428],[0,0],[0,1.12],[0.192,0.376],[0.428,0.218],[0,0],[1.12,0],[0.376,-0.192],[0.218,-0.428],[0,0],[0,-1.12],[-0.192,-0.376],[-0.428,-0.218],[0,0],[-1.12,0],[-0.376,0.192]],"v":[[-7.782,-8.908],[-8,-6.8],[-8,6.8],[-7.782,8.908],[-6.908,9.782],[-4.8,10],[4.8,10],[6.908,9.782],[7.782,8.908],[8,6.8],[8,-6.8],[7.782,-8.908],[6.908,-9.782],[4.8,-10],[-4.8,-10],[-6.908,-9.782]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.167,"y":0.167},"t":90,"s":[{"i":[[0.012,-0.376],[0,-1.12],[0,0],[-0.014,-0.428],[-0.024,-0.192],[-0.07,0],[0,0],[-0.027,0.218],[-0.012,0.376],[0,1.12],[0,0],[0.014,0.428],[0.024,0.192],[0.07,0],[0,0],[0.027,-0.218]],"o":[[-0.014,0.428],[0,0],[0,1.12],[0.012,0.376],[0.027,0.218],[0,0],[0.07,0],[0.024,-0.192],[0.014,-0.428],[0,0],[0,-1.12],[-0.012,-0.376],[-0.027,-0.218],[0,0],[-0.07,0],[-0.024,0.192]],"v":[[-0.486,-8.908],[-0.5,-6.8],[-0.5,6.8],[-0.486,8.908],[-0.432,9.782],[-0.3,10],[0.3,10],[0.432,9.782],[0.486,8.908],[0.5,6.8],[0.5,-6.8],[0.486,-8.908],[0.432,-9.782],[0.3,-10],[-0.3,-10],[-0.432,-9.782]],"c":true}]},{"t":100,"s":[{"i":[[0.192,-0.376],[0,-1.12],[0,0],[-0.218,-0.428],[-0.376,-0.192],[-1.12,0],[0,0],[-0.428,0.218],[-0.192,0.376],[0,1.12],[0,0],[0.218,0.428],[0.376,0.192],[1.12,0],[0,0],[0.428,-0.218]],"o":[[-0.218,0.428],[0,0],[0,1.12],[0.192,0.376],[0.428,0.218],[0,0],[1.12,0],[0.376,-0.192],[0.218,-0.428],[0,0],[0,-1.12],[-0.192,-0.376],[-0.428,-0.218],[0,0],[-1.12,0],[-0.376,0.192]],"v":[[-7.782,-8.908],[-8,-6.8],[-8,6.8],[-7.782,8.908],[-6.908,9.782],[-4.8,10],[4.8,10],[6.908,9.782],[7.782,8.908],[8,6.8],[8,-6.8],[7.782,-8.908],[6.908,-9.782],[4.8,-10],[-4.8,-10],[-6.908,-9.782]],"c":true}]}],"ix":2},"nm":"Контур 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Обводка 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":70,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":71,"s":[100]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":89,"s":[100]},{"t":90,"s":[0]}],"ix":5},"r":1,"bm":0,"nm":"Заливка 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Rectangle 21","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":-60,"op":184,"st":-60,"bm":0}],"markers":[]} \ No newline at end of file diff --git a/TMessagesProj/src/main/res/raw/iphone_30.json b/TMessagesProj/src/main/res/raw/iphone_30.json new file mode 100644 index 000000000..b214044d1 --- /dev/null +++ b/TMessagesProj/src/main/res/raw/iphone_30.json @@ -0,0 +1 @@ +{"v":"5.7.4","fr":60,"ip":0,"op":180,"w":30,"h":30,"nm":"iphone_30","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"apple","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[14.841,14.333,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0,0,0.667],"y":[1,1,1]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0]},"t":70,"s":[0,13.333,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,1]},"o":{"x":[1,1,0.333],"y":[0,0,0]},"t":80,"s":[15,15,100]},{"t":90,"s":[0,13.333,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-0.31,0.445],[-0.161,0.375],[-0.056,0.176],[0.222,0.21],[0.009,0.704],[-0.829,0.5],[0.927,0.074],[0.494,-0.176],[0.093,0],[0.431,0.162],[0.264,0],[0.409,-0.246],[0.242,-0.418],[0,-0.737],[-0.236,-0.686],[-0.359,-0.515],[-0.213,-0.185],[-0.334,0.014],[-0.357,0.144],[-0.344,0.006],[-0.307,-0.133],[-0.25,0],[-0.306,0.278]],"o":[[0.234,-0.334],[0.07,-0.162],[-0.28,-0.122],[-0.5,-0.463],[-0.009,-0.899],[-0.463,-0.658],[-0.34,-0.028],[-0.524,0.19],[-0.12,0],[-0.431,-0.162],[-0.477,0.005],[-0.414,0.248],[-0.32,0.533],[0,0.644],[0.201,0.594],[0.32,0.449],[0.334,0.31],[0.222,-0.009],[0.317,-0.135],[0.335,0.007],[0.352,0.148],[0.347,-0.009],[0.195,-0.171]],"v":[[3.848,4.137],[4.441,3.071],[4.631,2.566],[3.871,2.066],[3.107,0.315],[4.334,-1.789],[2.249,-2.887],[0.998,-2.665],[0.076,-2.377],[-0.753,-2.623],[-1.8,-2.868],[-3.153,-2.484],[-4.154,-1.469],[-4.631,0.435],[-4.274,2.427],[-3.431,4.1],[-2.634,5.054],[-1.633,5.499],[-0.767,5.272],[0.234,5.059],[1.207,5.272],[2.11,5.49],[3.088,5.059]],"c":true},"ix":2},"nm":"Контур 1","mn":"ADBE Vector Shape - Group","hd":false},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[-0.482,0.565],[0,0.551],[0.005,0.074],[0.277,-0.142],[0.217,-0.246],[0,-0.528],[-0.01,-0.069]],"o":[[0.403,-0.473],[0,-0.074],[-0.31,0.023],[-0.297,0.139],[-0.408,0.463],[0,0.07],[0.63,0.051]],"v":[[1.717,-3.739],[2.319,-5.278],[2.31,-5.5],[1.42,-5.25],[0.642,-4.666],[0.002,-3.109],[0.016,-2.901]],"c":true},"ix":2},"nm":"Контур 2","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":1,"nm":"Объединить контуры 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Заливка 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"apple","np":4,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":-60,"op":184,"st":-60,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Vector 39","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[15,6,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[16.667,16.667,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.333,"y":0},"t":60,"s":[{"i":[[0,0],[0,0],[0,-0.884],[0.221,0],[0,0],[0,0.221],[0.884,0],[0,0]],"o":[[0,0],[-0.884,0],[0,0.221],[0,0],[-0.221,0],[0,-0.884],[0,0],[0,0]],"v":[[4,-1],[3.6,-1],[2,0.6],[1.6,1],[-1.6,1],[-2,0.6],[-3.6,-1],[-4,-1]],"c":false}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":67,"s":[{"i":[[0,0],[0,0],[0,-0.884],[0.028,0],[0,0],[0,0.221],[0.11,0],[0,0]],"o":[[0,0],[-0.11,0],[0,0.221],[0,0],[-0.028,0],[0,-0.884],[0,0],[0,0]],"v":[[0.5,-1],[0.45,-1],[0.25,0.6],[0.2,1],[-0.2,1],[-0.25,0.6],[-0.45,-1],[-0.5,-1]],"c":false}]},{"i":{"x":0.667,"y":1},"o":{"x":0.167,"y":0.167},"t":93,"s":[{"i":[[0,0],[0,0],[0,-0.884],[0.028,0],[0,0],[0,0.221],[0.11,0],[0,0]],"o":[[0,0],[-0.11,0],[0,0.221],[0,0],[-0.028,0],[0,-0.884],[0,0],[0,0]],"v":[[0.5,-1],[0.45,-1],[0.25,0.6],[0.2,1],[-0.2,1],[-0.25,0.6],[-0.45,-1],[-0.5,-1]],"c":false}]},{"t":100,"s":[{"i":[[0,0],[0,0],[0,-0.884],[0.221,0],[0,0],[0,0.221],[0.884,0],[0,0]],"o":[[0,0],[-0.884,0],[0,0.221],[0,0],[-0.221,0],[0,-0.884],[0,0],[0,0]],"v":[[4,-1],[3.6,-1],[2,0.6],[1.6,1],[-1.6,1],[-2,0.6],[-3.6,-1],[-4,-1]],"c":false}]}],"ix":2},"nm":"Контур 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Обводка 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Vector 39","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":-60,"op":184,"st":-60,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Rectangle 21","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[15,15,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[16.667,16.667,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.333,"y":0},"t":60,"s":[{"i":[[0.192,-0.376],[0,-1.12],[0,0],[-0.218,-0.428],[-0.376,-0.192],[-1.12,0],[0,0],[-0.428,0.218],[-0.192,0.376],[0,1.12],[0,0],[0.218,0.428],[0.376,0.192],[1.12,0],[0,0],[0.428,-0.218]],"o":[[-0.218,0.428],[0,0],[0,1.12],[0.192,0.376],[0.428,0.218],[0,0],[1.12,0],[0.376,-0.192],[0.218,-0.428],[0,0],[0,-1.12],[-0.192,-0.376],[-0.428,-0.218],[0,0],[-1.12,0],[-0.376,0.192]],"v":[[-5.782,-8.908],[-6,-6.8],[-6,6.8],[-5.782,8.908],[-4.908,9.782],[-2.8,10],[2.8,10],[4.908,9.782],[5.782,8.908],[6,6.8],[6,-6.8],[5.782,-8.908],[4.908,-9.782],[2.8,-10],[-2.8,-10],[-4.908,-9.782]],"c":true}]},{"i":{"x":0,"y":1},"o":{"x":0.167,"y":0.167},"t":70,"s":[{"i":[[0.016,-0.376],[0,-1.12],[0,0],[-0.018,-0.428],[-0.031,-0.192],[-0.093,0],[0,0],[-0.036,0.218],[-0.016,0.376],[0,1.12],[0,0],[0.018,0.428],[0.031,0.192],[0.093,0],[0,0],[0.036,-0.218]],"o":[[-0.018,0.428],[0,0],[0,1.12],[0.016,0.376],[0.036,0.218],[0,0],[0.093,0],[0.031,-0.192],[0.018,-0.428],[0,0],[0,-1.12],[-0.016,-0.376],[-0.036,-0.218],[0,0],[-0.093,0],[-0.031,0.192]],"v":[[-0.482,-8.908],[-0.5,-6.8],[-0.5,6.8],[-0.482,8.908],[-0.409,9.782],[-0.233,10],[0.233,10],[0.409,9.782],[0.482,8.908],[0.5,6.8],[0.5,-6.8],[0.482,-8.908],[0.409,-9.782],[0.233,-10],[-0.233,-10],[-0.409,-9.782]],"c":true}]},{"i":{"x":0.833,"y":0.833},"o":{"x":1,"y":0},"t":80,"s":[{"i":[[0.192,-0.376],[0,-1.12],[0,0],[-0.218,-0.428],[-0.376,-0.192],[-1.12,0],[0,0],[-0.428,0.218],[-0.192,0.376],[0,1.12],[0,0],[0.218,0.428],[0.376,0.192],[1.12,0],[0,0],[0.428,-0.218]],"o":[[-0.218,0.428],[0,0],[0,1.12],[0.192,0.376],[0.428,0.218],[0,0],[1.12,0],[0.376,-0.192],[0.218,-0.428],[0,0],[0,-1.12],[-0.192,-0.376],[-0.428,-0.218],[0,0],[-1.12,0],[-0.376,0.192]],"v":[[-5.782,-8.908],[-6,-6.8],[-6,6.8],[-5.782,8.908],[-4.908,9.782],[-2.8,10],[2.8,10],[4.908,9.782],[5.782,8.908],[6,6.8],[6,-6.8],[5.782,-8.908],[4.908,-9.782],[2.8,-10],[-2.8,-10],[-4.908,-9.782]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.167,"y":0.167},"t":90,"s":[{"i":[[0.016,-0.376],[0,-1.12],[0,0],[-0.018,-0.428],[-0.031,-0.192],[-0.093,0],[0,0],[-0.036,0.218],[-0.016,0.376],[0,1.12],[0,0],[0.018,0.428],[0.031,0.192],[0.093,0],[0,0],[0.036,-0.218]],"o":[[-0.018,0.428],[0,0],[0,1.12],[0.016,0.376],[0.036,0.218],[0,0],[0.093,0],[0.031,-0.192],[0.018,-0.428],[0,0],[0,-1.12],[-0.016,-0.376],[-0.036,-0.218],[0,0],[-0.093,0],[-0.031,0.192]],"v":[[-0.482,-8.908],[-0.5,-6.8],[-0.5,6.8],[-0.482,8.908],[-0.409,9.782],[-0.233,10],[0.233,10],[0.409,9.782],[0.482,8.908],[0.5,6.8],[0.5,-6.8],[0.482,-8.908],[0.409,-9.782],[0.233,-10],[-0.233,-10],[-0.409,-9.782]],"c":true}]},{"t":100,"s":[{"i":[[0.192,-0.376],[0,-1.12],[0,0],[-0.218,-0.428],[-0.376,-0.192],[-1.12,0],[0,0],[-0.428,0.218],[-0.192,0.376],[0,1.12],[0,0],[0.218,0.428],[0.376,0.192],[1.12,0],[0,0],[0.428,-0.218]],"o":[[-0.218,0.428],[0,0],[0,1.12],[0.192,0.376],[0.428,0.218],[0,0],[1.12,0],[0.376,-0.192],[0.218,-0.428],[0,0],[0,-1.12],[-0.192,-0.376],[-0.428,-0.218],[0,0],[-1.12,0],[-0.376,0.192]],"v":[[-5.782,-8.908],[-6,-6.8],[-6,6.8],[-5.782,8.908],[-4.908,9.782],[-2.8,10],[2.8,10],[4.908,9.782],[5.782,8.908],[6,6.8],[6,-6.8],[5.782,-8.908],[4.908,-9.782],[2.8,-10],[-2.8,-10],[-4.908,-9.782]],"c":true}]}],"ix":2},"nm":"Контур 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"rd","nm":"Скругленные углы 1","r":{"a":0,"k":2,"ix":1},"ix":2,"mn":"ADBE Vector Filter - RC","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Обводка 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":70,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":71,"s":[100]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":89,"s":[100]},{"t":90,"s":[0]}],"ix":5},"r":1,"bm":0,"nm":"Заливка 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Rectangle 21","np":4,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":-60,"op":184,"st":-60,"bm":0}],"markers":[]} \ No newline at end of file diff --git a/TMessagesProj/src/main/res/raw/linux_30.json b/TMessagesProj/src/main/res/raw/linux_30.json new file mode 100644 index 000000000..fe9dfc342 --- /dev/null +++ b/TMessagesProj/src/main/res/raw/linux_30.json @@ -0,0 +1 @@ +{"v":"5.7.4","fr":60,"ip":0,"op":180,"w":30,"h":30,"nm":"linux_30","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Vector 25","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":60,"s":[15,21.686,0],"to":[0,0.069,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":70,"s":[15,22.103,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":80,"s":[15,21.686,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":90,"s":[15,22.103,0],"to":[0,0,0],"ti":[0,0.069,0]},{"t":100,"s":[15,21.686,0]}],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[16.667,16.667,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":60,"s":[{"i":[[-0.452,0.127],[-1.798,0],[-1.471,-0.414],[0.428,-0.195],[1.333,-1.348],[0.372,0.376],[1.412,0.643]],"o":[[1.471,-0.414],[1.798,0],[0.452,0.127],[-1.412,0.643],[-0.372,0.376],[-1.333,-1.348],[-0.428,-0.195]],"v":[[-5.66,-1.69],[0,-2.686],[5.66,-1.69],[5.712,-0.738],[0.726,2.404],[-0.726,2.404],[-5.712,-0.738]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":70,"s":[{"i":[[-0.452,0.127],[-1.798,0],[-1.471,-0.414],[0.428,-0.195],[1.333,-1.348],[0.372,0.376],[1.412,0.643]],"o":[[1.471,-0.414],[1.798,0],[0.452,0.127],[-1.412,0.643],[-0.372,0.376],[-1.333,-1.348],[-0.428,-0.195]],"v":[[-5.66,-1.69],[0,-2.686],[5.66,-1.69],[5.712,-0.738],[0.726,2.821],[-0.726,2.821],[-5.712,-0.738]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":80,"s":[{"i":[[-0.452,0.127],[-1.798,0],[-1.471,-0.414],[0.428,-0.195],[1.333,-1.348],[0.372,0.376],[1.412,0.643]],"o":[[1.471,-0.414],[1.798,0],[0.452,0.127],[-1.412,0.643],[-0.372,0.376],[-1.333,-1.348],[-0.428,-0.195]],"v":[[-5.66,-1.69],[0,-2.686],[5.66,-1.69],[5.712,-0.738],[0.726,2.404],[-0.726,2.404],[-5.712,-0.738]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":90,"s":[{"i":[[-0.452,0.127],[-1.798,0],[-1.471,-0.414],[0.428,-0.195],[1.333,-1.348],[0.372,0.376],[1.412,0.643]],"o":[[1.471,-0.414],[1.798,0],[0.452,0.127],[-1.412,0.643],[-0.372,0.376],[-1.333,-1.348],[-0.428,-0.195]],"v":[[-5.66,-1.69],[0,-2.686],[5.66,-1.69],[5.712,-0.738],[0.726,2.821],[-0.726,2.821],[-5.712,-0.738]],"c":true}]},{"t":100,"s":[{"i":[[-0.452,0.127],[-1.798,0],[-1.471,-0.414],[0.428,-0.195],[1.333,-1.348],[0.372,0.376],[1.412,0.643]],"o":[[1.471,-0.414],[1.798,0],[0.452,0.127],[-1.412,0.643],[-0.372,0.376],[-1.333,-1.348],[-0.428,-0.195]],"v":[[-5.66,-1.69],[0,-2.686],[5.66,-1.69],[5.712,-0.738],[0.726,2.404],[-0.726,2.404],[-5.712,-0.738]],"c":true}]}],"ix":2},"nm":"Контур 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Заливка 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Vector 25","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":180,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Ellipse 28","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[19,16.5,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":60,"s":[16.667,16.667,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":70,"s":[20,5,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":80,"s":[16.667,16.667,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":90,"s":[20,5,100]},{"t":100,"s":[16.667,16.667,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[2,2],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Контур эллипса 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Заливка 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Ellipse 28","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":180,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Ellipse 27","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[11,16.5,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":60,"s":[16.667,16.667,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":70,"s":[20,5,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":80,"s":[16.667,16.667,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":90,"s":[20,5,100]},{"t":100,"s":[16.667,16.667,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[2,2],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Контур эллипса 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Заливка 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Ellipse 27","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":180,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"Subtract","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[15,12,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[16.667,16.667,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":60,"s":[{"i":[[0,1.422],[-5.523,0],[0,-5.523],[0.535,-1.225],[0,0],[2.761,0],[0.81,-1.668],[1.979,0],[0,-2.761],[0,0]],"o":[[0,-5.523],[5.523,0],[0,1.422],[0,0],[0,-2.761],[-1.979,0],[-0.81,-1.668],[-2.761,0],[0,0],[-0.535,-1.225]],"v":[[-10,3],[0,-7],[10,3],[9.168,7],[9.5,5],[4.5,0],[0,2.818],[-4.5,0],[-9.5,5],[-9.168,7]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":70,"s":[{"i":[[0,1.422],[-5.523,0],[0,-5.523],[0.535,-1.225],[0,0],[2.761,0],[0.81,-1.668],[1.979,0],[0,-2.761],[0,0]],"o":[[0,-5.523],[5.523,0],[0,1.422],[0,0],[0,-2.761],[-1.979,0],[-0.81,-1.668],[-2.761,0],[0,0],[-0.535,-1.225]],"v":[[-10,3],[0,-7],[10,3],[9.168,7],[9.5,5],[4.5,1.25],[0,4.068],[-4.5,1.25],[-9.5,5],[-9.168,7]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":80,"s":[{"i":[[0,1.422],[-5.523,0],[0,-5.523],[0.535,-1.225],[0,0],[2.761,0],[0.81,-1.668],[1.979,0],[0,-2.761],[0,0]],"o":[[0,-5.523],[5.523,0],[0,1.422],[0,0],[0,-2.761],[-1.979,0],[-0.81,-1.668],[-2.761,0],[0,0],[-0.535,-1.225]],"v":[[-10,3],[0,-7],[10,3],[9.168,7],[9.5,5],[4.5,0],[0,2.818],[-4.5,0],[-9.5,5],[-9.168,7]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":90,"s":[{"i":[[0,1.422],[-5.523,0],[0,-5.523],[0.535,-1.225],[0,0],[2.761,0],[0.81,-1.668],[1.979,0],[0,-2.761],[0,0]],"o":[[0,-5.523],[5.523,0],[0,1.422],[0,0],[0,-2.761],[-1.979,0],[-0.81,-1.668],[-2.761,0],[0,0],[-0.535,-1.225]],"v":[[-10,3],[0,-7],[10,3],[9.168,7],[9.5,5],[4.5,1.25],[0,4.068],[-4.5,1.25],[-9.5,5],[-9.168,7]],"c":true}]},{"t":100,"s":[{"i":[[0,1.422],[-5.523,0],[0,-5.523],[0.535,-1.225],[0,0],[2.761,0],[0.81,-1.668],[1.979,0],[0,-2.761],[0,0]],"o":[[0,-5.523],[5.523,0],[0,1.422],[0,0],[0,-2.761],[-1.979,0],[-0.81,-1.668],[-2.761,0],[0,0],[-0.535,-1.225]],"v":[[-10,3],[0,-7],[10,3],[9.168,7],[9.5,5],[4.5,0],[0,2.818],[-4.5,0],[-9.5,5],[-9.168,7]],"c":true}]}],"ix":2},"nm":"Контур 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Заливка 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Subtract","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":180,"st":0,"bm":0}],"markers":[]} \ No newline at end of file diff --git a/TMessagesProj/src/main/res/raw/mac_30.json b/TMessagesProj/src/main/res/raw/mac_30.json new file mode 100644 index 000000000..1761fec2f --- /dev/null +++ b/TMessagesProj/src/main/res/raw/mac_30.json @@ -0,0 +1 @@ +{"v":"5.7.4","fr":60,"ip":0,"op":180,"w":30,"h":30,"nm":"mac_30","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Rectangle 21","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[15,20.5,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[16.667,16.667,100],"ix":6,"l":2}},"ao":0,"shapes":[],"ip":0,"op":180,"st":-60,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Rectangle 23","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[15,22,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[16.667,16.667,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,-0.276],[-0.828,0],[0,0],[0,0.828],[0.276,0]],"o":[[-0.276,0],[0,0.828],[0,0],[0.828,0],[0,-0.276],[0,0]],"v":[[-12.5,-1],[-13,-0.5],[-11.5,1],[11.5,1],[13,-0.5],[12.5,-1]],"c":true},"ix":2},"nm":"Контур 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Заливка 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Rectangle 22","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":180,"st":-60,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Rectangle 22","td":1,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[15,22,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[16.667,16.667,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,-0.276],[-0.828,0],[0,0],[0,0.828],[0.276,0]],"o":[[-0.276,0],[0,0.828],[0,0],[0.828,0],[0,-0.276],[0,0]],"v":[[-12.5,-17.667],[-13,-0.5],[-11.5,1],[11.5,1],[13,-0.5],[12.5,-17.667]],"c":true},"ix":2},"nm":"Контур 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Заливка 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Rectangle 22","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":180,"st":-60,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"Rectangle 21","tt":1,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0,"y":1},"o":{"x":0.333,"y":0},"t":60,"s":[15,15,0],"to":[0,1.083,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":1,"y":0},"t":80,"s":[15,21.5,0],"to":[0,0,0],"ti":[0,1.083,0]},{"t":100,"s":[15,15,0]}],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[16.667,16.667,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0,"y":1},"o":{"x":0.333,"y":0},"t":60,"s":[{"i":[[0.192,-0.376],[0,-1.12],[0,0],[0,0],[0,0],[0.218,0.428],[0.376,0.192],[1.12,0],[0,0],[0.428,-0.218]],"o":[[-0.218,0.428],[0,0],[0,0],[0,0],[0,-1.12],[-0.192,-0.376],[-0.428,-0.218],[0,0],[-1.12,0],[-0.376,0.192]],"v":[[-8.782,-5.908],[-9,-3.8],[-9,7],[9,7],[9,-3.8],[8.782,-5.908],[7.908,-6.782],[5.8,-7],[-5.8,-7],[-7.908,-6.782]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":1,"y":0},"t":80,"s":[{"i":[[0.256,-0.027],[0,-0.08],[0,0],[0,0],[0,0],[0.291,0.031],[0.502,0.014],[1.493,0],[0,0],[0.57,-0.016]],"o":[[-0.291,0.031],[0,0],[0,0],[0,0],[0,-0.08],[-0.256,-0.027],[-0.57,-0.016],[0,0],[-1.493,0],[-0.502,0.014]],"v":[[-11.709,-0.422],[-12,-0.271],[-12,0.5],[12,0.5],[12,-0.271],[11.709,-0.422],[10.544,-0.484],[7.733,-0.5],[-7.733,-0.5],[-10.544,-0.484]],"c":true}]},{"t":100,"s":[{"i":[[0.192,-0.376],[0,-1.12],[0,0],[0,0],[0,0],[0.218,0.428],[0.376,0.192],[1.12,0],[0,0],[0.428,-0.218]],"o":[[-0.218,0.428],[0,0],[0,0],[0,0],[0,-1.12],[-0.192,-0.376],[-0.428,-0.218],[0,0],[-1.12,0],[-0.376,0.192]],"v":[[-8.782,-5.908],[-9,-3.8],[-9,7],[9,7],[9,-3.8],[8.782,-5.908],[7.908,-6.782],[5.8,-7],[-5.8,-7],[-7.908,-6.782]],"c":true}]}],"ix":2},"nm":"Контур 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Обводка 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Rectangle 21","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":180,"st":-60,"bm":0},{"ddd":0,"ind":5,"ty":4,"nm":"apple 2","parent":4,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[-0.955,-1.5,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0,0,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":60,"s":[80,80,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[1,1,0.333],"y":[0,0,0]},"t":80,"s":[40,0,100]},{"t":100,"s":[80,80,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-0.31,0.445],[-0.161,0.375],[-0.056,0.176],[0.222,0.21],[0.009,0.704],[-0.829,0.5],[0.927,0.074],[0.494,-0.176],[0.093,0],[0.431,0.162],[0.264,0],[0.409,-0.246],[0.242,-0.418],[0,-0.737],[-0.236,-0.686],[-0.359,-0.515],[-0.213,-0.185],[-0.334,0.014],[-0.357,0.144],[-0.344,0.006],[-0.307,-0.133],[-0.25,0],[-0.306,0.278]],"o":[[0.234,-0.334],[0.07,-0.162],[-0.28,-0.122],[-0.5,-0.463],[-0.009,-0.899],[-0.463,-0.658],[-0.34,-0.028],[-0.524,0.19],[-0.12,0],[-0.431,-0.162],[-0.477,0.005],[-0.414,0.248],[-0.32,0.533],[0,0.644],[0.201,0.594],[0.32,0.449],[0.334,0.31],[0.222,-0.009],[0.317,-0.135],[0.335,0.007],[0.352,0.148],[0.347,-0.009],[0.195,-0.171]],"v":[[3.848,4.137],[4.441,3.071],[4.631,2.566],[3.871,2.066],[3.107,0.315],[4.334,-1.789],[2.249,-2.887],[0.998,-2.665],[0.076,-2.377],[-0.753,-2.623],[-1.8,-2.868],[-3.153,-2.484],[-4.154,-1.469],[-4.631,0.435],[-4.274,2.427],[-3.431,4.1],[-2.634,5.054],[-1.633,5.499],[-0.767,5.272],[0.234,5.059],[1.207,5.272],[2.11,5.49],[3.088,5.059]],"c":true},"ix":2},"nm":"Контур 1","mn":"ADBE Vector Shape - Group","hd":false},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[-0.482,0.565],[0,0.551],[0.005,0.074],[0.277,-0.142],[0.217,-0.246],[0,-0.528],[-0.01,-0.069]],"o":[[0.403,-0.473],[0,-0.074],[-0.31,0.023],[-0.297,0.139],[-0.408,0.463],[0,0.07],[0.63,0.051]],"v":[[1.717,-3.739],[2.319,-5.278],[2.31,-5.5],[1.42,-5.25],[0.642,-4.666],[0.002,-3.109],[0.016,-2.901]],"c":true},"ix":2},"nm":"Контур 2","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":1,"nm":"Объединить контуры 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Заливка 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"apple","np":4,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":180,"st":-60,"bm":0}],"markers":[]} \ No newline at end of file diff --git a/TMessagesProj/src/main/res/raw/safari_30.json b/TMessagesProj/src/main/res/raw/safari_30.json new file mode 100644 index 000000000..3ef6883b8 --- /dev/null +++ b/TMessagesProj/src/main/res/raw/safari_30.json @@ -0,0 +1 @@ +{"v":"5.7.4","fr":60,"ip":0,"op":180,"w":30,"h":30,"nm":"safari_30","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Com 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":60,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":80,"s":[185]},{"t":90,"s":[180]}],"ix":10},"p":{"a":0,"k":[15,15,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[16.667,16.667,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-0.15,0.205],[-0.233,0.543],[0,0],[0.142,0.444],[0.385,0.123],[1.435,-0.615],[0,0],[0.231,-0.17],[0.15,-0.205],[0.233,-0.543],[0,0],[-0.142,-0.444],[-0.385,-0.123],[-1.435,0.615],[0,0],[-0.231,0.17]],"o":[[0.17,-0.231],[0,0],[0.615,-1.435],[-0.123,-0.385],[-0.444,-0.142],[0,0],[-0.543,0.233],[-0.205,0.15],[-0.17,0.231],[0,0],[-0.615,1.435],[0.123,0.385],[0.444,0.142],[0,0],[0.543,-0.233],[0.205,-0.15]],"v":[[2.611,2.075],[3.13,1.029],[4.28,-1.654],[5.061,-4.251],[4.251,-5.061],[1.654,-4.28],[-1.029,-3.13],[-2.075,-2.611],[-2.611,-2.075],[-3.13,-1.029],[-4.28,1.654],[-5.061,4.251],[-4.251,5.061],[-1.654,4.28],[1.029,3.13],[2.075,2.611]],"c":true},"ix":2},"nm":"Контур 1","mn":"ADBE Vector Shape - Group","hd":false},{"d":1,"ty":"el","s":{"a":0,"k":[2.5,2.5],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Контур эллипса 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"mm","mm":3,"nm":"Объединить контуры 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Заливка 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Com 2","np":4,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":-60,"op":230,"st":50,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Com 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[15,15,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[16.667,16.667,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[20,20],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Контур эллипса 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Заливка 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Com 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":-60,"op":230,"st":50,"bm":0}],"markers":[]} \ No newline at end of file diff --git a/TMessagesProj/src/main/res/raw/ubuntu_30.json b/TMessagesProj/src/main/res/raw/ubuntu_30.json new file mode 100644 index 000000000..0b5a2e9d9 --- /dev/null +++ b/TMessagesProj/src/main/res/raw/ubuntu_30.json @@ -0,0 +1 @@ +{"v":"5.7.4","fr":60,"ip":0,"op":180,"w":30,"h":30,"nm":"ubuntu_30","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Union","parent":5,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[13.594,0,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[-4.297,-5.178],[-6.797,-9.508],[-8.234,-8.678],[-5.734,-4.348]],"c":true},"ix":2},"nm":"Контур 1","mn":"ADBE Vector Shape - Group","hd":false},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[-8.234,8.678],[-5.734,4.348],[-4.297,5.178],[-6.797,9.508]],"c":true},"ix":2},"nm":"Контур 2","mn":"ADBE Vector Shape - Group","hd":false},{"ind":2,"ty":"sh","ix":3,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[3.234,0.83],[8.234,0.83],[8.234,-0.83],[3.234,-0.83]],"c":true},"ix":2},"nm":"Контур 3","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":1,"nm":"Объединить контуры 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Заливка 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Union","np":5,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":180,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Ellipse 24","parent":5,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[30,51.962,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":60,"s":[-100,-100,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":75,"s":[-70,-70,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":80,"s":[-130,-130,100]},{"t":90,"s":[-100,-100,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[4,4],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Контур эллипса 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Заливка 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2.66,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Обводка 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":60,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Ellipse 24","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":180,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Ellipse 24","parent":5,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[-60,0,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":60,"s":[-100,-100,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":75,"s":[-70,-70,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":80,"s":[-130,-130,100]},{"t":90,"s":[-100,-100,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[4,4],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Контур эллипса 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Заливка 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2.66,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Обводка 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Ellipse 24","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":180,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"Ellipse 25","parent":5,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[30,-51.961,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":60,"s":[-100,-100,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":75,"s":[-70,-70,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":80,"s":[-130,-130,100]},{"t":90,"s":[-100,-100,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[4,4],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Контур эллипса 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Заливка 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2.66,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Обводка 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":-60,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Ellipse 24","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":180,"st":0,"bm":0},{"ddd":0,"ind":5,"ty":4,"nm":"Ellipse 3","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":60,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":80,"s":[-245]},{"t":90,"s":[-240]}],"ix":10},"p":{"a":0,"k":[15,15,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[16.667,16.667,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[16,16],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Контур эллипса 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":4,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Обводка 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Ellipse 3","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":180,"st":0,"bm":0}],"markers":[]} \ No newline at end of file diff --git a/TMessagesProj/src/main/res/raw/windows_30.json b/TMessagesProj/src/main/res/raw/windows_30.json new file mode 100644 index 000000000..4fb8b6595 --- /dev/null +++ b/TMessagesProj/src/main/res/raw/windows_30.json @@ -0,0 +1 @@ +{"v":"5.7.4","fr":60,"ip":0,"op":180,"w":30,"h":30,"nm":"windows_30","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Union","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"s":true,"x":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":60,"s":[15]},{"i":{"x":[0.833],"y":[0.889]},"o":{"x":[0.333],"y":[0]},"t":85,"s":[12.5]},{"i":{"x":[0],"y":[1]},"o":{"x":[0.167],"y":[0.222]},"t":95,"s":[15]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":115,"s":[17.5]},{"t":130,"s":[15]}],"ix":3},"y":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":60,"s":[15]},{"i":{"x":[0.833],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":85,"s":[15]},{"i":{"x":[0],"y":[1]},"o":{"x":[0.167],"y":[0]},"t":95,"s":[15]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":115,"s":[15]},{"t":130,"s":[15]}],"ix":4}},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[16.667,16.667,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[-1,11],[-1,1],[-12.667,1],[-12.667,-1],[-1,-1],[-1,-11],[1,-11],[1,-1],[12.667,-1],[12.667,1],[1,1],[1,11]],"c":true},"ix":2},"nm":"Контур 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Заливка 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Union","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":180,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Rectangle 23","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[15,15,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[16.667,16.667,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0,"y":1},"o":{"x":0.333,"y":0},"t":60,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[9,-9],[9,9],[-9,9],[-9,-9]],"c":true}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.333,"y":0},"t":85,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[9,-10.667],[9,10.667],[-10.667,5.667],[-10.667,-5.667]],"c":true}]},{"i":{"x":0,"y":1},"o":{"x":0.167,"y":0.167},"t":95,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[9,-9],[9,9],[-9,9],[-9,-9]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":115,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[10.667,-5.667],[10.667,5.667],[-9,10.667],[-9,-10.667]],"c":true}]},{"t":130,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[9,-9],[9,9],[-9,9],[-9,-9]],"c":true}]}],"ix":2},"nm":"Контур 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Заливка 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[600,600],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Преобразовать"}],"nm":"Rectangle 23","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":180,"st":0,"bm":0}],"markers":[]} \ No newline at end of file diff --git a/TMessagesProj/src/main/res/values-ar/strings.xml b/TMessagesProj/src/main/res/values-ar/strings.xml index 1dc9d873a..52a277632 100644 --- a/TMessagesProj/src/main/res/values-ar/strings.xml +++ b/TMessagesProj/src/main/res/values-ar/strings.xml @@ -3167,7 +3167,7 @@ المعذرة، لا يمكن استخدام اسم العائلة هذا. يتم التحميل... لا تملك أي مشغل للمقاطع المرئية على جهازك، يرجى تنزيل واحد للمتابعة - يرجى مراسلتنا عبر البريد الإلكتروني reports@stel.com لإخبارنا بمشكلتك. + يرجى مراسلتنا عبر البريد الإلكتروني sms@telegram.org لإخبارنا بمشكلتك. لا تملك تطبيقًا يمكنه فتح صيغة الملفات \'%1$s\'، يرجى تنزيل تطبيق مناسب للاستمرار هذا المستخدم ليس لديه تيليجرام بعد، هل تريد دعوته؟ هل أنت متأكد؟ diff --git a/TMessagesProj/src/main/res/values-de/strings.xml b/TMessagesProj/src/main/res/values-de/strings.xml index 95bf47245..6ccc9a72b 100644 --- a/TMessagesProj/src/main/res/values-de/strings.xml +++ b/TMessagesProj/src/main/res/values-de/strings.xml @@ -3167,7 +3167,7 @@ Dieser Name kann leider nicht benutzt werden Lädt… Du hast keinen Videoplayer. Bitte installiere einen um fortzufahren. - Bitte sende eine E-Mail an reports@stel.com mit einer Beschreibung des Problems. + Bitte sende eine E-Mail an sms@telegram.org mit einer Beschreibung des Problems. Du hast keine Applikationen, die den Dateityp \'%1$s\' öffnen könnten. Bitte installiere eine entsprechende Anwendung um fortzufahren. Dieser Nutzer hat noch kein Telegram. Möchtest du ihn einladen? Bist du sicher? diff --git a/TMessagesProj/src/main/res/values-es/strings.xml b/TMessagesProj/src/main/res/values-es/strings.xml index bdd835350..59a18f013 100644 --- a/TMessagesProj/src/main/res/values-es/strings.xml +++ b/TMessagesProj/src/main/res/values-es/strings.xml @@ -3167,7 +3167,7 @@ Lo sentimos, este apellido no se puede usar Cargando... No tienes reproductor de video. Por favor, instala uno para continuar. - Por favor, envía un correo describiendo tu problema a reports@stel.com + Por favor, envía un correo describiendo tu problema a sms@telegram.org No tienes aplicaciones que puedan manejar el tipo de archivo “%1$s”. Por favor, instala una para continuar. Este usuario aún no tiene Telegram. ¿Enviarle una invitación? ¿Quieres hacerlo? diff --git a/TMessagesProj/src/main/res/values-it/strings.xml b/TMessagesProj/src/main/res/values-it/strings.xml index 7c855268c..c7d92b4d8 100644 --- a/TMessagesProj/src/main/res/values-it/strings.xml +++ b/TMessagesProj/src/main/res/values-it/strings.xml @@ -3167,7 +3167,7 @@ Spiacenti, questo cognome non può essere usato Carico... Non hai un lettore video, per favore installane uno per continuare - Per favore invia un’email descrivendo il problema a reports@stel.com + Per favore invia un’email descrivendo il problema a sms@telegram.org Non hai applicazioni che possono gestire il tipo di file \'%1$s\': installane una per proseguire Questo utente non ha ancora Telegram, vuoi invitarlo? Sei sicuro? diff --git a/TMessagesProj/src/main/res/values-ko/strings.xml b/TMessagesProj/src/main/res/values-ko/strings.xml index af66e5ec7..8756b3008 100644 --- a/TMessagesProj/src/main/res/values-ko/strings.xml +++ b/TMessagesProj/src/main/res/values-ko/strings.xml @@ -3167,7 +3167,7 @@ 죄송합니다. 본 성을 사용하실 수 없습니다 불러오는 중... 동영상 재생기가 없습니다. 계속하려면 앱을 설치하세요. - 발생한 문제를 자세히 적어 reports@stel.com으로 이메일을 보내 주세요. + 발생한 문제를 자세히 적어 sms@telegram.org으로 이메일을 보내 주세요. \'%1$s\' 파일 유형을 처리할 수 있는 응용 프로그램이 없습니다. 계속하려면 프로그램을 설치해 주세요 지인분이 아직 텔레그램을 설치하지 않았습니다. 초대장을 보낼까요? 확실하십니까? diff --git a/TMessagesProj/src/main/res/values-nl/strings.xml b/TMessagesProj/src/main/res/values-nl/strings.xml index 030d5a652..4bf807df2 100644 --- a/TMessagesProj/src/main/res/values-nl/strings.xml +++ b/TMessagesProj/src/main/res/values-nl/strings.xml @@ -3167,7 +3167,7 @@ Ongeldige achternaam Bezig met laden Je hebt geen mediaspeler. Installeer een mediaspeler om door te gaan. - E-mail ons op reports@stel.com en vertel ons wat het probleem is. + E-mail ons op sms@telegram.org en vertel ons wat het probleem is. Je hebt geen apps die bestandstype \'%1$s\' kunnen verwerken, gelieve een compatibele app te installeren Deze gebruiker heeft nog geen Telegram. Wil je een uitnodiging sturen? Weet je het zeker? diff --git a/TMessagesProj/src/main/res/values-pt-rBR/strings.xml b/TMessagesProj/src/main/res/values-pt-rBR/strings.xml index 02c99d046..1d743a5bd 100644 --- a/TMessagesProj/src/main/res/values-pt-rBR/strings.xml +++ b/TMessagesProj/src/main/res/values-pt-rBR/strings.xml @@ -3167,7 +3167,7 @@ Desculpe, este sobrenome não pode ser usado Carregando... Você não possui um reprodutor de vídeo, instale um para continuar - Por favor, envie um email descrevendo o problema para reports@stel.com. + Por favor, envie um email descrevendo o problema para sms@telegram.org. Você não possui um aplicativo que suporte o tipo de arquivo \'%1$s\', por favor instale um para continuar Esse usuário ainda não tem o Telegram, deseja enviar um convite? Tem certeza? diff --git a/TMessagesProj/src/main/res/values/strings.xml b/TMessagesProj/src/main/res/values/strings.xml index b5a03e95a..75d2058b4 100644 --- a/TMessagesProj/src/main/res/values/strings.xml +++ b/TMessagesProj/src/main/res/values/strings.xml @@ -2167,8 +2167,9 @@ Token invalid or already expired. No auth token found Auth successfull - https://desktop.telegram.org/ - Download Telegram on your computer from *desktop.telegram.org*. + https://getdesktop.telegram.org/ + https://web.telegram.org/ + Download Telegram on your computer from *getdesktop.telegram.org*. Run Telegram Desktop to get the QR code. Scan the QR code to connect your account. This code can be used to allow someone to log in to your Telegram account.\n\nTo confirm Telegram login, please go to Settings > Devices > Scan QR and scan the code. @@ -2429,7 +2430,6 @@ You can log in to Telegram from other mobile, tablet and desktop devices, using the same phone number. All your data will be instantly synchronized. Active sessions Control your sessions on other devices. - Tap on a session to terminate. Terminate this session? Are you sure you want to terminate this session? Logs out all devices except for this one. @@ -3026,7 +3026,7 @@ My Contacts (-%1$d, +%2$d) Nobody (+%1$d) Security - Account self-destructs + Account self-destruct New chats from unknown users Archive and Mute Automatically archive and mute new chats, groups and channels from non-contacts. @@ -3245,7 +3245,7 @@ Sorry, this last name can\'t be used Loading... You don\'t have a video player, please install one to continue - Please send an email describing your problem to reports@stel.com + Please send an email describing your problem to sms@telegram.org You don\'t have applications that can handle the file type \'%1$s\', please install one to continue This user does not have Telegram yet, send an invitation? Are you sure? @@ -3862,6 +3862,28 @@ Voice call %1$s Video call %1$s + + Proceed without a password? If you do not set a password, you will only be able to log into your account via SMS once every %1$s days. + Proceed without a password? If you do not set a password, you will only be able to log into your account via SMS once every %1$s day. + Proceed without a password? If you do not set a password, you will only be able to log into your account via SMS once every %1$s days. + Proceed without a password? If you do not set a password, you will only be able to log into your account via SMS once every %1$s days. + Proceed without a password? If you do not set a password, you will only be able to log into your account via SMS once every %1$s days. + Proceed without a password? If you do not set a password, you will only be able to log into your account via SMS once every %1$s days. + + Messages for %1$s days deleted + Messages for %1$s day deleted + Messages for %1$s days deleted + Messages for %1$s days deleted + Messages for %1$s days deleted + Messages for %1$s days deleted + + Delete %1$s days + Delete %1$s day + Delete %1$s days + Delete %1$s days + Delete %1$s days + Delete %1$s days + un1 are speaking un1 is speaking un1 are speaking @@ -4751,6 +4773,7 @@ Show videos You can hold and move this bar for faster scrolling Switch to Night Mode + Switch to Day Mode Browse Themes Browse Themes Build my own theme @@ -4809,5 +4832,61 @@ un1 was accepted into the group %1$s was accepted into the group %2$s|%1$s was accepted into the group + Сopying and forwarding is not allowed in this channel. + Сopying and forwarding is not allowed in this group. + Send message as... VIEW POST + Saving content + Restrict saving content + Members won\'t be able to forward messages from this group or save media files. + Subscribers won\'t be able to forward messages from this group or save media files. + Please allow **Telegram** to manage all files to open in-app file browser + Telegram needs permission to manage all files to migrate old cache files to Scoped Storage + Allow + Use Another App + Application + Location based on the IP address + IP address + Accept Secret Chats + Use this device for Secret Chats + Terminate Session + Link *Telegram Desktop* or *Telegram Web* by scanning the QR. + Link Desktop Device + Automatically terminate old sessions + if inactive for + Go to *getdesktop.telegram.org* or *web.telegram.org* to get a QR code + The official Telegram app is available for Android, iPhone, iPad, Windows, macOS and Linux. + Migrate old folder to Scoped Storage + Select this day + No messages for this day + Don\'t ask again + Select Days + Clear History for these days + un1 enabled forwarding from this group + un1 enabled forwarding from this channel + un1 restricted forwarding from this group + un1 restricted forwarding from this channel + + Private restricted + Private restricted + Clear History for this day + Please select one ore more days first. + Enter the missing digits + Within next few seconds you should receive a short call from: + Please enter the last digits of the number that called + Are you sure you want to delete all messages for the selected days? + Use this device for Calls + Accept Calls + Yes, i\'m sure + Warning + No, let me set a password + **%1$s** is an admin of **%2$s**, a group you requested to join. + **%1$s** is an admin of **%2$s**, a channel you requested to join. + Chat with channel\'s admin + Chat with group\'s admin + I understand + Sessions self-destruct + You received this message because you requested to join **%1$s** on %2$s + un1 sent this message: + Get code on this phone diff --git a/TMessagesProj/src/main/res/values/styles.xml b/TMessagesProj/src/main/res/values/styles.xml index f3a3ed764..f510f801e 100644 --- a/TMessagesProj/src/main/res/values/styles.xml +++ b/TMessagesProj/src/main/res/values/styles.xml @@ -130,6 +130,18 @@ false + +