mirror of https://github.com/NekoX-Dev/NekoX.git
parent
2fe194e9b9
commit
3c94320b99
|
@ -1238,6 +1238,16 @@ public class RecyclerView extends ViewGroup implements ScrollingView,
|
||||||
mState.mStructureChanged = true;
|
mState.mStructureChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void prepareForFastScroll() {
|
||||||
|
stopScroll();
|
||||||
|
removeAndRecycleViews();
|
||||||
|
mAdapterHelper.reset();
|
||||||
|
mRecycler.onAdapterChanged(mAdapter, mAdapter, false);
|
||||||
|
mState.mStructureChanged = true;
|
||||||
|
mChildHelper.removeAllViewsUnfiltered();
|
||||||
|
mRecycler.updateViewCacheSize();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the previously set adapter or null if no adapter is set.
|
* Retrieves the previously set adapter or null if no adapter is set.
|
||||||
*
|
*
|
||||||
|
@ -1562,7 +1572,7 @@ public class RecyclerView extends ViewGroup implements ScrollingView,
|
||||||
if (state == mScrollState) {
|
if (state == mScrollState) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (DEBUG) {
|
if (false) {
|
||||||
Log.d(TAG, "setting scroll state to " + state + " from " + mScrollState,
|
Log.d(TAG, "setting scroll state to " + state + " from " + mScrollState,
|
||||||
new Exception());
|
new Exception());
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,8 +257,22 @@ public class FileRefController extends BaseController {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String cacheKey = locationKey;
|
||||||
|
if (parentObject instanceof String) {
|
||||||
|
String string = (String) parentObject;
|
||||||
|
if ("wallpaper".equals(string)) {
|
||||||
|
cacheKey = "wallpaper";
|
||||||
|
} else if (string.startsWith("gif")) {
|
||||||
|
cacheKey = "gif";
|
||||||
|
} else if ("recent".equals(string)) {
|
||||||
|
cacheKey = "recent";
|
||||||
|
} else if ("fav".equals(string)) {
|
||||||
|
cacheKey = "fav";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cleanupCache();
|
cleanupCache();
|
||||||
CachedResult cachedResult = getCachedResponse(locationKey);
|
CachedResult cachedResult = getCachedResponse(cacheKey);
|
||||||
if (cachedResult != null) {
|
if (cachedResult != null) {
|
||||||
if (!onRequestComplete(locationKey, parentKey, cachedResult.response, false)) {
|
if (!onRequestComplete(locationKey, parentKey, cachedResult.response, false)) {
|
||||||
responseCache.remove(locationKey);
|
responseCache.remove(locationKey);
|
||||||
|
@ -575,6 +589,16 @@ public class FileRefController extends BaseController {
|
||||||
|
|
||||||
private boolean onRequestComplete(String locationKey, String parentKey, TLObject response, boolean cache) {
|
private boolean onRequestComplete(String locationKey, String parentKey, TLObject response, boolean cache) {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
|
String cacheKey = parentKey;
|
||||||
|
if (response instanceof TLRPC.TL_account_wallPapers) {
|
||||||
|
cacheKey = "wallpaper";
|
||||||
|
} else if (response instanceof TLRPC.TL_messages_savedGifs) {
|
||||||
|
cacheKey = "gif";
|
||||||
|
} else if (response instanceof TLRPC.TL_messages_recentStickers) {
|
||||||
|
cacheKey = "recent";
|
||||||
|
} else if (response instanceof TLRPC.TL_messages_favedStickers) {
|
||||||
|
cacheKey = "fav";
|
||||||
|
}
|
||||||
if (parentKey != null) {
|
if (parentKey != null) {
|
||||||
ArrayList<Requester> arrayList = parentRequester.get(parentKey);
|
ArrayList<Requester> arrayList = parentRequester.get(parentKey);
|
||||||
if (arrayList != null) {
|
if (arrayList != null) {
|
||||||
|
@ -588,7 +612,7 @@ public class FileRefController extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (found) {
|
if (found) {
|
||||||
putReponseToCache(parentKey, response);
|
putReponseToCache(cacheKey, response);
|
||||||
}
|
}
|
||||||
parentRequester.remove(parentKey);
|
parentRequester.remove(parentKey);
|
||||||
}
|
}
|
||||||
|
@ -600,6 +624,7 @@ public class FileRefController extends BaseController {
|
||||||
if (arrayList == null) {
|
if (arrayList == null) {
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
cacheKey = locationKey;
|
||||||
for (int q = 0, N = arrayList.size(); q < N; q++) {
|
for (int q = 0, N = arrayList.size(); q < N; q++) {
|
||||||
Requester requester = arrayList.get(q);
|
Requester requester = arrayList.get(q);
|
||||||
if (requester.completed) {
|
if (requester.completed) {
|
||||||
|
@ -793,7 +818,7 @@ public class FileRefController extends BaseController {
|
||||||
}
|
}
|
||||||
locationRequester.remove(locationKey);
|
locationRequester.remove(locationKey);
|
||||||
if (found) {
|
if (found) {
|
||||||
putReponseToCache(locationKey, response);
|
putReponseToCache(cacheKey, response);
|
||||||
}
|
}
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,8 +128,8 @@ public class MediaDataController extends BaseController {
|
||||||
public static final int TYPE_FEATURED = 3;
|
public static final int TYPE_FEATURED = 3;
|
||||||
public static final int TYPE_EMOJI = 4;
|
public static final int TYPE_EMOJI = 4;
|
||||||
|
|
||||||
private ArrayList<TLRPC.TL_messages_stickerSet>[] stickerSets = new ArrayList[]{new ArrayList<>(), new ArrayList<>(), new ArrayList(0), new ArrayList(), new ArrayList()};
|
private ArrayList<TLRPC.TL_messages_stickerSet>[] stickerSets = new ArrayList[]{new ArrayList<>(), new ArrayList<>(), new ArrayList<>(0), new ArrayList<>(), new ArrayList<>()};
|
||||||
private LongSparseArray<TLRPC.Document>[] stickersByIds = new LongSparseArray[]{new LongSparseArray<>(), new LongSparseArray<>(), new LongSparseArray(), new LongSparseArray(), new LongSparseArray()};
|
private LongSparseArray<TLRPC.Document>[] stickersByIds = new LongSparseArray[]{new LongSparseArray<>(), new LongSparseArray<>(), new LongSparseArray<>(), new LongSparseArray<>(), new LongSparseArray<>()};
|
||||||
private LongSparseArray<TLRPC.TL_messages_stickerSet> stickerSetsById = new LongSparseArray<>();
|
private LongSparseArray<TLRPC.TL_messages_stickerSet> stickerSetsById = new LongSparseArray<>();
|
||||||
private LongSparseArray<TLRPC.TL_messages_stickerSet> installedStickerSetsById = new LongSparseArray<>();
|
private LongSparseArray<TLRPC.TL_messages_stickerSet> installedStickerSetsById = new LongSparseArray<>();
|
||||||
private LongSparseArray<TLRPC.TL_messages_stickerSet> groupStickerSets = new LongSparseArray<>();
|
private LongSparseArray<TLRPC.TL_messages_stickerSet> groupStickerSets = new LongSparseArray<>();
|
||||||
|
@ -683,7 +683,7 @@ public class MediaDataController extends BaseController {
|
||||||
return value != null ? value : "";
|
return value != null ? value : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int calcDocumentsHash(ArrayList<TLRPC.Document> arrayList) {
|
public static int calcDocumentsHash(ArrayList<TLRPC.Document> arrayList) {
|
||||||
if (arrayList == null) {
|
if (arrayList == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -5079,7 +5079,7 @@ public class MediaDataController extends BaseController {
|
||||||
}
|
}
|
||||||
ArrayList<String> recentEmoji = new ArrayList<>(Emoji.recentEmoji);
|
ArrayList<String> recentEmoji = new ArrayList<>(Emoji.recentEmoji);
|
||||||
getMessagesStorage().getStorageQueue().postRunnable(() -> {
|
getMessagesStorage().getStorageQueue().postRunnable(() -> {
|
||||||
ArrayList<KeywordResult> result = new ArrayList();
|
ArrayList<KeywordResult> result = new ArrayList<>();
|
||||||
HashMap<String, Boolean> resultMap = new HashMap<>();
|
HashMap<String, Boolean> resultMap = new HashMap<>();
|
||||||
String alias = null;
|
String alias = null;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -9378,7 +9378,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
dialog.pinnedNum = 0;
|
dialog.pinnedNum = 0;
|
||||||
}
|
}
|
||||||
sortDialogs(null);
|
sortDialogs(null);
|
||||||
if (!pin && dialogs.get(dialogs.size() - 1) == dialog && !dialogsEndReached.get(folderId)) {
|
if (!pin && !dialogs.isEmpty() && dialogs.get(dialogs.size() - 1) == dialog && !dialogsEndReached.get(folderId)) {
|
||||||
dialogs.remove(dialogs.size() - 1);
|
dialogs.remove(dialogs.size() - 1);
|
||||||
}
|
}
|
||||||
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload);
|
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload);
|
||||||
|
|
|
@ -356,7 +356,7 @@ public class NotificationCenter {
|
||||||
ArrayList<NotificationCenterDelegate> objects = observers.get(id);
|
ArrayList<NotificationCenterDelegate> objects = observers.get(id);
|
||||||
if (objects != null && !objects.isEmpty()) {
|
if (objects != null && !objects.isEmpty()) {
|
||||||
for (int a = 0; a < objects.size(); a++) {
|
for (int a = 0; a < objects.size(); a++) {
|
||||||
NotificationCenterDelegate obj = objects.get(a);;
|
NotificationCenterDelegate obj = objects.get(a);
|
||||||
obj.didReceivedNotification(id, currentAccount, args);
|
obj.didReceivedNotification(id, currentAccount, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -470,7 +470,10 @@ public class DrawerLayoutContainer extends FrameLayout {
|
||||||
}
|
}
|
||||||
inLayout = false;
|
inLayout = false;
|
||||||
} else {
|
} else {
|
||||||
AndroidUtilities.displaySize.y = heightSize - AndroidUtilities.statusBarHeight;
|
int newSize = heightSize - AndroidUtilities.statusBarHeight;
|
||||||
|
if (newSize > 0 && newSize < 4096) {
|
||||||
|
AndroidUtilities.displaySize.y = newSize;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean applyInsets = lastInsets != null && Build.VERSION.SDK_INT >= 21;
|
final boolean applyInsets = lastInsets != null && Build.VERSION.SDK_INT >= 21;
|
||||||
|
|
|
@ -13,6 +13,7 @@ import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
@ -23,13 +24,16 @@ import android.text.StaticLayout;
|
||||||
import android.text.TextPaint;
|
import android.text.TextPaint;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.style.ForegroundColorSpan;
|
import android.text.style.ForegroundColorSpan;
|
||||||
|
import android.text.style.ReplacementSpan;
|
||||||
import android.view.HapticFeedbackConstants;
|
import android.view.HapticFeedbackConstants;
|
||||||
import android.view.accessibility.AccessibilityEvent;
|
import android.view.accessibility.AccessibilityEvent;
|
||||||
import android.view.accessibility.AccessibilityNodeInfo;
|
import android.view.accessibility.AccessibilityNodeInfo;
|
||||||
import android.view.animation.Interpolator;
|
import android.view.animation.Interpolator;
|
||||||
|
|
||||||
import org.telegram.messenger.AndroidUtilities;
|
import org.telegram.messenger.AndroidUtilities;
|
||||||
|
import org.telegram.messenger.BuildVars;
|
||||||
import org.telegram.messenger.ChatObject;
|
import org.telegram.messenger.ChatObject;
|
||||||
|
import org.telegram.messenger.FileLoader;
|
||||||
import org.telegram.messenger.MediaDataController;
|
import org.telegram.messenger.MediaDataController;
|
||||||
import org.telegram.messenger.DialogObject;
|
import org.telegram.messenger.DialogObject;
|
||||||
import org.telegram.messenger.ImageLocation;
|
import org.telegram.messenger.ImageLocation;
|
||||||
|
@ -61,6 +65,34 @@ import java.util.ArrayList;
|
||||||
|
|
||||||
public class DialogCell extends BaseCell {
|
public class DialogCell extends BaseCell {
|
||||||
|
|
||||||
|
|
||||||
|
public static class FixedWidthSize extends ReplacementSpan {
|
||||||
|
|
||||||
|
private int width;
|
||||||
|
|
||||||
|
public FixedWidthSize(int w) {
|
||||||
|
width = w;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSize(Paint paint, CharSequence text, int start, int end, Paint.FontMetricsInt fm) {
|
||||||
|
if (fm == null) {
|
||||||
|
fm = paint.getFontMetricsInt();
|
||||||
|
}
|
||||||
|
if (fm != null) {
|
||||||
|
int h = fm.descent - fm.ascent;
|
||||||
|
fm.bottom = fm.descent = 1 - h;
|
||||||
|
fm.top = fm.ascent = -1;
|
||||||
|
}
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class CustomDialog {
|
public static class CustomDialog {
|
||||||
public String name;
|
public String name;
|
||||||
public String message;
|
public String message;
|
||||||
|
@ -116,6 +148,12 @@ public class DialogCell extends BaseCell {
|
||||||
private float currentRevealBounceProgress;
|
private float currentRevealBounceProgress;
|
||||||
private float archiveBackgroundProgress;
|
private float archiveBackgroundProgress;
|
||||||
|
|
||||||
|
private static String[] newLine = new String[]{"\n"};
|
||||||
|
private static String[] space = new String[]{" "};
|
||||||
|
|
||||||
|
private boolean hasMessageThumb;
|
||||||
|
private ImageReceiver thumbImage = new ImageReceiver(this);
|
||||||
|
|
||||||
private ImageReceiver avatarImage = new ImageReceiver(this);
|
private ImageReceiver avatarImage = new ImageReceiver(this);
|
||||||
private AvatarDrawable avatarDrawable = new AvatarDrawable();
|
private AvatarDrawable avatarDrawable = new AvatarDrawable();
|
||||||
private boolean animatingArchiveAvatar;
|
private boolean animatingArchiveAvatar;
|
||||||
|
@ -223,6 +261,7 @@ public class DialogCell extends BaseCell {
|
||||||
|
|
||||||
Theme.createDialogsResources(context);
|
Theme.createDialogsResources(context);
|
||||||
avatarImage.setRoundRadius(AndroidUtilities.dp(28));
|
avatarImage.setRoundRadius(AndroidUtilities.dp(28));
|
||||||
|
thumbImage.setRoundRadius(AndroidUtilities.dp(2));
|
||||||
useForceThreeLines = forceThreeLines;
|
useForceThreeLines = forceThreeLines;
|
||||||
|
|
||||||
if (needCheck) {
|
if (needCheck) {
|
||||||
|
@ -308,6 +347,7 @@ public class DialogCell extends BaseCell {
|
||||||
attachedToWindow = false;
|
attachedToWindow = false;
|
||||||
reorderIconProgress = drawPin && drawReorder ? 1.0f : 0.0f;
|
reorderIconProgress = drawPin && drawReorder ? 1.0f : 0.0f;
|
||||||
avatarImage.onDetachedFromWindow();
|
avatarImage.onDetachedFromWindow();
|
||||||
|
thumbImage.onDetachedFromWindow();
|
||||||
if (translationDrawable != null) {
|
if (translationDrawable != null) {
|
||||||
translationDrawable.stop();
|
translationDrawable.stop();
|
||||||
translationDrawable.setProgress(0.0f);
|
translationDrawable.setProgress(0.0f);
|
||||||
|
@ -321,6 +361,7 @@ public class DialogCell extends BaseCell {
|
||||||
protected void onAttachedToWindow() {
|
protected void onAttachedToWindow() {
|
||||||
super.onAttachedToWindow();
|
super.onAttachedToWindow();
|
||||||
avatarImage.onAttachedToWindow();
|
avatarImage.onAttachedToWindow();
|
||||||
|
thumbImage.onAttachedToWindow();
|
||||||
resetPinnedArchiveState();
|
resetPinnedArchiveState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,6 +461,7 @@ public class DialogCell extends BaseCell {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buildLayout() {
|
public void buildLayout() {
|
||||||
|
int thumbSize;
|
||||||
if (useForceThreeLines || SharedConfig.useThreeLinesLayout) {
|
if (useForceThreeLines || SharedConfig.useThreeLinesLayout) {
|
||||||
Theme.dialogs_namePaint[1].setTextSize(AndroidUtilities.dp(16));
|
Theme.dialogs_namePaint[1].setTextSize(AndroidUtilities.dp(16));
|
||||||
Theme.dialogs_nameEncryptedPaint[1].setTextSize(AndroidUtilities.dp(16));
|
Theme.dialogs_nameEncryptedPaint[1].setTextSize(AndroidUtilities.dp(16));
|
||||||
|
@ -428,6 +470,7 @@ public class DialogCell extends BaseCell {
|
||||||
|
|
||||||
Theme.dialogs_messagePaint[1].setColor(Theme.dialogs_messagePaint[1].linkColor = Theme.getColor(Theme.key_chats_message_threeLines));
|
Theme.dialogs_messagePaint[1].setColor(Theme.dialogs_messagePaint[1].linkColor = Theme.getColor(Theme.key_chats_message_threeLines));
|
||||||
paintIndex = 1;
|
paintIndex = 1;
|
||||||
|
thumbSize = 18;
|
||||||
} else {
|
} else {
|
||||||
Theme.dialogs_namePaint[0].setTextSize(AndroidUtilities.dp(17));
|
Theme.dialogs_namePaint[0].setTextSize(AndroidUtilities.dp(17));
|
||||||
Theme.dialogs_nameEncryptedPaint[0].setTextSize(AndroidUtilities.dp(17));
|
Theme.dialogs_nameEncryptedPaint[0].setTextSize(AndroidUtilities.dp(17));
|
||||||
|
@ -436,6 +479,7 @@ public class DialogCell extends BaseCell {
|
||||||
|
|
||||||
Theme.dialogs_messagePaint[0].setColor(Theme.dialogs_messagePaint[0].linkColor = Theme.getColor(Theme.key_chats_message));
|
Theme.dialogs_messagePaint[0].setColor(Theme.dialogs_messagePaint[0].linkColor = Theme.getColor(Theme.key_chats_message));
|
||||||
paintIndex = 0;
|
paintIndex = 0;
|
||||||
|
thumbSize = 19;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentDialogFolderDialogsCount = 0;
|
currentDialogFolderDialogsCount = 0;
|
||||||
|
@ -459,6 +503,8 @@ public class DialogCell extends BaseCell {
|
||||||
drawVerified = false;
|
drawVerified = false;
|
||||||
drawScam = false;
|
drawScam = false;
|
||||||
drawPinBackground = false;
|
drawPinBackground = false;
|
||||||
|
hasMessageThumb = false;
|
||||||
|
int offsetName = 0;
|
||||||
boolean showChecks = !UserObject.isUserSelf(user) && !useMeForMyMessages;
|
boolean showChecks = !UserObject.isUserSelf(user) && !useMeForMyMessages;
|
||||||
boolean drawTime = true;
|
boolean drawTime = true;
|
||||||
|
|
||||||
|
@ -585,14 +631,12 @@ public class DialogCell extends BaseCell {
|
||||||
if (customDialog.sent) {
|
if (customDialog.sent) {
|
||||||
drawCheck1 = true;
|
drawCheck1 = true;
|
||||||
drawCheck2 = true;
|
drawCheck2 = true;
|
||||||
drawClock = false;
|
|
||||||
drawError = false;
|
|
||||||
} else {
|
} else {
|
||||||
drawCheck1 = false;
|
drawCheck1 = false;
|
||||||
drawCheck2 = false;
|
drawCheck2 = false;
|
||||||
drawClock = false;
|
|
||||||
drawError = false;
|
|
||||||
}
|
}
|
||||||
|
drawClock = false;
|
||||||
|
drawError = false;
|
||||||
nameString = customDialog.name;
|
nameString = customDialog.name;
|
||||||
} else {
|
} else {
|
||||||
if (useForceThreeLines || SharedConfig.useThreeLinesLayout) {
|
if (useForceThreeLines || SharedConfig.useThreeLinesLayout) {
|
||||||
|
@ -800,6 +844,20 @@ public class DialogCell extends BaseCell {
|
||||||
}
|
}
|
||||||
currentMessagePaint = Theme.dialogs_messagePrintingPaint[paintIndex];
|
currentMessagePaint = Theme.dialogs_messagePrintingPaint[paintIndex];
|
||||||
} else {
|
} else {
|
||||||
|
boolean needEmoji = true;
|
||||||
|
if (BuildVars.DEBUG_VERSION && encryptedChat == null && !message.needDrawBluredPreview() && (message.isPhoto() || message.isNewGif() || message.isVideo())) {
|
||||||
|
TLRPC.PhotoSize smallThumb = FileLoader.getClosestPhotoSizeWithSize(message.photoThumbs, 40);
|
||||||
|
TLRPC.PhotoSize bigThumb = FileLoader.getClosestPhotoSizeWithSize(message.photoThumbs, AndroidUtilities.getPhotoSize());
|
||||||
|
if (smallThumb == bigThumb) {
|
||||||
|
bigThumb = null;
|
||||||
|
}
|
||||||
|
if (smallThumb != null) {
|
||||||
|
hasMessageThumb = true;
|
||||||
|
//TODO respect autodownload settings?
|
||||||
|
thumbImage.setImage(ImageLocation.getForObject(bigThumb, message.photoThumbsObject), "20_20", ImageLocation.getForObject(smallThumb, message.photoThumbsObject), "20_20", null, message, 0);
|
||||||
|
needEmoji = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (chat != null && chat.id > 0 && fromChat == null) {
|
if (chat != null && chat.id > 0 && fromChat == null) {
|
||||||
if (message.isOutOwner()) {
|
if (message.isOutOwner()) {
|
||||||
messageNameString = LocaleController.getString("FromYou", R.string.FromYou);
|
messageNameString = LocaleController.getString("FromYou", R.string.FromYou);
|
||||||
|
@ -826,7 +884,9 @@ public class DialogCell extends BaseCell {
|
||||||
mess = mess.substring(0, 150);
|
mess = mess.substring(0, 150);
|
||||||
}
|
}
|
||||||
String emoji;
|
String emoji;
|
||||||
if (message.isVideo()) {
|
if (!needEmoji) {
|
||||||
|
emoji = "";
|
||||||
|
} else if (message.isVideo()) {
|
||||||
emoji = "\uD83D\uDCF9 ";
|
emoji = "\uD83D\uDCF9 ";
|
||||||
} else if (message.isVoice()) {
|
} else if (message.isVoice()) {
|
||||||
emoji = "\uD83C\uDFA4 ";
|
emoji = "\uD83C\uDFA4 ";
|
||||||
|
@ -879,14 +939,25 @@ public class DialogCell extends BaseCell {
|
||||||
} else {
|
} else {
|
||||||
stringBuilder = SpannableStringBuilder.valueOf("");
|
stringBuilder = SpannableStringBuilder.valueOf("");
|
||||||
}
|
}
|
||||||
|
int thumbInsertIndex = 0;
|
||||||
if (!useForceThreeLines && !SharedConfig.useThreeLinesLayout || currentDialogFolderId != 0 && stringBuilder.length() > 0) {
|
if (!useForceThreeLines && !SharedConfig.useThreeLinesLayout || currentDialogFolderId != 0 && stringBuilder.length() > 0) {
|
||||||
try {
|
try {
|
||||||
stringBuilder.setSpan(new ForegroundColorSpan(Theme.getColor(Theme.key_chats_nameMessage)), 0, messageNameString.length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
stringBuilder.setSpan(new ForegroundColorSpan(Theme.getColor(Theme.key_chats_nameMessage)), 0, thumbInsertIndex = messageNameString.length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
offsetName = thumbInsertIndex;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
FileLog.e(e);
|
FileLog.e(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
messageString = Emoji.replaceEmoji(stringBuilder, Theme.dialogs_messagePaint[paintIndex].getFontMetricsInt(), AndroidUtilities.dp(20), false);
|
messageString = Emoji.replaceEmoji(stringBuilder, Theme.dialogs_messagePaint[paintIndex].getFontMetricsInt(), AndroidUtilities.dp(20), false);
|
||||||
|
if (hasMessageThumb) {
|
||||||
|
if (!(messageString instanceof SpannableStringBuilder)) {
|
||||||
|
messageString = new SpannableStringBuilder(messageString);
|
||||||
|
}
|
||||||
|
checkMessage = false;
|
||||||
|
SpannableStringBuilder builder = (SpannableStringBuilder) messageString;
|
||||||
|
builder.insert(thumbInsertIndex, " ");
|
||||||
|
builder.setSpan(new FixedWidthSize(AndroidUtilities.dp(thumbSize + 6)), thumbInsertIndex, thumbInsertIndex + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (message.messageOwner.media instanceof TLRPC.TL_messageMediaPhoto && message.messageOwner.media.photo instanceof TLRPC.TL_photoEmpty && message.messageOwner.media.ttl_seconds != 0) {
|
if (message.messageOwner.media instanceof TLRPC.TL_messageMediaPhoto && message.messageOwner.media.photo instanceof TLRPC.TL_photoEmpty && message.messageOwner.media.ttl_seconds != 0) {
|
||||||
messageString = LocaleController.getString("AttachPhotoExpired", R.string.AttachPhotoExpired);
|
messageString = LocaleController.getString("AttachPhotoExpired", R.string.AttachPhotoExpired);
|
||||||
|
@ -894,7 +965,9 @@ public class DialogCell extends BaseCell {
|
||||||
messageString = LocaleController.getString("AttachVideoExpired", R.string.AttachVideoExpired);
|
messageString = LocaleController.getString("AttachVideoExpired", R.string.AttachVideoExpired);
|
||||||
} else if (message.caption != null) {
|
} else if (message.caption != null) {
|
||||||
String emoji;
|
String emoji;
|
||||||
if (message.isVideo()) {
|
if (!needEmoji) {
|
||||||
|
emoji = "";
|
||||||
|
} else if (message.isVideo()) {
|
||||||
emoji = "\uD83D\uDCF9 ";
|
emoji = "\uD83D\uDCF9 ";
|
||||||
} else if (message.isVoice()) {
|
} else if (message.isVoice()) {
|
||||||
emoji = "\uD83C\uDFA4 ";
|
emoji = "\uD83C\uDFA4 ";
|
||||||
|
@ -921,6 +994,20 @@ public class DialogCell extends BaseCell {
|
||||||
currentMessagePaint = Theme.dialogs_messagePrintingPaint[paintIndex];
|
currentMessagePaint = Theme.dialogs_messagePrintingPaint[paintIndex];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (hasMessageThumb) {
|
||||||
|
if (messageString.length() > 150) {
|
||||||
|
messageString = messageString.subSequence(0, 150);
|
||||||
|
}
|
||||||
|
messageString = TextUtils.replace(messageString, newLine, space);
|
||||||
|
if (!(messageString instanceof SpannableStringBuilder)) {
|
||||||
|
messageString = new SpannableStringBuilder(messageString);
|
||||||
|
}
|
||||||
|
checkMessage = false;
|
||||||
|
SpannableStringBuilder builder = (SpannableStringBuilder) messageString;
|
||||||
|
builder.insert(0, " ");
|
||||||
|
builder.setSpan(new FixedWidthSize(AndroidUtilities.dp(thumbSize + 6)), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
Emoji.replaceEmoji(builder, Theme.dialogs_messagePaint[paintIndex].getFontMetricsInt(), AndroidUtilities.dp(17), false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (currentDialogFolderId != 0) {
|
if (currentDialogFolderId != 0) {
|
||||||
|
@ -1023,6 +1110,7 @@ public class DialogCell extends BaseCell {
|
||||||
}
|
}
|
||||||
if (!TextUtils.isEmpty(messagesController.promoPsaMessage)) {
|
if (!TextUtils.isEmpty(messagesController.promoPsaMessage)) {
|
||||||
messageString = messagesController.promoPsaMessage;
|
messageString = messagesController.promoPsaMessage;
|
||||||
|
hasMessageThumb = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1147,6 +1235,7 @@ public class DialogCell extends BaseCell {
|
||||||
int messageWidth;
|
int messageWidth;
|
||||||
int avatarLeft;
|
int avatarLeft;
|
||||||
int avatarTop;
|
int avatarTop;
|
||||||
|
int thumbLeft;
|
||||||
if (useForceThreeLines || SharedConfig.useThreeLinesLayout) {
|
if (useForceThreeLines || SharedConfig.useThreeLinesLayout) {
|
||||||
avatarTop = AndroidUtilities.dp(11);
|
avatarTop = AndroidUtilities.dp(11);
|
||||||
messageNameTop = AndroidUtilities.dp(32);
|
messageNameTop = AndroidUtilities.dp(32);
|
||||||
|
@ -1157,14 +1246,17 @@ public class DialogCell extends BaseCell {
|
||||||
checkDrawTop = AndroidUtilities.dp(13);
|
checkDrawTop = AndroidUtilities.dp(13);
|
||||||
messageWidth = getMeasuredWidth() - AndroidUtilities.dp(72 + 21);
|
messageWidth = getMeasuredWidth() - AndroidUtilities.dp(72 + 21);
|
||||||
|
|
||||||
if (!LocaleController.isRTL) {
|
if (LocaleController.isRTL) {
|
||||||
messageLeft = messageNameLeft = AndroidUtilities.dp(72 + 6);
|
|
||||||
avatarLeft = AndroidUtilities.dp(10);
|
|
||||||
} else {
|
|
||||||
messageLeft = messageNameLeft = AndroidUtilities.dp(16);
|
messageLeft = messageNameLeft = AndroidUtilities.dp(16);
|
||||||
avatarLeft = getMeasuredWidth() - AndroidUtilities.dp(66);
|
avatarLeft = getMeasuredWidth() - AndroidUtilities.dp(66);
|
||||||
|
thumbLeft = avatarLeft - AndroidUtilities.dp(13 + 18);
|
||||||
|
} else {
|
||||||
|
messageLeft = messageNameLeft = AndroidUtilities.dp(72 + 6);
|
||||||
|
avatarLeft = AndroidUtilities.dp(10);
|
||||||
|
thumbLeft = avatarLeft + AndroidUtilities.dp(56 + 13);
|
||||||
}
|
}
|
||||||
avatarImage.setImageCoords(avatarLeft, avatarTop, AndroidUtilities.dp(56), AndroidUtilities.dp(56));
|
avatarImage.setImageCoords(avatarLeft, avatarTop, AndroidUtilities.dp(56), AndroidUtilities.dp(56));
|
||||||
|
thumbImage.setImageCoords(thumbLeft, avatarTop + AndroidUtilities.dp(31), AndroidUtilities.dp(18), AndroidUtilities.dp(18));
|
||||||
} else {
|
} else {
|
||||||
avatarTop = AndroidUtilities.dp(9);
|
avatarTop = AndroidUtilities.dp(9);
|
||||||
messageNameTop = AndroidUtilities.dp(31);
|
messageNameTop = AndroidUtilities.dp(31);
|
||||||
|
@ -1175,14 +1267,17 @@ public class DialogCell extends BaseCell {
|
||||||
checkDrawTop = AndroidUtilities.dp(17);
|
checkDrawTop = AndroidUtilities.dp(17);
|
||||||
messageWidth = getMeasuredWidth() - AndroidUtilities.dp(72 + 23);
|
messageWidth = getMeasuredWidth() - AndroidUtilities.dp(72 + 23);
|
||||||
|
|
||||||
if (!LocaleController.isRTL) {
|
if (LocaleController.isRTL) {
|
||||||
messageLeft = messageNameLeft = AndroidUtilities.dp(72 + 4);
|
|
||||||
avatarLeft = AndroidUtilities.dp(10);
|
|
||||||
} else {
|
|
||||||
messageLeft = messageNameLeft = AndroidUtilities.dp(22);
|
messageLeft = messageNameLeft = AndroidUtilities.dp(22);
|
||||||
avatarLeft = getMeasuredWidth() - AndroidUtilities.dp(64);
|
avatarLeft = getMeasuredWidth() - AndroidUtilities.dp(64);
|
||||||
|
thumbLeft = avatarLeft - AndroidUtilities.dp(11 + thumbSize);
|
||||||
|
} else {
|
||||||
|
messageLeft = messageNameLeft = AndroidUtilities.dp(72 + 4);
|
||||||
|
avatarLeft = AndroidUtilities.dp(10);
|
||||||
|
thumbLeft = avatarLeft + AndroidUtilities.dp(56 + 11);
|
||||||
}
|
}
|
||||||
avatarImage.setImageCoords(avatarLeft, avatarTop, AndroidUtilities.dp(54), AndroidUtilities.dp(54));
|
avatarImage.setImageCoords(avatarLeft, avatarTop, AndroidUtilities.dp(54), AndroidUtilities.dp(54));
|
||||||
|
thumbImage.setImageCoords(thumbLeft, avatarTop + AndroidUtilities.dp(30), AndroidUtilities.dp(thumbSize), AndroidUtilities.dp(thumbSize));
|
||||||
}
|
}
|
||||||
if (drawPin) {
|
if (drawPin) {
|
||||||
if (!LocaleController.isRTL) {
|
if (!LocaleController.isRTL) {
|
||||||
|
@ -1272,10 +1367,12 @@ public class DialogCell extends BaseCell {
|
||||||
FileLog.e(e);
|
FileLog.e(e);
|
||||||
}
|
}
|
||||||
messageTop = AndroidUtilities.dp(32 + 19);
|
messageTop = AndroidUtilities.dp(32 + 19);
|
||||||
|
thumbImage.setImageY(avatarTop + AndroidUtilities.dp(40));
|
||||||
} else {
|
} else {
|
||||||
messageNameLayout = null;
|
messageNameLayout = null;
|
||||||
if (useForceThreeLines || SharedConfig.useThreeLinesLayout) {
|
if (useForceThreeLines || SharedConfig.useThreeLinesLayout) {
|
||||||
messageTop = AndroidUtilities.dp(32);
|
messageTop = AndroidUtilities.dp(32);
|
||||||
|
thumbImage.setImageY(avatarTop + AndroidUtilities.dp(21));
|
||||||
} else {
|
} else {
|
||||||
messageTop = AndroidUtilities.dp(39);
|
messageTop = AndroidUtilities.dp(39);
|
||||||
}
|
}
|
||||||
|
@ -1293,8 +1390,14 @@ public class DialogCell extends BaseCell {
|
||||||
messageStringFinal = messageString;
|
messageStringFinal = messageString;
|
||||||
}
|
}
|
||||||
if (useForceThreeLines || SharedConfig.useThreeLinesLayout) {
|
if (useForceThreeLines || SharedConfig.useThreeLinesLayout) {
|
||||||
|
if (hasMessageThumb && messageNameString != null) {
|
||||||
|
messageWidth += AndroidUtilities.dp(4);
|
||||||
|
}
|
||||||
messageLayout = StaticLayoutEx.createStaticLayout(messageStringFinal, currentMessagePaint, messageWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, AndroidUtilities.dp(1), false, TextUtils.TruncateAt.END, messageWidth, messageNameString != null ? 1 : 2);
|
messageLayout = StaticLayoutEx.createStaticLayout(messageStringFinal, currentMessagePaint, messageWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, AndroidUtilities.dp(1), false, TextUtils.TruncateAt.END, messageWidth, messageNameString != null ? 1 : 2);
|
||||||
} else {
|
} else {
|
||||||
|
if (hasMessageThumb) {
|
||||||
|
messageWidth += AndroidUtilities.dp(4);
|
||||||
|
}
|
||||||
messageLayout = new StaticLayout(messageStringFinal, currentMessagePaint, messageWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
messageLayout = new StaticLayout(messageStringFinal, currentMessagePaint, messageWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -1375,6 +1478,23 @@ public class DialogCell extends BaseCell {
|
||||||
messageNameLeft -= messageNameLayout.getLineLeft(0);
|
messageNameLeft -= messageNameLayout.getLineLeft(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (messageLayout != null && hasMessageThumb) {
|
||||||
|
try {
|
||||||
|
int textLen = messageLayout.getText().length();
|
||||||
|
if (offsetName >= textLen) {
|
||||||
|
offsetName = textLen - 1;
|
||||||
|
}
|
||||||
|
float x1 = messageLayout.getPrimaryHorizontal(offsetName);
|
||||||
|
float x2 = messageLayout.getPrimaryHorizontal(offsetName + 1);
|
||||||
|
int offset = (int) Math.ceil(Math.min(x1, x2));
|
||||||
|
if (offset != 0) {
|
||||||
|
offset += AndroidUtilities.dp(3);
|
||||||
|
}
|
||||||
|
thumbImage.setImageX(messageLeft + offset);
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPointInsideAvatar(float x, float y) {
|
public boolean isPointInsideAvatar(float x, float y) {
|
||||||
|
@ -1486,6 +1606,7 @@ public class DialogCell extends BaseCell {
|
||||||
dialogMuted = customDialog.muted;
|
dialogMuted = customDialog.muted;
|
||||||
avatarDrawable.setInfo(customDialog.id, customDialog.name, null);
|
avatarDrawable.setInfo(customDialog.id, customDialog.name, null);
|
||||||
avatarImage.setImage(null, "50_50", avatarDrawable, null, 0);
|
avatarImage.setImage(null, "50_50", avatarDrawable, null, 0);
|
||||||
|
thumbImage.setImageBitmap((BitmapDrawable) null);
|
||||||
} else {
|
} else {
|
||||||
if (isDialogCell) {
|
if (isDialogCell) {
|
||||||
TLRPC.Dialog dialog = MessagesController.getInstance(currentAccount).dialogs_dict.get(currentDialogId);
|
TLRPC.Dialog dialog = MessagesController.getInstance(currentAccount).dialogs_dict.get(currentDialogId);
|
||||||
|
@ -2063,6 +2184,10 @@ public class DialogCell extends BaseCell {
|
||||||
avatarImage.draw(canvas);
|
avatarImage.draw(canvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hasMessageThumb) {
|
||||||
|
thumbImage.draw(canvas);
|
||||||
|
}
|
||||||
|
|
||||||
if (animatingArchiveAvatar) {
|
if (animatingArchiveAvatar) {
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
}
|
}
|
||||||
|
|
|
@ -11504,8 +11504,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
canShowPagedownButton = false;
|
canShowPagedownButton = false;
|
||||||
updatePagedownButtonVisibility(true);
|
updatePagedownButtonVisibility(true);
|
||||||
showMentionDownButton(false, true);
|
showMentionDownButton(false, true);
|
||||||
|
removeUnreadPlane(true);
|
||||||
if (updated && chatAdapter != null) {
|
if (updated && chatAdapter != null) {
|
||||||
removeUnreadPlane(true);
|
|
||||||
chatAdapter.notifyDataSetChanged();
|
chatAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
} else if (id == NotificationCenter.messagesDeleted) {
|
} else if (id == NotificationCenter.messagesDeleted) {
|
||||||
|
@ -11566,7 +11566,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
addToSelectedMessages(obj, false, updatedSelectedLast = (a == size - 1));
|
addToSelectedMessages(obj, false, updatedSelectedLast = (a == size - 1));
|
||||||
}
|
}
|
||||||
MessageObject removed = messages.remove(index);
|
MessageObject removed = messages.remove(index);
|
||||||
removedIndexes.add(chatAdapter.messagesStartRow + index);
|
if (chatAdapter != null) {
|
||||||
|
removedIndexes.add(chatAdapter.messagesStartRow + index);
|
||||||
|
}
|
||||||
if (removed.getGroupId() != 0) {
|
if (removed.getGroupId() != 0) {
|
||||||
MessageObject.GroupedMessages groupedMessages = groupedMessagesMap.get(removed.getGroupId());
|
MessageObject.GroupedMessages groupedMessages = groupedMessagesMap.get(removed.getGroupId());
|
||||||
if (groupedMessages != null) {
|
if (groupedMessages != null) {
|
||||||
|
@ -11589,7 +11591,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
messagesByDays.remove(obj.dateKey);
|
messagesByDays.remove(obj.dateKey);
|
||||||
if (index >= 0 && index < messages.size()) {
|
if (index >= 0 && index < messages.size()) {
|
||||||
messages.remove(index);
|
messages.remove(index);
|
||||||
removedIndexes.add(chatAdapter.messagesStartRow + index);
|
if (chatAdapter != null) {
|
||||||
|
removedIndexes.add(chatAdapter.messagesStartRow + index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11664,22 +11668,21 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
updatePagedownButtonVisibility(true);
|
updatePagedownButtonVisibility(true);
|
||||||
showMentionDownButton(false, true);
|
showMentionDownButton(false, true);
|
||||||
}
|
}
|
||||||
if (chatAdapter != null) {
|
if (updated) {
|
||||||
if (updated) {
|
if (chatAdapter != null) {
|
||||||
int count = removedIndexes.size();
|
for (int a = 0, N = removedIndexes.size(); a < N; a++) {
|
||||||
for (int a = 0; a < count; a++) {
|
|
||||||
chatAdapter.notifyItemRemoved(removedIndexes.get(a));
|
chatAdapter.notifyItemRemoved(removedIndexes.get(a));
|
||||||
}
|
}
|
||||||
updateVisibleRows();
|
}
|
||||||
} else {
|
updateVisibleRows();
|
||||||
first_unread_id = 0;
|
} else {
|
||||||
last_message_id = 0;
|
first_unread_id = 0;
|
||||||
createUnreadMessageAfterId = 0;
|
last_message_id = 0;
|
||||||
removeMessageObject(unreadMessageObject);
|
createUnreadMessageAfterId = 0;
|
||||||
unreadMessageObject = null;
|
removeMessageObject(unreadMessageObject);
|
||||||
if (pagedownButtonCounter != null) {
|
unreadMessageObject = null;
|
||||||
pagedownButtonCounter.setVisibility(View.INVISIBLE);
|
if (pagedownButtonCounter != null) {
|
||||||
}
|
pagedownButtonCounter.setVisibility(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (updateScheduled) {
|
if (updateScheduled) {
|
||||||
|
@ -12881,7 +12884,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
if (dayArr.isEmpty()) {
|
if (dayArr.isEmpty()) {
|
||||||
messagesByDays.remove(old.dateKey);
|
messagesByDays.remove(old.dateKey);
|
||||||
messages.remove(index);
|
messages.remove(index);
|
||||||
chatAdapter.notifyItemRemoved(chatAdapter.messagesStartRow);
|
chatAdapter.notifyItemRemoved(chatAdapter.messagesStartRow + index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,6 +144,10 @@ public class AudioVisualizerDrawable {
|
||||||
|
|
||||||
float enterProgress = current[7];
|
float enterProgress = current[7];
|
||||||
float radiusProgress = current[6] * current[0];
|
float radiusProgress = current[6] * current[0];
|
||||||
|
|
||||||
|
if (enterProgress == 0 && radiusProgress == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// float idleProgress = radiusProgress > 0.4f ? 0 : (1f - radiusProgress / 0.4f);
|
// float idleProgress = radiusProgress > 0.4f ? 0 : (1f - radiusProgress / 0.4f);
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
|
|
|
@ -141,7 +141,7 @@ public class BlurBehindDrawable {
|
||||||
behindView.draw(blurCanvas[i]);
|
behindView.draw(blurCanvas[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == ADJUST_PAN_TRANSLATION_CONTENT) {
|
if (backDrawable != null && i == ADJUST_PAN_TRANSLATION_CONTENT) {
|
||||||
Rect oldBounds = backDrawable.getBounds();
|
Rect oldBounds = backDrawable.getBounds();
|
||||||
backDrawable.setBounds(0, 0, behindView.getMeasuredWidth(), behindView.getMeasuredHeight());
|
backDrawable.setBounds(0, 0, behindView.getMeasuredWidth(), behindView.getMeasuredHeight());
|
||||||
backDrawable.draw(blurCanvas[i]);
|
backDrawable.draw(blurCanvas[i]);
|
||||||
|
|
|
@ -3404,11 +3404,13 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
|
||||||
|
|
||||||
private void updateRecentGifs() {
|
private void updateRecentGifs() {
|
||||||
final boolean wasEmpty = recentGifs.isEmpty();
|
final boolean wasEmpty = recentGifs.isEmpty();
|
||||||
|
int prevHash = MediaDataController.calcDocumentsHash(recentGifs);
|
||||||
recentGifs = MediaDataController.getInstance(currentAccount).getRecentGifs();
|
recentGifs = MediaDataController.getInstance(currentAccount).getRecentGifs();
|
||||||
|
int newHash = MediaDataController.calcDocumentsHash(recentGifs);
|
||||||
if (gifTabs != null && wasEmpty && !recentGifs.isEmpty() || !wasEmpty && recentGifs.isEmpty()) {
|
if (gifTabs != null && wasEmpty && !recentGifs.isEmpty() || !wasEmpty && recentGifs.isEmpty()) {
|
||||||
updateGifTabs();
|
updateGifTabs();
|
||||||
}
|
}
|
||||||
if (gifAdapter != null) {
|
if (prevHash != newHash && gifAdapter != null) {
|
||||||
gifAdapter.notifyDataSetChanged();
|
gifAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import android.view.ViewGroup;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import org.telegram.messenger.AndroidUtilities;
|
||||||
import org.telegram.messenger.BuildVars;
|
import org.telegram.messenger.BuildVars;
|
||||||
import org.telegram.ui.Cells.ChatMessageCell;
|
import org.telegram.ui.Cells.ChatMessageCell;
|
||||||
|
|
||||||
|
@ -74,7 +75,7 @@ public class RecyclerAnimationScrollHelper {
|
||||||
oldStableIds.clear();
|
oldStableIds.clear();
|
||||||
|
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
View child = recyclerView.getChildAt(0);
|
View child = recyclerView.getChildAt(i);
|
||||||
oldViews.add(child);
|
oldViews.add(child);
|
||||||
int childPosition = layoutManager.getPosition(child);
|
int childPosition = layoutManager.getPosition(child);
|
||||||
positionToOldView.put(childPosition, child);
|
positionToOldView.put(childPosition, child);
|
||||||
|
@ -88,12 +89,9 @@ public class RecyclerAnimationScrollHelper {
|
||||||
if (child instanceof ChatMessageCell) {
|
if (child instanceof ChatMessageCell) {
|
||||||
((ChatMessageCell) child).setAnimationRunning(true, true);
|
((ChatMessageCell) child).setAnimationRunning(true, true);
|
||||||
}
|
}
|
||||||
layoutManager.removeAndRecycleView(child, recyclerView.mRecycler);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
recyclerView.mRecycler.clear();
|
recyclerView.prepareForFastScroll();
|
||||||
recyclerView.getRecycledViewPool().clear();
|
|
||||||
|
|
||||||
AnimatableAdapter animatableAdapter = null;
|
AnimatableAdapter animatableAdapter = null;
|
||||||
if (adapter instanceof AnimatableAdapter) {
|
if (adapter instanceof AnimatableAdapter) {
|
||||||
|
@ -162,9 +160,9 @@ public class RecyclerAnimationScrollHelper {
|
||||||
if (bot > oldH) oldH = bot;
|
if (bot > oldH) oldH = bot;
|
||||||
if (topl < oldT) oldT = topl;
|
if (topl < oldT) oldT = topl;
|
||||||
|
|
||||||
|
|
||||||
if (view.getParent() == null) {
|
if (view.getParent() == null) {
|
||||||
recyclerView.addView(view);
|
recyclerView.addView(view);
|
||||||
|
layoutManager.ignoreView(view);
|
||||||
}
|
}
|
||||||
if (view instanceof ChatMessageCell) {
|
if (view instanceof ChatMessageCell) {
|
||||||
((ChatMessageCell) view).setAnimationRunning(true, true);
|
((ChatMessageCell) view).setAnimationRunning(true, true);
|
||||||
|
@ -179,8 +177,6 @@ public class RecyclerAnimationScrollHelper {
|
||||||
scrollLength = finalHeight + (scrollDown ? -top : bottom - recyclerView.getHeight());
|
scrollLength = finalHeight + (scrollDown ? -top : bottom - recyclerView.getHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (animator != null) {
|
if (animator != null) {
|
||||||
animator.removeAllListeners();
|
animator.removeAllListeners();
|
||||||
animator.cancel();
|
animator.cancel();
|
||||||
|
@ -229,6 +225,7 @@ public class RecyclerAnimationScrollHelper {
|
||||||
((ChatMessageCell) view).setAnimationRunning(false, true);
|
((ChatMessageCell) view).setAnimationRunning(false, true);
|
||||||
}
|
}
|
||||||
view.setTranslationY(0);
|
view.setTranslationY(0);
|
||||||
|
layoutManager.stopIgnoringView(view);
|
||||||
recyclerView.removeView(view);
|
recyclerView.removeView(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,6 +239,10 @@ public class RecyclerAnimationScrollHelper {
|
||||||
if (recyclerView.mChildHelper.getHiddenChildCount() != 0) {
|
if (recyclerView.mChildHelper.getHiddenChildCount() != 0) {
|
||||||
throw new RuntimeException("hidden child count must be 0");
|
throw new RuntimeException("hidden child count must be 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (recyclerView.getCachedChildCount() != 0) {
|
||||||
|
throw new RuntimeException("recycler cached child count must be 0");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int n = recyclerView.getChildCount();
|
int n = recyclerView.getChildCount();
|
||||||
|
|
|
@ -502,7 +502,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
|
||||||
} else if (view instanceof ContextLinkCell) {
|
} else if (view instanceof ContextLinkCell) {
|
||||||
ContextLinkCell cell = (ContextLinkCell) view;
|
ContextLinkCell cell = (ContextLinkCell) view;
|
||||||
MessageObject message = (MessageObject) cell.getParentObject();
|
MessageObject message = (MessageObject) cell.getParentObject();
|
||||||
if (message.getId() == messageObject.getId()) {
|
if (message != null && messageObject != null && message.getId() == messageObject.getId()) {
|
||||||
imageReceiver = cell.getPhotoImage();
|
imageReceiver = cell.getPhotoImage();
|
||||||
cell.getLocationInWindow(coords);
|
cell.getLocationInWindow(coords);
|
||||||
}
|
}
|
||||||
|
|
|
@ -614,7 +614,7 @@ public class StickersAlert extends BottomSheet implements NotificationCenter.Not
|
||||||
|
|
||||||
stickerImageView = new BackupImageView(context);
|
stickerImageView = new BackupImageView(context);
|
||||||
stickerImageView.setAspectFit(true);
|
stickerImageView.setAspectFit(true);
|
||||||
stickerImageView.setLayerNum(5);
|
stickerImageView.setLayerNum(7);
|
||||||
stickerPreviewLayout.addView(stickerImageView);
|
stickerPreviewLayout.addView(stickerImageView);
|
||||||
|
|
||||||
stickerEmojiTextView = new TextView(context);
|
stickerEmojiTextView = new TextView(context);
|
||||||
|
@ -1062,7 +1062,7 @@ public class StickersAlert extends BottomSheet implements NotificationCenter.Not
|
||||||
super.onMeasure(MeasureSpec.makeMeasureSpec(itemSize, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(82), MeasureSpec.EXACTLY));
|
super.onMeasure(MeasureSpec.makeMeasureSpec(itemSize, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(82), MeasureSpec.EXACTLY));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
cell.getImageView().setLayerNum(5);
|
cell.getImageView().setLayerNum(7);
|
||||||
view = cell;
|
view = cell;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.telegram.ui.ActionBar.ThemeDescription;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class TrendingStickersAlert extends BottomSheet implements TrendingStickersLayout.AlertDelegate {
|
public class TrendingStickersAlert extends BottomSheet {
|
||||||
|
|
||||||
private final int topOffset = AndroidUtilities.dp(12);
|
private final int topOffset = AndroidUtilities.dp(12);
|
||||||
|
|
||||||
|
@ -45,7 +45,6 @@ public class TrendingStickersAlert extends BottomSheet implements TrendingSticke
|
||||||
useSmoothKeyboard = true;
|
useSmoothKeyboard = true;
|
||||||
|
|
||||||
layout = trendingStickersLayout;
|
layout = trendingStickersLayout;
|
||||||
layout.setAlertDelegate(this);
|
|
||||||
layout.setParentFragment(parentFragment);
|
layout.setParentFragment(parentFragment);
|
||||||
layout.setOnScrollListener(new RecyclerListView.OnScrollListener() {
|
layout.setOnScrollListener(new RecyclerListView.OnScrollListener() {
|
||||||
|
|
||||||
|
@ -86,7 +85,6 @@ public class TrendingStickersAlert extends BottomSheet implements TrendingSticke
|
||||||
setHeavyOperationsEnabled(true);
|
setHeavyOperationsEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setHeavyOperationsEnabled(boolean enabled) {
|
public void setHeavyOperationsEnabled(boolean enabled) {
|
||||||
NotificationCenter.getGlobalInstance().postNotificationName(enabled ? NotificationCenter.startAllHeavyOperations : NotificationCenter.stopAllHeavyOperations, 2);
|
NotificationCenter.getGlobalInstance().postNotificationName(enabled ? NotificationCenter.startAllHeavyOperations : NotificationCenter.stopAllHeavyOperations, 2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,10 +79,6 @@ public class TrendingStickersLayout extends FrameLayout implements NotificationC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface AlertDelegate {
|
|
||||||
void setHeavyOperationsEnabled(boolean enabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
private final int currentAccount = UserConfig.selectedAccount;
|
private final int currentAccount = UserConfig.selectedAccount;
|
||||||
|
|
||||||
private final Delegate delegate;
|
private final Delegate delegate;
|
||||||
|
@ -100,7 +96,6 @@ public class TrendingStickersLayout extends FrameLayout implements NotificationC
|
||||||
|
|
||||||
private BaseFragment parentFragment;
|
private BaseFragment parentFragment;
|
||||||
private RecyclerListView.OnScrollListener onScrollListener;
|
private RecyclerListView.OnScrollListener onScrollListener;
|
||||||
private AlertDelegate alertDelegate;
|
|
||||||
|
|
||||||
private int topOffset;
|
private int topOffset;
|
||||||
private boolean motionEventCatchedByListView;
|
private boolean motionEventCatchedByListView;
|
||||||
|
@ -361,23 +356,7 @@ public class TrendingStickersLayout extends FrameLayout implements NotificationC
|
||||||
} else {
|
} else {
|
||||||
stickersAlertDelegate = null;
|
stickersAlertDelegate = null;
|
||||||
}
|
}
|
||||||
final StickersAlert stickersAlert = new StickersAlert(getContext(), parentFragment, inputStickerSet, null, stickersAlertDelegate) {
|
final StickersAlert stickersAlert = new StickersAlert(getContext(), parentFragment, inputStickerSet, null, stickersAlertDelegate);
|
||||||
@Override
|
|
||||||
public void show() {
|
|
||||||
super.show();
|
|
||||||
if (alertDelegate != null) {
|
|
||||||
alertDelegate.setHeavyOperationsEnabled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dismiss() {
|
|
||||||
super.dismiss();
|
|
||||||
if (alertDelegate != null) {
|
|
||||||
alertDelegate.setHeavyOperationsEnabled(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
stickersAlert.setShowTooltipWhenToggle(false);
|
stickersAlert.setShowTooltipWhenToggle(false);
|
||||||
stickersAlert.setInstallDelegate(new StickersAlert.StickersAlertInstallDelegate() {
|
stickersAlert.setInstallDelegate(new StickersAlert.StickersAlertInstallDelegate() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -434,10 +413,6 @@ public class TrendingStickersLayout extends FrameLayout implements NotificationC
|
||||||
this.onScrollListener = onScrollListener;
|
this.onScrollListener = onScrollListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAlertDelegate(AlertDelegate alertDelegate) {
|
|
||||||
this.alertDelegate = alertDelegate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setParentFragment(BaseFragment parentFragment) {
|
public void setParentFragment(BaseFragment parentFragment) {
|
||||||
this.parentFragment = parentFragment;
|
this.parentFragment = parentFragment;
|
||||||
}
|
}
|
||||||
|
|
|
@ -655,13 +655,14 @@ public class VideoPlayer implements ExoPlayer.EventListener, SimpleExoPlayer.Vid
|
||||||
private class VisualizerBufferSink implements TeeAudioProcessor.AudioBufferSink {
|
private class VisualizerBufferSink implements TeeAudioProcessor.AudioBufferSink {
|
||||||
|
|
||||||
private final int BUFFER_SIZE = 1024;
|
private final int BUFFER_SIZE = 1024;
|
||||||
|
private final int MAX_BUFFER_SIZE = BUFFER_SIZE * 8;
|
||||||
FourierTransform.FFT fft = new FourierTransform.FFT(BUFFER_SIZE, 48000);
|
FourierTransform.FFT fft = new FourierTransform.FFT(BUFFER_SIZE, 48000);
|
||||||
float[] real = new float[BUFFER_SIZE];
|
float[] real = new float[BUFFER_SIZE];
|
||||||
ByteBuffer byteBuffer;
|
ByteBuffer byteBuffer;
|
||||||
int position = 0;
|
int position = 0;
|
||||||
|
|
||||||
public VisualizerBufferSink() {
|
public VisualizerBufferSink() {
|
||||||
byteBuffer = ByteBuffer.allocateDirect(BUFFER_SIZE * 8);
|
byteBuffer = ByteBuffer.allocateDirect(MAX_BUFFER_SIZE);
|
||||||
byteBuffer.position(0);
|
byteBuffer.position(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -694,11 +695,22 @@ public class VideoPlayer implements ExoPlayer.EventListener, SimpleExoPlayer.Vid
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
byteBuffer.put(buffer);
|
int len = buffer.limit();
|
||||||
position += buffer.limit();
|
if (len > MAX_BUFFER_SIZE) {
|
||||||
|
audioUpdateHandler.removeCallbacksAndMessages(null);
|
||||||
|
audioVisualizerDelegate.onVisualizerUpdate(false, true, null);
|
||||||
|
return;
|
||||||
|
// len = MAX_BUFFER_SIZE;
|
||||||
|
// byte[] bytes = new byte[BUFFER_SIZE];
|
||||||
|
// buffer.get(bytes);
|
||||||
|
// byteBuffer.put(bytes, 0, BUFFER_SIZE);
|
||||||
|
} else {
|
||||||
|
byteBuffer.put(buffer);
|
||||||
|
}
|
||||||
|
position += len;
|
||||||
|
|
||||||
if (position >= BUFFER_SIZE) {
|
if (position >= BUFFER_SIZE) {
|
||||||
int len = BUFFER_SIZE;
|
len = BUFFER_SIZE;
|
||||||
byteBuffer.position(0);
|
byteBuffer.position(0);
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
real[i] = (byteBuffer.getShort()) / 32768.0F;
|
real[i] = (byteBuffer.getShort()) / 32768.0F;
|
||||||
|
|
|
@ -2886,8 +2886,15 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
heightSize = AndroidUtilities.displaySize.y;
|
heightSize = AndroidUtilities.displaySize.y;
|
||||||
}
|
}
|
||||||
heightSize += AndroidUtilities.statusBarHeight;
|
heightSize += AndroidUtilities.statusBarHeight;
|
||||||
|
} else {
|
||||||
|
int insetBottom = insets.getStableInsetBottom();
|
||||||
|
if (insetBottom >= 0 && AndroidUtilities.statusBarHeight >= 0) {
|
||||||
|
int newSize = heightSize - AndroidUtilities.statusBarHeight - insets.getStableInsetBottom();
|
||||||
|
if (newSize > 0 && newSize < 4096) {
|
||||||
|
AndroidUtilities.displaySize.y = newSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
AndroidUtilities.displaySize.y = heightSize - AndroidUtilities.statusBarHeight - insets.getStableInsetBottom();
|
|
||||||
heightSize -= insets.getSystemWindowInsetBottom();
|
heightSize -= insets.getSystemWindowInsetBottom();
|
||||||
} else {
|
} else {
|
||||||
if (heightSize > AndroidUtilities.displaySize.y) {
|
if (heightSize > AndroidUtilities.displaySize.y) {
|
||||||
|
|
Loading…
Reference in New Issue