Browse Source

Update to 8.4.3

pull/729/head
xaxtix 7 months ago
parent
commit
ad6629f6fc
  1. 4
      TMessagesProj/build.gradle
  2. 21
      TMessagesProj/src/main/assets/bluebubbles.attheme
  3. 4
      TMessagesProj/src/main/assets/darkblue.attheme
  4. 2
      TMessagesProj/src/main/assets/night.attheme
  5. 3
      TMessagesProj/src/main/java/androidx/recyclerview/widget/ChatListItemAnimator.java
  6. 8
      TMessagesProj/src/main/java/androidx/recyclerview/widget/DefaultItemAnimator.java
  7. 3
      TMessagesProj/src/main/java/androidx/recyclerview/widget/GridLayoutManagerFixed.java
  8. 2
      TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java
  9. 4
      TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java
  10. 3
      TMessagesProj/src/main/java/org/telegram/messenger/GcmPushListenerService.java
  11. 4
      TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java
  12. 21
      TMessagesProj/src/main/java/org/telegram/messenger/ImageReceiver.java
  13. 4
      TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java
  14. 31
      TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java
  15. 4
      TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java
  16. 100
      TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java
  17. 9
      TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java
  18. 17
      TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java
  19. 3
      TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarPopupWindow.java
  20. 6
      TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java
  21. 12
      TMessagesProj/src/main/java/org/telegram/ui/ArticleViewer.java
  22. 407
      TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java
  23. 17
      TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java
  24. 309
      TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
  25. 50
      TMessagesProj/src/main/java/org/telegram/ui/ChatReactionsEditActivity.java
  26. 23
      TMessagesProj/src/main/java/org/telegram/ui/Components/ChatScrimPopupContainerLayout.java
  27. 2
      TMessagesProj/src/main/java/org/telegram/ui/Components/ChatThemeBottomSheet.java
  28. 14
      TMessagesProj/src/main/java/org/telegram/ui/Components/CounterView.java
  29. 6
      TMessagesProj/src/main/java/org/telegram/ui/Components/FlickerLoadingView.java
  30. 200
      TMessagesProj/src/main/java/org/telegram/ui/Components/MotionBackgroundDrawable.java
  31. 13
      TMessagesProj/src/main/java/org/telegram/ui/Components/PopupSwipeBackLayout.java
  32. 7
      TMessagesProj/src/main/java/org/telegram/ui/Components/RLottieDrawable.java
  33. 16
      TMessagesProj/src/main/java/org/telegram/ui/Components/ReactedUsersListView.java
  34. 45
      TMessagesProj/src/main/java/org/telegram/ui/Components/ReactionTabHolderView.java
  35. 34
      TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/ReactionsEffectOverlay.java
  36. 94
      TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/ReactionsLayoutInBubble.java
  37. 179
      TMessagesProj/src/main/java/org/telegram/ui/Components/ReactionsContainerLayout.java
  38. 7
      TMessagesProj/src/main/java/org/telegram/ui/Components/ScrollSlidingTabStrip.java
  39. 1
      TMessagesProj/src/main/java/org/telegram/ui/Components/TextStyleSpan.java
  40. 6
      TMessagesProj/src/main/java/org/telegram/ui/Components/ThemeSmallPreviewView.java
  41. 898
      TMessagesProj/src/main/java/org/telegram/ui/Components/TranslateAlert.java
  42. 7
      TMessagesProj/src/main/java/org/telegram/ui/LanguageSelectActivity.java
  43. 2
      TMessagesProj/src/main/java/org/telegram/ui/MessageSeenView.java
  44. 35
      TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java
  45. 99
      TMessagesProj/src/main/java/org/telegram/ui/QrActivity.java
  46. 1
      TMessagesProj/src/main/res/values/strings.xml
  47. 4
      build.gradle

4
TMessagesProj/build.gradle

@ -300,7 +300,7 @@ android {
}
}
defaultConfig.versionCode = 2522
defaultConfig.versionCode = 2531
applicationVariants.all { variant ->
variant.outputs.all { output ->
@ -319,7 +319,7 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 30
versionName "8.4.1"
versionName "8.4.3"
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']

21
TMessagesProj/src/main/assets/bluebubbles.attheme

@ -34,6 +34,7 @@ dialogTextLink=-14057020
chat_status=-2627597
windowBackgroundWhiteBlueHeader=-14380330
chat_messagePanelVoiceBackground=-10374934
switchTrackBlueChecked=-12940870
chat_topPanelLine=-11949852
chat_outInstantSelected=-14770977
chat_outSentCheck=-14967834
@ -80,8 +81,8 @@ dialogTextGray4=-7565423
chat_attachContactText=-2121728
chat_searchPanelIcons=-12937244
windowBackgroundWhiteLinkText=-13990712
chat_outVenueInfoText=-9396792
chat_outContactPhoneText=-9396792
chat_outVenueInfoText=-8216913
chat_outContactPhoneText=-8612185
chat_inAudioTitleText=-15061445
chat_messageLinkIn=-16090691
chat_inBubbleSelected=-1509892
@ -92,7 +93,7 @@ chat_outSiteNameText=-14515511
dialogTextGray=-7565423
chat_messageLinkOut=-16155709
avatar_backgroundArchived=-4998207
chat_outFileInfoSelectedText=-9396792
chat_outFileInfoSelectedText=-8674358
chat_outAudioDurationSelectedText=-8674358
avatar_backgroundArchivedHidden=-10832396
statisticChartLine_orange=-1853657
@ -105,7 +106,7 @@ chat_outReplyLine=-13133085
chat_inAudioSeekbarFill=-10572824
chat_inContactBackground=-431707662
progressCircle=-14375188
chat_outVenueInfoSelectedText=-9396792
chat_outVenueInfoSelectedText=-8674358
chats_menuItemIcon=-7433063
wallpaperFileOffset=-1
chat_outBubbleShadow=-16699318
@ -130,8 +131,8 @@ chat_outBubbleSelected=-2690305
chat_inFileNameText=-15654091
statisticChartLine_blue=-13467675
chat_inInstantSelected=-14707230
chat_outFileInfoText=-9396792
chat_outContactPhoneSelectedText=-9396792
chat_outFileInfoText=-7953740
chat_outContactPhoneSelectedText=-9725764
chat_wallpaper=-11300655
chat_outMenuSelected=-7026959
chat_outLoaderPhotoSelected=-263935502
@ -142,14 +143,14 @@ avatar_actionBarSelectorBlue=-12091735
switchTrackChecked=-11424793
chat_inLoader=-431707662
chat_outPreviewInstantSelectedText=-14514998
chat_outTimeText=-143614520
chat_outTimeText=-141776195
chat_attachAudioText=-2209977
chat_outBubble=-1641732
chat_attachHideBackground=-4866356
chats_menuItemText=-12632257
chat_outReplyNameText=-14382642
chats_menuTopBackgroundCats=-10906430
chat_outReplyMediaMessageText=-9396792
chat_outReplyMediaMessageText=-7558467
actionBarTabSelector=-12554340
chat_outLoaderPhotoIcon=-263935502
chat_attachFileText=-15423260
@ -178,9 +179,9 @@ chats_actionPressedBackground=-11166764
chat_replyPanelName=-13397538
windowBackgroundWhiteValueText=-13003565
chat_outAudioDurationText=-7558467
chat_outMenu=-5782571
chat_outMenu=-5716778
statisticChartActiveLine=335544320
chat_outReplyMediaMessageSelectedText=-9396792
chat_outReplyMediaMessageSelectedText=-8674357
chats_attachMessage=-14843710
chat_outSentClock=-594761027
chat_searchPanelText=-12609056

4
TMessagesProj/src/main/assets/darkblue.attheme

@ -36,6 +36,7 @@ chat_inMediaIcon=-1
actionBarDefaultArchived=-13748149
avatar_subtitleInProfileViolet=-7628894
chat_messagePanelCancelInlineBot=-8549479
voipgroup_topPanelGray=-10521727
dialogSearchBackground=-14010037
chat_outAudioSeekbarFill=-7944965
chat_botKeyboardButtonBackgroundPressed=-12956574
@ -373,6 +374,7 @@ chat_outReplyMediaMessageText=-7357217
chat_textSelectBackground=1516415459
chat_messagePanelVoiceDelete=-1
chat_inAudioProgress=-1
chat_inReactionButtonTextSelected=-1
chats_date=-9207925
chat_messagePanelText=-1
actionBarTabSelector=926307434
@ -431,6 +433,7 @@ chat_outReplyMessageText=-1
chat_recordedVoiceDot=-1221292
chat_messagePanelBackground=-14602949
chat_inLoaderPhotoSelected=-14925725
chat_inReactionButtonText=-1
chat_inVoiceSeekbarFill=-10177041
graySection=-15459033
chat_outAudioSeekbar=-429551165
@ -462,4 +465,3 @@ chat_outSentClock=-8213557
dialogBackgroundGray=-14932431
chat_searchPanelText=-8796932
chat_inContactIcon=-1
voipgroup_topPanelGray=-10521727

2
TMessagesProj/src/main/assets/night.attheme

@ -393,6 +393,7 @@ chat_outReplyMediaMessageText=-7023626
chat_textSelectBackground=1516415459
chat_messagePanelVoiceDelete=-1
chat_inAudioProgress=-1
chat_inReactionButtonTextSelected=-1
chats_date=-8882056
chat_messagePanelText=-1
actionBarTabSelector=827876202
@ -456,6 +457,7 @@ chat_recordedVoiceDot=-1221292
chat_messagePanelBackground=-14803425
chat_wallpaper_gradient_to=-15790320
chat_inLoaderPhotoSelected=-14925725
chat_inReactionButtonText=-1
chats_messageArchived=-8224126
chat_inVoiceSeekbarFill=-10177041
graySection=-16053492

3
TMessagesProj/src/main/java/androidx/recyclerview/widget/ChatListItemAnimator.java

@ -427,6 +427,7 @@ public class ChatListItemAnimator extends DefaultItemAnimator {
view.setTranslationX(-deltaX);
}
mPendingMoves.add(moveInfo);
checkIsRunning();
return true;
}
@ -655,6 +656,7 @@ public class ChatListItemAnimator extends DefaultItemAnimator {
}
mPendingMoves.add(moveInfo);
checkIsRunning();
return true;
}
@ -926,6 +928,7 @@ public class ChatListItemAnimator extends DefaultItemAnimator {
newHolder.itemView.setAlpha(0);
}
mPendingChanges.add(new ChangeInfo(oldHolder, newHolder, fromX, fromY, toX, toY));
checkIsRunning();
return true;
}

