mirror of
https://github.com/DrKLO/Telegram.git
synced 2025-03-27 08:40:37 +01:00
Update to 8.4.3
This commit is contained in:
parent
c1c2ebaf46
commit
ad6629f6fc
47 changed files with 1806 additions and 923 deletions
|
@ -300,7 +300,7 @@ android {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig.versionCode = 2522
|
defaultConfig.versionCode = 2531
|
||||||
|
|
||||||
applicationVariants.all { variant ->
|
applicationVariants.all { variant ->
|
||||||
variant.outputs.all { output ->
|
variant.outputs.all { output ->
|
||||||
|
@ -319,7 +319,7 @@ android {
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionName "8.4.1"
|
versionName "8.4.3"
|
||||||
|
|
||||||
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']
|
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ dialogTextLink=-14057020
|
||||||
chat_status=-2627597
|
chat_status=-2627597
|
||||||
windowBackgroundWhiteBlueHeader=-14380330
|
windowBackgroundWhiteBlueHeader=-14380330
|
||||||
chat_messagePanelVoiceBackground=-10374934
|
chat_messagePanelVoiceBackground=-10374934
|
||||||
|
switchTrackBlueChecked=-12940870
|
||||||
chat_topPanelLine=-11949852
|
chat_topPanelLine=-11949852
|
||||||
chat_outInstantSelected=-14770977
|
chat_outInstantSelected=-14770977
|
||||||
chat_outSentCheck=-14967834
|
chat_outSentCheck=-14967834
|
||||||
|
@ -80,8 +81,8 @@ dialogTextGray4=-7565423
|
||||||
chat_attachContactText=-2121728
|
chat_attachContactText=-2121728
|
||||||
chat_searchPanelIcons=-12937244
|
chat_searchPanelIcons=-12937244
|
||||||
windowBackgroundWhiteLinkText=-13990712
|
windowBackgroundWhiteLinkText=-13990712
|
||||||
chat_outVenueInfoText=-9396792
|
chat_outVenueInfoText=-8216913
|
||||||
chat_outContactPhoneText=-9396792
|
chat_outContactPhoneText=-8612185
|
||||||
chat_inAudioTitleText=-15061445
|
chat_inAudioTitleText=-15061445
|
||||||
chat_messageLinkIn=-16090691
|
chat_messageLinkIn=-16090691
|
||||||
chat_inBubbleSelected=-1509892
|
chat_inBubbleSelected=-1509892
|
||||||
|
@ -92,7 +93,7 @@ chat_outSiteNameText=-14515511
|
||||||
dialogTextGray=-7565423
|
dialogTextGray=-7565423
|
||||||
chat_messageLinkOut=-16155709
|
chat_messageLinkOut=-16155709
|
||||||
avatar_backgroundArchived=-4998207
|
avatar_backgroundArchived=-4998207
|
||||||
chat_outFileInfoSelectedText=-9396792
|
chat_outFileInfoSelectedText=-8674358
|
||||||
chat_outAudioDurationSelectedText=-8674358
|
chat_outAudioDurationSelectedText=-8674358
|
||||||
avatar_backgroundArchivedHidden=-10832396
|
avatar_backgroundArchivedHidden=-10832396
|
||||||
statisticChartLine_orange=-1853657
|
statisticChartLine_orange=-1853657
|
||||||
|
@ -105,7 +106,7 @@ chat_outReplyLine=-13133085
|
||||||
chat_inAudioSeekbarFill=-10572824
|
chat_inAudioSeekbarFill=-10572824
|
||||||
chat_inContactBackground=-431707662
|
chat_inContactBackground=-431707662
|
||||||
progressCircle=-14375188
|
progressCircle=-14375188
|
||||||
chat_outVenueInfoSelectedText=-9396792
|
chat_outVenueInfoSelectedText=-8674358
|
||||||
chats_menuItemIcon=-7433063
|
chats_menuItemIcon=-7433063
|
||||||
wallpaperFileOffset=-1
|
wallpaperFileOffset=-1
|
||||||
chat_outBubbleShadow=-16699318
|
chat_outBubbleShadow=-16699318
|
||||||
|
@ -130,8 +131,8 @@ chat_outBubbleSelected=-2690305
|
||||||
chat_inFileNameText=-15654091
|
chat_inFileNameText=-15654091
|
||||||
statisticChartLine_blue=-13467675
|
statisticChartLine_blue=-13467675
|
||||||
chat_inInstantSelected=-14707230
|
chat_inInstantSelected=-14707230
|
||||||
chat_outFileInfoText=-9396792
|
chat_outFileInfoText=-7953740
|
||||||
chat_outContactPhoneSelectedText=-9396792
|
chat_outContactPhoneSelectedText=-9725764
|
||||||
chat_wallpaper=-11300655
|
chat_wallpaper=-11300655
|
||||||
chat_outMenuSelected=-7026959
|
chat_outMenuSelected=-7026959
|
||||||
chat_outLoaderPhotoSelected=-263935502
|
chat_outLoaderPhotoSelected=-263935502
|
||||||
|
@ -142,14 +143,14 @@ avatar_actionBarSelectorBlue=-12091735
|
||||||
switchTrackChecked=-11424793
|
switchTrackChecked=-11424793
|
||||||
chat_inLoader=-431707662
|
chat_inLoader=-431707662
|
||||||
chat_outPreviewInstantSelectedText=-14514998
|
chat_outPreviewInstantSelectedText=-14514998
|
||||||
chat_outTimeText=-143614520
|
chat_outTimeText=-141776195
|
||||||
chat_attachAudioText=-2209977
|
chat_attachAudioText=-2209977
|
||||||
chat_outBubble=-1641732
|
chat_outBubble=-1641732
|
||||||
chat_attachHideBackground=-4866356
|
chat_attachHideBackground=-4866356
|
||||||
chats_menuItemText=-12632257
|
chats_menuItemText=-12632257
|
||||||
chat_outReplyNameText=-14382642
|
chat_outReplyNameText=-14382642
|
||||||
chats_menuTopBackgroundCats=-10906430
|
chats_menuTopBackgroundCats=-10906430
|
||||||
chat_outReplyMediaMessageText=-9396792
|
chat_outReplyMediaMessageText=-7558467
|
||||||
actionBarTabSelector=-12554340
|
actionBarTabSelector=-12554340
|
||||||
chat_outLoaderPhotoIcon=-263935502
|
chat_outLoaderPhotoIcon=-263935502
|
||||||
chat_attachFileText=-15423260
|
chat_attachFileText=-15423260
|
||||||
|
@ -178,9 +179,9 @@ chats_actionPressedBackground=-11166764
|
||||||
chat_replyPanelName=-13397538
|
chat_replyPanelName=-13397538
|
||||||
windowBackgroundWhiteValueText=-13003565
|
windowBackgroundWhiteValueText=-13003565
|
||||||
chat_outAudioDurationText=-7558467
|
chat_outAudioDurationText=-7558467
|
||||||
chat_outMenu=-5782571
|
chat_outMenu=-5716778
|
||||||
statisticChartActiveLine=335544320
|
statisticChartActiveLine=335544320
|
||||||
chat_outReplyMediaMessageSelectedText=-9396792
|
chat_outReplyMediaMessageSelectedText=-8674357
|
||||||
chats_attachMessage=-14843710
|
chats_attachMessage=-14843710
|
||||||
chat_outSentClock=-594761027
|
chat_outSentClock=-594761027
|
||||||
chat_searchPanelText=-12609056
|
chat_searchPanelText=-12609056
|
||||||
|
|
|
@ -36,6 +36,7 @@ chat_inMediaIcon=-1
|
||||||
actionBarDefaultArchived=-13748149
|
actionBarDefaultArchived=-13748149
|
||||||
avatar_subtitleInProfileViolet=-7628894
|
avatar_subtitleInProfileViolet=-7628894
|
||||||
chat_messagePanelCancelInlineBot=-8549479
|
chat_messagePanelCancelInlineBot=-8549479
|
||||||
|
voipgroup_topPanelGray=-10521727
|
||||||
dialogSearchBackground=-14010037
|
dialogSearchBackground=-14010037
|
||||||
chat_outAudioSeekbarFill=-7944965
|
chat_outAudioSeekbarFill=-7944965
|
||||||
chat_botKeyboardButtonBackgroundPressed=-12956574
|
chat_botKeyboardButtonBackgroundPressed=-12956574
|
||||||
|
@ -373,6 +374,7 @@ chat_outReplyMediaMessageText=-7357217
|
||||||
chat_textSelectBackground=1516415459
|
chat_textSelectBackground=1516415459
|
||||||
chat_messagePanelVoiceDelete=-1
|
chat_messagePanelVoiceDelete=-1
|
||||||
chat_inAudioProgress=-1
|
chat_inAudioProgress=-1
|
||||||
|
chat_inReactionButtonTextSelected=-1
|
||||||
chats_date=-9207925
|
chats_date=-9207925
|
||||||
chat_messagePanelText=-1
|
chat_messagePanelText=-1
|
||||||
actionBarTabSelector=926307434
|
actionBarTabSelector=926307434
|
||||||
|
@ -431,6 +433,7 @@ chat_outReplyMessageText=-1
|
||||||
chat_recordedVoiceDot=-1221292
|
chat_recordedVoiceDot=-1221292
|
||||||
chat_messagePanelBackground=-14602949
|
chat_messagePanelBackground=-14602949
|
||||||
chat_inLoaderPhotoSelected=-14925725
|
chat_inLoaderPhotoSelected=-14925725
|
||||||
|
chat_inReactionButtonText=-1
|
||||||
chat_inVoiceSeekbarFill=-10177041
|
chat_inVoiceSeekbarFill=-10177041
|
||||||
graySection=-15459033
|
graySection=-15459033
|
||||||
chat_outAudioSeekbar=-429551165
|
chat_outAudioSeekbar=-429551165
|
||||||
|
@ -462,4 +465,3 @@ chat_outSentClock=-8213557
|
||||||
dialogBackgroundGray=-14932431
|
dialogBackgroundGray=-14932431
|
||||||
chat_searchPanelText=-8796932
|
chat_searchPanelText=-8796932
|
||||||
chat_inContactIcon=-1
|
chat_inContactIcon=-1
|
||||||
voipgroup_topPanelGray=-10521727
|
|
||||||
|
|
|
@ -393,6 +393,7 @@ chat_outReplyMediaMessageText=-7023626
|
||||||
chat_textSelectBackground=1516415459
|
chat_textSelectBackground=1516415459
|
||||||
chat_messagePanelVoiceDelete=-1
|
chat_messagePanelVoiceDelete=-1
|
||||||
chat_inAudioProgress=-1
|
chat_inAudioProgress=-1
|
||||||
|
chat_inReactionButtonTextSelected=-1
|
||||||
chats_date=-8882056
|
chats_date=-8882056
|
||||||
chat_messagePanelText=-1
|
chat_messagePanelText=-1
|
||||||
actionBarTabSelector=827876202
|
actionBarTabSelector=827876202
|
||||||
|
@ -456,6 +457,7 @@ chat_recordedVoiceDot=-1221292
|
||||||
chat_messagePanelBackground=-14803425
|
chat_messagePanelBackground=-14803425
|
||||||
chat_wallpaper_gradient_to=-15790320
|
chat_wallpaper_gradient_to=-15790320
|
||||||
chat_inLoaderPhotoSelected=-14925725
|
chat_inLoaderPhotoSelected=-14925725
|
||||||
|
chat_inReactionButtonText=-1
|
||||||
chats_messageArchived=-8224126
|
chats_messageArchived=-8224126
|
||||||
chat_inVoiceSeekbarFill=-10177041
|
chat_inVoiceSeekbarFill=-10177041
|
||||||
graySection=-16053492
|
graySection=-16053492
|
||||||
|
|
|
@ -427,6 +427,7 @@ public class ChatListItemAnimator extends DefaultItemAnimator {
|
||||||
view.setTranslationX(-deltaX);
|
view.setTranslationX(-deltaX);
|
||||||
}
|
}
|
||||||
mPendingMoves.add(moveInfo);
|
mPendingMoves.add(moveInfo);
|
||||||
|
checkIsRunning();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -655,6 +656,7 @@ public class ChatListItemAnimator extends DefaultItemAnimator {
|
||||||
}
|
}
|
||||||
|
|
||||||
mPendingMoves.add(moveInfo);
|
mPendingMoves.add(moveInfo);
|
||||||
|
checkIsRunning();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -926,6 +928,7 @@ public class ChatListItemAnimator extends DefaultItemAnimator {
|
||||||
newHolder.itemView.setAlpha(0);
|
newHolder.itemView.setAlpha(0);
|
||||||
}
|
}
|
||||||
mPendingChanges.add(new ChangeInfo(oldHolder, newHolder, fromX, fromY, toX, toY));
|
mPendingChanges.add(new ChangeInfo(oldHolder, newHolder, fromX, fromY, toX, toY));
|
||||||
|
checkIsRunning();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -210,6 +210,7 @@ public class DefaultItemAnimator extends SimpleItemAnimator {
|
||||||
public boolean animateRemove(final RecyclerView.ViewHolder holder, ItemHolderInfo info) {
|
public boolean animateRemove(final RecyclerView.ViewHolder holder, ItemHolderInfo info) {
|
||||||
resetAnimation(holder);
|
resetAnimation(holder);
|
||||||
mPendingRemovals.add(holder);
|
mPendingRemovals.add(holder);
|
||||||
|
checkIsRunning();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,6 +248,7 @@ public class DefaultItemAnimator extends SimpleItemAnimator {
|
||||||
resetAnimation(holder);
|
resetAnimation(holder);
|
||||||
holder.itemView.setAlpha(0);
|
holder.itemView.setAlpha(0);
|
||||||
mPendingAdditions.add(holder);
|
mPendingAdditions.add(holder);
|
||||||
|
checkIsRunning();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,6 +298,7 @@ public class DefaultItemAnimator extends SimpleItemAnimator {
|
||||||
view.setTranslationY(-deltaY);
|
view.setTranslationY(-deltaY);
|
||||||
}
|
}
|
||||||
mPendingMoves.add(new MoveInfo(holder, fromX, fromY, toX, toY));
|
mPendingMoves.add(new MoveInfo(holder, fromX, fromY, toX, toY));
|
||||||
|
checkIsRunning();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -380,6 +383,7 @@ public class DefaultItemAnimator extends SimpleItemAnimator {
|
||||||
newHolder.itemView.setAlpha(0);
|
newHolder.itemView.setAlpha(0);
|
||||||
}
|
}
|
||||||
mPendingChanges.add(new ChangeInfo(oldHolder, newHolder, fromX, fromY, toX, toY));
|
mPendingChanges.add(new ChangeInfo(oldHolder, newHolder, fromX, fromY, toX, toY));
|
||||||
|
checkIsRunning();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -734,4 +738,8 @@ public class DefaultItemAnimator extends SimpleItemAnimator {
|
||||||
public void setTranslationInterpolator(Interpolator translationInterpolator) {
|
public void setTranslationInterpolator(Interpolator translationInterpolator) {
|
||||||
this.translationInterpolator = translationInterpolator;
|
this.translationInterpolator = translationInterpolator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void checkIsRunning() {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,6 +129,9 @@ public class GridLayoutManagerFixed extends GridLayoutManager {
|
||||||
int backupPosition = layoutState.mCurrentPosition;
|
int backupPosition = layoutState.mCurrentPosition;
|
||||||
for (int a = layoutState.mCurrentPosition; a > startPosition; a--) {
|
for (int a = layoutState.mCurrentPosition; a > startPosition; a--) {
|
||||||
View view = layoutState.next(recycler);
|
View view = layoutState.next(recycler);
|
||||||
|
if (view == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
additionalViews.add(view);
|
additionalViews.add(view);
|
||||||
if (a != backupPosition) {
|
if (a != backupPosition) {
|
||||||
calculateItemDecorationsForChild(view, mDecorInsets);
|
calculateItemDecorationsForChild(view, mDecorInsets);
|
||||||
|
|
|
@ -39,6 +39,7 @@ import android.graphics.Typeface;
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.media.MediaScannerConnection;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
|
@ -95,6 +96,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||||
import androidx.viewpager.widget.ViewPager;
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
import com.android.internal.telephony.ITelephony;
|
import com.android.internal.telephony.ITelephony;
|
||||||
|
import com.google.android.exoplayer2.util.Log;
|
||||||
import com.google.android.gms.auth.api.phone.SmsRetriever;
|
import com.google.android.gms.auth.api.phone.SmsRetriever;
|
||||||
import com.google.android.gms.auth.api.phone.SmsRetrieverClient;
|
import com.google.android.gms.auth.api.phone.SmsRetrieverClient;
|
||||||
import com.google.android.gms.tasks.Task;
|
import com.google.android.gms.tasks.Task;
|
||||||
|
|
|
@ -20,8 +20,8 @@ public class BuildVars {
|
||||||
public static boolean USE_CLOUD_STRINGS = true;
|
public static boolean USE_CLOUD_STRINGS = true;
|
||||||
public static boolean CHECK_UPDATES = true;
|
public static boolean CHECK_UPDATES = true;
|
||||||
public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29;
|
public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29;
|
||||||
public static int BUILD_VERSION = 2526;
|
public static int BUILD_VERSION = 2531;
|
||||||
public static String BUILD_VERSION_STRING = "8.4.2";
|
public static String BUILD_VERSION_STRING = "8.4.3";
|
||||||
public static int APP_ID = 4;
|
public static int APP_ID = 4;
|
||||||
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
|
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ import android.util.Base64;
|
||||||
|
|
||||||
import androidx.collection.LongSparseArray;
|
import androidx.collection.LongSparseArray;
|
||||||
|
|
||||||
import com.google.android.exoplayer2.util.Log;
|
|
||||||
import com.google.firebase.messaging.FirebaseMessagingService;
|
import com.google.firebase.messaging.FirebaseMessagingService;
|
||||||
import com.google.firebase.messaging.RemoteMessage;
|
import com.google.firebase.messaging.RemoteMessage;
|
||||||
|
|
||||||
|
@ -1114,7 +1113,7 @@ public class GcmPushListenerService extends FirebaseMessagingService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getReactedText(String loc_key, String[] args) {
|
private String getReactedText(String loc_key, Object[] args) {
|
||||||
switch (loc_key) {
|
switch (loc_key) {
|
||||||
case "REACT_TEXT": {
|
case "REACT_TEXT": {
|
||||||
return LocaleController.formatString("PushReactText", R.string.PushReactText, args);
|
return LocaleController.formatString("PushReactText", R.string.PushReactText, args);
|
||||||
|
|
|
@ -14,8 +14,6 @@ import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.pm.ApplicationInfo;
|
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.Matrix;
|
import android.graphics.Matrix;
|
||||||
|
@ -859,7 +857,7 @@ public class ImageLoader {
|
||||||
if (args.length >= 3 && "pcache".equals(args[2])) {
|
if (args.length >= 3 && "pcache".equals(args[2])) {
|
||||||
precache = true;
|
precache = true;
|
||||||
} else {
|
} else {
|
||||||
precache = SharedConfig.getDevicePerformanceClass() != SharedConfig.PERFORMANCE_CLASS_HIGH;
|
precache = !cacheImage.filter.contains("nolimit") && SharedConfig.getDevicePerformanceClass() != SharedConfig.PERFORMANCE_CLASS_HIGH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,8 @@ import android.graphics.drawable.Drawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.annotation.Keep;
|
||||||
|
|
||||||
import org.telegram.tgnet.TLObject;
|
import org.telegram.tgnet.TLObject;
|
||||||
import org.telegram.tgnet.TLRPC;
|
import org.telegram.tgnet.TLRPC;
|
||||||
import org.telegram.ui.Components.AnimatedFileDrawable;
|
import org.telegram.ui.Components.AnimatedFileDrawable;
|
||||||
|
@ -34,8 +36,6 @@ import org.telegram.ui.Components.LoadingStickerDrawable;
|
||||||
import org.telegram.ui.Components.RLottieDrawable;
|
import org.telegram.ui.Components.RLottieDrawable;
|
||||||
import org.telegram.ui.Components.RecyclableDrawable;
|
import org.telegram.ui.Components.RecyclableDrawable;
|
||||||
|
|
||||||
import androidx.annotation.Keep;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class ImageReceiver implements NotificationCenter.NotificationCenterDelegate {
|
public class ImageReceiver implements NotificationCenter.NotificationCenterDelegate {
|
||||||
|
@ -263,6 +263,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
|
||||||
private boolean centerRotation;
|
private boolean centerRotation;
|
||||||
private ImageReceiverDelegate delegate;
|
private ImageReceiverDelegate delegate;
|
||||||
private float currentAlpha;
|
private float currentAlpha;
|
||||||
|
private float previousAlpha = 1f;
|
||||||
private long lastUpdateAlphaTime;
|
private long lastUpdateAlphaTime;
|
||||||
private byte crossfadeAlpha = 1;
|
private byte crossfadeAlpha = 1;
|
||||||
private boolean manualAlphaAnimator;
|
private boolean manualAlphaAnimator;
|
||||||
|
@ -360,7 +361,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
|
||||||
if (strippedBitmap != null) {
|
if (strippedBitmap != null) {
|
||||||
setImage(ImageLocation.getForUserOrChat(object, ImageLocation.TYPE_SMALL), "50_50", strippedBitmap, null, parentObject, 0);
|
setImage(ImageLocation.getForUserOrChat(object, ImageLocation.TYPE_SMALL), "50_50", strippedBitmap, null, parentObject, 0);
|
||||||
} else if (hasStripped) {
|
} else if (hasStripped) {
|
||||||
setImage(ImageLocation.getForUserOrChat(object, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(object, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, parentObject, 0);
|
setImage(ImageLocation.getForUserOrChat(object, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(object, ImageLocation.TYPE_STRIPPED), "50_50_b", avatarDrawable, parentObject, 0);
|
||||||
} else {
|
} else {
|
||||||
setImage(ImageLocation.getForUserOrChat(object, ImageLocation.TYPE_SMALL), "50_50", avatarDrawable, null, parentObject, 0);
|
setImage(ImageLocation.getForUserOrChat(object, ImageLocation.TYPE_SMALL), "50_50", avatarDrawable, null, parentObject, 0);
|
||||||
}
|
}
|
||||||
|
@ -578,6 +579,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
|
||||||
updateDrawableRadius(staticThumbDrawable);
|
updateDrawableRadius(staticThumbDrawable);
|
||||||
}
|
}
|
||||||
currentAlpha = 1.0f;
|
currentAlpha = 1.0f;
|
||||||
|
previousAlpha = 1f;
|
||||||
|
|
||||||
if (staticThumbDrawable instanceof SvgHelper.SvgDrawable) {
|
if (staticThumbDrawable instanceof SvgHelper.SvgDrawable) {
|
||||||
((SvgHelper.SvgDrawable) staticThumbDrawable).setParent(this);
|
((SvgHelper.SvgDrawable) staticThumbDrawable).setParent(this);
|
||||||
|
@ -746,6 +748,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
|
||||||
currentSize = 0;
|
currentSize = 0;
|
||||||
currentCacheType = 0;
|
currentCacheType = 0;
|
||||||
currentAlpha = 1;
|
currentAlpha = 1;
|
||||||
|
previousAlpha = 1f;
|
||||||
|
|
||||||
if (setImageBackup != null) {
|
if (setImageBackup != null) {
|
||||||
setImageBackup.clear();
|
setImageBackup.clear();
|
||||||
|
@ -1335,6 +1338,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
|
||||||
currentAlpha += dt / (float) crossfadeDuration;
|
currentAlpha += dt / (float) crossfadeDuration;
|
||||||
if (currentAlpha > 1) {
|
if (currentAlpha > 1) {
|
||||||
currentAlpha = 1;
|
currentAlpha = 1;
|
||||||
|
previousAlpha = 1f;
|
||||||
if (crossfadeImage != null) {
|
if (crossfadeImage != null) {
|
||||||
recycleBitmap(null, 2);
|
recycleBitmap(null, 2);
|
||||||
crossfadeShader = null;
|
crossfadeShader = null;
|
||||||
|
@ -1410,6 +1414,9 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
|
||||||
}
|
}
|
||||||
if (drawable != null) {
|
if (drawable != null) {
|
||||||
if (crossfadeAlpha != 0) {
|
if (crossfadeAlpha != 0) {
|
||||||
|
if (previousAlpha != 1f && (drawable == currentImageDrawable || drawable == currentMediaDrawable) && staticThumbDrawable != null) {
|
||||||
|
drawDrawable(canvas, staticThumbDrawable, (int) (overrideAlpha * 255), shaderToUse, orientation);
|
||||||
|
}
|
||||||
if (crossfadeWithThumb && animationNotReady) {
|
if (crossfadeWithThumb && animationNotReady) {
|
||||||
drawDrawable(canvas, drawable, (int) (overrideAlpha * 255), shaderToUse, orientation);
|
drawDrawable(canvas, drawable, (int) (overrideAlpha * 255), shaderToUse, orientation);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1443,7 +1450,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
|
||||||
if (thumbDrawable instanceof SvgHelper.SvgDrawable || thumbDrawable instanceof Emoji.EmojiDrawable) {
|
if (thumbDrawable instanceof SvgHelper.SvgDrawable || thumbDrawable instanceof Emoji.EmojiDrawable) {
|
||||||
alpha = (int) (overrideAlpha * 255 * (1.0f - currentAlpha));
|
alpha = (int) (overrideAlpha * 255 * (1.0f - currentAlpha));
|
||||||
} else {
|
} else {
|
||||||
alpha = (int) (overrideAlpha * 255);
|
alpha = (int) (overrideAlpha * previousAlpha * 255);
|
||||||
}
|
}
|
||||||
drawDrawable(canvas, thumbDrawable, alpha, thumbShaderToUse, thumbOrientation);
|
drawDrawable(canvas, thumbDrawable, alpha, thumbShaderToUse, thumbOrientation);
|
||||||
if (alpha != 255 && thumbDrawable instanceof Emoji.EmojiDrawable) {
|
if (alpha != 255 && thumbDrawable instanceof Emoji.EmojiDrawable) {
|
||||||
|
@ -2077,7 +2084,8 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
|
||||||
} else if (currentImageDrawable instanceof RLottieDrawable) {
|
} else if (currentImageDrawable instanceof RLottieDrawable) {
|
||||||
allowCorssfade = staticThumbDrawable instanceof LoadingStickerDrawable || staticThumbDrawable instanceof SvgHelper.SvgDrawable || staticThumbDrawable instanceof Emoji.EmojiDrawable;
|
allowCorssfade = staticThumbDrawable instanceof LoadingStickerDrawable || staticThumbDrawable instanceof SvgHelper.SvgDrawable || staticThumbDrawable instanceof Emoji.EmojiDrawable;
|
||||||
}
|
}
|
||||||
if (allowCorssfade && (currentThumbDrawable == null && staticThumbDrawable == null || currentAlpha == 1.0f || forceCrossfade)) {
|
if (allowCorssfade && (currentThumbDrawable != null || staticThumbDrawable != null || forceCrossfade)) {
|
||||||
|
previousAlpha = currentAlpha;
|
||||||
currentAlpha = 0.0f;
|
currentAlpha = 0.0f;
|
||||||
lastUpdateAlphaTime = System.currentTimeMillis();
|
lastUpdateAlphaTime = System.currentTimeMillis();
|
||||||
crossfadeWithThumb = crossfadeImage != null || currentThumbDrawable != null || staticThumbDrawable != null;
|
crossfadeWithThumb = crossfadeImage != null || currentThumbDrawable != null || staticThumbDrawable != null;
|
||||||
|
@ -2101,6 +2109,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
|
||||||
boolean allowCorssfade = true;
|
boolean allowCorssfade = true;
|
||||||
if (!memCache && !forcePreview || forceCrossfade) {
|
if (!memCache && !forcePreview || forceCrossfade) {
|
||||||
if (currentThumbDrawable == null && staticThumbDrawable == null || currentAlpha == 1.0f || forceCrossfade) {
|
if (currentThumbDrawable == null && staticThumbDrawable == null || currentAlpha == 1.0f || forceCrossfade) {
|
||||||
|
previousAlpha = currentAlpha;
|
||||||
currentAlpha = 0.0f;
|
currentAlpha = 0.0f;
|
||||||
lastUpdateAlphaTime = System.currentTimeMillis();
|
lastUpdateAlphaTime = System.currentTimeMillis();
|
||||||
crossfadeWithThumb = crossfadeImage != null || currentThumbDrawable != null || staticThumbDrawable != null;
|
crossfadeWithThumb = crossfadeImage != null || currentThumbDrawable != null || staticThumbDrawable != null;
|
||||||
|
@ -2139,7 +2148,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
|
||||||
} else {
|
} else {
|
||||||
currentAlpha = 0.0f;
|
currentAlpha = 0.0f;
|
||||||
lastUpdateAlphaTime = System.currentTimeMillis();
|
lastUpdateAlphaTime = System.currentTimeMillis();
|
||||||
crossfadeWithThumb = staticThumbDrawable != null && currentImageKey == null && currentMediaKey == null;
|
crossfadeWithThumb = staticThumbDrawable != null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
currentAlpha = 1.0f;
|
currentAlpha = 1.0f;
|
||||||
|
|
|
@ -414,10 +414,10 @@ public class LocaleController {
|
||||||
}
|
}
|
||||||
return languagesDict.get(key.toLowerCase().replace("-", "_"));
|
return languagesDict.get(key.toLowerCase().replace("-", "_"));
|
||||||
}
|
}
|
||||||
public LocaleInfo getLanguageByPlural(String plural) {
|
public LocaleInfo getBuiltinLanguageByPlural(String plural) {
|
||||||
Collection<LocaleInfo> values = languagesDict.values();
|
Collection<LocaleInfo> values = languagesDict.values();
|
||||||
for (LocaleInfo l : values)
|
for (LocaleInfo l : values)
|
||||||
if (l.pluralLangCode != null && l.pluralLangCode.equals(plural))
|
if (l.pathToFile != null && l.pathToFile.equals("remote") && l.pluralLangCode != null && l.pluralLangCode.equals(plural))
|
||||||
return l;
|
return l;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ package org.telegram.messenger;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Entity;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.ShortcutManager;
|
import android.content.pm.ShortcutManager;
|
||||||
|
@ -355,9 +354,15 @@ public class MediaDataController extends BaseController {
|
||||||
ImageReceiver imageReceiver = new ImageReceiver();
|
ImageReceiver imageReceiver = new ImageReceiver();
|
||||||
TLRPC.TL_availableReaction reaction = reactions.get(i);
|
TLRPC.TL_availableReaction reaction = reactions.get(i);
|
||||||
imageReceiver.setImage(ImageLocation.getForDocument(reaction.activate_animation), null, null, null, 0, 1);
|
imageReceiver.setImage(ImageLocation.getForDocument(reaction.activate_animation), null, null, null, 0, 1);
|
||||||
imageReceiver.setImage(ImageLocation.getForDocument(reaction.appear_animation), null, null, null, 0, 1);
|
ImageLoader.getInstance().loadImageForImageReceiver(imageReceiver);
|
||||||
|
|
||||||
|
imageReceiver = new ImageReceiver();
|
||||||
|
imageReceiver.setImage(ImageLocation.getForDocument(reaction.appear_animation), "60_60_nolimit", 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);
|
||||||
}
|
}
|
||||||
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.reactionsDidLoad);
|
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.reactionsDidLoad);
|
||||||
});
|
});
|
||||||
|
@ -4589,23 +4594,31 @@ public class MediaDataController extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addTextStyleRuns(TLRPC.DraftMessage msg, Spannable text) {
|
public static void addTextStyleRuns(MessageObject msg, Spannable text) {
|
||||||
addTextStyleRuns(msg.entities, msg.message, text);
|
addTextStyleRuns(msg.messageOwner.entities, msg.messageText, text, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addTextStyleRuns(MessageObject msg, Spannable text) {
|
public static void addTextStyleRuns(TLRPC.DraftMessage msg, Spannable text, int allowedFlags) {
|
||||||
addTextStyleRuns(msg.messageOwner.entities, msg.messageText, text);
|
addTextStyleRuns(msg.entities, msg.message, text, allowedFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addTextStyleRuns(MessageObject msg, Spannable text, int allowedFlags) {
|
||||||
|
addTextStyleRuns(msg.messageOwner.entities, msg.messageText, text, allowedFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addTextStyleRuns(ArrayList<TLRPC.MessageEntity> entities, CharSequence messageText, Spannable text) {
|
public static void addTextStyleRuns(ArrayList<TLRPC.MessageEntity> entities, CharSequence messageText, Spannable text) {
|
||||||
|
addTextStyleRuns(entities, messageText, text, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addTextStyleRuns(ArrayList<TLRPC.MessageEntity> entities, CharSequence messageText, Spannable text, int allowedFlags) {
|
||||||
for (TextStyleSpan prevSpan : text.getSpans(0, text.length(), TextStyleSpan.class))
|
for (TextStyleSpan prevSpan : text.getSpans(0, text.length(), TextStyleSpan.class))
|
||||||
text.removeSpan(prevSpan);
|
text.removeSpan(prevSpan);
|
||||||
for (TextStyleSpan.TextStyleRun run : MediaDataController.getTextStyleRuns(entities, messageText)) {
|
for (TextStyleSpan.TextStyleRun run : MediaDataController.getTextStyleRuns(entities, messageText, allowedFlags)) {
|
||||||
MediaDataController.addStyleToText(new TextStyleSpan(run), run.start, run.end, text, true);
|
MediaDataController.addStyleToText(new TextStyleSpan(run), run.start, run.end, text, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<TextStyleSpan.TextStyleRun> getTextStyleRuns(ArrayList<TLRPC.MessageEntity> entities, CharSequence text) {
|
public static ArrayList<TextStyleSpan.TextStyleRun> getTextStyleRuns(ArrayList<TLRPC.MessageEntity> entities, CharSequence text, int allowedFlags) {
|
||||||
ArrayList<TextStyleSpan.TextStyleRun> runs = new ArrayList<>();
|
ArrayList<TextStyleSpan.TextStyleRun> runs = new ArrayList<>();
|
||||||
ArrayList<TLRPC.MessageEntity> entitiesCopy = new ArrayList<>(entities);
|
ArrayList<TLRPC.MessageEntity> entitiesCopy = new ArrayList<>(entities);
|
||||||
|
|
||||||
|
@ -4654,6 +4667,8 @@ public class MediaDataController extends BaseController {
|
||||||
newRun.urlEntity = entity;
|
newRun.urlEntity = entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newRun.flags &= allowedFlags;
|
||||||
|
|
||||||
for (int b = 0, N2 = runs.size(); b < N2; b++) {
|
for (int b = 0, N2 = runs.size(); b < N2; b++) {
|
||||||
TextStyleSpan.TextStyleRun run = runs.get(b);
|
TextStyleSpan.TextStyleRun run = runs.get(b);
|
||||||
|
|
||||||
|
|
|
@ -98,9 +98,9 @@ public class MessageObject {
|
||||||
public CharSequence caption;
|
public CharSequence caption;
|
||||||
public MessageObject replyMessageObject;
|
public MessageObject replyMessageObject;
|
||||||
public int type = 1000;
|
public int type = 1000;
|
||||||
public boolean reactionsVisibleOnScreen;
|
|
||||||
public long reactionsLastCheckTime;
|
public long reactionsLastCheckTime;
|
||||||
public String customName;
|
public String customName;
|
||||||
|
public boolean reactionsChanged;
|
||||||
private int isRoundVideoCached;
|
private int isRoundVideoCached;
|
||||||
public long eventId;
|
public long eventId;
|
||||||
public int contentType;
|
public int contentType;
|
||||||
|
@ -6275,6 +6275,7 @@ public class MessageObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
reactionsChanged = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6308,6 +6309,7 @@ public class MessageObject {
|
||||||
action.user_id = UserConfig.getInstance(currentAccount).getClientUserId();
|
action.user_id = UserConfig.getInstance(currentAccount).getClientUserId();
|
||||||
action.reaction = reaction;
|
action.reaction = reaction;
|
||||||
}
|
}
|
||||||
|
reactionsChanged = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,6 @@ import android.util.SparseIntArray;
|
||||||
import androidx.collection.LongSparseArray;
|
import androidx.collection.LongSparseArray;
|
||||||
import androidx.core.app.NotificationManagerCompat;
|
import androidx.core.app.NotificationManagerCompat;
|
||||||
|
|
||||||
import com.google.android.exoplayer2.util.Log;
|
|
||||||
|
|
||||||
import org.telegram.SQLite.SQLiteCursor;
|
import org.telegram.SQLite.SQLiteCursor;
|
||||||
import org.telegram.messenger.support.LongSparseIntArray;
|
import org.telegram.messenger.support.LongSparseIntArray;
|
||||||
import org.telegram.messenger.support.LongSparseLongArray;
|
import org.telegram.messenger.support.LongSparseLongArray;
|
||||||
|
@ -136,10 +134,6 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
private int pollsToCheckSize;
|
private int pollsToCheckSize;
|
||||||
private long lastViewsCheckTime;
|
private long lastViewsCheckTime;
|
||||||
|
|
||||||
private LongSparseArray<SparseArray<MessageObject>> reactionsToCheck = new LongSparseArray<>();
|
|
||||||
private long lastReactionsCheckTime;
|
|
||||||
private LongSparseArray<List<Integer>> reactionsTempDialogs = new LongSparseArray<>();
|
|
||||||
|
|
||||||
public ArrayList<DialogFilter> dialogFilters = new ArrayList<>();
|
public ArrayList<DialogFilter> dialogFilters = new ArrayList<>();
|
||||||
public SparseArray<DialogFilter> dialogFiltersById = new SparseArray<>();
|
public SparseArray<DialogFilter> dialogFiltersById = new SparseArray<>();
|
||||||
private boolean loadingSuggestedFilters;
|
private boolean loadingSuggestedFilters;
|
||||||
|
@ -2610,7 +2604,6 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
channelViewsToSend.clear();
|
channelViewsToSend.clear();
|
||||||
pollsToCheck.clear();
|
pollsToCheck.clear();
|
||||||
pollsToCheckSize = 0;
|
pollsToCheckSize = 0;
|
||||||
reactionsToCheck.clear();
|
|
||||||
dialogsServerOnly.clear();
|
dialogsServerOnly.clear();
|
||||||
dialogsForward.clear();
|
dialogsForward.clear();
|
||||||
allDialogs.clear();
|
allDialogs.clear();
|
||||||
|
@ -2842,12 +2835,6 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
object.pollVisibleOnScreen = false;
|
object.pollVisibleOnScreen = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
array = reactionsToCheck.get(dialogId);
|
|
||||||
if (array != null) {
|
|
||||||
for (int i = 0; i < array.size(); i++) {
|
|
||||||
array.valueAt(i).reactionsVisibleOnScreen = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Utilities.stageQueue.postRunnable(() -> {
|
Utilities.stageQueue.postRunnable(() -> {
|
||||||
|
@ -5399,57 +5386,6 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int currentServerTime = getConnectionsManager().getCurrentTime();
|
int currentServerTime = getConnectionsManager().getCurrentTime();
|
||||||
if (Math.abs(System.currentTimeMillis() - lastReactionsCheckTime) >= 15000) {
|
|
||||||
lastReactionsCheckTime = System.currentTimeMillis();
|
|
||||||
if (reactionsToCheck.size() > 0) {
|
|
||||||
AndroidUtilities.runOnUIThread(() -> {
|
|
||||||
long time = SystemClock.elapsedRealtime();
|
|
||||||
for (int a = 0, N = reactionsToCheck.size(); a < N; a++) {
|
|
||||||
SparseArray<MessageObject> array = reactionsToCheck.valueAt(a);
|
|
||||||
if (array == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
reactionsTempDialogs.clear();
|
|
||||||
for (int b = 0, N2 = array.size(); b < N2; b++) {
|
|
||||||
MessageObject messageObject = array.valueAt(b);
|
|
||||||
List<Integer> ids = reactionsTempDialogs.get(messageObject.getDialogId());
|
|
||||||
if (ids == null) {
|
|
||||||
reactionsTempDialogs.put(messageObject.getDialogId(), ids = new ArrayList<>());
|
|
||||||
}
|
|
||||||
ids.add(messageObject.getId());
|
|
||||||
|
|
||||||
int timeout = 15000;
|
|
||||||
if (Math.abs(time - messageObject.reactionsLastCheckTime) < timeout) {
|
|
||||||
if (!messageObject.reactionsVisibleOnScreen) {
|
|
||||||
array.remove(messageObject.getId());
|
|
||||||
N2--;
|
|
||||||
b--;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
messageObject.reactionsLastCheckTime = time;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (array.size() == 0) {
|
|
||||||
reactionsToCheck.remove(reactionsToCheck.keyAt(a));
|
|
||||||
N--;
|
|
||||||
a--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < reactionsTempDialogs.size(); i++) {
|
|
||||||
TLRPC.TL_messages_getMessagesReactions req = new TLRPC.TL_messages_getMessagesReactions();
|
|
||||||
req.peer = getInputPeer(reactionsTempDialogs.keyAt(i));
|
|
||||||
req.id.addAll(reactionsTempDialogs.valueAt(i));
|
|
||||||
getConnectionsManager().sendRequest(req, (response, error) -> {
|
|
||||||
if (error == null) {
|
|
||||||
TLRPC.Updates updates = (TLRPC.Updates) response;
|
|
||||||
processUpdates(updates, false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Math.abs(System.currentTimeMillis() - lastViewsCheckTime) >= 5000) {
|
if (Math.abs(System.currentTimeMillis() - lastViewsCheckTime) >= 5000) {
|
||||||
lastViewsCheckTime = System.currentTimeMillis();
|
lastViewsCheckTime = System.currentTimeMillis();
|
||||||
if (channelViewsToSend.size() != 0) {
|
if (channelViewsToSend.size() != 0) {
|
||||||
|
@ -8607,26 +8543,22 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addToReactionsQueue(long dialogId, ArrayList<MessageObject> visibleObjects) {
|
public void loadReactionsForMessages(long dialogId, ArrayList<MessageObject> visibleObjects) {
|
||||||
SparseArray<MessageObject> array = reactionsToCheck.get(dialogId);
|
if (visibleObjects.isEmpty()) {
|
||||||
if (array == null) {
|
return;
|
||||||
reactionsToCheck.put(dialogId, array = new SparseArray<>());
|
|
||||||
}
|
}
|
||||||
for (int a = 0, N = array.size(); a < N; a++) {
|
TLRPC.TL_messages_getMessagesReactions req = new TLRPC.TL_messages_getMessagesReactions();
|
||||||
MessageObject object = array.valueAt(a);
|
req.peer = getInputPeer(dialogId);
|
||||||
object.reactionsVisibleOnScreen = false;
|
for (int i = 0; i < visibleObjects.size(); i++) {
|
||||||
}
|
MessageObject messageObject = visibleObjects.get(i);
|
||||||
int time = getConnectionsManager().getCurrentTime();
|
req.id.add(messageObject.getId());
|
||||||
for (int a = 0, N = visibleObjects.size(); a < N; a++) {
|
|
||||||
MessageObject messageObject = visibleObjects.get(a);
|
|
||||||
int id = messageObject.getId();
|
|
||||||
MessageObject object = array.get(id);
|
|
||||||
if (object != null) {
|
|
||||||
object.reactionsVisibleOnScreen = true;
|
|
||||||
} else {
|
|
||||||
array.put(id, messageObject);
|
|
||||||
}
|
}
|
||||||
|
getConnectionsManager().sendRequest(req, (response, error) -> {
|
||||||
|
if (error == null) {
|
||||||
|
TLRPC.Updates updates = (TLRPC.Updates) response;
|
||||||
|
processUpdates(updates, false);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addToPollsQueue(long dialogId, ArrayList<MessageObject> visibleObjects) {
|
public void addToPollsQueue(long dialogId, ArrayList<MessageObject> visibleObjects) {
|
||||||
|
@ -14044,7 +13976,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
return info.messages;
|
return info.messages;
|
||||||
}
|
}
|
||||||
TLRPC.Chat chat = getChat(-dialogId);
|
TLRPC.Chat chat = getChat(-dialogId);
|
||||||
if (!ChatObject.isChannel(chat) || chat.megagroup || chat.gigagroup) {
|
if (!ChatObject.isChannel(chat)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
info = new SponsoredMessagesInfo();
|
info = new SponsoredMessagesInfo();
|
||||||
|
@ -14926,7 +14858,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
}
|
}
|
||||||
|
|
||||||
public void markSponsoredAsRead(long dialog_id, MessageObject object) {
|
public void markSponsoredAsRead(long dialog_id, MessageObject object) {
|
||||||
sponsoredMessages.remove(dialog_id);
|
// sponsoredMessages.remove(dialog_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteMessagesRange(long dialogId, long channelId, int minDate, int maxDate, boolean forAll, Runnable callback) {
|
public void deleteMessagesRange(long dialogId, long channelId, int minDate, int maxDate, boolean forAll, Runnable callback) {
|
||||||
|
|
|
@ -2663,8 +2663,13 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TLRPC.TL_messages_sendReaction req = new TLRPC.TL_messages_sendReaction();
|
TLRPC.TL_messages_sendReaction req = new TLRPC.TL_messages_sendReaction();
|
||||||
|
if (messageObject.messageOwner.isThreadMessage) {
|
||||||
|
req.peer = getMessagesController().getInputPeer(messageObject.getFromChatId());
|
||||||
|
req.msg_id = messageObject.messageOwner.fwd_from.saved_from_msg_id;
|
||||||
|
} else {
|
||||||
req.peer = getMessagesController().getInputPeer(messageObject.getDialogId());
|
req.peer = getMessagesController().getInputPeer(messageObject.getDialogId());
|
||||||
req.msg_id = messageObject.getId();
|
req.msg_id = messageObject.getId();
|
||||||
|
}
|
||||||
if (reaction != null) {
|
if (reaction != null) {
|
||||||
req.reaction = reaction.toString();
|
req.reaction = reaction.toString();
|
||||||
req.flags |= 1;
|
req.flags |= 1;
|
||||||
|
|
|
@ -485,6 +485,14 @@ public class TLRPC {
|
||||||
photo_big = new TL_fileLocationToBeDeprecated();
|
photo_big = new TL_fileLocationToBeDeprecated();
|
||||||
photo_big.volume_id = -photo_id;
|
photo_big.volume_id = -photo_id;
|
||||||
photo_big.local_id = 'c';
|
photo_big.local_id = 'c';
|
||||||
|
|
||||||
|
if (stripped_thumb != null && Build.VERSION.SDK_INT >= 21) {
|
||||||
|
try {
|
||||||
|
strippedBitmap = new BitmapDrawable(ImageLoader.getStrippedPhotoBitmap(stripped_thumb, "b"));
|
||||||
|
} catch (Throwable e) {
|
||||||
|
FileLog.e(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void serializeToStream(AbstractSerializedData stream) {
|
public void serializeToStream(AbstractSerializedData stream) {
|
||||||
|
@ -30395,6 +30403,14 @@ public class TLRPC {
|
||||||
photo_big = new TL_fileLocationToBeDeprecated();
|
photo_big = new TL_fileLocationToBeDeprecated();
|
||||||
photo_big.volume_id = -photo_id;
|
photo_big.volume_id = -photo_id;
|
||||||
photo_big.local_id = 'c';
|
photo_big.local_id = 'c';
|
||||||
|
|
||||||
|
if (stripped_thumb != null && Build.VERSION.SDK_INT >= 21) {
|
||||||
|
try {
|
||||||
|
strippedBitmap = new BitmapDrawable(ImageLoader.getStrippedPhotoBitmap(stripped_thumb, "b"));
|
||||||
|
} catch (Throwable e) {
|
||||||
|
FileLog.e(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void serializeToStream(AbstractSerializedData stream) {
|
public void serializeToStream(AbstractSerializedData stream) {
|
||||||
|
@ -54106,6 +54122,7 @@ public class TLRPC {
|
||||||
if ((flags & 33554432) != 0) {
|
if ((flags & 33554432) != 0) {
|
||||||
stream.writeInt32(ttl_period);
|
stream.writeInt32(ttl_period);
|
||||||
}
|
}
|
||||||
|
writeAttachPath(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ import android.graphics.Rect;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.ViewTreeObserver;
|
import android.view.ViewTreeObserver;
|
||||||
|
@ -35,6 +36,8 @@ import android.widget.ScrollView;
|
||||||
import androidx.annotation.Keep;
|
import androidx.annotation.Keep;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.google.android.exoplayer2.util.Log;
|
||||||
|
|
||||||
import org.telegram.messenger.AndroidUtilities;
|
import org.telegram.messenger.AndroidUtilities;
|
||||||
import org.telegram.messenger.FileLog;
|
import org.telegram.messenger.FileLog;
|
||||||
import org.telegram.messenger.NotificationCenter;
|
import org.telegram.messenger.NotificationCenter;
|
||||||
|
|
|
@ -65,6 +65,8 @@ import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.UiThread;
|
import androidx.annotation.UiThread;
|
||||||
import androidx.core.graphics.ColorUtils;
|
import androidx.core.graphics.ColorUtils;
|
||||||
|
|
||||||
|
import com.google.android.exoplayer2.util.Log;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -7525,7 +7527,9 @@ public class Theme {
|
||||||
try {
|
try {
|
||||||
String[] wallpaperLink = new String[1];
|
String[] wallpaperLink = new String[1];
|
||||||
HashMap<String, Integer> colors = getThemeFileValues(new File(pathToFile), null, wallpaperLink);
|
HashMap<String, Integer> colors = getThemeFileValues(new File(pathToFile), null, wallpaperLink);
|
||||||
|
if (accent != null) {
|
||||||
checkIsDark(colors, accent.parentTheme);
|
checkIsDark(colors, accent.parentTheme);
|
||||||
|
}
|
||||||
Integer wallpaperFileOffset = colors.get("wallpaperFileOffset");
|
Integer wallpaperFileOffset = colors.get("wallpaperFileOffset");
|
||||||
Bitmap bitmap = Bitmaps.createBitmap(560, 678, Bitmap.Config.ARGB_8888);
|
Bitmap bitmap = Bitmaps.createBitmap(560, 678, Bitmap.Config.ARGB_8888);
|
||||||
Canvas canvas = new Canvas(bitmap);
|
Canvas canvas = new Canvas(bitmap);
|
||||||
|
|
|
@ -8,6 +8,11 @@
|
||||||
|
|
||||||
package org.telegram.ui;
|
package org.telegram.ui;
|
||||||
|
|
||||||
|
import static org.telegram.messenger.MessageObject.POSITION_FLAG_BOTTOM;
|
||||||
|
import static org.telegram.messenger.MessageObject.POSITION_FLAG_LEFT;
|
||||||
|
import static org.telegram.messenger.MessageObject.POSITION_FLAG_RIGHT;
|
||||||
|
import static org.telegram.messenger.MessageObject.POSITION_FLAG_TOP;
|
||||||
|
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.AnimatorListenerAdapter;
|
import android.animation.AnimatorListenerAdapter;
|
||||||
import android.animation.AnimatorSet;
|
import android.animation.AnimatorSet;
|
||||||
|
@ -169,11 +174,6 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import static org.telegram.messenger.MessageObject.POSITION_FLAG_BOTTOM;
|
|
||||||
import static org.telegram.messenger.MessageObject.POSITION_FLAG_LEFT;
|
|
||||||
import static org.telegram.messenger.MessageObject.POSITION_FLAG_RIGHT;
|
|
||||||
import static org.telegram.messenger.MessageObject.POSITION_FLAG_TOP;
|
|
||||||
|
|
||||||
public class ArticleViewer implements NotificationCenter.NotificationCenterDelegate {
|
public class ArticleViewer implements NotificationCenter.NotificationCenterDelegate {
|
||||||
|
|
||||||
private Activity parentActivity;
|
private Activity parentActivity;
|
||||||
|
@ -5954,7 +5954,7 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
||||||
currentBlock = block;
|
currentBlock = block;
|
||||||
parentBlock = null;
|
parentBlock = null;
|
||||||
currentDocument = parentAdapter.getDocumentWithId(currentBlock.video_id);
|
currentDocument = parentAdapter.getDocumentWithId(currentBlock.video_id);
|
||||||
isGif = MessageObject.isGifDocument(currentDocument)/* && currentBlock.autoplay*/;
|
isGif = MessageObject.isVideoDocument(currentDocument) || MessageObject.isGifDocument(currentDocument)/* && currentBlock.autoplay*/;
|
||||||
isFirst = first;
|
isFirst = first;
|
||||||
channelCell.setVisibility(INVISIBLE);
|
channelCell.setVisibility(INVISIBLE);
|
||||||
updateButtonState(false);
|
updateButtonState(false);
|
||||||
|
|
|
@ -129,7 +129,6 @@ import org.telegram.ui.Components.SeekBar;
|
||||||
import org.telegram.ui.Components.SeekBarAccessibilityDelegate;
|
import org.telegram.ui.Components.SeekBarAccessibilityDelegate;
|
||||||
import org.telegram.ui.Components.SeekBarWaveform;
|
import org.telegram.ui.Components.SeekBarWaveform;
|
||||||
import org.telegram.ui.Components.SlotsDrawable;
|
import org.telegram.ui.Components.SlotsDrawable;
|
||||||
import org.telegram.ui.Components.spoilers.SpoilerEffect;
|
|
||||||
import org.telegram.ui.Components.StaticLayoutEx;
|
import org.telegram.ui.Components.StaticLayoutEx;
|
||||||
import org.telegram.ui.Components.TextStyleSpan;
|
import org.telegram.ui.Components.TextStyleSpan;
|
||||||
import org.telegram.ui.Components.TimerParticles;
|
import org.telegram.ui.Components.TimerParticles;
|
||||||
|
@ -139,6 +138,7 @@ import org.telegram.ui.Components.URLSpanBrowser;
|
||||||
import org.telegram.ui.Components.URLSpanMono;
|
import org.telegram.ui.Components.URLSpanMono;
|
||||||
import org.telegram.ui.Components.URLSpanNoUnderline;
|
import org.telegram.ui.Components.URLSpanNoUnderline;
|
||||||
import org.telegram.ui.Components.VideoForwardDrawable;
|
import org.telegram.ui.Components.VideoForwardDrawable;
|
||||||
|
import org.telegram.ui.Components.spoilers.SpoilerEffect;
|
||||||
import org.telegram.ui.PhotoViewer;
|
import org.telegram.ui.PhotoViewer;
|
||||||
import org.telegram.ui.PinchToZoomHelper;
|
import org.telegram.ui.PinchToZoomHelper;
|
||||||
import org.telegram.ui.SecretMediaViewer;
|
import org.telegram.ui.SecretMediaViewer;
|
||||||
|
@ -155,11 +155,14 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate, ImageReceiver.ImageReceiverDelegate, DownloadController.FileDownloadProgressListener, TextSelectionHelper.SelectableView, NotificationCenter.NotificationCenterDelegate {
|
public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate, ImageReceiver.ImageReceiverDelegate, DownloadController.FileDownloadProgressListener, TextSelectionHelper.SelectableView, NotificationCenter.NotificationCenterDelegate {
|
||||||
|
|
||||||
|
public boolean clipToGroupBounds;
|
||||||
|
|
||||||
public RadialProgress2 getRadialProgress() {
|
public RadialProgress2 getRadialProgress() {
|
||||||
return radialProgress;
|
return radialProgress;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean enterTransitionInPorgress;
|
boolean enterTransitionInPorgress;
|
||||||
|
|
||||||
public void setEnterTransitionInProgress(boolean b) {
|
public void setEnterTransitionInProgress(boolean b) {
|
||||||
enterTransitionInPorgress = b;
|
enterTransitionInPorgress = b;
|
||||||
invalidate();
|
invalidate();
|
||||||
|
@ -241,6 +244,15 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setScrimReaction(String scrimViewReaction) {
|
||||||
|
reactionsLayoutInBubble.setScrimReaction(scrimViewReaction);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawScrimReaction(Canvas canvas, String scrimViewReaction) {
|
||||||
|
reactionsLayoutInBubble.draw(canvas, transitionParams.animateChangeProgress, scrimViewReaction);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public interface ChatMessageCellDelegate {
|
public interface ChatMessageCellDelegate {
|
||||||
default void didPressUserAvatar(ChatMessageCell cell, TLRPC.User user, float touchX, float touchY) {
|
default void didPressUserAvatar(ChatMessageCell cell, TLRPC.User user, float touchX, float touchY) {
|
||||||
}
|
}
|
||||||
|
@ -1123,7 +1135,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
x -= textX - (block.isRtl() ? currentMessageObject.textXOffset : 0);
|
x -= textX - (block.isRtl() ? currentMessageObject.textXOffset : 0);
|
||||||
y -= block.textYOffset;
|
y -= block.textYOffset;
|
||||||
final int line = block.textLayout.getLineForVertical(y);
|
final int line = block.textLayout.getLineForVertical(y);
|
||||||
final int off = block.textLayout.getOffsetForHorizontal(line, x);
|
final int off = block.charactersOffset + block.textLayout.getOffsetForHorizontal(line, x);
|
||||||
|
|
||||||
final float left = block.textLayout.getLineLeft(line);
|
final float left = block.textLayout.getLineLeft(line);
|
||||||
if (left <= x && left + block.textLayout.getLineWidth(line) >= x) {
|
if (left <= x && left + block.textLayout.getLineWidth(line) >= x) {
|
||||||
|
@ -1147,6 +1159,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
try {
|
try {
|
||||||
LinkPath path = obtainNewUrlPath(false);
|
LinkPath path = obtainNewUrlPath(false);
|
||||||
int[] pos = getRealSpanStartAndEnd(buffer, pressedLink);
|
int[] pos = getRealSpanStartAndEnd(buffer, pressedLink);
|
||||||
|
pos[0] -= block.charactersOffset;
|
||||||
|
pos[1] -= block.charactersOffset;
|
||||||
path.setCurrentLayout(block.textLayout, pos[0], 0);
|
path.setCurrentLayout(block.textLayout, pos[0], 0);
|
||||||
block.textLayout.getSelectionPath(pos[0], pos[1], path);
|
block.textLayout.getSelectionPath(pos[0], pos[1], path);
|
||||||
if (pos[1] >= block.charactersEnd) {
|
if (pos[1] >= block.charactersEnd) {
|
||||||
|
@ -1163,8 +1177,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
path = obtainNewUrlPath(false);
|
path = obtainNewUrlPath(false);
|
||||||
path.setCurrentLayout(nextBlock.textLayout, 0, nextBlock.textYOffset - block.textYOffset);
|
path.setCurrentLayout(nextBlock.textLayout, 0, nextBlock.textYOffset - block.textYOffset);
|
||||||
nextBlock.textLayout.getSelectionPath(0, pos[1], path);
|
int p1 = pos[1] + block.charactersOffset - nextBlock.charactersOffset;
|
||||||
if (pos[1] < nextBlock.charactersEnd - 1) {
|
nextBlock.textLayout.getSelectionPath(0, p1, path);
|
||||||
|
if (p1 < nextBlock.charactersEnd - 1) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1184,9 +1199,11 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
path = obtainNewUrlPath(false);
|
path = obtainNewUrlPath(false);
|
||||||
offsetY -= nextBlock.height;
|
offsetY -= nextBlock.height;
|
||||||
path.setCurrentLayout(nextBlock.textLayout, pos[0], offsetY);
|
int p0 = pos[0] + block.charactersOffset - nextBlock.charactersOffset;
|
||||||
nextBlock.textLayout.getSelectionPath(pos[0], pos[1], path);
|
int p1 = pos[1] + block.charactersOffset - nextBlock.charactersOffset;
|
||||||
if (pos[0] > nextBlock.charactersOffset) {
|
path.setCurrentLayout(nextBlock.textLayout, p0, offsetY);
|
||||||
|
nextBlock.textLayout.getSelectionPath(p0, p1, path);
|
||||||
|
if (p0 > nextBlock.charactersOffset) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1896,7 +1913,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
currentMessageObject.audioProgress = p;
|
currentMessageObject.audioProgress = p;
|
||||||
updatePlayingMessageProgress();
|
updatePlayingMessageProgress();
|
||||||
} if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL) {
|
}
|
||||||
|
if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL) {
|
||||||
if (roundSeekbarTouched != 0) {
|
if (roundSeekbarTouched != 0) {
|
||||||
if (event.getAction() == MotionEvent.ACTION_UP) {
|
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||||
float localX = x - photoImage.getCenterX();
|
float localX = x - photoImage.getCenterX();
|
||||||
|
@ -2137,7 +2155,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
|
|
||||||
if (hasCaptionLayout() && x >= captionX && y >= captionY && x <= captionX + captionLayout.getWidth() && y <= captionY + captionLayout.getHeight()) {
|
if (hasCaptionLayout() && x >= captionX && y >= captionY && x <= captionX + captionLayout.getWidth() && y <= captionY + captionLayout.getHeight()) {
|
||||||
for (SpoilerEffect eff : captionSpoilers) {
|
for (SpoilerEffect eff : captionSpoilers) {
|
||||||
if (eff.getBounds().contains((int)(x - captionX), (int)(y - captionY))) {
|
if (eff.getBounds().contains((int) (x - captionX), (int) (y - captionY))) {
|
||||||
spoilerPressed = eff;
|
spoilerPressed = eff;
|
||||||
isCaptionSpoilerPressed = true;
|
isCaptionSpoilerPressed = true;
|
||||||
return true;
|
return true;
|
||||||
|
@ -2166,7 +2184,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
float rad = (float) Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2));
|
float rad = (float) Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2));
|
||||||
|
|
||||||
isSpoilerRevealing = true;
|
isSpoilerRevealing = true;
|
||||||
spoilerPressed.setOnRippleEndCallback(()->post(()->{
|
spoilerPressed.setOnRippleEndCallback(() -> post(() -> {
|
||||||
isSpoilerRevealing = false;
|
isSpoilerRevealing = false;
|
||||||
getMessageObject().isSpoilersRevealed = true;
|
getMessageObject().isSpoilersRevealed = true;
|
||||||
if (isCaptionSpoilerPressed) {
|
if (isCaptionSpoilerPressed) {
|
||||||
|
@ -2198,7 +2216,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
ChatMessageCell cell = (ChatMessageCell) ch;
|
ChatMessageCell cell = (ChatMessageCell) ch;
|
||||||
if (cell.getMessageObject() != null && cell.getMessageObject().getReplyMsgId() == getMessageObject().getId()) {
|
if (cell.getMessageObject() != null && cell.getMessageObject().getReplyMsgId() == getMessageObject().getId()) {
|
||||||
if (!cell.replySpoilers.isEmpty()) {
|
if (!cell.replySpoilers.isEmpty()) {
|
||||||
cell.replySpoilers.get(0).setOnRippleEndCallback(()->post(()->{
|
cell.replySpoilers.get(0).setOnRippleEndCallback(() -> post(() -> {
|
||||||
cell.getMessageObject().replyMessageObject.isSpoilersRevealed = true;
|
cell.getMessageObject().replyMessageObject.isSpoilersRevealed = true;
|
||||||
cell.replySpoilers.clear();
|
cell.replySpoilers.clear();
|
||||||
cell.invalidate();
|
cell.invalidate();
|
||||||
|
@ -2841,7 +2859,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
this.parentViewTopOffset = parentOffset;
|
this.parentViewTopOffset = parentOffset;
|
||||||
parentHeight = parent;
|
parentHeight = parent;
|
||||||
}
|
}
|
||||||
if (currentMessageObject != null && (hasGradientService() && currentMessageObject.shouldDrawWithoutBackground() || drawSideButton != 0 || !botButtons.isEmpty()) ) {
|
if (currentMessageObject != null && (hasGradientService() && currentMessageObject.shouldDrawWithoutBackground() || drawSideButton != 0 || !botButtons.isEmpty())) {
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3580,6 +3598,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
photoImage.setMediaStartEndTime(-1, -1);
|
photoImage.setMediaStartEndTime(-1, -1);
|
||||||
boolean canChangeRadius = true;
|
boolean canChangeRadius = true;
|
||||||
|
|
||||||
|
|
||||||
|
if (messageIdChanged || messageObject.reactionsChanged) {
|
||||||
|
messageObject.reactionsChanged = false;
|
||||||
if (currentPosition == null || ((currentPosition.flags & MessageObject.POSITION_FLAG_BOTTOM) != 0)) {
|
if (currentPosition == null || ((currentPosition.flags & MessageObject.POSITION_FLAG_BOTTOM) != 0)) {
|
||||||
if (currentPosition != null) {
|
if (currentPosition != null) {
|
||||||
reactionsLayoutInBubble.setMessage(groupedMessages.findPrimaryMessageObject(), !messageObject.shouldDrawReactionsInLayout(), resourcesProvider);
|
reactionsLayoutInBubble.setMessage(groupedMessages.findPrimaryMessageObject(), !messageObject.shouldDrawReactionsInLayout(), resourcesProvider);
|
||||||
|
@ -3589,6 +3610,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
} else {
|
} else {
|
||||||
reactionsLayoutInBubble.setMessage(null, false, resourcesProvider);
|
reactionsLayoutInBubble.setMessage(null, false, resourcesProvider);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (messageChanged) {
|
if (messageChanged) {
|
||||||
firstVisibleBlockNum = 0;
|
firstVisibleBlockNum = 0;
|
||||||
|
@ -4515,7 +4538,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
currentPhotoFilterThumb = String.format(Locale.US, "%d_%d_b", w, h);
|
currentPhotoFilterThumb = String.format(Locale.US, "%d_%d_b", w, h);
|
||||||
|
|
||||||
if (webDocument != null) {
|
if (webDocument != null) {
|
||||||
/*TODO*/photoImage.setImage(ImageLocation.getForWebFile(webDocument), currentPhotoFilter, null, null, webDocument.size, null, messageObject, 1);
|
/*TODO*/
|
||||||
|
photoImage.setImage(ImageLocation.getForWebFile(webDocument), currentPhotoFilter, null, null, webDocument.size, null, messageObject, 1);
|
||||||
} else {
|
} else {
|
||||||
if (documentAttachType == DOCUMENT_ATTACH_TYPE_WALLPAPER) {
|
if (documentAttachType == DOCUMENT_ATTACH_TYPE_WALLPAPER) {
|
||||||
if (messageObject.mediaExists) {
|
if (messageObject.mediaExists) {
|
||||||
|
@ -4548,13 +4572,16 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
photoImage.setAllowDecodeSingleFrame(true);
|
photoImage.setAllowDecodeSingleFrame(true);
|
||||||
photoImage.setAllowStartAnimation(true);
|
photoImage.setAllowStartAnimation(true);
|
||||||
photoImage.startAnimation();
|
photoImage.startAnimation();
|
||||||
/*TODO*/photoImage.setImage(ImageLocation.getForDocument(documentAttach), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForDocument(currentPhotoObjectThumb, documentAttach), currentPhotoFilterThumb, null, documentAttach.size, null, messageObject, 0);
|
/*TODO*/
|
||||||
|
photoImage.setImage(ImageLocation.getForDocument(documentAttach), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForDocument(currentPhotoObjectThumb, documentAttach), currentPhotoFilterThumb, null, documentAttach.size, null, messageObject, 0);
|
||||||
autoPlayingMedia = true;
|
autoPlayingMedia = true;
|
||||||
} else {
|
} else {
|
||||||
if (currentPhotoObjectThumb != null) {
|
if (currentPhotoObjectThumb != null) {
|
||||||
/*TODO*/photoImage.setImage(ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, 0, null, messageObject, 0);
|
/*TODO*/
|
||||||
|
photoImage.setImage(ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, 0, null, messageObject, 0);
|
||||||
} else {
|
} else {
|
||||||
/*TODO*/photoImage.setImage(null, null, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoObject instanceof TLRPC.TL_photoStrippedSize || "s".equals(currentPhotoObject.type) ? currentPhotoFilterThumb : currentPhotoFilter, 0, null, messageObject, 0);
|
/*TODO*/
|
||||||
|
photoImage.setImage(null, null, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoObject instanceof TLRPC.TL_photoStrippedSize || "s".equals(currentPhotoObject.type) ? currentPhotoFilterThumb : currentPhotoFilter, 0, null, messageObject, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (documentAttachType == DOCUMENT_ATTACH_TYPE_GIF || documentAttachType == DOCUMENT_ATTACH_TYPE_ROUND) {
|
} else if (documentAttachType == DOCUMENT_ATTACH_TYPE_GIF || documentAttachType == DOCUMENT_ATTACH_TYPE_ROUND) {
|
||||||
|
@ -4572,23 +4599,28 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
autoPlayingMedia = true;
|
autoPlayingMedia = true;
|
||||||
TLRPC.VideoSize videoSize = MessageObject.getDocumentVideoThumb(document);
|
TLRPC.VideoSize videoSize = MessageObject.getDocumentVideoThumb(document);
|
||||||
if (!messageObject.mediaExists && videoSize != null && (currentPhotoObject == null || currentPhotoObjectThumb == null)) {
|
if (!messageObject.mediaExists && videoSize != null && (currentPhotoObject == null || currentPhotoObjectThumb == null)) {
|
||||||
/*TODO*/photoImage.setImage(ImageLocation.getForDocument(document), document.size < 1024 * 32 ? null : ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForDocument(videoSize, documentAttach), null, ImageLocation.getForDocument(currentPhotoObject != null ? currentPhotoObject : currentPhotoObjectThumb, documentAttach), currentPhotoObject != null ? filter : currentPhotoFilterThumb, null, document.size, null, messageObject, 0);
|
/*TODO*/
|
||||||
|
photoImage.setImage(ImageLocation.getForDocument(document), document.size < 1024 * 32 ? null : ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForDocument(videoSize, documentAttach), null, ImageLocation.getForDocument(currentPhotoObject != null ? currentPhotoObject : currentPhotoObjectThumb, documentAttach), currentPhotoObject != null ? filter : currentPhotoFilterThumb, null, document.size, null, messageObject, 0);
|
||||||
} else {
|
} else {
|
||||||
/*TODO*/photoImage.setImage(ImageLocation.getForDocument(document), document.size < 1024 * 32 ? null : ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForDocument(currentPhotoObject, documentAttach), filter, ImageLocation.getForDocument(currentPhotoObjectThumb, documentAttach), currentPhotoFilterThumb, null, document.size, null, messageObject, 0);
|
/*TODO*/
|
||||||
|
photoImage.setImage(ImageLocation.getForDocument(document), document.size < 1024 * 32 ? null : ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForDocument(currentPhotoObject, documentAttach), filter, ImageLocation.getForDocument(currentPhotoObjectThumb, documentAttach), currentPhotoFilterThumb, null, document.size, null, messageObject, 0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/*TODO*/photoImage.setImage(null, null, ImageLocation.getForDocument(currentPhotoObject, documentAttach), filter, 0, null, currentMessageObject, 0);
|
/*TODO*/
|
||||||
|
photoImage.setImage(null, null, ImageLocation.getForDocument(currentPhotoObject, documentAttach), filter, 0, null, currentMessageObject, 0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
boolean photoExist = messageObject.mediaExists;
|
boolean photoExist = messageObject.mediaExists;
|
||||||
String fileName = FileLoader.getAttachFileName(currentPhotoObject);
|
String fileName = FileLoader.getAttachFileName(currentPhotoObject);
|
||||||
if (hasGamePreview || photoExist || DownloadController.getInstance(currentAccount).canDownloadMedia(currentMessageObject) || FileLoader.getInstance(currentAccount).isLoadingFile(fileName)) {
|
if (hasGamePreview || photoExist || DownloadController.getInstance(currentAccount).canDownloadMedia(currentMessageObject) || FileLoader.getInstance(currentAccount).isLoadingFile(fileName)) {
|
||||||
photoNotSet = false;
|
photoNotSet = false;
|
||||||
/*TODO*/photoImage.setImage(ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, 0, null, messageObject, 0);
|
/*TODO*/
|
||||||
|
photoImage.setImage(ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, 0, null, messageObject, 0);
|
||||||
} else {
|
} else {
|
||||||
photoNotSet = true;
|
photoNotSet = true;
|
||||||
if (currentPhotoObjectThumb != null) {
|
if (currentPhotoObjectThumb != null) {
|
||||||
/*TODO*/photoImage.setImage(null, null, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), String.format(Locale.US, "%d_%d_b", w, h), 0, null, messageObject, 0);
|
/*TODO*/
|
||||||
|
photoImage.setImage(null, null, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), String.format(Locale.US, "%d_%d_b", w, h), 0, null, messageObject, 0);
|
||||||
} else {
|
} else {
|
||||||
photoImage.setImageBitmap((Drawable) null);
|
photoImage.setImageBitmap((Drawable) null);
|
||||||
}
|
}
|
||||||
|
@ -5285,7 +5317,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!reactionsLayoutInBubble.isSmall && !reactionsLayoutInBubble.isEmpty) {
|
if (!reactionsLayoutInBubble.isSmall && !reactionsLayoutInBubble.isEmpty) {
|
||||||
// reactionsLayoutInBubble.positionOffsetY += AndroidUtilities.dp(12);
|
if (captionLayout != null && currentPosition != null && currentMessagesGroup != null && currentMessagesGroup.isDocuments) {
|
||||||
|
reactionsLayoutInBubble.positionOffsetY += AndroidUtilities.dp(10);
|
||||||
|
}
|
||||||
reactionsLayoutInBubble.totalHeight = reactionsLayoutInBubble.height + AndroidUtilities.dp(8);
|
reactionsLayoutInBubble.totalHeight = reactionsLayoutInBubble.height + AndroidUtilities.dp(8);
|
||||||
measureTime(messageObject);
|
measureTime(messageObject);
|
||||||
int timeLeft = backgroundWidth - reactionsLayoutInBubble.lastLineX - AndroidUtilities.dp(24);
|
int timeLeft = backgroundWidth - reactionsLayoutInBubble.lastLineX - AndroidUtilities.dp(24);
|
||||||
|
@ -5850,7 +5884,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
} else {
|
} else {
|
||||||
minCaptionWidth = (int) (Math.min(getParentWidth(), AndroidUtilities.displaySize.y) * 0.65f);
|
minCaptionWidth = (int) (Math.min(getParentWidth(), AndroidUtilities.displaySize.y) * 0.65f);
|
||||||
}
|
}
|
||||||
if (!messageObject.needDrawBluredPreview() && (currentCaption != null || (!reactionsLayoutInBubble.isEmpty && !reactionsLayoutInBubble.isSmall) && photoWidth < minCaptionWidth)) {
|
if (!messageObject.needDrawBluredPreview() && (currentCaption != null || (!reactionsLayoutInBubble.isEmpty && !reactionsLayoutInBubble.isSmall)) && photoWidth < minCaptionWidth) {
|
||||||
widthForCaption = minCaptionWidth;
|
widthForCaption = minCaptionWidth;
|
||||||
fixPhotoWidth = true;
|
fixPhotoWidth = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -6024,13 +6058,15 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
TLRPC.Document document = messageObject.getDocument();
|
TLRPC.Document document = messageObject.getDocument();
|
||||||
|
|
||||||
if (currentMessageObject.videoEditedInfo != null && currentMessageObject.videoEditedInfo.canAutoPlaySourceVideo()) {
|
if (currentMessageObject.videoEditedInfo != null && currentMessageObject.videoEditedInfo.canAutoPlaySourceVideo()) {
|
||||||
/*TODO*/photoImage.setImage(ImageLocation.getForPath(currentMessageObject.videoEditedInfo.originalPath), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForDocument(currentPhotoObjectThumb, document), currentPhotoFilterThumb, null, messageObject.getDocument().size, null, messageObject, 0);
|
/*TODO*/
|
||||||
|
photoImage.setImage(ImageLocation.getForPath(currentMessageObject.videoEditedInfo.originalPath), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForDocument(currentPhotoObjectThumb, document), currentPhotoFilterThumb, null, messageObject.getDocument().size, null, messageObject, 0);
|
||||||
photoImage.setMediaStartEndTime(currentMessageObject.videoEditedInfo.startTime / 1000, currentMessageObject.videoEditedInfo.endTime / 1000);
|
photoImage.setMediaStartEndTime(currentMessageObject.videoEditedInfo.startTime / 1000, currentMessageObject.videoEditedInfo.endTime / 1000);
|
||||||
} else {
|
} else {
|
||||||
if (!messageIdChanged && !dataChanged) {
|
if (!messageIdChanged && !dataChanged) {
|
||||||
photoImage.setCrossfadeWithOldImage(true);
|
photoImage.setCrossfadeWithOldImage(true);
|
||||||
}
|
}
|
||||||
/*TODO*/photoImage.setImage(ImageLocation.getForDocument(document), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForDocument(currentPhotoObjectThumb, document), currentPhotoFilterThumb, null, messageObject.getDocument().size, null, messageObject, 0);
|
/*TODO*/
|
||||||
|
photoImage.setImage(ImageLocation.getForDocument(document), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForDocument(currentPhotoObjectThumb, document), currentPhotoFilterThumb, null, messageObject.getDocument().size, null, messageObject, 0);
|
||||||
}
|
}
|
||||||
} else if (messageObject.type == MessageObject.TYPE_PHOTO) {
|
} else if (messageObject.type == MessageObject.TYPE_PHOTO) {
|
||||||
if (messageObject.useCustomPhoto) {
|
if (messageObject.useCustomPhoto) {
|
||||||
|
@ -6081,45 +6117,55 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
photoImage.setCrossfadeDuration(250);
|
photoImage.setCrossfadeDuration(250);
|
||||||
}
|
}
|
||||||
if (localFile == 0 && videoSize != null && (currentPhotoObject == null || currentPhotoObjectThumb == null)) {
|
if (localFile == 0 && videoSize != null && (currentPhotoObject == null || currentPhotoObjectThumb == null)) {
|
||||||
/*TODO*/photoImage.setImage(ImageLocation.getForDocument(document), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForDocument(videoSize, documentAttach), null, ImageLocation.getForDocument(currentPhotoObject != null ? currentPhotoObject : currentPhotoObjectThumb, documentAttach), currentPhotoObject != null ? currentPhotoFilter : currentPhotoFilterThumb, null, document.size, null, messageObject, 0);
|
/*TODO*/
|
||||||
|
photoImage.setImage(ImageLocation.getForDocument(document), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForDocument(videoSize, documentAttach), null, ImageLocation.getForDocument(currentPhotoObject != null ? currentPhotoObject : currentPhotoObjectThumb, documentAttach), currentPhotoObject != null ? currentPhotoFilter : currentPhotoFilterThumb, null, document.size, null, messageObject, 0);
|
||||||
} else {
|
} else {
|
||||||
if (isRoundVideo && !messageIdChanged && photoImage.hasStaticThumb()) {
|
if (isRoundVideo && !messageIdChanged && photoImage.hasStaticThumb()) {
|
||||||
/*TODO*/photoImage.setImage(ImageLocation.getForDocument(document), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, null, null, photoImage.getStaticThumb(), document.size, null, messageObject, 0);
|
/*TODO*/
|
||||||
|
photoImage.setImage(ImageLocation.getForDocument(document), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, null, null, photoImage.getStaticThumb(), document.size, null, messageObject, 0);
|
||||||
} else {
|
} else {
|
||||||
/*TODO*/photoImage.setImage(ImageLocation.getForDocument(document), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, null, document.size, null, messageObject, 0);
|
/*TODO*/
|
||||||
|
photoImage.setImage(ImageLocation.getForDocument(document), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, null, document.size, null, messageObject, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (localFile == 1) {
|
} else if (localFile == 1) {
|
||||||
/*TODO*/photoImage.setImage(ImageLocation.getForPath(messageObject.isSendError() ? null : messageObject.messageOwner.attachPath), null, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, null, 0, null, messageObject, 0);
|
/*TODO*/
|
||||||
|
photoImage.setImage(ImageLocation.getForPath(messageObject.isSendError() ? null : messageObject.messageOwner.attachPath), null, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, null, 0, null, messageObject, 0);
|
||||||
} else {
|
} else {
|
||||||
if (videoSize != null && (currentPhotoObject == null || currentPhotoObjectThumb == null)) {
|
if (videoSize != null && (currentPhotoObject == null || currentPhotoObjectThumb == null)) {
|
||||||
/*TODO*/photoImage.setImage(ImageLocation.getForDocument(document), null, ImageLocation.getForDocument(videoSize, documentAttach), null, ImageLocation.getForDocument(currentPhotoObject != null ? currentPhotoObject : currentPhotoObjectThumb, documentAttach), currentPhotoObject != null ? currentPhotoFilter : currentPhotoFilterThumb, null, document.size, null, messageObject, 0);
|
/*TODO*/
|
||||||
|
photoImage.setImage(ImageLocation.getForDocument(document), null, ImageLocation.getForDocument(videoSize, documentAttach), null, ImageLocation.getForDocument(currentPhotoObject != null ? currentPhotoObject : currentPhotoObjectThumb, documentAttach), currentPhotoObject != null ? currentPhotoFilter : currentPhotoFilterThumb, null, document.size, null, messageObject, 0);
|
||||||
} else {
|
} else {
|
||||||
/*TODO*/photoImage.setImage(ImageLocation.getForDocument(document), null, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, null, document.size, null, messageObject, 0);
|
/*TODO*/
|
||||||
|
photoImage.setImage(ImageLocation.getForDocument(document), null, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, null, document.size, null, messageObject, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (messageObject.videoEditedInfo != null && messageObject.type == MessageObject.TYPE_ROUND_VIDEO && !currentMessageObject.needDrawBluredPreview()) {
|
if (messageObject.videoEditedInfo != null && messageObject.type == MessageObject.TYPE_ROUND_VIDEO && !currentMessageObject.needDrawBluredPreview()) {
|
||||||
/*TODO*/photoImage.setImage(ImageLocation.getForPath(messageObject.videoEditedInfo.originalPath), currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, 0, null, messageObject, 0);
|
/*TODO*/
|
||||||
|
photoImage.setImage(ImageLocation.getForPath(messageObject.videoEditedInfo.originalPath), currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, 0, null, messageObject, 0);
|
||||||
photoImage.setMediaStartEndTime(currentMessageObject.videoEditedInfo.startTime / 1000, currentMessageObject.videoEditedInfo.endTime / 1000);
|
photoImage.setMediaStartEndTime(currentMessageObject.videoEditedInfo.startTime / 1000, currentMessageObject.videoEditedInfo.endTime / 1000);
|
||||||
} else {
|
} else {
|
||||||
if (!messageIdChanged && !currentMessageObject.needDrawBluredPreview()) {
|
if (!messageIdChanged && !currentMessageObject.needDrawBluredPreview()) {
|
||||||
photoImage.setCrossfadeWithOldImage(true);
|
photoImage.setCrossfadeWithOldImage(true);
|
||||||
photoImage.setCrossfadeDuration(250);
|
photoImage.setCrossfadeDuration(250);
|
||||||
}
|
}
|
||||||
/*TODO*/photoImage.setImage(ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, 0, null, messageObject, 0);
|
/*TODO*/
|
||||||
|
photoImage.setImage(ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, 0, null, messageObject, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (messageObject.videoEditedInfo != null && messageObject.type == MessageObject.TYPE_ROUND_VIDEO && !currentMessageObject.needDrawBluredPreview()) {
|
if (messageObject.videoEditedInfo != null && messageObject.type == MessageObject.TYPE_ROUND_VIDEO && !currentMessageObject.needDrawBluredPreview()) {
|
||||||
/*TODO*/photoImage.setImage(ImageLocation.getForPath(messageObject.videoEditedInfo.originalPath), currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, 0, null, messageObject, currentMessageObject.shouldEncryptPhotoOrVideo() ? 2 : 0);
|
/*TODO*/
|
||||||
|
photoImage.setImage(ImageLocation.getForPath(messageObject.videoEditedInfo.originalPath), currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, 0, null, messageObject, currentMessageObject.shouldEncryptPhotoOrVideo() ? 2 : 0);
|
||||||
photoImage.setMediaStartEndTime(currentMessageObject.videoEditedInfo.startTime / 1000, currentMessageObject.videoEditedInfo.endTime / 1000);
|
photoImage.setMediaStartEndTime(currentMessageObject.videoEditedInfo.startTime / 1000, currentMessageObject.videoEditedInfo.endTime / 1000);
|
||||||
} else {
|
} else {
|
||||||
if (!messageIdChanged && !currentMessageObject.needDrawBluredPreview()) {
|
if (!messageIdChanged && !currentMessageObject.needDrawBluredPreview()) {
|
||||||
photoImage.setCrossfadeWithOldImage(true);
|
photoImage.setCrossfadeWithOldImage(true);
|
||||||
photoImage.setCrossfadeDuration(250);
|
photoImage.setCrossfadeDuration(250);
|
||||||
}
|
}
|
||||||
/*TODO*/photoImage.setImage(ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, 0, null, messageObject, currentMessageObject.shouldEncryptPhotoOrVideo() ? 2 : 0);
|
/*TODO*/
|
||||||
|
photoImage.setImage(ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, 0, null, messageObject, currentMessageObject.shouldEncryptPhotoOrVideo() ? 2 : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7313,6 +7359,12 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
} else {
|
} else {
|
||||||
str = LocaleController.getString("InstantView", R.string.InstantView);
|
str = LocaleController.getString("InstantView", R.string.InstantView);
|
||||||
}
|
}
|
||||||
|
if (currentMessageObject.isSponsored()) {
|
||||||
|
int buttonWidth = (int) (Theme.chat_instantViewPaint.measureText(str) + AndroidUtilities.dp(10 + 24 + 10 + 31));
|
||||||
|
if (backgroundWidth < buttonWidth) {
|
||||||
|
backgroundWidth = buttonWidth;
|
||||||
|
}
|
||||||
|
}
|
||||||
int mWidth = backgroundWidth - AndroidUtilities.dp(10 + 24 + 10 + 31);
|
int mWidth = backgroundWidth - AndroidUtilities.dp(10 + 24 + 10 + 31);
|
||||||
instantViewLayout = new StaticLayout(TextUtils.ellipsize(str, Theme.chat_instantViewPaint, mWidth, TextUtils.TruncateAt.END), Theme.chat_instantViewPaint, mWidth + AndroidUtilities.dp(2), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
instantViewLayout = new StaticLayout(TextUtils.ellipsize(str, Theme.chat_instantViewPaint, mWidth, TextUtils.TruncateAt.END), Theme.chat_instantViewPaint, mWidth + AndroidUtilities.dp(2), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||||
if (drawInstantViewType == 8) {
|
if (drawInstantViewType == 8) {
|
||||||
|
@ -7398,6 +7450,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
|
|
||||||
int lastSize;
|
int lastSize;
|
||||||
|
|
||||||
@SuppressLint("DrawAllocation")
|
@SuppressLint("DrawAllocation")
|
||||||
@Override
|
@Override
|
||||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||||
|
@ -7638,7 +7691,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
} else {
|
} else {
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
} else if (!drawPause && roundToPauseProgress != 0f){
|
} else if (!drawPause && roundToPauseProgress != 0f) {
|
||||||
roundToPauseProgress -= 16 / 150f;
|
roundToPauseProgress -= 16 / 150f;
|
||||||
if (roundToPauseProgress < 0) {
|
if (roundToPauseProgress < 0) {
|
||||||
roundToPauseProgress = 0f;
|
roundToPauseProgress = 0f;
|
||||||
|
@ -7654,7 +7707,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
} else {
|
} else {
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
} else if (!drawTouchedSeekbar && roundToPauseProgress2 != 0f){
|
} else if (!drawTouchedSeekbar && roundToPauseProgress2 != 0f) {
|
||||||
roundToPauseProgress2 -= 16 / 150f;
|
roundToPauseProgress2 -= 16 / 150f;
|
||||||
if (roundToPauseProgress2 < 0) {
|
if (roundToPauseProgress2 < 0) {
|
||||||
roundToPauseProgress2 = 0f;
|
roundToPauseProgress2 = 0f;
|
||||||
|
@ -8072,7 +8125,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
toSeekBarProgress = 1f;
|
toSeekBarProgress = 1f;
|
||||||
}
|
}
|
||||||
invalidate();
|
invalidate();
|
||||||
} else if (!showSeekbar && toSeekBarProgress != 0){
|
} else if (!showSeekbar && toSeekBarProgress != 0) {
|
||||||
toSeekBarProgress -= 16f / 100f;
|
toSeekBarProgress -= 16f / 100f;
|
||||||
if (toSeekBarProgress < 0) {
|
if (toSeekBarProgress < 0) {
|
||||||
toSeekBarProgress = 0;
|
toSeekBarProgress = 0;
|
||||||
|
@ -8184,7 +8237,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
updateCaptionLayout();
|
updateCaptionLayout();
|
||||||
}
|
}
|
||||||
updateReactionLayoutPosition();
|
updateReactionLayoutPosition();
|
||||||
if (!currentMessageObject.preview && (currentPosition == null || currentMessagesGroup != null && currentMessagesGroup.isDocuments) && !transitionParams.animateBackgroundBoundsInner && !(enterTransitionInPorgress && currentMessageObject.isVoice())) {
|
if (!currentMessageObject.preview && (currentPosition == null || (currentMessagesGroup != null && currentMessagesGroup.isDocuments && (currentPosition.flags & MessageObject.POSITION_FLAG_BOTTOM) == 0)) && !transitionParams.animateBackgroundBoundsInner && !(enterTransitionInPorgress && currentMessageObject.isVoice())) {
|
||||||
drawCaptionLayout(canvas, false, 1f);
|
drawCaptionLayout(canvas, false, 1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8521,7 +8574,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
int size = AndroidUtilities.dp(48);
|
int size = AndroidUtilities.dp(48);
|
||||||
buttonX = this.buttonX = (int) (photoImage.getImageX() + (photoImage.getImageWidth() - size) / 2.0f);
|
buttonX = this.buttonX = (int) (photoImage.getImageX() + (photoImage.getImageWidth() - size) / 2.0f);
|
||||||
buttonY = this.buttonY = (int) (photoImage.getImageY() + (photoImage.getImageHeight() - size) / 2.0f);
|
buttonY = this.buttonY = (int) (photoImage.getImageY() + (photoImage.getImageHeight() - size) / 2.0f);
|
||||||
radialProgress.setProgressRect((int) buttonX, (int ) buttonY, (int) buttonX + size, (int) buttonY + size);
|
radialProgress.setProgressRect((int) buttonX, (int) buttonY, (int) buttonX + size, (int) buttonY + size);
|
||||||
}
|
}
|
||||||
if (delegate == null || delegate.getPinchToZoomHelper() == null || !delegate.getPinchToZoomHelper().isInOverlayModeFor(this)) {
|
if (delegate == null || delegate.getPinchToZoomHelper() == null || !delegate.getPinchToZoomHelper().isInOverlayModeFor(this)) {
|
||||||
if (alpha != 1f) {
|
if (alpha != 1f) {
|
||||||
|
@ -9740,7 +9793,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
if (setCurrentDiceValue(!memCache && !currentMessageObject.wasUnread)) {
|
if (setCurrentDiceValue(!memCache && !currentMessageObject.wasUnread)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!thumb && !currentMessageObject.mediaExists && !currentMessageObject.attachPathExists && (currentMessageObject.type == 0 && (documentAttachType == DOCUMENT_ATTACH_TYPE_WALLPAPER || documentAttachType == DOCUMENT_ATTACH_TYPE_NONE || documentAttachType == DOCUMENT_ATTACH_TYPE_STICKER) || currentMessageObject.type == MessageObject.TYPE_PHOTO)){
|
if (!thumb && !currentMessageObject.mediaExists && !currentMessageObject.attachPathExists && (currentMessageObject.type == 0 && (documentAttachType == DOCUMENT_ATTACH_TYPE_WALLPAPER || documentAttachType == DOCUMENT_ATTACH_TYPE_NONE || documentAttachType == DOCUMENT_ATTACH_TYPE_STICKER) || currentMessageObject.type == MessageObject.TYPE_PHOTO)) {
|
||||||
currentMessageObject.mediaExists = true;
|
currentMessageObject.mediaExists = true;
|
||||||
updateButtonState(false, true, false);
|
updateButtonState(false, true, false);
|
||||||
}
|
}
|
||||||
|
@ -10660,7 +10713,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDrawPinnedBottom() {
|
public boolean isDrawPinnedBottom() {
|
||||||
return mediaBackground || drawPinnedBottom;
|
boolean forceMediaByGroup = currentPosition != null && (currentPosition.flags & MessageObject.POSITION_FLAG_BOTTOM) == 0 && currentMessagesGroup.isDocuments;
|
||||||
|
return mediaBackground || drawPinnedBottom || forceMediaByGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawCheckBox(Canvas canvas) {
|
public void drawCheckBox(Canvas canvas) {
|
||||||
|
@ -10719,6 +10773,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
|
|
||||||
float transitionYOffsetForDrawables;
|
float transitionYOffsetForDrawables;
|
||||||
|
|
||||||
public void setDrawableBoundsInner(Drawable drawable, int x, int y, int w, int h) {
|
public void setDrawableBoundsInner(Drawable drawable, int x, int y, int w, int h) {
|
||||||
if (drawable != null) {
|
if (drawable != null) {
|
||||||
transitionYOffsetForDrawables = (y + h + transitionParams.deltaBottom) - ((int) (y + h + transitionParams.deltaBottom));
|
transitionYOffsetForDrawables = (y + h + transitionParams.deltaBottom) - ((int) (y + h + transitionParams.deltaBottom));
|
||||||
|
@ -10853,73 +10908,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!transitionParams.animateBackgroundBoundsInner) {
|
if (!clipToGroupBounds) {
|
||||||
if (!transitionParams.transitionBotButtons.isEmpty()) {
|
drawOutboundsContent(canvas);
|
||||||
drawBotButtons(canvas, transitionParams.transitionBotButtons, 1f - transitionParams.animateChangeProgress);
|
|
||||||
}
|
|
||||||
if (!botButtons.isEmpty()) {
|
|
||||||
drawBotButtons(canvas, botButtons, transitionParams.animateChangeProgress);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (drawSideButton != 0) {
|
|
||||||
if (currentMessageObject.isOutOwner()) {
|
|
||||||
sideStartX = getCurrentBackgroundLeft() - AndroidUtilities.dp(8 + 32);
|
|
||||||
if (currentMessagesGroup != null) {
|
|
||||||
sideStartX += currentMessagesGroup.transitionParams.offsetLeft - animationOffsetX;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sideStartX = currentBackgroundDrawable.getBounds().right + AndroidUtilities.dp(8);
|
|
||||||
if (currentMessagesGroup != null) {
|
|
||||||
sideStartX += currentMessagesGroup.transitionParams.offsetRight - animationOffsetX;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sideStartY = layoutHeight - AndroidUtilities.dp(41) + transitionParams.deltaBottom;
|
|
||||||
if (currentMessagesGroup != null) {
|
|
||||||
sideStartY += currentMessagesGroup.transitionParams.offsetBottom;
|
|
||||||
if (currentMessagesGroup.transitionParams.backgroundChangeBounds) {
|
|
||||||
sideStartY -= getTranslationY();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!currentMessageObject.isOutOwner() && isRoundVideo && isAvatarVisible) {
|
|
||||||
float offsetSize = (AndroidUtilities.roundPlayingMessageSize - AndroidUtilities.roundMessageSize) * 0.7f;
|
|
||||||
float offsetX = isPlayingRound ? offsetSize : 0;
|
|
||||||
if (transitionParams.animatePlayingRound) {
|
|
||||||
offsetX = (isPlayingRound ? transitionParams.animateChangeProgress : (1f - transitionParams.animateChangeProgress)) * offsetSize;
|
|
||||||
}
|
|
||||||
sideStartX -= offsetX;
|
|
||||||
}
|
|
||||||
if (drawSideButton == 3) {
|
|
||||||
if (!(enterTransitionInPorgress && !currentMessageObject.isVoice())) {
|
|
||||||
drawCommentButton(canvas, 1f);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
rect.set(sideStartX, sideStartY, sideStartX + AndroidUtilities.dp(32), sideStartY + AndroidUtilities.dp(32));
|
|
||||||
applyServiceShaderMatrix(getMeasuredWidth(), backgroundHeight, getX(), viewTop);
|
|
||||||
canvas.drawRoundRect(rect, AndroidUtilities.dp(16), AndroidUtilities.dp(16), getThemedPaint(sideButtonPressed ? Theme.key_paint_chatActionBackgroundSelected : Theme.key_paint_chatActionBackground));
|
|
||||||
if (hasGradientService()) {
|
|
||||||
canvas.drawRoundRect(rect, AndroidUtilities.dp(16), AndroidUtilities.dp(16), Theme.chat_actionBackgroundGradientDarkenPaint);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (drawSideButton == 2) {
|
|
||||||
Drawable goIconDrawable = getThemedDrawable(Theme.key_drawable_goIcon);
|
|
||||||
if (currentMessageObject.isOutOwner()) {
|
|
||||||
setDrawableBounds(goIconDrawable, sideStartX + AndroidUtilities.dp(10), sideStartY + AndroidUtilities.dp(9));
|
|
||||||
canvas.save();
|
|
||||||
canvas.scale(-1, 1, goIconDrawable.getBounds().centerX(), goIconDrawable.getBounds().centerY());
|
|
||||||
} else {
|
|
||||||
setDrawableBounds(goIconDrawable, sideStartX + AndroidUtilities.dp(12), sideStartY + AndroidUtilities.dp(9));
|
|
||||||
}
|
|
||||||
goIconDrawable.draw(canvas);
|
|
||||||
if (currentMessageObject.isOutOwner()) {
|
|
||||||
canvas.restore();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Drawable drawable = getThemedDrawable(Theme.key_drawable_shareIcon);
|
|
||||||
setDrawableBounds(drawable, sideStartX + AndroidUtilities.dp(8), sideStartY + AndroidUtilities.dp(9));
|
|
||||||
drawable.draw(canvas);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (replyNameLayout != null) {
|
if (replyNameLayout != null) {
|
||||||
|
@ -11399,12 +11389,74 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawOutboundsContent(Canvas canvas) {
|
public void drawOutboundsContent(Canvas canvas) {
|
||||||
if (transitionParams.animateBackgroundWidth) {
|
if (!transitionParams.transitionBotButtons.isEmpty() && transitionParams.animateBotButtonsChanged) {
|
||||||
if (!transitionParams.transitionBotButtons.isEmpty()) {
|
|
||||||
drawBotButtons(canvas, transitionParams.transitionBotButtons, 1f - transitionParams.animateChangeProgress);
|
drawBotButtons(canvas, transitionParams.transitionBotButtons, 1f - transitionParams.animateChangeProgress);
|
||||||
}
|
}
|
||||||
if (!botButtons.isEmpty()) {
|
if (!botButtons.isEmpty()) {
|
||||||
drawBotButtons(canvas, botButtons, transitionParams.animateChangeProgress);
|
drawBotButtons(canvas, botButtons, transitionParams.animateBotButtonsChanged ? transitionParams.animateChangeProgress : 1f);
|
||||||
|
}
|
||||||
|
drawSideButton(canvas);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawSideButton(Canvas canvas) {
|
||||||
|
if (drawSideButton != 0) {
|
||||||
|
if (currentMessageObject.isOutOwner()) {
|
||||||
|
sideStartX = getCurrentBackgroundLeft() - AndroidUtilities.dp(8 + 32);
|
||||||
|
if (currentMessagesGroup != null) {
|
||||||
|
sideStartX += currentMessagesGroup.transitionParams.offsetLeft - animationOffsetX;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sideStartX = currentBackgroundDrawable.getBounds().right + AndroidUtilities.dp(8);
|
||||||
|
if (currentMessagesGroup != null) {
|
||||||
|
sideStartX += currentMessagesGroup.transitionParams.offsetRight - animationOffsetX;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sideStartY = layoutHeight - AndroidUtilities.dp(41) + transitionParams.deltaBottom;
|
||||||
|
if (currentMessagesGroup != null) {
|
||||||
|
sideStartY += currentMessagesGroup.transitionParams.offsetBottom;
|
||||||
|
if (currentMessagesGroup.transitionParams.backgroundChangeBounds) {
|
||||||
|
sideStartY -= getTranslationY();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!currentMessageObject.isOutOwner() && isRoundVideo && isAvatarVisible) {
|
||||||
|
float offsetSize = (AndroidUtilities.roundPlayingMessageSize - AndroidUtilities.roundMessageSize) * 0.7f;
|
||||||
|
float offsetX = isPlayingRound ? offsetSize : 0;
|
||||||
|
if (transitionParams.animatePlayingRound) {
|
||||||
|
offsetX = (isPlayingRound ? transitionParams.animateChangeProgress : (1f - transitionParams.animateChangeProgress)) * offsetSize;
|
||||||
|
}
|
||||||
|
sideStartX -= offsetX;
|
||||||
|
}
|
||||||
|
if (drawSideButton == 3) {
|
||||||
|
if (!(enterTransitionInPorgress && !currentMessageObject.isVoice())) {
|
||||||
|
drawCommentButton(canvas, 1f);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rect.set(sideStartX, sideStartY, sideStartX + AndroidUtilities.dp(32), sideStartY + AndroidUtilities.dp(32));
|
||||||
|
applyServiceShaderMatrix(getMeasuredWidth(), backgroundHeight, getX(), viewTop);
|
||||||
|
canvas.drawRoundRect(rect, AndroidUtilities.dp(16), AndroidUtilities.dp(16), getThemedPaint(sideButtonPressed ? Theme.key_paint_chatActionBackgroundSelected : Theme.key_paint_chatActionBackground));
|
||||||
|
if (hasGradientService()) {
|
||||||
|
canvas.drawRoundRect(rect, AndroidUtilities.dp(16), AndroidUtilities.dp(16), Theme.chat_actionBackgroundGradientDarkenPaint);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (drawSideButton == 2) {
|
||||||
|
Drawable goIconDrawable = getThemedDrawable(Theme.key_drawable_goIcon);
|
||||||
|
if (currentMessageObject.isOutOwner()) {
|
||||||
|
setDrawableBounds(goIconDrawable, sideStartX + AndroidUtilities.dp(10), sideStartY + AndroidUtilities.dp(9));
|
||||||
|
canvas.save();
|
||||||
|
canvas.scale(-1, 1, goIconDrawable.getBounds().centerX(), goIconDrawable.getBounds().centerY());
|
||||||
|
} else {
|
||||||
|
setDrawableBounds(goIconDrawable, sideStartX + AndroidUtilities.dp(12), sideStartY + AndroidUtilities.dp(9));
|
||||||
|
}
|
||||||
|
goIconDrawable.draw(canvas);
|
||||||
|
if (currentMessageObject.isOutOwner()) {
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
Drawable drawable = getThemedDrawable(Theme.key_drawable_shareIcon);
|
||||||
|
setDrawableBounds(drawable, sideStartX + AndroidUtilities.dp(8), sideStartY + AndroidUtilities.dp(9));
|
||||||
|
drawable.draw(canvas);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11449,7 +11501,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
int additionalTop = 0;
|
int additionalTop = 0;
|
||||||
if (currentPosition != null) {
|
if (currentPosition != null) {
|
||||||
if ((currentPosition.flags & MessageObject.POSITION_FLAG_TOP) == 0) {
|
if ((currentPosition.flags & MessageObject.POSITION_FLAG_TOP) == 0) {
|
||||||
additionalTop -= AndroidUtilities.dp( 3);
|
additionalTop -= AndroidUtilities.dp(3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return additionalTop + (drawPinnedTop ? 0 : AndroidUtilities.dp(1));
|
return additionalTop + (drawPinnedTop ? 0 : AndroidUtilities.dp(1));
|
||||||
|
@ -11730,7 +11782,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
forwardNameXLocal = transitionParams.animateForwardNameX;
|
forwardNameXLocal = transitionParams.animateForwardNameX;
|
||||||
}
|
}
|
||||||
if (currentMessageObject.isOutOwner() && currentMessageObject.type == MessageObject.TYPE_ROUND_VIDEO && transitionParams.animatePlayingRound || isPlayingRound) {
|
if (currentMessageObject.isOutOwner() && currentMessageObject.type == MessageObject.TYPE_ROUND_VIDEO && transitionParams.animatePlayingRound || isPlayingRound) {
|
||||||
forwardNameXLocal -= AndroidUtilities.dp (78) * (isPlayingRound ? transitionParams.animateChangeProgress : (1f - transitionParams.animateChangeProgress));
|
forwardNameXLocal -= AndroidUtilities.dp(78) * (isPlayingRound ? transitionParams.animateChangeProgress : (1f - transitionParams.animateChangeProgress));
|
||||||
}
|
}
|
||||||
forwardNameY = AndroidUtilities.dp(12);
|
forwardNameY = AndroidUtilities.dp(12);
|
||||||
|
|
||||||
|
@ -12055,16 +12107,16 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
drawCaptionLayout(canvas, captionLayout, selectionOnly, alpha);
|
drawCaptionLayout(canvas, captionLayout, selectionOnly, alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((currentPosition == null || ((currentPosition.flags & MessageObject.POSITION_FLAG_BOTTOM) != 0 && (currentPosition.flags & MessageObject.POSITION_FLAG_LEFT) != 0)) && !reactionsLayoutInBubble.isSmall) {
|
if (!selectionOnly && (currentPosition == null || ((currentPosition.flags & MessageObject.POSITION_FLAG_BOTTOM) != 0 && (currentPosition.flags & MessageObject.POSITION_FLAG_LEFT) != 0)) && !reactionsLayoutInBubble.isSmall) {
|
||||||
if (reactionsLayoutInBubble.drawServiceShaderBackground) {
|
if (reactionsLayoutInBubble.drawServiceShaderBackground) {
|
||||||
applyServiceShaderMatrix(getMeasuredWidth(), backgroundHeight, getX(), viewTop);
|
applyServiceShaderMatrix(getMeasuredWidth(), backgroundHeight, getX(), viewTop);
|
||||||
}
|
}
|
||||||
if (reactionsLayoutInBubble.drawServiceShaderBackground || !transitionParams.animateBackgroundBoundsInner || currentPosition != null) {
|
if (reactionsLayoutInBubble.drawServiceShaderBackground || !transitionParams.animateBackgroundBoundsInner || currentPosition != null) {
|
||||||
reactionsLayoutInBubble.draw(canvas, transitionParams.animateChange ? transitionParams.animateChangeProgress : 1f);
|
reactionsLayoutInBubble.draw(canvas, transitionParams.animateChange ? transitionParams.animateChangeProgress : 1f, null);
|
||||||
} else {
|
} else {
|
||||||
canvas.save();
|
canvas.save();
|
||||||
canvas.clipRect(0, 0, getMeasuredWidth(), getBackgroundDrawableBottom() + transitionParams.deltaBottom);
|
canvas.clipRect(0, 0, getMeasuredWidth(), getBackgroundDrawableBottom() + transitionParams.deltaBottom);
|
||||||
reactionsLayoutInBubble.draw(canvas, transitionParams.animateChange ? transitionParams.animateChangeProgress : 1f);
|
reactionsLayoutInBubble.draw(canvas, transitionParams.animateChange ? transitionParams.animateChangeProgress : 1f, null);
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12328,6 +12380,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
float captionY = this.captionY;
|
float captionY = this.captionY;
|
||||||
float captionX = this.captionX;
|
float captionX = this.captionX;
|
||||||
|
|
||||||
|
|
||||||
if (transitionParams.animateBackgroundBoundsInner) {
|
if (transitionParams.animateBackgroundBoundsInner) {
|
||||||
if (transitionParams.transformGroupToSingleMessage) {
|
if (transitionParams.transformGroupToSingleMessage) {
|
||||||
captionY -= getTranslationY();
|
captionY -= getTranslationY();
|
||||||
|
@ -12340,7 +12393,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int restore = Integer.MIN_VALUE;
|
int restore = Integer.MIN_VALUE;
|
||||||
if (renderingAlpha != 1.0f) {
|
if (renderingAlpha != 1.0f) {
|
||||||
rect.set(captionX, captionY, captionX + captionLayout.getWidth(), captionY + captionLayout.getHeight());
|
rect.set(captionX, captionY, captionX + captionLayout.getWidth(), captionY + captionLayout.getHeight());
|
||||||
|
@ -12350,13 +12402,13 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
Rect r = currentBackgroundDrawable.getBounds();
|
Rect r = currentBackgroundDrawable.getBounds();
|
||||||
if (currentMessageObject.isOutOwner() && !mediaBackground && !pinnedBottom) {
|
if (currentMessageObject.isOutOwner() && !mediaBackground && !pinnedBottom) {
|
||||||
canvas.clipRect(
|
canvas.clipRect(
|
||||||
r.left + AndroidUtilities.dp(4), r.top + AndroidUtilities.dp(4),
|
getBackgroundDrawableLeft() + transitionParams.deltaLeft + AndroidUtilities.dp(4), getBackgroundDrawableTop() + transitionParams.deltaTop + AndroidUtilities.dp(4),
|
||||||
r.right - AndroidUtilities.dp(10), r.bottom - AndroidUtilities.dp(4)
|
getBackgroundDrawableRight() + transitionParams.deltaRight - AndroidUtilities.dp(10), getBackgroundDrawableBottom() + transitionParams.deltaBottom - AndroidUtilities.dp(4)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
canvas.clipRect(
|
canvas.clipRect(
|
||||||
r.left + AndroidUtilities.dp(4), r.top + AndroidUtilities.dp(4),
|
getBackgroundDrawableLeft() + transitionParams.deltaLeft + AndroidUtilities.dp(4), getBackgroundDrawableTop() + transitionParams.deltaTop + AndroidUtilities.dp(4),
|
||||||
r.right - AndroidUtilities.dp(4), r.bottom - AndroidUtilities.dp(4)
|
getBackgroundDrawableRight() + transitionParams.deltaRight - AndroidUtilities.dp(4), getBackgroundDrawableBottom() + transitionParams.deltaBottom - AndroidUtilities.dp(4)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12418,7 +12470,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
boolean drawSelectionBackground = i == 1;
|
boolean drawSelectionBackground = i == 1;
|
||||||
if (i == 1) {
|
if (i == 1) {
|
||||||
curentAplha *= currentSelectedBackgroundAlpha;
|
curentAplha *= currentSelectedBackgroundAlpha;
|
||||||
} else if (!shouldDrawTimeOnMedia()){
|
} else if (!shouldDrawTimeOnMedia()) {
|
||||||
curentAplha *= (1f - currentSelectedBackgroundAlpha);
|
curentAplha *= (1f - currentSelectedBackgroundAlpha);
|
||||||
}
|
}
|
||||||
if (transitionParams.animateShouldDrawTimeOnMedia && transitionParams.animateChangeProgress != 1f) {
|
if (transitionParams.animateShouldDrawTimeOnMedia && transitionParams.animateChangeProgress != 1f) {
|
||||||
|
@ -12501,7 +12553,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
if (transitionParams.animateBackgroundBoundsInner) {
|
if (transitionParams.animateBackgroundBoundsInner) {
|
||||||
timeX += animationOffsetX;
|
timeX += animationOffsetX;
|
||||||
timeTitleTimeX += animationOffsetX;
|
timeTitleTimeX += animationOffsetX;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (reactionsLayoutInBubble.isSmall) {
|
if (reactionsLayoutInBubble.isSmall) {
|
||||||
if (transitionParams.animateBackgroundBoundsInner && transitionParams.deltaRight != 0) {
|
if (transitionParams.animateBackgroundBoundsInner && transitionParams.deltaRight != 0) {
|
||||||
|
@ -12510,6 +12561,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
timeTitleTimeX += reactionsLayoutInBubble.getCurrentWidth(transitionParams.animateChangeProgress);
|
timeTitleTimeX += reactionsLayoutInBubble.getCurrentWidth(transitionParams.animateChangeProgress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (transitionParams.animateEditedEnter) {
|
||||||
|
timeTitleTimeX -= transitionParams.animateEditedWidthDiff * (1f - transitionParams.animateChangeProgress);
|
||||||
|
}
|
||||||
|
|
||||||
int timeYOffset;
|
int timeYOffset;
|
||||||
if (shouldDrawTimeOnMedia()) {
|
if (shouldDrawTimeOnMedia()) {
|
||||||
|
@ -12550,11 +12604,14 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
float additionalX = -timeLayout.getLineLeft(0);
|
float additionalX = -timeLayout.getLineLeft(0);
|
||||||
if (reactionsLayoutInBubble.isSmall) {
|
if (reactionsLayoutInBubble.isSmall) {
|
||||||
updateReactionLayoutPosition();
|
updateReactionLayoutPosition();
|
||||||
reactionsLayoutInBubble.draw(canvas, transitionParams.animateChangeProgress);
|
reactionsLayoutInBubble.draw(canvas, transitionParams.animateChangeProgress, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ChatObject.isChannel(currentChat) && !currentChat.megagroup || (currentMessageObject.messageOwner.flags & TLRPC.MESSAGE_FLAG_HAS_VIEWS) != 0 || repliesLayout != null || isPinned) {
|
if (ChatObject.isChannel(currentChat) && !currentChat.megagroup || (currentMessageObject.messageOwner.flags & TLRPC.MESSAGE_FLAG_HAS_VIEWS) != 0 || repliesLayout != null || isPinned) {
|
||||||
additionalX += this.timeWidth - timeLayout.getLineWidth(0);
|
additionalX += this.timeWidth - timeLayout.getLineWidth(0);
|
||||||
|
if (reactionsLayoutInBubble.isSmall && !reactionsLayoutInBubble.isEmpty) {
|
||||||
|
additionalX -= reactionsLayoutInBubble.width;
|
||||||
|
}
|
||||||
|
|
||||||
int currentStatus = transitionParams.createStatusDrawableParams();
|
int currentStatus = transitionParams.createStatusDrawableParams();
|
||||||
if (transitionParams.lastStatusDrawableParams >= 0 && transitionParams.lastStatusDrawableParams != currentStatus && !statusDrawableAnimationInProgress) {
|
if (transitionParams.lastStatusDrawableParams >= 0 && transitionParams.lastStatusDrawableParams != currentStatus && !statusDrawableAnimationInProgress) {
|
||||||
|
@ -12597,7 +12654,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
transitionParams.lastStatusDrawableParams = transitionParams.createStatusDrawableParams();
|
transitionParams.lastStatusDrawableParams = transitionParams.createStatusDrawableParams();
|
||||||
|
|
||||||
if (drawClock && fromParent && getParent() != null) {
|
if (drawClock && fromParent && getParent() != null) {
|
||||||
((View)getParent()).invalidate();
|
((View) getParent()).invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12618,7 +12675,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
float additionalX = -timeLayout.getLineLeft(0);
|
float additionalX = -timeLayout.getLineLeft(0);
|
||||||
if (reactionsLayoutInBubble.isSmall) {
|
if (reactionsLayoutInBubble.isSmall) {
|
||||||
updateReactionLayoutPosition();
|
updateReactionLayoutPosition();
|
||||||
reactionsLayoutInBubble.draw(canvas, transitionParams.animateChangeProgress);
|
reactionsLayoutInBubble.draw(canvas, transitionParams.animateChangeProgress, null);
|
||||||
}
|
}
|
||||||
if (ChatObject.isChannel(currentChat) && !currentChat.megagroup || (currentMessageObject.messageOwner.flags & TLRPC.MESSAGE_FLAG_HAS_VIEWS) != 0 || (repliesLayout != null || transitionParams.animateReplies) || (isPinned || transitionParams.animatePinned)) {
|
if (ChatObject.isChannel(currentChat) && !currentChat.megagroup || (currentMessageObject.messageOwner.flags & TLRPC.MESSAGE_FLAG_HAS_VIEWS) != 0 || (repliesLayout != null || transitionParams.animateReplies) || (isPinned || transitionParams.animatePinned)) {
|
||||||
additionalX += this.timeWidth - timeLayout.getLineWidth(0);
|
additionalX += this.timeWidth - timeLayout.getLineWidth(0);
|
||||||
|
@ -12666,7 +12723,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
transitionParams.lastStatusDrawableParams = transitionParams.createStatusDrawableParams();
|
transitionParams.lastStatusDrawableParams = transitionParams.createStatusDrawableParams();
|
||||||
|
|
||||||
if (drawClock && fromParent && getParent() != null) {
|
if (drawClock && fromParent && getParent() != null) {
|
||||||
((View)getParent()).invalidate();
|
((View) getParent()).invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12727,7 +12784,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
if (!outDrawClock && !isBroadcast && !outIsBroadcast && outDrawCheck2 && drawCheck2 && !outDrawCheck1 && drawCheck1) {
|
if (!outDrawClock && !isBroadcast && !outIsBroadcast && outDrawCheck2 && drawCheck2 && !outDrawCheck1 && drawCheck1) {
|
||||||
drawStatusDrawable(canvas, drawCheck1, drawCheck2, drawClock, drawError, isBroadcast, alpha, bigRadius, timeYOffset, layoutHeight, statusDrawableProgress, true, drawSelectionBackground);
|
drawStatusDrawable(canvas, drawCheck1, drawCheck2, drawClock, drawError, isBroadcast, alpha, bigRadius, timeYOffset, layoutHeight, statusDrawableProgress, true, drawSelectionBackground);
|
||||||
} else {
|
} else {
|
||||||
drawStatusDrawable(canvas, outDrawCheck1, outDrawCheck2, outDrawClock, outDrawError, outIsBroadcast, alpha, bigRadius, timeYOffset, layoutHeight,1f - statusDrawableProgress, false, drawSelectionBackground);
|
drawStatusDrawable(canvas, outDrawCheck1, outDrawCheck2, outDrawClock, outDrawError, outIsBroadcast, alpha, bigRadius, timeYOffset, layoutHeight, 1f - statusDrawableProgress, false, drawSelectionBackground);
|
||||||
drawStatusDrawable(canvas, drawCheck1, drawCheck2, drawClock, drawError, isBroadcast, alpha, bigRadius, timeYOffset, layoutHeight, statusDrawableProgress, false, drawSelectionBackground);
|
drawStatusDrawable(canvas, drawCheck1, drawCheck2, drawClock, drawError, isBroadcast, alpha, bigRadius, timeYOffset, layoutHeight, statusDrawableProgress, false, drawSelectionBackground);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -12760,7 +12817,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
statusDrawableProgress = 0f;
|
statusDrawableProgress = 0f;
|
||||||
statusDrawableAnimator = ValueAnimator.ofFloat(0,1f);
|
statusDrawableAnimator = ValueAnimator.ofFloat(0, 1f);
|
||||||
if (moveCheckTransition) {
|
if (moveCheckTransition) {
|
||||||
statusDrawableAnimator.setDuration(220);
|
statusDrawableAnimator.setDuration(220);
|
||||||
} else {
|
} else {
|
||||||
|
@ -13343,7 +13400,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
} else {
|
} else {
|
||||||
imageW = 0;
|
imageW = 0;
|
||||||
}
|
}
|
||||||
if (drawLoadingProgress && loadingProgressLayout != null){
|
if (drawLoadingProgress && loadingProgressLayout != null) {
|
||||||
imageW = 0;
|
imageW = 0;
|
||||||
infoW = (int) loadingProgressLayout.getLineWidth(0);
|
infoW = (int) loadingProgressLayout.getLineWidth(0);
|
||||||
} else {
|
} else {
|
||||||
|
@ -13471,7 +13528,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
StaticLayout docTitleLayout = this.docTitleLayout;
|
StaticLayout docTitleLayout = this.docTitleLayout;
|
||||||
StaticLayout infoLayout = this.infoLayout;
|
StaticLayout infoLayout = this.infoLayout;
|
||||||
float alpha = 1f;
|
float alpha = 1f;
|
||||||
if (transitionParams.animateLocationIsExpired){
|
if (transitionParams.animateLocationIsExpired) {
|
||||||
progress = transitionParams.lastDrawLocationExpireProgress;
|
progress = transitionParams.lastDrawLocationExpireProgress;
|
||||||
text = transitionParams.lastDrawLocationExpireText;
|
text = transitionParams.lastDrawLocationExpireText;
|
||||||
docTitleLayout = transitionParams.lastDrawDocTitleLayout;
|
docTitleLayout = transitionParams.lastDrawDocTitleLayout;
|
||||||
|
@ -15211,6 +15268,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
private StaticLayout animateTimeLayout;
|
private StaticLayout animateTimeLayout;
|
||||||
private int animateTimeWidth;
|
private int animateTimeWidth;
|
||||||
private int lastTimeWidth;
|
private int lastTimeWidth;
|
||||||
|
private int animateEditedWidthDiff;
|
||||||
private boolean lastDrawingEdited;
|
private boolean lastDrawingEdited;
|
||||||
|
|
||||||
boolean animateReplaceCaptionLayout;
|
boolean animateReplaceCaptionLayout;
|
||||||
|
@ -15264,6 +15322,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
float lastForwardNameX;
|
float lastForwardNameX;
|
||||||
int animateForwardNameWidth;
|
int animateForwardNameWidth;
|
||||||
int lastForwardNameWidth;
|
int lastForwardNameWidth;
|
||||||
|
boolean animateBotButtonsChanged;
|
||||||
|
|
||||||
public void recordDrawingState() {
|
public void recordDrawingState() {
|
||||||
wasDraw = true;
|
wasDraw = true;
|
||||||
|
@ -15283,10 +15342,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
lastDrawingCaptionY = captionY;
|
lastDrawingCaptionY = captionY;
|
||||||
|
|
||||||
lastDrawingCaptionLayout = captionLayout;
|
lastDrawingCaptionLayout = captionLayout;
|
||||||
if (!botButtons.isEmpty()) {
|
|
||||||
lastDrawBotButtons.clear();
|
lastDrawBotButtons.clear();
|
||||||
lastDrawBotButtons.addAll(botButtons);
|
lastDrawBotButtons.addAll(botButtons);
|
||||||
}
|
|
||||||
|
|
||||||
if (commentLayout != null) {
|
if (commentLayout != null) {
|
||||||
lastCommentsCount = getRepliesCount();
|
lastCommentsCount = getRepliesCount();
|
||||||
|
@ -15384,13 +15441,16 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
spannableStringBuilder.append(text.substring(editedStr.length()));
|
spannableStringBuilder.append(text.substring(editedStr.length()));
|
||||||
spannableStringBuilder.setSpan(new EmptyStubSpan(), 0, editedStr.length(), 0);
|
spannableStringBuilder.setSpan(new EmptyStubSpan(), 0, editedStr.length(), 0);
|
||||||
animateTimeLayout = new StaticLayout(spannableStringBuilder, Theme.chat_timePaint, timeTextWidth + AndroidUtilities.dp(100), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
animateTimeLayout = new StaticLayout(spannableStringBuilder, Theme.chat_timePaint, timeTextWidth + AndroidUtilities.dp(100), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||||
|
animateEditedWidthDiff = timeWidth - lastTimeWidth;
|
||||||
} else {
|
} else {
|
||||||
|
animateEditedWidthDiff = 0;
|
||||||
animateEditedLayout = null;
|
animateEditedLayout = null;
|
||||||
animateTimeLayout = lastTimeLayout;
|
animateTimeLayout = lastTimeLayout;
|
||||||
}
|
}
|
||||||
animateEditedEnter = true;
|
animateEditedEnter = true;
|
||||||
animateTimeWidth = lastTimeWidth;
|
animateTimeWidth = lastTimeWidth;
|
||||||
animateFromTimeX = lastTimeX;
|
animateFromTimeX = lastTimeX;
|
||||||
|
shouldAnimateTimeX = true;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15421,8 +15481,23 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!lastDrawBotButtons.isEmpty() || !botButtons.isEmpty()) {
|
if (!lastDrawBotButtons.isEmpty() || !botButtons.isEmpty()) {
|
||||||
|
if (lastDrawBotButtons.size() != botButtons.size()) {
|
||||||
|
animateBotButtonsChanged = true;
|
||||||
|
}
|
||||||
|
if (!animateBotButtonsChanged) {
|
||||||
|
for (int i = 0; i < botButtons.size(); i++) {
|
||||||
|
BotButton button1 = botButtons.get(i);
|
||||||
|
BotButton button2 = lastDrawBotButtons.get(i);
|
||||||
|
if (button1.x != button2.x || button1.width != button2.width) {
|
||||||
|
animateBotButtonsChanged = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (animateBotButtonsChanged) {
|
||||||
transitionBotButtons.addAll(lastDrawBotButtons);
|
transitionBotButtons.addAll(lastDrawBotButtons);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (documentAttachType == DOCUMENT_ATTACH_TYPE_AUDIO || documentAttachType == DOCUMENT_ATTACH_TYPE_DOCUMENT) {
|
if (documentAttachType == DOCUMENT_ATTACH_TYPE_AUDIO || documentAttachType == DOCUMENT_ATTACH_TYPE_DOCUMENT) {
|
||||||
if (buttonX != lastButtonX || buttonY != lastButtonY) {
|
if (buttonX != lastButtonX || buttonY != lastButtonY) {
|
||||||
|
|
|
@ -68,12 +68,12 @@ import org.telegram.ui.Components.RLottieDrawable;
|
||||||
import org.telegram.ui.Components.StaticLayoutEx;
|
import org.telegram.ui.Components.StaticLayoutEx;
|
||||||
import org.telegram.ui.Components.StatusDrawable;
|
import org.telegram.ui.Components.StatusDrawable;
|
||||||
import org.telegram.ui.Components.SwipeGestureSettingsView;
|
import org.telegram.ui.Components.SwipeGestureSettingsView;
|
||||||
|
import org.telegram.ui.Components.TextStyleSpan;
|
||||||
import org.telegram.ui.Components.TypefaceSpan;
|
import org.telegram.ui.Components.TypefaceSpan;
|
||||||
import org.telegram.ui.Components.URLSpanNoUnderline;
|
import org.telegram.ui.Components.URLSpanNoUnderline;
|
||||||
import org.telegram.ui.Components.URLSpanNoUnderlineBold;
|
import org.telegram.ui.Components.URLSpanNoUnderlineBold;
|
||||||
import org.telegram.ui.Components.spoilers.SpoilerEffect;
|
import org.telegram.ui.Components.spoilers.SpoilerEffect;
|
||||||
import org.telegram.ui.DialogsActivity;
|
import org.telegram.ui.DialogsActivity;
|
||||||
import org.telegram.ui.Components.SwipeGestureSettingsView;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -955,7 +955,7 @@ public class DialogCell extends BaseCell {
|
||||||
mess = mess.substring(0, 150);
|
mess = mess.substring(0, 150);
|
||||||
}
|
}
|
||||||
Spannable messSpan = new SpannableStringBuilder(mess);
|
Spannable messSpan = new SpannableStringBuilder(mess);
|
||||||
MediaDataController.addTextStyleRuns(draftMessage, messSpan);
|
MediaDataController.addTextStyleRuns(draftMessage, messSpan, TextStyleSpan.FLAG_STYLE_SPOILER);
|
||||||
|
|
||||||
SpannableStringBuilder stringBuilder = AndroidUtilities.formatSpannable(messageFormat, AndroidUtilities.replaceNewLines(messSpan), messageNameString);
|
SpannableStringBuilder stringBuilder = AndroidUtilities.formatSpannable(messageFormat, AndroidUtilities.replaceNewLines(messSpan), messageNameString);
|
||||||
if (!useForceThreeLines && !SharedConfig.useThreeLinesLayout) {
|
if (!useForceThreeLines && !SharedConfig.useThreeLinesLayout) {
|
||||||
|
@ -1089,7 +1089,7 @@ public class DialogCell extends BaseCell {
|
||||||
emoji = "\uD83D\uDCCE ";
|
emoji = "\uD83D\uDCCE ";
|
||||||
}
|
}
|
||||||
SpannableStringBuilder msgBuilder = new SpannableStringBuilder(mess);
|
SpannableStringBuilder msgBuilder = new SpannableStringBuilder(mess);
|
||||||
MediaDataController.addTextStyleRuns(message.messageOwner.entities, message.caption, msgBuilder);
|
MediaDataController.addTextStyleRuns(message.messageOwner.entities, message.caption, msgBuilder, TextStyleSpan.FLAG_STYLE_SPOILER);
|
||||||
stringBuilder = AndroidUtilities.formatSpannable(messageFormat, new SpannableStringBuilder(emoji).append(AndroidUtilities.replaceNewLines(msgBuilder)), messageNameString);
|
stringBuilder = AndroidUtilities.formatSpannable(messageFormat, new SpannableStringBuilder(emoji).append(AndroidUtilities.replaceNewLines(msgBuilder)), messageNameString);
|
||||||
} else if (message.messageOwner.media != null && !message.isMediaEmpty()) {
|
} else if (message.messageOwner.media != null && !message.isMediaEmpty()) {
|
||||||
currentMessagePaint = Theme.dialogs_messagePrintingPaint[paintIndex];
|
currentMessagePaint = Theme.dialogs_messagePrintingPaint[paintIndex];
|
||||||
|
@ -1148,7 +1148,7 @@ public class DialogCell extends BaseCell {
|
||||||
mess = AndroidUtilities.replaceNewLines(mess);
|
mess = AndroidUtilities.replaceNewLines(mess);
|
||||||
}
|
}
|
||||||
mess = new SpannableStringBuilder(mess);
|
mess = new SpannableStringBuilder(mess);
|
||||||
MediaDataController.addTextStyleRuns(message, (Spannable) mess);
|
MediaDataController.addTextStyleRuns(message, (Spannable) mess, TextStyleSpan.FLAG_STYLE_SPOILER);
|
||||||
stringBuilder = AndroidUtilities.formatSpannable(messageFormat, mess, messageNameString);
|
stringBuilder = AndroidUtilities.formatSpannable(messageFormat, mess, messageNameString);
|
||||||
} else {
|
} else {
|
||||||
stringBuilder = SpannableStringBuilder.valueOf("");
|
stringBuilder = SpannableStringBuilder.valueOf("");
|
||||||
|
@ -1218,7 +1218,7 @@ public class DialogCell extends BaseCell {
|
||||||
messageString = emoji + str;
|
messageString = emoji + str;
|
||||||
} else {
|
} else {
|
||||||
SpannableStringBuilder msgBuilder = new SpannableStringBuilder(message.caption);
|
SpannableStringBuilder msgBuilder = new SpannableStringBuilder(message.caption);
|
||||||
MediaDataController.addTextStyleRuns(message.messageOwner.entities, message.caption, msgBuilder);
|
MediaDataController.addTextStyleRuns(message.messageOwner.entities, message.caption, msgBuilder, TextStyleSpan.FLAG_STYLE_SPOILER);
|
||||||
messageString = new SpannableStringBuilder(emoji).append(msgBuilder);
|
messageString = new SpannableStringBuilder(emoji).append(msgBuilder);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1241,7 +1241,7 @@ public class DialogCell extends BaseCell {
|
||||||
messageString = AndroidUtilities.ellipsizeCenterEnd(messageString, message.highlightedWords.get(0), w, currentMessagePaint, 130).toString();
|
messageString = AndroidUtilities.ellipsizeCenterEnd(messageString, message.highlightedWords.get(0), w, currentMessagePaint, 130).toString();
|
||||||
} else {
|
} else {
|
||||||
SpannableStringBuilder stringBuilder = new SpannableStringBuilder(msgText);
|
SpannableStringBuilder stringBuilder = new SpannableStringBuilder(msgText);
|
||||||
MediaDataController.addTextStyleRuns(message, stringBuilder);
|
MediaDataController.addTextStyleRuns(message, stringBuilder, TextStyleSpan.FLAG_STYLE_SPOILER);
|
||||||
messageString = stringBuilder;
|
messageString = stringBuilder;
|
||||||
}
|
}
|
||||||
AndroidUtilities.highlightText(messageString, message.highlightedWords, resourcesProvider);
|
AndroidUtilities.highlightText(messageString, message.highlightedWords, resourcesProvider);
|
||||||
|
@ -2497,11 +2497,6 @@ public class DialogCell extends BaseCell {
|
||||||
swipeMessageTextLayout.draw(canvas);
|
swipeMessageTextLayout.draw(canvas);
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (width / 2 < AndroidUtilities.dp(40)) {
|
|
||||||
// canvas.drawText(swipeMessage, getMeasuredWidth() - AndroidUtilities.dp(43) - width / 2, AndroidUtilities.dp(useForceThreeLines || SharedConfig.useThreeLinesLayout ? 62 : 59), Theme.dialogs_archiveTextPaint);
|
|
||||||
// }
|
|
||||||
|
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
} else if (translationDrawable != null) {
|
} else if (translationDrawable != null) {
|
||||||
translationDrawable.stop();
|
translationDrawable.stop();
|
||||||
|
|
|
@ -61,6 +61,7 @@ import android.text.TextUtils;
|
||||||
import android.text.style.CharacterStyle;
|
import android.text.style.CharacterStyle;
|
||||||
import android.text.style.ForegroundColorSpan;
|
import android.text.style.ForegroundColorSpan;
|
||||||
import android.text.style.URLSpan;
|
import android.text.style.URLSpan;
|
||||||
|
import android.util.Log;
|
||||||
import android.util.Property;
|
import android.util.Property;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
import android.util.SparseIntArray;
|
import android.util.SparseIntArray;
|
||||||
|
@ -92,8 +93,6 @@ import androidx.collection.LongSparseArray;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.content.FileProvider;
|
import androidx.core.content.FileProvider;
|
||||||
import androidx.core.graphics.ColorUtils;
|
import androidx.core.graphics.ColorUtils;
|
||||||
import androidx.dynamicanimation.animation.SpringAnimation;
|
|
||||||
import androidx.dynamicanimation.animation.SpringForce;
|
|
||||||
import androidx.recyclerview.widget.ChatListItemAnimator;
|
import androidx.recyclerview.widget.ChatListItemAnimator;
|
||||||
import androidx.recyclerview.widget.GridLayoutManager;
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
import androidx.recyclerview.widget.GridLayoutManagerFixed;
|
import androidx.recyclerview.widget.GridLayoutManagerFixed;
|
||||||
|
@ -670,6 +669,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
|
|
||||||
private Paint scrimPaint;
|
private Paint scrimPaint;
|
||||||
private View scrimView;
|
private View scrimView;
|
||||||
|
private String scrimViewReaction;
|
||||||
private int popupAnimationIndex = -1;
|
private int popupAnimationIndex = -1;
|
||||||
private AnimatorSet scrimAnimatorSet;
|
private AnimatorSet scrimAnimatorSet;
|
||||||
private ActionBarPopupWindow scrimPopupWindow;
|
private ActionBarPopupWindow scrimPopupWindow;
|
||||||
|
@ -859,6 +859,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
|
|
||||||
private PinchToZoomHelper pinchToZoomHelper;
|
private PinchToZoomHelper pinchToZoomHelper;
|
||||||
private EmojiAnimationsOverlay emojiAnimationsOverlay;
|
private EmojiAnimationsOverlay emojiAnimationsOverlay;
|
||||||
|
public float drawingChatLisViewYoffset;
|
||||||
|
|
||||||
public void deleteHistory(int dateSelectedStart, int dateSelectedEnd, boolean forAll) {
|
public void deleteHistory(int dateSelectedStart, int dateSelectedEnd, boolean forAll) {
|
||||||
chatAdapter.frozenMessages.clear();
|
chatAdapter.frozenMessages.clear();
|
||||||
|
@ -3121,7 +3122,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (scrimView != null) {
|
if (scrimView != null) {
|
||||||
|
if (scrimViewReaction == null) {
|
||||||
canvas.drawRect(0, 0, getMeasuredWidth(), getMeasuredHeight(), scrimPaint);
|
canvas.drawRect(0, 0, getMeasuredWidth(), getMeasuredHeight(), scrimPaint);
|
||||||
|
}
|
||||||
float listTop = chatListView.getY() + chatListViewPaddingTop - chatListViewPaddingVisibleOffset - AndroidUtilities.dp(4);
|
float listTop = chatListView.getY() + chatListViewPaddingTop - chatListViewPaddingVisibleOffset - AndroidUtilities.dp(4);
|
||||||
MessageObject.GroupedMessages scrimGroup;
|
MessageObject.GroupedMessages scrimGroup;
|
||||||
if (scrimView instanceof ChatMessageCell) {
|
if (scrimView instanceof ChatMessageCell) {
|
||||||
|
@ -3129,9 +3132,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
} else {
|
} else {
|
||||||
scrimGroup = null;
|
scrimGroup = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean groupedBackgroundWasDraw = false;
|
boolean groupedBackgroundWasDraw = false;
|
||||||
|
|
||||||
int count = chatListView.getChildCount();
|
int count = chatListView.getChildCount();
|
||||||
for (int num = 0; num < count; num++) {
|
for (int num = 0; num < count; num++) {
|
||||||
View child = chatListView.getChildAt(num);
|
View child = chatListView.getChildAt(num);
|
||||||
|
@ -3193,10 +3194,17 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
float viewClipLeft = Math.max(chatListView.getLeft(), chatListView.getLeft() + child.getX());
|
float viewClipLeft = chatListView.getLeft();
|
||||||
float viewClipTop = Math.max(listTop, chatListView.getTop() + child.getY());
|
float viewClipTop = listTop;
|
||||||
float viewClipRight = Math.min(chatListView.getRight(), chatListView.getLeft() + child.getX() + child.getMeasuredWidth());
|
float viewClipRight = chatListView.getRight();
|
||||||
float viewClipBottom = Math.min(chatListView.getY() + chatListView.getMeasuredHeight(), chatListView.getY() + child.getY() + child.getMeasuredHeight());
|
float viewClipBottom = chatListView.getY() + chatListView.getMeasuredHeight();
|
||||||
|
|
||||||
|
if (cell == null || !cell.getTransitionParams().animateBackgroundBoundsInner) {
|
||||||
|
viewClipLeft = Math.max(viewClipLeft, chatListView.getLeft() + child.getX());
|
||||||
|
viewClipTop = Math.max(viewClipTop, chatListView.getTop() + child.getY());
|
||||||
|
viewClipRight = Math.min(viewClipRight, chatListView.getLeft() + child.getX() + child.getMeasuredWidth());
|
||||||
|
viewClipBottom = Math.min(viewClipBottom, chatListView.getY() + child.getY() + child.getMeasuredHeight());
|
||||||
|
}
|
||||||
|
|
||||||
if (viewClipTop < viewClipBottom) {
|
if (viewClipTop < viewClipBottom) {
|
||||||
if (child.getAlpha() != 1f) {
|
if (child.getAlpha() != 1f) {
|
||||||
|
@ -3206,6 +3214,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
if (cell != null) {
|
if (cell != null) {
|
||||||
cell.setInvalidatesParent(true);
|
cell.setInvalidatesParent(true);
|
||||||
|
cell.setScrimReaction(scrimViewReaction);
|
||||||
}
|
}
|
||||||
canvas.clipRect(viewClipLeft, viewClipTop, viewClipRight, viewClipBottom);
|
canvas.clipRect(viewClipLeft, viewClipTop, viewClipRight, viewClipBottom);
|
||||||
canvas.translate(chatListView.getLeft() + child.getX(), chatListView.getY() + child.getY());
|
canvas.translate(chatListView.getLeft() + child.getX(), chatListView.getY() + child.getY());
|
||||||
|
@ -3217,6 +3226,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
|
|
||||||
if (cell != null) {
|
if (cell != null) {
|
||||||
cell.setInvalidatesParent(false);
|
cell.setInvalidatesParent(false);
|
||||||
|
cell.setScrimReaction(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3233,6 +3243,21 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
drawCaptionAfter.add(cell);
|
drawCaptionAfter.add(cell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (scrimViewReaction != null && cell != null) {
|
||||||
|
canvas.drawRect(0, 0, getMeasuredWidth(), getMeasuredHeight(), scrimPaint);
|
||||||
|
|
||||||
|
if (viewClipTop < viewClipBottom) {
|
||||||
|
if (child.getAlpha() != 1f) {
|
||||||
|
canvas.saveLayerAlpha(viewClipLeft, viewClipTop, viewClipRight, viewClipBottom, (int) (255 * child.getAlpha()), Canvas.ALL_SAVE_FLAG);
|
||||||
|
} else {
|
||||||
|
canvas.save();
|
||||||
|
}
|
||||||
|
canvas.clipRect(viewClipLeft, viewClipTop, viewClipRight, viewClipBottom);
|
||||||
|
canvas.translate(chatListView.getLeft() + child.getX(), chatListView.getY() + child.getY());
|
||||||
|
cell.drawScrimReaction(canvas, scrimViewReaction);
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int size = drawTimeAfter.size();
|
int size = drawTimeAfter.size();
|
||||||
|
@ -4301,7 +4326,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;
|
||||||
}
|
}
|
||||||
canvas.translate(0, -pullingDownOffset - transitionOffset);
|
canvas.translate(0, drawingChatLisViewYoffset = -pullingDownOffset - transitionOffset);
|
||||||
drawChatBackgroundElements(canvas);
|
drawChatBackgroundElements(canvas);
|
||||||
super.dispatchDraw(canvas);
|
super.dispatchDraw(canvas);
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
|
@ -4611,11 +4636,17 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
b - AndroidUtilities.dp(4)
|
b - AndroidUtilities.dp(4)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (cell != null && clipToGroupBounds) {
|
||||||
|
cell.clipToGroupBounds = true;
|
||||||
result = super.drawChild(canvas, child, drawingTime);
|
result = super.drawChild(canvas, child, drawingTime);
|
||||||
|
cell.clipToGroupBounds = false;
|
||||||
|
} else {
|
||||||
|
result = super.drawChild(canvas, child, drawingTime);
|
||||||
|
}
|
||||||
if (clipToGroupBounds) {
|
if (clipToGroupBounds) {
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
}
|
}
|
||||||
if (cell != null && cell.getTransitionParams().animateBackgroundBoundsInner) {
|
if (cell != null && clipToGroupBounds) {
|
||||||
canvas.save();
|
canvas.save();
|
||||||
canvas.translate(cell.getX(), cell.getY());
|
canvas.translate(cell.getX(), cell.getY());
|
||||||
cell.drawOutboundsContent(canvas);
|
cell.drawOutboundsContent(canvas);
|
||||||
|
@ -5055,6 +5086,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
|
|
||||||
Runnable finishRunnable;
|
Runnable finishRunnable;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkIsRunning() {
|
||||||
|
if (scrollAnimationIndex == -1) {
|
||||||
|
scrollAnimationIndex = getNotificationCenter().setAnimationInProgress(scrollAnimationIndex, allowedNotificationsDuringChatListAnimations, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationStart() {
|
public void onAnimationStart() {
|
||||||
if (scrollAnimationIndex == -1) {
|
if (scrollAnimationIndex == -1) {
|
||||||
|
@ -5297,6 +5335,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
|
|
||||||
pullingDownOffset += dy * k;
|
pullingDownOffset += dy * k;
|
||||||
|
ReactionsEffectOverlay.onScrolled((int) (dy * k));
|
||||||
chatListView.invalidate();
|
chatListView.invalidate();
|
||||||
}
|
}
|
||||||
if (pullingDownOffset == 0) {
|
if (pullingDownOffset == 0) {
|
||||||
|
@ -8126,7 +8165,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
topBottom[1] = chatListView.getBottom();
|
topBottom[1] = chatListView.getBottom();
|
||||||
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);
|
||||||
return fragmentView;
|
return fragmentView;
|
||||||
}
|
}
|
||||||
|
@ -11219,12 +11257,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
if (chatListView != null && !messages.isEmpty() && !pinchToZoomHelper.isInOverlayMode()) {
|
if (chatListView != null && !messages.isEmpty() && !pinchToZoomHelper.isInOverlayMode()) {
|
||||||
int position = 0;
|
int position = 0;
|
||||||
if (skipSponsored) {
|
if (skipSponsored) {
|
||||||
while (position < messages.size()) {
|
position += getSponsoredMessagesCount();
|
||||||
if (!messages.get(position).isSponsored()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
position++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chatLayoutManager.scrollToPositionWithOffset(position, 0);
|
chatLayoutManager.scrollToPositionWithOffset(position, 0);
|
||||||
chatListView.stopScroll();
|
chatListView.stopScroll();
|
||||||
|
@ -11518,14 +11551,25 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
int maxUnreadDate = Integer.MIN_VALUE;
|
int maxUnreadDate = Integer.MIN_VALUE;
|
||||||
int recyclerChatViewHeight = (contentView.getHeightWithKeyboard() - (inPreviewMode ? 0 : AndroidUtilities.dp(48)) - chatListView.getTop());
|
int recyclerChatViewHeight = (contentView.getHeightWithKeyboard() - (inPreviewMode ? 0 : AndroidUtilities.dp(48)) - chatListView.getTop());
|
||||||
pollsToCheck.clear();
|
pollsToCheck.clear();
|
||||||
reactionsToCheck.clear();
|
float clipTop = chatListViewPaddingTop;
|
||||||
float cilpTop = chatListViewPaddingTop;
|
long currentTime = System.currentTimeMillis();
|
||||||
|
int maxAdapterPosition = -1;
|
||||||
|
int minAdapterPosition = -1;
|
||||||
for (int a = 0; a < count; a++) {
|
for (int a = 0; a < count; a++) {
|
||||||
View view = chatListView.getChildAt(a);
|
View view = chatListView.getChildAt(a);
|
||||||
MessageObject messageObject = null;
|
MessageObject messageObject = null;
|
||||||
|
int adapterPosition = chatListView.getChildAdapterPosition(view);
|
||||||
|
if (adapterPosition >= 0) {
|
||||||
|
if (adapterPosition > maxAdapterPosition || maxAdapterPosition == -1) {
|
||||||
|
maxAdapterPosition = adapterPosition;
|
||||||
|
}
|
||||||
|
if (adapterPosition < minAdapterPosition || minAdapterPosition == -1) {
|
||||||
|
minAdapterPosition = adapterPosition;
|
||||||
|
}
|
||||||
|
}
|
||||||
int top = (int) view.getY();
|
int top = (int) view.getY();
|
||||||
int bottom = top + view.getMeasuredHeight();
|
int bottom = top + view.getMeasuredHeight();
|
||||||
if (bottom <= cilpTop - chatListViewPaddingVisibleOffset || top > chatListView.getMeasuredHeight()) {
|
if (bottom <= clipTop - chatListViewPaddingVisibleOffset || top > chatListView.getMeasuredHeight()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11602,11 +11646,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
if (messageObject.type == MessageObject.TYPE_POLL && messageObject.getId() > 0) {
|
if (messageObject.type == MessageObject.TYPE_POLL && messageObject.getId() > 0) {
|
||||||
pollsToCheck.add(messageObject);
|
pollsToCheck.add(messageObject);
|
||||||
}
|
}
|
||||||
if (messageObject.getId() > 0 && messageObject.messageOwner.action == null) {
|
|
||||||
reactionsToCheck.add(messageObject);
|
|
||||||
}
|
}
|
||||||
}
|
if (bottom <= clipTop) {
|
||||||
if (bottom <= cilpTop) {
|
|
||||||
if (view instanceof ChatActionCell && messageObject.isDateObject) {
|
if (view instanceof ChatActionCell && messageObject.isDateObject) {
|
||||||
view.setAlpha(0);
|
view.setAlpha(0);
|
||||||
}
|
}
|
||||||
|
@ -11668,7 +11709,25 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getMessagesController().addToPollsQueue(dialog_id, pollsToCheck);
|
getMessagesController().addToPollsQueue(dialog_id, pollsToCheck);
|
||||||
getMessagesController().addToReactionsQueue(dialog_id, reactionsToCheck);
|
if (maxAdapterPosition >= 0 && minAdapterPosition >= 0) {
|
||||||
|
int from = minAdapterPosition - chatAdapter.messagesStartRow - 10;
|
||||||
|
int to = maxAdapterPosition - chatAdapter.messagesStartRow + 10;
|
||||||
|
if (from < 0) {
|
||||||
|
from = 0;
|
||||||
|
}
|
||||||
|
if (to > messages.size()) {
|
||||||
|
to = messages.size();
|
||||||
|
}
|
||||||
|
reactionsToCheck.clear();
|
||||||
|
for (int i = from; i < to; i++) {
|
||||||
|
MessageObject messageObject = messages.get(i);
|
||||||
|
if (threadMessageObject != messageObject && messageObject.getId() > 0 && messageObject.messageOwner.action == null && (currentTime - messageObject.reactionsLastCheckTime) > 15000L) {
|
||||||
|
messageObject.reactionsLastCheckTime = currentTime;
|
||||||
|
reactionsToCheck.add(messageObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getMessagesController().loadReactionsForMessages(dialog_id, reactionsToCheck);
|
||||||
|
}
|
||||||
if (videoPlayerContainer != null) {
|
if (videoPlayerContainer != null) {
|
||||||
if (!foundTextureViewMessage) {
|
if (!foundTextureViewMessage) {
|
||||||
MessageObject messageObject = MediaController.getInstance().getPlayingMessageObject();
|
MessageObject messageObject = MediaController.getInstance().getPlayingMessageObject();
|
||||||
|
@ -11700,7 +11759,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
currentFloatingTopIsNotMessage = !(minChild instanceof ChatMessageCell || minChild instanceof ChatActionCell);
|
currentFloatingTopIsNotMessage = !(minChild instanceof ChatMessageCell || minChild instanceof ChatActionCell);
|
||||||
if (minDateChild != null) {
|
if (minDateChild != null) {
|
||||||
boolean showFloatingView = false;
|
boolean showFloatingView = false;
|
||||||
if (minDateChild.getY() > cilpTop || currentFloatingTopIsNotMessage) {
|
if (minDateChild.getY() > clipTop || currentFloatingTopIsNotMessage) {
|
||||||
if (minDateChild.getAlpha() != 1.0f) {
|
if (minDateChild.getAlpha() != 1.0f) {
|
||||||
minDateChild.setAlpha(1.0f);
|
minDateChild.setAlpha(1.0f);
|
||||||
}
|
}
|
||||||
|
@ -11724,7 +11783,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
showFloatingView = true;
|
showFloatingView = true;
|
||||||
}
|
}
|
||||||
float offset = minDateChild.getY() + minDateChild.getMeasuredHeight() - cilpTop;
|
float offset = minDateChild.getY() + minDateChild.getMeasuredHeight() - clipTop;
|
||||||
if (offset > floatingDateView.getMeasuredHeight() && offset < floatingDateView.getMeasuredHeight() * 2) {
|
if (offset > floatingDateView.getMeasuredHeight() && offset < floatingDateView.getMeasuredHeight() * 2) {
|
||||||
if (chatListView.getChildAdapterPosition(minDateChild) == chatAdapter.messagesStartRow + messages.size() - 1) {
|
if (chatListView.getChildAdapterPosition(minDateChild) == chatAdapter.messagesStartRow + messages.size() - 1) {
|
||||||
showFloatingView = false;
|
showFloatingView = false;
|
||||||
|
@ -15424,7 +15483,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
MessageObject messageObject = messagesDict[did == dialog_id ? 0 : 1].get(msgId);
|
MessageObject messageObject = messagesDict[did == dialog_id ? 0 : 1].get(msgId);
|
||||||
if (messageObject != null) {
|
if (messageObject != null) {
|
||||||
MessageObject.updateReactions(messageObject.messageOwner, (TLRPC.TL_messageReactions) args[2]);
|
MessageObject.updateReactions(messageObject.messageOwner, (TLRPC.TL_messageReactions) args[2]);
|
||||||
chatAdapter.notifyDataSetChanged(true);
|
messageObject.forceUpdate = true;
|
||||||
|
messageObject.reactionsChanged = true;
|
||||||
|
updateMessageAnimated(messageObject, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (id == NotificationCenter.didVerifyMessagesStickers) {
|
} else if (id == NotificationCenter.didVerifyMessagesStickers) {
|
||||||
|
@ -16194,7 +16255,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
|
|
||||||
private boolean sponsoredMessagesAdded;
|
private boolean sponsoredMessagesAdded;
|
||||||
private void addSponsoredMessages(boolean animated) {
|
private void addSponsoredMessages(boolean animated) {
|
||||||
if (sponsoredMessagesAdded || chatMode != 0 || !ChatObject.isChannel(currentChat) || currentChat.megagroup || currentChat.gigagroup || !forwardEndReached[0]) {
|
if (sponsoredMessagesAdded || chatMode != 0 || !ChatObject.isChannel(currentChat) || !forwardEndReached[0]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ArrayList<MessageObject> arrayList = getMessagesController().getSponsoredMessages(dialog_id);
|
ArrayList<MessageObject> arrayList = getMessagesController().getSponsoredMessages(dialog_id);
|
||||||
|
@ -16925,6 +16986,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
if (placeToPaste > messages.size()) {
|
if (placeToPaste > messages.size()) {
|
||||||
placeToPaste = messages.size();
|
placeToPaste = messages.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int sponsoredMessagesCount = getSponsoredMessagesCount();
|
||||||
|
if (!isAd && placeToPaste < sponsoredMessagesCount) {
|
||||||
|
placeToPaste = sponsoredMessagesCount;
|
||||||
|
}
|
||||||
if (dayArray == null) {
|
if (dayArray == null) {
|
||||||
dayArray = new ArrayList<>();
|
dayArray = new ArrayList<>();
|
||||||
messagesByDays.put(obj.dateKey, dayArray);
|
messagesByDays.put(obj.dateKey, dayArray);
|
||||||
|
@ -17072,7 +17138,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
scrollToTopOnResume = true;
|
scrollToTopOnResume = true;
|
||||||
} else {
|
} else {
|
||||||
forceScrollToTop = true;
|
forceScrollToTop = true;
|
||||||
moveScrollToLastMessage(false);
|
moveScrollToLastMessage(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -17085,6 +17151,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
canShowPagedownButton = true;
|
canShowPagedownButton = true;
|
||||||
updatePagedownButtonVisibility(true);
|
updatePagedownButtonVisibility(true);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (child != null) {
|
||||||
|
chatLayoutManager.scrollToPositionWithOffset(lastVisible + 1, chatListView.getMeasuredHeight() - child.getBottom() - chatListView.getPaddingBottom());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (newMentionsCount != 0 && mentiondownButtonCounter != null) {
|
if (newMentionsCount != 0 && mentiondownButtonCounter != null) {
|
||||||
mentiondownButtonCounter.setVisibility(View.VISIBLE);
|
mentiondownButtonCounter.setVisibility(View.VISIBLE);
|
||||||
|
@ -17129,6 +17199,17 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
updateReplyMessageHeader(true);
|
updateReplyMessageHeader(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getSponsoredMessagesCount() {
|
||||||
|
int sponsoredMessagesCount = 0;
|
||||||
|
while (sponsoredMessagesCount < messages.size()) {
|
||||||
|
if (!messages.get(sponsoredMessagesCount).isSponsored()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sponsoredMessagesCount++;
|
||||||
|
}
|
||||||
|
return sponsoredMessagesCount;
|
||||||
|
}
|
||||||
|
|
||||||
private void processDeletedMessages(ArrayList<Integer> markAsDeletedMessages, long channelId) {
|
private void processDeletedMessages(ArrayList<Integer> markAsDeletedMessages, long channelId) {
|
||||||
ArrayList<Integer> removedIndexes = new ArrayList<>();
|
ArrayList<Integer> removedIndexes = new ArrayList<>();
|
||||||
int loadIndex = 0;
|
int loadIndex = 0;
|
||||||
|
@ -19768,6 +19849,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
if (scrimPopupWindow != null) {
|
if (scrimPopupWindow != null) {
|
||||||
scrimPopupWindow.dismiss();
|
scrimPopupWindow.dismiss();
|
||||||
scrimView = null;
|
scrimView = null;
|
||||||
|
scrimViewReaction = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!AndroidUtilities.isTablet()) {
|
if (!AndroidUtilities.isTablet()) {
|
||||||
|
@ -20103,7 +20185,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
options.add(OPTION_EDIT);
|
options.add(OPTION_EDIT);
|
||||||
icons.add(R.drawable.msg_edit);
|
icons.add(R.drawable.msg_edit);
|
||||||
}
|
}
|
||||||
if (!selectedObject.isOutOwner() && (messageText != null && messageText.length() > 0 && !selectedObject.isAnimatedEmoji() && !selectedObject.isDice()) && MessagesController.getGlobalMainSettings().getBoolean("translate_button", false)) {
|
if (selectedObject != null && selectedObject.contentType == 0 && (messageText != null && messageText.length() > 0 && !selectedObject.isAnimatedEmoji() && !selectedObject.isDice()) && MessagesController.getGlobalMainSettings().getBoolean("translate_button", false)) {
|
||||||
items.add(LocaleController.getString("TranslateMessage", R.string.TranslateMessage));
|
items.add(LocaleController.getString("TranslateMessage", R.string.TranslateMessage));
|
||||||
options.add(29);
|
options.add(29);
|
||||||
icons.add(R.drawable.msg_translate);
|
icons.add(R.drawable.msg_translate);
|
||||||
|
@ -20367,7 +20449,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
options.add(102);
|
options.add(102);
|
||||||
icons.add(R.drawable.msg_schedule);
|
icons.add(R.drawable.msg_schedule);
|
||||||
}
|
}
|
||||||
if (!selectedObject.isOutOwner() && (messageText != null && messageText.length() > 0 && !selectedObject.isAnimatedEmoji() && !selectedObject.isDice()) && MessagesController.getGlobalMainSettings().getBoolean("translate_button", false)) {
|
if (selectedObject != null && selectedObject.contentType == 0 && (messageText != null && messageText.length() > 0 && !selectedObject.isAnimatedEmoji() && !selectedObject.isDice()) && MessagesController.getGlobalMainSettings().getBoolean("translate_button", false)) {
|
||||||
items.add(LocaleController.getString("TranslateMessage", R.string.TranslateMessage));
|
items.add(LocaleController.getString("TranslateMessage", R.string.TranslateMessage));
|
||||||
options.add(29);
|
options.add(29);
|
||||||
icons.add(R.drawable.msg_translate);
|
icons.add(R.drawable.msg_translate);
|
||||||
|
@ -20488,11 +20570,26 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final AtomicBoolean waitForLangDetection = new AtomicBoolean(false);
|
||||||
|
final AtomicReference<Runnable> onLangDetectionDone = new AtomicReference(null);
|
||||||
|
|
||||||
Rect rect = new Rect();
|
Rect rect = new Rect();
|
||||||
|
|
||||||
List<TLRPC.TL_availableReaction> availableReacts = getMediaDataController().getEnabledReactionsList();
|
List<TLRPC.TL_availableReaction> availableReacts = getMediaDataController().getEnabledReactionsList();
|
||||||
boolean isReactionsViewAvailable = !isSecretChat() && !isInScheduleMode() && currentUser == null && message.hasReactions() && (!ChatObject.isChannel(currentChat) || currentChat.megagroup) && !availableReacts.isEmpty() && message.messageOwner.reactions.can_see_list;
|
boolean isReactionsViewAvailable = !isSecretChat() && !isInScheduleMode() && currentUser == null && message.hasReactions() && (!ChatObject.isChannel(currentChat) || currentChat.megagroup) && !availableReacts.isEmpty() && message.messageOwner.reactions.can_see_list;
|
||||||
boolean isReactionsAvailable = !isSecretChat() && !isInScheduleMode() && message.isReactionsAvailable() && (chatInfo != null && !chatInfo.available_reactions.isEmpty() || (chatInfo == null && !ChatObject.isChannel(currentChat)) || currentUser != null) && !availableReacts.isEmpty();
|
boolean isReactionsAvailable;
|
||||||
|
boolean needLoadReactionsChat = false;
|
||||||
|
if (message.isForwardedChannelPost()) {
|
||||||
|
TLRPC.ChatFull chatInfo = getMessagesController().getChatFull(-message.getFromChatId());
|
||||||
|
if (chatInfo == null) {
|
||||||
|
isReactionsAvailable = true;
|
||||||
|
needLoadReactionsChat = true;
|
||||||
|
} else {
|
||||||
|
isReactionsAvailable = !isSecretChat() && !isInScheduleMode() && message.isReactionsAvailable() && (chatInfo != null && !chatInfo.available_reactions.isEmpty()) && !availableReacts.isEmpty();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
isReactionsAvailable = !isSecretChat() && !isInScheduleMode() && message.isReactionsAvailable() && (chatInfo != null && !chatInfo.available_reactions.isEmpty() || (chatInfo == null && !ChatObject.isChannel(currentChat)) || currentUser != null) && !availableReacts.isEmpty();
|
||||||
|
}
|
||||||
boolean showMessageSeen = !isReactionsViewAvailable && !isInScheduleMode() && currentChat != null && message.isOutOwner() && message.isSent() && !message.isEditing() && !message.isSending() && !message.isSendError() && !message.isContentUnread() && !message.isUnread() && (ConnectionsManager.getInstance(currentAccount).getCurrentTime() - message.messageOwner.date < getMessagesController().chatReadMarkExpirePeriod) && (ChatObject.isMegagroup(currentChat) || !ChatObject.isChannel(currentChat)) && chatInfo != null && chatInfo.participants_count < getMessagesController().chatReadMarkSizeThreshold && !(message.messageOwner.action instanceof TLRPC.TL_messageActionChatJoinedByRequest) && (v instanceof ChatMessageCell);
|
boolean showMessageSeen = !isReactionsViewAvailable && !isInScheduleMode() && currentChat != null && message.isOutOwner() && message.isSent() && !message.isEditing() && !message.isSending() && !message.isSendError() && !message.isContentUnread() && !message.isUnread() && (ConnectionsManager.getInstance(currentAccount).getCurrentTime() - message.messageOwner.date < getMessagesController().chatReadMarkExpirePeriod) && (ChatObject.isMegagroup(currentChat) || !ChatObject.isChannel(currentChat)) && chatInfo != null && chatInfo.participants_count < getMessagesController().chatReadMarkSizeThreshold && !(message.messageOwner.action instanceof TLRPC.TL_messageActionChatJoinedByRequest) && (v instanceof ChatMessageCell);
|
||||||
|
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
|
@ -20500,9 +20597,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
flags |= ActionBarPopupWindow.ActionBarPopupWindowLayout.FLAG_USE_SWIPEBACK;
|
flags |= ActionBarPopupWindow.ActionBarPopupWindowLayout.FLAG_USE_SWIPEBACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
final AtomicBoolean waitForLangDetection = new AtomicBoolean(false);
|
|
||||||
final AtomicReference<Runnable> onLangDetectionDone = new AtomicReference(null);
|
|
||||||
|
|
||||||
ActionBarPopupWindow.ActionBarPopupWindowLayout popupLayout = new ActionBarPopupWindow.ActionBarPopupWindowLayout(getParentActivity(), R.drawable.popup_fixed_alert, themeDelegate, flags);
|
ActionBarPopupWindow.ActionBarPopupWindowLayout popupLayout = new ActionBarPopupWindow.ActionBarPopupWindowLayout(getParentActivity(), R.drawable.popup_fixed_alert, themeDelegate, flags);
|
||||||
popupLayout.setMinimumWidth(AndroidUtilities.dp(200));
|
popupLayout.setMinimumWidth(AndroidUtilities.dp(200));
|
||||||
Rect backgroundPaddings = new Rect();
|
Rect backgroundPaddings = new Rect();
|
||||||
|
@ -20866,6 +20960,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
processSelectedOption(options.get(i));
|
processSelectedOption(options.get(i));
|
||||||
scrimView = null;
|
scrimView = null;
|
||||||
|
scrimViewReaction = null;
|
||||||
contentView.invalidate();
|
contentView.invalidate();
|
||||||
chatListView.invalidate();
|
chatListView.invalidate();
|
||||||
if (scrimPopupWindow != null) {
|
if (scrimPopupWindow != null) {
|
||||||
|
@ -20876,6 +20971,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
// "Translate" button
|
// "Translate" button
|
||||||
String toLang = LocaleController.getInstance().getCurrentLocale().getLanguage();
|
String toLang = LocaleController.getInstance().getCurrentLocale().getLanguage();
|
||||||
final CharSequence finalMessageText = messageText;
|
final CharSequence finalMessageText = messageText;
|
||||||
|
TranslateAlert.OnLinkPress onLinkPress = (link) -> {
|
||||||
|
didPressMessageUrl(link, false, selectedObject, v instanceof ChatMessageCell ? (ChatMessageCell) v : null);
|
||||||
|
};
|
||||||
if (LanguageDetector.hasSupport()) {
|
if (LanguageDetector.hasSupport()) {
|
||||||
final String[] fromLang = { null };
|
final String[] fromLang = { null };
|
||||||
cell.setVisibility(View.GONE);
|
cell.setVisibility(View.GONE);
|
||||||
|
@ -20895,7 +20993,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(Exception e) -> {
|
(Exception e) -> {
|
||||||
FileLog.e(e);
|
Log.e("mlkit", "failed to detect language in message");
|
||||||
|
e.printStackTrace();
|
||||||
waitForLangDetection.set(false);
|
waitForLangDetection.set(false);
|
||||||
if (onLangDetectionDone.get() != null) {
|
if (onLangDetectionDone.get() != null) {
|
||||||
onLangDetectionDone.get().run();
|
onLangDetectionDone.get().run();
|
||||||
|
@ -20907,9 +21006,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
if (selectedObject == null || i >= options.size() || getParentActivity() == null) {
|
if (selectedObject == null || i >= options.size() || getParentActivity() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean noForwards = currentChat != null && currentChat.noforwards;
|
TranslateAlert.showAlert(getParentActivity(), this, fromLang[0], toLang, finalMessageText, currentChat != null && currentChat.noforwards, onLinkPress);
|
||||||
TranslateAlert.showAlert(getParentActivity(), this, fromLang[0], toLang, finalMessageText, noForwards);
|
|
||||||
scrimView = null;
|
scrimView = null;
|
||||||
|
scrimViewReaction = null;
|
||||||
contentView.invalidate();
|
contentView.invalidate();
|
||||||
chatListView.invalidate();
|
chatListView.invalidate();
|
||||||
if (scrimPopupWindow != null) {
|
if (scrimPopupWindow != null) {
|
||||||
|
@ -20927,9 +21026,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
if (selectedObject == null || i >= options.size() || getParentActivity() == null) {
|
if (selectedObject == null || i >= options.size() || getParentActivity() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean noForwards = currentChat != null && currentChat.noforwards;
|
TranslateAlert.showAlert(getParentActivity(), this, "und", toLang, finalMessageText, currentChat != null && currentChat.noforwards, onLinkPress);
|
||||||
TranslateAlert.showAlert(getParentActivity(), this, "und", toLang, finalMessageText, noForwards);
|
|
||||||
scrimView = null;
|
scrimView = null;
|
||||||
|
scrimViewReaction = null;
|
||||||
contentView.invalidate();
|
contentView.invalidate();
|
||||||
chatListView.invalidate();
|
chatListView.invalidate();
|
||||||
if (scrimPopupWindow != null) {
|
if (scrimPopupWindow != null) {
|
||||||
|
@ -20948,6 +21047,15 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
return super.dispatchKeyEvent(event);
|
return super.dispatchKeyEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean dispatchTouchEvent(MotionEvent ev) {
|
||||||
|
boolean b = super.dispatchTouchEvent(ev);
|
||||||
|
if (ev.getAction() == MotionEvent.ACTION_DOWN && !b && scrimPopupWindow != null) {
|
||||||
|
scrimPopupWindow.dismiss();
|
||||||
|
}
|
||||||
|
return b;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
scrimPopupContainerLayout.setOnTouchListener(new View.OnTouchListener() {
|
scrimPopupContainerLayout.setOnTouchListener(new View.OnTouchListener() {
|
||||||
|
|
||||||
|
@ -20973,48 +21081,26 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ReactionsContainerLayout reactionsLayout = new ReactionsContainerLayout(contentView.getContext(), getResourceProvider());
|
ReactionsContainerLayout reactionsLayout = new ReactionsContainerLayout(contentView.getContext(), currentAccount, getResourceProvider());
|
||||||
if (isReactionsAvailable) {
|
if (isReactionsAvailable) {
|
||||||
int pad = 22;
|
int pad = 22;
|
||||||
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));
|
||||||
List<TLRPC.TL_availableReaction> l;
|
|
||||||
if (chatInfo != null) {
|
|
||||||
l = new ArrayList<>(chatInfo.available_reactions.size());
|
|
||||||
for (String s : chatInfo.available_reactions) {
|
|
||||||
for (TLRPC.TL_availableReaction a : getMediaDataController().getEnabledReactionsList()) {
|
|
||||||
if (a.reaction.equals(s)) {
|
|
||||||
l.add(a);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
l = getMediaDataController().getEnabledReactionsList();
|
|
||||||
}
|
|
||||||
reactionsLayout.setReactionsList(l);
|
|
||||||
reactionsLayout.setDelegate((rView, reaction) -> {
|
reactionsLayout.setDelegate((rView, reaction) -> {
|
||||||
selectReaction(primaryMessage, reactionsLayout, 0, 0, reaction, false);
|
selectReaction(primaryMessage, reactionsLayout, 0, 0, reaction, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
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, 0, 0, -20);
|
||||||
int size = params.height - reactionsLayout.getPaddingTop() - reactionsLayout.getPaddingBottom();
|
|
||||||
if (size * l.size() < AndroidUtilities.dp(200))
|
|
||||||
params.width = ViewGroup.LayoutParams.WRAP_CONTENT;
|
|
||||||
scrimPopupContainerLayout.addView(reactionsLayout, params);
|
scrimPopupContainerLayout.addView(reactionsLayout, params);
|
||||||
scrimPopupContainerLayout.reactionsLayout = reactionsLayout;
|
scrimPopupContainerLayout.reactionsLayout = reactionsLayout;
|
||||||
|
reactionsLayout.setMessage(message, chatInfo);
|
||||||
|
|
||||||
reactionsLayout.setTransitionProgress(0);
|
reactionsLayout.setTransitionProgress(0);
|
||||||
if (popupLayout.getSwipeBack() != null) {
|
if (popupLayout.getSwipeBack() != null) {
|
||||||
popupLayout.getSwipeBack().setOnSwipeBackProgressListener((layout, toProgress, progress) -> {
|
popupLayout.getSwipeBack().setOnSwipeBackProgressListener((layout, toProgress, progress) -> {
|
||||||
if (toProgress == 0) {
|
if (toProgress == 0) {
|
||||||
reactionsLayout.setTransitionProgress(0);
|
reactionsLayout.startEnterAnimation();
|
||||||
reactionsLayout.setAlpha(1f);
|
|
||||||
new SpringAnimation(reactionsLayout, ReactionsContainerLayout.TRANSITION_PROGRESS_VALUE)
|
|
||||||
.setSpring(new SpringForce().setFinalPosition(100)
|
|
||||||
.setStiffness(240)
|
|
||||||
.setDampingRatio(0.7f))
|
|
||||||
.start();
|
|
||||||
} else if (toProgress == 1)
|
} else if (toProgress == 1)
|
||||||
reactionsLayout.setAlpha(1f - progress);
|
reactionsLayout.setAlpha(1f - progress);
|
||||||
});
|
});
|
||||||
|
@ -21022,7 +21108,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean showNoForwards = getMessagesController().isChatNoForwards(currentChat) && message.messageOwner.action == null && message.isSent() && !message.isEditing() && chatMode != MODE_SCHEDULED;
|
boolean showNoForwards = getMessagesController().isChatNoForwards(currentChat) && message.messageOwner.action == null && message.isSent() && !message.isEditing() && chatMode != MODE_SCHEDULED;
|
||||||
scrimPopupContainerLayout.addView(popupLayout, LayoutHelper.createLinearRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START, isReactionsAvailable ? 16 : 0, 0, isReactionsAvailable ? 36 : 0, 0));
|
scrimPopupContainerLayout.addView(popupLayout, LayoutHelper.createLinearRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT, isReactionsAvailable ? 16 : 0, 0, isReactionsAvailable ? 36 : 0, 0));
|
||||||
scrimPopupContainerLayout.popupWindowLayout = popupLayout;
|
scrimPopupContainerLayout.popupWindowLayout = popupLayout;
|
||||||
if (showNoForwards) {
|
if (showNoForwards) {
|
||||||
popupLayout.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
|
popupLayout.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
|
||||||
|
@ -21040,7 +21126,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
FrameLayout fl = new FrameLayout(contentView.getContext());
|
FrameLayout fl = new FrameLayout(contentView.getContext());
|
||||||
fl.setBackground(shadowDrawable2);
|
fl.setBackground(shadowDrawable2);
|
||||||
fl.addView(tv, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 11, 11, 11, 11));
|
fl.addView(tv, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 11, 11, 11, 11));
|
||||||
scrimPopupContainerLayout.addView(fl, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
|
scrimPopupContainerLayout.addView(fl, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT, isReactionsAvailable ? 16 : 0, -8, isReactionsAvailable ? 36 : 0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
scrimPopupWindow = new ActionBarPopupWindow(scrimPopupContainerLayout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT) {
|
scrimPopupWindow = new ActionBarPopupWindow(scrimPopupContainerLayout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT) {
|
||||||
|
@ -21077,6 +21163,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Animator animation) {
|
public void onAnimationEnd(Animator animation) {
|
||||||
scrimView = null;
|
scrimView = null;
|
||||||
|
scrimViewReaction = null;
|
||||||
contentView.invalidate();
|
contentView.invalidate();
|
||||||
chatListView.invalidate();
|
chatListView.invalidate();
|
||||||
}
|
}
|
||||||
|
@ -21114,7 +21201,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
popupX += location[0];
|
popupX += location[0];
|
||||||
}
|
}
|
||||||
int totalHeight = contentView.getHeight();
|
int totalHeight = contentView.getHeight();
|
||||||
int height = scrimPopupContainerLayout.getMeasuredHeight();
|
int height = scrimPopupContainerLayout.getMeasuredHeight() + AndroidUtilities.dp(48);
|
||||||
int keyboardHeight = contentView.measureKeyboardHeight();
|
int keyboardHeight = contentView.measureKeyboardHeight();
|
||||||
if (keyboardHeight > AndroidUtilities.dp(20)) {
|
if (keyboardHeight > AndroidUtilities.dp(20)) {
|
||||||
totalHeight += keyboardHeight;
|
totalHeight += keyboardHeight;
|
||||||
|
@ -21133,23 +21220,18 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
} else {
|
} else {
|
||||||
popupY = inBubbleMode ? 0 : AndroidUtilities.statusBarHeight;
|
popupY = inBubbleMode ? 0 : AndroidUtilities.statusBarHeight;
|
||||||
}
|
}
|
||||||
scrimPopupWindow.showAtLocation(chatListView, Gravity.LEFT | Gravity.TOP, scrimPopupX = popupX, scrimPopupY = popupY);
|
|
||||||
if (isReactionsAvailable) {
|
|
||||||
reactionsLayout.setTransitionProgress(0);
|
|
||||||
new SpringAnimation(reactionsLayout, ReactionsContainerLayout.TRANSITION_PROGRESS_VALUE)
|
|
||||||
.setSpring(new SpringForce().setFinalPosition(100)
|
|
||||||
.setStiffness(240)
|
|
||||||
.setDampingRatio(0.7f))
|
|
||||||
.start();
|
|
||||||
}
|
|
||||||
final int finalPopupX = scrimPopupX = popupX;
|
final int finalPopupX = scrimPopupX = popupX;
|
||||||
final int finalPopupY = scrimPopupY = popupY;
|
final int finalPopupY = scrimPopupY = popupY;
|
||||||
Runnable showMenu = () -> scrimPopupWindow.showAtLocation(chatListView, Gravity.LEFT | Gravity.TOP, finalPopupX, finalPopupY);
|
Runnable showMenu = () -> {
|
||||||
|
scrimPopupWindow.showAtLocation(chatListView, Gravity.LEFT | Gravity.TOP, finalPopupX, finalPopupY);
|
||||||
|
if (isReactionsAvailable) {
|
||||||
|
reactionsLayout.startEnterAnimation();
|
||||||
|
}
|
||||||
|
};
|
||||||
if (waitForLangDetection.get()) {
|
if (waitForLangDetection.get()) {
|
||||||
onLangDetectionDone.set(showMenu);
|
onLangDetectionDone.set(showMenu);
|
||||||
} else {
|
} else
|
||||||
showMenu.run();
|
showMenu.run();
|
||||||
}
|
|
||||||
chatListView.stopScroll();
|
chatListView.stopScroll();
|
||||||
chatLayoutManager.setCanScrollVertically(false);
|
chatLayoutManager.setCanScrollVertically(false);
|
||||||
scrimView = v;
|
scrimView = v;
|
||||||
|
@ -21284,7 +21366,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}, 50);
|
}, 50);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
updateMessageAnimated(primaryMessage);
|
updateMessageAnimated(primaryMessage, true);
|
||||||
ReactionsEffectOverlay.startAnimation();
|
ReactionsEffectOverlay.startAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21297,7 +21379,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
//updateReactionRunnable.run();
|
//updateReactionRunnable.run();
|
||||||
|
|
||||||
if (fromDoubleTap) {
|
if (fromDoubleTap) {
|
||||||
updateMessageAnimated(primaryMessage);
|
updateMessageAnimated(primaryMessage, true);
|
||||||
updateReactionRunnable.run();
|
updateReactionRunnable.run();
|
||||||
}
|
}
|
||||||
AndroidUtilities.runOnUIThread(updateReactionRunnable, 50);
|
AndroidUtilities.runOnUIThread(updateReactionRunnable, 50);
|
||||||
|
@ -21306,7 +21388,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
private void updateMessageAnimated(MessageObject message) {
|
private void updateMessageAnimated(MessageObject message, boolean updateReactions) {
|
||||||
if (chatAdapter == null) {
|
if (chatAdapter == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -21318,6 +21400,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
for (int i = 0; i < group.messages.size(); i++) {
|
for (int i = 0; i < group.messages.size(); i++) {
|
||||||
group.messages.get(i).forceUpdate = true;
|
group.messages.get(i).forceUpdate = true;
|
||||||
|
if (updateReactions) {
|
||||||
|
group.messages.get(i).reactionsChanged = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
chatAdapter.notifyDataSetChanged(true);
|
chatAdapter.notifyDataSetChanged(true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -22689,6 +22774,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
if (originalMessage != null && originalMessage.messageOwner.replies != null && chatActivity.threadMessageObject.messageOwner.replies != null) {
|
if (originalMessage != null && originalMessage.messageOwner.replies != null && chatActivity.threadMessageObject.messageOwner.replies != null) {
|
||||||
originalMessage.messageOwner.replies.replies = chatActivity.threadMessageObject.messageOwner.replies.replies;
|
originalMessage.messageOwner.replies.replies = chatActivity.threadMessageObject.messageOwner.replies.replies;
|
||||||
}
|
}
|
||||||
|
if (originalMessage != null && originalMessage.messageOwner.reactions != null) {
|
||||||
|
chatActivity.threadMessageObject.messageOwner.reactions = originalMessage.messageOwner.reactions;
|
||||||
|
}
|
||||||
presentFragment(chatActivity);
|
presentFragment(chatActivity);
|
||||||
if (isKeyboardVisible() && !chatActivity.hideKeyboardOnShow()) {
|
if (isKeyboardVisible() && !chatActivity.hideKeyboardOnShow()) {
|
||||||
chatActivity.chatActivityEnterView.getEditField().requestFocus();
|
chatActivity.chatActivityEnterView.getEditField().requestFocus();
|
||||||
|
@ -23870,7 +23958,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
if (h == 0) {
|
if (h == 0) {
|
||||||
h = AndroidUtilities.dp(ReactedUsersListView.VISIBLE_ITEMS * ReactedUsersListView.ITEM_HEIGHT_DP);
|
h = AndroidUtilities.dp(ReactedUsersListView.VISIBLE_ITEMS * ReactedUsersListView.ITEM_HEIGHT_DP);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(h, MeasureSpec.AT_MOST));
|
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(h, MeasureSpec.AT_MOST));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -23882,12 +23969,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
shadowDrawable2.getPadding(backgroundPaddings);
|
shadowDrawable2.getPadding(backgroundPaddings);
|
||||||
scrimPopupContainerLayout.setBackground(shadowDrawable2);
|
scrimPopupContainerLayout.setBackground(shadowDrawable2);
|
||||||
|
|
||||||
int totalHeight = contentView.getHeight();
|
|
||||||
int height = scrimPopupContainerLayout.getMeasuredHeight();
|
|
||||||
int keyboardHeight = contentView.measureKeyboardHeight();
|
|
||||||
if (keyboardHeight > AndroidUtilities.dp(20)) {
|
|
||||||
totalHeight += keyboardHeight;
|
|
||||||
}
|
|
||||||
ReactionsLayoutInBubble.ReactionButton button = cell.getReactionButton(reaction.reaction);
|
ReactionsLayoutInBubble.ReactionButton button = cell.getReactionButton(reaction.reaction);
|
||||||
if (button == null) {
|
if (button == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -23896,7 +23978,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
float left = cell.reactionsLayoutInBubble.x + button.x;
|
float left = cell.reactionsLayoutInBubble.x + button.x;
|
||||||
int[] loc = new int[2];
|
int[] loc = new int[2];
|
||||||
cell.getLocationInWindow(loc);
|
cell.getLocationInWindow(loc);
|
||||||
int finalTotalHeight = totalHeight;
|
|
||||||
scrimPopupContainerLayout.addView(new ReactedUsersListView(getParentActivity(), themeDelegate, currentAccount, cell.getPrimaryMessageObject(), reaction, false)
|
scrimPopupContainerLayout.addView(new ReactedUsersListView(getParentActivity(), themeDelegate, currentAccount, cell.getPrimaryMessageObject(), reaction, false)
|
||||||
.setOnProfileSelectedListener((view1, userId) -> {
|
.setOnProfileSelectedListener((view1, userId) -> {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
|
@ -23906,19 +23987,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
if (scrimPopupWindow != null) {
|
if (scrimPopupWindow != null) {
|
||||||
scrimPopupWindow.dismiss();
|
scrimPopupWindow.dismiss();
|
||||||
}
|
}
|
||||||
}).setOnHeightChangedListener((view1, newHeight) -> {
|
}), LayoutHelper.createFrame(240, LayoutHelper.WRAP_CONTENT));
|
||||||
// float delta = Math.max(0, loc[1] + bottom - scrimPopupY + backgroundPaddings.top);
|
|
||||||
// int h = scrimPopupContainerLayout.getHeight();
|
|
||||||
// ValueAnimator anim = ValueAnimator.ofFloat(0, 1).setDuration(240);
|
|
||||||
// anim.setInterpolator(CubicBezierInterpolator.DEFAULT);
|
|
||||||
// anim.addUpdateListener(animation -> {
|
|
||||||
// float val = (float) animation.getAnimatedValue();
|
|
||||||
// float f = Math.min(delta * val, finalTotalHeight - newHeight);
|
|
||||||
// scrimPopupContainerLayout.setTranslationY(f);
|
|
||||||
// scrimPopupWindow.setHeight((int) (h + f));
|
|
||||||
// });
|
|
||||||
// anim.start();
|
|
||||||
}), LayoutHelper.createFrame(200, LayoutHelper.WRAP_CONTENT));
|
|
||||||
|
|
||||||
scrimPopupWindow = new ActionBarPopupWindow(scrimPopupContainerLayout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT) {
|
scrimPopupWindow = new ActionBarPopupWindow(scrimPopupContainerLayout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT) {
|
||||||
@Override
|
@Override
|
||||||
|
@ -23954,6 +24023,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Animator animation) {
|
public void onAnimationEnd(Animator animation) {
|
||||||
scrimView = null;
|
scrimView = null;
|
||||||
|
scrimViewReaction = null;
|
||||||
contentView.invalidate();
|
contentView.invalidate();
|
||||||
chatListView.invalidate();
|
chatListView.invalidate();
|
||||||
}
|
}
|
||||||
|
@ -23975,6 +24045,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
scrimPopupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED);
|
scrimPopupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED);
|
||||||
scrimPopupWindow.getContentView().setFocusableInTouchMode(true);
|
scrimPopupWindow.getContentView().setFocusableInTouchMode(true);
|
||||||
|
|
||||||
|
int totalHeight = contentView.getHeight();
|
||||||
|
int height = scrimPopupContainerLayout.getMeasuredHeight();
|
||||||
|
int keyboardHeight = contentView.measureKeyboardHeight();
|
||||||
|
if (keyboardHeight > AndroidUtilities.dp(20)) {
|
||||||
|
totalHeight += keyboardHeight;
|
||||||
|
}
|
||||||
|
|
||||||
int popupX = (int) (left - AndroidUtilities.dp(28));
|
int popupX = (int) (left - AndroidUtilities.dp(28));
|
||||||
popupX = Math.max(AndroidUtilities.dp(6), Math.min(chatListView.getMeasuredWidth() - AndroidUtilities.dp(6) - scrimPopupContainerLayout.getMeasuredWidth(), popupX));
|
popupX = Math.max(AndroidUtilities.dp(6), Math.min(chatListView.getMeasuredWidth() - AndroidUtilities.dp(6) - scrimPopupContainerLayout.getMeasuredWidth(), popupX));
|
||||||
if (AndroidUtilities.isTablet()) {
|
if (AndroidUtilities.isTablet()) {
|
||||||
|
@ -23984,14 +24061,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
int popupY;
|
int popupY;
|
||||||
if (height < totalHeight) {
|
if (height < totalHeight) {
|
||||||
popupY = (int) (chatListView.getY() + cell.getY() + cell.getHeight());
|
if (height < totalHeight / 2f && chatListView.getY() + cell.getY() + cell.reactionsLayoutInBubble.y + button.y > totalHeight / 2f) {
|
||||||
if (height - backgroundPaddings.top - backgroundPaddings.bottom > AndroidUtilities.dp(240)) {
|
popupY = (int) (chatListView.getY() + cell.getY() + cell.reactionsLayoutInBubble.y + button.y - height);
|
||||||
popupY += AndroidUtilities.dp(240) - height;
|
} else {
|
||||||
}
|
popupY = (int) (chatListView.getY() + cell.getY() + cell.reactionsLayoutInBubble.y + button.y + button.height);
|
||||||
if (popupY < chatListView.getY() + AndroidUtilities.dp(24)) {
|
|
||||||
popupY = (int) (chatListView.getY() + AndroidUtilities.dp(24));
|
|
||||||
} else if (popupY > totalHeight - height - AndroidUtilities.dp(8)) {
|
|
||||||
popupY = totalHeight - height - AndroidUtilities.dp(8);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
popupY = inBubbleMode ? 0 : AndroidUtilities.statusBarHeight;
|
popupY = inBubbleMode ? 0 : AndroidUtilities.statusBarHeight;
|
||||||
|
@ -24001,6 +24074,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
chatListView.stopScroll();
|
chatListView.stopScroll();
|
||||||
chatLayoutManager.setCanScrollVertically(false);
|
chatLayoutManager.setCanScrollVertically(false);
|
||||||
scrimView = cell;
|
scrimView = cell;
|
||||||
|
scrimViewReaction = reaction.reaction;
|
||||||
cell.setInvalidatesParent(true);
|
cell.setInvalidatesParent(true);
|
||||||
restartSticker(cell);
|
restartSticker(cell);
|
||||||
contentView.invalidate();
|
contentView.invalidate();
|
||||||
|
@ -26534,6 +26608,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
|
|
||||||
Theme.applyTheme(activeTheme, false, isDark);
|
Theme.applyTheme(activeTheme, false, isDark);
|
||||||
} else {
|
} else {
|
||||||
|
if (ApplicationLoader.applicationContext != null) {
|
||||||
|
Theme.createChatResources(ApplicationLoader.applicationContext, false);
|
||||||
|
}
|
||||||
currentColors = chatTheme.createColors(currentAccount, isDark ? 1 : 0);
|
currentColors = chatTheme.createColors(currentAccount, isDark ? 1 : 0);
|
||||||
backgroundDrawable = getBackgroundDrawableFromTheme(chatTheme, prevPhase);
|
backgroundDrawable = getBackgroundDrawableFromTheme(chatTheme, prevPhase);
|
||||||
|
|
||||||
|
|
|
@ -106,23 +106,7 @@ public class ChatReactionsEditActivity extends BaseFragment implements Notificat
|
||||||
enableReactionsCell.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
enableReactionsCell.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
||||||
enableReactionsCell.setAnimatingToThumbInsteadOfTouch(true);
|
enableReactionsCell.setAnimatingToThumbInsteadOfTouch(true);
|
||||||
enableReactionsCell.setOnClickListener(v -> {
|
enableReactionsCell.setOnClickListener(v -> {
|
||||||
boolean c = !enableReactionsCell.isChecked();
|
setCheckedEnableReactionCell(!enableReactionsCell.isChecked());
|
||||||
enableReactionsCell.setChecked(c);
|
|
||||||
int clr = Theme.getColor(c ? Theme.key_windowBackgroundChecked : Theme.key_windowBackgroundUnchecked);
|
|
||||||
if (c) {
|
|
||||||
enableReactionsCell.setBackgroundColorAnimated(c, clr);
|
|
||||||
} else {
|
|
||||||
enableReactionsCell.setBackgroundColorAnimatedReverse(clr);
|
|
||||||
}
|
|
||||||
if (c) {
|
|
||||||
for (TLRPC.TL_availableReaction a : availableReactions) {
|
|
||||||
chatReactions.add(a.reaction);
|
|
||||||
}
|
|
||||||
listAdapter.notifyItemRangeInserted(1, 1 + availableReactions.size());
|
|
||||||
} else {
|
|
||||||
chatReactions.clear();
|
|
||||||
listAdapter.notifyItemRangeRemoved(1, 1 + availableReactions.size());
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
ll.addView(enableReactionsCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
|
ll.addView(enableReactionsCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
|
||||||
|
|
||||||
|
@ -185,8 +169,14 @@ public class ChatReactionsEditActivity extends BaseFragment implements Notificat
|
||||||
AvailableReactionCell cell = (AvailableReactionCell) view;
|
AvailableReactionCell cell = (AvailableReactionCell) view;
|
||||||
TLRPC.TL_availableReaction react = availableReactions.get(position - 2);
|
TLRPC.TL_availableReaction react = availableReactions.get(position - 2);
|
||||||
boolean nc = !chatReactions.contains(react.reaction);
|
boolean nc = !chatReactions.contains(react.reaction);
|
||||||
if (nc) chatReactions.add(react.reaction);
|
if (nc) {
|
||||||
else chatReactions.remove(react.reaction);
|
chatReactions.add(react.reaction);
|
||||||
|
} else {
|
||||||
|
chatReactions.remove(react.reaction);
|
||||||
|
if (chatReactions.isEmpty()) {
|
||||||
|
setCheckedEnableReactionCell(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cell.setChecked(nc, true);
|
cell.setChecked(nc, true);
|
||||||
});
|
});
|
||||||
|
@ -198,6 +188,28 @@ public class ChatReactionsEditActivity extends BaseFragment implements Notificat
|
||||||
return contentView;
|
return contentView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setCheckedEnableReactionCell(boolean c) {
|
||||||
|
if (enableReactionsCell.isChecked() == c) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
enableReactionsCell.setChecked(c);
|
||||||
|
int clr = Theme.getColor(c ? Theme.key_windowBackgroundChecked : Theme.key_windowBackgroundUnchecked);
|
||||||
|
if (c) {
|
||||||
|
enableReactionsCell.setBackgroundColorAnimated(c, clr);
|
||||||
|
} else {
|
||||||
|
enableReactionsCell.setBackgroundColorAnimatedReverse(clr);
|
||||||
|
}
|
||||||
|
if (c) {
|
||||||
|
for (TLRPC.TL_availableReaction a : availableReactions) {
|
||||||
|
chatReactions.add(a.reaction);
|
||||||
|
}
|
||||||
|
listAdapter.notifyItemRangeInserted(1, 1 + availableReactions.size());
|
||||||
|
} else {
|
||||||
|
chatReactions.clear();
|
||||||
|
listAdapter.notifyItemRangeRemoved(1, 1 + availableReactions.size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFragmentDestroy() {
|
public void onFragmentDestroy() {
|
||||||
super.onFragmentDestroy();
|
super.onFragmentDestroy();
|
||||||
|
|
|
@ -4,11 +4,12 @@ import android.content.Context;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
import org.telegram.messenger.AndroidUtilities;
|
||||||
import org.telegram.ui.ActionBar.ActionBarPopupWindow;
|
import org.telegram.ui.ActionBar.ActionBarPopupWindow;
|
||||||
|
|
||||||
public class ChatScrimPopupContainerLayout extends LinearLayout {
|
public class ChatScrimPopupContainerLayout extends LinearLayout {
|
||||||
|
|
||||||
public View reactionsLayout;
|
public ReactionsContainerLayout reactionsLayout;
|
||||||
public ActionBarPopupWindow.ActionBarPopupWindowLayout popupWindowLayout;
|
public ActionBarPopupWindow.ActionBarPopupWindowLayout popupWindowLayout;
|
||||||
|
|
||||||
public ChatScrimPopupContainerLayout(Context context) {
|
public ChatScrimPopupContainerLayout(Context context) {
|
||||||
|
@ -18,9 +19,25 @@ public class ChatScrimPopupContainerLayout extends LinearLayout {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
if (reactionsLayout != null && popupWindowLayout != null && popupWindowLayout.getSwipeBack() != null && reactionsLayout.getLayoutParams().width != LayoutHelper.WRAP_CONTENT) {
|
if (reactionsLayout != null && popupWindowLayout != null) {
|
||||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||||
int widthDiff = popupWindowLayout.getSwipeBack().getMeasuredWidth() - popupWindowLayout.getSwipeBack().getChildAt(0).getMeasuredWidth();
|
int reactionsLayoutTotalWidth = reactionsLayout.getTotalWidth();
|
||||||
|
View menuContainer = popupWindowLayout.getSwipeBack() != null ? popupWindowLayout.getSwipeBack().getChildAt(0) : popupWindowLayout.getChildAt(0);
|
||||||
|
int maxReactionsLayoutWidth = menuContainer.getMeasuredWidth() + AndroidUtilities.dp(16) + AndroidUtilities.dp(16) + AndroidUtilities.dp(36);
|
||||||
|
if (reactionsLayoutTotalWidth > maxReactionsLayoutWidth) {
|
||||||
|
int maxFullCount = ((maxReactionsLayoutWidth - AndroidUtilities.dp(16)) / AndroidUtilities.dp(36)) + 1;
|
||||||
|
int newWidth = maxFullCount * AndroidUtilities.dp(36) + AndroidUtilities.dp(16) - AndroidUtilities.dp(8);
|
||||||
|
if (newWidth > reactionsLayoutTotalWidth || maxFullCount == reactionsLayout.getItemsCount()) {
|
||||||
|
newWidth = reactionsLayoutTotalWidth;
|
||||||
|
}
|
||||||
|
reactionsLayout.getLayoutParams().width = newWidth;
|
||||||
|
} else {
|
||||||
|
reactionsLayout.getLayoutParams().width = LayoutHelper.WRAP_CONTENT;
|
||||||
|
}
|
||||||
|
int widthDiff = 0;
|
||||||
|
if (popupWindowLayout.getSwipeBack() != null) {
|
||||||
|
widthDiff = popupWindowLayout.getSwipeBack().getMeasuredWidth() - popupWindowLayout.getSwipeBack().getChildAt(0).getMeasuredWidth();
|
||||||
|
}
|
||||||
((LayoutParams)reactionsLayout.getLayoutParams()).rightMargin = widthDiff;
|
((LayoutParams)reactionsLayout.getLayoutParams()).rightMargin = widthDiff;
|
||||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -132,7 +132,7 @@ public class ChatThemeBottomSheet extends BottomSheet implements NotificationCen
|
||||||
}
|
}
|
||||||
setupLightDarkTheme(!forceDark);
|
setupLightDarkTheme(!forceDark);
|
||||||
});
|
});
|
||||||
rootLayout.addView(darkThemeView, LayoutHelper.createFrame(44, 44, Gravity.TOP | Gravity.END, 0, 0, 7, 0));
|
rootLayout.addView(darkThemeView, LayoutHelper.createFrame(44, 44, Gravity.TOP | Gravity.END, 0, -2, 7, 0));
|
||||||
forceDark = !Theme.getActiveTheme().isDark();
|
forceDark = !Theme.getActiveTheme().isDark();
|
||||||
setForceDark(Theme.getActiveTheme().isDark(), false);
|
setForceDark(Theme.getActiveTheme().isDark(), false);
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,7 @@ public class CounterView extends View {
|
||||||
private final static int ANIMATION_TYPE_IN = 0;
|
private final static int ANIMATION_TYPE_IN = 0;
|
||||||
private final static int ANIMATION_TYPE_OUT = 1;
|
private final static int ANIMATION_TYPE_OUT = 1;
|
||||||
private final static int ANIMATION_TYPE_REPLACE = 2;
|
private final static int ANIMATION_TYPE_REPLACE = 2;
|
||||||
|
public boolean shortFormat;
|
||||||
|
|
||||||
int animationType = -1;
|
int animationType = -1;
|
||||||
|
|
||||||
|
@ -180,14 +181,14 @@ public class CounterView extends View {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String newStr = String.valueOf(count);
|
String newStr = getStringOfCCount(count);
|
||||||
countWidth = Math.max(AndroidUtilities.dp(12), (int) Math.ceil(textPaint.measureText(newStr)));
|
countWidth = Math.max(AndroidUtilities.dp(12), (int) Math.ceil(textPaint.measureText(newStr)));
|
||||||
countLayout = new StaticLayout(newStr, textPaint, countWidth, Layout.Alignment.ALIGN_CENTER, 1.0f, 0.0f, false);
|
countLayout = new StaticLayout(newStr, textPaint, countWidth, Layout.Alignment.ALIGN_CENTER, 1.0f, 0.0f, false);
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
parent.invalidate();
|
parent.invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String newStr = String.valueOf(count);
|
String newStr = getStringOfCCount(count);
|
||||||
|
|
||||||
if (animated) {
|
if (animated) {
|
||||||
if (countAnimator != null) {
|
if (countAnimator != null) {
|
||||||
|
@ -231,7 +232,7 @@ public class CounterView extends View {
|
||||||
countAnimator.setInterpolator(CubicBezierInterpolator.DEFAULT);
|
countAnimator.setInterpolator(CubicBezierInterpolator.DEFAULT);
|
||||||
}
|
}
|
||||||
if (countLayout != null) {
|
if (countLayout != null) {
|
||||||
String oldStr = String.valueOf(currentCount);
|
String oldStr = getStringOfCCount(currentCount);
|
||||||
|
|
||||||
if (oldStr.length() == newStr.length()) {
|
if (oldStr.length() == newStr.length()) {
|
||||||
SpannableStringBuilder oldSpannableStr = new SpannableStringBuilder(oldStr);
|
SpannableStringBuilder oldSpannableStr = new SpannableStringBuilder(oldStr);
|
||||||
|
@ -269,6 +270,13 @@ public class CounterView extends View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getStringOfCCount(int count) {
|
||||||
|
if (shortFormat) {
|
||||||
|
return AndroidUtilities.formatWholeNumber(count, 0);
|
||||||
|
}
|
||||||
|
return String.valueOf(count);
|
||||||
|
}
|
||||||
|
|
||||||
public void draw(Canvas canvas) {
|
public void draw(Canvas canvas) {
|
||||||
if (type != TYPE_CHAT_PULLING_DOWN && type != TYPE_CHAT_REACTIONS) {
|
if (type != TYPE_CHAT_PULLING_DOWN && type != TYPE_CHAT_REACTIONS) {
|
||||||
int textColor = getThemedColor(textColorKey);
|
int textColor = getThemedColor(textColorKey);
|
||||||
|
|
|
@ -505,10 +505,10 @@ public class FlickerLoadingView extends View {
|
||||||
} else if (getViewType() == REACTED_TYPE) {
|
} else if (getViewType() == REACTED_TYPE) {
|
||||||
int k = 0;
|
int k = 0;
|
||||||
while (h <= getMeasuredHeight()) {
|
while (h <= getMeasuredHeight()) {
|
||||||
int r = AndroidUtilities.dp(16);
|
int r = AndroidUtilities.dp(18);
|
||||||
canvas.drawCircle(checkRtl(paddingLeft + AndroidUtilities.dp(13) + r), h + AndroidUtilities.dp(24), r, paint);
|
canvas.drawCircle(checkRtl(paddingLeft + AndroidUtilities.dp(8) + r), h + AndroidUtilities.dp(24), r, paint);
|
||||||
|
|
||||||
rectF.set(paddingLeft + AndroidUtilities.dp(53), h + AndroidUtilities.dp(20), getWidth() - AndroidUtilities.dp(53), h + AndroidUtilities.dp(28));
|
rectF.set(paddingLeft + AndroidUtilities.dp(58), h + AndroidUtilities.dp(20), getWidth() - AndroidUtilities.dp(53), h + AndroidUtilities.dp(28));
|
||||||
checkRtl(rectF);
|
checkRtl(rectF);
|
||||||
canvas.drawRoundRect(rectF, AndroidUtilities.dp(8), AndroidUtilities.dp(8), paint);
|
canvas.drawRoundRect(rectF, AndroidUtilities.dp(8), AndroidUtilities.dp(8), paint);
|
||||||
|
|
||||||
|
|
|
@ -98,6 +98,7 @@ public class MotionBackgroundDrawable extends Drawable {
|
||||||
private ColorFilter patternColorFilter;
|
private ColorFilter patternColorFilter;
|
||||||
private int roundRadius;
|
private int roundRadius;
|
||||||
private float patternAlpha = 1f;
|
private float patternAlpha = 1f;
|
||||||
|
private float backgroundAlpha = 1f;
|
||||||
private int alpha = 255;
|
private int alpha = 255;
|
||||||
|
|
||||||
private ColorFilter legacyBitmapColorFilter;
|
private ColorFilter legacyBitmapColorFilter;
|
||||||
|
@ -422,6 +423,10 @@ public class MotionBackgroundDrawable extends Drawable {
|
||||||
this.patternAlpha = alpha;
|
this.patternAlpha = alpha;
|
||||||
invalidateParent();
|
invalidateParent();
|
||||||
}
|
}
|
||||||
|
public void setBackgroundAlpha(float alpha) {
|
||||||
|
this.backgroundAlpha = alpha;
|
||||||
|
invalidateParent();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBounds(int left, int top, int right, int bottom) {
|
public void setBounds(int left, int top, int right, int bottom) {
|
||||||
|
@ -459,6 +464,192 @@ public class MotionBackgroundDrawable extends Drawable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void drawBackground(Canvas canvas) {
|
||||||
|
android.graphics.Rect bounds = getBounds();
|
||||||
|
canvas.save();
|
||||||
|
float tr = patternBitmap != null ? bounds.top : translationY;
|
||||||
|
int bitmapWidth = currentBitmap.getWidth();
|
||||||
|
int bitmapHeight = currentBitmap.getHeight();
|
||||||
|
float w = bounds.width();
|
||||||
|
float h = bounds.height();
|
||||||
|
float maxScale = Math.max(w / bitmapWidth, h / bitmapHeight);
|
||||||
|
float width = bitmapWidth * maxScale;
|
||||||
|
float height = bitmapHeight * maxScale;
|
||||||
|
float x = (w - width) / 2;
|
||||||
|
float y = (h - height) / 2;
|
||||||
|
if (isPreview) {
|
||||||
|
x += bounds.left;
|
||||||
|
y += bounds.top;
|
||||||
|
canvas.clipRect(bounds.left, bounds.top, bounds.right, bounds.bottom);
|
||||||
|
}
|
||||||
|
if (intensity < 0) {
|
||||||
|
canvas.drawColor(ColorUtils.setAlphaComponent(Color.BLACK, (int) (alpha * backgroundAlpha)));
|
||||||
|
} else {
|
||||||
|
if (roundRadius != 0) {
|
||||||
|
matrix.reset();
|
||||||
|
matrix.setTranslate(x, y);
|
||||||
|
float scaleW = (currentBitmap.getWidth() / (float) bounds.width());
|
||||||
|
float scaleH = (currentBitmap.getHeight() / (float) bounds.height());
|
||||||
|
float scale = 1.0f / Math.min(scaleW, scaleH);
|
||||||
|
matrix.preScale(scale, scale);
|
||||||
|
bitmapShader.setLocalMatrix(matrix);
|
||||||
|
|
||||||
|
rect.set(bounds.left, bounds.top, bounds.right, bounds.bottom);
|
||||||
|
int wasAlpha = paint.getAlpha();
|
||||||
|
paint.setAlpha((int) (wasAlpha * backgroundAlpha));
|
||||||
|
canvas.drawRoundRect(rect, roundRadius, roundRadius, paint);
|
||||||
|
paint.setAlpha(wasAlpha);
|
||||||
|
} else {
|
||||||
|
canvas.translate(0, tr);
|
||||||
|
if (gradientDrawable != null) {
|
||||||
|
gradientDrawable.setBounds((int) x, (int) y, (int) (x + width), (int) (y + height));
|
||||||
|
gradientDrawable.setAlpha((int) (255 * backgroundAlpha));
|
||||||
|
gradientDrawable.draw(canvas);
|
||||||
|
} else {
|
||||||
|
rect.set(x, y, x + width, y + height);
|
||||||
|
Paint bitmapPaint = overrideBitmapPaint != null ? overrideBitmapPaint : paint;
|
||||||
|
int wasAlpha = bitmapPaint.getAlpha();
|
||||||
|
bitmapPaint.setAlpha((int) (wasAlpha * backgroundAlpha));
|
||||||
|
canvas.drawBitmap(currentBitmap, null, rect, bitmapPaint);
|
||||||
|
bitmapPaint.setAlpha(wasAlpha);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
canvas.restore();
|
||||||
|
|
||||||
|
updateAnimation();
|
||||||
|
}
|
||||||
|
public void drawPattern(Canvas canvas) {
|
||||||
|
android.graphics.Rect bounds = getBounds();
|
||||||
|
canvas.save();
|
||||||
|
float tr = patternBitmap != null ? bounds.top : translationY;
|
||||||
|
int bitmapWidth = currentBitmap.getWidth();
|
||||||
|
int bitmapHeight = currentBitmap.getHeight();
|
||||||
|
float w = bounds.width();
|
||||||
|
float h = bounds.height();
|
||||||
|
float maxScale = Math.max(w / bitmapWidth, h / bitmapHeight);
|
||||||
|
float width = bitmapWidth * maxScale;
|
||||||
|
float height = bitmapHeight * maxScale;
|
||||||
|
float x = (w - width) / 2;
|
||||||
|
float y = (h - height) / 2;
|
||||||
|
if (isPreview) {
|
||||||
|
x += bounds.left;
|
||||||
|
y += bounds.top;
|
||||||
|
canvas.clipRect(bounds.left, bounds.top, bounds.right, bounds.bottom);
|
||||||
|
}
|
||||||
|
if (intensity < 0) {
|
||||||
|
if (patternBitmap != null) {
|
||||||
|
if (useLegacyBitmap) {
|
||||||
|
if (errorWhileGenerateLegacyBitmap) {
|
||||||
|
bitmapWidth = patternBitmap.getWidth();
|
||||||
|
bitmapHeight = patternBitmap.getHeight();
|
||||||
|
maxScale = Math.max(w / bitmapWidth, h / bitmapHeight);
|
||||||
|
width = bitmapWidth * maxScale;
|
||||||
|
height = bitmapHeight * maxScale;
|
||||||
|
x = (w - width) / 2;
|
||||||
|
y = (h - height) / 2;
|
||||||
|
rect.set(x, y, x + width, y + height);
|
||||||
|
|
||||||
|
int averageColor = AndroidUtilities.getAverageColor(colors[2], AndroidUtilities.getAverageColor(colors[0], colors[1]));
|
||||||
|
if (colors[3] != 0) {
|
||||||
|
averageColor = AndroidUtilities.getAverageColor(colors[3], averageColor);
|
||||||
|
}
|
||||||
|
if (legacyBitmapColorFilter == null || averageColor != legacyBitmapColor) {
|
||||||
|
legacyBitmapColor = averageColor;
|
||||||
|
legacyBitmapColorFilter = new PorterDuffColorFilter(averageColor, PorterDuff.Mode.SRC_IN);
|
||||||
|
}
|
||||||
|
paint2.setColorFilter(legacyBitmapColorFilter);
|
||||||
|
paint2.setAlpha((int) ((Math.abs(intensity) / 100f) * alpha * patternAlpha));
|
||||||
|
canvas.translate(0, tr);
|
||||||
|
canvas.drawBitmap(patternBitmap, null, rect, paint2);
|
||||||
|
} else if (legacyBitmap != null) {
|
||||||
|
if (invalidateLegacy) {
|
||||||
|
rect.set(0, 0, legacyBitmap.getWidth(), legacyBitmap.getHeight());
|
||||||
|
int oldAlpha = paint.getAlpha();
|
||||||
|
paint.setAlpha(255);
|
||||||
|
legacyCanvas.drawBitmap(currentBitmap, null, rect, paint);
|
||||||
|
paint.setAlpha(oldAlpha);
|
||||||
|
|
||||||
|
bitmapWidth = patternBitmap.getWidth();
|
||||||
|
bitmapHeight = patternBitmap.getHeight();
|
||||||
|
maxScale = Math.max(w / bitmapWidth, h / bitmapHeight);
|
||||||
|
width = bitmapWidth * maxScale;
|
||||||
|
height = bitmapHeight * maxScale;
|
||||||
|
x = (w - width) / 2;
|
||||||
|
y = (h - height) / 2;
|
||||||
|
rect.set(x, y, x + width, y + height);
|
||||||
|
|
||||||
|
paint2.setColorFilter(null);
|
||||||
|
paint2.setAlpha((int) ((Math.abs(intensity) / 100f) * 255));
|
||||||
|
legacyCanvas.save();
|
||||||
|
legacyCanvas.scale(legacyBitmapScale, legacyBitmapScale);
|
||||||
|
legacyCanvas.drawBitmap(patternBitmap, null, rect, paint2);
|
||||||
|
legacyCanvas.restore();
|
||||||
|
invalidateLegacy = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
rect.set(bounds.left, bounds.top, bounds.right, bounds.bottom);
|
||||||
|
if (legacyBitmap2 != null && posAnimationProgress != 1f) {
|
||||||
|
paint.setAlpha((int) (alpha * patternAlpha * (1f - posAnimationProgress)));
|
||||||
|
canvas.drawBitmap(legacyBitmap2, null, rect, paint);
|
||||||
|
|
||||||
|
paint.setAlpha((int) (alpha * patternAlpha * posAnimationProgress));
|
||||||
|
canvas.drawBitmap(legacyBitmap, null, rect, paint);
|
||||||
|
paint.setAlpha(alpha);
|
||||||
|
} else {
|
||||||
|
canvas.drawBitmap(legacyBitmap, null, rect, paint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (matrix == null) {
|
||||||
|
matrix = new Matrix();
|
||||||
|
}
|
||||||
|
matrix.reset();
|
||||||
|
matrix.setTranslate(x, y + tr);
|
||||||
|
float scaleW = (currentBitmap.getWidth() / (float) bounds.width());
|
||||||
|
float scaleH = (currentBitmap.getHeight() / (float) bounds.height());
|
||||||
|
float scale = 1.0f / Math.min(scaleW, scaleH);
|
||||||
|
matrix.preScale(scale, scale);
|
||||||
|
bitmapShader.setLocalMatrix(matrix);
|
||||||
|
|
||||||
|
matrix.reset();
|
||||||
|
bitmapWidth = patternBitmap.getWidth();
|
||||||
|
bitmapHeight = patternBitmap.getHeight();
|
||||||
|
maxScale = Math.max(w / bitmapWidth, h / bitmapHeight);
|
||||||
|
width = bitmapWidth * maxScale;
|
||||||
|
height = bitmapHeight * maxScale;
|
||||||
|
x = (w - width) / 2;
|
||||||
|
y = (h - height) / 2;
|
||||||
|
matrix.setTranslate(x, y + tr);
|
||||||
|
matrix.preScale(maxScale, maxScale);
|
||||||
|
gradientShader.setLocalMatrix(matrix);
|
||||||
|
paint2.setColorFilter(null);
|
||||||
|
paint2.setAlpha((int) ((Math.abs(intensity) / 100f) * alpha * patternAlpha));
|
||||||
|
rect.set(bounds.left, bounds.top, bounds.right, bounds.bottom);
|
||||||
|
canvas.drawRoundRect(rect, roundRadius, roundRadius, paint2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (patternBitmap != null) {
|
||||||
|
bitmapWidth = patternBitmap.getWidth();
|
||||||
|
bitmapHeight = patternBitmap.getHeight();
|
||||||
|
maxScale = Math.max(w / bitmapWidth, h / bitmapHeight);
|
||||||
|
width = bitmapWidth * maxScale;
|
||||||
|
height = bitmapHeight * maxScale;
|
||||||
|
x = (w - width) / 2;
|
||||||
|
y = (h - height) / 2;
|
||||||
|
rect.set(x, y, x + width, y + height);
|
||||||
|
|
||||||
|
paint2.setColorFilter(patternColorFilter);
|
||||||
|
paint2.setAlpha((int) ((Math.abs(intensity) / 100f) * alpha * patternAlpha));
|
||||||
|
canvas.drawBitmap(patternBitmap, null, rect, paint2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
canvas.restore();
|
||||||
|
|
||||||
|
updateAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Canvas canvas) {
|
public void draw(Canvas canvas) {
|
||||||
android.graphics.Rect bounds = getBounds();
|
android.graphics.Rect bounds = getBounds();
|
||||||
|
@ -479,7 +670,7 @@ public class MotionBackgroundDrawable extends Drawable {
|
||||||
canvas.clipRect(bounds.left, bounds.top, bounds.right, bounds.bottom);
|
canvas.clipRect(bounds.left, bounds.top, bounds.right, bounds.bottom);
|
||||||
}
|
}
|
||||||
if (intensity < 0) {
|
if (intensity < 0) {
|
||||||
canvas.drawColor(ColorUtils.setAlphaComponent(Color.BLACK, alpha));
|
canvas.drawColor(ColorUtils.setAlphaComponent(Color.BLACK, (int) (alpha * backgroundAlpha)));
|
||||||
if (patternBitmap != null) {
|
if (patternBitmap != null) {
|
||||||
if (useLegacyBitmap) {
|
if (useLegacyBitmap) {
|
||||||
if (errorWhileGenerateLegacyBitmap) {
|
if (errorWhileGenerateLegacyBitmap) {
|
||||||
|
@ -587,10 +778,15 @@ public class MotionBackgroundDrawable extends Drawable {
|
||||||
canvas.translate(0, tr);
|
canvas.translate(0, tr);
|
||||||
if (gradientDrawable != null) {
|
if (gradientDrawable != null) {
|
||||||
gradientDrawable.setBounds((int) x, (int) y, (int) (x + width), (int) (y + height));
|
gradientDrawable.setBounds((int) x, (int) y, (int) (x + width), (int) (y + height));
|
||||||
|
gradientDrawable.setAlpha((int) (255 * backgroundAlpha));
|
||||||
gradientDrawable.draw(canvas);
|
gradientDrawable.draw(canvas);
|
||||||
} else {
|
} else {
|
||||||
rect.set(x, y, x + width, y + height);
|
rect.set(x, y, x + width, y + height);
|
||||||
canvas.drawBitmap(currentBitmap, null, rect, overrideBitmapPaint != null ? overrideBitmapPaint : paint);
|
Paint bitmapPaint = overrideBitmapPaint != null ? overrideBitmapPaint : paint;
|
||||||
|
int wasAlpha = bitmapPaint.getAlpha();
|
||||||
|
bitmapPaint.setAlpha((int) (wasAlpha * backgroundAlpha));
|
||||||
|
canvas.drawBitmap(currentBitmap, null, rect, bitmapPaint);
|
||||||
|
bitmapPaint.setAlpha(wasAlpha);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -194,18 +194,18 @@ public class PopupSwipeBackLayout extends FrameLayout {
|
||||||
if (processTouchEvent(ev))
|
if (processTouchEvent(ev))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
int act = ev.getActionMasked();
|
||||||
|
if (act == MotionEvent.ACTION_DOWN && !mRect.contains(ev.getX(), ev.getY())) {
|
||||||
|
callOnClick();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (currentForegroundIndex < 0 || currentForegroundIndex >= getChildCount()) {
|
if (currentForegroundIndex < 0 || currentForegroundIndex >= getChildCount()) {
|
||||||
return super.dispatchTouchEvent(ev);
|
return super.dispatchTouchEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
View bv = getChildAt(0);
|
View bv = getChildAt(0);
|
||||||
View fv = getChildAt(currentForegroundIndex);
|
View fv = getChildAt(currentForegroundIndex);
|
||||||
int act = ev.getActionMasked();
|
|
||||||
if (act == MotionEvent.ACTION_DOWN && (ev.getX() > (bv.getMeasuredWidth() + (fv.getMeasuredWidth() - bv.getMeasuredWidth()) * transitionProgress) ||
|
|
||||||
ev.getY() > (bv.getMeasuredHeight() + ((overrideForegroundHeight != 0 ? overrideForegroundHeight : fv.getMeasuredHeight()) - bv.getMeasuredHeight()) * transitionProgress))) {
|
|
||||||
callOnClick();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean b = (transitionProgress > 0.5f ? fv : bv).dispatchTouchEvent(ev);
|
boolean b = (transitionProgress > 0.5f ? fv : bv).dispatchTouchEvent(ev);
|
||||||
if (!b && act == MotionEvent.ACTION_DOWN) {
|
if (!b && act == MotionEvent.ACTION_DOWN) {
|
||||||
|
@ -345,7 +345,6 @@ public class PopupSwipeBackLayout extends FrameLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int s = canvas.save();
|
int s = canvas.save();
|
||||||
mPath.rewind();
|
mPath.rewind();
|
||||||
int rad = AndroidUtilities.dp(6);
|
int rad = AndroidUtilities.dp(6);
|
||||||
|
|
|
@ -22,6 +22,8 @@ import android.text.TextUtils;
|
||||||
import android.view.HapticFeedbackConstants;
|
import android.view.HapticFeedbackConstants;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
|
import com.google.android.exoplayer2.util.Log;
|
||||||
|
|
||||||
import org.telegram.messenger.AndroidUtilities;
|
import org.telegram.messenger.AndroidUtilities;
|
||||||
import org.telegram.messenger.ApplicationLoader;
|
import org.telegram.messenger.ApplicationLoader;
|
||||||
import org.telegram.messenger.DispatchQueuePool;
|
import org.telegram.messenger.DispatchQueuePool;
|
||||||
|
@ -164,6 +166,7 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable {
|
||||||
if (cacheGenerateTask == null) {
|
if (cacheGenerateTask == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
createCache(nativePtr, width, height);
|
createCache(nativePtr, width, height);
|
||||||
uiHandler.post(uiRunnableCacheFinished);
|
uiHandler.post(uiRunnableCacheFinished);
|
||||||
});
|
});
|
||||||
|
@ -358,12 +361,14 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable {
|
||||||
this(file, w, h, precache, limitFps, null, 0);
|
this(file, w, h, precache, limitFps, null, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File file;
|
||||||
public RLottieDrawable(File file, int w, int h, boolean precache, boolean limitFps, int[] colorReplacement, int fitzModifier) {
|
public RLottieDrawable(File file, int w, int h, boolean precache, boolean limitFps, int[] colorReplacement, int fitzModifier) {
|
||||||
width = w;
|
width = w;
|
||||||
height = h;
|
height = h;
|
||||||
shouldLimitFps = limitFps;
|
shouldLimitFps = limitFps;
|
||||||
getPaint().setFlags(Paint.FILTER_BITMAP_FLAG);
|
getPaint().setFlags(Paint.FILTER_BITMAP_FLAG);
|
||||||
|
|
||||||
|
this.file = file;
|
||||||
nativePtr = create(file.getAbsolutePath(), null, w, h, metaData, precache, colorReplacement, shouldLimitFps, fitzModifier);
|
nativePtr = create(file.getAbsolutePath(), null, w, h, metaData, precache, colorReplacement, shouldLimitFps, fitzModifier);
|
||||||
if (precache && lottieCacheGenerateQueue == null) {
|
if (precache && lottieCacheGenerateQueue == null) {
|
||||||
lottieCacheGenerateQueue = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>());
|
lottieCacheGenerateQueue = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>());
|
||||||
|
@ -809,7 +814,7 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCurrentFrame(int frame, boolean async, boolean resetFrame) {
|
public void setCurrentFrame(int frame, boolean async, boolean resetFrame) {
|
||||||
if (frame < 0 || frame > metaData[0]) {
|
if (frame < 0 || frame > metaData[0] || currentFrame == frame) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
currentFrame = frame;
|
currentFrame = frame;
|
||||||
|
|
|
@ -5,6 +5,8 @@ import android.animation.AnimatorListenerAdapter;
|
||||||
import android.animation.ValueAnimator;
|
import android.animation.ValueAnimator;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
import android.os.Build;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.LongSparseArray;
|
import android.util.LongSparseArray;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
|
@ -24,6 +26,7 @@ import org.telegram.messenger.ImageLocation;
|
||||||
import org.telegram.messenger.MediaDataController;
|
import org.telegram.messenger.MediaDataController;
|
||||||
import org.telegram.messenger.MessageObject;
|
import org.telegram.messenger.MessageObject;
|
||||||
import org.telegram.messenger.MessagesController;
|
import org.telegram.messenger.MessagesController;
|
||||||
|
import org.telegram.messenger.NotificationCenter;
|
||||||
import org.telegram.messenger.SvgHelper;
|
import org.telegram.messenger.SvgHelper;
|
||||||
import org.telegram.messenger.UserObject;
|
import org.telegram.messenger.UserObject;
|
||||||
import org.telegram.tgnet.ConnectionsManager;
|
import org.telegram.tgnet.ConnectionsManager;
|
||||||
|
@ -75,6 +78,9 @@ public class ReactedUsersListView extends FrameLayout {
|
||||||
listView.setPadding(0, 0, 0, AndroidUtilities.dp(8));
|
listView.setPadding(0, 0, 0, AndroidUtilities.dp(8));
|
||||||
listView.setClipToPadding(false);
|
listView.setClipToPadding(false);
|
||||||
}
|
}
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
|
listView.setVerticalScrollbarThumbDrawable(new ColorDrawable(Theme.getColor(Theme.key_listSelector)));
|
||||||
|
}
|
||||||
listView.setAdapter(adapter = new RecyclerView.Adapter() {
|
listView.setAdapter(adapter = new RecyclerView.Adapter() {
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
|
@ -163,6 +169,7 @@ public class ReactedUsersListView extends FrameLayout {
|
||||||
TLRPC.TL_messages_messageReactionsList l = (TLRPC.TL_messages_messageReactionsList) response;
|
TLRPC.TL_messages_messageReactionsList l = (TLRPC.TL_messages_messageReactionsList) response;
|
||||||
|
|
||||||
for (TLRPC.User u : l.users) {
|
for (TLRPC.User u : l.users) {
|
||||||
|
MessagesController.getInstance(currentAccount).putUser(u, false);
|
||||||
users.put(u.id, u);
|
users.put(u.id, u);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,10 +179,11 @@ public class ReactedUsersListView extends FrameLayout {
|
||||||
newReactions.addAll(userReactions);
|
newReactions.addAll(userReactions);
|
||||||
newReactions.addAll(l.reactions);
|
newReactions.addAll(l.reactions);
|
||||||
|
|
||||||
if (onlySeenNow)
|
if (onlySeenNow) {
|
||||||
Collections.sort(newReactions, (o1, o2) -> Integer.compare(o1.reaction != null ? 1 : 0, o2.reaction != null ? 1 : 0));
|
Collections.sort(newReactions, (o1, o2) -> Integer.compare(o1.reaction != null ? 1 : 0, o2.reaction != null ? 1 : 0));
|
||||||
|
}
|
||||||
|
|
||||||
AndroidUtilities.runOnUIThread(()->{
|
AndroidUtilities.runOnUIThread(() -> NotificationCenter.getInstance(currentAccount).doOnIdle(() -> {
|
||||||
userReactions = newReactions;
|
userReactions = newReactions;
|
||||||
if (onlySeenNow) {
|
if (onlySeenNow) {
|
||||||
onlySeenNow = false;
|
onlySeenNow = false;
|
||||||
|
@ -206,7 +214,7 @@ public class ReactedUsersListView extends FrameLayout {
|
||||||
if (offset == null)
|
if (offset == null)
|
||||||
canLoadMore = false;
|
canLoadMore = false;
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
});
|
}));
|
||||||
} else isLoading = false;
|
} else isLoading = false;
|
||||||
}, ConnectionsManager.RequestFlagInvokeAfter);
|
}, ConnectionsManager.RequestFlagInvokeAfter);
|
||||||
}
|
}
|
||||||
|
@ -247,7 +255,7 @@ public class ReactedUsersListView extends FrameLayout {
|
||||||
titleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
|
titleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
|
||||||
titleView.setTextColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem));
|
titleView.setTextColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem));
|
||||||
titleView.setEllipsize(TextUtils.TruncateAt.END);
|
titleView.setEllipsize(TextUtils.TruncateAt.END);
|
||||||
addView(titleView, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.CENTER_VERTICAL, 65, 0, 44, 0));
|
addView(titleView, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.CENTER_VERTICAL, 58, 0, 44, 0));
|
||||||
|
|
||||||
reactView = new BackupImageView(context);
|
reactView = new BackupImageView(context);
|
||||||
addView(reactView, LayoutHelper.createFrameRelatively(24, 24, Gravity.END | Gravity.CENTER_VERTICAL, 0, 0, 12, 0));
|
addView(reactView, LayoutHelper.createFrameRelatively(24, 24, Gravity.END | Gravity.CENTER_VERTICAL, 0, 0, 12, 0));
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.telegram.ui.Components;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Color;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.Path;
|
import android.graphics.Path;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
|
@ -16,6 +17,7 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.core.graphics.ColorUtils;
|
||||||
|
|
||||||
import org.telegram.messenger.AndroidUtilities;
|
import org.telegram.messenger.AndroidUtilities;
|
||||||
import org.telegram.messenger.DocumentObject;
|
import org.telegram.messenger.DocumentObject;
|
||||||
|
@ -39,13 +41,17 @@ public class ReactionTabHolderView extends FrameLayout {
|
||||||
private TextView counterView;
|
private TextView counterView;
|
||||||
|
|
||||||
private float outlineProgress;
|
private float outlineProgress;
|
||||||
|
Drawable drawable;
|
||||||
public ReactionTabHolderView(@NonNull Context context) {
|
public ReactionTabHolderView(@NonNull Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
|
|
||||||
|
View 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));
|
||||||
|
|
||||||
|
|
||||||
iconView = new ImageView(context);
|
iconView = new ImageView(context);
|
||||||
Drawable drawable = ContextCompat.getDrawable(context, R.drawable.msg_reactions_filled).mutate();
|
drawable = ContextCompat.getDrawable(context, R.drawable.msg_reactions_filled).mutate();
|
||||||
drawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_avatar_nameInMessageBlue), PorterDuff.Mode.MULTIPLY));
|
|
||||||
iconView.setImageDrawable(drawable);
|
iconView.setImageDrawable(drawable);
|
||||||
addView(iconView, LayoutHelper.createFrameRelatively(24, 24, Gravity.START | Gravity.CENTER_VERTICAL, 8, 0, 8, 0));
|
addView(iconView, LayoutHelper.createFrameRelatively(24, 24, Gravity.START | Gravity.CENTER_VERTICAL, 8, 0, 8, 0));
|
||||||
|
|
||||||
|
@ -58,20 +64,24 @@ public class ReactionTabHolderView extends FrameLayout {
|
||||||
|
|
||||||
outlinePaint.setStyle(Paint.Style.STROKE);
|
outlinePaint.setStyle(Paint.Style.STROKE);
|
||||||
outlinePaint.setStrokeWidth(AndroidUtilities.dp(1));
|
outlinePaint.setStrokeWidth(AndroidUtilities.dp(1));
|
||||||
outlinePaint.setColor(Theme.getColor(Theme.key_avatar_nameInMessageBlue));
|
|
||||||
|
|
||||||
bgPaint.setColor(Theme.getColor(Theme.key_avatar_nameInMessageBlue));
|
|
||||||
bgPaint.setAlpha(0x10);
|
|
||||||
|
|
||||||
View overlaySelectorView = new View(context);
|
|
||||||
overlaySelectorView.setBackground(Theme.getSelectorDrawable(bgPaint.getColor(), false));
|
|
||||||
addView(overlaySelectorView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
|
||||||
|
|
||||||
setWillNotDraw(false);
|
setWillNotDraw(false);
|
||||||
|
|
||||||
|
setOutlineProgress(outlineProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOutlineProgress(float outlineProgress) {
|
public void setOutlineProgress(float outlineProgress) {
|
||||||
this.outlineProgress = outlineProgress;
|
this.outlineProgress = outlineProgress;
|
||||||
|
int backgroundSelectedColor = Theme.getColor(Theme.key_chat_inReactionButtonBackground);
|
||||||
|
int backgroundColor = ColorUtils.setAlphaComponent(Theme.getColor(Theme.key_chat_inReactionButtonBackground), 0x10);
|
||||||
|
|
||||||
|
int textSelectedColor = Theme.getColor(Theme.key_chat_inReactionButtonTextSelected);
|
||||||
|
int textColor = Theme.getColor(Theme.key_chat_inReactionButtonText);
|
||||||
|
int textFinalColor = ColorUtils.blendARGB(textColor, textSelectedColor, outlineProgress);
|
||||||
|
|
||||||
|
bgPaint.setColor(ColorUtils.blendARGB(backgroundColor, backgroundSelectedColor, outlineProgress));
|
||||||
|
counterView.setTextColor(textFinalColor);
|
||||||
|
drawable.setColorFilter(new PorterDuffColorFilter(textFinalColor, PorterDuff.Mode.MULTIPLY));
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,19 +107,14 @@ public class ReactionTabHolderView extends FrameLayout {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void dispatchDraw(Canvas canvas) {
|
protected void dispatchDraw(Canvas canvas) {
|
||||||
int s = canvas.save();
|
|
||||||
path.rewind();
|
|
||||||
rect.set(0, 0, getWidth(), getHeight());
|
rect.set(0, 0, getWidth(), getHeight());
|
||||||
path.addRoundRect(rect, radius, radius, Path.Direction.CW);
|
|
||||||
canvas.clipPath(path);
|
|
||||||
|
|
||||||
canvas.drawRoundRect(rect, radius, radius, bgPaint);
|
canvas.drawRoundRect(rect, radius, radius, bgPaint);
|
||||||
super.dispatchDraw(canvas);
|
super.dispatchDraw(canvas);
|
||||||
|
|
||||||
outlinePaint.setAlpha((int) (outlineProgress * 0xFF));
|
// outlinePaint.setAlpha((int) (outlineProgress * 0xFF));
|
||||||
float w = outlinePaint.getStrokeWidth();
|
// float w = outlinePaint.getStrokeWidth();
|
||||||
rect.set(w, w, getWidth() - w, getHeight() - w);
|
// rect.set(w, w, getWidth() - w, getHeight() - w);
|
||||||
canvas.drawRoundRect(rect, radius, radius, outlinePaint);
|
// canvas.drawRoundRect(rect, radius, radius, outlinePaint);
|
||||||
canvas.restoreToCount(s);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,6 +10,7 @@ import android.widget.FrameLayout;
|
||||||
import org.telegram.messenger.AndroidUtilities;
|
import org.telegram.messenger.AndroidUtilities;
|
||||||
import org.telegram.messenger.ImageLocation;
|
import org.telegram.messenger.ImageLocation;
|
||||||
import org.telegram.messenger.MediaDataController;
|
import org.telegram.messenger.MediaDataController;
|
||||||
|
import org.telegram.messenger.MessagesController;
|
||||||
import org.telegram.tgnet.TLRPC;
|
import org.telegram.tgnet.TLRPC;
|
||||||
import org.telegram.ui.ActionBar.BaseFragment;
|
import org.telegram.ui.ActionBar.BaseFragment;
|
||||||
import org.telegram.ui.Cells.ChatMessageCell;
|
import org.telegram.ui.Cells.ChatMessageCell;
|
||||||
|
@ -24,6 +25,7 @@ public class ReactionsEffectOverlay {
|
||||||
|
|
||||||
private final AnimationView effectImageView;
|
private final AnimationView effectImageView;
|
||||||
private final AnimationView emojiImageView;
|
private final AnimationView emojiImageView;
|
||||||
|
private final AnimationView emojiStaticImageView;
|
||||||
private final FrameLayout container;
|
private final FrameLayout container;
|
||||||
boolean animateIn;
|
boolean animateIn;
|
||||||
float animateInProgress;
|
float animateInProgress;
|
||||||
|
@ -53,6 +55,7 @@ public class ReactionsEffectOverlay {
|
||||||
this.reaction = reaction;
|
this.reaction = reaction;
|
||||||
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;
|
||||||
if (reactionsLayout != null) {
|
if (reactionsLayout != null) {
|
||||||
for (int i = 0; i < reactionsLayout.recyclerListView.getChildCount(); i++) {
|
for (int i = 0; i < reactionsLayout.recyclerListView.getChildCount(); i++) {
|
||||||
if (((ReactionsContainerLayout.ReactionHolderView) reactionsLayout.recyclerListView.getChildAt(i)).currentReaction.reaction.equals(reaction)) {
|
if (((ReactionsContainerLayout.ReactionHolderView) reactionsLayout.recyclerListView.getChildAt(i)).currentReaction.reaction.equals(reaction)) {
|
||||||
|
@ -141,6 +144,9 @@ public class ReactionsEffectOverlay {
|
||||||
toX += reactionButton.x + reactionButton.imageReceiver.getImageX();
|
toX += reactionButton.x + reactionButton.imageReceiver.getImageX();
|
||||||
toY += reactionButton.y + reactionButton.imageReceiver.getImageY();
|
toY += reactionButton.y + reactionButton.imageReceiver.getImageY();
|
||||||
}
|
}
|
||||||
|
if (chatActivity != null) {
|
||||||
|
toY += chatActivity.drawingChatLisViewYoffset;
|
||||||
|
}
|
||||||
|
|
||||||
lastDrawnToX = toX;
|
lastDrawnToX = toX;
|
||||||
lastDrawnToY = toY;
|
lastDrawnToY = toY;
|
||||||
|
@ -164,6 +170,7 @@ public class ReactionsEffectOverlay {
|
||||||
}
|
}
|
||||||
|
|
||||||
float animateInProgressX, animateInProgressY;
|
float animateInProgressX, animateInProgressY;
|
||||||
|
float animateOutProgress = CubicBezierInterpolator.DEFAULT.getInterpolation(ReactionsEffectOverlay.this.animateOutProgress);
|
||||||
if (fromHolder) {
|
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);
|
||||||
|
@ -187,6 +194,8 @@ public class ReactionsEffectOverlay {
|
||||||
effectImageView.setTranslationX(x);
|
effectImageView.setTranslationX(x);
|
||||||
effectImageView.setTranslationY(y);
|
effectImageView.setTranslationY(y);
|
||||||
effectImageView.setAlpha((1f - animateOutProgress));
|
effectImageView.setAlpha((1f - animateOutProgress));
|
||||||
|
effectImageView.setScaleX(scale);
|
||||||
|
effectImageView.setScaleY(scale);
|
||||||
|
|
||||||
if (animateOutProgress != 0) {
|
if (animateOutProgress != 0) {
|
||||||
scale = scale * (1f - animateOutProgress) + toScale * animateOutProgress;
|
scale = scale * (1f - animateOutProgress) + toScale * animateOutProgress;
|
||||||
|
@ -194,6 +203,9 @@ public class ReactionsEffectOverlay {
|
||||||
y = y * (1f - animateOutProgress) + toY * animateOutProgress;
|
y = y * (1f - animateOutProgress) + toY * animateOutProgress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
emojiStaticImageView.setAlpha(animateOutProgress > 0.7f ? (animateOutProgress - 0.7f) / 0.3f : 0);
|
||||||
|
//emojiImageView.setAlpha(animateOutProgress < 0.5f ? 1f - (animateOutProgress / 0.5f) : 0f);
|
||||||
container.setTranslationX(x);
|
container.setTranslationX(x);
|
||||||
container.setTranslationY(y);
|
container.setTranslationY(y);
|
||||||
|
|
||||||
|
@ -214,10 +226,10 @@ public class ReactionsEffectOverlay {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wasScrolled || (emojiImageView.wasPlaying && emojiImageView.getImageReceiver().getLottieAnimation() != null && !emojiImageView.getImageReceiver().getLottieAnimation().isRunning())) {
|
if (wasScrolled || (emojiImageView.wasPlaying && emojiImageView.getImageReceiver().getLottieAnimation() != null && !emojiImageView.getImageReceiver().getLottieAnimation().isRunning())) {
|
||||||
if (animateOutProgress != 1f) {
|
if (ReactionsEffectOverlay.this.animateOutProgress != 1f) {
|
||||||
animateOutProgress += 16f / 220f;
|
ReactionsEffectOverlay.this.animateOutProgress += 16f / 220f;
|
||||||
if (animateOutProgress > 1f) {
|
if (ReactionsEffectOverlay.this.animateOutProgress > 1f) {
|
||||||
animateOutProgress = 1f;
|
ReactionsEffectOverlay.this.animateOutProgress = 1f;
|
||||||
currentOverlay = null;
|
currentOverlay = null;
|
||||||
cell.invalidate();
|
cell.invalidate();
|
||||||
if (cell.getCurrentMessagesGroup() != null && cell.getParent() != null) {
|
if (cell.getCurrentMessagesGroup() != null && cell.getParent() != null) {
|
||||||
|
@ -239,6 +251,7 @@ public class ReactionsEffectOverlay {
|
||||||
};
|
};
|
||||||
effectImageView = new AnimationView(context);
|
effectImageView = new AnimationView(context);
|
||||||
emojiImageView = new AnimationView(context);
|
emojiImageView = 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;
|
TLRPC.Document document = availableReaction.effect_animation;
|
||||||
|
@ -274,6 +287,15 @@ public class ReactionsEffectOverlay {
|
||||||
((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);
|
||||||
|
|
||||||
|
container.addView(emojiStaticImageView);
|
||||||
|
emojiStaticImageView.getLayoutParams().width = emojiSize;
|
||||||
|
emojiStaticImageView.getLayoutParams().height = emojiSize;
|
||||||
|
((FrameLayout.LayoutParams) emojiStaticImageView.getLayoutParams()).topMargin = topOffset;
|
||||||
|
((FrameLayout.LayoutParams) emojiStaticImageView.getLayoutParams()).leftMargin = leftOffset;
|
||||||
|
|
||||||
|
|
||||||
windowView.addView(container);
|
windowView.addView(container);
|
||||||
container.getLayoutParams().width = size;
|
container.getLayoutParams().width = size;
|
||||||
container.getLayoutParams().height = size;
|
container.getLayoutParams().height = size;
|
||||||
|
@ -298,6 +320,10 @@ public class ReactionsEffectOverlay {
|
||||||
if (cell == null) {
|
if (cell == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
boolean animationEnabled = MessagesController.getGlobalMainSettings().getBoolean("view_animations", true);
|
||||||
|
if (!animationEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
ReactionsEffectOverlay reactionsEffectOverlay = new ReactionsEffectOverlay(baseFragment.getParentActivity(), baseFragment, reactionsLayout, cell, x, y, reaction, currentAccount);
|
ReactionsEffectOverlay reactionsEffectOverlay = new ReactionsEffectOverlay(baseFragment.getParentActivity(), baseFragment, reactionsLayout, cell, x, y, reaction, currentAccount);
|
||||||
currentOverlay = reactionsEffectOverlay;
|
currentOverlay = reactionsEffectOverlay;
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,7 @@ public class ReactionsLayoutInBubble {
|
||||||
ChatMessageCell parentView;
|
ChatMessageCell parentView;
|
||||||
MessageObject messageObject;
|
MessageObject messageObject;
|
||||||
Theme.ResourcesProvider resourcesProvider;
|
Theme.ResourcesProvider resourcesProvider;
|
||||||
|
private String scrimViewReaction;
|
||||||
|
|
||||||
int availableWidth;
|
int availableWidth;
|
||||||
private int lastDrawnWidth;
|
private int lastDrawnWidth;
|
||||||
|
@ -125,6 +126,9 @@ public class ReactionsLayoutInBubble {
|
||||||
reactionButtons.add(new ReactionButton(reactionCount));
|
reactionButtons.add(new ReactionButton(reactionCount));
|
||||||
reactionButtons.get(0).isSelected = false;
|
reactionButtons.get(0).isSelected = false;
|
||||||
reactionButtons.get(1).isSelected = true;
|
reactionButtons.get(1).isSelected = true;
|
||||||
|
reactionButtons.get(0).realCount = 1;
|
||||||
|
reactionButtons.get(1).realCount = 1;
|
||||||
|
reactionButtons.get(1).key = reactionButtons.get(1).key + "_";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (isSmall && i == 2) {
|
if (isSmall && i == 2) {
|
||||||
|
@ -135,9 +139,11 @@ public class ReactionsLayoutInBubble {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!isSmall) {
|
||||||
comparator.currentAccount = currentAccount;
|
comparator.currentAccount = currentAccount;
|
||||||
Collections.sort(reactionButtons, comparator);
|
Collections.sort(reactionButtons, comparator);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
isEmpty = reactionButtons.isEmpty();
|
isEmpty = reactionButtons.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,7 +196,7 @@ public class ReactionsLayoutInBubble {
|
||||||
drawServiceShaderBackground = false;
|
drawServiceShaderBackground = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Canvas canvas, float animationProgress) {
|
public void draw(Canvas canvas, float animationProgress, String drawOnlyReaction) {
|
||||||
if (isEmpty && outButtons.isEmpty()) {
|
if (isEmpty && outButtons.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -207,6 +213,9 @@ public class ReactionsLayoutInBubble {
|
||||||
canvas.translate(totalX, totalY);
|
canvas.translate(totalX, totalY);
|
||||||
for (int i = 0; i < reactionButtons.size(); i++) {
|
for (int i = 0; i < reactionButtons.size(); i++) {
|
||||||
ReactionButton reactionButton = reactionButtons.get(i);
|
ReactionButton reactionButton = reactionButtons.get(i);
|
||||||
|
if (reactionButton.reaction.equals(scrimViewReaction) || (drawOnlyReaction != null && !reactionButton.reaction.equals(drawOnlyReaction))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
canvas.save();
|
canvas.save();
|
||||||
float x = reactionButton.x;
|
float x = reactionButton.x;
|
||||||
float y = reactionButton.y;
|
float y = reactionButton.y;
|
||||||
|
@ -221,7 +230,7 @@ public class ReactionsLayoutInBubble {
|
||||||
alpha = animationProgress;
|
alpha = animationProgress;
|
||||||
canvas.scale(s, s, reactionButton.width / 2f, reactionButton.height / 2f);
|
canvas.scale(s, s, reactionButton.width / 2f, reactionButton.height / 2f);
|
||||||
}
|
}
|
||||||
reactionButton.draw(canvas, reactionButton.animationType == ANIMATION_TYPE_IN ? 1f : animationProgress, alpha);
|
reactionButton.draw(canvas, reactionButton.animationType == ANIMATION_TYPE_MOVE ? animationProgress : 1f, alpha, drawOnlyReaction != null);
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +240,7 @@ public class ReactionsLayoutInBubble {
|
||||||
canvas.translate(reactionButton.x, reactionButton.y);
|
canvas.translate(reactionButton.x, reactionButton.y);
|
||||||
float s = 0.5f + 0.5f * (1f - animationProgress);
|
float s = 0.5f + 0.5f * (1f - animationProgress);
|
||||||
canvas.scale(s, s, reactionButton.width / 2f, reactionButton.height / 2f);
|
canvas.scale(s, s, reactionButton.width / 2f, reactionButton.height / 2f);
|
||||||
outButtons.get(i).draw(canvas, 1f, (1f - animationProgress));
|
outButtons.get(i).draw(canvas, 1f, (1f - animationProgress), false);
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
}
|
}
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
|
@ -240,7 +249,7 @@ public class ReactionsLayoutInBubble {
|
||||||
public void recordDrawingState() {
|
public void recordDrawingState() {
|
||||||
lastDrawingReactionButtons.clear();
|
lastDrawingReactionButtons.clear();
|
||||||
for (int i = 0; i < reactionButtons.size(); i++) {
|
for (int i = 0; i < reactionButtons.size(); i++) {
|
||||||
lastDrawingReactionButtons.put(reactionButtons.get(i).reaction, reactionButtons.get(i));
|
lastDrawingReactionButtons.put(reactionButtons.get(i).key, reactionButtons.get(i));
|
||||||
}
|
}
|
||||||
wasDrawn = !isEmpty;
|
wasDrawn = !isEmpty;
|
||||||
lastDrawnX = x;
|
lastDrawnX = x;
|
||||||
|
@ -249,6 +258,9 @@ public class ReactionsLayoutInBubble {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean animateChange() {
|
public boolean animateChange() {
|
||||||
|
if (messageObject == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
lastDrawingReactionButtonsTmp.clear();
|
lastDrawingReactionButtonsTmp.clear();
|
||||||
for (int i = 0; i < outButtons.size(); i++) {
|
for (int i = 0; i < outButtons.size(); i++) {
|
||||||
|
@ -258,12 +270,13 @@ public class ReactionsLayoutInBubble {
|
||||||
lastDrawingReactionButtonsTmp.putAll(lastDrawingReactionButtons);
|
lastDrawingReactionButtonsTmp.putAll(lastDrawingReactionButtons);
|
||||||
for (int i = 0; i < reactionButtons.size(); i++) {
|
for (int i = 0; i < reactionButtons.size(); i++) {
|
||||||
ReactionButton button = reactionButtons.get(i);
|
ReactionButton button = reactionButtons.get(i);
|
||||||
ReactionButton lastButton = lastDrawingReactionButtonsTmp.remove(button.reaction);
|
ReactionButton lastButton = lastDrawingReactionButtonsTmp.remove(button.key);
|
||||||
if (lastButton != null) {
|
if (lastButton != null) {
|
||||||
if (button.animateFromX != lastButton.x || button.animateFromY != lastButton.y || button.animateFromWidth != lastButton.width || button.count != lastButton.count || button.backgroundColor != lastButton.backgroundColor) {
|
if (button.x != lastButton.x || button.y != lastButton.y || button.width != lastButton.width || button.count != lastButton.count || button.backgroundColor != lastButton.backgroundColor) {
|
||||||
button.animateFromX = lastButton.x;
|
button.animateFromX = lastButton.x;
|
||||||
button.animateFromY = lastButton.y;
|
button.animateFromY = lastButton.y;
|
||||||
button.animateFromWidth = lastButton.width;
|
button.animateFromWidth = lastButton.width;
|
||||||
|
|
||||||
button.fromTextColor = lastButton.lastDrawnTextColor;
|
button.fromTextColor = lastButton.lastDrawnTextColor;
|
||||||
button.fromBackgroundColor = lastButton.lastDrawnBackgroundColor;
|
button.fromBackgroundColor = lastButton.lastDrawnBackgroundColor;
|
||||||
button.animationType = ANIMATION_TYPE_MOVE;
|
button.animationType = ANIMATION_TYPE_MOVE;
|
||||||
|
@ -328,9 +341,19 @@ public class ReactionsLayoutInBubble {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReactionButton getReactionButton(String reaction) {
|
public ReactionButton getReactionButton(String reaction) {
|
||||||
|
if (isSmall) {
|
||||||
|
ReactionButton button = lastDrawingReactionButtons.get(reaction + "_");
|
||||||
|
if (button != null) {
|
||||||
|
return button;
|
||||||
|
}
|
||||||
|
}
|
||||||
return lastDrawingReactionButtons.get(reaction);
|
return lastDrawingReactionButtons.get(reaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setScrimReaction(String scrimViewReaction) {
|
||||||
|
this.scrimViewReaction = scrimViewReaction;
|
||||||
|
}
|
||||||
|
|
||||||
public class ReactionButton {
|
public class ReactionButton {
|
||||||
|
|
||||||
private final TLRPC.TL_reactionCount reactionCount;
|
private final TLRPC.TL_reactionCount reactionCount;
|
||||||
|
@ -343,14 +366,17 @@ public class ReactionsLayoutInBubble {
|
||||||
public int realCount;
|
public int realCount;
|
||||||
public boolean drawImage = true;
|
public boolean drawImage = true;
|
||||||
public boolean lastImageDrawn;
|
public boolean lastImageDrawn;
|
||||||
|
public boolean wasDrawn;
|
||||||
|
public String key;
|
||||||
|
|
||||||
String countText;
|
String countText;
|
||||||
String reaction;
|
String reaction;
|
||||||
|
|
||||||
int count;
|
int count;
|
||||||
public int x;
|
public int x;
|
||||||
public int y;
|
public int y;
|
||||||
int width;
|
public int width;
|
||||||
int height;
|
public int height;
|
||||||
ImageReceiver imageReceiver = new ImageReceiver();
|
ImageReceiver imageReceiver = new ImageReceiver();
|
||||||
CounterView.CounterDrawable counterDrawable = new CounterView.CounterDrawable(parentView, false, null);
|
CounterView.CounterDrawable counterDrawable = new CounterView.CounterDrawable(parentView, false, null);
|
||||||
int backgroundColor;
|
int backgroundColor;
|
||||||
|
@ -369,10 +395,12 @@ public class ReactionsLayoutInBubble {
|
||||||
this.reaction = reactionCount.reaction;
|
this.reaction = reactionCount.reaction;
|
||||||
this.count = reactionCount.count;
|
this.count = reactionCount.count;
|
||||||
this.realCount = reactionCount.count;
|
this.realCount = reactionCount.count;
|
||||||
|
this.key = this.reaction;
|
||||||
countText = Integer.toString(reactionCount.count);
|
countText = Integer.toString(reactionCount.count);
|
||||||
imageReceiver.setParentView(parentView);
|
imageReceiver.setParentView(parentView);
|
||||||
isSelected = reactionCount.chosen;
|
isSelected = reactionCount.chosen;
|
||||||
counterDrawable.updateVisibility = false;
|
counterDrawable.updateVisibility = false;
|
||||||
|
counterDrawable.shortFormat = true;
|
||||||
if (reactionCount.chosen) {
|
if (reactionCount.chosen) {
|
||||||
backgroundColor = Theme.getColor(messageObject.isOutOwner() ? Theme.key_chat_outReactionButtonBackground : Theme.key_chat_inReactionButtonBackground, resourcesProvider);
|
backgroundColor = Theme.getColor(messageObject.isOutOwner() ? Theme.key_chat_outReactionButtonBackground : Theme.key_chat_inReactionButtonBackground, resourcesProvider);
|
||||||
textColor = Theme.getColor(messageObject.isOutOwner() ? Theme.key_chat_outReactionButtonTextSelected : Theme.key_chat_inReactionButtonTextSelected, resourcesProvider);
|
textColor = Theme.getColor(messageObject.isOutOwner() ? Theme.key_chat_outReactionButtonTextSelected : Theme.key_chat_inReactionButtonTextSelected, resourcesProvider);
|
||||||
|
@ -402,20 +430,17 @@ public class ReactionsLayoutInBubble {
|
||||||
counterDrawable.gravity = Gravity.LEFT;
|
counterDrawable.gravity = Gravity.LEFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Canvas canvas, float progress, float alpha) {
|
public void draw(Canvas canvas, float progress, float alpha, boolean drawOverlayScrim) {
|
||||||
|
wasDrawn = true;
|
||||||
if (isSmall) {
|
if (isSmall) {
|
||||||
imageReceiver.setAlpha(alpha);
|
imageReceiver.setAlpha(alpha);
|
||||||
imageReceiver.setImageCoords(0, 0, AndroidUtilities.dp(14), AndroidUtilities.dp(14));
|
imageReceiver.setImageCoords(0, 0, AndroidUtilities.dp(14), AndroidUtilities.dp(14));
|
||||||
drawImage(canvas);
|
drawImage(canvas);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (drawServiceShaderBackground) {
|
updateColors(progress);
|
||||||
textPaint.setColor(lastDrawnTextColor = ColorUtils.blendARGB(fromTextColor, serviceTextColor, progress));
|
textPaint.setColor(lastDrawnTextColor);
|
||||||
paint.setColor(lastDrawnBackgroundColor = ColorUtils.blendARGB(fromBackgroundColor, serviceBackgroundColor, progress));
|
paint.setColor(lastDrawnBackgroundColor);
|
||||||
} else {
|
|
||||||
textPaint.setColor(lastDrawnTextColor = ColorUtils.blendARGB(fromTextColor, textColor, progress));
|
|
||||||
paint.setColor(lastDrawnBackgroundColor = ColorUtils.blendARGB(fromBackgroundColor, backgroundColor, progress));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (alpha != 1f) {
|
if (alpha != 1f) {
|
||||||
textPaint.setAlpha((int) (textPaint.getAlpha() * alpha));
|
textPaint.setAlpha((int) (textPaint.getAlpha() * alpha));
|
||||||
|
@ -443,6 +468,12 @@ public class ReactionsLayoutInBubble {
|
||||||
paint1.setAlpha(oldAlpha);
|
paint1.setAlpha(oldAlpha);
|
||||||
paint2.setAlpha(oldAlpha2);
|
paint2.setAlpha(oldAlpha2);
|
||||||
}
|
}
|
||||||
|
if (!drawServiceShaderBackground && drawOverlayScrim) {
|
||||||
|
Theme.MessageDrawable messageBackground = parentView.getCurrentBackgroundDrawable(false);
|
||||||
|
if (messageBackground != null) {
|
||||||
|
canvas.drawRoundRect(AndroidUtilities.rectTmp, rad, rad, messageBackground.getPaint());
|
||||||
|
}
|
||||||
|
}
|
||||||
canvas.drawRoundRect(AndroidUtilities.rectTmp, rad, rad, paint);
|
canvas.drawRoundRect(AndroidUtilities.rectTmp, rad, rad, paint);
|
||||||
|
|
||||||
imageReceiver.setImageCoords(AndroidUtilities.dp(8), (height - AndroidUtilities.dp(20)) / 2f, AndroidUtilities.dp(20), AndroidUtilities.dp(20));
|
imageReceiver.setImageCoords(AndroidUtilities.dp(8), (height - AndroidUtilities.dp(20)) / 2f, AndroidUtilities.dp(20), AndroidUtilities.dp(20));
|
||||||
|
@ -464,6 +495,16 @@ public class ReactionsLayoutInBubble {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateColors(float progress) {
|
||||||
|
if (drawServiceShaderBackground) {
|
||||||
|
lastDrawnTextColor = ColorUtils.blendARGB(fromTextColor, serviceTextColor, progress);
|
||||||
|
lastDrawnBackgroundColor = ColorUtils.blendARGB(fromBackgroundColor, serviceBackgroundColor, progress);
|
||||||
|
} else {
|
||||||
|
lastDrawnTextColor = ColorUtils.blendARGB(fromTextColor, textColor, progress);
|
||||||
|
lastDrawnBackgroundColor = ColorUtils.blendARGB(fromBackgroundColor, backgroundColor, progress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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.draw(canvas);
|
||||||
|
@ -497,8 +538,6 @@ public class ReactionsLayoutInBubble {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void attach() {
|
public void attach() {
|
||||||
if (imageReceiver != null) {
|
if (imageReceiver != null) {
|
||||||
imageReceiver.onAttachedToWindow();
|
imageReceiver.onAttachedToWindow();
|
||||||
|
@ -517,7 +556,6 @@ public class ReactionsLayoutInBubble {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static int attachedCount;
|
|
||||||
|
|
||||||
float lastX;
|
float lastX;
|
||||||
float lastY;
|
float lastY;
|
||||||
|
@ -526,7 +564,7 @@ public class ReactionsLayoutInBubble {
|
||||||
Runnable longPressRunnable;
|
Runnable longPressRunnable;
|
||||||
|
|
||||||
public boolean chekTouchEvent(MotionEvent event) {
|
public boolean chekTouchEvent(MotionEvent event) {
|
||||||
if (isEmpty || messageObject == null || messageObject.messageOwner == null || messageObject.messageOwner.reactions == null) {
|
if (isEmpty || isSmall || messageObject == null || messageObject.messageOwner == null || messageObject.messageOwner.reactions == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
float x = event.getX() - this.x;
|
float x = event.getX() - this.x;
|
||||||
|
@ -538,16 +576,18 @@ public class ReactionsLayoutInBubble {
|
||||||
lastX = event.getX();
|
lastX = event.getX();
|
||||||
lastY = event.getY();
|
lastY = event.getY();
|
||||||
lastSelectedButton = reactionButtons.get(i);
|
lastSelectedButton = reactionButtons.get(i);
|
||||||
if (longPressRunnable != null && messageObject.messageOwner.reactions.can_see_list) {
|
if (longPressRunnable != null) {
|
||||||
AndroidUtilities.cancelRunOnUIThread(longPressRunnable);
|
AndroidUtilities.cancelRunOnUIThread(longPressRunnable);
|
||||||
longPressRunnable = null;
|
longPressRunnable = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final ReactionButton selectedButtonFinal = lastSelectedButton;
|
final ReactionButton selectedButtonFinal = lastSelectedButton;
|
||||||
|
if (messageObject.messageOwner.reactions.can_see_list) {
|
||||||
AndroidUtilities.runOnUIThread(longPressRunnable = () -> {
|
AndroidUtilities.runOnUIThread(longPressRunnable = () -> {
|
||||||
parentView.getDelegate().didPressReaction(parentView, selectedButtonFinal.reactionCount, true);
|
parentView.getDelegate().didPressReaction(parentView, selectedButtonFinal.reactionCount, true);
|
||||||
longPressRunnable = null;
|
longPressRunnable = null;
|
||||||
}, ViewConfiguration.getLongPressTimeout());
|
}, ViewConfiguration.getLongPressTimeout());
|
||||||
|
}
|
||||||
pressed = true;
|
pressed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.telegram.ui.Components;
|
||||||
|
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.AnimatorListenerAdapter;
|
import android.animation.AnimatorListenerAdapter;
|
||||||
|
import android.animation.ObjectAnimator;
|
||||||
import android.animation.ValueAnimator;
|
import android.animation.ValueAnimator;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -17,15 +18,16 @@ import android.graphics.RectF;
|
||||||
import android.graphics.Region;
|
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.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.animation.OvershootInterpolator;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.util.Consumer;
|
import androidx.core.util.Consumer;
|
||||||
import androidx.dynamicanimation.animation.FloatPropertyCompat;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
@ -33,7 +35,12 @@ import org.telegram.messenger.AndroidUtilities;
|
||||||
import org.telegram.messenger.DocumentObject;
|
import org.telegram.messenger.DocumentObject;
|
||||||
import org.telegram.messenger.ImageLocation;
|
import org.telegram.messenger.ImageLocation;
|
||||||
import org.telegram.messenger.LocaleController;
|
import org.telegram.messenger.LocaleController;
|
||||||
|
import org.telegram.messenger.MediaDataController;
|
||||||
|
import org.telegram.messenger.MessageObject;
|
||||||
|
import org.telegram.messenger.MessagesController;
|
||||||
|
import org.telegram.messenger.NotificationCenter;
|
||||||
import org.telegram.messenger.R;
|
import org.telegram.messenger.R;
|
||||||
|
import org.telegram.messenger.SharedConfig;
|
||||||
import org.telegram.messenger.SvgHelper;
|
import org.telegram.messenger.SvgHelper;
|
||||||
import org.telegram.tgnet.TLRPC;
|
import org.telegram.tgnet.TLRPC;
|
||||||
import org.telegram.ui.ActionBar.Theme;
|
import org.telegram.ui.ActionBar.Theme;
|
||||||
|
@ -44,16 +51,16 @@ import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class ReactionsContainerLayout extends FrameLayout {
|
public class ReactionsContainerLayout extends FrameLayout implements NotificationCenter.NotificationCenterDelegate {
|
||||||
public final static FloatPropertyCompat<ReactionsContainerLayout> TRANSITION_PROGRESS_VALUE = new FloatPropertyCompat<ReactionsContainerLayout>("transitionProgress") {
|
public final static Property<ReactionsContainerLayout, Float> TRANSITION_PROGRESS_VALUE = new Property<ReactionsContainerLayout, Float>(Float.class, "transitionProgress") {
|
||||||
@Override
|
@Override
|
||||||
public float getValue(ReactionsContainerLayout object) {
|
public Float get(ReactionsContainerLayout reactionsContainerLayout) {
|
||||||
return object.transitionProgress * 100f;
|
return reactionsContainerLayout.transitionProgress ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setValue(ReactionsContainerLayout object, float value) {
|
public void set(ReactionsContainerLayout object, Float value) {
|
||||||
object.setTransitionProgress(value / 100f);
|
object.setTransitionProgress(value);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -76,6 +83,9 @@ public class ReactionsContainerLayout extends FrameLayout {
|
||||||
private float bigCircleRadius = AndroidUtilities.dp(8);
|
private float bigCircleRadius = AndroidUtilities.dp(8);
|
||||||
private float smallCircleRadius = bigCircleRadius / 2;
|
private float smallCircleRadius = bigCircleRadius / 2;
|
||||||
private int bigCircleOffset = AndroidUtilities.dp(36);
|
private int bigCircleOffset = AndroidUtilities.dp(36);
|
||||||
|
private MessageObject messageObject;
|
||||||
|
private int currentAccount;
|
||||||
|
private long waitingLoadingChatId;
|
||||||
|
|
||||||
private List<TLRPC.TL_availableReaction> reactionsList = Collections.emptyList();
|
private List<TLRPC.TL_availableReaction> reactionsList = Collections.emptyList();
|
||||||
|
|
||||||
|
@ -88,13 +98,17 @@ public class ReactionsContainerLayout extends FrameLayout {
|
||||||
|
|
||||||
private Rect shadowPad = new Rect();
|
private Rect shadowPad = new Rect();
|
||||||
private Drawable shadow;
|
private Drawable shadow;
|
||||||
|
private final boolean animationEnabled;
|
||||||
|
|
||||||
private List<String> triggeredReactions = new ArrayList<>();
|
private List<String> triggeredReactions = new ArrayList<>();
|
||||||
Theme.ResourcesProvider resourcesProvider;
|
Theme.ResourcesProvider resourcesProvider;
|
||||||
|
|
||||||
public ReactionsContainerLayout(@NonNull Context context, Theme.ResourcesProvider resourcesProvider) {
|
public ReactionsContainerLayout(@NonNull Context context, int currentAccount, Theme.ResourcesProvider resourcesProvider) {
|
||||||
super(context);
|
super(context);
|
||||||
this.resourcesProvider = resourcesProvider;
|
this.resourcesProvider = resourcesProvider;
|
||||||
|
this.currentAccount = currentAccount;
|
||||||
|
|
||||||
|
animationEnabled = MessagesController.getGlobalMainSettings().getBoolean("view_animations", true) && SharedConfig.getDevicePerformanceClass() != SharedConfig.PERFORMANCE_CLASS_LOW;
|
||||||
|
|
||||||
shadow = ContextCompat.getDrawable(context, R.drawable.reactions_bubble_shadow).mutate();
|
shadow = ContextCompat.getDrawable(context, R.drawable.reactions_bubble_shadow).mutate();
|
||||||
shadowPad.left = shadowPad.top = shadowPad.right = shadowPad.bottom = AndroidUtilities.dp(7);
|
shadowPad.left = shadowPad.top = shadowPad.right = shadowPad.bottom = AndroidUtilities.dp(7);
|
||||||
|
@ -206,9 +220,14 @@ public class ReactionsContainerLayout extends FrameLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
public void setReactionsList(List<TLRPC.TL_availableReaction> reactionsList) {
|
private void setReactionsList(List<TLRPC.TL_availableReaction> reactionsList) {
|
||||||
this.reactionsList = reactionsList;
|
this.reactionsList = reactionsList;
|
||||||
|
int size = getLayoutParams().height - getPaddingTop() - getPaddingBottom();
|
||||||
|
if (size * reactionsList.size() < AndroidUtilities.dp(200)) {
|
||||||
|
getLayoutParams().width = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||||
|
}
|
||||||
listAdapter.notifyDataSetChanged();
|
listAdapter.notifyDataSetChanged();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HashSet<View> lastVisibleViews = new HashSet<>();
|
HashSet<View> lastVisibleViews = new HashSet<>();
|
||||||
|
@ -222,13 +241,18 @@ public class ReactionsContainerLayout extends FrameLayout {
|
||||||
if (transitionProgress != 0) {
|
if (transitionProgress != 0) {
|
||||||
int delay = 0;
|
int delay = 0;
|
||||||
for (int i = 0; i < recyclerListView.getChildCount(); i++) {
|
for (int i = 0; i < recyclerListView.getChildCount(); i++) {
|
||||||
View view = recyclerListView.getChildAt(i);
|
ReactionHolderView view = (ReactionHolderView) recyclerListView.getChildAt(i);
|
||||||
if (view.getX() + view.getMeasuredWidth() > 0 && view.getX() < getWidth()) {
|
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)) {
|
if (!lastVisibleViewsTmp.contains(view)) {
|
||||||
((ReactionHolderView) view).play(delay);
|
view.play(delay);
|
||||||
delay += 50;
|
delay += 30;
|
||||||
}
|
}
|
||||||
lastVisibleViews.add(view);
|
lastVisibleViews.add(view);
|
||||||
|
} else if (!view.isEnter) {
|
||||||
|
view.resetAnimation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -335,6 +359,51 @@ public class ReactionsContainerLayout extends FrameLayout {
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMessage(MessageObject message, TLRPC.ChatFull chatFull) {
|
||||||
|
this.messageObject = message;
|
||||||
|
TLRPC.ChatFull reactionsChat = chatFull;
|
||||||
|
List<TLRPC.TL_availableReaction> l;
|
||||||
|
if (message.isForwardedChannelPost()) {
|
||||||
|
reactionsChat = MessagesController.getInstance(currentAccount).getChatFull(-message.getFromChatId());
|
||||||
|
if (reactionsChat == null) {
|
||||||
|
waitingLoadingChatId = -message.getFromChatId();
|
||||||
|
MessagesController.getInstance(currentAccount).loadFullChat(-message.getFromChatId(), 0, true);
|
||||||
|
setVisibility(View.INVISIBLE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (reactionsChat != null) {
|
||||||
|
l = new ArrayList<>(reactionsChat.available_reactions.size());
|
||||||
|
for (String s : reactionsChat.available_reactions) {
|
||||||
|
for (TLRPC.TL_availableReaction a : MediaDataController.getInstance(currentAccount).getEnabledReactionsList()) {
|
||||||
|
if (a.reaction.equals(s)) {
|
||||||
|
l.add(a);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
l = MediaDataController.getInstance(currentAccount).getEnabledReactionsList();
|
||||||
|
}
|
||||||
|
setReactionsList(l);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startEnterAnimation() {
|
||||||
|
setTransitionProgress(0);
|
||||||
|
setAlpha(1f);
|
||||||
|
ObjectAnimator animator = ObjectAnimator.ofFloat(this, ReactionsContainerLayout.TRANSITION_PROGRESS_VALUE, 0f, 1f).setDuration(400);
|
||||||
|
animator.setInterpolator(new OvershootInterpolator(1.004f));
|
||||||
|
animator.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTotalWidth() {
|
||||||
|
return AndroidUtilities.dp(36) * reactionsList.size() + AndroidUtilities.dp(16);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getItemsCount() {
|
||||||
|
return reactionsList.size();
|
||||||
|
}
|
||||||
|
|
||||||
private final class LeftRightShadowsListener extends RecyclerView.OnScrollListener {
|
private final class LeftRightShadowsListener extends RecyclerView.OnScrollListener {
|
||||||
private boolean leftVisible, rightVisible;
|
private boolean leftVisible, rightVisible;
|
||||||
private ValueAnimator leftAnimator, rightAnimator;
|
private ValueAnimator leftAnimator, rightAnimator;
|
||||||
|
@ -383,11 +452,12 @@ public class ReactionsContainerLayout extends FrameLayout {
|
||||||
public final class ReactionHolderView extends FrameLayout {
|
public final class ReactionHolderView extends FrameLayout {
|
||||||
public BackupImageView backupImageView;
|
public BackupImageView backupImageView;
|
||||||
public TLRPC.TL_availableReaction currentReaction;
|
public TLRPC.TL_availableReaction currentReaction;
|
||||||
|
private boolean isEnter;
|
||||||
|
|
||||||
Runnable playRunnable = new Runnable() {
|
Runnable playRunnable = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (backupImageView.getImageReceiver().getLottieAnimation() != null && !backupImageView.getImageReceiver().getLottieAnimation().isRunning()) {
|
if (backupImageView.getImageReceiver().getLottieAnimation() != null && !backupImageView.getImageReceiver().getLottieAnimation().isRunning() && !backupImageView.getImageReceiver().getLottieAnimation().isGeneratingCache()) {
|
||||||
backupImageView.getImageReceiver().getLottieAnimation().start();
|
backupImageView.getImageReceiver().getLottieAnimation().start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -396,37 +466,100 @@ public class ReactionsContainerLayout extends FrameLayout {
|
||||||
|
|
||||||
ReactionHolderView(Context context) {
|
ReactionHolderView(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
backupImageView = new BackupImageView(context);
|
backupImageView = new BackupImageView(context) {
|
||||||
|
@Override
|
||||||
|
public void invalidate() {
|
||||||
|
super.invalidate();
|
||||||
|
ReactionsContainerLayout.this.invalidate();
|
||||||
|
}
|
||||||
|
};
|
||||||
backupImageView.getImageReceiver().setAutoRepeat(0);
|
backupImageView.getImageReceiver().setAutoRepeat(0);
|
||||||
|
backupImageView.getImageReceiver().setAllowStartLottieAnimation(false);
|
||||||
addView(backupImageView, LayoutHelper.createFrame(34, 34, Gravity.CENTER));
|
addView(backupImageView, LayoutHelper.createFrame(34, 34, Gravity.CENTER));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setReaction(TLRPC.TL_availableReaction react) {
|
private void setReaction(TLRPC.TL_availableReaction react) {
|
||||||
|
if (currentReaction != null && currentReaction.reaction.equals(react.reaction)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
resetAnimation();
|
||||||
currentReaction = react;
|
currentReaction = react;
|
||||||
SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(currentReaction.appear_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), "80_80_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);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void play(int delay) {
|
@Override
|
||||||
|
protected void onAttachedToWindow() {
|
||||||
|
super.onAttachedToWindow();
|
||||||
|
resetAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean play(int delay) {
|
||||||
|
if (!animationEnabled) {
|
||||||
|
resetAnimation();
|
||||||
|
isEnter = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
AndroidUtilities.cancelRunOnUIThread(playRunnable);
|
AndroidUtilities.cancelRunOnUIThread(playRunnable);
|
||||||
if (backupImageView.getImageReceiver().getLottieAnimation() != null) {
|
if (backupImageView.getImageReceiver().getLottieAnimation() != null && !backupImageView.getImageReceiver().getLottieAnimation().isGeneratingCache() && !isEnter) {
|
||||||
backupImageView.getImageReceiver().getLottieAnimation().setCurrentFrame(0, false);
|
isEnter = true;
|
||||||
if (delay == 0) {
|
if (delay == 0) {
|
||||||
|
backupImageView.getImageReceiver().getLottieAnimation().stop();
|
||||||
|
backupImageView.getImageReceiver().getLottieAnimation().setCurrentFrame(0, false);
|
||||||
playRunnable.run();
|
playRunnable.run();
|
||||||
} else {
|
} else {
|
||||||
backupImageView.getImageReceiver().getLottieAnimation().stop();
|
backupImageView.getImageReceiver().getLottieAnimation().stop();
|
||||||
backupImageView.getImageReceiver().getLottieAnimation().setCurrentFrame(0, false);
|
backupImageView.getImageReceiver().getLottieAnimation().setCurrentFrame(0, false);
|
||||||
AndroidUtilities.runOnUIThread(playRunnable, delay);
|
AndroidUtilities.runOnUIThread(playRunnable, delay);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (backupImageView.getImageReceiver().getLottieAnimation() != null && isEnter && !backupImageView.getImageReceiver().getLottieAnimation().isRunning() && !backupImageView.getImageReceiver().getLottieAnimation().isGeneratingCache()) {
|
||||||
|
backupImageView.getImageReceiver().getLottieAnimation().setCurrentFrame(backupImageView.getImageReceiver().getLottieAnimation().getFramesCount() - 1, false);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void resetAnimation() {
|
||||||
|
AndroidUtilities.cancelRunOnUIThread(playRunnable);
|
||||||
|
if (backupImageView.getImageReceiver().getLottieAnimation() != null && !backupImageView.getImageReceiver().getLottieAnimation().isGeneratingCache()) {
|
||||||
|
backupImageView.getImageReceiver().getLottieAnimation().stop();
|
||||||
|
if (animationEnabled) {
|
||||||
|
backupImageView.getImageReceiver().getLottieAnimation().setCurrentFrame(0, false, true);
|
||||||
|
} else {
|
||||||
|
backupImageView.getImageReceiver().getLottieAnimation().setCurrentFrame(backupImageView.getImageReceiver().getLottieAnimation().getFramesCount() - 1, false, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
isEnter = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface ReactionsContainerDelegate {
|
public interface ReactionsContainerDelegate {
|
||||||
void onReactionClicked(View v, TLRPC.TL_availableReaction reaction);
|
void onReactionClicked(View v, TLRPC.TL_availableReaction reaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onAttachedToWindow() {
|
||||||
|
super.onAttachedToWindow();
|
||||||
|
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.chatInfoDidLoad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDetachedFromWindow() {
|
||||||
|
super.onDetachedFromWindow();
|
||||||
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.chatInfoDidLoad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void didReceivedNotification(int id, int account, Object... args) {
|
||||||
|
if (id == NotificationCenter.chatInfoDidLoad) {
|
||||||
|
TLRPC.ChatFull chatFull = (TLRPC.ChatFull) args[0];
|
||||||
|
if (chatFull.id == waitingLoadingChatId && getVisibility() != View.VISIBLE && !chatFull.available_reactions.isEmpty()) {
|
||||||
|
setMessage(messageObject, null);
|
||||||
|
setVisibility(View.VISIBLE);
|
||||||
|
startEnterAnimation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -13,7 +13,6 @@ import android.animation.AnimatorListenerAdapter;
|
||||||
import android.animation.ValueAnimator;
|
import android.animation.ValueAnimator;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.Paint.Style;
|
import android.graphics.Paint.Style;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
@ -26,7 +25,6 @@ import android.transition.TransitionManager;
|
||||||
import android.transition.TransitionSet;
|
import android.transition.TransitionSet;
|
||||||
import android.transition.TransitionValues;
|
import android.transition.TransitionValues;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
import android.util.SparseIntArray;
|
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.HapticFeedbackConstants;
|
import android.view.HapticFeedbackConstants;
|
||||||
|
@ -52,10 +50,7 @@ import org.telegram.tgnet.TLObject;
|
||||||
import org.telegram.tgnet.TLRPC;
|
import org.telegram.tgnet.TLRPC;
|
||||||
import org.telegram.ui.ActionBar.Theme;
|
import org.telegram.ui.ActionBar.Theme;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
public class ScrollSlidingTabStrip extends HorizontalScrollView {
|
public class ScrollSlidingTabStrip extends HorizontalScrollView {
|
||||||
|
|
||||||
|
@ -648,7 +643,7 @@ public class ScrollSlidingTabStrip extends HorizontalScrollView {
|
||||||
}
|
}
|
||||||
if (sticker instanceof TLRPC.Document) {
|
if (sticker instanceof TLRPC.Document) {
|
||||||
// String.format(Locale.US, "%d_%d_nr_%s" + messageObject.emojiAnimatedStickerColor, w, h, messageObject.toString());
|
// String.format(Locale.US, "%d_%d_nr_%s" + messageObject.emojiAnimatedStickerColor, w, h, messageObject.toString());
|
||||||
tabView.imageView.setImage(ImageLocation.getForDocument((TLRPC.Document) sticker), "36_36", thumbDrawable, null);
|
tabView.imageView.setImage(ImageLocation.getForDocument((TLRPC.Document) sticker), "36_36_nolimit", thumbDrawable, null);
|
||||||
} else {
|
} else {
|
||||||
tabView.imageView.setImageDrawable(thumbDrawable);
|
tabView.imageView.setImageDrawable(thumbDrawable);
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,6 +100,7 @@ public class TextStyleSpan extends MetricAffectingSpan {
|
||||||
public final static int FLAG_STYLE_SPOILER = 256;
|
public final static int FLAG_STYLE_SPOILER = 256;
|
||||||
public final static int FLAG_STYLE_SPOILER_REVEALED = 512;
|
public final static int FLAG_STYLE_SPOILER_REVEALED = 512;
|
||||||
|
|
||||||
|
|
||||||
public TextStyleSpan(TextStyleRun run) {
|
public TextStyleSpan(TextStyleRun run) {
|
||||||
this(run, 0, 0);
|
this(run, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -477,8 +477,10 @@ public class ThemeSmallPreviewView extends FrameLayout implements NotificationCe
|
||||||
if (backupImageView.getImageReceiver().getLottieAnimation() != null) {
|
if (backupImageView.getImageReceiver().getLottieAnimation() != null) {
|
||||||
AndroidUtilities.cancelRunOnUIThread(animationCancelRunnable);
|
AndroidUtilities.cancelRunOnUIThread(animationCancelRunnable);
|
||||||
backupImageView.setVisibility(View.VISIBLE);
|
backupImageView.setVisibility(View.VISIBLE);
|
||||||
backupImageView.getImageReceiver().getLottieAnimation().setCurrentFrame(0, false);
|
if (!backupImageView.getImageReceiver().getLottieAnimation().isRunning) {
|
||||||
|
backupImageView.getImageReceiver().getLottieAnimation().setCurrentFrame(0, true);
|
||||||
backupImageView.getImageReceiver().getLottieAnimation().start();
|
backupImageView.getImageReceiver().getLottieAnimation().start();
|
||||||
|
}
|
||||||
backupImageView.animate().scaleX(2f).scaleY(2f).setDuration(300).setInterpolator(AndroidUtilities.overshootInterpolator).start();
|
backupImageView.animate().scaleX(2f).scaleY(2f).setDuration(300).setInterpolator(AndroidUtilities.overshootInterpolator).start();
|
||||||
|
|
||||||
AndroidUtilities.runOnUIThread(animationCancelRunnable = () -> {
|
AndroidUtilities.runOnUIThread(animationCancelRunnable = () -> {
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -13,6 +13,7 @@ import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
@ -31,6 +32,11 @@ import org.telegram.messenger.MessagesController;
|
||||||
import org.telegram.messenger.NotificationCenter;
|
import org.telegram.messenger.NotificationCenter;
|
||||||
import org.telegram.messenger.R;
|
import org.telegram.messenger.R;
|
||||||
import org.telegram.messenger.Utilities;
|
import org.telegram.messenger.Utilities;
|
||||||
|
import org.telegram.ui.ActionBar.AlertDialog;
|
||||||
|
import org.telegram.ui.ActionBar.Theme;
|
||||||
|
import org.telegram.ui.ActionBar.ThemeDescription;
|
||||||
|
import org.telegram.ui.Cells.HeaderCell;
|
||||||
|
import org.telegram.ui.Cells.LanguageCell;
|
||||||
import org.telegram.ui.ActionBar.ActionBar;
|
import org.telegram.ui.ActionBar.ActionBar;
|
||||||
import org.telegram.ui.ActionBar.ActionBarMenu;
|
import org.telegram.ui.ActionBar.ActionBarMenu;
|
||||||
import org.telegram.ui.ActionBar.ActionBarMenuItem;
|
import org.telegram.ui.ActionBar.ActionBarMenuItem;
|
||||||
|
@ -54,6 +60,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
|
|
||||||
public class LanguageSelectActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
|
public class LanguageSelectActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
|
||||||
|
|
|
@ -220,7 +220,7 @@ public class MessageSeenView extends FrameLayout {
|
||||||
titleView.setText(ContactsController.formatName(users.get(0).first_name, users.get(0).last_name));
|
titleView.setText(ContactsController.formatName(users.get(0).first_name, users.get(0).last_name));
|
||||||
} else {
|
} else {
|
||||||
if (peerIds.size() == 0) {
|
if (peerIds.size() == 0) {
|
||||||
titleView.setText(LocaleController.getString(LocaleController.getString("NobodyViewed", R.string.NobodyViewed)));
|
titleView.setText(LocaleController.getString("NobodyViewed", R.string.NobodyViewed));
|
||||||
} else {
|
} else {
|
||||||
titleView.setText(LocaleController.formatPluralString(isVoice ? "MessagePlayed" : "MessageSeen", peerIds.size()));
|
titleView.setText(LocaleController.formatPluralString(isVoice ? "MessagePlayed" : "MessageSeen", peerIds.size()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1131,7 +1131,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
public void onAnimationEnd(Animator animation) {
|
public void onAnimationEnd(Animator animation) {
|
||||||
if (isIndicatorVisible) {
|
if (isIndicatorVisible) {
|
||||||
if (searchItem != null) {
|
if (searchItem != null) {
|
||||||
searchItem.setVisibility(GONE);
|
searchItem.setClickable(false);
|
||||||
}
|
}
|
||||||
if (editItemVisible) {
|
if (editItemVisible) {
|
||||||
editItem.setVisibility(GONE);
|
editItem.setVisibility(GONE);
|
||||||
|
@ -1150,7 +1150,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationStart(Animator animation) {
|
public void onAnimationStart(Animator animation) {
|
||||||
if (searchItem != null && !expanded) {
|
if (searchItem != null && !expanded) {
|
||||||
searchItem.setVisibility(VISIBLE);
|
searchItem.setClickable(true);
|
||||||
}
|
}
|
||||||
if (editItemVisible) {
|
if (editItemVisible) {
|
||||||
editItem.setVisibility(VISIBLE);
|
editItem.setVisibility(VISIBLE);
|
||||||
|
@ -3150,7 +3150,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(56), Theme.getColor(Theme.key_profile_actionBackground), Theme.getColor(Theme.key_profile_actionPressedBackground)),
|
Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(56), Theme.getColor(Theme.key_profile_actionBackground), Theme.getColor(Theme.key_profile_actionPressedBackground)),
|
||||||
0, 0);
|
0, 0);
|
||||||
combinedDrawable.setIconSize(AndroidUtilities.dp(56), AndroidUtilities.dp(56));
|
combinedDrawable.setIconSize(AndroidUtilities.dp(56), AndroidUtilities.dp(56));
|
||||||
writeButton.setBackgroundDrawable(combinedDrawable);
|
writeButton.setBackground(combinedDrawable);
|
||||||
if (userId != 0) {
|
if (userId != 0) {
|
||||||
if (imageUpdater != null) {
|
if (imageUpdater != null) {
|
||||||
cameraDrawable = new RLottieDrawable(R.raw.camera_outline, "" + R.raw.camera_outline, AndroidUtilities.dp(56), AndroidUtilities.dp(56), false, null);
|
cameraDrawable = new RLottieDrawable(R.raw.camera_outline, "" + R.raw.camera_outline, AndroidUtilities.dp(56), AndroidUtilities.dp(56), false, null);
|
||||||
|
@ -3233,9 +3233,12 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
if (searchItem != null) {
|
if (searchItem != null) {
|
||||||
searchItem.setAlpha(1.0f - value);
|
searchItem.setAlpha(1.0f - value);
|
||||||
searchItem.setScaleY(1.0f - value);
|
searchItem.setScaleY(1.0f - value);
|
||||||
searchItem.setVisibility(searchItem.getAlpha() == 0f ? View.GONE : View.VISIBLE);
|
searchItem.setVisibility(View.VISIBLE);
|
||||||
if (qrItem != null && searchItem.getVisibility() == View.VISIBLE) {
|
searchItem.setClickable(searchItem.getAlpha() > .5f);
|
||||||
|
if (qrItem != null) {
|
||||||
float translation = AndroidUtilities.dp(48) * value;
|
float translation = AndroidUtilities.dp(48) * value;
|
||||||
|
// if (searchItem.getVisibility() == View.VISIBLE)
|
||||||
|
// translation += AndroidUtilities.dp(48);
|
||||||
qrItem.setTranslationX(translation);
|
qrItem.setTranslationX(translation);
|
||||||
avatarsViewPagerIndicatorView.setTranslationX(translation - AndroidUtilities.dp(48));
|
avatarsViewPagerIndicatorView.setTranslationX(translation - AndroidUtilities.dp(48));
|
||||||
}
|
}
|
||||||
|
@ -4320,8 +4323,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
qrItemAnimation.start();
|
qrItemAnimation.start();
|
||||||
} else {
|
} else {
|
||||||
qrItem.setAlpha(setQrVisible ? 1.0f : 0.0f);
|
qrItem.setAlpha(setQrVisible ? 1.0f : 0.0f);
|
||||||
qrItem.setTranslationX(setQrVisible ? 0f : AndroidUtilities.dp(48f));
|
float translation = AndroidUtilities.dp(48) * qrItem.getAlpha();
|
||||||
avatarsViewPagerIndicatorView.setTranslationX(setQrVisible ? 0f : -AndroidUtilities.dp(48f));
|
qrItem.setTranslationX(translation);
|
||||||
|
avatarsViewPagerIndicatorView.setTranslationX(translation - AndroidUtilities.dp(48));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6089,7 +6093,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qrItem != null) {
|
if (qrItem != null) {
|
||||||
qrItem.setVisibility(isQrNeedVisible() ? View.VISIBLE : View.GONE);
|
qrItem.setVisibility(searchTransitionProgress > 0.5f && isQrNeedVisible() ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8242,6 +8246,21 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onBecomeFullyVisible() {
|
||||||
|
super.onBecomeFullyVisible();
|
||||||
|
|
||||||
|
try {
|
||||||
|
Drawable shadowDrawable = fragmentView.getContext().getResources().getDrawable(R.drawable.floating_shadow_profile).mutate();
|
||||||
|
shadowDrawable.setColorFilter(new PorterDuffColorFilter(Color.BLACK, PorterDuff.Mode.MULTIPLY));
|
||||||
|
CombinedDrawable combinedDrawable = new CombinedDrawable(shadowDrawable,
|
||||||
|
Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(56), Theme.getColor(Theme.key_profile_actionBackground), Theme.getColor(Theme.key_profile_actionPressedBackground)),
|
||||||
|
0, 0);
|
||||||
|
combinedDrawable.setIconSize(AndroidUtilities.dp(56), AndroidUtilities.dp(56));
|
||||||
|
writeButton.setBackground(combinedDrawable);
|
||||||
|
} catch (Exception e) {}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isQrNeedVisible() {
|
private boolean isQrNeedVisible() {
|
||||||
return !TextUtils.isEmpty(getUserConfig().getCurrentUser().username);
|
return !TextUtils.isEmpty(getUserConfig().getCurrentUser().username);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@ package org.telegram.ui;
|
||||||
|
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.AnimatorListenerAdapter;
|
import android.animation.AnimatorListenerAdapter;
|
||||||
|
import android.animation.AnimatorSet;
|
||||||
|
import android.animation.ObjectAnimator;
|
||||||
import android.animation.ValueAnimator;
|
import android.animation.ValueAnimator;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
|
@ -23,18 +25,21 @@ import android.graphics.Shader;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.SystemClock;
|
||||||
import android.text.Layout;
|
import android.text.Layout;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.text.StaticLayout;
|
import android.text.StaticLayout;
|
||||||
import android.text.TextPaint;
|
import android.text.TextPaint;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
|
import android.view.animation.DecelerateInterpolator;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -73,6 +78,7 @@ import org.telegram.ui.Cells.SettingsSearchCell;
|
||||||
import org.telegram.ui.Components.AvatarDrawable;
|
import org.telegram.ui.Components.AvatarDrawable;
|
||||||
import org.telegram.ui.Components.BackupImageView;
|
import org.telegram.ui.Components.BackupImageView;
|
||||||
import org.telegram.ui.Components.ChatThemeBottomSheet;
|
import org.telegram.ui.Components.ChatThemeBottomSheet;
|
||||||
|
import org.telegram.ui.Components.CubicBezierInterpolator;
|
||||||
import org.telegram.ui.Components.Easings;
|
import org.telegram.ui.Components.Easings;
|
||||||
import org.telegram.ui.Components.FlickerLoadingView;
|
import org.telegram.ui.Components.FlickerLoadingView;
|
||||||
import org.telegram.ui.Components.HideViewAfterAnimation;
|
import org.telegram.ui.Components.HideViewAfterAnimation;
|
||||||
|
@ -239,10 +245,15 @@ public class QrActivity extends BaseFragment {
|
||||||
protected void onDraw(Canvas canvas) {
|
protected void onDraw(Canvas canvas) {
|
||||||
if (prevMotionDrawable != null) {
|
if (prevMotionDrawable != null) {
|
||||||
prevMotionDrawable.setBounds(0, 0, getWidth(), getHeight());
|
prevMotionDrawable.setBounds(0, 0, getWidth(), getHeight());
|
||||||
prevMotionDrawable.draw(canvas);
|
|
||||||
}
|
}
|
||||||
currMotionDrawable.setBounds(0, 0, getWidth(), getHeight());
|
currMotionDrawable.setBounds(0, 0, getWidth(), getHeight());
|
||||||
currMotionDrawable.draw(canvas);
|
|
||||||
|
if (prevMotionDrawable != null)
|
||||||
|
prevMotionDrawable.drawBackground(canvas);
|
||||||
|
currMotionDrawable.drawBackground(canvas);
|
||||||
|
if (prevMotionDrawable != null)
|
||||||
|
prevMotionDrawable.drawPattern(canvas);
|
||||||
|
currMotionDrawable.drawPattern(canvas);
|
||||||
super.onDraw(canvas);
|
super.onDraw(canvas);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -481,6 +492,34 @@ public class QrActivity extends BaseFragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected AnimatorSet onCustomTransitionAnimation(boolean isOpen, Runnable callback) {
|
||||||
|
if (isOpen) {
|
||||||
|
fragmentView.setAlpha(0f);
|
||||||
|
fragmentView.setTranslationX(AndroidUtilities.dp(48));
|
||||||
|
}
|
||||||
|
|
||||||
|
AnimatorSet animator = new AnimatorSet();
|
||||||
|
animator.playTogether(
|
||||||
|
ObjectAnimator.ofFloat(fragmentView, View.TRANSLATION_X, isOpen ? 0 : AndroidUtilities.dp(48)),
|
||||||
|
ObjectAnimator.ofFloat(fragmentView, View.ALPHA, isOpen ? 1f : 0f)
|
||||||
|
);
|
||||||
|
if (!isOpen)
|
||||||
|
animator.setInterpolator(new DecelerateInterpolator(1.5f));
|
||||||
|
else
|
||||||
|
animator.setInterpolator(CubicBezierInterpolator.EASE_IN);
|
||||||
|
animator.setDuration(isOpen ? 200 : 150);
|
||||||
|
animator.addListener(new AnimatorListenerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animator) {
|
||||||
|
if (callback != null)
|
||||||
|
callback.run();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
animator.start();
|
||||||
|
return animator;
|
||||||
|
}
|
||||||
|
|
||||||
private void onItemSelected(EmojiThemes newTheme, int position, boolean withAnimation) {
|
private void onItemSelected(EmojiThemes newTheme, int position, boolean withAnimation) {
|
||||||
selectedPosition = position;
|
selectedPosition = position;
|
||||||
final EmojiThemes prevTheme = currentTheme;
|
final EmojiThemes prevTheme = currentTheme;
|
||||||
|
@ -488,8 +527,16 @@ public class QrActivity extends BaseFragment {
|
||||||
currentTheme = newTheme;
|
currentTheme = newTheme;
|
||||||
EmojiThemes.ThemeItem themeItem = currentTheme.getThemeItem(isDarkTheme ? 1 : 0);
|
EmojiThemes.ThemeItem themeItem = currentTheme.getThemeItem(isDarkTheme ? 1 : 0);
|
||||||
|
|
||||||
|
float duration = 1f;
|
||||||
|
if (patternAlphaAnimator != null) {
|
||||||
|
// from = (float) patternAlphaAnimator.getAnimatedValue();
|
||||||
|
duration *= Math.max(.5f, 1f - (float) patternAlphaAnimator.getAnimatedValue());
|
||||||
|
patternAlphaAnimator.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
prevMotionDrawable = currMotionDrawable;
|
prevMotionDrawable = currMotionDrawable;
|
||||||
prevMotionDrawable.setIndeterminateAnimation(false);
|
prevMotionDrawable.setIndeterminateAnimation(false);
|
||||||
|
prevMotionDrawable.setAlpha(255);
|
||||||
|
|
||||||
currMotionDrawable = new MotionBackgroundDrawable();
|
currMotionDrawable = new MotionBackgroundDrawable();
|
||||||
currMotionDrawable.setCallback(backgroundView);
|
currMotionDrawable.setCallback(backgroundView);
|
||||||
|
@ -497,18 +544,21 @@ public class QrActivity extends BaseFragment {
|
||||||
currMotionDrawable.setParentView(backgroundView);
|
currMotionDrawable.setParentView(backgroundView);
|
||||||
currMotionDrawable.setPatternAlpha(1f);
|
currMotionDrawable.setPatternAlpha(1f);
|
||||||
currMotionDrawable.setIndeterminateAnimation(true);
|
currMotionDrawable.setIndeterminateAnimation(true);
|
||||||
|
if (prevMotionDrawable != null)
|
||||||
currMotionDrawable.posAnimationProgress = prevMotionDrawable.posAnimationProgress;
|
currMotionDrawable.posAnimationProgress = prevMotionDrawable.posAnimationProgress;
|
||||||
qrView.setPosAnimationProgress(currMotionDrawable.posAnimationProgress);
|
qrView.setPosAnimationProgress(currMotionDrawable.posAnimationProgress);
|
||||||
|
|
||||||
TLRPC.WallPaper wallPaper = currentTheme.getWallpaper(isDarkTheme ? 1 : 0);
|
TLRPC.WallPaper wallPaper = currentTheme.getWallpaper(isDarkTheme ? 1 : 0);
|
||||||
if (wallPaper != null) {
|
if (wallPaper != null) {
|
||||||
currMotionDrawable.setPatternBitmap(wallPaper.settings.intensity);
|
currMotionDrawable.setPatternBitmap(wallPaper.settings.intensity);
|
||||||
|
final long startedLoading = SystemClock.elapsedRealtime();
|
||||||
currentTheme.loadWallpaper(isDarkTheme ? 1 : 0, pair -> {
|
currentTheme.loadWallpaper(isDarkTheme ? 1 : 0, pair -> {
|
||||||
if (pair != null && currentTheme.getTlTheme(isDarkTheme ? 1 : 0) != null) {
|
if (pair != null && currentTheme.getTlTheme(isDarkTheme ? 1 : 0) != null) {
|
||||||
final long themeId = pair.first;
|
final long themeId = pair.first;
|
||||||
final Bitmap bitmap = pair.second;
|
final Bitmap bitmap = pair.second;
|
||||||
if (themeId == currentTheme.getTlTheme(isDarkTheme ? 1 : 0).id && bitmap != null) {
|
if (themeId == currentTheme.getTlTheme(isDarkTheme ? 1 : 0).id && bitmap != null) {
|
||||||
onPatternLoaded(bitmap, currMotionDrawable.getIntensity(), withAnimation);
|
long elapsed = SystemClock.elapsedRealtime() - startedLoading;
|
||||||
|
onPatternLoaded(bitmap, currMotionDrawable.getIntensity(), elapsed > 150);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -517,22 +567,20 @@ public class QrActivity extends BaseFragment {
|
||||||
}
|
}
|
||||||
currMotionDrawable.setPatternColorFilter(currMotionDrawable.getPatternColor());
|
currMotionDrawable.setPatternColorFilter(currMotionDrawable.getPatternColor());
|
||||||
|
|
||||||
float from = 0;
|
|
||||||
if (patternAlphaAnimator != null) {
|
|
||||||
from = (float) patternAlphaAnimator.getAnimatedValue();
|
|
||||||
patternAlphaAnimator.cancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
int[] newQrColors = qrColorsMap.get(newTheme.emoji + (isDarkTheme ? "n" : "d"));
|
int[] newQrColors = qrColorsMap.get(newTheme.emoji + (isDarkTheme ? "n" : "d"));
|
||||||
if (withAnimation) {
|
if (withAnimation) {
|
||||||
currMotionDrawable.setAlpha(0);
|
currMotionDrawable.setAlpha(255);
|
||||||
patternAlphaAnimator = ValueAnimator.ofFloat(from, 1f);
|
currMotionDrawable.setBackgroundAlpha(0f);
|
||||||
|
patternAlphaAnimator = ValueAnimator.ofFloat(0f, 1f);
|
||||||
patternAlphaAnimator.addUpdateListener(animation -> {
|
patternAlphaAnimator.addUpdateListener(animation -> {
|
||||||
float progress = (float) animation.getAnimatedValue();
|
float progress = (float) animation.getAnimatedValue();
|
||||||
if (prevMotionDrawable != null) {
|
if (prevMotionDrawable != null) {
|
||||||
|
prevMotionDrawable.setBackgroundAlpha(1f);
|
||||||
prevMotionDrawable.setPatternAlpha(1f - progress);
|
prevMotionDrawable.setPatternAlpha(1f - progress);
|
||||||
}
|
}
|
||||||
currMotionDrawable.setAlpha((int) (255f * progress));
|
currMotionDrawable.setBackgroundAlpha(progress);
|
||||||
|
currMotionDrawable.setPatternAlpha(progress);
|
||||||
|
// currMotionDrawable.setAlpha((int) (255f * progress));
|
||||||
if (newQrColors != null) {
|
if (newQrColors != null) {
|
||||||
int color1 = ColorUtils.blendARGB(prevQrColors[0], newQrColors[0], progress);
|
int color1 = ColorUtils.blendARGB(prevQrColors[0], newQrColors[0], progress);
|
||||||
int color2 = ColorUtils.blendARGB(prevQrColors[1], newQrColors[1], progress);
|
int color2 = ColorUtils.blendARGB(prevQrColors[1], newQrColors[1], progress);
|
||||||
|
@ -551,9 +599,25 @@ public class QrActivity extends BaseFragment {
|
||||||
}
|
}
|
||||||
prevMotionDrawable = null;
|
prevMotionDrawable = null;
|
||||||
patternAlphaAnimator = null;
|
patternAlphaAnimator = null;
|
||||||
|
currMotionDrawable.setBackgroundAlpha(1f);
|
||||||
|
currMotionDrawable.setPatternAlpha(1f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationCancel(Animator animation) {
|
||||||
|
super.onAnimationCancel(animation);
|
||||||
|
float progress = (float) ((ValueAnimator) animation).getAnimatedValue();
|
||||||
|
if (newQrColors != null) {
|
||||||
|
int color1 = ColorUtils.blendARGB(prevQrColors[0], newQrColors[0], progress);
|
||||||
|
int color2 = ColorUtils.blendARGB(prevQrColors[1], newQrColors[1], progress);
|
||||||
|
int color3 = ColorUtils.blendARGB(prevQrColors[2], newQrColors[2], progress);
|
||||||
|
int color4 = ColorUtils.blendARGB(prevQrColors[3], newQrColors[3], progress);
|
||||||
|
int[] colors = new int[] { color1, color2, color3, color4 };
|
||||||
|
System.arraycopy(colors, 0, prevQrColors, 0, 4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
patternAlphaAnimator.setDuration(250);
|
patternAlphaAnimator.setDuration((int) (250 * duration));
|
||||||
patternAlphaAnimator.start();
|
patternAlphaAnimator.start();
|
||||||
} else {
|
} else {
|
||||||
if (newQrColors != null) {
|
if (newQrColors != null) {
|
||||||
|
@ -569,7 +633,7 @@ public class QrActivity extends BaseFragment {
|
||||||
animationSettings.applyTheme = false;
|
animationSettings.applyTheme = false;
|
||||||
animationSettings.onlyTopFragment = true;
|
animationSettings.onlyTopFragment = true;
|
||||||
animationSettings.resourcesProvider = getResourceProvider();
|
animationSettings.resourcesProvider = getResourceProvider();
|
||||||
animationSettings.duration = 250;
|
animationSettings.duration = (int) (250 * duration);
|
||||||
if (withAnimation) {
|
if (withAnimation) {
|
||||||
resourcesProvider.initColors(prevTheme, isCurrentThemeDark);
|
resourcesProvider.initColors(prevTheme, isCurrentThemeDark);
|
||||||
} else {
|
} else {
|
||||||
|
@ -991,8 +1055,9 @@ public class QrActivity extends BaseFragment {
|
||||||
}
|
}
|
||||||
setupLightDarkTheme(!forceDark);
|
setupLightDarkTheme(!forceDark);
|
||||||
});
|
});
|
||||||
|
darkThemeView.setAlpha(0f);
|
||||||
darkThemeView.setVisibility(View.INVISIBLE);
|
darkThemeView.setVisibility(View.INVISIBLE);
|
||||||
rootLayout.addView(darkThemeView, LayoutHelper.createFrame(44, 44, Gravity.TOP | Gravity.END, 0, 0, 7, 0));
|
rootLayout.addView(darkThemeView, LayoutHelper.createFrame(44, 44, Gravity.TOP | Gravity.END, 0, -2, 7, 0));
|
||||||
forceDark = !Theme.getActiveTheme().isDark();
|
forceDark = !Theme.getActiveTheme().isDark();
|
||||||
setForceDark(Theme.getActiveTheme().isDark(), false);
|
setForceDark(Theme.getActiveTheme().isDark(), false);
|
||||||
|
|
||||||
|
@ -1068,6 +1133,8 @@ public class QrActivity extends BaseFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDataLoaded() {
|
public void onDataLoaded() {
|
||||||
|
darkThemeView.setAlpha(0f);
|
||||||
|
darkThemeView.animate().alpha(1f).setDuration(150).start();
|
||||||
darkThemeView.setVisibility(View.VISIBLE);
|
darkThemeView.setVisibility(View.VISIBLE);
|
||||||
progressView.animate().alpha(0f).setListener(new HideViewAfterAnimation(progressView)).setDuration(150).start();
|
progressView.animate().alpha(0f).setListener(new HideViewAfterAnimation(progressView)).setDuration(150).start();
|
||||||
recyclerView.setAlpha(0f);
|
recyclerView.setAlpha(0f);
|
||||||
|
|
|
@ -1022,7 +1022,6 @@
|
||||||
<string name="DeleteReportSpam">Report spam</string>
|
<string name="DeleteReportSpam">Report spam</string>
|
||||||
<string name="TranslateMessage">Translate</string>
|
<string name="TranslateMessage">Translate</string>
|
||||||
<string name="AutomaticTranslation">Automatic Translation</string>
|
<string name="AutomaticTranslation">Automatic Translation</string>
|
||||||
<string name="TranslateMore">Translate more...</string>
|
|
||||||
<string name="CloseTranslation">Close Translation</string>
|
<string name="CloseTranslation">Close Translation</string>
|
||||||
<string name="TranslationFailedAlert1">Translation failed. Try again later.</string>
|
<string name="TranslationFailedAlert1">Translation failed. Try again later.</string>
|
||||||
<string name="TranslationFailedAlert2">Translation failed.</string>
|
<string name="TranslationFailedAlert2">Translation failed.</string>
|
||||||
|
|
|
@ -5,8 +5,8 @@ buildscript {
|
||||||
google()
|
google()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:4.2.1'
|
classpath 'com.android.tools.build:gradle:7.0.3'
|
||||||
classpath 'com.google.gms:google-services:4.3.5'
|
classpath 'com.google.gms:google-services:4.3.10'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
|
|
Loading…
Add table
Reference in a new issue