update to 10.2.3 (4075)

This commit is contained in:
dkaraush 2023-11-02 14:51:24 +04:00
parent dfaff8c01d
commit c319639e9a
44 changed files with 844 additions and 299 deletions

View file

@ -1245,7 +1245,7 @@ void ConnectionsManager::processServerResponse(TLObject *message, int64_t messag
if (!request->respondsToMessageId(resultMid)) {
continue;
}
if (LOGS_ENABLED) DEBUG_D("got response for request %p - %s", request->rawRequest, typeid(*request->rawRequest).name());
if (LOGS_ENABLED) DEBUG_D("got response for request %p - %s (messageId = 0x%" PRIx64 ")", request->rawRequest, typeid(*request->rawRequest).name(), request->messageId);
bool discardResponse = false;
bool isError = false;
bool allowInitConnection = true;

View file

@ -5517,4 +5517,18 @@ public class AndroidUtilities {
}
context.setTheme(Theme.isCurrentThemeDark() && open ? R.style.Theme_TMessages_Dark : R.style.Theme_TMessages);
}
private static Boolean isHonor;
public static boolean isHonor() {
if (isHonor == null) {
try {
final String brand = Build.BRAND.toLowerCase();
isHonor = brand.contains("huawei") || brand.contains("honor");
} catch (Exception e) {
FileLog.e(e);
isHonor = false;
}
}
return isHonor;
}
}

View file

@ -92,6 +92,10 @@ public class BillingController implements PurchasesUpdatedListener, BillingClien
}
public String formatCurrency(long amount, String currency, int exp) {
return formatCurrency(amount, currency, exp, false);
}
public String formatCurrency(long amount, String currency, int exp, boolean rounded) {
if (currency.isEmpty()) {
return String.valueOf(amount);
}
@ -99,6 +103,9 @@ public class BillingController implements PurchasesUpdatedListener, BillingClien
if (cur != null) {
NumberFormat numberFormat = NumberFormat.getCurrencyInstance();
numberFormat.setCurrency(cur);
if (rounded) {
return numberFormat.format(Math.round(amount / Math.pow(10, exp)));
}
return numberFormat.format(amount / Math.pow(10, exp));
}
return amount + " " + currency;

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 = 4071;
public static String BUILD_VERSION_STRING = "10.2.2";
public static int BUILD_VERSION = 4075;
public static String BUILD_VERSION_STRING = "10.2.3";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";

View file

@ -144,7 +144,7 @@ public class ChatMessagesMetadataController {
});
reactionsRequests.add(reqId);
if (reactionsRequests.size() > 5) {
chatActivity.getConnectionsManager().cancelRequest(reactionsRequests.remove(0), false);
chatActivity.getConnectionsManager().cancelRequest(reactionsRequests.remove(0), true);
}
}

View file