8
TMessagesProj/src/main/java/androidx/recyclerview/widget/DefaultItemAnimator.java

@ -210,6 +210,7 @@ public class DefaultItemAnimator extends SimpleItemAnimator {
public boolean animateRemove(final RecyclerView.ViewHolder holder, ItemHolderInfo info) {
resetAnimation(holder);
mPendingRemovals.add(holder);
checkIsRunning();
return true;
}
@ -247,6 +248,7 @@ public class DefaultItemAnimator extends SimpleItemAnimator {
resetAnimation(holder);
holder.itemView.setAlpha(0);
mPendingAdditions.add(holder);
checkIsRunning();
return true;
}
@ -296,6 +298,7 @@ public class DefaultItemAnimator extends SimpleItemAnimator {
view.setTranslationY(-deltaY);
}
mPendingMoves.add(new MoveInfo(holder, fromX, fromY, toX, toY));
checkIsRunning();
return true;
}
@ -380,6 +383,7 @@ public class DefaultItemAnimator extends SimpleItemAnimator {
newHolder.itemView.setAlpha(0);
}
mPendingChanges.add(new ChangeInfo(oldHolder, newHolder, fromX, fromY, toX, toY));
checkIsRunning();
return true;
}
@ -734,4 +738,8 @@ public class DefaultItemAnimator extends SimpleItemAnimator {
public void setTranslationInterpolator(Interpolator translationInterpolator) {
this.translationInterpolator = translationInterpolator;
}
public void checkIsRunning() {
}
}

3
TMessagesProj/src/main/java/androidx/recyclerview/widget/GridLayoutManagerFixed.java

