update to 9.5.2

This commit is contained in:
xaxtix 2023-03-11 00:20:59 +04:00
parent 1a48adbec4
commit 1dcd153fe2
43 changed files with 587 additions and 142 deletions

View File

@ -136,7 +136,7 @@ NativeRegistration::NativeRegistration(JNIEnv* jni, jclass clazz)
NativeRegistration::~NativeRegistration() { NativeRegistration::~NativeRegistration() {
RTC_LOG(LS_INFO) << "NativeRegistration::dtor"; RTC_LOG(LS_INFO) << "NativeRegistration::dtor";
jni_->UnregisterNatives(j_class_); //jni_->UnregisterNatives(j_class_);
CHECK_EXCEPTION(jni_) << "Error during UnregisterNatives"; CHECK_EXCEPTION(jni_) << "Error during UnregisterNatives";
} }

View File

@ -1878,6 +1878,7 @@ public class AndroidUtilities {
} }
public static ArrayList<File> getRootDirs() { public static ArrayList<File> getRootDirs() {
HashSet<String> pathes = new HashSet<>();
ArrayList<File> result = null; ArrayList<File> result = null;
if (Build.VERSION.SDK_INT >= 19) { if (Build.VERSION.SDK_INT >= 19) {
File[] dirs = ApplicationLoader.applicationContext.getExternalFilesDirs(null); File[] dirs = ApplicationLoader.applicationContext.getExternalFilesDirs(null);
@ -1898,16 +1899,22 @@ public class AndroidUtilities {
continue; continue;
} }
} }
if (file != null && !pathes.contains(file.getAbsolutePath())) {
pathes.add(file.getAbsolutePath());
result.add(file); result.add(file);
} }
} }
} }
} }
}
if (result == null) { if (result == null) {
result = new ArrayList<>(); result = new ArrayList<>();
} }
if (result.isEmpty()) { if (result.isEmpty()) {
result.add(Environment.getExternalStorageDirectory()); File dir = Environment.getExternalStorageDirectory();
if (dir != null && !pathes.contains(dir.getAbsolutePath())) {
result.add(dir);
}
} }
return result; return result;
} }
@ -1919,7 +1926,9 @@ public class AndroidUtilities {
} catch (Exception e) { } catch (Exception e) {
FileLog.e(e); FileLog.e(e);
} }
if (state == null || state.startsWith(Environment.MEDIA_MOUNTED)) { if (state == null || state.startsWith(Environment.MEDIA_MOUNTED)) {
FileLog.d("external dir mounted");
try { try {
File file; File file;
if (Build.VERSION.SDK_INT >= 19) { if (Build.VERSION.SDK_INT >= 19) {
@ -1936,16 +1945,20 @@ public class AndroidUtilities {
} else { } else {
file = ApplicationLoader.applicationContext.getExternalCacheDir(); file = ApplicationLoader.applicationContext.getExternalCacheDir();
} }
FileLog.d("check dir " + (file == null ? null : file.getPath()) + " ");
if (file != null && (file.exists() || file.mkdirs()) && file.canWrite()) { if (file != null && (file.exists() || file.mkdirs()) && file.canWrite()) {
boolean canWrite = true; // boolean canWrite = true;
try { // try {
AndroidUtilities.createEmptyFile(new File(file, ".nomedia")); // AndroidUtilities.createEmptyFile(new File(file, ".nomedia"));
} catch (Exception e) { // } catch (Exception e) {
canWrite = false; // canWrite = false;
} // }
if (canWrite) { // if (canWrite) {
// return file;
// }
return file; return file;
} } else if (file != null) {
FileLog.d("check dir file exist " + file.exists() + " can write " + file.canWrite());
} }
} catch (Exception e) { } catch (Exception e) {
FileLog.e(e); FileLog.e(e);

View File

@ -24,8 +24,8 @@ public class BuildVars {
public static boolean USE_CLOUD_STRINGS = true; public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true; public static boolean CHECK_UPDATES = true;
public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29; public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29;
public static int BUILD_VERSION = 3199; public static int BUILD_VERSION = 3208;
public static String BUILD_VERSION_STRING = "9.5.1"; public static String BUILD_VERSION_STRING = "9.5.2";
public static int APP_ID = 4; public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103"; public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";

View File

@ -41,7 +41,7 @@ public class CacheByChatsController {
} else if (type == KEEP_MEDIA_TYPE_GROUP) { } else if (type == KEEP_MEDIA_TYPE_GROUP) {
return KEEP_MEDIA_ONE_MONTH; return KEEP_MEDIA_ONE_MONTH;
} else if (type == KEEP_MEDIA_TYPE_CHANNEL) { } else if (type == KEEP_MEDIA_TYPE_CHANNEL) {
return KEEP_MEDIA_ONE_MONTH; return KEEP_MEDIA_ONE_WEEK;
} }
return SharedConfig.keepMedia; return SharedConfig.keepMedia;
} }

View File

@ -1234,6 +1234,13 @@ public class DatabaseMigrationHelper {
version = 113; version = 113;
} }
if (version == 113) {
//fix issue when database file was deleted
//just reload dialogs
messagesStorage.reset();
database.executeFast("PRAGMA user_version = 114").stepThis().dispose();
version = 114;
}
return version; return version;
} }

View File

