update to 9.2.1

This commit is contained in:
xaxtix 2022-12-07 19:13:09 +04:00
parent b73fc8de38
commit 03e899e4ec
63 changed files with 886 additions and 309 deletions

View file

@ -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 = 2956;
public static String BUILD_VERSION_STRING = "9.2.0";
public static int BUILD_VERSION = 2962;
public static String BUILD_VERSION_STRING = "9.2.1";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";

View file

@ -35,6 +35,7 @@ public class FileLoadOperation {
long streamOffset;
public static volatile DispatchQueue filesQueue = new DispatchQueue("writeFileQueue");
private boolean forceSmallChunk;
public void setStream(FileLoadOperationStream stream, boolean streamPriority, long streamOffset) {
this.stream = stream;
@ -48,6 +49,7 @@ public class FileLoadOperation {
private TLRPC.TL_upload_file response;
private TLRPC.TL_upload_webFile responseWeb;
private TLRPC.TL_upload_cdnFile responseCdn;
private boolean forceSmallChunk;
}
public static class Range {
@ -205,7 +207,7 @@ public class FileLoadOperation {
}
private void updateParams() {
if (MessagesController.getInstance(currentAccount).getfileExperimentalParams) {
if (MessagesController.getInstance(currentAccount).getfileExperimentalParams && !forceSmallChunk) {
downloadChunkSizeBig = 1024 * 512;
maxDownloadRequests = 8;
maxDownloadRequestsBig = 8;
@ -1756,7 +1758,14 @@ public class FileLoadOperation {
}
}
} else {
if (error.text.contains("FILE_MIGRATE_")) {
if (error.text.contains("LIMIT_INVALID") && !requestInfo.forceSmallChunk) {
if (!forceSmallChunk) {
forceSmallChunk = true;
currentDownloadChunkSize = 0;
pause();
start();
}
} else if (error.text.contains("FILE_MIGRATE_")) {
String errorMsg = error.text.replace("FILE_MIGRATE_", "");
Scanner scanner = new Scanner(errorMsg);
scanner.useDelimiter("");
@ -1993,6 +2002,7 @@ public class FileLoadOperation {
final RequestInfo requestInfo = new RequestInfo();
requestInfos.add(requestInfo);
requestInfo.offset = downloadOffset;
requestInfo.forceSmallChunk = forceSmallChunk;
if (!isPreloadVideoOperation && supportsPreloading && preloadStream != null && preloadedBytesRanges != null) {
PreloadRange range = preloadedBytesRanges.get(requestInfo.offset);
@ -2032,7 +2042,7 @@ public class FileLoadOperation {
continue;
}
}
requestInfo.forceSmallChunk = forceSmallChunk;
requestInfo.requestToken = ConnectionsManager.getInstance(currentAccount).sendRequest(request, (response, error) -> {
if (!requestInfos.contains(requestInfo)) {
return;

View file

@ -77,7 +77,7 @@ public class FileLog {
String requestSimpleName = request.getClass().getSimpleName();
checkGson();
if (excludeRequests.contains(requestSimpleName)) {
if (excludeRequests.contains(requestSimpleName) && error == null) {
return;
}
try {

View file

@ -478,12 +478,12 @@ public class LocaleController {
return currentLocaleInfo.isLocal();
}
public void reloadCurrentRemoteLocale(int currentAccount, String langCode, boolean force) {
public void reloadCurrentRemoteLocale(int currentAccount, String langCode, boolean force, Runnable onDone) {
if (langCode != null) {
langCode = langCode.replace("-", "_");
}
if (langCode == null || currentLocaleInfo != null && (langCode.equals(currentLocaleInfo.shortName) || langCode.equals(currentLocaleInfo.baseLangCode))) {
applyRemoteLanguage(currentLocaleInfo, langCode, force, currentAccount);
applyRemoteLanguage(currentLocaleInfo, langCode, force, currentAccount, onDone);
}
}
@ -493,11 +493,11 @@ public class LocaleController {
}
if (currentLocaleInfo.hasBaseLang()) {
if (currentLocaleInfo.baseVersion < baseVersion) {
applyRemoteLanguage(currentLocaleInfo, currentLocaleInfo.baseLangCode, false, currentAccount);
applyRemoteLanguage(currentLocaleInfo, currentLocaleInfo.baseLangCode, false, currentAccount, null);
}
}
if (currentLocaleInfo.version < version) {
applyRemoteLanguage(currentLocaleInfo, currentLocaleInfo.shortName, false, currentAccount);
applyRemoteLanguage(currentLocaleInfo, currentLocaleInfo.shortName, false, currentAccount, null);
}
}
@ -654,7 +654,7 @@ public class LocaleController {
saveOtherLanguages();
}
localeValues = stringMap;
applyLanguage(localeInfo, true, false, true, false, currentAccount);
applyLanguage(localeInfo, true, false, true, false, currentAccount, null);
return true;
}
} catch (Exception e) {
@ -848,14 +848,15 @@ public class LocaleController {
return new HashMap<>();
}
public void applyLanguage(LocaleInfo localeInfo, boolean override, boolean init, final int currentAccount) {
applyLanguage(localeInfo, override, init, false, false, currentAccount);
public int applyLanguage(LocaleInfo localeInfo, boolean override, boolean init, final int currentAccount) {
return applyLanguage(localeInfo, override, init, false, false, currentAccount, null);
}
public void applyLanguage(final LocaleInfo localeInfo, boolean override, boolean init, boolean fromFile, boolean force, final int currentAccount) {
public int applyLanguage(final LocaleInfo localeInfo, boolean override, boolean init, boolean fromFile, boolean force, final int currentAccount, Runnable onDone) {
if (localeInfo == null) {
return;
return 0;
}
int requestId = 0;
boolean hasBase = localeInfo.hasBaseLang();
File pathToFile = localeInfo.getPathToFile();
File pathToBaseFile = localeInfo.getPathToBaseFile();
@ -884,9 +885,9 @@ public class LocaleController {
}
isLoadingRemote = true;
if (init) {
AndroidUtilities.runOnUIThread(() -> applyRemoteLanguage(localeInfo, null, true, currentAccount));
AndroidUtilities.runOnUIThread(() -> applyRemoteLanguage(localeInfo, null, true, currentAccount, onDone));
} else {
applyRemoteLanguage(localeInfo, null, true, currentAccount);
requestId = applyRemoteLanguage(localeInfo, null, true, currentAccount, onDone);
}
}
try {
@ -943,9 +944,9 @@ public class LocaleController {
changingConfiguration = false;
if (reloadLastFile) {
if (init) {
AndroidUtilities.runOnUIThread(() -> reloadCurrentRemoteLocale(currentAccount, null, force));
AndroidUtilities.runOnUIThread(() -> reloadCurrentRemoteLocale(currentAccount, null, force, null));
} else {
reloadCurrentRemoteLocale(currentAccount, null, force);
reloadCurrentRemoteLocale(currentAccount, null, force, null);
}
reloadLastFile = false;
}
@ -955,6 +956,9 @@ public class LocaleController {
} else {
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.reloadInterface);
}
if (onDone != null) {
onDone.run();
}
}
} catch (Exception e) {
FileLog.e(e);
@ -964,6 +968,7 @@ public class LocaleController {
if (force) {
MediaDataController.getInstance(currentAccount).loadAttachMenuBots(false, true);
}
return requestId;
}
public LocaleInfo getCurrentLocaleInfo() {
@ -2053,10 +2058,10 @@ public class LocaleController {
if (!langCode.equals(currentLocaleInfo.shortName) && !langCode.equals(currentLocaleInfo.baseLangCode)) {
return;
}
saveRemoteLocaleStrings(currentLocaleInfo, difference, currentAccount);
saveRemoteLocaleStrings(currentLocaleInfo, difference, currentAccount, null);
}
public void saveRemoteLocaleStrings(LocaleInfo localeInfo, final TLRPC.TL_langPackDifference difference, int currentAccount) {
public void saveRemoteLocaleStrings(LocaleInfo localeInfo, final TLRPC.TL_langPackDifference difference, int currentAccount, Runnable onDone) {
if (difference == null || difference.strings.isEmpty() || localeInfo == null || localeInfo.isLocal()) {
return;
}
@ -2171,6 +2176,9 @@ public class LocaleController {
}
recreateFormatters();
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.reloadInterface);
if (onDone != null) {
onDone.run();
}
});
} catch (Exception ignore) {
@ -2256,9 +2264,9 @@ public class LocaleController {
}, ConnectionsManager.RequestFlagWithoutLogin);
}
private void applyRemoteLanguage(LocaleInfo localeInfo, String langCode, boolean force, final int currentAccount) {
private int applyRemoteLanguage(LocaleInfo localeInfo, String langCode, boolean force, final int currentAccount, Runnable onDone) {
if (localeInfo == null || !localeInfo.isRemote() && !localeInfo.isUnofficial()) {
return;
return 0;
}
if (localeInfo.hasBaseLang() && (langCode == null || langCode.equals(localeInfo.baseLangCode))) {
if (localeInfo.baseVersion != 0 && !force) {
@ -2267,18 +2275,18 @@ public class LocaleController {
req.from_version = localeInfo.baseVersion;
req.lang_code = localeInfo.getBaseLangCode();
req.lang_pack = "";
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
return ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
if (response != null) {
AndroidUtilities.runOnUIThread(() -> saveRemoteLocaleStrings(localeInfo, (TLRPC.TL_langPackDifference) response, currentAccount));
AndroidUtilities.runOnUIThread(() -> saveRemoteLocaleStrings(localeInfo, (TLRPC.TL_langPackDifference) response, currentAccount, onDone));
}
}, ConnectionsManager.RequestFlagWithoutLogin);
}
} else {
TLRPC.TL_langpack_getLangPack req = new TLRPC.TL_langpack_getLangPack();
req.lang_code = localeInfo.getBaseLangCode();
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (TLObject response, TLRPC.TL_error error) -> {
return ConnectionsManager.getInstance(currentAccount).sendRequest(req, (TLObject response, TLRPC.TL_error error) -> {
if (response != null) {
AndroidUtilities.runOnUIThread(() -> saveRemoteLocaleStrings(localeInfo, (TLRPC.TL_langPackDifference) response, currentAccount));
AndroidUtilities.runOnUIThread(() -> saveRemoteLocaleStrings(localeInfo, (TLRPC.TL_langPackDifference) response, currentAccount, onDone));
}
}, ConnectionsManager.RequestFlagWithoutLogin);
}
@ -2289,9 +2297,9 @@ public class LocaleController {
req.from_version = localeInfo.version;
req.lang_code = localeInfo.getLangCode();
req.lang_pack = "";
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
return ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
if (response != null) {
AndroidUtilities.runOnUIThread(() -> saveRemoteLocaleStrings(localeInfo, (TLRPC.TL_langPackDifference) response, currentAccount));
AndroidUtilities.runOnUIThread(() -> saveRemoteLocaleStrings(localeInfo, (TLRPC.TL_langPackDifference) response, currentAccount, onDone));
}
}, ConnectionsManager.RequestFlagWithoutLogin);
} else {
@ -2300,13 +2308,14 @@ public class LocaleController {
}
TLRPC.TL_langpack_getLangPack req = new TLRPC.TL_langpack_getLangPack();
req.lang_code = localeInfo.getLangCode();
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (TLObject response, TLRPC.TL_error error) -> {
return ConnectionsManager.getInstance(currentAccount).sendRequest(req, (TLObject response, TLRPC.TL_error error) -> {
if (response != null) {
AndroidUtilities.runOnUIThread(() -> saveRemoteLocaleStrings(localeInfo, (TLRPC.TL_langPackDifference) response, currentAccount));
AndroidUtilities.runOnUIThread(() -> saveRemoteLocaleStrings(localeInfo, (TLRPC.TL_langPackDifference) response, currentAccount, onDone));
}
}, ConnectionsManager.RequestFlagWithoutLogin);
}
}
return 0;
}
public String getTranslitString(String src) {

View file

@ -2320,6 +2320,15 @@ public class MessageObject {
);
messageText = replaceWithLink(messageText, "un2", pinTopic.new_topic);
}
} else if (event.action instanceof TLRPC.TL_channelAdminLogEventActionToggleAntiSpam) {
TLRPC.TL_channelAdminLogEventActionToggleAntiSpam action = (TLRPC.TL_channelAdminLogEventActionToggleAntiSpam) event.action;
messageText = replaceWithLink(
action.new_value ?
LocaleController.getString("EventLogEnabledAntiSpam", R.string.EventLogEnabledAntiSpam) :
LocaleController.getString("EventLogDisabledAntiSpam", R.string.EventLogDisabledAntiSpam),
"un1",
fromUser
);
} else {
messageText = "unsupported " + event.action;
}
@ -6180,7 +6189,7 @@ public class MessageObject {
for (int a = 0, N = document.attributes.size(); a < N; a++) {
TLRPC.DocumentAttribute attribute = document.attributes.get(a);
if (attribute instanceof TLRPC.TL_documentAttributeSticker ||
attribute instanceof TLRPC.TL_documentAttributeCustomEmoji) {
attribute instanceof TLRPC.TL_documentAttributeCustomEmoji) {
if (attribute.stickerset instanceof TLRPC.TL_inputStickerSetEmpty) {
return null;
}
@ -6201,7 +6210,7 @@ public class MessageObject {
for (int a = 0, N = document.attributes.size(); a < N; a++) {
TLRPC.DocumentAttribute attribute = document.attributes.get(a);
if (attribute instanceof TLRPC.TL_documentAttributeCustomEmoji ||
attribute instanceof TLRPC.TL_documentAttributeSticker) {
attribute instanceof TLRPC.TL_documentAttributeSticker) {
return attribute.alt;
}
}
@ -6234,6 +6243,23 @@ public class MessageObject {
return false;
}
public static boolean isTextColorEmoji(TLRPC.Document document) {
if (document == null) {
return false;
}
TLRPC.InputStickerSet set = MessageObject.getInputStickerSet(document);
for (int a = 0, N = document.attributes.size(); a < N; a++) {
TLRPC.DocumentAttribute attribute = document.attributes.get(a);
if (attribute instanceof TLRPC.TL_documentAttributeCustomEmoji) {
if (attribute.stickerset instanceof TLRPC.TL_inputStickerSetID && attribute.stickerset.id == 1269403972611866647L) {
return true;
}
return ((TLRPC.TL_documentAttributeCustomEmoji) attribute).text_color;
}
}
return false;
}
public static boolean isPremiumEmojiPack(TLRPC.TL_messages_stickerSet set) {
if (set != null && set.set != null && !set.set.emojis) {
return false;
@ -7375,7 +7401,7 @@ public class MessageObject {
}
int maxReactionsCount = MessagesController.getInstance(currentAccount).getMaxUserReactionsCount();
if (!choosenReactions.isEmpty() && (choosenReactions.contains(newReaction) || fromDoubleTap)) {
if (!choosenReactions.isEmpty() && choosenReactions.contains(newReaction)) {
if (newReaction != null) {
newReaction.chosen = false;
newReaction.count--;

View file

@ -182,13 +182,13 @@ public class MessagesController extends BaseController implements NotificationCe
private LongSparseArray<TLRPC.ChatFull> fullChats = new LongSparseArray<>();
private LongSparseArray<ChatObject.Call> groupCalls = new LongSparseArray<>();
private LongSparseArray<ChatObject.Call> groupCallsByChatId = new LongSparseArray<>();
private ArrayList<Long> loadingFullUsers = new ArrayList<>();
private ArrayList<Long> loadedFullUsers = new ArrayList<>();
private ArrayList<Long> loadingFullChats = new ArrayList<>();
private ArrayList<Long> loadingGroupCalls = new ArrayList<>();
private ArrayList<Long> loadingFullParticipants = new ArrayList<>();
private ArrayList<Long> loadedFullParticipants = new ArrayList<>();
private ArrayList<Long> loadedFullChats = new ArrayList<>();
private HashSet<Long> loadingFullUsers = new HashSet<>();
private LongSparseLongArray loadedFullUsers = new LongSparseLongArray();
private HashSet<Long> loadingFullChats = new HashSet<>();
private HashSet<Long> loadingGroupCalls = new HashSet<>();
private HashSet<Long> loadingFullParticipants = new HashSet<>();
private HashSet<Long> loadedFullParticipants = new HashSet<>();
public LongSparseLongArray loadedFullChats = new LongSparseLongArray();
private LongSparseArray<LongSparseArray<TLRPC.ChannelParticipant>> channelAdmins = new LongSparseArray<>();
private LongSparseIntArray loadingChannelAdmins = new LongSparseIntArray();
@ -3955,7 +3955,7 @@ public class MessagesController extends BaseController implements NotificationCe
if (!fromCache) {
if (oldChat != null) {
if (chat.version != oldChat.version) {
loadedFullChats.remove(chat.id);
loadedFullChats.delete(chat.id);
}
if (oldChat.participants_count != 0 && chat.participants_count == 0) {
chat.participants_count = oldChat.participants_count;
@ -4328,10 +4328,11 @@ public class MessagesController extends BaseController implements NotificationCe
}
public void loadFullChat(long chatId, int classGuid, boolean force) {
boolean loaded = loadedFullChats.contains(chatId);
// if (loadingFullChats.contains(chatId) || !force && loaded) {
// return;
// }
long lastLoadedTime = loadedFullChats.get(chatId, 0);
boolean loaded = lastLoadedTime > 0;
if (loadingFullChats.contains(chatId) || !force && loaded) {
return;
}
loadingFullChats.add(chatId);
TLObject request;
long dialogId = -chatId;
@ -4413,7 +4414,7 @@ public class MessagesController extends BaseController implements NotificationCe
}
exportedChats.put(chatId, res.full_chat.exported_invite);
loadingFullChats.remove(chatId);
loadedFullChats.add(chatId);
loadedFullChats.put(chatId, System.currentTimeMillis());
putUsers(res.users, false);
putChats(res.chats, false);
@ -4450,7 +4451,7 @@ public class MessagesController extends BaseController implements NotificationCe
}
public void loadFullUser(final TLRPC.User user, int classGuid, boolean force) {
if (user == null || loadingFullUsers.contains(user.id) || !force && loadedFullUsers.contains(user.id)) {
if (user == null || loadingFullUsers.contains(user.id) || !force && loadedFullUsers.get(user.id) > 0) {
return;
}
loadingFullUsers.add(user.id);
@ -4491,7 +4492,7 @@ public class MessagesController extends BaseController implements NotificationCe
}
fullUsers.put(user.id, userFull);
loadingFullUsers.remove(user.id);
loadedFullUsers.add(user.id);
loadedFullUsers.put(user.id, System.currentTimeMillis());
String names = user.first_name + user.last_name + UserObject.getPublicUsername(user);
ArrayList<TLRPC.User> users = new ArrayList<>();
users.add(userFull.user);
@ -6302,7 +6303,10 @@ public class MessagesController extends BaseController implements NotificationCe
public void processChatInfo(long chatId, TLRPC.ChatFull info, ArrayList<TLRPC.User> usersArr, boolean fromCache, boolean force, boolean byChannelUsers, ArrayList<Integer> pinnedMessages, HashMap<Integer, MessageObject> pinnedMessagesMap, int totalPinnedCount, boolean pinnedEndReached) {
AndroidUtilities.runOnUIThread(() -> {
if (fromCache && chatId > 0 && !byChannelUsers) {
loadFullChat(chatId, 0, force);
long lastLoadedTime = loadedFullChats.get(chatId, 0);
if (System.currentTimeMillis() - lastLoadedTime > 60 * 1000) {
loadFullChat(chatId, 0, force);
}
}
if (info != null) {
if (fullChats.get(chatId) == null) {
@ -6341,7 +6345,10 @@ public class MessagesController extends BaseController implements NotificationCe
public void processUserInfo(TLRPC.User user, TLRPC.UserFull info, boolean fromCache, boolean force, int classGuid, ArrayList<Integer> pinnedMessages, HashMap<Integer, MessageObject> pinnedMessagesMap, int totalPinnedCount, boolean pinnedEndReached) {
AndroidUtilities.runOnUIThread(() -> {
if (fromCache) {
loadFullUser(user, classGuid, force);
long lastLoadedTime = loadedFullUsers.get(user.id, 0);
if (System.currentTimeMillis() - lastLoadedTime > 60 * 1000) {
loadFullUser(user, classGuid, force);
}
}
if (info != null) {
if (fullUsers.get(user.id) == null) {
@ -14324,7 +14331,7 @@ public class MessagesController extends BaseController implements NotificationCe
AndroidUtilities.runOnUIThread(() -> LocaleController.getInstance().saveRemoteLocaleStringsForCurrentLocale(update.difference, currentAccount));
} else if (baseUpdate instanceof TLRPC.TL_updateLangPackTooLong) {
TLRPC.TL_updateLangPackTooLong update = (TLRPC.TL_updateLangPackTooLong) baseUpdate;
LocaleController.getInstance().reloadCurrentRemoteLocale(currentAccount, update.lang_code, false);
LocaleController.getInstance().reloadCurrentRemoteLocale(currentAccount, update.lang_code, false, null);
} else if (baseUpdate instanceof TLRPC.TL_updateRecentReactions) {
if (updatesOnMainThread == null) {
updatesOnMainThread = new ArrayList<>();
@ -14456,7 +14463,7 @@ public class MessagesController extends BaseController implements NotificationCe
topicsReadInbox = new HashMap<>();
}
MessagesStorage.TopicKey topicKey = MessagesStorage.TopicKey.of(-update.channel_id, update.top_msg_id);
topicsReadInbox.put(MessagesStorage.TopicKey.of(-update.channel_id, update.top_msg_id), Math.max(Utilities.getOrDefault(topicsReadInbox, topicKey, 0), update.read_max_id));
topicsReadInbox.put(topicKey, Math.max(Utilities.getOrDefault(topicsReadInbox, topicKey, 0), update.read_max_id));
if (updatesOnMainThread == null) {
updatesOnMainThread = new ArrayList<>();
}

View file

@ -11060,6 +11060,7 @@ public class MessagesStorage extends BaseController {
forumTopic.icon_emoji_id = action.icon_emoji_id;
forumTopic.title = action.title;
forumTopic.closed = action.closed;
forumTopic.hidden = action.hidden;
int flags = 0;
if ((action.flags & 1) != 0) {
flags += TopicsController.TOPIC_FLAG_TITLE;
@ -11070,6 +11071,9 @@ public class MessagesStorage extends BaseController {
if ((action.flags & 4) != 0) {
flags += TopicsController.TOPIC_FLAG_CLOSE;
}
if ((action.flags & 8) != 0) {
flags += TopicsController.TOPIC_FLAG_HIDE;
}
updateTopicData(dialogId, forumTopic, flags);
int finalFlags = flags;
AndroidUtilities.runOnUIThread(() -> {

View file

@ -1877,10 +1877,12 @@ public class TLRPC {
public static int constructor = 0xfd149899;
public boolean free;
public boolean text_color;
public void readParams(AbstractSerializedData stream, boolean exception) {
flags = stream.readInt32(exception);
free = (flags & 1) != 0;
text_color = (flags & 2) != 0;
alt = stream.readString(exception);
stickerset = InputStickerSet.TLdeserialize(stream, stream.readInt32(exception), exception);
}
@ -1888,6 +1890,7 @@ public class TLRPC {
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
flags = free ? (flags | 1) : (flags &~ 1);
flags = text_color ? (flags | 2) : (flags &~ 2);
stream.writeInt32(flags);
stream.writeString(alt);
stickerset.serializeToStream(stream);
@ -41030,6 +41033,9 @@ public class TLRPC {
case 0xae168909:
result = new TL_channelAdminLogEventActionDeleteTopic();
break;
case 0x64f36dfc:
result = new TL_channelAdminLogEventActionToggleAntiSpam();
break;
}
if (result == null && exception) {
throw new RuntimeException(String.format("can't parse magic %x in ChannelAdminLogEventAction", constructor));
@ -41774,6 +41780,21 @@ public class TLRPC {
}
}
public static class TL_channelAdminLogEventActionToggleAntiSpam extends ChannelAdminLogEventAction {
public static int constructor = 0x64f36dfc;
public boolean new_value;
public void readParams(AbstractSerializedData stream, boolean exception) {
new_value = stream.readBool(exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeBool(new_value);
}
}
public static abstract class InputWebFileLocation extends TLObject {
public static InputWebFileLocation TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {

View file

@ -37,6 +37,7 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewPropertyAnimator;
import android.view.animation.Interpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
@ -1621,6 +1622,10 @@ public class ActionBar extends FrameLayout {
}
public void setTitleAnimated(CharSequence title, boolean fromBottom, long duration) {
setTitleAnimated(title, fromBottom, duration, null);
}
public void setTitleAnimated(CharSequence title, boolean fromBottom, long duration, Interpolator interpolator) {
if (titleTextView[0] == null || title == null) {
setTitle(title);
return;
@ -1648,13 +1653,20 @@ public class ActionBar extends FrameLayout {
if (!crossfade) {
titleTextView[0].setTranslationY(fromBottom ? AndroidUtilities.dp(20) : -AndroidUtilities.dp(20));
}
titleTextView[0].animate().alpha(1f).translationY(0).setDuration(duration).start();
ViewPropertyAnimator a1 = titleTextView[0].animate().alpha(1f).translationY(0).setDuration(duration);
if (interpolator != null) {
a1.setInterpolator(interpolator);
}
a1.start();
titleAnimationRunning = true;
ViewPropertyAnimator a = titleTextView[1].animate().alpha(0);
if (!crossfade) {
a.translationY(fromBottom ? -AndroidUtilities.dp(20) : AndroidUtilities.dp(20));
}
if (interpolator != null) {
a.setInterpolator(interpolator);
}
a.setDuration(duration).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {

View file

@ -3059,6 +3059,7 @@ public class Theme {
public static MessageDrawable chat_msgOutMediaDrawable;
public static MessageDrawable chat_msgOutMediaSelectedDrawable;
private static StatusDrawable[] chat_status_drawables = new StatusDrawable[6];
public static PorterDuffColorFilter chat_animatedEmojiTextColorFilter;
public static PathAnimator playPauseAnimator;
public static Drawable chat_msgOutCheckDrawable;
@ -8896,6 +8897,8 @@ public class Theme {
dialogs_unarchiveDrawable.setLayerColor("Box1.**", getNonAnimatedColor(key_chats_archiveIcon));
dialogs_unarchiveDrawable.commitApplyLayerColors();
chat_animatedEmojiTextColorFilter = new PorterDuffColorFilter(getColor(key_windowBackgroundWhiteBlackText), PorterDuff.Mode.SRC_IN);
PremiumGradient.getInstance().checkIconColors();
}

View file

@ -287,7 +287,7 @@ public class DialogsAdapter extends RecyclerListView.SelectionAdapter implements
if (itemInternals.get(i).dialog != null) {
return itemInternals.get(i).dialog;
} else if (itemInternals.get(i).contact != null) {
return itemInternals.get(i).contact;
return MessagesController.getInstance(currentAccount).getUser(itemInternals.get(i).contact.user_id);
} else if (itemInternals.get(i).recentMeUrl != null) {
return itemInternals.get(i).recentMeUrl;
}
@ -731,8 +731,7 @@ public class DialogsAdapter extends RecyclerListView.SelectionAdapter implements
}
case VIEW_TYPE_USER: {
UserCell cell = (UserCell) holder.itemView;
TLRPC.TL_contact contact = (TLRPC.TL_contact) getItem(i);
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(contact.user_id);
TLRPC.User user = (TLRPC.User) getItem(i);
cell.setData(user, null, null, 0);
break;
}
@ -803,27 +802,28 @@ public class DialogsAdapter extends RecyclerListView.SelectionAdapter implements
return itemInternals.get(i).viewType;
}
public void moveDialogs(RecyclerListView recyclerView, int fromPosition, int toPosition) {
ArrayList<TLRPC.Dialog> dialogs = parentFragment.getDialogsArray(currentAccount, dialogsType, folderId, false);
int fromIndex = fixPosition(fromPosition);
int toIndex = fixPosition(toPosition);
TLRPC.Dialog fromDialog = dialogs.get(fromIndex);
TLRPC.Dialog toDialog = dialogs.get(toIndex);
if (dialogsType == 7 || dialogsType == 8) {
MessagesController.DialogFilter filter = MessagesController.getInstance(currentAccount).selectedDialogFilter[dialogsType == 8 ? 1 : 0];
int idx1 = filter.pinnedDialogs.get(fromDialog.id);
int idx2 = filter.pinnedDialogs.get(toDialog.id);
filter.pinnedDialogs.put(fromDialog.id, idx2);
filter.pinnedDialogs.put(toDialog.id, idx1);
} else {
int oldNum = fromDialog.pinnedNum;
fromDialog.pinnedNum = toDialog.pinnedNum;
toDialog.pinnedNum = oldNum;
}
Collections.swap(dialogs, fromIndex, toIndex);
updateList(recyclerView);
}
@Override
public void notifyItemMoved(int fromPosition, int toPosition) {
if (!fromDiffUtils) {
ArrayList<TLRPC.Dialog> dialogs = parentFragment.getDialogsArray(currentAccount, dialogsType, folderId, false);
int fromIndex = fixPosition(fromPosition);
int toIndex = fixPosition(toPosition);
TLRPC.Dialog fromDialog = dialogs.get(fromIndex);
TLRPC.Dialog toDialog = dialogs.get(toIndex);
if (dialogsType == 7 || dialogsType == 8) {
MessagesController.DialogFilter filter = MessagesController.getInstance(currentAccount).selectedDialogFilter[dialogsType == 8 ? 1 : 0];
int idx1 = filter.pinnedDialogs.get(fromDialog.id);
int idx2 = filter.pinnedDialogs.get(toDialog.id);
filter.pinnedDialogs.put(fromDialog.id, idx2);
filter.pinnedDialogs.put(toDialog.id, idx1);
} else {
int oldNum = fromDialog.pinnedNum;
fromDialog.pinnedNum = toDialog.pinnedNum;
toDialog.pinnedNum = oldNum;
}
Collections.swap(dialogs, fromIndex, toIndex);
}
super.notifyItemMoved(fromPosition, toPosition);
}

View file

@ -697,6 +697,7 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
while (filtered2RecentSearchObjects.size() > 0) {
RecentSearchObject obj = filtered2RecentSearchObjects.remove(0);
recentSearchObjects.remove(obj);
filteredRecentSearchObjects.remove(obj);
recentSearchObjectsById.remove(obj.did);
if (queryFilter == null) {
queryFilter = new StringBuilder("did IN (");
@ -712,6 +713,7 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
}
} else {
filtered2RecentSearchObjects.clear();
filteredRecentSearchObjects.clear();
recentSearchObjects.clear();
recentSearchObjectsById.clear();
queryFilter = new StringBuilder("1");
@ -735,6 +737,8 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
}
recentSearchObjectsById.remove(did);
recentSearchObjects.remove(object);
filtered2RecentSearchObjects.remove(object);
filteredRecentSearchObjects.remove(object);
notifyDataSetChanged();
MessagesStorage.getInstance(currentAccount).getStorageQueue().postRunnable(() -> {
try {

View file

@ -313,7 +313,7 @@ public class CacheControlActivity extends BaseFragment implements NotificationCe
i--;
}
}
Collections.sort(entities, (o1, o2) -> (int) (o2.totalSize - o1.totalSize));
sort(entities);
AndroidUtilities.runOnUIThread(() -> {
loadingDialogs = false;
getMessagesController().putUsers(users, true);
@ -333,7 +333,7 @@ public class CacheControlActivity extends BaseFragment implements NotificationCe
unknownChatsEntity = dialogEntities;
}
if (changed) {
Collections.sort(entities, (o1, o2) -> (int) (o2.totalSize - o1.totalSize));
sort(entities);
}
}
}
@ -346,6 +346,17 @@ public class CacheControlActivity extends BaseFragment implements NotificationCe
});
}
private void sort(ArrayList<DialogFileEntities> entities) {
Collections.sort(entities, (o1, o2) -> {
if (o2.totalSize > o1.totalSize) {
return 1;
} else if (o2.totalSize < o1.totalSize) {
return -1;
}
return 0;
});
}
ArrayList<DialogFileEntities> dialogsFilesEntities = null;
@ -1569,6 +1580,6 @@ public class CacheControlActivity extends BaseFragment implements NotificationCe
selectedDialogsCountTextView.setOnTouchListener((v, event) -> true);
ActionBarMenuItem deleteItem = actionMode.addItemWithWidth(delete_id, R.drawable.msg_delete, AndroidUtilities.dp(54), LocaleController.getString("ClearCache", R.string.ClearCache));
ActionBarMenuItem deleteItem = actionMode.addItemWithWidth(delete_id, R.drawable.msg_clear, AndroidUtilities.dp(54), LocaleController.getString("ClearCache", R.string.ClearCache));
}
}

View file

@ -6241,6 +6241,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
if (messageObject.isAnimatedAnimatedEmoji()) {
photoWidth = Math.max(512, photoWidth);
photoHeight = Math.max(512, photoHeight);
if (MessageObject.isTextColorEmoji(messageObject.getDocument())) {
photoImage.setColorFilter(Theme.chat_animatedEmojiTextColorFilter);
}
}
float maxHeight;
int maxWidth;
@ -11934,9 +11937,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
drawTopic = false;
if (!isThreadChat && (delegate != null && delegate.shouldShowTopicButton()) && !pinnedTop && (MessageObject.getTopicId(messageObject.messageOwner, ChatObject.isForum(currentChat)) != 0 || messageObject.replyToForumTopic != null)) {
if (!isThreadChat && (delegate != null && delegate.shouldShowTopicButton()) && !pinnedTop && (MessageObject.getTopicId(messageObject.messageOwner, true) != 0 || messageObject.replyToForumTopic != null)) {
if (currentPosition == null || currentPosition.minY == 0) {
int topicId = messageObject.replyToForumTopic == null ? MessageObject.getTopicId(messageObject.messageOwner, ChatObject.isForum(currentChat)) : messageObject.replyToForumTopic.id;
int topicId = messageObject.replyToForumTopic == null ? MessageObject.getTopicId(messageObject.messageOwner, true) : messageObject.replyToForumTopic.id;
TLRPC.TL_forumTopic topic = messageObject.replyToForumTopic == null ? MessagesController.getInstance(currentAccount).getTopicsController().findTopic(-messageObject.getDialogId(), topicId) : messageObject.replyToForumTopic;
if (topic != null) {
drawTopic = true;
@ -13965,6 +13968,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
x -= AndroidUtilities.dp(2.33f);
y = AndroidUtilities.dp(12) + (drawNameLayout && nameLayout != null ? AndroidUtilities.dp(6) + (int) Theme.chat_namePaint.getTextSize() : 0);
}
if (transitionParams.animateBackgroundBoundsInner) {
x += transitionParams.deltaLeft;
}
topicButton.draw(canvas, x, y, animatingAlpha * replyForwardAlpha);
}

View file

@ -2070,6 +2070,7 @@ public class DialogCell extends BaseCell {
if (useForceThreeLines || SharedConfig.useThreeLinesLayout) {
typingLayout = StaticLayoutEx.createStaticLayout(typingString, Theme.dialogs_messagePrintingPaint[paintIndex], messageWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, AndroidUtilities.dp(1), false, TextUtils.TruncateAt.END, messageWidth, typingString != null ? 1 : 2);
} else {
typingString = TextUtils.ellipsize(typingString, currentMessagePaint, messageWidth - AndroidUtilities.dp(12), TextUtils.TruncateAt.END);
typingLayout = new StaticLayout(typingString, Theme.dialogs_messagePrintingPaint[paintIndex], messageWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
}
}
@ -2318,7 +2319,7 @@ public class DialogCell extends BaseCell {
}
if (boldLen > 0) {
spannableStringBuilder.setSpan(
new TypefaceSpan(AndroidUtilities.getTypeface("fonts/rmedium.ttf"), 0, Theme.getColor(Theme.key_chats_name, resourcesProvider)),
new TypefaceSpan(AndroidUtilities.getTypeface("fonts/rmedium.ttf"), 0, Theme.key_chats_name, null),
0, Math.min(spannableStringBuilder.length(), boldLen + 2), 0
);
}
@ -4717,7 +4718,9 @@ public class DialogCell extends BaseCell {
}
int messageHash = message == null ? 0 : message.getId();
Integer printingType = null;
long readHash = dialog.read_inbox_max_id + ((long) dialog.read_outbox_max_id << 8) + ((long) dialog.unread_count << 16);
long readHash = dialog.read_inbox_max_id + ((long) dialog.read_outbox_max_id << 8) + ((long) (dialog.unread_count + (dialog.unread_mark ? -1 : 0)) << 16) +
(dialog.unread_reactions_count > 0 ? (1 << 18) : 0) +
(dialog.unread_mentions_count > 0 ? (1 << 19) : 0);
if (!isForumCell() && (isDialogCell || isTopic)) {
if (!TextUtils.isEmpty(MessagesController.getInstance(currentAccount).getPrintingString(currentDialogId, getTopicId(), true))) {
printingType = MessagesController.getInstance(currentAccount).getPrintingStringType(currentDialogId, getTopicId());

View file

@ -401,12 +401,13 @@ public class DrawerProfileCell extends FrameLayout implements NotificationCenter
public void setColor(int color) {
this.color = color;
final ColorFilter colorFilter = new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY);
final ColorFilter colorFilterEmoji = new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN);
for (int i = 0; i < animations.size(); ++i) {
Object animation = animations.get(i);
if (animation instanceof ImageReceiver) {
((ImageReceiver) animation).setColorFilter(colorFilter);
} else if (animation instanceof AnimatedEmojiEffect) {
((AnimatedEmojiEffect) animation).animatedEmojiDrawable.setColorFilter(colorFilter);
((AnimatedEmojiEffect) animation).animatedEmojiDrawable.setColorFilter(colorFilterEmoji);
}
}
}

View file

@ -123,6 +123,7 @@ public class HeaderCell extends FrameLayout {
}
public void setText(CharSequence text) {
textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
textView.setText(text);
}

View file

@ -432,7 +432,8 @@ public class SessionCell extends FrameLayout {
}
}
if (needDivider) {
canvas.drawLine(LocaleController.isRTL ? 0 : AndroidUtilities.dp(20), getMeasuredHeight() - 1, getMeasuredWidth() - (LocaleController.isRTL ? AndroidUtilities.dp(20) : 0), getMeasuredHeight() - 1, Theme.dividerPaint);
int margin = currentType == 1 ? 49 : 21;
canvas.drawLine(LocaleController.isRTL ? 0 : AndroidUtilities.dp(margin), getMeasuredHeight() - 1, getMeasuredWidth() - (LocaleController.isRTL ? AndroidUtilities.dp(margin) : 0), getMeasuredHeight() - 1, Theme.dividerPaint);
}
}

View file

@ -143,6 +143,7 @@ public class StickerEmojiCell extends FrameLayout implements NotificationCenter.
currentEmoji = emoji;
isPremiumSticker = MessageObject.isPremiumSticker(document);
drawInParentView = false;
imageView.setColorFilter(null);
if (isPremiumSticker) {
premiumIconView.setColor(Theme.getColor(Theme.key_windowBackgroundWhite));
premiumIconView.setWaitingImage();
@ -167,6 +168,9 @@ public class StickerEmojiCell extends FrameLayout implements NotificationCenter.
TLRPC.PhotoSize thumb = FileLoader.getClosestPhotoSizeWithSize(document.thumbs, 90);
SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(document, fromEmojiPanel ? Theme.key_emptyListPlaceholder : Theme.key_windowBackgroundGray, fromEmojiPanel ? 0.2f : 1.0f);
String imageFilter = fromEmojiPanel ? "66_66_pcache_compress" : "66_66";
if (MessageObject.isTextColorEmoji(document)) {
imageView.setColorFilter(Theme.chat_animatedEmojiTextColorFilter);
}
if (MessageObject.canAutoplayAnimatedSticker(document)) {
if (fromEmojiPanel) {
drawInParentView = true;

View file

@ -304,6 +304,7 @@ public class StickerSetCell extends FrameLayout {
emojis = set.set.emojis;
sideButtons.setVisibility(emojis ? View.VISIBLE : View.GONE);
optionsButton.setVisibility(emojis ? View.GONE : View.VISIBLE);
imageView.setColorFilter(null);
ArrayList<TLRPC.Document> documents = set.documents;
if (documents != null && !documents.isEmpty()) {
@ -341,6 +342,9 @@ public class StickerSetCell extends FrameLayout {
} else {
imageView.setImage(ImageLocation.getForDocument(sticker), "50_50", imageLocation, null, 0, set);
}
if (MessageObject.isTextColorEmoji(sticker)) {
imageView.setColorFilter(Theme.chat_animatedEmojiTextColorFilter);
}
} else if (imageLocation != null && imageLocation.imageType == FileLoader.IMAGE_TYPE_LOTTIE) {
imageView.setImage(imageLocation, "50_50", "tgs", svgThumb, set);
} else {

View file

@ -51,6 +51,7 @@ public class TextCheckCell extends FrameLayout {
private float lastTouchX;
private ObjectAnimator animator;
private boolean drawCheckRipple;
private int padding;
private Theme.ResourcesProvider resourcesProvider;
public static final Property<TextCheckCell, Float> ANIMATION_PROGRESS = new AnimationProperties.FloatProperty<TextCheckCell>("animationProgress") {
@ -86,6 +87,8 @@ public class TextCheckCell extends FrameLayout {
super(context);
this.resourcesProvider = resourcesProvider;
this.padding = padding;
textView = new TextView(context);
textView.setTextColor(Theme.getColor(dialog ? Theme.key_dialogTextBlack : Theme.key_windowBackgroundWhiteBlackText, resourcesProvider));
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
@ -153,6 +156,19 @@ public class TextCheckCell extends FrameLayout {
setWillNotDraw(!divider);
}
public void updateRTL() {
textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
removeView(textView);
addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 70 : padding, 0, LocaleController.isRTL ? padding : 70, 0));
valueTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
removeView(valueTextView);
addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 64 : padding, 36, LocaleController.isRTL ? padding : 64, 0));
removeView(checkBox);
addView(checkBox, LayoutHelper.createFrame(37, 20, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, 22, 0, 22, 0));
}
public void setColors(String key, String switchKey, String switchKeyChecked, String switchThumb, String switchThumbChecked) {
textView.setTextColor(Theme.getColor(key, resourcesProvider));
checkBox.setColors(switchKey, switchKeyChecked, switchThumb, switchThumbChecked);

View file

@ -354,4 +354,20 @@ public class TextSettingsCell extends FrameLayout {
((AnimatedEmojiDrawable) valueBackupImageView.getImageReceiver().getDrawable()).removeView(this);
}
}
public void updateRTL() {
textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
removeView(textView);
addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, padding, 0, padding, 0));
valueTextView.setGravity((LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL);
removeView(valueTextView);
addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP, padding, 0, padding, 0));
removeView(imageView);
addView(imageView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL, 21, 0, 21, 0));
removeView(valueImageView);
addView(valueImageView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, padding, 0, padding, 0));
}
}

View file

@ -1182,7 +1182,7 @@ public class ChannelAdminLogActivity extends BaseFragment implements Notificatio
final ArrayList<Integer> options = new ArrayList<>();
final ArrayList<Integer> icons = new ArrayList<>();
if (message.currentEvent != null && message.currentEvent.action instanceof TLRPC.TL_channelAdminLogEventActionDeleteMessage && message.currentEvent.user_id == getMessagesController().telegramAntispamUserId) {
if (message.currentEvent != null && (message.currentEvent.action instanceof TLRPC.TL_channelAdminLogEventActionDeleteMessage && message.currentEvent.user_id == getMessagesController().telegramAntispamUserId || message.currentEvent.action instanceof TLRPC.TL_channelAdminLogEventActionToggleAntiSpam)) {
if (v instanceof ChatActionCell) {
SpannableString arrow = new SpannableString(">");
Drawable arrowDrawable = getContext().getResources().getDrawable(R.drawable.attach_arrow_right).mutate();

View file

@ -4638,10 +4638,17 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
slidingView = (ChatMessageCell) view;
MessageObject message = slidingView.getMessageObject();
boolean allowReplyOnOpenTopic = false;
if (message != null && ChatObject.isForum(currentChat)) {
TLRPC.TL_forumTopic topic = getMessagesController().getTopicsController().findTopic(currentChat.id, MessageObject.getTopicId(message.messageOwner, true));
if (topic != null) {
allowReplyOnOpenTopic = !topic.closed || ChatObject.canManageTopic(currentAccount, currentChat, topic);
}
}
if (chatMode != 0 || threadMessageObjects != null && threadMessageObjects.contains(message) ||
getMessageType(message) == 1 && (message.getDialogId() == mergeDialogId || message.needDrawBluredPreview()) ||
currentEncryptedChat == null && message.getId() < 0 ||
bottomOverlayChat != null && bottomOverlayChat.getVisibility() == View.VISIBLE && !(bottomOverlayChatWaitsReply && message != null && (MessageObject.getTopicId(message.messageOwner, ChatObject.isForum(currentChat)) != 0 || message.wasJustSent)) ||
bottomOverlayChat != null && bottomOverlayChat.getVisibility() == View.VISIBLE && !(bottomOverlayChatWaitsReply && allowReplyOnOpenTopic || message.wasJustSent) ||
currentChat != null && (ChatObject.isNotInChat(currentChat) && !isThreadChat() || ChatObject.isChannel(currentChat) && !ChatObject.canPost(currentChat) && !currentChat.megagroup || !ChatObject.canSendMessages(currentChat)) ||
textSelectionHelper.isSelectionMode()) {
slidingView.setSlidingOffset(0);
@ -4879,46 +4886,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
private boolean isSkeletonVisible() {
if (justCreatedTopic || justCreatedChat || currentUser != null || !SharedConfig.animationsEnabled()) {
return false;
}
int childHeight = 0;
int maxTop = Integer.MAX_VALUE;
for (int i = 0; i < getChildCount(); i++) {
childHeight += getChildAt(i).getHeight();
int top = getChildAt(i).getTop();
if (top < maxTop) {
maxTop = top;
}
}
if (maxTop <= chatListViewPaddingTop) {
checkDispatchHideSkeletons(fragmentBeginToShow);
}
boolean visible = (!endReached[0] || mergeDialogId != 0 && !endReached[1] || messages.isEmpty()) && loading && maxTop > chatListViewPaddingTop && (messages.isEmpty() ? animateProgressViewTo : childHeight != 0);
if (!visible && startMessageAppearTransitionMs == 0) {
checkDispatchHideSkeletons(fragmentBeginToShow);
}
if (SharedConfig.getDevicePerformanceClass() != SharedConfig.PERFORMANCE_CLASS_LOW && !fromPullingDownTransition && !fragmentBeginToShow) {
Drawable wallpaper = themeDelegate.getWallpaperDrawable();
if (fragmentView != null) {
wallpaper = ((SizeNotifierFrameLayout) fragmentView).getBackgroundImage();
}
if (wallpaper instanceof MotionBackgroundDrawable) {
MotionBackgroundDrawable motion = (MotionBackgroundDrawable) wallpaper;
if (((MotionBackgroundDrawable) wallpaper).isIndeterminateAnimation() != visible) {
motion.setIndeterminateAnimation(visible);
motion.setIndeterminateSpeedScale(visible ? 1.5f : 1f);
motion.updateAnimation(true);
} else if (visible) {
motion.updateAnimation(false);
}
}
}
return visible || startMessageAppearTransitionMs != 0 && System.currentTimeMillis() - startMessageAppearTransitionMs <= SKELETON_DISAPPEAR_MS;
}
@Override
public void draw(Canvas canvas) {
if ((startMessageAppearTransitionMs == 0 || System.currentTimeMillis() - startMessageAppearTransitionMs <= SKELETON_DISAPPEAR_MS) && !AndroidUtilities.isTablet() && !isComments && currentUser == null) {
@ -14273,7 +14240,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private void updateTopicTitleIcon() {
if (forumTopic != null && avatarContainer != null) {
avatarContainer.getAvatarImageView().setVisibility(View.VISIBLE);
ForumUtilities.setTopicIcon(avatarContainer.getAvatarImageView(), forumTopic, true, themeDelegate);
ForumUtilities.setTopicIcon(avatarContainer.getAvatarImageView(), forumTopic, true, true, themeDelegate);
}
}
@ -14823,6 +14790,47 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
currentPicturePath = args.getString("path");
}
private boolean isSkeletonVisible() {
if (justCreatedTopic || justCreatedChat || currentUser != null || !SharedConfig.animationsEnabled()) {
return false;
}
int childHeight = 0;
int maxTop = Integer.MAX_VALUE;
for (int i = 0; i < chatListView.getChildCount(); i++) {
childHeight += chatListView.getChildAt(i).getHeight();
int top = chatListView.getChildAt(i).getTop();
if (top < maxTop) {
maxTop = top;
}
}
if (maxTop <= chatListViewPaddingTop) {
checkDispatchHideSkeletons(fragmentBeginToShow);
}
boolean visible = (!endReached[0] || mergeDialogId != 0 && !endReached[1] || messages.isEmpty()) && loading && maxTop > chatListViewPaddingTop && (messages.isEmpty() ? animateProgressViewTo : childHeight != 0);
if (!visible && startMessageAppearTransitionMs == 0) {
checkDispatchHideSkeletons(fragmentBeginToShow);
}
if (SharedConfig.getDevicePerformanceClass() != SharedConfig.PERFORMANCE_CLASS_LOW && !fromPullingDownTransition && fragmentBeginToShow) {
boolean rotate = visible && startMessageAppearTransitionMs == 0;
Drawable wallpaper = themeDelegate.getWallpaperDrawable();
if (fragmentView != null) {
wallpaper = ((SizeNotifierFrameLayout) fragmentView).getBackgroundImage();
}
if (wallpaper instanceof MotionBackgroundDrawable) {
MotionBackgroundDrawable motion = (MotionBackgroundDrawable) wallpaper;
if (((MotionBackgroundDrawable) wallpaper).isIndeterminateAnimation() != rotate) {
motion.setIndeterminateAnimation(rotate);
motion.setIndeterminateSpeedScale(rotate ? 1.5f : 1f);
motion.updateAnimation(true);
} else if (rotate) {
motion.updateAnimation(false);
}
}
}
return visible || startMessageAppearTransitionMs != 0 && System.currentTimeMillis() - startMessageAppearTransitionMs <= SKELETON_DISAPPEAR_MS;
}
private void checkDispatchHideSkeletons(boolean animate) {
if (startMessageAppearTransitionMs == 0) {
if (animate && !messageSkeletons.isEmpty()) {
@ -14830,6 +14838,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} else {
startMessageAppearTransitionMs = 1;
}
isSkeletonVisible();
if (chatListView != null) {
chatListView.invalidate();
}
@ -18446,7 +18455,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
int lastAdIndex = -1;
for (int a = 0; a < arr.size(); a++) {
MessageObject obj = arr.get(a);
if (obj.scheduled != (chatMode == MODE_SCHEDULED) || threadMessageId != 0 && threadMessageId != obj.getReplyTopMsgId() && threadMessageId != obj.getReplyMsgId()) {
if (obj.scheduled != (chatMode == MODE_SCHEDULED) || threadMessageId != 0 && (!ChatObject.isForum(currentChat) || threadMessageId != 1) && threadMessageId != obj.getReplyTopMsgId() && threadMessageId != obj.getReplyMsgId()) {
continue;
}
if (obj.isOut()) {
@ -26965,7 +26974,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
@Override
public boolean shouldShowTopicButton() {
return true;
return ChatObject.isForum(currentChat) && !isTopic;
}
@Override
@ -28216,96 +28225,112 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
return true;
}
} else if (ChatObject.getPublicUsername(currentChat) != null) {
String username = ChatObject.getPublicUsername(currentChat).toLowerCase();
if (publicMsgUrlPattern == null) {
publicMsgUrlPattern = Pattern.compile("(https://)?t.me/([0-9a-zA-Z_]+)/([0-9]+)");
voiceChatUrlPattern = Pattern.compile("(https://)?t.me/([0-9a-zA-Z_]+)\\?(voicechat+)");
}
Matcher matcher = publicMsgUrlPattern.matcher(urlFinal);
if (matcher.find(2) && matcher.find(3) && username.equals(matcher.group(2).toLowerCase())) {
Uri data = Uri.parse(urlFinal);
int threadId = Utilities.parseInt(data.getQueryParameter("thread"));
int commentId = Utilities.parseInt(data.getQueryParameter("comment"));
if (threadId != 0 || commentId != 0) {
return false;
} else {
int messageId = Integer.parseInt(matcher.group(3));
showScrollToMessageError = true;
if (chatMode == MODE_PINNED) {
chatActivityDelegate.openReplyMessage(messageId);
finishFragment();
} else {
startFromVideoTimestamp = LaunchActivity.getTimestampFromLink(data);
if (startFromVideoTimestamp >= 0) {
startFromVideoMessageId = messageId;
}
scrollToMessageId(messageId, fromMessageId, true, 0, false, 0);
}
try {
if (publicMsgUrlPattern == null) {
publicMsgUrlPattern = Pattern.compile("(https://)?t.me/([0-9a-zA-Z_]+)/([0-9]+)/?([0-9]+)?");
voiceChatUrlPattern = Pattern.compile("(https://)?t.me/([0-9a-zA-Z_]+)\\?(voicechat+)");
}
return true;
} else if (urlFinal.startsWith("tg:resolve") || urlFinal.startsWith("tg://resolve")) {
String urlTmp = urlFinal.replace("tg:resolve", "tg://telegram.org").replace("tg://resolve", "tg://telegram.org");
Uri data = Uri.parse(urlTmp);
String usernameE = data.getQueryParameter("domain").toLowerCase();
int messageId = Utilities.parseInt(data.getQueryParameter("post"));
int threadId = Utilities.parseInt(data.getQueryParameter("thread"));
int commentId = Utilities.parseInt(data.getQueryParameter("comment"));
if (username.equals(usernameE) && messageId != 0) {
Matcher matcher = publicMsgUrlPattern.matcher(urlFinal);
if (matcher.find(2) && matcher.find(3) && ChatObject.hasPublicLink(currentChat, matcher.group(2))) {
Uri data = Uri.parse(urlFinal);
int threadId = Utilities.parseInt(data.getQueryParameter("thread"));
int commentId = Utilities.parseInt(data.getQueryParameter("comment"));
if (threadId != 0 || commentId != 0) {
return false;
} else {
if (chatMode == MODE_PINNED) {
chatActivityDelegate.openReplyMessage(messageId);
finishFragment();
int messageId, topicId;
if (matcher.group(4) != null) {
topicId = Integer.parseInt(matcher.group(3));
messageId = Integer.parseInt(matcher.group(4));
} else {
scrollToMessageId(messageId, fromMessageId, true, 0, false, 0);
topicId = 0;
messageId = Integer.parseInt(matcher.group(3));
}
return true;
}
}
} else {
matcher = voiceChatUrlPattern.matcher(urlFinal);
try {
if (matcher.find(2) && matcher.find(3) && username.equals(matcher.group(2).toLowerCase())) {
Uri data = Uri.parse(urlFinal);
String voicechat = data.getQueryParameter("voicechat");
if (!TextUtils.isEmpty(voicechat)) {
voiceChatHash = voicechat;
checkGroupCallJoin(true);
return true;
if (ChatObject.isForum(currentChat) && topicId != getTopicId()) {
return false;
}
}
} catch (Exception e) {
FileLog.e(e);
}
}
} else {
if (privateMsgUrlPattern == null) {
privateMsgUrlPattern = Pattern.compile("(https://)?t.me/c/([0-9]+)/([0-9]+)/?([0-9]+)?");
}
Matcher matcher = privateMsgUrlPattern.matcher(urlFinal);
if (matcher.find(2) && matcher.find(3) && !matcher.find(4)) {
long channelId = Long.parseLong(matcher.group(2));
int messageId = Integer.parseInt(matcher.group(3));
if (channelId == currentChat.id && messageId != 0) {
Uri data = Uri.parse(urlFinal);
int threadId = Utilities.parseInt(data.getQueryParameter("thread"));
int topicId = Utilities.parseInt(data.getQueryParameter("topic"));
int commentId = Utilities.parseInt(data.getQueryParameter("comment"));
if (threadId != 0 || topicId != 0 || commentId != 0) {
return false;
} else {
showScrollToMessageError = true;
if (chatMode == MODE_PINNED) {
chatActivityDelegate.openReplyMessage(messageId);
finishFragment();
} else {
startFromVideoTimestamp = LaunchActivity.getTimestampFromLink(data);
if (startFromVideoTimestamp >= 0) {
startFromVideoMessageId = messageId;
}
scrollToMessageId(messageId, fromMessageId, true, 0, false, 0);
}
return true;
}
return true;
} else if (urlFinal.startsWith("tg:resolve") || urlFinal.startsWith("tg://resolve")) {
String urlTmp = urlFinal.replace("tg:resolve", "tg://telegram.org").replace("tg://resolve", "tg://telegram.org");
Uri data = Uri.parse(urlTmp);
String usernameE = data.getQueryParameter("domain").toLowerCase();
int messageId = Utilities.parseInt(data.getQueryParameter("post"));
int threadId = Utilities.parseInt(data.getQueryParameter("thread"));
int commentId = Utilities.parseInt(data.getQueryParameter("comment"));
if (ChatObject.hasPublicLink(currentChat, usernameE) && messageId != 0) {
if (threadId != 0 || commentId != 0) {
return false;
} else {
if (chatMode == MODE_PINNED) {
chatActivityDelegate.openReplyMessage(messageId);
finishFragment();
} else {
scrollToMessageId(messageId, fromMessageId, true, 0, false, 0);
}
return true;
}
}
} else {
matcher = voiceChatUrlPattern.matcher(urlFinal);
try {
if (matcher.find(2) && matcher.find(3) && ChatObject.hasPublicLink(currentChat, matcher.group(2))) {
Uri data = Uri.parse(urlFinal);
String voicechat = data.getQueryParameter("voicechat");
if (!TextUtils.isEmpty(voicechat)) {
voiceChatHash = voicechat;
checkGroupCallJoin(true);
return true;
}
}
} catch (Exception e) {
FileLog.e(e);
}
}
} catch (Exception e) {
FileLog.e(e);
}
} else {
try {
if (privateMsgUrlPattern == null) {
privateMsgUrlPattern = Pattern.compile("(https://)?t.me/c/([0-9]+)/([0-9]+)/?([0-9]+)?");
}
Matcher matcher = privateMsgUrlPattern.matcher(urlFinal);
if (matcher.find(2) && matcher.find(3) && matcher.group(4) == null) {
long channelId = Long.parseLong(matcher.group(2));
int messageId = Integer.parseInt(matcher.group(3));
if (channelId == currentChat.id && messageId != 0) {
Uri data = Uri.parse(urlFinal);
int threadId = Utilities.parseInt(data.getQueryParameter("thread"));
int topicId = Utilities.parseInt(data.getQueryParameter("topic"));
int commentId = Utilities.parseInt(data.getQueryParameter("comment"));
if (threadId != 0 || topicId != 0 || commentId != 0) {
return false;
} else {
showScrollToMessageError = true;
if (chatMode == MODE_PINNED) {
chatActivityDelegate.openReplyMessage(messageId);
finishFragment();
} else {
scrollToMessageId(messageId, fromMessageId, true, 0, false, 0);
}
return true;
}
}
}
} catch (Exception e) {
FileLog.e(e);
}
}
return false;

View file

@ -573,7 +573,7 @@ public class AlertsCreator {
localeInfo.pathToFile = "unofficial";
}
}
LocaleController.getInstance().applyLanguage(localeInfo, true, false, false, true, UserConfig.selectedAccount);
LocaleController.getInstance().applyLanguage(localeInfo, true, false, false, true, UserConfig.selectedAccount, null);
activity.rebuildAllFragments(true);
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);

View file

@ -645,9 +645,20 @@ public class AnimatedEmojiDrawable extends Drawable {
if (canOverrideColorCached != null) {
return canOverrideColorCached;
}
if (document != null) {
return canOverrideColorCached = (isDefaultStatusEmoji() || MessageObject.isTextColorEmoji(document));
}
return false;
}
private Boolean isDefaultStatusEmojiCached = null;
public boolean isDefaultStatusEmoji() {
if (isDefaultStatusEmojiCached != null) {
return isDefaultStatusEmojiCached;
}
if (document != null) {
TLRPC.InputStickerSet set = MessageObject.getInputStickerSet(document);
return canOverrideColorCached = (
return isDefaultStatusEmojiCached = (
set instanceof TLRPC.TL_inputStickerSetEmojiDefaultStatuses ||
set instanceof TLRPC.TL_inputStickerSetID && (set.id == 773947703670341676L || set.id == 2964141614563343L)
);
@ -655,6 +666,17 @@ public class AnimatedEmojiDrawable extends Drawable {
return false;
}
public static boolean isDefaultStatusEmoji(Drawable drawable) {
if (!(drawable instanceof AnimatedEmojiDrawable)) {
return false;
}
return isDefaultStatusEmoji((AnimatedEmojiDrawable) drawable);
}
public static boolean isDefaultStatusEmoji(AnimatedEmojiDrawable drawable) {
return drawable != null && drawable.isDefaultStatusEmoji();
}
@Override
public int getAlpha() {
return (int) (255 * this.alpha);
@ -672,7 +694,7 @@ public class AnimatedEmojiDrawable extends Drawable {
@Override
public void setColorFilter(@Nullable ColorFilter colorFilter) {
if (imageReceiver == null) {
if (imageReceiver == null || document == null) {
colorFilterToSet = colorFilter;
} else if (canOverrideColor()) {
imageReceiver.setColorFilter(colorFilter);
@ -848,7 +870,7 @@ public class AnimatedEmojiDrawable extends Drawable {
return;
}
lastColor = color;
colorFilter = color != null ? new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY) : null;
colorFilter = color != null ? new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN) : null;
}
public Integer getColor() {

View file

@ -23,6 +23,7 @@ import org.telegram.messenger.ImageReceiver;
import org.telegram.messenger.MessageObject;
import org.telegram.messenger.UserConfig;
import org.telegram.tgnet.TLRPC;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.Components.spoilers.SpoilerEffect;
import java.util.ArrayList;
@ -279,6 +280,7 @@ public class AnimatedEmojiSpan extends ReplacementSpan {
}
if (drawable.getImageReceiver() != null) {
drawable.setColorFilter(Theme.chat_animatedEmojiTextColorFilter);
drawable.setTime(time);
drawable.draw(canvas, drawableBounds, alpha * this.alpha);
// drawable.setTime(0);

View file

@ -1,6 +1,8 @@
package org.telegram.ui.Components;
import android.content.Context;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
@ -257,6 +259,9 @@ public final class BulletinFactory {
public Bulletin createEmojiBulletin(TLRPC.Document document, CharSequence text, CharSequence button, Runnable onButtonClick) {
final Bulletin.LottieLayout layout = new Bulletin.LottieLayout(getContext(), resourcesProvider);
if (MessageObject.isTextColorEmoji(document)) {
layout.imageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_undo_infoColor), PorterDuff.Mode.SRC_IN));
}
layout.setAnimation(document, 36, 36);
layout.textView.setText(text);
layout.textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
@ -268,6 +273,9 @@ public final class BulletinFactory {
public Bulletin createEmojiLoadingBulletin(TLRPC.Document document, CharSequence text, CharSequence button, Runnable onButtonClick) {
final Bulletin.LoadingLottieLayout layout = new Bulletin.LoadingLottieLayout(getContext(), resourcesProvider);
if (MessageObject.isTextColorEmoji(document)) {
layout.imageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_undo_infoColor), PorterDuff.Mode.SRC_IN));
}
layout.setAnimation(document, 36, 36);
layout.textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
layout.textView.setSingleLine(false);

View file

@ -868,7 +868,6 @@ public class ChatAvatarContainer extends FrameLayout implements NotificationCent
avatarImageView.setForUserOrChat(chat, avatarDrawable);
avatarImageView.setRoundRadius(chat != null && chat.forum ? AndroidUtilities.dp(16) : AndroidUtilities.dp(21));
}
}
public void setUserAvatar(TLRPC.User user) {

View file

@ -201,7 +201,7 @@ public class EmojiPacksAlert extends BottomSheet implements NotificationCenter.N
if (drawable == null) {
animatedEmojiDrawables.put(documentId, drawable = AnimatedEmojiDrawable.make(currentAccount, AnimatedEmojiDrawable.CACHE_TYPE_ALERT_PREVIEW, documentId));
}
drawable.setColorFilter(colorFilter);
drawable.setColorFilter(Theme.chat_animatedEmojiTextColorFilter);
drawable.addView(this);
ArrayList<EmojiImageView> arrayList = viewsGroupedByLines.get(child.getTop());
if (arrayList == null) {
@ -317,7 +317,8 @@ public class EmojiPacksAlert extends BottomSheet implements NotificationCenter.N
drawable.setAlpha(255);
AndroidUtilities.rectTmp2.set(imageView.getLeft() + imageView.getPaddingLeft(), imageView.getPaddingTop(), imageView.getRight() - imageView.getPaddingRight(), imageView.getMeasuredHeight() - imageView.getPaddingBottom());
imageView.backgroundThreadDrawHolder[threadIndex].setBounds(AndroidUtilities.rectTmp2);
imageView.imageReceiver = drawable.getImageReceiver();
drawable.setColorFilter(Theme.chat_animatedEmojiTextColorFilter);
imageView.imageReceiver = drawable.getImageReceiver();;
drawInBackgroundViews.add(imageView);
}
}

View file

@ -6,6 +6,7 @@ import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PorterDuff;
@ -22,6 +23,7 @@ import android.widget.HorizontalScrollView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import androidx.annotation.Nullable;
import androidx.core.graphics.ColorUtils;
import androidx.core.math.MathUtils;
@ -616,6 +618,10 @@ public class EmojiTabsStrip extends ScrollableHorizontalScrollView {
}
}
protected ColorFilter getEmojiColorFilter() {
return Theme.chat_animatedEmojiTextColorFilter;
}
private int selectorColor() {
return 0x2effffff & Theme.getColor(Theme.key_chat_emojiPanelIcon, resourcesProvider);
}
@ -629,6 +635,7 @@ public class EmojiTabsStrip extends ScrollableHorizontalScrollView {
public Integer id;
public boolean newly;
private boolean isAnimatedEmoji;
private ImageView imageView;
private RLottieDrawable lottieDrawable;
@ -712,8 +719,17 @@ public class EmojiTabsStrip extends ScrollableHorizontalScrollView {
}
}
}
@Override
public void setImageDrawable(@Nullable Drawable drawable) {
super.setImageDrawable(drawable);
}
};
imageView.setImageDrawable(drawable);
if (drawable instanceof AnimatedEmojiDrawable) {
isAnimatedEmoji = true;
imageView.setColorFilter(getEmojiColorFilter());
}
addView(imageView);
lockView = new PremiumLockIconView(context, PremiumLockIconView.TYPE_STICKERS_PREMIUM_LOCKED, resourcesProvider);
@ -914,7 +930,7 @@ public class EmojiTabsStrip extends ScrollableHorizontalScrollView {
private void setColor(int color) {
PorterDuffColorFilter colorFilter = new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY);
if (imageView != null) {
if (imageView != null && !isAnimatedEmoji) {
imageView.setColorFilter(colorFilter);
imageView.invalidate();
}

View file

@ -2836,6 +2836,7 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
AndroidUtilities.rectTmp2.set(imageView.getLeft() + imageView.getPaddingLeft() - startOffset, topOffset, imageView.getRight() - imageView.getPaddingRight() - startOffset, topOffset + imageView.getMeasuredHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom());
imageView.backgroundThreadDrawHolder[threadIndex].setBounds(AndroidUtilities.rectTmp2);
imageView.drawable = drawable;
imageView.drawable.setColorFilter(Theme.chat_animatedEmojiTextColorFilter);
imageView.imageReceiver = drawable.getImageReceiver();
drawInBackgroundViews.add(imageView);
}
@ -5086,7 +5087,6 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
bottomTabContainerBackground.setBackgroundColor(getThemedColor(Theme.key_chat_emojiPanelBackground));
}
}
if (emojiTabs != null) {
emojiTabs.setBackgroundColor(getThemedColor(Theme.key_chat_emojiPanelBackground));
emojiTabsShadow.setBackgroundColor(getThemedColor(Theme.key_chat_emojiPanelShadowLine));

View file

@ -48,9 +48,9 @@ public class ForumUtilities {
public static void setTopicIcon(BackupImageView backupImageView, TLRPC.TL_forumTopic forumTopic) {
setTopicIcon(backupImageView, forumTopic, false, null);
setTopicIcon(backupImageView, forumTopic, false, false, null);
}
public static void setTopicIcon(BackupImageView backupImageView, TLRPC.TL_forumTopic forumTopic, boolean largeIcon, Theme.ResourcesProvider resourcesProvider) {
public static void setTopicIcon(BackupImageView backupImageView, TLRPC.TL_forumTopic forumTopic, boolean actionBar, boolean largeIcon, Theme.ResourcesProvider resourcesProvider) {
if (forumTopic == null || backupImageView == null) {
return;
}
@ -60,7 +60,9 @@ public class ForumUtilities {
} else if (forumTopic.icon_emoji_id != 0) {
backupImageView.setImageDrawable(null);
if (backupImageView.animatedEmojiDrawable == null || forumTopic.icon_emoji_id != backupImageView.animatedEmojiDrawable.getDocumentId()) {
backupImageView.setAnimatedEmojiDrawable(new AnimatedEmojiDrawable(largeIcon ? AnimatedEmojiDrawable.CACHE_TYPE_FORUM_TOPIC_LARGE : AnimatedEmojiDrawable.CACHE_TYPE_FORUM_TOPIC, UserConfig.selectedAccount, forumTopic.icon_emoji_id));
AnimatedEmojiDrawable drawable = new AnimatedEmojiDrawable(largeIcon ? AnimatedEmojiDrawable.CACHE_TYPE_FORUM_TOPIC_LARGE : AnimatedEmojiDrawable.CACHE_TYPE_FORUM_TOPIC, UserConfig.selectedAccount, forumTopic.icon_emoji_id);
drawable.setColorFilter(actionBar ? new PorterDuffColorFilter(Theme.getColor(Theme.key_actionBarDefaultTitle), PorterDuff.Mode.SRC_IN) : Theme.chat_animatedEmojiTextColorFilter);
backupImageView.setAnimatedEmojiDrawable(drawable);
}
} else {
backupImageView.setAnimatedEmojiDrawable(null);
@ -256,6 +258,9 @@ public class ForumUtilities {
}
public static void applyTopic(ChatActivity chatActivity, MessagesStorage.TopicKey topicKey) {
if (topicKey.topicId == 0) {
return;
}
TLRPC.TL_forumTopic topic = chatActivity.getMessagesController().getTopicsController().findTopic(-topicKey.dialogId, topicKey.topicId);
if (topic == null) {
return;

View file

@ -16,6 +16,7 @@ import android.text.StaticLayout;
import android.text.TextUtils;
import android.view.MotionEvent;
import androidx.annotation.NonNull;
import androidx.core.graphics.ColorUtils;
import org.telegram.messenger.AndroidUtilities;
@ -40,6 +41,8 @@ public class MessageTopicButton {
private int topicWidth;
private int topicHeight;
private boolean topicClosed;
private Drawable topicClosedDrawable;
private Paint topicPaint;
private boolean isGeneralTopic;
private Path topicPath;
@ -73,9 +76,9 @@ public class MessageTopicButton {
protected void onClick() {}
public int set(ChatMessageCell cell, MessageObject messageObject, TLRPC.TL_forumTopic topic, int maxWidth) {
public int set(ChatMessageCell cell, MessageObject messageObject, @NonNull TLRPC.TL_forumTopic topic, int maxWidth) {
lastMessageObject = messageObject;
isGeneralTopic = topic == null || topic.id == 1;
isGeneralTopic = topic.id == 1;
if (cell == null || messageObject == null) {
return 0;
}
@ -87,6 +90,10 @@ public class MessageTopicButton {
maxWidth -= padleft + padright;
String title = topic.title == null ? "" : topic.title;
topicClosed = topic.closed;
if (topicClosed) {
maxWidth -= AndroidUtilities.dp(18);
}
topicNameLayout = StaticLayoutEx.createStaticLayout(title, 0, title.length(), Theme.chat_topicTextPaint, maxWidth, Layout.Alignment.ALIGN_NORMAL, 1f, 0, false, TextUtils.TruncateAt.END, maxWidth, 2, false);
topicHeight = AndroidUtilities.dp(4 + 4.5f) + Math.min(AndroidUtilities.dp(24), topicNameLayout == null ? 0 : topicNameLayout.getHeight());
float textWidth = 0;
@ -131,17 +138,25 @@ public class MessageTopicButton {
topicBackgroundColorAnimated = new AnimatedColor(cell);
}
}
if (topicArrowDrawable == null && context != null) {
if (topicArrowDrawable == null) {
topicArrowDrawable = context.getResources().getDrawable(R.drawable.msg_mini_topicarrow).mutate();
}
topicArrowDrawable.setColorFilter(new PorterDuffColorFilter(topicArrowColor = ColorUtils.setAlphaComponent(topicNameColor, 140), PorterDuff.Mode.MULTIPLY));
if (topicClosedDrawable == null) {
topicClosedDrawable = context.getResources().getDrawable(R.drawable.msg_mini_lock2).mutate();
}
topicClosedDrawable.setColorFilter(new PorterDuffColorFilter(topicArrowColor = ColorUtils.setAlphaComponent(topicNameColor, 140), PorterDuff.Mode.MULTIPLY));
float R = (AndroidUtilities.dp(11) + (int) Theme.chat_topicTextPaint.getTextSize());
int arrowsz = Math.max(1, (int) Theme.chat_topicTextPaint.getTextSize() + AndroidUtilities.dp(0));
int locksz = Math.max(1, (int) Theme.chat_topicTextPaint.getTextSize() - AndroidUtilities.dp(4));
if (lineCount == 2) {
topicHeight = AndroidUtilities.dp(15) + 2 * ((int) Theme.chat_topicTextPaint.getTextSize());
float l1w = Math.abs(topicNameLayout.getLineRight(0) - topicNameLayout.getLineLeft(0));
float l2w = Math.abs(topicNameLayout.getLineRight(1) - topicNameLayout.getLineLeft(1));
if (topicClosed) {
l2w += AndroidUtilities.dp(4) + locksz;
}
topicNameLeft = Math.min(topicNameLayout.getLineLeft(0), topicNameLayout.getLineLeft(1));
boolean isRTL = topicNameLeft != 0;
textWidth = Math.max(l1w, l2w);
@ -179,6 +194,12 @@ public class MessageTopicButton {
(int) (padleft + padright + AndroidUtilities.dp(-4) + l2w),
(int) ((topicHeight - AndroidUtilities.dp(11) - Theme.chat_topicTextPaint.getTextSize() + topicHeight) / 2f + arrowsz / 2)
);
topicClosedDrawable.setBounds(
(int) (padleft + padright + AndroidUtilities.dp(-4) - arrowsz + l2w - locksz),
(int) ((topicHeight - AndroidUtilities.dp(11) - Theme.chat_topicTextPaint.getTextSize() + topicHeight) / 2f - locksz / 2),
(int) (padleft + padright + AndroidUtilities.dp(-4) - arrowsz + l2w),
(int) ((topicHeight - AndroidUtilities.dp(11) - Theme.chat_topicTextPaint.getTextSize() + topicHeight) / 2f + locksz / 2)
);
AndroidUtilities.rectTmp.set(padleft + padright + l2w - r, topicHeight - r, padleft + padright + l2w, topicHeight);
topicPath.arcTo(AndroidUtilities.rectTmp, 0, 90);
AndroidUtilities.rectTmp.set(0, topicHeight - R, R, topicHeight);
@ -187,6 +208,9 @@ public class MessageTopicButton {
} else if (lineCount == 1) {
topicHeight = AndroidUtilities.dp(11) + (int) Theme.chat_topicTextPaint.getTextSize();
textWidth = Math.abs(topicNameLayout.getLineRight(0) - topicNameLayout.getLineLeft(0));
if (topicClosed) {
textWidth += AndroidUtilities.dp(4) + locksz;
}
topicNameLeft = topicNameLayout.getLineLeft(0);
AndroidUtilities.rectTmp.set(0, 0, padleft + padright + textWidth, topicHeight);
topicArrowDrawableVisible = true;
@ -196,22 +220,37 @@ public class MessageTopicButton {
(int) (padleft + padright + AndroidUtilities.dp(-4) + textWidth),
(int) (topicHeight / 2f + arrowsz / 2)
);
topicClosedDrawable.setBounds(
(int) (padleft + padright + AndroidUtilities.dp(-4) + textWidth - arrowsz - locksz),
(int) (topicHeight / 2f - locksz / 2),
(int) (padleft + padright + AndroidUtilities.dp(-4) + textWidth - arrowsz),
(int) (topicHeight / 2f + locksz / 2)
);
topicPath.addRoundRect(AndroidUtilities.rectTmp, R, R, Path.Direction.CW);
} else if (lineCount == 0) {
topicHeight = AndroidUtilities.dp(11) + (int) Theme.chat_topicTextPaint.getTextSize();
textWidth = 0;
if (topicClosed) {
textWidth += AndroidUtilities.dp(4) + locksz;
}
topicNameLeft = 0;
topicArrowDrawableVisible = true;
topicArrowDrawable.setBounds(
(int) (padleft + padright + AndroidUtilities.dp(-4) + textWidth - arrowsz),
(int) (padleft + padright + AndroidUtilities.dp(-4) + textWidth - locksz),
(int) (topicHeight / 2f - arrowsz / 2),
(int) (padleft + padright + AndroidUtilities.dp(-4) + textWidth),
(int) (topicHeight / 2f + arrowsz / 2)
);
topicClosedDrawable.setBounds(
(int) (padleft + padright + AndroidUtilities.dp(-4) + textWidth - arrowsz - locksz),
(int) (topicHeight / 2f - locksz / 2),
(int) (padleft + padright + AndroidUtilities.dp(-4) + textWidth - arrowsz),
(int) (topicHeight / 2f + locksz / 2)
);
AndroidUtilities.rectTmp.set(0, 0, padleft + padright + textWidth, topicHeight);
topicPath.addRoundRect(AndroidUtilities.rectTmp, R, R, Path.Direction.CW);
}
topicWidth = (int) (padleft + padright -AndroidUtilities.dp(1) + textWidth);
topicWidth = (int) (padleft + padright - AndroidUtilities.dp(1) + textWidth);
int occupingHeight = 0;
if (!messageObject.isAnyKindOfSticker() && messageObject.type != MessageObject.TYPE_ROUND_VIDEO || messageObject.type == MessageObject.TYPE_EMOJIS) {
occupingHeight += AndroidUtilities.dp(6) + topicHeight;
@ -413,10 +452,17 @@ public class MessageTopicButton {
} else {
Theme.chat_topicTextPaint.setColor(nameColor = topicNameColor);
}
Theme.chat_topicTextPaint.setAlpha((int) (Theme.chat_topicTextPaint.getAlpha() * alpha));
Theme.chat_topicTextPaint.setAlpha((int) (Theme.chat_topicTextPaint.getAlpha() * alpha * (topicClosed ? .7f : 1f)));
topicNameLayout.draw(canvas);
canvas.restore();
}
if (topicClosedDrawable != null && topicClosed) {
int arrowColor = ColorUtils.setAlphaComponent(nameColor, 140);
if (topicArrowColor != arrowColor) {
topicClosedDrawable.setColorFilter(new PorterDuffColorFilter(topicArrowColor = arrowColor, PorterDuff.Mode.MULTIPLY));
}
topicClosedDrawable.draw(canvas);
}
if (topicArrowDrawable != null && topicArrowDrawableVisible) {
int arrowColor = ColorUtils.setAlphaComponent(nameColor, 140);
if (topicArrowColor != arrowColor) {

View file

@ -131,6 +131,7 @@ public class MessageContainsEmojiButton extends FrameLayout implements Notificat
}
}, 0, emoji.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
emojiDrawable = AnimatedEmojiDrawable.make(currentAccount, AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, document);
emojiDrawable.setColorFilter(Theme.chat_animatedEmojiTextColorFilter);
emojiDrawable.addView(this);
SpannableString stickerPack = new SpannableString(stickerPackName);

View file

@ -433,7 +433,9 @@ public class ReactedUsersListView extends FrameLayout {
reactView.setImageDrawable(null);
}
} else {
reactView.setAnimatedEmojiDrawable(new AnimatedEmojiDrawable(AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, currentAccount, visibleReaction.documentId));
AnimatedEmojiDrawable drawable = new AnimatedEmojiDrawable(AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, currentAccount, visibleReaction.documentId);
drawable.setColorFilter(Theme.chat_animatedEmojiTextColorFilter);
reactView.setAnimatedEmojiDrawable(drawable);
hasReactImage = true;
}
setContentDescription(LocaleController.formatString("AccDescrReactedWith", R.string.AccDescrReactedWith, UserObject.getUserName(u), reaction.reaction));

View file

@ -4,6 +4,8 @@ import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.PixelFormat;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.view.HapticFeedbackConstants;
import android.view.View;
import android.view.ViewGroup;
@ -18,6 +20,7 @@ import org.telegram.messenger.MessageObject;
import org.telegram.messenger.MessagesController;
import org.telegram.tgnet.TLRPC;
import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.Cells.ChatMessageCell;
import org.telegram.ui.ChatActivity;
import org.telegram.ui.Components.AnimatedEmojiDrawable;
@ -546,8 +549,16 @@ public class ReactionsEffectOverlay {
emojiImageView.setAnimatedReactionDrawable(new AnimatedEmojiDrawable(AnimatedEmojiDrawable.CACHE_TYPE_KEYBOARD, currentAccount, visibleReaction.documentId));
}
if (animationType == LONG_ANIMATION || animationType == SHORT_ANIMATION) {
effectImageView.setAnimatedEmojiEffect(AnimatedEmojiEffect.createFrom(new AnimatedEmojiDrawable(AnimatedEmojiDrawable.CACHE_TYPE_KEYBOARD, currentAccount, visibleReaction.documentId), animationType == LONG_ANIMATION, true));
windowView.setClipChildren(false);
AnimatedEmojiDrawable animatedEmojiDrawable = new AnimatedEmojiDrawable(AnimatedEmojiDrawable.CACHE_TYPE_KEYBOARD, currentAccount, visibleReaction.documentId);
int color = Theme.getColor(
cell.getMessageObject().shouldDrawWithoutBackground() ?
cell.getMessageObject().isOutOwner() ? Theme.key_chat_outReactionButtonBackground : Theme.key_chat_inReactionButtonBackground :
cell.getMessageObject().isOutOwner() ? Theme.key_chat_outReactionButtonTextSelected : Theme.key_chat_inReactionButtonTextSelected,
fragment.getResourceProvider()
);
animatedEmojiDrawable.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN));
effectImageView.setAnimatedEmojiEffect(AnimatedEmojiEffect.createFrom(animatedEmojiDrawable, animationType == LONG_ANIMATION, true));
windowView.setClipChildren(false);
}
}

View file

@ -3,6 +3,8 @@ package org.telegram.ui.Components.Reactions;
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.text.TextPaint;
import android.text.TextUtils;
@ -483,6 +485,7 @@ public class ReactionsLayoutInBubble {
public int height;
ImageReceiver imageReceiver = new ImageReceiver();
AnimatedEmojiDrawable animatedEmojiDrawable;
int animatedEmojiDrawableColor;
CounterView.CounterDrawable counterDrawable = new CounterView.CounterDrawable(parentView, false, null);
int backgroundColor;
int textColor;
@ -643,6 +646,9 @@ public class ReactionsLayoutInBubble {
private void drawImage(Canvas canvas, float alpha) {
ImageReceiver imageReceiver = animatedEmojiDrawable != null ? animatedEmojiDrawable.getImageReceiver() : this.imageReceiver;
if (animatedEmojiDrawable != null && animatedEmojiDrawableColor != lastDrawnTextColor) {
animatedEmojiDrawable.setColorFilter(new PorterDuffColorFilter(animatedEmojiDrawableColor = lastDrawnTextColor, PorterDuff.Mode.SRC_IN));
}
if (drawImage && ((realCount > 1 || !ReactionsEffectOverlay.isPlaying(messageObject.getId(), messageObject.getGroupId(), visibleReaction)) || !isSelected)) {
ImageReceiver imageReceiver2 = animatedReactions.get(visibleReaction);
boolean drawStaticImage = true;

View file

@ -1258,8 +1258,12 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
} else {
pressedBackupImageView.getImageReceiver().clearImage();
loopImageView.getImageReceiver().clearImage();
pressedBackupImageView.setAnimatedEmojiDrawable(new AnimatedEmojiDrawable(AnimatedEmojiDrawable.CACHE_TYPE_ALERT_PREVIEW_LARGE, currentAccount, currentReaction.documentId));
loopImageView.setAnimatedEmojiDrawable(new AnimatedEmojiDrawable(AnimatedEmojiDrawable.CACHE_TYPE_ALERT_PREVIEW, currentAccount, currentReaction.documentId));
AnimatedEmojiDrawable pressedDrawable = new AnimatedEmojiDrawable(AnimatedEmojiDrawable.CACHE_TYPE_ALERT_PREVIEW_LARGE, currentAccount, currentReaction.documentId);
pressedDrawable.setColorFilter(Theme.chat_animatedEmojiTextColorFilter);
pressedBackupImageView.setAnimatedEmojiDrawable(pressedDrawable);
AnimatedEmojiDrawable loopDrawable = new AnimatedEmojiDrawable(AnimatedEmojiDrawable.CACHE_TYPE_ALERT_PREVIEW, currentAccount, currentReaction.documentId);
loopDrawable.setColorFilter(Theme.chat_animatedEmojiTextColorFilter);
loopImageView.setAnimatedEmojiDrawable(loopDrawable);
}
setFocusable(true);
shouldSwitchToLoopView = hasEnterAnimation && showCustomEmojiReaction();

View file

@ -1459,8 +1459,41 @@ public class RecyclerListView extends RecyclerView {
}
int position = getChildAdapterPosition(child);
if (position >= fromAdapterPosition && position <= toAdapterPosition) {
top = Math.min(child.getTop(), top);
bottom = Math.max(child.getBottom(), bottom);
top = Math.min((int) child.getY(), top);
bottom = Math.max((int) child.getY() + child.getHeight(), bottom);
}
}
if (top < bottom) {
if (backgroundPaint == null) {
backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
}
backgroundPaint.setColor(color);
canvas.drawRect(0, top, getWidth(), bottom, backgroundPaint);
}
}
protected void drawItemBackground(Canvas canvas, int adapterPosition, int color) {
drawItemBackground(canvas, adapterPosition, -1, color);
}
protected void drawItemBackground(Canvas canvas, int adapterPosition, int height, int color) {
int top = Integer.MAX_VALUE;
int bottom = Integer.MIN_VALUE;
for (int i = 0; i < getChildCount(); ++i) {
View child = getChildAt(i);
if (child == null) {
continue;
}
int position = getChildAdapterPosition(child);
if (position == adapterPosition) {
top = (int) child.getY();
if (height <= 0) {
bottom = top + child.getHeight();
} else {
bottom = top + height;
}
}
}

View file

@ -3245,6 +3245,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
Bundle args = new Bundle();
args.putBoolean("onlySelect", true);
args.putBoolean("canSelectTopics", true);
args.putInt("dialogsType", 3);
DialogsActivity fragment = new DialogsActivity(args);
fragment.setDelegate((fragment1, dids, message, param) -> {
@ -3306,6 +3307,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
profileActivity.getNotificationCenter().postNotificationName(NotificationCenter.closeChats);
ChatActivity chatActivity = new ChatActivity(args1);
ForumUtilities.applyTopic(chatActivity, dids.get(0));
fragment1.presentFragment(chatActivity, true);
chatActivity.showFieldPanelForForward(true, fmessages);
}

View file

@ -694,6 +694,10 @@ public class SizeNotifierFrameLayout extends FrameLayout {
blurIsRunning = false;
}
public boolean blurWasDrawn() {
return SharedConfig.chatBlurEnabled() && currentBitmap != null;
}
public void drawBlurRect(Canvas canvas, float y, Rect rectTmp, Paint blurScrimPaint, boolean top) {
int blurAlpha = Color.alpha(Theme.getColor(Theme.key_chat_BlurAlpha));
if (currentBitmap == null || !SharedConfig.chatBlurEnabled()) {

View file

@ -14,12 +14,15 @@ import android.text.TextPaint;
import android.text.style.MetricAffectingSpan;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.ui.ActionBar.Theme;
public class TypefaceSpan extends MetricAffectingSpan {
private Typeface typeface;
private int textSize;
private int color;
private String colorKey;
Theme.ResourcesProvider resourcesProvider;
public TypefaceSpan(Typeface tf) {
typeface = tf;
@ -38,6 +41,16 @@ public class TypefaceSpan extends MetricAffectingSpan {
color = textColor;
}
public TypefaceSpan(Typeface tf, int size, String colorKey, Theme.ResourcesProvider resourcesProvider) {
typeface = tf;
if (size > 0) {
textSize = size;
}
this.resourcesProvider = resourcesProvider;
this.colorKey = colorKey;
color = Theme.getColor(colorKey, resourcesProvider);
}
public Typeface getTypeface() {
return typeface;
}
@ -71,6 +84,9 @@ public class TypefaceSpan extends MetricAffectingSpan {
@Override
public void updateDrawState(TextPaint tp) {
if (colorKey != null) {
color = Theme.getColor(colorKey, resourcesProvider);
}
if (typeface != null) {
tp.setTypeface(typeface);
}

View file

@ -271,11 +271,6 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
AndroidUtilities.runOnUIThread(updateListRunnable, 36);
}
@Override
protected void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
}
}
private ViewPagerFixed.TabsView searchTabsView;
@ -1642,7 +1637,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
}
int pos = parentPage.layoutManager.findFirstVisibleItemPosition();
if (pos != RecyclerView.NO_POSITION && !dialogsListFrozen && parentPage.itemTouchhelper.isIdle()) {
if (pos != RecyclerView.NO_POSITION && parentPage.itemTouchhelper.isIdle()) {
RecyclerView.ViewHolder holder = parentPage.listView.findViewHolderForAdapterPosition(pos);
if (holder != null) {
int top = holder.itemView.getTop();
@ -1731,7 +1726,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
@Override
public boolean onTouchEvent(MotionEvent e) {
if (fastScrollAnimationRunning || waitingForScrollFinished || parentPage.dialogsItemAnimator.isRunning() || rightFragmentTransitionInProgress) {
if (fastScrollAnimationRunning || waitingForScrollFinished || rightFragmentTransitionInProgress) {
return false;
}
int action = e.getAction();
@ -1995,8 +1990,10 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
}
int fromIndex = source.getAdapterPosition();
int toIndex = target.getAdapterPosition();
parentPage.listView.setItemAnimator(parentPage.dialogsItemAnimator);
parentPage.dialogsAdapter.notifyItemMoved(fromIndex, toIndex);
if (parentPage.listView.getItemAnimator() == null) {
parentPage.listView.setItemAnimator(parentPage.dialogsItemAnimator);
}
parentPage.dialogsAdapter.moveDialogs(parentPage.listView, fromIndex, toIndex);
if (viewPages[0].dialogsType == 7 || viewPages[0].dialogsType == 8) {
MessagesController.DialogFilter filter = getMessagesController().selectedDialogFilter[viewPages[0].dialogsType == 8 ? 1 : 0];
@ -5036,7 +5033,9 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
}
int a = animated ? 1 : 0;
RecyclerView.Adapter currentAdapter = viewPages[a].listView.getAdapter();
if (viewPages[a].selectedType < 0 || viewPages[a].selectedType >= getMessagesController().dialogFilters.size()) {
return;
}
MessagesController.DialogFilter filter = getMessagesController().dialogFilters.get(viewPages[a].selectedType);
if (filter.isDefault()) {
viewPages[a].dialogsType = 0;
@ -5177,7 +5176,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
private void updateDrawerSwipeEnabled() {
if (parentLayout != null && parentLayout.getDrawerLayoutContainer() != null) {
parentLayout.getDrawerLayoutContainer().setAllowOpenDrawerBySwipe(isFirstTab && !searchIsShowed && SharedConfig.getChatSwipeAction(currentAccount) == SwipeGestureSettingsView.SWIPE_GESTURE_FOLDERS && (rightSlidingDialogContainer == null || !rightSlidingDialogContainer.hasFragment()));
parentLayout.getDrawerLayoutContainer().setAllowOpenDrawerBySwipe(((isFirstTab && SharedConfig.getChatSwipeAction(currentAccount) == SwipeGestureSettingsView.SWIPE_GESTURE_FOLDERS) || SharedConfig.getChatSwipeAction(currentAccount) != SwipeGestureSettingsView.SWIPE_GESTURE_FOLDERS) && !searchIsShowed && (rightSlidingDialogContainer == null || !rightSlidingDialogContainer.hasFragment()));
}
}

View file

@ -15,12 +15,15 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.ChatObject;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.R;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.TLRPC;
@ -39,9 +42,6 @@ import org.telegram.ui.Components.RecyclerListView;
import java.util.ArrayList;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
public class GroupInviteActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
private ListAdapter listAdapter;
@ -86,6 +86,7 @@ public class GroupInviteActivity extends BaseFragment implements NotificationCen
@Override
public void onFragmentDestroy() {
super.onFragmentDestroy();
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.chatInfoDidLoad);
}

View file

@ -15,6 +15,8 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.graphics.Canvas;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
@ -22,6 +24,7 @@ import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@ -33,6 +36,7 @@ import org.telegram.messenger.MessagesController;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.messenger.Utilities;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.ui.ActionBar.ActionBar;
import org.telegram.ui.ActionBar.ActionBarMenu;
import org.telegram.ui.ActionBar.ActionBarMenuItem;
@ -73,6 +77,9 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
private ArrayList<LocaleController.LocaleInfo> sortedLanguages;
private ArrayList<LocaleController.LocaleInfo> unofficialLanguages;
private ActionBarMenuItem searchItem;
private int translateSettingsBackgroundHeight;
@Override
public boolean onFragmentCreate() {
fillLanguages();
@ -106,7 +113,7 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
});
ActionBarMenu menu = actionBar.createMenu();
ActionBarMenuItem item = menu.addItem(0, R.drawable.ic_ab_search).setIsSearchField(true).setActionBarMenuItemSearchListener(new ActionBarMenuItem.ActionBarMenuItemSearchListener() {
searchItem = menu.addItem(0, R.drawable.ic_ab_search).setIsSearchField(true).setActionBarMenuItemSearchListener(new ActionBarMenuItem.ActionBarMenuItemSearchListener() {
@Override
public void onSearchExpand() {
searching = true;
@ -142,7 +149,7 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
}
}
});
item.setSearchFieldHint(LocaleController.getString("Search", R.string.Search));
searchItem.setSearchFieldHint(LocaleController.getString("Search", R.string.Search));
listAdapter = new ListAdapter(context, false);
searchListViewAdapter = new ListAdapter(context, true);
@ -157,11 +164,32 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
emptyView.setShowAtCenter(true);
frameLayout.addView(emptyView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
listView = new RecyclerListView(context);
listView = new RecyclerListView(context) {
@Override
protected void dispatchDraw(Canvas canvas) {
if (getAdapter() == listAdapter && getItemAnimator() != null && getItemAnimator().isRunning()) {
int backgroundColor = Theme.getColor(Theme.key_windowBackgroundWhite, resourcesProvider);
drawItemBackground(canvas, 0, translateSettingsBackgroundHeight, backgroundColor);
// drawItemBackground(canvas, 1, Theme.getColor(Theme.key_windowBackgroundWhite, resourcesProvider));
drawSectionBackground(canvas, 1, 2, backgroundColor);
}
super.dispatchDraw(canvas);
}
};
listView.setEmptyView(emptyView);
listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
listView.setVerticalScrollBarEnabled(false);
listView.setAdapter(listAdapter);
DefaultItemAnimator itemAnimator = new DefaultItemAnimator() {
@Override
protected void onMoveAnimationUpdate(RecyclerView.ViewHolder holder) {
listView.invalidate();
listView.updateSelector();
}
};
itemAnimator.setDurations(400);
itemAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
listView.setItemAnimator(itemAnimator);
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
listView.setOnItemClickListener((view, position) -> {
@ -186,8 +214,21 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
}
if (localeInfo != null) {
LocaleController.LocaleInfo prevLocale = LocaleController.getInstance().getCurrentLocaleInfo();
LocaleController.getInstance().applyLanguage(localeInfo, true, false, false, true, currentAccount);
parentLayout.rebuildAllFragmentViews(false, false);
boolean sameLang = prevLocale == localeInfo;
final AlertDialog progressDialog = new AlertDialog(getContext(), 3);
int reqId = LocaleController.getInstance().applyLanguage(localeInfo, true, false, false, true, currentAccount, () -> {
progressDialog.dismiss();
if (!sameLang) {
actionBar.closeSearchField();
updateLanguage();
}
});
if (reqId != 0) {
progressDialog.setOnCancelListener(di -> {
ConnectionsManager.getInstance(currentAccount).cancelRequest(reqId, true);
});
}
String langCode = localeInfo.pluralLangCode,
prevLangCode = prevLocale.pluralLangCode;
@ -202,7 +243,9 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
}
preferences.edit().putStringSet("translate_button_restricted_languages", newSelectedLanguages).apply();
finishFragment();
if (!sameLang) {
progressDialog.showDelayed(500);
}
}
} catch (Exception e) {
FileLog.e(e);
@ -359,6 +402,22 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
}
}
private void updateLanguage() {
if (actionBar != null) {
actionBar.setTitleAnimated(LocaleController.getString("Language", R.string.Language), true, 350, CubicBezierInterpolator.EASE_OUT_QUINT);
}
if (listView != null) {
for (int i = 0; i < listView.getChildCount(); ++i) {
View child = listView.getChildAt(i);
if (child instanceof TranslateSettings || child instanceof HeaderCell) {
listAdapter.notifyItemChanged(listView.getChildAdapterPosition(child));
} else {
listAdapter.onBindViewHolder(listView.getChildViewHolder(child), listView.getChildAdapterPosition(child));
}
}
}
}
private void processSearch(final String query) {
Utilities.searchQueue.postRunnable(() -> {
@ -478,6 +537,21 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
update();
}
public void updateTranslations() {
header.setText(LocaleController.getString("TranslateMessages", R.string.TranslateMessages));
showButtonCheck.setTextAndCheck(
LocaleController.getString("ShowTranslateButton", R.string.ShowTranslateButton), getValue(), getValue()
);
showButtonCheck.updateRTL();
doNotTranslateCell.updateRTL();
info.setText(LocaleController.getString("TranslateMessagesInfo1", R.string.TranslateMessagesInfo1));
info.getTextView().setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
info2.setText(LocaleController.getString("TranslateMessagesInfo2", R.string.TranslateMessagesInfo2));
info2.getTextView().setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
update();
updateHeight();
}
private boolean getValue() {
return preferences.getBoolean("translate_button", false);
}
@ -521,15 +595,8 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
info.setTranslationY(-doNotTranslateCell.getHeight() * (1f - t));
info2.setAlpha(1f - t);
info2.setTranslationY(-doNotTranslateCell.getHeight() * (1f - t));
// header2.setTranslationY(-Math.max(doNotTranslateCell.getHeight(), info2.getHeight()));
// updateHeight();
// header2.setTranslationY(-doNotTranslateCell.getHeight());
// header2.setTranslationY(-doNotTranslateCell.getHeight() * (1f - t));
// ViewGroup.LayoutParams layoutParams = getLayoutParams();
// layoutParams.height = AndroidUtilities.dp(HEIGHT_CLOSED + (HEIGHT_OPEN - HEIGHT_CLOSED) * t);
// setLayoutParams(layoutParams);
translateSettingsBackgroundHeight = header.getMeasuredHeight() + showButtonCheck.getMeasuredHeight() + (int) (doNotTranslateCell.getAlpha() * doNotTranslateCell.getMeasuredHeight());
});
doNotTranslateCellAnimation.addListener(new AnimatorListenerAdapter() {
@Override
@ -540,11 +607,12 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
} else {
info2.setVisibility(View.VISIBLE);
}
translateSettingsBackgroundHeight = header.getMeasuredHeight() + showButtonCheck.getMeasuredHeight() + (int) (doNotTranslateCell.getAlpha() * doNotTranslateCell.getMeasuredHeight());
}
});
doNotTranslateCellAnimation.setDuration((long) (Math.abs(doNotTranslateCell.getAlpha() - (value ? 1f : 0f)) * 200));
doNotTranslateCellAnimation.start();
// updateHeight();
}
@ -576,6 +644,7 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
setLayoutParams(lp);
}
}
int height() {
return Math.max(AndroidUtilities.dp(40), header.getMeasuredHeight()) +
Math.max(AndroidUtilities.dp(50), showButtonCheck.getMeasuredHeight()) +
@ -661,7 +730,6 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
case 3:
HeaderCell header = new HeaderCell(mContext);
header.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
header.setText(LocaleController.getString("Language", R.string.Language));
view = header;
break;
case 1:
@ -679,7 +747,6 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
case 0: {
if (!search)
position -= 2;
// LanguageCell textSettingsCell = (LanguageCell) holder.itemView;
TextRadioCell textSettingsCell = (TextRadioCell) holder.itemView;
LocaleController.LocaleInfo localeInfo;
boolean last;
@ -718,7 +785,13 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
case 2: {
TranslateSettings translateSettings = (TranslateSettings) holder.itemView;
translateSettings.setVisibility(searching ? View.GONE : View.VISIBLE);
translateSettings.updateHeight();
translateSettings.updateTranslations();
break;
}
case 3: {
HeaderCell header = (HeaderCell) holder.itemView;
header.setText(LocaleController.getString("Language", R.string.Language));
break;
}
}
}

View file

@ -3043,7 +3043,7 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
for (int a = 0, N = res.messages.size(); a < N; a++) {
arrayList.add(new MessageObject(UserConfig.selectedAccount, res.messages.get(a), true, true));
}
if (!arrayList.isEmpty()) {
if (!arrayList.isEmpty() || chat.forum && threadId != null && threadId == 1) {
if (chat.forum) {
TLRPC.TL_channels_getForumTopicsByID getForumTopicsByID = new TLRPC.TL_channels_getForumTopicsByID();
getForumTopicsByID.channel = MessagesController.getInstance(currentAccount).getInputChannel(chat.id);
@ -3063,11 +3063,17 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
TLRPC.TL_forumTopic topic = MessagesController.getInstance(currentAccount).getTopicsController().findTopic(chat.id, threadId);
if (topic != null) {
Bundle args = new Bundle();
args.putLong("chat_id", -arrayList.get(0).getDialogId());
args.putLong("chat_id", chat.id);
if (messageId != topic.id) {
args.putInt("message_id", Math.max(1, messageId));
}
ChatActivity chatActivity = new ChatActivity(args);
if (arrayList.isEmpty()) {
TLRPC.Message message = new TLRPC.Message();
message.id = 1;
message.action = new TLRPC.TL_messageActionChannelMigrateFrom();
arrayList.add(new MessageObject(currentAccount, message, false, false));
}
chatActivity.setThreadMessages(arrayList, chat, req.msg_id, topic.read_inbox_max_id, topic.read_outbox_max_id, topic);
if (commentId != null) {
chatActivity.setHighlightMessageId(commentId);

View file

@ -49,6 +49,7 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
import android.view.WindowManager;
import android.view.animation.OvershootInterpolator;
import android.widget.EditText;
import android.widget.FrameLayout;
@ -79,6 +80,8 @@ 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.Theme;
@ -224,6 +227,8 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
public final static int LOCATION_TYPE_GROUP_VIEW = 5;
public final static int LOCATION_TYPE_LIVE_VIEW = 6;
private ActionBarPopupWindow popupWindow;
private Runnable markAsReadRunnable;
public static class VenueLocation {
@ -542,7 +547,7 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
} else if (id == share_live_location) {
openShareLiveLocation(0);
} else if (id == get_directions) {
openDirections();
openDirections(null);
}
}
});
@ -951,7 +956,24 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
listView.setAdapter(adapter = new LocationActivityAdapter(context, locationType, dialogId, false, null) {
@Override
protected void onDirectionClick() {
openDirections();
openDirections(null);
}
@Override
public void setLiveLocations(ArrayList<LiveLocation> liveLocations) {
if (messageObject != null && messageObject.isLiveLocation()) {
int otherPeopleLocations = 0;
if (liveLocations != null) {
for (int i = 0; i < liveLocations.size(); ++i) {
LiveLocation loc = liveLocations.get(i);
if (loc != null && !UserObject.isUserSelf(loc.user)) {
otherPeopleLocations++;
}
}
}
otherItem.setVisibility(otherPeopleLocations == 1 ? View.VISIBLE : View.GONE);
}
super.setLiveLocations(liveLocations);
}
});
adapter.setMyLocationDenied(locationDenied);
@ -978,6 +1000,47 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
}
});
((DefaultItemAnimator) listView.getItemAnimator()).setDelayAnimations(false);
listView.setOnItemLongClickListener((view, position) -> {
if (locationType == 2) {
Object object = adapter.getItem(position);
if (object instanceof LiveLocation) {
final LiveLocation location = (LiveLocation) object;
ActionBarPopupWindow.ActionBarPopupWindowLayout popupLayout = new ActionBarPopupWindow.ActionBarPopupWindowLayout(context);
ActionBarMenuSubItem cell = new ActionBarMenuSubItem(getParentActivity(), true, true, getResourceProvider());
cell.setMinimumWidth(AndroidUtilities.dp(200));
cell.setTextAndIcon(LocaleController.getString("GetDirections", R.string.GetDirections), R.drawable.navigate);
cell.setOnClickListener(e -> {
openDirections(location);
if (popupWindow != null) {
popupWindow.dismiss();
}
});
popupLayout.addView(cell);
popupWindow = new ActionBarPopupWindow(popupLayout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT) {
@Override
public void dismiss() {
super.dismiss();
popupWindow = null;
}
};
popupWindow.setOutsideTouchable(true);
popupWindow.setClippingEnabled(true);
popupWindow.setInputMethodMode(ActionBarPopupWindow.INPUT_METHOD_NOT_NEEDED);
popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED);
int[] loc = new int[2];
view.getLocationInWindow(loc);
popupWindow.showAtLocation(view, Gravity.TOP, 0, loc[1] - AndroidUtilities.dp(48 + 4));
popupWindow.dimBehind();
return true;
}
}
return false;
});
listView.setOnItemClickListener((view, position) -> {
if (locationType == LOCATION_TYPE_GROUP) {
if (position == 1) {
@ -1289,9 +1352,12 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
return AndroidUtilities.computePerceivedBrightness(color) < 0.721f;
}
private void openDirections() {
private void openDirections(LiveLocation location) {
double daddrLat, daddrLong;
if (messageObject != null) {
if (location != null && location.object != null) {
daddrLat = location.object.media.geo.lat;
daddrLong = location.object.media.geo._long;
} else if (messageObject != null) {
daddrLat = messageObject.messageOwner.media.geo.lat;
daddrLong = messageObject.messageOwner.media.geo._long;
} else {

View file

@ -298,7 +298,7 @@ public class NotificationsSoundActivity extends BaseFragment implements ChatAtta
if (dialogId < 0) {
if (topicId != 0) {
TLRPC.TL_forumTopic forumTopic = getMessagesController().getTopicsController().findTopic(-dialogId, topicId);
ForumUtilities.setTopicIcon(avatarContainer.getAvatarImageView(), forumTopic, true, resourcesProvider);
ForumUtilities.setTopicIcon(avatarContainer.getAvatarImageView(), forumTopic, false, true, resourcesProvider);
avatarContainer.setTitle(forumTopic.title);
} else {
TLRPC.Chat chatLocal = getMessagesController().getChat(-dialogId);

View file

@ -758,7 +758,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
if (y1 != 0) {
if (previousTransitionFragment != null && previousTransitionFragment.getContentView() != null) {
AndroidUtilities.rectTmp2.set(0, 0, getMeasuredWidth(), y1);
if (previousTransitionFragment.getActionBar() != null && previousTransitionFragment.getActionBar().getBackground() == null) {
if (previousTransitionFragment.getActionBar() != null && !previousTransitionFragment.getContentView().blurWasDrawn() && previousTransitionFragment.getActionBar().getBackground() == null) {
paint.setColor(Theme.getColor(Theme.key_actionBarDefault, previousTransitionFragment.getResourceProvider()));
canvas.drawRect(AndroidUtilities.rectTmp2, paint);
} else {
@ -7230,8 +7230,11 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
icon.setLayerNum(7);
icon.setRoundRadius(AndroidUtilities.dp(4));
icon.setImage(mediaLocation, mediaFilter, ImageLocation.getForDocument(thumb, document), "140_140", thumbDrawable, document);
if (((AnimatedEmojiDrawable) emojiStatusDrawable[1].getDrawable()).canOverrideColor()) {
icon.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_windowBackgroundWhiteBlueIcon), PorterDuff.Mode.MULTIPLY));
if (AnimatedEmojiDrawable.isDefaultStatusEmoji(emojiStatusDrawable[1].getDrawable())) {
icon.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_windowBackgroundWhiteBlueIcon), PorterDuff.Mode.SRC_IN));
} else if (((AnimatedEmojiDrawable) emojiStatusDrawable[1].getDrawable()).canOverrideColor()) {
icon.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_windowBackgroundWhiteBlackText), PorterDuff.Mode.SRC_IN));
premiumPreviewBottomSheet.statusStickerSet = MessageObject.getInputStickerSet(document);
} else {
premiumPreviewBottomSheet.statusStickerSet = MessageObject.getInputStickerSet(document);
}
@ -7436,7 +7439,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
imageLocation = null;
thumbLocation = null;
videoLocation = null;
ForumUtilities.setTopicIcon(avatarImage, topic, true, resourcesProvider);
ForumUtilities.setTopicIcon(avatarImage, topic, true, true, resourcesProvider);
} else {
avatarDrawable.setInfo(chat);
imageLocation = ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_BIG);

View file

@ -321,7 +321,7 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
if (dialogId < 0) {
if (topicId != 0) {
TLRPC.TL_forumTopic forumTopic = getMessagesController().getTopicsController().findTopic(-dialogId, topicId);
ForumUtilities.setTopicIcon(avatarContainer.getAvatarImageView(), forumTopic, true, resourcesProvider);
ForumUtilities.setTopicIcon(avatarContainer.getAvatarImageView(), forumTopic, false, true, resourcesProvider);
avatarContainer.setTitle(forumTopic.title);
} else {
TLRPC.Chat chatLocal = getMessagesController().getChat(-dialogId);

View file

@ -405,7 +405,7 @@ public class QrActivity extends BaseFragment {
}
private boolean phoneIsPublic() {
final ArrayList<TLRPC.PrivacyRule> privacyRules = ContactsController.getInstance(currentAccount).getPrivacyRules(ContactsController.PRIVACY_RULES_TYPE_PHONE);
ArrayList<TLRPC.PrivacyRule> privacyRules = ContactsController.getInstance(currentAccount).getPrivacyRules(ContactsController.PRIVACY_RULES_TYPE_PHONE);
if (privacyRules == null) {
return false;
}
@ -423,6 +423,23 @@ public class QrActivity extends BaseFragment {
break;
}
}
if (type == 2) {
privacyRules = ContactsController.getInstance(currentAccount).getPrivacyRules(ContactsController.PRIVACY_RULES_TYPE_ADDED_BY_PHONE);
if (privacyRules == null || privacyRules.size() == 0) {
return true;
} else {
for (int a = 0; a < privacyRules.size(); a++) {
TLRPC.PrivacyRule rule = privacyRules.get(a);
if (rule instanceof TLRPC.TL_privacyValueAllowAll) {
return true;
} else if (rule instanceof TLRPC.TL_privacyValueDisallowAll) {
return false;
} else if (rule instanceof TLRPC.TL_privacyValueAllowContacts) {
return false;
}
}
}
}
return type == 0 || type == 1;
}

View file

@ -380,7 +380,7 @@ public class SelectAnimatedEmojiDialog extends FrameLayout implements Notificati
selectorPaint.setColor(Theme.getColor(Theme.key_listSelector, resourcesProvider));
selectorAccentPaint.setColor(ColorUtils.setAlphaComponent(Theme.getColor(Theme.key_windowBackgroundWhiteBlueIcon, resourcesProvider), 30));
premiumStarColorFilter = new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteBlueIcon, resourcesProvider), PorterDuff.Mode.MULTIPLY);
premiumStarColorFilter = new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteBlueIcon, resourcesProvider), PorterDuff.Mode.SRC_IN);
this.emojiX = emojiX;
final Integer bubbleX = emojiX == null ? null : MathUtils.clamp(emojiX, AndroidUtilities.dp(26), AndroidUtilities.dp(340 - 48));
@ -482,6 +482,12 @@ public class SelectAnimatedEmojiDialog extends FrameLayout implements Notificati
dismiss.run();
}
} : null) {
@Override
protected ColorFilter getEmojiColorFilter() {
return premiumStarColorFilter;
}
@Override
protected boolean onTabClick(int index) {
if (smoothScrolling) {
@ -1039,7 +1045,7 @@ public class SelectAnimatedEmojiDialog extends FrameLayout implements Notificati
canvas.translate(0, -getTranslationY());
emojiSelectView.drawable.setAlpha((int) (255 * emojiSelectAlpha));
emojiSelectView.drawable.setBounds(emojiSelectRect);
emojiSelectView.drawable.setColorFilter(new PorterDuffColorFilter(ColorUtils.blendARGB(Theme.getColor(Theme.key_windowBackgroundWhiteBlueIcon, resourcesProvider), scrimColor, 1f - scrimAlpha), PorterDuff.Mode.MULTIPLY));
emojiSelectView.drawable.setColorFilter(new PorterDuffColorFilter(ColorUtils.blendARGB(Theme.getColor(Theme.key_windowBackgroundWhiteBlueIcon, resourcesProvider), scrimColor, 1f - scrimAlpha), PorterDuff.Mode.SRC_IN));
emojiSelectView.drawable.draw(canvas);
canvas.restore();
}
@ -3433,12 +3439,13 @@ public class SelectAnimatedEmojiDialog extends FrameLayout implements Notificati
private void drawImage(Canvas canvas, Drawable drawable, ImageViewEmoji imageView, float alpha) {
if (drawable != null) {
drawable.setColorFilter(premiumStarColorFilter);
drawable.setAlpha((int) (255 * alpha));
if (drawable instanceof AnimatedEmojiDrawable) {
((AnimatedEmojiDrawable) drawable).draw(canvas, false);
drawable.setColorFilter(premiumStarColorFilter);
} else {
drawable.draw(canvas);
drawable.setColorFilter(premiumStarColorFilter);
}
if (imageView.premiumLockIconView != null) {
@ -4228,7 +4235,7 @@ public class SelectAnimatedEmojiDialog extends FrameLayout implements Notificati
}
imageReceiver.setImage(mediaLocation, mediaFilter, ImageLocation.getForDocument(thumb, document), filter, null, null, thumbDrawable, document.size, null, document, 1);
if (imageViewEmoji.drawable instanceof AnimatedEmojiDrawable && ((AnimatedEmojiDrawable) imageViewEmoji.drawable).canOverrideColor()) {
imageReceiver.setColorFilter(premiumStarColorFilter);
imageReceiver.setColorFilter(AnimatedEmojiDrawable.isDefaultStatusEmoji((AnimatedEmojiDrawable) imageViewEmoji.drawable) ? premiumStarColorFilter : Theme.chat_animatedEmojiTextColorFilter);
}
}

View file

@ -224,10 +224,20 @@ public class TopicCreateFragment extends BaseFragment {
editForumRequest.icon_emoji_id = selectedEmojiDocumentId;
editForumRequest.flags |= 2;
}
if (checkBoxCell != null) {
editForumRequest.hidden = !checkBoxCell.isChecked();
editForumRequest.flags |= 8;
}
// if (checkBoxCell != null ) {
// editForumRequest.hidden = !checkBoxCell.isChecked();
// editForumRequest.flags |= 8;
// }
ConnectionsManager.getInstance(currentAccount).sendRequest(editForumRequest, (response, error) -> {
});
}
if (checkBoxCell != null && topicForEdit.id == 1 && !checkBoxCell.isChecked() != topicForEdit.hidden) {
TLRPC.TL_channels_editForumTopic editForumRequest = new TLRPC.TL_channels_editForumTopic();
editForumRequest.channel = getMessagesController().getInputChannel(chatId);
editForumRequest.topic_id = topicForEdit.id;
editForumRequest.hidden = !checkBoxCell.isChecked();
editForumRequest.flags |= 8;
ConnectionsManager.getInstance(currentAccount).sendRequest(editForumRequest, (response, error) -> {
});
@ -520,6 +530,7 @@ public class TopicCreateFragment extends BaseFragment {
if (docId != 0) {
AnimatedEmojiDrawable animatedEmojiDrawable = new AnimatedEmojiDrawable(AnimatedEmojiDrawable.CACHE_TYPE_FORUM_TOPIC, currentAccount, docId);
animatedEmojiDrawable.setColorFilter(Theme.chat_animatedEmojiTextColorFilter);
backupImageView[1].setAnimatedEmojiDrawable(animatedEmojiDrawable);
backupImageView[1].setImageDrawable(null);
} else {

View file

@ -468,7 +468,7 @@ public class TopicsFragment extends BaseFragment implements NotificationCenter.N
}
};
contentView.needBlur = true;
contentView.needBlur = !inPreviewMode;
actionBar.setAddToContainer(false);
actionBar.setCastShadows(false);
@ -2879,6 +2879,9 @@ public class TopicsFragment extends BaseFragment implements NotificationCenter.N
if (this.animatedEmojiDrawable != null && attached) {
this.animatedEmojiDrawable.removeView(this);
}
if (animatedEmojiDrawable != null) {
animatedEmojiDrawable.setColorFilter(Theme.chat_animatedEmojiTextColorFilter);
}
this.animatedEmojiDrawable = animatedEmojiDrawable;
if (animatedEmojiDrawable != null && attached) {
animatedEmojiDrawable.addView(this);