@ -129,6 +129,9 @@ public class GridLayoutManagerFixed extends GridLayoutManager {
int backupPosition = layoutState.mCurrentPosition;
for (int a = layoutState.mCurrentPosition; a > startPosition; a--) {
View view = layoutState.next(recycler);
if (view == null) {
continue;
}
additionalViews.add(view);
if (a != backupPosition) {
calculateItemDecorationsForChild(view, mDecorInsets);

2
TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java

@ -39,6 +39,7 @@ import android.graphics.Typeface;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.media.MediaScannerConnection;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
@ -95,6 +96,7 @@ import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.ViewPager;
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.SmsRetrieverClient;
import com.google.android.gms.tasks.Task;

4
TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java

@ -20,8 +20,8 @@ public class BuildVars {
public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true;
public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29;
public static int BUILD_VERSION = 2526;
public static String BUILD_VERSION_STRING = "8.4.2";
public static int BUILD_VERSION = 2531;
public static String BUILD_VERSION_STRING = "8.4.3";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";

3
TMessagesProj/src/main/java/org/telegram/messenger/GcmPushListenerService.java

@ -14,7 +14,6 @@ import android.util.Base64;
import androidx.collection.LongSparseArray;
import com.google.android.exoplayer2.util.Log;
import com.google.firebase.messaging.FirebaseMessagingService;
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) {
case "REACT_TEXT": {
return LocaleController.formatString("PushReactText", R.string.PushReactText, args);

4
TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java

@ -14,8 +14,6 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
@ -859,7 +857,7 @@ public class ImageLoader {
if (args.length >= 3 && "pcache".equals(args[2])) {
precache = true;
} else {
precache = SharedConfig.getDevicePerformanceClass() != SharedConfig.PERFORMANCE_CLASS_HIGH;
precache = !cacheImage.filter.contains("nolimit") && SharedConfig.getDevicePerformanceClass() != SharedConfig.PERFORMANCE_CLASS_HIGH;
}
}

21
TMessagesProj/src/main/java/org/telegram/messenger/ImageReceiver.java

@ -27,6 +27,8 @@ import android.graphics.drawable.Drawable;
import android.os.Build;
import android.view.View;
import androidx.annotation.Keep;
import org.telegram.tgnet.TLObject;
import org.telegram.tgnet.TLRPC;
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.RecyclableDrawable;
import androidx.annotation.Keep;
import java.util.ArrayList;
public class ImageReceiver implements NotificationCenter.NotificationCenterDelegate {
@ -263,6 +263,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
private boolean centerRotation;
private ImageReceiverDelegate delegate;
private float currentAlpha;
private float previousAlpha = 1f;
private long lastUpdateAlphaTime;
private byte crossfadeAlpha = 1;
private boolean manualAlphaAnimator;
@ -360,7 +361,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
if (strippedBitmap != null) {
setImage(ImageLocation.getForUserOrChat(object, ImageLocation.TYPE_SMALL), "50_50", strippedBitmap, null, parentObject, 0);
} 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 {
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);
}
currentAlpha = 1.0f;
previousAlpha = 1f;
if (staticThumbDrawable instanceof SvgHelper.SvgDrawable) {
((SvgHelper.SvgDrawable) staticThumbDrawable).setParent(this);
@ -746,6 +748,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
currentSize = 0;
currentCacheType = 0;
currentAlpha = 1;
previousAlpha = 1f;
if (setImageBackup != null) {
setImageBackup.clear();
@ -1335,6 +1338,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
currentAlpha += dt / (float) crossfadeDuration;
if (currentAlpha > 1) {
currentAlpha = 1;
previousAlpha = 1f;
if (crossfadeImage != null) {
recycleBitmap(null, 2);
crossfadeShader = null;
@ -1410,6 +1414,9 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
}
if (drawable != null) {
if (crossfadeAlpha != 0) {
if (previousAlpha != 1f && (drawable == currentImageDrawable || drawable == currentMediaDrawable) && staticThumbDrawable != null) {
drawDrawable(canvas, staticThumbDrawable, (int) (overrideAlpha * 255), shaderToUse, orientation);
}
if (crossfadeWithThumb && animationNotReady) {
drawDrawable(canvas, drawable, (int) (overrideAlpha * 255), shaderToUse, orientation);
} else {
@ -1443,7 +1450,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
if (thumbDrawable instanceof SvgHelper.SvgDrawable || thumbDrawable instanceof Emoji.EmojiDrawable) {
alpha = (int) (overrideAlpha * 255 * (1.0f - currentAlpha));
} else {
alpha = (int) (overrideAlpha * 255);
alpha = (int) (overrideAlpha * previousAlpha * 255);
}
drawDrawable(canvas, thumbDrawable, alpha, thumbShaderToUse, thumbOrientation);
if (alpha != 255 && thumbDrawable instanceof Emoji.EmojiDrawable) {
@ -2077,7 +2084,8 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
} else if (currentImageDrawable instanceof RLottieDrawable) {
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;
lastUpdateAlphaTime = System.currentTimeMillis();
crossfadeWithThumb = crossfadeImage != null || currentThumbDrawable != null || staticThumbDrawable != null;
@ -2101,6 +2109,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
boolean allowCorssfade = true;
if (!memCache && !forcePreview || forceCrossfade) {
if (currentThumbDrawable == null && staticThumbDrawable == null || currentAlpha == 1.0f || forceCrossfade) {
previousAlpha = currentAlpha;
currentAlpha = 0.0f;
lastUpdateAlphaTime = System.currentTimeMillis();
crossfadeWithThumb = crossfadeImage != null || currentThumbDrawable != null || staticThumbDrawable != null;
@ -2139,7 +2148,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
} else {
currentAlpha = 0.0f;
lastUpdateAlphaTime = System.currentTimeMillis();
crossfadeWithThumb = staticThumbDrawable != null && currentImageKey == null && currentMediaKey == null;
crossfadeWithThumb = staticThumbDrawable != null;
}
} else {
currentAlpha = 1.0f;

4
TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java

@ -414,10 +414,10 @@ public class LocaleController {
}
return languagesDict.get(key.toLowerCase().replace("-", "_"));
}
public LocaleInfo getLanguageByPlural(String plural) {
public LocaleInfo getBuiltinLanguageByPlural(String plural) {
Collection<LocaleInfo> values = languagesDict.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 null;
}

31
TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java

@ -10,7 +10,6 @@ package org.telegram.messenger;
import android.app.Activity;
import android.content.Context;
import android.content.Entity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ShortcutManager;
@ -355,9 +354,15 @@ public class MediaDataController extends BaseController {
ImageReceiver imageReceiver = new ImageReceiver();
TLRPC.TL_availableReaction reaction = reactions.get(i);
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.setImage(ImageLocation.getForDocument(reaction.static_icon), null, null, null, 0, 1);
ImageLoader.getInstance().loadImageForImageReceiver(imageReceiver);
}
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.reactionsDidLoad);
});
@ -4589,23 +4594,31 @@ public class MediaDataController extends BaseController {
}
}
public static void addTextStyleRuns(TLRPC.DraftMessage msg, Spannable text) {
addTextStyleRuns(msg.entities, msg.message, text);
public static void addTextStyleRuns(MessageObject msg, Spannable text) {
addTextStyleRuns(msg.messageOwner.entities, msg.messageText, text, -1);
}
public static void addTextStyleRuns(MessageObject msg, Spannable text) {
addTextStyleRuns(msg.messageOwner.entities, msg.messageText, text);
public static void addTextStyleRuns(TLRPC.DraftMessage msg, Spannable text, int allowedFlags) {
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) {
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))
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);
}
}
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<TLRPC.MessageEntity> entitiesCopy = new ArrayList<>(entities);
@ -4654,6 +4667,8 @@ public class MediaDataController extends BaseController {
newRun.urlEntity = entity;
}
newRun.flags &= allowedFlags;
for (int b = 0, N2 = runs.size(); b < N2; b++) {
TextStyleSpan.TextStyleRun run = runs.get(b);

4
TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java

@ -98,9 +98,9 @@ public class MessageObject {
public CharSequence caption;
public MessageObject replyMessageObject;
public int type = 1000;
public boolean reactionsVisibleOnScreen;
public long reactionsLastCheckTime;
public String customName;
public boolean reactionsChanged;
private int isRoundVideoCached;
public long eventId;
public int contentType;
@ -6275,6 +6275,7 @@ public class MessageObject {
}
}
}
reactionsChanged = true;
return false;
}
@ -6308,6 +6309,7 @@ public class MessageObject {
action.user_id = UserConfig.getInstance(currentAccount).getClientUserId();
action.reaction = reaction;
}
reactionsChanged = true;
return true;
}
}

100
TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java

@ -28,8 +28,6 @@ import android.util.SparseIntArray;
import androidx.collection.LongSparseArray;
import androidx.core.app.NotificationManagerCompat;
import com.google.android.exoplayer2.util.Log;
import org.telegram.SQLite.SQLiteCursor;
import org.telegram.messenger.support.LongSparseIntArray;
import org.telegram.messenger.support.LongSparseLongArray;
@ -135,11 +133,7 @@ public class MessagesController extends BaseController implements NotificationCe
private LongSparseArray<SparseArray<MessageObject>> pollsToCheck = new LongSparseArray<>();
private int pollsToCheckSize;
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 SparseArray<DialogFilter> dialogFiltersById = new SparseArray<>();
private boolean loadingSuggestedFilters;
@ -2610,7 +2604,6 @@ public class MessagesController extends BaseController implements NotificationCe
channelViewsToSend.clear();
pollsToCheck.clear();
pollsToCheckSize = 0;
reactionsToCheck.clear();
dialogsServerOnly.clear();
dialogsForward.clear();
allDialogs.clear();
@ -2842,12 +2835,6 @@ public class MessagesController extends BaseController implements NotificationCe
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(() -> {
@ -5399,57 +5386,6 @@ public class MessagesController extends BaseController implements NotificationCe
}
}
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) {
lastViewsCheckTime = System.currentTimeMillis();
if (channelViewsToSend.size() != 0) {
@ -8607,26 +8543,22 @@ public class MessagesController extends BaseController implements NotificationCe
});
}
public void addToReactionsQueue(long dialogId, ArrayList<MessageObject> visibleObjects) {
SparseArray<MessageObject> array = reactionsToCheck.get(dialogId);
if (array == null) {
reactionsToCheck.put(dialogId, array = new SparseArray<>());
public void loadReactionsForMessages(long dialogId, ArrayList<MessageObject> visibleObjects) {
if (visibleObjects.isEmpty()) {
return;
}
for (int a = 0, N = array.size(); a < N; a++) {
MessageObject object = array.valueAt(a);
object.reactionsVisibleOnScreen = false;
TLRPC.TL_messages_getMessagesReactions req = new TLRPC.TL_messages_getMessagesReactions();
req.peer = getInputPeer(dialogId);
for (int i = 0; i < visibleObjects.size(); i++) {
MessageObject messageObject = visibleObjects.get(i);
req.id.add(messageObject.getId());
}
int time = getConnectionsManager().getCurrentTime();
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) {
@ -14044,7 +13976,7 @@ public class MessagesController extends BaseController implements NotificationCe
return info.messages;
}
TLRPC.Chat chat = getChat(-dialogId);
if (!ChatObject.isChannel(chat) || chat.megagroup || chat.gigagroup) {
if (!ChatObject.isChannel(chat)) {
return null;
}
info = new SponsoredMessagesInfo();
@ -14926,7 +14858,7 @@ public class MessagesController extends BaseController implements NotificationCe
}
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) {

9
TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java

@ -2663,8 +2663,13 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
return;
}
TLRPC.TL_messages_sendReaction req = new TLRPC.TL_messages_sendReaction();
req.peer = getMessagesController().getInputPeer(messageObject.getDialogId());
req.msg_id = messageObject.getId();
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.msg_id = messageObject.getId();
}
if (reaction != null) {
req.reaction = reaction.toString();
req.flags |= 1;

17
TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java

@ -485,6 +485,14 @@ public class TLRPC {
photo_big = new TL_fileLocationToBeDeprecated();
photo_big.volume_id = -photo_id;
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) {
@ -30395,6 +30403,14 @@ public class TLRPC {
photo_big = new TL_fileLocationToBeDeprecated();
photo_big.volume_id = -photo_id;
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) {
@ -54106,6 +54122,7 @@ public class TLRPC {
if ((flags & 33554432) != 0) {
stream.writeInt32(ttl_period);
}
writeAttachPath(stream);
}
}

3
TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarPopupWindow.java

@ -22,6 +22,7 @@ import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
@ -35,6 +36,8 @@ import android.widget.ScrollView;
import androidx.annotation.Keep;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.util.Log;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.NotificationCenter;

6
TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java

@ -65,6 +65,8 @@ import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import androidx.core.graphics.ColorUtils;
import com.google.android.exoplayer2.util.Log;
import org.json.JSONArray;
import org.json.JSONObject;
import org.telegram.messenger.AndroidUtilities;
@ -7525,7 +7527,9 @@ public class Theme {
try {
String[] wallpaperLink = new String[1];
HashMap<String, Integer> colors = getThemeFileValues(new File(pathToFile), null, wallpaperLink);
checkIsDark(colors, accent.parentTheme);
if (accent != null) {
checkIsDark(colors, accent.parentTheme);
}
Integer wallpaperFileOffset = colors.get("wallpaperFileOffset");
Bitmap bitmap = Bitmaps.createBitmap(560, 678, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);

12
TMessagesProj/src/main/java/org/telegram/ui/ArticleViewer.java

@ -8,6 +8,11 @@
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.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
@ -169,11 +174,6 @@ import java.util.HashMap;
import java.util.List;
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 {
private Activity parentActivity;
@ -5954,7 +5954,7 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
currentBlock = block;
parentBlock = null;
currentDocument = parentAdapter.getDocumentWithId(currentBlock.video_id);
isGif = MessageObject.isGifDocument(currentDocument)/* && currentBlock.autoplay*/;
isGif = MessageObject.isVideoDocument(currentDocument) || MessageObject.isGifDocument(currentDocument)/* && currentBlock.autoplay*/;
isFirst = first;
channelCell.setVisibility(INVISIBLE);
updateButtonState(false);

407
TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java

@ -129,7 +129,6 @@ import org.telegram.ui.Components.SeekBar;
import org.telegram.ui.Components.SeekBarAccessibilityDelegate;
import org.telegram.ui.Components.SeekBarWaveform;
import org.telegram.ui.Components.SlotsDrawable;
import org.telegram.ui.Components.spoilers.SpoilerEffect;
import org.telegram.ui.Components.StaticLayoutEx;
import org.telegram.ui.Components.TextStyleSpan;
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.URLSpanNoUnderline;
import org.telegram.ui.Components.VideoForwardDrawable;
import org.telegram.ui.Components.spoilers.SpoilerEffect;
import org.telegram.ui.PhotoViewer;
import org.telegram.ui.PinchToZoomHelper;
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 boolean clipToGroupBounds;
public RadialProgress2 getRadialProgress() {
return radialProgress;
}
boolean enterTransitionInPorgress;
public void setEnterTransitionInProgress(boolean b) {
enterTransitionInPorgress = b;
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 {
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);
y -= block.textYOffset;
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);
if (left <= x && left + block.textLayout.getLineWidth(line) >= x) {
@ -1147,6 +1159,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
try {
LinkPath path = obtainNewUrlPath(false);
int[] pos = getRealSpanStartAndEnd(buffer, pressedLink);
pos[0] -= block.charactersOffset;
pos[1] -= block.charactersOffset;
path.setCurrentLayout(block.textLayout, pos[0], 0);
block.textLayout.getSelectionPath(pos[0], pos[1], path);
if (pos[1] >= block.charactersEnd) {
@ -1163,8 +1177,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
path = obtainNewUrlPath(false);
path.setCurrentLayout(nextBlock.textLayout, 0, nextBlock.textYOffset - block.textYOffset);
nextBlock.textLayout.getSelectionPath(0, pos[1], path);
if (pos[1] < nextBlock.charactersEnd - 1) {
int p1 = pos[1] + block.charactersOffset - nextBlock.charactersOffset;
nextBlock.textLayout.getSelectionPath(0, p1, path);
if (p1 < nextBlock.charactersEnd - 1) {
break;
}
}
@ -1184,9 +1199,11 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
path = obtainNewUrlPath(false);
offsetY -= nextBlock.height;
path.setCurrentLayout(nextBlock.textLayout, pos[0], offsetY);
nextBlock.textLayout.getSelectionPath(pos[0], pos[1], path);
if (pos[0] > nextBlock.charactersOffset) {
int p0 = pos[0] + block.charactersOffset - nextBlock.charactersOffset;
int p1 = pos[1] + block.charactersOffset - nextBlock.charactersOffset;
path.setCurrentLayout(nextBlock.textLayout, p0, offsetY);
nextBlock.textLayout.getSelectionPath(p0, p1, path);
if (p0 > nextBlock.charactersOffset) {
break;
}
}
@ -1896,7 +1913,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
currentMessageObject.audioProgress = p;
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 (event.getAction() == MotionEvent.ACTION_UP) {
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()) {
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;
isCaptionSpoilerPressed = 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));
isSpoilerRevealing = true;
spoilerPressed.setOnRippleEndCallback(()->post(()->{
spoilerPressed.setOnRippleEndCallback(() -> post(() -> {
isSpoilerRevealing = false;
getMessageObject().isSpoilersRevealed = true;
if (isCaptionSpoilerPressed) {
@ -2198,7 +2216,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
ChatMessageCell cell = (ChatMessageCell) ch;
if (cell.getMessageObject() != null && cell.getMessageObject().getReplyMsgId() == getMessageObject().getId()) {
if (!cell.replySpoilers.isEmpty()) {
cell.replySpoilers.get(0).setOnRippleEndCallback(()->post(()->{
cell.replySpoilers.get(0).setOnRippleEndCallback(() -> post(() -> {
cell.getMessageObject().replyMessageObject.isSpoilersRevealed = true;
cell.replySpoilers.clear();
cell.invalidate();
@ -2599,7 +2617,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
return false;
}
return reactionsLayoutInBubble.chekTouchEvent(event);
return reactionsLayoutInBubble.chekTouchEvent(event);
}
@ -2841,7 +2859,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
this.parentViewTopOffset = parentOffset;
parentHeight = parent;
}
if (currentMessageObject != null && (hasGradientService() && currentMessageObject.shouldDrawWithoutBackground() || drawSideButton != 0 || !botButtons.isEmpty()) ) {
if (currentMessageObject != null && (hasGradientService() && currentMessageObject.shouldDrawWithoutBackground() || drawSideButton != 0 || !botButtons.isEmpty())) {
invalidate();
}
@ -3580,16 +3598,21 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
photoImage.setMediaStartEndTime(-1, -1);
boolean canChangeRadius = true;
if (currentPosition == null || ((currentPosition.flags & MessageObject.POSITION_FLAG_BOTTOM) != 0)) {
if (currentPosition != null) {
reactionsLayoutInBubble.setMessage(groupedMessages.findPrimaryMessageObject(), !messageObject.shouldDrawReactionsInLayout(), resourcesProvider);
if (messageIdChanged || messageObject.reactionsChanged) {
messageObject.reactionsChanged = false;
if (currentPosition == null || ((currentPosition.flags & MessageObject.POSITION_FLAG_BOTTOM) != 0)) {
if (currentPosition != null) {
reactionsLayoutInBubble.setMessage(groupedMessages.findPrimaryMessageObject(), !messageObject.shouldDrawReactionsInLayout(), resourcesProvider);
} else {
reactionsLayoutInBubble.setMessage(messageObject, !messageObject.shouldDrawReactionsInLayout(), resourcesProvider);
}
} else {
reactionsLayoutInBubble.setMessage(messageObject, !messageObject.shouldDrawReactionsInLayout(), resourcesProvider);
reactionsLayoutInBubble.setMessage(null, false, resourcesProvider);
}
} else {
reactionsLayoutInBubble.setMessage(null, false, resourcesProvider);
}
if (messageChanged) {
firstVisibleBlockNum = 0;
lastVisibleBlockNum = 0;
@ -3895,11 +3918,11 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
backgroundWidth = reactionsLayoutInBubble.width;
}
if ((hasLinkPreview || hasInvoicePreview) && !drawInstantView) {
reactionsLayoutInBubble.totalHeight += AndroidUtilities.dp(6);
reactionsLayoutInBubble.positionOffsetY += AndroidUtilities.dp(3);
}
totalHeight += reactionsLayoutInBubble.totalHeight;
if ((hasLinkPreview || hasInvoicePreview) && !drawInstantView) {
reactionsLayoutInBubble.totalHeight += AndroidUtilities.dp(6);
reactionsLayoutInBubble.positionOffsetY += AndroidUtilities.dp(3);
}
totalHeight += reactionsLayoutInBubble.totalHeight;
}
}
if (drawPinnedTop) {
@ -4515,7 +4538,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
currentPhotoFilterThumb = String.format(Locale.US, "%d_%d_b", w, h);
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 {
if (documentAttachType == DOCUMENT_ATTACH_TYPE_WALLPAPER) {
if (messageObject.mediaExists) {
@ -4548,13 +4572,16 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
photoImage.setAllowDecodeSingleFrame(true);
photoImage.setAllowStartAnimation(true);
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;
} else {
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 {
/*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) {
@ -4572,23 +4599,28 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
autoPlayingMedia = true;
TLRPC.VideoSize videoSize = MessageObject.getDocumentVideoThumb(document);
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 {
/*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 {
/*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 {
boolean photoExist = messageObject.mediaExists;
String fileName = FileLoader.getAttachFileName(currentPhotoObject);
if (hasGamePreview || photoExist || DownloadController.getInstance(currentAccount).canDownloadMedia(currentMessageObject) || FileLoader.getInstance(currentAccount).isLoadingFile(fileName)) {
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 {
photoNotSet = true;
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 {
photoImage.setImageBitmap((Drawable) null);
}
@ -5285,7 +5317,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
}
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);
measureTime(messageObject);
int timeLeft = backgroundWidth - reactionsLayoutInBubble.lastLineX - AndroidUtilities.dp(24);
@ -5850,7 +5884,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
} else {
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;
fixPhotoWidth = true;
} else {
@ -6024,13 +6058,15 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
TLRPC.Document document = messageObject.getDocument();
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);
} else {
if (!messageIdChanged && !dataChanged) {
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) {
if (messageObject.useCustomPhoto) {
@ -6081,45 +6117,55 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
photoImage.setCrossfadeDuration(250);
}
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 {
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 {
/*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) {
/*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 {
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*/