Merge official 8.4.4

This commit is contained in:
luvletter2333 2022-01-20 15:25:09 +08:00
commit e1c74d2aaf
No known key found for this signature in database
GPG Key ID: A26A8880836E1978
29 changed files with 1258 additions and 237 deletions

View File

@ -3,15 +3,15 @@ import cn.hutool.core.util.RuntimeUtil
apply plugin: "com.android.application" apply plugin: "com.android.application"
apply plugin: "kotlin-android" apply plugin: "kotlin-android"
def verName = "8.4.3-rc01" def verName = "8.4.4-preview01"
def verCode = 535 def verCode = 540
if (System.getenv("DEBUG_BUILD") == "true") { if (System.getenv("DEBUG_BUILD") == "true") {
verName += "-" + RuntimeUtil.execForStr("git log --pretty=format:'%h' -n 1") verName += "-" + RuntimeUtil.execForStr("git log --pretty=format:'%h' -n 1")
} }
def officialVer = "8.4.3" def officialVer = "8.4.4"
def officialCode = 2531 def officialCode = 2538
def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json") def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json")

View File

@ -102,7 +102,7 @@ public class ChatListItemAnimator extends DefaultItemAnimator {
ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, 1f); ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, 1f);
valueAnimator.addUpdateListener(animation -> { valueAnimator.addUpdateListener(animation -> {
if (activity != null) { if (activity != null) {
activity.onListItemAniamtorTick(); activity.onListItemAnimatorTick();
} else { } else {
recyclerListView.invalidate(); recyclerListView.invalidate();
} }

View File

@ -96,6 +96,7 @@ import androidx.viewpager.widget.ViewPager;
import com.android.internal.telephony.ITelephony; import com.android.internal.telephony.ITelephony;
import org.telegram.PhoneFormat.PhoneFormat; import org.telegram.PhoneFormat.PhoneFormat;
import org.telegram.messenger.browser.Browser; import org.telegram.messenger.browser.Browser;
import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.ConnectionsManager;
@ -205,6 +206,7 @@ public class AndroidUtilities {
private static RectF bitmapRect; private static RectF bitmapRect;
public static final RectF rectTmp = new RectF(); public static final RectF rectTmp = new RectF();
public static final Rect rectTmp2 = new Rect();
public static Pattern WEB_URL = null; public static Pattern WEB_URL = null;
public static Pattern BAD_CHARS_PATTERN = null; public static Pattern BAD_CHARS_PATTERN = null;

View File

@ -520,7 +520,7 @@ public class ImageLoader {
fileOutputStream = new RandomAccessFile(cacheImage.tempFilePath, "rws"); fileOutputStream = new RandomAccessFile(cacheImage.tempFilePath, "rws");
} }
} catch (Throwable e) { } catch (Throwable e) {
boolean sentLogs = true; boolean sentLogs = true;
if (e instanceof SocketTimeoutException) { if (e instanceof SocketTimeoutException) {
if (ApplicationLoader.isNetworkOnline()) { if (ApplicationLoader.isNetworkOnline()) {
canRetry = false; canRetry = false;
@ -537,6 +537,8 @@ public class ImageLoader {
} else if (e instanceof FileNotFoundException) { } else if (e instanceof FileNotFoundException) {
canRetry = false; canRetry = false;
sentLogs = false; sentLogs = false;
} else if (e instanceof InterruptedException) {
sentLogs = false;
} }
FileLog.e(e, sentLogs); FileLog.e(e, sentLogs);
} }
@ -912,7 +914,7 @@ public class ImageLoader {
compressed = true; compressed = true;
} }
} catch (Exception e) { } catch (Exception e) {
FileLog.e(e); FileLog.e(e, false);
} finally { } finally {
if (randomAccessFile != null) { if (randomAccessFile != null) {
try { try {

View File

@ -315,7 +315,7 @@ public class MediaDataController extends BaseController {
date = c.intValue(2); date = c.intValue(2);
} }
} catch (Exception e) { } catch (Exception e) {
FileLog.e(e); FileLog.e(e, false);
} finally { } finally {
if (c != null) { if (c != null) {
c.dispose(); c.dispose();
@ -366,6 +366,14 @@ public class MediaDataController extends BaseController {
imageReceiver.setImage(ImageLocation.getForDocument(reaction.appear_animation), "60_60_nolimit", null, null, 0, 1); imageReceiver.setImage(ImageLocation.getForDocument(reaction.appear_animation), "60_60_nolimit", null, null, 0, 1);
ImageLoader.getInstance().loadImageForImageReceiver(imageReceiver); ImageLoader.getInstance().loadImageForImageReceiver(imageReceiver);
imageReceiver = new ImageReceiver();
imageReceiver.setImage(ImageLocation.getForDocument(reaction.around_animation), null, null, null, 0, 1);
ImageLoader.getInstance().loadImageForImageReceiver(imageReceiver);
imageReceiver = new ImageReceiver();
imageReceiver.setImage(ImageLocation.getForDocument(reaction.center_icon), null, null, null, 0, 1);
ImageLoader.getInstance().loadImageForImageReceiver(imageReceiver);
imageReceiver = new ImageReceiver(); imageReceiver = new ImageReceiver();
imageReceiver.setImage(ImageLocation.getForDocument(reaction.static_icon), null, null, null, 0, 1); imageReceiver.setImage(ImageLocation.getForDocument(reaction.static_icon), null, null, null, 0, 1);
ImageLoader.getInstance().loadImageForImageReceiver(imageReceiver); ImageLoader.getInstance().loadImageForImageReceiver(imageReceiver);

View File

@ -15224,6 +15224,12 @@ public class MessagesController extends BaseController implements NotificationCe
processUpdates((TLRPC.Updates) response, false); processUpdates((TLRPC.Updates) response, false);
TLRPC.ChatFull full = getChatFull(chatId); TLRPC.ChatFull full = getChatFull(chatId);
if (full != null) { if (full != null) {
if (full instanceof TLRPC.TL_chatFull) {
full.flags |= 262144;
}
if (full instanceof TLRPC.TL_channelFull) {
full.flags |= 1073741824;
}
full.available_reactions = new ArrayList<>(reactions); full.available_reactions = new ArrayList<>(reactions);
getMessagesStorage().updateChatInfo(full, false); getMessagesStorage().updateChatInfo(full, false);
} }

View File

@ -111,7 +111,6 @@ public class SharedConfig {
public static boolean searchMessagesAsListUsed; public static boolean searchMessagesAsListUsed;
public static boolean stickersReorderingHintUsed; public static boolean stickersReorderingHintUsed;
public static boolean disableVoiceAudioEffects; public static boolean disableVoiceAudioEffects;
public static boolean drawSnowInChat;
private static int lastLocalId = -210000; private static int lastLocalId = -210000;
public static String storageCacheDir; public static String storageCacheDir;
@ -141,6 +140,7 @@ public class SharedConfig {
public static boolean saveStreamMedia = true; public static boolean saveStreamMedia = true;
public static boolean smoothKeyboard = true; public static boolean smoothKeyboard = true;
public static boolean pauseMusicOnRecord = true; public static boolean pauseMusicOnRecord = true;
public static boolean chatBlur = false;
public static boolean noiseSupression; public static boolean noiseSupression;
public static boolean noStatusBar; public static boolean noStatusBar;
public static boolean sortContactsByName; public static boolean sortContactsByName;
@ -1212,6 +1212,7 @@ public class SharedConfig {
saveStreamMedia = preferences.getBoolean("saveStreamMedia", true); saveStreamMedia = preferences.getBoolean("saveStreamMedia", true);
smoothKeyboard = preferences.getBoolean("smoothKeyboard2", true); smoothKeyboard = preferences.getBoolean("smoothKeyboard2", true);
pauseMusicOnRecord = preferences.getBoolean("pauseMusicOnRecord", false); pauseMusicOnRecord = preferences.getBoolean("pauseMusicOnRecord", false);
chatBlur = preferences.getBoolean("chatBlur", false);
streamAllVideo = preferences.getBoolean("streamAllVideo", BuildVars.DEBUG_VERSION); streamAllVideo = preferences.getBoolean("streamAllVideo", BuildVars.DEBUG_VERSION);
streamMkv = preferences.getBoolean("streamMkv", false); streamMkv = preferences.getBoolean("streamMkv", false);
suggestStickers = preferences.getInt("suggestStickers", 0); suggestStickers = preferences.getInt("suggestStickers", 0);
@ -1276,7 +1277,6 @@ public class SharedConfig {
mediaColumnsCount = preferences.getInt("mediaColumnsCount", 3); mediaColumnsCount = preferences.getInt("mediaColumnsCount", 3);
fastScrollHintCount = preferences.getInt("fastScrollHintCount", 3); fastScrollHintCount = preferences.getInt("fastScrollHintCount", 3);
dontAskManageStorage = preferences.getBoolean("dontAskManageStorage", false); dontAskManageStorage = preferences.getBoolean("dontAskManageStorage", false);
drawSnowInChat = preferences.getBoolean("drawSnowInChat", BuildVars.DEBUG_VERSION);
preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
showNotificationsForAllAccounts = preferences.getBoolean("AllAccounts", true); showNotificationsForAllAccounts = preferences.getBoolean("AllAccounts", true);
@ -1614,14 +1614,6 @@ public class SharedConfig {
editor.commit(); editor.commit();
} }
public static void toggleDrawSnowInChat() {
drawSnowInChat = !drawSnowInChat;
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("drawSnowInChat", drawSnowInChat);
editor.commit();
}
public static void toggleNoiseSupression() { public static void toggleNoiseSupression() {
noiseSupression = !noiseSupression; noiseSupression = !noiseSupression;
SharedPreferences preferences = MessagesController.getGlobalMainSettings(); SharedPreferences preferences = MessagesController.getGlobalMainSettings();
@ -1847,6 +1839,14 @@ public class SharedConfig {
editor.commit(); editor.commit();
} }
public static void toggleDebugChatBlur() {
chatBlur = !chatBlur;
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("chatBlur", chatBlur);
editor.commit();
}
public static void toggleInappCamera() { public static void toggleInappCamera() {
inappCamera = !inappCamera; inappCamera = !inappCamera;
SharedPreferences preferences = MessagesController.getGlobalMainSettings(); SharedPreferences preferences = MessagesController.getGlobalMainSettings();
@ -2324,4 +2324,11 @@ public class SharedConfig {
dontAskManageStorage = b; dontAskManageStorage = b;
ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE).edit().putBoolean("dontAskManageStorage", dontAskManageStorage).apply(); ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE).edit().putBoolean("dontAskManageStorage", dontAskManageStorage).apply();
} }
public static boolean canBlurChat() {
return BuildVars.DEBUG_VERSION && getDevicePerformanceClass() == PERFORMANCE_CLASS_HIGH;
}
public static boolean chatBlurEnabled() {
return canBlurChat() && chatBlur;
}
} }

View File

@ -69,7 +69,7 @@ public class TLRPC {
public static final int MESSAGE_FLAG_HAS_BOT_ID = 0x00000800; public static final int MESSAGE_FLAG_HAS_BOT_ID = 0x00000800;
public static final int MESSAGE_FLAG_EDITED = 0x00008000; public static final int MESSAGE_FLAG_EDITED = 0x00008000;
public static final int LAYER = 136; public static final int LAYER = 137;
public static class TL_stats_megagroupStats extends TLObject { public static class TL_stats_megagroupStats extends TLObject {
public static int constructor = 0xef7ff916; public static int constructor = 0xef7ff916;
@ -36647,7 +36647,7 @@ public class TLRPC {
} }
public static class TL_availableReaction extends TLObject { public static class TL_availableReaction extends TLObject {
public static int constructor = 0x21d7c4b; public static int constructor = 0xc077ec01;
public int flags; public int flags;
public boolean inactive; public boolean inactive;
@ -36658,6 +36658,8 @@ public class TLRPC {
public Document select_animation; public Document select_animation;
public Document activate_animation; public Document activate_animation;
public Document effect_animation; public Document effect_animation;
public Document around_animation;
public Document center_icon;
public int positionInList; //custom public int positionInList; //custom
public static TL_availableReaction TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { public static TL_availableReaction TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
@ -36683,6 +36685,12 @@ public class TLRPC {
select_animation = Document.TLdeserialize(stream, stream.readInt32(exception), exception); select_animation = Document.TLdeserialize(stream, stream.readInt32(exception), exception);
activate_animation = Document.TLdeserialize(stream, stream.readInt32(exception), exception); activate_animation = Document.TLdeserialize(stream, stream.readInt32(exception), exception);
effect_animation = Document.TLdeserialize(stream, stream.readInt32(exception), exception); effect_animation = Document.TLdeserialize(stream, stream.readInt32(exception), exception);
if ((flags & 2) != 0) {
around_animation = Document.TLdeserialize(stream, stream.readInt32(exception), exception);
}
if ((flags & 2) != 0) {
center_icon = Document.TLdeserialize(stream, stream.readInt32(exception), exception);
}
} }
public void serializeToStream(AbstractSerializedData stream) { public void serializeToStream(AbstractSerializedData stream) {
@ -36696,6 +36704,12 @@ public class TLRPC {
select_animation.serializeToStream(stream); select_animation.serializeToStream(stream);
activate_animation.serializeToStream(stream); activate_animation.serializeToStream(stream);
effect_animation.serializeToStream(stream); effect_animation.serializeToStream(stream);
if ((flags & 2) != 0) {
around_animation.serializeToStream(stream);
}
if ((flags & 2) != 0) {
center_icon.serializeToStream(stream);
}
} }
} }
@ -39889,6 +39903,52 @@ public class TLRPC {
} }
} }
public static abstract class messages_TranslatedText extends TLObject {
public static messages_TranslatedText TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
messages_TranslatedText result = null;
switch (constructor) {
case 0x67ca4737:
result = new TL_messages_translateNoResult();
break;
case 0xa214f7d0:
result = new TL_messages_translateResultText();
break;
}
if (result == null && exception) {
throw new RuntimeException(String.format("can't parse magic %x in messages_TranslatedText", constructor));
}
if (result != null) {
result.readParams(stream, exception);
}
return result;
}
}
public static class TL_messages_translateNoResult extends messages_TranslatedText {
public static int constructor = 0x67ca4737;
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
}
}
public static class TL_messages_translateResultText extends messages_TranslatedText {
public static int constructor = 0xa214f7d0;
public String text;
public void readParams(AbstractSerializedData stream, boolean exception) {
text = stream.readString(exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeString(text);
}
}
public static abstract class MessagesFilter extends TLObject { public static abstract class MessagesFilter extends TLObject {
public int flags; public int flags;
public boolean missed; public boolean missed;
@ -49528,6 +49588,39 @@ public class TLRPC {
} }
} }
public static class TL_messages_translateText extends TLObject {
public static int constructor = 0x24ce6dee;
public int flags;
public InputPeer peer;
public int msg_id;
public String text;
public String from_lang;
public String to_lang;
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
return messages_TranslatedText.TLdeserialize(stream, constructor, exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt32(flags);
if ((flags & 1) != 0) {
peer.serializeToStream(stream);
}
if ((flags & 1) != 0) {
stream.writeInt32(msg_id);
}
if ((flags & 2) != 0) {
stream.writeString(text);
}
if ((flags & 4) != 0) {
stream.writeString(from_lang);
}
stream.writeString(to_lang);
}
}
public static class TL_messages_getMessagesReactions extends TLObject { public static class TL_messages_getMessagesReactions extends TLObject {
public static int constructor = 0x8bba90e6; public static int constructor = 0x8bba90e6;

View File

@ -50,6 +50,7 @@ import org.telegram.ui.Components.CubicBezierInterpolator;
import org.telegram.ui.Components.EllipsizeSpanAnimator; import org.telegram.ui.Components.EllipsizeSpanAnimator;
import org.telegram.ui.Components.FireworksEffect; import org.telegram.ui.Components.FireworksEffect;
import org.telegram.ui.Components.LayoutHelper; import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.Components.SizeNotifierFrameLayout;
import org.telegram.ui.Components.SnowflakesEffect; import org.telegram.ui.Components.SnowflakesEffect;
import java.util.ArrayList; import java.util.ArrayList;
@ -1533,7 +1534,29 @@ public class ActionBar extends FrameLayout {
return color != null ? color : Theme.getColor(key); return color != null ? color : Theme.getColor(key);
} }
//Nekomura SizeNotifierFrameLayout contentView;
boolean blurredBackground;
public void setDrawBlurBackground(SizeNotifierFrameLayout contentView) {
blurredBackground = true;
this.contentView = contentView;
contentView.blurBehindViews.add(this);
setBackground(null);
}
Paint blurScrimPaint = new Paint();
Rect rectTmp = new Rect();
@Override
protected void dispatchDraw(Canvas canvas) {
if (blurredBackground) {
rectTmp.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
blurScrimPaint.setColor(actionBarColor);
contentView.drawBlur(canvas, 0, rectTmp, blurScrimPaint, true);
}
super.dispatchDraw(canvas);
}
// NekoX Changes
private StaticLayout countLayout; private StaticLayout countLayout;

View File

@ -68,6 +68,9 @@ import androidx.core.graphics.ColorUtils;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import androidx.core.graphics.ColorUtils;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.AndroidUtilities;
@ -3461,6 +3464,7 @@ public class Theme {
public static final String key_chat_inTextSelectionHighlight = "chat_inTextSelectionHighlight"; public static final String key_chat_inTextSelectionHighlight = "chat_inTextSelectionHighlight";
public static final String key_chat_recordedVoiceHighlight = "key_chat_recordedVoiceHighlight"; public static final String key_chat_recordedVoiceHighlight = "key_chat_recordedVoiceHighlight";
public static final String key_chat_TextSelectionCursor = "chat_TextSelectionCursor"; public static final String key_chat_TextSelectionCursor = "chat_TextSelectionCursor";
public static final String key_chat_BlurAlpha = "chat_BlurAlpha";
public static final String key_voipgroup_listSelector = "voipgroup_listSelector"; public static final String key_voipgroup_listSelector = "voipgroup_listSelector";
public static final String key_voipgroup_inviteMembersBackground = "voipgroup_inviteMembersBackground"; public static final String key_voipgroup_inviteMembersBackground = "voipgroup_inviteMembersBackground";
@ -4454,6 +4458,7 @@ public class Theme {
defaultColors.put(key_chat_outTextSelectionHighlight, 0x2E3F9923); defaultColors.put(key_chat_outTextSelectionHighlight, 0x2E3F9923);
defaultColors.put(key_chat_inTextSelectionHighlight, 0x5062A9E3); defaultColors.put(key_chat_inTextSelectionHighlight, 0x5062A9E3);
defaultColors.put(key_chat_TextSelectionCursor, 0xFF419FE8); defaultColors.put(key_chat_TextSelectionCursor, 0xFF419FE8);
defaultColors.put(key_chat_BlurAlpha, 0xAF000000);
defaultColors.put(key_statisticChartSignature, 0x7f252529); defaultColors.put(key_statisticChartSignature, 0x7f252529);
defaultColors.put(key_statisticChartSignatureAlpha, 0x7f252529); defaultColors.put(key_statisticChartSignatureAlpha, 0x7f252529);
@ -7754,7 +7759,8 @@ public class Theme {
if (gradientRotation == null) { if (gradientRotation == null) {
gradientRotation = 45; gradientRotation = 45;
} }
final int[] gradientColors = {backColor, gradientToColor2}; int gradientToColorInt = gradientToColor2 == null ? 0 : gradientToColor2;
final int[] gradientColors = {backColor, gradientToColorInt};
wallpaperDrawable = BackgroundGradientDrawable.createDitheredGradientBitmapDrawable(gradientRotation, gradientColors, bitmap.getWidth(), bitmap.getHeight() - 120); wallpaperDrawable = BackgroundGradientDrawable.createDitheredGradientBitmapDrawable(gradientRotation, gradientColors, bitmap.getWidth(), bitmap.getHeight() - 120);
quality = 90; quality = 90;
} }

View File

@ -64,6 +64,7 @@ import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityNodeProvider; import android.view.accessibility.AccessibilityNodeProvider;
import android.view.animation.Interpolator; import android.view.animation.Interpolator;
import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.core.graphics.ColorUtils; import androidx.core.graphics.ColorUtils;
@ -376,6 +377,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
default boolean isLandscape() { default boolean isLandscape() {
return false; return false;
} }
default void invalidateBlur() { }
} }
private final static int DOCUMENT_ATTACH_TYPE_NONE = 0; private final static int DOCUMENT_ATTACH_TYPE_NONE = 0;
@ -422,7 +425,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
public boolean pinnedTop; public boolean pinnedTop;
public boolean pinnedBottom; public boolean pinnedBottom;
private boolean drawPinnedTop; private boolean drawPinnedTop;
private boolean drawPinnedBottom; public boolean drawPinnedBottom;
private MessageObject.GroupedMessages currentMessagesGroup; private MessageObject.GroupedMessages currentMessagesGroup;
private MessageObject.GroupedMessagePosition currentPosition; private MessageObject.GroupedMessagePosition currentPosition;
private boolean groupPhotoInvisible; private boolean groupPhotoInvisible;
@ -947,6 +950,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
private Stack<SpoilerEffect> captionSpoilersPool = new Stack<>(); private Stack<SpoilerEffect> captionSpoilersPool = new Stack<>();
private AtomicReference<Layout> captionPatchedSpoilersLayout = new AtomicReference<>(); private AtomicReference<Layout> captionPatchedSpoilersLayout = new AtomicReference<>();
private Path sPath = new Path(); private Path sPath = new Path();
public boolean isBlurred;
// NekoX // NekoX
private boolean needHideMessage() { private boolean needHideMessage() {
@ -3920,10 +3924,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
backgroundWidth = reactionsLayoutInBubble.width; backgroundWidth = reactionsLayoutInBubble.width;
} }
if ((hasLinkPreview || hasInvoicePreview) && !drawInstantView) {
reactionsLayoutInBubble.totalHeight += AndroidUtilities.dp(6);
reactionsLayoutInBubble.positionOffsetY += AndroidUtilities.dp(3);
}
totalHeight += reactionsLayoutInBubble.totalHeight; totalHeight += reactionsLayoutInBubble.totalHeight;
} }
} }
@ -4871,7 +4871,12 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
if (!reactionsLayoutInBubble.isSmall) { if (!reactionsLayoutInBubble.isSmall) {
reactionsLayoutInBubble.measure(maxWidth - AndroidUtilities.dp(24)); reactionsLayoutInBubble.measure(maxWidth - AndroidUtilities.dp(24));
if (!reactionsLayoutInBubble.isEmpty) { if (!reactionsLayoutInBubble.isEmpty) {
reactionsLayoutInBubble.totalHeight = reactionsLayoutInBubble.height + AndroidUtilities.dp(12); reactionsLayoutInBubble.totalHeight = reactionsLayoutInBubble.height;
if (TextUtils.isEmpty(messageObject.caption)) {
reactionsLayoutInBubble.totalHeight += AndroidUtilities.dp(12);
} else {
reactionsLayoutInBubble.totalHeight += AndroidUtilities.dp(8);
}
measureTime(messageObject); measureTime(messageObject);
if (reactionsLayoutInBubble.width > backgroundWidth) { if (reactionsLayoutInBubble.width > backgroundWidth) {
backgroundWidth = reactionsLayoutInBubble.width; backgroundWidth = reactionsLayoutInBubble.width;
@ -5334,10 +5339,12 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
int lineCount = infoLayout.getLineCount(); int lineCount = infoLayout.getLineCount();
measureTime(messageObject); measureTime(messageObject);
int timeLeft = backgroundWidth - AndroidUtilities.dp(40 + 18 + 56 + 8) - infoWidth; int timeLeft = backgroundWidth - AndroidUtilities.dp(40 + 18 + 56 + 8) - infoWidth;
if (timeLeft < timeWidth && (reactionsLayoutInBubble.isSmall || reactionsLayoutInBubble.isEmpty)) { if (reactionsLayoutInBubble.isSmall || reactionsLayoutInBubble.isEmpty) {
photoHeight += AndroidUtilities.dp(12); if (timeLeft < timeWidth) {
} else if (lineCount == 1) { photoHeight += AndroidUtilities.dp(12);
photoHeight += AndroidUtilities.dp(4); } else if (lineCount == 1) {
photoHeight += AndroidUtilities.dp(4);
}
} }
} }
} }
@ -5345,8 +5352,16 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
if (captionLayout != null && currentPosition != null && currentMessagesGroup != null && currentMessagesGroup.isDocuments) { if (captionLayout != null && currentPosition != null && currentMessagesGroup != null && currentMessagesGroup.isDocuments) {
reactionsLayoutInBubble.positionOffsetY += AndroidUtilities.dp(10); reactionsLayoutInBubble.positionOffsetY += AndroidUtilities.dp(10);
} }
if (!drawPhotoImage && !TextUtils.isEmpty(messageObject.caption) && docTitleLayout != null && docTitleLayout.getLineCount() > 1) {
reactionsLayoutInBubble.positionOffsetY += AndroidUtilities.dp(10);
}
reactionsLayoutInBubble.totalHeight = reactionsLayoutInBubble.height + AndroidUtilities.dp(8); reactionsLayoutInBubble.totalHeight = reactionsLayoutInBubble.height + AndroidUtilities.dp(8);
measureTime(messageObject); measureTime(messageObject);
if (drawPhotoImage && captionLayout == null) {
reactionsLayoutInBubble.totalHeight += AndroidUtilities.dp(8);
}
int timeLeft = backgroundWidth - reactionsLayoutInBubble.lastLineX - AndroidUtilities.dp(24); int timeLeft = backgroundWidth - reactionsLayoutInBubble.lastLineX - AndroidUtilities.dp(24);
if (timeLeft < timeWidth) { if (timeLeft < timeWidth) {
@ -5783,7 +5798,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
} }
if (messageObject.type == MessageObject.TYPE_ROUND_VIDEO) { if (messageObject.type == MessageObject.TYPE_ROUND_VIDEO) {
availableTimeWidth = (int) (AndroidUtilities.roundMessageSize - Math.ceil(Theme.chat_audioTimePaint.measureText("00:00")) + AndroidUtilities.dp(40)); availableTimeWidth = (int) (AndroidUtilities.roundMessageSize - Math.ceil(Theme.chat_audioTimePaint.measureText("00:00")) - AndroidUtilities.dp(46));
} }
measureTime(messageObject); measureTime(messageObject);
int timeWidthTotal = timeWidth + AndroidUtilities.dp((SharedConfig.bubbleRadius >= 10 ? 22 : 18) + (messageObject.isOutOwner() ? 20 : 0)); int timeWidthTotal = timeWidth + AndroidUtilities.dp((SharedConfig.bubbleRadius >= 10 ? 22 : 18) + (messageObject.isOutOwner() ? 20 : 0));
@ -5985,7 +6000,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
} }
if (!reactionsLayoutInBubble.isSmall) { if (!reactionsLayoutInBubble.isSmall) {
boolean useBackgroundWidth = backgroundWidth - AndroidUtilities.dp(24) > widthForCaption; boolean useBackgroundWidth = backgroundWidth - AndroidUtilities.dp(24) > widthForCaption;
int maxWidth = Math.max(backgroundWidth - AndroidUtilities.dp(24), widthForCaption); int maxWidth = Math.max(backgroundWidth - AndroidUtilities.dp(36), widthForCaption);
reactionsLayoutInBubble.measure(maxWidth); reactionsLayoutInBubble.measure(maxWidth);
if (!reactionsLayoutInBubble.isEmpty) { if (!reactionsLayoutInBubble.isEmpty) {
if (shouldDrawTimeOnMedia()) { if (shouldDrawTimeOnMedia()) {
@ -6289,7 +6304,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
captionWidth = width; captionWidth = width;
captionHeight = captionLayout.getHeight(); captionHeight = captionLayout.getHeight();
totalHeight += captionHeight + AndroidUtilities.dp(9); totalHeight += captionHeight + AndroidUtilities.dp(9);
if (currentPosition == null || (currentPosition.flags & MessageObject.POSITION_FLAG_BOTTOM) != 0) { if ((reactionsLayoutInBubble.isEmpty || reactionsLayoutInBubble.isSmall) && (currentPosition == null || (currentPosition.flags & MessageObject.POSITION_FLAG_BOTTOM) != 0)) {
int timeWidthTotal = timeWidth + (messageObject.isOutOwner() ? AndroidUtilities.dp(20) : 0) + getExtraTimeX(); int timeWidthTotal = timeWidth + (messageObject.isOutOwner() ? AndroidUtilities.dp(20) : 0) + getExtraTimeX();
float lastLineWidth = captionLayout.getLineWidth(captionLayout.getLineCount() - 1) + captionLayout.getLineLeft(captionLayout.getLineCount() - 1); float lastLineWidth = captionLayout.getLineWidth(captionLayout.getLineCount() - 1) + captionLayout.getLineLeft(captionLayout.getLineCount() - 1);
if (width - AndroidUtilities.dp(8) - lastLineWidth < timeWidthTotal) { if (width - AndroidUtilities.dp(8) - lastLineWidth < timeWidthTotal) {
@ -6849,6 +6864,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
parent.invalidate(); parent.invalidate();
} }
} }
if (isBlurred && delegate != null) {
delegate.invalidateBlur();
}
} }
@Override @Override
@ -8488,7 +8506,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
if (hasNewLineForTime) { if (hasNewLineForTime) {
reactionsLayoutInBubble.y -= AndroidUtilities.dp(16); reactionsLayoutInBubble.y -= AndroidUtilities.dp(16);
} }
if (captionLayout != null) { if (captionLayout != null && ((currentMessageObject.type != 2 && !(currentMessageObject.type == 9 && drawPhotoImage)) || (currentPosition != null && currentMessagesGroup != null))) {
reactionsLayoutInBubble.y -= AndroidUtilities.dp(14); reactionsLayoutInBubble.y -= AndroidUtilities.dp(14);
} }
if (!botButtons.isEmpty() && currentMessageObject.type == 9) { if (!botButtons.isEmpty() && currentMessageObject.type == 9) {
@ -10112,11 +10130,13 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
} else { } else {
edited = false; edited = false;
hasReplies = currentMessagesGroup.messages.get(0).hasReplies(); hasReplies = currentMessagesGroup.messages.get(0).hasReplies();
for (int a = 0, size = currentMessagesGroup.messages.size(); a < size; a++) { if (!currentMessagesGroup.messages.get(0).messageOwner.edit_hide) {
MessageObject object = currentMessagesGroup.messages.get(a); for (int a = 0, size = currentMessagesGroup.messages.size(); a < size; a++) {
if ((object.messageOwner.flags & TLRPC.MESSAGE_FLAG_EDITED) != 0 || object.isEditing()) { MessageObject object = currentMessagesGroup.messages.get(a);
edited = true; if ((object.messageOwner.flags & TLRPC.MESSAGE_FLAG_EDITED) != 0 || object.isEditing()) {
break; edited = true;
break;
}
} }
} }
} }
@ -11484,6 +11504,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
sideStartY -= getTranslationY(); sideStartY -= getTranslationY();
} }
} }
if (!reactionsLayoutInBubble.isSmall && reactionsLayoutInBubble.drawServiceShaderBackground) {
sideStartY -= reactionsLayoutInBubble.getCurrentTotalHeight(transitionParams.animateChangeProgress);
}
if (!currentMessageObject.isOutOwner() && isRoundVideo && isAvatarVisible) { if (!currentMessageObject.isOutOwner() && isRoundVideo && isAvatarVisible) {
float offsetSize = (AndroidUtilities.roundPlayingMessageSize - AndroidUtilities.roundMessageSize) * 0.7f; float offsetSize = (AndroidUtilities.roundPlayingMessageSize - AndroidUtilities.roundMessageSize) * 0.7f;
float offsetX = isPlayingRound ? offsetSize : 0; float offsetX = isPlayingRound ? offsetSize : 0;
@ -14740,7 +14763,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
} }
accessibilityText = sb; accessibilityText = sb;
} }
info.setText(accessibilityText); info.setText(accessibilityText);
info.setEnabled(true); info.setEnabled(true);
if (Build.VERSION.SDK_INT >= 19) { if (Build.VERSION.SDK_INT >= 19) {

View File

@ -177,7 +177,7 @@ public class ThemePreviewMessagesCell extends LinearLayout {
requestLayout(); requestLayout();
ReactionsEffectOverlay.removeCurrent(false); ReactionsEffectOverlay.removeCurrent(false);
if (added) { if (added) {
ReactionsEffectOverlay.show(fragment, null, cells[1], e.getX(), e.getY(), MediaDataController.getInstance(currentAccount).getDoubleTapReaction(), currentAccount); ReactionsEffectOverlay.show(fragment, null, cells[1], e.getX(), e.getY(), MediaDataController.getInstance(currentAccount).getDoubleTapReaction(), currentAccount, ReactionsEffectOverlay.LONG_ANIMATION);
ReactionsEffectOverlay.startAnimation(); ReactionsEffectOverlay.startAnimation();
} }
getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {

View File

@ -196,6 +196,7 @@ import org.telegram.ui.Components.ChatAttachAlert;
import org.telegram.ui.Components.ChatAttachAlertDocumentLayout; import org.telegram.ui.Components.ChatAttachAlertDocumentLayout;
import org.telegram.ui.Components.ChatAvatarContainer; import org.telegram.ui.Components.ChatAvatarContainer;
import org.telegram.ui.Components.ChatBigEmptyView; import org.telegram.ui.Components.ChatBigEmptyView;
import org.telegram.ui.Components.ChatBlurredFrameLayout;
import org.telegram.ui.Components.ChatGreetingsView; import org.telegram.ui.Components.ChatGreetingsView;
import org.telegram.ui.Components.ChatScrimPopupContainerLayout; import org.telegram.ui.Components.ChatScrimPopupContainerLayout;
import org.telegram.ui.Components.ChatThemeBottomSheet; import org.telegram.ui.Components.ChatThemeBottomSheet;
@ -248,6 +249,7 @@ import org.telegram.ui.Components.SizeNotifierFrameLayout;
import org.telegram.ui.Components.StickersAlert; import org.telegram.ui.Components.StickersAlert;
import org.telegram.ui.Components.TextSelectionHint; import org.telegram.ui.Components.TextSelectionHint;
import org.telegram.ui.Components.TextStyleSpan; import org.telegram.ui.Components.TextStyleSpan;
import org.telegram.ui.Components.ThemeEditorView;
import org.telegram.ui.Components.TrendingStickersAlert; import org.telegram.ui.Components.TrendingStickersAlert;
import org.telegram.ui.Components.TypefaceSpan; import org.telegram.ui.Components.TypefaceSpan;
import org.telegram.ui.Components.URLSpanBotCommand; import org.telegram.ui.Components.URLSpanBotCommand;
@ -374,7 +376,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private ImageView bottomOverlayImage; private ImageView bottomOverlayImage;
private RadialProgressView bottomOverlayProgress; private RadialProgressView bottomOverlayProgress;
private AnimatorSet bottomOverlayAnimation; private AnimatorSet bottomOverlayAnimation;
private FrameLayout bottomOverlayChat; private ChatBlurredFrameLayout bottomOverlayChat;
private FrameLayout bottomMessagesActionContainer; private FrameLayout bottomMessagesActionContainer;
private TextView forwardButton; private TextView forwardButton;
private TextView replyButton; private TextView replyButton;
@ -415,7 +417,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private ExtendedGridLayoutManager mentionGridLayoutManager; private ExtendedGridLayoutManager mentionGridLayoutManager;
private AnimatorSet mentionListAnimation; private AnimatorSet mentionListAnimation;
private ChatAttachAlert chatAttachAlert; private ChatAttachAlert chatAttachAlert;
private FrameLayout topChatPanelView; private ChatBlurredFrameLayout topChatPanelView;
private AnimatorSet reportSpamViewAnimator; private AnimatorSet reportSpamViewAnimator;
private TextView addToContactsButton; private TextView addToContactsButton;
private boolean addToContactsButtonArchive; private boolean addToContactsButtonArchive;
@ -444,7 +446,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private HintView forwardHintView; private HintView forwardHintView;
private ChecksHintView checksHintView; private ChecksHintView checksHintView;
private View emojiButtonRed; private View emojiButtonRed;
private FrameLayout pinnedMessageView; private ChatBlurredFrameLayout pinnedMessageView;
private BluredView blurredView; private BluredView blurredView;
private PinnedLineView pinnedLineView; private PinnedLineView pinnedLineView;
private boolean setPinnedTextTranslationX; private boolean setPinnedTextTranslationX;
@ -729,7 +731,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private boolean scrollToVideo; private boolean scrollToVideo;
private Path aspectPath; private Path aspectPath;
private Paint aspectPaint; private Paint aspectPaint;
private Runnable destroyTextureViewRunnable = this::destroyTextureView; private Runnable destroyTextureViewRunnable = () -> {
destroyTextureView();
};
private static boolean noForwardQuote; private static boolean noForwardQuote;
private TLRPC.ChatParticipant selectedParticipant; private TLRPC.ChatParticipant selectedParticipant;
@ -928,6 +932,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private PinchToZoomHelper pinchToZoomHelper; private PinchToZoomHelper pinchToZoomHelper;
private EmojiAnimationsOverlay emojiAnimationsOverlay; private EmojiAnimationsOverlay emojiAnimationsOverlay;
public float drawingChatLisViewYoffset; public float drawingChatLisViewYoffset;
private boolean drawListBackgroundBlur;
private boolean drawListBackgroundBlurTop;
private int blurredViewTopOffset;
private int blurredViewBottomOffset;
public void deleteHistory(int dateSelectedStart, int dateSelectedEnd, boolean forAll) { public void deleteHistory(int dateSelectedStart, int dateSelectedEnd, boolean forAll) {
chatAdapter.frozenMessages.clear(); chatAdapter.frozenMessages.clear();
@ -1480,10 +1488,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
} }
} }
if (!available) { if (!available || !(view instanceof ChatMessageCell)) {
return false; return false;
} }
return (view instanceof ChatMessageCell) && ((ChatMessageCell)view).getMessageObject().type != 16 && !actionBar.isActionModeShowed() && !isSecretChat() && !isInScheduleMode(); ChatMessageCell cell = (ChatMessageCell) view;
return !cell.getMessageObject().isSending() && !cell.getMessageObject().isEditing() && cell.getMessageObject().type != 16 && !actionBar.isActionModeShowed() && !isSecretChat() && !isInScheduleMode();
} }
@Override @Override
@ -1511,7 +1520,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (!available) { if (!available) {
return; return;
} }
selectReaction(primaryMessage, null, x, y, reaction, true); selectReaction(primaryMessage, null, x, y, reaction, true, false);
} }
}; };
@ -3003,6 +3012,27 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
Paint backgroundPaint; Paint backgroundPaint;
int backgroundColor; int backgroundColor;
@Override
protected void drawList(Canvas blurCanvas, boolean top) {
blurCanvas.save();
blurCanvas.translate(chatListView.getX(), chatListView.getY());
drawListBackgroundBlurTop = top;
drawListBackgroundBlur = true;
chatListView.draw(blurCanvas);
drawListBackgroundBlur = false;
blurCanvas.restore();
}
@Override
protected int getScrollOffset() {
return chatListView.computeVerticalScrollOffset();
}
@Override
protected float getBottomOffset() {
return chatListView.getBottom();
}
AdjustPanLayoutHelper adjustPanLayoutHelper = new AdjustPanLayoutHelper(this) { AdjustPanLayoutHelper adjustPanLayoutHelper = new AdjustPanLayoutHelper(this) {
@Override @Override
@ -3266,7 +3296,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
float canvasOffsetX = chatListView.getLeft() + cell.getLeft(); float canvasOffsetX = chatListView.getLeft() + cell.getLeft();
float canvasOffsetY = chatListView.getY() + cell.getY(); float canvasOffsetY = chatListView.getY() + cell.getY();
float alpha = cell.shouldDrawAlphaLayer() ? cell.getAlpha() : 1f; float alpha = cell.shouldDrawAlphaLayer() ? cell.getAlpha() : 1f;
canvas.clipRect(chatListView.getLeft(), listTop, chatListView.getRight(), chatListView.getY() + chatListView.getMeasuredHeight()); canvas.clipRect(chatListView.getLeft(), listTop, chatListView.getRight(), chatListView.getY() + chatListView.getMeasuredHeight() - blurredViewBottomOffset);
canvas.translate(canvasOffsetX, canvasOffsetY); canvas.translate(canvasOffsetX, canvasOffsetY);
cell.setInvalidatesParent(true); cell.setInvalidatesParent(true);
if (type == 0) { if (type == 0) {
@ -3395,7 +3425,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
canvas.save(); canvas.save();
canvas.clipRect(0, listTop, getMeasuredWidth(), chatListView.getY() + chatListView.getHeight()); canvas.clipRect(0, listTop, getMeasuredWidth(), chatListView.getY() + chatListView.getMeasuredHeight() - blurredViewBottomOffset);
canvas.translate(0, chatListView.getY()); canvas.translate(0, chatListView.getY());
scrimGroup.transitionParams.cell.drawBackground(canvas, (int) l, (int) t, (int) r, (int) b, scrimGroup.transitionParams.pinnedTop, scrimGroup.transitionParams.pinnedBotton, selected, contentView.getKeyboardHeight()); scrimGroup.transitionParams.cell.drawBackground(canvas, (int) l, (int) t, (int) r, (int) b, scrimGroup.transitionParams.pinnedTop, scrimGroup.transitionParams.pinnedBotton, selected, contentView.getKeyboardHeight());
canvas.restore(); canvas.restore();
@ -3409,7 +3439,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
float viewClipLeft = chatListView.getLeft(); float viewClipLeft = chatListView.getLeft();
float viewClipTop = listTop; float viewClipTop = listTop;
float viewClipRight = chatListView.getRight(); float viewClipRight = chatListView.getRight();
float viewClipBottom = chatListView.getY() + chatListView.getMeasuredHeight(); float viewClipBottom = chatListView.getY() + chatListView.getMeasuredHeight() - blurredViewBottomOffset;
if (cell == null || !cell.getTransitionParams().animateBackgroundBoundsInner) { if (cell == null || !cell.getTransitionParams().animateBackgroundBoundsInner) {
viewClipLeft = Math.max(viewClipLeft, chatListView.getLeft() + child.getX()); viewClipLeft = Math.max(viewClipLeft, chatListView.getLeft() + child.getX());
@ -3547,8 +3577,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
int widthSize = MeasureSpec.getSize(widthMeasureSpec); int widthSize = MeasureSpec.getSize(widthMeasureSpec);
int heightSize = allHeight = MeasureSpec.getSize(heightMeasureSpec); int heightSize = allHeight = MeasureSpec.getSize(heightMeasureSpec);
long time = System.currentTimeMillis();
if (lastWidth != widthSize) { if (lastWidth != widthSize) {
globalIgnoreLayout = true; globalIgnoreLayout = true;
lastWidth = widthMeasureSpec; lastWidth = widthMeasureSpec;
@ -3651,7 +3679,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
chatActivityEnterView.runEmojiPanelAnimation(); chatActivityEnterView.runEmojiPanelAnimation();
} }
int childCount = getChildCount(); int childCount = getChildCount();
measureChildWithMargins(chatActivityEnterView, widthMeasureSpec, 0, heightMeasureSpec, 0); measureChildWithMargins(chatActivityEnterView, widthMeasureSpec, 0, heightMeasureSpec, 0);
@ -3664,6 +3691,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
listViewTopHeight = AndroidUtilities.dp(49); listViewTopHeight = AndroidUtilities.dp(49);
} }
blurredViewTopOffset = 0;
blurredViewBottomOffset = 0;
if (SharedConfig.chatBlurEnabled()) {
blurredViewTopOffset = actionBarHeight;
blurredViewBottomOffset = AndroidUtilities.dp(203);
}
for (int i = 0; i < childCount; i++) { for (int i = 0; i < childCount; i++) {
View child = getChildAt(i); View child = getChildAt(i);
@ -3680,7 +3713,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
child.measure(contentWidthSpec, contentHeightSpec); child.measure(contentWidthSpec, contentHeightSpec);
} else if (child == chatListView) { } else if (child == chatListView) {
int contentWidthSpec = MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY); int contentWidthSpec = MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY);
int h = heightSize - listViewTopHeight - (inPreviewMode && Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0); int h = heightSize - listViewTopHeight - (inPreviewMode && Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0) + blurredViewTopOffset + blurredViewBottomOffset;
if (keyboardSize > AndroidUtilities.dp(20) && getLayoutParams().height < 0) { if (keyboardSize > AndroidUtilities.dp(20) && getLayoutParams().height < 0) {
h += keyboardSize; h += keyboardSize;
} }
@ -3765,7 +3798,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
} else if (child == textSelectionHelper.getOverlayView(context)) { } else if (child == textSelectionHelper.getOverlayView(context)) {
int contentWidthSpec = MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY); int contentWidthSpec = MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY);
int h = heightSize; int h = heightSize + blurredViewTopOffset;
if (keyboardSize > AndroidUtilities.dp(20) && getLayoutParams().height < 0) { if (keyboardSize > AndroidUtilities.dp(20) && getLayoutParams().height < 0) {
h += keyboardSize; h += keyboardSize;
textSelectionHelper.setKeyboardSize(keyboardSize); textSelectionHelper.setKeyboardSize(keyboardSize);
@ -3905,6 +3938,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} else if (child == gifHintTextView || child == voiceHintTextView || child == mediaBanTooltip) { } else if (child == gifHintTextView || child == voiceHintTextView || child == mediaBanTooltip) {
childTop -= inputFieldHeight; childTop -= inputFieldHeight;
} else if (child == chatListView || child == floatingDateView || child == infoTopView) { } else if (child == chatListView || child == floatingDateView || child == infoTopView) {
childTop -= blurredViewTopOffset;
if (!inPreviewMode) { if (!inPreviewMode) {
childTop -= (inputFieldHeight - AndroidUtilities.dp(51)); childTop -= (inputFieldHeight - AndroidUtilities.dp(51));
} }
@ -3934,6 +3968,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (keyboardSize > AndroidUtilities.dp(20) && getLayoutParams().height < 0) { if (keyboardSize > AndroidUtilities.dp(20) && getLayoutParams().height < 0) {
childTop -= keyboardSize; childTop -= keyboardSize;
} }
childTop -= blurredViewTopOffset;
} else if (chatActivityEnterView != null && child == chatActivityEnterView.botCommandsMenuContainer) { } else if (chatActivityEnterView != null && child == chatActivityEnterView.botCommandsMenuContainer) {
childTop -= inputFieldHeight; childTop -= inputFieldHeight;
} else if (child == forwardingPreviewView) { } else if (child == forwardingPreviewView) {
@ -3990,6 +4025,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}; };
contentView = (SizeNotifierFrameLayout) fragmentView; contentView = (SizeNotifierFrameLayout) fragmentView;
contentView.needBlur = true;
if (inBubbleMode) { if (inBubbleMode) {
contentView.setOccupyStatusBar(false); contentView.setOccupyStatusBar(false);
} }
@ -4503,7 +4539,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (pullingDownAnimateProgress != 0) { if (pullingDownAnimateProgress != 0) {
transitionOffset = (chatListView.getMeasuredHeight() - pullingDownOffset) * pullingDownAnimateProgress; transitionOffset = (chatListView.getMeasuredHeight() - pullingDownOffset) * pullingDownAnimateProgress;
} }
c.translate(0, getMeasuredHeight() - transitionOffset); c.translate(0, getMeasuredHeight() - blurredViewBottomOffset - transitionOffset);
if (pullingDownDrawable == null) { if (pullingDownDrawable == null) {
pullingDownDrawable = new ChatPullingDownDrawable(currentAccount, fragmentView, dialog_id, dialogFolderId, dialogFilterId, themeDelegate); pullingDownDrawable = new ChatPullingDownDrawable(currentAccount, fragmentView, dialog_id, dialogFolderId, dialogFilterId, themeDelegate);
pullingDownDrawable.onAttach(); pullingDownDrawable.onAttach();
@ -4789,12 +4825,21 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
public boolean drawChild(Canvas canvas, View child, long drawingTime) { public boolean drawChild(Canvas canvas, View child, long drawingTime) {
int clipLeft = 0; int clipLeft = 0;
int clipBottom = 0; int clipBottom = 0;
boolean skipDraw = child == scrimView; boolean skipDraw = !drawListBackgroundBlur && child == scrimView;
ChatMessageCell cell; ChatMessageCell cell;
float cilpTop = chatListViewPaddingTop - chatListViewPaddingVisibleOffset - AndroidUtilities.dp(4); float cilpTop = chatListViewPaddingTop - chatListViewPaddingVisibleOffset - AndroidUtilities.dp(4);
if (child.getY() > getMeasuredHeight() || child.getY() + child.getMeasuredHeight() < cilpTop) { if (drawListBackgroundBlur) {
skipDraw = true; if (drawListBackgroundBlurTop && child.getY() > cilpTop + AndroidUtilities.dp(40)) {
skipDraw = true;
}
if (!drawListBackgroundBlurTop && child.getY() + child.getMeasuredHeight() < AndroidUtilities.dp(203)) {
skipDraw = true;
}
} else {
if (child.getY() > getMeasuredHeight() || child.getY() + child.getMeasuredHeight() < cilpTop) {
skipDraw = true;
}
} }
MessageObject.GroupedMessages group = null; MessageObject.GroupedMessages group = null;
@ -5280,6 +5325,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
return super.createAccessibilityNodeInfo(); return super.createAccessibilityNodeInfo();
} }
@Override
public void invalidate() {
super.invalidate();
contentView.invalidateBlur();
}
}; };
if (currentEncryptedChat != null && Build.VERSION.SDK_INT >= 19) { if (currentEncryptedChat != null && Build.VERSION.SDK_INT >= 19) {
chatListView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS); chatListView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);
@ -5880,7 +5931,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
if (currentEncryptedChat == null) { if (currentEncryptedChat == null) {
pinnedMessageView = new FrameLayout(context) { pinnedMessageView = new ChatBlurredFrameLayout(context, ChatActivity.this) {
float lastY; float lastY;
float startY; float startY;
@ -5950,6 +6001,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
pinnedMessageEnterOffset = -AndroidUtilities.dp(50); pinnedMessageEnterOffset = -AndroidUtilities.dp(50);
pinnedMessageView.setVisibility(View.GONE); pinnedMessageView.setVisibility(View.GONE);
pinnedMessageView.setBackgroundResource(R.drawable.blockpanel); pinnedMessageView.setBackgroundResource(R.drawable.blockpanel);
pinnedMessageView.backgroundColor = getThemedColor(Theme.key_chat_topPanelBackground);
pinnedMessageView.backgroundPaddingBottom = AndroidUtilities.dp(2);
pinnedMessageView.getBackground().mutate().setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_chat_topPanelBackground), PorterDuff.Mode.SRC_IN)); pinnedMessageView.getBackground().mutate().setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_chat_topPanelBackground), PorterDuff.Mode.SRC_IN));
contentView.addView(pinnedMessageView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 50, Gravity.TOP | Gravity.LEFT)); contentView.addView(pinnedMessageView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 50, Gravity.TOP | Gravity.LEFT));
pinnedMessageView.setOnClickListener(v -> { pinnedMessageView.setOnClickListener(v -> {
@ -6152,7 +6205,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}); });
} }
topChatPanelView = new FrameLayout(context) { topChatPanelView = new ChatBlurredFrameLayout(context, this) {
private boolean ignoreLayout; private boolean ignoreLayout;
@ -6198,6 +6251,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
super.requestLayout(); super.requestLayout();
} }
}; };
topChatPanelView.backgroundColor = getThemedColor(Theme.key_chat_topPanelBackground);
topChatPanelView.backgroundPaddingBottom = AndroidUtilities.dp(2);
topChatPanelView.setTag(1); topChatPanelView.setTag(1);
topChatPanelViewOffset = -AndroidUtilities.dp(50); topChatPanelViewOffset = -AndroidUtilities.dp(50);
invalidateChatListViewTopPadding(); invalidateChatListViewTopPadding();
@ -7121,6 +7176,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
undoView.showWithAction(0, Math.abs(value - 1.0f) > 0.001f ? UndoView.ACTION_PLAYBACK_SPEED_ENABLED : UndoView.ACTION_PLAYBACK_SPEED_DISABLED, value, null, null); undoView.showWithAction(0, Math.abs(value - 1.0f) > 0.001f ? UndoView.ACTION_PLAYBACK_SPEED_ENABLED : UndoView.ACTION_PLAYBACK_SPEED_DISABLED, value, null, null);
} }
} }
}; };
contentView.addView(fragmentLocationContextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 38, Gravity.TOP | Gravity.LEFT, 0, -36, 0, 0)); contentView.addView(fragmentLocationContextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 38, Gravity.TOP | Gravity.LEFT, 0, -36, 0, 0));
contentView.addView(fragmentContextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 38, Gravity.TOP | Gravity.LEFT, 0, -36, 0, 0)); contentView.addView(fragmentContextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 38, Gravity.TOP | Gravity.LEFT, 0, -36, 0, 0));
@ -8145,7 +8202,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
bottomOverlayText.setTextColor(getThemedColor(Theme.key_chat_secretChatStatusText)); bottomOverlayText.setTextColor(getThemedColor(Theme.key_chat_secretChatStatusText));
bottomOverlay.addView(bottomOverlayText, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 14, 0, 14, 0)); bottomOverlay.addView(bottomOverlayText, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 14, 0, 14, 0));
bottomOverlayChat = new FrameLayout(context) { bottomOverlayChat = new ChatBlurredFrameLayout(context, this) {
@Override @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int allWidth = MeasureSpec.getSize(widthMeasureSpec); int allWidth = MeasureSpec.getSize(widthMeasureSpec);
@ -8159,9 +8216,16 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
int bottom = Theme.chat_composeShadowDrawable.getIntrinsicHeight(); int bottom = Theme.chat_composeShadowDrawable.getIntrinsicHeight();
Theme.chat_composeShadowDrawable.setBounds(0, 0, getMeasuredWidth(), bottom); Theme.chat_composeShadowDrawable.setBounds(0, 0, getMeasuredWidth(), bottom);
Theme.chat_composeShadowDrawable.draw(canvas); Theme.chat_composeShadowDrawable.draw(canvas);
canvas.drawRect(0, bottom, getMeasuredWidth(), getMeasuredHeight(), getThemedPaint(Theme.key_paint_chatComposeBackground)); if (SharedConfig.chatBlurEnabled()) {
AndroidUtilities.rectTmp2.set(0, bottom, getMeasuredWidth(), getMeasuredHeight());
contentView.drawBlur(canvas, getY(), AndroidUtilities.rectTmp2, getThemedPaint(Theme.key_paint_chatComposeBackground), false);
} else {
canvas.drawRect(0, bottom, getMeasuredWidth(), getMeasuredHeight(), getThemedPaint(Theme.key_paint_chatComposeBackground));
}
} }
}; };
bottomOverlayChat.isTopView = false;
bottomOverlayChat.drawBlur = false;
bottomOverlayChat.setWillNotDraw(false); bottomOverlayChat.setWillNotDraw(false);
bottomOverlayChat.setPadding(0, AndroidUtilities.dp(1.5f), 0, 0); bottomOverlayChat.setPadding(0, AndroidUtilities.dp(1.5f), 0, 0);
bottomOverlayChat.setVisibility(View.INVISIBLE); bottomOverlayChat.setVisibility(View.INVISIBLE);
@ -8519,6 +8583,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
topBottom[0] = chatListView.getTop() + chatListViewPaddingTop - AndroidUtilities.dp(4); topBottom[0] = chatListView.getTop() + chatListViewPaddingTop - AndroidUtilities.dp(4);
}); });
emojiAnimationsOverlay = new EmojiAnimationsOverlay(ChatActivity.this, contentView, chatListView, currentAccount, dialog_id, threadMessageId); emojiAnimationsOverlay = new EmojiAnimationsOverlay(ChatActivity.this, contentView, chatListView, currentAccount, dialog_id, threadMessageId);
actionBar.setDrawBlurBackground(contentView);
return fragmentView; return fragmentView;
} }
@ -9085,6 +9150,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
float oldPadding = chatListViewPaddingTop; float oldPadding = chatListViewPaddingTop;
chatListViewPaddingTopOnlyTopViews = topPanelViewH + pinnedViewH; chatListViewPaddingTopOnlyTopViews = topPanelViewH + pinnedViewH;
chatListViewPaddingTop = AndroidUtilities.dp(4) + contentPaddingTop + topPanelViewH + pinnedViewH + pendingViewH; chatListViewPaddingTop = AndroidUtilities.dp(4) + contentPaddingTop + topPanelViewH + pinnedViewH + pendingViewH;
chatListViewPaddingTop += blurredViewTopOffset;
chatListViewPaddingVisibleOffset = 0; chatListViewPaddingVisibleOffset = 0;
chatListViewPaddingTop += contentPanTranslation + bottomPanelTranslationY; chatListViewPaddingTop += contentPanTranslation + bottomPanelTranslationY;
@ -9135,7 +9201,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
} }
chatListView.setPadding(0, p, 0, AndroidUtilities.dp(3)); chatListView.setPadding(0, p, 0, AndroidUtilities.dp(3) + blurredViewBottomOffset);
if (firstVisPos != RecyclerView.NO_POSITION && scrollToMessageObject != null) { if (firstVisPos != RecyclerView.NO_POSITION && scrollToMessageObject != null) {
chatAdapter.updateRowsSafe(); chatAdapter.updateRowsSafe();
@ -12049,6 +12115,14 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
int top = (int) view.getY(); int top = (int) view.getY();
int bottom = top + view.getMeasuredHeight(); int bottom = top + view.getMeasuredHeight();
ChatMessageCell messageCell = null;
if (view instanceof ChatMessageCell) {
messageCell = (ChatMessageCell) view;
}
if (messageCell != null) {
messageCell.isBlurred = view.getY() < clipTop || view.getY() + view.getMeasuredHeight() > AndroidUtilities.dp(203);
}
if (bottom <= clipTop - chatListViewPaddingVisibleOffset || top > chatListView.getMeasuredHeight()) { if (bottom <= clipTop - chatListViewPaddingVisibleOffset || top > chatListView.getMeasuredHeight()) {
continue; continue;
} }
@ -12063,8 +12137,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
keyboardOffset = chatActivityEnterView.getEmojiPadding(); keyboardOffset = chatActivityEnterView.getEmojiPadding();
} }
if (view instanceof ChatMessageCell) { if (messageCell != null) {
ChatMessageCell messageCell = (ChatMessageCell) view;
messageObject = messageCell.getMessageObject(); messageObject = messageCell.getMessageObject();
if (messageObject.getDialogId() == dialog_id && messageObject.getId() > maxVisibleId) { if (messageObject.getDialogId() == dialog_id && messageObject.getId() > maxVisibleId) {
maxVisibleId = messageObject.getId(); maxVisibleId = messageObject.getId();
@ -21909,13 +21982,14 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
int sPad = 24; int sPad = 24;
reactionsLayout.setPadding(AndroidUtilities.dp(4) + (LocaleController.isRTL ? 0 : sPad), AndroidUtilities.dp(4), AndroidUtilities.dp(4) + (LocaleController.isRTL ? sPad : 0), AndroidUtilities.dp(pad)); reactionsLayout.setPadding(AndroidUtilities.dp(4) + (LocaleController.isRTL ? 0 : sPad), AndroidUtilities.dp(4), AndroidUtilities.dp(4) + (LocaleController.isRTL ? sPad : 0), AndroidUtilities.dp(pad));
reactionsLayout.setDelegate((rView, reaction) -> { reactionsLayout.setDelegate((rView, reaction, longress) -> {
selectReaction(primaryMessage, reactionsLayout, 0, 0, reaction, false); selectReaction(primaryMessage, reactionsLayout, 0, 0, reaction, false, longress);
}); });
LinearLayout.LayoutParams params = LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 52 + pad, Gravity.RIGHT, 0, 0, 0, -20); LinearLayout.LayoutParams params = LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 52 + pad, Gravity.RIGHT, 0, 50, 0, -20);
scrimPopupContainerLayout.addView(reactionsLayout, params); scrimPopupContainerLayout.addView(reactionsLayout, params);
scrimPopupContainerLayout.reactionsLayout = reactionsLayout; scrimPopupContainerLayout.reactionsLayout = reactionsLayout;
scrimPopupContainerLayout.setClipChildren(false);
reactionsLayout.setMessage(message, chatInfo); reactionsLayout.setMessage(message, chatInfo);
reactionsLayout.setTransitionProgress(0); reactionsLayout.setTransitionProgress(0);
@ -22157,12 +22231,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
Runnable updateReactionRunnable; Runnable updateReactionRunnable;
private void selectReaction(MessageObject primaryMessage, ReactionsContainerLayout reactionsLayout, float x, float y, TLRPC.TL_availableReaction reaction, boolean fromDoubleTap) { private void selectReaction(MessageObject primaryMessage, ReactionsContainerLayout reactionsLayout, float x, float y, TLRPC.TL_availableReaction reaction, boolean fromDoubleTap, boolean bigEmoji) {
ReactionsEffectOverlay.removeCurrent(false); ReactionsEffectOverlay.removeCurrent(false);
boolean added = primaryMessage.selectReaction(reaction.reaction, fromDoubleTap); boolean added = primaryMessage.selectReaction(reaction.reaction, fromDoubleTap);
int messageIdForCell = primaryMessage.getId(); int messageIdForCell = primaryMessage.getId();
if (groupedMessagesMap.get(primaryMessage.getGroupId()) != null) { if (groupedMessagesMap.get(primaryMessage.getGroupId()) != null) {
MessageObject messageObject = groupedMessagesMap.get(primaryMessage.getGroupId()).findMessageWithFlags(MessageObject.POSITION_FLAG_BOTTOM | MessageObject.POSITION_FLAG_LEFT); int flags = primaryMessage.shouldDrawReactionsInLayout() ? MessageObject.POSITION_FLAG_BOTTOM | MessageObject.POSITION_FLAG_LEFT : MessageObject.POSITION_FLAG_BOTTOM | MessageObject.POSITION_FLAG_RIGHT;
MessageObject messageObject = groupedMessagesMap.get(primaryMessage.getGroupId()).findMessageWithFlags(flags);
if (messageObject != null) { if (messageObject != null) {
messageIdForCell = messageObject.getId(); messageIdForCell = messageObject.getId();
} }
@ -22172,7 +22247,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (added && !fromDoubleTap) { if (added && !fromDoubleTap) {
ChatMessageCell cell = findMessageCell(finalMessageIdForCell); ChatMessageCell cell = findMessageCell(finalMessageIdForCell);
ReactionsEffectOverlay.show(ChatActivity.this, reactionsLayout, cell, x, y, reaction.reaction, currentAccount); ReactionsEffectOverlay.show(ChatActivity.this, reactionsLayout, cell, x, y, reaction.reaction, currentAccount, reactionsLayout != null ? (bigEmoji ? ReactionsEffectOverlay.LONG_ANIMATION : ReactionsEffectOverlay.ONLY_MOVE_ANIMATION) : ReactionsEffectOverlay.SHORT_ANIMATION);
} }
getSendMessagesHelper().sendReaction(primaryMessage, added ? reaction.reaction : null, ChatActivity.this, updateReactionRunnable = new Runnable() { getSendMessagesHelper().sendReaction(primaryMessage, added ? reaction.reaction : null, ChatActivity.this, updateReactionRunnable = new Runnable() {
@Override @Override
@ -22184,7 +22259,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
AndroidUtilities.runOnUIThread(() -> { AndroidUtilities.runOnUIThread(() -> {
ChatMessageCell cell = findMessageCell(finalMessageIdForCell); ChatMessageCell cell = findMessageCell(finalMessageIdForCell);
if (added) { if (added) {
ReactionsEffectOverlay.show(ChatActivity.this, reactionsLayout, cell, x, y, reaction.reaction, currentAccount); ReactionsEffectOverlay.show(ChatActivity.this, reactionsLayout, cell, x, y, reaction.reaction, currentAccount, ReactionsEffectOverlay.SHORT_ANIMATION);
ReactionsEffectOverlay.startAnimation(); ReactionsEffectOverlay.startAnimation();
} }
}, 50); }, 50);
@ -22207,8 +22282,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
updateReactionRunnable.run(); updateReactionRunnable.run();
} }
AndroidUtilities.runOnUIThread(updateReactionRunnable, 50); AndroidUtilities.runOnUIThread(updateReactionRunnable, 50);
} }
@SuppressLint("NotifyDataSetChanged") @SuppressLint("NotifyDataSetChanged")
@ -23327,7 +23400,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
updateVisibleRows(); updateVisibleRows();
} }
public void onListItemAniamtorTick() { public void onListItemAnimatorTick() {
invalidateMessagesVisiblePart(); invalidateMessagesVisiblePart();
if (scrimView != null) { if (scrimView != null) {
fragmentView.invalidate(); fragmentView.invalidate();
@ -25092,7 +25165,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
} }
} else { } else {
selectReaction(cell.getPrimaryMessageObject(), null, 0, 0, getMediaDataController().getReactionsMap().get(reaction.reaction), false); selectReaction(cell.getPrimaryMessageObject(), null, 0, 0, getMediaDataController().getReactionsMap().get(reaction.reaction), false, false);
} }
} }
@ -25502,6 +25575,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
public boolean isLandscape() { public boolean isLandscape() {
return contentView.getMeasuredWidth() > contentView.getMeasuredHeight(); return contentView.getMeasuredWidth() > contentView.getMeasuredHeight();
} }
@Override
public void invalidateBlur() {
contentView.invalidateBlur();
}
}); });
if (currentEncryptedChat == null) { if (currentEncryptedChat == null) {
chatMessageCell.setAllowAssistant(true); chatMessageCell.setAllowAssistant(true);
@ -26627,6 +26705,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (avatarContainer != null) { if (avatarContainer != null) {
avatarContainer.updateColors(); avatarContainer.updateColors();
} }
if (pinnedMessageView != null) {
pinnedMessageView.backgroundColor = getThemedColor(Theme.key_chat_topPanelBackground);
}
if (topChatPanelView != null) {
topChatPanelView.backgroundColor = getThemedColor(Theme.key_chat_topPanelBackground);
}
}; };
ArrayList<ThemeDescription> themeDescriptions = new ArrayList<>(); ArrayList<ThemeDescription> themeDescriptions = new ArrayList<>();
@ -27202,6 +27286,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
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_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));
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));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_BlurAlpha));
if (chatActivityEnterView != null) { 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)); themeDescriptions.add(new ThemeDescription(chatActivityEnterView.botCommandsMenuContainer.listView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{BotCommandsMenuView.BotCommandView.class}, new String[]{"description"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
@ -27560,7 +27645,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
setupChatTheme(chatTheme, false, true); setupChatTheme(chatTheme, false, true);
} }
} }
if (!setup) { if (!setup && ThemeEditorView.getInstance() == null) {
Theme.refreshThemeColors(true, true); Theme.refreshThemeColors(true, true);
} }
} }

