mirror of
https://github.com/NekoX-Dev/NekoX.git
synced 2024-12-11 23:09:25 +01:00
Merge branch 'master' of github.com:DrKLO/Telegram
This commit is contained in:
commit
107fe3dfbe
@ -285,7 +285,7 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
defaultConfig.versionCode = 10 * 1822
|
||||
defaultConfig.versionCode = 10 * 1823
|
||||
|
||||
applicationVariants.all { variant ->
|
||||
variant.outputs.all { output ->
|
||||
|
@ -1449,7 +1449,7 @@ void ConnectionsManager::processServerResponse(TLObject *message, int64_t messag
|
||||
int64_t time = (int64_t) (messageId / 4294967296.0 * 1000);
|
||||
int64_t currentTime = getCurrentTimeMillis();
|
||||
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)) {
|
||||
TL_bad_server_salt *response = (TL_bad_server_salt *) message;
|
||||
@ -2201,7 +2201,7 @@ void ConnectionsManager::processRequestQueue(uint32_t connectionTypes, uint32_t
|
||||
|
||||
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) {
|
||||
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;
|
||||
|
||||
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();
|
||||
for (uint32_t a = 0; a < size; a++) {
|
||||
existingSalts.push_back(salts[a]->salt);
|
||||
|
@ -19,7 +19,7 @@ public class BuildVars {
|
||||
public static boolean USE_CLOUD_STRINGS = true;
|
||||
public static boolean CHECK_UPDATES = true;
|
||||
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 int APP_ID = 336779; //obtain your own APP_ID at https://core.telegram.org/api/obtaining_api_id
|
||||
public static String APP_HASH = "b91eefacc86747c068c8d8a16b41500d"; //obtain your own APP_HASH at https://core.telegram.org/api/obtaining_api_id
|
||||
|
@ -446,7 +446,7 @@ public class FileLoader extends BaseController {
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -4533,7 +4533,10 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||
for (int a = 0; a < allDialogs.size(); a++) {
|
||||
TLRPC.Dialog d = allDialogs.get(a);
|
||||
if (!d.pinned) {
|
||||
break;
|
||||
if (d.id != proxyDialogId) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
maxPinnedNum = Math.max(d.pinnedNum, maxPinnedNum);
|
||||
}
|
||||
@ -8206,7 +8209,10 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||
continue;
|
||||
}
|
||||
if (!dialog.pinned) {
|
||||
break;
|
||||
if (dialog.id != proxyDialogId) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
getMessagesStorage().setDialogPinned(dialog.id, dialog.pinnedNum);
|
||||
if ((int) dialog.id != 0) {
|
||||
@ -8260,7 +8266,10 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||
continue;
|
||||
}
|
||||
if (!d.pinned) {
|
||||
break;
|
||||
if (d.id != proxyDialogId) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
maxPinnedNum = Math.max(d.pinnedNum, maxPinnedNum);
|
||||
}
|
||||
@ -8423,7 +8432,10 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||
continue;
|
||||
}
|
||||
if (!dialog.pinned) {
|
||||
break;
|
||||
if (dialog.id != proxyDialogId) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
maxPinnedNum = Math.max(dialog.pinnedNum, maxPinnedNum);
|
||||
dialog.pinned = false;
|
||||
|
@ -7261,16 +7261,14 @@ public class MessagesStorage extends BaseController {
|
||||
message.attachPath = oldMessage.attachPath;
|
||||
message.ttl = cursor.intValue(2);
|
||||
}
|
||||
if (!message.out) {
|
||||
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) {
|
||||
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) {
|
||||
sameMedia = oldMessage.media.document.id == message.media.document.id;
|
||||
}
|
||||
if (!sameMedia) {
|
||||
addFilesToDelete(oldMessage, filesToDelete, false);
|
||||
}
|
||||
boolean sameMedia = false;
|
||||
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;
|
||||
} 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;
|
||||
}
|
||||
if (!sameMedia) {
|
||||
addFilesToDelete(oldMessage, filesToDelete, false);
|
||||
}
|
||||
}
|
||||
boolean oldMention = cursor.intValue(3) != 0;
|
||||
|
@ -488,34 +488,7 @@ public class Theme {
|
||||
if (svg) {
|
||||
patternBitmap = SvgHelper.getBitmap(patternPath, AndroidUtilities.dp(360), AndroidUtilities.dp(640), false);
|
||||
} else {
|
||||
BitmapFactory.Options opts = new BitmapFactory.Options();
|
||||
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);
|
||||
patternBitmap = loadScreenSizedBitmap(new FileInputStream(patternPath), 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7182,14 +7155,17 @@ public class Theme {
|
||||
}
|
||||
isCustomTheme = true;
|
||||
} else if (themedWallpaperLink != null) {
|
||||
File pathToWallpaper = new File(ApplicationLoader.getFilesDirFixed(), Utilities.MD5(themedWallpaperLink) + ".wp");
|
||||
Bitmap bitmap = BitmapFactory.decodeFile(pathToWallpaper.getAbsolutePath());
|
||||
if (bitmap != null) {
|
||||
themedWallpaper = wallpaper = new BitmapDrawable(bitmap);
|
||||
isCustomTheme = true;
|
||||
try {
|
||||
File pathToWallpaper = new File(ApplicationLoader.getFilesDirFixed(), Utilities.MD5(themedWallpaperLink) + ".wp");
|
||||
Bitmap bitmap = loadScreenSizedBitmap(new FileInputStream(pathToWallpaper), 0);
|
||||
if (bitmap != null) {
|
||||
themedWallpaper = wallpaper = new BitmapDrawable(bitmap);
|
||||
isCustomTheme = true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
} else if (themedWallpaperFileOffset > 0 && (currentTheme.pathToFile != null || currentTheme.assetName != null)) {
|
||||
FileInputStream stream = null;
|
||||
try {
|
||||
File file;
|
||||
if (currentTheme.assetName != null) {
|
||||
@ -7197,23 +7173,13 @@ public class Theme {
|
||||
} else {
|
||||
file = new File(currentTheme.pathToFile);
|
||||
}
|
||||
stream = new FileInputStream(file);
|
||||
stream.getChannel().position(themedWallpaperFileOffset);
|
||||
Bitmap bitmap = BitmapFactory.decodeStream(stream);
|
||||
Bitmap bitmap = loadScreenSizedBitmap(new FileInputStream(file), themedWallpaperFileOffset);
|
||||
if (bitmap != null) {
|
||||
themedWallpaper = wallpaper = new BitmapDrawable(bitmap);
|
||||
isCustomTheme = true;
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
FileLog.e(e);
|
||||
} finally {
|
||||
try {
|
||||
if (stream != null) {
|
||||
stream.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7246,11 +7212,14 @@ public class Theme {
|
||||
}
|
||||
} else {
|
||||
File toFile = new File(ApplicationLoader.getFilesDirFixed(), overrideWallpaper.fileName);
|
||||
long len = toFile.length();
|
||||
if (toFile.exists()) {
|
||||
wallpaper = Drawable.createFromPath(toFile.getAbsolutePath());
|
||||
isCustomTheme = true;
|
||||
} else {
|
||||
Bitmap bitmap = loadScreenSizedBitmap(new FileInputStream(toFile), 0);
|
||||
if (bitmap != null) {
|
||||
wallpaper = new BitmapDrawable(bitmap);
|
||||
isCustomTheme = true;
|
||||
}
|
||||
}
|
||||
if (wallpaper == null) {
|
||||
wallpaper = ApplicationLoader.applicationContext.getResources().getDrawable(R.drawable.background_hd);
|
||||
isCustomTheme = false;
|
||||
}
|
||||
@ -7275,6 +7244,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) {
|
||||
Integer backgroundColor = currentColors.get(key_chat_wallpaper);
|
||||
File file = null;
|
||||
|
@ -1051,7 +1051,7 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent e) {
|
||||
if (getParent() != null && getParent().getParent() != null) {
|
||||
getParent().getParent().requestDisallowInterceptTouchEvent(true);
|
||||
getParent().getParent().requestDisallowInterceptTouchEvent(canScrollHorizontally(-1));
|
||||
}
|
||||
return super.onInterceptTouchEvent(e);
|
||||
}
|
||||
|
@ -4750,6 +4750,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
radialProgress.setIcon(getIconForCurrentState(), false, false);
|
||||
}
|
||||
|
||||
if (delegate != null && delegate.getTextSelectionHelper() != null && !messageIdChanged && messageChanged && messageObject != null) {
|
||||
delegate.getTextSelectionHelper().checkDataChanged(messageObject);
|
||||
}
|
||||
accessibilityVirtualViewBounds.clear();
|
||||
}
|
||||
|
||||
|
@ -1442,14 +1442,17 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
|
||||
protected int getLineHeight() {
|
||||
if (selectedView != null && selectedView.getMessageObject() != null) {
|
||||
MessageObject object = selectedView.getMessageObject();
|
||||
StaticLayout layout;
|
||||
StaticLayout layout = null;
|
||||
if (isDescription) {
|
||||
layout = selectedView.getDescriptionlayout();
|
||||
} else if (selectedView.hasCaptionLayout()) {
|
||||
layout = selectedView.getCaptionLayout();
|
||||
} else {
|
||||
} else if (object.textLayoutBlocks != null) {
|
||||
layout = object.textLayoutBlocks.get(0).textLayout;
|
||||
}
|
||||
if (layout == null) {
|
||||
return 0;
|
||||
}
|
||||
int lineHeight = layout.getLineBottom(0) - layout.getLineTop(0);
|
||||
return lineHeight;
|
||||
}
|
||||
@ -1461,7 +1464,7 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
|
||||
this.maybeSelectedView = chatMessageCell;
|
||||
MessageObject messageObject = chatMessageCell.getMessageObject();
|
||||
|
||||
if (maybeIsDescription) {
|
||||
if (maybeIsDescription && chatMessageCell.getDescriptionlayout() != null) {
|
||||
textArea.set(
|
||||
maybeTextX, maybeTextY,
|
||||
maybeTextX + chatMessageCell.getDescriptionlayout().getWidth(),
|
||||
@ -1673,6 +1676,11 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
|
||||
return;
|
||||
}
|
||||
|
||||
if (messageObject.textLayoutBlocks == null) {
|
||||
layoutBlock.layout = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (messageObject.textLayoutBlocks.size() == 1) {
|
||||
layoutBlock.layout = messageObject.textLayoutBlocks.get(0).textLayout;
|
||||
layoutBlock.yOffset = 0;
|
||||
@ -1802,6 +1810,12 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public void checkDataChanged(MessageObject messageObject) {
|
||||
if (selectedCellId == messageObject.getId()) {
|
||||
clear(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class ArticleTextSelectionHelper extends TextSelectionHelper<ArticleSelectableView> {
|
||||
|
@ -734,7 +734,7 @@ public class ThemesHorizontalListCell extends RecyclerListView implements Notifi
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent e) {
|
||||
if (getParent() != null && getParent().getParent() != null) {
|
||||
getParent().getParent().requestDisallowInterceptTouchEvent(true);
|
||||
getParent().getParent().requestDisallowInterceptTouchEvent(canScrollHorizontally(-1));
|
||||
}
|
||||
return super.onInterceptTouchEvent(e);
|
||||
}
|
||||
|
@ -5090,7 +5090,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
updateTopPanel(false);
|
||||
updatePinnedMessageView(true);
|
||||
|
||||
chatScrollHelper = new RecyclerAnimationScrollHelper(chatListView,chatLayoutManager);
|
||||
chatScrollHelper = new RecyclerAnimationScrollHelper(chatListView, chatLayoutManager);
|
||||
chatScrollHelper.setScrollListener(() -> updateMessagesVisiblePart(false));
|
||||
chatScrollHelper.setAnimationCallback(chatScrollHelperCallback);
|
||||
|
||||
@ -7575,7 +7575,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
if (viewBottom > 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();
|
||||
boolean isVideo;
|
||||
@ -9552,7 +9552,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
}
|
||||
loading = false;
|
||||
|
||||
if (chatListView != null) {
|
||||
if (chatListView != null && chatScrollHelper != null) {
|
||||
if (first || scrollToTopOnResume || forceScrollToTop) {
|
||||
forceScrollToTop = false;
|
||||
if (!postponedScroll) {
|
||||
@ -10056,6 +10056,14 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
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) {
|
||||
chatAdapter.notifyDataSetChanged();
|
||||
}
|
||||
@ -16248,7 +16256,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
if (viewBottom > 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;
|
||||
}
|
||||
|
@ -1642,7 +1642,7 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
if (getParent() != null) {
|
||||
getParent().requestDisallowInterceptTouchEvent(true);
|
||||
getParent().requestDisallowInterceptTouchEvent(canScrollHorizontally(-1));
|
||||
}
|
||||
return super.onInterceptTouchEvent(ev);
|
||||
}
|
||||
|
@ -2591,7 +2591,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||
int lower_id = (int) dialog.id;
|
||||
if (dialog.pinned) {
|
||||
pinnedCount++;
|
||||
} else {
|
||||
} else if (!getMessagesController().isProxyDialog(dialog.id, false)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2648,7 +2648,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||
} else {
|
||||
pinnedCount++;
|
||||
}
|
||||
} else {
|
||||
} else if (!getMessagesController().isProxyDialog(dialog.id, false)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1026,7 +1026,7 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
|
||||
MapsInitializer.initialize(ApplicationLoader.applicationContext);
|
||||
mapView.getMapAsync(map1 -> {
|
||||
googleMap = map1;
|
||||
if (Theme.getCurrentTheme().isDark() || Theme.isCurrentThemeNight()) {
|
||||
if (isActiveThemeDark()) {
|
||||
currentMapStyleDark = true;
|
||||
MapStyleOptions style = MapStyleOptions.loadRawResourceStyle(ApplicationLoader.applicationContext, R.raw.mapstyle_night);
|
||||
googleMap.setMapStyle(style);
|
||||
@ -1154,6 +1154,15 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
|
||||
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() {
|
||||
if (searching) {
|
||||
if (searchInProgress) {
|
||||
@ -2052,7 +2061,7 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
|
||||
shadow.invalidate();
|
||||
|
||||
if (googleMap != null) {
|
||||
if (Theme.getCurrentTheme().isDark() || Theme.isCurrentThemeNight()) {
|
||||
if (isActiveThemeDark()) {
|
||||
if (!currentMapStyleDark) {
|
||||
currentMapStyleDark = true;
|
||||
MapStyleOptions style = MapStyleOptions.loadRawResourceStyle(ApplicationLoader.applicationContext, R.raw.mapstyle_night);
|
||||
|
@ -8938,7 +8938,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);
|
||||
canvas.drawText(hightQualityDescription, getMeasuredWidth() - sideSide - width, cy - AndroidUtilities.dp(16), textPaint);
|
||||
}
|
||||
|
@ -1532,7 +1532,7 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent e) {
|
||||
if (getParent() != null && getParent().getParent() != null) {
|
||||
getParent().getParent().requestDisallowInterceptTouchEvent(true);
|
||||
getParent().getParent().requestDisallowInterceptTouchEvent(canScrollHorizontally(-1));
|
||||
}
|
||||
return super.onInterceptTouchEvent(e);
|
||||
}
|
||||
|
@ -68,6 +68,7 @@ import org.telegram.messenger.MessagesController;
|
||||
import org.telegram.messenger.MessagesStorage;
|
||||
import org.telegram.messenger.NotificationCenter;
|
||||
import org.telegram.messenger.R;
|
||||
import org.telegram.messenger.SharedConfig;
|
||||
import org.telegram.messenger.UserConfig;
|
||||
import org.telegram.messenger.Utilities;
|
||||
import org.telegram.tgnet.ConnectionsManager;
|
||||
@ -865,15 +866,34 @@ public class ThemePreviewActivity extends BaseFragment implements DownloadContro
|
||||
String fileName = isBlurred ? theme.generateWallpaperName(null, false) : originalFileName;
|
||||
File toFile = new File(ApplicationLoader.getFilesDirFixed(), originalFileName);
|
||||
if (currentWallpaper instanceof TLRPC.TL_wallPaper) {
|
||||
try {
|
||||
FileOutputStream stream = new FileOutputStream(toFile);
|
||||
originalBitmap.compress(Bitmap.CompressFormat.JPEG, 87, stream);
|
||||
stream.close();
|
||||
done = true;
|
||||
} catch (Exception e) {
|
||||
done = false;
|
||||
FileLog.e(e);
|
||||
if (originalBitmap != null) {
|
||||
try {
|
||||
FileOutputStream stream = new FileOutputStream(toFile);
|
||||
originalBitmap.compress(Bitmap.CompressFormat.JPEG, 87, stream);
|
||||
stream.close();
|
||||
done = true;
|
||||
} catch (Exception 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) {
|
||||
TLRPC.TL_wallPaper wallPaper = (TLRPC.TL_wallPaper) currentWallpaper;
|
||||
File f = FileLoader.getPathToAttach(wallPaper.document, true);
|
||||
@ -1865,7 +1885,13 @@ public class ThemePreviewActivity extends BaseFragment implements DownloadContro
|
||||
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didSetNewWallpapper);
|
||||
}
|
||||
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));
|
||||
|
||||
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.wallpapersNeedReload);
|
||||
|
@ -1359,7 +1359,7 @@ public class WallpapersListActivity extends BaseFragment implements Notification
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent e) {
|
||||
if (getParent() != null && getParent().getParent() != null) {
|
||||
getParent().getParent().requestDisallowInterceptTouchEvent(true);
|
||||
getParent().getParent().requestDisallowInterceptTouchEvent(canScrollHorizontally(-1));
|
||||
}
|
||||
return super.onInterceptTouchEvent(e);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user