update to 11.1.3 (5243)

This commit is contained in:
dkaraush 2024-09-11 01:59:53 +04:00
parent cc50db9d67
commit 8558775967
58 changed files with 527 additions and 193 deletions

View file

@ -272,6 +272,7 @@ public class AndroidUtilities {
public static float density = 1;
public static Point displaySize = new Point();
public static float screenRefreshRate = 60;
public static float screenMaxRefreshRate = 60;
public static float screenRefreshTime = 1000 / screenRefreshRate;
public static int roundMessageSize;
public static int roundPlayingMessageSize;
@ -2565,6 +2566,17 @@ public class AndroidUtilities {
display.getMetrics(displayMetrics);
display.getSize(displaySize);
screenRefreshRate = display.getRefreshRate();
screenMaxRefreshRate = screenRefreshRate;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
float[] rates = display.getSupportedRefreshRates();
if (rates != null) {
for (int i = 0; i < rates.length; ++i) {
if (rates[i] > screenMaxRefreshRate) {
screenMaxRefreshRate = rates[i];
}
}
}
}
screenRefreshTime = 1000 / screenRefreshRate;
}
}
@ -2601,6 +2613,35 @@ public class AndroidUtilities {
}
}
public static void setPreferredMaxRefreshRate(Window window) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return;
if (window == null) return;
final WindowManager wm = window.getWindowManager();
if (wm == null) return;
WindowManager.LayoutParams params = window.getAttributes();
params.preferredRefreshRate = screenMaxRefreshRate;
try {
wm.updateViewLayout(window.getDecorView(), params);
} catch (Exception e) {
FileLog.e(e);
}
}
public static void setPreferredMaxRefreshRate(WindowManager wm, View windowView, WindowManager.LayoutParams params) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return;
if (wm == null) return;
if (Math.abs(params.preferredRefreshRate - screenMaxRefreshRate) > 0.2) {
params.preferredRefreshRate = screenMaxRefreshRate;
if (windowView.isAttachedToWindow()) {
try {
wm.updateViewLayout(windowView, params);
} catch (Exception e) {
FileLog.e(e);
}
}
}
}
public static double fixLocationCoord(double value) {
return ((long) (value * 1000000)) / 1000000.0;
}
@ -3505,6 +3546,9 @@ public class AndroidUtilities {
} else if (name2 != null && name2.length() != 0) {
wholeString += " " + name2;
}
if (wholeString == null) {
return "";
}
wholeString = wholeString.trim();
String lower = " " + wholeString.toLowerCase();

View file

@ -1516,6 +1516,12 @@ public class DatabaseMigrationHelper {
version = 155;
}
if (version == 155) {
database.executeFast("CREATE TABLE popular_bots(uid INTEGER PRIMARY KEY, time INTEGER, offset TEXT);").stepThis().dispose();
database.executeFast("PRAGMA user_version = 156").stepThis().dispose();
version = 156;
}
return version;
}

View file

@ -19,7 +19,6 @@ import android.os.Build;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.text.format.DateFormat;
import android.util.Log;
import android.util.Xml;
import androidx.annotation.StringRes;
@ -32,13 +31,10 @@ import org.telegram.tgnet.TLRPC;
import org.telegram.ui.RestrictedLanguagesSelectActivity;
import org.xmlpull.v1.XmlPullParser;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Calendar;
@ -1468,6 +1464,14 @@ public class LocaleController {
return formatPluralStringComma(key, plural, ',');
}
public static String formatPluralStringSpaced(String key, int plural) {
return formatPluralStringComma(key, plural, ' ');
}
public static String formatPluralStringSpaced(String key, int plural, Object... args) {
return formatPluralStringComma(key, plural, ' ', args);
}
public static String formatPluralStringComma(String key, int plural, Object... args) {
return formatPluralStringComma(key, plural, ',', args);
}

View file

@ -50,7 +50,6 @@ import android.os.Build;
import android.os.Environment;
import android.os.PowerManager;
import android.os.SystemClock;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
import android.provider.OpenableColumns;
import android.telephony.PhoneStateListener;
@ -65,8 +64,6 @@ import android.view.WindowManager;
import android.webkit.MimeTypeMap;
import android.widget.FrameLayout;
import androidx.core.content.FileProvider;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
@ -3884,7 +3881,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
recordReplyingStory = storyItem;
}
public void requestAudioFocus(boolean request) {
public void requestRecordAudioFocus(boolean request) {
if (request) {
if (!hasRecordAudioFocus && SharedConfig.pauseMusicOnRecord) {
int result = NotificationsController.audioManager.requestAudioFocus(audioRecordFocusChangedListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
@ -3902,7 +3899,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
public void prepareResumedRecording(int currentAccount, MediaDataController.DraftVoice draft, long dialogId, MessageObject replyToMsg, MessageObject replyToTopMsg, TL_stories.StoryItem replyStory, int guid, String query_shortcut, int query_shortcut_id) {
manualRecording = false;
requestAudioFocus(true);
requestRecordAudioFocus(true);
recordQueue.cancelRunnable(recordStartRunnable);
recordQueue.postRunnable(() -> {
setBluetoothScoOn(true);
@ -4033,6 +4030,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
audioToSend.attributes.add(attributeAudio);
NotificationCenter.getInstance(recordingCurrentAccount).postNotificationName(NotificationCenter.recordPaused);
NotificationCenter.getInstance(recordingCurrentAccount).postNotificationName(NotificationCenter.audioDidSent, recordingGuid, audioToSend, recordingAudioFileToSend.getAbsolutePath());
requestRecordAudioFocus(false);
});
});
} else {
@ -4050,6 +4048,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
}
AndroidUtilities.runOnUIThread(() -> {
requestRecordAudioFocus(true);
MediaDataController.getInstance(recordingCurrentAccount).pushDraftVoiceMessage(recordDialogId, recordTopicId, null);
audioRecorder = new AudioRecord(MediaRecorder.AudioSource.DEFAULT, sampleRate, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT, recordBufferSize);
@ -4071,7 +4070,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
paused = true;
}
manualRecording = manual;
requestAudioFocus(true);
requestRecordAudioFocus(true);
try {
feedbackView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
@ -4280,7 +4279,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
recordingAudioFileToSend.delete();
}
}
requestAudioFocus(false);
requestRecordAudioFocus(false);
});
});
} else {
@ -4288,7 +4287,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
if (recordingAudioFile != null) {
recordingAudioFile.delete();
}
requestAudioFocus(false);
requestRecordAudioFocus(false);
}
try {
if (audioRecorder != null) {
@ -4423,7 +4422,11 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
if (cancelled) {
break;
}
if (sourceFile.exists()) {
if (!sourceFile.exists()) {
sourceFile = FileLoader.getInstance(currentAccount.getCurrentAccount()).getPathToAttach(message.messageOwner, true);
FileLog.d("saving file: correcting path from " + path + " to " + (sourceFile == null ? null : sourceFile.getAbsolutePath()));
}
if (sourceFile != null && sourceFile.exists()) {
saveFileInternal(isMusic ? 3 : 2, sourceFile, name);
copiedFiles++;
}
@ -4519,7 +4522,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
}
String fileName = FileLoader.getAttachFileName(document);
loadingMessageObjects.put(fileName, messageObject);
currentAccount.getFileLoader().loadFile(document, messageObject, FileLoader.PRIORITY_LOW, messageObject.shouldEncryptPhotoOrVideo() ? 2 : 0);
currentAccount.getFileLoader().loadFile(document, messageObject, FileLoader.PRIORITY_HIGH, messageObject.shouldEncryptPhotoOrVideo() ? 2 : 0);
});
}

View file

@ -3609,7 +3609,6 @@ public class MessageObject {
}
message.reactions = reactions;
message.flags |= 1048576;
FileLog.d("msg#"+message.id+" updateReactions out=" + message.out);
}
public boolean hasReactions() {

View file

@ -105,7 +105,7 @@ public class MessagesStorage extends BaseController {
}
}
public final static int LAST_DB_VERSION = 155;
public final static int LAST_DB_VERSION = 156;
private boolean databaseMigrationInProgress;
public boolean showClearDatabaseAlert;
private LongSparseIntArray dialogIsForum = new LongSparseIntArray();
@ -724,6 +724,7 @@ public class MessagesStorage extends BaseController {
database.executeFast("CREATE TABLE business_links(data BLOB, order_value INTEGER);").stepThis().dispose();
database.executeFast("CREATE TABLE fact_checks(hash INTEGER PRIMARY KEY, data BLOB, expires INTEGER);").stepThis().dispose();
database.executeFast("CREATE TABLE popular_bots(uid INTEGER PRIMARY KEY, time INTEGER, offset TEXT);").stepThis().dispose();
database.executeFast("PRAGMA user_version = " + MessagesStorage.LAST_DB_VERSION).stepThis().dispose();

View file

@ -30,8 +30,10 @@ public class NotificationDismissReceiver extends BroadcastReceiver {
} else if (intent.hasExtra("storyReaction") && intent.getBooleanExtra("storyReaction", false)) {
NotificationsController.getInstance(currentAccount).processIgnoreStoryReactions();
} else if (dialogId == 0) {
FileLog.d("set dismissDate of global to " + date);
MessagesController.getNotificationsSettings(currentAccount).edit().putInt("dismissDate", date).commit();
} else {
FileLog.d("set dismissDate of " + dialogId + " to " + date);
MessagesController.getNotificationsSettings(currentAccount).edit().putInt("dismissDate" + dialogId, date).commit();
}
}

View file

