Update to 5.13.0 (1819)

This commit is contained in:
DrKLO 2019-12-31 22:46:59 +03:00
parent 471ed12003
commit cc1dc35742
24 changed files with 175 additions and 120 deletions

View File

@ -283,7 +283,7 @@ android {
}
}
defaultConfig.versionCode = 1818
defaultConfig.versionCode = 1819
applicationVariants.all { variant ->
variant.outputs.all { output ->

View File

@ -1440,10 +1440,11 @@ void ConnectionsManager::processServerResponse(TLObject *message, int64_t messag
TL_bad_server_salt *response = (TL_bad_server_salt *) message;
int64_t resultMid = response->bad_msg_id;
if (resultMid != 0) {
bool beginHandshake = false;
for (requestsIter iter = runningRequests.begin(); iter != runningRequests.end(); iter++) {
Request *request = iter->get();
if (request->datacenterId == datacenter->datacenterId && typeid(*request->rawRequest) == typeid(TL_auth_bindTempAuthKey) && request->respondsToMessageId(response->bad_msg_id)) {
datacenter->beginHandshake(HandshakeTypeCurrent, false);
if (!beginHandshake && request->datacenterId == datacenter->datacenterId && typeid(*request->rawRequest) == typeid(TL_auth_bindTempAuthKey) && request->respondsToMessageId(response->bad_msg_id)) {
beginHandshake = true;
}
if ((request->connectionType & ConnectionTypeDownload) == 0) {
continue;
@ -1454,6 +1455,9 @@ void ConnectionsManager::processServerResponse(TLObject *message, int64_t messag
request->failedBySalt = true;
}
}
if (beginHandshake) {
datacenter->beginHandshake(HandshakeTypeCurrent, false);
}
}
datacenter->clearServerSalts(media);

View File

@ -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 = 1818;
public static int BUILD_VERSION = 1819;
public static String BUILD_VERSION_STRING = "5.13.0";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";

View File

@ -24,7 +24,7 @@ public class EmojiData {
0x2197, 0x2198, 0x2199, 0x2196, 0x2195, 0x2194, 0x21AA, 0x21A9, 0x2934, 0x2935,
0x2139, 0x2714, 0x2716, 0x2611, 0x26AA, 0x26AB, 0x25AA, 0x25AB, 0x2B1B, 0x2B1C,
0x25FC, 0x25FB, 0x25FE, 0x25FD, 0x2660, 0x2663, 0x2665, 0x2666, 0x263A, 0x2639,
0x270C, 0x261D, 0x2764
0x270C, 0x261D, 0x2764, 0x2603
};
public static final char[] dataChars = {

View File

@ -1388,7 +1388,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
countLess = 0;
} else if (proximityTouched) {
if (playingMessageObject != null && !ApplicationLoader.mainInterfacePaused && (playingMessageObject.isVoice() || playingMessageObject.isRoundVideo())) {
if (!useFrontSpeaker && NotificationsController.audioManager.isWiredHeadsetOn()) {
if (!useFrontSpeaker && !NotificationsController.audioManager.isWiredHeadsetOn()) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("start listen by proximity only");
}
@ -3521,7 +3521,9 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
if (!videoConvertQueue.isEmpty()) {
MessageObject messageObject = videoConvertQueue.get(0);
synchronized (videoConvertSync) {
messageObject.videoEditedInfo.canceled = false;
if (messageObject != null && messageObject.videoEditedInfo != null) {
messageObject.videoEditedInfo.canceled = false;
}
}
Intent intent = new Intent(ApplicationLoader.applicationContext, VideoEncodingService.class);
intent.putExtra("path", messageObject.messageOwner.attachPath);
@ -3675,19 +3677,20 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
private boolean convertVideo(final MessageObject messageObject) {
if (messageObject == null || messageObject.videoEditedInfo == null) {
VideoEditedInfo info = messageObject.videoEditedInfo;
if (messageObject == null || info == null) {
return false;
}
String videoPath = messageObject.videoEditedInfo.originalPath;
long startTime = messageObject.videoEditedInfo.startTime;
long endTime = messageObject.videoEditedInfo.endTime;
int resultWidth = messageObject.videoEditedInfo.resultWidth;
int resultHeight = messageObject.videoEditedInfo.resultHeight;
int rotationValue = messageObject.videoEditedInfo.rotationValue;
int originalWidth = messageObject.videoEditedInfo.originalWidth;
int originalHeight = messageObject.videoEditedInfo.originalHeight;
int framerate = messageObject.videoEditedInfo.framerate;
int bitrate = messageObject.videoEditedInfo.bitrate;
String videoPath = info.originalPath;
long startTime = info.startTime;
long endTime = info.endTime;
int resultWidth = info.resultWidth;
int resultHeight = info.resultHeight;
int rotationValue = info.rotationValue;
int originalWidth = info.originalWidth;
int originalHeight = info.originalHeight;
int framerate = info.framerate;
int bitrate = info.bitrate;
int rotateRender = 0;
boolean isSecret = ((int) messageObject.getDialogId()) == 0;
final File cacheFile = new File(messageObject.messageOwner.attachPath);
@ -3705,9 +3708,9 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
} else if (endTime > 0) {
duration = endTime;
} else if (startTime > 0) {
duration = messageObject.videoEditedInfo.originalDuration - startTime;
duration = info.originalDuration - startTime;
} else {
duration = messageObject.videoEditedInfo.originalDuration;
duration = info.originalDuration;
}
if (framerate == 0) {
@ -3734,7 +3737,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
}
boolean needCompress = resultWidth != originalWidth || resultHeight != originalHeight || rotateRender != 0
|| messageObject.videoEditedInfo.roundVideo || Build.VERSION.SDK_INT >= 18 && startTime != -1;
|| info.roundVideo || Build.VERSION.SDK_INT >= 18 && startTime != -1;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("videoconvert", Activity.MODE_PRIVATE);
@ -3747,17 +3750,19 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
@Override
public boolean checkConversionCanceled() {
return messageObject.videoEditedInfo.canceled;
return info.canceled;
}
@Override
public void didWriteData(long availableSize, float progress) {
if (messageObject.videoEditedInfo.canceled) return;
if (info.canceled) {
return;
}
if (availableSize < 0) {
availableSize = cacheFile.length();
}
if (!messageObject.videoEditedInfo.needUpdateProgress && lastAvailableSize == availableSize) {
if (!info.needUpdateProgress && lastAvailableSize == availableSize) {
return;
}
@ -3766,7 +3771,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
}
};
messageObject.videoEditedInfo.videoConvertFirstWrite = true;
info.videoConvertFirstWrite = true;
MediaCodecVideoConvertor videoConvertor = new MediaCodecVideoConvertor();
boolean error = videoConvertor.convertVideo(videoPath, cacheFile,
@ -3778,10 +3783,10 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
callback);
boolean canceled = messageObject.videoEditedInfo.canceled;
boolean canceled = info.canceled;
if (!canceled) {
synchronized (videoConvertSync) {
canceled = messageObject.videoEditedInfo.canceled;
canceled = info.canceled;
}
}

View File

@ -3081,7 +3081,7 @@ public class MessageObject {
}
}
private static void addUrlsByPattern(boolean isOut, CharSequence charSequence, boolean botCommands, int patternType, int duration) {
public static void addUrlsByPattern(boolean isOut, CharSequence charSequence, boolean botCommands, int patternType, int duration) {
try {
Matcher matcher;
if (patternType == 3 || patternType == 4) {

View File

@ -841,13 +841,14 @@ public class MessagesController extends BaseController implements NotificationCe
TLRPC.TL_account_uploadWallPaper req = new TLRPC.TL_account_uploadWallPaper();
req.file = file;
req.mime_type = "image/jpeg";
Theme.OverrideWallpaperInfo overrideWallpaperInfo = uploadingWallpaperInfo;
final TLRPC.TL_wallPaperSettings settings = new TLRPC.TL_wallPaperSettings();
settings.blur = uploadingWallpaperInfo.isBlurred;
settings.motion = uploadingWallpaperInfo.isMotion;
settings.blur = overrideWallpaperInfo.isBlurred;
settings.motion = overrideWallpaperInfo.isMotion;
req.settings = settings;
getConnectionsManager().sendRequest(req, (response, error) -> {
TLRPC.TL_wallPaper wallPaper = (TLRPC.TL_wallPaper) response;
File path = new File(ApplicationLoader.getFilesDirFixed(), uploadingWallpaperInfo.originalFileName);
File path = new File(ApplicationLoader.getFilesDirFixed(), overrideWallpaperInfo.originalFileName);
if (wallPaper != null) {
try {
AndroidUtilities.copyFile(path, FileLoader.getPathToAttach(wallPaper.document, true));
@ -859,8 +860,8 @@ public class MessagesController extends BaseController implements NotificationCe
if (uploadingWallpaper != null && wallPaper != null) {
wallPaper.settings = settings;
wallPaper.flags |= 4;
uploadingWallpaperInfo.slug = wallPaper.slug;
uploadingWallpaperInfo.saveOverrideWallpaper();
overrideWallpaperInfo.slug = wallPaper.slug;
overrideWallpaperInfo.saveOverrideWallpaper();
ArrayList<TLRPC.WallPaper> wallpapers = new ArrayList<>();
wallpapers.add(wallPaper);
getMessagesStorage().putWallpapers(wallpapers, 2);

View File

@ -290,7 +290,7 @@ public class Browser {
builder.setToolbarColor(Theme.getColor(Theme.key_actionBarBrowser));
builder.setShowTitle(true);
builder.setActionButton(BitmapFactory.decodeResource(context.getResources(), R.drawable.abc_ic_menu_share_mtrl_alpha), LocaleController.getString("ShareFile", R.string.ShareFile), PendingIntent.getBroadcast(ApplicationLoader.applicationContext, 0, share, 0), false);
builder.setActionButton(BitmapFactory.decodeResource(context.getResources(), R.drawable.abc_ic_menu_share_mtrl_alpha), LocaleController.getString("ShareFile", R.string.ShareFile), PendingIntent.getBroadcast(ApplicationLoader.applicationContext, 0, share, 0), true);
CustomTabsIntent intent = builder.build();
intent.setUseNewTask();
intent.launchUrl(context, uri);

View File

@ -177,51 +177,9 @@ public class MediaCodecVideoConvertor {
outputFormat.setInteger(MediaFormat.KEY_FRAME_RATE, framerate);
outputFormat.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 2);
if (Build.VERSION.SDK_INT >= 23) {
int profile;
int level;
if (Math.min(resultHeight, resultWidth) >= 1080) {
profile = MediaCodecInfo.CodecProfileLevel.AVCProfileHigh;
level = MediaCodecInfo.CodecProfileLevel.AVCLevel41;
} else if (Math.min(resultHeight, resultWidth) >= 720) {
profile = MediaCodecInfo.CodecProfileLevel.AVCProfileHigh;
level = MediaCodecInfo.CodecProfileLevel.AVCLevel4;
} else if (Math.min(resultHeight, resultWidth) >= 480) {
profile = MediaCodecInfo.CodecProfileLevel.AVCProfileBaseline;
level = MediaCodecInfo.CodecProfileLevel.AVCLevel31;
} else {
profile = MediaCodecInfo.CodecProfileLevel.AVCProfileBaseline;
level = MediaCodecInfo.CodecProfileLevel.AVCLevel3;
}
MediaCodecInfo.CodecCapabilities capabilities = MediaCodecInfo.CodecCapabilities.createFromProfileLevel(MediaController.VIDEO_MIME_TYPE, profile, level);
if (capabilities == null && profile == MediaCodecInfo.CodecProfileLevel.AVCProfileHigh) {
profile = MediaCodecInfo.CodecProfileLevel.AVCProfileBaseline;
capabilities = MediaCodecInfo.CodecCapabilities.createFromProfileLevel(MediaController.VIDEO_MIME_TYPE, profile, level);
}
if (capabilities.getEncoderCapabilities() != null) {
outputFormat.setInteger(MediaFormat.KEY_PROFILE, profile);
outputFormat.setInteger(MediaFormat.KEY_LEVEL, level);
int maxBitrate = capabilities.getVideoCapabilities().getBitrateRange().getUpper();
if (bitrate > maxBitrate) {
bitrate = maxBitrate;
outputFormat.setInteger(MediaFormat.KEY_BIT_RATE, bitrate);
}
int maxFramerate = capabilities.getVideoCapabilities().getSupportedFrameRates().getUpper();
if (framerate > maxFramerate) {
framerate = maxFramerate;
outputFormat.setInteger(MediaFormat.KEY_FRAME_RATE, framerate);
}
}
} else {
if (Math.min(resultHeight, resultWidth) <= 480) {
if (bitrate > 921600) bitrate = 921600;
outputFormat.setInteger(MediaFormat.KEY_BIT_RATE, bitrate);
}
if (Build.VERSION.SDK_INT < 23 && Math.min(resultHeight, resultWidth) <= 480) {
if (bitrate > 921600) bitrate = 921600;
outputFormat.setInteger(MediaFormat.KEY_BIT_RATE, bitrate);
}
if (Build.VERSION.SDK_INT < 18) {

View File

@ -30,7 +30,6 @@ import android.widget.FrameLayout;
import android.widget.ImageView;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.R;
import org.telegram.ui.Components.FireworksEffect;
@ -172,7 +171,7 @@ public class ActionBar extends FrameLayout {
snowflakesEffect = new SnowflakesEffect();
titleTextView.invalidate();
invalidate();
} else if (BuildVars.DEBUG_PRIVATE_VERSION) {
} else {
snowflakesEffect = null;
fireworksEffect = new FireworksEffect();
titleTextView.invalidate();

View File

@ -3760,7 +3760,7 @@ public class Theme {
OverrideWallpaperInfo overrideWallpaper = new OverrideWallpaperInfo();
overrideWallpaper.color = preferences.getInt("selectedColor", 0);
overrideWallpaper.slug = preferences.getString("selectedBackgroundSlug", "");
if (id == -1 && TextUtils.isEmpty(overrideWallpaper.slug)) {
if (id >= -100 && id <= -1 && TextUtils.isEmpty(overrideWallpaper.slug)) {
overrideWallpaper.slug = COLOR_BACKGROUND_SLUG;
overrideWallpaper.fileName = "";
overrideWallpaper.originalFileName = "";
@ -4714,7 +4714,7 @@ public class Theme {
}
public static boolean deleteThemeAccent(ThemeInfo theme, ThemeAccent accent, boolean save) {
if (accent == null) {
if (accent == null || theme == null || theme.themeAccents == null) {
return false;
}
boolean current = accent.id == theme.currentAccentId;
@ -5335,7 +5335,7 @@ public class Theme {
boolean changed = false;
if (response instanceof TLRPC.TL_theme) {
TLRPC.TL_theme theme = (TLRPC.TL_theme) response;
if (theme.settings != null) {
if (accent != null && theme.settings != null) {
if (!ThemeInfo.accentEquals(accent, theme.settings)) {
File file = accent.getPathToWallpaper();
if (file != null) {
@ -5347,6 +5347,7 @@ public class Theme {
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.needSetDayNightTheme, currentTheme, currentNightTheme == currentTheme, null, -1);
}
PatternsLoader.createLoader(true);
changed = true;
}
accent.patternMotion = theme.settings.wallpaper != null && theme.settings.wallpaper.settings != null && theme.settings.wallpaper.settings.motion;
} else if (theme.document != null && theme.document.id != info.document.id) {
@ -6835,6 +6836,9 @@ public class Theme {
Integer color = currentColorsNoAccent.get(key);
if (color != null) {
ThemeAccent accent = currentTheme.getAccent(false);
if (accent == null) {
return 0;
}
float[] hsvTemp1 = getTempHsv(1);
float[] hsvTemp2 = getTempHsv(2);
Color.colorToHSV(currentTheme.accentBaseColor, hsvTemp1);

View File

@ -671,6 +671,9 @@ public class ActionIntroActivity extends BaseFragment implements LocationControl
}
private void updateColors() {
if (colors == null || imageView == null) {
return;
}
colors[0] = 0x333333;
colors[1] = Theme.getColor(Theme.key_windowBackgroundWhiteBlackText);

View File

@ -985,6 +985,8 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
layoutManager[0] = layoutManagerToUpdate;
pagesStack.remove(pagesStack.size() - 1);
currentPage = pagesStack.get(pagesStack.size() - 1);
titleTextView.setText(currentPage.site_name == null ? "" : currentPage.site_name);
}
listView[1].setVisibility(GONE);
headerView.invalidate();
@ -1923,7 +1925,7 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
boolean extraSpace = maxWidth >= 0 && innerRichText instanceof TLRPC.TL_textUrl && ((TLRPC.TL_textUrl) innerRichText).webpage_id != 0;
if (extraSpace && spannableStringBuilder.length() != 0 && spannableStringBuilder.charAt(spannableStringBuilder.length() - 1) != '\n') {
spannableStringBuilder.append(" ");
spannableStringBuilder.setSpan(new TextSelectionHelper.IngnoreCopySpanable(), spannableStringBuilder.length() - 1, spannableStringBuilder.length(), 0);
spannableStringBuilder.setSpan(new TextSelectionHelper.IgnoreCopySpannable(), spannableStringBuilder.length() - 1, spannableStringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
CharSequence innerText = getText(parentView, parentRichText, innerRichText, parentBlock, maxWidth);
@ -1943,17 +1945,17 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
span = new TextPaintUrlSpan(getTextPaint(parentRichText, lastRichText, parentBlock), url);
}
if (startLength != spannableStringBuilder.length()) {
spannableStringBuilder.setSpan(span, startLength, spannableStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
spannableStringBuilder.setSpan(span, startLength, spannableStringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
} else {
if (startLength != spannableStringBuilder.length()) {
spannableStringBuilder.setSpan(new TextPaintSpan(getTextPaint(parentRichText, lastRichText, parentBlock)), startLength, spannableStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
spannableStringBuilder.setSpan(new TextPaintSpan(getTextPaint(parentRichText, lastRichText, parentBlock)), startLength, spannableStringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
}
}
if (extraSpace && a != count - 1) {
spannableStringBuilder.append(" ");
spannableStringBuilder.setSpan(new TextSelectionHelper.IngnoreCopySpanable(), spannableStringBuilder.length() - 1, spannableStringBuilder.length(), 0);
spannableStringBuilder.setSpan(new TextSelectionHelper.IgnoreCopySpannable(), spannableStringBuilder.length() - 1, spannableStringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
}
return spannableStringBuilder;

View File

@ -70,7 +70,7 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
private int longpressDelay;
private int touchSlop;
protected Path path = new Path();
protected PathWithSavedBottom path = new PathWithSavedBottom();
protected Paint selectionPaint = new Paint();
@ -1334,7 +1334,7 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
fillLayoutForOffset(offset, layoutBlock);
StaticLayout layout = layoutBlock.layout;
if (layout == null || offset >= layout.getText().length()) {
if (layout == null || offset > layout.getText().length()) {
return tmpCoord;
}
int line = layout.getLineForOffset(offset);
@ -1387,12 +1387,11 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
private void drawLine(Canvas canvas, StaticLayout layout, int line, int start, int end) {
layout.getSelectionPath(start, end, path);
boolean rtl = layout.getParagraphDirection(line) == StaticLayout.DIR_RIGHT_TO_LEFT;
if (!rtl && layout.getSpacingAdd() > 0 && line < layout.getLineCount() - 1) {
if (path.lastBottom < layout.getLineBottom(line)) {
int lineBottom = layout.getLineBottom(line);
int lineTop = layout.getLineTop(line);
float lineH = lineBottom - lineTop;
float lineHWithoutSpaсing = (lineBottom - layout.getSpacingAdd()) - lineTop;
float lineHWithoutSpaсing = path.lastBottom - lineTop;
canvas.save();
canvas.scale(1f, lineH / lineHWithoutSpaсing, 0, lineTop);
canvas.drawPath(path, selectionPaint);
@ -2322,11 +2321,28 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
for (int k = startViewChildPosition; k <= n; k++) {
CharSequence text = textByPosition.get(i + (k << 16));
if (startViewPosition == endViewPosition && k == endViewChildPosition && k == startViewChildPosition) {
stringBuilder.append(text.subSequence(startViewOffset, endViewOffset));
int e = endViewOffset;
int s = startViewOffset;
if (s < text.length()) {
if (e > text.length()) e = text.length();
stringBuilder.append(text.subSequence(s, e));
stringBuilder.append('\n');
}
} else if (startViewPosition == endViewPosition && k == endViewChildPosition) {
CharSequence prefix = prefixTextByPosition.get(i + (k << 16));
if (prefix != null) {
stringBuilder.append(prefix).append(' ');
}
int e = endViewOffset;
if (e > text.length()) e = text.length();
stringBuilder.append(text.subSequence(0, e));
stringBuilder.append('\n');
} else if (k == startViewChildPosition) {
stringBuilder.append(text.subSequence(startViewOffset, text.length()));
stringBuilder.append('\n');
int s = startViewOffset;
if (s < text.length()) {
stringBuilder.append(text.subSequence(s, text.length()));
stringBuilder.append('\n');
}
} else {
CharSequence prefix = prefixTextByPosition.get(i + (k << 16));
if (prefix != null) {
@ -2340,14 +2356,21 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
for (int k = 0; k <= endViewChildPosition; k++) {
CharSequence text = textByPosition.get(i + (k << 16));
if (startViewPosition == endViewPosition && k == endViewChildPosition && k == startViewChildPosition) {
stringBuilder.append(text.subSequence(startViewOffset, endViewOffset));
stringBuilder.append('\n');
int e = endViewOffset;
int s = startViewOffset;
if (s < text.length()) {
if (e > text.length()) e = text.length();
stringBuilder.append(text.subSequence(s, e));
stringBuilder.append('\n');
}
} else if (k == endViewChildPosition) {
CharSequence prefix = prefixTextByPosition.get(i + (k << 16));
if (prefix != null) {
stringBuilder.append(prefix).append(' ');
}
stringBuilder.append(text.subSequence(0, endViewOffset));
int e = endViewOffset;
if (e > text.length()) e = text.length();
stringBuilder.append(text.subSequence(0, e));
stringBuilder.append('\n');
} else {
CharSequence prefix = prefixTextByPosition.get(i + (k << 16));
@ -2372,8 +2395,8 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
}
if (stringBuilder.length() > 0) {
IngnoreCopySpanable[] spans = stringBuilder.getSpans(0, stringBuilder.length() - 1, IngnoreCopySpanable.class);
for (IngnoreCopySpanable span : spans) {
IgnoreCopySpannable[] spans = stringBuilder.getSpans(0, stringBuilder.length() - 1, IgnoreCopySpannable.class);
for (IgnoreCopySpannable span : spans) {
int end = stringBuilder.getSpanEnd(span);
int start = stringBuilder.getSpanStart(span);
stringBuilder.delete(start, end);
@ -2484,7 +2507,26 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
}
}
public static class IngnoreCopySpanable {
public static class IgnoreCopySpannable {
}
private static class PathWithSavedBottom extends Path {
float lastBottom = 0;
@Override
public void reset() {
super.reset();
lastBottom = 0;
}
@Override
public void addRect(float left, float top, float right, float bottom, Direction dir) {
super.addRect(left, top, right, bottom, dir);
if (bottom > lastBottom) {
lastBottom = bottom;
}
}
}
}

View File

@ -2827,6 +2827,9 @@ public class AlertsCreator {
}
private static void processCreate(EditTextBoldCursor editText, AlertDialog alertDialog, BaseFragment fragment) {
if (fragment == null || fragment.getParentActivity() == null) {
return;
}
AndroidUtilities.hideKeyboard(editText);
Theme.ThemeInfo themeInfo = Theme.createNewTheme(editText.getText().toString());
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.themeListUpdated);

View File

@ -278,7 +278,9 @@ public class CropAreaView extends View {
canvas.drawRect(0, (int) actualRect.top, (int) actualRect.left, (int) actualRect.bottom, dimPaint);
canvas.drawRect((int) actualRect.right, (int) actualRect.top, getWidth(), (int) actualRect.bottom, dimPaint);
canvas.drawRect(0, (int) actualRect.bottom, getWidth(), getHeight(), dimPaint);
canvas.drawBitmap(circleBitmap, (int) actualRect.left, (int) actualRect.top, null);
if (circleBitmap != null) {
canvas.drawBitmap(circleBitmap, (int) actualRect.left, (int) actualRect.top, null);
}
}
}

View File

@ -667,7 +667,9 @@ public class EditTextBoldCursor extends EditText {
floatingToolbar = new FloatingToolbar(getContext(), windowView != null ? windowView : attachedToWindow, getActionModeStyle());
floatingActionMode = new FloatingActionMode(getContext(), new ActionModeCallback2Wrapper(callback), this, floatingToolbar);
floatingToolbarPreDrawListener = () -> {
floatingActionMode.updateViewLocationInWindow();
if (floatingActionMode != null) {
floatingActionMode.updateViewLocationInWindow();
}
return true;
};
callback.onCreateActionMode(floatingActionMode, floatingActionMode.getMenu());

View File

@ -99,6 +99,9 @@ public class ScrollSlidingTabStrip extends HorizontalScrollView {
layoutTransition.setAnimateParentHierarchy(false);
layoutTransition.setDuration(250);
layoutTransition.addTransitionListener(new LayoutTransition.TransitionListener() {
private boolean inTransition;
@Override
public void startTransition(LayoutTransition transition, ViewGroup container, View view, int transitionType) {
@ -106,7 +109,12 @@ public class ScrollSlidingTabStrip extends HorizontalScrollView {
@Override
public void endTransition(LayoutTransition transition, ViewGroup container, View view, int transitionType) {
if (inTransition) {
return;
}
inTransition = true;
tabsContainer.setLayoutTransition(null);
inTransition = false;
}
});
}

View File

@ -518,10 +518,14 @@ public class DialogOrContactPickerActivity extends BaseFragment {
if (scrollY != 0 && scrollY != actionBarHeight) {
if (scrollY < actionBarHeight / 2) {
viewPages[0].listView.smoothScrollBy(0, -scrollY);
viewPages[0].listView2.smoothScrollBy(0, -scrollY);
if (viewPages[0].listView2 != null) {
viewPages[0].listView2.smoothScrollBy(0, -scrollY);
}
} else {
viewPages[0].listView.smoothScrollBy(0, actionBarHeight - scrollY);
viewPages[0].listView2.smoothScrollBy(0, actionBarHeight - scrollY);
if (viewPages[0].listView2 != null) {
viewPages[0].listView2.smoothScrollBy(0, actionBarHeight - scrollY);
}
}
}
}

View File

@ -727,6 +727,9 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
int dialogIndex = dialogsAdapter.fixPosition(position);
int count = dialogsAdapter.getItemCount();
Runnable finishRunnable = () -> {
if (frozenDialogsList == null) {
return;
}
TLRPC.Dialog dialog = frozenDialogsList.remove(dialogIndex);
int pinnedNum = dialog.pinnedNum;
slidingView = null;
@ -1097,7 +1100,9 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
actionBar.setTitle(LocaleController.getString("AppName", R.string.AppName));
}
}
actionBar.setSupportsHolidayImage(true);
if (folderId == 0) {
actionBar.setSupportsHolidayImage(true);
}
}
actionBar.setTitleActionRunnable(() -> {
hideFloatingButton(false);

View File

@ -2051,16 +2051,18 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
shadowDrawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_dialogBackground), PorterDuff.Mode.MULTIPLY));
shadow.invalidate();
if (Theme.getCurrentTheme().isDark() || Theme.isCurrentThemeNight()) {
if (!currentMapStyleDark) {
currentMapStyleDark = true;
MapStyleOptions style = MapStyleOptions.loadRawResourceStyle(ApplicationLoader.applicationContext, R.raw.mapstyle_night);
googleMap.setMapStyle(style);
}
} else {
if (currentMapStyleDark) {
currentMapStyleDark = false;
googleMap.setMapStyle(null);
if (googleMap != null) {
if (Theme.getCurrentTheme().isDark() || Theme.isCurrentThemeNight()) {
if (!currentMapStyleDark) {
currentMapStyleDark = true;
MapStyleOptions style = MapStyleOptions.loadRawResourceStyle(ApplicationLoader.applicationContext, R.raw.mapstyle_night);
googleMap.setMapStyle(style);
}
} else {
if (currentMapStyleDark) {
currentMapStyleDark = false;
googleMap.setMapStyle(null);
}
}
}
};

View File

@ -6435,6 +6435,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
if (messageObject != null && !messageObject.messageOwner.entities.isEmpty()) {
Spannable spannableString = SpannableString.valueOf(caption.toString());
messageObject.addEntitiesToText(spannableString, true, false);
if (messageObject.isVideo()) {
MessageObject.addUrlsByPattern(messageObject.isOutOwner(), spannableString, false, 3, messageObject.getDuration());
}
str = Emoji.replaceEmoji(spannableString, captionTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false);
} else {
str = Emoji.replaceEmoji(new SpannableStringBuilder(caption), captionTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false);

View File

@ -569,9 +569,13 @@ public class ProxySettingsActivity extends BaseFragment {
private void updatePasteCell() {
final ClipData clip = clipboardManager.getPrimaryClip();
final String clipText;
String clipText;
if (clip != null && clip.getItemCount() > 0) {
clipText = clip.getItemAt(0).coerceToText(fragmentView.getContext()).toString();
try {
clipText = clip.getItemAt(0).coerceToText(fragmentView.getContext()).toString();
} catch (Exception e) {
clipText = null;
}
} else {
clipText = null;
}

View File

@ -895,7 +895,8 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No
return;
}
Theme.ThemeInfo themeInfo = Theme.getCurrentTheme();
if (themeInfo.themeAccents != null && !themeInfo.themeAccents.isEmpty() && themeInfo.getAccent(false).id >= 100) {
Theme.ThemeAccent accent = themeInfo.getAccent(false);
if (themeInfo.themeAccents != null && !themeInfo.themeAccents.isEmpty() && accent != null && accent.id >= 100) {
menuItem.showSubItem(share_theme);
menuItem.showSubItem(edit_theme);
} else {
@ -1583,6 +1584,9 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No
}
});
accentsListView.setOnItemLongClickListener((view12, position) -> {
if (position < 0 || position >= accentsAdapter.themeAccents.size()) {
return false;
}
Theme.ThemeAccent accent = accentsAdapter.themeAccents.get(position);
if (accent.id >= 100) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());