mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 06:25:14 +01:00
Update to 5.13.0 (1823)
This commit is contained in:
parent
4e55e974f8
commit
12caa1e8cd
20 changed files with 181 additions and 95 deletions
|
@ -283,7 +283,7 @@ android {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig.versionCode = 1821
|
defaultConfig.versionCode = 1823
|
||||||
|
|
||||||
applicationVariants.all { variant ->
|
applicationVariants.all { variant ->
|
||||||
variant.outputs.all { output ->
|
variant.outputs.all { output ->
|
||||||
|
|
|
@ -1434,7 +1434,7 @@ void ConnectionsManager::processServerResponse(TLObject *message, int64_t messag
|
||||||
int64_t time = (int64_t) (messageId / 4294967296.0 * 1000);
|
int64_t time = (int64_t) (messageId / 4294967296.0 * 1000);
|
||||||
int64_t currentTime = getCurrentTimeMillis();
|
int64_t currentTime = getCurrentTimeMillis();
|
||||||
timeDifference = (int32_t) ((time - currentTime) / 1000 - currentPingTime / 2);
|
timeDifference = (int32_t) ((time - currentTime) / 1000 - currentPingTime / 2);
|
||||||
lastOutgoingMessageId = messageId > (lastOutgoingMessageId ? messageId : lastOutgoingMessageId);
|
lastOutgoingMessageId = (messageId > lastOutgoingMessageId ? messageId : lastOutgoingMessageId);
|
||||||
}
|
}
|
||||||
if ((connection->getConnectionType() & ConnectionTypeDownload) == 0 || !datacenter->containsServerSalt(messageSalt, media)) {
|
if ((connection->getConnectionType() & ConnectionTypeDownload) == 0 || !datacenter->containsServerSalt(messageSalt, media)) {
|
||||||
TL_bad_server_salt *response = (TL_bad_server_salt *) message;
|
TL_bad_server_salt *response = (TL_bad_server_salt *) message;
|
||||||
|
@ -2186,7 +2186,7 @@ void ConnectionsManager::processRequestQueue(uint32_t connectionTypes, uint32_t
|
||||||
|
|
||||||
bool forceThisRequest = (connectionTypes & requestConnectionType) && requestDatacenter->getDatacenterId() == dc;
|
bool forceThisRequest = (connectionTypes & requestConnectionType) && requestDatacenter->getDatacenterId() == dc;
|
||||||
|
|
||||||
if (typeInfo == typeid(TL_get_future_salts) || typeInfo == typeid(TL_destroy_session)) {
|
if (typeInfo == typeid(TL_get_future_salts)) {
|
||||||
if (request->messageId != 0) {
|
if (request->messageId != 0) {
|
||||||
request->addRespondMessageId(request->messageId);
|
request->addRespondMessageId(request->messageId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -688,7 +688,8 @@ void Datacenter::mergeServerSalts(TL_future_salts *futureSalts, bool media) {
|
||||||
std::vector<std::unique_ptr<TL_future_salt>> &salts = media ? mediaServerSalts : serverSalts;
|
std::vector<std::unique_ptr<TL_future_salt>> &salts = media ? mediaServerSalts : serverSalts;
|
||||||
|
|
||||||
int32_t date = ConnectionsManager::getInstance(instanceNum).getCurrentTime();
|
int32_t date = ConnectionsManager::getInstance(instanceNum).getCurrentTime();
|
||||||
std::vector<int64_t> existingSalts(salts.size());
|
std::vector<int64_t> existingSalts;
|
||||||
|
existingSalts.reserve(salts.size());
|
||||||
size_t size = salts.size();
|
size_t size = salts.size();
|
||||||
for (uint32_t a = 0; a < size; a++) {
|
for (uint32_t a = 0; a < size; a++) {
|
||||||
existingSalts.push_back(salts[a]->salt);
|
existingSalts.push_back(salts[a]->salt);
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class BuildVars {
|
||||||
public static boolean USE_CLOUD_STRINGS = true;
|
public static boolean USE_CLOUD_STRINGS = true;
|
||||||
public static boolean CHECK_UPDATES = true;
|
public static boolean CHECK_UPDATES = true;
|
||||||
public static boolean TON_WALLET_STANDALONE = false;
|
public static boolean TON_WALLET_STANDALONE = false;
|
||||||
public static int BUILD_VERSION = 1821;
|
public static int BUILD_VERSION = 1823;
|
||||||
public static String BUILD_VERSION_STRING = "5.13.0";
|
public static String BUILD_VERSION_STRING = "5.13.0";
|
||||||
public static int APP_ID = 4;
|
public static int APP_ID = 4;
|
||||||
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
|
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
|
||||||
|
|
|
@ -446,7 +446,7 @@ public class FileLoader extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLoadingFile(final String fileName) {
|
public boolean isLoadingFile(final String fileName) {
|
||||||
return loadOperationPathsUI.containsKey(fileName);
|
return fileName != null && loadOperationPathsUI.containsKey(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getBufferedProgressFromPosition(final float position, final String fileName) {
|
public float getBufferedProgressFromPosition(final float position, final String fileName) {
|
||||||
|
|
|
@ -4523,7 +4523,10 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
for (int a = 0; a < allDialogs.size(); a++) {
|
for (int a = 0; a < allDialogs.size(); a++) {
|
||||||
TLRPC.Dialog d = allDialogs.get(a);
|
TLRPC.Dialog d = allDialogs.get(a);
|
||||||
if (!d.pinned) {
|
if (!d.pinned) {
|
||||||
break;
|
if (d.id != proxyDialogId) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
maxPinnedNum = Math.max(d.pinnedNum, maxPinnedNum);
|
maxPinnedNum = Math.max(d.pinnedNum, maxPinnedNum);
|
||||||
}
|
}
|
||||||
|
@ -8196,7 +8199,10 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!dialog.pinned) {
|
if (!dialog.pinned) {
|
||||||
break;
|
if (dialog.id != proxyDialogId) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
getMessagesStorage().setDialogPinned(dialog.id, dialog.pinnedNum);
|
getMessagesStorage().setDialogPinned(dialog.id, dialog.pinnedNum);
|
||||||
if ((int) dialog.id != 0) {
|
if ((int) dialog.id != 0) {
|
||||||
|
@ -8250,7 +8256,10 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!d.pinned) {
|
if (!d.pinned) {
|
||||||
break;
|
if (d.id != proxyDialogId) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
maxPinnedNum = Math.max(d.pinnedNum, maxPinnedNum);
|
maxPinnedNum = Math.max(d.pinnedNum, maxPinnedNum);
|
||||||
}
|
}
|
||||||
|
@ -8413,7 +8422,10 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!dialog.pinned) {
|
if (!dialog.pinned) {
|
||||||
break;
|
if (dialog.id != proxyDialogId) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
maxPinnedNum = Math.max(dialog.pinnedNum, maxPinnedNum);
|
maxPinnedNum = Math.max(dialog.pinnedNum, maxPinnedNum);
|
||||||
dialog.pinned = false;
|
dialog.pinned = false;
|
||||||
|
|
|
@ -7261,16 +7261,14 @@ public class MessagesStorage extends BaseController {
|
||||||
message.attachPath = oldMessage.attachPath;
|
message.attachPath = oldMessage.attachPath;
|
||||||
message.ttl = cursor.intValue(2);
|
message.ttl = cursor.intValue(2);
|
||||||
}
|
}
|
||||||
if (!message.out) {
|
boolean sameMedia = false;
|
||||||
boolean sameMedia = false; //TODO check
|
if (oldMessage.media instanceof TLRPC.TL_messageMediaPhoto && message.media instanceof TLRPC.TL_messageMediaPhoto && oldMessage.media.photo != null && message.media.photo != null) {
|
||||||
if (oldMessage.media instanceof TLRPC.TL_messageMediaPhoto && message.media instanceof TLRPC.TL_messageMediaPhoto && oldMessage.media.photo != null && message.media.photo != null) {
|
sameMedia = oldMessage.media.photo.id == message.media.photo.id;
|
||||||
sameMedia = oldMessage.media.photo.id == message.media.photo.id;
|
} else if (oldMessage.media instanceof TLRPC.TL_messageMediaDocument && message.media instanceof TLRPC.TL_messageMediaDocument && oldMessage.media.document != null && message.media.document != null) {
|
||||||
} else if (oldMessage.media instanceof TLRPC.TL_messageMediaDocument && message.media instanceof TLRPC.TL_messageMediaDocument && oldMessage.media.document != null && message.media.document != null) {
|
sameMedia = oldMessage.media.document.id == message.media.document.id;
|
||||||
sameMedia = oldMessage.media.document.id == message.media.document.id;
|
}
|
||||||
}
|
if (!sameMedia) {
|
||||||
if (!sameMedia) {
|
addFilesToDelete(oldMessage, filesToDelete, false);
|
||||||
addFilesToDelete(oldMessage, filesToDelete, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
boolean oldMention = cursor.intValue(3) != 0;
|
boolean oldMention = cursor.intValue(3) != 0;
|
||||||
|
|
|
@ -486,34 +486,7 @@ public class Theme {
|
||||||
if (svg) {
|
if (svg) {
|
||||||
patternBitmap = SvgHelper.getBitmap(patternPath, AndroidUtilities.dp(360), AndroidUtilities.dp(640), false);
|
patternBitmap = SvgHelper.getBitmap(patternPath, AndroidUtilities.dp(360), AndroidUtilities.dp(640), false);
|
||||||
} else {
|
} else {
|
||||||
BitmapFactory.Options opts = new BitmapFactory.Options();
|
patternBitmap = loadScreenSizedBitmap(new FileInputStream(patternPath), 0);
|
||||||
opts.inSampleSize = 1;
|
|
||||||
opts.inJustDecodeBounds = true;
|
|
||||||
BitmapFactory.decodeFile(patternPath.getAbsolutePath(), opts);
|
|
||||||
float photoW = opts.outWidth;
|
|
||||||
float photoH = opts.outHeight;
|
|
||||||
float scaleFactor;
|
|
||||||
int w_filter = AndroidUtilities.dp(360);
|
|
||||||
int h_filter = AndroidUtilities.dp(640);
|
|
||||||
if (w_filter >= h_filter && photoW > photoH) {
|
|
||||||
scaleFactor = Math.max(photoW / w_filter, photoH / h_filter);
|
|
||||||
} else {
|
|
||||||
scaleFactor = Math.min(photoW / w_filter, photoH / h_filter);
|
|
||||||
}
|
|
||||||
if (scaleFactor < 1.2f) {
|
|
||||||
scaleFactor = 1;
|
|
||||||
}
|
|
||||||
opts.inJustDecodeBounds = false;
|
|
||||||
if (scaleFactor > 1.0f && (photoW > w_filter || photoH > h_filter)) {
|
|
||||||
int sample = 1;
|
|
||||||
do {
|
|
||||||
sample *= 2;
|
|
||||||
} while (sample * 2 < scaleFactor);
|
|
||||||
opts.inSampleSize = sample;
|
|
||||||
} else {
|
|
||||||
opts.inSampleSize = (int) scaleFactor;
|
|
||||||
}
|
|
||||||
patternBitmap = BitmapFactory.decodeFile(patternPath.getAbsolutePath(), opts);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7180,14 +7153,17 @@ public class Theme {
|
||||||
}
|
}
|
||||||
isCustomTheme = true;
|
isCustomTheme = true;
|
||||||
} else if (themedWallpaperLink != null) {
|
} else if (themedWallpaperLink != null) {
|
||||||
File pathToWallpaper = new File(ApplicationLoader.getFilesDirFixed(), Utilities.MD5(themedWallpaperLink) + ".wp");
|
try {
|
||||||
Bitmap bitmap = BitmapFactory.decodeFile(pathToWallpaper.getAbsolutePath());
|
File pathToWallpaper = new File(ApplicationLoader.getFilesDirFixed(), Utilities.MD5(themedWallpaperLink) + ".wp");
|
||||||
if (bitmap != null) {
|
Bitmap bitmap = loadScreenSizedBitmap(new FileInputStream(pathToWallpaper), 0);
|
||||||
themedWallpaper = wallpaper = new BitmapDrawable(bitmap);
|
if (bitmap != null) {
|
||||||
isCustomTheme = true;
|
themedWallpaper = wallpaper = new BitmapDrawable(bitmap);
|
||||||
|
isCustomTheme = true;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e(e);
|
||||||
}
|
}
|
||||||
} else if (themedWallpaperFileOffset > 0 && (currentTheme.pathToFile != null || currentTheme.assetName != null)) {
|
} else if (themedWallpaperFileOffset > 0 && (currentTheme.pathToFile != null || currentTheme.assetName != null)) {
|
||||||
FileInputStream stream = null;
|
|
||||||
try {
|
try {
|
||||||
File file;
|
File file;
|
||||||
if (currentTheme.assetName != null) {
|
if (currentTheme.assetName != null) {
|
||||||
|
@ -7195,23 +7171,13 @@ public class Theme {
|
||||||
} else {
|
} else {
|
||||||
file = new File(currentTheme.pathToFile);
|
file = new File(currentTheme.pathToFile);
|
||||||
}
|
}
|
||||||
stream = new FileInputStream(file);
|
Bitmap bitmap = loadScreenSizedBitmap(new FileInputStream(file), themedWallpaperFileOffset);
|
||||||
stream.getChannel().position(themedWallpaperFileOffset);
|
|
||||||
Bitmap bitmap = BitmapFactory.decodeStream(stream);
|
|
||||||
if (bitmap != null) {
|
if (bitmap != null) {
|
||||||
themedWallpaper = wallpaper = new BitmapDrawable(bitmap);
|
themedWallpaper = wallpaper = new BitmapDrawable(bitmap);
|
||||||
isCustomTheme = true;
|
isCustomTheme = true;
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
FileLog.e(e);
|
FileLog.e(e);
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
if (stream != null) {
|
|
||||||
stream.close();
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
FileLog.e(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7244,11 +7210,14 @@ public class Theme {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
File toFile = new File(ApplicationLoader.getFilesDirFixed(), overrideWallpaper.fileName);
|
File toFile = new File(ApplicationLoader.getFilesDirFixed(), overrideWallpaper.fileName);
|
||||||
long len = toFile.length();
|
|
||||||
if (toFile.exists()) {
|
if (toFile.exists()) {
|
||||||
wallpaper = Drawable.createFromPath(toFile.getAbsolutePath());
|
Bitmap bitmap = loadScreenSizedBitmap(new FileInputStream(toFile), 0);
|
||||||
isCustomTheme = true;
|
if (bitmap != null) {
|
||||||
} else {
|
wallpaper = new BitmapDrawable(bitmap);
|
||||||
|
isCustomTheme = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (wallpaper == null) {
|
||||||
wallpaper = ApplicationLoader.applicationContext.getResources().getDrawable(R.drawable.background_hd);
|
wallpaper = ApplicationLoader.applicationContext.getResources().getDrawable(R.drawable.background_hd);
|
||||||
isCustomTheme = false;
|
isCustomTheme = false;
|
||||||
}
|
}
|
||||||
|
@ -7273,6 +7242,52 @@ public class Theme {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Bitmap loadScreenSizedBitmap(FileInputStream stream, int offset) {
|
||||||
|
try {
|
||||||
|
BitmapFactory.Options opts = new BitmapFactory.Options();
|
||||||
|
opts.inSampleSize = 1;
|
||||||
|
opts.inJustDecodeBounds = true;
|
||||||
|
stream.getChannel().position(offset);
|
||||||
|
BitmapFactory.decodeStream(stream, null, opts);
|
||||||
|
float photoW = opts.outWidth;
|
||||||
|
float photoH = opts.outHeight;
|
||||||
|
float scaleFactor;
|
||||||
|
int w_filter = AndroidUtilities.dp(360);
|
||||||
|
int h_filter = AndroidUtilities.dp(640);
|
||||||
|
if (w_filter >= h_filter && photoW > photoH) {
|
||||||
|
scaleFactor = Math.max(photoW / w_filter, photoH / h_filter);
|
||||||
|
} else {
|
||||||
|
scaleFactor = Math.min(photoW / w_filter, photoH / h_filter);
|
||||||
|
}
|
||||||
|
if (scaleFactor < 1.2f) {
|
||||||
|
scaleFactor = 1;
|
||||||
|
}
|
||||||
|
opts.inJustDecodeBounds = false;
|
||||||
|
if (scaleFactor > 1.0f && (photoW > w_filter || photoH > h_filter)) {
|
||||||
|
int sample = 1;
|
||||||
|
do {
|
||||||
|
sample *= 2;
|
||||||
|
} while (sample * 2 < scaleFactor);
|
||||||
|
opts.inSampleSize = sample;
|
||||||
|
} else {
|
||||||
|
opts.inSampleSize = (int) scaleFactor;
|
||||||
|
}
|
||||||
|
stream.getChannel().position(offset);
|
||||||
|
return BitmapFactory.decodeStream(stream, null, opts);
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e(e);
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (stream != null) {
|
||||||
|
stream.close();
|
||||||
|
}
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static Drawable getThemedWallpaper(boolean thumb, View ownerView) {
|
public static Drawable getThemedWallpaper(boolean thumb, View ownerView) {
|
||||||
Integer backgroundColor = currentColors.get(key_chat_wallpaper);
|
Integer backgroundColor = currentColors.get(key_chat_wallpaper);
|
||||||
File file = null;
|
File file = null;
|
||||||
|
|
|
@ -1049,7 +1049,7 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
|
||||||
@Override
|
@Override
|
||||||
public boolean onInterceptTouchEvent(MotionEvent e) {
|
public boolean onInterceptTouchEvent(MotionEvent e) {
|
||||||
if (getParent() != null && getParent().getParent() != null) {
|
if (getParent() != null && getParent().getParent() != null) {
|
||||||
getParent().getParent().requestDisallowInterceptTouchEvent(true);
|
getParent().getParent().requestDisallowInterceptTouchEvent(canScrollHorizontally(-1));
|
||||||
}
|
}
|
||||||
return super.onInterceptTouchEvent(e);
|
return super.onInterceptTouchEvent(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4746,6 +4746,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
radialProgress.setIcon(getIconForCurrentState(), false, false);
|
radialProgress.setIcon(getIconForCurrentState(), false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (delegate != null && delegate.getTextSelectionHelper() != null && !messageIdChanged && messageChanged && messageObject != null) {
|
||||||
|
delegate.getTextSelectionHelper().checkDataChanged(messageObject);
|
||||||
|
}
|
||||||
accessibilityVirtualViewBounds.clear();
|
accessibilityVirtualViewBounds.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1442,14 +1442,17 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
|
||||||
protected int getLineHeight() {
|
protected int getLineHeight() {
|
||||||
if (selectedView != null && selectedView.getMessageObject() != null) {
|
if (selectedView != null && selectedView.getMessageObject() != null) {
|
||||||
MessageObject object = selectedView.getMessageObject();
|
MessageObject object = selectedView.getMessageObject();
|
||||||
StaticLayout layout;
|
StaticLayout layout = null;
|
||||||
if (isDescription) {
|
if (isDescription) {
|
||||||
layout = selectedView.getDescriptionlayout();
|
layout = selectedView.getDescriptionlayout();
|
||||||
} else if (selectedView.hasCaptionLayout()) {
|
} else if (selectedView.hasCaptionLayout()) {
|
||||||
layout = selectedView.getCaptionLayout();
|
layout = selectedView.getCaptionLayout();
|
||||||
} else {
|
} else if (object.textLayoutBlocks != null) {
|
||||||
layout = object.textLayoutBlocks.get(0).textLayout;
|
layout = object.textLayoutBlocks.get(0).textLayout;
|
||||||
}
|
}
|
||||||
|
if (layout == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
int lineHeight = layout.getLineBottom(0) - layout.getLineTop(0);
|
int lineHeight = layout.getLineBottom(0) - layout.getLineTop(0);
|
||||||
return lineHeight;
|
return lineHeight;
|
||||||
}
|
}
|
||||||
|
@ -1461,7 +1464,7 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
|
||||||
this.maybeSelectedView = chatMessageCell;
|
this.maybeSelectedView = chatMessageCell;
|
||||||
MessageObject messageObject = chatMessageCell.getMessageObject();
|
MessageObject messageObject = chatMessageCell.getMessageObject();
|
||||||
|
|
||||||
if (maybeIsDescription) {
|
if (maybeIsDescription && chatMessageCell.getDescriptionlayout() != null) {
|
||||||
textArea.set(
|
textArea.set(
|
||||||
maybeTextX, maybeTextY,
|
maybeTextX, maybeTextY,
|
||||||
maybeTextX + chatMessageCell.getDescriptionlayout().getWidth(),
|
maybeTextX + chatMessageCell.getDescriptionlayout().getWidth(),
|
||||||
|
@ -1673,6 +1676,11 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (messageObject.textLayoutBlocks == null) {
|
||||||
|
layoutBlock.layout = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (messageObject.textLayoutBlocks.size() == 1) {
|
if (messageObject.textLayoutBlocks.size() == 1) {
|
||||||
layoutBlock.layout = messageObject.textLayoutBlocks.get(0).textLayout;
|
layoutBlock.layout = messageObject.textLayoutBlocks.get(0).textLayout;
|
||||||
layoutBlock.yOffset = 0;
|
layoutBlock.yOffset = 0;
|
||||||
|
@ -1802,6 +1810,12 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void checkDataChanged(MessageObject messageObject) {
|
||||||
|
if (selectedCellId == messageObject.getId()) {
|
||||||
|
clear(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ArticleTextSelectionHelper extends TextSelectionHelper<ArticleSelectableView> {
|
public static class ArticleTextSelectionHelper extends TextSelectionHelper<ArticleSelectableView> {
|
||||||
|
|
|
@ -734,7 +734,7 @@ public class ThemesHorizontalListCell extends RecyclerListView implements Notifi
|
||||||
@Override
|
@Override
|
||||||
public boolean onInterceptTouchEvent(MotionEvent e) {
|
public boolean onInterceptTouchEvent(MotionEvent e) {
|
||||||
if (getParent() != null && getParent().getParent() != null) {
|
if (getParent() != null && getParent().getParent() != null) {
|
||||||
getParent().getParent().requestDisallowInterceptTouchEvent(true);
|
getParent().getParent().requestDisallowInterceptTouchEvent(canScrollHorizontally(-1));
|
||||||
}
|
}
|
||||||
return super.onInterceptTouchEvent(e);
|
return super.onInterceptTouchEvent(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5001,7 +5001,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
updateTopPanel(false);
|
updateTopPanel(false);
|
||||||
updatePinnedMessageView(true);
|
updatePinnedMessageView(true);
|
||||||
|
|
||||||
chatScrollHelper = new RecyclerAnimationScrollHelper(chatListView,chatLayoutManager);
|
chatScrollHelper = new RecyclerAnimationScrollHelper(chatListView, chatLayoutManager);
|
||||||
chatScrollHelper.setScrollListener(() -> updateMessagesVisiblePart(false));
|
chatScrollHelper.setScrollListener(() -> updateMessagesVisiblePart(false));
|
||||||
chatScrollHelper.setAnimationCallback(chatScrollHelperCallback);
|
chatScrollHelper.setAnimationCallback(chatScrollHelperCallback);
|
||||||
|
|
||||||
|
@ -7482,7 +7482,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
if (viewBottom > height) {
|
if (viewBottom > height) {
|
||||||
viewBottom = viewTop + height;
|
viewBottom = viewTop + height;
|
||||||
}
|
}
|
||||||
messageCell.setVisiblePart(viewTop, viewBottom - viewTop, contentView.getHeightWithKeyboard() - AndroidUtilities.dp(48) - chatListView.getTop());
|
messageCell.setVisiblePart(viewTop, viewBottom - viewTop, contentView.getHeightWithKeyboard() - (inPreviewMode ? 0 : AndroidUtilities.dp(48)) - chatListView.getTop());
|
||||||
|
|
||||||
messageObject = messageCell.getMessageObject();
|
messageObject = messageCell.getMessageObject();
|
||||||
boolean isVideo;
|
boolean isVideo;
|
||||||
|
@ -9465,7 +9465,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
loading = false;
|
loading = false;
|
||||||
|
|
||||||
if (chatListView != null) {
|
if (chatListView != null && chatScrollHelper != null) {
|
||||||
if (first || scrollToTopOnResume || forceScrollToTop) {
|
if (first || scrollToTopOnResume || forceScrollToTop) {
|
||||||
forceScrollToTop = false;
|
forceScrollToTop = false;
|
||||||
if (!postponedScroll) {
|
if (!postponedScroll) {
|
||||||
|
@ -9969,6 +9969,14 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
messages.remove(index);
|
messages.remove(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (removed.hasValidGroupId()) {
|
||||||
|
MessageObject.GroupedMessages groupedMessages = groupedMessagesMap.get(removed.getGroupId());
|
||||||
|
groupedMessages.messages.remove(removed);
|
||||||
|
if (newGroups == null) {
|
||||||
|
newGroups = new LongSparseArray<>();
|
||||||
|
}
|
||||||
|
newGroups.put(groupedMessages.groupId, groupedMessages);
|
||||||
|
}
|
||||||
if (chatAdapter != null) {
|
if (chatAdapter != null) {
|
||||||
chatAdapter.notifyDataSetChanged();
|
chatAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
@ -16032,7 +16040,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
if (viewBottom > height) {
|
if (viewBottom > height) {
|
||||||
viewBottom = viewTop + height;
|
viewBottom = viewTop + height;
|
||||||
}
|
}
|
||||||
messageCell.setVisiblePart(viewTop, viewBottom - viewTop, contentView.getHeightWithKeyboard() - AndroidUtilities.dp(48) - chatListView.getTop());
|
messageCell.setVisiblePart(viewTop, viewBottom - viewTop, contentView.getHeightWithKeyboard() - (inPreviewMode ? 0 : AndroidUtilities.dp(48)) - chatListView.getTop());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1642,7 +1642,7 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
|
||||||
@Override
|
@Override
|
||||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||||
if (getParent() != null) {
|
if (getParent() != null) {
|
||||||
getParent().requestDisallowInterceptTouchEvent(true);
|
getParent().requestDisallowInterceptTouchEvent(canScrollHorizontally(-1));
|
||||||
}
|
}
|
||||||
return super.onInterceptTouchEvent(ev);
|
return super.onInterceptTouchEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2558,7 +2558,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
int lower_id = (int) dialog.id;
|
int lower_id = (int) dialog.id;
|
||||||
if (dialog.pinned) {
|
if (dialog.pinned) {
|
||||||
pinnedCount++;
|
pinnedCount++;
|
||||||
} else {
|
} else if (!getMessagesController().isProxyDialog(dialog.id, false)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2615,7 +2615,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
} else {
|
} else {
|
||||||
pinnedCount++;
|
pinnedCount++;
|
||||||
}
|
}
|
||||||
} else {
|
} else if (!getMessagesController().isProxyDialog(dialog.id, false)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1026,7 +1026,7 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
|
||||||
MapsInitializer.initialize(ApplicationLoader.applicationContext);
|
MapsInitializer.initialize(ApplicationLoader.applicationContext);
|
||||||
mapView.getMapAsync(map1 -> {
|
mapView.getMapAsync(map1 -> {
|
||||||
googleMap = map1;
|
googleMap = map1;
|
||||||
if (Theme.getCurrentTheme().isDark() || Theme.isCurrentThemeNight()) {
|
if (isActiveThemeDark()) {
|
||||||
currentMapStyleDark = true;
|
currentMapStyleDark = true;
|
||||||
MapStyleOptions style = MapStyleOptions.loadRawResourceStyle(ApplicationLoader.applicationContext, R.raw.mapstyle_night);
|
MapStyleOptions style = MapStyleOptions.loadRawResourceStyle(ApplicationLoader.applicationContext, R.raw.mapstyle_night);
|
||||||
googleMap.setMapStyle(style);
|
googleMap.setMapStyle(style);
|
||||||
|
@ -1154,6 +1154,15 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
|
||||||
return fragmentView;
|
return fragmentView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isActiveThemeDark() {
|
||||||
|
Theme.ThemeInfo info = Theme.getActiveTheme();
|
||||||
|
if (info.isDark()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
int color = Theme.getColor(Theme.key_windowBackgroundWhite);
|
||||||
|
return AndroidUtilities.computePerceivedBrightness(color) < 0.721f;
|
||||||
|
}
|
||||||
|
|
||||||
private void updateEmptyView() {
|
private void updateEmptyView() {
|
||||||
if (searching) {
|
if (searching) {
|
||||||
if (searchInProgress) {
|
if (searchInProgress) {
|
||||||
|
@ -2052,7 +2061,7 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
|
||||||
shadow.invalidate();
|
shadow.invalidate();
|
||||||
|
|
||||||
if (googleMap != null) {
|
if (googleMap != null) {
|
||||||
if (Theme.getCurrentTheme().isDark() || Theme.isCurrentThemeNight()) {
|
if (isActiveThemeDark()) {
|
||||||
if (!currentMapStyleDark) {
|
if (!currentMapStyleDark) {
|
||||||
currentMapStyleDark = true;
|
currentMapStyleDark = true;
|
||||||
MapStyleOptions style = MapStyleOptions.loadRawResourceStyle(ApplicationLoader.applicationContext, R.raw.mapstyle_night);
|
MapStyleOptions style = MapStyleOptions.loadRawResourceStyle(ApplicationLoader.applicationContext, R.raw.mapstyle_night);
|
||||||
|
|
|
@ -8920,7 +8920,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas.drawText(lowQualityDescription, sideSide, cy - AndroidUtilities.dp(20), textPaint);
|
canvas.drawText(lowQualityDescription, sideSide, cy - AndroidUtilities.dp(16), textPaint);
|
||||||
float width = textPaint.measureText(hightQualityDescription);
|
float width = textPaint.measureText(hightQualityDescription);
|
||||||
canvas.drawText(hightQualityDescription, getMeasuredWidth() - sideSide - width, cy - AndroidUtilities.dp(16), textPaint);
|
canvas.drawText(hightQualityDescription, getMeasuredWidth() - sideSide - width, cy - AndroidUtilities.dp(16), textPaint);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1532,7 +1532,7 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No
|
||||||
@Override
|
@Override
|
||||||
public boolean onInterceptTouchEvent(MotionEvent e) {
|
public boolean onInterceptTouchEvent(MotionEvent e) {
|
||||||
if (getParent() != null && getParent().getParent() != null) {
|
if (getParent() != null && getParent().getParent() != null) {
|
||||||
getParent().getParent().requestDisallowInterceptTouchEvent(true);
|
getParent().getParent().requestDisallowInterceptTouchEvent(canScrollHorizontally(-1));
|
||||||
}
|
}
|
||||||
return super.onInterceptTouchEvent(e);
|
return super.onInterceptTouchEvent(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,7 @@ import org.telegram.messenger.MessagesController;
|
||||||
import org.telegram.messenger.MessagesStorage;
|
import org.telegram.messenger.MessagesStorage;
|
||||||
import org.telegram.messenger.NotificationCenter;
|
import org.telegram.messenger.NotificationCenter;
|
||||||
import org.telegram.messenger.R;
|
import org.telegram.messenger.R;
|
||||||
|
import org.telegram.messenger.SharedConfig;
|
||||||
import org.telegram.messenger.UserConfig;
|
import org.telegram.messenger.UserConfig;
|
||||||
import org.telegram.messenger.Utilities;
|
import org.telegram.messenger.Utilities;
|
||||||
import org.telegram.tgnet.ConnectionsManager;
|
import org.telegram.tgnet.ConnectionsManager;
|
||||||
|
@ -865,15 +866,34 @@ public class ThemePreviewActivity extends BaseFragment implements DownloadContro
|
||||||
String fileName = isBlurred ? theme.generateWallpaperName(null, false) : originalFileName;
|
String fileName = isBlurred ? theme.generateWallpaperName(null, false) : originalFileName;
|
||||||
File toFile = new File(ApplicationLoader.getFilesDirFixed(), originalFileName);
|
File toFile = new File(ApplicationLoader.getFilesDirFixed(), originalFileName);
|
||||||
if (currentWallpaper instanceof TLRPC.TL_wallPaper) {
|
if (currentWallpaper instanceof TLRPC.TL_wallPaper) {
|
||||||
try {
|
if (originalBitmap != null) {
|
||||||
FileOutputStream stream = new FileOutputStream(toFile);
|
try {
|
||||||
originalBitmap.compress(Bitmap.CompressFormat.JPEG, 87, stream);
|
FileOutputStream stream = new FileOutputStream(toFile);
|
||||||
stream.close();
|
originalBitmap.compress(Bitmap.CompressFormat.JPEG, 87, stream);
|
||||||
done = true;
|
stream.close();
|
||||||
} catch (Exception e) {
|
done = true;
|
||||||
done = false;
|
} catch (Exception e) {
|
||||||
FileLog.e(e);
|
done = false;
|
||||||
|
FileLog.e(e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ImageReceiver imageReceiver = backgroundImage.getImageReceiver();
|
||||||
|
if (imageReceiver.hasNotThumb() || imageReceiver.hasStaticThumb()) {
|
||||||
|
Bitmap bitmap = imageReceiver.getBitmap();
|
||||||
|
try {
|
||||||
|
FileOutputStream stream = new FileOutputStream(toFile);
|
||||||
|
bitmap.compress(Bitmap.CompressFormat.JPEG, 87, stream);
|
||||||
|
stream.close();
|
||||||
|
done = true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
done = false;
|
||||||
|
FileLog.e(e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
done = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!done) {
|
if (!done) {
|
||||||
TLRPC.TL_wallPaper wallPaper = (TLRPC.TL_wallPaper) currentWallpaper;
|
TLRPC.TL_wallPaper wallPaper = (TLRPC.TL_wallPaper) currentWallpaper;
|
||||||
File f = FileLoader.getPathToAttach(wallPaper.document, true);
|
File f = FileLoader.getPathToAttach(wallPaper.document, true);
|
||||||
|
@ -1865,7 +1885,13 @@ public class ThemePreviewActivity extends BaseFragment implements DownloadContro
|
||||||
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didSetNewWallpapper);
|
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didSetNewWallpapper);
|
||||||
}
|
}
|
||||||
if (screenType != SCREEN_TYPE_PREVIEW || accent != null) {
|
if (screenType != SCREEN_TYPE_PREVIEW || accent != null) {
|
||||||
imageFilter = (int) (1080 / AndroidUtilities.density) + "_" + (int) (1920 / AndroidUtilities.density) + "_f";
|
if (SharedConfig.getDevicePerfomanceClass() == SharedConfig.PERFORMANCE_CLASS_LOW) {
|
||||||
|
int w = Math.min(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y);
|
||||||
|
int h = Math.max(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y);
|
||||||
|
imageFilter = (int) (w / AndroidUtilities.density) + "_" + (int) (h / AndroidUtilities.density) + "_f";
|
||||||
|
} else {
|
||||||
|
imageFilter = (int) (1080 / AndroidUtilities.density) + "_" + (int) (1920 / AndroidUtilities.density) + "_f";
|
||||||
|
}
|
||||||
maxWallpaperSize = Math.min(1920, Math.max(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y));
|
maxWallpaperSize = Math.min(1920, Math.max(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y));
|
||||||
|
|
||||||
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.wallpapersNeedReload);
|
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.wallpapersNeedReload);
|
||||||
|
|
|
@ -1359,7 +1359,7 @@ public class WallpapersListActivity extends BaseFragment implements Notification
|
||||||
@Override
|
@Override
|
||||||
public boolean onInterceptTouchEvent(MotionEvent e) {
|
public boolean onInterceptTouchEvent(MotionEvent e) {
|
||||||
if (getParent() != null && getParent().getParent() != null) {
|
if (getParent() != null && getParent().getParent() != null) {
|
||||||
getParent().getParent().requestDisallowInterceptTouchEvent(true);
|
getParent().getParent().requestDisallowInterceptTouchEvent(canScrollHorizontally(-1));
|
||||||
}
|
}
|
||||||
return super.onInterceptTouchEvent(e);
|
return super.onInterceptTouchEvent(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue