mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 06:25:14 +01:00
Update to 8.4.2
This commit is contained in:
parent
9e740dfd4d
commit
c1c2ebaf46
15 changed files with 157 additions and 72 deletions
|
@ -20,8 +20,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 = 2522;
|
||||
public static String BUILD_VERSION_STRING = "8.4.1";
|
||||
public static int BUILD_VERSION = 2526;
|
||||
public static String BUILD_VERSION_STRING = "8.4.2";
|
||||
public static int APP_ID = 4;
|
||||
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
|
||||
|
||||
|
|
|
@ -1766,13 +1766,13 @@ public class NotificationsController extends BaseController {
|
|||
} else {
|
||||
if (messageObject.isMediaEmpty()) {
|
||||
if (!TextUtils.isEmpty(messageObject.messageOwner.message)) {
|
||||
return messageObject.messageOwner.message;
|
||||
return replaceSpoilers(messageObject);
|
||||
} else {
|
||||
return LocaleController.getString("Message", R.string.Message);
|
||||
}
|
||||
} else if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaPhoto) {
|
||||
if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(messageObject.messageOwner.message)) {
|
||||
return "\uD83D\uDDBC " + messageObject.messageOwner.message;
|
||||
return "\uD83D\uDDBC " + replaceSpoilers(messageObject);
|
||||
} else if (messageObject.messageOwner.media.ttl_seconds != 0) {
|
||||
return LocaleController.getString("AttachDestructingPhoto", R.string.AttachDestructingPhoto);
|
||||
} else {
|
||||
|
@ -1780,7 +1780,7 @@ public class NotificationsController extends BaseController {
|
|||
}
|
||||
} else if (messageObject.isVideo()) {
|
||||
if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(messageObject.messageOwner.message)) {
|
||||
return "\uD83D\uDCF9 " + messageObject.messageOwner.message;
|
||||
return "\uD83D\uDCF9 " + replaceSpoilers(messageObject);
|
||||
} else if (messageObject.messageOwner.media.ttl_seconds != 0) {
|
||||
return LocaleController.getString("AttachDestructingVideo", R.string.AttachDestructingVideo);
|
||||
} else {
|
||||
|
@ -1816,19 +1816,19 @@ public class NotificationsController extends BaseController {
|
|||
}
|
||||
} else if (messageObject.isGif()) {
|
||||
if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(messageObject.messageOwner.message)) {
|
||||
return "\uD83C\uDFAC " + messageObject.messageOwner.message;
|
||||
return "\uD83C\uDFAC " + replaceSpoilers(messageObject);
|
||||
} else {
|
||||
return LocaleController.getString("AttachGif", R.string.AttachGif);
|
||||
}
|
||||
} else {
|
||||
if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(messageObject.messageOwner.message)) {
|
||||
return "\uD83D\uDCCE " + messageObject.messageOwner.message;
|
||||
return "\uD83D\uDCCE " + replaceSpoilers(messageObject);
|
||||
} else {
|
||||
return LocaleController.getString("AttachDocument", R.string.AttachDocument);
|
||||
}
|
||||
}
|
||||
} else if (!TextUtils.isEmpty(messageObject.messageText)) {
|
||||
return messageObject.messageText.toString();
|
||||
return replaceSpoilers(messageObject);
|
||||
} else {
|
||||
return LocaleController.getString("Message", R.string.Message);
|
||||
}
|
||||
|
|
|
@ -186,22 +186,18 @@ public class EmojiThemes {
|
|||
return themeItem;
|
||||
}
|
||||
|
||||
public static EmojiThemes createHome() {
|
||||
public static EmojiThemes createHomeQrTheme() {
|
||||
EmojiThemes themeItem = new EmojiThemes();
|
||||
themeItem.emoji = "\uD83C\uDFE0";
|
||||
|
||||
ThemeItem blue = new ThemeItem();
|
||||
blue.themeInfo = getDefaultThemeInfo(false);
|
||||
if (blue.themeInfo.getKey().equals("Blue")) {
|
||||
blue.accentId = 99;
|
||||
}
|
||||
blue.themeInfo = Theme.getTheme("Blue");
|
||||
blue.accentId = 99;
|
||||
themeItem.items.add(blue);
|
||||
|
||||
ThemeItem nightBlue = new ThemeItem();
|
||||
nightBlue.themeInfo = getDefaultThemeInfo(true);
|
||||
if (nightBlue.themeInfo.getKey().equals("Night")) {
|
||||
nightBlue.accentId = 0;
|
||||
}
|
||||
nightBlue.themeInfo = Theme.getTheme("Dark Blue");
|
||||
nightBlue.accentId = 0;
|
||||
themeItem.items.add(nightBlue);
|
||||
|
||||
return themeItem;
|
||||
|
|
|
@ -3679,6 +3679,8 @@ public class Theme {
|
|||
public static final String key_chat_inReactionButtonBackground = "chat_inReactionButtonBackground";
|
||||
public static final String key_chat_outReactionButtonText = "chat_outReactionButtonText";
|
||||
public static final String key_chat_inReactionButtonText = "chat_inReactionButtonText";
|
||||
public static final String key_chat_inReactionButtonTextSelected = "chat_inReactionButtonTextSelected";
|
||||
public static final String key_chat_outReactionButtonTextSelected = "chat_outReactionButtonTextSelected";
|
||||
|
||||
|
||||
public static final String key_drawable_botInline = "drawableBotInline";
|
||||
|
@ -4537,8 +4539,10 @@ public class Theme {
|
|||
|
||||
defaultColors.put(key_chat_outReactionButtonBackground, 0xff78c272);
|
||||
defaultColors.put(key_chat_inReactionButtonBackground, 0xff72b5e8);
|
||||
defaultColors.put(key_chat_inReactionButtonText, 0xffffffff);
|
||||
defaultColors.put(key_chat_outReactionButtonText, 0xffffffff);
|
||||
defaultColors.put(key_chat_inReactionButtonText, 0xff3a8ccf);
|
||||
defaultColors.put(key_chat_outReactionButtonText, 0xff55ab4f);
|
||||
defaultColors.put(key_chat_inReactionButtonTextSelected, 0xffffffff);
|
||||
defaultColors.put(key_chat_outReactionButtonTextSelected, 0xffffffff);
|
||||
|
||||
|
||||
fallbackKeys.put(key_chat_inAdminText, key_chat_inTimeText);
|
||||
|
@ -4680,6 +4684,8 @@ public class Theme {
|
|||
fallbackKeys.put(key_chat_outReactionButtonBackground, key_chat_outLoader);
|
||||
fallbackKeys.put(key_chat_inReactionButtonText, key_chat_inPreviewInstantText);
|
||||
fallbackKeys.put(key_chat_outReactionButtonText, key_chat_outPreviewInstantText);
|
||||
fallbackKeys.put(key_chat_inReactionButtonTextSelected, key_windowBackgroundWhite);
|
||||
fallbackKeys.put(key_chat_outReactionButtonTextSelected, key_windowBackgroundWhite);
|
||||
|
||||
themeAccentExclusionKeys.addAll(Arrays.asList(keys_avatar_background));
|
||||
themeAccentExclusionKeys.addAll(Arrays.asList(keys_avatar_nameInMessage));
|
||||
|
@ -5495,7 +5501,7 @@ public class Theme {
|
|||
int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
|
||||
int minutes = calendar.get(Calendar.MINUTE);
|
||||
int hour = calendar.get(Calendar.HOUR_OF_DAY);
|
||||
if (monthOfYear == 0 && dayOfMonth == 1 && minutes <= 10 && hour == 0) {
|
||||
if (monthOfYear == 0 && dayOfMonth == 1 && hour <= 23) {
|
||||
canStartHolidayAnimation = true;
|
||||
} else {
|
||||
canStartHolidayAnimation = false;
|
||||
|
|
|
@ -5285,10 +5285,11 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
|||
}
|
||||
}
|
||||
if (!reactionsLayoutInBubble.isSmall && !reactionsLayoutInBubble.isEmpty) {
|
||||
reactionsLayoutInBubble.positionOffsetY += AndroidUtilities.dp(12);
|
||||
// reactionsLayoutInBubble.positionOffsetY += AndroidUtilities.dp(12);
|
||||
reactionsLayoutInBubble.totalHeight = reactionsLayoutInBubble.height + AndroidUtilities.dp(8);
|
||||
measureTime(messageObject);
|
||||
int timeLeft = backgroundWidth - reactionsLayoutInBubble.lastLineX - AndroidUtilities.dp(24);
|
||||
|
||||
if (timeLeft < timeWidth) {
|
||||
reactionsLayoutInBubble.totalHeight += AndroidUtilities.dp(12);
|
||||
reactionsLayoutInBubble.positionOffsetY -= AndroidUtilities.dp(12);
|
||||
|
@ -8377,6 +8378,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
|||
if (captionLayout != null) {
|
||||
reactionsLayoutInBubble.y -= AndroidUtilities.dp(14);
|
||||
}
|
||||
if (!botButtons.isEmpty() && currentMessageObject.type == 9) {
|
||||
reactionsLayoutInBubble.y += AndroidUtilities.dp(10);
|
||||
}
|
||||
reactionsLayoutInBubble.y = reactionsLayoutInBubble.y + reactionsLayoutInBubble.positionOffsetY;
|
||||
}
|
||||
if (reactionsLayoutInBubble.isSmall && !reactionsLayoutInBubble.isEmpty) {
|
||||
|
@ -10482,7 +10486,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
|||
mess = mess.replace('\n', ' ');
|
||||
stringFinalText = Emoji.replaceEmoji(mess, Theme.chat_replyTextPaint.getFontMetricsInt(), AndroidUtilities.dp(14), false);
|
||||
stringFinalText = TextUtils.ellipsize(stringFinalText, Theme.chat_replyTextPaint, maxWidth, TextUtils.TruncateAt.END);
|
||||
MediaDataController.addTextStyleRuns(messageObject.replyMessageObject.messageOwner.entities, messageObject.replyMessageObject.caption, (Spannable) stringFinalText);
|
||||
if (stringFinalText instanceof Spannable) {
|
||||
MediaDataController.addTextStyleRuns(messageObject.replyMessageObject.messageOwner.entities, messageObject.replyMessageObject.caption, (Spannable) stringFinalText);
|
||||
}
|
||||
} else if (messageObject.replyMessageObject.messageText != null && messageObject.replyMessageObject.messageText.length() > 0) {
|
||||
String mess = messageObject.replyMessageObject.messageText.toString();
|
||||
if (mess.length() > 150) {
|
||||
|
@ -12498,7 +12504,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
|||
|
||||
}
|
||||
if (reactionsLayoutInBubble.isSmall) {
|
||||
Log.d("kek", transitionParams.shouldAnimateTimeX + " " + transitionParams.animateBackgroundBoundsInner + " " + transitionParams.animateFromTimeX + " " + this.timeX);
|
||||
if (transitionParams.animateBackgroundBoundsInner && transitionParams.deltaRight != 0) {
|
||||
timeTitleTimeX += reactionsLayoutInBubble.getCurrentWidth(1f);
|
||||
} else {
|
||||
|
|
|
@ -83,6 +83,13 @@ public class TextDetailCell extends FrameLayout {
|
|||
} else {
|
||||
imageView.setBackground(Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(48), Color.TRANSPARENT, Theme.getColor(Theme.key_listSelector)));
|
||||
}
|
||||
int margin = AndroidUtilities.dp(23) + (drawable == null ? 0 : AndroidUtilities.dp(48));
|
||||
if (LocaleController.isRTL) {
|
||||
((MarginLayoutParams) textView.getLayoutParams()).leftMargin = margin;
|
||||
} else {
|
||||
((MarginLayoutParams) textView.getLayoutParams()).rightMargin = margin;
|
||||
}
|
||||
textView.requestLayout();
|
||||
}
|
||||
|
||||
public void setImageClickListener(View.OnClickListener clickListener) {
|
||||
|
|
|
@ -20904,10 +20904,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
}
|
||||
);
|
||||
cell.setOnClickListener(e -> {
|
||||
if (selectedObject == null || i >= options.size()) {
|
||||
if (selectedObject == null || i >= options.size() || getParentActivity() == null) {
|
||||
return;
|
||||
}
|
||||
TranslateAlert.showAlert(getParentActivity(), this, fromLang[0], toLang, finalMessageText, currentChat.noforwards);
|
||||
boolean noForwards = currentChat != null && currentChat.noforwards;
|
||||
TranslateAlert.showAlert(getParentActivity(), this, fromLang[0], toLang, finalMessageText, noForwards);
|
||||
scrimView = null;
|
||||
contentView.invalidate();
|
||||
chatListView.invalidate();
|
||||
|
@ -20923,10 +20924,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
}, 250);
|
||||
} else {
|
||||
cell.setOnClickListener(e -> {
|
||||
if (selectedObject == null || i >= options.size()) {
|
||||
if (selectedObject == null || i >= options.size() || getParentActivity() == null) {
|
||||
return;
|
||||
}
|
||||
TranslateAlert.showAlert(getParentActivity(), this, "und", toLang, finalMessageText, currentChat.noforwards);
|
||||
boolean noForwards = currentChat != null && currentChat.noforwards;
|
||||
TranslateAlert.showAlert(getParentActivity(), this, "und", toLang, finalMessageText, noForwards);
|
||||
scrimView = null;
|
||||
contentView.invalidate();
|
||||
chatListView.invalidate();
|
||||
|
@ -23847,6 +23849,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
|
||||
@Override
|
||||
public void didPressReaction(ChatMessageCell cell, TLRPC.TL_reactionCount reaction, boolean longpress) {
|
||||
if (getParentActivity() == null) {
|
||||
return;
|
||||
}
|
||||
if (longpress) {
|
||||
if (!ChatObject.isChannelAndNotMegaGroup(currentChat)) {
|
||||
cell.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
|
||||
|
@ -26045,6 +26050,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_chat_inReactionButtonBackground));
|
||||
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_chat_inReactionButtonText));
|
||||
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_chat_outReactionButtonText));
|
||||
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_chat_inReactionButtonTextSelected));
|
||||
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_chat_inReactionButtonTextSelected));
|
||||
|
||||
if (chatActivityEnterView != null) {
|
||||
themeDescriptions.add(new ThemeDescription(chatActivityEnterView.botCommandsMenuContainer.listView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{BotCommandsMenuView.BotCommandView.class}, new String[]{"description"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
|
||||
|
|
|
@ -375,11 +375,12 @@ public class ReactionsLayoutInBubble {
|
|||
counterDrawable.updateVisibility = false;
|
||||
if (reactionCount.chosen) {
|
||||
backgroundColor = Theme.getColor(messageObject.isOutOwner() ? Theme.key_chat_outReactionButtonBackground : Theme.key_chat_inReactionButtonBackground, resourcesProvider);
|
||||
textColor = Theme.getColor(messageObject.isOutOwner() ? Theme.key_chat_outReactionButtonText : Theme.key_chat_inReactionButtonText, resourcesProvider);
|
||||
textColor = Theme.getColor(messageObject.isOutOwner() ? Theme.key_chat_outReactionButtonTextSelected : Theme.key_chat_inReactionButtonTextSelected, resourcesProvider);
|
||||
serviceTextColor = Theme.getColor(messageObject.isOutOwner() ? Theme.key_chat_outReactionButtonBackground : Theme.key_chat_inReactionButtonBackground, resourcesProvider);
|
||||
serviceBackgroundColor = Theme.getColor(messageObject.isOutOwner() ? Theme.key_chat_outBubble : Theme.key_chat_inBubble);
|
||||
} else {
|
||||
textColor = backgroundColor = Theme.getColor(messageObject.isOutOwner() ? Theme.key_chat_outReactionButtonBackground : Theme.key_chat_inReactionButtonBackground, resourcesProvider);
|
||||
textColor = Theme.getColor(messageObject.isOutOwner() ? Theme.key_chat_outReactionButtonText : Theme.key_chat_inReactionButtonText, resourcesProvider);
|
||||
backgroundColor = Theme.getColor(messageObject.isOutOwner() ? Theme.key_chat_outReactionButtonBackground : Theme.key_chat_inReactionButtonBackground, resourcesProvider);
|
||||
backgroundColor = ColorUtils.setAlphaComponent(backgroundColor, (int) (Color.alpha(backgroundColor) * 0.156f));
|
||||
serviceTextColor = Theme.getColor(Theme.key_chat_serviceText, resourcesProvider);
|
||||
serviceBackgroundColor = Color.TRANSPARENT;
|
||||
|
|
|
@ -387,7 +387,7 @@ public class ReactionsContainerLayout extends FrameLayout {
|
|||
Runnable playRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (backupImageView.getImageReceiver().getLottieAnimation() != null) {
|
||||
if (backupImageView.getImageReceiver().getLottieAnimation() != null && !backupImageView.getImageReceiver().getLottieAnimation().isRunning()) {
|
||||
backupImageView.getImageReceiver().getLottieAnimation().start();
|
||||
}
|
||||
}
|
||||
|
@ -410,11 +410,12 @@ public class ReactionsContainerLayout extends FrameLayout {
|
|||
public void play(int delay) {
|
||||
AndroidUtilities.cancelRunOnUIThread(playRunnable);
|
||||
if (backupImageView.getImageReceiver().getLottieAnimation() != null) {
|
||||
backupImageView.getImageReceiver().getLottieAnimation().setCurrentFrame(0);
|
||||
backupImageView.getImageReceiver().getLottieAnimation().setCurrentFrame(0, false);
|
||||
if (delay == 0) {
|
||||
playRunnable.run();
|
||||
} else {
|
||||
backupImageView.getImageReceiver().getLottieAnimation().stop();
|
||||
backupImageView.getImageReceiver().getLottieAnimation().setCurrentFrame(0, false);
|
||||
AndroidUtilities.runOnUIThread(playRunnable, delay);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@ import android.widget.FrameLayout;
|
|||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.DocumentObject;
|
||||
import org.telegram.messenger.FileLoader;
|
||||
|
@ -31,8 +33,6 @@ import org.telegram.tgnet.TLRPC;
|
|||
import org.telegram.ui.ActionBar.BottomSheet;
|
||||
import org.telegram.ui.ActionBar.Theme;
|
||||
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
|
||||
public class UpdateAppAlertDialog extends BottomSheet {
|
||||
|
||||
private TLRPC.TL_help_appUpdate appUpdate;
|
||||
|
@ -239,9 +239,9 @@ public class UpdateAppAlertDialog extends BottomSheet {
|
|||
ImageLocation imageLocation = ImageLocation.getForDocument(thumb, appUpdate.sticker);
|
||||
|
||||
if (svgThumb != null) {
|
||||
imageView.setImage(ImageLocation.getForDocument(appUpdate.sticker), "160_160", svgThumb, 0, "update");
|
||||
imageView.setImage(ImageLocation.getForDocument(appUpdate.sticker), "250_250", svgThumb, 0, "update");
|
||||
} else {
|
||||
imageView.setImage(ImageLocation.getForDocument(appUpdate.sticker), "160_160", imageLocation, null, 0, "update");
|
||||
imageView.setImage(ImageLocation.getForDocument(appUpdate.sticker), "250_250", imageLocation, null, 0, "update");
|
||||
}
|
||||
linearLayout.addView(imageView, LayoutHelper.createLinear(160, 160, Gravity.CENTER_HORIZONTAL | Gravity.TOP, 17, 8, 17, 0));
|
||||
}
|
||||
|
|
|
@ -2,7 +2,10 @@ package org.telegram.ui.Components.spoilers;
|
|||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffXfermode;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Region;
|
||||
import android.text.Layout;
|
||||
|
@ -22,6 +25,7 @@ public class SpoilersTextView extends TextView {
|
|||
private Stack<SpoilerEffect> spoilersPool = new Stack<>();
|
||||
private boolean isSpoilersRevealed;
|
||||
private Path path = new Path();
|
||||
private Paint xRefPaint;
|
||||
|
||||
public SpoilersTextView(Context context) {
|
||||
super(context);
|
||||
|
@ -82,19 +86,38 @@ public class SpoilersTextView extends TextView {
|
|||
canvas.save();
|
||||
canvas.clipPath(path);
|
||||
path.rewind();
|
||||
if (!spoilers.isEmpty())
|
||||
if (!spoilers.isEmpty()) {
|
||||
spoilers.get(0).getRipplePath(path);
|
||||
}
|
||||
canvas.clipPath(path);
|
||||
super.onDraw(canvas);
|
||||
canvas.restore();
|
||||
|
||||
canvas.save();
|
||||
canvas.translate(getPaddingLeft(), getPaddingTop() + AndroidUtilities.dp(2));
|
||||
for (SpoilerEffect eff : spoilers) {
|
||||
eff.setColor(getPaint().getColor());
|
||||
eff.draw(canvas);
|
||||
if (!spoilers.isEmpty()) {
|
||||
boolean useAlphaLayer = spoilers.get(0).getRippleProgress() != -1;
|
||||
if (useAlphaLayer) {
|
||||
canvas.saveLayer(0, 0, getMeasuredWidth(), getMeasuredHeight(), null, canvas.ALL_SAVE_FLAG);
|
||||
} else {
|
||||
canvas.save();
|
||||
}
|
||||
canvas.translate(getPaddingLeft(), getPaddingTop() + AndroidUtilities.dp(2));
|
||||
for (SpoilerEffect eff : spoilers) {
|
||||
eff.setColor(getPaint().getColor());
|
||||
eff.draw(canvas);
|
||||
}
|
||||
|
||||
if (useAlphaLayer) {
|
||||
path.rewind();
|
||||
spoilers.get(0).getRipplePath(path);
|
||||
if (xRefPaint == null) {
|
||||
xRefPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
xRefPaint.setColor(0xff000000);
|
||||
xRefPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
|
||||
}
|
||||
canvas.drawPath(path, xRefPaint);
|
||||
}
|
||||
canvas.restore();
|
||||
}
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
private void invalidateSpoilers() {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.telegram.ui;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.text.TextUtils;
|
||||
import android.view.HapticFeedbackConstants;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
@ -319,8 +320,10 @@ public class EmojiAnimationsOverlay implements NotificationCenter.NotificationCe
|
|||
return false;
|
||||
}
|
||||
|
||||
emoji = unwrapEmoji(emoji);
|
||||
|
||||
if (supportedEmoji.contains(emoji)) {
|
||||
ArrayList<TLRPC.Document> arrayList = emojiInteractionsStickersMap.get(view.getMessageObject().getStickerEmoji());
|
||||
ArrayList<TLRPC.Document> arrayList = emojiInteractionsStickersMap.get(emoji);
|
||||
if (arrayList != null && !arrayList.isEmpty()) {
|
||||
int sameAnimationsCount = 0;
|
||||
for (int i = 0; i < drawingObjects.size(); i++) {
|
||||
|
@ -404,6 +407,23 @@ public class EmojiAnimationsOverlay implements NotificationCenter.NotificationCe
|
|||
return false;
|
||||
}
|
||||
|
||||
private String unwrapEmoji(String emoji) {
|
||||
CharSequence fixedEmoji = emoji;
|
||||
int length = emoji.length();
|
||||
for (int a = 0; a < length; a++) {
|
||||
if (a < length - 1 && (fixedEmoji.charAt(a) == 0xD83C && fixedEmoji.charAt(a + 1) >= 0xDFFB && fixedEmoji.charAt(a + 1) <= 0xDFFF || fixedEmoji.charAt(a) == 0x200D && (fixedEmoji.charAt(a + 1) == 0x2640 || fixedEmoji.charAt(a + 1) == 0x2642))) {
|
||||
fixedEmoji = TextUtils.concat(fixedEmoji.subSequence(0, a), fixedEmoji.subSequence(a + 2, fixedEmoji.length()));
|
||||
length -= 2;
|
||||
a--;
|
||||
} else if (fixedEmoji.charAt(a) == 0xfe0f) {
|
||||
fixedEmoji = TextUtils.concat(fixedEmoji.subSequence(0, a), fixedEmoji.subSequence(a + 1, fixedEmoji.length()));
|
||||
length--;
|
||||
a--;
|
||||
}
|
||||
}
|
||||
return fixedEmoji.toString();
|
||||
}
|
||||
|
||||
private void sendCurrentTaps() {
|
||||
if (lastTappedMsgId == 0) {
|
||||
return;
|
||||
|
|
|
@ -1926,8 +1926,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
|||
|
||||
ActionBarMenu menu = actionBar.createMenu();
|
||||
|
||||
if (userId == getUserConfig().clientUserId && !TextUtils.isEmpty(getUserConfig().getCurrentUser().username)) {
|
||||
if (userId == getUserConfig().clientUserId) {
|
||||
qrItem = menu.addItem(qr_button, R.drawable.msg_qr_mini, getResourceProvider());
|
||||
qrItem.setVisibility(isQrNeedVisible() ? View.VISIBLE : View.GONE);
|
||||
qrItem.setContentDescription(LocaleController.getString("AuthAnotherClientScan", R.string.AuthAnotherClientScan));
|
||||
}
|
||||
if (imageUpdater != null) {
|
||||
|
@ -3231,6 +3232,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
|||
avatarImage.setRoundRadius((int) AndroidUtilities.lerp(AndroidUtilities.dpf2(21f), 0f, value));
|
||||
if (searchItem != null) {
|
||||
searchItem.setAlpha(1.0f - value);
|
||||
searchItem.setScaleY(1.0f - value);
|
||||
searchItem.setVisibility(searchItem.getAlpha() == 0f ? View.GONE : View.VISIBLE);
|
||||
if (qrItem != null && searchItem.getVisibility() == View.VISIBLE) {
|
||||
float translation = AndroidUtilities.dp(48) * value;
|
||||
|
@ -4297,14 +4299,14 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
|||
qrItemAnimation.setInterpolator(new DecelerateInterpolator());
|
||||
qrItemAnimation.playTogether(
|
||||
ObjectAnimator.ofFloat(qrItem, View.ALPHA, 1.0f),
|
||||
ObjectAnimator.ofFloat(qrItem, View.TRANSLATION_X, 0),
|
||||
ObjectAnimator.ofFloat(qrItem, View.SCALE_Y, 1f),
|
||||
ObjectAnimator.ofFloat(avatarsViewPagerIndicatorView, View.TRANSLATION_X, -AndroidUtilities.dp(48))
|
||||
);
|
||||
} else {
|
||||
qrItemAnimation.setInterpolator(new AccelerateInterpolator());
|
||||
qrItemAnimation.playTogether(
|
||||
ObjectAnimator.ofFloat(qrItem, View.ALPHA, 0.0f),
|
||||
ObjectAnimator.ofFloat(qrItem, View.TRANSLATION_X, AndroidUtilities.dp(48)),
|
||||
ObjectAnimator.ofFloat(qrItem, View.SCALE_Y, 0f),
|
||||
ObjectAnimator.ofFloat(avatarsViewPagerIndicatorView, View.TRANSLATION_X, 0)
|
||||
);
|
||||
}
|
||||
|
@ -6085,6 +6087,10 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
|||
}
|
||||
avatarImage.getImageReceiver().setVisible(!PhotoViewer.isShowingImage(photoBig), false);
|
||||
}
|
||||
|
||||
if (qrItem != null) {
|
||||
qrItem.setVisibility(isQrNeedVisible() ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void createActionBarMenu(boolean animated) {
|
||||
|
@ -6408,7 +6414,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
|||
otherItem.setVisibility(itemVisibility);
|
||||
}
|
||||
if (qrItem != null) {
|
||||
qrItem.setVisibility(itemVisibility);
|
||||
qrItem.setVisibility(isQrNeedVisible() && searchTransitionProgress > 0.5f ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
searchItem.setVisibility(itemVisibility);
|
||||
|
||||
|
@ -6461,7 +6467,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
|||
}
|
||||
if (qrItem != null) {
|
||||
qrItem.setAlpha(progressHalf);
|
||||
qrItem.setVisibility(visibility);
|
||||
qrItem.setVisibility(searchTransitionProgress > 0.5f && isQrNeedVisible() ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
searchItem.setVisibility(visibility);
|
||||
|
||||
|
@ -6527,7 +6533,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
|||
}
|
||||
if (qrItem != null) {
|
||||
qrItem.setAlpha(1f);
|
||||
qrItem.setVisibility(hide);
|
||||
qrItem.setVisibility(enter || !isQrNeedVisible() ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
searchItem.setVisibility(hide);
|
||||
|
||||
|
@ -8236,6 +8242,10 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isQrNeedVisible() {
|
||||
return !TextUtils.isEmpty(getUserConfig().getCurrentUser().username);
|
||||
}
|
||||
|
||||
private class DiffCallback extends DiffUtil.Callback {
|
||||
|
||||
int oldRowCount;
|
||||
|
|
|
@ -31,6 +31,7 @@ import android.text.TextPaint;
|
|||
import android.text.TextUtils;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
|
@ -114,7 +115,7 @@ public class QrActivity extends BaseFragment {
|
|||
}
|
||||
|
||||
private final ThemeResourcesProvider resourcesProvider = new ThemeResourcesProvider();
|
||||
private final EmojiThemes homeTheme = EmojiThemes.createHome();
|
||||
private final EmojiThemes homeTheme = EmojiThemes.createHomeQrTheme();
|
||||
private final Rect logoRect = new Rect();
|
||||
private final ArrayMap<String, Bitmap> emojiThemeDarkIcons = new ArrayMap<>();
|
||||
private final int[] prevQrColors = new int[4];
|
||||
|
@ -126,6 +127,7 @@ public class QrActivity extends BaseFragment {
|
|||
private ValueAnimator patternAlphaAnimator;
|
||||
private ValueAnimator patternIntensityAnimator;
|
||||
|
||||
private View backgroundView;
|
||||
private FrameLayout themeLayout;
|
||||
private BackupImageView avatarImageView;
|
||||
private QrView qrView;
|
||||
|
@ -142,7 +144,6 @@ public class QrActivity extends BaseFragment {
|
|||
|
||||
public QrActivity(Bundle args) {
|
||||
super(args);
|
||||
homeTheme.loadPreviewColors(currentAccount);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -152,16 +153,24 @@ public class QrActivity extends BaseFragment {
|
|||
return super.onFragmentCreate();
|
||||
}
|
||||
|
||||
@SuppressLint("SourceLockedOrientationActivity")
|
||||
@Override
|
||||
public View createView(Context context) {
|
||||
homeTheme.loadPreviewColors(currentAccount);
|
||||
isCurrentThemeDark = Theme.getActiveTheme().isDark();
|
||||
actionBar.setAddToContainer(false);
|
||||
actionBar.setBackground(null);
|
||||
actionBar.setItemsColor(0xffffffff, false);
|
||||
|
||||
FrameLayout rootLayout = new FrameLayout(context) {
|
||||
|
||||
private boolean prevIsPortrait;
|
||||
|
||||
@Override
|
||||
public boolean dispatchTouchEvent(MotionEvent ev) {
|
||||
super.dispatchTouchEvent(ev);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
int width = MeasureSpec.getSize(widthMeasureSpec);
|
||||
|
@ -181,10 +190,13 @@ public class QrActivity extends BaseFragment {
|
|||
}
|
||||
prevIsPortrait = isPortrait;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
boolean isPortrait = getWidth() < getHeight();
|
||||
|
||||
backgroundView.layout(0, 0, getWidth(), getHeight());
|
||||
|
||||
int themeLayoutHeight = 0;
|
||||
if (themeLayout.getVisibility() == View.VISIBLE) {
|
||||
themeLayoutHeight = themeLayout.getMeasuredHeight();
|
||||
|
@ -220,21 +232,21 @@ public class QrActivity extends BaseFragment {
|
|||
int closeTop = AndroidUtilities.statusBarHeight + (isPortrait ? AndroidUtilities.dp(10) : AndroidUtilities.dp(5));
|
||||
closeImageView.layout(closeLeft, closeTop, closeLeft + closeImageView.getMeasuredWidth(), closeTop + closeImageView.getMeasuredHeight());
|
||||
}
|
||||
};
|
||||
|
||||
backgroundView = new View(context) {
|
||||
@Override
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
protected void onDraw(Canvas canvas) {
|
||||
if (prevMotionDrawable != null) {
|
||||
prevMotionDrawable.setBounds(0, 0, getWidth(), getHeight());
|
||||
prevMotionDrawable.draw(canvas);
|
||||
}
|
||||
currMotionDrawable.setBounds(0, 0, getWidth(), getHeight());
|
||||
currMotionDrawable.draw(canvas);
|
||||
super.dispatchDraw(canvas);
|
||||
}
|
||||
@Override
|
||||
protected boolean verifyDrawable(@NonNull Drawable who) {
|
||||
return super.verifyDrawable(who) || who == currMotionDrawable || who == prevMotionDrawable;
|
||||
super.onDraw(canvas);
|
||||
}
|
||||
};
|
||||
rootLayout.addView(backgroundView);
|
||||
|
||||
AvatarDrawable avatarDrawable = null;
|
||||
String username = null;
|
||||
|
@ -480,9 +492,9 @@ public class QrActivity extends BaseFragment {
|
|||
prevMotionDrawable.setIndeterminateAnimation(false);
|
||||
|
||||
currMotionDrawable = new MotionBackgroundDrawable();
|
||||
currMotionDrawable.setCallback(fragmentView);
|
||||
currMotionDrawable.setCallback(backgroundView);
|
||||
currMotionDrawable.setColors(themeItem.patternBgColor, themeItem.patternBgGradientColor1, themeItem.patternBgGradientColor2, themeItem.patternBgGradientColor3);
|
||||
currMotionDrawable.setParentView(fragmentView);
|
||||
currMotionDrawable.setParentView(backgroundView);
|
||||
currMotionDrawable.setPatternAlpha(1f);
|
||||
currMotionDrawable.setIndeterminateAnimation(true);
|
||||
currMotionDrawable.posAnimationProgress = prevMotionDrawable.posAnimationProgress;
|
||||
|
@ -501,7 +513,7 @@ public class QrActivity extends BaseFragment {
|
|||
}
|
||||
});
|
||||
} else {
|
||||
currMotionDrawable.setPatternBitmap(34, SvgHelper.getBitmap(R.raw.default_pattern, fragmentView.getWidth(), fragmentView.getHeight(), Color.BLACK));
|
||||
currMotionDrawable.setPatternBitmap(34, SvgHelper.getBitmap(R.raw.default_pattern, backgroundView.getWidth(), backgroundView.getHeight(), Color.BLACK));
|
||||
}
|
||||
currMotionDrawable.setPatternColorFilter(currMotionDrawable.getPatternColor());
|
||||
|
||||
|
@ -528,7 +540,7 @@ public class QrActivity extends BaseFragment {
|
|||
int color4 = ColorUtils.blendARGB(prevQrColors[3], newQrColors[3], progress);
|
||||
qrView.setColors(color1, color2, color3, color4);
|
||||
}
|
||||
fragmentView.invalidate();
|
||||
backgroundView.invalidate();
|
||||
});
|
||||
patternAlphaAnimator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
|
@ -549,7 +561,7 @@ public class QrActivity extends BaseFragment {
|
|||
System.arraycopy(newQrColors, 0, prevQrColors, 0, 4);
|
||||
}
|
||||
prevMotionDrawable = null;
|
||||
fragmentView.invalidate();
|
||||
backgroundView.invalidate();
|
||||
}
|
||||
|
||||
Theme.ThemeInfo currentThemeInfo = isCurrentThemeDark ? Theme.getCurrentNightTheme() : Theme.getCurrentTheme();
|
||||
|
@ -595,8 +607,8 @@ public class QrActivity extends BaseFragment {
|
|||
drawable.setCurrentFrame(currentFrame, false);
|
||||
logoImageView.playAnimation();
|
||||
|
||||
fragmentView.layout(fragmentView.getLeft() - 1, fragmentView.getTop(), fragmentView.getRight(), fragmentView.getBottom());
|
||||
fragmentView.layout(fragmentView.getLeft() + 1, fragmentView.getTop(), fragmentView.getRight(), fragmentView.getBottom());
|
||||
ViewGroup parent = (ViewGroup) fragmentView.getParent();
|
||||
fragmentView.layout(0, 0, parent.getWidth(), parent.getHeight());
|
||||
|
||||
Uri uri = AndroidUtilities.getBitmapShareUri(bitmap, "qr_tmp.jpg", Bitmap.CompressFormat.JPEG);
|
||||
if (uri != null) {
|
||||
|
@ -766,13 +778,13 @@ public class QrActivity extends BaseFragment {
|
|||
int linesCount = textWidth > textMaxWidth ? 2 : 1;
|
||||
int layoutWidth = textMaxWidth;
|
||||
if (linesCount > 1) {
|
||||
layoutWidth = (int)(textWidth + drawable.getBounds().width()) / 2 + AndroidUtilities.dp(1);
|
||||
layoutWidth = (int)(textWidth + drawable.getBounds().width()) / 2 + AndroidUtilities.dp(2);
|
||||
}
|
||||
if (layoutWidth > textMaxWidth) {
|
||||
linesCount = 3;
|
||||
layoutWidth = (int)(textWidth + drawable.getBounds().width()) / 3 + AndroidUtilities.dp(2);
|
||||
layoutWidth = (int)(textWidth + drawable.getBounds().width()) / 3 + AndroidUtilities.dp(4);
|
||||
}
|
||||
staticLayout = StaticLayoutEx.createStaticLayout(string, textPaint, layoutWidth, Layout.Alignment.ALIGN_CENTER, 1f, 0f, false, null, contentBitmap.getWidth(), linesCount);
|
||||
staticLayout = StaticLayoutEx.createStaticLayout(string, textPaint, layoutWidth, Layout.Alignment.ALIGN_CENTER, 1f, 0f, false, null, Math.min(layoutWidth + AndroidUtilities.dp(10), contentBitmap.getWidth()), linesCount);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -29,13 +29,10 @@ import org.telegram.ui.Components.RecyclerListView;
|
|||
import org.telegram.ui.Components.SimpleThemeDescription;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class ReactionsDoubleTapManageActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
|
||||
|
||||
private List<String> chatReactions = Collections.emptyList();
|
||||
|
||||
private LinearLayout contentView;
|
||||
private RecyclerListView listView;
|
||||
private RecyclerView.Adapter listAdapter;
|
||||
|
@ -159,7 +156,7 @@ public class ReactionsDoubleTapManageActivity extends BaseFragment implements No
|
|||
}
|
||||
|
||||
private List<TLRPC.TL_availableReaction> getAvailableReactions() {
|
||||
return getMediaDataController().getReactionsList();
|
||||
return getMediaDataController().getEnabledReactionsList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue