mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 06:25:14 +01:00
update to 11.1.3 (5243)
This commit is contained in:
parent
cc50db9d67
commit
8558775967
58 changed files with 527 additions and 193 deletions
|
@ -272,6 +272,7 @@ public class AndroidUtilities {
|
||||||
public static float density = 1;
|
public static float density = 1;
|
||||||
public static Point displaySize = new Point();
|
public static Point displaySize = new Point();
|
||||||
public static float screenRefreshRate = 60;
|
public static float screenRefreshRate = 60;
|
||||||
|
public static float screenMaxRefreshRate = 60;
|
||||||
public static float screenRefreshTime = 1000 / screenRefreshRate;
|
public static float screenRefreshTime = 1000 / screenRefreshRate;
|
||||||
public static int roundMessageSize;
|
public static int roundMessageSize;
|
||||||
public static int roundPlayingMessageSize;
|
public static int roundPlayingMessageSize;
|
||||||
|
@ -2565,6 +2566,17 @@ public class AndroidUtilities {
|
||||||
display.getMetrics(displayMetrics);
|
display.getMetrics(displayMetrics);
|
||||||
display.getSize(displaySize);
|
display.getSize(displaySize);
|
||||||
screenRefreshRate = display.getRefreshRate();
|
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;
|
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) {
|
public static double fixLocationCoord(double value) {
|
||||||
return ((long) (value * 1000000)) / 1000000.0;
|
return ((long) (value * 1000000)) / 1000000.0;
|
||||||
}
|
}
|
||||||
|
@ -3505,6 +3546,9 @@ public class AndroidUtilities {
|
||||||
} else if (name2 != null && name2.length() != 0) {
|
} else if (name2 != null && name2.length() != 0) {
|
||||||
wholeString += " " + name2;
|
wholeString += " " + name2;
|
||||||
}
|
}
|
||||||
|
if (wholeString == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
wholeString = wholeString.trim();
|
wholeString = wholeString.trim();
|
||||||
String lower = " " + wholeString.toLowerCase();
|
String lower = " " + wholeString.toLowerCase();
|
||||||
|
|
||||||
|
|
|
@ -1516,6 +1516,12 @@ public class DatabaseMigrationHelper {
|
||||||
version = 155;
|
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;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ import android.os.Build;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.format.DateFormat;
|
import android.text.format.DateFormat;
|
||||||
import android.util.Log;
|
|
||||||
import android.util.Xml;
|
import android.util.Xml;
|
||||||
|
|
||||||
import androidx.annotation.StringRes;
|
import androidx.annotation.StringRes;
|
||||||
|
@ -32,13 +31,10 @@ import org.telegram.tgnet.TLRPC;
|
||||||
import org.telegram.ui.RestrictedLanguagesSelectActivity;
|
import org.telegram.ui.RestrictedLanguagesSelectActivity;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.BufferedWriter;
|
import java.io.BufferedWriter;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
@ -1468,6 +1464,14 @@ public class LocaleController {
|
||||||
return formatPluralStringComma(key, plural, ',');
|
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) {
|
public static String formatPluralStringComma(String key, int plural, Object... args) {
|
||||||
return formatPluralStringComma(key, plural, ',', args);
|
return formatPluralStringComma(key, plural, ',', args);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,6 @@ import android.os.Build;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.provider.DocumentsContract;
|
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
import android.provider.OpenableColumns;
|
import android.provider.OpenableColumns;
|
||||||
import android.telephony.PhoneStateListener;
|
import android.telephony.PhoneStateListener;
|
||||||
|
@ -65,8 +64,6 @@ import android.view.WindowManager;
|
||||||
import android.webkit.MimeTypeMap;
|
import android.webkit.MimeTypeMap;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
import androidx.core.content.FileProvider;
|
|
||||||
|
|
||||||
import com.google.android.exoplayer2.C;
|
import com.google.android.exoplayer2.C;
|
||||||
import com.google.android.exoplayer2.ExoPlayer;
|
import com.google.android.exoplayer2.ExoPlayer;
|
||||||
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
|
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
|
||||||
|
@ -3884,7 +3881,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
||||||
recordReplyingStory = storyItem;
|
recordReplyingStory = storyItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void requestAudioFocus(boolean request) {
|
public void requestRecordAudioFocus(boolean request) {
|
||||||
if (request) {
|
if (request) {
|
||||||
if (!hasRecordAudioFocus && SharedConfig.pauseMusicOnRecord) {
|
if (!hasRecordAudioFocus && SharedConfig.pauseMusicOnRecord) {
|
||||||
int result = NotificationsController.audioManager.requestAudioFocus(audioRecordFocusChangedListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
|
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) {
|
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;
|
manualRecording = false;
|
||||||
requestAudioFocus(true);
|
requestRecordAudioFocus(true);
|
||||||
recordQueue.cancelRunnable(recordStartRunnable);
|
recordQueue.cancelRunnable(recordStartRunnable);
|
||||||
recordQueue.postRunnable(() -> {
|
recordQueue.postRunnable(() -> {
|
||||||
setBluetoothScoOn(true);
|
setBluetoothScoOn(true);
|
||||||
|
@ -4033,6 +4030,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
||||||
audioToSend.attributes.add(attributeAudio);
|
audioToSend.attributes.add(attributeAudio);
|
||||||
NotificationCenter.getInstance(recordingCurrentAccount).postNotificationName(NotificationCenter.recordPaused);
|
NotificationCenter.getInstance(recordingCurrentAccount).postNotificationName(NotificationCenter.recordPaused);
|
||||||
NotificationCenter.getInstance(recordingCurrentAccount).postNotificationName(NotificationCenter.audioDidSent, recordingGuid, audioToSend, recordingAudioFileToSend.getAbsolutePath());
|
NotificationCenter.getInstance(recordingCurrentAccount).postNotificationName(NotificationCenter.audioDidSent, recordingGuid, audioToSend, recordingAudioFileToSend.getAbsolutePath());
|
||||||
|
requestRecordAudioFocus(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -4050,6 +4048,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
||||||
}
|
}
|
||||||
|
|
||||||
AndroidUtilities.runOnUIThread(() -> {
|
AndroidUtilities.runOnUIThread(() -> {
|
||||||
|
requestRecordAudioFocus(true);
|
||||||
MediaDataController.getInstance(recordingCurrentAccount).pushDraftVoiceMessage(recordDialogId, recordTopicId, null);
|
MediaDataController.getInstance(recordingCurrentAccount).pushDraftVoiceMessage(recordDialogId, recordTopicId, null);
|
||||||
|
|
||||||
audioRecorder = new AudioRecord(MediaRecorder.AudioSource.DEFAULT, sampleRate, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT, recordBufferSize);
|
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;
|
paused = true;
|
||||||
}
|
}
|
||||||
manualRecording = manual;
|
manualRecording = manual;
|
||||||
requestAudioFocus(true);
|
requestRecordAudioFocus(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
feedbackView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
feedbackView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||||
|
@ -4280,7 +4279,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
||||||
recordingAudioFileToSend.delete();
|
recordingAudioFileToSend.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
requestAudioFocus(false);
|
requestRecordAudioFocus(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -4288,7 +4287,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
||||||
if (recordingAudioFile != null) {
|
if (recordingAudioFile != null) {
|
||||||
recordingAudioFile.delete();
|
recordingAudioFile.delete();
|
||||||
}
|
}
|
||||||
requestAudioFocus(false);
|
requestRecordAudioFocus(false);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (audioRecorder != null) {
|
if (audioRecorder != null) {
|
||||||
|
@ -4423,7 +4422,11 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
||||||
if (cancelled) {
|
if (cancelled) {
|
||||||
break;
|
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);
|
saveFileInternal(isMusic ? 3 : 2, sourceFile, name);
|
||||||
copiedFiles++;
|
copiedFiles++;
|
||||||
}
|
}
|
||||||
|
@ -4519,7 +4522,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
||||||
}
|
}
|
||||||
String fileName = FileLoader.getAttachFileName(document);
|
String fileName = FileLoader.getAttachFileName(document);
|
||||||
loadingMessageObjects.put(fileName, messageObject);
|
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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3609,7 +3609,6 @@ public class MessageObject {
|
||||||
}
|
}
|
||||||
message.reactions = reactions;
|
message.reactions = reactions;
|
||||||
message.flags |= 1048576;
|
message.flags |= 1048576;
|
||||||
FileLog.d("msg#"+message.id+" updateReactions out=" + message.out);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasReactions() {
|
public boolean hasReactions() {
|
||||||
|
|
|
@ -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;
|
private boolean databaseMigrationInProgress;
|
||||||
public boolean showClearDatabaseAlert;
|
public boolean showClearDatabaseAlert;
|
||||||
private LongSparseIntArray dialogIsForum = new LongSparseIntArray();
|
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 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 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();
|
database.executeFast("PRAGMA user_version = " + MessagesStorage.LAST_DB_VERSION).stepThis().dispose();
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,10 @@ public class NotificationDismissReceiver extends BroadcastReceiver {
|
||||||
} else if (intent.hasExtra("storyReaction") && intent.getBooleanExtra("storyReaction", false)) {
|
} else if (intent.hasExtra("storyReaction") && intent.getBooleanExtra("storyReaction", false)) {
|
||||||
NotificationsController.getInstance(currentAccount).processIgnoreStoryReactions();
|
NotificationsController.getInstance(currentAccount).processIgnoreStoryReactions();
|
||||||
} else if (dialogId == 0) {
|
} else if (dialogId == 0) {
|
||||||
|
FileLog.d("set dismissDate of global to " + date);
|
||||||
MessagesController.getNotificationsSettings(currentAccount).edit().putInt("dismissDate", date).commit();
|
MessagesController.getNotificationsSettings(currentAccount).edit().putInt("dismissDate", date).commit();
|
||||||
} else {
|
} else {
|
||||||
|
FileLog.d("set dismissDate of " + dialogId + " to " + date);
|
||||||
MessagesController.getNotificationsSettings(currentAccount).edit().putInt("dismissDate" + dialogId, date).commit();
|
MessagesController.getNotificationsSettings(currentAccount).edit().putInt("dismissDate" + dialogId, date).commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -963,6 +963,7 @@ public class NotificationsController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processNewMessages(ArrayList<MessageObject> messageObjects, boolean isLast, boolean isFcm, CountDownLatch countDownLatch) {
|
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 (messageObjects.isEmpty()) {
|
||||||
if (countDownLatch != null) {
|
if (countDownLatch != null) {
|
||||||
countDownLatch.countDown();
|
countDownLatch.countDown();
|
||||||
|
@ -988,6 +989,7 @@ public class NotificationsController extends BaseController {
|
||||||
messageObject.messageOwner.action instanceof TLRPC.TL_messageActionSetMessagesTTL ||
|
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.messageOwner.silent && (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionContactSignUp || messageObject.messageOwner.action instanceof TLRPC.TL_messageActionUserJoined)) ||
|
||||||
MessageObject.isTopicActionMessage(messageObject)) {
|
MessageObject.isTopicActionMessage(messageObject)) {
|
||||||
|
FileLog.d("skipped message because 1");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (messageObject.isStoryPush) {
|
if (messageObject.isStoryPush) {
|
||||||
|
@ -1062,9 +1064,11 @@ public class NotificationsController extends BaseController {
|
||||||
getMessagesStorage().putPushMessage(messageObject);
|
getMessagesStorage().putPushMessage(messageObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FileLog.d("skipped message because old message with same dialog and message ids exist: did=" + did + ", mid="+mid);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (edited) {
|
if (edited) {
|
||||||
|
FileLog.d("skipped message because edited");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (isFcm) {
|
if (isFcm) {
|
||||||
|
@ -1077,10 +1081,12 @@ public class NotificationsController extends BaseController {
|
||||||
if (!isFcm) {
|
if (!isFcm) {
|
||||||
playInChatSound();
|
playInChatSound();
|
||||||
}
|
}
|
||||||
|
FileLog.d("skipped message because chat is already opened (openedDialogId = " + openedDialogId + ")");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (messageObject.messageOwner.mentioned) {
|
if (messageObject.messageOwner.mentioned) {
|
||||||
if (!allowPinned && messageObject.messageOwner.action instanceof TLRPC.TL_messageActionPinMessage) {
|
if (!allowPinned && messageObject.messageOwner.action instanceof TLRPC.TL_messageActionPinMessage) {
|
||||||
|
FileLog.d("skipped message because message is mention of pinned");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
dialogId = messageObject.getFromChatId();
|
dialogId = messageObject.getFromChatId();
|
||||||
|
@ -1099,6 +1105,7 @@ public class NotificationsController extends BaseController {
|
||||||
int notifyOverride = getNotifyOverride(preferences, dialogId, topicId);
|
int notifyOverride = getNotifyOverride(preferences, dialogId, topicId);
|
||||||
if (notifyOverride == -1) {
|
if (notifyOverride == -1) {
|
||||||
value = isGlobalNotificationsEnabled(dialogId, isChannel, messageObject.isReactionPush, messageObject.isStoryReactionPush);
|
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) {
|
/*if (BuildVars.DEBUG_PRIVATE_VERSION && BuildVars.LOGS_ENABLED) {
|
||||||
FileLog.d("global notify settings for " + dialog_id + " = " + value);
|
FileLog.d("global notify settings for " + dialog_id + " = " + value);
|
||||||
}*/
|
}*/
|
||||||
|
@ -1109,6 +1116,7 @@ public class NotificationsController extends BaseController {
|
||||||
settingsCache.put(dialogId, value);
|
settingsCache.put(dialogId, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FileLog.d("NotificationsController: process new messages, value is " + value + " ("+dialogId+", "+isChannel+", "+messageObject.isReactionPush+", "+messageObject.isStoryReactionPush+")");
|
||||||
if (value) {
|
if (value) {
|
||||||
if (!isFcm) {
|
if (!isFcm) {
|
||||||
popup = addToPopupMessages(popupArrayAdd, messageObject, dialogId, isChannel, preferences);
|
popup = addToPopupMessages(popupArrayAdd, messageObject, dialogId, isChannel, preferences);
|
||||||
|
@ -1162,9 +1170,11 @@ public class NotificationsController extends BaseController {
|
||||||
}
|
}
|
||||||
if (isFcm || hasScheduled) {
|
if (isFcm || hasScheduled) {
|
||||||
if (edited) {
|
if (edited) {
|
||||||
|
FileLog.d("NotificationsController processNewMessages: edited branch, showOrUpdateNotification " + notifyCheck);
|
||||||
delayedPushMessages.clear();
|
delayedPushMessages.clear();
|
||||||
showOrUpdateNotification(notifyCheck);
|
showOrUpdateNotification(notifyCheck);
|
||||||
} else if (added) {
|
} else if (added) {
|
||||||
|
FileLog.d("NotificationsController processNewMessages: added branch");
|
||||||
MessageObject messageObject = messageObjects.get(0);
|
MessageObject messageObject = messageObjects.get(0);
|
||||||
long dialog_id = messageObject.getDialogId();
|
long dialog_id = messageObject.getDialogId();
|
||||||
long topicId = MessageObject.getTopicId(currentAccount, messageObject.messageOwner, getMessagesController().isForum(dialog_id));
|
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) {
|
if (old_unread_count != total_unread_count || storiesUpdated) {
|
||||||
delayedPushMessages.clear();
|
delayedPushMessages.clear();
|
||||||
|
FileLog.d("NotificationsController processNewMessages: added branch: " + notifyCheck);
|
||||||
showOrUpdateNotification(notifyCheck);
|
showOrUpdateNotification(notifyCheck);
|
||||||
int pushDialogsCount = pushDialogs.size();
|
int pushDialogsCount = pushDialogs.size();
|
||||||
AndroidUtilities.runOnUIThread(() -> {
|
AndroidUtilities.runOnUIThread(() -> {
|
||||||
|
@ -3045,6 +3056,7 @@ public class NotificationsController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dismissNotification() {
|
private void dismissNotification() {
|
||||||
|
FileLog.d("NotificationsController dismissNotification");
|
||||||
try {
|
try {
|
||||||
notificationManager.cancel(notificationId);
|
notificationManager.cancel(notificationId);
|
||||||
pushMessages.clear();
|
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) {
|
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;
|
Uri defaultSound = Settings.System.DEFAULT_RINGTONE_URI;
|
||||||
if (defaultSound != null && sound != null && !TextUtils.equals(defaultSound.toString(), sound.toString())) {
|
if (defaultSound != null && sound != null && !TextUtils.equals(defaultSound.toString(), sound.toString())) {
|
||||||
SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
|
SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
|
||||||
|
@ -4546,6 +4559,7 @@ public class NotificationsController extends BaseController {
|
||||||
|
|
||||||
@SuppressLint("InlinedApi")
|
@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) {
|
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) {
|
if (Build.VERSION.SDK_INT >= 26) {
|
||||||
notificationBuilder.setChannelId(validateChannelId(lastDialogId, lastTopicId, chatName, vibrationPattern, ledColor, sound, importance, isDefault, isInApp, isSilent, chatType));
|
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));
|
long topicId = MessageObject.getTopicId(currentAccount, messageObject.messageOwner, getMessagesController().isForum(messageObject));
|
||||||
int dismissDate = preferences.getInt("dismissDate" + dialog_id, 0);
|
int dismissDate = preferences.getInt("dismissDate" + dialog_id, 0);
|
||||||
if (!messageObject.isStoryPush && messageObject.messageOwner.date <= dismissDate) {
|
if (!messageObject.isStoryPush && messageObject.messageOwner.date <= dismissDate) {
|
||||||
|
FileLog.d("showExtraNotifications: dialog " + dialog_id + " is skipped, message date (" + messageObject.messageOwner.date + " <= " + dismissDate + ")");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4578,6 +4593,7 @@ public class NotificationsController extends BaseController {
|
||||||
if (arrayList == null) {
|
if (arrayList == null) {
|
||||||
arrayList = new ArrayList<>();
|
arrayList = new ArrayList<>();
|
||||||
messagesByDialogs.put(dialog_id, arrayList);
|
messagesByDialogs.put(dialog_id, arrayList);
|
||||||
|
FileLog.d("showExtraNotifications: sortedDialogs += " + dialog_id);
|
||||||
sortedDialogs.add(new DialogKey(dialog_id, topicId, false));
|
sortedDialogs.add(new DialogKey(dialog_id, topicId, false));
|
||||||
}
|
}
|
||||||
arrayList.add(messageObject);
|
arrayList.add(messageObject);
|
||||||
|
@ -4633,11 +4649,13 @@ public class NotificationsController extends BaseController {
|
||||||
long selfUserId = getUserConfig().getClientUserId();
|
long selfUserId = getUserConfig().getClientUserId();
|
||||||
boolean waitingForPasscode = AndroidUtilities.needShowPasscode() || SharedConfig.isWaitingForPasscodeEnter;
|
boolean waitingForPasscode = AndroidUtilities.needShowPasscode() || SharedConfig.isWaitingForPasscodeEnter;
|
||||||
boolean passcode = SharedConfig.passcodeHash.length() > 0;
|
boolean passcode = SharedConfig.passcodeHash.length() > 0;
|
||||||
|
FileLog.d("showExtraNotifications: passcode="+passcode+" waitingForPasscode=" + waitingForPasscode + " selfUserId=" + selfUserId + " useSummaryNotification=" + useSummaryNotification);
|
||||||
|
|
||||||
int maxCount = 7;
|
int maxCount = 7;
|
||||||
LongSparseArray<Person> personCache = new LongSparseArray<>();
|
LongSparseArray<Person> personCache = new LongSparseArray<>();
|
||||||
for (int b = 0, size = sortedDialogs.size(); b < size; b++) {
|
for (int b = 0, size = sortedDialogs.size(); b < size; b++) {
|
||||||
if (holders.size() >= maxCount) {
|
if (holders.size() >= maxCount) {
|
||||||
|
FileLog.d("showExtraNotifications: break from holders, count over " + maxCount);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DialogKey dialogKey = sortedDialogs.get(b);
|
DialogKey dialogKey = sortedDialogs.get(b);
|
||||||
|
@ -4649,6 +4667,7 @@ public class NotificationsController extends BaseController {
|
||||||
if (dialogKey.story) {
|
if (dialogKey.story) {
|
||||||
messageObjects = new ArrayList<>();
|
messageObjects = new ArrayList<>();
|
||||||
if (storyPushMessages.isEmpty()) {
|
if (storyPushMessages.isEmpty()) {
|
||||||
|
FileLog.d("showExtraNotifications: ["+dialogKey.dialogId+"] continue; story but storyPushMessages is empty");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
dialogId = storyPushMessages.get(0).dialogId;
|
dialogId = storyPushMessages.get(0).dialogId;
|
||||||
|
@ -4915,6 +4934,7 @@ public class NotificationsController extends BaseController {
|
||||||
if (hidden) {
|
if (hidden) {
|
||||||
text.append(LocaleController.formatPluralString("StoryNotificationHidden", storiesCount));
|
text.append(LocaleController.formatPluralString("StoryNotificationHidden", storiesCount));
|
||||||
} else if (names.isEmpty()) {
|
} else if (names.isEmpty()) {
|
||||||
|
FileLog.d("showExtraNotifications: ["+dialogKey.dialogId+"] continue; story but names is empty");
|
||||||
continue;
|
continue;
|
||||||
} else if (names.size() == 1) {
|
} else if (names.size() == 1) {
|
||||||
if (storiesCount == 1) {
|
if (storiesCount == 1) {
|
||||||
|
@ -4943,9 +4963,11 @@ public class NotificationsController extends BaseController {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int a = messageObjects.size() - 1; a >= 0; a--) {
|
for (int a = messageObjects.size() - 1; a >= 0; a--) {
|
||||||
MessageObject messageObject = messageObjects.get(a);
|
final MessageObject messageObject = messageObjects.get(a);
|
||||||
long messageTopicId = MessageObject.getTopicId(currentAccount, messageObject.messageOwner, getMessagesController().isForum(messageObject));
|
final boolean isForum = getMessagesController().isForum(messageObject);
|
||||||
|
final long messageTopicId = MessageObject.getTopicId(currentAccount, messageObject.messageOwner, isForum);
|
||||||
if (topicId != messageTopicId) {
|
if (topicId != messageTopicId) {
|
||||||
|
FileLog.d("showExtraNotifications: ["+dialogKey.dialogId+"] continue; topic id is not equal: topicId=" + topicId + " messageTopicId=" + messageTopicId + "; selfId=" + getUserConfig().getClientUserId());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String message = getShortStringForMessage(messageObject, senderName, preview);
|
String message = getShortStringForMessage(messageObject, senderName, preview);
|
||||||
|
@ -5303,6 +5325,7 @@ public class NotificationsController extends BaseController {
|
||||||
if (Build.VERSION.SDK_INT >= 26) {
|
if (Build.VERSION.SDK_INT >= 26) {
|
||||||
setNotificationChannel(mainNotification, builder, useSummaryNotification);
|
setNotificationChannel(mainNotification, builder, useSummaryNotification);
|
||||||
}
|
}
|
||||||
|
FileLog.d("showExtraNotifications: holders.add " + dialogId);
|
||||||
holders.add(new NotificationHolder(internalId, dialogId, dialogKey.story, topicId, name, user, chat, builder));
|
holders.add(new NotificationHolder(internalId, dialogId, dialogKey.story, topicId, name, user, chat, builder));
|
||||||
wearNotificationsIds.put(dialogId, internalId);
|
wearNotificationsIds.put(dialogId, internalId);
|
||||||
}
|
}
|
||||||
|
@ -5319,6 +5342,9 @@ public class NotificationsController extends BaseController {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (openedInBubbleDialogs.isEmpty()) {
|
if (openedInBubbleDialogs.isEmpty()) {
|
||||||
|
if (BuildVars.LOGS_ENABLED) {
|
||||||
|
FileLog.d("cancel summary with id " + notificationId);
|
||||||
|
}
|
||||||
notificationManager.cancel(notificationId);
|
notificationManager.cancel(notificationId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5336,6 +5362,7 @@ public class NotificationsController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<String> ids = new ArrayList<>(holders.size());
|
ArrayList<String> ids = new ArrayList<>(holders.size());
|
||||||
|
FileLog.d("showExtraNotifications: holders.size()=" + holders.size());
|
||||||
for (int a = 0, size = holders.size(); a < size; a++) {
|
for (int a = 0, size = holders.size(); a < size; a++) {
|
||||||
NotificationHolder holder = holders.get(a);
|
NotificationHolder holder = holders.get(a);
|
||||||
ids.clear();
|
ids.clear();
|
||||||
|
@ -5345,6 +5372,7 @@ public class NotificationsController extends BaseController {
|
||||||
ids.add(shortcutId);
|
ids.add(shortcutId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FileLog.d("showExtraNotifications: holders["+a+"].call()");
|
||||||
holder.call();
|
holder.call();
|
||||||
if (!unsupportedNotificationShortcut() && !ids.isEmpty()) {
|
if (!unsupportedNotificationShortcut() && !ids.isEmpty()) {
|
||||||
ShortcutManagerCompat.removeDynamicShortcuts(ApplicationLoader.applicationContext, ids);
|
ShortcutManagerCompat.removeDynamicShortcuts(ApplicationLoader.applicationContext, ids);
|
||||||
|
|
|
@ -1319,6 +1319,7 @@ public class PushListenerController {
|
||||||
ArrayList<MessageObject> arrayList = new ArrayList<>();
|
ArrayList<MessageObject> arrayList = new ArrayList<>();
|
||||||
arrayList.add(messageObject);
|
arrayList.add(messageObject);
|
||||||
canRelease = false;
|
canRelease = false;
|
||||||
|
FileLog.d("PushListenerController push notification to NotificationsController of " + messageOwner.dialog_id);
|
||||||
NotificationsController.getInstance(currentAccount).processNewMessages(arrayList, true, true, countDownLatch);
|
NotificationsController.getInstance(currentAccount).processNewMessages(arrayList, true, true, countDownLatch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -607,7 +607,7 @@ public class SharedConfig {
|
||||||
useSystemEmoji = preferences.getBoolean("useSystemEmoji", false);
|
useSystemEmoji = preferences.getBoolean("useSystemEmoji", false);
|
||||||
streamMedia = preferences.getBoolean("streamMedia", true);
|
streamMedia = preferences.getBoolean("streamMedia", true);
|
||||||
saveStreamMedia = preferences.getBoolean("saveStreamMedia", true);
|
saveStreamMedia = preferences.getBoolean("saveStreamMedia", true);
|
||||||
pauseMusicOnRecord = preferences.getBoolean("pauseMusicOnRecord", false);
|
pauseMusicOnRecord = preferences.getBoolean("pauseMusicOnRecord", true);
|
||||||
pauseMusicOnMedia = preferences.getBoolean("pauseMusicOnMedia", false);
|
pauseMusicOnMedia = preferences.getBoolean("pauseMusicOnMedia", false);
|
||||||
forceDisableTabletMode = preferences.getBoolean("forceDisableTabletMode", false);
|
forceDisableTabletMode = preferences.getBoolean("forceDisableTabletMode", false);
|
||||||
streamAllVideo = preferences.getBoolean("streamAllVideo", BuildVars.DEBUG_VERSION);
|
streamAllVideo = preferences.getBoolean("streamAllVideo", BuildVars.DEBUG_VERSION);
|
||||||
|
@ -1682,7 +1682,7 @@ public class SharedConfig {
|
||||||
performanceClass = PERFORMANCE_CLASS_HIGH;
|
performanceClass = PERFORMANCE_CLASS_HIGH;
|
||||||
}
|
}
|
||||||
if (BuildVars.LOGS_ENABLED) {
|
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;
|
return performanceClass;
|
||||||
|
|
|
@ -1532,7 +1532,9 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
||||||
FileLog.d("present fragment " + fragment.getClass().getSimpleName() + " args=" + fragment.getArguments());
|
FileLog.d("present fragment " + fragment.getClass().getSimpleName() + " args=" + fragment.getArguments());
|
||||||
}
|
}
|
||||||
StoryViewer.closeGlobalInstances();
|
StoryViewer.closeGlobalInstances();
|
||||||
LaunchActivity.dismissAllWeb();
|
if (bottomSheetTabs != null && !bottomSheetTabs.doNotDismiss) {
|
||||||
|
LaunchActivity.dismissAllWeb();
|
||||||
|
}
|
||||||
if (inPreviewMode && transitionAnimationPreviewMode) {
|
if (inPreviewMode && transitionAnimationPreviewMode) {
|
||||||
if (delayedOpenAnimationRunnable != null) {
|
if (delayedOpenAnimationRunnable != null) {
|
||||||
AndroidUtilities.cancelRunOnUIThread(delayedOpenAnimationRunnable);
|
AndroidUtilities.cancelRunOnUIThread(delayedOpenAnimationRunnable);
|
||||||
|
|
|
@ -58,6 +58,7 @@ public class BottomSheetTabs extends FrameLayout {
|
||||||
|
|
||||||
private final Paint backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
private final Paint backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
public boolean drawTabs = true;
|
public boolean drawTabs = true;
|
||||||
|
public boolean doNotDismiss = false;
|
||||||
|
|
||||||
private final ActionBarLayout actionBarLayout;
|
private final ActionBarLayout actionBarLayout;
|
||||||
|
|
||||||
|
@ -141,9 +142,11 @@ public class BottomSheetTabs extends FrameLayout {
|
||||||
};
|
};
|
||||||
open.run(lastFragment);
|
open.run(lastFragment);
|
||||||
if (tab.needsContext && (!(lastFragment instanceof ChatActivity) || ((ChatActivity) lastFragment).getDialogId() != tab.props.botId)) {
|
if (tab.needsContext && (!(lastFragment instanceof ChatActivity) || ((ChatActivity) lastFragment).getDialogId() != tab.props.botId)) {
|
||||||
|
doNotDismiss = true;
|
||||||
BaseFragment chatActivity = ChatActivity.of(tab.props.botId);
|
BaseFragment chatActivity = ChatActivity.of(tab.props.botId);
|
||||||
AndroidUtilities.runOnUIThread(() -> {
|
AndroidUtilities.runOnUIThread(() -> {
|
||||||
lastFragment.presentFragment(chatActivity);
|
lastFragment.presentFragment(chatActivity);
|
||||||
|
doNotDismiss = false;
|
||||||
}, 220);
|
}, 220);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1610,9 +1610,9 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
|
||||||
if (chat != null && chat.participants_count != 0) {
|
if (chat != null && chat.participants_count != 0) {
|
||||||
String membersString;
|
String membersString;
|
||||||
if (ChatObject.isChannel(chat) && !chat.megagroup) {
|
if (ChatObject.isChannel(chat) && !chat.megagroup) {
|
||||||
membersString = LocaleController.formatPluralStringComma("Subscribers", chat.participants_count, ' ');
|
membersString = LocaleController.formatPluralStringSpaced("Subscribers", chat.participants_count);
|
||||||
} else {
|
} else {
|
||||||
membersString = LocaleController.formatPluralStringComma("Members", chat.participants_count, ' ');
|
membersString = LocaleController.formatPluralStringSpaced("Members", chat.participants_count);
|
||||||
}
|
}
|
||||||
if (username instanceof SpannableStringBuilder) {
|
if (username instanceof SpannableStringBuilder) {
|
||||||
((SpannableStringBuilder) username).append(", ").append(membersString);
|
((SpannableStringBuilder) username).append(", ").append(membersString);
|
||||||
|
|
|
@ -8,9 +8,7 @@
|
||||||
|
|
||||||
package org.telegram.ui.Adapters;
|
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.dp;
|
||||||
import static org.telegram.messenger.AndroidUtilities.statusBarHeight;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
|
@ -317,7 +315,7 @@ public class MessagesSearchAdapter extends RecyclerListView.SelectionAdapter imp
|
||||||
avatarsDrawable.setCount(actualCount);
|
avatarsDrawable.setCount(actualCount);
|
||||||
avatarsDrawable.commitTransition(false);
|
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));
|
subtitleTextView.setText(LocaleController.formatString(R.string.HashtagStoriesFoundSubtitle, list.query));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -200,6 +200,7 @@ import org.telegram.ui.Components.VideoPlayer;
|
||||||
import org.telegram.ui.Components.WebPlayerView;
|
import org.telegram.ui.Components.WebPlayerView;
|
||||||
import org.telegram.ui.Stories.DarkThemeResourceProvider;
|
import org.telegram.ui.Stories.DarkThemeResourceProvider;
|
||||||
import org.telegram.ui.Stories.recorder.ButtonWithCounterView;
|
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.Stories.recorder.KeyboardNotifier;
|
||||||
import org.telegram.ui.web.AddressBarList;
|
import org.telegram.ui.web.AddressBarList;
|
||||||
import org.telegram.ui.web.BookmarksFragment;
|
import org.telegram.ui.web.BookmarksFragment;
|
||||||
|
@ -13284,7 +13285,12 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
Uri uri2 = Uri.parse(url);
|
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) {
|
} catch (Exception e) {
|
||||||
FileLog.e(e, false);
|
FileLog.e(e, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,6 +125,7 @@ public class AvatarPreviewer {
|
||||||
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
|
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
|
||||||
WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
|
WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
|
||||||
}
|
}
|
||||||
|
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, layout, layoutParams);
|
||||||
windowManager.addView(layout, layoutParams);
|
windowManager.addView(layout, layoutParams);
|
||||||
parentContainer.requestDisallowInterceptTouchEvent(true);
|
parentContainer.requestDisallowInterceptTouchEvent(true);
|
||||||
visible = true;
|
visible = true;
|
||||||
|
|
|
@ -320,6 +320,7 @@ public class BubbleActivity extends BasePermissionsActivity implements INavigati
|
||||||
@Override
|
@Override
|
||||||
public void onConfigurationChanged(android.content.res.Configuration newConfig) {
|
public void onConfigurationChanged(android.content.res.Configuration newConfig) {
|
||||||
AndroidUtilities.checkDisplaySize(this, newConfig);
|
AndroidUtilities.checkDisplaySize(this, newConfig);
|
||||||
|
AndroidUtilities.setPreferredMaxRefreshRate(getWindow());
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -521,7 +521,7 @@ public class AboutLinkCell extends FrameLayout {
|
||||||
} : null;
|
} : null;
|
||||||
if (pressedLink instanceof URLSpanNoUnderline) {
|
if (pressedLink instanceof URLSpanNoUnderline) {
|
||||||
String url = ((URLSpanNoUnderline) pressedLink).getURL();
|
String url = ((URLSpanNoUnderline) pressedLink).getURL();
|
||||||
if (url.startsWith("@") || url.startsWith("#") || url.startsWith("/")) {
|
if (url.startsWith("@") || url.startsWith("#") || url.startsWith("$") || url.startsWith("/")) {
|
||||||
didPressUrl(url, currentProgress);
|
didPressUrl(url, currentProgress);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -260,7 +260,7 @@ public class BotHelpCell extends View {
|
||||||
ClickableSpan span = pressedLink.getSpan();
|
ClickableSpan span = pressedLink.getSpan();
|
||||||
if (span instanceof URLSpanNoUnderline) {
|
if (span instanceof URLSpanNoUnderline) {
|
||||||
String url = ((URLSpanNoUnderline) span).getURL();
|
String url = ((URLSpanNoUnderline) span).getURL();
|
||||||
if (url.startsWith("@") || url.startsWith("#") || url.startsWith("/")) {
|
if (url.startsWith("@") || url.startsWith("#") || url.startsWith("/") || url.startsWith("$")) {
|
||||||
if (delegate != null) {
|
if (delegate != null) {
|
||||||
delegate.didPressUrl(url);
|
delegate.didPressUrl(url);
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,7 +300,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
} else {
|
} else {
|
||||||
currentPhoto = null;
|
currentPhoto = null;
|
||||||
}
|
}
|
||||||
if (currentChat.signature_profiles) {
|
if (currentChat.signature_profiles && messageObject.getDialogId() != UserObject.REPLY_BOT) {
|
||||||
long did = DialogObject.getPeerDialogId(messageObject.messageOwner.from_id);
|
long did = DialogObject.getPeerDialogId(messageObject.messageOwner.from_id);
|
||||||
if (did >= 0) {
|
if (did >= 0) {
|
||||||
TLRPC.User user = MessagesController.getInstance(messageObject.currentAccount).getUser(did);
|
TLRPC.User user = MessagesController.getInstance(messageObject.currentAccount).getUser(did);
|
||||||
|
@ -9497,7 +9497,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
botButtonsByPosition.clear();
|
botButtonsByPosition.clear();
|
||||||
botButtonsLayout = null;
|
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;
|
int rows;
|
||||||
|
|
||||||
if (messageObject.messageOwner.reply_markup instanceof TLRPC.TL_replyInlineMarkup) {
|
if (messageObject.messageOwner.reply_markup instanceof TLRPC.TL_replyInlineMarkup) {
|
||||||
|
@ -16894,7 +16894,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
if (currentUser != null) {
|
if (currentUser != null) {
|
||||||
return UserObject.getUserName(currentUser);
|
return UserObject.getUserName(currentUser);
|
||||||
} else if (currentChat != null) {
|
} 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);
|
long did = DialogObject.getPeerDialogId(currentMessageObject.messageOwner.from_id);
|
||||||
if (did >= 0) {
|
if (did >= 0) {
|
||||||
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(did);
|
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(did);
|
||||||
|
|
|
@ -1488,8 +1488,8 @@ public class DialogCell extends BaseCell implements StoriesListPlaceProvider.Ava
|
||||||
if (!isSavedDialog && user != null && user.self && !message.isOutOwner()) {
|
if (!isSavedDialog && user != null && user.self && !message.isOutOwner()) {
|
||||||
triedMessageName = AndroidUtilities.removeDiacritics(getMessageNameString());
|
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());
|
messageNameString = AndroidUtilities.removeDiacritics(triedMessageName != null ? triedMessageName : getMessageNameString());
|
||||||
if (chat != null && chat.forum && !isTopic && !useFromUserAsAvatar) {
|
if (chat != null && chat.forum && !isTopic && !useFromUserAsAvatar) {
|
||||||
CharSequence topicName = MessagesController.getInstance(currentAccount).getTopicsController().getTopicIconName(chat, message, currentMessagePaint);
|
CharSequence topicName = MessagesController.getInstance(currentAccount).getTopicsController().getTopicIconName(chat, message, currentMessagePaint);
|
||||||
if (!TextUtils.isEmpty(topicName)) {
|
if (!TextUtils.isEmpty(topicName)) {
|
||||||
|
@ -5078,7 +5078,7 @@ public class DialogCell extends BaseCell implements StoriesListPlaceProvider.Ava
|
||||||
return AndroidUtilities.removeDiacritics(fromChat.title.replace("\n", ""));
|
return AndroidUtilities.removeDiacritics(fromChat.title.replace("\n", ""));
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
} else if (message.isOutOwner()) {
|
} else if (message.isOutOwner() && fromUser != null) {
|
||||||
return LocaleController.getString(R.string.FromYou);
|
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) {
|
} 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", ""));
|
return AndroidUtilities.removeDiacritics(UserObject.getFirstName(user).replace("\n", ""));
|
||||||
|
|
|
@ -492,7 +492,7 @@ public class ProfileSearchCell extends BaseCell implements NotificationCenter.No
|
||||||
if (MessagesController.isSupportUser(user)) {
|
if (MessagesController.isSupportUser(user)) {
|
||||||
statusString = LocaleController.getString(R.string.SupportStatus);
|
statusString = LocaleController.getString(R.string.SupportStatus);
|
||||||
} else if (user.bot && user.bot_active_users != 0) {
|
} 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) {
|
} else if (user.bot) {
|
||||||
statusString = LocaleController.getString(R.string.Bot);
|
statusString = LocaleController.getString(R.string.Bot);
|
||||||
} else if (UserObject.isService(user.id)) {
|
} else if (UserObject.isService(user.id)) {
|
||||||
|
|
|
@ -26,7 +26,6 @@ import android.text.TextUtils;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.text.style.RelativeSizeSpan;
|
import android.text.style.RelativeSizeSpan;
|
||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
import android.util.Log;
|
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
|
@ -52,7 +51,6 @@ import org.telegram.messenger.ChatObject;
|
||||||
import org.telegram.messenger.FileLog;
|
import org.telegram.messenger.FileLog;
|
||||||
import org.telegram.messenger.LocaleController;
|
import org.telegram.messenger.LocaleController;
|
||||||
import org.telegram.messenger.MessagesController;
|
import org.telegram.messenger.MessagesController;
|
||||||
import org.telegram.messenger.NotificationCenter;
|
|
||||||
import org.telegram.messenger.R;
|
import org.telegram.messenger.R;
|
||||||
import org.telegram.messenger.UserConfig;
|
import org.telegram.messenger.UserConfig;
|
||||||
import org.telegram.messenger.UserObject;
|
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.Components.ViewPagerFixed;
|
||||||
import org.telegram.ui.Stars.BotStarsActivity;
|
import org.telegram.ui.Stars.BotStarsActivity;
|
||||||
import org.telegram.ui.Stars.BotStarsController;
|
import org.telegram.ui.Stars.BotStarsController;
|
||||||
import org.telegram.ui.Stars.StarsController;
|
|
||||||
import org.telegram.ui.Stars.StarsIntroActivity;
|
import org.telegram.ui.Stars.StarsIntroActivity;
|
||||||
import org.telegram.ui.Stories.recorder.ButtonWithCounterView;
|
import org.telegram.ui.Stories.recorder.ButtonWithCounterView;
|
||||||
|
|
||||||
|
@ -471,7 +468,7 @@ public class ChannelMonetizationLayout extends SizeNotifierFrameLayout implement
|
||||||
AndroidUtilities.runOnUIThread(this.setStarsBalanceButtonText, 1000);
|
AndroidUtilities.runOnUIThread(this.setStarsBalanceButtonText, 1000);
|
||||||
} else {
|
} else {
|
||||||
starsBalanceButton.setSubText(null, true);
|
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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -7092,6 +7092,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putInt("type", MediaActivity.TYPE_STORIES_SEARCH);
|
args.putInt("type", MediaActivity.TYPE_STORIES_SEARCH);
|
||||||
args.putString("hashtag", messagesSearchAdapter.storiesList.query);
|
args.putString("hashtag", messagesSearchAdapter.storiesList.query);
|
||||||
|
args.putInt("storiesCount", messagesSearchAdapter.storiesList.getCount());
|
||||||
presentFragment(new MediaActivity(args, null));
|
presentFragment(new MediaActivity(args, null));
|
||||||
} else if (obj instanceof MessageObject) {
|
} else if (obj instanceof MessageObject) {
|
||||||
openMessageInOriginalDialog((MessageObject) obj);
|
openMessageInOriginalDialog((MessageObject) obj);
|
||||||
|
@ -35401,7 +35402,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
if (!asForward && chat != null && chat.signature_profiles) {
|
if (!asForward && chat != null && chat.signature_profiles) {
|
||||||
MessageObject msg = cell.getMessageObject();
|
MessageObject msg = cell.getMessageObject();
|
||||||
if (msg != null) {
|
if (msg != null && msg.getDialogId() != UserObject.REPLY_BOT) {
|
||||||
long did = DialogObject.getPeerDialogId(msg.messageOwner.from_id);
|
long did = DialogObject.getPeerDialogId(msg.messageOwner.from_id);
|
||||||
openUserProfile(did);
|
openUserProfile(did);
|
||||||
return;
|
return;
|
||||||
|
@ -35915,6 +35916,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
popupLayout.addView(removeTag);
|
popupLayout.addView(removeTag);
|
||||||
scrimPopupContainerLayout.addView(popupLayout);
|
scrimPopupContainerLayout.addView(popupLayout);
|
||||||
} else if (messageObject != null && messageObject.messageOwner != null && messageObject.messageOwner.reactions != null && messageObject.messageOwner.reactions.can_see_list || dialog_id >= 0) {
|
} 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)
|
scrimPopupContainerLayout.addView(new ReactedUsersListView(getParentActivity(), themeDelegate, currentAccount, messageObject, reaction, false, false)
|
||||||
.setOnCustomEmojiSelectedListener((reactedUsersListView1, customEmojiStickerSets) -> {
|
.setOnCustomEmojiSelectedListener((reactedUsersListView1, customEmojiStickerSets) -> {
|
||||||
EmojiPacksAlert alert = new EmojiPacksAlert(ChatActivity.this, getParentActivity(), themeDelegate, 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.TL_reactionCustomEmoji customEmoji = (TLRPC.TL_reactionCustomEmoji) reaction.reaction;
|
||||||
TLRPC.InputStickerSet inputStickerSet = AnimatedEmojiDrawable.getDocumentFetcher(currentAccount).findStickerSet(customEmoji.document_id);
|
TLRPC.InputStickerSet inputStickerSet = AnimatedEmojiDrawable.getDocumentFetcher(currentAccount).findStickerSet(customEmoji.document_id);
|
||||||
if (inputStickerSet != null) {
|
if (inputStickerSet != null) {
|
||||||
|
button.stopAnimation();
|
||||||
ArrayList<TLRPC.InputStickerSet> arr = new ArrayList<TLRPC.InputStickerSet>();
|
ArrayList<TLRPC.InputStickerSet> arr = new ArrayList<TLRPC.InputStickerSet>();
|
||||||
arr.add(inputStickerSet);
|
arr.add(inputStickerSet);
|
||||||
MessageContainsEmojiButton setButton = new MessageContainsEmojiButton(currentAccount, getContext(), themeDelegate, arr, MessageContainsEmojiButton.SINGLE_REACTION_TYPE);
|
MessageContainsEmojiButton setButton = new MessageContainsEmojiButton(currentAccount, getContext(), themeDelegate, arr, MessageContainsEmojiButton.SINGLE_REACTION_TYPE);
|
||||||
|
|
|
@ -21,6 +21,7 @@ import java.util.ArrayList;
|
||||||
public class AvatarConstructorPreviewCell extends FrameLayout {
|
public class AvatarConstructorPreviewCell extends FrameLayout {
|
||||||
|
|
||||||
private AnimatedEmojiDrawable animatedEmojiDrawable;
|
private AnimatedEmojiDrawable animatedEmojiDrawable;
|
||||||
|
private AnimatedEmojiDrawable nextAnimatedEmojiDrawable;
|
||||||
BackupImageView currentImage;
|
BackupImageView currentImage;
|
||||||
BackupImageView nextImage;
|
BackupImageView nextImage;
|
||||||
|
|
||||||
|
@ -37,13 +38,16 @@ public class AvatarConstructorPreviewCell extends FrameLayout {
|
||||||
int emojiIndex = 0;
|
int emojiIndex = 0;
|
||||||
|
|
||||||
float progressToNext = 1f;
|
float progressToNext = 1f;
|
||||||
|
private boolean isAllEmojiDrawablesLoaded;
|
||||||
|
|
||||||
Runnable scheduleSwitchToNextRunnable = new Runnable() {
|
Runnable scheduleSwitchToNextRunnable = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
AndroidUtilities.runOnUIThread(scheduleSwitchToNextRunnable, 1000);
|
AndroidUtilities.runOnUIThread(scheduleSwitchToNextRunnable, 1000);
|
||||||
if (emojiList == null || emojiList.document_id.isEmpty() || progressToNext != 1f) {
|
if (emojiList == null || emojiList.document_id.isEmpty() || progressToNext != 1f) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!isAllEmojiDrawablesLoaded && (nextAnimatedEmojiDrawable.getImageReceiver() == null || !nextAnimatedEmojiDrawable.getImageReceiver().hasImageLoaded())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
emojiIndex++;
|
emojiIndex++;
|
||||||
|
@ -68,6 +72,7 @@ public class AvatarConstructorPreviewCell extends FrameLayout {
|
||||||
nextBackgroundDrawable.setColors(color1, color2, color3, color4);
|
nextBackgroundDrawable.setColors(color1, color2, color3, color4);
|
||||||
|
|
||||||
progressToNext = 0f;
|
progressToNext = 0f;
|
||||||
|
preloadNextEmojiDrawable();
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -116,6 +121,7 @@ public class AvatarConstructorPreviewCell extends FrameLayout {
|
||||||
if (emojiList != null && !emojiList.document_id.isEmpty()) {
|
if (emojiList != null && !emojiList.document_id.isEmpty()) {
|
||||||
animatedEmojiDrawable = new AnimatedEmojiDrawable(AnimatedEmojiDrawable.CACHE_TYPE_ALERT_PREVIEW_LARGE, currentAccount, emojiList.document_id.get(0));
|
animatedEmojiDrawable = new AnimatedEmojiDrawable(AnimatedEmojiDrawable.CACHE_TYPE_ALERT_PREVIEW_LARGE, currentAccount, emojiList.document_id.get(0));
|
||||||
currentImage.setAnimatedEmojiDrawable(animatedEmojiDrawable);
|
currentImage.setAnimatedEmojiDrawable(animatedEmojiDrawable);
|
||||||
|
preloadNextEmojiDrawable();
|
||||||
}
|
}
|
||||||
|
|
||||||
int color1 = AvatarConstructorFragment.defaultColors[backgroundIndex][0];
|
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
|
@Override
|
||||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||||
|
|
|
@ -570,6 +570,9 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
boolean ctrlPressed = false;
|
||||||
|
boolean shiftPressed = false;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
protected EditTextCaption messageEditText;
|
protected EditTextCaption messageEditText;
|
||||||
private SlowModeBtn slowModeButton;
|
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));
|
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() {
|
messageEditText.setOnKeyListener(new OnKeyListener() {
|
||||||
|
|
||||||
boolean ctrlPressed = false;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onKey(View view, int keyCode, KeyEvent keyEvent) {
|
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 (keyCode == KeyEvent.KEYCODE_BACK && !keyboardVisible && isPopupShowing() && keyEvent.getAction() == KeyEvent.ACTION_UP) {
|
||||||
if (ContentPreviewViewer.hasInstance() && ContentPreviewViewer.getInstance().isVisible()) {
|
if (ContentPreviewViewer.hasInstance() && ContentPreviewViewer.getInstance().isVisible()) {
|
||||||
ContentPreviewViewer.getInstance().closeWithMenu();
|
ContentPreviewViewer.getInstance().closeWithMenu();
|
||||||
|
@ -5125,27 +5130,22 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
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();
|
sendMessage();
|
||||||
return true;
|
return true;
|
||||||
} else if (keyCode == KeyEvent.KEYCODE_CTRL_LEFT || keyCode == KeyEvent.KEYCODE_CTRL_RIGHT) {
|
|
||||||
ctrlPressed = keyEvent.getAction() == KeyEvent.ACTION_DOWN;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
messageEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
messageEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||||
|
|
||||||
boolean ctrlPressed = false;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
|
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
|
||||||
if (i == EditorInfo.IME_ACTION_SEND) {
|
if (i == EditorInfo.IME_ACTION_SEND) {
|
||||||
sendMessage();
|
sendMessage();
|
||||||
return true;
|
return true;
|
||||||
} else if (keyEvent != null && i == EditorInfo.IME_NULL) {
|
} 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();
|
sendMessage();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -5204,7 +5204,7 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
|
||||||
if (innerTextChange == 1) {
|
if (innerTextChange == 1) {
|
||||||
return;
|
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;
|
nextChangeIsSend = true;
|
||||||
}
|
}
|
||||||
isPaste = false;
|
isPaste = false;
|
||||||
|
@ -9912,7 +9912,7 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
|
||||||
return;
|
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 (LaunchActivity.instance != null && LaunchActivity.instance.getBottomSheetTabs() != null && LaunchActivity.instance.getBottomSheetTabs().tryReopenTab(props) != null) {
|
||||||
if (botCommandsMenuButton != null) {
|
if (botCommandsMenuButton != null) {
|
||||||
botCommandsMenuButton.setOpened(false);
|
botCommandsMenuButton.setOpened(false);
|
||||||
|
|
|
@ -3,11 +3,16 @@ package org.telegram.ui.Components;
|
||||||
import static org.telegram.messenger.LocaleController.getString;
|
import static org.telegram.messenger.LocaleController.getString;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.database.sqlite.SQLiteStatement;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
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.AndroidUtilities;
|
||||||
import org.telegram.messenger.DialogObject;
|
import org.telegram.messenger.DialogObject;
|
||||||
|
import org.telegram.messenger.FileLog;
|
||||||
import org.telegram.messenger.MediaDataController;
|
import org.telegram.messenger.MediaDataController;
|
||||||
import org.telegram.messenger.MessageObject;
|
import org.telegram.messenger.MessageObject;
|
||||||
import org.telegram.messenger.MessagesController;
|
import org.telegram.messenger.MessagesController;
|
||||||
|
@ -29,9 +34,7 @@ public class DialogsBotsAdapter extends UniversalAdapter {
|
||||||
private final boolean showOnlyPopular;
|
private final boolean showOnlyPopular;
|
||||||
private final Theme.ResourcesProvider resourcesProvider;
|
private final Theme.ResourcesProvider resourcesProvider;
|
||||||
|
|
||||||
private String popularBotsNextOffset;
|
private final PopularBots popular;
|
||||||
private boolean popularBotsLoaded, popularBotsLoading;
|
|
||||||
public final ArrayList<TLRPC.User> popularBots = new ArrayList<>();
|
|
||||||
|
|
||||||
public final ArrayList<TLRPC.User> searchMine = new ArrayList<>();
|
public final ArrayList<TLRPC.User> searchMine = new ArrayList<>();
|
||||||
public final ArrayList<TLRPC.User> searchGlobal = new ArrayList<>();
|
public final ArrayList<TLRPC.User> searchGlobal = new ArrayList<>();
|
||||||
|
@ -48,9 +51,9 @@ public class DialogsBotsAdapter extends UniversalAdapter {
|
||||||
this.folderId = folderId;
|
this.folderId = folderId;
|
||||||
this.resourcesProvider = resourcesProvider;
|
this.resourcesProvider = resourcesProvider;
|
||||||
this.showOnlyPopular = showOnlyPopular;
|
this.showOnlyPopular = showOnlyPopular;
|
||||||
|
this.popular = new PopularBots(currentAccount, () -> update(true));
|
||||||
update(false);
|
update(false);
|
||||||
MediaDataController.getInstance(currentAccount).loadHints(true);
|
MediaDataController.getInstance(currentAccount).loadHints(true);
|
||||||
loadPopularBots();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int topPeersStart, topPeersEnd;
|
private int topPeersStart, topPeersEnd;
|
||||||
|
@ -111,20 +114,20 @@ public class DialogsBotsAdapter extends UniversalAdapter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
topPeersEnd = items.size();
|
topPeersEnd = items.size();
|
||||||
if (!popularBots.isEmpty()) {
|
if (!popular.bots.isEmpty()) {
|
||||||
if (!showOnlyPopular) items.add(UItem.asGraySection(getString(R.string.SearchAppsPopular)));
|
if (!showOnlyPopular) items.add(UItem.asGraySection(getString(R.string.SearchAppsPopular)));
|
||||||
for (int i = 0; i < popularBots.size(); ++i) {
|
for (int i = 0; i < popular.bots.size(); ++i) {
|
||||||
final TLRPC.User user = popularBots.get(i);
|
final TLRPC.User user = popular.bots.get(i);
|
||||||
if (uids.contains(user.id)) continue;
|
if (uids.contains(user.id)) continue;
|
||||||
uids.add(user.id);
|
uids.add(user.id);
|
||||||
items.add(UItem.asProfileCell(user).accent());
|
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));
|
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));
|
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));
|
||||||
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);
|
searchMessages(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean first = true;
|
||||||
public void checkBottom() {
|
public void checkBottom() {
|
||||||
if (!TextUtils.isEmpty(this.query)) {
|
if (!TextUtils.isEmpty(this.query)) {
|
||||||
if (hasMore && !loadingMessages && seesLoading()) {
|
if (hasMore && !loadingMessages && seesLoading()) {
|
||||||
searchMore();
|
searchMore();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!popularBotsLoading && !TextUtils.isEmpty(popularBotsNextOffset) && seesLoading()) {
|
if (first || seesLoading()) {
|
||||||
loadPopularBots();
|
popular.load();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
first = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean seesLoading() {
|
public boolean seesLoading() {
|
||||||
|
@ -373,26 +378,145 @@ public class DialogsBotsAdapter extends UniversalAdapter {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadPopularBots() {
|
public static class PopularBots {
|
||||||
if (popularBotsLoading || popularBotsLoaded && popularBotsNextOffset == null) return;
|
|
||||||
|
|
||||||
popularBotsLoading = true;
|
private final int currentAccount;
|
||||||
TL_bots.getPopularAppBots req = new TL_bots.getPopularAppBots();
|
private final Runnable whenUpdated;
|
||||||
req.offset = popularBotsNextOffset == null ? "" : popularBotsNextOffset;
|
public PopularBots(int currentAccount, Runnable whenUpdated) {
|
||||||
req.limit = 20;
|
this.currentAccount = currentAccount;
|
||||||
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> {
|
this.whenUpdated = whenUpdated;
|
||||||
popularBotsLoading = false;
|
}
|
||||||
popularBotsLoaded = true;
|
|
||||||
if (res instanceof TL_bots.popularAppBots) {
|
public boolean loading;
|
||||||
TL_bots.popularAppBots r = (TL_bots.popularAppBots) res;
|
private boolean cacheLoaded;
|
||||||
MessagesController.getInstance(currentAccount).putUsers(r.users, false);
|
private boolean endReached;
|
||||||
popularBots.addAll(r.users);
|
|
||||||
popularBotsNextOffset = r.next_offset;
|
private long cacheTime;
|
||||||
} else {
|
private String lastOffset;
|
||||||
popularBotsNextOffset = null;
|
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);
|
||||||
}
|
}
|
||||||
update(true);
|
|
||||||
}));
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
TL_bots.getPopularAppBots req = new TL_bots.getPopularAppBots();
|
||||||
|
req.limit = 20;
|
||||||
|
req.offset = lastOffset == null ? "" : lastOffset;
|
||||||
|
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> {
|
||||||
|
if (res instanceof TL_bots.popularAppBots) {
|
||||||
|
TL_bots.popularAppBots r = (TL_bots.popularAppBots) res;
|
||||||
|
MessagesController.getInstance(currentAccount).putUsers(r.users, false);
|
||||||
|
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 {
|
||||||
|
lastOffset = null;
|
||||||
|
endReached = true;
|
||||||
|
loading = false;
|
||||||
|
whenUpdated.run();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -694,7 +694,7 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
|
||||||
if (cancelled) {
|
if (cancelled) {
|
||||||
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.audioRecordTooShort, recordingGuid, true, (int) recordedTime);
|
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.audioRecordTooShort, recordingGuid, true, (int) recordedTime);
|
||||||
startAnimation(false, false);
|
startAnimation(false, false);
|
||||||
MediaController.getInstance().requestAudioFocus(false);
|
MediaController.getInstance().requestRecordAudioFocus(false);
|
||||||
} else {
|
} else {
|
||||||
videoEncoder.pause();
|
videoEncoder.pause();
|
||||||
}
|
}
|
||||||
|
@ -765,8 +765,8 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
|
||||||
if (MediaController.getInstance().getPlayingMessageObject() != null) {
|
if (MediaController.getInstance().getPlayingMessageObject() != null) {
|
||||||
if (MediaController.getInstance().getPlayingMessageObject().isVideo() || MediaController.getInstance().getPlayingMessageObject().isRoundVideo()) {
|
if (MediaController.getInstance().getPlayingMessageObject().isVideo() || MediaController.getInstance().getPlayingMessageObject().isRoundVideo()) {
|
||||||
MediaController.getInstance().cleanupPlayer(true, true);
|
MediaController.getInstance().cleanupPlayer(true, true);
|
||||||
} else {
|
} else if (SharedConfig.pauseMusicOnRecord) {
|
||||||
MediaController.getInstance().pauseMessage(MediaController.getInstance().getPlayingMessageObject());
|
MediaController.getInstance().pauseByRewind();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -874,7 +874,7 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
|
||||||
setVisibility(VISIBLE);
|
setVisibility(VISIBLE);
|
||||||
|
|
||||||
startAnimation(true, fromPaused);
|
startAnimation(true, fromPaused);
|
||||||
MediaController.getInstance().requestAudioFocus(true);
|
MediaController.getInstance().requestRecordAudioFocus(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public InstantViewCameraContainer getCameraContainer() {
|
public InstantViewCameraContainer getCameraContainer() {
|
||||||
|
@ -1020,7 +1020,7 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
|
||||||
if (scheduleDate != 0) {
|
if (scheduleDate != 0) {
|
||||||
startAnimation(false, false);
|
startAnimation(false, false);
|
||||||
}
|
}
|
||||||
MediaController.getInstance().requestAudioFocus(false);
|
MediaController.getInstance().requestRecordAudioFocus(false);
|
||||||
} else {
|
} else {
|
||||||
cancelled = recordedTime < 800;
|
cancelled = recordedTime < 800;
|
||||||
recording = false;
|
recording = false;
|
||||||
|
@ -1049,7 +1049,7 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
|
||||||
if (cancelled) {
|
if (cancelled) {
|
||||||
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.audioRecordTooShort, recordingGuid, true, (int) recordedTime);
|
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.audioRecordTooShort, recordingGuid, true, (int) recordedTime);
|
||||||
startAnimation(false, false);
|
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);
|
AutoDeleteMediaTask.unlockFile(cameraFile);
|
||||||
cameraFile = null;
|
cameraFile = null;
|
||||||
}
|
}
|
||||||
MediaController.getInstance().requestAudioFocus(false);
|
MediaController.getInstance().requestRecordAudioFocus(false);
|
||||||
startAnimation(false, false);
|
startAnimation(false, false);
|
||||||
blurBehindDrawable.show(false);
|
blurBehindDrawable.show(false);
|
||||||
invalidate();
|
invalidate();
|
||||||
|
@ -1129,7 +1129,7 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
|
||||||
textureOverlayView.setTranslationX(0);
|
textureOverlayView.setTranslationX(0);
|
||||||
animationTranslationY = 0;
|
animationTranslationY = 0;
|
||||||
updateTranslationY();
|
updateTranslationY();
|
||||||
MediaController.getInstance().playMessage(MediaController.getInstance().getPlayingMessageObject());
|
MediaController.getInstance().resumeByRewind();
|
||||||
|
|
||||||
if (textureView != null) {
|
if (textureView != null) {
|
||||||
ViewGroup parent = (ViewGroup) textureView.getParent();
|
ViewGroup parent = (ViewGroup) textureView.getParent();
|
||||||
|
@ -3106,7 +3106,7 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
|
||||||
videoEditedInfo.notReadyYet = false;
|
videoEditedInfo.notReadyYet = false;
|
||||||
}
|
}
|
||||||
didWriteData(videoFile, 0, true);
|
didWriteData(videoFile, 0, true);
|
||||||
MediaController.getInstance().requestAudioFocus(false);
|
MediaController.getInstance().requestRecordAudioFocus(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
EGL14.eglDestroySurface(eglDisplay, eglSurface);
|
EGL14.eglDestroySurface(eglDisplay, eglSurface);
|
||||||
|
@ -3633,7 +3633,7 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
|
||||||
" float radius = 0.51 * resolution.x;\n" +
|
" float radius = 0.51 * resolution.x;\n" +
|
||||||
" float d = length(coord - gl_FragCoord.xy) - radius;\n" +
|
" float d = length(coord - gl_FragCoord.xy) - radius;\n" +
|
||||||
" float t = clamp(d, 0.0, 1.0);\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" +
|
" gl_FragColor = vec4(color * alpha, alpha);\n" +
|
||||||
"}\n";
|
"}\n";
|
||||||
}
|
}
|
||||||
|
@ -3669,7 +3669,7 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
|
||||||
" vec4 x2 = mix(bl, br, frac.x);\n" +
|
" vec4 x2 = mix(bl, br, frac.x);\n" +
|
||||||
" gl_FragColor = mix(x1, x2, frac.y) * alpha;" +
|
" gl_FragColor = mix(x1, x2, frac.y) * alpha;" +
|
||||||
" } else {\n" +
|
" } else {\n" +
|
||||||
" gl_FragColor = vec4(0, 0, 0, alpha);\n" +
|
" gl_FragColor = vec4(1, 1, 1, alpha);\n" +
|
||||||
" }\n" +
|
" }\n" +
|
||||||
"}\n";
|
"}\n";
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,6 +78,7 @@ public class MediaActivity extends BaseFragment implements SharedMediaLayout.Sha
|
||||||
private long dialogId;
|
private long dialogId;
|
||||||
private long topicId;
|
private long topicId;
|
||||||
private String hashtag;
|
private String hashtag;
|
||||||
|
private int storiesCount;
|
||||||
private FrameLayout titlesContainer;
|
private FrameLayout titlesContainer;
|
||||||
private FrameLayout[] titles = new FrameLayout[2];
|
private FrameLayout[] titles = new FrameLayout[2];
|
||||||
private SimpleTextView[] nameTextView = new SimpleTextView[2];
|
private SimpleTextView[] nameTextView = new SimpleTextView[2];
|
||||||
|
@ -113,6 +114,7 @@ public class MediaActivity extends BaseFragment implements SharedMediaLayout.Sha
|
||||||
dialogId = getArguments().getLong("dialog_id");
|
dialogId = getArguments().getLong("dialog_id");
|
||||||
topicId = getArguments().getLong("topic_id", 0);
|
topicId = getArguments().getLong("topic_id", 0);
|
||||||
hashtag = getArguments().getString("hashtag", "");
|
hashtag = getArguments().getString("hashtag", "");
|
||||||
|
storiesCount = getArguments().getInt("storiesCount", -1);
|
||||||
int defaultTab = SharedMediaLayout.TAB_PHOTOVIDEO;
|
int defaultTab = SharedMediaLayout.TAB_PHOTOVIDEO;
|
||||||
if (type == TYPE_ARCHIVED_CHANNEL_STORIES) {
|
if (type == TYPE_ARCHIVED_CHANNEL_STORIES) {
|
||||||
defaultTab = SharedMediaLayout.TAB_ARCHIVED_STORIES;
|
defaultTab = SharedMediaLayout.TAB_ARCHIVED_STORIES;
|
||||||
|
@ -343,36 +345,32 @@ public class MediaActivity extends BaseFragment implements SharedMediaLayout.Sha
|
||||||
|
|
||||||
boolean hasAvatar = type == TYPE_MEDIA;
|
boolean hasAvatar = type == TYPE_MEDIA;
|
||||||
|
|
||||||
if (type == TYPE_STORIES_SEARCH) {
|
titlesContainer = new FrameLayout(context);
|
||||||
actionBar.setTitle(hashtag);
|
avatarContainer.addView(titlesContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.FILL));
|
||||||
} else {
|
for (int i = 0; i < (type == TYPE_STORIES ? 2 : 1); ++i) {
|
||||||
titlesContainer = new FrameLayout(context);
|
titles[i] = new FrameLayout(context);
|
||||||
avatarContainer.addView(titlesContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.FILL));
|
titlesContainer.addView(titles[i], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.FILL));
|
||||||
for (int i = 0; i < (type == TYPE_STORIES ? 2 : 1); ++i) {
|
|
||||||
titles[i] = new FrameLayout(context);
|
|
||||||
titlesContainer.addView(titles[i], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.FILL));
|
|
||||||
|
|
||||||
nameTextView[i] = new SimpleTextView(context);
|
nameTextView[i] = new SimpleTextView(context);
|
||||||
nameTextView[i].setPivotX(0);
|
nameTextView[i].setPivotX(0);
|
||||||
nameTextView[i].setPivotY(dp(9));
|
nameTextView[i].setPivotY(dp(9));
|
||||||
|
|
||||||
nameTextView[i].setTextSize(18);
|
nameTextView[i].setTextSize(18);
|
||||||
nameTextView[i].setGravity(Gravity.LEFT);
|
nameTextView[i].setGravity(Gravity.LEFT);
|
||||||
nameTextView[i].setTypeface(AndroidUtilities.bold());
|
nameTextView[i].setTypeface(AndroidUtilities.bold());
|
||||||
nameTextView[i].setLeftDrawableTopPadding(-dp(1.3f));
|
nameTextView[i].setLeftDrawableTopPadding(-dp(1.3f));
|
||||||
nameTextView[i].setScrollNonFitText(true);
|
nameTextView[i].setScrollNonFitText(true);
|
||||||
nameTextView[i].setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
|
nameTextView[i].setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
|
||||||
titles[i].addView(nameTextView[i], LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, hasAvatar ? 118 : 72, 0, 56, 0));
|
titles[i].addView(nameTextView[i], LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, hasAvatar ? 118 : 72, 0, 56, 0));
|
||||||
|
|
||||||
subtitleTextView[i] = new AnimatedTextView(context, true, true, true);
|
subtitleTextView[i] = new AnimatedTextView(context, true, true, true);
|
||||||
subtitleTextView[i].setAnimationProperties(.4f, 0, 320, CubicBezierInterpolator.EASE_OUT_QUINT);
|
subtitleTextView[i].setAnimationProperties(.4f, 0, 320, CubicBezierInterpolator.EASE_OUT_QUINT);
|
||||||
subtitleTextView[i].setTextSize(AndroidUtilities.dp(14));
|
subtitleTextView[i].setTextSize(AndroidUtilities.dp(14));
|
||||||
subtitleTextView[i].setTextColor(Theme.getColor(Theme.key_player_actionBarSubtitle));
|
subtitleTextView[i].setTextColor(Theme.getColor(Theme.key_player_actionBarSubtitle));
|
||||||
titles[i].addView(subtitleTextView[i], LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, hasAvatar ? 118 : 72, 0, 56, 0));
|
titles[i].addView(subtitleTextView[i], LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, hasAvatar ? 118 : 72, 0, 56, 0));
|
||||||
|
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
titles[i].setAlpha(0f);
|
titles[i].setAlpha(0f);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -754,7 +752,10 @@ public class MediaActivity extends BaseFragment implements SharedMediaLayout.Sha
|
||||||
}
|
}
|
||||||
TLObject avatarObject = null;
|
TLObject avatarObject = null;
|
||||||
if (type == TYPE_STORIES_SEARCH) {
|
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) {
|
} else if (type == TYPE_ARCHIVED_CHANNEL_STORIES) {
|
||||||
nameTextView[0].setText(LocaleController.getString("ProfileStoriesArchive"));
|
nameTextView[0].setText(LocaleController.getString("ProfileStoriesArchive"));
|
||||||
} else if (type == TYPE_STORIES) {
|
} else if (type == TYPE_STORIES) {
|
||||||
|
@ -868,6 +869,9 @@ public class MediaActivity extends BaseFragment implements SharedMediaLayout.Sha
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int id = sharedMediaLayout.getClosestTab();
|
int id = sharedMediaLayout.getClosestTab();
|
||||||
|
if (type == TYPE_STORIES_SEARCH && id != SharedMediaLayout.TAB_STORIES) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
int[] mediaCount = sharedMediaPreloader.getLastMediaCount();
|
int[] mediaCount = sharedMediaPreloader.getLastMediaCount();
|
||||||
final boolean animated = !LocaleController.isRTL;
|
final boolean animated = !LocaleController.isRTL;
|
||||||
int i;
|
int i;
|
||||||
|
@ -888,8 +892,15 @@ public class MediaActivity extends BaseFragment implements SharedMediaLayout.Sha
|
||||||
|
|
||||||
int count = sharedMediaLayout.getStoriesCount(SharedMediaLayout.TAB_STORIES);
|
int count = sharedMediaLayout.getStoriesCount(SharedMediaLayout.TAB_STORIES);
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
showSubtitle(0, true, true);
|
if (type == TYPE_STORIES_SEARCH) {
|
||||||
subtitleTextView[0].setText(LocaleController.formatPluralString("ProfileMyStoriesCount", count), animated);
|
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 {
|
} else {
|
||||||
showSubtitle(0, false, true);
|
showSubtitle(0, false, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -290,6 +290,7 @@ public class PipRoundVideoView implements NotificationCenter.NotificationCenterD
|
||||||
windowLayoutParams.gravity = Gravity.TOP | Gravity.LEFT;
|
windowLayoutParams.gravity = Gravity.TOP | Gravity.LEFT;
|
||||||
windowLayoutParams.type = WindowManager.LayoutParams.LAST_APPLICATION_WINDOW;
|
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;
|
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);
|
windowManager.addView(windowView, windowLayoutParams);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
FileLog.e(e);
|
FileLog.e(e);
|
||||||
|
|
|
@ -928,6 +928,7 @@ public class PipVideoOverlay {
|
||||||
protected void onConfigurationChanged(Configuration newConfig) {
|
protected void onConfigurationChanged(Configuration newConfig) {
|
||||||
AndroidUtilities.checkDisplaySize(getContext(), newConfig);
|
AndroidUtilities.checkDisplaySize(getContext(), newConfig);
|
||||||
pipConfig = null;
|
pipConfig = null;
|
||||||
|
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, contentView, windowLayoutParams);
|
||||||
|
|
||||||
if (pipWidth != getSuggestedWidth() * scaleFactor || pipHeight != getSuggestedHeight() * scaleFactor) {
|
if (pipWidth != getSuggestedWidth() * scaleFactor || pipHeight != getSuggestedHeight() * scaleFactor) {
|
||||||
windowLayoutParams.width = pipWidth = (int) (getSuggestedWidth() * scaleFactor);
|
windowLayoutParams.width = pipWidth = (int) (getSuggestedWidth() * scaleFactor);
|
||||||
|
@ -1127,6 +1128,7 @@ public class PipVideoOverlay {
|
||||||
windowLayoutParams.dimAmount = 0f;
|
windowLayoutParams.dimAmount = 0f;
|
||||||
windowLayoutParams.flags = FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
|
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
|
// Animate is a flag for PhotoViewer transition, not ours
|
||||||
if (animate) {
|
if (animate) {
|
||||||
windowManager.addView(contentView, windowLayoutParams);
|
windowManager.addView(contentView, windowLayoutParams);
|
||||||
|
|
|
@ -342,7 +342,7 @@ public class GiveawayResultsMessageCell {
|
||||||
}
|
}
|
||||||
isStars = (giveaway.flags & 32) != 0;
|
isStars = (giveaway.flags & 32) != 0;
|
||||||
if (isStars) {
|
if (isStars) {
|
||||||
bottomStringBuilder.append(LocaleController.formatPluralStringComma("BoostingStarsGiveawayResultsMsgAllWinnersReceivedLinks", (int) giveaway.stars, ' '));
|
bottomStringBuilder.append(LocaleController.formatPluralStringSpaced("BoostingStarsGiveawayResultsMsgAllWinnersReceivedLinks", (int) giveaway.stars));
|
||||||
} else {
|
} else {
|
||||||
bottomStringBuilder.append(LocaleController.getString(R.string.BoostingGiveawayResultsMsgAllWinnersReceivedLinks));
|
bottomStringBuilder.append(LocaleController.getString(R.string.BoostingGiveawayResultsMsgAllWinnersReceivedLinks));
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,6 +291,7 @@ public class CustomEmojiReactionsWindow {
|
||||||
} else {
|
} else {
|
||||||
WindowManager.LayoutParams lp = createLayoutParams(false);
|
WindowManager.LayoutParams lp = createLayoutParams(false);
|
||||||
windowManager = AndroidUtilities.findActivity(context).getWindowManager();
|
windowManager = AndroidUtilities.findActivity(context).getWindowManager();
|
||||||
|
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, windowView, lp);
|
||||||
windowManager.addView(windowView, lp);
|
windowManager.addView(windowView, lp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -756,6 +756,7 @@ public class ReactionsEffectOverlay {
|
||||||
lp.format = PixelFormat.TRANSLUCENT;
|
lp.format = PixelFormat.TRANSLUCENT;
|
||||||
|
|
||||||
reactionsEffectOverlay.windowManager = baseFragment.getParentActivity().getWindowManager();
|
reactionsEffectOverlay.windowManager = baseFragment.getParentActivity().getWindowManager();
|
||||||
|
AndroidUtilities.setPreferredMaxRefreshRate(reactionsEffectOverlay.windowManager, reactionsEffectOverlay.windowView, lp);
|
||||||
reactionsEffectOverlay.windowManager.addView(reactionsEffectOverlay.windowView, lp);
|
reactionsEffectOverlay.windowManager.addView(reactionsEffectOverlay.windowView, lp);
|
||||||
} else {
|
} else {
|
||||||
reactionsEffectOverlay.decorView = (FrameLayout) baseFragment.getParentActivity().getWindow().getDecorView();
|
reactionsEffectOverlay.decorView = (FrameLayout) baseFragment.getParentActivity().getWindow().getDecorView();
|
||||||
|
|
|
@ -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 ImageReceiver previewImageReceiver;
|
||||||
public AnimatedEmojiDrawable previewAnimatedEmojiDrawable;
|
public AnimatedEmojiDrawable previewAnimatedEmojiDrawable;
|
||||||
|
|
|
@ -481,6 +481,9 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie
|
||||||
// MessagesController.getInstance(currentAccount).getChannelRecommendations(0);
|
// MessagesController.getInstance(currentAccount).getChannelRecommendations(0);
|
||||||
botsSearchAdapter.search(query);
|
botsSearchAdapter.search(query);
|
||||||
botsEmptyView.setKeyboardHeight(keyboardSize, false);
|
botsEmptyView.setKeyboardHeight(keyboardSize, false);
|
||||||
|
if (TextUtils.isEmpty(query)) {
|
||||||
|
botsSearchAdapter.checkBottom();
|
||||||
|
}
|
||||||
} else if (view == searchContainer) {
|
} else if (view == searchContainer) {
|
||||||
if (dialogId == 0 && minDate == 0 && maxDate == 0 || forumDialogId != 0) {
|
if (dialogId == 0 && minDate == 0 && maxDate == 0 || forumDialogId != 0) {
|
||||||
lastSearchScrolledToTop = false;
|
lastSearchScrolledToTop = false;
|
||||||
|
|
|
@ -274,6 +274,7 @@ public class SenderSelectPopup extends ActionBarPopupWindow {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||||
params.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
|
params.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
|
||||||
}
|
}
|
||||||
|
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, bulletinContainer, params);
|
||||||
windowManager.addView(bulletinContainer, params);
|
windowManager.addView(bulletinContainer, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1517,6 +1517,7 @@ public class ThemeEditorView {
|
||||||
windowLayoutParams.gravity = Gravity.TOP | Gravity.LEFT;
|
windowLayoutParams.gravity = Gravity.TOP | Gravity.LEFT;
|
||||||
windowLayoutParams.type = WindowManager.LayoutParams.LAST_APPLICATION_WINDOW;
|
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;
|
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);
|
windowManager.addView(windowView, windowLayoutParams);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
FileLog.e(e);
|
FileLog.e(e);
|
||||||
|
@ -1608,6 +1609,7 @@ public class ThemeEditorView {
|
||||||
if (parentActivity == null) {
|
if (parentActivity == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, windowView, windowLayoutParams);
|
||||||
try {
|
try {
|
||||||
windowManager.addView(windowView, windowLayoutParams);
|
windowManager.addView(windowView, windowLayoutParams);
|
||||||
hidden = false;
|
hidden = false;
|
||||||
|
|
|
@ -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) {
|
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) {
|
TranslateAlert2 alert = new TranslateAlert2(context, fromLanguage, toLanguage, text, entities, null) {
|
||||||
@Override
|
@Override
|
||||||
public void dismiss() {
|
public void dismiss() {
|
||||||
|
|
|
@ -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
|
if (item.accent && object instanceof TLRPC.User && ((TLRPC.User) object).bot_active_users != 0) { // show bot dau
|
||||||
TLRPC.User user = (TLRPC.User) object;
|
TLRPC.User user = (TLRPC.User) object;
|
||||||
if (user.bot_active_users != 0) {
|
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) {
|
} else if (item.withUsername) {
|
||||||
String username = null;
|
String username = null;
|
||||||
|
@ -865,9 +865,9 @@ public class UniversalAdapter extends AdapterWithDiffUtils {
|
||||||
if (chat.participants_count != 0) {
|
if (chat.participants_count != 0) {
|
||||||
String membersString;
|
String membersString;
|
||||||
if (ChatObject.isChannel(chat) && !chat.megagroup) {
|
if (ChatObject.isChannel(chat) && !chat.megagroup) {
|
||||||
membersString = LocaleController.formatPluralStringComma("Subscribers", chat.participants_count, ' ');
|
membersString = LocaleController.formatPluralStringSpaced("Subscribers", chat.participants_count);
|
||||||
} else {
|
} else {
|
||||||
membersString = LocaleController.formatPluralStringComma("Members", chat.participants_count, ' ');
|
membersString = LocaleController.formatPluralStringSpaced("Members", chat.participants_count);
|
||||||
}
|
}
|
||||||
if (s instanceof SpannableStringBuilder) {
|
if (s instanceof SpannableStringBuilder) {
|
||||||
((SpannableStringBuilder) s).append(", ").append(membersString);
|
((SpannableStringBuilder) s).append(", ").append(membersString);
|
||||||
|
|
|
@ -462,6 +462,7 @@ public class RTMPStreamPipOverlay implements NotificationCenter.NotificationCent
|
||||||
@Override
|
@Override
|
||||||
protected void onConfigurationChanged(Configuration newConfig) {
|
protected void onConfigurationChanged(Configuration newConfig) {
|
||||||
AndroidUtilities.checkDisplaySize(getContext(), newConfig);
|
AndroidUtilities.checkDisplaySize(getContext(), newConfig);
|
||||||
|
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, contentView, windowLayoutParams);
|
||||||
bindTextureView();
|
bindTextureView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -612,6 +613,7 @@ public class RTMPStreamPipOverlay implements NotificationCenter.NotificationCent
|
||||||
contentView.setAlpha(0f);
|
contentView.setAlpha(0f);
|
||||||
contentView.setScaleX(0.1f);
|
contentView.setScaleX(0.1f);
|
||||||
contentView.setScaleY(0.1f);
|
contentView.setScaleY(0.1f);
|
||||||
|
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, contentView, windowLayoutParams);
|
||||||
windowManager.addView(contentView, windowLayoutParams);
|
windowManager.addView(contentView, windowLayoutParams);
|
||||||
|
|
||||||
AnimatorSet set = new AnimatorSet();
|
AnimatorSet set = new AnimatorSet();
|
||||||
|
|
|
@ -687,6 +687,7 @@ public class VoIPPiPView implements VoIPService.StateListener, NotificationCente
|
||||||
layoutParams.x = (int) (windowLayoutParams.x - (widthExpanded - widthNormal) * cX);
|
layoutParams.x = (int) (windowLayoutParams.x - (widthExpanded - widthNormal) * cX);
|
||||||
layoutParams.y = (int) (windowLayoutParams.y - (heightExpanded - heightNormal) * cY);
|
layoutParams.y = (int) (windowLayoutParams.y - (heightExpanded - heightNormal) * cY);
|
||||||
|
|
||||||
|
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, pipViewExpanded.windowView, layoutParams);
|
||||||
windowManager.addView(pipViewExpanded.windowView, layoutParams);
|
windowManager.addView(pipViewExpanded.windowView, layoutParams);
|
||||||
pipViewExpanded.windowView.setAlpha(1f);
|
pipViewExpanded.windowView.setAlpha(1f);
|
||||||
pipViewExpanded.windowLayoutParams = layoutParams;
|
pipViewExpanded.windowLayoutParams = layoutParams;
|
||||||
|
@ -784,6 +785,7 @@ public class VoIPPiPView implements VoIPService.StateListener, NotificationCente
|
||||||
}
|
}
|
||||||
swapRender(expandedInstance, instance);
|
swapRender(expandedInstance, instance);
|
||||||
instance.windowView.setAlpha(1f);
|
instance.windowView.setAlpha(1f);
|
||||||
|
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, instance.windowView, instance.windowLayoutParams);
|
||||||
windowManager.addView(instance.windowView, instance.windowLayoutParams);
|
windowManager.addView(instance.windowView, instance.windowLayoutParams);
|
||||||
AndroidUtilities.runOnUIThread(() -> {
|
AndroidUtilities.runOnUIThread(() -> {
|
||||||
if (instance == null || expandedInstance == null) {
|
if (instance == null || expandedInstance == null) {
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
package org.telegram.ui;
|
package org.telegram.ui;
|
||||||
|
|
||||||
import static org.telegram.messenger.AndroidUtilities.dp;
|
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.formatString;
|
||||||
import static org.telegram.messenger.LocaleController.getString;
|
import static org.telegram.messenger.LocaleController.getString;
|
||||||
|
|
||||||
|
@ -5860,7 +5861,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
updateDialogsHint();
|
updateDialogsHint();
|
||||||
}).show();
|
}).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 -> {
|
dialogsHintCell.setOnCloseListener(v -> {
|
||||||
MessagesController.getInstance(currentAccount).removeSuggestion(0, "STARS_SUBSCRIPTION_LOW_BALANCE");
|
MessagesController.getInstance(currentAccount).removeSuggestion(0, "STARS_SUBSCRIPTION_LOW_BALANCE");
|
||||||
ChangeBounds transition = new ChangeBounds();
|
ChangeBounds transition = new ChangeBounds();
|
||||||
|
|
|
@ -601,6 +601,7 @@ public class ExternalActionActivity extends Activity implements INavigationLayou
|
||||||
@Override
|
@Override
|
||||||
public void onConfigurationChanged(android.content.res.Configuration newConfig) {
|
public void onConfigurationChanged(android.content.res.Configuration newConfig) {
|
||||||
AndroidUtilities.checkDisplaySize(this, newConfig);
|
AndroidUtilities.checkDisplaySize(this, newConfig);
|
||||||
|
AndroidUtilities.setPreferredMaxRefreshRate(getWindow());
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
fixLayout();
|
fixLayout();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6481,6 +6481,7 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
|
||||||
@Override
|
@Override
|
||||||
public void onConfigurationChanged(Configuration newConfig) {
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
AndroidUtilities.checkDisplaySize(this, newConfig);
|
AndroidUtilities.checkDisplaySize(this, newConfig);
|
||||||
|
AndroidUtilities.setPreferredMaxRefreshRate(getWindow());
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
checkLayout();
|
checkLayout();
|
||||||
PipRoundVideoView pipRoundVideoView = PipRoundVideoView.getInstance();
|
PipRoundVideoView pipRoundVideoView = PipRoundVideoView.getInstance();
|
||||||
|
|
|
@ -536,6 +536,7 @@ public class PopupNotificationActivity extends Activity implements NotificationC
|
||||||
public void onConfigurationChanged(Configuration newConfig) {
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
AndroidUtilities.checkDisplaySize(this, newConfig);
|
AndroidUtilities.checkDisplaySize(this, newConfig);
|
||||||
|
AndroidUtilities.setPreferredMaxRefreshRate(getWindow());
|
||||||
fixLayout();
|
fixLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12574,7 +12574,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
private void openUrl(String url, Browser.Progress progress) {
|
private void openUrl(String url, Browser.Progress progress) {
|
||||||
if (url.startsWith("@")) {
|
if (url.startsWith("@")) {
|
||||||
getMessagesController().openByUserName(url.substring(1), ProfileActivity.this, 0, progress);
|
getMessagesController().openByUserName(url.substring(1), ProfileActivity.this, 0, progress);
|
||||||
} else if (url.startsWith("#")) {
|
} else if (url.startsWith("#") || url.startsWith("$")) {
|
||||||
DialogsActivity fragment = new DialogsActivity(null);
|
DialogsActivity fragment = new DialogsActivity(null);
|
||||||
fragment.setSearchString(url);
|
fragment.setSearchString(url);
|
||||||
presentFragment(fragment);
|
presentFragment(fragment);
|
||||||
|
|
|
@ -38,6 +38,7 @@ public class ShareActivity extends Activity {
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
ApplicationLoader.postInitApplication();
|
ApplicationLoader.postInitApplication();
|
||||||
AndroidUtilities.checkDisplaySize(this, getResources().getConfiguration());
|
AndroidUtilities.checkDisplaySize(this, getResources().getConfiguration());
|
||||||
|
AndroidUtilities.setPreferredMaxRefreshRate(getWindow());
|
||||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
setTheme(R.style.Theme_TMessages_Transparent);
|
setTheme(R.style.Theme_TMessages_Transparent);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
package org.telegram.ui.Stars;
|
package org.telegram.ui.Stars;
|
||||||
|
|
||||||
import static org.telegram.messenger.AndroidUtilities.dp;
|
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.messenger.LocaleController.getString;
|
||||||
import static org.telegram.ui.ActionBar.Theme.key_statisticChartLine_golden;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -12,28 +9,23 @@ import android.graphics.PorterDuff;
|
||||||
import android.graphics.PorterDuffColorFilter;
|
import android.graphics.PorterDuffColorFilter;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.text.method.PasswordTransformationMethod;
|
|
||||||
import android.text.style.RelativeSizeSpan;
|
import android.text.style.RelativeSizeSpan;
|
||||||
import android.util.Log;
|
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.widget.FrameLayout;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.Space;
|
import android.widget.Space;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.core.view.NestedScrollingParent3;
|
import androidx.core.view.NestedScrollingParent3;
|
||||||
import androidx.core.view.NestedScrollingParentHelper;
|
import androidx.core.view.NestedScrollingParentHelper;
|
||||||
import androidx.core.view.ViewCompat;
|
import androidx.core.view.ViewCompat;
|
||||||
|
@ -51,25 +43,19 @@ import org.telegram.messenger.UserConfig;
|
||||||
import org.telegram.messenger.UserObject;
|
import org.telegram.messenger.UserObject;
|
||||||
import org.telegram.messenger.browser.Browser;
|
import org.telegram.messenger.browser.Browser;
|
||||||
import org.telegram.tgnet.ConnectionsManager;
|
import org.telegram.tgnet.ConnectionsManager;
|
||||||
import org.telegram.tgnet.TLObject;
|
|
||||||
import org.telegram.tgnet.TLRPC;
|
import org.telegram.tgnet.TLRPC;
|
||||||
import org.telegram.tgnet.tl.TL_stats;
|
|
||||||
import org.telegram.ui.ActionBar.ActionBar;
|
import org.telegram.ui.ActionBar.ActionBar;
|
||||||
import org.telegram.ui.ActionBar.AlertDialog;
|
import org.telegram.ui.ActionBar.AlertDialog;
|
||||||
import org.telegram.ui.ActionBar.BackDrawable;
|
import org.telegram.ui.ActionBar.BackDrawable;
|
||||||
import org.telegram.ui.ActionBar.BaseFragment;
|
import org.telegram.ui.ActionBar.BaseFragment;
|
||||||
import org.telegram.ui.ActionBar.Theme;
|
import org.telegram.ui.ActionBar.Theme;
|
||||||
import org.telegram.ui.ChannelMonetizationLayout;
|
import org.telegram.ui.ChannelMonetizationLayout;
|
||||||
import org.telegram.ui.Charts.data.ChartData;
|
|
||||||
import org.telegram.ui.Components.AnimatedTextView;
|
import org.telegram.ui.Components.AnimatedTextView;
|
||||||
import org.telegram.ui.Components.Bulletin;
|
import org.telegram.ui.Components.Bulletin;
|
||||||
import org.telegram.ui.Components.BulletinFactory;
|
import org.telegram.ui.Components.BulletinFactory;
|
||||||
import org.telegram.ui.Components.ChatAvatarContainer;
|
import org.telegram.ui.Components.ChatAvatarContainer;
|
||||||
import org.telegram.ui.Components.CircularProgressDrawable;
|
|
||||||
import org.telegram.ui.Components.ColoredImageSpan;
|
import org.telegram.ui.Components.ColoredImageSpan;
|
||||||
import org.telegram.ui.Components.CubicBezierInterpolator;
|
|
||||||
import org.telegram.ui.Components.EditTextBoldCursor;
|
import org.telegram.ui.Components.EditTextBoldCursor;
|
||||||
import org.telegram.ui.Components.FlickerLoadingView;
|
|
||||||
import org.telegram.ui.Components.LayoutHelper;
|
import org.telegram.ui.Components.LayoutHelper;
|
||||||
import org.telegram.ui.Components.OutlineTextContainerView;
|
import org.telegram.ui.Components.OutlineTextContainerView;
|
||||||
import org.telegram.ui.Components.RecyclerListView;
|
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.UItem;
|
||||||
import org.telegram.ui.Components.UniversalAdapter;
|
import org.telegram.ui.Components.UniversalAdapter;
|
||||||
import org.telegram.ui.Components.UniversalRecyclerView;
|
import org.telegram.ui.Components.UniversalRecyclerView;
|
||||||
import org.telegram.ui.GradientHeaderActivity;
|
|
||||||
import org.telegram.ui.StatisticActivity;
|
import org.telegram.ui.StatisticActivity;
|
||||||
import org.telegram.ui.Stories.recorder.ButtonWithCounterView;
|
import org.telegram.ui.Stories.recorder.ButtonWithCounterView;
|
||||||
import org.telegram.ui.TwoStepVerificationActivity;
|
import org.telegram.ui.TwoStepVerificationActivity;
|
||||||
import org.telegram.ui.TwoStepVerificationSetupActivity;
|
import org.telegram.ui.TwoStepVerificationSetupActivity;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import java.text.DecimalFormatSymbols;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class BotStarsActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
|
public class BotStarsActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
|
||||||
|
@ -460,7 +442,7 @@ public class BotStarsActivity extends BaseFragment implements NotificationCenter
|
||||||
AndroidUtilities.runOnUIThread(this.setBalanceButtonText, 1000);
|
AndroidUtilities.runOnUIThread(this.setBalanceButtonText, 1000);
|
||||||
} else {
|
} else {
|
||||||
balanceButton.setSubText(null, true);
|
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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.telegram.ui.Stars;
|
||||||
import static org.telegram.messenger.AndroidUtilities.dp;
|
import static org.telegram.messenger.AndroidUtilities.dp;
|
||||||
import static org.telegram.messenger.LocaleController.formatPluralString;
|
import static org.telegram.messenger.LocaleController.formatPluralString;
|
||||||
import static org.telegram.messenger.LocaleController.formatPluralStringComma;
|
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.formatString;
|
||||||
import static org.telegram.messenger.LocaleController.getString;
|
import static org.telegram.messenger.LocaleController.getString;
|
||||||
import static org.telegram.ui.Stars.StarsIntroActivity.StarsTransactionView.getPlatformDrawable;
|
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.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
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.AndroidUtilities;
|
||||||
import org.telegram.messenger.BillingController;
|
import org.telegram.messenger.BillingController;
|
||||||
import org.telegram.messenger.BirthdayController;
|
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.RecyclerListView;
|
||||||
import org.telegram.ui.Components.ScaleStateListAnimator;
|
import org.telegram.ui.Components.ScaleStateListAnimator;
|
||||||
import org.telegram.ui.Components.StarAppsSheet;
|
import org.telegram.ui.Components.StarAppsSheet;
|
||||||
import org.telegram.ui.Components.TableLayout;
|
|
||||||
import org.telegram.ui.Components.TableView;
|
import org.telegram.ui.Components.TableView;
|
||||||
import org.telegram.ui.Components.Text;
|
import org.telegram.ui.Components.Text;
|
||||||
import org.telegram.ui.Components.UItem;
|
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 org.telegram.ui.Stories.recorder.HintView2;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -823,7 +819,7 @@ public class StarsIntroActivity extends GradientHeaderActivity implements Notifi
|
||||||
item.id = id;
|
item.id = id;
|
||||||
item.intValue = index;
|
item.intValue = index;
|
||||||
item.longValue = option.stars;
|
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.subtext = option.loadingStorePrice ? null : BillingController.getInstance().formatCurrency(option.amount, option.currency);
|
||||||
item.object = option;
|
item.object = option;
|
||||||
return item;
|
return item;
|
||||||
|
@ -834,7 +830,7 @@ public class StarsIntroActivity extends GradientHeaderActivity implements Notifi
|
||||||
item.id = id;
|
item.id = id;
|
||||||
item.intValue = index;
|
item.intValue = index;
|
||||||
item.longValue = option.stars;
|
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.subtext = option.loadingStorePrice ? null : BillingController.getInstance().formatCurrency(option.amount, option.currency);
|
||||||
item.object = option;
|
item.object = option;
|
||||||
return item;
|
return item;
|
||||||
|
@ -3654,7 +3650,7 @@ public class StarsIntroActivity extends GradientHeaderActivity implements Notifi
|
||||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);
|
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);
|
||||||
textView.setTypeface(AndroidUtilities.bold());
|
textView.setTypeface(AndroidUtilities.bold());
|
||||||
textView.setGravity(Gravity.CENTER);
|
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));
|
linearLayout.addView(textView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 20, 0, 20, 4));
|
||||||
|
|
||||||
textView = new TextView(context);
|
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.setPadding(dp(4), 0, dp(8.33f), 0);
|
||||||
textView.setGravity(Gravity.CENTER);
|
textView.setGravity(Gravity.CENTER);
|
||||||
textView.setTypeface(AndroidUtilities.bold());
|
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);
|
final ColoredImageSpan span = new ColoredImageSpan(R.drawable.mini_boost_badge, ColoredImageSpan.ALIGN_CENTER);
|
||||||
span.translate(0, dp(0.66f));
|
span.translate(0, dp(0.66f));
|
||||||
sb.setSpan(span, 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
sb.setSpan(span, 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
|
|
@ -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);
|
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);
|
windowManager.addView(windowView, windowLayoutParams);
|
||||||
}
|
}
|
||||||
windowView.requestLayout();
|
windowView.requestLayout();
|
||||||
|
|
|
@ -166,6 +166,7 @@ public class StoryWaveEffectView extends TextureView implements TextureView.Surf
|
||||||
}
|
}
|
||||||
|
|
||||||
public StoryWaveEffectView start() {
|
public StoryWaveEffectView start() {
|
||||||
|
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, this, layoutParams);
|
||||||
windowManager.addView(this, layoutParams);
|
windowManager.addView(this, layoutParams);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -485,6 +485,7 @@ public class StoryRecorder implements NotificationCenter.NotificationCenterDeleg
|
||||||
forceBackgroundVisible = false;
|
forceBackgroundVisible = false;
|
||||||
|
|
||||||
if (windowManager != null && windowView != null && windowView.getParent() == null) {
|
if (windowManager != null && windowView != null && windowView.getParent() == null) {
|
||||||
|
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, windowView, windowLayoutParams);
|
||||||
windowManager.addView(windowView, windowLayoutParams);
|
windowManager.addView(windowView, windowLayoutParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -546,6 +547,7 @@ public class StoryRecorder implements NotificationCenter.NotificationCenterDeleg
|
||||||
videoTextureHolder.active = false;
|
videoTextureHolder.active = false;
|
||||||
|
|
||||||
if (windowManager != null && windowView != null && windowView.getParent() == null) {
|
if (windowManager != null && windowView != null && windowView.getParent() == null) {
|
||||||
|
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, windowView, windowLayoutParams);
|
||||||
windowManager.addView(windowView, windowLayoutParams);
|
windowManager.addView(windowView, windowLayoutParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -603,6 +605,7 @@ public class StoryRecorder implements NotificationCenter.NotificationCenterDeleg
|
||||||
forceBackgroundVisible = false;
|
forceBackgroundVisible = false;
|
||||||
|
|
||||||
if (windowManager != null && windowView != null && windowView.getParent() == null) {
|
if (windowManager != null && windowView != null && windowView.getParent() == null) {
|
||||||
|
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, windowView, windowLayoutParams);
|
||||||
windowManager.addView(windowView, windowLayoutParams);
|
windowManager.addView(windowView, windowLayoutParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -662,6 +665,7 @@ public class StoryRecorder implements NotificationCenter.NotificationCenterDeleg
|
||||||
forceBackgroundVisible = false;
|
forceBackgroundVisible = false;
|
||||||
|
|
||||||
if (windowManager != null && windowView != null && windowView.getParent() == null) {
|
if (windowManager != null && windowView != null && windowView.getParent() == null) {
|
||||||
|
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, windowView, windowLayoutParams);
|
||||||
windowManager.addView(windowView, windowLayoutParams);
|
windowManager.addView(windowView, windowLayoutParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -722,6 +726,7 @@ public class StoryRecorder implements NotificationCenter.NotificationCenterDeleg
|
||||||
forceBackgroundVisible = false;
|
forceBackgroundVisible = false;
|
||||||
|
|
||||||
if (windowManager != null && windowView != null && windowView.getParent() == null) {
|
if (windowManager != null && windowView != null && windowView.getParent() == null) {
|
||||||
|
AndroidUtilities.setPreferredMaxRefreshRate(windowManager, windowView, windowLayoutParams);
|
||||||
windowManager.addView(windowView, windowLayoutParams);
|
windowManager.addView(windowView, windowLayoutParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2968,7 +2968,10 @@ public abstract class BotWebViewContainer extends FrameLayout implements Notific
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||||
if (url == null) return false;
|
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 (opener != null) {
|
||||||
if (botWebViewContainer.delegate != null) {
|
if (botWebViewContainer.delegate != null) {
|
||||||
botWebViewContainer.delegate.onInstantClose();
|
botWebViewContainer.delegate.onInstantClose();
|
||||||
|
|
|
@ -21,6 +21,7 @@ import android.graphics.PorterDuffColorFilter;
|
||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
|
import android.text.TextPaint;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
|
@ -80,6 +81,8 @@ public class WebActionBar extends FrameLayout {
|
||||||
public int textColor, iconColor;
|
public int textColor, iconColor;
|
||||||
public int addressBackgroundColor, addressTextColor;
|
public int addressBackgroundColor, addressTextColor;
|
||||||
|
|
||||||
|
public final TextPaint titlePaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
|
||||||
public boolean isMenuShown = false;
|
public boolean isMenuShown = false;
|
||||||
|
|
||||||
public int height = dp(56);
|
public int height = dp(56);
|
||||||
|
@ -130,6 +133,9 @@ public class WebActionBar extends FrameLayout {
|
||||||
super(context);
|
super(context);
|
||||||
this.resourcesProvider = resourcesProvider;
|
this.resourcesProvider = resourcesProvider;
|
||||||
|
|
||||||
|
titlePaint.setTypeface(AndroidUtilities.bold());
|
||||||
|
titlePaint.setTextSize(dp(18.33f));
|
||||||
|
|
||||||
for (int i = 0; i < 2; ++i) {
|
for (int i = 0; i < 2; ++i) {
|
||||||
backgroundPaint[i] = new Paint(Paint.ANTI_ALIAS_FLAG);
|
backgroundPaint[i] = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
progressBackgroundPaint[i] = new Paint(Paint.ANTI_ALIAS_FLAG);
|
progressBackgroundPaint[i] = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
|
|
@ -6095,6 +6095,8 @@
|
||||||
<string name="StorySavedSubtitle">Saved stories can be viewed by others on your profile until you remove them.</string>
|
<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_one">%d story is hidden from your profile</string>
|
||||||
<string name="StoryArchived_other">%d stories are 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="OpenLink">Open Link</string>
|
||||||
<string name="StorySharedToEveryone">This story is shown to everyone.</string>
|
<string name="StorySharedToEveryone">This story is shown to everyone.</string>
|
||||||
<string name="StorySharedToCloseFriends">This story is shown to your close friends.</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="StarsSubscriptionExpiredInfo">Your subscription expired on %s.</string>
|
||||||
<string name="StarsSubscriptionRefulfill">Join Channel</string>
|
<string name="StarsSubscriptionRefulfill">Join Channel</string>
|
||||||
<string name="StarsSubscriptionRefulfillInfo">You left channel, but you can still get back until %s.</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="StarsSubscriptionExpiredHintText">Insufficient funds to cover your subscription.</string>
|
||||||
<string name="StarsParticipantSubscription">Subscriber</string>
|
<string name="StarsParticipantSubscription">Subscriber</string>
|
||||||
<string name="StarsParticipantSubscriptionApproxMonth">appx. %1$s per month</string>
|
<string name="StarsParticipantSubscriptionApproxMonth">appx. %1$s per month</string>
|
||||||
|
|
|
@ -2,6 +2,8 @@ package org.telegram.ui.Components;
|
||||||
|
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.AnimatorListenerAdapter;
|
import android.animation.AnimatorListenerAdapter;
|
||||||
|
import android.animation.AnimatorSet;
|
||||||
|
import android.animation.ObjectAnimator;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.LinearGradient;
|
import android.graphics.LinearGradient;
|
||||||
|
@ -9,6 +11,7 @@ import android.graphics.Matrix;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.Shader;
|
import android.graphics.Shader;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -27,13 +30,15 @@ import org.telegram.ui.ActionBar.Theme;
|
||||||
import org.telegram.ui.IUpdateLayout;
|
import org.telegram.ui.IUpdateLayout;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class UpdateLayout extends IUpdateLayout {
|
public class UpdateLayout extends IUpdateLayout {
|
||||||
|
|
||||||
private FrameLayout updateLayout;
|
private FrameLayout updateLayout;
|
||||||
private RadialProgress2 updateLayoutIcon;
|
private RadialProgress2 updateLayoutIcon;
|
||||||
private SimpleTextView updateTextView;
|
private SimpleTextView[] updateTextViews;
|
||||||
private TextView updateSizeTextView;
|
private TextView updateSizeTextView;
|
||||||
|
private AnimatorSet updateTextAnimator;
|
||||||
|
|
||||||
private Activity activity;
|
private Activity activity;
|
||||||
private ViewGroup sideMenu;
|
private ViewGroup sideMenu;
|
||||||
|
@ -47,7 +52,8 @@ public class UpdateLayout extends IUpdateLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateFileProgress(Object[] args) {
|
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 location = (String) args[0];
|
||||||
String fileName = FileLoader.getAttachFileName(SharedConfig.pendingAppUpdate.document);
|
String fileName = FileLoader.getAttachFileName(SharedConfig.pendingAppUpdate.document);
|
||||||
if (fileName != null && fileName.equals(location)) {
|
if (fileName != null && fileName.equals(location)) {
|
||||||
|
@ -55,13 +61,13 @@ public class UpdateLayout extends IUpdateLayout {
|
||||||
Long totalSize = (Long) args[2];
|
Long totalSize = (Long) args[2];
|
||||||
float loadProgress = loadedSize / (float) totalSize;
|
float loadProgress = loadedSize / (float) totalSize;
|
||||||
updateLayoutIcon.setProgress(loadProgress, true);
|
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) {
|
public void createUpdateUI(int currentAccount) {
|
||||||
if (sideMenuContainer == null) {
|
if (sideMenuContainer == null || updateLayout != null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
updateLayout = new FrameLayout(activity) {
|
updateLayout = new FrameLayout(activity) {
|
||||||
|
@ -121,13 +127,18 @@ public class UpdateLayout extends IUpdateLayout {
|
||||||
updateLayoutIcon.setCircleRadius(AndroidUtilities.dp(11));
|
updateLayoutIcon.setCircleRadius(AndroidUtilities.dp(11));
|
||||||
updateLayoutIcon.setAsMini();
|
updateLayoutIcon.setAsMini();
|
||||||
|
|
||||||
updateTextView = new SimpleTextView(activity);
|
updateTextViews = new SimpleTextView[2];
|
||||||
updateTextView.setTextSize(15);
|
for (int i = 0; i < 2; ++i) {
|
||||||
updateTextView.setTypeface(AndroidUtilities.bold());
|
updateTextViews[i] = new SimpleTextView(activity);
|
||||||
updateTextView.setText(LocaleController.getString(R.string.AppUpdate));
|
updateTextViews[i].setTextSize(15);
|
||||||
updateTextView.setTextColor(0xffffffff);
|
updateTextViews[i].setTypeface(AndroidUtilities.bold());
|
||||||
updateTextView.setGravity(Gravity.LEFT);
|
updateTextViews[i].setTextColor(0xffffffff);
|
||||||
updateLayout.addView(updateTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL, 74, 0, 0, 0));
|
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 = new TextView(activity);
|
||||||
updateSizeTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
|
updateSizeTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
|
||||||
|
@ -142,26 +153,25 @@ public class UpdateLayout extends IUpdateLayout {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (SharedConfig.isAppUpdateAvailable()) {
|
if (SharedConfig.isAppUpdateAvailable()) {
|
||||||
View prevUpdateLayout = updateLayout;
|
|
||||||
createUpdateUI(currentAccount);
|
createUpdateUI(currentAccount);
|
||||||
updateSizeTextView.setText(AndroidUtilities.formatFileSize(SharedConfig.pendingAppUpdate.document.size));
|
updateSizeTextView.setText(AndroidUtilities.formatFileSize(SharedConfig.pendingAppUpdate.document.size));
|
||||||
String fileName = FileLoader.getAttachFileName(SharedConfig.pendingAppUpdate.document);
|
String fileName = FileLoader.getAttachFileName(SharedConfig.pendingAppUpdate.document);
|
||||||
File path = FileLoader.getInstance(currentAccount).getPathToAttach(SharedConfig.pendingAppUpdate.document, true);
|
File path = FileLoader.getInstance(currentAccount).getPathToAttach(SharedConfig.pendingAppUpdate.document, true);
|
||||||
boolean showSize;
|
boolean showSize;
|
||||||
if (path.exists()) {
|
if (path.exists()) {
|
||||||
updateLayoutIcon.setIcon(MediaActionDrawable.ICON_UPDATE, true, false);
|
updateLayoutIcon.setIcon(MediaActionDrawable.ICON_UPDATE, true, animated);
|
||||||
updateTextView.setText(LocaleController.getString(R.string.AppUpdateNow));
|
setUpdateText(LocaleController.getString(R.string.AppUpdateNow), animated);
|
||||||
showSize = false;
|
showSize = false;
|
||||||
} else {
|
} else {
|
||||||
if (FileLoader.getInstance(currentAccount).isLoadingFile(fileName)) {
|
if (FileLoader.getInstance(currentAccount).isLoadingFile(fileName)) {
|
||||||
updateLayoutIcon.setIcon(MediaActionDrawable.ICON_CANCEL, true, false);
|
updateLayoutIcon.setIcon(MediaActionDrawable.ICON_CANCEL, true, animated);
|
||||||
updateLayoutIcon.setProgress(0, false);
|
updateLayoutIcon.setProgress(0, false);
|
||||||
Float p = ImageLoader.getInstance().getFileProgress(fileName);
|
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;
|
showSize = false;
|
||||||
} else {
|
} else {
|
||||||
updateLayoutIcon.setIcon(MediaActionDrawable.ICON_DOWNLOAD, true, false);
|
updateLayoutIcon.setIcon(MediaActionDrawable.ICON_DOWNLOAD, true, animated);
|
||||||
updateTextView.setText(LocaleController.getString(R.string.AppUpdate));
|
setUpdateText(LocaleController.getString(R.string.AppUpdate), animated);
|
||||||
showSize = true;
|
showSize = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -194,22 +204,9 @@ public class UpdateLayout extends IUpdateLayout {
|
||||||
updateLayout.setVisibility(View.VISIBLE);
|
updateLayout.setVisibility(View.VISIBLE);
|
||||||
updateLayout.setTag(1);
|
updateLayout.setTag(1);
|
||||||
if (animated) {
|
if (animated) {
|
||||||
updateLayout.animate().translationY(0).setInterpolator(CubicBezierInterpolator.EASE_OUT).setListener(null).setDuration(180).withEndAction(() -> {
|
updateLayout.animate().translationY(0).setInterpolator(CubicBezierInterpolator.EASE_OUT).setListener(null).setDuration(180).start();
|
||||||
if (prevUpdateLayout != null) {
|
|
||||||
ViewGroup parent = (ViewGroup) prevUpdateLayout.getParent();
|
|
||||||
if (parent != null) {
|
|
||||||
parent.removeView(prevUpdateLayout);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
} else {
|
} else {
|
||||||
updateLayout.setTranslationY(0);
|
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));
|
sideMenu.setPadding(0, 0, 0, AndroidUtilities.dp(44));
|
||||||
} else {
|
} else {
|
||||||
|
@ -233,5 +230,48 @@ public class UpdateLayout extends IUpdateLayout {
|
||||||
sideMenu.setPadding(0, 0, 0, 0);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
# org.gradle.parallel=true
|
# org.gradle.parallel=true
|
||||||
#Sat Mar 12 05:53:50 MSK 2016
|
#Sat Mar 12 05:53:50 MSK 2016
|
||||||
APP_VERSION_CODE=5240
|
APP_VERSION_CODE=5243
|
||||||
APP_VERSION_NAME=11.1.2
|
APP_VERSION_NAME=11.1.3
|
||||||
APP_PACKAGE=org.telegram.messenger
|
APP_PACKAGE=org.telegram.messenger
|
||||||
IS_PRIVATE=false
|
IS_PRIVATE=false
|
||||||
RELEASE_KEY_PASSWORD=android
|
RELEASE_KEY_PASSWORD=android
|
||||||
|
|
Loading…
Reference in a new issue