mirror of
https://github.com/MGislv/NekoX.git
synced 2024-07-07 12:32:34 +00:00
Merge upstream 7.3.1 (2206)
This commit is contained in:
commit
932b17b1b2
|
@ -1,8 +1,8 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
def verName = "7.3.1-rc05"
|
||||
def verCode = 140
|
||||
def verName = "7.3.1-rc06"
|
||||
def verCode = 142
|
||||
|
||||
def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json")
|
||||
|
||||
|
|
|
@ -34,10 +34,12 @@ public class SQLitePreparedStatement {
|
|||
if (BuildVars.LOGS_ENABLED) {
|
||||
query = sql;
|
||||
startTime = SystemClock.elapsedRealtime();
|
||||
/*if (hashMap == null) {
|
||||
hashMap = new HashMap<>();
|
||||
}
|
||||
hashMap.put(this, sql);*/
|
||||
/*if (BuildVars.DEBUG_PRIVATE_VERSION) {
|
||||
if (hashMap == null) {
|
||||
hashMap = new HashMap<>();
|
||||
}
|
||||
hashMap.put(this, sql);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,7 +110,7 @@ public class SQLitePreparedStatement {
|
|||
}
|
||||
}
|
||||
try {
|
||||
/*if (BuildVars.DEBUG_VERSION) {
|
||||
/*if (BuildVars.DEBUG_PRIVATE_VERSION) {
|
||||
hashMap.remove(this);
|
||||
}*/
|
||||
isFinalized = true;
|
||||
|
|
|
@ -70,6 +70,9 @@ public class DocumentObject {
|
|||
}
|
||||
|
||||
public static SvgHelper.SvgDrawable getSvgThumb(TLRPC.Document document, String colorKey, float alpha, float zoom) {
|
||||
if (document == null) {
|
||||
return null;
|
||||
}
|
||||
SvgHelper.SvgDrawable pathThumb = null;
|
||||
for (int b = 0, N2 = document.thumbs.size(); b < N2; b++) {
|
||||
TLRPC.PhotoSize size = document.thumbs.get(b);
|
||||
|
|
|
@ -1039,6 +1039,10 @@ public class FileLoader extends BaseController {
|
|||
}
|
||||
|
||||
public static TLRPC.PhotoSize getClosestPhotoSizeWithSize(ArrayList<TLRPC.PhotoSize> sizes, int side, boolean byMinSide) {
|
||||
return getClosestPhotoSizeWithSize(sizes, side, byMinSide, null);
|
||||
}
|
||||
|
||||
public static TLRPC.PhotoSize getClosestPhotoSizeWithSize(ArrayList<TLRPC.PhotoSize> sizes, int side, boolean byMinSide, TLRPC.PhotoSize toIgnore) {
|
||||
if (sizes == null || sizes.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
@ -1046,7 +1050,7 @@ public class FileLoader extends BaseController {
|
|||
TLRPC.PhotoSize closestObject = null;
|
||||
for (int a = 0; a < sizes.size(); a++) {
|
||||
TLRPC.PhotoSize obj = sizes.get(a);
|
||||
if (obj == null || obj instanceof TLRPC.TL_photoSizeEmpty || obj instanceof TLRPC.TL_photoPathSize) {
|
||||
if (obj == null || obj == toIgnore || obj instanceof TLRPC.TL_photoSizeEmpty || obj instanceof TLRPC.TL_photoPathSize) {
|
||||
continue;
|
||||
}
|
||||
if (byMinSide) {
|
||||
|
|
|
@ -1068,7 +1068,20 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
|
|||
}
|
||||
}
|
||||
} else {
|
||||
drawRegion.set(imageX, imageY, imageX + imageW, imageY + imageH);
|
||||
if (isAspectFit) {
|
||||
int bitmapW = drawable.getIntrinsicWidth();
|
||||
int bitmapH = drawable.getIntrinsicHeight();
|
||||
float realImageW = imageW - sideClip * 2;
|
||||
float realImageH = imageH - sideClip * 2;
|
||||
float scaleW = imageW == 0 ? 1.0f : (bitmapW / realImageW);
|
||||
float scaleH = imageH == 0 ? 1.0f : (bitmapH / realImageH);
|
||||
float scale = Math.max(scaleW, scaleH);
|
||||
bitmapW /= scale;
|
||||
bitmapH /= scale;
|
||||
drawRegion.set(imageX + (imageW - bitmapW) / 2.0f, imageY + (imageH - bitmapH) / 2.0f, imageX + (imageW + bitmapW) / 2.0f, imageY + (imageH + bitmapH) / 2.0f);
|
||||
} else {
|
||||
drawRegion.set(imageX, imageY, imageX + imageW, imageY + imageH);
|
||||
}
|
||||
drawable.setBounds((int) drawRegion.left, (int) drawRegion.top, (int) drawRegion.right, (int) drawRegion.bottom);
|
||||
if (isVisible) {
|
||||
try {
|
||||
|
|
|
@ -947,6 +947,9 @@ public class MessageObject {
|
|||
} else {
|
||||
emojiAnimatedStickerColor = "";
|
||||
}
|
||||
if (!TextUtils.isEmpty(emojiAnimatedStickerColor) && index + 2 < messageText.length()) {
|
||||
emoji = emoji.toString() + messageText.subSequence(index + 2, messageText.length()).toString();
|
||||
}
|
||||
if (TextUtils.isEmpty(emojiAnimatedStickerColor) || EmojiData.emojiColoredMap.contains(emoji.toString())) {
|
||||
emojiAnimatedSticker = MediaDataController.getInstance(currentAccount).getEmojiAnimatedSticker(emoji);
|
||||
}
|
||||
|
@ -3091,7 +3094,7 @@ public class MessageObject {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (photo.dc_id != 0) {
|
||||
if (photo.dc_id != 0 && photoThumbs != null) {
|
||||
for (int a = 0, N = photoThumbs.size(); a < N; a++) {
|
||||
TLRPC.FileLocation location = photoThumbs.get(a).location;
|
||||
if (location == null) {
|
||||
|
@ -3440,12 +3443,6 @@ public class MessageObject {
|
|||
boolean hasEntities;
|
||||
if (messageOwner.send_state != MESSAGE_SEND_STATE_SENT) {
|
||||
hasEntities = false;
|
||||
for (int a = 0; a < messageOwner.entities.size(); a++) {
|
||||
if (!(messageOwner.entities.get(a) instanceof TLRPC.TL_inputMessageEntityMentionName)) {
|
||||
hasEntities = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
hasEntities = !messageOwner.entities.isEmpty();
|
||||
}
|
||||
|
@ -3941,7 +3938,7 @@ public class MessageObject {
|
|||
}
|
||||
TLRPC.Chat chat = messageOwner.peer_id != null && messageOwner.peer_id.channel_id != 0 ? getChat(null, null, messageOwner.peer_id.channel_id) : null;
|
||||
if (ChatObject.isChannel(chat) && chat.megagroup) {
|
||||
return chat != null && chat.username != null && chat.username.length() > 0 && !(messageOwner.media instanceof TLRPC.TL_messageMediaContact) && !(messageOwner.media instanceof TLRPC.TL_messageMediaGeo);
|
||||
return chat.username != null && chat.username.length() > 0 && !(messageOwner.media instanceof TLRPC.TL_messageMediaContact) && !(messageOwner.media instanceof TLRPC.TL_messageMediaGeo);
|
||||
}
|
||||
}
|
||||
} else if (messageOwner.from_id instanceof TLRPC.TL_peerChannel || messageOwner.post) {
|
||||
|
@ -5515,7 +5512,7 @@ public class MessageObject {
|
|||
message.media instanceof TLRPC.TL_messageMediaWebPage ||
|
||||
message.media == null);
|
||||
}
|
||||
if (chat.megagroup && message.out || !chat.megagroup && (chat.creator || chat.admin_rights != null && (chat.admin_rights.edit_messages || message.out && chat.admin_rights.post_messages)) && message.post) {
|
||||
if (chat != null && chat.megagroup && message.out || chat != null && !chat.megagroup && (chat.creator || chat.admin_rights != null && (chat.admin_rights.edit_messages || message.out && chat.admin_rights.post_messages)) && message.post) {
|
||||
if (message.media instanceof TLRPC.TL_messageMediaPhoto ||
|
||||
message.media instanceof TLRPC.TL_messageMediaDocument && !isStickerMessage(message) && !isAnimatedStickerMessage(message) ||
|
||||
message.media instanceof TLRPC.TL_messageMediaEmpty ||
|
||||
|
|
|
@ -1230,7 +1230,11 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
|
||||
allDialogs.clear();
|
||||
for (int a = 0, size = dialogs_dict.size(); a < size; a++) {
|
||||
allDialogs.add(dialogs_dict.valueAt(a));
|
||||
TLRPC.Dialog dialog = dialogs_dict.valueAt(a);
|
||||
if (deletingDialogs.indexOfKey(dialog.id) >= 0) {
|
||||
continue;
|
||||
}
|
||||
allDialogs.add(dialog);
|
||||
}
|
||||
sortDialogs(null);
|
||||
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload);
|
||||
|
@ -5998,15 +6002,13 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
ImageLoader.saveMessagesThumbs(messagesRes.messages);
|
||||
}
|
||||
boolean isInitialLoading = offset_date == 0 && max_id == 0;
|
||||
boolean requestByTime;
|
||||
boolean reload;
|
||||
if (mode == 1) {
|
||||
requestByTime = ((SystemClock.elapsedRealtime() - lastScheduledServerQueryTime.get(dialogId, 0L)) > 60 * 1000);
|
||||
} else if (mode == 2) {
|
||||
requestByTime = false;
|
||||
reload = ((SystemClock.elapsedRealtime() - lastScheduledServerQueryTime.get(dialogId, 0L)) > 60 * 1000);
|
||||
} else {
|
||||
requestByTime = (SystemClock.elapsedRealtime() - lastServerQueryTime.get(dialogId, 0L)) > 60 * 1000;
|
||||
reload = resCount == 0 && (!isInitialLoading || (SystemClock.elapsedRealtime() - lastServerQueryTime.get(dialogId, 0L)) > 60 * 1000);
|
||||
}
|
||||
if (high_id != 1 && lower_id != 0 && isCache && (resCount == 0 && (!isInitialLoading || requestByTime))) {
|
||||
if (high_id != 1 && lower_id != 0 && isCache && reload) {
|
||||
int hash;
|
||||
if (mode == 2) {
|
||||
hash = 0;
|
||||
|
@ -6882,7 +6884,11 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
|
||||
allDialogs.clear();
|
||||
for (int a = 0, size = dialogs_dict.size(); a < size; a++) {
|
||||
allDialogs.add(dialogs_dict.valueAt(a));
|
||||
TLRPC.Dialog dialog = dialogs_dict.valueAt(a);
|
||||
if (deletingDialogs.indexOfKey(dialog.id) >= 0) {
|
||||
continue;
|
||||
}
|
||||
allDialogs.add(dialog);
|
||||
}
|
||||
sortDialogs(null);
|
||||
dialogsEndReached.put(0, true);
|
||||
|
@ -7454,7 +7460,11 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
|
||||
allDialogs.clear();
|
||||
for (int a = 0, size = dialogs_dict.size(); a < size; a++) {
|
||||
allDialogs.add(dialogs_dict.valueAt(a));
|
||||
TLRPC.Dialog dialog = dialogs_dict.valueAt(a);
|
||||
if (deletingDialogs.indexOfKey(dialog.id) >= 0) {
|
||||
continue;
|
||||
}
|
||||
allDialogs.add(dialog);
|
||||
}
|
||||
sortDialogs(migrate ? chatsDict : null);
|
||||
|
||||
|
@ -8016,7 +8026,11 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
|
||||
allDialogs.clear();
|
||||
for (int a = 0, size = dialogs_dict.size(); a < size; a++) {
|
||||
allDialogs.add(dialogs_dict.valueAt(a));
|
||||
TLRPC.Dialog dialog = dialogs_dict.valueAt(a);
|
||||
if (deletingDialogs.indexOfKey(dialog.id) >= 0) {
|
||||
continue;
|
||||
}
|
||||
allDialogs.add(dialog);
|
||||
}
|
||||
sortDialogs(null);
|
||||
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload);
|
||||
|
@ -10325,7 +10339,11 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
if (added) {
|
||||
allDialogs.clear();
|
||||
for (int a = 0, size = dialogs_dict.size(); a < size; a++) {
|
||||
allDialogs.add(dialogs_dict.valueAt(a));
|
||||
TLRPC.Dialog dialog = dialogs_dict.valueAt(a);
|
||||
if (deletingDialogs.indexOfKey(dialog.id) >= 0) {
|
||||
continue;
|
||||
}
|
||||
allDialogs.add(dialog);
|
||||
}
|
||||
}
|
||||
sortDialogs(null);
|
||||
|
@ -11180,7 +11198,6 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
ArrayList<Integer> contactsIds = null;
|
||||
ArrayList<ImageLoader.MessageThumb> messageThumbs = null;
|
||||
|
||||
boolean checkForUsers = true;
|
||||
ConcurrentHashMap<Integer, TLRPC.User> usersDict;
|
||||
ConcurrentHashMap<Integer, TLRPC.Chat> chatsDict;
|
||||
if (usersArr != null) {
|
||||
|
@ -11190,7 +11207,6 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
usersDict.put(user.id, user);
|
||||
}
|
||||
} else {
|
||||
checkForUsers = false;
|
||||
usersDict = users;
|
||||
}
|
||||
if (chatsArr != null) {
|
||||
|
@ -11200,12 +11216,8 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
chatsDict.put(chat.id, chat);
|
||||
}
|
||||
} else {
|
||||
checkForUsers = false;
|
||||
chatsDict = chats;
|
||||
}
|
||||
if (fromGetDifference) {
|
||||
checkForUsers = false;
|
||||
}
|
||||
|
||||
if (usersArr != null || chatsArr != null) {
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
|
@ -11257,7 +11269,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
putChat(chat, true);
|
||||
}
|
||||
}
|
||||
if (checkForUsers) {
|
||||
if (!fromGetDifference) {
|
||||
if (chat_id != 0) {
|
||||
if (chat == null) {
|
||||
if (BuildVars.LOGS_ENABLED) {
|
||||
|
|
|
@ -4986,6 +4986,7 @@ public class MessagesStorage extends BaseController {
|
|||
} else {
|
||||
SQLiteCursor cursor = database.queryFinalized(String.format(Locale.US, "SELECT COUNT(mid) FROM chat_pinned_v2 WHERE uid = %d AND mid IN (%s)", dialogId, TextUtils.join(",", ids)));
|
||||
alreadyAdded = cursor.next() ? cursor.intValue(0) : 0;
|
||||
cursor.dispose();
|
||||
}
|
||||
SQLitePreparedStatement state = database.executeFast("REPLACE INTO chat_pinned_v2 VALUES(?, ?, ?)");
|
||||
for (int a = 0, N = ids.size(); a < N; a++) {
|
||||
|
|
|
@ -1994,7 +1994,7 @@ public class SharedConfig {
|
|||
} else {
|
||||
devicePerformanceClass = PERFORMANCE_CLASS_HIGH;
|
||||
}
|
||||
if (BuildVars.DEBUG_VERSION) {
|
||||
if (BuildVars.LOGS_ENABLED) {
|
||||
FileLog.d("device performance info (cpu_count = " + cpuCount + ", freq = " + maxCpuFreq + ", memoryClass = " + memoryClass + ", android version " + androidVersion + ")");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,6 +121,16 @@ public class SvgHelper {
|
|||
private float colorAlpha;
|
||||
private float crossfadeAlpha;
|
||||
|
||||
@Override
|
||||
public int getIntrinsicHeight() {
|
||||
return width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIntrinsicWidth() {
|
||||
return height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
if (currentColorKey != null) {
|
||||
|
|
|
@ -18283,87 +18283,85 @@ public class TLRPC {
|
|||
}
|
||||
}
|
||||
|
||||
public static abstract class InputPaymentCredentials extends TLObject {
|
||||
public int flags;
|
||||
public boolean save;
|
||||
public TL_dataJSON data;
|
||||
public TL_dataJSON payment_token;
|
||||
public String google_transaction_id;
|
||||
public String id;
|
||||
public byte[] tmp_password;
|
||||
public static abstract class InputPaymentCredentials extends TLObject {
|
||||
|
||||
public static InputPaymentCredentials TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
InputPaymentCredentials result = null;
|
||||
switch (constructor) {
|
||||
case 0x3417d728:
|
||||
result = new TL_inputPaymentCredentials();
|
||||
break;
|
||||
case 0xca05d50e:
|
||||
result = new TL_inputPaymentCredentialsAndroidPay();
|
||||
break;
|
||||
case 0xc10eb2cf:
|
||||
result = new TL_inputPaymentCredentialsSaved();
|
||||
break;
|
||||
}
|
||||
if (result == null && exception) {
|
||||
throw new RuntimeException(String.format("can't parse magic %x in InputPaymentCredentials", constructor));
|
||||
}
|
||||
if (result != null) {
|
||||
result.readParams(stream, exception);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
public int flags;
|
||||
public boolean save;
|
||||
public TL_dataJSON data;
|
||||
public String id;
|
||||
public byte[] tmp_password;
|
||||
public TL_dataJSON payment_token;
|
||||
|
||||
public static class TL_inputPaymentCredentials extends InputPaymentCredentials {
|
||||
public static int constructor = 0x3417d728;
|
||||
public static InputPaymentCredentials TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
InputPaymentCredentials result = null;
|
||||
switch (constructor) {
|
||||
case 0x3417d728:
|
||||
result = new TL_inputPaymentCredentials();
|
||||
break;
|
||||
case 0x8ac32801:
|
||||
result = new TL_inputPaymentCredentialsGooglePay();
|
||||
break;
|
||||
case 0xc10eb2cf:
|
||||
result = new TL_inputPaymentCredentialsSaved();
|
||||
break;
|
||||
}
|
||||
if (result == null && exception) {
|
||||
throw new RuntimeException(String.format("can't parse magic %x in InputPaymentCredentials", constructor));
|
||||
}
|
||||
if (result != null) {
|
||||
result.readParams(stream, exception);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public static class TL_inputPaymentCredentials extends InputPaymentCredentials {
|
||||
public static int constructor = 0x3417d728;
|
||||
|
||||
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
flags = stream.readInt32(exception);
|
||||
save = (flags & 1) != 0;
|
||||
data = TL_dataJSON.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
}
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
flags = stream.readInt32(exception);
|
||||
save = (flags & 1) != 0;
|
||||
data = TL_dataJSON.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
}
|
||||
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
flags = save ? (flags | 1) : (flags &~ 1);
|
||||
stream.writeInt32(flags);
|
||||
data.serializeToStream(stream);
|
||||
}
|
||||
}
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
flags = save ? (flags | 1) : (flags &~ 1);
|
||||
stream.writeInt32(flags);
|
||||
data.serializeToStream(stream);
|
||||
}
|
||||
}
|
||||
|
||||
public static class TL_inputPaymentCredentialsAndroidPay extends InputPaymentCredentials {
|
||||
public static int constructor = 0xca05d50e;
|
||||
public static class TL_inputPaymentCredentialsGooglePay extends InputPaymentCredentials {
|
||||
public static int constructor = 0x8ac32801;
|
||||
|
||||
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
payment_token = TL_dataJSON.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
google_transaction_id = stream.readString(exception);
|
||||
}
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
payment_token = TL_dataJSON.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
}
|
||||
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
payment_token.serializeToStream(stream);
|
||||
stream.writeString(google_transaction_id);
|
||||
}
|
||||
}
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
payment_token.serializeToStream(stream);
|
||||
}
|
||||
}
|
||||
|
||||
public static class TL_inputPaymentCredentialsSaved extends InputPaymentCredentials {
|
||||
public static int constructor = 0xc10eb2cf;
|
||||
public static class TL_inputPaymentCredentialsSaved extends InputPaymentCredentials {
|
||||
public static int constructor = 0xc10eb2cf;
|
||||
|
||||
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
id = stream.readString(exception);
|
||||
tmp_password = stream.readByteArray(exception);
|
||||
}
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
id = stream.readString(exception);
|
||||
tmp_password = stream.readByteArray(exception);
|
||||
}
|
||||
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
stream.writeString(id);
|
||||
stream.writeByteArray(tmp_password);
|
||||
}
|
||||
}
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
stream.writeString(id);
|
||||
stream.writeByteArray(tmp_password);
|
||||
}
|
||||
}
|
||||
|
||||
public static class TL_exportedMessageLink extends TLObject {
|
||||
public static int constructor = 0x5dab1af4;
|
||||
|
|
|
@ -12,10 +12,10 @@ import android.animation.Animator;
|
|||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
|
@ -36,6 +36,7 @@ import android.widget.ImageView;
|
|||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.LocaleController;
|
||||
import org.telegram.messenger.R;
|
||||
import org.telegram.messenger.SharedConfig;
|
||||
import org.telegram.ui.Adapters.FiltersView;
|
||||
import org.telegram.ui.Components.EllipsizeSpanAnimator;
|
||||
import org.telegram.ui.Components.FireworksEffect;
|
||||
|
@ -62,6 +63,8 @@ public class ActionBar extends FrameLayout {
|
|||
private SimpleTextView[] titleTextView = new SimpleTextView[2];
|
||||
private SimpleTextView subtitleTextView;
|
||||
private View actionModeTop;
|
||||
private int actionModeColor;
|
||||
private int actionBarColor;
|
||||
private ActionBarMenu menu;
|
||||
private ActionBarMenu actionMode;
|
||||
private String actionModeTag;
|
||||
|
@ -211,18 +214,26 @@ public class ActionBar extends FrameLayout {
|
|||
canvas.clipRect(0, -getTranslationY() + (occupyStatusBar ? AndroidUtilities.statusBarHeight : 0), getMeasuredWidth(), getMeasuredHeight());
|
||||
}
|
||||
boolean result = super.drawChild(canvas, child, drawingTime);
|
||||
if (supportsHolidayImage && !titleOverlayShown && !LocaleController.isRTL && child == titleTextView[0]) {
|
||||
if (supportsHolidayImage && !titleOverlayShown && !LocaleController.isRTL && (child == titleTextView[0] || child == titleTextView[1])) {
|
||||
Drawable drawable = Theme.getCurrentHolidayDrawable();
|
||||
if (drawable != null) {
|
||||
TextPaint textPaint = titleTextView[0].getTextPaint();
|
||||
textPaint.getFontMetricsInt(fontMetricsInt);
|
||||
textPaint.getTextBounds((String) titleTextView[0].getText(), 0, 1, rect);
|
||||
int x = titleTextView[0].getTextStartX() + Theme.getCurrentHolidayDrawableXOffset() + (rect.width() - (drawable.getIntrinsicWidth() + Theme.getCurrentHolidayDrawableXOffset())) / 2;
|
||||
int y = titleTextView[0].getTextStartY() + Theme.getCurrentHolidayDrawableYOffset() + (int) Math.ceil((titleTextView[0].getTextHeight() - rect.height()) / 2.0f);
|
||||
drawable.setBounds(x, y - drawable.getIntrinsicHeight(), x + drawable.getIntrinsicWidth(), y);
|
||||
drawable.setColorFilter(textPaint.getColor(), PorterDuff.Mode.MULTIPLY);
|
||||
drawable.draw(canvas);
|
||||
}
|
||||
|
||||
SimpleTextView titleView = (SimpleTextView) child;
|
||||
if (titleView.getVisibility() == View.VISIBLE && titleView.getText() instanceof String) {
|
||||
TextPaint textPaint = titleView.getTextPaint();
|
||||
textPaint.getFontMetricsInt(fontMetricsInt);
|
||||
textPaint.getTextBounds((String) titleView.getText(), 0, 1, rect);
|
||||
int x = titleView.getTextStartX() + Theme.getCurrentHolidayDrawableXOffset() + (rect.width() - (drawable.getIntrinsicWidth() + Theme.getCurrentHolidayDrawableXOffset())) / 2;
|
||||
int y = titleView.getTextStartY() + Theme.getCurrentHolidayDrawableYOffset() + (int) Math.ceil((titleView.getTextHeight() - rect.height()) / 2.0f);
|
||||
drawable.setBounds(x, y - drawable.getIntrinsicHeight(), x + drawable.getIntrinsicWidth(), y);
|
||||
drawable.setAlpha((int) (255 * titleView.getAlpha()));
|
||||
drawable.setColorFilter(textPaint.getColor(), PorterDuff.Mode.MULTIPLY);
|
||||
drawable.draw(canvas);
|
||||
if (overlayTitleAnimationInProgress) {
|
||||
child.invalidate();
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
if (NekoConfig.actionBarDecoration == 2) {
|
||||
if (fireworksEffect == null) {
|
||||
fireworksEffect = new FireworksEffect();
|
||||
|
@ -244,6 +255,7 @@ public class ActionBar extends FrameLayout {
|
|||
} else if (fireworksEffect != null) {
|
||||
fireworksEffect.onDraw(this, canvas);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (clip) {
|
||||
canvas.restore();
|
||||
|
@ -444,7 +456,7 @@ public class ActionBar extends FrameLayout {
|
|||
actionMode = new ActionBarMenu(getContext(), this);
|
||||
actionMode.isActionMode = true;
|
||||
actionMode.setClickable(true);
|
||||
actionMode.setBackgroundColor(Theme.getColor(Theme.key_actionBarActionModeDefault));
|
||||
actionMode.setBackgroundColor(actionModeColor = Theme.getColor(Theme.key_actionBarActionModeDefault));
|
||||
addView(actionMode, indexOfChild(backButtonImageView));
|
||||
actionMode.setPadding(0, occupyStatusBar ? AndroidUtilities.statusBarHeight : 0, 0, 0);
|
||||
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) actionMode.getLayoutParams();
|
||||
|
@ -474,7 +486,8 @@ public class ActionBar extends FrameLayout {
|
|||
showActionMode(null, null, null, null, null, 0);
|
||||
}
|
||||
|
||||
public void showActionMode(View extraView, View showingView, View[] hidingViews, boolean[] hideView, View translationView, int translation) {
|
||||
public void showActionMode(View extraView, View showingView, View[] hidingViews,
|
||||
boolean[] hideView, View translationView, int translation) {
|
||||
if (actionMode == null || actionModeVisible) {
|
||||
return;
|
||||
}
|
||||
|
@ -498,9 +511,16 @@ public class ActionBar extends FrameLayout {
|
|||
actionModeExtraView = extraView;
|
||||
actionModeShowingView = showingView;
|
||||
actionModeHidingViews = hidingViews;
|
||||
if (occupyStatusBar && actionModeTop != null) {
|
||||
if (occupyStatusBar && actionModeTop != null && !SharedConfig.noStatusBar) {
|
||||
animators.add(ObjectAnimator.ofFloat(actionModeTop, View.ALPHA, 0.0f, 1.0f));
|
||||
}
|
||||
if (SharedConfig.noStatusBar) {
|
||||
if (AndroidUtilities.computePerceivedBrightness(actionModeColor) < 0.721f) {
|
||||
AndroidUtilities.setLightStatusBar(((Activity) getContext()).getWindow(), false);
|
||||
} else {
|
||||
AndroidUtilities.setLightStatusBar(((Activity) getContext()).getWindow(), true);
|
||||
}
|
||||
}
|
||||
if (actionModeAnimation != null) {
|
||||
actionModeAnimation.cancel();
|
||||
}
|
||||
|
@ -511,7 +531,7 @@ public class ActionBar extends FrameLayout {
|
|||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
actionMode.setVisibility(VISIBLE);
|
||||
if (occupyStatusBar && actionModeTop != null) {
|
||||
if (occupyStatusBar && actionModeTop != null && !SharedConfig.noStatusBar) {
|
||||
actionModeTop.setVisibility(VISIBLE);
|
||||
}
|
||||
}
|
||||
|
@ -581,9 +601,16 @@ public class ActionBar extends FrameLayout {
|
|||
if (actionModeShowingView != null) {
|
||||
animators.add(ObjectAnimator.ofFloat(actionModeShowingView, View.ALPHA, 0.0f));
|
||||
}
|
||||
if (occupyStatusBar && actionModeTop != null) {
|
||||
if (occupyStatusBar && actionModeTop != null && !SharedConfig.noStatusBar) {
|
||||
animators.add(ObjectAnimator.ofFloat(actionModeTop, View.ALPHA, 0.0f));
|
||||
}
|
||||
if (SharedConfig.noStatusBar) {
|
||||
if (AndroidUtilities.computePerceivedBrightness(actionBarColor) < 0.721f) {
|
||||
AndroidUtilities.setLightStatusBar(((Activity) getContext()).getWindow(), false);
|
||||
} else {
|
||||
AndroidUtilities.setLightStatusBar(((Activity) getContext()).getWindow(), true);
|
||||
}
|
||||
}
|
||||
if (actionModeAnimation != null) {
|
||||
actionModeAnimation.cancel();
|
||||
}
|
||||
|
@ -596,7 +623,7 @@ public class ActionBar extends FrameLayout {
|
|||
if (actionModeAnimation != null && actionModeAnimation.equals(animation)) {
|
||||
actionModeAnimation = null;
|
||||
actionMode.setVisibility(INVISIBLE);
|
||||
if (occupyStatusBar && actionModeTop != null) {
|
||||
if (occupyStatusBar && actionModeTop != null && !SharedConfig.noStatusBar) {
|
||||
actionModeTop.setVisibility(INVISIBLE);
|
||||
}
|
||||
if (actionModeExtraView != null) {
|
||||
|
@ -660,10 +687,15 @@ public class ActionBar extends FrameLayout {
|
|||
|
||||
public void setActionModeColor(int color) {
|
||||
if (actionMode != null) {
|
||||
actionMode.setBackgroundColor(color);
|
||||
actionMode.setBackgroundColor(actionModeColor = color);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBackgroundColor(int color) {
|
||||
super.setBackgroundColor(actionBarColor = color);
|
||||
}
|
||||
|
||||
public boolean isActionModeShowed() {
|
||||
return actionMode != null && actionModeVisible;
|
||||
}
|
||||
|
@ -1085,7 +1117,7 @@ public class ActionBar extends FrameLayout {
|
|||
Drawable drawable = backButtonImageView.getDrawable();
|
||||
if (drawable instanceof BackDrawable) {
|
||||
((BackDrawable) drawable).setColor(color);
|
||||
} else if (drawable instanceof MenuDrawable) {
|
||||
} else if (drawable instanceof MenuDrawable) {
|
||||
((MenuDrawable) drawable).setIconColor(color);
|
||||
}
|
||||
}
|
||||
|
@ -1124,7 +1156,7 @@ public class ActionBar extends FrameLayout {
|
|||
setTitle(title);
|
||||
return;
|
||||
}
|
||||
boolean crossfade = overlayTitleAnimation && !TextUtils.isEmpty(subtitleTextView.getText());
|
||||
boolean crossfade = overlayTitleAnimation && !TextUtils.isEmpty(subtitleTextView.getText());
|
||||
if (crossfade) {
|
||||
if (subtitleTextView.getVisibility() != View.VISIBLE) {
|
||||
subtitleTextView.setVisibility(View.VISIBLE);
|
||||
|
@ -1183,12 +1215,26 @@ public class ActionBar extends FrameLayout {
|
|||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
ellipsizeSpanAnimator.onAttachedToWindow();
|
||||
if (SharedConfig.noStatusBar && actionModeVisible) {
|
||||
if (AndroidUtilities.computePerceivedBrightness(actionModeColor) < 0.721f) {
|
||||
AndroidUtilities.setLightStatusBar(((Activity) getContext()).getWindow(), false);
|
||||
} else {
|
||||
AndroidUtilities.setLightStatusBar(((Activity) getContext()).getWindow(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
ellipsizeSpanAnimator.onDetachedFromWindow();
|
||||
if (SharedConfig.noStatusBar && actionModeVisible) {
|
||||
if (AndroidUtilities.computePerceivedBrightness(actionBarColor) < 0.721f) {
|
||||
AndroidUtilities.setLightStatusBar(((Activity) getContext()).getWindow(), false);
|
||||
} else {
|
||||
AndroidUtilities.setLightStatusBar(((Activity) getContext()).getWindow(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ActionBarMenu getActionMode() {
|
||||
|
|
|
@ -827,7 +827,16 @@ public class ActionBarLayout extends FrameLayout {
|
|||
ViewGroup parent = (ViewGroup) fragment.fragmentView.getParent();
|
||||
if (parent != null) {
|
||||
fragment.onRemoveFromParent();
|
||||
parent.removeViewInLayout(fragment.fragmentView);
|
||||
try {
|
||||
parent.removeViewInLayout(fragment.fragmentView);
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
try {
|
||||
parent.removeView(fragment.fragmentView);
|
||||
} catch (Exception e2) {
|
||||
FileLog.e(e2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fragment.actionBar != null && fragment.actionBar.shouldAddToContainer()) {
|
||||
|
|
|
@ -4460,6 +4460,13 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
|||
} else if (o1.decimal < o2.decimal) {
|
||||
return 1;
|
||||
}
|
||||
if (o1.decimal == o2.decimal) {
|
||||
if (o1.percent > o2.percent) {
|
||||
return 1;
|
||||
} else if (o1.percent < o2.percent) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
for (int a = 0, N = Math.min(restPercent, sortedPollButtons.size()); a < N; a++) {
|
||||
|
@ -4879,7 +4886,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
|||
maxPhotoWidth = photoWidth = (int) (AndroidUtilities.getMinTabletSide() * 0.7f);
|
||||
} else {
|
||||
if (currentPhotoObject != null && (messageObject.type == MessageObject.TYPE_PHOTO || messageObject.type == MessageObject.TYPE_VIDEO || messageObject.type == 8) && currentPhotoObject.w >= currentPhotoObject.h) {
|
||||
maxPhotoWidth = photoWidth = Math.min(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y) - AndroidUtilities.dp((drawAvatar ? 116 : 64) + (checkNeedDrawShareButton(messageObject) ? 10 : 0));
|
||||
maxPhotoWidth = photoWidth = Math.min(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y) - AndroidUtilities.dp(64 + (checkNeedDrawShareButton(messageObject) ? 10 : 0));
|
||||
useFullWidth = true;
|
||||
} else {
|
||||
maxPhotoWidth = photoWidth = (int) (Math.min(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y) * 0.7f);
|
||||
|
@ -4889,7 +4896,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
|||
photoHeight = photoWidth + AndroidUtilities.dp(100);
|
||||
if (!useFullWidth) {
|
||||
if (messageObject.type != 5 && checkNeedDrawShareButton(messageObject)) {
|
||||
maxPhotoWidth -= AndroidUtilities.dp(20);
|
||||
photoWidth -= AndroidUtilities.dp(20);
|
||||
}
|
||||
if (photoWidth > AndroidUtilities.getPhotoSize()) {
|
||||
|
@ -5015,7 +5021,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
|||
}
|
||||
availableTimeWidth = firstLineWidth - AndroidUtilities.dp(35);
|
||||
} else {
|
||||
availableTimeWidth = maxPhotoWidth - AndroidUtilities.dp(14);
|
||||
availableTimeWidth = photoWidth - AndroidUtilities.dp(14);
|
||||
}
|
||||
if (messageObject.type == MessageObject.TYPE_ROUND_VIDEO) {
|
||||
availableTimeWidth -= Math.ceil(Theme.chat_audioTimePaint.measureText("00:00")) + AndroidUtilities.dp(26);
|
||||
|
|
|
@ -28,6 +28,7 @@ import android.view.animation.AccelerateInterpolator;
|
|||
import android.widget.FrameLayout;
|
||||
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.DocumentObject;
|
||||
import org.telegram.messenger.DownloadController;
|
||||
import org.telegram.messenger.Emoji;
|
||||
import org.telegram.messenger.FileLoader;
|
||||
|
@ -40,6 +41,7 @@ import org.telegram.messenger.MediaController;
|
|||
import org.telegram.messenger.MessageObject;
|
||||
import org.telegram.messenger.MessagesController;
|
||||
import org.telegram.messenger.R;
|
||||
import org.telegram.messenger.SvgHelper;
|
||||
import org.telegram.messenger.UserConfig;
|
||||
import org.telegram.messenger.Utilities;
|
||||
import org.telegram.messenger.WebFile;
|
||||
|
@ -343,11 +345,20 @@ public class ContextLinkCell extends FrameLayout implements DownloadController.F
|
|||
}
|
||||
} else {
|
||||
if (currentPhotoObject != null) {
|
||||
SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(documentAttach, Theme.key_windowBackgroundGray, 1.0f);
|
||||
if (MessageObject.canAutoplayAnimatedSticker(documentAttach)) {
|
||||
linkImageView.setImage(ImageLocation.getForDocument(documentAttach), "80_80", ImageLocation.getForDocument(currentPhotoObject, documentAttach), currentPhotoFilterThumb, currentPhotoObject.size, null, parentObject, 0);
|
||||
if (svgThumb != null) {
|
||||
linkImageView.setImage(ImageLocation.getForDocument(documentAttach), "80_80", svgThumb, currentPhotoObject.size, ext, parentObject, 0);
|
||||
} else {
|
||||
linkImageView.setImage(ImageLocation.getForDocument(documentAttach), "80_80", ImageLocation.getForDocument(currentPhotoObject, documentAttach), currentPhotoFilterThumb, currentPhotoObject.size, ext, parentObject, 0);
|
||||
}
|
||||
} else {
|
||||
if (documentAttach != null) {
|
||||
linkImageView.setImage(ImageLocation.getForDocument(currentPhotoObject, documentAttach), currentPhotoFilter, ImageLocation.getForPhoto(currentPhotoObjectThumb, photoAttach), currentPhotoFilterThumb, currentPhotoObject.size, ext, parentObject, 0);
|
||||
if (svgThumb != null) {
|
||||
linkImageView.setImage(ImageLocation.getForDocument(currentPhotoObject, documentAttach), currentPhotoFilter, svgThumb, currentPhotoObject.size, ext, parentObject, 0);
|
||||
} else {
|
||||
linkImageView.setImage(ImageLocation.getForDocument(currentPhotoObject, documentAttach), currentPhotoFilter, ImageLocation.getForPhoto(currentPhotoObjectThumb, photoAttach), currentPhotoFilterThumb, currentPhotoObject.size, ext, parentObject, 0);
|
||||
}
|
||||
} else {
|
||||
linkImageView.setImage(ImageLocation.getForPhoto(currentPhotoObject, photoAttach), currentPhotoFilter, ImageLocation.getForPhoto(currentPhotoObjectThumb, photoAttach), currentPhotoFilterThumb, currentPhotoObject.size, ext, parentObject, 0);
|
||||
}
|
||||
|
|
|
@ -269,6 +269,7 @@ public class DialogCell extends BaseCell {
|
|||
private boolean statusDrawableAnimationInProgress;
|
||||
private ValueAnimator statusDrawableAnimator;
|
||||
long lastDialogChangedTime;
|
||||
private int statusDrawableLeft;
|
||||
|
||||
public static class BounceInterpolator implements Interpolator {
|
||||
|
||||
|
@ -843,12 +844,8 @@ public class DialogCell extends BaseCell {
|
|||
startPadding = statusDrawable.getIntrinsicWidth() + AndroidUtilities.dp(3);
|
||||
}
|
||||
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP && LocaleController.isRTL && (int) currentDialogId < 0) {
|
||||
spannableStringBuilder.append(TextUtils.replace(printingString, new String[]{"..."}, new String[]{""})).append(" ");
|
||||
spannableStringBuilder.setSpan(new FixedWidthSpan(startPadding), spannableStringBuilder.length() - 1, spannableStringBuilder.length(), 0);
|
||||
} else {
|
||||
spannableStringBuilder.append(" ").append(TextUtils.replace(printingString, new String[]{"..."}, new String[]{""})).setSpan(new FixedWidthSpan(startPadding), 0, 1, 0);
|
||||
}
|
||||
spannableStringBuilder.append(" ").append(TextUtils.replace(printingString, new String[]{"..."}, new String[]{""})).setSpan(new FixedWidthSpan(startPadding), 0, 1, 0);
|
||||
|
||||
messageString = spannableStringBuilder;
|
||||
currentMessagePaint = Theme.dialogs_messagePrintingPaint[paintIndex];
|
||||
checkMessage = false;
|
||||
|
@ -1685,6 +1682,15 @@ public class DialogCell extends BaseCell {
|
|||
FileLog.e(e);
|
||||
}
|
||||
}
|
||||
if (messageLayout != null && printingStringType >= 0) {
|
||||
float x1 = messageLayout.getPrimaryHorizontal(0);
|
||||
float x2 = messageLayout.getPrimaryHorizontal(1);
|
||||
if (x1 < x2) {
|
||||
statusDrawableLeft = (int) (messageLeft + x1);
|
||||
} else {
|
||||
statusDrawableLeft = (int) (messageLeft + x2 + AndroidUtilities.dp(3));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void drawCheckStatus(Canvas canvas, boolean drawClock, boolean drawCheck1, boolean drawCheck2, boolean moveCheck, float alpha) {
|
||||
|
@ -2437,14 +2443,13 @@ public class DialogCell extends BaseCell {
|
|||
StatusDrawable statusDrawable = Theme.getChatStatusDrawable(printingStringType);
|
||||
if (statusDrawable != null) {
|
||||
canvas.save();
|
||||
int left = (LocaleController.isRTL || messageLayout.isRtlCharAt(0)) ? getMeasuredWidth() - AndroidUtilities.dp(72) - statusDrawable.getIntrinsicWidth() : messageLeft;
|
||||
if (printingStringType == 1 || printingStringType == 4) {
|
||||
canvas.translate(left, messageTop + (printingStringType == 1 ? AndroidUtilities.dp(1) : 0));
|
||||
canvas.translate(statusDrawableLeft, messageTop + (printingStringType == 1 ? AndroidUtilities.dp(1) : 0));
|
||||
} else {
|
||||
canvas.translate(left, messageTop + (AndroidUtilities.dp(18) - statusDrawable.getIntrinsicHeight()) / 2f);
|
||||
canvas.translate(statusDrawableLeft, messageTop + (AndroidUtilities.dp(18) - statusDrawable.getIntrinsicHeight()) / 2f);
|
||||
}
|
||||
statusDrawable.draw(canvas);
|
||||
invalidate(left, messageTop, left + statusDrawable.getIntrinsicWidth(), messageTop + statusDrawable.getIntrinsicHeight());
|
||||
invalidate(statusDrawableLeft, messageTop, statusDrawableLeft + statusDrawable.getIntrinsicWidth(), messageTop + statusDrawable.getIntrinsicHeight());
|
||||
canvas.restore();
|
||||
}
|
||||
}
|
||||
|
@ -2967,8 +2972,12 @@ public class DialogCell extends BaseCell {
|
|||
@Override
|
||||
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
|
||||
super.onInitializeAccessibilityNodeInfo(info);
|
||||
info.addAction(AccessibilityNodeInfo.ACTION_CLICK);
|
||||
info.addAction(AccessibilityNodeInfo.ACTION_LONG_CLICK);
|
||||
if (currentDialogFolderId != 0 && archiveHidden) {
|
||||
info.setVisibleToUser(false);
|
||||
} else {
|
||||
info.addAction(AccessibilityNodeInfo.ACTION_CLICK);
|
||||
info.addAction(AccessibilityNodeInfo.ACTION_LONG_CLICK);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,6 +23,7 @@ import android.os.Build;
|
|||
import android.text.TextUtils;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
|
|
@ -192,13 +192,13 @@ public class SharedPhotoVideoCell extends FrameLayout {
|
|||
}
|
||||
} else if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaPhoto && messageObject.messageOwner.media.photo != null && !messageObject.photoThumbs.isEmpty()) {
|
||||
videoInfoContainer.setVisibility(INVISIBLE);
|
||||
TLRPC.PhotoSize currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, 320);
|
||||
TLRPC.PhotoSize currentPhotoObjectThumb = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, 50);
|
||||
TLRPC.PhotoSize currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, 320, false, currentPhotoObjectThumb);
|
||||
if (messageObject.mediaExists || DownloadController.getInstance(currentAccount).canDownloadMedia(messageObject)) {
|
||||
if (currentPhotoObject == currentPhotoObjectThumb) {
|
||||
currentPhotoObjectThumb = null;
|
||||
}
|
||||
imageView.getImageReceiver().setImage(ImageLocation.getForObject(currentPhotoObject, messageObject.photoThumbsObject), "100_100", ImageLocation.getForObject(currentPhotoObjectThumb, messageObject.photoThumbsObject), "b", currentPhotoObject.size, null, messageObject, messageObject.shouldEncryptPhotoOrVideo() ? 2 : 1);
|
||||
imageView.getImageReceiver().setImage(ImageLocation.getForObject(currentPhotoObject, messageObject.photoThumbsObject), "100_100", ImageLocation.getForObject(currentPhotoObjectThumb, messageObject.photoThumbsObject), "b", currentPhotoObject != null ? currentPhotoObject.size : 0, null, messageObject, messageObject.shouldEncryptPhotoOrVideo() ? 2 : 1);
|
||||
} else {
|
||||
imageView.setImage(null, null, ImageLocation.getForObject(currentPhotoObjectThumb, messageObject.photoThumbsObject), "b", ApplicationLoader.applicationContext.getResources().getDrawable(R.drawable.photo_placeholder_in), null, null, 0, messageObject);
|
||||
}
|
||||
|
|
|
@ -7269,6 +7269,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
} else {
|
||||
getNotificationCenter().postNotificationName(NotificationCenter.didLoadPinnedMessages, dialog_id, ids, false, null, null, 0, 0, true);
|
||||
}
|
||||
if (pinBulletin != null) {
|
||||
pinBulletin.hide();
|
||||
}
|
||||
showPinBulletin = true;
|
||||
int tag = ++pinBullerinTag;
|
||||
int oldTotalPinnedCount = getPinnedMessagesCount();
|
||||
|
@ -10236,7 +10239,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
if (view instanceof ChatMessageCell) {
|
||||
ChatMessageCell messageCell = (ChatMessageCell) view;
|
||||
messageObject = messageCell.getMessageObject();
|
||||
if (messageObject.getId() > maxVisibleId) {
|
||||
if (messageObject.getDialogId() == dialog_id && messageObject.getId() > maxVisibleId) {
|
||||
maxVisibleId = messageObject.getId();
|
||||
maxVisibleMessageObject = messageObject;
|
||||
}
|
||||
|
@ -10267,7 +10270,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
}
|
||||
} else if (view instanceof ChatActionCell) {
|
||||
messageObject = ((ChatActionCell) view).getMessageObject();
|
||||
if (messageObject != null) {
|
||||
if (messageObject != null && messageObject.getDialogId() == dialog_id && messageObject.getId() > maxVisibleId) {
|
||||
maxVisibleId = Math.max(maxVisibleId, messageObject.getId());
|
||||
}
|
||||
} else if (view instanceof BotHelpCell) {
|
||||
|
@ -19114,6 +19117,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
if (messageObject == null) {
|
||||
return;
|
||||
}
|
||||
if (pinBulletin != null) {
|
||||
pinBulletin.hide(false);
|
||||
}
|
||||
ArrayList<MessageObject> objects = new ArrayList<>();
|
||||
objects.add(selectedObject);
|
||||
ArrayList<Integer> ids = new ArrayList<>();
|
||||
|
@ -19438,7 +19444,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
messageObjects.add(selectedObject);
|
||||
}
|
||||
MediaController.saveFilesFromMessages(getParentActivity(), getAccountInstance(), messageObjects, (count) -> {
|
||||
if (getParentActivity() == null) {
|
||||
if (getParentActivity() == null || fragmentView == null) {
|
||||
return;
|
||||
}
|
||||
if (count > 0) {
|
||||
|
@ -20911,7 +20917,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
args.putLong("dialog_id", dialog_id);
|
||||
}
|
||||
}
|
||||
ProfileActivity fragment = new ProfileActivity(args);
|
||||
ProfileActivity fragment = new ProfileActivity(args, avatarContainer.getSharedMediaPreloader());
|
||||
fragment.setPlayProfileAnimation(1);
|
||||
fragment.setChatInfo(chatInfo);
|
||||
fragment.setUserInfo(userInfo);
|
||||
|
|
|
@ -35,15 +35,15 @@ public final class BulletinFactory {
|
|||
|
||||
MEDIA("MediaSavedHint", Icon.SAVED_TO_GALLERY),
|
||||
|
||||
PHOTO_TO_DOWNLOADS("PhotoSavedToDownloadsHint", Icon.SAVED_TO_DOWNLOADS),
|
||||
PHOTO_TO_DOWNLOADS("PhotoSavedToDownloadsHint", R.string.PhotoSavedToDownloadsHint, Icon.SAVED_TO_DOWNLOADS),
|
||||
VIDEO_TO_DOWNLOADS("VideoSavedToDownloadsHint", R.string.VideoSavedToDownloadsHint, Icon.SAVED_TO_DOWNLOADS),
|
||||
|
||||
GIF("GifSavedToDownloadsHint", Icon.SAVED_TO_DOWNLOADS),
|
||||
|
||||
AUDIO("AudioSavedHint", Icon.SAVED_TO_MUSIC),
|
||||
AUDIO("AudioSavedHint", R.string.AudioSavedHint, Icon.SAVED_TO_MUSIC),
|
||||
AUDIOS("AudiosSavedHint", Icon.SAVED_TO_MUSIC),
|
||||
|
||||
UNKNOWN("FileSavedHint", Icon.SAVED_TO_DOWNLOADS),
|
||||
UNKNOWN("FileSavedHint", R.string.FileSavedHint, Icon.SAVED_TO_DOWNLOADS),
|
||||
UNKNOWNS("FilesSavedHint", Icon.SAVED_TO_DOWNLOADS);
|
||||
|
||||
private final String localeKey;
|
||||
|
|
|
@ -671,4 +671,8 @@ public class ChatAvatarContainer extends FrameLayout implements NotificationCent
|
|||
info.addAction(new AccessibilityNodeInfo.AccessibilityAction(AccessibilityNodeInfo.ACTION_CLICK, LocaleController.getString("OpenProfile", R.string.OpenProfile)));
|
||||
}
|
||||
}
|
||||
|
||||
public SharedMediaLayout.SharedMediaPreloader getSharedMediaPreloader() {
|
||||
return sharedMediaPreloader;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,17 +20,18 @@ import android.graphics.Paint;
|
|||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.os.Build;
|
||||
import android.os.SystemClock;
|
||||
import android.text.Layout;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.StaticLayout;
|
||||
import android.text.TextPaint;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.Property;
|
||||
import android.util.SparseIntArray;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -186,6 +187,7 @@ public class FilterTabsView extends FrameLayout {
|
|||
public void setTab(Tab tab, int position) {
|
||||
currentTab = tab;
|
||||
currentPosition = position;
|
||||
setContentDescription(tab.title);
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
|
@ -566,6 +568,17 @@ public class FilterTabsView extends FrameLayout {
|
|||
|
||||
return changed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
|
||||
super.onInitializeAccessibilityNodeInfo(info);
|
||||
info.addAction(AccessibilityNodeInfo.ACTION_CLICK);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
info.addAction(new AccessibilityNodeInfo.AccessibilityAction(AccessibilityNodeInfo.ACTION_LONG_CLICK, LocaleController.getString("AccDescrOpenMenu2", R.string.AccDescrOpenMenu2)));
|
||||
} else {
|
||||
info.addAction(AccessibilityNodeInfo.ACTION_LONG_CLICK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private TextPaint textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
|
||||
|
|
|
@ -533,7 +533,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
|
|||
}
|
||||
|
||||
private void openSharingLocation(final LocationController.SharingLocationInfo info) {
|
||||
if (info == null || fragment.getParentActivity() == null) {
|
||||
if (info == null || !(fragment.getParentActivity() instanceof LaunchActivity)) {
|
||||
return;
|
||||
}
|
||||
LaunchActivity launchActivity = ((LaunchActivity) fragment.getParentActivity());
|
||||
|
|
|
@ -201,6 +201,7 @@ public class PhotoViewerCaptionEnterView extends FrameLayout implements Notifica
|
|||
messageEditText.setWindowView(windowView);
|
||||
messageEditText.setHint(LocaleController.getString("AddCaption", R.string.AddCaption));
|
||||
messageEditText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
|
||||
messageEditText.setLinkTextColor(0xff76c2f1);
|
||||
messageEditText.setInputType(messageEditText.getInputType() | EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES);
|
||||
messageEditText.setMaxLines(4);
|
||||
messageEditText.setHorizontallyScrolling(false);
|
||||
|
|
|
@ -10,7 +10,6 @@ package org.telegram.ui.Components;
|
|||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
|
|
|
@ -45,6 +45,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.ApplicationLoader;
|
||||
import org.telegram.messenger.MediaDataController;
|
||||
import org.telegram.messenger.Emoji;
|
||||
import org.telegram.messenger.FileLoader;
|
||||
import org.telegram.messenger.FileLog;
|
||||
|
@ -81,12 +82,15 @@ public class StickersAlert extends BottomSheet implements NotificationCenter.Not
|
|||
|
||||
public interface StickersAlertDelegate {
|
||||
void onStickerSelected(TLRPC.Document sticker, String query, Object parent, boolean clearsInputField, boolean notify, int scheduleDate);
|
||||
|
||||
boolean canSchedule();
|
||||
|
||||
boolean isInScheduleMode();
|
||||
}
|
||||
|
||||
public interface StickersAlertInstallDelegate {
|
||||
void onStickerSetInstalled();
|
||||
|
||||
void onStickerSetUninstalled();
|
||||
}
|
||||
|
||||
|
|
|
@ -3102,7 +3102,13 @@ private int lastMeasuredTopPadding;
|
|||
}
|
||||
|
||||
if (!onlySelect && initialDialogsType == 0) {
|
||||
blurredView = new View(context);
|
||||
blurredView = new View(context) {
|
||||
@Override
|
||||
public void setAlpha(float alpha) {
|
||||
super.setAlpha(alpha);
|
||||
fragmentView.invalidate();
|
||||
}
|
||||
};
|
||||
blurredView.setVisibility(View.GONE);
|
||||
contentView.addView(blurredView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
||||
}
|
||||
|
|
|
@ -554,6 +554,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
@Override
|
||||
public boolean onTouchEvent(@NonNull TextView widget, @NonNull Spannable buffer, @NonNull MotionEvent event) {
|
||||
try {
|
||||
if (!imagesArrLocals.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
int action = event.getAction();
|
||||
boolean result = false;
|
||||
|
||||
|
|
|
@ -2112,6 +2112,8 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
|||
}
|
||||
layoutManager.scrollToPositionWithOffset(pos, top - paddingTop);
|
||||
layout = true;
|
||||
} else {
|
||||
layoutManager.scrollToPositionWithOffset(0, AndroidUtilities.dp(88) - paddingTop);
|
||||
}
|
||||
if (currentPaddingTop != paddingTop || listView.getPaddingBottom() != paddingBottom) {
|
||||
listView.setPadding(0, paddingTop, 0, paddingBottom);
|
||||
|
@ -6778,10 +6780,15 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
|||
case 8:
|
||||
UserCell userCell = (UserCell) holder.itemView;
|
||||
TLRPC.ChatParticipant part;
|
||||
if (!sortedUsers.isEmpty()) {
|
||||
part = chatInfo.participants.participants.get(sortedUsers.get(position - membersStartRow));
|
||||
} else {
|
||||
part = chatInfo.participants.participants.get(position - membersStartRow);
|
||||
try {
|
||||
if (!sortedUsers.isEmpty()) {
|
||||
part = chatInfo.participants.participants.get(sortedUsers.get(position - membersStartRow));
|
||||
} else {
|
||||
part = chatInfo.participants.participants.get(position - membersStartRow);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
part = null;
|
||||
FileLog.e(e);
|
||||
}
|
||||
if (part != null) {
|
||||
String role;
|
||||
|
@ -7493,8 +7500,10 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
|||
arrayList.add(new ThemeDescription(null, 0, null, null, null, themeDelegate, Theme.key_profile_status));
|
||||
arrayList.add(new ThemeDescription(null, 0, null, null, null, themeDelegate, Theme.key_avatar_subtitleInProfileBlue));
|
||||
|
||||
arrayList.add(new ThemeDescription(mediaCounterTextView.getTextView(), ThemeDescription.FLAG_TEXTCOLOR, null, null, null, themeDelegate, Theme.key_player_actionBarSubtitle));
|
||||
arrayList.add(new ThemeDescription(mediaCounterTextView.getNextTextView(), ThemeDescription.FLAG_TEXTCOLOR, null, null, null, themeDelegate, Theme.key_player_actionBarSubtitle));
|
||||
if (mediaCounterTextView != null) {
|
||||
arrayList.add(new ThemeDescription(mediaCounterTextView.getTextView(), ThemeDescription.FLAG_TEXTCOLOR, null, null, null, themeDelegate, Theme.key_player_actionBarSubtitle));
|
||||
arrayList.add(new ThemeDescription(mediaCounterTextView.getNextTextView(), ThemeDescription.FLAG_TEXTCOLOR, null, null, null, themeDelegate, Theme.key_player_actionBarSubtitle));
|
||||
}
|
||||
|
||||
arrayList.add(new ThemeDescription(topView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_avatar_backgroundActionBarBlue));
|
||||
arrayList.add(new ThemeDescription(listView, ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_listSelector));
|
||||
|
|
|
@ -188,7 +188,7 @@ public class WebRtcAudioTrack {
|
|||
try {
|
||||
audioTrack.stop();
|
||||
Logging.d(TAG, "AudioTrack.stop is done.");
|
||||
} catch (IllegalStateException e) {
|
||||
} catch (Exception e) {
|
||||
Logging.e(TAG, "AudioTrack.stop failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3870,6 +3870,8 @@
|
|||
<string name="AccDescrOpenInPhotoViewer">Open in photo viewer</string>
|
||||
<string name="AccDescrMusicInfo">%2$s by %1$s</string>
|
||||
<string name="AccDescrMoreOptions">More options</string>
|
||||
<string name="AccDescrSwitchToNightTheme">Switch to night theme</string>
|
||||
<string name="AccDescrSwitchToDayTheme">Switch to day theme</string>
|
||||
<string name="AccActionPlay">Play</string>
|
||||
<string name="AccActionPause">Pause</string>
|
||||
<string name="AccActionDownload">Download</string>
|
||||
|
|
Loading…
Reference in New Issue
Block a user