From 3c9a4c1f1f929e69fc4ed42cb59b78f2b8e8ba12 Mon Sep 17 00:00:00 2001 From: xaxtix Date: Wed, 26 Apr 2023 14:01:31 +0400 Subject: [PATCH] update to 9.6.2 --- .../messenger/AnimatedFileDrawableStream.java | 28 ++++++++-- .../org/telegram/messenger/BuildVars.java | 4 +- .../telegram/messenger/FileLoadOperation.java | 8 +++ .../org/telegram/messenger/FileLoader.java | 4 +- .../messenger/FileLoaderPriorityQueue.java | 12 ++-- .../messenger/FileStreamLoadOperation.java | 15 ++++- .../telegram/messenger/MediaController.java | 2 +- .../org/telegram/messenger/MessageObject.java | 35 +++++++++++- .../messenger/MessagesController.java | 35 +++++++----- .../telegram/messenger/MessagesStorage.java | 2 +- .../messenger/NotificationsController.java | 11 +++- .../org/telegram/messenger/SharedConfig.java | 2 +- .../telegram/messenger/voip/VoIPService.java | 7 ++- .../telegram/tgnet/ConnectionsManager.java | 1 + .../ui/ActionBar/ActionBarPopupWindow.java | 3 - .../java/org/telegram/ui/ActionBar/Theme.java | 7 +-- .../telegram/ui/Adapters/ContactsAdapter.java | 2 +- .../telegram/ui/Adapters/DialogsAdapter.java | 6 +- .../ui/Adapters/LocationActivityAdapter.java | 8 +-- .../telegram/ui/ArchivedStickersActivity.java | 10 ++-- .../org/telegram/ui/CacheControlActivity.java | 6 +- .../java/org/telegram/ui/CallLogActivity.java | 3 +- .../ui/Cells/ArchivedStickerSetCell.java | 30 ++++++++-- .../telegram/ui/Cells/ChatMessageCell.java | 18 ++---- .../org/telegram/ui/Cells/DialogCell.java | 12 ++++ .../ui/Cells/RequestPeerRequirementsCell.java | 2 +- .../ui/Cells/ThemePreviewMessagesCell.java | 2 +- .../telegram/ui/ChangeUsernameActivity.java | 4 +- .../telegram/ui/ChannelCreateActivity.java | 10 ++-- .../java/org/telegram/ui/ChatActivity.java | 20 ++----- .../org/telegram/ui/ChatEditActivity.java | 8 +-- .../org/telegram/ui/ChatEditTypeActivity.java | 20 +++---- .../org/telegram/ui/ChatLinkActivity.java | 2 +- .../telegram/ui/ChatRightsEditActivity.java | 10 ++-- .../org/telegram/ui/ChatUsersActivity.java | 18 +++--- .../ui/Components/AutoDeletePopupWrapper.java | 2 +- .../ChatAttachAlertDocumentLayout.java | 2 +- .../Components/ChatAttachAlertPollLayout.java | 4 +- .../ui/Components/ClearHistoryAlert.java | 4 +- .../ui/Components/FolderBottomSheet.java | 10 +--- .../ui/Components/InstantCameraView.java | 16 ++++-- .../ui/Components/InviteLinkBottomSheet.java | 12 ++-- .../Paint/Views/LPhotoPaintView.java | 2 +- .../PhotoViewerCaptionEnterView.java | 2 + .../Components/StickerSetBulletinLayout.java | 3 + .../telegram/ui/DataAutoDownloadActivity.java | 10 ++-- .../org/telegram/ui/DataSettingsActivity.java | 6 +- .../org/telegram/ui/DataUsage2Activity.java | 8 +-- .../org/telegram/ui/DataUsageActivity.java | 6 +- .../ui/Delegates/MemberRequestsDelegate.java | 2 +- .../java/org/telegram/ui/DialogsActivity.java | 32 +++++++++-- .../telegram/ui/DilogCacheBottomSheet.java | 2 +- .../org/telegram/ui/EditWidgetActivity.java | 4 +- .../telegram/ui/FeaturedStickersActivity.java | 2 +- .../telegram/ui/FilterChatlistActivity.java | 6 +- .../org/telegram/ui/FilterCreateActivity.java | 22 +------- .../org/telegram/ui/FiltersSetupActivity.java | 12 +--- .../org/telegram/ui/GroupCallActivity.java | 5 +- .../telegram/ui/GroupCreateFinalActivity.java | 4 +- .../org/telegram/ui/GroupInviteActivity.java | 4 +- .../telegram/ui/GroupStickersActivity.java | 4 +- .../org/telegram/ui/KeepMediaPopupView.java | 2 +- .../telegram/ui/LanguageSelectActivity.java | 9 ++- .../org/telegram/ui/LinkEditActivity.java | 16 +++--- .../telegram/ui/LiteModeSettingsActivity.java | 6 +- .../java/org/telegram/ui/LogoutActivity.java | 2 +- .../org/telegram/ui/ManageLinksActivity.java | 6 +- .../telegram/ui/MessageStatisticActivity.java | 4 +- .../NotificationsCustomSettingsActivity.java | 4 +- .../ui/NotificationsSettingsActivity.java | 6 +- .../ui/NotificationsSoundActivity.java | 22 +++++--- .../org/telegram/ui/PasscodeActivity.java | 4 +- .../org/telegram/ui/PassportActivity.java | 56 +++++++++---------- .../org/telegram/ui/PaymentFormActivity.java | 28 +++++----- .../org/telegram/ui/PeopleNearbyActivity.java | 6 +- .../org/telegram/ui/PollCreateActivity.java | 2 +- .../telegram/ui/PrivacyControlActivity.java | 6 +- .../telegram/ui/PrivacySettingsActivity.java | 2 +- .../org/telegram/ui/PrivacyUsersActivity.java | 6 +- .../ui/ProfileNotificationsActivity.java | 8 +-- .../org/telegram/ui/ProxyListActivity.java | 10 ++-- .../telegram/ui/ProxySettingsActivity.java | 6 +- .../ui/QuickRepliesSettingsActivity.java | 2 +- .../ui/ReactionsDoubleTapManageActivity.java | 4 +- .../ui/RestrictedLanguagesSelectActivity.java | 8 +-- .../org/telegram/ui/SessionsActivity.java | 10 ++-- .../org/telegram/ui/StatisticActivity.java | 2 +- .../org/telegram/ui/StickersActivity.java | 28 +++++----- .../java/org/telegram/ui/ThemeActivity.java | 7 +-- .../org/telegram/ui/ThemeSetUrlActivity.java | 14 ++--- .../ui/TooManyCommunitiesActivity.java | 2 +- .../org/telegram/ui/TopicCreateFragment.java | 2 +- .../ui/TwoStepVerificationActivity.java | 4 +- .../telegram/ui/WallpapersListActivity.java | 4 +- TMessagesProj/src/main/res/values/strings.xml | 3 + gradle.properties | 4 +- 96 files changed, 475 insertions(+), 383 deletions(-) diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/AnimatedFileDrawableStream.java b/TMessagesProj/src/main/java/org/telegram/messenger/AnimatedFileDrawableStream.java index 3b97fd02d..b26c1ef04 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/AnimatedFileDrawableStream.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/AnimatedFileDrawableStream.java @@ -6,7 +6,7 @@ import java.util.concurrent.CountDownLatch; public class AnimatedFileDrawableStream implements FileLoadOperationStream { - private final FileLoadOperation loadOperation; + private FileLoadOperation loadOperation; private CountDownLatch countDownLatch; private TLRPC.Document document; private ImageLocation location; @@ -76,22 +76,30 @@ public class AnimatedFileDrawableStream implements FileLoadOperationStream { return 0; } } + countDownLatch = new CountDownLatch(1); if (loadOperation.isPaused() || lastOffset != offset || preview) { - FileLoader.getInstance(currentAccount).loadStreamFile(this, document, location, parentObject, offset, preview, loadingPriority); + FileLoadOperation loadOperation = FileLoader.getInstance(currentAccount).loadStreamFile(this, document, location, parentObject, offset, preview, loadingPriority); + if (this.loadOperation != loadOperation) { + this.loadOperation.removeStreamListener(this); + this.loadOperation = loadOperation; + } + lastOffset = offset + availableLength; } synchronized (sync) { if (canceled) { + countDownLatch = null; cancelLoadingInternal(); return 0; } - countDownLatch = new CountDownLatch(1); } if (!preview) { FileLoader.getInstance(currentAccount).setLoadingVideo(document, false, true); } - waitingForLoad = true; - countDownLatch.await(); - waitingForLoad = false; + if (countDownLatch != null) { + waitingForLoad = true; + countDownLatch.await(); + waitingForLoad = false; + } } } lastOffset = offset + availableLength; @@ -113,10 +121,17 @@ public class AnimatedFileDrawableStream implements FileLoadOperationStream { synchronized (sync) { if (countDownLatch != null) { countDownLatch.countDown(); + countDownLatch = null; if (removeLoading && !canceled && !preview) { FileLoader.getInstance(currentAccount).removeLoadingVideo(document, false, true); } } + if (parentObject instanceof MessageObject) { + MessageObject messageObject = (MessageObject) parentObject; + if (DownloadController.getInstance(messageObject.currentAccount).isDownloading(messageObject.getId())) { + removeLoading = false; + } + } if (removeLoading) { cancelLoadingInternal(); } @@ -165,6 +180,7 @@ public class AnimatedFileDrawableStream implements FileLoadOperationStream { public void newDataAvailable() { if (countDownLatch != null) { countDownLatch.countDown(); + countDownLatch = null; } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java index 1a315ac52..3ffb1a697 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java @@ -24,8 +24,8 @@ public class BuildVars { 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 = 3333; - public static String BUILD_VERSION_STRING = "9.6.1"; + public static int BUILD_VERSION = 3341; + public static String BUILD_VERSION_STRING = "9.6.2"; public static int APP_ID = 4; public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103"; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java index f6cacce0f..fc4f42e9e 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java @@ -619,6 +619,14 @@ public class FileLoadOperation { return result[0]; } + protected File getCurrentFileFast() { + if (state == stateFinished) { + return cacheFileFinal; + } else { + return cacheFileTemp; + } + } + private long getDownloadedLengthFromOffsetInternal(ArrayList ranges, final long offset, final long length) { if (ranges == null || state == stateFinished || ranges.isEmpty()) { if (state == stateFinished) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoader.java b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoader.java index 02246c9cc..f64cfe97d 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoader.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoader.java @@ -203,8 +203,8 @@ public class FileLoader extends BaseController { super(instance); filePathDatabase = new FilePathDatabase(instance); for (int i = 0; i < smallFilesQueue.length; i++) { - smallFilesQueue[i] = new FileLoaderPriorityQueue("smallFilesQueue dc" + (i + 1), 5); - largeFilesQueue[i] = new FileLoaderPriorityQueue("largeFilesQueue dc" + (i + 1), 2); + smallFilesQueue[i] = new FileLoaderPriorityQueue(instance, "smallFilesQueue dc" + (i + 1), FileLoaderPriorityQueue.TYPE_SMALL); + largeFilesQueue[i] = new FileLoaderPriorityQueue(instance, "largeFilesQueue dc" + (i + 1), FileLoaderPriorityQueue.TYPE_LARGE); } dumpFilesQueue(); } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoaderPriorityQueue.java b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoaderPriorityQueue.java index 5cacee6a2..2db81ad8d 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoaderPriorityQueue.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoaderPriorityQueue.java @@ -4,8 +4,11 @@ import java.util.ArrayList; public class FileLoaderPriorityQueue { - private final int maxActiveOperationsCount; + public static final int TYPE_SMALL = 0; + public static final int TYPE_LARGE = 1; String name; + int type; + int currentAccount; private ArrayList allOperations = new ArrayList<>(); @@ -13,9 +16,10 @@ public class FileLoaderPriorityQueue { private int PRIORITY_VALUE_NORMAL = (1 << 16); private int PRIORITY_VALUE_LOW = 0; - FileLoaderPriorityQueue(String name, int maxActiveOperationsCount) { + FileLoaderPriorityQueue(int currentAccount, String name, int type) { + this.currentAccount = currentAccount; this.name = name; - this.maxActiveOperationsCount = maxActiveOperationsCount; + this.type = type; } public void add(FileLoadOperation operation) { @@ -55,7 +59,7 @@ public class FileLoaderPriorityQueue { int activeCount = 0; int lastPriority = 0; boolean pauseAllNextOperations = false; - int max = maxActiveOperationsCount; + int max = type == TYPE_LARGE ? MessagesController.getInstance(currentAccount).largeQueueMaxActiveOperations : MessagesController.getInstance(currentAccount).smallQueueMaxActiveOperations; for (int i = 0; i < allOperations.size(); i++) { FileLoadOperation operation = allOperations.get(i); if (i > 0 && !pauseAllNextOperations) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/FileStreamLoadOperation.java b/TMessagesProj/src/main/java/org/telegram/messenger/FileStreamLoadOperation.java index 5adf7a728..fbc590c0f 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/FileStreamLoadOperation.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/FileStreamLoadOperation.java @@ -20,6 +20,7 @@ import com.google.android.exoplayer2.upstream.TransferListener; import org.telegram.tgnet.TLRPC; import java.io.EOFException; +import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; import java.util.concurrent.CountDownLatch; @@ -37,6 +38,7 @@ public class FileStreamLoadOperation extends BaseDataSource implements FileLoadO private TLRPC.Document document; private Object parentObject; private int currentAccount; + File currentFile; public FileStreamLoadOperation() { super(/* isNetwork= */ false); @@ -78,7 +80,7 @@ public class FileStreamLoadOperation extends BaseDataSource implements FileLoadO opened = true; transferStarted(dataSpec); if (loadOperation != null) { - file = new RandomAccessFile(loadOperation.getCurrentFile(), "r"); + file = new RandomAccessFile(currentFile = loadOperation.getCurrentFile(), "r"); file.seek(currentOffset); } return bytesRemaining; @@ -99,13 +101,16 @@ public class FileStreamLoadOperation extends BaseDataSource implements FileLoadO while (availableLength == 0 && opened) { availableLength = (int) loadOperation.getDownloadedLengthFromOffset(currentOffset, readLength)[0]; if (availableLength == 0) { + countDownLatch = new CountDownLatch(1); FileLoadOperation loadOperation = FileLoader.getInstance(currentAccount).loadStreamFile(this, document, null, parentObject, currentOffset, false, FileLoader.PRIORITY_HIGH); if (this.loadOperation != loadOperation) { this.loadOperation.removeStreamListener(this); this.loadOperation = loadOperation; } - countDownLatch = new CountDownLatch(1); - countDownLatch.await(); + if (countDownLatch != null) { + countDownLatch.await(); + countDownLatch = null; + } } } if (!opened) { @@ -146,14 +151,18 @@ public class FileStreamLoadOperation extends BaseDataSource implements FileLoadO transferEnded(); } if (countDownLatch != null) { + // FileLog.d("FileStreamLoadOperation count down"); countDownLatch.countDown(); + countDownLatch = null; } } @Override public void newDataAvailable() { if (countDownLatch != null) { + // FileLog.d("FileStreamLoadOperation count down"); countDownLatch.countDown(); + countDownLatch = null; } } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java index 45d6fa5fd..679064424 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java @@ -1802,7 +1802,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener, if (chatActivity == null || accelerometerSensor == null && (gravitySensor == null || linearAcceleration == null) || proximitySensor == null) { return; } - if (!SharedConfig.enabledRaiseTo(true) && (playingMessageObject == null || !playingMessageObject.isVoice() && !playingMessageObject.isRoundVideo())) { + if (!SharedConfig.enabledRaiseTo(false) && (playingMessageObject == null || !playingMessageObject.isVoice() && !playingMessageObject.isRoundVideo())) { return; } raiseChat = chatActivity; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java index 167d5740e..eccd9120b 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java @@ -2450,6 +2450,32 @@ public class MessageObject { checkMediaExistance(); } + private boolean spoiledLoginCode = false; + private static Pattern loginCodePattern; + public void spoilLoginCode() { // spoil login code from +42777 + if (!spoiledLoginCode && messageText != null && messageOwner != null && messageOwner.entities != null && messageOwner.from_id instanceof TLRPC.TL_peerUser && messageOwner.from_id.user_id == 777000) { + if (loginCodePattern == null) { + loginCodePattern = Pattern.compile("[\\d\\-]{5,7}"); + } + try { + Matcher matcher = loginCodePattern.matcher(messageText); + if (matcher.find()) { + TLRPC.TL_messageEntitySpoiler spoiler = new TLRPC.TL_messageEntitySpoiler(); + spoiler.offset = matcher.start(); + spoiler.length = matcher.end() - spoiler.offset; + messageOwner.entities.add(spoiler); + } + } catch (Exception e) { + FileLog.e(e, false); + } + spoiledLoginCode = true; + } + } + + public boolean didSpoilLoginCode() { + return spoiledLoginCode; + } + private CharSequence getStringFrom(TLRPC.ChatReactions reactions) { if (reactions instanceof TLRPC.TL_chatReactionsAll) { return LocaleController.getString("AllReactions", R.string.AllReactions); @@ -4764,6 +4790,9 @@ public class MessageObject { } matcher = urlPattern.matcher(charSequence); } + if (!(charSequence instanceof Spannable)) { + return; + } Spannable spannable = (Spannable) charSequence; while (matcher.find()) { int start = matcher.start(); @@ -5389,6 +5418,7 @@ public class MessageObject { textWidth = 0; ArrayList entities = translated && messageOwner.translatedText != null ? messageOwner.translatedText.entities : messageOwner.entities; + spoilLoginCode(); boolean hasEntities; if (messageOwner.send_state != MESSAGE_SEND_STATE_SENT) { @@ -5670,7 +5700,7 @@ public class MessageObject { linesOffset += currentBlockLinesCount; block.spoilers.clear(); - if (!isSpoilersRevealed) { + if (!isSpoilersRevealed && !spoiledLoginCode) { SpoilerEffect.addSpoilers(null, block.textLayout, -1, linesMaxWidthWithLeft, null, block.spoilers); } } @@ -7578,6 +7608,9 @@ public class MessageObject { } public boolean equals(MessageObject obj) { + if (obj == null) { + return false; + } return getId() == obj.getId() && getDialogId() == obj.getDialogId(); } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java index c37d22e49..42a45aafb 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java @@ -27,6 +27,7 @@ import android.os.SystemClock; import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.Base64; +import android.util.Log; import android.util.Pair; import android.util.SparseArray; import android.util.SparseBooleanArray; @@ -133,6 +134,8 @@ public class MessagesController extends BaseController implements NotificationCe private LongSparseIntArray pendingUnreadCounter = new LongSparseIntArray(); private int lastPrintingStringCount; private SparseArray chatlistFoldersUpdates = new SparseArray<>(); + public int largeQueueMaxActiveOperations = 2; + public int smallQueueMaxActiveOperations = 5; class ChatlistUpdatesStat { public ChatlistUpdatesStat() { @@ -1321,6 +1324,8 @@ public class MessagesController extends BaseController implements NotificationCe giftAttachMenuIcon = mainPreferences.getBoolean("giftAttachMenuIcon", false); giftTextFieldIcon = mainPreferences.getBoolean("giftTextFieldIcon", false); checkResetLangpack = mainPreferences.getInt("checkResetLangpack", 0); + smallQueueMaxActiveOperations = mainPreferences.getInt("smallQueueMaxActiveOperations", 5); + largeQueueMaxActiveOperations = mainPreferences.getInt("largeQueueMaxActiveOperations", 2); boolean isTest = ConnectionsManager.native_isTestBackend(currentAccount) != 0; chatlistInvitesLimitDefault = mainPreferences.getInt("chatlistInvitesLimitDefault", 3); chatlistInvitesLimitPremium = mainPreferences.getInt("chatlistInvitesLimitPremium", isTest ? 5 : 20); @@ -2096,6 +2101,20 @@ public class MessagesController extends BaseController implements NotificationCe for (int a = 0, N = object.value.size(); a < N; a++) { TLRPC.TL_jsonObjectValue value = object.value.get(a); switch (value.key) { + case "large_queue_max_active_operations_count": { + if (value.value instanceof TLRPC.TL_jsonNumber) { + largeQueueMaxActiveOperations = (int) ((TLRPC.TL_jsonNumber) value.value).value; + editor.putInt("largeQueueMaxActiveOperations", largeQueueMaxActiveOperations); + } + break; + } + case "small_queue_max_active_operations_count": { + if (value.value instanceof TLRPC.TL_jsonNumber) { + smallQueueMaxActiveOperations = (int) ((TLRPC.TL_jsonNumber) value.value).value; + editor.putInt("smallQueueMaxActiveOperations", smallQueueMaxActiveOperations); + } + break; + } case "premium_gift_text_field_icon": { if (value.value instanceof TLRPC.TL_jsonBool) { if (giftTextFieldIcon != ((TLRPC.TL_jsonBool) value.value).value) { @@ -2356,17 +2375,6 @@ public class MessagesController extends BaseController implements NotificationCe } break; } - case "autologin_token": { - if (value.value instanceof TLRPC.TL_jsonString) { - TLRPC.TL_jsonString string = (TLRPC.TL_jsonString) value.value; - if (!string.value.equals(autologinToken)) { - autologinToken = string.value; - editor.putString("autologinToken", autologinToken); - changed = true; - } - } - break; - } case "emojies_send_dice": { HashSet newEmojies = new HashSet<>(); if (value.value instanceof TLRPC.TL_jsonArray) { @@ -3364,6 +3372,7 @@ public class MessagesController extends BaseController implements NotificationCe editor.putInt("webFileDatacenterId", webFileDatacenterId); editor.putString("suggestedLangCode", suggestedLangCode); editor.putBoolean("forceTryIpV6", forceTryIpV6); + editor.putString("autologinToken", autologinToken = config.autologin_token); editor.commit(); getConnectionsManager().setForceTryIpV6(forceTryIpV6); @@ -11199,9 +11208,9 @@ public class MessagesController extends BaseController implements NotificationCe final ArrayList userRestrictedPrivacy = new ArrayList<>(); processed[0] = 0; final Runnable showUserRestrictedPrivacyAlert = () -> { - AndroidUtilities.runOnUIThread(() ->{ + AndroidUtilities.runOnUIThread(() -> { BaseFragment lastFragment = LaunchActivity.getLastFragment(); - if (lastFragment != null && lastFragment.getParentActivity() != null) { + if (lastFragment != null && lastFragment.getParentActivity() != null && !lastFragment.getParentActivity().isFinishing()) { // if (ChatObject.canUserDoAdminAction(currentChat, ChatObject.ACTION_INVITE)) { LimitReachedBottomSheet restricterdUsersBottomSheet = new LimitReachedBottomSheet(lastFragment, lastFragment.getParentActivity(), LimitReachedBottomSheet.TYPE_ADD_MEMBERS_RESTRICTED, currentAccount); restricterdUsersBottomSheet.setRestrictedUsers(currentChat, userRestrictedPrivacy); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java index 94a97d8a8..a35df022d 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java @@ -13871,7 +13871,7 @@ public class MessagesStorage extends BaseController { } if (message.media instanceof TLRPC.TL_messageMediaPoll) { TLRPC.TL_messageMediaPoll messageMediaPoll = (TLRPC.TL_messageMediaPoll) message.media; - if (!messageMediaPoll.results.recent_voters.isEmpty()) { + if (messageMediaPoll.results != null && messageMediaPoll.results.recent_voters != null && !messageMediaPoll.results.recent_voters.isEmpty()) { usersToLoad.addAll(messageMediaPoll.results.recent_voters); } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/NotificationsController.java b/TMessagesProj/src/main/java/org/telegram/messenger/NotificationsController.java index 86de7ec87..1187edd57 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/NotificationsController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/NotificationsController.java @@ -1990,8 +1990,11 @@ public class NotificationsController extends BaseController { }; private String replaceSpoilers(MessageObject messageObject) { + if (messageObject == null || messageObject.messageOwner == null) { + return null; + } String text = messageObject.messageOwner.message; - if (text == null || messageObject == null || messageObject.messageOwner == null || messageObject.messageOwner.entities == null) { + if (text == null || messageObject.messageOwner.entities == null) { return null; } StringBuilder stringBuilder = new StringBuilder(text); @@ -3204,7 +3207,8 @@ public class NotificationsController extends BaseController { boolean secretChat = !isDefault && DialogObject.isEncryptedDialog(dialogId); boolean shouldOverwrite = !isInApp && overwriteKey != null && preferences.getBoolean(overwriteKey, false); - String soundHash = Utilities.MD5(sound == null ? "NoSound" : sound.toString()); + int nosoundPatch = 2; // when changing code here about no-sound issues, make sure to increment this value + String soundHash = Utilities.MD5(sound == null ? "NoSound" + nosoundPatch : sound.toString()); if (soundHash != null && soundHash.length() > 5) { soundHash = soundHash.substring(0, 5); } @@ -3422,7 +3426,8 @@ public class NotificationsController extends BaseController { if (sound != null) { notificationChannel.setSound(sound, builder.build()); } else { - // notificationChannel.setSound(null, null); + // todo: deal with vendor messed up crash here later + notificationChannel.setSound(null, builder.build()); } if (BuildVars.LOGS_ENABLED) { FileLog.d("create new channel " + channelId); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/SharedConfig.java b/TMessagesProj/src/main/java/org/telegram/messenger/SharedConfig.java index 53134d148..2987372e6 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/SharedConfig.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/SharedConfig.java @@ -1236,7 +1236,7 @@ public class SharedConfig { return info; } } - proxyList.add(proxyInfo); + proxyList.add(0, proxyInfo); saveProxyList(); return proxyInfo; } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPService.java b/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPService.java index 3206548a9..fa09db606 100755 --- a/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPService.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPService.java @@ -4097,8 +4097,13 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa Notification incomingNotification; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { Bitmap avatar = getRoundAvatarBitmap(userOrChat); + String presonName = ContactsController.formatName(userOrChat); + if (TextUtils.isEmpty(presonName)) { + //java.lang.IllegalArgumentException: person must have a non-empty a name + presonName = "___"; + } Person person = new Person.Builder() - .setName(ContactsController.formatName(userOrChat)) + .setName(presonName) .setIcon(Icon.createWithAdaptiveBitmap(avatar)).build(); Notification.CallStyle notificationStyle = Notification.CallStyle.forIncomingCall(person, endPendingIntent, answerPendingIntent); diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/ConnectionsManager.java b/TMessagesProj/src/main/java/org/telegram/tgnet/ConnectionsManager.java index 81a36b00a..517b1d598 100644 --- a/TMessagesProj/src/main/java/org/telegram/tgnet/ConnectionsManager.java +++ b/TMessagesProj/src/main/java/org/telegram/tgnet/ConnectionsManager.java @@ -9,6 +9,7 @@ import android.os.Build; import android.os.SystemClock; import android.text.TextUtils; import android.util.Base64; +import android.util.Log; import com.google.firebase.remoteconfig.FirebaseRemoteConfig; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarPopupWindow.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarPopupWindow.java index 9a8ccd2d3..77c75aeb3 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarPopupWindow.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarPopupWindow.java @@ -39,18 +39,15 @@ import androidx.annotation.Nullable; import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.AnimationNotificationsLocker; import org.telegram.messenger.FileLog; -import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; import org.telegram.messenger.UserConfig; import org.telegram.ui.Components.LayoutHelper; -import org.telegram.ui.Components.Paint.Views.LPhotoPaintView; import org.telegram.ui.Components.PopupSwipeBackLayout; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; -import java.util.Locale; public class ActionBarPopupWindow extends PopupWindow { 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 08c8ba310..63bb492f7 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java @@ -141,7 +141,6 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Locale; import java.util.Map; -import java.util.Set; import java.util.concurrent.CountDownLatch; public class Theme { @@ -3526,6 +3525,8 @@ public class Theme { public static final int key_chat_outBubbleSelected = colorsCount++; public static final int key_chat_outBubbleShadow = colorsCount++; public static final int key_chat_outBubbleGradient1 = colorsCount++; + public static final int key_chat_outBubbleGradient2 = colorsCount++; + public static final int key_chat_outBubbleGradient3 = colorsCount++; public static final int myMessagesBubblesEndIndex = colorsCount; //my messages @@ -3598,8 +3599,6 @@ public class Theme { public static final int key_chat_outBubbleLocationPlaceholder = colorsCount++; public static final int key_chat_outBubbleSelectedOverlay = colorsCount++; public static final int key_chat_outPsaNameText = colorsCount++; - public static final int key_chat_outBubbleGradient2 = colorsCount++; - public static final int key_chat_outBubbleGradient3 = colorsCount++; public static final int key_chat_outBubbleGradientAnimated = colorsCount++; public static final int key_chat_outBubbleGradientSelectedOverlay = colorsCount++; public static final int key_chat_inBubbleSelected = colorsCount++; @@ -9077,7 +9076,7 @@ public class Theme { setDrawableColorByKey(profile_verifiedCheckDrawable, key_profile_verifiedCheck); } - public static Drawable getThemedDrawable(Context context, int resId, int key, Theme.ResourcesProvider resourcesProvider) { + public static Drawable getThemedDrawableByKey(Context context, int resId, int key, Theme.ResourcesProvider resourcesProvider) { return getThemedDrawable(context, resId, getColor(key, resourcesProvider)); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsAdapter.java index 3d7dd115c..338dc7fdf 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsAdapter.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsAdapter.java @@ -402,7 +402,7 @@ public class ContactsAdapter extends RecyclerListView.SectionsAdapter { case 5: default: view = new ShadowSectionCell(mContext); - Drawable drawable = Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); + Drawable drawable = Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray)), drawable); combinedDrawable.setFullsize(true); view.setBackgroundDrawable(combinedDrawable); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DialogsAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DialogsAdapter.java index 909fb758d..ebfb7fa1d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DialogsAdapter.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DialogsAdapter.java @@ -583,7 +583,7 @@ public class DialogsAdapter extends RecyclerListView.SelectionAdapter implements }; frameLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray)); View v = new View(mContext); - v.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + v.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); frameLayout.addView(v, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); view = frameLayout; break; @@ -616,7 +616,7 @@ public class DialogsAdapter extends RecyclerListView.SelectionAdapter implements break; case VIEW_TYPE_SHADOW: { view = new ShadowSectionCell(mContext); - Drawable drawable = Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); + Drawable drawable = Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray)), drawable); combinedDrawable.setFullsize(true); view.setBackgroundDrawable(combinedDrawable); @@ -679,7 +679,7 @@ public class DialogsAdapter extends RecyclerListView.SelectionAdapter implements } } }; - Drawable drawable = Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); + Drawable drawable = Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray)), drawable); combinedDrawable.setFullsize(true); view.setBackgroundDrawable(combinedDrawable); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/LocationActivityAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/LocationActivityAdapter.java index 85f4527ec..f2adcc30f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/LocationActivityAdapter.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/LocationActivityAdapter.java @@ -12,14 +12,11 @@ import android.content.Context; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.location.Location; -import android.os.Build; import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; -import android.view.ViewPropertyAnimator; import android.widget.FrameLayout; -import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.LocaleController; import org.telegram.messenger.LocationController; import org.telegram.messenger.MessageObject; @@ -27,7 +24,6 @@ import org.telegram.messenger.R; import org.telegram.messenger.UserConfig; import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.Theme; -import org.telegram.ui.Cells.EmptyCell; import org.telegram.ui.Cells.HeaderCell; import org.telegram.ui.Cells.LocationCell; import org.telegram.ui.Cells.LocationDirectionCell; @@ -46,8 +42,6 @@ import java.util.Locale; import androidx.recyclerview.widget.RecyclerView; -import com.google.android.gms.vision.Frame; - public class LocationActivityAdapter extends BaseLocationAdapter implements LocationController.LocationFetchCallback { private int currentAccount = UserConfig.selectedAccount; @@ -326,7 +320,7 @@ public class LocationActivityAdapter extends BaseLocationAdapter implements Loca } case 9: { view = new ShadowSectionCell(mContext); - Drawable drawable = Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow); + Drawable drawable = Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow); CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(getThemedColor(Theme.key_windowBackgroundGray)), drawable); combinedDrawable.setFullsize(true); view.setBackgroundDrawable(combinedDrawable); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ArchivedStickersActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ArchivedStickersActivity.java index 5367e05f1..7bfa84f82 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ArchivedStickersActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ArchivedStickersActivity.java @@ -93,6 +93,8 @@ public class ArchivedStickersActivity extends BaseFragment implements Notificati actionBar.setAllowOverlayTitle(true); if (currentType == MediaDataController.TYPE_IMAGE) { actionBar.setTitle(LocaleController.getString("ArchivedStickers", R.string.ArchivedStickers)); + } else if (currentType == MediaDataController.TYPE_EMOJIPACKS) { + actionBar.setTitle(LocaleController.getString("ArchivedEmojiPacks", R.string.ArchivedEmojiPacks)); } else { actionBar.setTitle(LocaleController.getString("ArchivedMasks", R.string.ArchivedMasks)); } @@ -173,7 +175,7 @@ public class ArchivedStickersActivity extends BaseFragment implements Notificati private void updateRows() { rowCount = 0; if (!sets.isEmpty()) { - archiveInfoRow = currentType == MediaDataController.TYPE_IMAGE ? rowCount++ : -1; + archiveInfoRow = currentType == MediaDataController.TYPE_IMAGE || currentType == MediaDataController.TYPE_EMOJIPACKS ? rowCount++ : -1; stickersStartRow = rowCount; stickersEndRow = rowCount + sets.size(); rowCount += sets.size(); @@ -342,7 +344,7 @@ public class ArchivedStickersActivity extends BaseFragment implements Notificati if (position == archiveInfoRow) { cell.setTopPadding(17); cell.setBottomPadding(10); - cell.setText(LocaleController.getString("ArchivedStickersInfo", R.string.ArchivedStickersInfo)); + cell.setText(currentType == MediaDataController.TYPE_EMOJIPACKS ? LocaleController.getString("ArchivedEmojiInfo", R.string.ArchivedEmojiInfo) : LocaleController.getString("ArchivedStickersInfo", R.string.ArchivedStickersInfo)); } else { cell.setTopPadding(10); cell.setBottomPadding(17); @@ -366,11 +368,11 @@ public class ArchivedStickersActivity extends BaseFragment implements Notificati break; case 1: view = new LoadingCell(mContext); - view.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + view.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); break; case 2: view = new TextInfoPrivacyCell(mContext); - view.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + view.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); break; } view.setLayoutParams(new RecyclerView.LayoutParams(RecyclerView.LayoutParams.MATCH_PARENT, RecyclerView.LayoutParams.WRAP_CONTENT)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/CacheControlActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/CacheControlActivity.java index 88e25384d..09fb7c870 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/CacheControlActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/CacheControlActivity.java @@ -20,7 +20,6 @@ import android.graphics.Path; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.RectF; -import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Bundle; @@ -108,9 +107,6 @@ import org.telegram.ui.Components.UndoView; import org.telegram.ui.Storage.CacheModel; import java.io.File; -import java.nio.file.Files; -import java.nio.file.attribute.BasicFileAttributes; -import java.nio.file.attribute.FileTime; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -2562,7 +2558,7 @@ public class CacheControlActivity extends BaseFragment implements NotificationCe // privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); // } else { privacyCell.setText(AndroidUtilities.replaceTags(item.text)); - privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + privacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); // } break; case VIEW_TYPE_STORAGE: diff --git a/TMessagesProj/src/main/java/org/telegram/ui/CallLogActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/CallLogActivity.java index c71e7ae4f..46a3d945b 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/CallLogActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/CallLogActivity.java @@ -17,7 +17,6 @@ import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Bundle; import android.text.SpannableString; -import android.text.TextUtils; import android.text.style.ImageSpan; import android.util.TypedValue; import android.view.Gravity; @@ -991,7 +990,7 @@ public class CallLogActivity extends BaseFragment implements NotificationCenter. break; case 2: view = new TextInfoPrivacyCell(mContext); - view.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + view.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); break; case 3: view = new HeaderCell(mContext, Theme.key_windowBackgroundWhiteBlueHeader, 21, 15, 2, false, getResourceProvider()); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ArchivedStickerSetCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ArchivedStickerSetCell.java index 044d6e3d1..cba1a3a47 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ArchivedStickerSetCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ArchivedStickerSetCell.java @@ -42,6 +42,8 @@ import org.telegram.ui.Components.LayoutHelper; import org.telegram.ui.Components.ProgressButton; import org.telegram.ui.Components.ViewHelper; +import java.util.ArrayList; + @SuppressLint("ViewConstructor") public class ArchivedStickerSetCell extends FrameLayout implements Checkable { @@ -154,15 +156,33 @@ public class ArchivedStickerSetCell extends FrameLayout implements Checkable { setWillNotDraw(!needDivider); textView.setText(stickersSet.set.title); - valueTextView.setText(LocaleController.formatPluralString("Stickers", set.set.count)); + if (set.set.emojis) { + valueTextView.setText(LocaleController.formatPluralString("EmojiCount", set.set.count)); + } else { + valueTextView.setText(LocaleController.formatPluralString("Stickers", set.set.count)); + } - TLRPC.Document sticker; - if (set.cover != null) { + TLRPC.Document sticker = null; + if (set instanceof TLRPC.TL_stickerSetFullCovered) { + ArrayList documents = ((TLRPC.TL_stickerSetFullCovered) set).documents; + if (documents == null) { + return; + } + long thumb_document_id = set.set.thumb_document_id; + for (int i = 0; i < documents.size(); ++i) { + TLRPC.Document d = documents.get(i); + if (d != null && d.id == thumb_document_id) { + sticker = d; + break; + } + } + if (sticker == null && !documents.isEmpty()) { + sticker = documents.get(0); + } + } else if (set.cover != null) { sticker = set.cover; } else if (!set.covers.isEmpty()) { sticker = set.covers.get(0); - } else { - sticker = null; } if (sticker != null) { TLObject object = FileLoader.getClosestPhotoSizeWithSize(set.set.thumbs, 90); 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 e8b2bd395..7d1fba883 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java @@ -816,6 +816,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate private StaticLayout infoLayout; private StaticLayout loadingProgressLayout; + private long loadingProgressLayoutHash; private int infoX; private int infoWidth; @@ -12072,6 +12073,11 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate loadingProgressLayout = null; return; } + long hash = loadedSize << 16 + totalSize; + if (loadingProgressLayout != null && loadingProgressLayoutHash == hash) { + return; + } + loadingProgressLayoutHash = hash; if (lastLoadingSizeTotal == 0) { lastLoadingSizeTotal = totalSize; @@ -12122,18 +12128,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate w = (int) Math.ceil(Theme.chat_infoPaint.measureText(str)); } loadingProgressLayout = new StaticLayout(str, Theme.chat_infoPaint, w, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); -// if (loadingProgressLayout != null) { -// loadingProgressLayout.copyStylesFrom(Theme.chat_infoPaint); -// loadingProgressLayout.setBounds(0, 0, w, (int) Theme.chat_infoPaint.getTextSize()); -// loadingProgressLayout.setText(str, true); -// } else { -// loadingProgressLayout = new AnimatedTextView.AnimatedTextDrawable(false, true, true); -// loadingProgressLayout.setAnimationProperties(0.3f, 0, 140, CubicBezierInterpolator.EASE_OUT); -// loadingProgressLayout.setCallback(this); -// loadingProgressLayout.copyStylesFrom(Theme.chat_infoPaint); -// loadingProgressLayout.setBounds(0, 0, w, (int) Theme.chat_infoPaint.getTextSize()); -// loadingProgressLayout.setText(str, false); -// } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java index 4d036eff9..80be210f4 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java @@ -1437,6 +1437,9 @@ public class DialogCell extends BaseCell { } else { SpannableStringBuilder msgBuilder = new SpannableStringBuilder(message.caption); if (message != null && message.messageOwner != null) { + if (message != null) { + message.spoilLoginCode(); + } MediaDataController.addTextStyleRuns(message.messageOwner.entities, message.caption, msgBuilder, TextStyleSpan.FLAG_STYLE_SPOILER | TextStyleSpan.FLAG_STYLE_STRIKE); MediaDataController.addAnimatedEmojiSpans(message.messageOwner.entities, msgBuilder, currentMessagePaint == null ? null : currentMessagePaint.getFontMetricsInt()); } @@ -1469,6 +1472,9 @@ public class DialogCell extends BaseCell { messageString = AndroidUtilities.ellipsizeCenterEnd(messageString, message.highlightedWords.get(0), w, currentMessagePaint, 130).toString(); } else { SpannableStringBuilder stringBuilder = new SpannableStringBuilder(msgText); + if (message != null) { + message.spoilLoginCode(); + } MediaDataController.addTextStyleRuns(message, stringBuilder, TextStyleSpan.FLAG_STYLE_SPOILER | TextStyleSpan.FLAG_STYLE_STRIKE); if (message != null && message.messageOwner != null) { MediaDataController.addAnimatedEmojiSpans(message.messageOwner.entities, stringBuilder, currentMessagePaint == null ? null : currentMessagePaint.getFontMetricsInt()); @@ -4679,6 +4685,9 @@ public class DialogCell extends BaseCell { mess = mess.subSequence(0, 150); } SpannableStringBuilder msgBuilder = new SpannableStringBuilder(mess); + if (message != null) { + message.spoilLoginCode(); + } MediaDataController.addTextStyleRuns(message.messageOwner.entities, mess, msgBuilder, TextStyleSpan.FLAG_STYLE_SPOILER | TextStyleSpan.FLAG_STYLE_STRIKE); if (message != null && message.messageOwner != null) { MediaDataController.addAnimatedEmojiSpans(message.messageOwner.entities, msgBuilder, currentMessagePaint == null ? null : currentMessagePaint.getFontMetricsInt()); @@ -4761,6 +4770,9 @@ public class DialogCell extends BaseCell { mess = AndroidUtilities.replaceNewLines(mess); } mess = new SpannableStringBuilder(mess); + if (message != null) { + message.spoilLoginCode(); + } MediaDataController.addTextStyleRuns(message, (Spannable) mess, TextStyleSpan.FLAG_STYLE_SPOILER | TextStyleSpan.FLAG_STYLE_STRIKE); if (message != null && message.messageOwner != null) { MediaDataController.addAnimatedEmojiSpans(message.messageOwner.entities, mess, currentMessagePaint == null ? null : currentMessagePaint.getFontMetricsInt()); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/RequestPeerRequirementsCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/RequestPeerRequirementsCell.java index 04cf51d80..fa99fb01e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/RequestPeerRequirementsCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/RequestPeerRequirementsCell.java @@ -89,7 +89,7 @@ public class RequestPeerRequirementsCell extends LinearLayout { } addView(emptyView(12, Theme.getColor(Theme.key_windowBackgroundWhite)), LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); - addView(emptyView(12, Theme.getThemedDrawable(getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)), LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + addView(emptyView(12, Theme.getThemedDrawableByKey(getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)), LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); } } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ThemePreviewMessagesCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ThemePreviewMessagesCell.java index a226d9540..b514d4109 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ThemePreviewMessagesCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ThemePreviewMessagesCell.java @@ -63,7 +63,7 @@ public class ThemePreviewMessagesCell extends LinearLayout { setOrientation(LinearLayout.VERTICAL); setPadding(0, AndroidUtilities.dp(11), 0, AndroidUtilities.dp(11)); - shadowDrawable = Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow); + shadowDrawable = Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow); int date = (int) (System.currentTimeMillis() / 1000) - 60 * 60; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChangeUsernameActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChangeUsernameActivity.java index aba0cff13..71933d9ae 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChangeUsernameActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChangeUsernameActivity.java @@ -517,7 +517,7 @@ public class ChangeUsernameActivity extends BaseFragment { break; case VIEW_TYPE_HELP2: ((TextInfoPrivacyCell) holder.itemView).setText(LocaleController.getString(botId != 0 ? R.string.BotUsernamesHelp : R.string.UsernamesProfileHelp)); - ((TextInfoPrivacyCell) holder.itemView).setBackgroundDrawable(Theme.getThemedDrawable(getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + ((TextInfoPrivacyCell) holder.itemView).setBackgroundDrawable(Theme.getThemedDrawableByKey(getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); break; } } @@ -650,7 +650,7 @@ public class ChangeUsernameActivity extends BaseFragment { helpCell = this; setPadding(AndroidUtilities.dp(18), AndroidUtilities.dp(10), AndroidUtilities.dp(18), AndroidUtilities.dp(17)); - setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); setClipChildren(false); text1View = new LinkSpanDrawable.LinksTextView(context); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChannelCreateActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChannelCreateActivity.java index ca17e4a59..1ad1a8867 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChannelCreateActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChannelCreateActivity.java @@ -899,7 +899,7 @@ public class ChannelCreateActivity extends BaseFragment implements NotificationC linkContainer.addView(checkTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, 18, 3, 18, 7)); typeInfoCell = new TextInfoPrivacyCell(context); - typeInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + typeInfoCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); linearLayout.addView(typeInfoCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); loadingAdminedCell = new LoadingCell(context); @@ -911,7 +911,7 @@ public class ChannelCreateActivity extends BaseFragment implements NotificationC linearLayout.addView(adminnedChannelsLayout, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); adminedInfoCell = new TextInfoPrivacyCell(context); - adminedInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + adminedInfoCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); linearLayout.addView(adminedInfoCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); updatePrivatePublic(); @@ -960,10 +960,10 @@ public class ChannelCreateActivity extends BaseFragment implements NotificationC if (loadingAdminedChannels) { loadingAdminedCell.setVisibility(View.VISIBLE); adminnedChannelsLayout.setVisibility(View.GONE); - typeInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(typeInfoCell.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + typeInfoCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(typeInfoCell.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); adminedInfoCell.setVisibility(View.GONE); } else { - typeInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(typeInfoCell.getContext(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + typeInfoCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(typeInfoCell.getContext(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); loadingAdminedCell.setVisibility(View.GONE); adminnedChannelsLayout.setVisibility(View.VISIBLE); adminedInfoCell.setVisibility(View.VISIBLE); @@ -974,7 +974,7 @@ public class ChannelCreateActivity extends BaseFragment implements NotificationC sectionCell.setVisibility(View.VISIBLE); adminedInfoCell.setVisibility(View.GONE); adminnedChannelsLayout.setVisibility(View.GONE); - typeInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(typeInfoCell.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + typeInfoCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(typeInfoCell.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); linkContainer.setVisibility(View.VISIBLE); loadingAdminedCell.setVisibility(View.GONE); if (isGroup) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index 0978b3727..a995b29e6 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -15931,7 +15931,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (!postponedScroll) { chatAdapter.notifyDataSetChanged(true); } - if (isTopic && startLoadFromMessageId == getTopicId() && messArr.size() > 0 && messages.size() > 0) { + if (isTopic && startLoadFromMessageId == getTopicId() && messArr.size() > 0 && messages.size() > 0 && messArr.size() - 1 < messages.size()) { scrollToMessage = messages.get(messArr.size() - 1); } if (scrollToMessage != null) { @@ -17252,18 +17252,18 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not isVotedChanged = true; } } + createUndoView(); if (isVotedChanged && isQuiz && undoView != null && pollView instanceof ChatMessageCell) { ChatMessageCell cell = (ChatMessageCell) pollView; if (cell.isAnimatingPollAnswer()) { for (int a = 0, N = results.results.size(); a < N; a++) { TLRPC.TL_pollAnswerVoters voters = results.results.get(a); if (voters.chosen) { + pollView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); if (voters.correct) { fireworksOverlay.start(); - pollView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } else { ((ChatMessageCell) pollView).shakeView(); - pollView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); showPollSolution(cell.getMessageObject(), results); cell.showHintButton(false, true, 0); } @@ -31084,7 +31084,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not return animatingColors.valueAt(index); } } - if (chatTheme == null && backgroundDrawable == null) { + if (chatTheme == null) { return Theme.getColor(key); } int index = currentColors.indexOfKey(key); @@ -31092,18 +31092,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not return currentColors.valueAt(index); } - if (Theme.key_chat_outBubbleGradient1 == key || Theme.key_chat_outBubbleGradient2 == key || Theme.key_chat_outBubbleGradient3 == key) { - index = currentColors.indexOfKey(Theme.key_chat_outBubble); - if (index < 0) { - int color = Theme.getColor(key); - if (color != 0) { - return color; - } - } else { - return currentColors.valueAt(index); - } - } - int fallbackKey = Theme.getFallbackKey(key); if (fallbackKey >= 0) { index = currentColors.indexOfKey(fallbackKey); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatEditActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatEditActivity.java index 1a3e0a001..9616bf9e4 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatEditActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatEditActivity.java @@ -1162,7 +1162,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image } }, index, index + 10, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } - botInfoCell.setBackground(Theme.getThemedDrawable(getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + botInfoCell.setBackground(Theme.getThemedDrawableByKey(getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); botInfoCell.setText(span); linearLayout1.addView(botInfoCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); } @@ -1194,15 +1194,15 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image }, null)); deleteInfoCell = new ShadowSectionCell(context); - deleteInfoCell.setBackground(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + deleteInfoCell.setBackground(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); linearLayout1.addView(deleteInfoCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); } if (stickersInfoCell != null) { if (deleteInfoCell == null) { - stickersInfoCell.setBackground(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + stickersInfoCell.setBackground(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else { - stickersInfoCell.setBackground(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + stickersInfoCell.setBackground(Theme.getThemedDrawableByKey(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatEditTypeActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatEditTypeActivity.java index 59db92731..abe8550db 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatEditTypeActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatEditTypeActivity.java @@ -547,7 +547,7 @@ public class ChatEditTypeActivity extends BaseFragment implements NotificationCe prevHeight = getHeight(); } }; - checkTextView.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + checkTextView.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); checkTextView.setBottomPadding(6); linearLayout.addView(checkTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT)); @@ -1061,7 +1061,7 @@ public class ChatEditTypeActivity extends BaseFragment implements NotificationCe break; case VIEW_TYPE_HELP: ((TextInfoPrivacyCell) holder.itemView).setText(LocaleController.getString("UsernamesChannelHelp", R.string.UsernamesChannelHelp)); - ((TextInfoPrivacyCell) holder.itemView).setBackgroundDrawable(Theme.getThemedDrawable(getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + ((TextInfoPrivacyCell) holder.itemView).setBackgroundDrawable(Theme.getThemedDrawableByKey(getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); break; } } @@ -1305,11 +1305,11 @@ public class ChatEditTypeActivity extends BaseFragment implements NotificationCe if (loadingAdminedChannels) { loadingAdminedCell.setVisibility(View.VISIBLE); adminnedChannelsLayout.setVisibility(View.GONE); - typeInfoCell.setBackgroundDrawable(checkTextView.getVisibility() == View.VISIBLE ? null : Theme.getThemedDrawable(typeInfoCell.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + typeInfoCell.setBackgroundDrawable(checkTextView.getVisibility() == View.VISIBLE ? null : Theme.getThemedDrawableByKey(typeInfoCell.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); adminedInfoCell.setBackgroundDrawable(null); } else { - adminedInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(adminedInfoCell.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); - typeInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(typeInfoCell.getContext(), R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow)); + adminedInfoCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(adminedInfoCell.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + typeInfoCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(typeInfoCell.getContext(), R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow)); loadingAdminedCell.setVisibility(View.GONE); adminnedChannelsLayout.setVisibility(View.VISIBLE); } @@ -1322,7 +1322,7 @@ public class ChatEditTypeActivity extends BaseFragment implements NotificationCe sectionCell2.setVisibility(View.VISIBLE); } adminedInfoCell.setVisibility(View.GONE); - typeInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(typeInfoCell.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + typeInfoCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(typeInfoCell.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); adminnedChannelsLayout.setVisibility(View.GONE); linkContainer.setVisibility(View.VISIBLE); loadingAdminedCell.setVisibility(View.GONE); @@ -1344,10 +1344,10 @@ public class ChatEditTypeActivity extends BaseFragment implements NotificationCe checkTextView.setVisibility(!isPrivate && checkTextView.length() != 0 ? View.VISIBLE : View.GONE); manageLinksInfoCell.setText(LocaleController.getString("ManageLinksInfoHelp", R.string.ManageLinksInfoHelp)); if (isPrivate) { - typeInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(typeInfoCell.getContext(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); - manageLinksInfoCell.setBackground(Theme.getThemedDrawable(typeInfoCell.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + typeInfoCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(typeInfoCell.getContext(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + manageLinksInfoCell.setBackground(Theme.getThemedDrawableByKey(typeInfoCell.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else { - typeInfoCell.setBackgroundDrawable(checkTextView.getVisibility() == View.VISIBLE ? null : Theme.getThemedDrawable(typeInfoCell.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + typeInfoCell.setBackgroundDrawable(checkTextView.getVisibility() == View.VISIBLE ? null : Theme.getThemedDrawableByKey(typeInfoCell.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } } radioButtonCell1.setChecked(!isPrivate, true); @@ -1392,7 +1392,7 @@ public class ChatEditTypeActivity extends BaseFragment implements NotificationCe } else { checkTextView.setVisibility(View.GONE); } - typeInfoCell.setBackgroundDrawable(checkTextView.getVisibility() == View.VISIBLE ? null : Theme.getThemedDrawable(typeInfoCell.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + typeInfoCell.setBackgroundDrawable(checkTextView.getVisibility() == View.VISIBLE ? null : Theme.getThemedDrawableByKey(typeInfoCell.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); if (checkRunnable != null) { AndroidUtilities.cancelRunOnUIThread(checkRunnable); checkRunnable = null; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatLinkActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatLinkActivity.java index a0dd2718d..fd3799d3f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatLinkActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatLinkActivity.java @@ -871,7 +871,7 @@ public class ChatLinkActivity extends BaseFragment implements NotificationCenter break; case 1: view = new TextInfoPrivacyCell(mContext); - view.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + view.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); break; case 2: view = new ManageChatTextCell(mContext); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatRightsEditActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatRightsEditActivity.java index eb333b3ca..070a2006a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatRightsEditActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatRightsEditActivity.java @@ -1519,7 +1519,7 @@ public class ChatRightsEditActivity extends BaseFragment { break; case VIEW_TYPE_INFO_CELL: view = new TextInfoPrivacyCell(mContext); - view.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + view.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); break; case VIEW_TYPE_TRANSFER_CELL: default: @@ -1833,13 +1833,13 @@ public class ChatRightsEditActivity extends BaseFragment { shadowCell.setAlpha(1); } if (position == rightsShadowRow) { - shadowCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, removeAdminRow == -1 && rankRow == -1 ? R.drawable.greydivider_bottom : R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + shadowCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, removeAdminRow == -1 && rankRow == -1 ? R.drawable.greydivider_bottom : R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } else if (position == removeAdminShadowRow) { - shadowCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + shadowCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (position == rankInfoRow) { - shadowCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, canEdit ? R.drawable.greydivider : R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + shadowCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, canEdit ? R.drawable.greydivider : R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else { - shadowCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + shadowCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } break; case VIEW_TYPE_UNTIL_DATE_CELL: diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java index e406d6413..4293ce0ba 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java @@ -3002,7 +3002,7 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente } else { privacyCell.setText(LocaleController.getString(R.string.NoBlockedGroup2)); } - privacyCell.setBackground(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + privacyCell.setBackground(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); break; case 5: HeaderCell headerCell = new HeaderCell(mContext, Theme.key_windowBackgroundWhiteBlueHeader, 21, 11, false); @@ -3176,7 +3176,7 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente TextInfoPrivacyCell privacyCell = (TextInfoPrivacyCell) holder.itemView; if (position == antiSpamInfoRow) { privacyCell.setText(LocaleController.getString("ChannelAntiSpamInfo", R.string.ChannelAntiSpamInfo)); - privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + privacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } else if (position == participantsInfoRow) { if (type == TYPE_BANNED || type == TYPE_KICKED) { if (isChannel) { @@ -3184,7 +3184,7 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente } else { privacyCell.setText(LocaleController.getString("NoBlockedGroup2", R.string.NoBlockedGroup2)); } - privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + privacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (type == TYPE_ADMIN) { if (addNewRow != -1) { if (isChannel) { @@ -3195,17 +3195,17 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente } else { privacyCell.setText(""); } - privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + privacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (type == TYPE_USERS) { if (!isChannel || selectType != SELECT_TYPE_MEMBERS) { privacyCell.setText(""); } else { privacyCell.setText(LocaleController.getString("ChannelMembersInfo", R.string.ChannelMembersInfo)); } - privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + privacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } } else if (position == slowmodeInfoRow) { - privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + privacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); int seconds = getSecondsForIndex(selectedSlowmode); if (info == null || seconds == 0) { privacyCell.setText(LocaleController.getString("SlowmodeInfoOff", R.string.SlowmodeInfoOff)); @@ -3213,7 +3213,7 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente privacyCell.setText(LocaleController.formatString("SlowmodeInfoSelected", R.string.SlowmodeInfoSelected, formatSeconds(seconds))); } } else if (position == hideMembersInfoRow) { - privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + privacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); privacyCell.setText(LocaleController.getString("ChannelHideMembersInfo", R.string.ChannelHideMembersInfo)); } else if (position == gigaInfoRow) { privacyCell.setText(LocaleController.getString("BroadcastGroupConvertInfo", R.string.BroadcastGroupConvertInfo)); @@ -3254,9 +3254,9 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente break; case 3: if (position == addNewSectionRow || type == TYPE_KICKED && position == participantsDividerRow && addNewRow == -1 && participantsStartRow == -1) { - holder.itemView.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + holder.itemView.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else { - holder.itemView.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + holder.itemView.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } break; case 5: diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/AutoDeletePopupWrapper.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/AutoDeletePopupWrapper.java index 127647215..a5d2028c0 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/AutoDeletePopupWrapper.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/AutoDeletePopupWrapper.java @@ -79,7 +79,7 @@ public class AutoDeletePopupWrapper { FrameLayout gap = new FrameLayout(context); gap.setBackgroundColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuSeparator, resourcesProvider)); View gapShadow = new View(context); - gapShadow.setBackground(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow, resourcesProvider)); + gapShadow.setBackground(Theme.getThemedDrawableByKey(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow, resourcesProvider)); gap.addView(gapShadow, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); gap.setTag(R.id.fit_width_tag, 1); windowLayout.addView(gap, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 8)); 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 6266714ac..bb6817810 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertDocumentLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertDocumentLayout.java @@ -1436,7 +1436,7 @@ public class ChatAttachAlertDocumentLayout extends ChatAttachAlert.AttachAlertLa break; case 2: view = new ShadowSectionCell(mContext); - Drawable drawable = Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); + Drawable drawable = Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(getThemedColor(Theme.key_windowBackgroundGray)), drawable); combinedDrawable.setFullsize(true); view.setBackgroundDrawable(combinedDrawable); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPollLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPollLayout.java index 55d9b057a..04c5a9903 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPollLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPollLayout.java @@ -771,7 +771,7 @@ public class ChatAttachAlertPollLayout extends ChatAttachAlert.AttachAlertLayout } case 2: { TextInfoPrivacyCell cell = (TextInfoPrivacyCell) holder.itemView; - Drawable drawable = Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow); + Drawable drawable = Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow); CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(getThemedColor(Theme.key_windowBackgroundGray)), drawable); combinedDrawable.setFullsize(true); cell.setBackgroundDrawable(combinedDrawable); @@ -880,7 +880,7 @@ public class ChatAttachAlertPollLayout extends ChatAttachAlert.AttachAlertLayout break; case 1: view = new ShadowSectionCell(mContext); - Drawable drawable = Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); + Drawable drawable = Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(getThemedColor(Theme.key_windowBackgroundGray)), drawable); combinedDrawable.setFullsize(true); view.setBackgroundDrawable(combinedDrawable); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ClearHistoryAlert.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ClearHistoryAlert.java index def47ef5e..55a669212 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ClearHistoryAlert.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ClearHistoryAlert.java @@ -296,7 +296,7 @@ public class ClearHistoryAlert extends BottomSheet { linearLayout.addView(clearButton, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 50, Gravity.LEFT | Gravity.TOP, 0, 0, 0, 0)); ShadowSectionCell shadowSectionCell = new ShadowSectionCell(context); - Drawable drawable = Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); + Drawable drawable = Theme.getThemedDrawableByKey(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(getThemedColor(Theme.key_windowBackgroundGray)), drawable); combinedDrawable.setFullsize(true); shadowSectionCell.setBackgroundDrawable(combinedDrawable); @@ -359,7 +359,7 @@ public class ClearHistoryAlert extends BottomSheet { linearLayout.addView(slideChooseView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 8, 0, 0)); FrameLayout buttonContainer = new FrameLayout(context); - Drawable drawable = Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow); + Drawable drawable = Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow); CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(getThemedColor(Theme.key_windowBackgroundGray)), drawable); combinedDrawable.setFullsize(true); buttonContainer.setBackgroundDrawable(combinedDrawable); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/FolderBottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/FolderBottomSheet.java index d6008e819..d91d72051 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/FolderBottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/FolderBottomSheet.java @@ -15,7 +15,6 @@ import android.graphics.Path; import android.graphics.PorterDuff; import android.graphics.PorterDuffXfermode; import android.graphics.Shader; -import android.graphics.Xfermode; import android.graphics.drawable.Drawable; import android.graphics.drawable.ShapeDrawable; import android.text.Layout; @@ -32,12 +31,9 @@ import android.widget.FrameLayout; import android.widget.TextView; import androidx.annotation.NonNull; -import androidx.core.graphics.ColorUtils; import androidx.core.view.ViewCompat; import androidx.recyclerview.widget.RecyclerView; -import com.google.android.gms.vision.Frame; - import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.BotWebViewVibrationEffect; import org.telegram.messenger.ChatObject; @@ -46,7 +42,6 @@ import org.telegram.messenger.LocaleController; import org.telegram.messenger.MessagesController; import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; -import org.telegram.messenger.UserConfig; import org.telegram.messenger.UserObject; import org.telegram.messenger.Utilities; import org.telegram.tgnet.TLObject; @@ -58,15 +53,12 @@ import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Cells.GroupCreateUserCell; import org.telegram.ui.Cells.TextInfoPrivacyCell; import org.telegram.ui.ChatActivity; -import org.telegram.ui.Components.Premium.LimitReachedBottomSheet; import org.telegram.ui.DialogsActivity; -import org.telegram.ui.FilterChatlistActivity; import org.telegram.ui.FilterCreateActivity; import org.telegram.ui.FiltersSetupActivity; import java.util.ArrayList; import java.util.List; -import java.util.Locale; public class FolderBottomSheet extends BottomSheetWithRecyclerListView { @@ -1020,7 +1012,7 @@ public class FolderBottomSheet extends BottomSheetWithRecyclerListView { } } else if (viewType == VIEW_TYPE_HINT) { TextInfoPrivacyCell hintCell = (TextInfoPrivacyCell) holder.itemView; - hintCell.setForeground(Theme.getThemedDrawable(getContext(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + hintCell.setForeground(Theme.getThemedDrawableByKey(getContext(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); if (position == alreadySectionRow || position == sectionRow || peers == null || peers.isEmpty()) { hintCell.setFixedSize(12); hintCell.setText(""); 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 884a47696..7a15ef54f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/InstantCameraView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/InstantCameraView.java @@ -2037,9 +2037,15 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter long startWriteTime = input.offset[input.lastWroteBuffer]; for (int a = input.lastWroteBuffer; a <= input.results; a++) { if (a < input.results) { - if (!running && input.offset[a] >= videoLast - desyncTime) { + long totalTime = input.offset[a] - audioStartTime; + if (!running && (input.offset[a] >= videoLast - desyncTime || totalTime >= 60_000000)) { if (BuildVars.LOGS_ENABLED) { - FileLog.d("stop audio encoding because of stoped video recording at " + input.offset[a] + " last video " + videoLast); + if (totalTime >= 60_000000) { + FileLog.d("stop audio encoding because recorded time more than 60s"); + } else { + FileLog.d("stop audio encoding because of stoped video recording at " + input.offset[a] + " last video " + videoLast); + } + } audioStopedByTime = true; isLast = true; @@ -2084,7 +2090,9 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter } long dt, alphaDt; if (!lastCameraId.equals(cameraId)) { - // lastTimestamp = -1; + if (timestampNanos - lastTimestamp > 10_000) { + lastTimestamp = -1; + } lastCameraId = cameraId; } if (lastTimestamp == -1) { @@ -2741,7 +2749,7 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter } private String createFragmentShader(Size previewSize) { - if (!allowBigSizeCamera() || Math.max(previewSize.getHeight(), previewSize.getWidth()) * 0.7f < MessagesController.getInstance(currentAccount).roundVideoSize) { + if (!SharedConfig.deviceIsHigh() || !allowBigSizeCamera() || Math.max(previewSize.getHeight(), previewSize.getWidth()) * 0.7f < MessagesController.getInstance(currentAccount).roundVideoSize) { return "#extension GL_OES_EGL_image_external : require\n" + "precision highp float;\n" + "varying vec2 vTextureCoord;\n" + diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/InviteLinkBottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/InviteLinkBottomSheet.java index dcd5edf88..5c6f4a9f0 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/InviteLinkBottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/InviteLinkBottomSheet.java @@ -6,7 +6,6 @@ import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.content.Context; import android.graphics.Canvas; -import android.graphics.Color; import android.graphics.RectF; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; @@ -48,7 +47,6 @@ import org.telegram.ui.ManageLinksActivity; import org.telegram.ui.ProfileActivity; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Locale; @@ -399,7 +397,7 @@ public class InviteLinkBottomSheet extends BottomSheet { } else if (view instanceof LinkActionView) { ((LinkActionView) view).updateColors(); } else if (view instanceof TextInfoPrivacyCell) { - CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray)), Theme.getThemedDrawable(view.getContext(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray)), Theme.getThemedDrawableByKey(view.getContext(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); combinedDrawable.setFullsize(true); view.setBackground(combinedDrawable); ((TextInfoPrivacyCell) view).setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText4)); @@ -409,13 +407,13 @@ public class InviteLinkBottomSheet extends BottomSheet { RecyclerView.ViewHolder holder = listView.getChildViewHolder(view); if (holder != null) { if (holder.getItemViewType() == 7) { - Drawable shadowDrawable = Theme.getThemedDrawable(view.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow); + Drawable shadowDrawable = Theme.getThemedDrawableByKey(view.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow); Drawable background = new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray)); CombinedDrawable combinedDrawable = new CombinedDrawable(background, shadowDrawable, 0, 0); combinedDrawable.setFullsize(true); view.setBackgroundDrawable(combinedDrawable); } else if (holder.getItemViewType() == 2) { - Drawable shadowDrawable = Theme.getThemedDrawable(view.getContext(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); + Drawable shadowDrawable = Theme.getThemedDrawableByKey(view.getContext(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); Drawable background = new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray)); CombinedDrawable combinedDrawable = new CombinedDrawable(background, shadowDrawable, 0, 0); combinedDrawable.setFullsize(true); @@ -653,7 +651,7 @@ public class InviteLinkBottomSheet extends BottomSheet { break; case 4: view = new TimerPrivacyCell(context); - CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray)), Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray)), Theme.getThemedDrawableByKey(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); combinedDrawable.setFullsize(true); view.setBackground(combinedDrawable); break; @@ -675,7 +673,7 @@ public class InviteLinkBottomSheet extends BottomSheet { break; case 7: view = new ShadowSectionCell(context, 12); - Drawable shadowDrawable = Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow); + Drawable shadowDrawable = Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow); Drawable background = new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray)); combinedDrawable = new CombinedDrawable(background, shadowDrawable, 0, 0); combinedDrawable.setFullsize(true); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/LPhotoPaintView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/LPhotoPaintView.java index b5922691d..f618be4b1 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/LPhotoPaintView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/LPhotoPaintView.java @@ -1733,7 +1733,7 @@ public class LPhotoPaintView extends SizeNotifierFrameLayoutPhoto implements IPh currentCanvas.scale(v.getScaleX(), v.getScaleY()); currentCanvas.rotate(v.getRotation()); currentCanvas.translate(-entity.getWidth() / 2f, -entity.getHeight() / 2f); - if (v instanceof TextPaintView) { + if (v instanceof TextPaintView && v.getHeight() > 0 && v.getWidth() > 0) { Bitmap b = Bitmaps.createBitmap(v.getWidth(), v.getHeight(), Bitmap.Config.ARGB_8888); Canvas c = new Canvas(b); v.draw(c); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoViewerCaptionEnterView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoViewerCaptionEnterView.java index 283af5201..1f00f46d6 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoViewerCaptionEnterView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoViewerCaptionEnterView.java @@ -620,6 +620,8 @@ public class PhotoViewerCaptionEnterView extends FrameLayout implements Notifica return -16777216; } else if (key == Theme.key_dialogFloatingButton) { return -10177041; + } else if (key == Theme.key_dialogFloatingIcon) { + return 0xffffffff; } return 0; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/StickerSetBulletinLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/StickerSetBulletinLayout.java index e911a5c4c..4e7d346a4 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/StickerSetBulletinLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/StickerSetBulletinLayout.java @@ -171,6 +171,9 @@ public class StickerSetBulletinLayout extends Bulletin.TwoLineLayout { if (stickerSet.masks) { titleTextView.setText(LocaleController.getString("MasksArchived", R.string.MasksArchived)); subtitleTextView.setText(LocaleController.formatString("MasksArchivedInfo", R.string.MasksArchivedInfo, stickerSet.title)); + } else if (stickerSet.emojis) { + titleTextView.setText(LocaleController.getString("EmojiArchived", R.string.EmojiArchived)); + subtitleTextView.setText(LocaleController.formatString("EmojiArchivedInfo", R.string.EmojiArchivedInfo, stickerSet.title)); } else { titleTextView.setText(LocaleController.getString("StickersArchived", R.string.StickersArchived)); subtitleTextView.setText(LocaleController.formatString("StickersArchivedInfo", R.string.StickersArchivedInfo, stickerSet.title)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/DataAutoDownloadActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/DataAutoDownloadActivity.java index 4a6160713..ec84feeea 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/DataAutoDownloadActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/DataAutoDownloadActivity.java @@ -407,7 +407,7 @@ public class DataAutoDownloadActivity extends BaseFragment { linearLayout.addView(checkCell[0], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48)); checkCell[0].setOnClickListener(v -> checkCell[0].setChecked(!checkCell[0].isChecked())); - Drawable drawable = Theme.getThemedDrawable(getParentActivity(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); + Drawable drawable = Theme.getThemedDrawableByKey(getParentActivity(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray)), drawable); combinedDrawable.setFullsize(true); infoCell.setBackgroundDrawable(combinedDrawable); @@ -749,12 +749,12 @@ public class DataAutoDownloadActivity extends BaseFragment { TextInfoPrivacyCell view = (TextInfoPrivacyCell) holder.itemView; if (position == typeSectionRow) { view.setText(LocaleController.getString("AutoDownloadAudioInfo", R.string.AutoDownloadAudioInfo)); - view.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + view.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); view.setFixedSize(0); view.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES); } else if (position == autoDownloadSectionRow) { if (usageHeaderRow == -1) { - view.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + view.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); if (currentType == 0) { view.setText(LocaleController.getString("AutoDownloadOnMobileDataInfo", R.string.AutoDownloadOnMobileDataInfo)); } else if (currentType == 1) { @@ -764,7 +764,7 @@ public class DataAutoDownloadActivity extends BaseFragment { } view.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES); } else { - view.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + view.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); view.setText(null); view.setFixedSize(12); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { @@ -850,7 +850,7 @@ public class DataAutoDownloadActivity extends BaseFragment { case 5: default: { view = new TextInfoPrivacyCell(mContext); - view.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + view.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } } view.setLayoutParams(new RecyclerView.LayoutParams(RecyclerView.LayoutParams.MATCH_PARENT, RecyclerView.LayoutParams.WRAP_CONTENT)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/DataSettingsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/DataSettingsActivity.java index b27d34431..b4ffed892 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/DataSettingsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/DataSettingsActivity.java @@ -644,9 +644,9 @@ public class DataSettingsActivity extends BaseFragment { switch (holder.getItemViewType()) { case 0: { if (position == clearDraftsSectionRow) { - holder.itemView.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + holder.itemView.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else { - holder.itemView.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + holder.itemView.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } break; } @@ -914,7 +914,7 @@ public class DataSettingsActivity extends BaseFragment { break; case 4: view = new TextInfoPrivacyCell(mContext); - view.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + view.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); break; case 5: view = new NotificationsCheckCell(mContext); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/DataUsage2Activity.java b/TMessagesProj/src/main/java/org/telegram/ui/DataUsage2Activity.java index ed2cb1374..9ded923ce 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/DataUsage2Activity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/DataUsage2Activity.java @@ -624,7 +624,7 @@ public class DataUsage2Activity extends BaseFragment { int bottomViewType; boolean bottom = position + 1 < itemInners.size() && (bottomViewType = itemInners.get(position + 1).viewType) != item.viewType && bottomViewType != VIEW_TYPE_SEPARATOR && bottomViewType != VIEW_TYPE_ROUNDING; if (bottom) { - subtitleCell.setBackground(Theme.getThemedDrawable(getContext(), R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow)); + subtitleCell.setBackground(Theme.getThemedDrawableByKey(getContext(), R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow)); } else { subtitleCell.setBackground(null); } @@ -637,11 +637,11 @@ public class DataUsage2Activity extends BaseFragment { boolean top = position > 0 && item.viewType != itemInners.get(position - 1).viewType; boolean bottom = position + 1 < itemInners.size() && itemInners.get(position + 1).viewType != item.viewType; if (top && bottom) { - view.setBackground(Theme.getThemedDrawable(getContext(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + view.setBackground(Theme.getThemedDrawableByKey(getContext(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } else if (top) { - view.setBackground(Theme.getThemedDrawable(getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + view.setBackground(Theme.getThemedDrawableByKey(getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (bottom) { - view.setBackground(Theme.getThemedDrawable(getContext(), R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow)); + view.setBackground(Theme.getThemedDrawableByKey(getContext(), R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow)); } else { view.setBackground(null); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/DataUsageActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/DataUsageActivity.java index 76d15f052..a9c2c9d53 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/DataUsageActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/DataUsageActivity.java @@ -735,9 +735,9 @@ public class DataUsageActivity extends BaseFragment { switch (holder.getItemViewType()) { case 0: { if (position == resetSection2Row) { - holder.itemView.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + holder.itemView.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else { - holder.itemView.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + holder.itemView.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } break; } @@ -806,7 +806,7 @@ public class DataUsageActivity extends BaseFragment { } case 3: { TextInfoPrivacyCell cell = (TextInfoPrivacyCell) holder.itemView; - cell.setBackground(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + cell.setBackground(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); cell.setText(LocaleController.formatString("NetworkUsageSince", R.string.NetworkUsageSince, LocaleController.getInstance().formatterStats.format(StatsController.getInstance(currentAccount).getResetStatsDate(currentType)))); break; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Delegates/MemberRequestsDelegate.java b/TMessagesProj/src/main/java/org/telegram/ui/Delegates/MemberRequestsDelegate.java index 8a37aa987..94be5cbc6 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Delegates/MemberRequestsDelegate.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Delegates/MemberRequestsDelegate.java @@ -554,7 +554,7 @@ public class MemberRequestsDelegate implements MemberRequestCell.OnClickListener break; case 1: view = new View(parent.getContext()); - view.setBackground(Theme.getThemedDrawable(parent.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + view.setBackground(Theme.getThemedDrawableByKey(parent.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); break; case 2: view = new View(parent.getContext()) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java index fbd07d406..849bfb976 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java @@ -45,7 +45,6 @@ import android.os.Build; import android.os.Bundle; import android.text.TextPaint; import android.text.TextUtils; -import android.util.Log; import android.util.LongSparseArray; import android.util.Property; import android.util.StateSet; @@ -4507,6 +4506,13 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter. return fragmentView; } + public boolean isPremiumRestoreHintVisible() { + if (!MessagesController.getInstance(currentAccount).premiumLocked && folderId == 0) { + return MessagesController.getInstance(currentAccount).pendingSuggestions.contains("PREMIUM_RESTORE") && !getUserConfig().isPremium(); + } + return false; + } + public boolean isPremiumHintVisible() { if (!MessagesController.getInstance(currentAccount).premiumLocked && folderId == 0) { if (MessagesController.getInstance(currentAccount).pendingSuggestions.contains("PREMIUM_UPGRADE") && getUserConfig().isPremium() || MessagesController.getInstance(currentAccount).pendingSuggestions.contains("PREMIUM_ANNUAL") && !getUserConfig().isPremium()) { @@ -4646,7 +4652,25 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter. if (dialogsHintCell == null) { return; } - if (isPremiumHintVisible()) { + if (isPremiumRestoreHintVisible()) { + dialogsHintCell.setVisibility(View.VISIBLE); + dialogsHintCell.setOnClickListener(v -> { + presentFragment(new PremiumPreviewFragment("dialogs_hint").setSelectAnnualByDefault()); + AndroidUtilities.runOnUIThread(() -> { + MessagesController.getInstance(currentAccount).removeSuggestion(0, "PREMIUM_RESTORE"); + updateDialogsHint(); + }, 250); + }); + dialogsHintCell.setText( + AndroidUtilities.replaceSingleTag( + LocaleController.formatString(R.string.RestorePremiumHintTitle, MediaDataController.getInstance(currentAccount).getPremiumHintAnnualDiscount(false)), + Theme.key_windowBackgroundWhiteValueText, + 0, + null + ), + LocaleController.getString(R.string.RestorePremiumHintMessage) + ); + } else if (isPremiumHintVisible()) { dialogsHintCell.setVisibility(View.VISIBLE); dialogsHintCell.setOnClickListener(v -> { presentFragment(new PremiumPreviewFragment("dialogs_hint").setSelectAnnualByDefault()); @@ -7726,12 +7750,12 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter. getMessagesController().deleteDialog(selectedDialog, 0, revoke); } else { TLRPC.User currentUser = getMessagesController().getUser(getUserConfig().getClientUserId()); - getMessagesController().deleteParticipantFromChat((int) -selectedDialog, currentUser, null, revoke, false); + getMessagesController().deleteParticipantFromChat(-selectedDialog, currentUser, null, revoke, false); } } else { getMessagesController().deleteDialog(selectedDialog, 0, revoke); if (isBot && revoke) { - getMessagesController().blockPeer((int) selectedDialog); + getMessagesController().blockPeer(selectedDialog); } } if (AndroidUtilities.isTablet()) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/DilogCacheBottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/DilogCacheBottomSheet.java index de0585469..79251c5d5 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/DilogCacheBottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/DilogCacheBottomSheet.java @@ -72,7 +72,7 @@ public class DilogCacheBottomSheet extends BottomSheetWithRecyclerListView { textInfoPrivacyCell.setFixedSize(12); CombinedDrawable combinedDrawable = new CombinedDrawable( new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray)), - Theme.getThemedDrawable(parent.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow) + Theme.getThemedDrawableByKey(parent.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow) ); combinedDrawable.setFullsize(true); textInfoPrivacyCell.setBackgroundDrawable(combinedDrawable); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/EditWidgetActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/EditWidgetActivity.java index d02f2987c..3ffd94b8f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/EditWidgetActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/EditWidgetActivity.java @@ -230,7 +230,7 @@ public class EditWidgetActivity extends BaseFragment { } updateDialogs(); - shadowDrawable = Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow); + shadowDrawable = Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow); } public void updateDialogs() { @@ -935,7 +935,7 @@ public class EditWidgetActivity extends BaseFragment { switch (viewType) { case 0: view = new TextInfoPrivacyCell(mContext); - view.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + view.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); break; case 1: view = new TextCell(mContext); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/FeaturedStickersActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/FeaturedStickersActivity.java index 81a3febf3..4a4bd938a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/FeaturedStickersActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/FeaturedStickersActivity.java @@ -247,7 +247,7 @@ public class FeaturedStickersActivity extends BaseFragment implements Notificati case 1: default: view = new TextInfoPrivacyCell(mContext); - view.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + view.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); break; } view.setLayoutParams(new RecyclerView.LayoutParams(RecyclerView.LayoutParams.MATCH_PARENT, RecyclerView.LayoutParams.WRAP_CONTENT)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/FilterChatlistActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/FilterChatlistActivity.java index ea8230569..5c9d2f723 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/FilterChatlistActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/FilterChatlistActivity.java @@ -35,7 +35,6 @@ import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.view.WindowManager; -import android.view.accessibility.AccessibilityNodeInfo; import android.view.inputmethod.EditorInfo; import android.widget.FrameLayout; import android.widget.ImageView; @@ -46,7 +45,6 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.core.content.ContextCompat; -import androidx.core.view.ViewCompat; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -73,9 +71,7 @@ import org.telegram.ui.ActionBar.SimpleTextView; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Cells.DialogCell; import org.telegram.ui.Cells.GroupCreateUserCell; -import org.telegram.ui.Cells.PollEditTextCell; import org.telegram.ui.Cells.TextInfoPrivacyCell; -import org.telegram.ui.Components.AnimatedTextView; import org.telegram.ui.Components.Bulletin; import org.telegram.ui.Components.BulletinFactory; import org.telegram.ui.Components.CircularProgressDrawable; @@ -642,7 +638,7 @@ public class FilterChatlistActivity extends BaseFragment { updateHintCell(false); } else if (viewType == 2) { TextInfoPrivacyCell cell = (TextInfoPrivacyCell) holder.itemView; - cell.setBackground(Theme.getThemedDrawable(getContext(), position == chatsSectionRow ? R.drawable.greydivider_bottom : R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + cell.setBackground(Theme.getThemedDrawableByKey(getContext(), position == chatsSectionRow ? R.drawable.greydivider_bottom : R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); if (position == chatsSectionRow) { cell.setFixedSize(0); if (invite == null || allowedPeers.isEmpty()) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/FilterCreateActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/FilterCreateActivity.java index da8bda19f..88e4c3f9f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/FilterCreateActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/FilterCreateActivity.java @@ -7,16 +7,13 @@ import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.content.Context; import android.content.DialogInterface; -import android.content.SharedPreferences; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.Rect; -import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; -import android.graphics.drawable.RippleDrawable; import android.os.Build; import android.text.Editable; import android.text.Layout; @@ -27,29 +24,21 @@ import android.text.StaticLayout; import android.text.TextPaint; import android.text.TextUtils; import android.text.TextWatcher; -import android.text.style.CharacterStyle; import android.text.style.DynamicDrawableSpan; import android.text.style.ImageSpan; import android.text.style.ReplacementSpan; import android.util.TypedValue; import android.view.Gravity; -import android.view.KeyEvent; import android.view.View; import android.view.ViewGroup; -import android.view.ViewTreeObserver; -import android.view.WindowManager; -import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.view.inputmethod.EditorInfo; import android.widget.FrameLayout; import android.widget.ImageView; -import android.widget.PopupWindow; -import android.widget.ScrollView; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.core.graphics.ColorUtils; import androidx.recyclerview.widget.DefaultItemAnimator; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -71,14 +60,11 @@ import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenu; import org.telegram.ui.ActionBar.ActionBarMenuItem; -import org.telegram.ui.ActionBar.ActionBarMenuSubItem; -import org.telegram.ui.ActionBar.ActionBarPopupWindow; import org.telegram.ui.ActionBar.AlertDialog; 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.Cells.CreationTextCell; import org.telegram.ui.Cells.HeaderCell; import org.telegram.ui.Cells.PollEditTextCell; import org.telegram.ui.Cells.ShadowSectionCell; @@ -105,8 +91,6 @@ import org.telegram.ui.Components.UndoView; import java.util.ArrayList; import java.util.Collections; -import java.util.Locale; -import java.util.Objects; public class FilterCreateActivity extends BaseFragment { @@ -1457,7 +1441,7 @@ public class FilterCreateActivity extends BaseFragment { break; } case VIEW_TYPE_SHADOW: { - holder.itemView.setBackground(Theme.getThemedDrawable(mContext, divider ? R.drawable.greydivider : R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + holder.itemView.setBackground(Theme.getThemedDrawableByKey(mContext, divider ? R.drawable.greydivider : R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); break; } case VIEW_TYPE_BUTTON: { @@ -1469,7 +1453,7 @@ public class FilterCreateActivity extends BaseFragment { case VIEW_TYPE_SHADOW_TEXT: { TextInfoPrivacyCell cell = (TextInfoPrivacyCell) holder.itemView; cell.setText(item.text); - holder.itemView.setBackground(Theme.getThemedDrawable(mContext, divider ? R.drawable.greydivider : R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + holder.itemView.setBackground(Theme.getThemedDrawableByKey(mContext, divider ? R.drawable.greydivider : R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); break; } case VIEW_TYPE_LINK: { @@ -2328,7 +2312,7 @@ public class FilterCreateActivity extends BaseFragment { cell.setFixedSize(12); cell.setText(""); } - cell.setForeground(Theme.getThemedDrawable(getContext(), divider ? R.drawable.greydivider : R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + cell.setForeground(Theme.getThemedDrawableByKey(getContext(), divider ? R.drawable.greydivider : R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (viewType == VIEW_TYPE_HEADER) { // HeaderView headerV = (HeaderView) holder.itemView; // textView.setText(item.text); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/FiltersSetupActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/FiltersSetupActivity.java index 28166e5f3..78135bcfc 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/FiltersSetupActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/FiltersSetupActivity.java @@ -1,16 +1,12 @@ package org.telegram.ui; -import android.animation.ValueAnimator; import android.annotation.SuppressLint; import android.content.Context; import android.content.DialogInterface; -import android.content.SharedPreferences; import android.graphics.Canvas; -import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.drawable.Drawable; -import android.text.TextPaint; import android.text.TextUtils; import android.util.TypedValue; import android.view.Gravity; @@ -33,7 +29,6 @@ import androidx.recyclerview.widget.RecyclerView; import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.Emoji; import org.telegram.messenger.FileLog; -import org.telegram.messenger.GenericProvider; import org.telegram.messenger.LocaleController; import org.telegram.messenger.MessagesController; import org.telegram.messenger.NotificationCenter; @@ -51,9 +46,7 @@ import org.telegram.ui.Cells.HeaderCell; import org.telegram.ui.Cells.ShadowSectionCell; import org.telegram.ui.Components.Bulletin; import org.telegram.ui.Components.BulletinFactory; -import org.telegram.ui.Components.CircularProgressDrawable; import org.telegram.ui.Components.CombinedDrawable; -import org.telegram.ui.Components.CrossfadeDrawable; import org.telegram.ui.Components.CubicBezierInterpolator; import org.telegram.ui.Components.FolderBottomSheet; import org.telegram.ui.Components.ItemOptions; @@ -68,7 +61,6 @@ import org.telegram.ui.Components.RecyclerListView; import org.telegram.ui.Components.UndoView; import java.util.ArrayList; -import java.util.Objects; public class FiltersSetupActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate { @@ -777,7 +769,7 @@ public class FiltersSetupActivity extends BaseFragment implements NotificationCe break; case VIEW_TYPE_HINT: view = new HintInnerCell(mContext, R.raw.filters, AndroidUtilities.replaceTags(LocaleController.formatString("CreateNewFilterInfo", R.string.CreateNewFilterInfo))); - view.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow)); + view.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow)); break; case VIEW_TYPE_FILTER: FilterCell filterCell = new FilterCell(mContext); @@ -938,7 +930,7 @@ public class FiltersSetupActivity extends BaseFragment implements NotificationCe break; } case VIEW_TYPE_SHADOW: { - holder.itemView.setBackground(Theme.getThemedDrawable(mContext, divider ? R.drawable.greydivider : R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + holder.itemView.setBackground(Theme.getThemedDrawableByKey(mContext, divider ? R.drawable.greydivider : R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); break; } case VIEW_TYPE_BUTTON: { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/GroupCallActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/GroupCallActivity.java index 1b57f5b27..046f89156 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/GroupCallActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/GroupCallActivity.java @@ -7145,7 +7145,7 @@ public class GroupCallActivity extends BottomSheet implements NotificationCenter } private boolean showMenuForCell(View rendererCell) { - if (itemAnimator.isRunning()) { + if (itemAnimator.isRunning() || getContext() == null) { return false; } if (avatarPriviewTransitionInProgress || avatarsPreviewShowed) { @@ -7211,6 +7211,9 @@ public class GroupCallActivity extends BottomSheet implements NotificationCenter boolean showWithAvatarPreview = !isLandscapeMode && !isTabletMode && !AndroidUtilities.isInMultiwindow; TLRPC.TL_groupCallParticipant participant = view.getParticipant(); + if (participant == null) { + return false; + } Rect rect = new Rect(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateFinalActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateFinalActivity.java index 9f75b700d..822888e8e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateFinalActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateFinalActivity.java @@ -980,7 +980,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati switch (viewType) { case VIEW_TYPE_SHADOW_SECTION_CELL: { view = new ShadowSectionCell(context); - Drawable drawable = Theme.getThemedDrawable(context, R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow); + Drawable drawable = Theme.getThemedDrawableByKey(context, R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow); CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray)), drawable); combinedDrawable.setFullsize(true); view.setBackgroundDrawable(combinedDrawable); @@ -999,7 +999,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati break; case VIEW_TYPE_TEXT_INFO_CELL: view = new TextInfoPrivacyCell(context); - Drawable drawable = Theme.getThemedDrawable(context, selectedContacts.size() == 0 ? R.drawable.greydivider_bottom : R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); + Drawable drawable = Theme.getThemedDrawableByKey(context, selectedContacts.size() == 0 ? R.drawable.greydivider_bottom : R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray)), drawable); combinedDrawable.setFullsize(true); view.setBackgroundDrawable(combinedDrawable); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/GroupInviteActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/GroupInviteActivity.java index 1f64befc4..c01a1aaa4 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/GroupInviteActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/GroupInviteActivity.java @@ -271,7 +271,7 @@ public class GroupInviteActivity extends BaseFragment implements NotificationCen TextInfoPrivacyCell privacyCell = (TextInfoPrivacyCell) holder.itemView; if (position == shadowRow) { privacyCell.setText(""); - privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + privacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (position == linkInfoRow) { TLRPC.Chat chat = getMessagesController().getChat(chatId); if (ChatObject.isChannel(chat) && !chat.megagroup) { @@ -279,7 +279,7 @@ public class GroupInviteActivity extends BaseFragment implements NotificationCen } else { privacyCell.setText(LocaleController.getString("LinkInfo", R.string.LinkInfo)); } - privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + privacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } break; case 2: diff --git a/TMessagesProj/src/main/java/org/telegram/ui/GroupStickersActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/GroupStickersActivity.java index 545021d01..002829475 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/GroupStickersActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/GroupStickersActivity.java @@ -549,7 +549,7 @@ public class GroupStickersActivity extends BaseFragment implements NotificationC default: case TYPE_MY_STICKERS_HEADER: view = new HeaderCell(mContext, Theme.key_windowBackgroundWhiteGrayText4, 21, 0, 0, false, getResourceProvider()); - view.setBackground(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + view.setBackground(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); ((HeaderCell) view).setText(LocaleController.getString(R.string.ChooseStickerMyStickerSets)); break; } @@ -685,7 +685,7 @@ public class GroupStickersActivity extends BaseFragment implements NotificationC break; case TYPE_INFO: view = new TextInfoPrivacyCell(mContext); - view.setBackground(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + view.setBackground(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); break; case TYPE_CHOOSE_HEADER: default: diff --git a/TMessagesProj/src/main/java/org/telegram/ui/KeepMediaPopupView.java b/TMessagesProj/src/main/java/org/telegram/ui/KeepMediaPopupView.java index 5dbe52296..ce2c6395a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/KeepMediaPopupView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/KeepMediaPopupView.java @@ -72,7 +72,7 @@ public class KeepMediaPopupView extends ActionBarPopupWindow.ActionBarPopupWindo gap = new FrameLayout(context); gap.setBackgroundColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuSeparator)); View gapShadow = new View(context); - gapShadow.setBackground(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow, null)); + gapShadow.setBackground(Theme.getThemedDrawableByKey(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow, null)); gap.addView(gapShadow, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); gap.setTag(R.id.fit_width_tag, 1); addView(gap, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 8)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LanguageSelectActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LanguageSelectActivity.java index 2afc73447..c8ac956a0 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LanguageSelectActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LanguageSelectActivity.java @@ -10,7 +10,6 @@ package org.telegram.ui; import android.content.Context; import android.content.DialogInterface; -import android.content.SharedPreferences; import android.graphics.Canvas; import android.text.TextUtils; import android.view.View; @@ -633,9 +632,9 @@ public class LanguageSelectActivity extends BaseFragment implements Notification position--; ShadowSectionCell sectionCell = (ShadowSectionCell) holder.itemView; if (!unofficialLanguages.isEmpty() && position == unofficialLanguages.size()) { - sectionCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + sectionCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } else { - sectionCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + sectionCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } break; } @@ -695,14 +694,14 @@ public class LanguageSelectActivity extends BaseFragment implements Notification infoCell.updateRTL(); if (position == (!getMessagesController().premiumLocked && (getContextValue() || getChatValue()) ? 4 : 3)) { infoCell.setText(LocaleController.getString("TranslateMessagesInfo1", R.string.TranslateMessagesInfo1)); - infoCell.setBackground(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + infoCell.setBackground(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); infoCell.setTopPadding(11); infoCell.setBottomPadding(16); } else { infoCell.setTopPadding(0); infoCell.setBottomPadding(16); infoCell.setText(LocaleController.getString("TranslateMessagesInfo2", R.string.TranslateMessagesInfo2)); - infoCell.setBackground(Theme.getThemedDrawable(mContext, R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow)); + infoCell.setBackground(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow)); } break; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LinkEditActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LinkEditActivity.java index 2183b9826..9517e2a60 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LinkEditActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LinkEditActivity.java @@ -314,7 +314,7 @@ public class LinkEditActivity extends BaseFragment { } TextInfoPrivacyCell hintCell = new TextInfoPrivacyCell(context); - hintCell.setBackground(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + hintCell.setBackground(Theme.getThemedDrawableByKey(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); if (hasApproveCell) { hintCell.setText(LocaleController.getString("ApproveNewMembersDescription", R.string.ApproveNewMembersDescription)); } @@ -450,7 +450,7 @@ public class LinkEditActivity extends BaseFragment { linearLayout.addView(nameEditText, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 50)); dividerName = new TextInfoPrivacyCell(context); - dividerName.setBackground(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + dividerName.setBackground(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); dividerName.setText(LocaleController.getString("LinkNameHelp", R.string.LinkNameHelp)); linearLayout.addView(dividerName); @@ -489,8 +489,8 @@ public class LinkEditActivity extends BaseFragment { buttonTextView.setOnClickListener(this::onCreateClicked); buttonTextView.setTextColor(Theme.getColor(Theme.key_featuredStickers_buttonText)); - dividerUses.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); - divider.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + dividerUses.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + divider.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); buttonTextView.setBackgroundDrawable(Theme.createSimpleSelectorRoundRectDrawable(AndroidUtilities.dp(6), Theme.getColor(Theme.key_featuredStickers_addButton), Theme.getColor(Theme.key_featuredStickers_addButtonPressed))); usesEditText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); @@ -792,7 +792,7 @@ public class LinkEditActivity extends BaseFragment { usesChooseView.setVisibility(isVisible ? View.VISIBLE : View.GONE); usesEditText.setVisibility(isVisible ? View.VISIBLE : View.GONE); dividerUses.setVisibility(isVisible ? View.VISIBLE : View.GONE); - divider.setBackground(Theme.getThemedDrawable(getParentActivity(), isVisible ? R.drawable.greydivider : R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + divider.setBackground(Theme.getThemedDrawableByKey(getParentActivity(), isVisible ? R.drawable.greydivider : R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } public interface Callback { @@ -818,8 +818,8 @@ public class LinkEditActivity extends BaseFragment { ThemeDescription.ThemeDescriptionDelegate descriptionDelegate = () -> { if (dividerUses != null) { Context context = dividerUses.getContext(); - dividerUses.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); - divider.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + dividerUses.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + divider.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); buttonTextView.setBackgroundDrawable(Theme.createSimpleSelectorRoundRectDrawable(AndroidUtilities.dp(6), Theme.getColor(Theme.key_featuredStickers_addButton), Theme.getColor(Theme.key_featuredStickers_addButtonPressed))); usesEditText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); @@ -833,7 +833,7 @@ public class LinkEditActivity extends BaseFragment { } createTextView.setTextColor(Theme.getColor(Theme.key_actionBarDefaultTitle)); - dividerName.setBackground(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + dividerName.setBackground(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); nameEditText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); nameEditText.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText)); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LiteModeSettingsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LiteModeSettingsActivity.java index 70f636a5b..1764383f9 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LiteModeSettingsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LiteModeSettingsActivity.java @@ -391,11 +391,11 @@ public class LiteModeSettingsActivity extends BaseFragment { boolean top = position > 0 && items.get(position - 1).viewType != VIEW_TYPE_INFO; boolean bottom = position + 1 < items.size() && items.get(position + 1).viewType != VIEW_TYPE_INFO; if (top && bottom) { - textInfoPrivacyCell.setBackground(Theme.getThemedDrawable(getContext(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + textInfoPrivacyCell.setBackground(Theme.getThemedDrawableByKey(getContext(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } else if (top) { - textInfoPrivacyCell.setBackground(Theme.getThemedDrawable(getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + textInfoPrivacyCell.setBackground(Theme.getThemedDrawableByKey(getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (bottom) { - textInfoPrivacyCell.setBackground(Theme.getThemedDrawable(getContext(), R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow)); + textInfoPrivacyCell.setBackground(Theme.getThemedDrawableByKey(getContext(), R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow)); } else { textInfoPrivacyCell.setBackground(null); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LogoutActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LogoutActivity.java index e8da60f8f..0ba4bbaae 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LogoutActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LogoutActivity.java @@ -275,7 +275,7 @@ public class LogoutActivity extends BaseFragment { case 4: default: { view = new TextInfoPrivacyCell(mContext); - view.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + view.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); break; } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ManageLinksActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ManageLinksActivity.java index 73b0fa5a7..da8e5fb68 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ManageLinksActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ManageLinksActivity.java @@ -740,7 +740,7 @@ public class ManageLinksActivity extends BaseFragment { case 0: default: view = new HintInnerCell(mContext); - view.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundWhite)); + view.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundWhite)); break; case 1: view = new HeaderCell(mContext, 23); @@ -784,7 +784,7 @@ public class ManageLinksActivity extends BaseFragment { break; case 7: view = new ShadowSectionCell(mContext); - view.setBackground(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + view.setBackground(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); break; case 8: TextSettingsCell revokeAll = new TextSettingsCell(mContext); @@ -796,7 +796,7 @@ public class ManageLinksActivity extends BaseFragment { case 9: TextInfoPrivacyCell cell = new TextInfoPrivacyCell(mContext); cell.setText(LocaleController.getString("CreateNewLinkHelp", R.string.CreateNewLinkHelp)); - cell.setBackground(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + cell.setBackground(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); view = cell; break; case 10: diff --git a/TMessagesProj/src/main/java/org/telegram/ui/MessageStatisticActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/MessageStatisticActivity.java index 138c8737a..25b259722 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/MessageStatisticActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/MessageStatisticActivity.java @@ -777,7 +777,7 @@ public class MessageStatisticActivity extends BaseFragment implements Notificati } break; case 1: - holder.itemView.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + holder.itemView.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); break; case 2: HeaderCell headerCell = (HeaderCell) holder.itemView; @@ -970,7 +970,7 @@ public class MessageStatisticActivity extends BaseFragment implements Notificati ((StatisticActivity.BaseChartCell) child).recolor(); child.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); } else if (child instanceof ShadowSectionCell) { - Drawable shadowDrawable = Theme.getThemedDrawable(ApplicationLoader.applicationContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); + Drawable shadowDrawable = Theme.getThemedDrawableByKey(ApplicationLoader.applicationContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); Drawable background = new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray)); CombinedDrawable combinedDrawable = new CombinedDrawable(background, shadowDrawable, 0, 0); combinedDrawable.setFullsize(true); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/NotificationsCustomSettingsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/NotificationsCustomSettingsActivity.java index 42b953fb7..cc735bd0b 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/NotificationsCustomSettingsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/NotificationsCustomSettingsActivity.java @@ -1301,9 +1301,9 @@ public class NotificationsCustomSettingsActivity extends BaseFragment implements } case 4: { if (position == deleteAllSectionRow || position == groupSection2Row && exceptionsSection2Row == -1 || position == exceptionsSection2Row && deleteAllRow == -1) { - holder.itemView.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + holder.itemView.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else { - holder.itemView.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + holder.itemView.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } break; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/NotificationsSettingsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/NotificationsSettingsActivity.java index 4e04efea3..1fccf2287 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/NotificationsSettingsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/NotificationsSettingsActivity.java @@ -787,7 +787,7 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif case 6: default: view = new TextInfoPrivacyCell(mContext); - view.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + view.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); break; } return new RecyclerListView.Holder(view); @@ -912,9 +912,9 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif } case 4: { if (position == resetNotificationsSectionRow) { - holder.itemView.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + holder.itemView.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else { - holder.itemView.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + holder.itemView.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } break; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/NotificationsSoundActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/NotificationsSoundActivity.java index 87af6de02..c2c7fcbea 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/NotificationsSoundActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/NotificationsSoundActivity.java @@ -521,17 +521,23 @@ public class NotificationsSoundActivity extends BaseFragment implements ChatAtta return null; } - RingtoneManager manager = new RingtoneManager(ApplicationLoader.applicationContext); - manager.setType(RingtoneManager.TYPE_NOTIFICATION); - Cursor cursor = manager.getCursor(); + try { + RingtoneManager manager = new RingtoneManager(ApplicationLoader.applicationContext); + manager.setType(RingtoneManager.TYPE_NOTIFICATION); + Cursor cursor = manager.getCursor(); - while (cursor.moveToNext()) { - String notificationTitle = cursor.getString(RingtoneManager.TITLE_COLUMN_INDEX); - String notificationUri = cursor.getString(RingtoneManager.URI_COLUMN_INDEX) + "/" + cursor.getString(RingtoneManager.ID_COLUMN_INDEX); + while (cursor.moveToNext()) { + String notificationTitle = cursor.getString(RingtoneManager.TITLE_COLUMN_INDEX); + String notificationUri = cursor.getString(RingtoneManager.URI_COLUMN_INDEX) + "/" + cursor.getString(RingtoneManager.ID_COLUMN_INDEX); - if (title.equalsIgnoreCase(notificationTitle)) { - return notificationUri; + if (title.equalsIgnoreCase(notificationTitle)) { + return notificationUri; + } } + } catch (Throwable e) { + // Exception java.lang.NullPointerException: Attempt to invoke interface method 'void android.database.Cursor.registerDataSetObserver(android.database.DataSetObserver)' on a null object reference + // ignore + FileLog.e(e); } return null; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PasscodeActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/PasscodeActivity.java index d631b22b2..318085e19 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PasscodeActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PasscodeActivity.java @@ -1232,11 +1232,11 @@ public class PasscodeActivity extends BaseFragment implements NotificationCenter cell.getTextView().setGravity(Gravity.CENTER_HORIZONTAL); } else if (position == autoLockDetailRow) { cell.setText(LocaleController.getString(R.string.AutoLockInfo)); - cell.setBackground(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + cell.setBackground(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); cell.getTextView().setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); } else if (position == captureDetailRow) { cell.setText(LocaleController.getString(R.string.ScreenCaptureInfo)); - cell.setBackground(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + cell.setBackground(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); cell.getTextView().setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); } break; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PassportActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/PassportActivity.java index 0a8bb7d06..b5e47fe34 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PassportActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PassportActivity.java @@ -1494,7 +1494,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter } bottomCell = new TextInfoPrivacyCell(context); - bottomCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + bottomCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); bottomCell.setText(LocaleController.formatString("PassportEmailVerifyInfo", R.string.PassportEmailVerifyInfo, currentValues.get("email"))); linearLayout2.addView(bottomCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); } @@ -1620,7 +1620,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter } passwordInfoRequestTextView = new TextInfoPrivacyCell(context); - passwordInfoRequestTextView.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + passwordInfoRequestTextView.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); passwordInfoRequestTextView.setText(LocaleController.formatString("PassportRequestPasswordInfo", R.string.PassportRequestPasswordInfo)); linearLayout2.addView(passwordInfoRequestTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); @@ -2007,7 +2007,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter avatarImageView.setForUserOrChat(botUser, avatarDrawable); bottomCell = new TextInfoPrivacyCell(context); - bottomCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow)); + bottomCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow)); bottomCell.setText(AndroidUtilities.replaceTags(LocaleController.formatString("PassportRequest", R.string.PassportRequest, UserObject.getFirstName(botUser)))); bottomCell.getTextView().setGravity(Gravity.CENTER_HORIZONTAL); ((FrameLayout.LayoutParams) bottomCell.getTextView().getLayoutParams()).gravity = Gravity.CENTER_HORIZONTAL; @@ -2156,7 +2156,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter if (botUser != null) { bottomCell = new TextInfoPrivacyCell(context); - bottomCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + bottomCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); bottomCell.setLinkTextColorKey(Theme.key_windowBackgroundWhiteGrayText4); if (!TextUtils.isEmpty(currentForm.privacy_policy_url)) { String str2 = LocaleController.formatString("PassportPolicy", R.string.PassportPolicy, UserObject.getFirstName(botUser), botUser.username); @@ -2431,7 +2431,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter linearLayout2.addView(headerCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); sectionCell = new ShadowSectionCell(context); - sectionCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + sectionCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); linearLayout2.addView(sectionCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); addDocumentCell = new TextSettingsCell(context); @@ -2480,13 +2480,13 @@ public class PassportActivity extends BaseFragment implements NotificationCenter }); addDocumentSectionCell = new ShadowSectionCell(context); - addDocumentSectionCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + addDocumentSectionCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); linearLayout2.addView(addDocumentSectionCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); emptyLayout = new LinearLayout(context); emptyLayout.setOrientation(LinearLayout.VERTICAL); emptyLayout.setGravity(Gravity.CENTER); - emptyLayout.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + emptyLayout.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); if (AndroidUtilities.isTablet()) { linearLayout2.addView(emptyLayout, new LinearLayout.LayoutParams(LayoutHelper.MATCH_PARENT, AndroidUtilities.dp(528) - ActionBar.getCurrentActionBarHeight())); } else { @@ -2733,7 +2733,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter }); bottomCell = new TextInfoPrivacyCell(context); - bottomCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + bottomCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); bottomCell.setText(LocaleController.getString("PassportPhoneUseSameEmailInfo", R.string.PassportPhoneUseSameEmailInfo)); linearLayout2.addView(bottomCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); } @@ -2777,7 +2777,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter } bottomCell = new TextInfoPrivacyCell(context); - bottomCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + bottomCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); bottomCell.setText(LocaleController.getString("PassportEmailUploadInfo", R.string.PassportEmailUploadInfo)); linearLayout2.addView(bottomCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); } @@ -2819,7 +2819,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter }); bottomCell = new TextInfoPrivacyCell(context); - bottomCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + bottomCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); bottomCell.setText(LocaleController.getString("PassportPhoneUseSameInfo", R.string.PassportPhoneUseSameInfo)); linearLayout2.addView(bottomCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); @@ -3123,7 +3123,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter } bottomCell = new TextInfoPrivacyCell(context); - bottomCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + bottomCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); bottomCell.setText(LocaleController.getString("PassportPhoneUploadInfo", R.string.PassportPhoneUploadInfo)); linearLayout2.addView(bottomCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); } @@ -3143,7 +3143,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter } topErrorCell = new TextInfoPrivacyCell(context); - topErrorCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow)); + topErrorCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow)); topErrorCell.setPadding(0, AndroidUtilities.dp(7), 0, 0); linearLayout2.addView(topErrorCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); checkTopErrorCell(true); @@ -3179,7 +3179,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter }); bottomCell = new TextInfoPrivacyCell(context); - bottomCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + bottomCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); if (currentBotId != 0) { noAllDocumentsErrorText = LocaleController.getString("PassportAddAddressUploadInfo", R.string.PassportAddAddressUploadInfo); @@ -3233,7 +3233,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter }); bottomCellTranslation = new TextInfoPrivacyCell(context); - bottomCellTranslation.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + bottomCellTranslation.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); if (currentBotId != 0) { noAllTranslationErrorText = LocaleController.getString("PassportAddTranslationUploadInfo", R.string.PassportAddTranslationUploadInfo); @@ -3502,7 +3502,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter addDocumentViews(currentDocumentsTypeValue.files); addTranslationDocumentViews(currentDocumentsTypeValue.translation); } - sectionCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + sectionCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); TextSettingsCell settingsCell1 = new TextSettingsCell(context); settingsCell1.setTextColor(Theme.getColor(Theme.key_text_RedRegular)); @@ -3516,12 +3516,12 @@ public class PassportActivity extends BaseFragment implements NotificationCenter settingsCell1.setOnClickListener(v -> createDocumentDeleteAlert()); sectionCell = new ShadowSectionCell(context); - sectionCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + sectionCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); linearLayout2.addView(sectionCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); } else { - sectionCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + sectionCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); if (documentOnly && currentDocumentsType != null) { - bottomCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + bottomCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } } updateUploadText(UPLOADING_TYPE_DOCUMENTS); @@ -3884,7 +3884,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter } topErrorCell = new TextInfoPrivacyCell(context); - topErrorCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow)); + topErrorCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow)); topErrorCell.setPadding(0, AndroidUtilities.dp(7), 0, 0); linearLayout2.addView(topErrorCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); checkTopErrorCell(true); @@ -3942,7 +3942,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter } bottomCell = new TextInfoPrivacyCell(context); - bottomCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + bottomCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); bottomCell.setText(LocaleController.getString("PassportPersonalUploadInfo", R.string.PassportPersonalUploadInfo)); linearLayout2.addView(bottomCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); @@ -3965,7 +3965,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter }); bottomCellTranslation = new TextInfoPrivacyCell(context); - bottomCellTranslation.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + bottomCellTranslation.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); if (currentBotId != 0) { noAllTranslationErrorText = LocaleController.getString("PassportAddTranslationUploadInfo", R.string.PassportAddTranslationUploadInfo); @@ -4056,7 +4056,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter }); bottomCell = new TextInfoPrivacyCell(context); - bottomCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + bottomCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); bottomCell.setText(LocaleController.getString("PassportScanPassportInfo", R.string.PassportScanPassportInfo)); linearLayout2.addView(bottomCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); } @@ -4590,13 +4590,13 @@ public class PassportActivity extends BaseFragment implements NotificationCenter linearLayout2.addView(settingsCell1, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); settingsCell1.setOnClickListener(v -> createDocumentDeleteAlert()); - nativeInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + nativeInfoCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); sectionCell = new ShadowSectionCell(context); - sectionCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + sectionCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); linearLayout2.addView(sectionCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); } else { - nativeInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + nativeInfoCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } updateInterfaceStringsForDocumentType(); @@ -5301,9 +5301,9 @@ public class PassportActivity extends BaseFragment implements NotificationCenter } if ((currentBotId != 0 || currentDocumentsType == null) && currentTypeValue != null && !documentOnly || currentDocumentsTypeValue != null) { - sectionCell2.setBackgroundDrawable(Theme.getThemedDrawable(getParentActivity(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + sectionCell2.setBackgroundDrawable(Theme.getThemedDrawableByKey(getParentActivity(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } else { - sectionCell2.setBackgroundDrawable(Theme.getThemedDrawable(getParentActivity(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + sectionCell2.setBackgroundDrawable(Theme.getThemedDrawableByKey(getParentActivity(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } } } else { @@ -5324,7 +5324,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter } } } - sectionCell2.setBackgroundDrawable(Theme.getThemedDrawable(getParentActivity(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + sectionCell2.setBackgroundDrawable(Theme.getThemedDrawableByKey(getParentActivity(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } nativeInfoCell.setText(LocaleController.formatString("PassportNativeInfo", R.string.PassportNativeInfo, country)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PaymentFormActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/PaymentFormActivity.java index 2d0e1053c..1a8a5a4cd 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PaymentFormActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PaymentFormActivity.java @@ -1007,7 +1007,7 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen } bottomCell[1] = new TextInfoPrivacyCell(context, resourcesProvider); - bottomCell[1].setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + bottomCell[1].setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); linearLayout2.addView(bottomCell[1], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); if (paymentForm.invoice.email_to_provider && paymentForm.invoice.phone_to_provider) { bottomCell[1].setText(LocaleController.formatString("PaymentPhoneEmailToProvider", R.string.PaymentPhoneEmailToProvider, providerName)); @@ -1031,7 +1031,7 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen }); bottomCell[0] = new TextInfoPrivacyCell(context, resourcesProvider); - bottomCell[0].setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + bottomCell[0].setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); bottomCell[0].setText(LocaleController.getString("PaymentShippingSaveInfo", R.string.PaymentShippingSaveInfo)); linearLayout2.addView(bottomCell[0], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); } @@ -1187,7 +1187,7 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen }); bottomCell[0] = new TextInfoPrivacyCell(context, resourcesProvider); - bottomCell[0].setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + bottomCell[0].setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); updateSavePaymentField(); linearLayout2.addView(bottomCell[0], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); } else { @@ -1627,7 +1627,7 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen }); bottomCell[0] = new TextInfoPrivacyCell(context, resourcesProvider); - bottomCell[0].setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + bottomCell[0].setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); updateSavePaymentField(); linearLayout2.addView(bottomCell[0], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); } else if (a == FIELD_CARD) { @@ -1679,7 +1679,7 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen linearLayout2.addView(radioCells[a]); } bottomCell[0] = new TextInfoPrivacyCell(context, resourcesProvider); - bottomCell[0].setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + bottomCell[0].setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); linearLayout2.addView(bottomCell[0], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); } else if (currentStep == STEP_CONFIRM_PASSWORD) { inputFields = new EditTextBoldCursor[FIELDS_COUNT_SAVEDCARD]; @@ -1757,7 +1757,7 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen if (a == FIELD_SAVEDPASSWORD) { bottomCell[0] = new TextInfoPrivacyCell(context, resourcesProvider); bottomCell[0].setText(LocaleController.formatString("PaymentConfirmationMessage", R.string.PaymentConfirmationMessage, savedCredentialsCard.title)); - bottomCell[0].setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + bottomCell[0].setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); linearLayout2.addView(bottomCell[0], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); settingsCell[0] = new TextSettingsCell(context, resourcesProvider); @@ -1770,7 +1770,7 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen }); bottomCell[1] = new TextInfoPrivacyCell(context, resourcesProvider); - bottomCell[1].setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + bottomCell[1].setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); linearLayout2.addView(bottomCell[1], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); } } @@ -2092,7 +2092,7 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen linearLayout2.addView(totalCell); sectionCell[2] = new ShadowSectionCell(context, resourcesProvider); - sectionCell[2].setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + sectionCell[2].setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); linearLayout2.addView(sectionCell[2], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); detailSettingsCell[0] = new TextDetailSettingsCell(context); @@ -2436,7 +2436,7 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen } sectionCell[1] = new ShadowSectionCell(context, resourcesProvider); - sectionCell[1].setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + sectionCell[1].setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); if (cardInfoVisibility != View.VISIBLE && currentStep == STEP_CHECKOUT && validateRequest == null && (paymentForm == null || paymentForm.saved_info == null)) { sectionCell[1].setVisibility(cardInfoVisibility); } @@ -2476,7 +2476,7 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen linearLayout2.addView(codeFieldCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); bottomCell[2] = new TextInfoPrivacyCell(context, resourcesProvider); - bottomCell[2].setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + bottomCell[2].setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); linearLayout2.addView(bottomCell[2], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); settingsCell[1] = new TextSettingsCell(context, resourcesProvider); @@ -2605,12 +2605,12 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen if (a == FIELD_REENTERPASSWORD) { bottomCell[0] = new TextInfoPrivacyCell(context, resourcesProvider); bottomCell[0].setText(LocaleController.getString("PaymentPasswordInfo", R.string.PaymentPasswordInfo)); - bottomCell[0].setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + bottomCell[0].setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); linearLayout2.addView(bottomCell[0], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); } else if (a == FIELD_ENTERPASSWORDEMAIL) { bottomCell[1] = new TextInfoPrivacyCell(context, resourcesProvider); bottomCell[1].setText(LocaleController.getString("PaymentPasswordEmailInfo", R.string.PaymentPasswordEmailInfo)); - bottomCell[1].setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + bottomCell[1].setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); linearLayout2.addView(bottomCell[1], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); } } @@ -3432,11 +3432,11 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen bottomCell[0].setText(text); checkCell1.setVisibility(View.VISIBLE); bottomCell[0].setVisibility(View.VISIBLE); - sectionCell[2].setBackgroundDrawable(Theme.getThemedDrawable(sectionCell[2].getContext(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + sectionCell[2].setBackgroundDrawable(Theme.getThemedDrawableByKey(sectionCell[2].getContext(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } else { checkCell1.setVisibility(View.GONE); bottomCell[0].setVisibility(View.GONE); - sectionCell[2].setBackgroundDrawable(Theme.getThemedDrawable(sectionCell[2].getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + sectionCell[2].setBackgroundDrawable(Theme.getThemedDrawableByKey(sectionCell[2].getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PeopleNearbyActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/PeopleNearbyActivity.java index afd328181..15d072785 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PeopleNearbyActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PeopleNearbyActivity.java @@ -995,11 +995,11 @@ public class PeopleNearbyActivity extends BaseFragment implements NotificationCe case 1: ShadowSectionCell privacyCell = (ShadowSectionCell) holder.itemView; if (position == usersSectionRow) { - privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + privacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } else if (position == chatsSectionRow) { - privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + privacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (position == helpSectionRow) { - privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + privacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } break; case 2: diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PollCreateActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/PollCreateActivity.java index 5a0976da4..8bf363435 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PollCreateActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PollCreateActivity.java @@ -587,7 +587,7 @@ public class PollCreateActivity extends BaseFragment { case 2: { TextInfoPrivacyCell cell = (TextInfoPrivacyCell) holder.itemView; cell.setFixedSize(0); - cell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + cell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); if (position == solutionInfoRow) { cell.setText(LocaleController.getString("AddAnExplanationInfo", R.string.AddAnExplanationInfo)); } else if (position == settingsSectionRow) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PrivacyControlActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/PrivacyControlActivity.java index 654e8fcfb..bfaa9e3a3 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PrivacyControlActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PrivacyControlActivity.java @@ -257,7 +257,7 @@ public class PrivacyControlActivity extends BaseFragment implements Notification setWillNotDraw(false); setClipToPadding(false); - shadowDrawable = Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow); + shadowDrawable = Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow); setPadding(0, AndroidUtilities.dp(11), 0, AndroidUtilities.dp(11)); int date = (int) (System.currentTimeMillis() / 1000) - 60 * 60; @@ -1141,7 +1141,7 @@ public class PrivacyControlActivity extends BaseFragment implements Notification case 5: default: view = new ShadowSectionCell(mContext); - Drawable drawable = Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); + Drawable drawable = Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray)), drawable); combinedDrawable.setFullsize(true); view.setBackgroundDrawable(combinedDrawable); @@ -1335,7 +1335,7 @@ public class PrivacyControlActivity extends BaseFragment implements Notification privacyCell.setText(LocaleController.getString("PhotoForRestDescription", R.string.PhotoForRestDescription)); } if (backgroundResId != 0) { - Drawable drawable = Theme.getThemedDrawable(mContext, backgroundResId, Theme.key_windowBackgroundGrayShadow); + Drawable drawable = Theme.getThemedDrawableByKey(mContext, backgroundResId, Theme.key_windowBackgroundGrayShadow); CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray)), drawable); combinedDrawable.setFullsize(true); privacyCell.setBackgroundDrawable(combinedDrawable); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PrivacySettingsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/PrivacySettingsActivity.java index 82914000d..5b628f635 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PrivacySettingsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PrivacySettingsActivity.java @@ -1022,7 +1022,7 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio case 1: TextInfoPrivacyCell privacyCell = (TextInfoPrivacyCell) holder.itemView; boolean last = position == getItemCount() - 1; - privacyCell.setBackground(Theme.getThemedDrawable(mContext, last ? R.drawable.greydivider_bottom : R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + privacyCell.setBackground(Theme.getThemedDrawableByKey(mContext, last ? R.drawable.greydivider_bottom : R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); if (position == deleteAccountDetailRow) { privacyCell.setText(LocaleController.getString("DeleteAccountHelp", R.string.DeleteAccountHelp)); } else if (position == groupsDetailRow) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PrivacyUsersActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/PrivacyUsersActivity.java index 35a21584d..6f8459812 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PrivacyUsersActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PrivacyUsersActivity.java @@ -494,14 +494,14 @@ public class PrivacyUsersActivity extends BaseFragment implements NotificationCe privacyCell.setText(null); } if (usersStartRow == -1) { - privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + privacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else { - privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + privacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } } else if (position == usersDetailRow) { privacyCell.setFixedSize(12); privacyCell.setText(""); - privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + privacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } break; case 2: diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ProfileNotificationsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ProfileNotificationsActivity.java index c428159af..873a70844 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ProfileNotificationsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ProfileNotificationsActivity.java @@ -815,20 +815,20 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi TextInfoPrivacyCell textCell = (TextInfoPrivacyCell) holder.itemView; if (position == popupInfoRow) { textCell.setText(LocaleController.getString("ProfilePopupNotificationInfo", R.string.ProfilePopupNotificationInfo)); - textCell.setBackground(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + textCell.setBackground(Theme.getThemedDrawableByKey(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } else if (position == ledInfoRow) { textCell.setText(LocaleController.getString("NotificationsLedInfo", R.string.NotificationsLedInfo)); - textCell.setBackground(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + textCell.setBackground(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (position == priorityInfoRow) { if (priorityRow == -1) { textCell.setText(""); } else { textCell.setText(LocaleController.getString("PriorityInfo", R.string.PriorityInfo)); } - textCell.setBackground(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + textCell.setBackground(Theme.getThemedDrawableByKey(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } else if (position == ringtoneInfoRow) { textCell.setText(LocaleController.getString("VoipRingtoneInfo", R.string.VoipRingtoneInfo)); - textCell.setBackground(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + textCell.setBackground(Theme.getThemedDrawableByKey(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } break; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ProxyListActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ProxyListActivity.java index 427b3f3b0..9d8640884 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ProxyListActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ProxyListActivity.java @@ -881,9 +881,9 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente switch (holder.getItemViewType()) { case VIEW_TYPE_SHADOW: { if (position == proxyShadowRow && callsRow == -1) { - holder.itemView.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + holder.itemView.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else { - holder.itemView.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + holder.itemView.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } break; } @@ -920,10 +920,10 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente TextInfoPrivacyCell cell = (TextInfoPrivacyCell) holder.itemView; if (position == callsDetailRow) { cell.setText(LocaleController.getString("UseProxyForCallsInfo", R.string.UseProxyForCallsInfo)); - cell.setBackground(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + cell.setBackground(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (position == rotationTimeoutInfoRow) { cell.setText(LocaleController.getString(R.string.ProxyRotationTimeoutInfo)); - cell.setBackground(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + cell.setBackground(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } break; } @@ -1023,7 +1023,7 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente break; case VIEW_TYPE_INFO: view = new TextInfoPrivacyCell(mContext); - view.setBackground(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + view.setBackground(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); break; case VIEW_TYPE_SLIDE_CHOOSER: view = new SlideChooseView(mContext); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ProxySettingsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ProxySettingsActivity.java index d55260eca..f965adb9e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ProxySettingsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ProxySettingsActivity.java @@ -436,7 +436,7 @@ public class ProxySettingsActivity extends BaseFragment { for (int i = 0; i < 2; i++) { bottomCells[i] = new TextInfoPrivacyCell(context); - bottomCells[i].setBackground(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + bottomCells[i].setBackground(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); if (i == 0) { bottomCells[i].setText(LocaleController.getString("UseProxyInfo", R.string.UseProxyInfo)); } else { @@ -487,7 +487,7 @@ public class ProxySettingsActivity extends BaseFragment { linearLayout2.addView(pasteCell, 0, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); pasteCell.setVisibility(View.GONE); sectionCell[2] = new ShadowSectionCell(fragmentView.getContext()); - sectionCell[2].setBackground(Theme.getThemedDrawable(fragmentView.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + sectionCell[2].setBackground(Theme.getThemedDrawableByKey(fragmentView.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); linearLayout2.addView(sectionCell[2], 1, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); sectionCell[2].setVisibility(View.GONE); @@ -549,7 +549,7 @@ public class ProxySettingsActivity extends BaseFragment { }); sectionCell[1] = new ShadowSectionCell(context); - sectionCell[1].setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + sectionCell[1].setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); linearLayout2.addView(sectionCell[1], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); clipboardManager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/QuickRepliesSettingsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/QuickRepliesSettingsActivity.java index 3aaac4bf7..6b73b38af 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/QuickRepliesSettingsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/QuickRepliesSettingsActivity.java @@ -138,7 +138,7 @@ public class QuickRepliesSettingsActivity extends BaseFragment { switch (holder.getItemViewType()) { case 0: { TextInfoPrivacyCell cell = (TextInfoPrivacyCell) holder.itemView; - cell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + cell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); cell.setText(LocaleController.getString("VoipQuickRepliesExplain", R.string.VoipQuickRepliesExplain)); break; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ReactionsDoubleTapManageActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ReactionsDoubleTapManageActivity.java index 09204ef3f..e8d03d435 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ReactionsDoubleTapManageActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ReactionsDoubleTapManageActivity.java @@ -107,7 +107,7 @@ public class ReactionsDoubleTapManageActivity extends BaseFragment implements No case 2: TextInfoPrivacyCell cell = new TextInfoPrivacyCell(context); cell.setText(LocaleController.getString("DoubleTapPreviewRational", R.string.DoubleTapPreviewRational)); - cell.setBackground(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + cell.setBackground(Theme.getThemedDrawableByKey(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); view = cell; break; case 3: @@ -125,7 +125,7 @@ public class ReactionsDoubleTapManageActivity extends BaseFragment implements No ); } }; - view.setBackground(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + view.setBackground(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); break; default: case 1: { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/RestrictedLanguagesSelectActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/RestrictedLanguagesSelectActivity.java index 114d5979f..4a504dcd3 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/RestrictedLanguagesSelectActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/RestrictedLanguagesSelectActivity.java @@ -27,7 +27,6 @@ import com.google.common.collect.Sets; import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.ApplicationLoader; -import org.telegram.messenger.BotWebViewVibrationEffect; import org.telegram.messenger.FileLog; import org.telegram.messenger.LocaleController; import org.telegram.messenger.MessagesController; @@ -51,15 +50,10 @@ import org.telegram.ui.Components.LayoutHelper; import org.telegram.ui.Components.RecyclerListView; import org.telegram.ui.Components.TranslateAlert2; -import java.io.BufferedReader; -import java.io.InputStreamReader; import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Set; -import java.util.Timer; public class RestrictedLanguagesSelectActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate { @@ -481,7 +475,7 @@ public class RestrictedLanguagesSelectActivity extends BaseFragment implements N } case 1: { ShadowSectionCell sectionCell = (ShadowSectionCell) holder.itemView; - sectionCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + sectionCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); break; } case 2: { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/SessionsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/SessionsActivity.java index c9ca3669a..3f3e42eba 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/SessionsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/SessionsActivity.java @@ -797,7 +797,7 @@ public class SessionsActivity extends BaseFragment implements NotificationCenter } else { privacyCell.setText(LocaleController.getString("ClearOtherWebSessionsHelp", R.string.ClearOtherWebSessionsHelp)); } - privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + privacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } else if (position == otherSessionsTerminateDetail) { if (currentType == 0) { if (sessions.isEmpty()) { @@ -808,16 +808,16 @@ public class SessionsActivity extends BaseFragment implements NotificationCenter } else { privacyCell.setText(LocaleController.getString("TerminateWebSessionInfo", R.string.TerminateWebSessionInfo)); } - privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + privacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } else if (position == passwordSessionsDetailRow) { privacyCell.setText(LocaleController.getString("LoginAttemptsInfo", R.string.LoginAttemptsInfo)); if (otherSessionsTerminateDetail == -1) { - privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + privacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else { - privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + privacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } } else if (position == qrCodeDividerRow || position == ttlDivideRow || position == noOtherSessionsRow) { - privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + privacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); privacyCell.setText(""); privacyCell.setFixedSize(12); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/StatisticActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/StatisticActivity.java index acb67ccd5..f2be15832 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/StatisticActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/StatisticActivity.java @@ -1916,7 +1916,7 @@ public class StatisticActivity extends BaseFragment implements NotificationCente if (child instanceof ChartCell) { ((ChartCell) child).recolor(); } else if (child instanceof ShadowSectionCell) { - Drawable shadowDrawable = Theme.getThemedDrawable(ApplicationLoader.applicationContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); + Drawable shadowDrawable = Theme.getThemedDrawableByKey(ApplicationLoader.applicationContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); Drawable background = new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray)); CombinedDrawable combinedDrawable = new CombinedDrawable(background, shadowDrawable, 0, 0); combinedDrawable.setFullsize(true); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/StickersActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/StickersActivity.java index 544fb193a..823c631a8 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/StickersActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/StickersActivity.java @@ -71,7 +71,6 @@ import org.telegram.ui.Components.Bulletin; import org.telegram.ui.Components.BulletinFactory; import org.telegram.ui.Components.CubicBezierInterpolator; import org.telegram.ui.Components.EmojiPacksAlert; -import org.telegram.ui.Components.EmojiView; import org.telegram.ui.Components.ItemOptions; import org.telegram.ui.Components.LayoutHelper; import org.telegram.ui.Components.NumberTextView; @@ -295,9 +294,7 @@ public class StickersActivity extends BaseFragment implements NotificationCenter selectedCountTextView.setOnTouchListener((v, event) -> true); shareMenuItem = actionMode.addItemWithWidth(MENU_SHARE, R.drawable.msg_share, AndroidUtilities.dp(54)); - if (currentType != MediaDataController.TYPE_EMOJIPACKS) { - archiveMenuItem = actionMode.addItemWithWidth(MENU_ARCHIVE, R.drawable.msg_archive, AndroidUtilities.dp(54)); - } + archiveMenuItem = actionMode.addItemWithWidth(MENU_ARCHIVE, R.drawable.msg_archive, AndroidUtilities.dp(54)); deleteMenuItem = actionMode.addItemWithWidth(MENU_DELETE, R.drawable.msg_delete, AndroidUtilities.dp(54)); ArrayList sets; @@ -656,14 +653,7 @@ public class StickersActivity extends BaseFragment implements NotificationCenter loopRow = -1; loopInfoRow = -1; - - if (currentType == MediaDataController.TYPE_EMOJIPACKS) { - suggestAnimatedEmojiRow = rowCount++; - suggestAnimatedEmojiInfoRow = rowCount++; - } else { - suggestAnimatedEmojiRow = -1; - suggestAnimatedEmojiInfoRow = -1; - } + archivedRow = -1; if (currentType == MediaDataController.TYPE_IMAGE) { featuredRow = rowCount++; @@ -682,7 +672,7 @@ public class StickersActivity extends BaseFragment implements NotificationCenter masksRow = -1; emojiPacksRow = -1; - if (mediaDataController.getArchivedStickersCount(currentType) != 0 && currentType != MediaDataController.TYPE_EMOJIPACKS) { + if (mediaDataController.getArchivedStickersCount(currentType) != 0) { boolean inserted = archivedRow == -1; archivedRow = rowCount++; @@ -704,6 +694,14 @@ public class StickersActivity extends BaseFragment implements NotificationCenter } } + if (currentType == MediaDataController.TYPE_EMOJIPACKS) { + suggestAnimatedEmojiRow = rowCount++; + suggestAnimatedEmojiInfoRow = rowCount++; + } else { + suggestAnimatedEmojiRow = -1; + suggestAnimatedEmojiInfoRow = -1; + } + if (currentType == MediaDataController.TYPE_IMAGE) { reactionsDoubleTapRow = rowCount++; } else { @@ -1206,7 +1204,7 @@ public class StickersActivity extends BaseFragment implements NotificationCenter } case TYPE_SHADOW: if (position == stickersShadowRow) { - holder.itemView.setBackground(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + holder.itemView.setBackground(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } break; case TYPE_SWITCH: @@ -1367,7 +1365,7 @@ public class StickersActivity extends BaseFragment implements NotificationCenter break; case TYPE_INFO: view = new TextInfoPrivacyCell(mContext); - view.setBackground(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + view.setBackground(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); break; case TYPE_TEXT_AND_VALUE: view = new TextCell(mContext); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ThemeActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ThemeActivity.java index 7fad5672b..d54ddc0bc 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ThemeActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ThemeActivity.java @@ -101,7 +101,6 @@ import java.io.FileOutputStream; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; -import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.concurrent.atomic.AtomicReference; @@ -1940,7 +1939,7 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No break; case TYPE_TEXT_INFO_PRIVACY: view = new TextInfoPrivacyCell(mContext); - view.setBackground(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + view.setBackground(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); break; case TYPE_SHADOW: view = new ShadowSectionCell(mContext); @@ -2244,9 +2243,9 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No } case TYPE_SHADOW: { if (position == nightTypeInfoRow && themeInfoRow == -1 || position == lastShadowRow || position == themeInfoRow && nightTypeInfoRow != -1 || position == saveToGallerySectionRow || position == settings2Row) { - holder.itemView.setBackground(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + holder.itemView.setBackground(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else { - holder.itemView.setBackground(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + holder.itemView.setBackground(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } break; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ThemeSetUrlActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ThemeSetUrlActivity.java index 7856c077d..4b931807b 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ThemeSetUrlActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ThemeSetUrlActivity.java @@ -322,7 +322,7 @@ public class ThemeSetUrlActivity extends BaseFragment implements NotificationCen } checkInfoCell = new TextInfoPrivacyCell(context); - checkInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + checkInfoCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); checkInfoCell.setVisibility(View.GONE); checkInfoCell.setBottomPadding(0); linearLayout.addView(checkInfoCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); @@ -338,7 +338,7 @@ public class ThemeSetUrlActivity extends BaseFragment implements NotificationCen linearLayout.addView(helpInfoCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); if (creatingNewTheme) { - helpInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + helpInfoCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); messagesCell = new ThemePreviewMessagesCell(context, parentLayout, 1); linearLayout.addView(messagesCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); @@ -386,10 +386,10 @@ public class ThemeSetUrlActivity extends BaseFragment implements NotificationCen createInfoCell = new TextInfoPrivacyCell(context); createInfoCell.setText(AndroidUtilities.replaceTags(LocaleController.getString("UseDifferentThemeInfo", R.string.UseDifferentThemeInfo))); - createInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + createInfoCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); linearLayout.addView(createInfoCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); } else { - helpInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + helpInfoCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } if (info != null) { @@ -534,9 +534,9 @@ public class ThemeSetUrlActivity extends BaseFragment implements NotificationCen if (TextUtils.isEmpty(text)) { checkInfoCell.setVisibility(View.GONE); if (creatingNewTheme) { - helpInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(getParentActivity(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); + helpInfoCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(getParentActivity(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } else { - helpInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(getParentActivity(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + helpInfoCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(getParentActivity(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } } else { checkInfoCell.setVisibility(View.VISIBLE); @@ -544,7 +544,7 @@ public class ThemeSetUrlActivity extends BaseFragment implements NotificationCen checkInfoCell.setTag(colorKey); checkInfoCell.setTextColorByKey(colorKey); if (creatingNewTheme) { - helpInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(getParentActivity(), R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow)); + helpInfoCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(getParentActivity(), R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow)); } else { helpInfoCell.setBackgroundDrawable(null); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/TooManyCommunitiesActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/TooManyCommunitiesActivity.java index 70e901c3f..a27d0cb85 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/TooManyCommunitiesActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/TooManyCommunitiesActivity.java @@ -464,7 +464,7 @@ public class TooManyCommunitiesActivity extends BaseFragment { break; case 2: view = new ShadowSectionCell(parent.getContext()); - Drawable drawable = Theme.getThemedDrawable(parent.getContext(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); + Drawable drawable = Theme.getThemedDrawableByKey(parent.getContext(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray)), drawable); combinedDrawable.setFullsize(true); view.setBackground(combinedDrawable); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/TopicCreateFragment.java b/TMessagesProj/src/main/java/org/telegram/ui/TopicCreateFragment.java index a5900e842..6c1bf20df 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/TopicCreateFragment.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/TopicCreateFragment.java @@ -486,7 +486,7 @@ public class TopicCreateFragment extends BaseFragment { TextInfoPrivacyCell infoCell = new TextInfoPrivacyCell(context); infoCell.setText(LocaleController.getString("EditTopicHideInfo", R.string.EditTopicHideInfo)); - infoCell.setBackground(Theme.getThemedDrawable(getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow, getResourceProvider())); + infoCell.setBackground(Theme.getThemedDrawableByKey(getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow, getResourceProvider())); emojiContainer.addView(infoCell, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP, 0, 8 + 50, 0, 0)); } linearLayout.addView(emojiContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/TwoStepVerificationActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/TwoStepVerificationActivity.java index c67a3ebb5..cfe11d56e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/TwoStepVerificationActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/TwoStepVerificationActivity.java @@ -1205,10 +1205,10 @@ public class TwoStepVerificationActivity extends BaseFragment implements Notific TextInfoPrivacyCell privacyCell = (TextInfoPrivacyCell) holder.itemView; if (position == setPasswordDetailRow) { privacyCell.setText(LocaleController.getString("SetAdditionalPasswordInfo", R.string.SetAdditionalPasswordInfo)); - privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + privacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (position == passwordEnabledDetailRow) { privacyCell.setText(LocaleController.getString("EnabledPasswordText", R.string.EnabledPasswordText)); - privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + privacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } break; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/WallpapersListActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/WallpapersListActivity.java index 46194f1ce..3b8751b6a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/WallpapersListActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/WallpapersListActivity.java @@ -1814,7 +1814,7 @@ public class WallpapersListActivity extends BaseFragment implements Notification } case 1: { view = new ShadowSectionCell(mContext); - Drawable drawable = Theme.getThemedDrawable(mContext, wallPaperStartRow == -1 ? R.drawable.greydivider_bottom : R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); + Drawable drawable = Theme.getThemedDrawableByKey(mContext, wallPaperStartRow == -1 ? R.drawable.greydivider_bottom : R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow); CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray)), drawable); combinedDrawable.setFullsize(true); view.setBackgroundDrawable(combinedDrawable); @@ -1822,7 +1822,7 @@ public class WallpapersListActivity extends BaseFragment implements Notification } case 3: { view = new TextInfoPrivacyCell(mContext); - Drawable drawable = Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow); + Drawable drawable = Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow); CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray)), drawable); combinedDrawable.setFullsize(true); view.setBackgroundDrawable(combinedDrawable); diff --git a/TMessagesProj/src/main/res/values/strings.xml b/TMessagesProj/src/main/res/values/strings.xml index 6ca730944..fae708a9b 100644 --- a/TMessagesProj/src/main/res/values/strings.xml +++ b/TMessagesProj/src/main/res/values/strings.xml @@ -1907,6 +1907,7 @@ No archived masks No archived emoji packs You can add up to 200 sticker sets.\nUnused sets are archived when you add more. + You can add up to 200 emoji packs.\nUnused packs are archived when you add more. You can have up to 200 sets of masks.\nUnused sets are archived when you add more. SEND STICKER Archived stickers @@ -6598,4 +6599,6 @@ Tap to view this theme in the day mode. Tap to view this theme in the night mode. Open App + Get Premium back with up to **%1$d%%** off + Your Telegram Premium has recently expired. Tap here to extend it. diff --git a/gradle.properties b/gradle.properties index 57fd92a1e..7e913ed7e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,8 +13,8 @@ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true #Sat Mar 12 05:53:50 MSK 2016 -APP_VERSION_CODE=3333 -APP_VERSION_NAME=9.6.1 +APP_VERSION_CODE=3341 +APP_VERSION_NAME=9.6.2 APP_PACKAGE=org.telegram.messenger RELEASE_KEY_PASSWORD=android RELEASE_KEY_ALIAS=androidkey