View File

@ -1,5 +1,7 @@
package org.telegram.ui.Components; package org.telegram.ui.Components;
import static java.lang.annotation.RetentionPolicy.SOURCE;
import android.animation.Animator; import android.animation.Animator;
import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator; import android.animation.ObjectAnimator;
@ -51,9 +53,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import static java.lang.annotation.RetentionPolicy.SOURCE; public class Bulletin {
public final class Bulletin {
public static final int DURATION_SHORT = 1500; public static final int DURATION_SHORT = 1500;
public static final int DURATION_LONG = 2750; public static final int DURATION_LONG = 2750;
@ -117,6 +117,12 @@ public final class Bulletin {
private Delegate currentDelegate; private Delegate currentDelegate;
private Layout.Transition layoutTransition; private Layout.Transition layoutTransition;
private Bulletin() {
layout = null;
parentLayout = null;
containerLayout = null;
}
private Bulletin(@NonNull ViewGroup containerLayout, @NonNull Layout layout, int duration) { private Bulletin(@NonNull ViewGroup containerLayout, @NonNull Layout layout, int duration) {
this.layout = layout; this.layout = layout;
this.parentLayout = new ParentLayout(layout) { this.parentLayout = new ParentLayout(layout) {
@ -214,7 +220,7 @@ public final class Bulletin {
} }
private void setCanHide(boolean canHide) { private void setCanHide(boolean canHide) {
if (this.canHide != canHide) { if (this.canHide != canHide && layout != null) {
this.canHide = canHide; this.canHide = canHide;
if (canHide) { if (canHide) {
layout.postDelayed(hideRunnable, duration); layout.postDelayed(hideRunnable, duration);
@ -225,7 +231,7 @@ public final class Bulletin {
} }
private void ensureLayoutTransitionCreated() { private void ensureLayoutTransitionCreated() {
if (layoutTransition == null) { if (layout != null && layoutTransition == null) {
layoutTransition = layout.createTransition(); layoutTransition = layout.createTransition();
} }
} }
@ -239,6 +245,9 @@ public final class Bulletin {
} }
public void hide(boolean animated, long duration) { public void hide(boolean animated, long duration) {
if (layout == null) {
return;
}
if (showing) { if (showing) {
showing = false; showing = false;
@ -1216,4 +1225,16 @@ public final class Bulletin {
} }
} }
//endregion //endregion
public static class EmptyBulletin extends Bulletin {
public EmptyBulletin() {
super();
}
@Override
public Bulletin show() {
return this;
}
}
} }

View File

@ -2,6 +2,7 @@ package org.telegram.ui.Components;
import android.content.Context; import android.content.Context;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.os.Build;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import androidx.annotation.CheckResult; import androidx.annotation.CheckResult;
@ -197,6 +198,9 @@ public final class BulletinFactory {
@CheckResult @CheckResult
public Bulletin createCopyLinkBulletin(boolean isPrivate, Theme.ResourcesProvider resourcesProvider) { public Bulletin createCopyLinkBulletin(boolean isPrivate, Theme.ResourcesProvider resourcesProvider) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
return new Bulletin.EmptyBulletin();
}
if (isPrivate) { if (isPrivate) {
final Bulletin.TwoLineLottieLayout layout = new Bulletin.TwoLineLottieLayout(getContext(), resourcesProvider); final Bulletin.TwoLineLottieLayout layout = new Bulletin.TwoLineLottieLayout(getContext(), resourcesProvider);
layout.setAnimation(R.raw.voip_invite, 36, 36, "Wibe", "Circle"); layout.setAnimation(R.raw.voip_invite, 36, 36, "Wibe", "Circle");

View File

@ -175,7 +175,7 @@ import tw.nekomimi.nekogram.utils.UIUtil;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
public class ChatActivityEnterView extends FrameLayout implements NotificationCenter.NotificationCenterDelegate, SizeNotifierFrameLayout.SizeNotifierFrameLayoutDelegate, StickersAlert.StickersAlertDelegate { public class ChatActivityEnterView extends ChatBlurredFrameLayout implements NotificationCenter.NotificationCenterDelegate, SizeNotifierFrameLayout.SizeNotifierFrameLayoutDelegate, StickersAlert.StickersAlertDelegate {
public interface ChatActivityEnterViewDelegate { public interface ChatActivityEnterViewDelegate {
default void beforeMessageSend(CharSequence message, boolean notify, int scheduleDate) { default void beforeMessageSend(CharSequence message, boolean notify, int scheduleDate) {
@ -1716,8 +1716,10 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")
public ChatActivityEnterView(Activity context, SizeNotifierFrameLayout parent, ChatActivity fragment, final boolean isChat, Theme.ResourcesProvider resourcesProvider) { public ChatActivityEnterView(Activity context, SizeNotifierFrameLayout parent, ChatActivity fragment, final boolean isChat, Theme.ResourcesProvider resourcesProvider) {
super(context); super(context, fragment);
this.resourcesProvider = resourcesProvider; this.resourcesProvider = resourcesProvider;
this.backgroundColor = getThemedColor(Theme.key_chat_messagePanelBackground);
this.drawBlur = false;
smoothKeyboard = isChat && SharedConfig.smoothKeyboard && !AndroidUtilities.isInMultiwindow && (fragment == null || !fragment.isInBubbleMode()); smoothKeyboard = isChat && SharedConfig.smoothKeyboard && !AndroidUtilities.isInMultiwindow && (fragment == null || !fragment.isInBubbleMode());
dotPaint = new Paint(Paint.ANTI_ALIAS_FLAG); dotPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
@ -3048,7 +3050,13 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
senderSelectView.setVisibility(GONE); senderSelectView.setVisibility(GONE);
frameLayout.addView(senderSelectView, LayoutHelper.createFrame(32, 32, Gravity.BOTTOM | Gravity.LEFT, 10, 8, 10, 8)); frameLayout.addView(senderSelectView, LayoutHelper.createFrame(32, 32, Gravity.BOTTOM | Gravity.LEFT, 10, 8, 10, 8));
recordedAudioPanel = new FrameLayout(context); recordedAudioPanel = new FrameLayout(context) {
@Override
public void setVisibility(int visibility) {
super.setVisibility(visibility);
updateSendAsButton();
}
};
recordedAudioPanel.setVisibility(audioToSend == null ? GONE : VISIBLE); recordedAudioPanel.setVisibility(audioToSend == null ? GONE : VISIBLE);
recordedAudioPanel.setFocusable(true); recordedAudioPanel.setFocusable(true);
recordedAudioPanel.setFocusableInTouchMode(true); recordedAudioPanel.setFocusableInTouchMode(true);
@ -3758,7 +3766,12 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
Theme.chat_composeShadowDrawable.setBounds(0, top, getMeasuredWidth(), bottom); Theme.chat_composeShadowDrawable.setBounds(0, top, getMeasuredWidth(), bottom);
Theme.chat_composeShadowDrawable.draw(canvas); Theme.chat_composeShadowDrawable.draw(canvas);
backgroundPaint.setColor(getThemedColor(Theme.key_chat_messagePanelBackground)); backgroundPaint.setColor(getThemedColor(Theme.key_chat_messagePanelBackground));
canvas.drawRect(0, bottom, getWidth(), getHeight(), backgroundPaint); if (SharedConfig.chatBlurEnabled() && chatActivity != null) {
AndroidUtilities.rectTmp2.set(0, bottom, getWidth(), getHeight());
chatActivity.contentView.drawBlur(canvas, getY(), AndroidUtilities.rectTmp2, backgroundPaint, false);
} else {
canvas.drawRect(0, bottom, getWidth(), getHeight(), backgroundPaint);
}
} }
@Override @Override
@ -5385,7 +5398,6 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
recordPannelAnimation.addListener(new AnimatorListenerAdapter() { recordPannelAnimation.addListener(new AnimatorListenerAdapter() {
@Override @Override
public void onAnimationEnd(Animator animation) { public void onAnimationEnd(Animator animation) {
recordedAudioPanel.setVisibility(GONE);
recordedAudioSeekBar.setAlpha(1f); recordedAudioSeekBar.setAlpha(1f);
recordedAudioSeekBar.setTranslationX(0); recordedAudioSeekBar.setTranslationX(0);
recordedAudioPlayButton.setAlpha(1f); recordedAudioPlayButton.setAlpha(1f);
@ -5399,6 +5411,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
messageEditText.setAlpha(1f); messageEditText.setAlpha(1f);
messageEditText.setTranslationX(0); messageEditText.setTranslationX(0);
messageEditText.requestFocus(); messageEditText.requestFocus();
recordedAudioPanel.setVisibility(GONE);
} }
}); });
@ -7606,7 +7619,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
} }
public void updateSendAsButton() { public void updateSendAsButton() {
if (parentFragment == null) { if (parentFragment == null || delegate == null) {
return; return;
} }
if (NekoConfig.hideSendAsChannel.Bool()) if (NekoConfig.hideSendAsChannel.Bool())
@ -7626,7 +7639,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
} }
} }
boolean wasVisible = senderSelectView.getVisibility() == View.VISIBLE; boolean wasVisible = senderSelectView.getVisibility() == View.VISIBLE;
boolean isVisible = delegate.getSendAsPeers() != null && defPeer != null && delegate.getSendAsPeers().peers.size() > 1 && !isEditingMessage() && !isRecordingAudioVideo(); boolean isVisible = delegate.getSendAsPeers() != null && defPeer != null && delegate.getSendAsPeers().peers.size() > 1 && !isEditingMessage() && !isRecordingAudioVideo() && recordedAudioPanel.getVisibility() != View.VISIBLE;
int pad = AndroidUtilities.dp(2); int pad = AndroidUtilities.dp(2);
MarginLayoutParams params = (MarginLayoutParams) senderSelectView.getLayoutParams(); MarginLayoutParams params = (MarginLayoutParams) senderSelectView.getLayoutParams();
float sA = isVisible ? 0 : 1; float sA = isVisible ? 0 : 1;
@ -7643,6 +7656,8 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
if (parentFragment.getOtherSameChatsDiff() == 0 && parentFragment.fragmentOpened) { if (parentFragment.getOtherSameChatsDiff() == 0 && parentFragment.fragmentOpened) {
ValueAnimator anim = ValueAnimator.ofFloat(0, 1).setDuration(150); ValueAnimator anim = ValueAnimator.ofFloat(0, 1).setDuration(150);
senderSelectView.setTranslationX(sX);
messageEditText.setTranslationX(senderSelectView.getTranslationX());
anim.addUpdateListener(animation -> { anim.addUpdateListener(animation -> {
float val = (float) animation.getAnimatedValue(); float val = (float) animation.getAnimatedValue();

View File

@ -57,6 +57,14 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.LinearSmoothScroller; import androidx.recyclerview.widget.LinearSmoothScroller;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.annotation.Keep;
import androidx.core.graphics.ColorUtils;
import androidx.exifinterface.media.ExifInterface;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.LinearSmoothScroller;
import androidx.recyclerview.widget.RecyclerView;
import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader; import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.BuildVars; import org.telegram.messenger.BuildVars;
@ -367,6 +375,11 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
} }
} }
@Override
public void onApplyCaption(CharSequence caption) {
parentAlert.commentTextView.setText(caption);
}
@Override @Override
public boolean cancelButtonPressed() { public boolean cancelButtonPressed() {
return false; return false;
@ -2527,16 +2540,25 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
@Override @Override
void applyCaption(CharSequence text) { void applyCaption(CharSequence text) {
int imageId = (Integer) selectedPhotosOrder.get(0); for (int a = 0; a < selectedPhotosOrder.size(); a++) {
Object entry = selectedPhotos.get(imageId); Object o = selectedPhotos.get(selectedPhotosOrder.get(a));
if (entry instanceof MediaController.PhotoEntry) { if (o instanceof MediaController.PhotoEntry) {
MediaController.PhotoEntry photoEntry = (MediaController.PhotoEntry) entry; MediaController.PhotoEntry photoEntry1 = (MediaController.PhotoEntry) o;
photoEntry.caption = text; if (a == 0) {
photoEntry.entities = MediaDataController.getInstance(UserConfig.selectedAccount).getEntities(new CharSequence[] {text}, false); photoEntry1.caption = text;
} else if (entry instanceof MediaController.SearchImage) { photoEntry1.entities = MediaDataController.getInstance(UserConfig.selectedAccount).getEntities(new CharSequence[] {text}, false);
MediaController.SearchImage searchImage = (MediaController.SearchImage) entry; } else {
searchImage.caption = text; photoEntry1.caption = null;
searchImage.entities = MediaDataController.getInstance(UserConfig.selectedAccount).getEntities(new CharSequence[] {text}, false); }
} else if (o instanceof MediaController.SearchImage) {
MediaController.SearchImage photoEntry1 = (MediaController.SearchImage) o;
if (a == 0) {
photoEntry1.caption = text;
photoEntry1.entities = MediaDataController.getInstance(UserConfig.selectedAccount).getEntities(new CharSequence[] {text}, false);
} else {
photoEntry1.caption = null;
}
}
} }
} }

View File

@ -0,0 +1,73 @@
package org.telegram.ui.Components;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.view.View;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.SharedConfig;
import org.telegram.ui.ChatActivity;
public class ChatBlurredFrameLayout extends FrameLayout {
ChatActivity chatActivity;
Paint backgroundPaint;
public int backgroundColor;
public int backgroundPaddingBottom;
public int backgroundPaddingTop;
public boolean isTopView = true;
public boolean drawBlur = true;
public ChatBlurredFrameLayout(@NonNull Context context, ChatActivity chatActivity) {
super(context);
this.chatActivity = chatActivity;
}
@Override
protected void dispatchDraw(Canvas canvas) {
if (SharedConfig.chatBlurEnabled() && chatActivity != null && drawBlur) {
if (backgroundPaint == null) {
backgroundPaint = new Paint();
}
backgroundPaint.setColor(backgroundColor);
AndroidUtilities.rectTmp2.set(0, backgroundPaddingTop, getMeasuredWidth(), getMeasuredHeight() - backgroundPaddingBottom);
float y = 0;
View view = this;
while (view != chatActivity.contentView) {
y += view.getY();
view = (View) view.getParent();
}
chatActivity.contentView.drawBlur(canvas, y, AndroidUtilities.rectTmp2, backgroundPaint, isTopView);
}
super.dispatchDraw(canvas);
}
@Override
public void setBackgroundColor(int color) {
if (SharedConfig.chatBlurEnabled() && chatActivity != null) {
backgroundColor = color;
} else {
super.setBackgroundColor(color);
}
}
@Override
protected void onAttachedToWindow() {
if (SharedConfig.chatBlurEnabled() && chatActivity != null) {
chatActivity.contentView.blurBehindViews.add(this);
}
super.onAttachedToWindow();
}
@Override
protected void onDetachedFromWindow() {
if (SharedConfig.chatBlurEnabled() && chatActivity != null) {
chatActivity.contentView.blurBehindViews.remove(this);
}
super.onDetachedFromWindow();
}
}

View File

@ -91,6 +91,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
private AudioPlayerAlert.ClippingTextViewSwitcher subtitleTextView; private AudioPlayerAlert.ClippingTextViewSwitcher subtitleTextView;
private AnimatorSet animatorSet; private AnimatorSet animatorSet;
private BaseFragment fragment; private BaseFragment fragment;
private ChatActivity chatActivity;
private View applyingView; private View applyingView;
private FrameLayout frameLayout; private FrameLayout frameLayout;
private View shadow; private View shadow;
@ -217,6 +218,9 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
this.resourcesProvider = resourcesProvider; this.resourcesProvider = resourcesProvider;
fragment = parentFragment; fragment = parentFragment;
if (fragment instanceof ChatActivity) {
chatActivity = (ChatActivity) fragment;
}
applyingView = paddingView; applyingView = paddingView;
visible = true; visible = true;
isLocation = location; isLocation = location;
@ -225,7 +229,8 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
} }
setTag(1); setTag(1);
frameLayout = new FrameLayout(context) { frameLayout = new ChatBlurredFrameLayout(context, chatActivity) {
@Override @Override
public void invalidate() { public void invalidate() {
super.invalidate(); super.invalidate();

View File

@ -39,17 +39,15 @@ public class ReactionTabHolderView extends FrameLayout {
private BackupImageView reactView; private BackupImageView reactView;
private ImageView iconView; private ImageView iconView;
private TextView counterView; private TextView counterView;
View overlaySelectorView;
private float outlineProgress; private float outlineProgress;
Drawable drawable; Drawable drawable;
public ReactionTabHolderView(@NonNull Context context) { public ReactionTabHolderView(@NonNull Context context) {
super(context); super(context);
View overlaySelectorView = new View(context); overlaySelectorView = new View(context);
overlaySelectorView.setBackground(Theme.createSimpleSelectorRoundRectDrawable((int) radius, Color.TRANSPARENT, Theme.getColor(Theme.key_chat_inReactionButtonTextSelected)));
addView(overlaySelectorView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); addView(overlaySelectorView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
iconView = new ImageView(context); iconView = new ImageView(context);
drawable = ContextCompat.getDrawable(context, R.drawable.msg_reactions_filled).mutate(); drawable = ContextCompat.getDrawable(context, R.drawable.msg_reactions_filled).mutate();
iconView.setImageDrawable(drawable); iconView.setImageDrawable(drawable);
@ -82,6 +80,12 @@ public class ReactionTabHolderView extends FrameLayout {
bgPaint.setColor(ColorUtils.blendARGB(backgroundColor, backgroundSelectedColor, outlineProgress)); bgPaint.setColor(ColorUtils.blendARGB(backgroundColor, backgroundSelectedColor, outlineProgress));
counterView.setTextColor(textFinalColor); counterView.setTextColor(textFinalColor);
drawable.setColorFilter(new PorterDuffColorFilter(textFinalColor, PorterDuff.Mode.MULTIPLY)); drawable.setColorFilter(new PorterDuffColorFilter(textFinalColor, PorterDuff.Mode.MULTIPLY));
if (outlineProgress == 1f) {
overlaySelectorView.setBackground(Theme.createSimpleSelectorRoundRectDrawable((int) radius, Color.TRANSPARENT, ColorUtils.setAlphaComponent(Theme.getColor(Theme.key_chat_inReactionButtonTextSelected), (int) (0.3f * 255))));
} else if (outlineProgress == 0) {
overlaySelectorView.setBackground(Theme.createSimpleSelectorRoundRectDrawable((int) radius, Color.TRANSPARENT, ColorUtils.setAlphaComponent(backgroundSelectedColor, (int) (0.3f * 255))));
}
invalidate(); invalidate();
} }

View File

@ -1,8 +1,10 @@
package org.telegram.ui.Components.Reactions; package org.telegram.ui.Components.Reactions;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.PixelFormat; import android.graphics.PixelFormat;
import android.view.HapticFeedbackConstants;
import android.view.View; import android.view.View;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.FrameLayout; import android.widget.FrameLayout;
@ -21,19 +23,28 @@ import org.telegram.ui.Components.ReactionsContainerLayout;
public class ReactionsEffectOverlay { public class ReactionsEffectOverlay {
public final static int LONG_ANIMATION = 0;
public final static int SHORT_ANIMATION = 1;
public final static int ONLY_MOVE_ANIMATION = 2;
private final int animationType;
@SuppressLint("StaticFieldLeak")
public static ReactionsEffectOverlay currentOverlay; public static ReactionsEffectOverlay currentOverlay;
public static ReactionsEffectOverlay currentShortOverlay;
private final AnimationView effectImageView; private final AnimationView effectImageView;
private final AnimationView emojiImageView; private final AnimationView emojiImageView;
private final AnimationView emojiStaticImageView; private final AnimationView emojiStaticImageView;
private final FrameLayout container; private final FrameLayout container;
private final BaseFragment fragment;
private final int currentAccount;
boolean animateIn; boolean animateIn;
float animateInProgress; float animateInProgress;
float animateOutProgress; float animateOutProgress;
FrameLayout windowView; FrameLayout windowView;
BackupImageView backupImageView; BackupImageView backupImageView;
private static int unicPrefix; private static int uniqPrefix;
int[] loc = new int[2]; int[] loc = new int[2];
private WindowManager windowManager; private WindowManager windowManager;
@ -47,12 +58,17 @@ public class ReactionsEffectOverlay {
private boolean started; private boolean started;
private ReactionsContainerLayout.ReactionHolderView holderView = null; private ReactionsContainerLayout.ReactionHolderView holderView = null;
private boolean wasScrolled; private boolean wasScrolled;
private ChatMessageCell cell;
private boolean finished;
private ReactionsEffectOverlay(Context context, BaseFragment fragment, ReactionsContainerLayout reactionsLayout, ChatMessageCell cell, float x, float y, String reaction, int currentAccount, int animationType) {
private ReactionsEffectOverlay(Context context, BaseFragment fragment, ReactionsContainerLayout reactionsLayout, ChatMessageCell cell, float x, float y, String reaction, int currentAccount) { this.fragment = fragment;
this.messageId = cell.getMessageObject().getId(); this.messageId = cell.getMessageObject().getId();
this.groupId = cell.getMessageObject().getGroupId(); this.groupId = cell.getMessageObject().getGroupId();
this.reaction = reaction; this.reaction = reaction;
this.animationType = animationType;
this.currentAccount = currentAccount;
this.cell = cell;
ReactionsLayoutInBubble.ReactionButton reactionButton = cell.getReactionButton(reaction); ReactionsLayoutInBubble.ReactionButton reactionButton = cell.getReactionButton(reaction);
float fromX, fromY, fromHeight, fromWidth; float fromX, fromY, fromHeight, fromWidth;
ChatActivity chatActivity = (fragment instanceof ChatActivity) ? (ChatActivity) fragment : null; ChatActivity chatActivity = (fragment instanceof ChatActivity) ? (ChatActivity) fragment : null;
@ -66,10 +82,10 @@ public class ReactionsEffectOverlay {
} }
boolean fromHolder = holderView != null || (x != 0 && y != 0); boolean fromHolder = holderView != null || (x != 0 && y != 0);
if (holderView != null) { if (holderView != null) {
reactionsLayout.getLocationOnScreen(loc); holderView.getLocationOnScreen(loc);
fromX = loc[0] + holderView.getX() + holderView.backupImageView.getX() + AndroidUtilities.dp(16); fromX = loc[0] + holderView.backupImageView.getX();
fromY = loc[1] + holderView.getY() + holderView.backupImageView.getY() + AndroidUtilities.dp(16); fromY = loc[1] + holderView.backupImageView.getY();
fromHeight = holderView.backupImageView.getWidth(); fromHeight = holderView.backupImageView.getWidth() * holderView.getScaleX();
} else if (reactionButton != null) { } else if (reactionButton != null) {
cell.getLocationInWindow(loc); cell.getLocationInWindow(loc);
fromX = loc[0] + cell.reactionsLayoutInBubble.x + reactionButton.x + reactionButton.imageReceiver.getImageX(); fromX = loc[0] + cell.reactionsLayoutInBubble.x + reactionButton.x + reactionButton.imageReceiver.getImageX();
@ -84,7 +100,14 @@ public class ReactionsEffectOverlay {
fromWidth = 0; fromWidth = 0;
} }
int size = Math.round(Math.min(AndroidUtilities.dp(350), Math.min(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y)) * 0.8f); int size;
if (animationType == ONLY_MOVE_ANIMATION) {
size = AndroidUtilities.dp(34);
} else if (animationType == SHORT_ANIMATION) {
size = AndroidUtilities.dp(80);
} else {
size = Math.round(Math.min(AndroidUtilities.dp(350), Math.min(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y)) * 0.8f);
}
int sizeForFilter = (int) (2f * size / AndroidUtilities.density); int sizeForFilter = (int) (2f * size / AndroidUtilities.density);
int emojiSize = size >> 1; int emojiSize = size >> 1;
int emojiSizeForFilter = sizeForFilter >> 1; int emojiSizeForFilter = sizeForFilter >> 1;
@ -125,6 +148,7 @@ public class ReactionsEffectOverlay {
} else { } else {
if (holderView != null) { if (holderView != null) {
holderView.backupImageView.setAlpha(0); holderView.backupImageView.setAlpha(0);
holderView.pressedBackupImageView.setAlpha(0);
} }
} }
ChatMessageCell drawingCell; ChatMessageCell drawingCell;
@ -133,7 +157,13 @@ public class ReactionsEffectOverlay {
} else { } else {
drawingCell = cell; drawingCell = cell;
} }
float toX, toY; float toX, toY, toH;
if (cell.getMessageObject().shouldDrawReactionsInLayout()) {
toH = AndroidUtilities.dp(20);
} else {
toH = AndroidUtilities.dp(14);
}
if (drawingCell != null) { if (drawingCell != null) {
cell.getLocationInWindow(loc); cell.getLocationInWindow(loc);
@ -147,31 +177,40 @@ public class ReactionsEffectOverlay {
if (chatActivity != null) { if (chatActivity != null) {
toY += chatActivity.drawingChatLisViewYoffset; toY += chatActivity.drawingChatLisViewYoffset;
} }
if (drawingCell.drawPinnedBottom && !drawingCell.shouldDrawTimeOnMedia()) {
toY += AndroidUtilities.dp(2);
}
lastDrawnToX = toX; lastDrawnToX = toX;
lastDrawnToY = toY; lastDrawnToY = toY;
} else { } else {
toX = lastDrawnToX; toX = lastDrawnToX;
toY = lastDrawnToY; toY = lastDrawnToY;
} }
float previewX = toX - emojiSize / 2f;
float previewY = toY - emojiSize / 2f;
if (fragment.getParentActivity() != null && fragment.getFragmentView().getParent() != null && fragment.getFragmentView().getVisibility() == View.VISIBLE && fragment.getFragmentView() != null) { if (fragment.getParentActivity() != null && fragment.getFragmentView().getParent() != null && fragment.getFragmentView().getVisibility() == View.VISIBLE && fragment.getFragmentView() != null) {
fragment.getFragmentView().getLocationOnScreen(loc); fragment.getFragmentView().getLocationOnScreen(loc);
setAlpha(((View) fragment.getFragmentView().getParent()).getAlpha()); setAlpha(((View) fragment.getFragmentView().getParent()).getAlpha());
} else { } else {
return; return;
} }
if (previewX < loc[0]) { float previewX = toX - (emojiSize - toH) / 2f;
previewX = loc[0]; float previewY = toY - (emojiSize - toH) / 2f;
}
if (previewX + emojiSize > loc[0] + getMeasuredWidth()) { if (animationType != SHORT_ANIMATION) {
previewX = loc[0] + getMeasuredWidth() - emojiSize; if (previewX < loc[0]) {
previewX = loc[0];
}
if (previewX + emojiSize > loc[0] + getMeasuredWidth()) {
previewX = loc[0] + getMeasuredWidth() - emojiSize;
}
} }
float animateInProgressX, animateInProgressY; float animateInProgressX, animateInProgressY;
float animateOutProgress = CubicBezierInterpolator.DEFAULT.getInterpolation(ReactionsEffectOverlay.this.animateOutProgress); float animateOutProgress = CubicBezierInterpolator.DEFAULT.getInterpolation(ReactionsEffectOverlay.this.animateOutProgress);
if (fromHolder) { if (animationType == ONLY_MOVE_ANIMATION) {
animateInProgressX = CubicBezierInterpolator.EASE_OUT_QUINT.getInterpolation(animateOutProgress);
animateInProgressY = CubicBezierInterpolator.DEFAULT.getInterpolation(animateOutProgress);
} else if (fromHolder) {
animateInProgressX = CubicBezierInterpolator.EASE_OUT_QUINT.getInterpolation(animateInProgress); animateInProgressX = CubicBezierInterpolator.EASE_OUT_QUINT.getInterpolation(animateInProgress);
animateInProgressY = CubicBezierInterpolator.DEFAULT.getInterpolation(animateInProgress); animateInProgressY = CubicBezierInterpolator.DEFAULT.getInterpolation(animateInProgress);
} else { } else {
@ -180,31 +219,41 @@ public class ReactionsEffectOverlay {
float scale = animateInProgressX + (1f - animateInProgressX) * fromScale; float scale = animateInProgressX + (1f - animateInProgressX) * fromScale;
float toScale; float toScale = toH / (float) emojiSize;
if (cell.getMessageObject().shouldDrawReactionsInLayout()) {
toScale = AndroidUtilities.dp(20) / (float) emojiSize; float x;
float y;
if (animationType == SHORT_ANIMATION) {
x = previewX;
y = previewY;
scale = 1f;
} else { } else {
toScale = AndroidUtilities.dp(14) / (float) emojiSize; x = fromX * (1f - animateInProgressX) + previewX * animateInProgressX;
y = fromY * (1f - animateInProgressY) + previewY * animateInProgressY;
} }
float x = fromX * (1f - animateInProgressX) + previewX * animateInProgressX;
float y = fromY * (1f - animateInProgressY) + previewY * animateInProgressY;
effectImageView.setTranslationX(x); effectImageView.setTranslationX(x);
effectImageView.setTranslationY(y); effectImageView.setTranslationY(y);
effectImageView.setAlpha((1f - animateOutProgress)); effectImageView.setAlpha((1f - animateOutProgress));
effectImageView.setScaleX(scale); effectImageView.setScaleX(scale);
effectImageView.setScaleY(scale); effectImageView.setScaleY(scale);
if (animateOutProgress != 0) { if (animationType == ONLY_MOVE_ANIMATION) {
scale = scale * (1f - animateOutProgress) + toScale * animateOutProgress; scale = fromScale * (1f - animateInProgressX) + toScale * animateInProgressX;
x = x * (1f - animateOutProgress) + toX * animateOutProgress; x = fromX * (1f - animateInProgressX) + toX * animateInProgressX;
y = y * (1f - animateOutProgress) + toY * animateOutProgress; y = fromY * (1f - animateInProgressY) + toY * animateInProgressY;
} else {
if (animateOutProgress != 0) {
scale = scale * (1f - animateOutProgress) + toScale * animateOutProgress;
x = x * (1f - animateOutProgress) + toX * animateOutProgress;
y = y * (1f - animateOutProgress) + toY * animateOutProgress;
}
} }
if (animationType != SHORT_ANIMATION) {
emojiStaticImageView.setAlpha(animateOutProgress > 0.7f ? (animateOutProgress - 0.7f) / 0.3f : 0); emojiStaticImageView.setAlpha(animateOutProgress > 0.7f ? (animateOutProgress - 0.7f) / 0.3f : 0);
}
//emojiImageView.setAlpha(animateOutProgress < 0.5f ? 1f - (animateOutProgress / 0.5f) : 0f); //emojiImageView.setAlpha(animateOutProgress < 0.5f ? 1f - (animateOutProgress / 0.5f) : 0f);
container.setTranslationX(x); container.setTranslationX(x);
container.setTranslationY(y); container.setTranslationY(y);
@ -214,7 +263,7 @@ public class ReactionsEffectOverlay {
super.dispatchDraw(canvas); super.dispatchDraw(canvas);
if (emojiImageView.wasPlaying && animateInProgress != 1f) { if ((animationType == SHORT_ANIMATION || emojiImageView.wasPlaying) && animateInProgress != 1f) {
if (fromHolder) { if (fromHolder) {
animateInProgress += 16f / 350f; animateInProgress += 16f / 350f;
} else { } else {
@ -225,12 +274,28 @@ public class ReactionsEffectOverlay {
} }
} }
if (wasScrolled || (emojiImageView.wasPlaying && emojiImageView.getImageReceiver().getLottieAnimation() != null && !emojiImageView.getImageReceiver().getLottieAnimation().isRunning())) { if (animationType == ONLY_MOVE_ANIMATION || (wasScrolled && animationType == LONG_ANIMATION) || (animationType != SHORT_ANIMATION && emojiImageView.wasPlaying && emojiImageView.getImageReceiver().getLottieAnimation() != null && !emojiImageView.getImageReceiver().getLottieAnimation().isRunning()) ||
(animationType == SHORT_ANIMATION && effectImageView.wasPlaying && effectImageView.getImageReceiver().getLottieAnimation() != null && !effectImageView.getImageReceiver().getLottieAnimation().isRunning())) {
if (ReactionsEffectOverlay.this.animateOutProgress != 1f) { if (ReactionsEffectOverlay.this.animateOutProgress != 1f) {
ReactionsEffectOverlay.this.animateOutProgress += 16f / 220f; if (animationType == SHORT_ANIMATION) {
if (ReactionsEffectOverlay.this.animateOutProgress > 1f) {
ReactionsEffectOverlay.this.animateOutProgress = 1f; ReactionsEffectOverlay.this.animateOutProgress = 1f;
currentOverlay = null; } else {
float duration = animationType == ONLY_MOVE_ANIMATION ? 350f : 220f;
ReactionsEffectOverlay.this.animateOutProgress += 16f / duration;
}
if (ReactionsEffectOverlay.this.animateOutProgress > 0.7f && !finished) {
startShortAnimation();
}
if (ReactionsEffectOverlay.this.animateOutProgress >= 1f) {
if (animationType == LONG_ANIMATION || animationType == ONLY_MOVE_ANIMATION) {
cell.reactionsLayoutInBubble.animateReaction(reaction);
}
ReactionsEffectOverlay.this.animateOutProgress = 1f;
if (animationType == SHORT_ANIMATION) {
currentShortOverlay = null;
} else {
currentOverlay = null;
}
cell.invalidate(); cell.invalidate();
if (cell.getCurrentMessagesGroup() != null && cell.getParent() != null) { if (cell.getCurrentMessagesGroup() != null && cell.getParent() != null) {
((View) cell.getParent()).invalidate(); ((View) cell.getParent()).invalidate();
@ -254,41 +319,59 @@ public class ReactionsEffectOverlay {
emojiStaticImageView = new AnimationView(context); emojiStaticImageView = new AnimationView(context);
TLRPC.TL_availableReaction availableReaction = MediaDataController.getInstance(currentAccount).getReactionsMap().get(reaction); TLRPC.TL_availableReaction availableReaction = MediaDataController.getInstance(currentAccount).getReactionsMap().get(reaction);
if (availableReaction != null) { if (availableReaction != null) {
TLRPC.Document document = availableReaction.effect_animation;
effectImageView.getImageReceiver().setUniqKeyPrefix((unicPrefix++) + "_" + cell.getMessageObject().getId() + "_"); if (animationType != ONLY_MOVE_ANIMATION) {
effectImageView.setImage(ImageLocation.getForDocument(document), sizeForFilter + "_" + sizeForFilter + "_pcache", null, null, 0, null); TLRPC.Document document = animationType == SHORT_ANIMATION ? availableReaction.around_animation : availableReaction.effect_animation;
effectImageView.getImageReceiver().setUniqKeyPrefix((uniqPrefix++) + "_" + cell.getMessageObject().getId() + "_");
effectImageView.setImage(ImageLocation.getForDocument(document), sizeForFilter + "_" + sizeForFilter + "_pcache", null, null, 0, null);
effectImageView.getImageReceiver().setAutoRepeat(0); effectImageView.getImageReceiver().setAutoRepeat(0);
effectImageView.getImageReceiver().setAllowStartAnimation(false); effectImageView.getImageReceiver().setAllowStartAnimation(false);
if (effectImageView.getImageReceiver().getLottieAnimation() != null) { if (effectImageView.getImageReceiver().getLottieAnimation() != null) {
effectImageView.getImageReceiver().getLottieAnimation().setCurrentFrame(0, false); effectImageView.getImageReceiver().getLottieAnimation().setCurrentFrame(0, false);
effectImageView.getImageReceiver().getLottieAnimation().start(); effectImageView.getImageReceiver().getLottieAnimation().start();
}
} }
document = availableReaction.activate_animation; if (animationType == ONLY_MOVE_ANIMATION) {
emojiImageView.getImageReceiver().setUniqKeyPrefix((unicPrefix++) + "_" + cell.getMessageObject().getId() + "_"); TLRPC.Document document = availableReaction.appear_animation;
emojiImageView.setImage(ImageLocation.getForDocument(document), emojiSizeForFilter + "_" + emojiSizeForFilter, null, null, 0, null); emojiImageView.getImageReceiver().setUniqKeyPrefix((uniqPrefix++) + "_" + cell.getMessageObject().getId() + "_");
emojiImageView.setImage(ImageLocation.getForDocument(document), emojiSizeForFilter + "_" + emojiSizeForFilter, null, null, 0, null);
} else if (animationType == LONG_ANIMATION) {
TLRPC.Document document = availableReaction.activate_animation;
emojiImageView.getImageReceiver().setUniqKeyPrefix((uniqPrefix++) + "_" + cell.getMessageObject().getId() + "_");
emojiImageView.setImage(ImageLocation.getForDocument(document), emojiSizeForFilter + "_" + emojiSizeForFilter, null, null, 0, null);
}
emojiImageView.getImageReceiver().setAutoRepeat(0); emojiImageView.getImageReceiver().setAutoRepeat(0);
emojiImageView.getImageReceiver().setAllowStartAnimation(false); emojiImageView.getImageReceiver().setAllowStartAnimation(false);
if (emojiImageView.getImageReceiver().getLottieAnimation() != null) { if (emojiImageView.getImageReceiver().getLottieAnimation() != null) {
emojiImageView.getImageReceiver().getLottieAnimation().setCurrentFrame(0, false); if (animationType == ONLY_MOVE_ANIMATION) {
emojiImageView.getImageReceiver().getLottieAnimation().start(); emojiImageView.getImageReceiver().getLottieAnimation().setCurrentFrame(emojiImageView.getImageReceiver().getLottieAnimation().getFramesCount() - 1, false);
} else {
emojiImageView.getImageReceiver().getLottieAnimation().setCurrentFrame(0, false);
emojiImageView.getImageReceiver().getLottieAnimation().start();
}
} }
int topOffset = (size - emojiSize) >> 1; int topOffset = (size - emojiSize) >> 1;
int leftOffset = size - emojiSize; int leftOffset;
if (animationType == SHORT_ANIMATION) {
leftOffset = topOffset;
} else {
leftOffset = size - emojiSize;
}
container.addView(emojiImageView); container.addView(emojiImageView);
emojiImageView.getLayoutParams().width = emojiSize; emojiImageView.getLayoutParams().width = emojiSize;
emojiImageView.getLayoutParams().height = emojiSize; emojiImageView.getLayoutParams().height = emojiSize;
((FrameLayout.LayoutParams) emojiImageView.getLayoutParams()).topMargin = topOffset; ((FrameLayout.LayoutParams) emojiImageView.getLayoutParams()).topMargin = topOffset;
((FrameLayout.LayoutParams) emojiImageView.getLayoutParams()).leftMargin = leftOffset; ((FrameLayout.LayoutParams) emojiImageView.getLayoutParams()).leftMargin = leftOffset;
emojiStaticImageView.getImageReceiver().setImage(ImageLocation.getForDocument(availableReaction.static_icon), "40_40", null, "webp", availableReaction, 1); if (animationType != SHORT_ANIMATION) {
emojiStaticImageView.getImageReceiver().setImage(ImageLocation.getForDocument(availableReaction.static_icon), "40_40", null, "webp", availableReaction, 1);
}
container.addView(emojiStaticImageView); container.addView(emojiStaticImageView);
emojiStaticImageView.getLayoutParams().width = emojiSize; emojiStaticImageView.getLayoutParams().width = emojiSize;
emojiStaticImageView.getLayoutParams().height = emojiSize; emojiStaticImageView.getLayoutParams().height = emojiSize;
@ -311,12 +394,14 @@ public class ReactionsEffectOverlay {
((FrameLayout.LayoutParams) effectImageView.getLayoutParams()).topMargin = -topOffset; ((FrameLayout.LayoutParams) effectImageView.getLayoutParams()).topMargin = -topOffset;
((FrameLayout.LayoutParams) effectImageView.getLayoutParams()).leftMargin = -leftOffset; ((FrameLayout.LayoutParams) effectImageView.getLayoutParams()).leftMargin = -leftOffset;
// if (!SHORT_ANIMATION) {
container.setPivotX(leftOffset); container.setPivotX(leftOffset);
container.setPivotY(topOffset); container.setPivotY(topOffset);
//}
} }
} }
public static void show(BaseFragment baseFragment, ReactionsContainerLayout reactionsLayout, ChatMessageCell cell, float x, float y, String reaction, int currentAccount) { public static void show(BaseFragment baseFragment, ReactionsContainerLayout reactionsLayout, ChatMessageCell cell, float x, float y, String reaction, int currentAccount, int animationType) {
if (cell == null) { if (cell == null) {
return; return;
} }
@ -324,8 +409,16 @@ public class ReactionsEffectOverlay {
if (!animationEnabled) { if (!animationEnabled) {
return; return;
} }
ReactionsEffectOverlay reactionsEffectOverlay = new ReactionsEffectOverlay(baseFragment.getParentActivity(), baseFragment, reactionsLayout, cell, x, y, reaction, currentAccount); if (animationType == ONLY_MOVE_ANIMATION || animationType == LONG_ANIMATION) {
currentOverlay = reactionsEffectOverlay; show(baseFragment, null, cell, 0, 0, reaction, currentAccount, SHORT_ANIMATION);
}
ReactionsEffectOverlay reactionsEffectOverlay = new ReactionsEffectOverlay(baseFragment.getParentActivity(), baseFragment, reactionsLayout, cell, x, y, reaction, currentAccount, animationType);
if (animationType == SHORT_ANIMATION) {
currentShortOverlay = reactionsEffectOverlay;
} else {
currentOverlay = reactionsEffectOverlay;
}
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.width = lp.height = WindowManager.LayoutParams.MATCH_PARENT; lp.width = lp.height = WindowManager.LayoutParams.MATCH_PARENT;
@ -339,31 +432,50 @@ public class ReactionsEffectOverlay {
if (cell.getCurrentMessagesGroup() != null && cell.getParent() != null) { if (cell.getCurrentMessagesGroup() != null && cell.getParent() != null) {
((View) cell.getParent()).invalidate(); ((View) cell.getParent()).invalidate();
} }
} }
public static void startAnimation() { public static void startAnimation() {
if (currentOverlay != null) { if (currentOverlay != null) {
currentOverlay.started = true; currentOverlay.started = true;
} else {
startShortAnimation();
if (currentShortOverlay != null) {
currentShortOverlay.cell.reactionsLayoutInBubble.animateReaction(currentShortOverlay.reaction);
}
}
}
public static void startShortAnimation() {
if (currentShortOverlay != null && !currentShortOverlay.started) {
currentShortOverlay.started = true;
if (currentShortOverlay.animationType == SHORT_ANIMATION) {
currentShortOverlay.cell.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
}
} }
} }
public static void removeCurrent(boolean instant) { public static void removeCurrent(boolean instant) {
if (currentOverlay != null) { for (int i = 0; i < 2; i++) {
if (instant) { ReactionsEffectOverlay overlay = i == 0 ? currentOverlay : currentShortOverlay;
try { if (overlay != null) {
currentOverlay.windowManager.removeView(currentOverlay.windowView); if (instant) {
} catch (Exception e) { try {
overlay.windowManager.removeView(overlay.windowView);
} catch (Exception e) {
}
} else {
overlay.dismissed = true;
} }
} else {
currentOverlay.dismissed = true;
} }
} }
currentShortOverlay = null;
currentOverlay = null; currentOverlay = null;
} }
public static boolean isPlaying(int messageId, long groupId, String reaction) { public static boolean isPlaying(int messageId, long groupId, String reaction) {
if (currentOverlay != null) { if (currentOverlay != null && (currentOverlay.animationType == ONLY_MOVE_ANIMATION || currentOverlay.animationType == LONG_ANIMATION)) {
return ((currentOverlay.groupId != 0 && groupId == currentOverlay.groupId) || messageId == currentOverlay.messageId) && currentOverlay.reaction.equals(reaction); return ((currentOverlay.groupId != 0 && groupId == currentOverlay.groupId) || messageId == currentOverlay.messageId) && currentOverlay.reaction.equals(reaction);
} }
return false; return false;
@ -384,8 +496,12 @@ public class ReactionsEffectOverlay {
wasPlaying = true; wasPlaying = true;
} }
if (!wasPlaying && getImageReceiver().getLottieAnimation() != null && !getImageReceiver().getLottieAnimation().isRunning()) { if (!wasPlaying && getImageReceiver().getLottieAnimation() != null && !getImageReceiver().getLottieAnimation().isRunning()) {
getImageReceiver().getLottieAnimation().setCurrentFrame(0, false); if (animationType == ONLY_MOVE_ANIMATION) {
getImageReceiver().getLottieAnimation().start(); getImageReceiver().getLottieAnimation().setCurrentFrame(getImageReceiver().getLottieAnimation().getFramesCount() - 1, false);
} else {
getImageReceiver().getLottieAnimation().setCurrentFrame(0, false);
getImageReceiver().getLottieAnimation().start();
}
} }
super.onDraw(canvas); super.onDraw(canvas);
} }

View File

@ -51,6 +51,7 @@ public class ReactionsLayoutInBubble {
private boolean wasDrawn; private boolean wasDrawn;
private boolean animateMove; private boolean animateMove;
private boolean animateWidth; private boolean animateWidth;
private boolean animateHeight;
public int positionOffsetY; public int positionOffsetY;
int currentAccount; int currentAccount;
public int height; public int height;
@ -72,8 +73,12 @@ public class ReactionsLayoutInBubble {
int availableWidth; int availableWidth;
private int lastDrawnWidth; private int lastDrawnWidth;
boolean attached; boolean attached;
private static int animationUniq;
private final static ButtonsComparator comparator = new ButtonsComparator(); private final static ButtonsComparator comparator = new ButtonsComparator();
HashMap<String, ImageReceiver> animatedReactions = new HashMap<>();
private int lastDrawTotalHeight;
private int animateFromTotalHeight;
public ReactionsLayoutInBubble(ChatMessageCell parentView) { public ReactionsLayoutInBubble(ChatMessageCell parentView) {
this.parentView = parentView; this.parentView = parentView;
@ -151,6 +156,7 @@ public class ReactionsLayoutInBubble {
height = 0; height = 0;
width = 0; width = 0;
positionOffsetY = 0; positionOffsetY = 0;
totalHeight = 0;
if (isEmpty) { if (isEmpty) {
return; return;
} }
@ -192,7 +198,6 @@ public class ReactionsLayoutInBubble {
lastLineX = currentX; lastLineX = currentX;
width = maxWidth; width = maxWidth;
height = currentY + (reactionButtons.size() == 0 ? 0 : AndroidUtilities.dp(26)); height = currentY + (reactionButtons.size() == 0 ? 0 : AndroidUtilities.dp(26));
drawServiceShaderBackground = false; drawServiceShaderBackground = false;
} }
@ -255,6 +260,7 @@ public class ReactionsLayoutInBubble {
lastDrawnX = x; lastDrawnX = x;
lastDrawnY = y; lastDrawnY = y;
lastDrawnWidth = width; lastDrawnWidth = width;
lastDrawTotalHeight = totalHeight;
} }
public boolean animateChange() { public boolean animateChange() {
@ -325,6 +331,12 @@ public class ReactionsLayoutInBubble {
changed = true; changed = true;
} }
if (lastDrawTotalHeight != totalHeight) {
animateHeight = true;
animateFromTotalHeight = lastDrawTotalHeight;
changed = true;
}
return changed; return changed;
} }
@ -335,6 +347,7 @@ public class ReactionsLayoutInBubble {
outButtons.clear(); outButtons.clear();
animateMove = false; animateMove = false;
animateWidth = false; animateWidth = false;
animateHeight = false;
for (int i = 0; i < reactionButtons.size(); i++) { for (int i = 0; i < reactionButtons.size(); i++) {
reactionButtons.get(i).animationType = 0; reactionButtons.get(i).animationType = 0;
} }
@ -507,7 +520,28 @@ public class ReactionsLayoutInBubble {
private void drawImage(Canvas canvas) { private void drawImage(Canvas canvas) {
if (drawImage && ((realCount > 1 || !ReactionsEffectOverlay.isPlaying(messageObject.getId(), messageObject.getGroupId(), reaction)) || !isSelected)) { if (drawImage && ((realCount > 1 || !ReactionsEffectOverlay.isPlaying(messageObject.getId(), messageObject.getGroupId(), reaction)) || !isSelected)) {
imageReceiver.draw(canvas); ImageReceiver imageReceiver2 = animatedReactions.get(reaction);
boolean drawStaticImage = true;
if (imageReceiver2 != null) {
imageReceiver2.setAlpha(imageReceiver.getAlpha());
imageReceiver2.setImageCoords(imageReceiver.getImageX() - imageReceiver.getImageWidth() / 2, imageReceiver.getImageY() - imageReceiver.getImageWidth() / 2, imageReceiver.getImageWidth() * 2, imageReceiver.getImageHeight() * 2);
imageReceiver2.draw(canvas);
if (imageReceiver2.getLottieAnimation() != null && imageReceiver2.getLottieAnimation().hasBitmap()) {
drawStaticImage = false;
}
if (imageReceiver2.getLottieAnimation() != null && !imageReceiver2.getLottieAnimation().isRunning()) {
float alpha = imageReceiver2.getAlpha() - 16f / 200;
if (alpha < 0) {
imageReceiver2.onDetachedFromWindow();
animatedReactions.remove(reaction);
} else {
imageReceiver2.setAlpha(alpha);
}
}
}
if (drawStaticImage) {
imageReceiver.draw(canvas);
}
lastImageDrawn = true; lastImageDrawn = true;
} else { } else {
imageReceiver.setAlpha(0); imageReceiver.setAlpha(0);
@ -633,6 +667,13 @@ public class ReactionsLayoutInBubble {
return width; return width;
} }
public float getCurrentTotalHeight(float transitionProgress) {
if (animateHeight) {
return animateFromTotalHeight * (1f - transitionProgress) + totalHeight * transitionProgress;
}
return totalHeight;
}
private static class ButtonsComparator implements Comparator<ReactionButton> { private static class ButtonsComparator implements Comparator<ReactionButton> {
int currentAccount; int currentAccount;
@ -661,5 +702,29 @@ public class ReactionsLayoutInBubble {
for (int i = 0; i < reactionButtons.size(); i++) { for (int i = 0; i < reactionButtons.size(); i++) {
reactionButtons.get(i).detach(); reactionButtons.get(i).detach();
} }
if (!animatedReactions.isEmpty()) {
for (ImageReceiver imageReceiver : animatedReactions.values()) {
imageReceiver.onDetachedFromWindow();
}
}
animatedReactions.clear();
} }
public void animateReaction(String reaction) {
if (animatedReactions.get(reaction) == null) {
ImageReceiver imageReceiver = new ImageReceiver();
imageReceiver.setParentView(parentView);
imageReceiver.setUniqKeyPrefix(Integer.toString(animationUniq++));
if (reaction != null) {
TLRPC.TL_availableReaction r = MediaDataController.getInstance(currentAccount).getReactionsMap().get(reaction);
if (r != null) {
imageReceiver.setImage(ImageLocation.getForDocument(r.center_icon), "40_40_nolimit", null, "tgs", r, 1);
}
}
imageReceiver.setAutoRepeat(0);
imageReceiver.onAttachedToWindow();
animatedReactions.put(reaction, imageReceiver);
}
}
} }

View File

@ -15,12 +15,14 @@ import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter; import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.RectF; import android.graphics.RectF;
import android.graphics.Region;
import android.graphics.Shader; import android.graphics.Shader;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.util.Property; import android.util.Property;
import android.view.Gravity; import android.view.Gravity;
import android.view.HapticFeedbackConstants;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.animation.OvershootInterpolator; import android.view.animation.OvershootInterpolator;
import android.widget.FrameLayout; import android.widget.FrameLayout;
@ -55,7 +57,7 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
public final static Property<ReactionsContainerLayout, Float> TRANSITION_PROGRESS_VALUE = new Property<ReactionsContainerLayout, Float>(Float.class, "transitionProgress") { public final static Property<ReactionsContainerLayout, Float> TRANSITION_PROGRESS_VALUE = new Property<ReactionsContainerLayout, Float>(Float.class, "transitionProgress") {
@Override @Override
public Float get(ReactionsContainerLayout reactionsContainerLayout) { public Float get(ReactionsContainerLayout reactionsContainerLayout) {
return reactionsContainerLayout.transitionProgress ; return reactionsContainerLayout.transitionProgress;
} }
@Override @Override
@ -86,6 +88,7 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
private MessageObject messageObject; private MessageObject messageObject;
private int currentAccount; private int currentAccount;
private long waitingLoadingChatId; private long waitingLoadingChatId;
ValueAnimator cancelPressedAnimation;
private List<TLRPC.TL_availableReaction> reactionsList = Collections.emptyList(); private List<TLRPC.TL_availableReaction> reactionsList = Collections.emptyList();
@ -102,6 +105,13 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
private List<String> triggeredReactions = new ArrayList<>(); private List<String> triggeredReactions = new ArrayList<>();
Theme.ResourcesProvider resourcesProvider; Theme.ResourcesProvider resourcesProvider;
private String pressedReaction;
private int pressedReactionPosition;
private float pressedProgress;
private float cancelPressedProgress;
private float pressedViewScale;
private float otherViewsScale;
private boolean clicked;
public ReactionsContainerLayout(@NonNull Context context, int currentAccount, Theme.ResourcesProvider resourcesProvider) { public ReactionsContainerLayout(@NonNull Context context, int currentAccount, Theme.ResourcesProvider resourcesProvider) {
super(context); super(context);
@ -114,7 +124,15 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
shadowPad.left = shadowPad.top = shadowPad.right = shadowPad.bottom = AndroidUtilities.dp(7); shadowPad.left = shadowPad.top = shadowPad.right = shadowPad.bottom = AndroidUtilities.dp(7);
shadow.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_messagePanelShadow), PorterDuff.Mode.MULTIPLY)); shadow.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_messagePanelShadow), PorterDuff.Mode.MULTIPLY));
recyclerListView = new RecyclerListView(context); recyclerListView = new RecyclerListView(context) {
@Override
public boolean drawChild(Canvas canvas, View child, long drawingTime) {
if (pressedReaction != null && ((ReactionHolderView) child).currentReaction.equals(pressedReaction)) {
return true;
}
return super.drawChild(canvas, child, drawingTime);
}
};
linearLayoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false); linearLayoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
recyclerListView.addItemDecoration(new RecyclerView.ItemDecoration() { recyclerListView.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override @Override
@ -155,11 +173,6 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
return reactionsList.size(); return reactionsList.size();
} }
}); });
recyclerListView.setOnItemClickListener((view, position) -> {
ReactionHolderView h = (ReactionHolderView) view;
if (delegate != null)
delegate.onReactionClicked(h, h.currentReaction);
});
recyclerListView.addOnScrollListener(new LeftRightShadowsListener()); recyclerListView.addOnScrollListener(new LeftRightShadowsListener());
recyclerListView.addOnScrollListener(new RecyclerView.OnScrollListener() { recyclerListView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override @Override
@ -177,8 +190,7 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
int dX1 = ch1X - rX; int dX1 = ch1X - rX;
float s1 = SIDE_SCALE + (1f - Math.min(1, -Math.min(dX1, 0f) / ch1.getWidth())) * sideDiff; float s1 = SIDE_SCALE + (1f - Math.min(1, -Math.min(dX1, 0f) / ch1.getWidth())) * sideDiff;
if (Float.isNaN(s1)) s1 = 1f; if (Float.isNaN(s1)) s1 = 1f;
ch1.setScaleX(s1); ((ReactionHolderView) ch1).sideScale = s1;
ch1.setScaleY(s1);
View ch2 = recyclerView.getChildAt(recyclerView.getChildCount() - 1); View ch2 = recyclerView.getChildAt(recyclerView.getChildCount() - 1);
ch2.getLocationInWindow(location); ch2.getLocationInWindow(location);
@ -187,14 +199,11 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
int dX2 = rX + recyclerView.getWidth() - (ch2X + ch2.getWidth()); int dX2 = rX + recyclerView.getWidth() - (ch2X + ch2.getWidth());
float s2 = SIDE_SCALE + (1f - Math.min(1, -Math.min(dX2, 0f) / ch2.getWidth())) * sideDiff; float s2 = SIDE_SCALE + (1f - Math.min(1, -Math.min(dX2, 0f) / ch2.getWidth())) * sideDiff;
if (Float.isNaN(s2)) s2 = 1f; if (Float.isNaN(s2)) s2 = 1f;
ch2.setScaleX(s2); ((ReactionHolderView) ch2).sideScale = s2;
ch2.setScaleY(s2);
} }
for (int i = 1; i < recyclerListView.getChildCount() - 1; i++) { for (int i = 1; i < recyclerListView.getChildCount() - 1; i++) {
View ch = recyclerListView.getChildAt(i); View ch = recyclerListView.getChildAt(i);
float sc = 1f; ((ReactionHolderView) ch).sideScale = 1f;
ch.setScaleX(sc);
ch.setScaleY(sc);
} }
invalidate(); invalidate();
} }
@ -238,46 +247,24 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
lastVisibleViewsTmp.clear(); lastVisibleViewsTmp.clear();
lastVisibleViewsTmp.addAll(lastVisibleViews); lastVisibleViewsTmp.addAll(lastVisibleViews);
lastVisibleViews.clear(); lastVisibleViews.clear();
if (transitionProgress != 0) {
int delay = 0; if (pressedReaction != null) {
for (int i = 0; i < recyclerListView.getChildCount(); i++) { if (pressedProgress != 1f) {
ReactionHolderView view = (ReactionHolderView) recyclerListView.getChildAt(i); pressedProgress += 16f / 2000f;
if (view.backupImageView.getImageReceiver().getLottieAnimation() == null) { if (pressedProgress >= 1f) {
continue; pressedProgress = 1f;
}
if (view.getX() + view.getMeasuredWidth() / 2f > 0 && view.getX() + view.getMeasuredWidth() / 2f < recyclerListView.getWidth()) {
if (!lastVisibleViewsTmp.contains(view)) {
view.play(delay);
delay += 30;
}
lastVisibleViews.add(view);
} else if (!view.isEnter) {
view.resetAnimation();
} }
invalidate();
} }
} }
float cPr = (Math.max(CLIP_PROGRESS, Math.min(transitionProgress, 1f)) - CLIP_PROGRESS) / (1f - CLIP_PROGRESS); float cPr = (Math.max(CLIP_PROGRESS, Math.min(transitionProgress, 1f)) - CLIP_PROGRESS) / (1f - CLIP_PROGRESS);
float br = bigCircleRadius * cPr, sr = smallCircleRadius * cPr; float br = bigCircleRadius * cPr, sr = smallCircleRadius * cPr;
float cx = LocaleController.isRTL ? bigCircleOffset : getWidth() - bigCircleOffset, cy = getHeight() - getPaddingBottom(); pressedViewScale = 1 + 2 * pressedProgress;
int sPad = AndroidUtilities.dp(3); otherViewsScale = 1 - 0.15f * pressedProgress;
shadow.setBounds((int) (cx - br - sPad * cPr), (int) (cy - br - sPad * cPr), (int) (cx + br + sPad * cPr), (int) (cy + br + sPad * cPr));
shadow.draw(canvas);
canvas.drawCircle(cx, cy, br, bgPaint);
cx = LocaleController.isRTL ? bigCircleOffset - bigCircleRadius : getWidth() - bigCircleOffset + bigCircleRadius;
cy = getHeight() - smallCircleRadius - sPad;
sPad = -AndroidUtilities.dp(1);
shadow.setBounds((int) (cx - br - sPad * cPr), (int) (cy - br - sPad * cPr), (int) (cx + br + sPad * cPr), (int) (cy + br + sPad * cPr));
shadow.draw(canvas);
canvas.drawCircle(cx, cy, sr, bgPaint);
int s = canvas.save(); int s = canvas.save();
mPath.rewind();
mPath.addCircle(LocaleController.isRTL ? bigCircleOffset : getWidth() - bigCircleOffset, getHeight() - getPaddingBottom(), br, Path.Direction.CW);
canvas.clipPath(mPath, Region.Op.DIFFERENCE);
float pivotX = LocaleController.isRTL ? getWidth() * 0.125f : getWidth() * 0.875f; float pivotX = LocaleController.isRTL ? getWidth() * 0.125f : getWidth() * 0.875f;
if (transitionProgress <= SCALE_PROGRESS) { if (transitionProgress <= SCALE_PROGRESS) {
@ -291,7 +278,8 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
} else { } else {
lt = (1f - Math.max(CLIP_PROGRESS, transitionProgress)); lt = (1f - Math.max(CLIP_PROGRESS, transitionProgress));
} }
rect.set(getPaddingLeft() + (getWidth() - getPaddingRight()) * lt, getPaddingTop(), (getWidth() - getPaddingRight()) * rt, getHeight() - getPaddingBottom()); rect.set(getPaddingLeft() + (getWidth() - getPaddingRight()) * lt, getPaddingTop() + recyclerListView.getMeasuredHeight() * (1f - otherViewsScale), (getWidth() - getPaddingRight()) * rt, getHeight() - getPaddingBottom());
radius = rect.height() / 2f;
shadow.setBounds((int) (getPaddingLeft() + (getWidth() - getPaddingRight() + shadowPad.right) * lt - shadowPad.left), getPaddingTop() - shadowPad.top, (int) ((getWidth() - getPaddingRight() + shadowPad.right) * rt), getHeight() - getPaddingBottom() + shadowPad.bottom); shadow.setBounds((int) (getPaddingLeft() + (getWidth() - getPaddingRight() + shadowPad.right) * lt - shadowPad.left), getPaddingTop() - shadowPad.top, (int) ((getWidth() - getPaddingRight() + shadowPad.right) * rt), getHeight() - getPaddingBottom() + shadowPad.bottom);
shadow.draw(canvas); shadow.draw(canvas);
canvas.restoreToCount(s); canvas.restoreToCount(s);
@ -312,18 +300,31 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
float sc = transitionProgress / SCALE_PROGRESS; float sc = transitionProgress / SCALE_PROGRESS;
canvas.scale(sc, sc, pivotX, getHeight() / 2f); canvas.scale(sc, sc, pivotX, getHeight() / 2f);
} }
if (transitionProgress != 0) {
int delay = 0;
for (int i = 0; i < recyclerListView.getChildCount(); i++) {
ReactionHolderView view = (ReactionHolderView) recyclerListView.getChildAt(i);
checkPressedProgress(canvas, view);
if (view.backupImageView.getImageReceiver().getLottieAnimation() == null) {
continue;
}
if (view.getX() + view.getMeasuredWidth() / 2f > 0 && view.getX() + view.getMeasuredWidth() / 2f < recyclerListView.getWidth()) {
if (!lastVisibleViewsTmp.contains(view)) {
view.play(delay);
delay += 30;
}
lastVisibleViews.add(view);
} else if (!view.isEnter) {
view.resetAnimation();
}
}
}
canvas.clipPath(mPath); canvas.clipPath(mPath);
canvas.translate((LocaleController.isRTL ? -1 : 1) * getWidth() * (1f - transitionProgress), 0); canvas.translate((LocaleController.isRTL ? -1 : 1) * getWidth() * (1f - transitionProgress), 0);
super.dispatchDraw(canvas); super.dispatchDraw(canvas);
canvas.restoreToCount(s);
s = canvas.save();
if (LocaleController.isRTL) rt = Math.max(CLIP_PROGRESS, Math.min(1, transitionProgress));
else lt = 1f - Math.max(CLIP_PROGRESS, Math.min(1f, transitionProgress));
rect.set(getPaddingLeft() + (getWidth() - getPaddingRight()) * lt, getPaddingTop(), (getWidth() - getPaddingRight()) * rt, getHeight() - getPaddingBottom());
mPath.rewind();
mPath.addRoundRect(rect, radius, radius, Path.Direction.CW);
canvas.clipPath(mPath);
if (leftShadowPaint != null) { if (leftShadowPaint != null) {
leftShadowPaint.setAlpha((int) (leftAlpha * transitionProgress * 0xFF)); leftShadowPaint.setAlpha((int) (leftAlpha * transitionProgress * 0xFF));
canvas.drawRect(rect, leftShadowPaint); canvas.drawRect(rect, leftShadowPaint);
@ -334,6 +335,73 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
} }
canvas.restoreToCount(s); canvas.restoreToCount(s);
canvas.save();
canvas.clipRect(0, rect.bottom, getMeasuredWidth(), getMeasuredHeight());
float cx = LocaleController.isRTL ? bigCircleOffset : getWidth() - bigCircleOffset, cy = getHeight() - getPaddingBottom();
int sPad = AndroidUtilities.dp(3);
shadow.setBounds((int) (cx - br - sPad * cPr), (int) (cy - br - sPad * cPr), (int) (cx + br + sPad * cPr), (int) (cy + br + sPad * cPr));
shadow.draw(canvas);
canvas.drawCircle(cx, cy, br, bgPaint);
cx = LocaleController.isRTL ? bigCircleOffset - bigCircleRadius : getWidth() - bigCircleOffset + bigCircleRadius;
cy = getHeight() - smallCircleRadius - sPad;
sPad = -AndroidUtilities.dp(1);
shadow.setBounds((int) (cx - br - sPad * cPr), (int) (cy - br - sPad * cPr), (int) (cx + br + sPad * cPr), (int) (cy + br + sPad * cPr));
shadow.draw(canvas);
canvas.drawCircle(cx, cy, sr, bgPaint);
canvas.restore();
}
private void checkPressedProgress(Canvas canvas, ReactionHolderView view) {
if (view.currentReaction.reaction.equals(pressedReaction)) {
view.setPivotX(view.getMeasuredWidth() >> 1);
view.setPivotY(view.backupImageView.getY() + view.backupImageView.getMeasuredHeight());
view.setScaleX(pressedViewScale);
view.setScaleY(pressedViewScale);
if (!clicked) {
if (cancelPressedAnimation == null) {
view.pressedBackupImageView.setVisibility(View.VISIBLE);
view.pressedBackupImageView.setAlpha(1f);
if (view.pressedBackupImageView.getImageReceiver().hasBitmapImage()) {
view.backupImageView.setAlpha(0f);
}
} else {
view.pressedBackupImageView.setAlpha(1f - cancelPressedProgress);
view.backupImageView.setAlpha(cancelPressedProgress);
}
if (pressedProgress == 1f) {
clicked = true;
delegate.onReactionClicked(view, view.currentReaction, true);
}
}
canvas.save();
canvas.translate(recyclerListView.getX() + view.getX(), recyclerListView.getY() + view.getY());
canvas.scale(view.getScaleX(), view.getScaleY(), view.getPivotX(), view.getPivotY());
view.draw(canvas);
canvas.restore();
} else {
int position = recyclerListView.getChildAdapterPosition(view);
float translationX;
translationX = (view.getMeasuredWidth() * (pressedViewScale - 1f)) / 3f - view.getMeasuredWidth() * (1f - otherViewsScale) * (Math.abs(pressedReactionPosition - position) - 1);
if (position < pressedReactionPosition) {
view.setPivotX(0);
view.setTranslationX(-translationX);
} else {
view.setPivotX(view.getMeasuredWidth());
view.setTranslationX(translationX);
}
view.setPivotY(view.backupImageView.getY() + view.backupImageView.getMeasuredHeight());
view.setScaleX(otherViewsScale);
view.setScaleY(otherViewsScale);
view.backupImageView.setScaleX(view.sideScale);
view.backupImageView.setScaleY(view.sideScale);
view.pressedBackupImageView.setVisibility(View.INVISIBLE);
view.backupImageView.setAlpha(1f);
}
} }
@Override @Override
@ -451,7 +519,9 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
public final class ReactionHolderView extends FrameLayout { public final class ReactionHolderView extends FrameLayout {
public BackupImageView backupImageView; public BackupImageView backupImageView;
public BackupImageView pressedBackupImageView;
public TLRPC.TL_availableReaction currentReaction; public TLRPC.TL_availableReaction currentReaction;
public float sideScale;
private boolean isEnter; private boolean isEnter;
Runnable playRunnable = new Runnable() { Runnable playRunnable = new Runnable() {
@ -460,6 +530,7 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
if (backupImageView.getImageReceiver().getLottieAnimation() != null && !backupImageView.getImageReceiver().getLottieAnimation().isRunning() && !backupImageView.getImageReceiver().getLottieAnimation().isGeneratingCache()) { if (backupImageView.getImageReceiver().getLottieAnimation() != null && !backupImageView.getImageReceiver().getLottieAnimation().isRunning() && !backupImageView.getImageReceiver().getLottieAnimation().isGeneratingCache()) {
backupImageView.getImageReceiver().getLottieAnimation().start(); backupImageView.getImageReceiver().getLottieAnimation().start();
} }
} }
}; };
@ -475,7 +546,16 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
}; };
backupImageView.getImageReceiver().setAutoRepeat(0); backupImageView.getImageReceiver().setAutoRepeat(0);
backupImageView.getImageReceiver().setAllowStartLottieAnimation(false); backupImageView.getImageReceiver().setAllowStartLottieAnimation(false);
pressedBackupImageView = new BackupImageView(context) {
@Override
public void invalidate() {
super.invalidate();
ReactionsContainerLayout.this.invalidate();
}
};
addView(backupImageView, LayoutHelper.createFrame(34, 34, Gravity.CENTER)); addView(backupImageView, LayoutHelper.createFrame(34, 34, Gravity.CENTER));
addView(pressedBackupImageView, LayoutHelper.createFrame(34, 34, Gravity.CENTER));
} }
private void setReaction(TLRPC.TL_availableReaction react) { private void setReaction(TLRPC.TL_availableReaction react) {
@ -486,6 +566,7 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
currentReaction = react; currentReaction = react;
SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(currentReaction.activate_animation, Theme.key_windowBackgroundGray, 1.0f); SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(currentReaction.activate_animation, Theme.key_windowBackgroundGray, 1.0f);
backupImageView.getImageReceiver().setImage(ImageLocation.getForDocument(currentReaction.appear_animation), "60_60_nolimit", null, null, svgThumb, 0, "tgs", react, 0); backupImageView.getImageReceiver().setImage(ImageLocation.getForDocument(currentReaction.appear_animation), "60_60_nolimit", null, null, svgThumb, 0, "tgs", react, 0);
pressedBackupImageView.getImageReceiver().setImage(ImageLocation.getForDocument(currentReaction.select_animation), "60_60_nolimit", null, null, svgThumb, 0, "tgs", react, 0);
} }
@Override @Override
@ -532,10 +613,80 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
} }
isEnter = false; isEnter = false;
} }
Runnable longPressRunnable = new Runnable() {
@Override
public void run() {
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
pressedReactionPosition = reactionsList.indexOf(currentReaction);
pressedReaction = currentReaction.reaction;
ReactionsContainerLayout.this.invalidate();
}
};
float pressedX, pressedY;
boolean pressed;
@Override
public boolean onTouchEvent(MotionEvent event) {
if (cancelPressedAnimation != null) {
return false;
}
if (event.getAction() == MotionEvent.ACTION_DOWN) {
pressed = true;
pressedX = event.getX();
pressedY = event.getY();
if (sideScale == 1f) {
AndroidUtilities.runOnUIThread(longPressRunnable, ViewConfiguration.getLongPressTimeout());
}
}
float touchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop() * 2f;
boolean cancelByMove = event.getAction() == MotionEvent.ACTION_MOVE && (Math.abs(pressedX - event.getX()) > touchSlop || Math.abs(pressedY - event.getY()) > touchSlop);
if (cancelByMove || event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL) {
if (event.getAction() == MotionEvent.ACTION_UP && pressed && (pressedReaction == null || pressedProgress > 0.8f) && delegate != null) {
clicked = true;
delegate.onReactionClicked(this, currentReaction, pressedProgress > 0.8f);
}
if (!clicked) {
cancelPressed();
}
AndroidUtilities.cancelRunOnUIThread(longPressRunnable);
pressed = false;
}
return true;
}
}
private void cancelPressed() {
if (pressedReaction != null) {
cancelPressedProgress = 0f;
float fromProgress = pressedProgress;
cancelPressedAnimation = ValueAnimator.ofFloat(0, 1f);
cancelPressedAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
cancelPressedProgress = (float) valueAnimator.getAnimatedValue();
pressedProgress = fromProgress * (1f - cancelPressedProgress);
ReactionsContainerLayout.this.invalidate();
}
});
cancelPressedAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
cancelPressedAnimation = null;
pressedProgress = 0;
pressedReaction = null;
ReactionsContainerLayout.this.invalidate();
}
});
cancelPressedAnimation.setDuration(150);
cancelPressedAnimation.setInterpolator(CubicBezierInterpolator.DEFAULT);
cancelPressedAnimation.start();
}
} }
public interface ReactionsContainerDelegate { public interface ReactionsContainerDelegate {
void onReactionClicked(View v, TLRPC.TL_availableReaction reaction); void onReactionClicked(View v, TLRPC.TL_availableReaction reaction, boolean longpress);
} }
@Override @Override

View File

@ -8,8 +8,16 @@
package org.telegram.ui.Components; package org.telegram.ui.Components;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.Shader; import android.graphics.Shader;
import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.BitmapDrawable;
@ -21,12 +29,17 @@ import android.view.View;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.DispatchQueue;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.SharedConfig; import org.telegram.messenger.SharedConfig;
import org.telegram.messenger.Utilities;
import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBar;
import org.telegram.ui.ActionBar.ActionBarLayout; import org.telegram.ui.ActionBar.ActionBarLayout;
import org.telegram.ui.ActionBar.AdjustPanLayoutHelper; import org.telegram.ui.ActionBar.AdjustPanLayoutHelper;
import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.ActionBar.Theme;
import java.util.ArrayList;
public class SizeNotifierFrameLayout extends FrameLayout { public class SizeNotifierFrameLayout extends FrameLayout {
private Rect rect = new Rect(); private Rect rect = new Rect();
@ -51,6 +64,11 @@ public class SizeNotifierFrameLayout extends FrameLayout {
private boolean skipBackgroundDrawing; private boolean skipBackgroundDrawing;
SnowflakesEffect snowflakesEffect; SnowflakesEffect snowflakesEffect;
public void invalidateBlur() {
invalidateBlur = true;
}
public interface SizeNotifierFrameLayoutDelegate { public interface SizeNotifierFrameLayoutDelegate {
void onSizeChanged(int keyboardHeight, boolean isWidthGreater); void onSizeChanged(int keyboardHeight, boolean isWidthGreater);
} }
@ -337,7 +355,7 @@ public class SizeNotifierFrameLayout extends FrameLayout {
} }
private void checkSnowflake(Canvas canvas) { private void checkSnowflake(Canvas canvas) {
if (SharedConfig.drawSnowInChat || Theme.canStartHolidayAnimation()) { if (Theme.canStartHolidayAnimation()) {
if (snowflakesEffect == null) { if (snowflakesEffect == null) {
snowflakesEffect = new SnowflakesEffect(1); snowflakesEffect = new SnowflakesEffect(1);
} }
@ -366,4 +384,265 @@ public class SizeNotifierFrameLayout extends FrameLayout {
protected boolean verifyDrawable(Drawable who) { protected boolean verifyDrawable(Drawable who) {
return who == getBackgroundImage() || super.verifyDrawable(who); return who == getBackgroundImage() || super.verifyDrawable(who);
} }
public boolean needBlur;
public boolean blurIsRunning;
public boolean blurGeneratingTuskIsRunning;
BlurBitmap currentBitmap;
public ArrayList<BlurBitmap> unusedBitmaps = new ArrayList<>(10);
public ArrayList<View> blurBehindViews = new ArrayList<>();
Matrix matrix = new Matrix();
public Paint blurPaintTop = new Paint();
public Paint blurPaintTop2 = new Paint();
public Paint blurPaintBottom = new Paint();
public Paint blurPaintBottom2 = new Paint();
public float blurCrossfadeProgress;
private final float DOWN_SCALE = 12f;
private static DispatchQueue blurQueue;
ValueAnimator blurCrossfade;
public boolean invalidateBlur;
int count;
int times;
public void startBlur() {
if (!blurIsRunning || blurGeneratingTuskIsRunning || !invalidateBlur || !SharedConfig.chatBlurEnabled()) {
return;
}
invalidateBlur = false;
blurGeneratingTuskIsRunning = true;
int lastW = getMeasuredWidth();
int lastH = ActionBar.getCurrentActionBarHeight() + AndroidUtilities.statusBarHeight + AndroidUtilities.dp(100);
int bitmapH = (int) (lastH / DOWN_SCALE) + 10;
int bitmapW = (int) (lastW / DOWN_SCALE);
BlurBitmap bitmap = null;
if (unusedBitmaps.size() > 0) {
bitmap = unusedBitmaps.remove(unusedBitmaps.size() - 1);
}
if (bitmap == null) {
bitmap = new BlurBitmap();
bitmap.topBitmap = Bitmap.createBitmap(bitmapW, bitmapH, Bitmap.Config.ARGB_8888);
bitmap.topCanvas = new Canvas(bitmap.topBitmap);
bitmap.bottomBitmap = Bitmap.createBitmap(bitmapW, bitmapH, Bitmap.Config.ARGB_8888);
bitmap.bottomCanvas = new Canvas(bitmap.bottomBitmap);
}
bitmap.topBitmap.eraseColor(Color.TRANSPARENT);
bitmap.bottomBitmap.eraseColor(Color.TRANSPARENT);
BlurBitmap finalBitmap = bitmap;
float sX = (float) finalBitmap.topBitmap.getWidth() / (float) lastW;
float sY = (float) (finalBitmap.topBitmap.getHeight() - 10) / (float) lastH;
finalBitmap.topCanvas.save();
finalBitmap.topCanvas.clipRect(0, 10 * sY, finalBitmap.topBitmap.getWidth(), finalBitmap.topBitmap.getHeight());
finalBitmap.topCanvas.scale(sX, sY);
finalBitmap.topScaleX = 1f / sX;
finalBitmap.topScaleY = 1f / sY;
// finalBitmap.pixelFixOffset = getScrollOffset() % (int) DOWN_SCALE;
finalBitmap.topCanvas.translate(0, finalBitmap.pixelFixOffset);
drawList(finalBitmap.topCanvas, true);
finalBitmap.topCanvas.restore();
sX = (float) finalBitmap.bottomBitmap.getWidth() / (float) lastW;
sY = (float) (finalBitmap.bottomBitmap.getHeight() - 10) / (float) lastH;
finalBitmap.bottomOffset = getBottomOffset() - lastH;
finalBitmap.bottomCanvas.save();
finalBitmap.bottomCanvas.clipRect(0, 10 * sY, finalBitmap.bottomBitmap.getWidth(), finalBitmap.bottomBitmap.getHeight());
finalBitmap.bottomCanvas.scale(sX, sY);
finalBitmap.bottomCanvas.translate(0, 10 - finalBitmap.bottomOffset);
finalBitmap.bottomScaleX = 1f / sX;
finalBitmap.bottomScaleY = 1f / sY;
drawList(finalBitmap.bottomCanvas, false);
finalBitmap.bottomCanvas.restore();
int radius = (int) (Math.max(6, Math.max(lastH, lastW) / 180) * 2.5f);
if (blurQueue == null) {
blurQueue = new DispatchQueue("BlurQueue");
}
blurQueue.postRunnable(new Runnable() {
@Override
public void run() {
long time = System.currentTimeMillis();
Utilities.stackBlurBitmap(finalBitmap.topBitmap, radius);
Utilities.stackBlurBitmap(finalBitmap.bottomBitmap, radius);
times += System.currentTimeMillis() - time;
count++;
if (count > 1000) {
FileLog.d("chat blur generating average time" + (times / (float) count));
count = 0;
times = 0;
}
AndroidUtilities.runOnUIThread(() -> {
BlurBitmap oldBitmap = currentBitmap;
blurPaintTop2.setShader(blurPaintTop.getShader());
blurPaintBottom2.setShader(blurPaintBottom.getShader());
BitmapShader bitmapShader = new BitmapShader(finalBitmap.topBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
blurPaintTop.setShader(bitmapShader);
bitmapShader = new BitmapShader(finalBitmap.bottomBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
blurPaintBottom.setShader(bitmapShader);
blurCrossfadeProgress = 0;
if (blurCrossfade != null) {
blurCrossfade.cancel();
}
blurCrossfade = ValueAnimator.ofFloat(0, 1f);
blurCrossfade.addUpdateListener(valueAnimator -> {
blurCrossfadeProgress = (float) valueAnimator.getAnimatedValue();
for (int i = 0; i < blurBehindViews.size(); i++) {
blurBehindViews.get(i).invalidate();
}
});
blurCrossfade.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
unusedBitmaps.add(oldBitmap);
super.onAnimationEnd(animation);
}
});
blurCrossfade.setDuration(50);
blurCrossfade.start();
for (int i = 0; i < blurBehindViews.size(); i++) {
blurBehindViews.get(i).invalidate();
}
currentBitmap = finalBitmap;
AndroidUtilities.runOnUIThread(() -> {
blurGeneratingTuskIsRunning = false;
startBlur();
}, 32);
});
}
});
}
protected float getBottomOffset() {
return getMeasuredHeight();
}
protected Theme.ResourcesProvider getResourceProvider() {
return null;
}
protected void drawList(Canvas blurCanvas, boolean top) {
}
protected int getScrollOffset() {
return 0;
}
@Override
protected void dispatchDraw(Canvas canvas) {
if (blurIsRunning) {
startBlur();
}
super.dispatchDraw(canvas);
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
if (needBlur && !blurIsRunning) {
blurIsRunning = true;
invalidateBlur = true;
}
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
blurPaintTop.setShader(null);
blurPaintTop2.setShader(null);
blurPaintBottom.setShader(null);
blurPaintBottom2.setShader(null);
if (blurCrossfade != null) {
blurCrossfade.cancel();
}
if (currentBitmap != null) {
currentBitmap.recycle();
currentBitmap = null;
}
for (int i = 0; i < unusedBitmaps.size(); i++) {
if (unusedBitmaps.get(i) != null) {
unusedBitmaps.get(i).recycle();
}
}
unusedBitmaps.clear();
blurIsRunning = false;
}
public void drawBlur(Canvas canvas, float y, Rect rectTmp, Paint blurScrimPaint, boolean top) {
if (currentBitmap == null || !SharedConfig.chatBlurEnabled()) {
canvas.drawRect(rectTmp, blurScrimPaint);
return;
}
Paint blurPaint = top ? blurPaintTop : blurPaintBottom;
Paint blurPaint2 = top ? blurPaintTop2 : blurPaintBottom2;
if (blurPaint.getShader() != null) {
matrix.reset();
if (!top) {
matrix.setTranslate(0, -y + currentBitmap.bottomOffset - currentBitmap.pixelFixOffset);
matrix.preScale(currentBitmap.bottomScaleX, currentBitmap.bottomScaleY);
} else {
matrix.setTranslate(0, -y);
matrix.preScale(currentBitmap.topScaleX, currentBitmap.topScaleY);
}
blurPaint.getShader().setLocalMatrix(matrix);
if (blurPaint2.getShader() != null) {
blurPaint2.getShader().setLocalMatrix(matrix);
}
}
if (blurCrossfadeProgress != 1f && blurPaint2.getShader() != null) {
canvas.drawRect(rectTmp, blurScrimPaint);
canvas.drawRect(rectTmp, blurPaint2);
canvas.saveLayerAlpha(rectTmp.left, rectTmp.top, rectTmp.right, rectTmp.bottom, (int) (blurCrossfadeProgress * 255), Canvas.ALL_SAVE_FLAG);
// blurScrimPaint.setAlpha((int) (blurCrossfadeProgress * 255));
// blurPaint.setAlpha((int) (blurCrossfadeProgress * 255));
canvas.drawRect(rectTmp, blurScrimPaint);
canvas.drawRect(rectTmp, blurPaint);
canvas.restore();
} else {
canvas.drawRect(rectTmp, blurScrimPaint);
canvas.drawRect(rectTmp, blurPaint);
}
blurScrimPaint.setAlpha(Color.alpha(Theme.getColor(Theme.key_chat_BlurAlpha)));
canvas.drawRect(rectTmp, blurScrimPaint);
}
private static class BlurBitmap {
int pixelFixOffset;
Canvas topCanvas;
Bitmap topBitmap;
float topScaleX, topScaleY;
float bottomScaleX, bottomScaleY;
float bottomOffset;
Canvas bottomCanvas;
Bitmap bottomBitmap;
public void recycle() {
topBitmap.recycle();
bottomBitmap.recycle();
}
}
} }

View File

@ -13,6 +13,7 @@ import android.graphics.PorterDuffColorFilter;
import android.graphics.RectF; import android.graphics.RectF;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.SystemClock; import android.os.SystemClock;
import android.text.Layout; import android.text.Layout;
import android.text.Selection; import android.text.Selection;
@ -436,6 +437,9 @@ public class UndoView extends FrameLayout {
} }
public void showWithAction(ArrayList<Long> dialogIds, int action, Object infoObject, Object infoObject2, Runnable actionRunnable, Runnable cancelRunnable) { public void showWithAction(ArrayList<Long> dialogIds, int action, Object infoObject, Object infoObject2, Runnable actionRunnable, Runnable cancelRunnable) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && currentAction == ACTION_MESSAGE_COPIED || currentAction == ACTION_USERNAME_COPIED || currentAction == ACTION_HASHTAG_COPIED || currentAction == ACTION_TEXT_COPIED || currentAction == ACTION_LINK_COPIED || currentAction == ACTION_PHONE_COPIED || currentAction == ACTION_EMAIL_COPIED || currentAction == ACTION_VOIP_LINK_COPIED) {
return;
}
if (currentActionRunnable != null) { if (currentActionRunnable != null) {
currentActionRunnable.run(); currentActionRunnable.run();
} }

View File

@ -573,7 +573,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
} }
public void setCaption(CharSequence caption) { public void setCaption(CharSequence caption) {
hasCaptionForAllMedia = !TextUtils.isEmpty(caption); hasCaptionForAllMedia = true;//!TextUtils.isEmpty(caption);
captionForAllMedia = caption; captionForAllMedia = caption;
} }
@ -1924,6 +1924,11 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
public boolean validateGroupId(long groupId) { public boolean validateGroupId(long groupId) {
return true; return true;
} }
@Override
public void onApplyCaption(CharSequence caption) {
}
} }
public interface PhotoViewerProvider { public interface PhotoViewerProvider {
@ -1990,6 +1995,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
boolean closeKeyboard(); boolean closeKeyboard();
boolean validateGroupId(long groupId); boolean validateGroupId(long groupId);
void onApplyCaption(CharSequence caption);
} }
private class FrameLayoutDrawer extends SizeNotifierFrameLayoutPhoto { private class FrameLayoutDrawer extends SizeNotifierFrameLayoutPhoto {
@ -6946,6 +6952,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
if (captionEditText.getFieldCharSequence().length() != 0 && !placeProvider.isPhotoChecked(currentIndex)) { if (captionEditText.getFieldCharSequence().length() != 0 && !placeProvider.isPhotoChecked(currentIndex)) {
setPhotoChecked(); setPhotoChecked();
} }
if (placeProvider != null) {
placeProvider.onApplyCaption(caption);
}
setCurrentCaption(null, result[0], false); setCurrentCaption(null, result[0], false);
} }
captionEditText.setTag(null); captionEditText.setTag(null);

View File

@ -3099,7 +3099,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
BuildVars.DEBUG_PRIVATE_VERSION ? "Clean app update" : null, BuildVars.DEBUG_PRIVATE_VERSION ? "Clean app update" : null,
BuildVars.DEBUG_PRIVATE_VERSION ? "Reset suggestions" : null, BuildVars.DEBUG_PRIVATE_VERSION ? "Reset suggestions" : null,
"Reset all notification channels", "Reset all notification channels",
SharedConfig.drawSnowInChat ? "Hide snow in chat" : "Show snow in chat" SharedConfig.canBlurChat() ? (SharedConfig.chatBlur ? "Disable blur in chat" : "Enable blur in chat") : null
}; };
builder.setItems(items, (dialog, which) -> { builder.setItems(items, (dialog, which) -> {
if (which == 0) { if (which == 0) {
@ -3199,7 +3199,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
} else if (which == 18) { } else if (which == 18) {
getNotificationsController().cleanupNotificationChannels(); getNotificationsController().cleanupNotificationChannels();
} else if (which == 19) { } else if (which == 19) {
SharedConfig.toggleDrawSnowInChat(); SharedConfig.toggleDebugChatBlur();
} }
}); });
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);

View File

@ -1699,7 +1699,7 @@ public class VoIPFragment implements VoIPService.StateListener, NotificationCent
buf.write(service.getGA()); buf.write(service.getGA());
auth_key = buf.toByteArray(); auth_key = buf.toByteArray();
} catch (Exception checkedExceptionsAreBad) { } catch (Exception checkedExceptionsAreBad) {
FileLog.e(checkedExceptionsAreBad); FileLog.e(checkedExceptionsAreBad, false);
} }
if (auth_key == null) { if (auth_key == null) {
return; return;

View File

@ -4938,7 +4938,6 @@
<string name="DoubleTapPreviewSenderName">Dino</string> <string name="DoubleTapPreviewSenderName">Dino</string>
<string name="DoubleTapSetting">Quick Reactions</string> <string name="DoubleTapSetting">Quick Reactions</string>
<string name="DoubleTapPreviewRational">Double tap this message for a quck reaction.</string> <string name="DoubleTapPreviewRational">Double tap this message for a quck reaction.</string>
<string name="DebugDrawSnowInChat">Snow in chat</string>
<string name="ActionReactionsChanged">un1 changed chat reactions \nfrom: %1$s \nto: %2$s</string> <string name="ActionReactionsChanged">un1 changed chat reactions \nfrom: %1$s \nto: %2$s</string>
<string name="NobodyViewed">Nobody viewed</string> <string name="NobodyViewed">Nobody viewed</string>
<string name="QrCode">QR Code</string> <string name="QrCode">QR Code</string>