@ -82,7 +82,7 @@ public class DownloadController extends BaseController implements NotificationCe
public final SparseArray<MessageObject> unviewedDownloads = new SparseArray<>();
public static class Preset {
public int[] mask = new int[5];
public int[] mask = new int[4];
public long[] sizes = new long[4];
public boolean preloadVideo;
public boolean preloadMusic;

View file

@ -90,6 +90,7 @@ import java.util.Objects;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -1294,31 +1295,6 @@ public class MediaDataController extends BaseController {
return set;
}
private void fetchStickerSetInternal(long id, Integer hash, Utilities.Callback2<Boolean, TLRPC.TL_messages_stickerSet> onDone) {
if (onDone == null) {
return;
}
TLRPC.TL_messages_getStickerSet req = new TLRPC.TL_messages_getStickerSet();
TLRPC.TL_inputStickerSetID inputStickerSetID = new TLRPC.TL_inputStickerSetID();
inputStickerSetID.id = id;
req.stickerset = inputStickerSetID;
if (hash != null) {
req.hash = hash;
}
getConnectionsManager().sendRequest(req, (response, error) -> {
AndroidUtilities.runOnUIThread(() -> {
// if (error != null && "".equals(error.text)) {
// onDone.run(true, null);
// } else
if (response != null) {
onDone.run(true, (TLRPC.TL_messages_stickerSet) response);
} else {
onDone.run(false, null);
}
});
});
}
private final HashMap<TLRPC.InputStickerSet, ArrayList<Utilities.Callback2<Boolean, TLRPC.TL_messages_stickerSet>>> loadingStickerSets = new HashMap<>();
private void fetchStickerSetInternal(TLRPC.InputStickerSet inputStickerSet, Utilities.Callback2<Boolean, TLRPC.TL_messages_stickerSet> onDone) {
@ -5603,20 +5579,18 @@ public class MediaDataController extends BaseController {
LongSparseArray<ArrayList<MessageObject>> finalMessagesWithUnknownStories = messagesWithUnknownStories;
int[] requestsCount = new int[] {2};
AtomicInteger requestsCount = new AtomicInteger(2);
getMessagesStorage().getStorageQueue().postRunnable(() -> {
try {
getMessagesController().getStoriesController().fillMessagesWithStories(finalMessagesWithUnknownStories, () -> {
requestsCount[0]--;
if (requestsCount[0] == 0) {
if (requestsCount.decrementAndGet() == 0) {
if (callback != null) {
AndroidUtilities.runOnUIThread(callback);
}
}
}, classGuid);
if (replyMessageOwners.isEmpty()) {
requestsCount[0]--;
if (requestsCount[0] == 0) {
if (requestsCount.decrementAndGet() == 0) {
if (callback != null) {
AndroidUtilities.runOnUIThread(callback);
}
@ -5743,8 +5717,7 @@ public class MediaDataController extends BaseController {
saveReplyMessages(replyMessageOwners, messagesRes.messages, scheduled);
}
}
requestsCount[0]--;
if (requestsCount[0] == 0) {
if (requestsCount.decrementAndGet() == 0) {
if (callback != null) {
AndroidUtilities.runOnUIThread(callback);
}
@ -5772,8 +5745,7 @@ public class MediaDataController extends BaseController {
getMessagesStorage().putUsersAndChats(messagesRes.users, messagesRes.chats, true, true);
saveReplyMessages(replyMessageOwners, messagesRes.messages, scheduled);
}
requestsCount[0]--;
if (requestsCount[0] == 0) {
if (requestsCount.decrementAndGet() == 0) {
if (callback != null) {
AndroidUtilities.runOnUIThread(callback);
}
@ -5799,8 +5771,7 @@ public class MediaDataController extends BaseController {
getMessagesStorage().putUsersAndChats(messagesRes.users, messagesRes.chats, true, true);
saveReplyMessages(replyMessageOwners, messagesRes.messages, scheduled);
}
requestsCount[0]--;
if (requestsCount[0] == 0) {
if (requestsCount.decrementAndGet() == 0) {
if (callback != null) {
AndroidUtilities.runOnUIThread(callback);
}
@ -5812,8 +5783,7 @@ public class MediaDataController extends BaseController {
}
}
} else {
requestsCount[0]--;
if (requestsCount[0] == 0) {
if (requestsCount.decrementAndGet() == 0) {
if (callback != null) {
AndroidUtilities.runOnUIThread(callback);
}

View file

@ -826,7 +826,7 @@ public class MessageObject {
if (checkCaption && captionMessage == null) {
captionMessage = messageObject;
checkCaption = false;
} else {
} else if (!isDocuments) {
captionMessage = null;
}
hasCaption = true;

View file

@ -3953,7 +3953,19 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
anotherChat = true;
}
}
final boolean anotherTopic = replyToTopMsg != null && replyToTopMsg.getId() != replyToMsg.getId() && MessageObject.getTopicId(replyToMsg.messageOwner, true) != replyToTopMsg.getId();
boolean anotherTopic = false;
if (replyToMsg != null) {
boolean isForum = false;
if (!isForum) {
TLRPC.Chat chat = getMessagesController().getChat(-DialogObject.getPeerDialogId(newMsg.peer_id));
if (ChatObject.isForum(chat)) {
isForum = true;
}
}
if (isForum) {
anotherTopic = replyToTopMsg.getId() != replyToMsg.getId() && MessageObject.getTopicId(replyToMsg.messageOwner, true) != replyToTopMsg.getId();
}
}
if (anotherChat || anotherTopic) {
newMsg.reply_to.flags |= 1;
newMsg.reply_to.reply_to_peer_id = peer2;

View file

@ -377,7 +377,7 @@ public class ConnectionsManager extends BaseController {
resp.networkType = networkType;
}
if (BuildVars.LOGS_ENABLED) {
FileLog.d("java received " + resp + " error = " + error);
FileLog.d("java received " + resp + " error = " + error + " messageId = " + requestMsgId);
}
FileLog.dumpResponseAndRequest(object, resp, error, requestMsgId, finalStartRequestTime, requestToken);
final TLObject finalResponse = resp;

View file

@ -768,7 +768,7 @@ public class AlertDialog extends Dialog implements Drawable.Callback, Notificati
} else {
scrollContainer.addView(messageTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (topAnimationIsNew ? Gravity.CENTER_HORIZONTAL : LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 24, 0, 24, customView != null || items != null ? customViewOffset : 0));
if (bottomView != null) {
scrollContainer.addView(bottomView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 24, -16, 24, 0));
scrollContainer.addView(bottomView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 24, -24, 24, 0));
}
}
if (!TextUtils.isEmpty(message)) {
@ -907,7 +907,12 @@ public class AlertDialog extends Dialog implements Drawable.Callback, Notificati
}
};
}
if(bottomView != null) {
buttonsLayout.setPadding(AndroidUtilities.dp(16), 0, AndroidUtilities.dp(16), AndroidUtilities.dp(4));
buttonsLayout.setTranslationY(-AndroidUtilities.dp(6));
} else {
buttonsLayout.setPadding(AndroidUtilities.dp(8), AndroidUtilities.dp(8), AndroidUtilities.dp(8), AndroidUtilities.dp(8));
}
containerView.addView(buttonsLayout, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 52));
if (topAnimationIsNew) {
buttonsLayout.setTranslationY(-AndroidUtilities.dp(8));

View file

@ -3507,25 +3507,6 @@ public class Theme {
public static int[] keys_avatar_background2 = {key_avatar_background2Red, key_avatar_background2Orange, key_avatar_background2Violet, key_avatar_background2Green, key_avatar_background2Cyan, key_avatar_background2Blue, key_avatar_background2Pink};
public static int[] keys_avatar_nameInMessage = {key_avatar_nameInMessageRed, key_avatar_nameInMessageOrange, key_avatar_nameInMessageViolet, key_avatar_nameInMessageGreen, key_avatar_nameInMessageCyan, key_avatar_nameInMessageBlue, key_avatar_nameInMessagePink};
public static final int key_avatar_composite_nameInMessageRed = colorsCount++;
public static final int key_avatar_composite_nameInMessageOrange = colorsCount++;
public static final int key_avatar_composite_nameInMessageViolet = colorsCount++;
public static final int key_avatar_composite_nameInMessageGreen = colorsCount++;
public static final int key_avatar_composite_nameInMessageCyan = colorsCount++;
public static final int key_avatar_composite_nameInMessageBlue = colorsCount++;
public static final int key_avatar_composite_nameInMessagePink = colorsCount++;
public static final int key_avatar_composite_nameInMessageRed2 = colorsCount++;
public static final int key_avatar_composite_nameInMessageOrange2 = colorsCount++;
public static final int key_avatar_composite_nameInMessageViolet2 = colorsCount++;
public static final int key_avatar_composite_nameInMessageGreen2 = colorsCount++;
public static final int key_avatar_composite_nameInMessageCyan2 = colorsCount++;
public static final int key_avatar_composite_nameInMessageBlue2 = colorsCount++;
public static final int key_avatar_composite_nameInMessagePink2 = colorsCount++;
public static int[] keys_avatar_composite_nameInMessage = {key_avatar_composite_nameInMessageRed, key_avatar_composite_nameInMessageOrange, key_avatar_composite_nameInMessageViolet, key_avatar_composite_nameInMessageGreen, key_avatar_composite_nameInMessageCyan, key_avatar_composite_nameInMessageBlue, key_avatar_composite_nameInMessagePink};
public static int[] keys_avatar_composite_nameInMessage2 = {key_avatar_composite_nameInMessageRed2, key_avatar_composite_nameInMessageOrange2, key_avatar_composite_nameInMessageViolet2, key_avatar_composite_nameInMessageGreen2, key_avatar_composite_nameInMessageCyan2, key_avatar_composite_nameInMessageBlue2, key_avatar_composite_nameInMessagePink2};
public static final int key_actionBarDefault = colorsCount++;
public static final int key_actionBarDefaultSelector = colorsCount++;
public static final int key_actionBarWhiteSelector = colorsCount++;
@ -4398,12 +4379,6 @@ public class Theme {
for (int i = 0; i < keys_avatar_nameInMessage.length; i++) {
themeAccentExclusionKeys.add(keys_avatar_nameInMessage[i]);
}
for (int i = 0; i < keys_avatar_composite_nameInMessage.length; i++) {
themeAccentExclusionKeys.add(keys_avatar_composite_nameInMessage[i]);
}
for (int i = 0; i < keys_avatar_composite_nameInMessage2.length; i++) {
themeAccentExclusionKeys.add(keys_avatar_composite_nameInMessage2[i]);
}
for (int i = 0; i < keys_colors.length; i++) {
themeAccentExclusionKeys.add(keys_colors[i]);
}

View file

@ -172,22 +172,6 @@ public class ThemeColors {
defaultColors[key_avatar_nameInMessageBlue] = 0xff368AD1;
defaultColors[key_avatar_nameInMessagePink] = 0xffC7508B;
defaultColors[key_avatar_composite_nameInMessageRed] = 0xffE15052;
defaultColors[key_avatar_composite_nameInMessageOrange] = 0xffE0802B;
defaultColors[key_avatar_composite_nameInMessageViolet] = 0xffA05FF3;
defaultColors[key_avatar_composite_nameInMessageGreen] = 0xff27A910;
defaultColors[key_avatar_composite_nameInMessageCyan] = 0xff27ACCE;
defaultColors[key_avatar_composite_nameInMessageBlue] = 0xff3391D4;
defaultColors[key_avatar_composite_nameInMessagePink] = 0xffD14972;
defaultColors[key_avatar_composite_nameInMessageRed2] = 0xffF9AE63;
defaultColors[key_avatar_composite_nameInMessageOrange2] = 0xffFAC534;
defaultColors[key_avatar_composite_nameInMessageViolet2] = 0xffF48FFF;
defaultColors[key_avatar_composite_nameInMessageGreen2] = 0xffA7DC57;
defaultColors[key_avatar_composite_nameInMessageCyan2] = 0xff82E8D6;
defaultColors[key_avatar_composite_nameInMessageBlue2] = 0xff7DD3F0;
defaultColors[key_avatar_composite_nameInMessagePink2] = 0xffFFBE9F;
defaultColors[key_actionBarDefault] = 0xff527da3;
defaultColors[key_actionBarDefaultIcon] = 0xffffffff;
defaultColors[key_actionBarActionModeDefault] = 0xffffffff;
@ -962,20 +946,6 @@ public class ThemeColors {
colorKeysMap.put(key_avatar_nameInMessageCyan, "avatar_nameInMessageCyan");
colorKeysMap.put(key_avatar_nameInMessageBlue, "avatar_nameInMessageBlue");
colorKeysMap.put(key_avatar_nameInMessagePink, "avatar_nameInMessagePink");
colorKeysMap.put(key_avatar_composite_nameInMessageRed, "avatar_composite_nameInMessageRed");
colorKeysMap.put(key_avatar_composite_nameInMessageOrange, "avatar_composite_nameInMessageOrange");
colorKeysMap.put(key_avatar_composite_nameInMessageViolet, "avatar_composite_nameInMessageViolet");
colorKeysMap.put(key_avatar_composite_nameInMessageGreen, "avatar_composite_nameInMessageGreen");
colorKeysMap.put(key_avatar_composite_nameInMessageCyan, "avatar_composite_nameInMessageCyan");
colorKeysMap.put(key_avatar_composite_nameInMessageBlue, "avatar_composite_nameInMessageBlue");
colorKeysMap.put(key_avatar_composite_nameInMessagePink, "avatar_composite_nameInMessagePink");
colorKeysMap.put(key_avatar_composite_nameInMessageRed2, "avatar_composite_nameInMessageRed2");
colorKeysMap.put(key_avatar_composite_nameInMessageOrange2, "avatar_composite_nameInMessageOrange2");
colorKeysMap.put(key_avatar_composite_nameInMessageViolet2, "avatar_composite_nameInMessageViolet2");
colorKeysMap.put(key_avatar_composite_nameInMessageGreen2, "avatar_composite_nameInMessageGreen2");
colorKeysMap.put(key_avatar_composite_nameInMessageCyan2, "avatar_composite_nameInMessageCyan2");
colorKeysMap.put(key_avatar_composite_nameInMessageBlue2, "avatar_composite_nameInMessageBlue2");
colorKeysMap.put(key_avatar_composite_nameInMessagePink2, "avatar_composite_nameInMessagePink2");
colorKeysMap.put(key_actionBarDefault, "actionBarDefault");
colorKeysMap.put(key_actionBarDefaultSelector, "actionBarDefaultSelector");
colorKeysMap.put(key_actionBarWhiteSelector, "actionBarWhiteSelector");

View file

@ -5345,7 +5345,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
siteNameLayoutWidth = 0;
for (int i = 0; i < siteNameLayout.getLineCount(); ++i) {
int left = (int) siteNameLayout.getLineLeft(i);
if ((siteNameLeft == 0 || i == 0) != (left == 0)) {
if (i > 0 && (siteNameLeft == 0) != (left == 0)) {
siteNameLayoutWidth = siteNameLayout.getWidth();
}
siteNameLeft = Math.min(siteNameLeft, left);
@ -5447,7 +5447,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
authorLayoutWidth = 0;
for (int i = 0; i < authorLayout.getLineCount(); ++i) {
int left = (int) authorLayout.getLineLeft(i);
if ((authorLayoutLeft == 0 || i == 0) != (left == 0)) {
if (i > 0 && (authorLayoutLeft == 0) != (left == 0)) {
authorLayoutWidth = authorLayout.getWidth();
}
authorLayoutLeft = (int) Math.min(authorLayoutLeft, left);
@ -12015,7 +12015,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
replyBackgroundRadii[2] = replyBackgroundRadii[3] = block.first && namesOffset <= 0 && !caption ? ((!currentMessageObject.isOutOwner() || !pinnedTop) ? rad / 3f * 2f : nearRad) : defrad;
replyBackgroundRadii[4] = replyBackgroundRadii[5] = replyBackgroundRadii[6] = replyBackgroundRadii[7] = defrad;
replyRoundRectPath.addRoundRect(AndroidUtilities.rectTmp, replyBackgroundRadii, Path.Direction.CW);
canvas.save();
canvas.translate((block.isRtl() ? rtlOffset - (block.quote ? AndroidUtilities.dp(10) : 0) : 0), 0);
canvas.drawPath(replyRoundRectPath, Theme.chat_msgCodeBgPaint);
canvas.restore();
}
}
if (a == linkSelectionBlockNum && quoteHighlight == null && !urlPathSelection.isEmpty() && !drawOnlyText) {
@ -14092,11 +14095,13 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
replyTextRTL = AndroidUtilities.isRTL(sb);
if (isReplyQuote) {
maxWidth += AndroidUtilities.dp(16);
// maxWidth += AndroidUtilities.dp(12);
// replyTextWidth += AndroidUtilities.dp(24);
}
if (isReplyQuote && needReplyImage && !replyTextRTL) {
sb.setSpan(new LeadingMarginSpan.Standard(AndroidUtilities.dp(35 + 3), 0), 0, sb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
replyTextWidth -= AndroidUtilities.dp(33);
final float sz = AndroidUtilities.dp(isReplyQuote ? 3 : 7) + Theme.chat_replyNamePaint.getTextSize() + Theme.chat_replyTextPaint.getTextSize();
sb.setSpan(new LeadingMarginSpan.Standard((int) sz + AndroidUtilities.dp(4), 0), 0, sb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
replyTextWidth -= sz;
}
if (!isReplyQuote || currentMessageObject.shouldDrawWithoutBackground() || Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
stringFinalText = TextUtils.ellipsize(sb, textPaint, maxWidth, TextUtils.TruncateAt.END);
@ -14131,7 +14136,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
for (int i = 0; i < replyTextLayout.getLineCount(); ++i) {
width = Math.max(width, (int) Math.ceil(replyTextLayout.getLineWidth(i)));
int left = (int) Math.ceil(replyTextLayout.getLineLeft(i));
if ((replyTextOffset == 0 || i == 0) != (left == 0)) {
if (i > 0 && (replyTextOffset == 0) != (left == 0)) {
width = replyTextLayout.getWidth();
}
replyTextOffset = Math.min(replyTextOffset, left);
@ -14367,22 +14372,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
Theme.chat_msgTextCodePaint.linkColor =
Theme.chat_msgTextCode2Paint.linkColor =
Theme.chat_msgTextCode3Paint.linkColor = getThemedColor(Theme.key_chat_messageLinkOut);
// } else if (currentMessageObject.overrideLinkColor >= 0 || currentMessageObject.isFromUser() && currentUser != null || currentMessageObject.isFromChannel() && currentChat != null) {
// int color;
// if (currentMessageObject.overrideLinkColor >= 0) {
// color = currentMessageObject.overrideLinkColor;
// } else if (currentMessageObject.isFromUser() && currentUser != null) {
// color = currentUser.color;
// } else {
// color = currentChat.color;
// }
// int hueColor = Theme.isCurrentThemeDark() ? AvatarDrawable.getNameColorKey2For(color) : AvatarDrawable.getNameColorKey1For(color);
// Theme.chat_msgTextPaint.setColor(Theme.adaptHue(getThemedColor(Theme.key_chat_messageTextIn), hueColor));
// Theme.chat_msgGameTextPaint.setColor(Theme.adaptHue(getThemedColor(Theme.key_chat_messageTextIn), hueColor));
// Theme.chat_msgGameTextPaint.linkColor =
// Theme.chat_replyTextPaint.linkColor =
// Theme.chat_quoteTextPaint.linkColor =
// Theme.chat_msgTextPaint.linkColor = Theme.adaptHue(getThemedColor(Theme.key_chat_messageLinkIn), hueColor);
} else {
Theme.chat_msgTextPaint.setColor(getThemedColor(Theme.key_chat_messageTextIn));
Theme.chat_msgGameTextPaint.setColor(getThemedColor(Theme.key_chat_messageTextIn));
@ -16205,8 +16194,12 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
if (currentMessagesGroup == null || currentPosition == null || (currentPosition.flags & MessageObject.POSITION_FLAG_LEFT) != 0 && (currentPosition.flags & MessageObject.POSITION_FLAG_RIGHT) != 0) {
right = getBackgroundDrawableRight() + transitionParams.deltaRight;
} else {
int end = 0;
int dWidth = getGroupPhotosWidth();
int end, dWidth;
if (AndroidUtilities.isTablet()) {
dWidth = AndroidUtilities.getMinTabletSide();
} else {
dWidth = getParentWidth();
}
int firstLineWidth = 0;
for (int a = 0; a < currentMessagesGroup.posArray.size(); a++) {
MessageObject.GroupedMessagePosition position = currentMessagesGroup.posArray.get(a);
@ -16221,8 +16214,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
} else {
end = backgroundDrawableLeft + firstLineWidth;
}
end -= getExtraTextX() + AndroidUtilities.dp(8);
right = end;//replyStartX + Math.max(replyNameWidth, replyTextWidth) + AndroidUtilities.dp(10);
end -= getExtraTextX() + AndroidUtilities.dp(8 + (isAvatarVisible ? 48 : 0));
right = end;
}
right -= AndroidUtilities.dp(10 + (currentMessageObject.isOutOwner() && !mediaBackground && !drawPinnedBottom ? 6 : 0)) + getExtraTextX();
replySelectorRect.set(
@ -16274,7 +16267,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
float replyImageSz = 0;
if (needReplyImage) {
replyImageReceiver.setAlpha(replyForwardAlpha);
replyImageSz = Math.min(replySelectorRect.height() - AndroidUtilities.dp(10), AndroidUtilities.dp(33));
replyImageSz = Math.min(replySelectorRect.height() - AndroidUtilities.dp(10), AndroidUtilities.dp(isReplyQuote ? 3 : 7) + Theme.chat_replyNamePaint.getTextSize() + Theme.chat_replyTextPaint.getTextSize());
replyImageReceiver.setImageCoords(replySelectorRect.left + AndroidUtilities.dp(8), replySelectorRect.top + AndroidUtilities.dp(5), replyImageSz, replyImageSz);
replyImageReceiver.draw(canvas);
@ -16336,7 +16329,17 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
canvas.clipRect(replySelectorRect);
canvas.save();
canvas.translate(replyStartX - replyTextOffset + offset + offsetX + (needReplyImage && (!isReplyQuote || replyTextRTL) ? replyImageSz + AndroidUtilities.dp(3) : 0) + (isReplyQuote && needReplyImage ? -AndroidUtilities.dp(2) : 0) + replyTextOffset - transitionParams.animateReplyTextOffset, replyStartY + offsetY - AndroidUtilities.dp(1) + Theme.chat_replyNamePaint.getTextSize() + AndroidUtilities.dp(5));
float left = replyStartX + offset + offsetX;
if (isReplyQuote && needReplyImage) {
left -= AndroidUtilities.dp(2);
}
if (needReplyImage && (!isReplyQuote || replyTextRTL)) {
left += replyImageSz + AndroidUtilities.dp(3);
}
if (replyTextRTL) {
left = replySelectorRect.right - AndroidUtilities.dp(8) - transitionParams.animateReplyTextLayout.getWidth();
}
canvas.translate(left, replyStartY + offsetY - AndroidUtilities.dp(1) + Theme.chat_replyNamePaint.getTextSize() + AndroidUtilities.dp(5));
final TextPaint paint = transitionParams.animateReplyTextLayout.getPaint();
int wasAlpha2 = paint.getAlpha();
paint.setAlpha((int) (wasAlpha2 * (1f - transitionParams.animateChangeProgress)));
@ -16347,7 +16350,17 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
if (replyTextLayout != null) {
canvas.save();
canvas.translate(replyStartX - replyTextOffset + offset + offsetX + (needReplyImage && (!isReplyQuote || replyTextRTL) ? replyImageSz + AndroidUtilities.dp(3) : 0) + (isReplyQuote && needReplyImage ? -AndroidUtilities.dp(2) : 0), replyStartY + offsetY - AndroidUtilities.dp(1) + Theme.chat_replyNamePaint.getTextSize() + AndroidUtilities.dp(5));
float left = replyStartX + offset + offsetX;
if (isReplyQuote && needReplyImage) {
left -= AndroidUtilities.dp(2);
}
if (needReplyImage && (!isReplyQuote || replyTextRTL)) {
left += replyImageSz + AndroidUtilities.dp(3);
}
if (replyTextRTL) {
left = replySelectorRect.right - AndroidUtilities.dp(8) - replyTextLayout.getWidth();
}
canvas.translate(left, replyStartY + offsetY - AndroidUtilities.dp(1) + Theme.chat_replyNamePaint.getTextSize() + AndroidUtilities.dp(5));
final TextPaint paint = replyTextLayout.getPaint();
int wasAlpha2 = paint.getAlpha();
paint.setAlpha((int) (wasAlpha2 * (transitionParams.animateReplyTextLayout != null ? transitionParams.animateChangeProgress : 1)));
@ -18774,7 +18787,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
}
if (drawImageButton && photoImage.getVisible() && !(currentMessageObject != null && currentMessageObject.preview) && !isSmallImage) {
if (drawImageButton && photoImage.getVisible() && !isSmallImage) {
if (controlsAlpha != 1.0f) {
radialProgress.setOverrideAlpha(controlsAlpha);
}

View file

@ -136,6 +136,10 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
protected boolean multiselect;
public Cell getSelectedCell() {
return selectedView;
}
protected final LayoutBlock layoutBlock = new LayoutBlock();
private int lastX;
@ -2069,7 +2073,10 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
}
public void drawCaption(MessageObject messageObject, MessageObject.TextLayoutBlock block, Canvas canvas) {
if (isDescription) {
if (messageObject == null) {
return;
}
if (isDescription || selectedView == null || selectedView.getMessageObject() == null || selectedView.getMessageObject().getId() != messageObject.getId()) {
return;
}
@ -2377,10 +2384,7 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
try {
currentEditDate = messageObject.messageOwner.edit_date;
} catch (Exception ignore) {}
if (selectedCellId == messageObject.getId() // &&
// !(selectedCellEditDate != null && selectedCellEditDate.equals(currentEditDate) ||
// selectedCellEditDate == null && currentEditDate == null)
) {
if (selectedCellId == messageObject.getId()) {
clear(true);
}
}

View file

@ -2869,7 +2869,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
chatActivity != null && chatActivity.getCurrentEncryptedChat() == null && !chatActivity.textSelectionHelper.isDescription &&
selectedView != null && selectedView.getMessageObject() != null && selectedView.getMessageObject().type != MessageObject.TYPE_STORY &&
!selectedView.getMessageObject().isVoiceTranscriptionOpen() && !selectedView.getMessageObject().isInvoice() &&
!chatActivity.getMessagesController().getTranslateController().isTranslatingDialog(chatActivity.dialog_id)
!chatActivity.getMessagesController().getTranslateController().isTranslatingDialog(chatActivity.dialog_id) &&
!UserObject.isService(chatActivity.dialog_id)
);
}
@ -2882,7 +2883,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
end = Math.min(end, start + chatActivity.getMessagesController().quoteLengthMax);
if (messageObject.getGroupId() != 0) {
MessageObject.GroupedMessages group = chatActivity.getGroup(messageObject.getGroupId());
if (group != null) {
if (group != null && !group.isDocuments) {
messageObject = group.captionMessage;
}
}
@ -8226,7 +8227,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
@Override
protected void onQuoteSelectedPart() {
if (replyingQuote == null) {
if (replyingQuote == null || replyingQuote.message == null || messagePreviewParams.quote != null && messagePreviewParams.quote.message != null && replyingQuote.message.getId() != messagePreviewParams.quote.message.getId()) {
replyingQuote = messagePreviewParams.quote;
}
}
@ -21628,7 +21629,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
private void updateBottomOverlay() {
if (bottomOverlayChatText == null || chatMode == MODE_SCHEDULED) {
if (bottomOverlayChatText == null || chatMode == MODE_SCHEDULED || getContext() == null) {
return;
}
boolean haveBeenWaiting = bottomOverlayChatWaitsReply;

View file

@ -189,74 +189,6 @@ public class AvatarDrawable extends Drawable {
return Theme.keys_avatar_nameInMessage[getColorIndex(id)];
}
public static boolean isNameColorKeyHasComposite(int color) {
return color >= Theme.keys_avatar_nameInMessage.length && color < Theme.keys_avatar_nameInMessage.length + Theme.keys_avatar_composite_nameInMessage.length;
}
public static int getNameColorKey1For(TLRPC.User user) {
if (user == null) {
return Theme.keys_avatar_nameInMessage[0];
}
if ((user.flags2 & 128) != 0) {
return getNameColorKey1For(user.color);
}
return getNameColorNameForId(user.id);
}
public static int getNameColorKey2For(TLRPC.User user) {
if (user == null) {
return Theme.keys_avatar_nameInMessage[0];
}
if ((user.flags2 & 128) != 0) {
return getNameColorKey2For(user.color);
}
return getNameColorNameForId(user.id);
}
public static int getNameColorKey1For(TLRPC.Chat chat) {
if (chat == null) {
return Theme.keys_avatar_nameInMessage[0];
}
if ((chat.flags2 & 64) != 0) {
return getNameColorKey1For(chat.color);
}
return getNameColorNameForId(chat.id);
}
public static int getNameColorKey2For(TLRPC.Chat chat) {
if (chat == null) {
return Theme.keys_avatar_nameInMessage[0];
}
if ((chat.flags2 & 64) != 0) {
return getNameColorKey2For(chat.color);
}
return getNameColorNameForId(chat.id);
}
public static int getNameColorKey1For(int color) {
color = color % (Theme.keys_avatar_nameInMessage.length + Theme.keys_avatar_composite_nameInMessage.length);
if (color >= 0 && color < Theme.keys_avatar_nameInMessage.length) {
return Theme.keys_avatar_nameInMessage[color];
}
color -= Theme.keys_avatar_nameInMessage.length;
if (color >= 0 && color < Theme.keys_avatar_composite_nameInMessage.length) {
return Theme.keys_avatar_composite_nameInMessage[color];
}
return Theme.keys_avatar_nameInMessage[0];
}
public static int getNameColorKey2For(int color) {
color = color % (Theme.keys_avatar_nameInMessage.length + Theme.keys_avatar_composite_nameInMessage2.length);
if (color >= 0 && color < Theme.keys_avatar_nameInMessage.length) {
return Theme.keys_avatar_nameInMessage[color];
}
color -= Theme.keys_avatar_nameInMessage.length;
if (color >= 0 && color < Theme.keys_avatar_composite_nameInMessage2.length) {
return Theme.keys_avatar_composite_nameInMessage2[color];
}
return Theme.keys_avatar_nameInMessage[0];
}
public void setInfo(TLRPC.User user) {
if (user != null) {
setInfo(user.id, user.first_name, user.last_name, null, (user.flags2 & 128) != 0 ? user.color : null);

View file

@ -4281,7 +4281,6 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
messageEditText.setFallbackLineSpacing(false);
}
messageEditText.wrapCanvasToFixClipping = Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT_WATCH && !BuildVars.isHuaweiStoreApp() && !XiaomiUtilities.isMIUI();
messageEditText.setDelegate(() -> {
messageEditText.invalidateEffects();
if (delegate != null) {
@ -7714,14 +7713,13 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
span = new AnimatedEmojiSpan(emojiEntity.document_id, fontMetricsInt);
}
stringBuilder.setSpan(span, entity.offset, entity.offset + entity.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
} else if (entity instanceof TLRPC.TL_messageEntityBlockquote) {
QuoteSpan.putQuoteToEditable(stringBuilder, entity.offset, entity.offset + entity.length);
}
}
} catch (Exception e) {
FileLog.e(e);
}
}
QuoteSpan.mergeQuotes(stringBuilder, entities);
textToSetWithKeyboard = Emoji.replaceEmoji(new SpannableStringBuilder(stringBuilder), fontMetricsInt, false, null);
if (entities != null) {
try {
@ -7731,13 +7729,6 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
if (!(textToSetWithKeyboard instanceof Spannable)) {
textToSetWithKeyboard = new SpannableStringBuilder(textToSetWithKeyboard);
}
// CodeHighlighting.highlight((Spannable) textToSetWithKeyboard, entity.offset, entity.offset + entity.length, entity.language, 0, null, false);
// ((Spannable) textToSetWithKeyboard).setSpan(
// new CodeHighlighting.Span(false, 0, null, entity.language, textToSetWithKeyboard.subSequence(entity.offset, entity.offset + entity.length).toString(), false, false, entity.offset, entity.offset + entity.length),
// entity.offset,
// entity.offset + entity.length,
// Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
// );
((SpannableStringBuilder) textToSetWithKeyboard).insert(entity.offset + entity.length, "```\n");
((SpannableStringBuilder) textToSetWithKeyboard).insert(entity.offset, "```"+(entity.language == null ? "" : entity.language)+"\n");
}

View file

@ -863,10 +863,14 @@ public class EditTextBoldCursor extends EditTextEffects {
throw new RuntimeException(e);
}
}
// ignoreTopCount = 1;
// ignoreBottomCount = 1;
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT_WATCH) {
ignoreTopCount = 1;
ignoreBottomCount = 1;
}
canvas.save();
// canvas.translate(0, topPadding);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT_WATCH) {
canvas.translate(0, topPadding);
}
try {
drawInMaim = true;
super.onDraw(canvas);

View file

@ -614,6 +614,16 @@ public class EditTextCaption extends EditTextBoldCursor {
}
int start = Math.max(0, getSelectionStart());
int end = Math.min(getText().length(), getSelectionEnd());
QuoteSpan.QuoteStyleSpan[] quotesInSelection = getText().getSpans(start, end, QuoteSpan.QuoteStyleSpan.class);
if (quotesInSelection != null && quotesInSelection.length > 0) {
QuoteSpan.QuoteStyleSpan[] quotesToDelete = pasted.getSpans(0, pasted.length(), QuoteSpan.QuoteStyleSpan.class);
for (int i = 0; i < quotesToDelete.length; ++i) {
pasted.removeSpan(quotesToDelete[i]);
pasted.removeSpan(quotesToDelete[i].span);
}
} else {
QuoteSpan.normalizeQuotes(pasted);
}
setText(getText().replace(start, end, pasted));
setSelection(start + pasted.length(), start + pasted.length());
return true;

View file

@ -271,7 +271,7 @@ public class EditTextEffects extends EditText {
return offsetY;
}
public boolean wrapCanvasToFixClipping;
public boolean wrapCanvasToFixClipping = Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT_WATCH;
private NoClipCanvas wrappedCanvas;
@Override

View file

@ -39,6 +39,7 @@ import org.telegram.ui.Cells.ChatMessageCell;
@SuppressWarnings("FieldCanBeLocal")
@Deprecated // use HintView2 instead
public class HintView extends FrameLayout {
public static final int TYPE_NOSOUND = 0;

View file

@ -222,10 +222,21 @@ public class MessagePreviewView extends FrameLayout {
}
public MessageObject getReplyMessage() {
return getReplyMessage(null);
}
public MessageObject getReplyMessage(MessageObject fallback) {
if (messagePreviewParams.replyMessage != null) {
if (messagePreviewParams.replyMessage.groupedMessagesMap != null && messagePreviewParams.replyMessage.groupedMessagesMap.size() > 0) {
MessageObject.GroupedMessages group = messagePreviewParams.replyMessage.groupedMessagesMap.valueAt(0);
if (group != null) {
if (group.isDocuments) {
if (fallback != null) {
return fallback;
} else if (messagePreviewParams.quote != null) {
return messagePreviewParams.quote.message;
}
}
return group.captionMessage;
}
}
@ -318,8 +329,9 @@ public class MessagePreviewView extends FrameLayout {
}
messagePreviewParams.quoteStart = textSelectionHelper.selectionStart;
messagePreviewParams.quoteEnd = textSelectionHelper.selectionEnd;
if (messagePreviewParams.quote == null) {
messagePreviewParams.quote = ChatActivity.ReplyQuote.from(getReplyMessage(), start, end);
MessageObject toSelectMessage = getReplyMessage(messageObject);
if (toSelectMessage != null && (messagePreviewParams.quote == null || messagePreviewParams.quote.message == null || messagePreviewParams.quote.message.getId() != toSelectMessage.getId())) {
messagePreviewParams.quote = ChatActivity.ReplyQuote.from(toSelectMessage, start, end);
}
onQuoteSelectedPart();
dismiss(true);
@ -338,17 +350,24 @@ public class MessagePreviewView extends FrameLayout {
}
if (!isSelected && menu.getSwipeBack().isForegroundOpen()) {
menu.getSwipeBack().closeForeground(true);
} else if (isSelected && messagePreviewParams.quote == null) {
} else if (isSelected) {
if (textSelectionHelper.selectionEnd - textSelectionHelper.selectionStart > MessagesController.getInstance(currentAccount).quoteLengthMax) {
showQuoteLengthError();
return;
}
MessageObject msg = null;
if (textSelectionHelper.getSelectedCell() != null) {
msg = textSelectionHelper.getSelectedCell().getMessageObject();
}
msg = getReplyMessage(msg);
if (messagePreviewParams.quote == null) {
messagePreviewParams.quoteStart = textSelectionHelper.selectionStart;
messagePreviewParams.quoteEnd = textSelectionHelper.selectionEnd;
messagePreviewParams.quote = ChatActivity.ReplyQuote.from(getReplyMessage(), messagePreviewParams.quoteStart, messagePreviewParams.quoteEnd);
messagePreviewParams.quote = ChatActivity.ReplyQuote.from(msg, messagePreviewParams.quoteStart, messagePreviewParams.quoteEnd);
menu.getSwipeBack().openForeground(menuBack);
}
}
}
});
chatListView = new RecyclerListView(context, resourcesProvider) {
@ -367,7 +386,7 @@ public class MessagePreviewView extends FrameLayout {
cell.drawContent(canvas, true);
cell.layoutTextXY(true);
cell.drawMessageText(canvas);
if ((cell.getCurrentMessagesGroup() == null || cell.getCurrentPosition() != null && cell.getCurrentPosition().last) || cell.getTransitionParams().animateBackgroundBoundsInner) {
if ((cell.getCurrentMessagesGroup() == null || cell.getCurrentPosition() != null && (cell.getCurrentPosition().last || cell.getCurrentMessagesGroup() != null && cell.getCurrentMessagesGroup().isDocuments)) || cell.getTransitionParams().animateBackgroundBoundsInner) {
cell.drawCaptionLayout(canvas, false, cell.getAlpha());
}
if (cell.getCurrentMessagesGroup() != null || cell.getTransitionParams().animateBackgroundBoundsInner) {
@ -795,9 +814,14 @@ public class MessagePreviewView extends FrameLayout {
showQuoteLengthError();
return;
}
MessageObject msg = null;
if (textSelectionHelper.getSelectedCell() != null) {
msg = textSelectionHelper.getSelectedCell().getMessageObject();
}
msg = getReplyMessage(msg);
messagePreviewParams.quoteStart = textSelectionHelper.selectionStart;
messagePreviewParams.quoteEnd = textSelectionHelper.selectionEnd;
messagePreviewParams.quote = ChatActivity.ReplyQuote.from(replyMessage, messagePreviewParams.quoteStart, messagePreviewParams.quoteEnd);
messagePreviewParams.quote = ChatActivity.ReplyQuote.from(msg, messagePreviewParams.quoteStart, messagePreviewParams.quoteEnd);
onQuoteSelectedPart();
dismiss(true);
}
@ -858,7 +882,12 @@ public class MessagePreviewView extends FrameLayout {
if (textSelectionHelper.isInSelectionMode()) {
messagePreviewParams.quoteStart = textSelectionHelper.selectionStart;
messagePreviewParams.quoteEnd = textSelectionHelper.selectionEnd;
messagePreviewParams.quote = ChatActivity.ReplyQuote.from(replyMessage, messagePreviewParams.quoteStart, messagePreviewParams.quoteEnd);
MessageObject msg = null;
if (textSelectionHelper.getSelectedCell() != null) {
msg = textSelectionHelper.getSelectedCell().getMessageObject();
}
msg = getReplyMessage(msg);
messagePreviewParams.quote = ChatActivity.ReplyQuote.from(msg, messagePreviewParams.quoteStart, messagePreviewParams.quoteEnd);
onQuoteSelectedPart();
dismiss(true);
return;
@ -1339,9 +1368,18 @@ public class MessagePreviewView extends FrameLayout {
if (textSelectionHelper.selectionEnd - textSelectionHelper.selectionStart > MessagesController.getInstance(currentAccount).quoteLengthMax) {
return;
}
MessageObject msg = null;
if (textSelectionHelper.getSelectedCell() != null) {
msg = textSelectionHelper.getSelectedCell().getMessageObject();
}
msg = getReplyMessage(msg);
if (messagePreviewParams.quote != null && textSelectionHelper.isInSelectionMode()) {
messagePreviewParams.quoteStart = textSelectionHelper.selectionStart;
messagePreviewParams.quoteEnd = textSelectionHelper.selectionEnd;
if (msg != null && (messagePreviewParams.quote.message == null || messagePreviewParams.quote.message.getId() != msg.getId())) {
messagePreviewParams.quote = ChatActivity.ReplyQuote.from(msg, messagePreviewParams.quoteStart, messagePreviewParams.quoteEnd);
onQuoteSelectedPart();
}
}
textSelectionHelper.clear();
}
@ -2147,11 +2185,15 @@ public class MessagePreviewView extends FrameLayout {
page.updateMessages();
if (page.currentTab == TAB_REPLY) {
if (showOutdatedQuote && !messagePreviewParams.isSecret) {
MessageObject replyMessage = page.getReplyMessage();
if (replyMessage != null) {
MessageObject msg = null;
if (page.textSelectionHelper.getSelectedCell() != null) {
msg = page.textSelectionHelper.getSelectedCell().getMessageObject();
}
msg = page.getReplyMessage(msg);
if (msg != null) {
messagePreviewParams.quoteStart = 0;
messagePreviewParams.quoteEnd = Math.min(MessagesController.getInstance(currentAccount).quoteLengthMax, replyMessage.messageOwner.message.length());
messagePreviewParams.quote = ChatActivity.ReplyQuote.from(replyMessage, messagePreviewParams.quoteStart, messagePreviewParams.quoteEnd);
messagePreviewParams.quoteEnd = Math.min(MessagesController.getInstance(currentAccount).quoteLengthMax, msg.messageOwner.message.length());
messagePreviewParams.quote = ChatActivity.ReplyQuote.from(msg, messagePreviewParams.quoteStart, messagePreviewParams.quoteEnd);
page.textSelectionHelper.select(page.getReplyMessageCell(), messagePreviewParams.quoteStart, messagePreviewParams.quoteEnd);
}
} else {

View file

@ -32,6 +32,42 @@ public class NoClipCanvas extends Canvas {
return false;
}
@Override
public boolean clipRect(@NonNull RectF rect) {
// nop
return false;
}
@Override
public boolean clipRect(@NonNull Rect rect) {
// nop
return false;
}
@Override
public boolean clipRect(int left, int top, int right, int bottom) {
// nop
return false;
}
@Override
public boolean clipRect(@NonNull Rect rect, @NonNull Region.Op op) {
// nop
return false;
}
@Override
public boolean clipRect(@NonNull RectF rect, @NonNull Region.Op op) {
// nop
return false;
}
@Override
public boolean clipRect(float left, float top, float right, float bottom, @NonNull Region.Op op) {
// nop
return false;
}
@Override
public int save() {
return canvas.save();
@ -97,6 +133,16 @@ public class NoClipCanvas extends Canvas {
canvas.drawText(text, start, end, x, y, paint);
}
@Override
public void drawLines(@NonNull float[] pts, int offset, int count, @NonNull Paint paint) {
canvas.drawLines(pts, offset, count, paint);
}
@Override
public void drawLines(@NonNull float[] pts, @NonNull Paint paint) {
canvas.drawLines(pts, paint);
}
@Override
public void drawRect(@NonNull Rect r, @NonNull Paint paint) {
canvas.drawRect(r, paint);
@ -247,6 +293,322 @@ public class NoClipCanvas extends Canvas {
return canvas.getHeight();
}
@Override
public void drawColor(long color, @NonNull BlendMode mode) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
canvas.drawColor(color, mode);
}
}
@Override
public void drawOval(@NonNull RectF oval, @NonNull Paint paint) {
canvas.drawOval(oval, paint);
}
@Override
public void drawColor(int color, @NonNull BlendMode mode) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
canvas.drawColor(color, mode);
}
}
@Override
public void drawPatch(@NonNull NinePatch patch, @NonNull RectF dst, @Nullable Paint paint) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
canvas.drawPatch(patch, dst, paint);
}
}
@Override
public void drawPosText(@NonNull String text, @NonNull float[] pos, @NonNull Paint paint) {
canvas.drawPosText(text, pos, paint);
}
@Override
public void drawPosText(@NonNull char[] text, int index, int count, @NonNull float[] pos, @NonNull Paint paint) {
canvas.drawPosText(text, index, count, pos, paint);
}
@Override
public void drawColor(int color) {
canvas.drawColor(color);
}
@Override
public void drawDoubleRoundRect(@NonNull RectF outer, @NonNull float[] outerRadii, @NonNull RectF inner, @NonNull float[] innerRadii, @NonNull Paint paint) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
canvas.drawDoubleRoundRect(outer, outerRadii, inner, innerRadii, paint);
}
}
@Override
public void drawPicture(@NonNull Picture picture, @NonNull RectF dst) {
canvas.drawPicture(picture, dst);
}
@Override
public void drawARGB(int a, int r, int g, int b) {
canvas.drawARGB(a, r, g, b);
}
@Override
public void drawArc(float left, float top, float right, float bottom, float startAngle, float sweepAngle, boolean useCenter, @NonNull Paint paint) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
canvas.drawArc(left, top, right, bottom, startAngle, sweepAngle, useCenter, paint);
}
}
@Override
public void drawPatch(@NonNull NinePatch patch, @NonNull Rect dst, @Nullable Paint paint) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
canvas.drawPatch(patch, dst, paint);
}
}
@Override
public void drawColor(int color, @NonNull PorterDuff.Mode mode) {
canvas.drawColor(color, mode);
}
@Override
public void drawRGB(int r, int g, int b) {
canvas.drawRGB(r, g, b);
}
@Override
public void drawPoints(float[] pts, int offset, int count, @NonNull Paint paint) {
canvas.drawPoints(pts, offset, count, paint);
}
@Override
public void drawPoints(@NonNull float[] pts, @NonNull Paint paint) {
canvas.drawPoints(pts, paint);
}
@Override
public void drawRenderNode(@NonNull RenderNode renderNode) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
canvas.drawRenderNode(renderNode);
}
}
@Override
public void drawOval(float left, float top, float right, float bottom, @NonNull Paint paint) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
canvas.drawOval(left, top, right, bottom, paint);
}
}
@Override
public void drawDoubleRoundRect(@NonNull RectF outer, float outerRx, float outerRy, @NonNull RectF inner, float innerRx, float innerRy, @NonNull Paint paint) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
canvas.drawDoubleRoundRect(outer, outerRx, outerRy, inner, innerRx, innerRy, paint);
}
}
@Override
public void drawPicture(@NonNull Picture picture) {
canvas.drawPicture(picture);
}
@Override
public void drawPicture(@NonNull Picture picture, @NonNull Rect dst) {
canvas.drawPicture(picture, dst);
}
@Override
public void drawColor(long color) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
canvas.drawColor(color);
}
}
@Override
public void drawPaint(@NonNull Paint paint) {
canvas.drawPaint(paint);
}
@Override
public void drawPoint(float x, float y, @NonNull Paint paint) {
canvas.drawPoint(x, y, paint);
}
@Nullable
@Override
public DrawFilter getDrawFilter() {
return canvas.getDrawFilter();
}
@Override
public void setDrawFilter(@Nullable DrawFilter filter) {
canvas.setDrawFilter(filter);
}
@Override
public int getDensity() {
return canvas.getDensity();
}
@Override
public void setDensity(int density) {
canvas.setDensity(density);
}
@Override
public int saveLayerAlpha(@Nullable RectF bounds, int alpha, int saveFlags) {
return canvas.saveLayerAlpha(bounds, alpha, saveFlags);
}
@Override
public int saveLayerAlpha(float left, float top, float right, float bottom, int alpha) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return canvas.saveLayerAlpha(left, top, right, bottom, alpha);
}
return getSaveCount();
}
@Override
public int saveLayerAlpha(@Nullable RectF bounds, int alpha) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return canvas.saveLayerAlpha(bounds, alpha);
}
return getSaveCount();
}
@Override
public int saveLayer(float left, float top, float right, float bottom, @Nullable Paint paint) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return canvas.saveLayer(left, top, right, bottom, paint);
}
return getSaveCount();
}
@Override
public int saveLayer(@Nullable RectF bounds, @Nullable Paint paint) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return canvas.saveLayer(bounds, paint);
}
return getSaveCount();
}
@Override
public int saveLayer(float left, float top, float right, float bottom, @Nullable Paint paint, int saveFlags) {
return canvas.saveLayer(left, top, right, bottom, paint, saveFlags);
}
@Override
public int saveLayer(@Nullable RectF bounds, @Nullable Paint paint, int saveFlags) {
return canvas.saveLayer(bounds, paint, saveFlags);
}
@Override
public int saveLayerAlpha(float left, float top, float right, float bottom, int alpha, int saveFlags) {
return canvas.saveLayerAlpha(left, top, right, bottom, alpha, saveFlags);
}
@Override
public boolean clipOutRect(float left, float top, float right, float bottom) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
return canvas.clipOutRect(left, top, right, bottom);
}
return false;
}
@Override
public boolean clipOutRect(int left, int top, int right, int bottom) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
return canvas.clipOutRect(left, top, right, bottom);
}
return false;
}
@Override
public boolean clipOutRect(@NonNull RectF rect) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
return canvas.clipOutRect(rect);
}
return false;
}
@Override
public boolean clipPath(@NonNull Path path) {
return canvas.clipPath(path);
}
@Override
public boolean clipOutPath(@NonNull Path path) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
return canvas.clipOutPath(path);
}
return false;
}
@Override
public boolean clipOutRect(@NonNull Rect rect) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
return canvas.clipOutRect(rect);
}
return false;
}
@Override
public boolean clipPath(@NonNull Path path, @NonNull Region.Op op) {
return canvas.clipPath(path, op);
}
@Override
public void skew(float sx, float sy) {
canvas.skew(sx, sy);
}
@Override
public void disableZ() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
canvas.disableZ();
}
}
@Override
public void enableZ() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
canvas.enableZ();
}
}
@Override
public boolean quickReject(float left, float top, float right, float bottom) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
return canvas.quickReject(left, top, right, bottom);
}
return false;
}
@Override
public boolean quickReject(@NonNull RectF rect) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
return canvas.quickReject(rect);
}
return false;
}
@Override
public boolean quickReject(@NonNull Path path) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
return canvas.quickReject(path);
}
return false;
}
@Override
public boolean quickReject(@NonNull RectF rect, @NonNull EdgeType type) {
return canvas.quickReject(rect, type);
}
@Override
public boolean quickReject(@NonNull Path path, @NonNull EdgeType type) {
return canvas.quickReject(path, type);
}
@Override
public boolean quickReject(float left, float top, float right, float bottom, @NonNull EdgeType type) {
return canvas.quickReject(left, top, right, bottom, type);

View file

@ -829,9 +829,8 @@ public class LimitReachedBottomSheet extends BottomSheetWithRecyclerListView imp
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText, resourcesProvider));
textView.setGravity(Gravity.CENTER_HORIZONTAL);
textView.setOnClickListener(v -> {
BoostPagerBottomSheet.show(getBaseFragment(), dialogId, resourcesProvider);
});
textView.setOnClickListener(v -> BoostPagerBottomSheet.show(getBaseFragment(), dialogId, resourcesProvider));
orDividerView.setOnClickListener(v -> textView.performClick());
wrapperLayout.addView(actionBtn, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48, 12, 12, 12, 8));
wrapperLayout.addView(orDividerView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48, 0, 0, 0, 0));
wrapperLayout.addView(textView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 12, 0, 12, 4));