@ -963,6 +963,7 @@ public class NotificationsController extends BaseController {
}
public void processNewMessages(ArrayList<MessageObject> messageObjects, boolean isLast, boolean isFcm, CountDownLatch countDownLatch) {
FileLog.d("NotificationsController: processNewMessages msgs.size()=" + (messageObjects == null ? "null" : messageObjects.size()) + " isLast=" + isLast + " isFcm=" + isFcm + ")");
if (messageObjects.isEmpty()) {
if (countDownLatch != null) {
countDownLatch.countDown();
@ -988,6 +989,7 @@ public class NotificationsController extends BaseController {
messageObject.messageOwner.action instanceof TLRPC.TL_messageActionSetMessagesTTL ||
messageObject.messageOwner.silent && (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionContactSignUp || messageObject.messageOwner.action instanceof TLRPC.TL_messageActionUserJoined)) ||
MessageObject.isTopicActionMessage(messageObject)) {
FileLog.d("skipped message because 1");
continue;
}
if (messageObject.isStoryPush) {
@ -1062,9 +1064,11 @@ public class NotificationsController extends BaseController {
getMessagesStorage().putPushMessage(messageObject);
}
}
FileLog.d("skipped message because old message with same dialog and message ids exist: did=" + did + ", mid="+mid);
continue;
}
if (edited) {
FileLog.d("skipped message because edited");
continue;
}
if (isFcm) {
@ -1077,10 +1081,12 @@ public class NotificationsController extends BaseController {
if (!isFcm) {
playInChatSound();
}
FileLog.d("skipped message because chat is already opened (openedDialogId = " + openedDialogId + ")");
continue;
}
if (messageObject.messageOwner.mentioned) {
if (!allowPinned && messageObject.messageOwner.action instanceof TLRPC.TL_messageActionPinMessage) {
FileLog.d("skipped message because message is mention of pinned");
continue;
}
dialogId = messageObject.getFromChatId();
@ -1099,6 +1105,7 @@ public class NotificationsController extends BaseController {
int notifyOverride = getNotifyOverride(preferences, dialogId, topicId);
if (notifyOverride == -1) {
value = isGlobalNotificationsEnabled(dialogId, isChannel, messageObject.isReactionPush, messageObject.isStoryReactionPush);
FileLog.d("NotificationsController: process new messages, isGlobalNotificationsEnabled("+dialogId+", "+isChannel+", "+messageObject.isReactionPush+", "+messageObject.isStoryReactionPush+") = " + value);
/*if (BuildVars.DEBUG_PRIVATE_VERSION && BuildVars.LOGS_ENABLED) {
FileLog.d("global notify settings for " + dialog_id + " = " + value);
}*/
@ -1109,6 +1116,7 @@ public class NotificationsController extends BaseController {
settingsCache.put(dialogId, value);
}
FileLog.d("NotificationsController: process new messages, value is " + value + " ("+dialogId+", "+isChannel+", "+messageObject.isReactionPush+", "+messageObject.isStoryReactionPush+")");
if (value) {
if (!isFcm) {
popup = addToPopupMessages(popupArrayAdd, messageObject, dialogId, isChannel, preferences);
@ -1162,9 +1170,11 @@ public class NotificationsController extends BaseController {
}
if (isFcm || hasScheduled) {
if (edited) {
FileLog.d("NotificationsController processNewMessages: edited branch, showOrUpdateNotification " + notifyCheck);
delayedPushMessages.clear();
showOrUpdateNotification(notifyCheck);
} else if (added) {
FileLog.d("NotificationsController processNewMessages: added branch");
MessageObject messageObject = messageObjects.get(0);
long dialog_id = messageObject.getDialogId();
long topicId = MessageObject.getTopicId(currentAccount, messageObject.messageOwner, getMessagesController().isForum(dialog_id));
@ -1210,6 +1220,7 @@ public class NotificationsController extends BaseController {
}
if (old_unread_count != total_unread_count || storiesUpdated) {
delayedPushMessages.clear();
FileLog.d("NotificationsController processNewMessages: added branch: " + notifyCheck);
showOrUpdateNotification(notifyCheck);
int pushDialogsCount = pushDialogs.size();
AndroidUtilities.runOnUIThread(() -> {
@ -3045,6 +3056,7 @@ public class NotificationsController extends BaseController {
}
private void dismissNotification() {
FileLog.d("NotificationsController dismissNotification");
try {
notificationManager.cancel(notificationId);
pushMessages.clear();
@ -4501,6 +4513,7 @@ public class NotificationsController extends BaseController {
}
private void resetNotificationSound(NotificationCompat.Builder notificationBuilder, long dialogId, long topicId, String chatName, long[] vibrationPattern, int ledColor, Uri sound, int importance, boolean isDefault, boolean isInApp, boolean isSilent, int chatType) {
FileLog.d("resetNotificationSound");
Uri defaultSound = Settings.System.DEFAULT_RINGTONE_URI;
if (defaultSound != null && sound != null && !TextUtils.equals(defaultSound.toString(), sound.toString())) {
SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
@ -4546,6 +4559,7 @@ public class NotificationsController extends BaseController {
@SuppressLint("InlinedApi")
private void showExtraNotifications(NotificationCompat.Builder notificationBuilder, String summary, long lastDialogId, long lastTopicId, String chatName, long[] vibrationPattern, int ledColor, Uri sound, int importance, boolean isDefault, boolean isInApp, boolean isSilent, int chatType) {
FileLog.d("showExtraNotifications pushMessages.size()=" + pushMessages.size());
if (Build.VERSION.SDK_INT >= 26) {
notificationBuilder.setChannelId(validateChannelId(lastDialogId, lastTopicId, chatName, vibrationPattern, ledColor, sound, importance, isDefault, isInApp, isSilent, chatType));
}
@ -4571,6 +4585,7 @@ public class NotificationsController extends BaseController {
long topicId = MessageObject.getTopicId(currentAccount, messageObject.messageOwner, getMessagesController().isForum(messageObject));
int dismissDate = preferences.getInt("dismissDate" + dialog_id, 0);
if (!messageObject.isStoryPush && messageObject.messageOwner.date <= dismissDate) {
FileLog.d("showExtraNotifications: dialog " + dialog_id + " is skipped, message date (" + messageObject.messageOwner.date + " <= " + dismissDate + ")");
continue;
}
@ -4578,6 +4593,7 @@ public class NotificationsController extends BaseController {
if (arrayList == null) {
arrayList = new ArrayList<>();
messagesByDialogs.put(dialog_id, arrayList);
FileLog.d("showExtraNotifications: sortedDialogs += " + dialog_id);
sortedDialogs.add(new DialogKey(dialog_id, topicId, false));
}
arrayList.add(messageObject);
@ -4633,11 +4649,13 @@ public class NotificationsController extends BaseController {
long selfUserId = getUserConfig().getClientUserId();
boolean waitingForPasscode = AndroidUtilities.needShowPasscode() || SharedConfig.isWaitingForPasscodeEnter;
boolean passcode = SharedConfig.passcodeHash.length() > 0;
FileLog.d("showExtraNotifications: passcode="+passcode+" waitingForPasscode=" + waitingForPasscode + " selfUserId=" + selfUserId + " useSummaryNotification=" + useSummaryNotification);
int maxCount = 7;
LongSparseArray<Person> personCache = new LongSparseArray<>();
for (int b = 0, size = sortedDialogs.size(); b < size; b++) {
if (holders.size() >= maxCount) {
FileLog.d("showExtraNotifications: break from holders, count over " + maxCount);
break;
}
DialogKey dialogKey = sortedDialogs.get(b);
@ -4649,6 +4667,7 @@ public class NotificationsController extends BaseController {
if (dialogKey.story) {
messageObjects = new ArrayList<>();
if (storyPushMessages.isEmpty()) {
FileLog.d("showExtraNotifications: ["+dialogKey.dialogId+"] continue; story but storyPushMessages is empty");
continue;
}
dialogId = storyPushMessages.get(0).dialogId;
@ -4915,6 +4934,7 @@ public class NotificationsController extends BaseController {
if (hidden) {
text.append(LocaleController.formatPluralString("StoryNotificationHidden", storiesCount));
} else if (names.isEmpty()) {
FileLog.d("showExtraNotifications: ["+dialogKey.dialogId+"] continue; story but names is empty");
continue;
} else if (names.size() == 1) {
if (storiesCount == 1) {
@ -4943,9 +4963,11 @@ public class NotificationsController extends BaseController {
}
} else {
for (int a = messageObjects.size() - 1; a >= 0; a--) {
MessageObject messageObject = messageObjects.get(a);
long messageTopicId = MessageObject.getTopicId(currentAccount, messageObject.messageOwner, getMessagesController().isForum(messageObject));
final MessageObject messageObject = messageObjects.get(a);
final boolean isForum = getMessagesController().isForum(messageObject);
final long messageTopicId = MessageObject.getTopicId(currentAccount, messageObject.messageOwner, isForum);
if (topicId != messageTopicId) {
FileLog.d("showExtraNotifications: ["+dialogKey.dialogId+"] continue; topic id is not equal: topicId=" + topicId + " messageTopicId=" + messageTopicId + "; selfId=" + getUserConfig().getClientUserId());
continue;
}
String message = getShortStringForMessage(messageObject, senderName, preview);
@ -5303,6 +5325,7 @@ public class NotificationsController extends BaseController {
if (Build.VERSION.SDK_INT >= 26) {
setNotificationChannel(mainNotification, builder, useSummaryNotification);
}
FileLog.d("showExtraNotifications: holders.add " + dialogId);
holders.add(new NotificationHolder(internalId, dialogId, dialogKey.story, topicId, name, user, chat, builder));
wearNotificationsIds.put(dialogId, internalId);
}
@ -5319,6 +5342,9 @@ public class NotificationsController extends BaseController {
}
} else {
if (openedInBubbleDialogs.isEmpty()) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("cancel summary with id " + notificationId);
}
notificationManager.cancel(notificationId);
}
}
@ -5336,6 +5362,7 @@ public class NotificationsController extends BaseController {
}
ArrayList<String> ids = new ArrayList<>(holders.size());
FileLog.d("showExtraNotifications: holders.size()=" + holders.size());
for (int a = 0, size = holders.size(); a < size; a++) {
NotificationHolder holder = holders.get(a);
ids.clear();
@ -5345,6 +5372,7 @@ public class NotificationsController extends BaseController {
ids.add(shortcutId);
}
}
FileLog.d("showExtraNotifications: holders["+a+"].call()");
holder.call();
if (!unsupportedNotificationShortcut() && !ids.isEmpty()) {
ShortcutManagerCompat.removeDynamicShortcuts(ApplicationLoader.applicationContext, ids);

View file

@ -1319,6 +1319,7 @@ public class PushListenerController {
ArrayList<MessageObject> arrayList = new ArrayList<>();
arrayList.add(messageObject);
canRelease = false;
FileLog.d("PushListenerController push notification to NotificationsController of " + messageOwner.dialog_id);
NotificationsController.getInstance(currentAccount).processNewMessages(arrayList, true, true, countDownLatch);
}
}

View file

@ -607,7 +607,7 @@ public class SharedConfig {
useSystemEmoji = preferences.getBoolean("useSystemEmoji", false);
streamMedia = preferences.getBoolean("streamMedia", true);
saveStreamMedia = preferences.getBoolean("saveStreamMedia", true);
pauseMusicOnRecord = preferences.getBoolean("pauseMusicOnRecord", false);
pauseMusicOnRecord = preferences.getBoolean("pauseMusicOnRecord", true);
pauseMusicOnMedia = preferences.getBoolean("pauseMusicOnMedia", false);
forceDisableTabletMode = preferences.getBoolean("forceDisableTabletMode", false);
streamAllVideo = preferences.getBoolean("streamAllVideo", BuildVars.DEBUG_VERSION);
@ -1682,7 +1682,7 @@ public class SharedConfig {
performanceClass = PERFORMANCE_CLASS_HIGH;
}
if (BuildVars.LOGS_ENABLED) {
FileLog.d("device performance info selected_class = " + performanceClass + " (cpu_count = " + cpuCount + ", freq = " + maxCpuFreq + ", memoryClass = " + memoryClass + ", android version " + androidVersion + ", manufacture " + Build.MANUFACTURER + ", screenRefreshRate=" + AndroidUtilities.screenRefreshRate + ")");
FileLog.d("device performance info selected_class = " + performanceClass + " (cpu_count = " + cpuCount + ", freq = " + maxCpuFreq + ", memoryClass = " + memoryClass + ", android version " + androidVersion + ", manufacture " + Build.MANUFACTURER + ", screenRefreshRate=" + AndroidUtilities.screenRefreshRate + ", screenMaxRefreshRate=" + AndroidUtilities.screenMaxRefreshRate + ")");
}
return performanceClass;

View file

@ -1532,7 +1532,9 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
FileLog.d("present fragment " + fragment.getClass().getSimpleName() + " args=" + fragment.getArguments());
}
StoryViewer.closeGlobalInstances();
if (bottomSheetTabs != null && !bottomSheetTabs.doNotDismiss) {
LaunchActivity.dismissAllWeb();
}
if (inPreviewMode && transitionAnimationPreviewMode) {
if (delayedOpenAnimationRunnable != null) {
AndroidUtilities.cancelRunOnUIThread(delayedOpenAnimationRunnable);

View file

@ -58,6 +58,7 @@ public class BottomSheetTabs extends FrameLayout {
private final Paint backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
public boolean drawTabs = true;
public boolean doNotDismiss = false;
private final ActionBarLayout actionBarLayout;
@ -141,9 +142,11 @@ public class BottomSheetTabs extends FrameLayout {
};
open.run(lastFragment);
if (tab.needsContext && (!(lastFragment instanceof ChatActivity) || ((ChatActivity) lastFragment).getDialogId() != tab.props.botId)) {
doNotDismiss = true;
BaseFragment chatActivity = ChatActivity.of(tab.props.botId);
AndroidUtilities.runOnUIThread(() -> {
lastFragment.presentFragment(chatActivity);
doNotDismiss = false;
}, 220);
}
}

View file

@ -1610,9 +1610,9 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
if (chat != null && chat.participants_count != 0) {
String membersString;
if (ChatObject.isChannel(chat) && !chat.megagroup) {
membersString = LocaleController.formatPluralStringComma("Subscribers", chat.participants_count, ' ');
membersString = LocaleController.formatPluralStringSpaced("Subscribers", chat.participants_count);
} else {
membersString = LocaleController.formatPluralStringComma("Members", chat.participants_count, ' ');
membersString = LocaleController.formatPluralStringSpaced("Members", chat.participants_count);
}
if (username instanceof SpannableStringBuilder) {
((SpannableStringBuilder) username).append(", ").append(membersString);

View file

@ -8,9 +8,7 @@
package org.telegram.ui.Adapters;
import static org.telegram.messenger.AndroidUtilities.checkAndroidTheme;
import static org.telegram.messenger.AndroidUtilities.dp;
import static org.telegram.messenger.AndroidUtilities.statusBarHeight;
import android.content.Context;
import android.graphics.Canvas;
@ -317,7 +315,7 @@ public class MessagesSearchAdapter extends RecyclerListView.SelectionAdapter imp
avatarsDrawable.setCount(actualCount);
avatarsDrawable.commitTransition(false);
titleTextView.setText(LocaleController.formatPluralString("HashtagStoriesFound", list.getCount()));
titleTextView.setText(LocaleController.formatPluralStringSpaced("HashtagStoriesFound", list.getCount()));
subtitleTextView.setText(LocaleController.formatString(R.string.HashtagStoriesFoundSubtitle, list.query));
}

View file

@ -200,6 +200,7 @@ import org.telegram.ui.Components.VideoPlayer;
import org.telegram.ui.Components.WebPlayerView;
import org.telegram.ui.Stories.DarkThemeResourceProvider;
import org.telegram.ui.Stories.recorder.ButtonWithCounterView;
import org.telegram.ui.Stories.recorder.HintView2;
import org.telegram.ui.Stories.recorder.KeyboardNotifier;
import org.telegram.ui.web.AddressBarList;
import org.telegram.ui.web.BookmarksFragment;
@ -13284,7 +13285,12 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
try {
try {
Uri uri2 = Uri.parse(url);
url = Browser.replace(uri2, null, "", Browser.IDN_toUnicode(uri2.getHost()), null);
String hostname = Browser.IDN_toUnicode(uri2.getHost());
String[] levels = hostname.split("\\.");
if (levels.length > 2 && actionBar != null && HintView2.measureCorrectly(hostname, actionBar.titlePaint) > AndroidUtilities.displaySize.x - dp(3 * 54)) {
hostname = levels[levels.length - 2] + '.' + levels[levels.length - 1];
}
url = Browser.replace(uri2, null, "", hostname, null);
} catch (Exception e) {
FileLog.e(e, false);
}

View file

@ -125,6 +125,7 @@ public class AvatarPreviewer {
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
}
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, layout, layoutParams);
windowManager.addView(layout, layoutParams);
parentContainer.requestDisallowInterceptTouchEvent(true);
visible = true;

View file

@ -320,6 +320,7 @@ public class BubbleActivity extends BasePermissionsActivity implements INavigati
@Override
public void onConfigurationChanged(android.content.res.Configuration newConfig) {
AndroidUtilities.checkDisplaySize(this, newConfig);
AndroidUtilities.setPreferredMaxRefreshRate(getWindow());
super.onConfigurationChanged(newConfig);
}

View file

@ -521,7 +521,7 @@ public class AboutLinkCell extends FrameLayout {
} : null;
if (pressedLink instanceof URLSpanNoUnderline) {
String url = ((URLSpanNoUnderline) pressedLink).getURL();
if (url.startsWith("@") || url.startsWith("#") || url.startsWith("/")) {
if (url.startsWith("@") || url.startsWith("#") || url.startsWith("$") || url.startsWith("/")) {
didPressUrl(url, currentProgress);
}
} else {

View file

@ -260,7 +260,7 @@ public class BotHelpCell extends View {
ClickableSpan span = pressedLink.getSpan();
if (span instanceof URLSpanNoUnderline) {
String url = ((URLSpanNoUnderline) span).getURL();
if (url.startsWith("@") || url.startsWith("#") || url.startsWith("/")) {
if (url.startsWith("@") || url.startsWith("#") || url.startsWith("/") || url.startsWith("$")) {
if (delegate != null) {
delegate.didPressUrl(url);
}

View file

@ -300,7 +300,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
} else {
currentPhoto = null;
}
if (currentChat.signature_profiles) {
if (currentChat.signature_profiles && messageObject.getDialogId() != UserObject.REPLY_BOT) {
long did = DialogObject.getPeerDialogId(messageObject.messageOwner.from_id);
if (did >= 0) {
TLRPC.User user = MessagesController.getInstance(messageObject.currentAccount).getUser(did);
@ -9497,7 +9497,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
botButtonsByPosition.clear();
botButtonsLayout = null;
}
if (!messageObject.isRestrictedMessage && !messageObject.isRepostPreview && currentPosition == null && (messageObject.messageOwner.reply_markup instanceof TLRPC.TL_replyInlineMarkup) && !messageObject.hasExtendedMedia()) {
if (!messageObject.isRestrictedMessage && !messageObject.isRepostPreview && (currentPosition == null || currentMessagesGroup != null && currentMessagesGroup.isDocuments && currentPosition.last) && (messageObject.messageOwner.reply_markup instanceof TLRPC.TL_replyInlineMarkup) && !messageObject.hasExtendedMedia()) {
int rows;
if (messageObject.messageOwner.reply_markup instanceof TLRPC.TL_replyInlineMarkup) {
@ -16894,7 +16894,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
if (currentUser != null) {
return UserObject.getUserName(currentUser);
} else if (currentChat != null) {
if (currentMessageObject != null && currentChat.signature_profiles) {
if (currentMessageObject != null && (currentMessageObject.getDialogId() != UserObject.REPLY_BOT) && currentChat.signature_profiles) {
long did = DialogObject.getPeerDialogId(currentMessageObject.messageOwner.from_id);
if (did >= 0) {
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(did);

View file

@ -1488,7 +1488,7 @@ public class DialogCell extends BaseCell implements StoriesListPlaceProvider.Ava
if (!isSavedDialog && user != null && user.self && !message.isOutOwner()) {
triedMessageName = AndroidUtilities.removeDiacritics(getMessageNameString());
}
if (isSavedDialog && user != null && !user.self && message != null && message.isOutOwner() || triedMessageName != null || chat != null && chat.id > 0 && fromChat == null && (!ChatObject.isChannel(chat) || ChatObject.isMegagroup(chat)) && !ForumUtilities.isTopicCreateMessage(message)) {
if (isSavedDialog && user != null && !user.self && message != null && message.isOutOwner() || triedMessageName != null || chat != null && chat.id > 0 && (fromChat == null || fromChat.id != chat.id) && (!ChatObject.isChannel(chat) || ChatObject.isMegagroup(chat)) && !ForumUtilities.isTopicCreateMessage(message)) {
messageNameString = AndroidUtilities.removeDiacritics(triedMessageName != null ? triedMessageName : getMessageNameString());
if (chat != null && chat.forum && !isTopic && !useFromUserAsAvatar) {
CharSequence topicName = MessagesController.getInstance(currentAccount).getTopicsController().getTopicIconName(chat, message, currentMessagePaint);
@ -5078,7 +5078,7 @@ public class DialogCell extends BaseCell implements StoriesListPlaceProvider.Ava
return AndroidUtilities.removeDiacritics(fromChat.title.replace("\n", ""));
}
return null;
} else if (message.isOutOwner()) {
} else if (message.isOutOwner() && fromUser != null) {
return LocaleController.getString(R.string.FromYou);
} else if (!isSavedDialog && message != null && message.messageOwner != null && message.messageOwner.from_id instanceof TLRPC.TL_peerUser && (user = MessagesController.getInstance(currentAccount).getUser(message.messageOwner.from_id.user_id)) != null) {
return AndroidUtilities.removeDiacritics(UserObject.getFirstName(user).replace("\n", ""));

View file

@ -492,7 +492,7 @@ public class ProfileSearchCell extends BaseCell implements NotificationCenter.No
if (MessagesController.isSupportUser(user)) {
statusString = LocaleController.getString(R.string.SupportStatus);
} else if (user.bot && user.bot_active_users != 0) {
statusString = LocaleController.formatPluralStringComma("BotUsers", user.bot_active_users, ' ');
statusString = LocaleController.formatPluralStringSpaced("BotUsers", user.bot_active_users);
} else if (user.bot) {
statusString = LocaleController.getString(R.string.Bot);
} else if (UserObject.isService(user.id)) {

View file

@ -26,7 +26,6 @@ import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.style.RelativeSizeSpan;
import android.util.Base64;
import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.MotionEvent;
@ -52,7 +51,6 @@ import org.telegram.messenger.ChatObject;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.messenger.UserConfig;
import org.telegram.messenger.UserObject;
@ -90,7 +88,6 @@ import org.telegram.ui.Components.UniversalRecyclerView;
import org.telegram.ui.Components.ViewPagerFixed;
import org.telegram.ui.Stars.BotStarsActivity;
import org.telegram.ui.Stars.BotStarsController;
import org.telegram.ui.Stars.StarsController;
import org.telegram.ui.Stars.StarsIntroActivity;
import org.telegram.ui.Stories.recorder.ButtonWithCounterView;
@ -471,7 +468,7 @@ public class ChannelMonetizationLayout extends SizeNotifierFrameLayout implement
AndroidUtilities.runOnUIThread(this.setStarsBalanceButtonText, 1000);
} else {
starsBalanceButton.setSubText(null, true);
starsBalanceButton.setText(StarsIntroActivity.replaceStars(starsBalanceEditTextAll ? getString(R.string.MonetizationStarsWithdrawAll) : LocaleController.formatPluralStringComma("MonetizationStarsWithdraw", (int) starsBalanceEditTextValue, ' '), starRef), true);
starsBalanceButton.setText(StarsIntroActivity.replaceStars(starsBalanceEditTextAll ? getString(R.string.MonetizationStarsWithdrawAll) : LocaleController.formatPluralStringSpaced("MonetizationStarsWithdraw", (int) starsBalanceEditTextValue), starRef), true);
}
};

View file

@ -7092,6 +7092,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
Bundle args = new Bundle();
args.putInt("type", MediaActivity.TYPE_STORIES_SEARCH);
args.putString("hashtag", messagesSearchAdapter.storiesList.query);
args.putInt("storiesCount", messagesSearchAdapter.storiesList.getCount());
presentFragment(new MediaActivity(args, null));
} else if (obj instanceof MessageObject) {
openMessageInOriginalDialog((MessageObject) obj);
@ -35401,7 +35402,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
if (!asForward && chat != null && chat.signature_profiles) {
MessageObject msg = cell.getMessageObject();
if (msg != null) {
if (msg != null && msg.getDialogId() != UserObject.REPLY_BOT) {
long did = DialogObject.getPeerDialogId(msg.messageOwner.from_id);
openUserProfile(did);
return;
@ -35915,6 +35916,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
popupLayout.addView(removeTag);
scrimPopupContainerLayout.addView(popupLayout);
} else if (messageObject != null && messageObject.messageOwner != null && messageObject.messageOwner.reactions != null && messageObject.messageOwner.reactions.can_see_list || dialog_id >= 0) {
if (reaction.reaction instanceof TLRPC.TL_reactionCustomEmoji) {
button.stopAnimation();
}
scrimPopupContainerLayout.addView(new ReactedUsersListView(getParentActivity(), themeDelegate, currentAccount, messageObject, reaction, false, false)
.setOnCustomEmojiSelectedListener((reactedUsersListView1, customEmojiStickerSets) -> {
EmojiPacksAlert alert = new EmojiPacksAlert(ChatActivity.this, getParentActivity(), themeDelegate, customEmojiStickerSets) {
@ -35946,6 +35950,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
TLRPC.TL_reactionCustomEmoji customEmoji = (TLRPC.TL_reactionCustomEmoji) reaction.reaction;
TLRPC.InputStickerSet inputStickerSet = AnimatedEmojiDrawable.getDocumentFetcher(currentAccount).findStickerSet(customEmoji.document_id);
if (inputStickerSet != null) {
button.stopAnimation();
ArrayList<TLRPC.InputStickerSet> arr = new ArrayList<TLRPC.InputStickerSet>();
arr.add(inputStickerSet);
MessageContainsEmojiButton setButton = new MessageContainsEmojiButton(currentAccount, getContext(), themeDelegate, arr, MessageContainsEmojiButton.SINGLE_REACTION_TYPE);

View file

@ -21,6 +21,7 @@ import java.util.ArrayList;
public class AvatarConstructorPreviewCell extends FrameLayout {
private AnimatedEmojiDrawable animatedEmojiDrawable;
private AnimatedEmojiDrawable nextAnimatedEmojiDrawable;
BackupImageView currentImage;
BackupImageView nextImage;
@ -37,13 +38,16 @@ public class AvatarConstructorPreviewCell extends FrameLayout {
int emojiIndex = 0;
float progressToNext = 1f;
private boolean isAllEmojiDrawablesLoaded;
Runnable scheduleSwitchToNextRunnable = new Runnable() {
@Override
public void run() {
AndroidUtilities.runOnUIThread(scheduleSwitchToNextRunnable, 1000);
if (emojiList == null || emojiList.document_id.isEmpty() || progressToNext != 1f) {
return;
}
if (!isAllEmojiDrawablesLoaded && (nextAnimatedEmojiDrawable.getImageReceiver() == null || !nextAnimatedEmojiDrawable.getImageReceiver().hasImageLoaded())) {
return;
}
emojiIndex++;
@ -68,6 +72,7 @@ public class AvatarConstructorPreviewCell extends FrameLayout {
nextBackgroundDrawable.setColors(color1, color2, color3, color4);
progressToNext = 0f;
preloadNextEmojiDrawable();
invalidate();
}
};
@ -116,6 +121,7 @@ public class AvatarConstructorPreviewCell extends FrameLayout {
if (emojiList != null && !emojiList.document_id.isEmpty()) {
animatedEmojiDrawable = new AnimatedEmojiDrawable(AnimatedEmojiDrawable.CACHE_TYPE_ALERT_PREVIEW_LARGE, currentAccount, emojiList.document_id.get(0));
currentImage.setAnimatedEmojiDrawable(animatedEmojiDrawable);
preloadNextEmojiDrawable();
}
int color1 = AvatarConstructorFragment.defaultColors[backgroundIndex][0];
@ -137,6 +143,19 @@ public class AvatarConstructorPreviewCell extends FrameLayout {
}
private void preloadNextEmojiDrawable() {
if (isAllEmojiDrawablesLoaded) {
return;
}
int nextEmojiIndex = emojiIndex + 1;
if (nextEmojiIndex > emojiList.document_id.size() - 1) {
isAllEmojiDrawablesLoaded = true;
return;
}
nextAnimatedEmojiDrawable = new AnimatedEmojiDrawable(AnimatedEmojiDrawable.CACHE_TYPE_ALERT_PREVIEW_LARGE, currentAccount, emojiList.document_id.get(nextEmojiIndex));
nextAnimatedEmojiDrawable.preload();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);

View file

@ -570,6 +570,9 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
}
};
boolean ctrlPressed = false;
boolean shiftPressed = false;
@Nullable
protected EditTextCaption messageEditText;
private SlowModeBtn slowModeButton;
@ -5087,10 +5090,12 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
messageEditTextContainer.addView(messageEditText, 1, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM, 52, 0, isChat ? 50 : 2, 1.5f));
messageEditText.setOnKeyListener(new OnKeyListener() {
boolean ctrlPressed = false;
@Override
public boolean onKey(View view, int keyCode, KeyEvent keyEvent) {
if (keyEvent != null) {
shiftPressed = keyEvent.isShiftPressed();
ctrlPressed = keyEvent.isCtrlPressed();
}
if (keyCode == KeyEvent.KEYCODE_BACK && !keyboardVisible && isPopupShowing() && keyEvent.getAction() == KeyEvent.ACTION_UP) {
if (ContentPreviewViewer.hasInstance() && ContentPreviewViewer.getInstance().isVisible()) {
ContentPreviewViewer.getInstance().closeWithMenu();
@ -5125,27 +5130,22 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
}
}
return true;
} else if (keyCode == KeyEvent.KEYCODE_ENTER && (ctrlPressed || sendByEnter) && keyEvent.getAction() == KeyEvent.ACTION_DOWN && editingMessageObject == null) {
} else if (keyCode == KeyEvent.KEYCODE_ENTER && !keyEvent.isShiftPressed() && (sendByEnter ? !keyEvent.isCtrlPressed() : keyEvent.isCtrlPressed()) && keyEvent.getAction() == KeyEvent.ACTION_DOWN && editingMessageObject == null) {
sendMessage();
return true;
} else if (keyCode == KeyEvent.KEYCODE_CTRL_LEFT || keyCode == KeyEvent.KEYCODE_CTRL_RIGHT) {
ctrlPressed = keyEvent.getAction() == KeyEvent.ACTION_DOWN;
return true;
}
return false;
}
});
messageEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
boolean ctrlPressed = false;
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
if (i == EditorInfo.IME_ACTION_SEND) {
sendMessage();
return true;
} else if (keyEvent != null && i == EditorInfo.IME_NULL) {
if ((ctrlPressed || sendByEnter) && keyEvent.getAction() == KeyEvent.ACTION_DOWN && editingMessageObject == null) {
if (!keyEvent.isShiftPressed() && (sendByEnter ? !keyEvent.isCtrlPressed() : keyEvent.isCtrlPressed()) && keyEvent.getAction() == KeyEvent.ACTION_DOWN && editingMessageObject == null) {
sendMessage();
return true;
}
@ -5204,7 +5204,7 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
if (innerTextChange == 1) {
return;
}
if (sendByEnter && !ignoreTextChange && !isPaste && editingMessageObject == null && count > before && charSequence.length() > 0 && charSequence.length() == start + count && charSequence.charAt(charSequence.length() - 1) == '\n') {
if (sendByEnter && !ctrlPressed && !shiftPressed && !ignoreTextChange && !isPaste && editingMessageObject == null && count > before && charSequence.length() > 0 && charSequence.length() == start + count && charSequence.charAt(charSequence.length() - 1) == '\n') {
nextChangeIsSend = true;
}
isPaste = false;
@ -9912,7 +9912,7 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
return;
}
WebViewRequestProps props = WebViewRequestProps.of(currentAccount, messageObject.messageOwner.dialog_id, botId, button.text, button.url, button instanceof TLRPC.TL_keyboardButtonSimpleWebView ? BotWebViewSheet.TYPE_SIMPLE_WEB_VIEW_BUTTON : BotWebViewSheet.TYPE_WEB_VIEW_BUTTON, replyMessageObject != null ? replyMessageObject.messageOwner.id : 0, false, null, false, null, null, 0, false);
final WebViewRequestProps props = WebViewRequestProps.of(currentAccount, messageObject.messageOwner.dialog_id, botId, button.text, button.url, button instanceof TLRPC.TL_keyboardButtonSimpleWebView ? BotWebViewAttachedSheet.TYPE_SIMPLE_WEB_VIEW_BUTTON : BotWebViewAttachedSheet.TYPE_WEB_VIEW_BUTTON, replyMessageObject != null ? replyMessageObject.messageOwner.id : 0, false, null, false, null, null, 0, false);
if (LaunchActivity.instance != null && LaunchActivity.instance.getBottomSheetTabs() != null && LaunchActivity.instance.getBottomSheetTabs().tryReopenTab(props) != null) {
if (botCommandsMenuButton != null) {
botCommandsMenuButton.setOpened(false);

View file

@ -3,11 +3,16 @@ package org.telegram.ui.Components;
import static org.telegram.messenger.LocaleController.getString;
import android.content.Context;
import android.database.sqlite.SQLiteStatement;
import android.text.TextUtils;
import android.view.View;
import org.telegram.SQLite.SQLiteCursor;
import org.telegram.SQLite.SQLiteDatabase;
import org.telegram.SQLite.SQLitePreparedStatement;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.DialogObject;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.MediaDataController;
import org.telegram.messenger.MessageObject;
import org.telegram.messenger.MessagesController;
@ -29,9 +34,7 @@ public class DialogsBotsAdapter extends UniversalAdapter {
private final boolean showOnlyPopular;
private final Theme.ResourcesProvider resourcesProvider;
private String popularBotsNextOffset;
private boolean popularBotsLoaded, popularBotsLoading;
public final ArrayList<TLRPC.User> popularBots = new ArrayList<>();
private final PopularBots popular;
public final ArrayList<TLRPC.User> searchMine = new ArrayList<>();
public final ArrayList<TLRPC.User> searchGlobal = new ArrayList<>();
@ -48,9 +51,9 @@ public class DialogsBotsAdapter extends UniversalAdapter {
this.folderId = folderId;
this.resourcesProvider = resourcesProvider;
this.showOnlyPopular = showOnlyPopular;
this.popular = new PopularBots(currentAccount, () -> update(true));
update(false);
MediaDataController.getInstance(currentAccount).loadHints(true);
loadPopularBots();
}
private int topPeersStart, topPeersEnd;
@ -111,20 +114,20 @@ public class DialogsBotsAdapter extends UniversalAdapter {
}
}
topPeersEnd = items.size();
if (!popularBots.isEmpty()) {
if (!popular.bots.isEmpty()) {
if (!showOnlyPopular) items.add(UItem.asGraySection(getString(R.string.SearchAppsPopular)));
for (int i = 0; i < popularBots.size(); ++i) {
final TLRPC.User user = popularBots.get(i);
for (int i = 0; i < popular.bots.size(); ++i) {
final TLRPC.User user = popular.bots.get(i);
if (uids.contains(user.id)) continue;
uids.add(user.id);
items.add(UItem.asProfileCell(user).accent());
}
if (popularBotsNextOffset != null || popularBotsLoading) {
if (popular.loading) {
items.add(UItem.asFlicker(FlickerLoadingView.PROFILE_SEARCH_CELL));
items.add(UItem.asFlicker(FlickerLoadingView.PROFILE_SEARCH_CELL));
items.add(UItem.asFlicker(FlickerLoadingView.PROFILE_SEARCH_CELL));
}
} else if (popularBotsNextOffset != null || popularBotsLoading) {
} else if (popular.loading) {
if (!showOnlyPopular) items.add(UItem.asFlicker(FlickerLoadingView.GRAY_SECTION));
items.add(UItem.asFlicker(FlickerLoadingView.PROFILE_SEARCH_CELL));
items.add(UItem.asFlicker(FlickerLoadingView.PROFILE_SEARCH_CELL));
@ -340,16 +343,18 @@ public class DialogsBotsAdapter extends UniversalAdapter {
searchMessages(true);
}
private boolean first = true;
public void checkBottom() {
if (!TextUtils.isEmpty(this.query)) {
if (hasMore && !loadingMessages && seesLoading()) {
searchMore();
}
} else {
if (!popularBotsLoading && !TextUtils.isEmpty(popularBotsNextOffset) && seesLoading()) {
loadPopularBots();
if (first || seesLoading()) {
popular.load();
}
}
first = false;
}
public boolean seesLoading() {
@ -373,27 +378,146 @@ public class DialogsBotsAdapter extends UniversalAdapter {
return false;
}
public void loadPopularBots() {
if (popularBotsLoading || popularBotsLoaded && popularBotsNextOffset == null) return;
public static class PopularBots {
private final int currentAccount;
private final Runnable whenUpdated;
public PopularBots(int currentAccount, Runnable whenUpdated) {
this.currentAccount = currentAccount;
this.whenUpdated = whenUpdated;
}
public boolean loading;
private boolean cacheLoaded;
private boolean endReached;
private long cacheTime;
private String lastOffset;
public final ArrayList<TLRPC.User> bots = new ArrayList<>();
private void loadCache(Runnable whenDone) {
final MessagesStorage storage = MessagesStorage.getInstance(currentAccount);
storage.getStorageQueue().postRunnable(() -> {
long time = 0;
String offset = null;
final ArrayList<TLRPC.User> users = new ArrayList<>();
final ArrayList<Long> userIds = new ArrayList<>();
final SQLiteDatabase db = storage.getDatabase();
SQLiteCursor cursor = null;
try {
cursor = db.queryFinalized("SELECT uid, time, offset FROM popular_bots");
while (cursor.next()) {
userIds.add(cursor.longValue(0));
time = Math.max(time, cursor.longValue(1));
offset = cursor.stringValue(2);
}
cursor.dispose();
users.addAll(storage.getUsers(userIds));
} catch (Exception e) {
FileLog.e(e);
} finally {
if (cursor != null) {
cursor.dispose();
}
}
final long finalTime = time;
final String finalOffset = offset;
AndroidUtilities.runOnUIThread(() -> {
MessagesController.getInstance(currentAccount).putUsers(users, true);
bots.addAll(users);
this.cacheTime = finalTime;
this.lastOffset = finalOffset;
this.cacheLoaded = true;
whenDone.run();
});
});
}
private boolean savingCache = false;
private void saveCache() {
if (savingCache) return;
savingCache = true;
final long time = cacheTime;
final String offset = lastOffset;
final ArrayList<Long> ids = new ArrayList<>();
for (int i = 0; i < bots.size(); ++i) {
ids.add(bots.get(i).id);
}
final MessagesStorage storage = MessagesStorage.getInstance(currentAccount);
storage.getStorageQueue().postRunnable(() -> {
final SQLiteDatabase db = storage.getDatabase();
SQLitePreparedStatement state = null;
try {
db.executeFast("DELETE FROM popular_bots").stepThis().dispose();
state = db.executeFast("REPLACE INTO popular_bots VALUES(?, ?, ?)");
for (int i = 0; i < ids.size(); i++) {
state.requery();
state.bindLong(1, ids.get(i));
state.bindLong(2, time);
state.bindString(3, offset);
state.step();
}
} catch (Exception e) {
FileLog.e(e);
} finally {
if (state != null) {
state.dispose();
}
}
AndroidUtilities.runOnUIThread(() -> {
savingCache = false;
});
});
}
public void load() {
if (loading || endReached) return;
loading = true;
if (!cacheLoaded) {
loadCache(() -> {
loading = false;
whenUpdated.run();
if (System.currentTimeMillis() - cacheTime > 60 * 60 * 1000) {
bots.clear();
load();
}
});
return;
}
popularBotsLoading = true;
TL_bots.getPopularAppBots req = new TL_bots.getPopularAppBots();
req.offset = popularBotsNextOffset == null ? "" : popularBotsNextOffset;
req.limit = 20;
req.offset = lastOffset == null ? "" : lastOffset;
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> {
popularBotsLoading = false;
popularBotsLoaded = true;
if (res instanceof TL_bots.popularAppBots) {
TL_bots.popularAppBots r = (TL_bots.popularAppBots) res;
MessagesController.getInstance(currentAccount).putUsers(r.users, false);
popularBots.addAll(r.users);
popularBotsNextOffset = r.next_offset;
MessagesStorage.getInstance(currentAccount).putUsersAndChats(r.users, null, false, true);
bots.addAll(r.users);
lastOffset = r.next_offset;
endReached = lastOffset == null;
cacheTime = System.currentTimeMillis();
saveCache();
loading = false;
whenUpdated.run();
} else {
popularBotsNextOffset = null;
lastOffset = null;
endReached = true;
loading = false;
whenUpdated.run();
}
update(true);
}));
}
}

View file

@ -694,7 +694,7 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
if (cancelled) {
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.audioRecordTooShort, recordingGuid, true, (int) recordedTime);
startAnimation(false, false);
MediaController.getInstance().requestAudioFocus(false);
MediaController.getInstance().requestRecordAudioFocus(false);
} else {
videoEncoder.pause();
}
@ -765,8 +765,8 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
if (MediaController.getInstance().getPlayingMessageObject() != null) {
if (MediaController.getInstance().getPlayingMessageObject().isVideo() || MediaController.getInstance().getPlayingMessageObject().isRoundVideo()) {
MediaController.getInstance().cleanupPlayer(true, true);
} else {
MediaController.getInstance().pauseMessage(MediaController.getInstance().getPlayingMessageObject());
} else if (SharedConfig.pauseMusicOnRecord) {
MediaController.getInstance().pauseByRewind();
}
}
@ -874,7 +874,7 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
setVisibility(VISIBLE);
startAnimation(true, fromPaused);
MediaController.getInstance().requestAudioFocus(true);
MediaController.getInstance().requestRecordAudioFocus(true);
}
public InstantViewCameraContainer getCameraContainer() {
@ -1020,7 +1020,7 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
if (scheduleDate != 0) {
startAnimation(false, false);
}
MediaController.getInstance().requestAudioFocus(false);
MediaController.getInstance().requestRecordAudioFocus(false);
} else {
cancelled = recordedTime < 800;
recording = false;
@ -1049,7 +1049,7 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
if (cancelled) {
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.audioRecordTooShort, recordingGuid, true, (int) recordedTime);
startAnimation(false, false);
MediaController.getInstance().requestAudioFocus(false);
MediaController.getInstance().requestRecordAudioFocus(false);
}
}
}
@ -1101,7 +1101,7 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
AutoDeleteMediaTask.unlockFile(cameraFile);
cameraFile = null;
}
MediaController.getInstance().requestAudioFocus(false);
MediaController.getInstance().requestRecordAudioFocus(false);
startAnimation(false, false);
blurBehindDrawable.show(false);
invalidate();
@ -1129,7 +1129,7 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
textureOverlayView.setTranslationX(0);
animationTranslationY = 0;
updateTranslationY();
MediaController.getInstance().playMessage(MediaController.getInstance().getPlayingMessageObject());
MediaController.getInstance().resumeByRewind();
if (textureView != null) {
ViewGroup parent = (ViewGroup) textureView.getParent();
@ -3106,7 +3106,7 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
videoEditedInfo.notReadyYet = false;
}
didWriteData(videoFile, 0, true);
MediaController.getInstance().requestAudioFocus(false);
MediaController.getInstance().requestRecordAudioFocus(false);
});
}
EGL14.eglDestroySurface(eglDisplay, eglSurface);
@ -3633,7 +3633,7 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
" float radius = 0.51 * resolution.x;\n" +
" float d = length(coord - gl_FragCoord.xy) - radius;\n" +
" float t = clamp(d, 0.0, 1.0);\n" +
" vec3 color = mix(textColor.rgb, vec3(0, 0, 0), t);\n" +
" vec3 color = mix(textColor.rgb, vec3(1, 1, 1), t);\n" +
" gl_FragColor = vec4(color * alpha, alpha);\n" +
"}\n";
}
@ -3669,7 +3669,7 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
" vec4 x2 = mix(bl, br, frac.x);\n" +
" gl_FragColor = mix(x1, x2, frac.y) * alpha;" +
" } else {\n" +
" gl_FragColor = vec4(0, 0, 0, alpha);\n" +
" gl_FragColor = vec4(1, 1, 1, alpha);\n" +
" }\n" +
"}\n";
}

View file

@ -78,6 +78,7 @@ public class MediaActivity extends BaseFragment implements SharedMediaLayout.Sha
private long dialogId;
private long topicId;
private String hashtag;
private int storiesCount;
private FrameLayout titlesContainer;
private FrameLayout[] titles = new FrameLayout[2];
private SimpleTextView[] nameTextView = new SimpleTextView[2];
@ -113,6 +114,7 @@ public class MediaActivity extends BaseFragment implements SharedMediaLayout.Sha
dialogId = getArguments().getLong("dialog_id");
topicId = getArguments().getLong("topic_id", 0);
hashtag = getArguments().getString("hashtag", "");
storiesCount = getArguments().getInt("storiesCount", -1);
int defaultTab = SharedMediaLayout.TAB_PHOTOVIDEO;
if (type == TYPE_ARCHIVED_CHANNEL_STORIES) {
defaultTab = SharedMediaLayout.TAB_ARCHIVED_STORIES;
@ -343,9 +345,6 @@ public class MediaActivity extends BaseFragment implements SharedMediaLayout.Sha
boolean hasAvatar = type == TYPE_MEDIA;
if (type == TYPE_STORIES_SEARCH) {
actionBar.setTitle(hashtag);
} else {
titlesContainer = new FrameLayout(context);
avatarContainer.addView(titlesContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.FILL));
for (int i = 0; i < (type == TYPE_STORIES ? 2 : 1); ++i) {
@ -374,7 +373,6 @@ public class MediaActivity extends BaseFragment implements SharedMediaLayout.Sha
titles[i].setAlpha(0f);
}
}
}
avatarImageView = new ProfileActivity.AvatarImageView(context) {
@Override
@ -754,7 +752,10 @@ public class MediaActivity extends BaseFragment implements SharedMediaLayout.Sha
}
TLObject avatarObject = null;
if (type == TYPE_STORIES_SEARCH) {
nameTextView[0].setText(hashtag);
if (storiesCount != -1) {
subtitleTextView[0].setText(LocaleController.formatPluralStringSpaced("FoundStories", storiesCount));
}
} else if (type == TYPE_ARCHIVED_CHANNEL_STORIES) {
nameTextView[0].setText(LocaleController.getString("ProfileStoriesArchive"));
} else if (type == TYPE_STORIES) {
@ -868,6 +869,9 @@ public class MediaActivity extends BaseFragment implements SharedMediaLayout.Sha
return;
}
int id = sharedMediaLayout.getClosestTab();
if (type == TYPE_STORIES_SEARCH && id != SharedMediaLayout.TAB_STORIES) {
return;
}
int[] mediaCount = sharedMediaPreloader.getLastMediaCount();
final boolean animated = !LocaleController.isRTL;
int i;
@ -888,8 +892,15 @@ public class MediaActivity extends BaseFragment implements SharedMediaLayout.Sha
int count = sharedMediaLayout.getStoriesCount(SharedMediaLayout.TAB_STORIES);
if (count > 0) {
if (type == TYPE_STORIES_SEARCH) {
if (TextUtils.isEmpty(subtitleTextView[0].getText())) {
showSubtitle(0, true, true);
subtitleTextView[0].setText(LocaleController.formatPluralStringSpaced("FoundStories", count), animated);
}
} else {
showSubtitle(0, true, true);
subtitleTextView[0].setText(LocaleController.formatPluralString("ProfileMyStoriesCount", count), animated);
}
} else {
showSubtitle(0, false, true);
}

View file

@ -290,6 +290,7 @@ public class PipRoundVideoView implements NotificationCenter.NotificationCenterD
windowLayoutParams.gravity = Gravity.TOP | Gravity.LEFT;
windowLayoutParams.type = WindowManager.LayoutParams.LAST_APPLICATION_WINDOW;
windowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, windowView, windowLayoutParams);
windowManager.addView(windowView, windowLayoutParams);
} catch (Exception e) {
FileLog.e(e);

View file

@ -928,6 +928,7 @@ public class PipVideoOverlay {
protected void onConfigurationChanged(Configuration newConfig) {
AndroidUtilities.checkDisplaySize(getContext(), newConfig);
pipConfig = null;
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, contentView, windowLayoutParams);
if (pipWidth != getSuggestedWidth() * scaleFactor || pipHeight != getSuggestedHeight() * scaleFactor) {
windowLayoutParams.width = pipWidth = (int) (getSuggestedWidth() * scaleFactor);
@ -1127,6 +1128,7 @@ public class PipVideoOverlay {
windowLayoutParams.dimAmount = 0f;
windowLayoutParams.flags = FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, contentView, windowLayoutParams);
// Animate is a flag for PhotoViewer transition, not ours
if (animate) {
windowManager.addView(contentView, windowLayoutParams);

View file

@ -342,7 +342,7 @@ public class GiveawayResultsMessageCell {
}
isStars = (giveaway.flags & 32) != 0;
if (isStars) {
bottomStringBuilder.append(LocaleController.formatPluralStringComma("BoostingStarsGiveawayResultsMsgAllWinnersReceivedLinks", (int) giveaway.stars, ' '));
bottomStringBuilder.append(LocaleController.formatPluralStringSpaced("BoostingStarsGiveawayResultsMsgAllWinnersReceivedLinks", (int) giveaway.stars));
} else {
bottomStringBuilder.append(LocaleController.getString(R.string.BoostingGiveawayResultsMsgAllWinnersReceivedLinks));
}

View file

@ -291,6 +291,7 @@ public class CustomEmojiReactionsWindow {
} else {
WindowManager.LayoutParams lp = createLayoutParams(false);
windowManager = AndroidUtilities.findActivity(context).getWindowManager();
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, windowView, lp);
windowManager.addView(windowView, lp);
}

View file

@ -756,6 +756,7 @@ public class ReactionsEffectOverlay {
lp.format = PixelFormat.TRANSLUCENT;
reactionsEffectOverlay.windowManager = baseFragment.getParentActivity().getWindowManager();
AndroidUtilities.setPreferredMaxRefreshRate(reactionsEffectOverlay.windowManager, reactionsEffectOverlay.windowView, lp);
reactionsEffectOverlay.windowManager.addView(reactionsEffectOverlay.windowView, lp);
} else {
reactionsEffectOverlay.decorView = (FrameLayout) baseFragment.getParentActivity().getWindow().getDecorView();

View file

@ -1216,6 +1216,25 @@ public class ReactionsLayoutInBubble {
}
}
public void stopAnimation() {
ImageReceiver imageReceiver;
if (animatedEmojiDrawable != null && animatedEmojiDrawable.getImageReceiver() != null) {
imageReceiver = animatedEmojiDrawable.getImageReceiver();
} else {
imageReceiver = this.imageReceiver;
}
if (imageReceiver != null) {
RLottieDrawable rLottieDrawable = imageReceiver.getLottieAnimation();
if (rLottieDrawable != null) {
rLottieDrawable.stop();
} else {
AnimatedFileDrawable animatedFileDrawable = imageReceiver.getAnimation();
if (animatedFileDrawable != null) {
animatedFileDrawable.stop();
}
}
}
}
public ImageReceiver previewImageReceiver;
public AnimatedEmojiDrawable previewAnimatedEmojiDrawable;

View file

@ -481,6 +481,9 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie
// MessagesController.getInstance(currentAccount).getChannelRecommendations(0);
botsSearchAdapter.search(query);
botsEmptyView.setKeyboardHeight(keyboardSize, false);
if (TextUtils.isEmpty(query)) {
botsSearchAdapter.checkBottom();
}
} else if (view == searchContainer) {
if (dialogId == 0 && minDate == 0 && maxDate == 0 || forumDialogId != 0) {
lastSearchScrolledToTop = false;

View file

@ -274,6 +274,7 @@ public class SenderSelectPopup extends ActionBarPopupWindow {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
params.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
}
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, bulletinContainer, params);
windowManager.addView(bulletinContainer, params);
}

View file

@ -1517,6 +1517,7 @@ public class ThemeEditorView {
windowLayoutParams.gravity = Gravity.TOP | Gravity.LEFT;
windowLayoutParams.type = WindowManager.LayoutParams.LAST_APPLICATION_WINDOW;
windowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, windowView, windowLayoutParams);
windowManager.addView(windowView, windowLayoutParams);
} catch (Exception e) {
FileLog.e(e);
@ -1608,6 +1609,7 @@ public class ThemeEditorView {
if (parentActivity == null) {
return;
}
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, windowView, windowLayoutParams);
try {
windowManager.addView(windowView, windowLayoutParams);
hidden = false;

View file

@ -1134,6 +1134,9 @@ public class TranslateAlert2 extends BottomSheet implements NotificationCenter.N
}
public static TranslateAlert2 showAlert(Context context, BaseFragment fragment, int currentAccount, String fromLanguage, String toLanguage, CharSequence text, ArrayList<TLRPC.MessageEntity> entities, boolean noforwards, Utilities.CallbackReturn<URLSpan, Boolean> onLinkPress, Runnable onDismiss) {
if (context == null) {
return null;
}
TranslateAlert2 alert = new TranslateAlert2(context, fromLanguage, toLanguage, text, entities, null) {
@Override
public void dismiss() {

View file

@ -846,7 +846,7 @@ public class UniversalAdapter extends AdapterWithDiffUtils {
if (item.accent && object instanceof TLRPC.User && ((TLRPC.User) object).bot_active_users != 0) { // show bot dau
TLRPC.User user = (TLRPC.User) object;
if (user.bot_active_users != 0) {
s = LocaleController.formatPluralStringComma("BotUsers", user.bot_active_users, ' ');
s = LocaleController.formatPluralStringSpaced("BotUsers", user.bot_active_users);
}
} else if (item.withUsername) {
String username = null;
@ -865,9 +865,9 @@ public class UniversalAdapter extends AdapterWithDiffUtils {
if (chat.participants_count != 0) {
String membersString;
if (ChatObject.isChannel(chat) && !chat.megagroup) {
membersString = LocaleController.formatPluralStringComma("Subscribers", chat.participants_count, ' ');
membersString = LocaleController.formatPluralStringSpaced("Subscribers", chat.participants_count);
} else {
membersString = LocaleController.formatPluralStringComma("Members", chat.participants_count, ' ');
membersString = LocaleController.formatPluralStringSpaced("Members", chat.participants_count);
}
if (s instanceof SpannableStringBuilder) {
((SpannableStringBuilder) s).append(", ").append(membersString);

View file

@ -462,6 +462,7 @@ public class RTMPStreamPipOverlay implements NotificationCenter.NotificationCent
@Override
protected void onConfigurationChanged(Configuration newConfig) {
AndroidUtilities.checkDisplaySize(getContext(), newConfig);
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, contentView, windowLayoutParams);
bindTextureView();
}
@ -612,6 +613,7 @@ public class RTMPStreamPipOverlay implements NotificationCenter.NotificationCent
contentView.setAlpha(0f);
contentView.setScaleX(0.1f);
contentView.setScaleY(0.1f);
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, contentView, windowLayoutParams);
windowManager.addView(contentView, windowLayoutParams);
AnimatorSet set = new AnimatorSet();

View file

@ -687,6 +687,7 @@ public class VoIPPiPView implements VoIPService.StateListener, NotificationCente
layoutParams.x = (int) (windowLayoutParams.x - (widthExpanded - widthNormal) * cX);
layoutParams.y = (int) (windowLayoutParams.y - (heightExpanded - heightNormal) * cY);
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, pipViewExpanded.windowView, layoutParams);
windowManager.addView(pipViewExpanded.windowView, layoutParams);
pipViewExpanded.windowView.setAlpha(1f);
pipViewExpanded.windowLayoutParams = layoutParams;
@ -784,6 +785,7 @@ public class VoIPPiPView implements VoIPService.StateListener, NotificationCente
}
swapRender(expandedInstance, instance);
instance.windowView.setAlpha(1f);
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, instance.windowView, instance.windowLayoutParams);
windowManager.addView(instance.windowView, instance.windowLayoutParams);
AndroidUtilities.runOnUIThread(() -> {
if (instance == null || expandedInstance == null) {

View file

@ -9,6 +9,7 @@
package org.telegram.ui;
import static org.telegram.messenger.AndroidUtilities.dp;
import static org.telegram.messenger.LocaleController.formatPluralStringComma;
import static org.telegram.messenger.LocaleController.formatString;
import static org.telegram.messenger.LocaleController.getString;
@ -5860,7 +5861,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
updateDialogsHint();
}).show();
});
dialogsHintCell.setText(StarsIntroActivity.replaceStarsWithPlain(formatString(R.string.StarsSubscriptionExpiredHintTitle, starsNeeded - c.balance <= 0 ? starsNeeded : starsNeeded - c.balance, starsNeededName), .72f), LocaleController.getString(R.string.StarsSubscriptionExpiredHintText));
dialogsHintCell.setText(StarsIntroActivity.replaceStarsWithPlain(formatPluralStringComma("StarsSubscriptionExpiredHintTitle2", (int) (starsNeeded - c.balance <= 0 ? starsNeeded : starsNeeded - c.balance), starsNeededName), .72f), LocaleController.getString(R.string.StarsSubscriptionExpiredHintText));
dialogsHintCell.setOnCloseListener(v -> {
MessagesController.getInstance(currentAccount).removeSuggestion(0, "STARS_SUBSCRIPTION_LOW_BALANCE");
ChangeBounds transition = new ChangeBounds();

View file

@ -601,6 +601,7 @@ public class ExternalActionActivity extends Activity implements INavigationLayou
@Override
public void onConfigurationChanged(android.content.res.Configuration newConfig) {
AndroidUtilities.checkDisplaySize(this, newConfig);
AndroidUtilities.setPreferredMaxRefreshRate(getWindow());
super.onConfigurationChanged(newConfig);
fixLayout();
}

View file

@ -6481,6 +6481,7 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
@Override
public void onConfigurationChanged(Configuration newConfig) {
AndroidUtilities.checkDisplaySize(this, newConfig);
AndroidUtilities.setPreferredMaxRefreshRate(getWindow());
super.onConfigurationChanged(newConfig);
checkLayout();
PipRoundVideoView pipRoundVideoView = PipRoundVideoView.getInstance();

View file

@ -536,6 +536,7 @@ public class PopupNotificationActivity extends Activity implements NotificationC
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
AndroidUtilities.checkDisplaySize(this, newConfig);
AndroidUtilities.setPreferredMaxRefreshRate(getWindow());
fixLayout();
}

View file

@ -12574,7 +12574,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
private void openUrl(String url, Browser.Progress progress) {
if (url.startsWith("@")) {
getMessagesController().openByUserName(url.substring(1), ProfileActivity.this, 0, progress);
} else if (url.startsWith("#")) {
} else if (url.startsWith("#") || url.startsWith("$")) {
DialogsActivity fragment = new DialogsActivity(null);
fragment.setSearchString(url);
presentFragment(fragment);

View file

@ -38,6 +38,7 @@ public class ShareActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
ApplicationLoader.postInitApplication();
AndroidUtilities.checkDisplaySize(this, getResources().getConfiguration());
AndroidUtilities.setPreferredMaxRefreshRate(getWindow());
requestWindowFeature(Window.FEATURE_NO_TITLE);
setTheme(R.style.Theme_TMessages_Transparent);
super.onCreate(savedInstanceState);

View file

@ -1,10 +1,7 @@
package org.telegram.ui.Stars;
import static org.telegram.messenger.AndroidUtilities.dp;
import static org.telegram.messenger.AndroidUtilities.dpf2;
import static org.telegram.messenger.LocaleController.formatPluralString;
import static org.telegram.messenger.LocaleController.getString;
import static org.telegram.ui.ActionBar.Theme.key_statisticChartLine_golden;
import android.app.Activity;
import android.content.Context;
@ -12,28 +9,23 @@ import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.Editable;
import android.text.InputType;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.method.PasswordTransformationMethod;
import android.text.style.RelativeSizeSpan;
import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Space;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.view.NestedScrollingParent3;
import androidx.core.view.NestedScrollingParentHelper;
import androidx.core.view.ViewCompat;
@ -51,25 +43,19 @@ import org.telegram.messenger.UserConfig;
import org.telegram.messenger.UserObject;
import org.telegram.messenger.browser.Browser;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.TLObject;
import org.telegram.tgnet.TLRPC;
import org.telegram.tgnet.tl.TL_stats;
import org.telegram.ui.ActionBar.ActionBar;
import org.telegram.ui.ActionBar.AlertDialog;
import org.telegram.ui.ActionBar.BackDrawable;
import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.ChannelMonetizationLayout;
import org.telegram.ui.Charts.data.ChartData;
import org.telegram.ui.Components.AnimatedTextView;
import org.telegram.ui.Components.Bulletin;
import org.telegram.ui.Components.BulletinFactory;
import org.telegram.ui.Components.ChatAvatarContainer;
import org.telegram.ui.Components.CircularProgressDrawable;
import org.telegram.ui.Components.ColoredImageSpan;
import org.telegram.ui.Components.CubicBezierInterpolator;
import org.telegram.ui.Components.EditTextBoldCursor;
import org.telegram.ui.Components.FlickerLoadingView;
import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.Components.OutlineTextContainerView;
import org.telegram.ui.Components.RecyclerListView;
@ -77,16 +63,12 @@ import org.telegram.ui.Components.SizeNotifierFrameLayout;
import org.telegram.ui.Components.UItem;
import org.telegram.ui.Components.UniversalAdapter;
import org.telegram.ui.Components.UniversalRecyclerView;
import org.telegram.ui.GradientHeaderActivity;
import org.telegram.ui.StatisticActivity;
import org.telegram.ui.Stories.recorder.ButtonWithCounterView;
import org.telegram.ui.TwoStepVerificationActivity;
import org.telegram.ui.TwoStepVerificationSetupActivity;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
public class BotStarsActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
@ -460,7 +442,7 @@ public class BotStarsActivity extends BaseFragment implements NotificationCenter
AndroidUtilities.runOnUIThread(this.setBalanceButtonText, 1000);
} else {
balanceButton.setSubText(null, true);
balanceButton.setText(StarsIntroActivity.replaceStars(balanceEditTextAll ? getString(R.string.BotStarsButtonWithdrawShortAll) : LocaleController.formatPluralStringComma("BotStarsButtonWithdrawShort", (int) balanceEditTextValue, ' '), starRef), true);
balanceButton.setText(StarsIntroActivity.replaceStars(balanceEditTextAll ? getString(R.string.BotStarsButtonWithdrawShortAll) : LocaleController.formatPluralStringSpaced("BotStarsButtonWithdrawShort", (int) balanceEditTextValue), starRef), true);
}
};

View file

@ -3,6 +3,7 @@ package org.telegram.ui.Stars;
import static org.telegram.messenger.AndroidUtilities.dp;
import static org.telegram.messenger.LocaleController.formatPluralString;
import static org.telegram.messenger.LocaleController.formatPluralStringComma;
import static org.telegram.messenger.LocaleController.formatPluralStringSpaced;
import static org.telegram.messenger.LocaleController.formatString;
import static org.telegram.messenger.LocaleController.getString;
import static org.telegram.ui.Stars.StarsIntroActivity.StarsTransactionView.getPlatformDrawable;
@ -54,9 +55,6 @@ import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.exoplayer2.scheduler.RequirementsWatcher;
import com.google.common.collect.Lists;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.BillingController;
import org.telegram.messenger.BirthdayController;
@ -118,7 +116,6 @@ import org.telegram.ui.Components.RLottieDrawable;
import org.telegram.ui.Components.RecyclerListView;
import org.telegram.ui.Components.ScaleStateListAnimator;
import org.telegram.ui.Components.StarAppsSheet;
import org.telegram.ui.Components.TableLayout;
import org.telegram.ui.Components.TableView;
import org.telegram.ui.Components.Text;
import org.telegram.ui.Components.UItem;
@ -135,7 +132,6 @@ import org.telegram.ui.Stories.recorder.ButtonWithCounterView;
import org.telegram.ui.Stories.recorder.HintView2;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
@ -823,7 +819,7 @@ public class StarsIntroActivity extends GradientHeaderActivity implements Notifi
item.id = id;
item.intValue = index;
item.longValue = option.stars;
item.text = formatPluralStringComma("StarsCount", (int) option.stars, ' ');
item.text = formatPluralStringSpaced("StarsCount", (int) option.stars);
item.subtext = option.loadingStorePrice ? null : BillingController.getInstance().formatCurrency(option.amount, option.currency);
item.object = option;
return item;
@ -834,7 +830,7 @@ public class StarsIntroActivity extends GradientHeaderActivity implements Notifi
item.id = id;
item.intValue = index;
item.longValue = option.stars;
item.text = formatPluralStringComma("StarsCount", (int) option.stars, ' ');
item.text = formatPluralStringSpaced("StarsCount", (int) option.stars);
item.subtext = option.loadingStorePrice ? null : BillingController.getInstance().formatCurrency(option.amount, option.currency);
item.object = option;
return item;
@ -3654,7 +3650,7 @@ public class StarsIntroActivity extends GradientHeaderActivity implements Notifi
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);
textView.setTypeface(AndroidUtilities.bold());
textView.setGravity(Gravity.CENTER);
textView.setText(LocaleController.formatPluralStringComma("BoostStars", (int) boost.stars, ' '));
textView.setText(LocaleController.formatPluralStringSpaced("BoostStars", (int) boost.stars));
linearLayout.addView(textView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 20, 0, 20, 4));
textView = new TextView(context);
@ -3664,7 +3660,7 @@ public class StarsIntroActivity extends GradientHeaderActivity implements Notifi
textView.setPadding(dp(4), 0, dp(8.33f), 0);
textView.setGravity(Gravity.CENTER);
textView.setTypeface(AndroidUtilities.bold());
final SpannableStringBuilder sb = new SpannableStringBuilder("x" + LocaleController.formatPluralStringComma("BoostingBoostsCount", boost.multiplier == 0 ? 1 : boost.multiplier, ' '));
final SpannableStringBuilder sb = new SpannableStringBuilder("x" + LocaleController.formatPluralStringSpaced("BoostingBoostsCount", boost.multiplier == 0 ? 1 : boost.multiplier));
final ColoredImageSpan span = new ColoredImageSpan(R.drawable.mini_boost_badge, ColoredImageSpan.ALIGN_CENTER);
span.translate(0, dp(0.66f));
sb.setSpan(span, 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

View file

@ -1628,6 +1628,7 @@ public class StoryViewer implements NotificationCenter.NotificationCenterDelegat
});
containerView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
}
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, windowView, windowLayoutParams);
windowManager.addView(windowView, windowLayoutParams);
}
windowView.requestLayout();

View file

@ -166,6 +166,7 @@ public class StoryWaveEffectView extends TextureView implements TextureView.Surf
}
public StoryWaveEffectView start() {
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, this, layoutParams);
windowManager.addView(this, layoutParams);
return this;
}

View file

@ -485,6 +485,7 @@ public class StoryRecorder implements NotificationCenter.NotificationCenterDeleg
forceBackgroundVisible = false;
if (windowManager != null && windowView != null && windowView.getParent() == null) {
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, windowView, windowLayoutParams);
windowManager.addView(windowView, windowLayoutParams);
}
@ -546,6 +547,7 @@ public class StoryRecorder implements NotificationCenter.NotificationCenterDeleg
videoTextureHolder.active = false;
if (windowManager != null && windowView != null && windowView.getParent() == null) {
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, windowView, windowLayoutParams);
windowManager.addView(windowView, windowLayoutParams);
}
@ -603,6 +605,7 @@ public class StoryRecorder implements NotificationCenter.NotificationCenterDeleg
forceBackgroundVisible = false;
if (windowManager != null && windowView != null && windowView.getParent() == null) {
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, windowView, windowLayoutParams);
windowManager.addView(windowView, windowLayoutParams);
}
@ -662,6 +665,7 @@ public class StoryRecorder implements NotificationCenter.NotificationCenterDeleg
forceBackgroundVisible = false;
if (windowManager != null && windowView != null && windowView.getParent() == null) {
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, windowView, windowLayoutParams);
windowManager.addView(windowView, windowLayoutParams);
}
@ -722,6 +726,7 @@ public class StoryRecorder implements NotificationCenter.NotificationCenterDeleg
forceBackgroundVisible = false;
if (windowManager != null && windowView != null && windowView.getParent() == null) {
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, windowView, windowLayoutParams);
windowManager.addView(windowView, windowLayoutParams);
}

View file

@ -2968,7 +2968,10 @@ public abstract class BotWebViewContainer extends FrameLayout implements Notific
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url == null) return false;
if (url.startsWith("tel:")) {
if (url.trim().startsWith("sms:")) {
return false;
}
if (url.trim().startsWith("tel:")) {
if (opener != null) {
if (botWebViewContainer.delegate != null) {
botWebViewContainer.delegate.onInstantClose();

View file

@ -21,6 +21,7 @@ import android.graphics.PorterDuffColorFilter;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.text.Editable;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.TypedValue;
@ -80,6 +81,8 @@ public class WebActionBar extends FrameLayout {
public int textColor, iconColor;
public int addressBackgroundColor, addressTextColor;
public final TextPaint titlePaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
public boolean isMenuShown = false;
public int height = dp(56);
@ -130,6 +133,9 @@ public class WebActionBar extends FrameLayout {
super(context);
this.resourcesProvider = resourcesProvider;
titlePaint.setTypeface(AndroidUtilities.bold());
titlePaint.setTextSize(dp(18.33f));
for (int i = 0; i < 2; ++i) {
backgroundPaint[i] = new Paint(Paint.ANTI_ALIAS_FLAG);
progressBackgroundPaint[i] = new Paint(Paint.ANTI_ALIAS_FLAG);

View file

@ -6095,6 +6095,8 @@
<string name="StorySavedSubtitle">Saved stories can be viewed by others on your profile until you remove them.</string>
<string name="StoryArchived_one">%d story is hidden from your profile</string>
<string name="StoryArchived_other">%d stories are hidden from your profile</string>
<string name="FoundStories_one">%d story</string>
<string name="FoundStories_other">%d stories</string>
<string name="OpenLink">Open Link</string>
<string name="StorySharedToEveryone">This story is shown to everyone.</string>
<string name="StorySharedToCloseFriends">This story is shown to your close friends.</string>
@ -7956,7 +7958,8 @@
<string name="StarsSubscriptionExpiredInfo">Your subscription expired on %s.</string>
<string name="StarsSubscriptionRefulfill">Join Channel</string>
<string name="StarsSubscriptionRefulfillInfo">You left channel, but you can still get back until %s.</string>
<string name="StarsSubscriptionExpiredHintTitle">⭐️%1$d Stars needed for %2$s</string>
<string name="StarsSubscriptionExpiredHintTitle2_one">⭐️%1$d Star needed for %2$s</string>
<string name="StarsSubscriptionExpiredHintTitle2_other">⭐️%1$d Stars needed for %2$s</string>
<string name="StarsSubscriptionExpiredHintText">Insufficient funds to cover your subscription.</string>
<string name="StarsParticipantSubscription">Subscriber</string>
<string name="StarsParticipantSubscriptionApproxMonth">appx. %1$s per month</string>

View file

@ -2,6 +2,8 @@ package org.telegram.ui.Components;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.graphics.Canvas;
import android.graphics.LinearGradient;
@ -9,6 +11,7 @@ import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Shader;
import android.os.Build;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
@ -27,13 +30,15 @@ import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.IUpdateLayout;
import java.io.File;
import java.util.ArrayList;
public class UpdateLayout extends IUpdateLayout {
private FrameLayout updateLayout;
private RadialProgress2 updateLayoutIcon;
private SimpleTextView updateTextView;
private SimpleTextView[] updateTextViews;
private TextView updateSizeTextView;
private AnimatorSet updateTextAnimator;
private Activity activity;
private ViewGroup sideMenu;
@ -47,7 +52,8 @@ public class UpdateLayout extends IUpdateLayout {
}
public void updateFileProgress(Object[] args) {
if (updateTextView != null && SharedConfig.isAppUpdateAvailable()) {
if (updateTextViews == null || args == null) return;
if (updateTextViews[0] != null && SharedConfig.isAppUpdateAvailable()) {
String location = (String) args[0];
String fileName = FileLoader.getAttachFileName(SharedConfig.pendingAppUpdate.document);
if (fileName != null && fileName.equals(location)) {
@ -55,13 +61,13 @@ public class UpdateLayout extends IUpdateLayout {
Long totalSize = (Long) args[2];
float loadProgress = loadedSize / (float) totalSize;
updateLayoutIcon.setProgress(loadProgress, true);
updateTextView.setText(LocaleController.formatString("AppUpdateDownloading", R.string.AppUpdateDownloading, (int) (loadProgress * 100)));
updateTextViews[0].setText(LocaleController.formatString("AppUpdateDownloading", R.string.AppUpdateDownloading, (int) (loadProgress * 100)));
}
}
}
public void createUpdateUI(int currentAccount) {
if (sideMenuContainer == null) {
if (sideMenuContainer == null || updateLayout != null) {
return;
}
updateLayout = new FrameLayout(activity) {
@ -121,13 +127,18 @@ public class UpdateLayout extends IUpdateLayout {
updateLayoutIcon.setCircleRadius(AndroidUtilities.dp(11));
updateLayoutIcon.setAsMini();
updateTextView = new SimpleTextView(activity);
updateTextView.setTextSize(15);
updateTextView.setTypeface(AndroidUtilities.bold());
updateTextView.setText(LocaleController.getString(R.string.AppUpdate));
updateTextView.setTextColor(0xffffffff);
updateTextView.setGravity(Gravity.LEFT);
updateLayout.addView(updateTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL, 74, 0, 0, 0));
updateTextViews = new SimpleTextView[2];
for (int i = 0; i < 2; ++i) {
updateTextViews[i] = new SimpleTextView(activity);
updateTextViews[i].setTextSize(15);
updateTextViews[i].setTypeface(AndroidUtilities.bold());
updateTextViews[i].setTextColor(0xffffffff);
updateTextViews[i].setGravity(Gravity.LEFT);
updateLayout.addView(updateTextViews[i], LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL, 74, 0, 0, 0));
}
updateTextViews[0].setText(LocaleController.getString(R.string.AppUpdate));
updateTextViews[1].setAlpha(0f);
updateTextViews[1].setVisibility(View.GONE);
updateSizeTextView = new TextView(activity);
updateSizeTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
@ -142,26 +153,25 @@ public class UpdateLayout extends IUpdateLayout {
return;
}
if (SharedConfig.isAppUpdateAvailable()) {
View prevUpdateLayout = updateLayout;
createUpdateUI(currentAccount);
updateSizeTextView.setText(AndroidUtilities.formatFileSize(SharedConfig.pendingAppUpdate.document.size));
String fileName = FileLoader.getAttachFileName(SharedConfig.pendingAppUpdate.document);
File path = FileLoader.getInstance(currentAccount).getPathToAttach(SharedConfig.pendingAppUpdate.document, true);
boolean showSize;
if (path.exists()) {
updateLayoutIcon.setIcon(MediaActionDrawable.ICON_UPDATE, true, false);
updateTextView.setText(LocaleController.getString(R.string.AppUpdateNow));
updateLayoutIcon.setIcon(MediaActionDrawable.ICON_UPDATE, true, animated);
setUpdateText(LocaleController.getString(R.string.AppUpdateNow), animated);
showSize = false;
} else {
if (FileLoader.getInstance(currentAccount).isLoadingFile(fileName)) {
updateLayoutIcon.setIcon(MediaActionDrawable.ICON_CANCEL, true, false);
updateLayoutIcon.setIcon(MediaActionDrawable.ICON_CANCEL, true, animated);
updateLayoutIcon.setProgress(0, false);
Float p = ImageLoader.getInstance().getFileProgress(fileName);
updateTextView.setText(LocaleController.formatString("AppUpdateDownloading", R.string.AppUpdateDownloading, (int) ((p != null ? p : 0.0f) * 100)));
setUpdateText(LocaleController.formatString("AppUpdateDownloading", R.string.AppUpdateDownloading, (int) ((p != null ? p : 0.0f) * 100)), animated);
showSize = false;
} else {
updateLayoutIcon.setIcon(MediaActionDrawable.ICON_DOWNLOAD, true, false);
updateTextView.setText(LocaleController.getString(R.string.AppUpdate));
updateLayoutIcon.setIcon(MediaActionDrawable.ICON_DOWNLOAD, true, animated);
setUpdateText(LocaleController.getString(R.string.AppUpdate), animated);
showSize = true;
}
}
@ -194,22 +204,9 @@ public class UpdateLayout extends IUpdateLayout {
updateLayout.setVisibility(View.VISIBLE);
updateLayout.setTag(1);
if (animated) {
updateLayout.animate().translationY(0).setInterpolator(CubicBezierInterpolator.EASE_OUT).setListener(null).setDuration(180).withEndAction(() -> {
if (prevUpdateLayout != null) {
ViewGroup parent = (ViewGroup) prevUpdateLayout.getParent();
if (parent != null) {
parent.removeView(prevUpdateLayout);
}
}
}).start();
updateLayout.animate().translationY(0).setInterpolator(CubicBezierInterpolator.EASE_OUT).setListener(null).setDuration(180).start();
} else {
updateLayout.setTranslationY(0);
if (prevUpdateLayout != null) {
ViewGroup parent = (ViewGroup) prevUpdateLayout.getParent();
if (parent != null) {
parent.removeView(prevUpdateLayout);
}
}
}
sideMenu.setPadding(0, 0, 0, AndroidUtilities.dp(44));
} else {
@ -233,5 +230,48 @@ public class UpdateLayout extends IUpdateLayout {
sideMenu.setPadding(0, 0, 0, 0);
}
}
}
private void setUpdateText(String text, boolean animate) {
if (TextUtils.equals(updateTextViews[0].getText(), text)) {
return;
}
if (updateTextAnimator != null) {
updateTextAnimator.cancel();
updateTextAnimator = null;
}
if (animate) {
updateTextViews[1].setText(updateTextViews[0].getText());
updateTextViews[0].setText(text);
updateTextViews[0].setAlpha(0);
updateTextViews[1].setAlpha(1);
updateTextViews[0].setVisibility(View.VISIBLE);
updateTextViews[1].setVisibility(View.VISIBLE);
ArrayList<Animator> arrayList = new ArrayList<>();
arrayList.add(ObjectAnimator.ofFloat(updateTextViews[1], View.ALPHA, 0));
arrayList.add(ObjectAnimator.ofFloat(updateTextViews[0], View.ALPHA, 1));
updateTextAnimator = new AnimatorSet();
updateTextAnimator.playTogether(arrayList);
updateTextAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (updateTextAnimator == animation) {
updateTextViews[1].setVisibility(View.GONE);
updateTextAnimator = null;
}
}
});
updateTextAnimator.setDuration(320);
updateTextAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
updateTextAnimator.start();
} else {
updateTextViews[0].setText(text);
updateTextViews[0].setAlpha(1);
updateTextViews[0].setVisibility(View.VISIBLE);
updateTextViews[1].setVisibility(View.GONE);
}
}
}

View file

@ -13,8 +13,8 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Sat Mar 12 05:53:50 MSK 2016
APP_VERSION_CODE=5240
APP_VERSION_NAME=11.1.2
APP_VERSION_CODE=5243
APP_VERSION_NAME=11.1.3
APP_PACKAGE=org.telegram.messenger
IS_PRIVATE=false
RELEASE_KEY_PASSWORD=android