@ -545,10 +545,9 @@ public class FileLoadOperation {
filePartsStream.write(filesQueueByteBuffer.buf, 0, bufferSize); filePartsStream.write(filesQueueByteBuffer.buf, 0, bufferSize);
} }
} catch (Exception e) { } catch (Exception e) {
FileLog.e(e, false);
if (AndroidUtilities.isENOSPC(e)) { if (AndroidUtilities.isENOSPC(e)) {
LaunchActivity.checkFreeDiscSpaceStatic(1); LaunchActivity.checkFreeDiscSpaceStatic(1);
} else {
FileLog.e(e);
} }
} }
totalTime += System.currentTimeMillis() - time; totalTime += System.currentTimeMillis() - time;
@ -881,6 +880,7 @@ public class FileLoadOperation {
} catch (Exception e) { } catch (Exception e) {
if (AndroidUtilities.isENOSPC(e)) { if (AndroidUtilities.isENOSPC(e)) {
LaunchActivity.checkFreeDiscSpaceStatic(1); LaunchActivity.checkFreeDiscSpaceStatic(1);
FileLog.e(e, false);
} else { } else {
FileLog.e(e); FileLog.e(e);
} }
@ -1044,6 +1044,7 @@ public class FileLoadOperation {
requestedBytesCount = downloadedBytes = 0; requestedBytesCount = downloadedBytes = 0;
if (AndroidUtilities.isENOSPC(e)) { if (AndroidUtilities.isENOSPC(e)) {
LaunchActivity.checkFreeDiscSpaceStatic(1); LaunchActivity.checkFreeDiscSpaceStatic(1);
FileLog.e(e, false);
} else { } else {
FileLog.e(e); FileLog.e(e);
} }
@ -1059,12 +1060,11 @@ public class FileLoadOperation {
fileOutputStream.seek(downloadedBytes); fileOutputStream.seek(downloadedBytes);
} }
} catch (Exception e) { } catch (Exception e) {
FileLog.e(e, false);
if (AndroidUtilities.isENOSPC(e)) { if (AndroidUtilities.isENOSPC(e)) {
LaunchActivity.checkFreeDiscSpaceStatic(1); LaunchActivity.checkFreeDiscSpaceStatic(1);
onFail(true, -1); onFail(true, -1);
return false; return false;
} else {
FileLog.e(e, false);
} }
} }
if (fileOutputStream == null) { if (fileOutputStream == null) {
@ -1091,11 +1091,11 @@ public class FileLoadOperation {
delegate.saveFilePath(pathSaveData, null); delegate.saveFilePath(pathSaveData, null);
} }
} catch (Exception e) { } catch (Exception e) {
FileLog.e(e, false);
if (AndroidUtilities.isENOSPC(e)) { if (AndroidUtilities.isENOSPC(e)) {
LaunchActivity.checkFreeDiscSpaceStatic(1); LaunchActivity.checkFreeDiscSpaceStatic(1);
onFail(true, -1); onFail(true, -1);
} else { } else {
FileLog.e(e, false);
onFail(true, 0); onFail(true, 0);
} }
} }
@ -1772,10 +1772,10 @@ public class FileLoadOperation {
startDownloadRequest(); startDownloadRequest();
} }
} catch (Exception e) { } catch (Exception e) {
FileLog.e(e, !AndroidUtilities.isFilNotFoundException(e) && !AndroidUtilities.isENOSPC(e));
if (AndroidUtilities.isENOSPC(e)) { if (AndroidUtilities.isENOSPC(e)) {
onFail(false, -1); onFail(false, -1);
} else { } else {
FileLog.e(e, !AndroidUtilities.isFilNotFoundException(e));
onFail(false, 0); onFail(false, 0);
} }
} }
@ -1835,6 +1835,9 @@ public class FileLoadOperation {
cleanup(); cleanup();
state = reason == 1 ? stateCanceled : stateFailed; state = reason == 1 ? stateCanceled : stateFailed;
if (delegate != null) { if (delegate != null) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("failed downloading file to " + cacheFileFinal + " reason = " + reason + " time = " + (System.currentTimeMillis() - startTime) + " dc = " + datacenterId + " size = " + AndroidUtilities.formatFileSize(totalBytesCount));
}
if (thread) { if (thread) {
Utilities.stageQueue.postRunnable(() -> delegate.didFailedLoadingFile(FileLoadOperation.this, reason)); Utilities.stageQueue.postRunnable(() -> delegate.didFailedLoadingFile(FileLoadOperation.this, reason));
} else { } else {

View File

@ -1679,8 +1679,10 @@ public class FileLoader extends BaseController {
Runnable dumpFilesQueueRunnable = () -> { Runnable dumpFilesQueueRunnable = () -> {
for (int i = 0; i < smallFilesQueue.length; i++) { for (int i = 0; i < smallFilesQueue.length; i++) {
if (smallFilesQueue[i].allOperations.size() > 0 || largeFilesQueue[i].allOperations.size() > 0) {
FileLog.d("download queue: dc" + (i + 1) + " account=" + currentAccount + " small_operations=" + smallFilesQueue[i].allOperations.size() + " large_operations=" + largeFilesQueue[i].allOperations.size()); FileLog.d("download queue: dc" + (i + 1) + " account=" + currentAccount + " small_operations=" + smallFilesQueue[i].allOperations.size() + " large_operations=" + largeFilesQueue[i].allOperations.size());
} }
}
dumpFilesQueue(); dumpFilesQueue();
}; };

View File

@ -2176,9 +2176,18 @@ public class ImageLoader {
} }
public void checkMediaPaths() { public void checkMediaPaths() {
checkMediaPaths(null);
}
public void checkMediaPaths(Runnable after) {
cacheOutQueue.postRunnable(() -> { cacheOutQueue.postRunnable(() -> {
final SparseArray<File> paths = createMediaPaths(); final SparseArray<File> paths = createMediaPaths();
AndroidUtilities.runOnUIThread(() -> FileLoader.setMediaDirs(paths)); AndroidUtilities.runOnUIThread(() -> {
FileLoader.setMediaDirs(paths);
if (after != null) {
after.run();
}
});
}); });
} }

View File

@ -61,11 +61,10 @@ public class LiteMode {
FLAG_ANIMATED_EMOJI_REACTIONS_PREMIUM | FLAG_ANIMATED_EMOJI_REACTIONS_PREMIUM |
FLAG_ANIMATED_EMOJI_CHAT | FLAG_ANIMATED_EMOJI_CHAT |
FLAG_CHAT_FORUM_TWOCOLUMN | FLAG_CHAT_FORUM_TWOCOLUMN |
FLAG_CHAT_BLUR |
FLAG_CALLS_ANIMATIONS | FLAG_CALLS_ANIMATIONS |
FLAG_AUTOPLAY_VIDEOS | FLAG_AUTOPLAY_VIDEOS |
FLAG_AUTOPLAY_GIFS FLAG_AUTOPLAY_GIFS
); // 8031 ); // 7775
public static int PRESET_HIGH = ( public static int PRESET_HIGH = (
FLAGS_ANIMATED_STICKERS | FLAGS_ANIMATED_STICKERS |
FLAGS_ANIMATED_EMOJI | FLAGS_ANIMATED_EMOJI |
@ -255,7 +254,7 @@ public class LiteMode {
} }
public static void savePreference() { public static void savePreference() {
MessagesController.getGlobalMainSettings().edit().putInt("lite_mode", value).putInt("lite_mode_battery_level", powerSaverLevel).apply(); MessagesController.getGlobalMainSettings().edit().putInt("lite_mode2", value).putInt("lite_mode_battery_level", powerSaverLevel).apply();
} }
public static int getPowerSaverLevel() { public static int getPowerSaverLevel() {

View File

@ -18,6 +18,7 @@ import android.content.res.Configuration;
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;
@ -39,7 +40,9 @@ import java.util.Collection;
import java.util.Currency; import java.util.Currency;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.Locale; import java.util.Locale;
import java.util.Map;
import java.util.TimeZone; import java.util.TimeZone;
public class LocaleController { public class LocaleController {
@ -487,17 +490,65 @@ public class LocaleController {
} }
} }
private boolean checkingUpdateForCurrentRemoteLocale;
public void checkUpdateForCurrentRemoteLocale(int currentAccount, int version, int baseVersion) { public void checkUpdateForCurrentRemoteLocale(int currentAccount, int version, int baseVersion) {
if (currentLocaleInfo == null || !currentLocaleInfo.isRemote() && !currentLocaleInfo.isUnofficial()) { if (currentLocaleInfo == null || !currentLocaleInfo.isRemote() && !currentLocaleInfo.isUnofficial()) {
return; return;
} }
if (currentLocaleInfo.hasBaseLang()) { if (currentLocaleInfo.hasBaseLang()) {
if (currentLocaleInfo.baseVersion < baseVersion) { if (currentLocaleInfo.baseVersion < baseVersion) {
applyRemoteLanguage(currentLocaleInfo, currentLocaleInfo.baseLangCode, false, currentAccount, null); checkingUpdateForCurrentRemoteLocale = true;
applyRemoteLanguage(currentLocaleInfo, currentLocaleInfo.baseLangCode, false, currentAccount, () -> {
checkingUpdateForCurrentRemoteLocale = false;
checkPatchLangpack(currentAccount);
});
} }
} }
if (currentLocaleInfo.version < version) { if (currentLocaleInfo.version < version) {
applyRemoteLanguage(currentLocaleInfo, currentLocaleInfo.shortName, false, currentAccount, null); checkingUpdateForCurrentRemoteLocale = true;
applyRemoteLanguage(currentLocaleInfo, currentLocaleInfo.shortName, false, currentAccount, () -> {
checkingUpdateForCurrentRemoteLocale = false;
checkPatchLangpack(currentAccount);
});
}
}
public int calculateTranslatedCount(HashMap<String, String> map) {
int count = 0;
HashSet<String> added = new HashSet<>();
for (String k : map.keySet()) {
if (k == null) {
continue;
}
String real = null;
if (k.endsWith("_other")) {
real = k.substring(0, k.length() - 6);
} else if (k.endsWith("_zero") || k.endsWith("_many")) {
real = k.substring(0, k.length() - 5);
} else if (k.endsWith("_one") || k.endsWith("_two") || k.endsWith("_few")) {
real = k.substring(0, k.length() - 4);
}
if (real == null) {
count++;
} else if (!added.contains(real)) {
added.add(real);
count++;
}
}
added.clear();
return count;
}
public void checkPatchLangpack(int currentAccount) {
if (currentLocaleInfo == null || checkingUpdateForCurrentRemoteLocale) {
return;
}
if (shouldReinstallLangpack(currentLocaleInfo.shortName)) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("reload locale because locale file is not enough");
}
AndroidUtilities.runOnUIThread(() -> reloadCurrentRemoteLocale(currentAccount, null, true, null));
} }
} }
@ -943,7 +994,7 @@ public class LocaleController {
config.locale = currentLocale; config.locale = currentLocale;
ApplicationLoader.applicationContext.getResources().updateConfiguration(config, ApplicationLoader.applicationContext.getResources().getDisplayMetrics()); ApplicationLoader.applicationContext.getResources().updateConfiguration(config, ApplicationLoader.applicationContext.getResources().getDisplayMetrics());
changingConfiguration = false; changingConfiguration = false;
if (reloadLastFile) { if (reloadLastFile || !isLoadingRemote && !force && shouldReinstallLangpack(localeInfo.shortName)) {
if (BuildVars.LOGS_ENABLED) { if (BuildVars.LOGS_ENABLED) {
FileLog.d("reload locale because one of file is corrupted " + pathToFile + " " + pathToBaseFile); FileLog.d("reload locale because one of file is corrupted " + pathToFile + " " + pathToBaseFile);
} }
@ -2316,6 +2367,7 @@ public class LocaleController {
onDone.run(); onDone.run();
} }
}; };
patched(localeInfo.shortName);
if (localeInfo.hasBaseLang() && (langCode == null || langCode.equals(localeInfo.baseLangCode))) { if (localeInfo.hasBaseLang() && (langCode == null || langCode.equals(localeInfo.baseLangCode))) {
if (localeInfo.baseVersion != 0 && !force) { if (localeInfo.baseVersion != 0 && !force) {
if (localeInfo.hasBaseLang()) { if (localeInfo.hasBaseLang()) {
@ -3261,6 +3313,25 @@ public class LocaleController {
return formatDistance(distance, type, null); return formatDistance(distance, type, null);
} }
// patch to force reinstalling of langpack in case some strings are missing after 9.0
private boolean shouldReinstallLangpack(String lng) {
int mustBeCount = MessagesController.getInstance(UserConfig.selectedAccount).checkResetLangpack;
if (mustBeCount <= 0) {
return false;
}
boolean alreadyPatched = MessagesController.getGlobalMainSettings().getBoolean("lngpack_patched_" + lng, false);
if (alreadyPatched) {
return false;
}
int count = calculateTranslatedCount(localeValues);
if (count >= mustBeCount) {
return false;
}
FileLog.e("reinstalling " + lng + " langpack because of patch (" + count + " keys, must be at least " + mustBeCount + ")");
patched(lng);
return true;
}
public static String formatDistance(float distance, int type, Boolean useImperial) { public static String formatDistance(float distance, int type, Boolean useImperial) {
ensureImperialSystemInit(); ensureImperialSystemInit();
boolean imperial = useImperial != null && useImperial || useImperial == null && useImperialSystemType; boolean imperial = useImperial != null && useImperial || useImperial == null && useImperialSystemType;
@ -3324,4 +3395,11 @@ public class LocaleController {
} }
} }
} }
private void patched(String lng) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("set as patched " + lng + " langpack");
}
MessagesController.getGlobalMainSettings().edit().putBoolean("lngpack_patched_" + lng, true).apply();
}
} }

View File

@ -1665,7 +1665,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
raisedToTop = 0; raisedToTop = 0;
raisedToTopSign = 0; raisedToTopSign = 0;
countLess = 0; countLess = 0;
} else if (proximityTouched && ((accelerometerSensor == null || linearSensor == null) && gravitySensor == null) && !VoIPService.isAnyKindOfCallActive()) { } else if (proximityTouched && ((accelerometerSensor == null || linearSensor == null) && gravitySensor == null || ignoreAccelerometerGestures()) && !VoIPService.isAnyKindOfCallActive()) {
if (playingMessageObject != null && !ApplicationLoader.mainInterfacePaused && (playingMessageObject.isVoice() || playingMessageObject.isRoundVideo())) { if (playingMessageObject != null && !ApplicationLoader.mainInterfacePaused && (playingMessageObject.isVoice() || playingMessageObject.isRoundVideo())) {
if (!useFrontSpeaker && !NotificationsController.audioManager.isWiredHeadsetOn() && !NotificationsController.audioManager.isBluetoothA2dpOn()) { if (!useFrontSpeaker && !NotificationsController.audioManager.isWiredHeadsetOn() && !NotificationsController.audioManager.isBluetoothA2dpOn()) {
if (BuildVars.LOGS_ENABLED) { if (BuildVars.LOGS_ENABLED) {
@ -3325,7 +3325,9 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
startRaiseToEarSensors(raiseChat); startRaiseToEarSensors(raiseChat);
} }
if (!ApplicationLoader.mainInterfacePaused && proximityWakeLock != null && !proximityWakeLock.isHeld() && (playingMessageObject.isVoice() || playingMessageObject.isRoundVideo())) { if (!ApplicationLoader.mainInterfacePaused && proximityWakeLock != null && !proximityWakeLock.isHeld() && (playingMessageObject.isVoice() || playingMessageObject.isRoundVideo())) {
// proximityWakeLock.acquire(); if (ignoreAccelerometerGestures()) {
proximityWakeLock.acquire();
}
} }
startProgressTimer(playingMessageObject); startProgressTimer(playingMessageObject);
NotificationCenter.getInstance(messageObject.currentAccount).postNotificationName(NotificationCenter.messagePlayingDidStart, messageObject, oldMessageObject); NotificationCenter.getInstance(messageObject.currentAccount).postNotificationName(NotificationCenter.messagePlayingDidStart, messageObject, oldMessageObject);
@ -3387,6 +3389,10 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
return true; return true;
} }
private boolean ignoreAccelerometerGestures() {
return Build.MANUFACTURER.equalsIgnoreCase("samsung");
}
public void updateSilent(boolean value) { public void updateSilent(boolean value) {
isSilent = value; isSilent = value;
if (videoPlayer != null) { if (videoPlayer != null) {

View File

@ -27,7 +27,6 @@ import android.os.SystemClock;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Base64; import android.util.Base64;
import android.util.Log;
import android.util.SparseArray; import android.util.SparseArray;
import android.util.SparseBooleanArray; import android.util.SparseBooleanArray;
import android.util.SparseIntArray; import android.util.SparseIntArray;
@ -495,6 +494,8 @@ public class MessagesController extends BaseController implements NotificationCe
public boolean giftAttachMenuIcon; public boolean giftAttachMenuIcon;
public boolean giftTextFieldIcon; public boolean giftTextFieldIcon;
public int checkResetLangpack;
public void getNextReactionMention(long dialogId, int topicId, int count, Consumer<Integer> callback) { public void getNextReactionMention(long dialogId, int topicId, int count, Consumer<Integer> callback) {
final MessagesStorage messagesStorage = getMessagesStorage(); final MessagesStorage messagesStorage = getMessagesStorage();
messagesStorage.getStorageQueue().postRunnable(() -> { messagesStorage.getStorageQueue().postRunnable(() -> {
@ -1200,8 +1201,6 @@ public class MessagesController extends BaseController implements NotificationCe
gifSearchBot = mainPreferences.getString("gifSearchBot", "gif"); gifSearchBot = mainPreferences.getString("gifSearchBot", "gif");
imageSearchBot = mainPreferences.getString("imageSearchBot", "pic"); imageSearchBot = mainPreferences.getString("imageSearchBot", "pic");
blockedCountry = mainPreferences.getBoolean("blockedCountry", false); blockedCountry = mainPreferences.getBoolean("blockedCountry", false);
dcDomainName = mainPreferences.getString("dcDomainName2", ConnectionsManager.native_isTestBackend(currentAccount) != 0 ? "tapv3.stel.com" : "apv3.stel.com");
webFileDatacenterId = mainPreferences.getInt("webFileDatacenterId", ConnectionsManager.native_isTestBackend(currentAccount) != 0 ? 2 : 4);
suggestedLangCode = mainPreferences.getString("suggestedLangCode", "en"); suggestedLangCode = mainPreferences.getString("suggestedLangCode", "en");
animatedEmojisZoom = mainPreferences.getFloat("animatedEmojisZoom", 0.625f); animatedEmojisZoom = mainPreferences.getFloat("animatedEmojisZoom", 0.625f);
qrLoginCamera = mainPreferences.getBoolean("qrLoginCamera", false); qrLoginCamera = mainPreferences.getBoolean("qrLoginCamera", false);
@ -1260,8 +1259,12 @@ public class MessagesController extends BaseController implements NotificationCe
uploadMarkupVideo = mainPreferences.getBoolean("uploadMarkupVideo", true); uploadMarkupVideo = mainPreferences.getBoolean("uploadMarkupVideo", true);
giftAttachMenuIcon = mainPreferences.getBoolean("giftAttachMenuIcon", false); giftAttachMenuIcon = mainPreferences.getBoolean("giftAttachMenuIcon", false);
giftTextFieldIcon = mainPreferences.getBoolean("giftTextFieldIcon", false); giftTextFieldIcon = mainPreferences.getBoolean("giftTextFieldIcon", false);
checkResetLangpack = mainPreferences.getInt("checkResetLangpack", 0);
BuildVars.GOOGLE_AUTH_CLIENT_ID = mainPreferences.getString("googleAuthClientId", BuildVars.GOOGLE_AUTH_CLIENT_ID); BuildVars.GOOGLE_AUTH_CLIENT_ID = mainPreferences.getString("googleAuthClientId", BuildVars.GOOGLE_AUTH_CLIENT_ID);
dcDomainName = mainPreferences.getString("dcDomainName2", ConnectionsManager.native_isTestBackend(currentAccount) != 0 ? "tapv3.stel.com" : "apv3.stel.com");
webFileDatacenterId = mainPreferences.getInt("webFileDatacenterId", ConnectionsManager.native_isTestBackend(currentAccount) != 0 ? 2 : 4);
Set<String> currencySet = mainPreferences.getStringSet("directPaymentsCurrency", null); Set<String> currencySet = mainPreferences.getStringSet("directPaymentsCurrency", null);
if (currencySet != null) { if (currencySet != null) {
directPaymentsCurrency.clear(); directPaymentsCurrency.clear();
@ -2964,6 +2967,18 @@ public class MessagesController extends BaseController implements NotificationCe
} }
break; break;
} }
case "android_check_reset_langpack": {
if (value.value instanceof TLRPC.TL_jsonNumber) {
TLRPC.TL_jsonNumber num = (TLRPC.TL_jsonNumber) value.value;
if (num.value != checkResetLangpack) {
checkResetLangpack = (int) num.value;
editor.putInt("checkResetLangpack", checkResetLangpack);
LocaleController.getInstance().checkPatchLangpack(currentAccount);
changed = true;
}
}
break;
}
} }
} }
if (changed) { if (changed) {

View File

@ -94,7 +94,7 @@ public class MessagesStorage extends BaseController {
} }
} }
public final static int LAST_DB_VERSION = 113; public final static int LAST_DB_VERSION = 114;
private boolean databaseMigrationInProgress; private boolean databaseMigrationInProgress;
public boolean showClearDatabaseAlert; public boolean showClearDatabaseAlert;
private LongSparseIntArray dialogIsForum = new LongSparseIntArray(); private LongSparseIntArray dialogIsForum = new LongSparseIntArray();
@ -354,9 +354,6 @@ public class MessagesStorage extends BaseController {
} }
} catch (Exception e) { } catch (Exception e) {
FileLog.e(e); FileLog.e(e);
// if (BuildVars.DEBUG_PRIVATE_VERSION) {
// throw new RuntimeException(e);
// }
if (openTries < 3 && e.getMessage() != null && e.getMessage().contains("malformed")) { if (openTries < 3 && e.getMessage() != null && e.getMessage().contains("malformed")) {
if (openTries == 2) { if (openTries == 2) {
cleanupInternal(true); cleanupInternal(true);
@ -696,7 +693,11 @@ public class MessagesStorage extends BaseController {
} }
private void cleanupInternal(boolean deleteFiles) { private void cleanupInternal(boolean deleteFiles) {
if (deleteFiles) {
reset();
} else {
clearDatabaseValues(); clearDatabaseValues();
}
if (database != null) { if (database != null) {
database.close(); database.close();
database = null; database = null;
@ -714,10 +715,11 @@ public class MessagesStorage extends BaseController {
shmCacheFile.delete(); shmCacheFile.delete();
shmCacheFile = null; shmCacheFile = null;
} }
} }
} }
private void clearDatabaseValues() { public void clearDatabaseValues() {
lastDateValue = 0; lastDateValue = 0;
lastSeqValue = 0; lastSeqValue = 0;
lastPtsValue = 0; lastPtsValue = 0;
@ -1334,10 +1336,7 @@ public class MessagesStorage extends BaseController {
if (cursor != null) { if (cursor != null) {
cursor.dispose(); cursor.dispose();
} }
AndroidUtilities.runOnUIThread(() -> { reset();
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.didClearDatabase);
getMediaDataController().loadAttachMenuBots(false, true);
});
} }
}); });
} }
@ -1828,6 +1827,23 @@ public class MessagesStorage extends BaseController {
return files; return files;
} }
public void reset() {
clearDatabaseValues();
AndroidUtilities.runOnUIThread(() -> {
for (int a = 0; a < 2; a++) {
getUserConfig().setDialogsLoadOffset(a, 0, 0, 0, 0, 0, 0);
getUserConfig().setTotalDialogsCount(a, 0);
}
getUserConfig().clearFilters();
getUserConfig().clearPinnedDialogsLoaded();
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.didClearDatabase);
getMediaDataController().loadAttachMenuBots(false, true);
getNotificationCenter().postNotificationName(NotificationCenter.onDatabaseReset);
});
}
private static class ReadDialog { private static class ReadDialog {
public int lastMid; public int lastMid;
public int date; public int date;

View File

@ -51,6 +51,7 @@ public class SharedConfig {
public final static int PASSCODE_TYPE_PIN = 0, public final static int PASSCODE_TYPE_PIN = 0,
PASSCODE_TYPE_PASSWORD = 1; PASSCODE_TYPE_PASSWORD = 1;
private static int legacyDevicePerformanceClass = -1;
public static boolean loopStickers() { public static boolean loopStickers() {
return LiteMode.isEnabled(LiteMode.FLAG_ANIMATED_STICKERS_CHAT); return LiteMode.isEnabled(LiteMode.FLAG_ANIMATED_STICKERS_CHAT);
@ -1473,4 +1474,36 @@ public class SharedConfig {
public static boolean deviceIsAverage() { public static boolean deviceIsAverage() {
return getDevicePerformanceClass() <= PERFORMANCE_CLASS_AVERAGE; return getDevicePerformanceClass() <= PERFORMANCE_CLASS_AVERAGE;
} }
@Deprecated
public static int getLegacyDevicePerformanceClass() {
if (legacyDevicePerformanceClass == -1) {
int androidVersion = Build.VERSION.SDK_INT;
int cpuCount = ConnectionsManager.CPU_COUNT;
int memoryClass = ((ActivityManager) ApplicationLoader.applicationContext.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryClass();
int totalCpuFreq = 0;
int freqResolved = 0;
for (int i = 0; i < cpuCount; i++) {
try {
RandomAccessFile reader = new RandomAccessFile(String.format(Locale.ENGLISH, "/sys/devices/system/cpu/cpu%d/cpufreq/cpuinfo_max_freq", i), "r");
String line = reader.readLine();
if (line != null) {
totalCpuFreq += Utilities.parseInt(line) / 1000;
freqResolved++;
}
reader.close();
} catch (Throwable ignore) {}
}
int maxCpuFreq = freqResolved == 0 ? -1 : (int) Math.ceil(totalCpuFreq / (float) freqResolved);
if (androidVersion < 21 || cpuCount <= 2 || memoryClass <= 100 || cpuCount <= 4 && maxCpuFreq != -1 && maxCpuFreq <= 1250 || cpuCount <= 4 && maxCpuFreq <= 1600 && memoryClass <= 128 && androidVersion <= 21 || cpuCount <= 4 && maxCpuFreq <= 1300 && memoryClass <= 128 && androidVersion <= 24) {
legacyDevicePerformanceClass = PERFORMANCE_CLASS_LOW;
} else if (cpuCount < 8 || memoryClass <= 160 || maxCpuFreq != -1 && maxCpuFreq <= 2050 || maxCpuFreq == -1 && cpuCount == 8 && androidVersion <= 23) {
legacyDevicePerformanceClass = PERFORMANCE_CLASS_AVERAGE;
} else {
legacyDevicePerformanceClass = PERFORMANCE_CLASS_HIGH;
}
}
return legacyDevicePerformanceClass;
}
} }

View File

@ -13,8 +13,6 @@ import android.content.SharedPreferences;
import android.os.SystemClock; import android.os.SystemClock;
import android.util.Base64; import android.util.Base64;
import android.util.LongSparseArray; import android.util.LongSparseArray;
import android.util.SparseArray;
import android.util.SparseLongArray;
import org.telegram.tgnet.SerializedData; import org.telegram.tgnet.SerializedData;
import org.telegram.tgnet.TLRPC; import org.telegram.tgnet.TLRPC;
@ -32,7 +30,7 @@ public class UserConfig extends BaseController {
public final static int MAX_ACCOUNT_COUNT = 4; public final static int MAX_ACCOUNT_COUNT = 4;
private final Object sync = new Object(); private final Object sync = new Object();
private boolean configLoaded; private volatile boolean configLoaded;
private TLRPC.User currentUser; private TLRPC.User currentUser;
public boolean registeredForPush; public boolean registeredForPush;
public int lastSendMessageId = -210000; public int lastSendMessageId = -210000;
@ -138,6 +136,9 @@ public class UserConfig extends BaseController {
public void saveConfig(boolean withFile) { public void saveConfig(boolean withFile) {
NotificationCenter.getInstance(currentAccount).doOnIdle(() -> { NotificationCenter.getInstance(currentAccount).doOnIdle(() -> {
if (!configLoaded) {
return;
}
synchronized (sync) { synchronized (sync) {
try { try {
SharedPreferences.Editor editor = getPreferences().edit(); SharedPreferences.Editor editor = getPreferences().edit();
@ -285,7 +286,8 @@ public class UserConfig extends BaseController {
} }
} }
public void loadConfig() { public void
loadConfig() {
synchronized (sync) { synchronized (sync) {
if (configLoaded) { if (configLoaded) {
return; return;
@ -519,6 +521,16 @@ public class UserConfig extends BaseController {
getPreferences().edit().putBoolean("2pinnedDialogsLoaded" + folderId, loaded).commit(); getPreferences().edit().putBoolean("2pinnedDialogsLoaded" + folderId, loaded).commit();
} }
public void clearPinnedDialogsLoaded() {
SharedPreferences.Editor editor = getPreferences().edit();
for (String key : getPreferences().getAll().keySet()) {
if (key.startsWith("2pinnedDialogsLoaded")) {
editor.remove(key);
}
}
editor.apply();
}
public static final int i_dialogsLoadOffsetId = 0; public static final int i_dialogsLoadOffsetId = 0;
public static final int i_dialogsLoadOffsetDate = 1; public static final int i_dialogsLoadOffsetDate = 1;
public static final int i_dialogsLoadOffsetUserId = 2; public static final int i_dialogsLoadOffsetUserId = 2;
@ -597,4 +609,9 @@ public class UserConfig extends BaseController {
public void setGlobalTtl(int ttl) { public void setGlobalTtl(int ttl) {
globalTtl = ttl; globalTtl = ttl;
} }
public void clearFilters() {
getPreferences().edit().remove("filtersLoaded").apply();
filtersLoaded = false;
}
} }

View File

@ -3826,6 +3826,8 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
} else { } else {
bluetoothScoActive = false; bluetoothScoActive = false;
bluetoothScoConnecting = false; bluetoothScoConnecting = false;
am.setBluetoothScoOn(false);
} }
for (StateListener l : stateListeners) { for (StateListener l : stateListeners) {
l.onAudioSettingsChanged(); l.onAudioSettingsChanged();

View File

@ -66,6 +66,7 @@ import java.util.List;
public class ActionBarLayout extends FrameLayout implements INavigationLayout, FloatingDebugProvider { public class ActionBarLayout extends FrameLayout implements INavigationLayout, FloatingDebugProvider {
public boolean highlightActionButtons = false; public boolean highlightActionButtons = false;
private boolean attached;
@Override @Override
public void setHighlightActionButtons(boolean highlightActionButtons) { public void setHighlightActionButtons(boolean highlightActionButtons) {
@ -2439,7 +2440,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
ArrayList<String> lastActions = new ArrayList<>(); ArrayList<String> lastActions = new ArrayList<>();
Runnable debugBlackScreenRunnable = () -> { Runnable debugBlackScreenRunnable = () -> {
if (getLastFragment() != null && containerView.getChildCount() == 0) { if (attached && getLastFragment() != null && containerView.getChildCount() == 0) {
if (BuildVars.DEBUG_VERSION) { if (BuildVars.DEBUG_VERSION) {
FileLog.e(new RuntimeException(TextUtils.join(", ", lastActions))); FileLog.e(new RuntimeException(TextUtils.join(", ", lastActions)));
} }
@ -2447,7 +2448,6 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
} }
}; };
public void checkBlackScreen(String action) { public void checkBlackScreen(String action) {
// if (!BuildVars.DEBUG_VERSION) { // if (!BuildVars.DEBUG_VERSION) {
// return; // return;
@ -2465,5 +2465,15 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
AndroidUtilities.cancelRunOnUIThread(debugBlackScreenRunnable); AndroidUtilities.cancelRunOnUIThread(debugBlackScreenRunnable);
AndroidUtilities.runOnUIThread(debugBlackScreenRunnable, 500); AndroidUtilities.runOnUIThread(debugBlackScreenRunnable, 500);
} }
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
attached = true;
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
attached = false;
}
} }

View File

@ -2116,8 +2116,15 @@ public class ActionBarMenuItem extends FrameLayout {
} }
public ActionBarPopupWindow.GapView addColoredGap() { public ActionBarPopupWindow.GapView addColoredGap() {
return addColoredGap(-1);
}
public ActionBarPopupWindow.GapView addColoredGap(int id) {
createPopupLayout(); createPopupLayout();
ActionBarPopupWindow.GapView gap = new ActionBarPopupWindow.GapView(getContext(), resourcesProvider, Theme.key_actionBarDefaultSubmenuSeparator); ActionBarPopupWindow.GapView gap = new ActionBarPopupWindow.GapView(getContext(), resourcesProvider, Theme.key_actionBarDefaultSubmenuSeparator);
if (id != -1) {
gap.setTag(id);
}
gap.setTag(R.id.fit_width_tag, 1); gap.setTag(R.id.fit_width_tag, 1);
popupLayout.addView(gap, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 8)); popupLayout.addView(gap, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 8));
return gap; return gap;

View File

@ -302,12 +302,13 @@ public abstract class BaseFragment {
this.finishing = finishing; this.finishing = finishing;
} }
public void finishFragment(boolean animated) { public boolean finishFragment(boolean animated) {
if (isFinished || parentLayout == null) { if (isFinished || parentLayout == null) {
return; return false;
} }
finishing = true; finishing = true;
parentLayout.closeLastFragment(animated); parentLayout.closeLastFragment(animated);
return true;
} }
public void removeSelfFromStack() { public void removeSelfFromStack() {

View File

@ -247,6 +247,10 @@ public class CacheControlActivity extends BaseFragment implements NotificationCe
}); });
} }
public static void resetCalculatedTotalSIze() {
lastTotalSizeCalculated = null;
}
public static void getDeviceTotalSize(Utilities.Callback2<Long, Long> onDone) { public static void getDeviceTotalSize(Utilities.Callback2<Long, Long> onDone) {
if (lastDeviceTotalSize != null && lastDeviceTotalFreeSize != null) { if (lastDeviceTotalSize != null && lastDeviceTotalFreeSize != null) {
if (onDone != null) { if (onDone != null) {

View File

@ -319,8 +319,7 @@ public class CalendarActivity extends BaseFragment {
@Override @Override
public void run(boolean forAll) { public void run(boolean forAll) {
finishFragment(); finishFragment();
if (parentLayout != null && parentLayout.getFragmentStack().size() >= 2) {
if (parentLayout.getFragmentStack().size() >= 2) {
BaseFragment fragment = parentLayout.getFragmentStack().get(parentLayout.getFragmentStack().size() - 2); BaseFragment fragment = parentLayout.getFragmentStack().get(parentLayout.getFragmentStack().size() - 2);
if (fragment instanceof ChatActivity) { if (fragment instanceof ChatActivity) {
((ChatActivity) fragment).deleteHistory(dateSelectedStart, dateSelectedEnd + 86400, forAll); ((ChatActivity) fragment).deleteHistory(dateSelectedStart, dateSelectedEnd + 86400, forAll);

View File

@ -53,7 +53,6 @@ import android.text.TextUtils;
import android.text.style.CharacterStyle; import android.text.style.CharacterStyle;
import android.text.style.ClickableSpan; import android.text.style.ClickableSpan;
import android.text.style.URLSpan; import android.text.style.URLSpan;
import android.util.Log;
import android.util.Property; import android.util.Property;
import android.util.SparseArray; import android.util.SparseArray;
import android.util.StateSet; import android.util.StateSet;
@ -83,7 +82,6 @@ import org.telegram.PhoneFormat.PhoneFormat;
import org.telegram.messenger.AccountInstance; import org.telegram.messenger.AccountInstance;
import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader; import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.ChatObject; import org.telegram.messenger.ChatObject;
import org.telegram.messenger.ContactsController; import org.telegram.messenger.ContactsController;
import org.telegram.messenger.DialogObject; import org.telegram.messenger.DialogObject;
@ -18046,7 +18044,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
sb.append(LocaleController.getString("AccDescrMsgSending", R.string.AccDescrMsgSending)); sb.append(LocaleController.getString("AccDescrMsgSending", R.string.AccDescrMsgSending));
final float sendingProgress = radialProgress.getProgress(); final float sendingProgress = radialProgress.getProgress();
if (sendingProgress > 0f) { if (sendingProgress > 0f) {
sb.append(", ").append(Integer.toString(Math.round(sendingProgress * 100))).append("%"); sb.append(Integer.toString(Math.round(sendingProgress * 100))).append("%");
} }
} else if (currentMessageObject.isSendError()) { } else if (currentMessageObject.isSendError()) {
sb.append("\n"); sb.append("\n");

View File

@ -79,7 +79,7 @@ public class ShareTopicCell extends FrameLayout {
} }
if (topic.icon_emoji_id != 0) { if (topic.icon_emoji_id != 0) {
imageView.setImageDrawable(null); imageView.setImageDrawable(null);
imageView.setAnimatedEmojiDrawable(new AnimatedEmojiDrawable(AnimatedEmojiDrawable.CACHE_TYPE_FORUM_TOPIC, UserConfig.selectedAccount, topic.icon_emoji_id)); imageView.setAnimatedEmojiDrawable(new AnimatedEmojiDrawable(AnimatedEmojiDrawable.CACHE_TYPE_ALERT_PREVIEW_STATIC, UserConfig.selectedAccount, topic.icon_emoji_id));
} else { } else {
imageView.setAnimatedEmojiDrawable(null); imageView.setAnimatedEmojiDrawable(null);
ForumBubbleDrawable forumBubbleDrawable = new ForumBubbleDrawable(topic.icon_color); ForumBubbleDrawable forumBubbleDrawable = new ForumBubbleDrawable(topic.icon_color);

View File

@ -7354,7 +7354,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (getUserConfig().isPremium()) { if (getUserConfig().isPremium()) {
getMessagesController().getTranslateController().toggleTranslatingDialog(getDialogId()); getMessagesController().getTranslateController().toggleTranslatingDialog(getDialogId());
} else { } else {
MessagesController.getNotificationsSettings(currentAccount).edit().putInt("dialog_show_translate_count" + getDialogId(), 10).commit(); MessagesController.getNotificationsSettings(currentAccount).edit().putInt("dialog_show_translate_count" + getDialogId(), 14).commit();
showDialog(new PremiumFeatureBottomSheet(ChatActivity.this, PremiumPreviewFragment.PREMIUM_FEATURE_TRANSLATIONS, false)); showDialog(new PremiumFeatureBottomSheet(ChatActivity.this, PremiumPreviewFragment.PREMIUM_FEATURE_TRANSLATIONS, false));
} }
updateTopPanel(true); updateTopPanel(true);
@ -8586,7 +8586,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (progressView == null) { if (progressView == null) {
return; return;
} }
if (DISABLE_PROGRESS_VIEW && !AndroidUtilities.isTablet() && !isComments && currentUser == null && LiteMode.isEnabled(LiteMode.FLAG_CHAT_BACKGROUND)) { if (DISABLE_PROGRESS_VIEW && !AndroidUtilities.isTablet() && !isComments && currentUser == null && LiteMode.isEnabled(LiteMode.FLAGS_CHAT)) {
animateProgressViewTo = show; animateProgressViewTo = show;
return; return;
} }
@ -9815,7 +9815,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (userInfo != null && userInfo.voice_messages_forbidden) { if (userInfo != null && userInfo.voice_messages_forbidden) {
mediaBanTooltip.setText(AndroidUtilities.replaceTags(LocaleController.formatString(chatActivityEnterView.isInVideoMode() ? R.string.VideoMessagesRestrictedByPrivacy : R.string.VoiceMessagesRestrictedByPrivacy, currentUser.first_name))); mediaBanTooltip.setText(AndroidUtilities.replaceTags(LocaleController.formatString(chatActivityEnterView.isInVideoMode() ? R.string.VideoMessagesRestrictedByPrivacy : R.string.VoiceMessagesRestrictedByPrivacy, currentUser.first_name)));
} else if (!ChatObject.canSendVoice(currentChat) && !ChatObject.canSendVoice(currentChat)) { } else if (!ChatObject.canSendVoice(currentChat) && !ChatObject.canSendRoundVideo(currentChat)) {
if (chatActivityEnterView.isInVideoMode()) { if (chatActivityEnterView.isInVideoMode()) {
mediaBanTooltip.setText(ChatObject.getRestrictedErrorText(currentChat, ChatObject.ACTION_SEND_ROUND)); mediaBanTooltip.setText(ChatObject.getRestrictedErrorText(currentChat, ChatObject.ACTION_SEND_ROUND));
} else { } else {
@ -16940,6 +16940,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
builder.setTopAnimationIsNew(true); builder.setTopAnimationIsNew(true);
if (reason == 0) { if (reason == 0) {
if (currentChat instanceof TLRPC.TL_channelForbidden) { if (currentChat instanceof TLRPC.TL_channelForbidden) {
builder.setTitle(LocaleController.getString("ChannelCantOpenBannedByAdminTitle", R.string.ChannelCantOpenBannedByAdminTitle));
builder.setMessage(LocaleController.getString("ChannelCantOpenBannedByAdmin", R.string.ChannelCantOpenBannedByAdmin)); builder.setMessage(LocaleController.getString("ChannelCantOpenBannedByAdmin", R.string.ChannelCantOpenBannedByAdmin));
} else { } else {
builder.setTitle(LocaleController.getString(R.string.ChannelPrivate)); builder.setTitle(LocaleController.getString(R.string.ChannelPrivate));
@ -21835,7 +21836,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
boolean showTranslate = ( boolean showTranslate = (
getUserConfig().isPremium() ? getUserConfig().isPremium() ?
getMessagesController().getTranslateController().isDialogTranslatable(getDialogId()) && !getMessagesController().getTranslateController().isTranslateDialogHidden(getDialogId()) : getMessagesController().getTranslateController().isDialogTranslatable(getDialogId()) && !getMessagesController().getTranslateController().isTranslateDialogHidden(getDialogId()) :
!getMessagesController().premiumLocked && preferences.getInt("dialog_show_translate_count" + did, 3) <= 0 !getMessagesController().premiumLocked && preferences.getInt("dialog_show_translate_count" + did, 5) <= 0
); );
if (showRestartTopic) { if (showRestartTopic) {
shownRestartTopic = true; shownRestartTopic = true;
@ -24145,6 +24146,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
drawable.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_actionBarDefaultSubmenuItemIcon), PorterDuff.Mode.SRC_IN)); drawable.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_actionBarDefaultSubmenuItemIcon), PorterDuff.Mode.SRC_IN));
drawable = new CrossfadeDrawable(drawable, new CircularProgressDrawable(AndroidUtilities.dp(12f), AndroidUtilities.dp(1.5f), getThemedColor(Theme.key_actionBarDefaultSubmenuItemIcon))); drawable = new CrossfadeDrawable(drawable, new CircularProgressDrawable(AndroidUtilities.dp(12f), AndroidUtilities.dp(1.5f), getThemedColor(Theme.key_actionBarDefaultSubmenuItemIcon)));
rateUp.setImageDrawable(drawable); rateUp.setImageDrawable(drawable);
rateUp.setContentDescription(LocaleController.getString(R.string.AccDescrRateTranscriptionUp));
rateTranscription.addView(rateUp, LayoutHelper.createFrame(33, 33, Gravity.CENTER_HORIZONTAL | Gravity.TOP, -42, 39, 0, 0)); rateTranscription.addView(rateUp, LayoutHelper.createFrame(33, 33, Gravity.CENTER_HORIZONTAL | Gravity.TOP, -42, 39, 0, 0));
ImageView rateDown = new ImageView(contentView.getContext()); ImageView rateDown = new ImageView(contentView.getContext());
@ -24153,6 +24155,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
drawable.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_actionBarDefaultSubmenuItemIcon), PorterDuff.Mode.SRC_IN)); drawable.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_actionBarDefaultSubmenuItemIcon), PorterDuff.Mode.SRC_IN));
drawable = new CrossfadeDrawable(drawable, new CircularProgressDrawable(AndroidUtilities.dp(12f), AndroidUtilities.dp(1.5f), getThemedColor(Theme.key_actionBarDefaultSubmenuItemIcon))); drawable = new CrossfadeDrawable(drawable, new CircularProgressDrawable(AndroidUtilities.dp(12f), AndroidUtilities.dp(1.5f), getThemedColor(Theme.key_actionBarDefaultSubmenuItemIcon)));
rateDown.setImageDrawable(drawable); rateDown.setImageDrawable(drawable);
rateDown.setContentDescription(LocaleController.getString(R.string.AccDescrRateTranscriptionDown));
rateTranscription.addView(rateDown, LayoutHelper.createFrame(33, 33, Gravity.CENTER_HORIZONTAL | Gravity.TOP, 42, 39, 0, 0)); rateTranscription.addView(rateDown, LayoutHelper.createFrame(33, 33, Gravity.CENTER_HORIZONTAL | Gravity.TOP, 42, 39, 0, 0));
Runnable rate = () -> { Runnable rate = () -> {
@ -24394,7 +24397,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
alert.setDimBehind(false); alert.setDimBehind(false);
closeMenu(false); closeMenu(false);
int hintCount = MessagesController.getNotificationsSettings(currentAccount).getInt("dialog_show_translate_count" + getDialogId(), 3); int hintCount = MessagesController.getNotificationsSettings(currentAccount).getInt("dialog_show_translate_count" + getDialogId(), 5);
if (hintCount > 0) { if (hintCount > 0) {
hintCount--; hintCount--;
MessagesController.getNotificationsSettings(currentAccount).edit().putInt("dialog_show_translate_count" + getDialogId(), hintCount).apply(); MessagesController.getNotificationsSettings(currentAccount).edit().putInt("dialog_show_translate_count" + getDialogId(), hintCount).apply();
@ -24415,7 +24418,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
alert.setDimBehind(false); alert.setDimBehind(false);
closeMenu(false); closeMenu(false);
int hintCount = MessagesController.getNotificationsSettings(currentAccount).getInt("dialog_show_translate_count" + getDialogId(), 3); int hintCount = MessagesController.getNotificationsSettings(currentAccount).getInt("dialog_show_translate_count" + getDialogId(), 5);
if (hintCount > 0) { if (hintCount > 0) {
hintCount--; hintCount--;
MessagesController.getNotificationsSettings(currentAccount).edit().putInt("dialog_show_translate_count" + getDialogId(), hintCount).apply(); MessagesController.getNotificationsSettings(currentAccount).edit().putInt("dialog_show_translate_count" + getDialogId(), hintCount).apply();

View File

@ -2060,7 +2060,7 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
if (hasRecordVideo) { if (hasRecordVideo) {
calledRecordRunnable = false; calledRecordRunnable = false;
recordAudioVideoRunnableStarted = true; recordAudioVideoRunnableStarted = true;
AndroidUtilities.runOnUIThread(recordAudioVideoRunnable, Math.max(150, ViewConfiguration.getLongPressTimeout())); AndroidUtilities.runOnUIThread(recordAudioVideoRunnable, 150);
} else { } else {
recordAudioVideoRunnable.run(); recordAudioVideoRunnable.run();
} }

View File

@ -37,6 +37,7 @@ import android.text.TextPaint;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.text.style.ImageSpan; import android.text.style.ImageSpan;
import android.util.Log;
import android.util.LongSparseArray; import android.util.LongSparseArray;
import android.util.Property; import android.util.Property;
import android.util.TypedValue; import android.util.TypedValue;
@ -679,6 +680,7 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
private FrameLayout frameLayout2; private FrameLayout frameLayout2;
protected EditTextEmoji commentTextView; protected EditTextEmoji commentTextView;
private int[] commentTextViewLocation = new int[2];
private FrameLayout writeButtonContainer; private FrameLayout writeButtonContainer;
private ImageView writeButton; private ImageView writeButton;
private Drawable writeButtonDrawable; private Drawable writeButtonDrawable;
@ -1228,6 +1230,8 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
invalidate(); invalidate();
frameLayout2.invalidate(); frameLayout2.invalidate();
updateCommentTextViewPosition();
if (currentAttachLayout != null) { if (currentAttachLayout != null) {
currentAttachLayout.onContainerTranslationUpdated(currentPanTranslationY); currentAttachLayout.onContainerTranslationUpdated(currentPanTranslationY);
} }
@ -2226,7 +2230,13 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
float dy = (messageEditTextPredrawHeigth - editText.getMeasuredHeight()) + (messageEditTextPredrawScrollY - editText.getScrollY()); float dy = (messageEditTextPredrawHeigth - editText.getMeasuredHeight()) + (messageEditTextPredrawScrollY - editText.getScrollY());
editText.setOffsetY(editText.getOffsetY() - dy); editText.setOffsetY(editText.getOffsetY() - dy);
ValueAnimator a = ValueAnimator.ofFloat(editText.getOffsetY(), 0); ValueAnimator a = ValueAnimator.ofFloat(editText.getOffsetY(), 0);
a.addUpdateListener(animation -> editText.setOffsetY((float) animation.getAnimatedValue())); a.addUpdateListener(animation -> {
editText.setOffsetY((float) animation.getAnimatedValue());
updateCommentTextViewPosition();
if (currentAttachLayout == photoLayout) {
photoLayout.onContainerTranslationUpdated(currentPanTranslationY);
}
});
if (messageEditTextAnimator != null) { if (messageEditTextAnimator != null) {
messageEditTextAnimator.cancel(); messageEditTextAnimator.cancel();
} }
@ -2253,6 +2263,7 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
} }
chatActivityEnterViewAnimateFromTop = frameLayout2.getTop() + captionEditTextTopOffset; chatActivityEnterViewAnimateFromTop = frameLayout2.getTop() + captionEditTextTopOffset;
frameLayout2.invalidate(); frameLayout2.invalidate();
updateCommentTextViewPosition();
} }
@Override @Override
@ -2270,6 +2281,12 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
protected void closeParent() { protected void closeParent() {
ChatAttachAlert.super.dismiss(); ChatAttachAlert.super.dismiss();
} }
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
updateCommentTextViewPosition();
}
}; };
commentTextView.setHint(LocaleController.getString("AddCaption", R.string.AddCaption)); commentTextView.setHint(LocaleController.getString("AddCaption", R.string.AddCaption));
commentTextView.onResume(); commentTextView.onResume();
@ -2608,6 +2625,14 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
} }
} }
public void updateCommentTextViewPosition() {
commentTextView.getLocationOnScreen(commentTextViewLocation);
}
public int getCommentTextViewTop() {
return commentTextViewLocation[1];
}
private void showCaptionLimitBulletin(BaseFragment parentFragment) { private void showCaptionLimitBulletin(BaseFragment parentFragment) {
if (!(parentFragment instanceof ChatActivity) || !ChatObject.isChannelAndNotMegaGroup(((ChatActivity) parentFragment).getCurrentChat())) { if (!(parentFragment instanceof ChatActivity) || !ChatObject.isChannelAndNotMegaGroup(((ChatActivity) parentFragment).getCurrentChat())) {
return; return;

View File

@ -597,7 +597,7 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
parentAlert.selectedMenuItem.addSubItem(group, R.drawable.msg_ungroup, LocaleController.getString("SendWithoutGrouping", R.string.SendWithoutGrouping)); parentAlert.selectedMenuItem.addSubItem(group, R.drawable.msg_ungroup, LocaleController.getString("SendWithoutGrouping", R.string.SendWithoutGrouping));
spoilerItem = parentAlert.selectedMenuItem.addSubItem(spoiler, R.drawable.msg_spoiler, LocaleController.getString("EnablePhotoSpoiler", R.string.EnablePhotoSpoiler)); spoilerItem = parentAlert.selectedMenuItem.addSubItem(spoiler, R.drawable.msg_spoiler, LocaleController.getString("EnablePhotoSpoiler", R.string.EnablePhotoSpoiler));
parentAlert.selectedMenuItem.addSubItem(open_in, R.drawable.msg_openin, LocaleController.getString("OpenInExternalApp", R.string.OpenInExternalApp)); parentAlert.selectedMenuItem.addSubItem(open_in, R.drawable.msg_openin, LocaleController.getString("OpenInExternalApp", R.string.OpenInExternalApp));
parentAlert.selectedMenuItem.addGap(preview_gap); parentAlert.selectedMenuItem.addColoredGap(preview_gap);
previewItem = parentAlert.selectedMenuItem.addSubItem(preview, R.drawable.msg_view_file, LocaleController.getString("AttachMediaPreviewButton", R.string.AttachMediaPreviewButton)); previewItem = parentAlert.selectedMenuItem.addSubItem(preview, R.drawable.msg_view_file, LocaleController.getString("AttachMediaPreviewButton", R.string.AttachMediaPreviewButton));
parentAlert.selectedMenuItem.setFitSubItems(true); parentAlert.selectedMenuItem.setFitSubItems(true);
@ -2117,12 +2117,13 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
if (Build.VERSION.SDK_INT >= 21) { if (Build.VERSION.SDK_INT >= 21) {
super.dispatchDraw(canvas); super.dispatchDraw(canvas);
} else { } else {
int maxY = (int) Math.min(parentAlert.getCommentTextViewTop() + currentPanTranslationY + parentAlert.getContainerView().getTranslationY() - cameraView.getTranslationY(), getMeasuredHeight());
if (cameraAnimationInProgress) { if (cameraAnimationInProgress) {
AndroidUtilities.rectTmp.set(animationClipLeft + cameraViewOffsetX * (1f - cameraOpenProgress), animationClipTop + cameraViewOffsetY * (1f - cameraOpenProgress), animationClipRight, animationClipBottom); AndroidUtilities.rectTmp.set(animationClipLeft + cameraViewOffsetX * (1f - cameraOpenProgress), animationClipTop + cameraViewOffsetY * (1f - cameraOpenProgress), animationClipRight, Math.min(maxY, animationClipBottom));
} else if (!cameraAnimationInProgress && !cameraOpened) { } else if (!cameraAnimationInProgress && !cameraOpened) {
AndroidUtilities.rectTmp.set(cameraViewOffsetX, cameraViewOffsetY, getMeasuredWidth(), getMeasuredHeight()); AndroidUtilities.rectTmp.set(cameraViewOffsetX, cameraViewOffsetY, getMeasuredWidth(), Math.min(maxY, getMeasuredHeight()));
} else { } else {
AndroidUtilities.rectTmp.set(0 , 0, getMeasuredWidth(), getMeasuredHeight()); AndroidUtilities.rectTmp.set(0 , 0, getMeasuredWidth(), Math.min(maxY, getMeasuredHeight()));
} }
canvas.save(); canvas.save();
canvas.clipRect(AndroidUtilities.rectTmp); canvas.clipRect(AndroidUtilities.rectTmp);
@ -2153,14 +2154,20 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
cameraView.setOutlineProvider(new ViewOutlineProvider() { cameraView.setOutlineProvider(new ViewOutlineProvider() {
@Override @Override
public void getOutline(View view, Outline outline) { public void getOutline(View view, Outline outline) {
int maxY = (int) Math.min(parentAlert.getCommentTextViewTop() + currentPanTranslationY + parentAlert.getContainerView().getTranslationY() - cameraView.getTranslationY(), view.getMeasuredHeight());
if (cameraOpened) {
maxY = view.getMeasuredHeight();
} else if (cameraAnimationInProgress) {
maxY = AndroidUtilities.lerp(maxY, view.getMeasuredHeight(), cameraOpenProgress);
}
if (cameraAnimationInProgress) { if (cameraAnimationInProgress) {
AndroidUtilities.rectTmp.set(animationClipLeft + cameraViewOffsetX * (1f - cameraOpenProgress), animationClipTop + cameraViewOffsetY * (1f - cameraOpenProgress), animationClipRight, animationClipBottom); AndroidUtilities.rectTmp.set(animationClipLeft + cameraViewOffsetX * (1f - cameraOpenProgress), animationClipTop + cameraViewOffsetY * (1f - cameraOpenProgress), animationClipRight, animationClipBottom);
outline.setRect((int) AndroidUtilities.rectTmp.left,(int) AndroidUtilities.rectTmp.top, (int) AndroidUtilities.rectTmp.right, (int) AndroidUtilities.rectTmp.bottom); outline.setRect((int) AndroidUtilities.rectTmp.left,(int) AndroidUtilities.rectTmp.top, (int) AndroidUtilities.rectTmp.right, Math.min(maxY, (int) AndroidUtilities.rectTmp.bottom));
} else if (!cameraAnimationInProgress && !cameraOpened) { } else if (!cameraAnimationInProgress && !cameraOpened) {
int rad = AndroidUtilities.dp(8 * parentAlert.cornerRadius); int rad = AndroidUtilities.dp(8 * parentAlert.cornerRadius);
outline.setRoundRect((int) cameraViewOffsetX, (int) cameraViewOffsetY, view.getMeasuredWidth() + rad, view.getMeasuredHeight() + rad, rad); outline.setRoundRect((int) cameraViewOffsetX, (int) cameraViewOffsetY, view.getMeasuredWidth() + rad, Math.min(maxY, view.getMeasuredHeight()) + rad, rad);
} else { } else {
outline.setRect(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight()); outline.setRect(0, 0, view.getMeasuredWidth(), Math.min(maxY, view.getMeasuredHeight()));
} }
} }
}); });
@ -2228,6 +2235,12 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
cameraIcon = new FrameLayout(parentAlert.baseFragment.getParentActivity()) { cameraIcon = new FrameLayout(parentAlert.baseFragment.getParentActivity()) {
@Override @Override
protected void onDraw(Canvas canvas) { protected void onDraw(Canvas canvas) {
int maxY = (int) Math.min(parentAlert.getCommentTextViewTop() + currentPanTranslationY + parentAlert.getContainerView().getTranslationY() - cameraView.getTranslationY(), getMeasuredHeight());
if (cameraOpened) {
maxY = getMeasuredHeight();
} else if (cameraAnimationInProgress) {
maxY = AndroidUtilities.lerp(maxY, getMeasuredHeight(), cameraOpenProgress);
}
int w = cameraDrawable.getIntrinsicWidth(); int w = cameraDrawable.getIntrinsicWidth();
int h = cameraDrawable.getIntrinsicHeight(); int h = cameraDrawable.getIntrinsicHeight();
int x = (itemSize - w) / 2; int x = (itemSize - w) / 2;
@ -2235,8 +2248,16 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
if (cameraViewOffsetY != 0) { if (cameraViewOffsetY != 0) {
y -= cameraViewOffsetY; y -= cameraViewOffsetY;
} }
boolean clip = maxY < getMeasuredHeight();
if (clip) {
canvas.save();
canvas.clipRect(0, 0, getMeasuredWidth(), maxY);
}
cameraDrawable.setBounds(x, y, x + w, y + h); cameraDrawable.setBounds(x, y, x + w, y + h);
cameraDrawable.draw(canvas); cameraDrawable.draw(canvas);
if (clip) {
canvas.restore();
}
} }
}; };
cameraIcon.setWillNotDraw(false); cameraIcon.setWillNotDraw(false);
@ -2758,16 +2779,16 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
int finalWidth = itemSize; int finalWidth = itemSize;
int finalHeight = itemSize; int finalHeight = itemSize;
FrameLayout.LayoutParams layoutParams; LayoutParams layoutParams;
if (!cameraOpened) { if (!cameraOpened) {
cameraView.setClipTop((int) cameraViewOffsetY); cameraView.setClipTop((int) cameraViewOffsetY);
cameraView.setClipBottom((int) cameraViewOffsetBottomY); cameraView.setClipBottom((int) cameraViewOffsetBottomY);
layoutParams = (FrameLayout.LayoutParams) cameraView.getLayoutParams(); layoutParams = (LayoutParams) cameraView.getLayoutParams();
if (layoutParams.height != finalHeight || layoutParams.width != finalWidth) { if (layoutParams.height != finalHeight || layoutParams.width != finalWidth) {
layoutParams.width = finalWidth; layoutParams.width = finalWidth;
layoutParams.height = finalHeight; layoutParams.height = finalHeight;
cameraView.setLayoutParams(layoutParams); cameraView.setLayoutParams(layoutParams);
final FrameLayout.LayoutParams layoutParamsFinal = layoutParams; final LayoutParams layoutParamsFinal = layoutParams;
AndroidUtilities.runOnUIThread(() -> { AndroidUtilities.runOnUIThread(() -> {
if (cameraView != null) { if (cameraView != null) {
cameraView.setLayoutParams(layoutParamsFinal); cameraView.setLayoutParams(layoutParamsFinal);
@ -2779,12 +2800,12 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
finalWidth = (int) (itemSize - cameraViewOffsetX); finalWidth = (int) (itemSize - cameraViewOffsetX);
finalHeight = (int) (itemSize - cameraViewOffsetY - cameraViewOffsetBottomY); finalHeight = (int) (itemSize - cameraViewOffsetY - cameraViewOffsetBottomY);
layoutParams = (FrameLayout.LayoutParams) cameraIcon.getLayoutParams(); layoutParams = (LayoutParams) cameraIcon.getLayoutParams();
if (layoutParams.height != finalHeight || layoutParams.width != finalWidth) { if (layoutParams.height != finalHeight || layoutParams.width != finalWidth) {
layoutParams.width = finalWidth; layoutParams.width = finalWidth;
layoutParams.height = finalHeight; layoutParams.height = finalHeight;
cameraIcon.setLayoutParams(layoutParams); cameraIcon.setLayoutParams(layoutParams);
final FrameLayout.LayoutParams layoutParamsFinal = layoutParams; final LayoutParams layoutParamsFinal = layoutParams;
AndroidUtilities.runOnUIThread(() -> { AndroidUtilities.runOnUIThread(() -> {
if (cameraIcon != null) { if (cameraIcon != null) {
cameraIcon.setLayoutParams(layoutParamsFinal); cameraIcon.setLayoutParams(layoutParamsFinal);
@ -3484,10 +3505,36 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
return !cameraOpened; return !cameraOpened;
} }
@Override
public void onPanTransitionStart(boolean keyboardVisible, int contentHeight) {
super.onPanTransitionStart(keyboardVisible, contentHeight);
checkCameraViewPosition();
if (cameraView != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
cameraView.invalidateOutline();
} else {
cameraView.invalidate();
}
}
if (cameraIcon != null) {
cameraIcon.invalidate();
}
}
@Override @Override
void onContainerTranslationUpdated(float currentPanTranslationY) { void onContainerTranslationUpdated(float currentPanTranslationY) {
this.currentPanTranslationY = currentPanTranslationY; this.currentPanTranslationY = currentPanTranslationY;
checkCameraViewPosition(); checkCameraViewPosition();
if (cameraView != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
cameraView.invalidateOutline();
} else {
cameraView.invalidate();
}
}
if (cameraIcon != null) {
cameraIcon.invalidate();
}
invalidate(); invalidate();
} }

View File

@ -1005,7 +1005,8 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
sortedSizes.add(previewSizes.get(i)); sortedSizes.add(previewSizes.get(i));
} }
} }
if (sortedSizes.isEmpty() || SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_LOW || SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_AVERAGE) { int devicePerformanceClass = SharedConfig.getLegacyDevicePerformanceClass();
if (sortedSizes.isEmpty() || devicePerformanceClass == SharedConfig.PERFORMANCE_CLASS_LOW || devicePerformanceClass == SharedConfig.PERFORMANCE_CLASS_AVERAGE) {
ArrayList<Size> sizes = sortedSizes; ArrayList<Size> sizes = sortedSizes;
if (!sortedSizes.isEmpty()) { if (!sortedSizes.isEmpty()) {
sizes = sortedSizes; sizes = sortedSizes;
@ -2691,7 +2692,8 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
} }
private String createFragmentShader(Size previewSize) { private String createFragmentShader(Size previewSize) {
if (SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_LOW || SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_AVERAGE || Math.max(previewSize.getHeight(), previewSize.getWidth()) * 0.7f < MessagesController.getInstance(currentAccount).roundVideoSize) { int devicePerformanceClass = SharedConfig.getLegacyDevicePerformanceClass();
if (devicePerformanceClass == SharedConfig.PERFORMANCE_CLASS_LOW || devicePerformanceClass == SharedConfig.PERFORMANCE_CLASS_AVERAGE || Math.max(previewSize.getHeight(), previewSize.getWidth()) * 0.7f < MessagesController.getInstance(currentAccount).roundVideoSize) {
return "#extension GL_OES_EGL_image_external : require\n" + return "#extension GL_OES_EGL_image_external : require\n" +
"precision highp float;\n" + "precision highp float;\n" +
"varying vec2 vTextureCoord;\n" + "varying vec2 vTextureCoord;\n" +

View File

@ -14,6 +14,7 @@ import android.os.Build;
import android.text.Layout; import android.text.Layout;
import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.LiteMode;
public class LinkPath extends Path { public class LinkPath extends Path {
@ -137,7 +138,7 @@ public class LinkPath extends Path {
} }
centerX = (right + left) / 2; centerX = (right + left) / 2;
centerY = (y2 + y) / 2; centerY = (y2 + y) / 2;
if (useRoundRect) { if (useRoundRect && LiteMode.isEnabled(LiteMode.FLAGS_CHAT)) {
// final CharSequence text = currentLayout.getText(); // final CharSequence text = currentLayout.getText();
// int startOffset = currentLayout.getOffsetForHorizontal(currentLine, left), endOffset = currentLayout.getOffsetForHorizontal(currentLine, right) + 1; // int startOffset = currentLayout.getOffsetForHorizontal(currentLine, left), endOffset = currentLayout.getOffsetForHorizontal(currentLine, right) + 1;
boolean startsWithWhitespace = false; // startOffset >= 0 && startOffset < text.length() && text.charAt(startOffset) == ' '; boolean startsWithWhitespace = false; // startOffset >= 0 && startOffset < text.length() && text.charAt(startOffset) == ' ';

View File

@ -3837,7 +3837,11 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
photoVideoAdapter.notifyDataSetChanged(); photoVideoAdapter.notifyDataSetChanged();
} }
} else { } else {
try {
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
} catch (Throwable e) {
}
} }
if (sharedMediaData[type].messages.isEmpty() && !sharedMediaData[type].loading) { if (sharedMediaData[type].messages.isEmpty() && !sharedMediaData[type].loading) {
if (listView != null) { if (listView != null) {

View File

@ -454,20 +454,35 @@ public class DataSettingsActivity extends BaseFragment {
} }
} }
boolean fullString = true;
try {
fullString = storageDirs.size() != 2 || storageDirs.get(0).getAbsolutePath().contains("/storage/emulated/") == storageDirs.get(1).getAbsolutePath().contains("/storage/emulated/");
} catch (Exception ignore) {}
for (int a = 0, N = storageDirs.size(); a < N; a++) { for (int a = 0, N = storageDirs.size(); a < N; a++) {
String storageDir = storageDirs.get(a).getAbsolutePath(); File file = storageDirs.get(a);
String storageDir = file.getAbsolutePath();
LanguageCell cell = new LanguageCell(context); LanguageCell cell = new LanguageCell(context);
cell.setPadding(AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4), 0); cell.setPadding(AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4), 0);
cell.setTag(a); cell.setTag(a);
cell.setValue(storageDir.contains("/storage/emulated/") ? LocaleController.getString("InternalStorage", R.string.InternalStorage) : LocaleController.getString("SdCard", R.string.SdCard), storageDir); cell.setValue(
storageDir.contains("/storage/emulated/") ? LocaleController.getString("InternalStorage", R.string.InternalStorage) : LocaleController.getString("SdCard", R.string.SdCard),
fullString ?
LocaleController.formatString("StoragePathFreeValue", R.string.StoragePathFreeValue, AndroidUtilities.formatFileSize(file.getFreeSpace()), storageDir) :
LocaleController.formatString("StoragePathFree", R.string.StoragePathFree, AndroidUtilities.formatFileSize(file.getFreeSpace()))
);
cell.setLanguageSelected(storageDir.startsWith(dir), false); cell.setLanguageSelected(storageDir.startsWith(dir), false);
cell.setBackground(Theme.createSelectorDrawable(Theme.getColor(Theme.key_dialogButtonSelector), 2));
linearLayout.addView(cell); linearLayout.addView(cell);
cell.setOnClickListener(v -> { cell.setOnClickListener(v -> {
SharedConfig.storageCacheDir = storageDir; SharedConfig.storageCacheDir = storageDir;
SharedConfig.saveConfig(); SharedConfig.saveConfig();
ImageLoader.getInstance().checkMediaPaths();
builder.getDismissRunnable().run(); builder.getDismissRunnable().run();
listAdapter.notifyItemChanged(storageNumRow); rebind(storageNumRow);
ImageLoader.getInstance().checkMediaPaths(() -> {
CacheControlActivity.resetCalculatedTotalSIze();
loadCacheSize();
});
}); });
} }
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
@ -582,7 +597,18 @@ public class DataSettingsActivity extends BaseFragment {
); );
textCell.setTextAndValueAndColorfulIcon(LocaleController.getString("NetworkUsage", R.string.NetworkUsage), AndroidUtilities.formatFileSize(size), true, R.drawable.msg_filled_datausage, getThemedColor(Theme.key_color_green), storageNumRow != -1); textCell.setTextAndValueAndColorfulIcon(LocaleController.getString("NetworkUsage", R.string.NetworkUsage), AndroidUtilities.formatFileSize(size), true, R.drawable.msg_filled_datausage, getThemedColor(Theme.key_color_green), storageNumRow != -1);
} else if (position == storageNumRow) { } else if (position == storageNumRow) {
textCell.setTextAndColorfulIcon(LocaleController.getString("StoragePath", R.string.StoragePath), R.drawable.msg_filled_sdcard, getThemedColor(Theme.key_color_yellow), false); String dir = storageDirs.get(0).getAbsolutePath();
if (!TextUtils.isEmpty(SharedConfig.storageCacheDir)) {
for (int a = 0, N = storageDirs.size(); a < N; a++) {
String path = storageDirs.get(a).getAbsolutePath();
if (path.startsWith(SharedConfig.storageCacheDir)) {
dir = path;
break;
}
}
}
final String value = dir == null || dir.contains("/storage/emulated/") ? LocaleController.getString("InternalStorage", R.string.InternalStorage) : LocaleController.getString("SdCard", R.string.SdCard);
textCell.setTextAndValueAndColorfulIcon(LocaleController.getString("StoragePath", R.string.StoragePath), value, true, R.drawable.msg_filled_sdcard, getThemedColor(Theme.key_color_yellow), false);
} }
break; break;
} }

View File

@ -43,6 +43,7 @@ import androidx.recyclerview.widget.RecyclerView;
import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ChatObject; import org.telegram.messenger.ChatObject;
import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.LocaleController; import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MemberRequestsController; import org.telegram.messenger.MemberRequestsController;
import org.telegram.messenger.MessagesController; import org.telegram.messenger.MessagesController;
@ -777,8 +778,19 @@ public class MemberRequestsDelegate implements MemberRequestCell.OnClickListener
public void setImporter(TLRPC.TL_chatInviteImporter importer, BackupImageView imageView) { public void setImporter(TLRPC.TL_chatInviteImporter importer, BackupImageView imageView) {
this.importer = importer; this.importer = importer;
this.imageView = imageView; this.imageView = imageView;
final ImageLocation imageLocation;
final ImageLocation thumbLocation;
TLRPC.User currentUser = MessagesController.getInstance(currentAccount).getUser(importer.user_id);
imageLocation = ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_BIG);
thumbLocation = ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_SMALL);
final TLRPC.UserFull userFull = MessagesController.getInstance(currentAccount).getUserFull(importer.user_id);
if (userFull == null) {
MessagesController.getInstance(currentAccount).loadUserInfo(currentUser, false, 0);
}
viewPager.setParentAvatarImage(imageView); viewPager.setParentAvatarImage(imageView);
viewPager.setData(importer.user_id, true); viewPager.setData(importer.user_id, true);
viewPager.initIfEmpty(null, imageLocation, thumbLocation, true);
TLRPC.User user = users.get(importer.user_id); TLRPC.User user = users.get(importer.user_id);
nameText.setText(UserObject.getUserName(user)); nameText.setText(UserObject.getUserName(user));
bioText.setText(importer.about); bioText.setText(importer.about);

View File

@ -8824,6 +8824,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
} else if (id == NotificationCenter.onDatabaseReset) { } else if (id == NotificationCenter.onDatabaseReset) {
dialogsLoaded[currentAccount] = false; dialogsLoaded[currentAccount] = false;
loadDialogs(getAccountInstance()); loadDialogs(getAccountInstance());
getMessagesController().loadPinnedDialogs(folderId, 0, null);
} }
} }

View File

@ -742,7 +742,7 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.requestPermissions); NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.requestPermissions);
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.currentUserPremiumStatusChanged); NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.currentUserPremiumStatusChanged);
LiteMode.addOnPowerSaverAppliedListener(this::onPowerSaver); LiteMode.addOnPowerSaverAppliedListener(this::onPowerSaver);
if (actionBarLayout.getFragmentStack().isEmpty()) { if (actionBarLayout.getFragmentStack().isEmpty() && (layersActionBarLayout == null || layersActionBarLayout.getFragmentStack().isEmpty())) {
if (!UserConfig.getInstance(currentAccount).isClientActivated()) { if (!UserConfig.getInstance(currentAccount).isClientActivated()) {
actionBarLayout.addFragmentToStack(getClientNotActivatedFragment()); actionBarLayout.addFragmentToStack(getClientNotActivatedFragment());
drawerLayoutContainer.setAllowOpenDrawer(false, false); drawerLayoutContainer.setAllowOpenDrawer(false, false);
@ -811,7 +811,7 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
FileLog.e(e); FileLog.e(e);
} }
} else { } else {
BaseFragment fragment = actionBarLayout.getFragmentStack().get(0); BaseFragment fragment = actionBarLayout.getFragmentStack().size() > 0 ? actionBarLayout.getFragmentStack().get(0) : layersActionBarLayout.getFragmentStack().get(0);
if (fragment instanceof DialogsActivity) { if (fragment instanceof DialogsActivity) {
((DialogsActivity) fragment).setSideMenu(sideMenu); ((DialogsActivity) fragment).setSideMenu(sideMenu);
} }
@ -1410,14 +1410,17 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
if (!AndroidUtilities.isInMultiwindow && (!AndroidUtilities.isSmallTablet() || getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)) { if (!AndroidUtilities.isInMultiwindow && (!AndroidUtilities.isSmallTablet() || getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)) {
tabletFullSize = false; tabletFullSize = false;
if (actionBarLayout.getFragmentStack().size() >= 2) { List<BaseFragment> fragmentStack = actionBarLayout.getFragmentStack();
for (int a = 1; a < actionBarLayout.getFragmentStack().size(); a++) { if (fragmentStack.size() >= 2) {
BaseFragment chatFragment = actionBarLayout.getFragmentStack().get(a); for (int a = 1; a < fragmentStack.size(); a++) {
BaseFragment chatFragment = fragmentStack.get(a);
if (chatFragment instanceof ChatActivity) { if (chatFragment instanceof ChatActivity) {
((ChatActivity) chatFragment).setIgnoreAttachOnPause(true); ((ChatActivity) chatFragment).setIgnoreAttachOnPause(true);
} }
chatFragment.onPause(); chatFragment.onPause();
actionBarLayout.removeFragmentFromStack(a); chatFragment.onFragmentDestroy();
chatFragment.setParentLayout(null);
fragmentStack.remove(chatFragment);
rightActionBarLayout.addFragmentToStack(chatFragment); rightActionBarLayout.addFragmentToStack(chatFragment);
a--; a--;
} }
@ -1431,14 +1434,17 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
shadowTabletSide.setVisibility(!actionBarLayout.getFragmentStack().isEmpty() ? View.VISIBLE : View.GONE); shadowTabletSide.setVisibility(!actionBarLayout.getFragmentStack().isEmpty() ? View.VISIBLE : View.GONE);
} else { } else {
tabletFullSize = true; tabletFullSize = true;
if (!rightActionBarLayout.getFragmentStack().isEmpty()) { List<BaseFragment> fragmentStack = rightActionBarLayout.getFragmentStack();
for (int a = 0; a < rightActionBarLayout.getFragmentStack().size(); a++) { if (!fragmentStack.isEmpty()) {
BaseFragment chatFragment = rightActionBarLayout.getFragmentStack().get(a); for (int a = 0; a < fragmentStack.size(); a++) {
BaseFragment chatFragment = fragmentStack.get(a);
if (chatFragment instanceof ChatActivity) { if (chatFragment instanceof ChatActivity) {
((ChatActivity) chatFragment).setIgnoreAttachOnPause(true); ((ChatActivity) chatFragment).setIgnoreAttachOnPause(true);
} }
chatFragment.onPause(); chatFragment.onPause();
rightActionBarLayout.removeFragmentFromStack(a); chatFragment.onFragmentDestroy();
chatFragment.setParentLayout(null);
fragmentStack.remove(chatFragment);
actionBarLayout.addFragmentToStack(chatFragment); actionBarLayout.addFragmentToStack(chatFragment);
a--; a--;
} }

View File

@ -434,15 +434,7 @@ public class LinkEditActivity extends BaseFragment {
@Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { }
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
SpannableStringBuilder builder = new SpannableStringBuilder(s); Emoji.replaceEmoji(s, nameEditText.getPaint().getFontMetricsInt(), (int) nameEditText.getPaint().getTextSize(), false);
Emoji.replaceEmoji(builder, nameEditText.getPaint().getFontMetricsInt(), (int) nameEditText.getPaint().getTextSize(), false);
int selection = nameEditText.getSelectionStart();
nameEditText.removeTextChangedListener(this);
nameEditText.setText(builder);
if (selection >= 0) {
nameEditText.setSelection(selection);
}
nameEditText.addTextChangedListener(this);
} }
}); });
nameEditText.setCursorVisible(false); nameEditText.setCursorVisible(false);

View File

@ -1,7 +1,6 @@
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.AndroidUtilities.dpf2;
import android.animation.Animator; import android.animation.Animator;
import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorListenerAdapter;
@ -10,17 +9,11 @@ import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PixelFormat;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter; import android.graphics.PorterDuffColorFilter;
import android.graphics.RectF;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.text.SpannableString; import android.os.Bundle;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
import android.text.Spanned; import android.text.Spanned;
import android.text.TextUtils; import android.text.TextUtils;
@ -31,6 +24,7 @@ import android.view.Gravity;
import android.view.HapticFeedbackConstants; import android.view.HapticFeedbackConstants;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
@ -44,9 +38,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.extractor.mkv.MatroskaExtractor;
import com.google.zxing.common.detector.MathUtils;
import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.LiteMode; import org.telegram.messenger.LiteMode;
import org.telegram.messenger.LocaleController; import org.telegram.messenger.LocaleController;
@ -59,7 +50,6 @@ import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.Cells.HeaderCell; import org.telegram.ui.Cells.HeaderCell;
import org.telegram.ui.Cells.TextCell; import org.telegram.ui.Cells.TextCell;
import org.telegram.ui.Cells.TextCheckCell;
import org.telegram.ui.Cells.TextInfoPrivacyCell; import org.telegram.ui.Cells.TextInfoPrivacyCell;
import org.telegram.ui.Components.AnimatedEmojiDrawable; import org.telegram.ui.Components.AnimatedEmojiDrawable;
import org.telegram.ui.Components.AnimatedTextView; import org.telegram.ui.Components.AnimatedTextView;
@ -68,17 +58,15 @@ import org.telegram.ui.Components.Bulletin;
import org.telegram.ui.Components.BulletinFactory; import org.telegram.ui.Components.BulletinFactory;
import org.telegram.ui.Components.CheckBox2; import org.telegram.ui.Components.CheckBox2;
import org.telegram.ui.Components.CubicBezierInterpolator; import org.telegram.ui.Components.CubicBezierInterpolator;
import org.telegram.ui.Components.IntSeekBarAccessibilityDelegate;
import org.telegram.ui.Components.LayoutHelper; import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.Components.ListView.AdapterWithDiffUtils; import org.telegram.ui.Components.ListView.AdapterWithDiffUtils;
import org.telegram.ui.Components.RecyclerListView; import org.telegram.ui.Components.RecyclerListView;
import org.telegram.ui.Components.SeekBarAccessibilityDelegate;
import org.telegram.ui.Components.SeekBarView; import org.telegram.ui.Components.SeekBarView;
import org.telegram.ui.Components.SlideChooseView;
import org.telegram.ui.Components.SlideView;
import org.telegram.ui.Components.SpannableStringLight;
import org.telegram.ui.Components.Switch; import org.telegram.ui.Components.Switch;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Locale;
public class LiteModeSettingsActivity extends BaseFragment { public class LiteModeSettingsActivity extends BaseFragment {
@ -223,7 +211,7 @@ public class LiteModeSettingsActivity extends BaseFragment {
items.add(Item.asCheckbox(LocaleController.getString("LiteOptionsBackground"), LiteMode.FLAG_CHAT_BACKGROUND)); items.add(Item.asCheckbox(LocaleController.getString("LiteOptionsBackground"), LiteMode.FLAG_CHAT_BACKGROUND));
items.add(Item.asCheckbox(LocaleController.getString("LiteOptionsTopics"), LiteMode.FLAG_CHAT_FORUM_TWOCOLUMN)); items.add(Item.asCheckbox(LocaleController.getString("LiteOptionsTopics"), LiteMode.FLAG_CHAT_FORUM_TWOCOLUMN));
items.add(Item.asCheckbox(LocaleController.getString("LiteOptionsSpoiler"), LiteMode.FLAG_CHAT_SPOILER)); items.add(Item.asCheckbox(LocaleController.getString("LiteOptionsSpoiler"), LiteMode.FLAG_CHAT_SPOILER));
if (SharedConfig.canBlurChat()) { if (SharedConfig.getDevicePerformanceClass() >= SharedConfig.PERFORMANCE_CLASS_AVERAGE) {
items.add(Item.asCheckbox(LocaleController.getString("LiteOptionsBlur"), LiteMode.FLAG_CHAT_BLUR)); items.add(Item.asCheckbox(LocaleController.getString("LiteOptionsBlur"), LiteMode.FLAG_CHAT_BLUR));
} }
items.add(Item.asCheckbox(LocaleController.getString("LiteOptionsScale"), LiteMode.FLAG_CHAT_SCALE)); items.add(Item.asCheckbox(LocaleController.getString("LiteOptionsScale"), LiteMode.FLAG_CHAT_SCALE));
@ -309,7 +297,22 @@ public class LiteModeSettingsActivity extends BaseFragment {
view = powerSaverSlider; view = powerSaverSlider;
view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
} else if (viewType == VIEW_TYPE_INFO) { } else if (viewType == VIEW_TYPE_INFO) {
view = new TextInfoPrivacyCell(context); view = new TextInfoPrivacyCell(context) {
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
info.setEnabled(true);
}
@Override
public void onPopulateAccessibilityEvent(AccessibilityEvent event) {
super.onPopulateAccessibilityEvent(event);
event.setContentDescription(getTextView().getText());
setContentDescription(getTextView().getText());
}
};
} else if (viewType == VIEW_TYPE_SWITCH || viewType == VIEW_TYPE_CHECKBOX) { } else if (viewType == VIEW_TYPE_SWITCH || viewType == VIEW_TYPE_CHECKBOX) {
view = new SwitchCell(context); view = new SwitchCell(context);
} else if (viewType == VIEW_TYPE_SWITCH2) { } else if (viewType == VIEW_TYPE_SWITCH2) {
@ -342,6 +345,7 @@ public class LiteModeSettingsActivity extends BaseFragment {
textInfoPrivacyCell.setFixedSize(0); textInfoPrivacyCell.setFixedSize(0);
} }
textInfoPrivacyCell.setText(item.text); textInfoPrivacyCell.setText(item.text);
textInfoPrivacyCell.setContentDescription(item.text);
boolean top = position > 0 && items.get(position - 1).viewType != VIEW_TYPE_INFO; boolean top = position > 0 && items.get(position - 1).viewType != VIEW_TYPE_INFO;
boolean bottom = position + 1 < items.size() && items.get(position + 1).viewType != VIEW_TYPE_INFO; boolean bottom = position + 1 < items.size() && items.get(position + 1).viewType != VIEW_TYPE_INFO;
if (top && bottom) { if (top && bottom) {
@ -401,6 +405,7 @@ public class LiteModeSettingsActivity extends BaseFragment {
public SwitchCell(Context context) { public SwitchCell(Context context) {
super(context); super(context);
setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
imageView = new ImageView(context); imageView = new ImageView(context);
@ -423,12 +428,14 @@ public class LiteModeSettingsActivity extends BaseFragment {
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
textView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
countTextView = new AnimatedTextView(context, false, true, true); countTextView = new AnimatedTextView(context, false, true, true);
countTextView.setAnimationProperties(.35f, 0, 200, CubicBezierInterpolator.EASE_OUT_QUINT); countTextView.setAnimationProperties(.35f, 0, 200, CubicBezierInterpolator.EASE_OUT_QUINT);
countTextView.setTypeface(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM)); countTextView.setTypeface(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM));
countTextView.setTextSize(dp(14)); countTextView.setTextSize(dp(14));
countTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); countTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
countTextView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
arrowView = new ImageView(context); arrowView = new ImageView(context);
arrowView.setVisibility(GONE); arrowView.setVisibility(GONE);
@ -452,6 +459,7 @@ public class LiteModeSettingsActivity extends BaseFragment {
switchView = new Switch(context); switchView = new Switch(context);
switchView.setVisibility(GONE); switchView.setVisibility(GONE);
switchView.setColors(Theme.key_switchTrack, Theme.key_switchTrackChecked, Theme.key_windowBackgroundWhite, Theme.key_windowBackgroundWhite); switchView.setColors(Theme.key_switchTrack, Theme.key_switchTrackChecked, Theme.key_windowBackgroundWhite, Theme.key_windowBackgroundWhite);
switchView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
addView(switchView, LayoutHelper.createFrame(37, 50, Gravity.CENTER_VERTICAL | (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT), 19, 0, 19, 0)); addView(switchView, LayoutHelper.createFrame(37, 50, Gravity.CENTER_VERTICAL | (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT), 19, 0, 19, 0));
checkBoxView = new CheckBox2(context, 21); checkBoxView = new CheckBox2(context, 21);
@ -460,6 +468,7 @@ public class LiteModeSettingsActivity extends BaseFragment {
checkBoxView.setChecked(true, false); checkBoxView.setChecked(true, false);
checkBoxView.setDrawBackgroundAsArc(10); checkBoxView.setDrawBackgroundAsArc(10);
checkBoxView.setVisibility(GONE); checkBoxView.setVisibility(GONE);
checkBoxView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
addView(checkBoxView, LayoutHelper.createFrame(21, 21, Gravity.CENTER_VERTICAL | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT), LocaleController.isRTL ? 0 : 64, 0, LocaleController.isRTL ? 64 : 0, 0)); addView(checkBoxView, LayoutHelper.createFrame(21, 21, Gravity.CENTER_VERTICAL | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT), LocaleController.isRTL ? 0 : 64, 0, LocaleController.isRTL ? 64 : 0, 0));
setFocusable(true); setFocusable(true);
@ -555,11 +564,24 @@ public class LiteModeSettingsActivity extends BaseFragment {
} }
private int preprocessFlagsCount(int flags) { private int preprocessFlagsCount(int flags) {
boolean isPremium = getUserConfig().isPremium();
int count = Integer.bitCount(flags); int count = Integer.bitCount(flags);
count += ((flags & LiteMode.FLAG_ANIMATED_EMOJI_CHAT_NOT_PREMIUM) > 0 ? -1 : 0) + ((flags & LiteMode.FLAG_ANIMATED_EMOJI_CHAT_PREMIUM) > 0 ? -1 : 0) + ((flags & LiteMode.FLAG_ANIMATED_EMOJI_CHAT) > 0 ? +1 : 0); if (isPremium) {
count += ((flags & LiteMode.FLAG_ANIMATED_EMOJI_REACTIONS_NOT_PREMIUM) > 0 ? -1 : 0) + ((flags & LiteMode.FLAG_ANIMATED_EMOJI_REACTIONS_PREMIUM) > 0 ? -1 : 0) + ((flags & LiteMode.FLAG_ANIMATED_EMOJI_REACTIONS) > 0 ? +1 : 0); if ((flags & LiteMode.FLAG_ANIMATED_EMOJI_CHAT_NOT_PREMIUM) > 0)
count += ((flags & LiteMode.FLAG_ANIMATED_EMOJI_KEYBOARD_NOT_PREMIUM) > 0 ? -1 : 0) + ((flags & LiteMode.FLAG_ANIMATED_EMOJI_KEYBOARD_PREMIUM) > 0 ? -1 : 0) + ((flags & LiteMode.FLAG_ANIMATED_EMOJI_KEYBOARD) > 0 ? +1 : 0); count--;
if (!SharedConfig.canBlurChat() && (flags & LiteMode.FLAG_CHAT_BLUR) > 0) { if ((flags & LiteMode.FLAG_ANIMATED_EMOJI_REACTIONS_NOT_PREMIUM) > 0)
count--;
if ((flags & LiteMode.FLAG_ANIMATED_EMOJI_KEYBOARD_NOT_PREMIUM) > 0)
count--;
} else {
if ((flags & LiteMode.FLAG_ANIMATED_EMOJI_CHAT_PREMIUM) > 0)
count--;
if ((flags & LiteMode.FLAG_ANIMATED_EMOJI_REACTIONS_PREMIUM) > 0)
count--;
if ((flags & LiteMode.FLAG_ANIMATED_EMOJI_KEYBOARD_PREMIUM) > 0)
count--;
}
if (SharedConfig.getDevicePerformanceClass() < SharedConfig.PERFORMANCE_CLASS_AVERAGE && (flags & LiteMode.FLAG_CHAT_BLUR) > 0) {
count--; count--;
} }
return count; return count;
@ -590,8 +612,9 @@ public class LiteModeSettingsActivity extends BaseFragment {
@Override @Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info); super.onInitializeAccessibilityNodeInfo(info);
info.setClassName("android.widget.Switch"); info.setClassName(checkBoxView.getVisibility() == View.VISIBLE ? "android.widget.CheckBox" : "android.widget.Switch");
info.setCheckable(true); info.setCheckable(true);
info.setEnabled(true);
if (checkBoxView.getVisibility() == View.VISIBLE) { if (checkBoxView.getVisibility() == View.VISIBLE) {
info.setChecked(checkBoxView.isChecked()); info.setChecked(checkBoxView.isChecked());
} else { } else {
@ -621,11 +644,14 @@ public class LiteModeSettingsActivity extends BaseFragment {
TextView rightTextView; TextView rightTextView;
SeekBarView seekBarView; SeekBarView seekBarView;
private SeekBarAccessibilityDelegate seekBarAccessibilityDelegate;
public PowerSaverSlider(Context context) { public PowerSaverSlider(Context context) {
super(context); super(context);
headerLayout = new LinearLayout(context); headerLayout = new LinearLayout(context);
headerLayout.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); headerLayout.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
headerLayout.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);
headerTextView = new TextView(context); headerTextView = new TextView(context);
headerTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15); headerTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
@ -680,9 +706,11 @@ public class LiteModeSettingsActivity extends BaseFragment {
} }
}); });
seekBarView.setProgress(LiteMode.getPowerSaverLevel() / 100F); seekBarView.setProgress(LiteMode.getPowerSaverLevel() / 100F);
seekBarView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
addView(seekBarView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 38 + 6, Gravity.TOP, 6, 68, 6, 0)); addView(seekBarView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 38 + 6, Gravity.TOP, 6, 68, 6, 0));
valuesView = new FrameLayout(context); valuesView = new FrameLayout(context);
valuesView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);
leftTextView = new TextView(context); leftTextView = new TextView(context);
leftTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13); leftTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
@ -725,9 +753,76 @@ public class LiteModeSettingsActivity extends BaseFragment {
addView(valuesView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.FILL_HORIZONTAL, 21, 52, 21, 0)); addView(valuesView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.FILL_HORIZONTAL, 21, 52, 21, 0));
seekBarAccessibilityDelegate = new IntSeekBarAccessibilityDelegate() {
@Override
protected int getProgress() {
return LiteMode.getPowerSaverLevel();
}
@Override
protected void setProgress(int progress) {
seekBarView.delegate.onSeekBarDrag(true, progress / 100f);
seekBarView.setProgress(progress / 100f);
}
@Override
protected int getMaxValue() {
return 100;
}
@Override
protected int getDelta() {
return 5;
}
@Override
public void onInitializeAccessibilityNodeInfoInternal(View host, AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfoInternal(host, info);
info.setEnabled(true);
}
@Override
public void onPopulateAccessibilityEvent(@NonNull View host, @NonNull AccessibilityEvent event) {
super.onPopulateAccessibilityEvent(host, event);
StringBuilder sb = new StringBuilder(LocaleController.getString(R.string.LiteBatteryTitle)).append(", ");
int percent = LiteMode.getPowerSaverLevel();
if (percent <= 0) {
sb.append(LocaleController.getString(R.string.LiteBatteryAlwaysDisabled));
} else if (percent >= 100) {
sb.append(LocaleController.getString(R.string.LiteBatteryAlwaysEnabled));
} else {
sb.append(LocaleController.formatString(R.string.AccDescrLiteBatteryWhenBelow, Math.round(percent)));
}
event.setContentDescription(sb);
setContentDescription(sb);
}
};
update(); update();
} }
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
seekBarAccessibilityDelegate.onInitializeAccessibilityNodeInfo(this, info);
}
@Override
public void onPopulateAccessibilityEvent(AccessibilityEvent event) {
super.onPopulateAccessibilityEvent(event);
seekBarAccessibilityDelegate.onPopulateAccessibilityEvent(this, event);
}
@Override
public boolean performAccessibilityAction(int action, @Nullable Bundle arguments) {
return seekBarAccessibilityDelegate.performAccessibilityAction(this, action, arguments);
}
public void update() { public void update() {
final int percent = LiteMode.getPowerSaverLevel(); final int percent = LiteMode.getPowerSaverLevel();

View File

@ -2565,12 +2565,11 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
} }
@Override @Override
public void finishFragment(boolean animated) { public boolean finishFragment(boolean animated) {
if (onCheckGlScreenshot()) { if (onCheckGlScreenshot()) {
return; return false;
} }
return super.finishFragment(animated);
super.finishFragment(animated);
} }
private boolean onCheckGlScreenshot() { private boolean onCheckGlScreenshot() {

View File

@ -201,6 +201,7 @@ import org.telegram.ui.Components.CubicBezierInterpolator;
import org.telegram.ui.Components.FadingTextViewLayout; import org.telegram.ui.Components.FadingTextViewLayout;
import org.telegram.ui.Components.FilterShaders; import org.telegram.ui.Components.FilterShaders;
import org.telegram.ui.Components.FloatSeekBarAccessibilityDelegate; import org.telegram.ui.Components.FloatSeekBarAccessibilityDelegate;
import org.telegram.ui.Components.Forum.ForumUtilities;
import org.telegram.ui.Components.GestureDetector2; import org.telegram.ui.Components.GestureDetector2;
import org.telegram.ui.Components.GroupedPhotosListView; import org.telegram.ui.Components.GroupedPhotosListView;
import org.telegram.ui.Components.HideViewAfterAnimation; import org.telegram.ui.Components.HideViewAfterAnimation;
@ -4368,6 +4369,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
} else { } else {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putBoolean("onlySelect", true); args.putBoolean("onlySelect", true);
args.putBoolean("canSelectTopics", true);
args.putInt("dialogsType", DialogsActivity.DIALOGS_TYPE_FORWARD); args.putInt("dialogsType", DialogsActivity.DIALOGS_TYPE_FORWARD);
DialogsActivity fragment = new DialogsActivity(args); DialogsActivity fragment = new DialogsActivity(args);
final ArrayList<MessageObject> fmessages = new ArrayList<>(); final ArrayList<MessageObject> fmessages = new ArrayList<>();
@ -4394,7 +4396,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
} }
} }
} else { } else {
long did = dids.get(0).dialogId; MessagesStorage.TopicKey topicKey = dids.get(0);
long did = topicKey.dialogId;
Bundle args1 = new Bundle(); Bundle args1 = new Bundle();
args1.putBoolean("scrollToTopOnResume", true); args1.putBoolean("scrollToTopOnResume", true);
if (DialogObject.isEncryptedDialog(did)) { if (DialogObject.isEncryptedDialog(did)) {
@ -4404,8 +4407,10 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
} else { } else {
args1.putLong("chat_id", -did); args1.putLong("chat_id", -did);
} }
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.closeChats);
ChatActivity chatActivity = new ChatActivity(args1); ChatActivity chatActivity = new ChatActivity(args1);
if (topicKey.topicId != 0) {
ForumUtilities.applyTopic(chatActivity, topicKey);
}
if (((LaunchActivity) parentActivity).presentFragment(chatActivity, true, false)) { if (((LaunchActivity) parentActivity).presentFragment(chatActivity, true, false)) {
chatActivity.showFieldPanelForForward(true, fmessages); chatActivity.showFieldPanelForForward(true, fmessages);
} else { } else {
@ -16666,7 +16671,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
if (animationStartTime != 0 || animationInProgress != 0) { if (animationStartTime != 0 || animationInProgress != 0) {
return false; return false;
} }
if (Math.sqrt(Math.pow(AndroidUtilities.displaySize.x / 2f - e.getX(), 2) + Math.pow((AndroidUtilities.displaySize.y + AndroidUtilities.statusBarHeight) / 2f - e.getY(), 2)) < AndroidUtilities.dp(40)) { if (photoProgressViews[0] != null && photoProgressViews[0].isVisible() && photoProgressViews[0].backgroundState != PROGRESS_NONE && Math.sqrt(Math.pow(AndroidUtilities.displaySize.x / 2f - e.getX(), 2) + Math.pow((AndroidUtilities.displaySize.y + AndroidUtilities.statusBarHeight) / 2f - e.getY(), 2)) < AndroidUtilities.dp(40)) {
return false; // play button return false; // play button
} }
if (scale == 1.0f) { if (scale == 1.0f) {

View File

@ -3558,7 +3558,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
showDialog(builder.create()); showDialog(builder.create());
} else { } else {
try { try {
Toast.makeText(getParentActivity(), "¯\\_(ツ)_/¯", Toast.LENGTH_SHORT).show(); Toast.makeText(getParentActivity(), LocaleController.getString("DebugMenuLongPress", R.string.DebugMenuLongPress), Toast.LENGTH_SHORT).show();
} catch (Exception e) { } catch (Exception e) {
FileLog.e(e); FileLog.e(e);
} }

View File

@ -2970,7 +2970,7 @@ public class TopicsFragment extends BaseFragment implements NotificationCenter.N
} else if (topic != null && topic.icon_emoji_id != 0) { } else if (topic != null && topic.icon_emoji_id != 0) {
setForumIcon(null); setForumIcon(null);
if (animatedEmojiDrawable == null || animatedEmojiDrawable.getDocumentId() != topic.icon_emoji_id) { if (animatedEmojiDrawable == null || animatedEmojiDrawable.getDocumentId() != topic.icon_emoji_id) {
setAnimatedEmojiDrawable(new AnimatedEmojiDrawable(AnimatedEmojiDrawable.CACHE_TYPE_FORUM_TOPIC, currentAccount, topic.icon_emoji_id)); setAnimatedEmojiDrawable(new AnimatedEmojiDrawable(openedForForward ? AnimatedEmojiDrawable.CACHE_TYPE_ALERT_PREVIEW_STATIC : AnimatedEmojiDrawable.CACHE_TYPE_FORUM_TOPIC, currentAccount, topic.icon_emoji_id));
} }
} else { } else {
setAnimatedEmojiDrawable(null); setAnimatedEmojiDrawable(null);

View File

@ -2154,14 +2154,14 @@ public class TwoStepVerificationSetupActivity extends BaseFragment {
} }
@Override @Override
public void finishFragment(boolean animated) { public boolean finishFragment(boolean animated) {
for (BaseFragment fragment : getParentLayout().getFragmentStack()) { for (BaseFragment fragment : getParentLayout().getFragmentStack()) {
if (fragment != this && fragment instanceof TwoStepVerificationSetupActivity) { if (fragment != this && fragment instanceof TwoStepVerificationSetupActivity) {
((TwoStepVerificationSetupActivity) fragment).floatingAutoAnimator.ignoreNextLayout(); ((TwoStepVerificationSetupActivity) fragment).floatingAutoAnimator.ignoreNextLayout();
} }
} }
super.finishFragment(animated); return super.finishFragment(animated);
} }
private void showSetForcePasswordAlert() { private void showSetForcePasswordAlert() {

View File

@ -542,6 +542,7 @@
<string name="ChannelJoinTo">Do you want to join the channel \'%1$s\'?</string> <string name="ChannelJoinTo">Do you want to join the channel \'%1$s\'?</string>
<string name="ChannelCantOpenPrivate">Sorry, this channel is private, so you cant view its content.</string> <string name="ChannelCantOpenPrivate">Sorry, this channel is private, so you cant view its content.</string>
<string name="ChannelCantOpenPrivate2">Sorry, this channel is private.</string> <string name="ChannelCantOpenPrivate2">Sorry, this channel is private.</string>
<string name="ChannelCantOpenBannedByAdminTitle">Can\'t access the chat</string>
<string name="ChannelCantOpenBannedByAdmin">Sorry, you can\'t access this chat because you were banned by an admin.</string> <string name="ChannelCantOpenBannedByAdmin">Sorry, you can\'t access this chat because you were banned by an admin.</string>
<string name="ChannelCantOpenBanned">Unfortunately, you were banned from participating in public groups.</string> <string name="ChannelCantOpenBanned">Unfortunately, you were banned from participating in public groups.</string>
<string name="ChannelCantOpenNa">Sorry, this chat is no longer accessible.</string> <string name="ChannelCantOpenNa">Sorry, this chat is no longer accessible.</string>
@ -2346,6 +2347,7 @@
<string name="EmojiUseDefault">Use system default emoji</string> <string name="EmojiUseDefault">Use system default emoji</string>
<string name="TelegramVersion">Telegram for Android %1$s</string> <string name="TelegramVersion">Telegram for Android %1$s</string>
<string name="DebugMenu">Debug Menu</string> <string name="DebugMenu">Debug Menu</string>
<string name="DebugMenuLongPress">Long press again for debug menu</string>
<string name="DebugSendLogs">Send Logs</string> <string name="DebugSendLogs">Send Logs</string>
<string name="DebugSendLastLogs">Send Last Logs</string> <string name="DebugSendLastLogs">Send Last Logs</string>
<string name="DebugClearLogs">Clear Logs</string> <string name="DebugClearLogs">Clear Logs</string>
@ -6350,4 +6352,10 @@
<string name="ChannelInviteViaLinkRestricted">You can\'t create a link</string> <string name="ChannelInviteViaLinkRestricted">You can\'t create a link</string>
<string name="ChannelInviteViaLinkRestricted2">This user can\'t be invited</string> <string name="ChannelInviteViaLinkRestricted2">This user can\'t be invited</string>
<string name="ChannelInviteViaLinkRestricted3">This users can\'t be invited</string> <string name="ChannelInviteViaLinkRestricted3">This users can\'t be invited</string>
<string name="StoragePathFree">%1$s free</string>
<string name="StoragePathFreeValue">%1$s free, %2$s</string>
<string name="AccDescrLiteBatteryWhenBelow">enabled when below %s%%</string>
<string name="AccDescrLiteBatteryLevelAnnounce">%s%%</string>
<string name="AccDescrRateTranscriptionUp">Rate up</string>
<string name="AccDescrRateTranscriptionDown">Rate down</string>
</resources> </resources>

View File

@ -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=3199 APP_VERSION_CODE=3208
APP_VERSION_NAME=9.5.1 APP_VERSION_NAME=9.5.2
APP_PACKAGE=org.telegram.messenger APP_PACKAGE=org.telegram.messenger
RELEASE_KEY_PASSWORD=android RELEASE_KEY_PASSWORD=android
RELEASE_KEY_ALIAS=androidkey RELEASE_KEY_ALIAS=androidkey