View file

@ -569,7 +569,7 @@ public class BoostDialogs {
stringBuilder.append(" ");
if (giveawayInfo.activated_count > 0) {
stringBuilder.append(replaceTags(formatString("BoostingGiveawayUsedLinks", R.string.BoostingGiveawayUsedLinks, giveawayInfo.activated_count)));
stringBuilder.append(replaceTags(formatPluralString("BoostingGiveawayUsedLinksPlural", giveawayInfo.activated_count)));
}
stringBuilder.append("\n\n");

View file

@ -59,6 +59,8 @@ public class BoostPagerBottomSheet extends BottomSheet {
return instance;
}
private boolean isLandscapeOrientation;
public BoostPagerBottomSheet(Context context, boolean needFocus, BoostViaGiftsBottomSheet leftSheet, SelectorBottomSheet rightSheet, Theme.ResourcesProvider resourcesProvider, boolean forceDark) {
super(context, needFocus, resourcesProvider);
this.rightSheet = rightSheet;
@ -68,6 +70,7 @@ public class BoostPagerBottomSheet extends BottomSheet {
setBackgroundColor(Color.TRANSPARENT);
fixNavigationBar();
AndroidUtilities.setLightStatusBar(getWindow(), isLightStatusBar());
checkScreenOrientation();
viewPager = new ViewPagerFixed(getContext()) {
@ -133,7 +136,7 @@ public class BoostPagerBottomSheet extends BottomSheet {
super.dispatchDraw(canvas);
canvas.restore();
} else {
if (isTablet) {
if (isTablet || isLandscapeOrientation) {
canvas.clipRect(0, 0, getMeasuredWidth(), getMeasuredHeight());
}
super.dispatchDraw(canvas);
@ -230,6 +233,10 @@ public class BoostPagerBottomSheet extends BottomSheet {
});
}
private void checkScreenOrientation() {
isLandscapeOrientation = getContext().getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
}
@Override
public void dismissInternal() {
super.dismissInternal();
@ -239,6 +246,7 @@ public class BoostPagerBottomSheet extends BottomSheet {
@Override
public void onConfigurationChanged(Configuration newConfig) {
rightSheet.onConfigurationChanged(newConfig);
checkScreenOrientation();
super.onConfigurationChanged(newConfig);
}

View file

@ -193,7 +193,7 @@ public class BoostAdapter extends AdapterWithDiffUtils {
view = new SliderCell(context, resourcesProvider);
break;
case HOLDER_TYPE_SUBTITLE:
view = new org.telegram.ui.Cells.HeaderCell(context, resourcesProvider);
view = new org.telegram.ui.Cells.HeaderCell(context, Theme.key_windowBackgroundWhiteBlueHeader, 21, 15, 3, false, resourcesProvider);
view.setBackgroundColor(Theme.getColor(Theme.key_dialogBackground, resourcesProvider));
break;
case HOLDER_TYPE_SUBTITLE_WITH_COUNTER:

View file

@ -62,7 +62,7 @@ public class DateEndCell extends FrameLayout {
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(
MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(56), MeasureSpec.EXACTLY)
MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(50), MeasureSpec.EXACTLY)
);
}
}

View file

@ -282,7 +282,8 @@ public class GiveawayMessageCell {
}
if (!countriesWithFlags.isEmpty()) {
CharSequence txt = replaceTags(formatString("BoostingGiveAwayFromCountries", R.string.BoostingGiveAwayFromCountries, TextUtils.join(", ", countriesWithFlags)));
countriesLayout = StaticLayoutEx.createStaticLayout(txt, countriesTextPaint, maxRowLength, Layout.Alignment.ALIGN_CENTER, 1.0f, AndroidUtilities.dp(2), false, TextUtils.TruncateAt.END, maxRowLength, 10);
txt = Emoji.replaceEmoji(txt, countriesTextPaint.getFontMetricsInt(), false);
countriesLayout = StaticLayoutEx.createStaticLayout(txt, countriesTextPaint, maxRowLength, Layout.Alignment.ALIGN_CENTER, 1.0f, 0, false, TextUtils.TruncateAt.END, maxRowLength, 10);
}
}

View file

@ -14,6 +14,7 @@ import android.text.Editable;
import android.text.Layout;
import android.text.ParcelableSpan;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.TextUtils;
@ -34,9 +35,13 @@ import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.R;
import org.telegram.messenger.SharedConfig;
import org.telegram.messenger.Utilities;
import org.telegram.tgnet.TLRPC;
import org.telegram.ui.ActionBar.Theme;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.TreeSet;
public class QuoteSpan implements LeadingMarginSpan {
@ -331,4 +336,196 @@ public class QuoteSpan implements LeadingMarginSpan {
canvas.restore();
}
}
public static void mergeQuotes(SpannableStringBuilder text, ArrayList<TLRPC.MessageEntity> entities) {
if (entities == null || !(text instanceof Spanned)) {
return;
}
final int QUOTE_START = 1;
final int QUOTE_END = 2;
final int CODE_START = 4;
final int CODE_END = 8;
final TreeSet<Integer> cutIndexes = new TreeSet<>();
final HashMap<Integer, Integer> cutToType = new HashMap<>();
for (int i = 0; i < entities.size(); ++i) {
TLRPC.MessageEntity entity = entities.get(i);
if (entity.offset + entity.length > text.length()) {
continue;
}
final int start = entity.offset;
final int end = entity.offset + entity.length;
if (entity instanceof TLRPC.TL_messageEntityBlockquote) {
cutIndexes.add(start);
cutIndexes.add(end);
cutToType.put(start, (cutToType.containsKey(start) ? cutToType.get(start) : 0) | QUOTE_START);
cutToType.put(end, (cutToType.containsKey(end) ? cutToType.get(end) : 0) | QUOTE_END);
}
}
int from = 0;
int quoteCount = 0, codeCount = 0;
for (Iterator<Integer> i = cutIndexes.iterator(); i.hasNext(); ) {
int cutIndex = i.next();
final int type = cutToType.get(cutIndex);
if (from != cutIndex) {
int to = cutIndex;
if (cutIndex - 1 >= 0 && cutIndex - 1 < text.length() && text.charAt(cutIndex - 1) == '\n') {
to--;
}
final boolean isQuote = quoteCount > 0;
if (isQuote) {
QuoteSpan.putQuoteToEditable(text, from, to);
}
from = cutIndex;
if (from + 1 < text.length() && text.charAt(from) == '\n') {
from++;
}
}
if ((type & QUOTE_END) != 0) quoteCount--;
if ((type & QUOTE_START) != 0) quoteCount++;
if ((type & CODE_END) != 0) codeCount--;
if ((type & CODE_START) != 0) codeCount++;
}
if (from < text.length()) {
if (quoteCount > 0) {
QuoteSpan.putQuoteToEditable(text, from, text.length());
}
}
}
public static void normalizeQuotes(Editable text) {
if (text == null) {
return;
}
final int QUOTE_START = 1;
final int QUOTE_END = 2;
final int CODE_START = 4;
final int CODE_END = 8;
final TreeSet<Integer> cutIndexes = new TreeSet<>();
final HashMap<Integer, Integer> cutToType = new HashMap<>();
QuoteSpan.QuoteStyleSpan[] quoteSpans = text.getSpans(0, text.length(), QuoteSpan.QuoteStyleSpan.class);
for (int i = 0; i < quoteSpans.length; ++i) {
QuoteSpan.QuoteStyleSpan span = quoteSpans[i];
final int start = text.getSpanStart(span);
final int end = text.getSpanEnd(span);
cutIndexes.add(start);
cutToType.put(start, (cutToType.containsKey(start) ? cutToType.get(start) : 0) | QUOTE_START);
cutIndexes.add(end);
cutToType.put(end, (cutToType.containsKey(end) ? cutToType.get(end) : 0) | QUOTE_END);
text.removeSpan(span);
text.removeSpan(span.span);
}
int from = 0;
int quoteCount = 0, codeCount = 0;
for (Iterator<Integer> i = cutIndexes.iterator(); i.hasNext(); ) {
int cutIndex = i.next();
final int type = cutToType.get(cutIndex);
if (from != cutIndex) {
int to = cutIndex;
if (cutIndex - 1 >= 0 && cutIndex - 1 < text.length() && text.charAt(cutIndex - 1) == '\n') {
to--;
}
final boolean isQuote = quoteCount > 0;
if (isQuote) {
QuoteSpan.putQuoteToEditable(text, from, to);
}
from = cutIndex;
if (from + 1 < text.length() && text.charAt(from) == '\n') {
from++;
}
}
if ((type & QUOTE_END) != 0) quoteCount--;
if ((type & QUOTE_START) != 0) quoteCount++;
if ((type & CODE_END) != 0) codeCount--;
if ((type & CODE_START) != 0) codeCount++;
}
if (from < text.length()) {
if (quoteCount > 0) {
QuoteSpan.putQuoteToEditable(text, from, text.length());
}
}
}
public static void normalizeQuotes(Spannable text) {
if (text == null) {
return;
}
final int QUOTE_START = 1;
final int QUOTE_END = 2;
final int CODE_START = 4;
final int CODE_END = 8;
final TreeSet<Integer> cutIndexes = new TreeSet<>();
final HashMap<Integer, Integer> cutToType = new HashMap<>();
QuoteSpan.QuoteStyleSpan[] quoteSpans = text.getSpans(0, text.length(), QuoteSpan.QuoteStyleSpan.class);
for (int i = 0; i < quoteSpans.length; ++i) {
QuoteSpan.QuoteStyleSpan span = quoteSpans[i];
final int start = text.getSpanStart(span);
final int end = text.getSpanEnd(span);
cutIndexes.add(start);
cutToType.put(start, (cutToType.containsKey(start) ? cutToType.get(start) : 0) | QUOTE_START);
cutIndexes.add(end);
cutToType.put(end, (cutToType.containsKey(end) ? cutToType.get(end) : 0) | QUOTE_END);
text.removeSpan(span);
text.removeSpan(span.span);
}
int from = 0;
int quoteCount = 0;
for (Iterator<Integer> i = cutIndexes.iterator(); i.hasNext(); ) {
int cutIndex = i.next();
final int type = cutToType.get(cutIndex);
if ((type & QUOTE_END) != 0 && (type & QUOTE_START) != 0 || quoteCount > 0 && (type & QUOTE_START) != 0) {
continue;
}
if (from != cutIndex) {
int to = cutIndex;
if (cutIndex - 1 >= 0 && cutIndex - 1 < text.length() && text.charAt(cutIndex - 1) == '\n') {
to--;
}
final boolean isQuote = quoteCount > 0;
if (isQuote) {
QuoteSpan.putQuote(text, from, to);
}
from = cutIndex;
if (from + 1 < text.length() && text.charAt(from) == '\n') {
from++;
}
}
if ((type & QUOTE_END) != 0) quoteCount--;
if ((type & QUOTE_START) != 0) quoteCount++;
}
if (from < text.length()) {
if (quoteCount > 0) {
QuoteSpan.putQuote(text, from, text.length());
}
}
}
}

View file

@ -61,6 +61,7 @@ import org.telegram.ui.PaymentFormActivity;
import java.util.ArrayList;
@SuppressWarnings("FieldCanBeLocal")
@Deprecated // use Bulletin instead
public class UndoView extends FrameLayout {
private TextView infoTextView;

View file

@ -89,10 +89,10 @@ public class SpoilerEffect2 {
case SharedConfig.PERFORMANCE_CLASS_HIGH:
return Math.min(900, (int) (Math.min(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y) * 1.0f));
case SharedConfig.PERFORMANCE_CLASS_AVERAGE:
return Math.min(512, (int) (Math.min(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y) * .95f));
return Math.min(900, (int) (Math.min(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y) * .8f));
default:
case SharedConfig.PERFORMANCE_CLASS_LOW:
return Math.min(400, (int) (Math.min(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y) * .85f));
return Math.min(720, (int) (Math.min(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y) * .7f));
}
}

View file

@ -2,6 +2,7 @@ package org.telegram.ui;
import android.graphics.Canvas;
import android.text.TextUtils;
import android.util.Log;
import android.view.HapticFeedbackConstants;
import android.view.View;
import android.widget.FrameLayout;

View file

@ -3825,10 +3825,13 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
if (!TextUtils.isEmpty(botAppMaybe)) {
TLRPC.User user = MessagesController.getInstance(intentAccount).getUser(peerId);
if (user != null && user.bot) {
if (user.bot_attach_menu && !MediaDataController.getInstance(intentAccount).botInAttachMenu(user.id)) {
TLRPC.TL_messages_getAttachMenuBot getAttachMenuBot = new TLRPC.TL_messages_getAttachMenuBot();
getAttachMenuBot.bot = MessagesController.getInstance(intentAccount).getInputUser(peerId);
ConnectionsManager.getInstance(intentAccount).sendRequest(getAttachMenuBot, (response1, error1) -> AndroidUtilities.runOnUIThread(() -> {
if (response1 instanceof TLRPC.TL_attachMenuBotsBot) {
if (error1 != null) {
AndroidUtilities.runOnUIThread(() -> runLinkRequest(intentAccount, username, group, sticker, emoji, botUser, botChat, botChannel, botChatAdminParams, message, contactToken, folderSlug, hasUrl, messageId, channelId, threadId, commentId, game, auth, lang, unsupportedUrl, code, loginToken, wallPaper, inputInvoiceSlug, theme, voicechat, livestream, state, videoTimestamp, setAsAttachBot, attachMenuBotToOpen, attachMenuBotChoose, null, null, progress, forceNotInternalForApps, storyId, isBoost));
} else if (response1 instanceof TLRPC.TL_attachMenuBotsBot) {
TLRPC.TL_attachMenuBotsBot bot = (TLRPC.TL_attachMenuBotsBot) response1;
TLRPC.TL_attachMenuBot attachBot = bot.bot;
final boolean botAttachable = attachBot != null && (attachBot.show_in_side_menu || attachBot.show_in_attach_menu);
@ -3873,6 +3876,9 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
}
}
}));
} else {
processWebAppBot(intentAccount, username, group, sticker, emoji, botUser, botChat, botChannel, botChatAdminParams, message, contactToken, folderSlug, hasUrl, messageId, channelId, threadId, commentId, game, auth, lang, unsupportedUrl, code, loginToken, wallPaper, inputInvoiceSlug, theme, voicechat, livestream, state, videoTimestamp, setAsAttachBot, attachMenuBotToOpen, attachMenuBotChoose, botAppMaybe, botAppStartParam, progress, forceNotInternalForApps, storyId, isBoost, user, dismissLoading, false);
}
return;
}
}

View file

@ -593,7 +593,7 @@ public class PeerColorActivity extends BaseFragment implements NotificationCente
public int getColor() {
if (selectedColor < 7) {
return getThemedColor(AvatarDrawable.getNameColorKey1For(selectedColor));
return getThemedColor(Theme.keys_avatar_nameInMessage[selectedColor]);
} else {
MessagesController.PeerColors peerColors = MessagesController.getInstance(currentAccount).peerColors;
if (peerColors != null) {
@ -603,7 +603,7 @@ public class PeerColorActivity extends BaseFragment implements NotificationCente
}
}
}
return getThemedColor(AvatarDrawable.getNameColorKey1For(0));
return getThemedColor(Theme.keys_avatar_nameInMessage[0]);
}
@Override

View file

@ -11129,7 +11129,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
if (location == null) {
return null;
}
if (videoLocation != location) {
if (videoLocation != null && videoLocation != location) {
return videoLocation.location.volume_id + "_" + videoLocation.location.local_id + ".mp4";
} else {
return location.location.volume_id + "_" + location.location.local_id + ".jpg";

View file

@ -922,12 +922,13 @@ public class PremiumPreviewFragment extends BaseFragment implements Notification
}
final boolean isPremium = UserConfig.getInstance(currentAccount).isPremium();
final boolean isYearTier = tier.getMonths() == 12;
final String price = isYearTier ? tier.getFormattedPricePerYear() : tier.getFormattedPricePerMonth();
String price = isYearTier ? tier.getFormattedPricePerYear() : tier.getFormattedPricePerMonth();
final int resId;
if (isPremium) {
resId = isYearTier ? R.string.UpgradePremiumPerYear : R.string.UpgradePremiumPerMonth;
} else {
resId = isYearTier ? R.string.SubscribeToPremiumPerYear : R.string.SubscribeToPremium;
price = tier.getFormattedPricePerMonthRounded();
resId = R.string.SubscribeToPremium;
}
return LocaleController.formatString(resId, price);
}
@ -1833,6 +1834,14 @@ public class PremiumPreviewFragment extends BaseFragment implements Notification
return googlePlayProductDetails == null ? "" : BillingController.getInstance().formatCurrency(getPricePerYear(), getCurrency(), 6);
}
public String getFormattedPricePerMonthRounded() {
if (BuildVars.useInvoiceBilling() || subscriptionOption.store_product == null) {
return BillingController.getInstance().formatCurrency(getPricePerMonth(), getCurrency(), BillingController.getInstance().getCurrencyExp(getCurrency()), true);
}
return googlePlayProductDetails == null ? "" : BillingController.getInstance().formatCurrency(getPricePerMonth(), getCurrency(), 6, true);
}
public String getFormattedPricePerMonth() {
if (BuildVars.useInvoiceBilling() || subscriptionOption.store_product == null) {
return BillingController.getInstance().formatCurrency(getPricePerMonth(), getCurrency());

View file

@ -215,7 +215,6 @@ public class CaptionContainerView extends FrameLayout {
return true;
}
};
editText.getEditText().wrapCanvasToFixClipping = Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT_WATCH && !BuildVars.isHuaweiStoreApp() && !XiaomiUtilities.isMIUI();
editText.setFocusable(true);
editText.setFocusableInTouchMode(true);
editText.getEditText().hintLayoutYFix = true;

View file

@ -584,6 +584,9 @@ public class DraftsController {
entry.gradientBottomColor = gradientBottomColor;
if (caption != null) {
CharSequence caption = new SpannableString(this.caption);
if (Theme.chat_msgTextPaint == null) {
Theme.createCommonMessageResources();
}
caption = Emoji.replaceEmoji(caption, Theme.chat_msgTextPaint.getFontMetricsInt(), true);
MessageObject.addEntitiesToText(caption, captionEntities, true, false, true, false);
entry.caption = caption;

View file

@ -635,7 +635,7 @@ public class TextMessageEnterTransition implements MessageEnterTransitionContain
float replyImageSz = 0;
if (messageView.needReplyImage) {
canvas.save();
final float sz = Math.min(replySelectorRect.height() - AndroidUtilities.dp(10), AndroidUtilities.dp(33));
final float sz = Math.min(replySelectorRect.height() - AndroidUtilities.dp(10), AndroidUtilities.dp(messageView.isReplyQuote ? 3 : 7) + Theme.chat_replyNamePaint.getTextSize() + Theme.chat_replyTextPaint.getTextSize());
replyImageSz = AndroidUtilities.lerp(AndroidUtilities.dp(35), sz, progressX);
messageView.replyImageReceiver.setImageCoords(
AndroidUtilities.lerp(replyX, replySelectorRect.left + AndroidUtilities.dp(8), progressX),

View file

@ -219,6 +219,10 @@ public class WebviewActivity extends BaseFragment {
webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
}
if (Build.VERSION.SDK_INT >= 17) {
webView.getSettings().setMediaPlaybackRequiresUserGesture(false);
}
if (Build.VERSION.SDK_INT >= 21) {
webView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
CookieManager cookieManager = CookieManager.getInstance();

View file

@ -7403,7 +7403,11 @@
<string name="BoostingGiveawayYouWon">You won a prize in this giveaway 🏆</string>
<string name="BoostingGiveawayViewPrize">View my prize</string>
<string name="BoostingGiveawayCanceledByPayment">The channel cancelled the prizes by reversing the payment for them.</string>
<string name="BoostingGiveawayUsedLinks">**%1$d** of the winners already used their gift links.</string>
<string name="BoostingGiveawayUsedLinksPlural_one">**%1$d** of the winners already used their gift links.</string>
<string name="BoostingGiveawayUsedLinksPlural_two">**%1$d** of the winners already used their gift links.</string>
<string name="BoostingGiveawayUsedLinksPlural_few">**%1$d** of the winners already used their gift links.</string>
<string name="BoostingGiveawayUsedLinksPlural_many">**%1$d** of the winners already used their gift links.</string>
<string name="BoostingGiveawayUsedLinksPlural_other">**%1$d** of the winners already used their gift links.</string>
<string name="BoostingReduceQuantityText">You cant purchase **%1$d** %2$s subscriptions in the app. Do you want to reduce the prize quantity to **%3$d**?</string>
<string name="BoostingReduceUsersText">You cant purchase **%1$d** subscriptions in the app. Only **%2$s** available.</string>
<string name="BoostingSelectUpTo">Select up to %1$d channels</string>

View file

@ -13,8 +13,8 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Sat Mar 12 05:53:50 MSK 2016
APP_VERSION_CODE=4071
APP_VERSION_NAME=10.2.2
APP_VERSION_CODE=4075
APP_VERSION_NAME=10.2.3
APP_PACKAGE=org.telegram.messenger
RELEASE_KEY_PASSWORD=android
RELEASE_KEY_ALIAS=androidkey